Computers

Crazy high CPU usage on Snow Leopard and a surprising culprit

After coming back from a team-building trip, I started to notice things were going a bit slow on my work laptop. I took it with me for casual emailing and working on the train, but spent about 4 days not really using it and certainly not ‘working’ on it. It came out once to display the lyrics to a song about Pithivier, and once to check emails, but that was about it.

Read more →

WordPress on Apache being Reverse Proxied by Nginx in an Endless Loop

I have a couple of WordPress installations running on Apache (on a non-80) port, and I’m reverse proxying them through nginx. Somewhere along the line WordPress is getting its knickers in a twist about the port not being the same as it expects. This results in WordPress going into an infinite redirect loop. To solve this, I put this in the nginx virtual server config: proxy_set_header Host $host; Fixed.

Read more →

In Which we Discover Some Rules About Python Scoping (which we already knew)

I’ve just been bitten by scoping in Python. If you gave me this code and asked me what it did, I’d probably guess that it was a trick question and look carefully at it. What would you say? def demo(): number = 100 one = number / 100 numbers = [one, one+1, one+2] big_numbers = [number * 100 for number in numbers] bigger_numbers = [big_number * 100 for big_number in big_numbers] print number  It’s not obvious.

Read more →

From La Mantovana to the Moldau. Musical similarity in the absence of rhythm and what it means to FolkTuneFinder

Má Vlast is a set of pieces written by the composer Smetana in the late 1800s about his homeland, Czechoslovakia. One of the pieces in the set, The Moldau (Vltava in Czech) is one of my favourite symphonies of all time ever. It could be something in my partially Czech blood, it could be the fact that I’m soppy about Romantic-period orchestral music, whatever it is, I love this piece of music and know it intimately.

Read more →

FolkTuneFinder index building used to be expensive

The first version of FolkTuneFinder was written in a combination of Java and PHP. I was still working out the best way to do melodic indexing, and the index build process was parallelised. The job ran across 14 Apple Xserves, made available to me by my university. That was back in 2008. These days it runs in a single virtual machine … somewhere.

Read more →

Recent downtime on FolkTuneFinder.com

I started FolkTuneFinder as a student project back in 2008. I’d done websites for a few years before, but this was the first serious one with any kind of heavy lifting or interesting behaviour. Over the years I added features that allowed people to interact, such as the commenting and FolkTuneFinder blogs, which has been surprisingly popular. I have always had a very small problem with spam: I received perhaps a small handful of blog posts a month, which was fine to deal with.

Read more →

Crazy Idea: Auto-reverse images

People like taking photos of themselves in the mirror, it seems. Especially with iPhones. The trouble with taking a photo in a mirror is that the image is obviously mirrored. Here’s my idea. An iPhone, or other phone with a prominent logo on the back, can do some basic shape recognition to decide whether or not there’s a logo reflected in the mirror. It can then decide whether it’s taking a photo in a mirror or not and automatically flip the image if needed.

Read more →

Useful things to have installed on a Mac

I’m a bit of a puritan. I don’t like hundreds of ornate tools. But a few things help. TextMate is quite good. It’s not free but I consider it worth paying for. http://macromates.com/ F.lux adjusts the colour temperature of your monitor according to the time of day. I generally have my monitor set quite yellow and low-brightness anyway. Free. http://stereopsis.com/flux/ ShiftIt allows you to arrange windows into non-overlapping pre-defined layouts with keyboard shortcuts.

Read more →

Storing integers in Redis

I’ve been looking into Redis. I wondered about storing integers as keys and values rather than plain old strings. After asking on Stackoverflow, I did my own experiments. It looks like it is possible to use any byte string as a key. For my application’s case it actually didn’t make that much difference storing the strings or the integers. I imagine that the structure in Redis undergoes some kind of alignment anyway, so there may be some pre-wasted bytes anyway.

Read more →

Typing on a one-row keyboard possible?

I’ve seen a number of special computer keyboards. These include, for example, five-finger units that require learning special ‘chords’. The idea of a one-handed keyboard is enticing but I don’t like the sound of having to learn specific combinations. What about re-using existing knowledge? Anyone who touch-types knows that each letter belongs to a given finger. I wondered what would happen if you restricted the keyboard to just one row (i.

Read more →