a blog by Marius Gedminas

E-books are the future

John Siracusa talks sense about e-books (via Charlie Stross):

Did you ride a horse to work today? I didn't. I'm sure plenty of people swore they would never ride in or operate a "horseless carriage"—and they never did! And then they died.

I like the bit about dedicated e-book reader devices missing the point. I'm a huge e-book fan (reading them almost exclusively since about 2002 on various handheld devices), but even I cannot justify to myself buying a bulky one-purpose piece of electronics for $lots for the sole purpose of reading books. Get something universal, like a Nokia N810 or (if you hate freedom) an iPhone. And stay away from DRM-ed stuff.

Huawei E220 USB 3G modem

Almost works out of the box on Ubuntu. Will work out of the box in the forthcoming 9.04 release.

One curious little detail: according to the manual, a blinking green light means it's trying to find the GSM network (if it's blinking twice every 2.7 seconds) or that it's successfully found a GSM network (if it's blinking twice every 2.9 seconds). I'd like to have been on the meeting when this was decided. "I know! Let's make it blink 0.2 seconds faster to indicate it hasn't found a network yet! Brilliant!"

Update: given its shape and position next to my right-hand USB ports, it should double as a USB mouse.

On an unrelated note, Sweden is a very nice country.

pydoc SyntaxError

I once needed to know about SyntaxError's attributes. Here's what pydoc SyntaxError from Python 2.5 says:

 |  Data descriptors defined here:
 |  
 |  filename
 |      exception filename
 |  
 |  lineno
 |      exception lineno
 |  
 |  message
 |      exception message

So far so good

 |  
 |  msg
 |      exception msg

Hmm?

 |  
 |  offset
 |      exception offset
 |  
 |  print_file_and_line
 |      exception print_file_and_line

Doh!

 |  
 |  text
 |      exception text

My, that was useful. Maybe the online documentation will be better?

exception SyntaxError

...

Instances of this class have attributes filename, lineno, offset and text for easier access to the details. str() of the exception instance returns only the message.

Um. Well, at least now I know I can ignore both 'msg' and 'message'. I think. Still, it would be nice to warn that sometimes the exception text can be multi-line.

Exporting to MS Word

If you're developing a web application that runs on Linux, and a customer asks for a report in MS Word format, you're going to be in a lot of pain. One approach is buying a Windows licence, installing it in a virtual machine, and hooking up an application to drive it over COM, and then figuring a way to talk to the VM from your web app. A simpler approach is generating a web archive file (.mht) and pretending it's a .doc file. Word happily opens it, usually.

Here's a random helpful tip: try not to have more than 2047 <ul> elements in it, or they'll start spontaneously nesting.

Volume control keys on Ubuntu

Does anybody else think it's retarded that volume control keys do not work if you have a menu open in Ubuntu?

I'm sure people can claim there are good technical reasons for that (the toolkit has to grab the X server to implement popup menus, and then gnome-settings-daemon doesn't see the XF86VolumeUp/Down key events or whatever), but if you take a step back and look at this from the user's perspective, it makes no sense.