Why I Don’t Write Much

Ladies and Gentlemen. The magnificent Verity Stob…

The reality is even better: an extended example of that kind of feminism that implies the intrinsic superiority of women in nearly all things while simultaneously demanding privileges to compensate for claimed weaknesses, without noticing any implicit contradiction. I particularly enjoyed suggestion #4 that female-friendly projects should use attractive-to-women programming languages such as Python and Ruby (and Perl too, it says. Is Terry sure about this? I would say that Perl was notoriously one of the most engine oil-besmirched languages around, full of syntactical structures that are hard to shift if one only has small hands, and shot through with rusted-solid regular expressions that only reluctantly yield to the full weight of a big fat bloke).

I now see the programming world in a new light, and have hit upon a wonderful idea. I intend to devise an index that ranks all the major programming languages according to their pulling power. It will range from old favourites like Fortran, which is hopelessly male but in a pleasant pipe-smoking, GWR steam engine, leather elbow patches sort of way that reminds me of Dad; through to an obviously female-attracting language like Delphi: elegant and friendly, using proper words instead of resorting to pointless grunty man-squiggles, yet instinctively practical and not at all like frilly, ditzy, slow-to-react Ruby – the only language actually to be coloured pink.


It Changed My Life – Book Four

When I returned from travelling around the world, I took a crappy job fixing avionics on planes at Heathrow Airport. Ooooooooooh how I hated that job. I quit after about three months with no idea of what to do next. Eventually, I narrowed it down to one of five things.

  • Six years in the navy had not cured me of my love of the sea. I applied for a job on a millionaire’s yacht based in Antibes.
  • I rather liked tropical islands. I applied for a job fixing satellite tracking equipment on Ascension Island.
  • I rather liked “abroad” in general. I applied for a course to learn to teach English as a foreign language (TEFL).
  • I had a tiny twinge of regret that I had not been to university. I applied to Cambridge.
  • I vaguely remembered that I had been good with computers as a lad. I applied for an adult education class in software engineering.

I didn’t really have a strong preference and decided to accept the first offer that arrived in my letterbox. Software engineering came in first so software engineering it was. I headed up to the East End of London for a five month course.

If you have ever been to Whitechapel, you will know that it is one of the poorest, crappiest parts of London and home to recent immigrants, gangsters and outcasts. Imagine a neighbourhood that has not changed one whit since Jack the Ripper’s reign of terror. That should help you picture the environs of my classroom.

If you have ever been unemployed in England, you will know that there is a prevailing threat that your benefits will stop unless you attend an endless stream of adult education classes. That should help you picture my fellow students.

Our instructor was a total nutcase. It was not clear that he had ever programmed a computer before but that didn’t stop him from having a sackful of forceful opinions about software engineering. Fortunately he only showed up for class about one day in four.

The Blind Beggar, WhitechapelMy fellow students were delighted. There was a pub next door and I got pretty good at pool. Winner Stays On was the prevailing convention and one of the highlights of my life was racking up for the first game at 11AM and not leaving the table until the pub closed at 11PM after thrashing all-comers including several shady-looking characters as the evening hours wore on and the bar filled with gangsters.

A few weeks into our course, the four of us who were not receiving unemployment benefits decided to complain about the lack of an instructor. The company that ran the course – fearing for their government funding – promised to find us a new teacher. They gave us a copy of The C Programming Language by Kernighan and Ritchie to help pass the time while they searched for the new guy.

I opened the book and, on the very first page, was the program that changed my life.

#include <stdio.h>
int main()
  printf("hello, world\n");
  return 0;

Our new instructor eventually showed up and tried to teach us ADA but I wasn’t interested. I already had my White Book. I had my passport to a successful career in software.

Kernighan and Ritchie

