Tuesday, October 30, 2007


I saw some lame TV show (guess where) about how they "caught" some Internet cracker who stole some "sensitive information" or something. Of course, he can't be extradited from Argentina or wherever he lives to the US, even though they have a warrant for his "misuse of a computer" (LOL), because well, "ha-ha". The funniest part is how they "caught" him, I mean, found his identity: he boasted in some chat room, and then the investigators used "powerful Internet tools, called Internet search engines" to look up his alias or something, and then found his posts on some forum. Hell yeah. I remember when I was in high school in the computer lab and bored to death and the admins or however they were called left some passwd file on public ftp, which I of course opened, because it was public, unrestricted, unprotected and even without a notice stating that I am not allowed to "go there". I later learned that I had misused the computer, as the admin came steaming into the computer lab, IP logged and matched and all - "Did you look into the passwd from this computer?" "Yes." "You're not allowed to do that." "Really?" Of course, being public, open internet-accessible ftp and all, I took the liberty of downloading it all from outside the building without the guy lecturing me about what bits I am allowed and prohibited from sending into his network port. This happened some days later, and the files still had not been removed from public view. I vaguely remember also finding some winDOS .pwl files (oh, the old times) which, unless fake, were indeed crackable, unlike the passwd which contained no actual password hashes. And now I'm wondering, was that some kind of honeypot or plain stupidity?

Sunday, October 28, 2007


