February 28, 2005
London Java Meetup tonight

Turnas out that I can make the London Java Meetup this evening. But since I still can't see Haloscan, I can't tell Jez about it...

Anyway, see you there.

Posted to Java by Simon Brunning at 01:48 PM
February 25, 2005
As long as that?

Today is Work Your Proper Hours Day. I'm not sure I can last that long...

Posted to Business by Simon Brunning at 04:16 PM
February 24, 2005
iPod earphones

Steve's having trouble with his iPod headphones and his he'll-grow-into-them ears.

I'd recommend that you pick up some Sony MDR-EX71s, Steve. (Now available in white!) I had a pair of these, and they sound fabulous.

My pair died, but Tulna's had hers for ages, so I think that I was just unlucky. I picked up some cheap 'n' cheerfuls, but they are no good at all, so I'll be picking up another set of EX71s when I see them.

BTW, is it just me that can't see Haloscan? I can't see the haloscan comments on any of the blogs that use them (Steve's, the London Java blog, witho etc.), and I haven't been able to for some days now.

Posted to iPod by Simon Brunning at 12:40 PM
New iPod software

iPod Updater 2005-02-22

I don't have my power supply with me, so I can't try this until I get home. And come to think of it, I'm out this evening, so I can't try it until tomorrow.

"Shuffle Songs selection in Main Menu" - my iPod already has a "Shuffle Songs" item in the main menu, so what does this mean? Does it allow you to toggle the shuffle settings as you can from the settings menu? (You know, that Songs/Albums/Off) thing? That would be nice.

Nicer still would be the ability to put selected playlists in the main menu...

Posted to iPod by Simon Brunning at 12:23 PM
February 23, 2005
Freja's pictures

Freja seems to have discovered email. I've had three from her today, which is really nice.

She's asked me to put a couple of her pictures on the Internet. Here you go, Freja:

Freja's picture

Freja's picture

They seem to have shrunk in the wash. Still, not to worry...

Posted to Family by Simon Brunning at 05:08 PM
Nuclear Now!

Nuclear Now! It's probably too late for anything else. We probably need these.

Fusion would be better, but that's jam tomorrow. Renewable would be better, but there's no way we can build enough of that in time. Cutting down on the energy that we use would be better, but people love their cars, TVs and refrigerators too much. We don't have to like it, but it seems to me that nuclear power is the only way to save the world at the moment.

Posted to Science and technology by Simon Brunning at 04:29 PM
Online lyric database

Anyone know of an online lyric database that I can get to pragmatically? I'm not above a bit of scraping if need be, but I'd prefer something cleaner - and I want somewhere that explicitly states that programmatic access is OK. I don't want to rub anybody up the wrong way.

I'm thinking of putting together something to display the lyrics of whatever I'm listening to in iTunes. Catching the events that tells me what's playing seems to work OK. Here's my proof of concept - show_playing_track.py. The next stage will be to actually retrieve the lyrics from somewhere.

I did look at EvilLyrics, but that seems to bugger iTunes up on my PC. Besides, it's more fun to write my own. ;-)

BTW, I've cleaned up convert_tracks.py a little, and made it a little more robust. It doesn't choke on read-only files now. Is there a cleaner way to write enable files in Windows than os.chmod(filepath, 0777)? That 0777 is nasty.

(See Batch iTunes track conversion with Python and COM for more about convert_tracks.py.)

Posted to iPod by Simon Brunning at 01:17 PM
The real problem with Java

I've realised what the real problem with Java is, for me. It's not the fact that my productivity is much lower with Java than it is with Python. After all, it's my management that decide that I should be using Java, and if they want to make me less productive than I could be, it's their prerogative.

And it's not the vast raft of tools, libraries and frameworks that a modern Java application uses that bothers me. It's a problem for a lot of people - c.f. Bruce Tate's superb Better, Faster, Lighter Java (on which more later), but I like learning new stuff, so I'm happy.

No, the problem is that Java coding is just no fun...

Posted to Java by Simon Brunning at 12:54 PM
February 22, 2005
Mad website of the day

Project C-90, via Rhodri.

Posted to The Internet by Simon Brunning at 12:58 PM
February 16, 2005
Kyoto

Kyoto Protocol comes into force.

It's far too little, China and India don't have to cut their emissions for ages, and the world's largest polluter, the US, aren't even playing.

Still, it's the first time that there has been any legally binding agreement to cut emissions, so it's still good news. It might just be the first step in saving the world.

Posted to The Big Room by Simon Brunning at 03:10 PM
Livingstone, I presume

OK, so I've done religion. Now for a bit of politics. ;-)

Livingstone. Hmmm. Well, I think that his choice of language and metaphor were, uh, well, unwise would be putting it far too lightly.

But while I think that he shouldn't have chosen to speak the way he did, I don't think that he should apologise unless he genuinely thinks that he was wrong. And in fact, I think that his assessment of the Mail and the Standard is correct in essentials; they are both appalling crypto-fascist rags.

Posted to The Big Room by Simon Brunning at 02:15 PM
February 15, 2005
The Horse's Mouth

Steve and I will be meeting at The Horse Bar, near Waterloo, this evening. I've got some ranting to do. If you feel you can put up with that, you'd be more than welcome.

Posted to Beer by Simon Brunning at 01:01 PM
Very superstitious, writing’s on the wall

Superstition.

In answer to you, Katherine:

When you believe in things,
That you don't understand,
Then you suffer,
Superstition ain’t the way.

OK, OK, that's a crap answer. The real answer, so far as I can see, is that people like to think they understand the world around them. Science doesn't (and doesn't claim to) answer all questions, and understanding many of Science's answers is hard work. Both of these things make people uncomfortable.

Superstition offers easy answers. It's all bollocks, but it's easy. That's what people want.

Posted to Apropos of nothing by Simon Brunning at 12:52 PM
February 14, 2005
More holiday

The holiday problem has been alleviated to an extent. By special dispensation I've been allowed to carry over ten days instead of the usual five, and I'm taking a couple of days off this week. (It's the girls' half-term.) So, I'll only be losing five days - that's my best yet!

Still, I'm probably only postponing the issue. I'll probably find myself with thirty days to use up next February.

Posted to Apropos of nothing by Simon Brunning at 05:08 PM
OK, own up...

I've asked around, but I can't work out who hid all my cards today. Ok, a joke's a joke, but it's own-up time. Who was it, and where have you hidden them all?

Posted to Apropos of nothing by Simon Brunning at 04:24 PM
The Indy online

My paper of choice, The Indy, has a woeful online presence. No RSS, and password protection on old content. A real shame. It's not like they are likely to be making money online, after all. It hurts me that The Bigot is ahead of The Indescribablyboring online.

The Indy's science and technology editor seems to be pretty clued up, on the other hand. He's a blogger, after all - Charles on... anything that comes along. Perhaps he'll drag them into the 21st century? But I doubt it. Wise words from the techies seems to have no effect on the PHBs in my experience.

Still, no, Scobie, Newspapers aren't dead. The BBC and the like might well compete on pure news, but when it comes to editorial, opinion and background, I've found nothing online that competes with real papers. And even if I could, I still wouldn't be able to read it on the tube.

Posted to The Big Room by Simon Brunning at 04:14 PM
'Darkies Out' via RSS

Thanks to davblog for pointing out that The Daily Bigot can now be read via your aggregator. Or you could just ignore its xenophobic and reactionary ravings altogether, as I do.

Or at least I try to. I can't help but spot the headlines on the tube now and again. It rarely fails to make me apoplectic. The Bigot is the single most malign influence on British life, on my opinion.

Posted to The Big Room by Simon Brunning at 03:36 PM
Power Exfoliation Treatment, £75

I didn't have the girls for a change this weekend, so I had a grown-up Saturday with Michael, wandering around the West End. Michael had a pre-arranged appointment to have his hair cut, so I went along. The whole thing was a bit of an experience for me. He went to The Refinery. £48 for a hair cut! (I've never paid more than £5 myself.) And that's at the cheap end of things. An Ionithermie Body Treatment is £110. (Whatever that is.) Top of the range - an 'Overall Overhaul', £250!

Michael, you understand, is a real metrosexual. He was metrosexual before there were any metrosexuals. He has tens of pairs of shoes, and he colour co-ordinates. I, on the other hand, am very unreconstructed in the fashion sense. I shave my own head, I only need to own one pair of shoes and one pair of boots at any given time, and if I colour co-ordinate it's only because I only own clothes of one colour. Typical nerd, in other words.

Still, I'm sure that it's all worthwhile for him. He was, after all, voted the fittest bloke in IT at St Andrew's last Christmas.

I didn't actually go in myself. If it ain't broke...

Update: Paul M reminded me of the term 'retrosexual'. I suppose that it kind of applies to me - though I've never referred to myself as a 'real man', and I don't get the opportunity to reject casual sex all that often.

Posted to Apropos of nothing by Simon Brunning at 03:00 PM
February 11, 2005
Blue Saturn

APOD is particularly spectacular today.

Posted to Science and technology by Simon Brunning at 11:02 AM
The curse of the project meal

We had planned the project meal to be on January the 31st. The system blew up spectacularly that day.

We fixed that, and re-scheduled the meal for today. Guess what's happened.

Update: Fixed. It was a nyetwork issue. We're off to Haz...

Posted to Software development by Simon Brunning at 10:31 AM
February 10, 2005
Bloody typical

I post about Python, I post about Java, I post about iTunes, I post about world events. What gets all the comments? A post about a smelly person. That's blogging for you...

;-)

