

Stumbled across this excellent article at Joel on Software today, via some tangential web surfing. (No relation to tantric web surfing)
I’ve been reading a lot of code lately, and I totally agree with him when he says “It’s harder to read code than to write it”. He argues that this is why programmers so often rewrite things rather than extend or even fork an existing implementation.
Of more interest to me, because as ambitious as I am, I’m not about to write my own kernel, are his comments on reading people’s code:
I think the best way to read somebody else’s code is just to SLOW DOWN… it’s like deciphering a code, not like reading.
Most people have trouble reading code because their eyes are used to reading at a certain speed from reading text written in human languages. But code is much more dense than English, and contains ‘secrets’ that need to be deciphered by looking elsewhere: for example, when you see that function call that says UpdateData(FALSE), unless you remember how UpdateData() works, you have to go look for it to figure out what the first argument is and what FALSE means.
My emphasis
Posted by mike on Tuesday February 22nd, 2005, tagged with linux, plugs | comments disabled
I wrote before about amarok and how cool it is. At the time I was holding off judgement on the audioscrobbler integration.
As it turns out Jeremy has beaten me to it.
So far I think it’s pretty sweet, and looks promising as a way of discovering new music.
Amarok provides the “Now Playing” image on the sidebar of this page, and if you click it you’ll be taken to my audioscrobbler page which displays what I’ve been listening to.
For the tin-foil hat brigade their privacy policy looks pretty solid, to sign up all you need is a username, everything else is optional.
Posted by mike on Monday February 21st, 2005, tagged with music, nerd | comments disabled
Spent the weekend at the always lovely North Head. Saturday was hot and humid, nice swimming weather. The sea was flat as a tack which was lovely, just floating around.
Ben and Jenny brought a snorkel which we mucked around with in the rock pool, it was awesome. There’s not exactly a barrier reef down there, but still some fish and stuff, and it’s just cool being able to see under water.
Saturday evening saw a bit of rain, but nothing major. Later on we started a fire and cooked some snags and so on. Gilby made a top beef curry kinda thing, some of which he kindly leant me.
Sunday was a bit rainy, and generally cold. We just sat around the fire and ate mostly.
During the afternoon I had a bit of a brain fade and managed to mince my hand up rather badly on a rope swing. Catherine reckons it’ll be alright, but at the moment I can’t feel my right pinky quite right, it’s like I’ve permanently got pins and needles. Make for interesting typing.
Got home about 6 to find Alli settling in on her return from Mexico. Good to have her back, although she did get up me about the state of the house pretty quickly!
I’ll have to downgrade the weekend from throughly excellent to excellent though, based on my discovery this morning that I’m actually the owner of a fine collection of grass ticks – argh!
Photos thanks to Ben C!
View the photos »
Posted by mike on Monday February 21st, 2005, tagged with friends, lyme, photos, travel | comments disabled
I spent most of last week chasing a bug in the as yet unreleased 2.6.11 kernel. I hit it originally while testing some code I’ve been writing to implement a mem=X boot-time option. After 2-3 hours of running LTP the box would drop into xmon.
Just for fun it would rarely crash in the same spot, the only commonality was that we’d generally have some registers full of random bollocks, and on further investigation we’d have a page or two of bollocks as well.
Although we had our suspicions as to which patch might have introduced the bug we still needed to tie it down. So I found my self running the test on everything from 2.6.10-bk1 to 2.6.11-rc4, I haven’t counted but that’s something like 30 different kernels.
I’m sure anyone who’s done any sort of decent testing knows all of what I’m about to say, but for me it was new, and so I’m gonna write it down here so google can keep track of it for me.
- Compile all your kernels on one box, not one of the boxes you’re trying to crash.
- Make a directory where all your kernels go.
- Always name the directory a kernel’s in the same as the kernel’s name.
- If you patch a kernel, change its name, eg:
2.6.11-rc4-with-bens-fixes
- Keep a record of which kernel is running on which box, when it crashes you may not be able to check.
- Having said that, if you’re in xmon you can usually check with:
1:mon> ls linux_banner
linux_banner: c000000000443d20
1:mon> dm c000000000443d20
c000000000443d20 4c696e7578207665 7273696f6e20322e |Linux version 2.|
c000000000443d30 362e31312d726334 2d6d69636861656c |6.11-rc4-michael|
c000000000443d40 20286d6963686165 6c40737570657265 | (michael@supere|
c000000000443d50 676f292028676363 2076657273696f6e |go) (gcc version|
Although this bug had a habit of corrupting the page holding the banner so then you’re stuffed.
- Keep a test matrix. It doesn’t have to be tied into your project schedule, or have key milestones and review points, just keep track of which kernel worked/broke on which machine, it’ll keep you sane.
- It’s also handy to record what you expect each kernel to do. Otherwise you might find yourself inappropriately excited when a kernel doesn’t crash – ie. when it doesn’t have the suspect code and therefore shouldn’t crash.
- Script it, within reason. You don’t want to spend 3 hours testing the wrong kernel ’cause you copied the wrong zImage into /tftpboot or something.
- If you’re applying more than one or two patches you need quilt or something similar, otherwise you will get confused (well I did!)
Posted by mike on Saturday February 19th, 2005, tagged with , linux | comments disabled
Thanks to Damian we also have this wonderful lineup of Mug shots.
Conspicously absent are Sarah and Nick, who certainly earned a place in this collection. Otherwise I think we’ve got just about everyone.
View the photos »
Posted by mike on Friday February 18th, 2005, tagged with friends, photos, woodford | comments disabled
More Woodford photos! You’ve gotta be kidding. Nope. Damian has kindly uploaded his shots, and here they are for your pleasure.
Captions thanks to Damian.
Some of these are, well, less than flattering. I apologise on Damian’s behalf, however death threats should be directed at him.
View the photos »
Posted by mike on Wednesday February 16th, 2005, tagged with friends, photos, woodford | comments disabled
On the way back from Woodford, Jess, Catherine, Tom and I started to reengage the analytical side of our brains.
This led to a whole bunch of questions coming up, none of which we really answered very satisfactorily, despite much discussion.
Jess had a few days off when we got back, so she did some heavy googling and came up with answers to a number of the BIG questions. I notice she didn’t come with anything explaining why girls suxes and boys rool, but I’m sure she tried.
Check it out.
Posted by mike on Friday February 11th, 2005, tagged with nerd, reference | comments disabled
I was just having a whinge about const in C, and how confusing it is trying to work out what I actually want. Stephen piped up and said “run cdecl .. and shutup!”.
[michael@concordia ~] cdecl
const char **p;
declare p as pointer to pointer to const char;
char * const * p;
declare p as pointer to const pointer to char;
const char const * const * p;
declare p as pointer to const pointer to const char const;
const char * const * p;
declare p as pointer to const pointer to const char;
const char * const * const p;
declare p as const pointer to const pointer to const char;
I’m still not sure I can parse it in my head, but next time I get stuck cdecl can come to my rescue.
Posted by mike on Tuesday February 8th, 2005, tagged with linux, nerd, rants | comments disabled
Chris describes how some “enterprising individual” made up for the lack of bike racks at the Australian War Memorial.
Apparently Security weren’t too pleased and the next photo in the series involves some rubber gloves, ouch!
Posted by mike on Tuesday February 8th, 2005, tagged with funny, riding | comments disabled
Yesterday evening I decided I needed some exercise so I tried to ride up Mt Majura. Having never been up there before I just sort of headed .. up. Turns out the track is rather direct, ie. it goes straight up the hill for about 2 kms at a 30 degree angle. I got maybe 500m up in 1st gear before I hit a big rock and stopped, and as soon as you lose momentum you’re stuffed.
After a fair bit of walking I got to the top, which was worth it. Great views, especially east towards the coast.
I fanged down the bitumen, foolishly thinking it would take me towards Hackett or Downer. But of course the road comes out on Majura Rd, out behind the airport. So I then had about a 10km ride along the highway back home, which was daunting at first but was actually quite pleasant.
Then I popped back home for a quick shower before riding over to All Bar for some pints with Catherine, Ben and Tom.
Posted by mike on Monday February 7th, 2005, tagged with friends, outdoor, riding | comments disabled