Having cooled down after the spontaneous daylight savings ranting, I am now ready to rant about my original intention.
Just like that idiot William Willet, who was a philologist / builder, and should have had nothing to do with time, some people think they can somehow transcend science and push bold ideas such as black and white not being colors. Some of my art teachers in school did this. Fuck art. Art is spontaneous and creative, it's not something you teach. If I want to paint red next to green next to blue next to dark gray because I feel so, you don't have to come and tell me it's wrong and the colors don't match and it has a weird, heavy feeling. Maybe that's what I want it to be. Oh, and I also don't care about anything. I remember when I was in childrengarden (sic), and the teacher made us paint some stuff on a sheet of A4 paper. Each one's sh[i|ee]t was then posted on a huge panel for public display, and they were all sorted according to 'value'. Mine was of course last, because it consisted of an entirely black sheet. To this day, I take great pride in the fact that my sheet was displayed last. That was true, innocent, creative, art. I had never heard of postmodernism, heavy metal or anything, I was just a 3-year old kid who painted a black picture. But that's not all. The philosophy behind my black, flimsy piece of paper is much deeper than this. I initially started to paint what everybody was painting: some stick people, grass, flowers, sun etc. Then I admired my complex work and thought: this is wrong. I took the tube of black paint and blackened it all. It looked much better. It was remarkable. And it couldn't have had a better place on the display board. I am still PROUD. :)
Some years passed and school started. And of course, we had art class. We had to paint stuff that strictly followed some given form. Of course, it had a point, it taught you basic elements of painting, but it was far from stimulating creativity. At one time we had a teacher that gave us the option of using a computer to generate some drawings instead of messing with paint. That was way cool and progressive, and I didn't fully realize it at that time.
But anyway, some people insist that black and white are not colors. Well. They might have a point, but not a strong one. There are only two disciplines that can rightfully tell whether or not something is a color, and those are physics and biology. As you can see, whatever-art-whatever is not among them. Unless of course, one takes the liberty of defining color however they please. Certainly, one can be high on LSD and taste orange and smell blue, but that's an exception, as are the cases of people who naturally do that.
So, to explain why black and white ARE colors, regardless of what some might assert, let's start with a definition. Color is visual perception that can be classified in red, orange, yellow, green, blue, violet and a lot of other names depending on how precise one wants to be. The other visual parameter would probably be brightness, which is a little easier to define: the intensity of perception, which is of course directly related to the intensity of the stimulus, light. A comparison beetwen light and sound, and between sight and hearing is useful in showing why all colors are colors. Both light and sound are waves and their natural properties are frequency, or how fast they vibrate, and amplitude, or how strong they are. We'll use intensity instead of amplitude. Any sound or light wave can be thought of as a sum of elementary waves of various frequencies and intensities. This mathematical decomposition is called the spectrum. It can be drawn as a graph that shows how strong each frequency is within a complex wave. So slowly vibrating air gives a low-pitched sound, while rapidly vibrating air gives a high-pitched one. If air is vibrating both slowly and rapidly, you hear both pitches. Yeah, it can do that, vibrate both slowly and rapidly, no big deal. It's called linear superposition. Think shaking your wrist very fast while also moving your whole arm up and down, slowly. Then, if the electromagnetic field (light) vibrates slowly, you see red, and if they vibrate rapidly, you see blue. Of course, slow and fast are relative to the phenomenon in question and to human perception. We only see a very small part of the electromagnetic spectrum and only hear a limited part of the mechanical spectrum. And light vibrates much, much faster than sound. Just as most sounds are complex, so are most colors. For example, you can't speak using just one sound frequency, and many colors can't be generated using only one light frequency, magenta being a good example. So if the equivalent of red is low pitch, that of blue is high pitch, and mixing red and blue light gives magenta, and mixing low and high pitches gives...ummm... low and high pitches, then: pure black is silence, pure white is hiss (also called white noise), pink is also some kind of hiss called of course pink noise, and so on. So if hiss is a kind of sound, then pure white is certainly a color. Either that, or pink and most other colors aren't actually colors. Anyway, there's no pure white, so how do you call a white that's a little bluish or yellowish or whatever, but not so much as not to call it white? you either call it a color, or you slowly increase the blue/yellow/whatever content until you can't call it white anymore, and don't call the resulting stuff a color either. So it is natural to call white a color. Some insist on calling it a sum of colors or whatever. True, it's a sum of all other colors. So? White hiss is a sum of all other sounds and it's still a sound. Every color is a sum of more elementary colors. There's no pure red, green, or blue, not even in the most precise lasers, let alone in a painting. If we skipped this and defined "mostly pure" colors, which indeed exist, then yellow can be a pure/primary/whatever you might call it color, meaning a single frequency of light, or can actually be two such frequencies, that of red and that of green. So there is a pure yellow and a yellow that's actually red+green, and they look exactly the same, and that's because of how our eyes are built. So all these attempts to refine the categories into which colors are placed and the idea that white is somehow different are absolutely pointless. The question of black is a little more difficult, because it is the absence of light. Is silence a sound? I don't know. It might be. Many artists talk about the sound of silence. The simple fact that we hear lets us categorize sounds into loud, soft, and absent. We wouldn't know what silence is if we didn't know what sound was, so silence is part of our audio perception. I guess it's still not a sound, but I don't even care. I'm making a comparison, not an equality. There is no pure black, at least not in paintings and shit. There is always light reflecting off even the blackest paint. So it's not equivalent to pure silence so it's a color. And if you were to be locked inside a totally dark room, you wouldn't see color anymore. You would see exactly nothing. So it's not black you're seeing, it's nothing, the equivalent of hearing nothing, or silence. There. Cut the crap once and for all. If I wanted to say that 1,2,3 and 4 are numbers but 5 isn't, I could, but it would be a very stupid thing to say. If I said that 1,2,3,4 and 5 are numbers, but zero isn't, that would be less stupid but still stupid, and it's been said throughout history. So feel free to classify numbers into positive, zero and negative, feel free to classify colors into warm, neutral and cold or whatever, but just please, cut the fucking crap.
PS. I also skim-read the Wikipedia article and found no indication of this stupidity. Is it a local tradition or something? Good enough reason to kill it ASAP.


I found a sketch in my Google Docs about purity. I thought I posted about this earlier, but a search reveals that I have apparently not. M'kay then. It was inspired by something someone said / wrote, I'm just sorry I can't remember who they were so I could give proper credit. The original text only had one of the items in the list, and I took the liberty of expanding it. So here it goes:

is for
  • drinking water
  • fresh snow
  • colors
  • vodka
  • 24k gold
  • deionized water
  • semiconductors
  • sampling clocks
  • extraterrestrial signals (you know that song the seti guy sings? :D)
et cetera.

Purity is for water, not for people.


Oh, I have sinned tonight. Let me remember... how many times. Let me think how many sins I have commited during this life. It's comparable to the xkcd number I guess. (The xkcd number is/was at some time the largest number concisely defined.) I am certainly going to fucking heck (having just mixed curse levels) where it's comfortably warm and otherwise interesting - i.e., not just clouds and singing angels. I mean, if the angel songs are played for ever and ever and ever, are they creative enough for me not to get bored? I guess they might be, actually. I shouldn't care anyway, because I'm going down there where there's solid matter for me to engineer. Let us again quote the wise words of William Murderface - "I'd rather DIE than go to heaven!"

