Fri Jun 22 15:39:20 CEST 2007

Gtk, the toolkit for ants

Today, after having cursed long enough about gtk fonts being the wrong size, I finally fixed them up.

The default fontsize is 16, which makes menu bars and other GUI items readable.

Firefox default fontsize is 32. That is about the same size as Qt 14, but ... I seriously need that to be able to read things. Minimum fontsize is 26.

I seriously want to know what is wrong with the gtk people that they (a) manage to mess up configuration that badly that gtk guesses values, (b) ship such defaults and (c) think that is correct. I'm not an ant, thus I'd appreciate font sizes that are readable for humans and other large bodies. I don't care about hamsters or ants, so don't set the defaults to be nice for them.

And no, I'm not blind. My notebook has a 14" screen with 1400x1050 native resolution, and every toolit except gtk manages to have usable defaults ...

Posted by Patrick | Permalink

Mon Jun 11 16:11:03 CEST 2007

MSDNAA: Concentrated fail

As a person working at a university I have the option to get lots of things from MicroSoft. For example I get Vista, Sharepoint Server and Office for 0 Eur.
Very tempting you say? It is. And as my virtualbox install needs a few VMs for testing I thought "hmmm, let's fetch that windows and see what it can do". So, log in to the website, order it, download. Right?
Small sidenote: this is counted as a sale with 100% discount. If you ever see windows sales statistics substract like 85% from the numbers to get the real windows sales.

What you do download is a 450kB file that is:
Windows: MS-DOS executable PE for MS Windows (GUI) Intel 80386 32-bit

So ... if I had wanted to install Windows I'd need ... err ... Windows to install it. Which means I need Windows to install that. Which means ... oh well, in short it means that Microsoft still sucks a lot. I can't even get it for testing because we have no open Windows machines running where I can download it. So I'll see if wine can run the downloader thingy ... and I bet I don't get a nice correct ISO, but some strange thing that makes me go all stabbity.
Now ... I can do even better. From a really nice Microsoftie I got a DVD ... "Windows Source Code". So, naive as I am, I'd assume it to contain, like, a cvs checkout of the kernel. No, they have outdone themselves!
There is sourcecode on the DVD. Surrounded by shims, stubs and binary blobs that protect teh Interleggtual Properdee. You know, that thing we Open Source people always steal. Everything remotely interesting is no longer there, what is left is about as informative as the Minix source code or the Linux 1.0 kernel. bah, I say. Bah.

If I had paid anything I'd want my money back. Not even for free is it really worth my time ...

Posted by Patrick | Permalink

Fri Jun 8 20:53:03 CEST 2007

Oops :-)

Total: 389 packages (354 upgrades, 24 new, 4 in new slots, 7 reinstalls), Size of downloads: 515,043 kB

That happens when you don't update a box for about 2 months. Aaargh :-)

Posted by Patrick | Permalink

Mon Jun 4 15:34:02 CEST 2007

Java, the daily source of insanity

As some astute readers may have noticed I do have a strong opinion about most programming languages. Mostly by experience I've learned how good things look, thus everything that doesn't look good is bad - quite subjective here.

Like ciaranm I thus complain about every language that isn't Python (and I have a special dislike for the C++ language he so admires). So, let's do another round of Java bashing - Java being the language I'm using because at work it tends to get used because ... uhm ... everyone else is using it. Noone seems to like it because it is complicated and tends to be slow, but because everyone uses it there's many libs and examples written.

Ok, let's start by first impressions. I've already blogged about the installation process of eclipse, which is like a dentist appointment, only that the dentist turns out to be a proctologist. Thanks to Caster I at least know that some of the issues I had were verifiably due to other people being stupid. Other issues were because I assumed that things should work. Ah well, one can fix that ... I hope.

Now, I've inherited an 8MB blob of Java to do some feature hacking. Just a few smallish features, nothing big ... First question: Why on earth is this 8MB? I could rewrite that in Python under 500K, maybe even under 250K, without losing any functionality. Java is verbose to the point of being a drunk fool blabbering all night long. Even worse: I have begun researching some P2P apps. And there doesn't seem to be any application that manages to go below 8MB. That is ... wow. Bittorrent used to be just below 200k before it went stupid (now it is a 4MB blob with no comments, which does not even qualify as stupid). That is insane! I mean ... we used to have an Operating System with most of a TCP/IP stack capable of running in 4MB. And now the source for a simple app is twice that size? Aaaaaaaaaaaugh.