Posted to Blogs by Simon Brunning at 03:49 PM
Stinky

The security guard at our front desk smells. I mean, he smells bad.

He's nothing to do with our company - he comes with the building. He's been around for about six months now. You've often caught a faint whiff of BO as you've walked past him, but it's never been troubling - you've just considered yourself lucky not to have found yourself next to him on the tube. But over the last couple of weeks, it's become an order of magnitude worse. It's no longer just BO - now he smells rank - like something has died. And it's not just a whiff any more, either; you can smell him all the way up the stairs.

Tracey keeps threatening to leave a bar of soap on his desk. When he's not there, that is, naturally.

I have no idea why I'm posting this, really. It just had to be said.

Posted to Apropos of nothing by Simon Brunning at 02:11 PM
Python meetup at The Stage Door, Waterloo on the 9th

I've had a promising response to my suggested London Python meetup. If even half of them turn up, I'll call it a success.

BTW, the London Java meetup is on the 28th. I probably can't make it, :-(, but don't let that stop you.

Posted to Python by Simon Brunning at 01:24 PM
Weird Eclipse error

I've come across the error message "The import somepackage cannot be resolved" loads of times - I'm sure that we all have. It usually means that you are missing a JAR file from your project's build path. But I'm getting it under strange circumstances this time...