So. Oh. Sorry. I just saw on TV that time has changed. (Times have also changed, but that's another story). This calls for a heavy dose of ranting. I mean, I think I should invest several femtograms of energy in ranting about how FUCKING STUPID DAYLIGHT SAVING TIME IS! Dude! It's TIME! You DON'T fucking change it!!! It's STUPID, POINTLESS, and ECONOMICALLY IDIOTIC! FUCK DAYLIGHT SAVINGS< FUCK DAYLIGHT SAVINGS< FUCK DAYLIGHT SAVINGS! I never use Caps Lock.
Although forms of DST were apparently used in ancient times, modern DST was invented by an idiot called William Willett, who printed pamphlets and lobbied politicians to implement his demented idea into law. Most people (including the idiots in the press who said it on TV this morning) think that Benjamin Franklin invented DST, but they're WRONG. I mean, that's insulting to the great Franklin. I was quite disturbed when I heard it on TV, so I checked. Of course, my intuition was right. Franklin couldn't have invented such a monstrosity. Instead, he did a much, much, MUCH more reasonable thing: he just told people to wake up earlier in the summer. Which is just, because you don't change time to force people to adapt to the planet's natural cycle. DOH!! Fuck daylight savings, they aren't saving anything. They're causing chaos, they're messing up people's rythm, FUCK DAYLIGHT SAVINGS A(g64,g64) times over! Then drill 10 more holes in it and fuck it again till it fucking dies! "William Willett did not live to see daylight saving become law, as he died of influenza in 1915 at the age of 58". GOOD! Fair! There is a God! Oh. And I don't like Coldplay.


February 23 - October 28 - 8 months of bits - 500 chars max.
(I wanted it to be lowercase but the template capitalized it, and I was too lazy to change it.)
Why exactly October 28th and not, for instance, October 23rd so there would be exactly 8 months? For that matter, why 8 months and not 6, half an year? Because.
Cheers et cetera.
Now that this note has been posted and the toast has been made, hm. Wish bits 8 more months of success.

Monday, October 22, 2007


I was talking some time ago about how much I hate pollution. Simply because it smells and it's toxic. I also said I didn't care about carbon dioxide emissions. We have a great deal of stuff to worry about that's more pressing and more important than CO_2. CO_2 can be absorbed by trees, if we stopped cutting them down and started planting new ones. Toxic gases and particles ("industrial ash") have a more direct impact on human life than global warming. Even more pressing is the oil crisis. Even if it's not a real crisis right now and it's driven by politics (may be, may be not, I don't care), it's still going to run out eventually. So that's the real problem, because then, the world economy is screwed. And then what? Riots? War? I don't know, I don't want to think about it. I hope a solution is found. What I care about today is bashing environmental fanatics. For instance, I use my bike and public transport most of the time, but I'm not fanatical about this. I don't have a problem with using a car, especially if there are more people in it. Think about this: according to Wikipedia, muscle efficiency is between 14% and 27%. A modern gasoline enginge on the other hand can have an efficiency of 25% to 30%. With Diesel engines that gets even higher. So I could get a better efficiency by riding say, a high-tech motorized skateboard / miniscooter, than by riding a bike. Guess what, you exhale 'dirty' carbon dioxide when you cycle, when you walk, when you sleep, all the time. You burn hydrocarbons just like a car does, and you eliminate CO_2 in the atmosphere. So by using a high-tech engine on a lightweight chassis you could actually 'hurt the environment' less by using motorized transportation than by cycling. Of course, cycling may be healthier, but that's another issue. Now think hybrid cars, where much less energy is spent on braking so the overall fuel consumption drops even more. Someday they're going to be markedly better than cycling. I should also mention a keen observation by my friend Wacky. All animals burn hydrocarbons and breathe out carbon dioxide, like we do. All plants on the other hand absorb the CO_2 and feed on it. So if you're somewhat of a vegetarian like I am, you're not protecting the environment by not eating animals, you're hurting it. You shouldn't kill and eat plants, who absorb CO_2, you should kill and eat animals, because they put CO_2 in your beloved atmosphere. And then campaign for cheaper condoms. We're complaining that the world population is increasing, that AIDS and other diseases are spreading sexually, and that's fucking normal! Because condoms are damn expensive. Especially in poor (pardon me, "developing") countries where a lot of people care more about finding half an old bread and a rotten apple to eat. Also, people are hypocrites. They're moral, they value family and bla-bla, when in public. But in private they spread AIDS and other diseases sexually. Actually, even if condoms were handed out freely, I guess many wouldn't take them because they're "highly moral and abstinent". Yeah. But still, condoms are fucking expensive. Hm. Seems I unintentionally found a problem worth campaining for: humanity's obsession with sex. The traditionalists' obsession with limiting and controlling it, the emancipated western(ized) peoples' obsession with having it, and the hypocrites' saying the first and doing the latter. And all the unnecessary taboo that surrounds it. There. Campaign for people to have less unprotected sex and make fewer children so there'd be less CO_2 emissions from breathing and from using technology. And then kill and eat all the animals that also breathe out CO_2. I think the environment would be perfectly sustainable with just humans, cockroaches, bacteria and all the plants. For instance, what role do panda bears play in the ecosystem? I mean, they're symbolic to the whole extinction craze. But besides being subjectively and questionably cute, they're dumb and poorly adapted. They only eat bamboo and reproduce with difficulty. So from an evolutionary standpoint, they deserve to die and go extinct. Big deal. So ideally, there'd be just many, many plants, us humans and little to no other animals. I mean, I guess there are plants that don't rely on insects for pollenation. Or just let the bees live, honey's good. And kill them if they multiply too fast. There. Clean air and sustainability. Then genetically modify humans to make their skin act like a plant leaf. There. No more fucking CO_2, and we get to feed on light. No more eating animals OR plants. Hippy nirvana peaceful utopia: us, the flowers and the trees. So we all happily feed on light and CO_2 instead of each other, until the CO_2 starts to run out and we can't synthesize organic matter any more. And so we burn half the forests to release more. And they all lived naturally ever after. The end.