Back to the inherited blob of stupid. Naively I fetch the example. Say "javac -cp .:somemagic.jar example.java" and then "java -cp .:somemagic.jar example". Notice the small but braindead change in the syntax there ... are we fighting automation? Either keep the file ending everywhere or drop it ...
example.java fails. I dig around a bit, do _exactly_ what the docs tell me and move it to banana/tutorial/dingledongle. Now it works. My brain shifts down to leetspeak and I think "liek zomg, wtf? teh fail!". So apparently some "smart" person decided to allow reverse hardcoding of paths by means of the absolutely redundant, pointless and retarded "package" statement. See, Java has Structure. If you want to have a main method you need a class first. And that class better be named like the file it is in or else. So ... can't do a test class in example.java, it must be a test class in test.java. And with the package keyword you can force it to be shroobarzle/beer/test.java, and noone will be able to escape from this apart from running sed over the whole sourcecode. Yay. See, in Python, that is solved in an obvious way that follows the KISS principle. I can explain how it works and why it works like that. Talking about structure - the class structure is inconsistent. Heavily inconsistent. In Python it's either there by default or you have to load a module. In Java some things (like System.*) are there by default, but still carry the full namespace with them. So ... uhm ... either force importing everything you want to use like C or drop the namespace, mmmk?

Talking about namespaces and the "package" retardation statement, it tends to organize your sourcecode neatly into a deep directory structure. So instead of having something obvious there is a directory src/net which contains a dir banana which contains ... you get the idea. Instead of lib/cranberrysauce.java it is src/net/banana/opensourceapplications/transmogrifier/framboozle/cranberrysauce.java. And you can't change those paths because it is hardcoded into the files.

But hey, one can fix that. Just use the illogical structure some muppet on the other end of the world forces on you! Grumble every time you have to type a path that feels wrong. Hit the sandsack every time the java compiler does another brilliantly stupid thing. See, that's another thing about structure. The compiler can prevent some kinds of stupid, but that comes at a high price. So, like, you have to catch every exception that a method declares, right? HTF can I still hit unhandled IOExceptions and NullPointerExceptions then? I need to wrap an exception handler around trivial code that could only fail when you deliberately want to crash the program, and the big mistakes are still not caught. Grrrrreat. And people tend to handle exceptions by swallowing them (because "the code works"), so debugging tends to be just mildly annoying.

Now somehow I didn't manage on the first try to hack up a simple method that returns every line of a file one at a time and restarts from the beginning when it hits the end. Obviously I split it out and tried to fix that specific function until it works, then push it back into the great disgusting blob I have inherited.
In Python it's roughly a four-liner. In Java it's just over 30.
In Python I can hack around in the interactive interpreter until it works, then extract the working bits into a file. In Java I need to do the edit-compile-test cycle.
In Python it takes ~150ms on first startup, then about 25ms with a hot cache to start. Java takes 5 seconds to compile (1.2 with a hot cache). What used to be reload(module) in Python thus can easily become a 30-second cycle in Java.
In Python every unhandled exception makes a nice backtrace you can read. In Java you have to catch the exception and run its printStackTrace method to get any idea what goes on there.

Best of all ...
In Python the code is the program. In Java you compile it into .class files, so reading the source of a library is complex and quite often impossible - if you only have the .class file you're screwed. Worst case you have to assume that it's a bug in your code and not in the library, best case you have to find a way to get the source. And looking at some of the code I have here ... People want to hide their nasty code in .class files so that noone can see what they made there. Argh.

Want an extra bonus? Some projects have .class files in their cvs instead of the .java ... That is STUPID. Words fail to describe the amount of fail concentrating here on small space. And to hit the jackpot ... these are applications that wish to be security-oriented. How the smeg can I trust you if I can't read your source? Stuff like that can make you really doubt the intelligence even of supposedly smart people.

So, short summary, Java is slower, bigger, and harder to debug. It adds some complex indirections in best NIH fashion, enforces structure without thinking about the benefit of that and leaves you with some impressive design errors which can only be worked around by developing a certain kind of braindeadness that prevents you from writing concise clean code. And it runs on almost no platforms! A short grep over all JREs in portage shows ... x86, amd64 with some bellyaches and ppc. Wow!

