Monthly Archives: November 2008

So what? Quite right!

Well, I’ve got sore fingers, and I can play some chords without that annoying buzzing sound. I’m making progress, and it feels good.

Truth be told, this guitar has been sitting in the corner of my room for years now – I made my (then) girlfriend buy one for my twentieth birthday when we were at University. I got it home, tuned it, and promptly put it back in the bag under my bed. The same thing happened to the PS2 she bought me for Christmas last year. We were engaged by then, and now we’re married, so I guess I must be doing something right.

But, I digress. The point isn’t about me playing the guitar – there’s a wider issue. It feels good to learn. Learning makes me a better person, sometimes a more interesting person, and it makes me better at my job.

What? That’s right. Learning anything makes me better at my job. Last year I took some courses in German. This year it’s the guitar. If you’re the sort of person that doesn’t want to give up learning stuff, you’re a more valluable employee, and you’ve always got something to talk about over a pint.

I want to write a technical book, but my narrative skills aren’t quite up to scratch. I know some stuff, and I keep thinking that if I could just find the right words I could share what I know with people, and we’d all be a little bit better off. I’d make some money into the bargain! A blog is a good way to practise writing, so here we are.

Take a course. Go to lectures at an art gallery. Learn an instrument. Give a talk. Read a new blog. Write a new blog. Read a book. Read another book.

Does your employer offer training? Could you learn to teach other people? Could you volunteer somewhere? Could you join a choir?

Hosted wordpress blogs allow reasonably rich text editing features, which I tend not to use. They don’t always translate well to places other than the website, and aren’t really guaranteed to work on other platforms.

