Monday, July 31, 2006

Playing with Avahi

Today I was playing around with Avahi for inclusion in glChess. The documentation is a little thin but luckily there are some helpful people in #avahi. So in glChess subversion _glchess._udp (still don't quite get the Zeroconf naming) services show up in the (new) join game dialog. I've got the transport layer working for the network so it should all come together some time soonish.

But I can't post without a bit of a gripe... It seems a lot of APIs have ultra generic function/method calls which means when you pass in an incorrect parameter you get some useless error message. Developers *please* explicitly check the passed variable signature is correct and generate a meaningful error message if it does not.

Oh and once the networking is done I need a serious refactoring session.

Friday, July 28, 2006

Broken base tools that need fixing

Here is a note to myself for base Linux tools that require fixing:

  • ifconfig - interfaces are configured by kernel name not MAC address. You should be able to do either as Linux randomly assigns interface names (at least to ethernet devices). On my work PC I have three network interfaces. I think the issue is the USB one gets detected at different times on boot

  • Fix 'ps' - As stated earlier it does not print entire process names even when it has loads of screen real-estate. I think the whole process could be rewritten and work much better.

  • etc etc (post comments of more)

Thursday, July 27, 2006

The crapness of old software

Last weekend I was bitching to Robert about how 'ps' was crap - it only displays 15 characters of the process name no matter how wide the console is.

e.g.

bob@alchemy2:~$ ps -A
PID TTY TIME CMD
1 ? 00:00:01 init
...
4995 ? 00:00:00 gnome-power-man


Sure the Gnome Power Man is a great process but other examples don't work so well. ;) So together we checked out the source (apt-get source procps) and had a crack at it.

Holy crap it is an obscure mess. I have previously found a bug in mount and it was a mission to track it down - that code is appalling too. Why is this old "base" code so crap?

Eventually I found out how the columns were generated in 'ps' and found the column is hard-coded to be of length 15. You could change it to be bigger but the columns can be ordered in any way so if you wanted a complex output it would be too wide. It looked like the column was supposed to expand if it the last one but I couldn't get the damn thing to work. The data is copied so many times through global variables it is too much of a mission.

So I gave up still not sure where the actual printf is...

Tuesday, July 25, 2006

The Python Challenge

Mr Hunter introduced me to the Python Challenge. It's a cool puzzle that presents you with lots of computationally complex situations (which you can solve suprisingly quickly using Python). I think we got to about 15 before I thought I should catch a train home.

I enjoyed annoying him by doing it all from the command line (no smelly files/IDE for me :P)

Friday, July 21, 2006

Ubuntu 6.06 versus 128MB RAM

Yeah when they say that Ubuntu 6.06 recommends 256MB+ of RAM to install they are not joking. I was trying to install it on a Dell Optiplex GX110 and it ran like a dog. The intaller died on the partitioning step (looks like the /dev entry didn't appear). So I deleted the partition table and rebooted. This time since there was no handy swap partition it ran like a very sick dog.

Insert a 128MB DIMM and it works like a charm. I never checked the RAM when I started - it would be a nice feature to write in large letters somewhere at the start of the installer "YOU HAVE THIS CPU, RAM, FREE SPACE" etc. Oh and when did it get so hard to match RAM to a PC? It took many attempts to find a working DIMM (eventually canabalised from an old Optiplex GX110). I'm sure back in the 386 days any RAM would do :)