And all that in only about six times the space of Python! And instead of clean formatting you can format the code any way you like to limit readability. It's the deal of the year ... buy it now while we still have it in stock!

I guess this has guaranteed me a place in the hall of fame (or wall of shame?) of the Java crowd. But ... honestly. There's so much stuff that is so massively wrong with the Java environment that I wonder how people can use it. It's a glorious hack!

Posted by Patrick | Permalink

Mon Jun 4 15:19:55 CEST 2007

An incomplete things of annoying things

A few things that can be really irritating -

Radio stations where people feel the need to blabber some random stuff between and across music tracks. "Yo yo yo shizzle, u r teh listening to the raaaaadio on 103.6 it is teh RADIO u r listening to" ... Like, whoa, dude, I knew that already. Just play some g'damn music already. And please ... shut up. It's one of the major reasons I avoid radio, I can't stand this mindless blah blah that interrupts the little fragments of music played between advertisments. I mean ... a modern radio station can't play Sgt.Pepper or Dark Side of the Moon anymore. Fail!

Jumping blinking thingies blocking more than half the screen on television. Three commercial blocks in a 45 minute timespan. Two commercial blocks and three fade-to-blacks because someone felt the need to replace the planned commercial blocks. Running text telling me that I can watch what I watch on Sunday at 10pm. DVDs that tell me that copying them is as bad as nuclear warfare while the download version has none of those. Braindead copy protection that needs to be removed to be able to see the content. Cutting out erotic scenes but leaving in the sick violence. Cutting out violence in ways that compromise the movie so badly that it does not make any sense anymore (see: Starship Troopers, Terminator 1, Police Story, german versions - one _can_ cut out the violence). Bad translations - "I can't get a lock" becomes "Ich kann kein Schloss bekommen", and you wonder why the radar operator can't have a castle. One wonders how that relates to the chaotic battle that's going on and what that has to do with the rest of the movie.

Oversized and hardened packaging. Buy a 128M USB memory stick and get a 45x25x20cm package. Grrrrrrreat, now I have half a kilo of packaging to get rid of and one negligibly small USB dongle. And then there's the nuke-proof hardened stuff ... Tried opening a headset or mouse package? Preferred weapons are plasma cutter and assault rifle, but you might get by with a sword and a power drill. That stuff should be used for cars, it's unbreakable. But don't use it for a cheap bit of molded plastic with some crappy electronic bits in it ...

Software that is overly complicated, suffering from NIH (not invented here), having a structure that barely works, but is in no way efficient ... Doing random things that don't make sense (a build system should not fetch something in the compile phase. And if it absolutely has to ... honour proxies or else). Software that consumes ressources without really doing anything (let's build a complete list in memory, iterate over it, then throw away everything except for the first ten elements and feed that to the do_something() part of the program) and worse, software that is a huge bloated mess because ... uhm ... because we don't know any better. Hey, drivers are supposed to be 675MB (without .net 1.0, 2.0 and 3.0, an SQL database and a webserver ... for a printer). My old 386 booted in 23 seconds. My fastest box takes around half a minute to even get to the point where it considers handing over control to a boot loader ... It's called progress!

Hardware that is not designed to be used ... "The controller locks up under heavy IO load" ... "The graphics card overheats during intense 3d games" ... "The car explodes when you floor the accelerator"
Well, I made up that last one, but it would cause quite a commotion. Consumer devices are expected to fail when you use them? Can anyone still remember the overengineered crap from the 70s and 80s that could withstand most attacks you could think of? Toasters that didn't melt after 10 consecutive toastings. Amplifiers that didn't melt when running at full volume for more than a minute. Keyboards that could take a direct hit from any part of your body without shattering... the IBM M-type has been known to survive more than 10 years even under heavy (ab-)use. Modern keyboards barely manage a year under moderate use. Grmbl.

Movie plots that need stupidity to work. "Hey, we're hygrophobic aliens, so we attack a planet that is covered in ... water!"
A computer mainframe that has a network login where you get a "Hack me!" button if you press the right buttons.
Gunfights where noone gets hurt even with automatic and explosive weapons in rooms smaller than 50m^2
Every episode of friends also qualifies here because in the first 10 minutes there is a misunderstanding which causes the problems which are then resolved in the end ... if these Cro Magnons knew how to communicate none of that would happen
Movies named after computer games that have some tangentially superficial connection to the game without taking the ideas that made the game interesting
Computer games made after movies just to exploit the movie's popularity, having no real plot, no useful controls and crummy graphics
Second and third parts just because ... and prequels


