Prickly Pear

I love the penultimate paragraph of the Guardian’s report on Man Utd’s total failure at Fulham last weekend:

As for Ronaldo, this was one of those wearisome afternoons when he played with the soul of a pickpocket, trying to get opponents sent off, eyeballing the officials, exaggerating injuries – in short, the whole everyone-is-against-me routine. At one point he spent so long portraying himself as the victim, repeatedly pulling up his shorts to show Dowd a scrape on his thigh, the referee demonstrated how little he cared by doing exactly the same with his own leg. Dowd might as well have made a W for Whatever with his fingers.

And I’m slightly cheered that though I only got 50% for my first machine learning assignment the class average was only 52%. Fifty is something of a psychological barrier .. anything less would feel a lot worse.

Hidden Quotes

Take a look at the URLs used to make the charts at the bottom of this page.

ithankYouGodformostthisamazingdayfortheleapinggreenlyspiritsof
treesandabluetruedreamofskyandforeverythingwhichisnatural
whichisinfinitewhichisyesithankYouGodformostthisamazingday
fortheleapinggreenlyspiritsoftreesandabluetruedreamofskyand
foreverythingwhichisnaturalwhichisinfinitewhichisyeseecummings

It’d be even cooler if the chart was at all attractive..

A Mystery Solved

Forever ago, in the glory-days of Napster and Kazaa, I discovered Radiohead (hurrah!) and amidst the 28.8kb/s hunt for b-sides and rarities on other people’s computers found myself in possession of a song called Cogs. It was a weird and haunting song that seemed to fit right into the Kid A/Amnesiac theme but didn’t fit with GreenPlastic’s suggestion that Cogs was an alternate title for Last Flowers.

It became this anomaly in my collection, Radiohead but not, and I forgot about it until today, when I thought I’d scan it with Last.fm’s command line fingerprinter which told me:

 <track confidence="0.245223">
     <artist>Ennio Morricone</artist>
     <title>Man With A Harmonica</title>
     <url>http://www.last.fm/music/Ennio+Morricone/_/Man+With+A+Harmonica</url>
 </track>

Which wasn’t what I expected at all.

But now a six-year odd mystery has been solved and I’d love to know how the fingerprinter works. Probably some hairy maths .. it’s impressive it can figure these things, especially now they’re automatically redirected.

It’s still an excellent song.

Eyes

He’s standing there on Platform 5 of London Bridge station. He always is. Always in the same spot, always in the same outfit, always staring at me, always. And I’m always here, watching him.

We started forty years ago. Little has happened since. Every day we are here, staring.

I know his eyes.

They’re dark blue and jealous and bitter. I tried to decipher what had happened to make them once, but their glare intensified and I was scared so I backed down.

Recursive chmod

Just so I don’t forget.

Directories only: find . -type d -exec chmod 755 {} \;
Files only : find . -type f -exec chmod 644 {} \;

Extremely Slow Track Chart Updating

Should be alleviated – an unindexed query called for each track in a chart list was returning close to a million rows = ouch and hurrah for indexes.

Life in the Stencil Buffer

Stumbling through a load of OpenGL documentation I came across a demonstration of Conway’s Game of Life using the stencil buffer, which is simultaneously awesome and horrible:

Life in the Stencil Buffer

One way to create this game using OpenGL is to use a multipass algorithm. Keep the data in the color buffer, one pixel for each grid point. Assume that black (all zeros) is the background color, and the color of a live pixel is nonzero. Initialize by clearing the depth and stencil buffers to zero, set the depth-buffer writemask to zero, and set the depth comparison function so that it passes on not-equal. To iterate, read the image off the screen, enable drawing into the depth buffer, and set the stencil function so that it increments whenever a depth comparison succeeds but leaves the stencil buffer unchanged otherwise. Disable drawing into the color buffer.

Next, draw the image eight times, offset one pixel in each vertical, horizontal, and diagonal direction. When you’re done, the stencil buffer contains a count of the number of live neighbors for each pixel. Enable drawing to the color buffer, set the color to the color for live cells, and set the stencil function to draw only if the value in the stencil buffer is 3 (three live neighbors). In addition, if this drawing occurs, decrement the value in the stencil buffer. Then draw a rectangle covering the image; this paints each cell that has exactly three live neighbors with the “alive” color.

At this point, the stencil buffers contain 0, 1, 2, 4, 5, 6, 7, 8, and the values under the 2’s are correct. The values under 0, 1, 4, 5, 6, 7, and 8 must be cleared to the “dead” color. Set the stencil function to draw whenever the value is not 2, and to zero the stencil values in all cases. Then draw a large polygon of the “dead” color across the entire image. You’re done.

http://www710.univ-lyon1.fr/~jciehl/Public/OpenGL_PG/ch15.html#id5553768