Tuesday, October 16, 2007


Exceptions again. I thought about them again after posting earlier about how pointless they are. I found some cases where they might be useful, but then I changed my mind.
For instance, I know it's truly elegant to write a = b + c * d - x++ with overloaded operators and just catch the exception instead of checking the result of each operation, but what if(a.has_error()) do_stuff_to(a.get_error()), something like aggresively_spit_message(a.get_error()->
get_human_readable_text_including_error_ \
type_and_operand_misvalue_and_any_releva \
And do whatever you like within the operators regarding operating on data with errors, just pass on the error.
I also know that even if you don't (can't) overload operators some methods must return useable objects, especially if you have immutable objects. Then either have mutable objects and pass them by reference, or make the error part of the object just as above. Duh.

Monday, October 15, 2007


Today I am going to talk about frying electronics. According to arcane lore, all electronics function by means of a mysterious substance called the Magic Smoke. It is inserted into the components when they are manufactured, through a highly secret alchemic process. Whenever the magic smoke is released - for instance through subjecting the component to an electrical current many times the one specified for normal functioning - it ceases to function. This is sometimes accompanied by strong luminous or acoustic events (flash-bang). Other times, depending on the energy involved, it also results in flying sparks and shrapnel: "Timmy, put down that transistor! You might poke somebody's eye out!"
Although sometimes embarassing, especially when frying something worth a lot of money, accidentally killing electronic components is seen by engineers and amateur enthusiasts alike as sort of an initiation rite.
Frying electronics can be the result of numerous mistakes, such as:
  • applying a voltage of incorrect polarity or magnitude - this results in internal breakdown or excessive conduction, which allows large currents to flow. Large currents times some voltage equals large Joule dissipation equals melting, and sometimes pressure increase = bang!
  • allowing too great a current by wrong selection of component values - see above
  • using a small resistor instead of a larger one (ohmically or mechanically) - ouch, it burned my fingers! Also see above.
    • in particular, short-circuiting something that can deliver a large current does indeed that, sometimes with unpleasant results.