Bonus programs in stores and supermarkets. No, I don't want a SuperDuper card. Really, I mean it. No thanks. I'd rather pay the 1% tax on anonymous shoppers. You call it thanking loyal shoppers, I call it punishing the few among us that value our privacy. And I really don't want to have you link my purchases - after all I buy the rope, whipped cream, cucumber and vaseline at different shops to avoid the dirty looks the cashiers tend to give me when they see that combination. No need to have that aggregated in a central database ... and don't even think about sending me any more ads. I get around 50 pages of random crap in the mail per day because I haven't put a "No commercials" sign on my mailbox. Once I sign up for your "bonus program" I'll get personalized ads that won't be filtered out by the "No commercials" sign ... Oh, and if you thought the other items were bad, don't ever buy a shovel, a rope, some fuel and a hacksaw at the same time. People somehow get the wrong ideas when you work on three projects at the same time ...

Policies and rules that prevent terrorism ... So now I can't carry a bottle of water on an airplane because some people realized that in theory one could use liquid chemicals for an exothermic reaction. Hmm, that will really stop these evil persons that have done about .... err ... how many attacks in Europe? But we preemtpively punish everyone ... and cars are still legal! How many people die through cars, how many through terrorism? Right.

Doublespeak. "We're expecting synergies" means that people will get fired. Peace troops that kill people. I think everyone knows it, but people don't cockpunch often enough when someone uses doublespeak. I think that would help a lot ... Not the nicest solution, but doublespeak is doubleplusungood. And politicians seem to like it so much now that freedom is defined as not being allowed to move and increasing taxes is reducing the individual contribution. I guess I'll have to call for people to do acts of love on these shining beacons of humanity ...

Judges and politicians that don't know the constitution of their country. If you look at Germany (which is the country where I see those things most often because I used to live there and have better information sources), especially Heiligendamm these days ... wow. I wish quoting the relevant parts of the constitution were a valid defense these days, but one has to resort to violence to be allowed to experience his rights, and then one is a terrrrorist. Uuuuuuuuh! Dem Terrorist. Und dem Sauerkraut ein Wienerschnitzel!
Sorry, having seen "The Great Dictator" a few days ago I channel Adenoid Hynkel from that movie... Everything and everyone is a potential evildoer now. Panic!!!!!! The government (especially the anticonstitutional group in the german government shines there) wishes to control everything and everyone. It kinda reminds me of the history lessons at school, it's like a giant deja vu.

This list does not attempt in any way to be complete, just a few of the random daily annoyances that could be avoided easily.

Posted by Patrick | Permalink

Mon Jun 4 15:17:37 CEST 2007

A random rant