The package that Eclipse is objecting to at the moment is in the current project! If I remove the import, and do an "Organise imports", Eclipse will replace the import, then claim not to be able to find it. If I hit F3 on the import, Eclipse takes me straight to the correct class.

Anyone got any ideas as to why Eclipse is claiming not to be able to resolve the import?

I have this problem running Eclipse version 3.1M4 and version 3.0.1, all on Windows 2000, with Java 1.4.2_1.

(I've also posted this to the eclipse.tools.jdt newsgroup - see Import cannot be resolved - for a class in my project!. You'll need a password before accessing this newsgroup.

Thanks in advance for all your recommendations that I switch to IntelliJ IDEA. ;-)

Posted to Java by Simon Brunning at 01:17 PM
So much holiday, so little time

I've just found out that I have to take 17 days off before the end of the month. Ooops - I really need to be a bit more organised about this kind of thing, don't I?

It's not quite that bad, actually. I can carry over five days, so I only need to take 12. There's no way I'm missing the team meal tomorrow, though, even if it isn't at Honkers.

Posted to Apropos of nothing by Simon Brunning at 12:56 PM
The Billys are nice, though

Chaos at Ikea opening. Ikea's always like that, in my experience.

Posted to The Big Room by Simon Brunning at 11:00 AM
February 08, 2005
The London Python Meetup Group

I'm having a bash at breathing some life into the London Python Meetup Group. If you are London based and fancy meeting up with some fellow Pythoneers for a beer and a war-story or two, please sign up.