Two weeks later, I finished my first C program – an editor for sheet music that could playback the music you had typed in. Two months later, I had my first programming job [remind me to tell you about my first gig at Reuters]. Two years after that, I was managing a 12 person team building insurance software (Ultima is still on sale!). Two more years and I was working on Wall Street then, later still, Silicon Valley.

My story is not complete unless I tell you about the Women into Technology class next door or, rather, about Rita, a woman in that class and how we moved in together and… well… that’s a longer story and I’ll save it for another day…

The very day that I started my class, I received a letter from Antibes requesting that I fly down for an interview on that yacht but I’d already made my choice and I stuck with it. I wonder how my life would have been different if I had got on that plane?

It Changed my Life – Book One

I hate internet memes too, but I like this one. List 10(ish) books that had a big influence on your life. Here are Will Wilkinson’s and Conor Friedersdorf’s and Ross Douthat’s.

Sinclair Basic

At the end of the third year at Chis and Sid, I won a prize for the most improved student. After coming dead last in my class in the autumn and winter terms, I came first in class at the end of the year and won a book voucher (I did the same thing in each of the subsequent years too but, by then, they were on to me – no more prizes for me).

On my way home from school, I stopped in the bookshop and picked up a book called Programming in BASIC (Beginners All-Purpose Symbolic Instruction Code).

My mum’s company had recently bought a mini-computer and mum took me to work one day to show it off. It was the first computer that I ever saw and she left me on my own with it for a couple of hours. I found the games!

It had a really primitive version of 20 Questions that I played over and over, fascinated that this chunk of metal could figure out what I was thinking. The highlight was when it didn’t guess my animal and it asked me for a question that would distinguish apes from moneys.

The lowlight came soon after when I introduced my first bug into a computer program. All future players, after answering “no” to “Does it have a tail?” would be asked

Is it a chim?


The full page dot-matrix ASCII of Snoopy made an impression too.


                 X    XX
                X  ***  X                XXXXX
               X  *****  X            XXX     XX
            XXXX ******* XXX      XXXX          XX
          XX   X ******  XXXXXXXXX                XX XXX
        XX      X ****  X                           X** X
       X        XX    XX     X                      X***X
      X         //XXXX       X                      XXXX
     X         //   X                             XX
    X         //    X          XXXXXXXXXXXXXXXXXX/
    X     XXX//    X          X
    X    X   X     X         X
    X    X    X    X        X
     X   X    X    X        X                    XX
     X    X   X    X        X                 XXX  XX
      X    XXX      X        X               X  X X  X
      X             X         X              XX X  XXXX
       X             X         XXXXXXXX\     XX   XX  X
        XX            XX              X     X    X  XX
          XX            XXXX   XXXXXX/     X     XXXX
            XXX             XX***         X     X
               XXXXXXXXXXXXX *   *       X     X
                            *---* X     X     X
                           *-* *   XXX X     X
                           *- *       XXX   X
                          *- *X          XXX
                          *- *X  X          XXX
                         *- *X    X            XX
                         *- *XX    X             X
                        *  *X* X    X             X
                        *  *X * X    X             X
                       *  * X**  X   XXXX          X
                       *  * X**  XX     X          X
                      *  ** X** X     XX          X
                      *  **  X*  XXX   X         X
                     *  **    XX   XXXX       XXX
                    *  * *      XXXX      X     X
                   *   * *          X     X     X
     =======*******   * *           X     X      XXXXXXXX\
            *         * *      /XXXXX      XXXXXXXX\      )
       =====**********  *     X                     )  \  )
         ====*         *     X               \  \   )XXXXX
    =========**********       XXXXXXXXXXXXXXXXXXXXXX

A couple of years later, when I won that prize, there was no question but that I would buy myself a book on programming. I didn’t have a computer though, so I wrote my programs on paper and imagined them running.

Sinclair ZX81Another year went by before Sir Clive Sinclair – who inherited the title Greatest Living Englishman when Winston Churchill died – released the first home computer for under a £100. I saved up and bought myself one.