For example, I use NetNewsWire Lite as an RSS aggregator on my mac. You usually just get the text there, so a special point made by using a different font or a fancy effect would be lost on me. Think of readers with blackberries, iPhones and older devices when you choose your style: I prefer to cede control to the great WordPress gods, and blame them when they get it wrong (-:

Anyway, one exception I’m happy to make is source code. It looks terrible in a variable-width font with no syntax highlighting, so any way to make code easier on the eye is something I’ll lap right up.

WordPress has a smart tag called ’sourcecode’ (imaginatively enough!) with a required ‘language’ argument, which can be one of cpp, csharp, css, delphi, html, java, jscript, php, python, ruby, sql, vb, or xml.

Unfortunately, there’s no ‘FSharp’ option (maybe someone should suggest it – surely it can’t be that complicated to implement?), so none of the options really fit. At least it’s a fixed-width font, though, and is a little easier on the eye. After a little experimentation I’m happiest with csharp, as it knows about primitive types and doesn’t get things wrong as much as the other settings do. Here’s an example:

#light

let getHostPort servicename =
  let host, port = serviceBroker.GetDetails serviceName
  host, port

Here’s a link to the formatting instructions.

Hope that helps!

A perennial question on messageboards, BBSs, and mailing lists of a certain kind is “what music do you tend to listen to when coding?” I’m a fairly lazy listener, so my answer tends to be “whatever’s on”. But Apple’s Genius Playlist feature has revolutionised the way I listen to music.

I’ve never really bothered with manual playlists – they take too much time to create, and have a short half-life before you get bored with them. The recently added smart playlist in iTunes is useful, because I often want to lsten to a new album the whole way through. But I reckon that’s a fairly uncommon desire. Unfortunately, because of the way the menus on your iPod are laid out, it’s quite often what people end up doing.

Genius playlists allow you to choose a track from your collection that suits your mood. It’ll then generate an ad-hoc playlist of twenty-five tracks from your collection that match the choice you made. The result is a couple of hours’ listening that matches your mood. It works on iTunes on your Mac or PC, and on your iPod. You can save generated playlists for later, and regenerate one if it’s not a very good choice.

I don’t know how Apple generate the track listing. When you first switch on the feature iTunes spends some time analysing the tracks in your collection, and talks to Apple about what you’ve got. It doesn’t seem to do any ‘rights’ analysis to see if you actually own the music in your library.

The thing is, the technology isn’t new. Audio analysis has been around for ages in the form of voice commands for computer systems (extant, but clearly not ubiquitous). British readers can use Shazam – call 2580 from your mobile phone, and the computer on the other end will listen to the music in the background for a little while, hang up, and text you back with the name of the track and the artist within a couple of seconds. It’s great fun to figure out how it works.

Amazon.com have been suggesting books you might like for years – they generate links between products based on what other people have looked at and bought. It’s a fairly good metric. Spam filters have been analysing documents for similar characteristics, although they generally only have two buckets for the results – spam, and not spam. Google Sets understands the links between collections of things – enter ‘John’, ‘Paul’, and ‘George’, and Google will tell you that the missing member of the set is ‘Ringo’ (the miserable sod).

The spam filter is the odd one out here. The cost of a false positive for Google Sets, Amazon’s recommendations, and Genius playlists is fairly low. Google don’t lose any money if they mistakenly thought you were naming the apostles. If you don’t take Amazon’s advice it’s really no skin off their nose (and if you buy something else instead, guess what? They get another data point and do better for the next guy). You can regenerate a Genius playlist you didn’t like, and what’s more: there’s a way that you can improve the results.

As well as showing a list of matching tracks in your collection, iTunes will also download a list of similar songs that you don’t own, and show you how you can buy them from the iTunes music store. All of these systems benefit better from more data. Google has plenty, so does Amazon. If you don’t have enough music in your iTunes library, it’s not Apple’s fault!

So, how might Apple be generating those track listings? I’ve got a couple of ideas:

  • They might know the contents of peoples playlists. Assuming that tracks in a single playlist are similar, they’d create a weighting between those tracks.
  • Similarly, they could do the same with tracks people bought in a single iTunes Music Store session.
  • They might put a lesser weighting on the sum total of all the tracks that a single person has bought in the iTunes Music Store, based on the assumption that generally, different people listen to different kinds of music.
  • They might do audio analysis on your music (or buy the data off someone else) – BPM, key instruments, genre, style, timbre, etc.
  • They clearly know what music a person has in their iTunes library. I’d expect that they’ve got dynamic statistics too, like how highly people have rated various tracks, and how many times they’ve listened to a track. All this can be aggregated together, too.

Lots of those things seem ‘hand-wavey’, but bear in mind that iTunes has millions of users and assumptions based on aggregations of huge data sets often work. Ask yourself what constitutes a false positive entry in a playlist? And who decides?

Hiring good developers is hard. It turns out, there just aren’t that many out there. Occasionally, you’ll get lucky. You’ll look further afield and find a pocket of clever people, but you’ll bring them all in on tasty salaries, only to find that they all clock off at five pm, or they want to re-write everything you’ve got in erlang.

Well, that’s just tough luck. From what I’ve seen, the best way to ensure a great time is to hire hard. When we interview C# developers we tend to ask C++ questions. You’d better know your memory model inside out, because anything on your CV is fair game.

There’s nothing more painful than watching an average candidate fall apart because she put ‘Advanced Java’ on her list of skills, then didn’t know static from abstract, but it happens all the time. The thing is, we want you to succeed, we really do. Most of us enjoy interviewing because it’s a chance to geek out with someone who has the same interests.

We interview hard – you’re going to have at least two hours of technical interviews before you get hired, but the single most important question we ask ourselves, after every interview, is “could I work with this person?”. If the answer isn’t a resounding “yes”, then the answer has to be “no”. Sorry!

But it has to be like this. If it weren’t then you’d end up with people you like but who couldn’t do the job. In the best cast you’d end up resenting them. In a small firm, they might have an effect on your company’s bottom line.

This is one of the prettiest things i’ve seen on the web in quite a while:

The team from Idée Inc. use Flickr’s API to generate a large corpus of ‘interesting’ images. Then they filter based on colour to show similar images. Further, their technology ‘Piximilar’ finds images that look like an image that you select.

I’ve done some work in the past with Media Bin from Interwoven, and they had a similar ’search by colour’ feature. It’s great for brand images, and the results get better and better as you add more images. That’s why it’s fantastic with a huge body of free images like Flickr.

All of my pictures on flickr are licensed under Creative Commons – not because of any ideological feelings (I don’t have a problem being paid for work I’ve done), but because I like using other peoples’ photos when I can, and that system only works if most people abide by the rules.

I recently did this, and it’s a little convoluted.

I don’t have an external CD drive, or a >1Gb flash drive, so I thought I’d give netboot a go. Here’s what to do:

  1. On your ibook, start the tftp server:
    sudo /sbin/service tftp start
  2. Download and extract the pxe image to your tftp folder:
    wget http://archive.ubuntu.com/ubuntu/dists/hardy-updates/main/installer-i386/current/images/netboot/netboot.tar.gz
    tar -xvzf netboot.tar.gz -C /private/tftpboot
  3. Download, compile and run dnsmasq, a DHCP server:
    sudo fink install dnsmasq
  4. Add the following to /etc/dnsmasq.conf:
    user=root
    resolv-file=/tmp/resolv.conf
    no-poll
    interfact=en0
    dhcp-leasefile=/tmp/dnsmasq.log
    dhcp-range=169.254.32.0,169.254.32.100,86400
    dhcp-option=3,169.254.32.135
    dhcp-boot=pxelinux.0
  5. You’ll need to change some of those bits. First of all, the interface name should match that of your iBook’s built-in ethernet port. Run `ifconfig` in a terminal window to find that out. Whilst you’re there, find out what IP address has been assigned to it, and slip that into the dhcp-option line. Then change the range to match the first three parts of your IP address – this is the range of addresses that your DHCP server will choose from when your Aspire asks for an address when it boots up.
  6. Switch on the DHCP server:
    sudo dnsmasq -C /etc/dnsmasq.conf

    Connect your Aspire and iBook together with an ethernet cable, and turn on your Aspire.

  7. Early in the boot sequence you’re given the opportunity to go into setup. Hit ‘F12′ and choose to boot from the network interface. Then save & exit. With any luck, your Aspire will ask your iBook for an IP address, be given one, and will load the pxelinux.0 boot file with tftp.
  8. If something goes wrong, there are a couple of things you can do. Check the screen for useful output (at this early stage of the game it’s not terribly likely that there’ll be much there, but you never know). Try to get the pxelinux file from another computer using a tftp client (there’s one build into OS X, certainly, and they’re easy to find on the net for other Operating Systems). Look in the dnsmasq log file for information. I was stuck at this stage for quite a while, and in my case the fix was to play with the range of IP addresses until I got it right.
  9. If all goes well, you’ll be prompted to ‘boot’. Just hit enter, and keep going through hardware and network configuration. The bootstrap installer will need to access the internet to download the rest of the install files, so select a mirror and watch it break.
  10. That’s right, it’ll probably break at this point. Remember how we gave the aspire an IP address to allow it to boot up? Well, it now thinks it can access the internet, and it probably can’t. So, switch off the DHCP server on your iBook
    sudo killall dnsmasq

    Then enable internet connection sharing on your iBook. In my case my internet connection was wireless, so I was fine. Otherwise, try plugging your aspire straight into the router or a switch, as long as there’s a working DHCP server on your network (it’s probably your router)
    System Preferences -> Sharing -> Internet

  11. Then, if you’re lucky, going back a few steps in the installer and re-auto-detecting network settings should be all you have to do. Your router should provide your Aspire with an IP address for the local network using DHCP, and you should be able to continue the download. That didn’t work for me, I’m afraid to say, so I had to manually configure the network settings for my laptop. Here’s how to do that:
  12. Ensure your Aspire is connected to a machine (or router) with internet access. In my case it was my iBook that was connected to an Apple Airport Express via wifi. Hit `ifconfig` in a Terminal, and find the interface (en1, in my case) that’s connected to the internet. Look for a line saying ‘inet’. Pick an IP address and Netmask based on the values in that line, though the IP address you choose probably shouldn’t be the same as any machine on the network.
  13. This did the trick, in my case. If not, go back and try auto-configuring the network again. Sometimes the manual changes you made will kick the thing into life. I know that sounds quite unscientific, but the whole thing seems like voodoo to me anyway.

At this point, you should be able to continue from step 3 (“Tweak/Fix”) on the Ubuntu AspireOne install page. Good luck!

(keep an eye out for my upcoming post ‘Is linux still not ready for the desktop?!’)