If there's a reasonable amount of interest, I'll get something organised.

I've not had much luck keeping these going in the past, but Jez's huge sucess with the London Java Meetups has inspired me.

Posted to Python by Simon Brunning at 11:55 AM
There's a lot to be said for being a man of your word

But then again...

Update Thursday the 9th: What's up with the news this week? Testicle removal story number 2.

Her bare hands? Ow!

Posted to The Big Room by Simon Brunning at 11:29 AM
February 07, 2005
Team meal

The project is over, and it went well - a few little wrinkles aside. Now it's time for the team meal.

I've suggested Honkers. It's sort of like Hooters, only not so classy.

Tulna doesn't seem keen. Her last email said "Fine...if u think your wives aren't going to find out...then go ahead and go to Honkers..." I don't understand - what's not to like?

Besides, I'm single.

Posted to Beer by Simon Brunning at 05:41 PM
February 04, 2005
Batch iTunes track conversion with Python and COM

I think that I see now why Apple has kept the iTunes interface simple. It's a simple app that does simple stuff, and it just works. Once you get it into your head that you can do whatever you like, where do you stop? I see that I'm not alone in getting a bit carried away - Garth and Chris have also been having a play with driving iTunes with Python and COM, too.

Anyway, on to my latest folly, batch conversion. I initially ripped all my CDs to MP3 at 192 kbps. I've since discovered that I'm quite happy with plain old 128 kbps, especially for the more raucous stuff in my collection. And I'm running out of room. So I want to convert a bunch of track to a lower bitrate. (And before you tell me, yes, I know that converting from 192 kbps to 128 kbps will give me a somewhat lower quality that I'd have had I ripped to 128 in the first place. I'll probably re-rip at my leisure.)

Now, you can convert from one format and bit rate to another in iTunes, but the process leaves a lot to be desired. For a start off, you end up with both the original and the new track, and you have to remove the original track yourself, which is fiddly - you have to make sure that you get the right one for a start. Also, there's a lot if metadata that doesn't get copied across to the converted track - the rating that you've given the track, the last-played date, that kind of thing. Lastly, if you've put the track into any manual playlists, the newly converted track won't be in them.

So, I came up with a script to do the conversion for me - convert_tracks.py. You just bung the tracks that you want converted into a playlist (called "To Convert" by default), set the conversion rate that you want to use in your iTunes' preferences, and away you go.

This script works OK, but there are a couple of problems with it. Firstly, though you can set the encoder to be used, I can't find any way of programatically setting the bitrate. You have to do it manually via the iTunes preferences dialog. A bit of a shame, but no biggie.

More seriously, you have to be very careful to leave iTunes alone to its thing. If iTunes shows any dialog box, your iTunes COM connection will fail if you make any calls to it. I could just trap the exceptions, but that would be The Wrong Thing. Instead, I think that I need to register for OnCOMCallsDisabledEvent()s. When I get one of these events, I should hold fire on COM calls until I get a OnCOMCallsEnabledEvent(). I've had a bit of a play with registering for iTunes events - see show_playing_track.py - but it's early days, and I've been too busy this week to look at it.

(Also, it would be nice if it were to be driven by command line arguments, a cinfuguration file or even a GUI rather than by hard-coded constants - but since it's pretty much a one-off script, I really can't be bothered.)

Anyway, I hope this is of some use to somebody. (All code runs with iTunes 4.7.1 Python 2.4 and Python for Windows build 202, and may work with earlier versions.)

Posted to Python by Simon Brunning at 05:05 PM
A quick look at ElementTree

Lumigent Log Explorer is a potential life saver, as I've said before, but there are some oddities with it. All the data is there, but we've had trouble getting exactly what we want from it in exactly the way that we want it.

No matter - it has a facility to export all your raw transactions to XML. Sorted! (Well, we had to fix a couple of very minor issues before the XML was well formed - & characters were not escaped to &, and we needed to add add encoding declaration. Still, not far off.)

I've not processed much XML, and not done any at all for a while. I was never really comfortable with the Python XML libraries that I'd played with, so I thought I'd give the effbot's ElementTree module a try.