As soon as that fuzzy little K cursor started blinking in the corner of my TV screen I was hooked and there was no holding me back.

I drew my own ascii art. I played chess in 1kB. I painstakingly copied the machine code for a draughts program byte by byte from a book. I wrote a Monopoly program. I wrote a program to do Fourier Analysis. I learned Z80 assembly language which I hand-assembled using look-up tables because I didn’t have an assembler.

Non-programmers often don’t understand what a creative activity programming is. They think it’s about following mundane instructions. I can’t think of a more creative activity.

It’s truly liberating to discover that you can make something out of nothing but the thoughts in your head. Maybe people who are gifted at painting or music get a hint of this but to suddenly find that you can imagine something and then go build it! It makes you feel superhuman.

Sinclair C5Sinclair also invented the first commercial electric car which turned out not to be so commercial after all and Uncle Clive lost both his fame and his fortune. A fickle nation turned its love to Alan Sugar and his wondrous Amstrads but I’ll always be grateful to Sir Clive for the gift he gave me.

Solar Flexus

I’ve wanted to write a physics engine for years and messing with Squeak made me want to try it in Flex. It wasn’t quite as easy as Squeak but it wasn’t too hard.

(It probably needs flash 10 to work)

So far I have gravity and collisions for circular objects. Up next: drag.

Here’s the main loop:

