March 31, 2003
Only total nerds need bother reading this

The case of the 500-mile email

Via Chris Winters.

Posted to Funny by Simon Brunning at 04:04 PM
Driving win32 GUIs with Python, part 4

A correction...

See Driving win32 GUIs with Python, part 1, Driving win32 GUIs with Python, part 2 and Driving win32 GUIs with Python, part 3.

Thomas Heller got in touch with me, and pointed out that my getMultipleWindowValues() function (see part 3) does A Very Bad Thing. It mutates a Python string. These are supposed to be immutable in Python. This didn't break anything of mine, or hasn't yet, but it certainly could. If, for example, a string being used as a key in a dictionary mutated, who knows what would happen? BANG!

Fixed code (using the array module) below. (Notice that I've also turned this function into a generator.)

def getMultipleWindowValues(hwnd, getCountMessage, getValueMessage):
bufferlength = struct.pack('i', 255)
count = win32gui.SendMessage(hwnd, getCountMessage, 0, 0)
for itemIndex in range(count):
value = array.array('c', bufferlength + str().ljust(253))
valueLength = win32gui.SendMessage(hwnd, getValueMessage, itemIndex, value)
yield value.tostring()[:valueLength]

Posted to Python by Simon Brunning at 01:43 PM
Game Boy Advance SP

I couldn't resist getting a Game Boy Advance SP. Cool as fuck, I tell you.

Games? I have Advance Wars, Golden Sun and Doom.

I can recommend Advance Wars. Incredible game. Golden Sun is pretty good too, if you don't mind inscrutable Japanese-style RPGs. Doom is a little on the retro side. I love it, but if you don't remember if from the first time around, it may well not do it for you.

Anyone else got a GBA? Which are the unmissable games?

Posted to Toys and games by Simon Brunning at 12:09 PM
Your Knowledge Portfolio

Steve's post makes an interesting point - if they sack us all, who'll buy anything?

My current company is in a similar situation. We are small, and everyone knows everyone. After some initial rounds of redundancy (mostly chaff, but some wheat), we have now all voluntarily gone on to 4 days weeks to avoid any more job cuts. For the moment, that is.

The only means you have to protect yourself really is to keep your own skill set up to date. In The Pragmatic Programmer, (which I recommend) Andy Hunt & David Thomas talk about your skill portfolio. They suggest that you should treat your skill set like your share portfolio - invest regularly, diversify, mix high-risk-high-return investments with low-risk-low-return investments. Good advice, I think.

Posted to Software development by Simon Brunning at 11:50 AM
Why the real Vietnam might start when the formal war has finished

Rupert Cornwell: Don't mention the V-word

Osama Bin Laden must be rubbing his hands with glee reading the news these days.

See also: Robert Fisk: Sergeant's suicidal act of war has struck fear into Allied hearts

Posted to The Big Room by Simon Brunning at 11:25 AM