Monday, November 23, 2009

IDLE & Python 2.6 escaping mishap

Here's an odd one that can catch out a newbie (well, me, at least):

x = '\x0'

Do that in the interpreter and it'll tell you "ValueError: invalid \x escape"... put it in a source file and execute it with F5 and nothing will happen, other than focus switching to the interpreter window. No message, no nothing. Had to do a binary(ish) search, commenting out the whole program minus one print statement and checking that it runs, then commenting out about half the file and homing in on the buggy line that way - I was writing a unit test which checked that the output of a particular function was a zero byte (the most trivial case of about 12 tests).

When you do it in the IDLE/Python 3.1 bundle, you get a notification as expected, but not in the 2.6 version for the Mac. Pity pygame doesn't work in Python 3 yet.

Sunday, November 15, 2009

Children as a hardware stress test

Phoned Medion because their data CD for this el cheapo car GPS system was just ejecting after ~10 seconds when I put it in my Macbook. The guy says "well it's not designed to run on Apple computers, we can't support them. You'll need to use a Windows machine."
So I says "wtf do you mean? All the computer is for, is to transfer map files from the CD onto an SD card which goes in the device. If it's not running any software on the computer then why would it matter what operating system I had?" and that was pretty much where I lost him. Figured it was some kind of completely braindead and needless copy protection that failed on OS X machines and went looking for torrents... unsuccessfully.

Then stuck in a DVD today and the same thing happened - doh! - just the disk getting pulled in, faint clicking for 10 seconds then the disk ejects. I tilt the laptop and hear something sliding about in the drive. Shit! Did some belt or mounting snap off?
Checking prices on eBay for a new 'superdrive' - cheapest is about €45 with postage, not bad but ouch, and opening the machine to swap DVD drives is a slog.
Maybe I can at least shake the broken object out of the drive and see if it's really screwed or maybe a fragment of a broken CD or something...
Hold the laptop with the DVD slot facing the floor, tap gently for 20 seconds, poke around in the slot with a playing card and what comes out?

A poxy 2c coin. Children FTWTF. Works now tho!

Sunday, November 08, 2009

Funny Chinese expression of the [arbitrary time period]

显怀 (xiǎnhuái): To look pregnant / Obviously pregnant