[sourcecode language='js']
public function tick() :void {
for each(var body :Body in bodies) {
var force :Point = calculateForceOn(body);


Inverse Square Law to calculate gravity:

[sourcecode language='js']
public function calculateForceOn(body :Body) :Point {
var force :Point= new Point(0, 0);

for each(var other :Body in bodies) {
if(body != other) {
var distance :Number = Point.distance(body.position,other.position);

var magnitude :Number = (body.mass+other.mass) /(distance*distance);

var direction :Point = other.position.subtract(body.position);

var additionalForce :Point = new Point(direction.x*magnitude/distance, direction.y*magnitude/distance);

force = force.add(additionalForce);

return force;

Look for collisions and calculate the impulsive forces:

[sourcecode language='js']
public function checkForCollision(body :Body) :void {
for each(var other :Body in bodies) {
if(body != other && body.intersects(other)) {
var normal :Point = body.findCollisionNormalTo(other);

var relativeVelocity :Point= body.findVelocityRelativeTo(other);

var relativeNormalVelocity :Number = dotProduct(relativeVelocity, normal);

if(relativeNormalVelocity < 0) { var impulse :Number = -dotProduct(normal,relativeVelocity) *(coefficientOfRestitution+1) /(1/body.mass+1/other.mass); body.applyImpulse(impulse, normal); other.applyImpulse(-impulse, normal); } } } } [/sourcecode]

And some heavenly bodies:

[sourcecode language='js']
var sun :Body = new Body("Sun", World.Origin);
sun.radius = 60;
sun.mass = 50000;
sun.color = 0x26393D;

var earth :Body = new Body("Earth", new Point(0,500));
earth.radius = 40;
earth.mass = 4;
earth.velocity = new Point(5,0);
earth.color = 0xE8E595;


I am still not sure whether I like Flex. The libraries are fantastic but the language - ActionScript - is super-annoying. It makes me wish for C#. It's allegedly a dynamic language but the compiler makes you declare every type anyway in that wacky syntax that I can never quite remember. Simulating solar systems is fun though.

My Drawing Table Squeaks

Took the kids to the Exploratorium today. It’s currently my favourite museum. Better even than OMSI (although they don’t serve beer at The Exploratorium. How come that hasn’t caught on outside Portland?)  I wish San Jose had a decent museum. The Tech sucks worse than possibly any museum in the world except Morwelham Quay.

I couldn’t find my favourite exhibit – Ladle Rat Rotten Hut. There are so many great exhibits that I have never actually seen them all.

Wan moaning, Rat Rotten Hut’s murder colder inset, “Ladle Rat Rotten Hut, heresy ladle basking winsome burden barter an shirker cockles. Tick disk ladle basking tutor cordage offer groin-murder hoe lifts honor udder site offer florist. Shaker lake! Dun stopper laundry wrote! An yonder nor sorghum-stenches, dun stopper torque wet strainers!”

Jazz fell in love with the drawing board and watched it for about 90 minutes. It’s basically a table hung from four ropes like a pendulum and a pen that draws patterns on a piece of paper as the table swings and twists.  There is a weight that makes it swing eccentrically to make the patterns more interesting.

I promised to make her a real one but I wanted to see if I could do it in Alan Kay’s excellent Squeak first. It was pretty easy and quite effective.

Here’s the program. I messed around with the constants to get different effects.

squeak program

and here’s a picture I made with it:


Today: simulation. Tomorrow: the real thing.

Wish us luck!


I just downloaded the latest version of Squeak (now called etoys). It’s MUCH better than it used to be. All the bugs are gone and it doesn’t look like it was made in 1983 any more. Go get it from http://www.squeakland.org/ then you can play with my project – Squeak: Drawing Table


Maybe you could add damping for me.

Heaven Knows I’m Miserable Now

I have been a Rhapsody subscriber for several years. The service they provide is fantastic:

Think of a song. Any song. Play it.

I suspect that people who suggest “try Pandora” (and there are many of you) probably don’t get what Rhapsody is about. It’s like owning all the songs in the world and you can play any one at any time.

But their software absolutely sucks.

RhapsodySo when Rhapsody suspended my account (I got a new credit card and forgot to tell them), I took it as an excuse to go see what else is happening in music software in the years that I have been gone.

I tried something like twenty different players this week and they pretty much fall into two basic categories:

  1. Music discovery (like Last.fm and Pandora)
  2. Playlist management

Within category 2, there are two business models (purchase tracks or monthly subscription) but the software all has the same primary use case:

User wants to manage their playlists.

They are playlist managers with the ability to actually play the music seemingly tacked on as an afterthought.

I don’t want to edit playlists.

I hate playlists.

Playlists are very seductive at first. You think Oh yes. I’ll build me a playlist with all my favourite songs. But then, after the third time you play it. You start thinking Oh man! This again!? I’m gonna build me another playlist. Then I’ll have two.

Before you know it, you have hundreds of playlists called things like Early English Folk (I) and Early English Folk (II) and you are spending all your time managing your playlists which, by the way, is exactly what the people who make the playlist managers want you to be doing.

No. Playlists are not a good solution for anything.

Here’s what I want:

I want to listen to music that I like.

I’ll clarify that a little:

chetOne day, I might have a hankering to play 7 different versions of My Funny Valentine (Chet Baker’s is best) or every single recording of John Barleycorn Must Die (Traffic’s).

piratesAnother day I’ll have an urgent need to listen to Rogue’s Gallery: Pirate Ballads, Sea Songs, and Chanteys – because there is a piratefest coming up – or to hear the latest Lily Allen album.

I might have just read that there have only ever been two songs sung in latin to make the UK Top Twenty and I’ll want to hear them both.

gogolI might be on my way to a Gogol Bordello concert and I want to hear their albums over and over to get myself in the mood.

But most of the time,

I just want the thing to play me stuff that it thinks I’ll like.

Pandora excels at that last one but is a non-starter for the rest. iTunes will do the job if you don’t mind shelling out 99c every time you have a hankering to listen to some early Abba. If you listen to a lot of music, those 99cs will soon rack up.

So given that

a) music subscriptions rock and

b) the software for music subscription services sucks

oh, and by the way,

c) I have been meaning to learn Flex for a while now

there is only one thing for it…

..I’ll have to write my own damn software.

So that’s what I have doing the last few evenings. It’s fun. I don’t get to program much at work any more so it’s a nice change of pace. I have a prototype that will play Rhapsody or Napster tracks on my wonderful Squeezebox. I have a design all sketched out and I even have a color scheme and icons (step 3 – profit!)

clown music

So, meanwhile, in my ongoing quest to find some existing software that doesn’t suck (and to steal ideas) I keep trying out new players and services. So far, they are all – every single one of them – playlist managers until…

…this morning I discovered GrooveShark.

GrooveShark is uncannily like my sketched design (they even copied my color scheme and icons) and I have been playing it all day.

They have a passably good search screen (mine is better of course but, since it is only sketched on paper, doesn’t work as well as theirs) and it is easy to find a song and stick it in your queue. But, what makes them different from everyone else is that tantalyzing autoplay button.


If you stop adding tracks to your queue, AutoPlay will start playing stuff that it thinks you will enjoy. That was gonna be my killer feature!

I have figured out their algorithm though.

It is:

Play The Smiths.

Did the user veto it?

No – Play The Smiths all day. Over and over (and over). Throw in the occasional REM track.

Yes – Play REM all day (throw in some Smiths though in case they have changed their mind).

Try playing some rap every now and again to make sure they are paying attention and not just listening to any old crap.

Play some more Smiths.

That’s it.

If I had known it was this easy, I would’ve done it years ago.

Technology Crisis

I feel a Technology Crisis coming on. Here were my clues:

Exhibit A: I’ve been meaning to learn Flex for a while. I have got as far as “Hello World” four times now.

Exhibit B: The Rhapsody client sucks. I love having access to all the music in the world but the client really, really sucks. The web client doesn’t completely suck but it’s a web client so it sucks a fair amount.

Put those two together and you have yourself a challenge. Build a new client for Rhapsody in Flex. How hard could it be?

rhapsody1Pretty hard it turns out, because Rhapsody does every thing in its power to make it hard for developers to use their APIs for anything useful. They have an amazing RESTful API that was years ahead of its time. They have a fantastic affiliates program. But – to make sure that no one does anything useful with the API, they force you to use their crappy player.

Go read their forums and you’ll find four years of posts like this:

Dear Rhapsody,

I luuurrve your service but your client is crappy and I would like to write a better one. Hey! You know what? I have a great idea that would send new subscribers your way by the thousand! Just give me an api to play songs. I could even use your player if you’ll give me a method to play a song and let me know when it is done.


Your Biggest Fan

PS. Let’s make some $$$$ !!111!

And there are four years of replies saying,

Dear Biggest Fan,

We don’t have that API right now but I’ll mention it to product management and they’ll get right on it. Meanwhile we have this asinine JavaScript API. It doesn’t really do anything, but it’s what we have.



There was even one VC funded company that figured out a backdoor. The upside for Rhapsody was that they sent scads of new subscribers their way. The downside was that…no …wait…there was no downside. Anyway, someone at Rhapsody decided that they didn’t want all these new subscribers and set the lawyers on them.


I still check the forums for old times sake and there are still hopeful posts like this one:

Dear Rhapsody,

I love the new Flash Player. I see there is a sendMessage() method but I can’t figure out how to work it.


Another Huge Fan

and the reply pretty much says “Don’t be using the sendMessage() method or we’ll set the lawyers on you like those other people who wanted to help us make money.”

Makes you wonder.

Anyway. Fast forward to yesterday and I decided to make a start on my little project. I got stuck (as you do) and googled.

Instead of finding my answer, I found:

The Rhapsody subscription service, which is 51-percent owned by RealNetworks, lost approximately 50,000 of its 800,000 subscribers over the past three months

I went to the forums and found that they have just had big layoffs at Rhapsody. They are going to focus on their web services instead of client software. Oh. And they cancelled the affiliates program.

I wonder if they laid off the dude who decided that they didn’t want third party developers writing clients for their still excellent service?


napsterExhibit C: Napster just reduced their subscription service for all-you-can-eat music to $5 a month. They’ll even throw in 5 free mp3s of your choice. I was happy paying $15 a month to Rhapsody but if Napster’s client is even a tiny bit better, I am switching.

Exhibit D: I use my Sansa to play Rhapsody in the car. It’s pretty crap, but there aren’t too many choices. I’d soooo get an ipod if Apple had a subscription service (or let me use rhapsody).

g1Exhibit E: Napster works on the G1.

Exhibit F: I have been wishing I had a camera.

I don’t need too many exhibits to know that the times are a-changin’ and I might be finally ready to get a phone that costs more that $12, that has a camera and that plays music from a subscription service.

But you can’t rush into these things. I need to mull over the idea for a while. Maybe the interwebs will help me make up my mind.

I’ll finish my Flex app but instead of having it drive Rhapsody, I’ll make it drive the Most Excellent Squeezebox because the nice people at SlimDevices know that, if you have a great product, you don’t need to write all the software for it. Expose some useful APIs and The People will do the rest.


Humane Software

I have had my Squeezebox for a good while now but I just discovered that I have been missing its best feature.

Squeezebox comes with SqueezeCenter – a piece of software that lets you remote control your Squeezebox from a PC.You can stream music from your hard drives or iTunes or any number of internet radio stations or subscription services. But the best bit is that SqueezeCenter is hackable.

SqueezeCenter is open source and has a plugin model and there are tons of plugins for it. Here’s my favourite:

Do you ever find you’re in the middle of listening to your favourite track when your other half suddenly announces that the volume is far too loud and turns it down for you? If so, this may be the plugin for you! VolumeGuard detects “unauthorised” changes in volume and stealthily restores the volume to its original level. Changes are made in small increments over a period of time, so with any luck they won’t notice!

I have wished for that since forever! Well done, writer of VolumeGuard!

Problem 12

To save you going all the way to Project Euler to read it, I have copied problem 12 here for your puzzle solving convenience…

The sequence of triangle numbers is generated by adding the natural numbers. So the 7th triangle number would be 1 + 2 + 3 + 4 + 5 + 6 + 7 = 28.

The first ten terms would be:

1, 3, 6, 10, 15, 21, 28, 36, 45, 55, …

Let us list the factors of the first seven triangle numbers:

1: 1
3: 1,3
6: 1,2,3,6
10: 1,2,5,10
15: 1,3,5,15
21: 1,3,7,21
28: 1,2,4,7,14,28

We can see that 28 is the first triangle number to have over five divisors.

What is the value of the first triangle number to have over five hundred divisors?

In case you were wondering, the answer to problem 10 is

primes = Primes.new
puts primes.find_primes_less_than(2000000).inject{|s,n| s+n}

How come inject and collect haven’t caught on in other languages? They are awesome.

Forgetful me

According to Kurzweil, the singularity (the moment when we will start to invent things instantaneously) will occur in 2045. According to me the singularity (the moment when I forget things fast than I can learn things) occurs in 2009.

Every time I start over with Ruby (or XSLT or …) I find that I have forgotten the most basic things (like how to construct an object).

Anyway, thanks to Project Euler (according to which, I am 4% genius), I had an excuse to go go back and learn Ruby all over again.

Here’s my prime number generator (which is about a third of the size of my Java version):

class Primes
  def initialize
    @primes = []
    @next_candidate = 2

  def prime? number
    root = Math.sqrt number
    find_primes_less_than root

    @primes.each do |prime|
      return true if prime > root
      return false if number % prime == 0

  def find_primes_less_than limit
    until @next_candidate > limit
      @primes << @next_candidate if prime? @next_candidate
      @next_candidate += 1

  def [] index
    until @primes.size > index
      find_primes_less_than @next_candidate + 100
    return @primes[index]

The answer to problem #7 is @primes[10000], in case you were wondering.