As you can see, it's always about overstress. Some particular cases include:
  • electrolytic capacitor overvoltage - fizz, bang
  • screwdriver across electrolytic capacitor - bang, sparks, screwdriver welded to terminals, capacitor internally overheated and mechanically stressed - bad
  • diode across mains - boom, blown fuse (trust me and don't try)
  • integrated circuit inserted backwards in socket - what students do in the electronics lab in the Bucharest Polytechnic to confuse their teacher - "Teacher, the circuit is not functioning, come take a look, I guess we wired up the thing wrong! [.......] So it's defective? Well, then, could you just let us off?" - the sockets are hidden on the back of the board and the traces and resistors are on the top side, for some arguable reasons like clarity and "don't touch those ICs, we don't have many more replacements! You don't need to see how those sockets work! Google it or something." -- doesn't work :)
  • electrostatic discharge - ellusive, nasty and sneaky.
Many components such as integrated circuits are designed to shut down when overheated to try and prevent further heating. This sometimes works, but not always. Most are designed to shut down or limit their output current when short-circuited, but not all. Some are even designed to survive reversing their supply voltage, but again, some aren't :) In any case, most will not survive severe overvoltage. Resistors, capacitors and diodes are not designed to survive overstress and will heat up. Some will fail open-circuit, so the heating stops quite rapidly, but others will continue to heat up until they blow violently. Bad, m'kay? In any case, open-circuit is a relative term. Under sufficient voltage, any material or gap becomes conductive.

There are also more interesting ways of frying electronics. We had some "Digital Computers" labs where we would design some simple stuff involving digital logic and stuff it into an FPGA and test it. Worth mentioning is the famous "Automatic coke dispenser" that was simulated using switches for dropping coins and LEDs* for releasing bottles as well as for internal diagnostics. *) Under the right conditions, any diode can emit light in the form of thermal radiation. Most can only do it once.
The coke dispenser never worked, partly because it was very easy to do the equations wrong, partly because the state machine was hand-designed and hand optimized instead of being written in some behavioural language, and partly because there was no switch debouncing. But, it taught us about whistling bits into an FPGA and reminded us how to hand-design stuff.
Another interesting one was the "robot ant" that navigated through a maze. It had VGA output but that module was already written so it was very cool (dude! video output dude! on the fucking monitor dude!) but not that challenging. The ant always looked like it had a blind desire to mate with the walls, but hey, it was all done in hardwarde. Sort of.
Years passed and one of my friends had to go through this lab. He asked me: is there some way you can fry an FPGA by misconfiguring it? I immediately said no, thinking of the usual mistakes one might do when generating the configuration bitstream, the same mistakes one would do when doing classic C programming for instance. After all, an FPGA is a very, very expensive thing to fry and you wouldn't want to be able to do that in software. Not easily at least. And the guy was sincerely concerned and I had to calm him down. And then I thought, well, if you wanted to fry it, I guess you could very well do that. (Don't!) You could for example take the clock and use an internal PLL to multiply it 6, 7 or even 10 times, maybe even way beyond what the chip is specified to properly function at. Then you would clock all the possible flip-flops with that, and tie all the combinatorial logic to it for good measure. That would surely overheat the chip in no time. If you're lucky, you might even blow up the power supply. If you're really lucky, the power supply might think you're short-circuiting it and shut down, preventing you from frying anything. Anyway, don't do such stuff.
Then (read hack a day!) I learned of a design that can really fry itself by software. It's a brilliant design actually, if proper protection is added. But it's just for proof of concept. Say you want to control a switching power supply by software. Need I say more? :) There's no greater opportunity for self-frying than this. This said, I would never trust software to keep me alive. I don't really know why we allow so many bugs to exist. I mean, when you design something physical, errors can creep up, but usually you do all the calculations and show that the stuff is going to function as planned. Not with software. Nobody does state diagrams and flowcharts anymore. In high school, we used to laugh when the teacher was trying to push flowcharts onto us. "What? Flowcharts?! That fucking looks like it's from an old sixties manual, I want to write some code!". Well. I admit it, I myself hate both flowcharts, Petri nets and proving algorithm corectness. Hell.

Sunday, October 14, 2007

fuck i18n