The API is lovely. After no more than five or ten minutes, I felt like I knew what I was doing.

An example. A radically truncated version of the XML output from Log Explorer might look like this - oh-bugger-its-all-gone-a-bit-pete-tong-lets-hope-i-can-recover-the-data-from-this.xml. (The real thing was over seventy MB in size.) Code to loop through all the records, pull out the relevant details (including all the row's data from a sub-element) is as simple as this:

import cElementTree as ElementTree

# Parse XML...
tree = ElementTree.parse("oh-bugger-its-all-gone-a-bit-pete-tong-lets-hope-i-can-recover-the-data-from-this.xml")
root = tree.getroot()

for record in root:
    
    # Pull out tags
    timestamp = record.findtext('DATETIME')
    opcode = record.findtext('OPCODETXT')
    table = record.findtext('TABLENAME')
    rowdata = dict((column.tag, column.text or '') for column in (record.find('ROWDATA') or []))

    # Complex stuff here...
    print timestamp, opcode, table, rowdata

Nice, eh?

Clearly my code did something a bit more complex that just printing out the data, but you get the idea. In fact, I'm rather pleased with the script on the whole. It does an awful lot with not much code - Python's dictionaries, lists and string interpolation do most of the work.

Performance? Now, I'm rather wary of venturing into benchmarking territory, so I'll just say that cElementTree goes like stink, and leave it at that.

Frankly, I'm almost always totally uninterested by benchmarks in any case. Software only has two speeds - fast enough, and not fast enough. cElementTree is comfortably in the fast enough range. Beyond that, I honestly couldn't care less.

Posted to Python by Simon Brunning at 12:14 PM
February 02, 2005
You are in a maze of twisty classes, all alike

Steve Rose is a very bad man. Vodka and Baileys is no drink for a man, but if (much against your will) you do drink it, you get very pissed indeed.

Anyway, we had a look at his code. He's fallen afowl of Java's laberynthine java.io. Now, I need a FileInputStream, an InputStreamReader and a BufferedReader to read a file, right? Or is that a FileReader and a BufferedReader? I've done this loads of times, and I still can't remember. It's hardly surprising that Steve can't work it all out. There really ought to be an openTheGoddamFileAlready() method somewhere...

Update: Here's how you do it in Python. Less is more.

Posted to Java by Simon Brunning at 11:10 AM
February 01, 2005
The Neveratoss clan

I had the pleasure of bumping into Mrs. and Master Neveratoss on Saturday at the Clapham Picture House. A bit of a surprise, since they live in Haslemere, but it's a small world, after all. Poor old Sam was a little out of sorts, but it was nice to see them both nevertheless.

This evening I'll be meeting Mr Neveratoss at The Horse Bar for, as he put it, "half an hour geeking out, then the usual looking at birds and talking nonsense". He's got a Java program that he's got some issues with, and I've got a new war-story. Anyone who thinks that they can put up with that lot are more than welcome to pitch up.

Posted to Apropos of nothing by Simon Brunning at 01:07 PM
"I suppose that you'll be needing it now."

I won't go into much detail yet over yesterdays thirteen hour epic, but it was a narrowly avoided catastrophe.

Suffice it to say that we needed a copy of Lumigent Log Explorer, sharpish. I gave Solution Data a bell at around five. "Can you give me some idea as to the lead time on a copy of Log Explorer, please?"

"I suppose that you'll be needing it now, won't you? You can download it now, and I can get you a key in, oh, an hour or so." Clearly, they know their market!

"Err, yes."

They were as good as their word. So, a big thank you to Andrew Hulley over at Solution Data.

As for Lumigent Log Explorer, well, it works. ;-) It does what it says on the tin, and the interface was good enough that we were able to do what we needed to do, despite the fact that our first exposure to the tool was when we were using it to fix a critical problem. Not pretty, and a bit complex, but then it's not exactly an end user tool. You don't need Log Explorer, but if you do need it, you need it bad.

One other thing. If your backup strategy depends on something as complex and delicate as SQL Server Replication, then it's not a robust backup strategy. ;-)

Posted to Software development by Simon Brunning at 10:40 AM