There are times when you wonder if everyone else is insane. When you want to use blunt devices to beat some common sense into people. And often the causes are so simple ...
So we want to install trac on the machine hosting our svn repositories so that we get all the nice features of a bugtracker / ticket system added to our version control. That machine is quite beefy and spends most of the time doing nothing or contemplating the infinity of the universe. Obviously I use the existing infrastructure as far as I can, so naive as I am I use "yum" to install trac. First mistake ;-)
yum is to package managers what Windows is to Operating Systems: It looks like it and most of the time it can pretend to be one. But there are some things about it that are ... how does one say this ... evil. For example it looks online for package definitions. This means that worst case it has to fetch metadata for _every_ dependency that could be depended on. So if you intend to install 1 package with 20 dependencies it will worst case recalculate the dependency graph 20 times and do 20 single requests to a possibly slow server. Also it's not deterministic, so at any time the dep calculation can change because the online definitions have changed. Added to that is antispeed in amounts large enough to keep a 3Ghz machine busy ...
Now there exist trac packages for rpm / yum, so I go ahead and let yum install trac. It pulls in a dependency or two and that's that. I look at the official trac docs, copy the relevant parts into the config files and let apache reload. Well, not apache ... httpd. Red Hat insists that it is httpd, and every time I stumble over it because medusa, lighttpd, apache, IIS etc. are all http-daemons, and apache is just one specific. So better call it apache, because it is the apache http server, right? Anyway, that can be fixed. But things will fail nicely because the rpm package from the fedora repository has some ideas. Like, you know ... default paths are boring. Be different. Just do it. So you'll have to poke rpm a few times until it tells you where it installed stuff. No biggie, trac works quite nicely after that. Well ... almost. The documentation is not very elaborate, and if you haven't set it up before it is easy to go wrong, especially with a non-standard setup. Like multiple svn repos ...
After lots of poking I had trac working with the svn authentication. What is missing is only "minor" stuff like assigning components to a maintainer so that you get an email alert as soon as a ticket is opened. The easiest way to do that seems to be TracWebAdmin, a small plugin for trac that adds some nice features. So you try to install that, only to realise that it wants very specific versions. And 0.1.2 is not 0.1.2dev4439, even when upstream says so. Now either you do some dark magic or you surrender. One could hack up the source so that the version numbers match more, but ... one wonders why upstream decides to be so dense. Also the amount of magic used in the install process is scary. trac mostly uses setuptools, which is a nice toy for installing things. I say toy because it is a bit limited in what it can do, and I say install because that's all it does. No consideration for uninstall, and upgrade ... hmmm, I don't know. Somehow it doesn't look like a good idea to me. And then I have to wonder why some pythonistas do a half-assed reimplementation of portage when portage already exists. Setuptools does not offer anything that portage (or, for that matter, apt or rpm) don't have in a more completed state. So you install something, it doesn't work and ... err ... I still haven't figured out a sane second step. Throwing some moderately large rocks at the second cosmic speed towards the perpetrators might be it.
Now, as the setuptool/.egg thing fails at life I decide to try the development version of trac that has it integrated. So I do a svn co, get about half a megabyte of checkout and ... D'oh. Use setuptools to create a package that gets installed. Nice indirection that doesn't help. Also setuptools magically install two other packages from an online source ... bad. If you wish to do that ask, but just assuming a working net connection is not nice. Also I'd appreciate some kind of cryptographic signature so that I know what this magic beast throws all over my harddisk. Accountability and all that ...
And best of all ... it fails. Hard. Reason? eggs are zipfiles that are imported like normal modules. Python can do that. But, because we are speciuhl, we do some evil path hacks so that module "banana" can be provided by "Bananarama-1.0.egg". Sounds like a great idea, but it is dumb and doesn't work. So now you have a broken path override that doesn't work which you can't easily remove ... Sounds exactly like the way a windows app installs itself. I will have to invent some new words to express how bad and wrong that is, badong doesn't do it justice. It's worse.
Now I have a messed up Python install and no reasonable rollback method ... and it fails in ways that are quite fascinating. If this was a student project I'd put a "Fail!" grade on it. So many nice ideas, so much potential, and it all breaks down because people assume that you don't want to upgrade or uninstall things. And things are always in the same place. Argh aah arghl grrr argh ...

Posted by Patrick | Permalink

Mon Jun 4 14:51:43 CEST 2007

How to win and lose at the same time

A short while ago I made an interesting observation while playing a card game with friends. Because we were mildly bored by the default rules and maybe also because there were negligible amounts of alcohol involved we began extending rules. Some of you might know "Uno" ... well, we extended it. For example since all cards exist twice we added a rule that you can throw in a card even if its not your turn if it is the same as played by anyone else. That makes the game a bit faster. And then we had these blank cards. Magic cards, so to say. At first they were "Exchange cards with any other player", which made winning totally random - everyone holds onto those cards, and once a player has almost won he gets a full hand from another player. Then that player gets "swapped" and so on. Fun, but totally unpredictable. Then we changed it to "exchange your cards clockwise", which limited the strategic impact as you could usually only hurt other players, but not benefit much yourself. We discussed some other models, but those were considered even more unfair and never implemented.

The most funny bit happened in in one of the faster games with the direct swap rule. After some nice reversals my last card was a blank. So ... I played it and won. Then I exchanged cards with another player and continued playing after winning. And lost. So these extended rules are lots of fun, but they tend to unbalance the game and cause unforeseen side-effects. You know what that reminds me of?
Lawyers. Always creating rules, never removing them. And never thinking about side-effects ...

Posted by Patrick | Permalink