sau de ce suge wikipedia în româneşte.
Pentru că, evident, sunt mult mai puţini oameni care scriu în porcăria de wichipedie românească decât în aia englezească (cu adevărat internaţională).
De exemplu, vreau să caut cum se zice în iengleză la a restitui ceva în natură, pentru că-s prost şi nu ştiu. Sau cum se traduce răspundere juridică, că poate-i un termen special, ceva. Mă, n-ar fi fost injust să fie nişte pagini dacă nu cu titlul ăsta (caz în care clicăiam linkul spre varianta internaţională), măcar să fie dracului menţionate pă undeva. Nu găseşti.

Romanian Wikipedia is a waste of resources and sucks by lacking lots of articles and it will never be able to get them (just as many of its other 'international' variants suck), fuck 'internationalization', the only international language is English.

Saturday, October 13, 2007


This should be part of the 'press' series. I saw an article about some astronomers discovering there's rain on Titan. Of course, it's not raining water but liquid methane, which is named an 'explosive gas'. This reminded of some show they used to air on Discovery about the moons of the Solar System. They were saying that, if oxygen were present on Titan, and one were to light a match, the whole moon would go up in flames. They were showing an expanding ring of fire that eventually circles the whole orange sphere leaving it black behind. Well, I find that very wrong on many levels. But first of all, methane is not explosive alone, it is explosive when mixed with oxygen, so don't call it that. On Earth it's an explosive gas under normal conditions, true, but not everywhere. Both sources recognize that, but the first still calls it explosive. Second, the whole idea of the moon going up in flames is pointless, because (a) there is no oxygen there and (b) if there was, it would have ignited with the methane from stuff like meteorites. Why ask oneself 'What if there was O_2 on Titan?' if that's not the case? Just for the trivially exciting fire ring. What if suddenly there was a lot of cianide in the air on Earth? We would all be dead, instantly, you could see all the people fall. Cool. Equally pointless.

Wednesday, October 10, 2007


There are more or less frequent discussions of bad science in movies, games etc. Damn, this computer is slower than my typing, much slower. It's much slower even than the eBox I have at home, from which I've once blogged. It's so slow I can't be bothered to look up the link to that certain post.
Anyway, bullets have low momentum and can't launch a dude in the air, lasers travel at light speed which is for all practical purposes infinite*, and sound can't travel through empty space. Neither can laser light scatter off empty space, so the beams should be invisible except where they hit something. It's light, not projectiles.
*). compared to practical lengths for spaceships and human eye response time.
So people like me praise old, well thought-out movies like 2001: A Space Odyssey, where there was no sound in space, no gravity on space ships et cetera. New movies on the other hand feature low-budget crappy CGI, all sorts of glowing beams, explosion sounds synced with space stuff blowing up, and Earth-like artificial gravity everywhere. Then I thought. Dude, you can hear the sound from a blast in space, because debree would be hitting your vehicle. But I'm pretty sure it would sound very different from fire crackers.


Time to relax (slow down brain clock while browsing Wikipedia articles on simple ubiquitous stuff just to see if something trivially interesting pops up).
Of course, this also leads to reading articles of a more specialized nature.
One of these would be the article on anti-patterns. I find the 'Reinventing the square wheel' list entry the funniest :D
Note the smileycon used as sentence-terminating punctuation mark.

Anti-patterns are called so because in many (most?) cases they're bad, m'kay?
Not always.

1. Come From and Go To
(listed as 'Spagetti Code')

goto is useful, and is indispensable if programming in assembly language. Few processors support 'if' and 'for' and 'while' natively, most use jumps (gotos) to emulate them.

2. Busy Waiting
(spinning in a loop waiting for something to happen/finish instead of doing something else and waiting for a signal)

They taught this with great passion and emphasis in Operating Systems class. No busy waiting, use wait functions that yield control to another thread, halt the processor to sleep if it has nothing to do. Which is obviously reasonable. You don't want a task to spin doing nothing, you want it to sleep and let another one run. If none has anything useful to do, halt the processor to save power. That can't be anything but good, right?

Wrong. Turning on the processor to do useful stuff and then off while waiting for more stuff to do trashes the supply voltage by drawing large current spikes. In an improperly designed (or cheap) system, this can induce audible noises in the speakers, audible noises from power supply coils (hear them when scrolling text?) and electrical noise leading to poor measurement precision in embedded data acquisition systems. That's why all my microntrollers spin and never sleep. Many don't use interrupts at all and poll all peripherals except timing-critical ones. Waste of power? At some tens of milliwatts, from the mains and not from batteries, I couldn't be made to care. I own and control all tasks, I know how long they (should) take, I schedule them, I own all time and silicon Mwahaha, I spend 4 hours debugging. I rule :)

Also, spinlocks and atomic operations are good, m'kay. And well-documented.

3. Raising, catching and ignoring exceptions
(and all sorts of other problems)

Blah! What's wrong with just checking return values?
Why do we need exceptions? Certainly not because of abstraction and object-orientation.
If I ask you to please go take a shit, you can do it and reply with "Done." (return 0, or the more oxymoronic ERR_OK), or you can not do it and reply with "All portable toilets in range have their doors locked." (return ERR_NO_TOILET), or "No." (return ERR_GENERIC). I can then choose to check or ignore your return value, or just check to see if it's null. You can even return a pointer to an error object (supposing that the method halts on the first error encountered, use a list otherwise), though you would need some sort of RTTI to implement various types of errors just as you traditionally do with typed exceptions. But that can be messy, so you could just use one single object type for all errors and fit all necessary info there or make it polymorphic or something. Anyway, what's so wrong and unobjectful about switching through some possible error types on an error_type field in your returned error object versus writing the same amount of catches for each possible exception object type you might catch? Don't want to check function (excuse me, method) return error type after each call? goto somewhere after a group of calls you would otherwise try and check there. That's what the compiler assembles anyway. But no. Passing objects by return is not enough. We also need to throw and catch them through some abstract, exceptional aether. There. Fuck exceptions**.

4. Magic numbers

0xdeadbeef, 0xbaadf00d, and combinations thereof. Rotten.
0xcafebabe. Sexy.
0xfee15bad. It does. Fuck 1337*.
MZ. Sounds tough.

*). I remember when I was young and dreaming of optimal ways to represent text on 7-segment displays.

Bad examples:
for i from 13 to 69 do stuff with i involving 833 and 647.

My examples:
clock_divisor = 47; // because I say so, dammit! MY code, my clock! See (2).

And, the winner is:
123. Loop-switch sequence

for i from 1 to 3
if i is 1 do this
if i is 2 do that
if i is 3 do some other stuff
fuck autounindentation end for

Funny :D
Seen that in programming books. Bad, m'kay ?

**). Regarding abstracted and formalized exception handling, another reason why I tend to look down on object-orientation fanaticism is that everything is defined backwards. If I have a computer and it contains a 3D-accelerated graphics card, that's a subassembly. The GPU per-se is a subassembly of that card. But no, in OOP if I derive a class from another and add functionality, that's a subclass, and its parent is of course a superclass.*** And if I choose to draw that hierarchy in UML all the arrows have funny heads and generally point backwards. Of course, the inheritors are under (sub-) their parent, which is above (super-). So 'subclass' is not about its ability to substitute its superclass. It's about counterintuitive back-arrows. As you might have guessed, you actually can not generally substitute objects of a derived class in place of objects of the base class (inheritance is supposed to model the "sub is a super" relationship) and that's called the circle-ellipse or square-rectangle problem. (with square pronounced skwaah****, like Cartman: "So I kicked 'm skwaah- in the nuts!") Final solution suggested in linked article: change the paradigm.

***). Too bad you don't have #defines in Java. Then you could #define ultra super*****
****). skwåh?
*****). Credits: Wacky.

Sunday, October 7, 2007


Today I feel unusually dark, cynical, unemphatic, insensitive, uncaring, angry, hateful, cruel, heartless. Heartless is a doubly inappropriate term in this case, as a) the heart is the source of emotion, just like the brain serves in cooling the body, and b) I am fully capable of feeling disgust, loathing, aversion, hate, as well as pleasure in others' suffering.

For example, I was reading about some big company testing their cosmetic products on animals. Well, I would feel a little bit safer if a product I'm using had been tested on something similar to my skin. Cruel and unethical to do that on rats or cute fuzzy rabbits, which are classified as pests? I agree. It would be ethical to test them on humans, both towards the animals and towards the end-users, who can be assured of a more reliable test. To the question of which humans should the products be tested on, I can only answer by pointing towards the ones who fanatically campaign for this idea that I fully endorse.