Thursday, April 30, 2009

Late to the Party: Google App Engine

One thing I always meant to try out was the Google App Engine. Now that I have a bit of time on my hands, I thought it would be an excellent time to give it a go.

If you're not familiar with GAE, it launched quite a while ago with solely Python support. Recently they added experimental Java support, with mixed feelings from Simon Phipps. I wasn't interested in the Java support -- I wanted the Python!

For a simple test case I wrote a twitter spammer -- it will ping my twitter account every time I write a new blog post. This will hopefully encourage traffic to my blog, and will hopefully be complex enough to let me try out all the main features of GAE.

One of the things I enjoyed most was the persistence model. Instead of having to define a database structure to accompany your objects, you just define your object with appropriate database strings. Your object is magically persisted when you go object.put().

Another thing I enjoyed was the templating. While the example starts you off by manually writing data out into the response, it's fairly easy to start using a template, and not that much more complex to start automatically creating things like forms.

The thing is though that these features are both provided by Django (well, the persistence model is more inspired by it). Given that the two main features I like aren't really features of GAE, what does it have going for it?

It's free
The most compelling reason to use GAE is that it's free and always available. Instead of having to pay for hosting for your Python (or Java) app, you get to run it on Google's hardware (until your app becomes too popular, when you'll have to start paying).

It has elegant cron
Cron jobs aren't really that difficult to set up in Unix, but Google's implementation is particularly elegant. You define a URL to hit, and then specify your cron pattern. I really like how they used a regular URL to implement this rather than making you define a script you want to run -- it's simple, and it works.

It's Google

Not much of a reason, I know, but while I had heard of Django I never got around to using it. GAE got me to use something I had wanted to play with not by virtue of the technology, but by its brandname. Who knows what else I'll come across in the course of developing my app that I wouldn't normally.


If you haven't had a chance to give it a whirl, I'd recommend you give it a try. Let me know what you think of the Java support.

Saturday, April 25, 2009

Face Recognition in Flickr

It is a truth universally acknowledged that Flickr has a load of APIs. Recently, a website named Polar Rose has emerged, which offers to run face recognition over your Flickr photos.

Note that I'm not calling it face detection, which is merely being able to find a face, but face recognition -- it should be able to know who the face is. This is quite a tough problem: I remember coding face detection at University wasn't that easy.

So, I added my photos and gave it a go. There's a processing time delay as it sucks everything out of Flickr (they estimated 30 mins for my 700 odd photos). After it's done, you get to start naming people: it pops up a face, asking who it is. When you tell it, it shows you similar faces and asks if these are also the same person.

My experience started smoothly. The first picture it chose was one of me, wearing sunglasses. Adding my name was easy enough, but then the subsequent pictures were all of my girlfriend, also wearing sunglasses. Not a good start overall.

As I kept tagging faces, I was generally impressed by the face detection. It seemed to be picking most faces, even partly obscured ones. I was less enamoured by the recognition, which seemed to find at most maybe two other photos of the same person.

Eventually though, it all got a bit silly. It kept asking me to identify people I had already said I didn't want to, and started showing faces that weren't even faces. I suggest the threshold for what is considered a face might need to be adjusted a bit higher, as by the end I was getting almost an even ratio between faces and non-faces.

Although I read it would tag my original Flickr photos with the names of the people I'd chosen, I checked the originals and couldn't see any. While I can understand this -- if you can browse pictures of people through tags on Flickr, why would you use Polar Rose -- it's a little bit sad in this era of openness.

Overall, I'd recommend Polar Rose as an entertaining way to spend a rainy afternoon. I don't think I'll be coming back frequently though; the face recognition gimmick quickly wears thin, and its accuracy deteriorates quite rapidly.

Update: if I was friends with William Shatner, I'd be in more luck.

Thursday, April 2, 2009

A Keyboard Conundrum

One thing you very quickly notice about life in the UK is the difference in keyboards. Although I've been here for over a month now, I still don't remember that the @ symbol is down by the semicolon instead of up above 2 (that's where you'll find the double quotation mark).

The other change I notice is that the # symbol has its own dedicated key instead of being above 3, which is where the £ hangs out (which is fairly amusing if you think about how our American friends refer to # as "pound"). This is obviously sensible, though I do wonder why they simply didn't replace $ with £ and move the former to be a secondary key, like the Euro symbol.

But I really don't understand the logic behind @ and ". My usual answerer of tricky questions, Wikipedia, is exceedingly knowledgeable about the differences between the British keyboard and what I would call 'the normal one', but is surprisingly quiet about the reasons behind the key-switcheroo.

I suspect this will remain a mystery unless I decide to fork out £32 for a copy of BS 4822, but I would love it if somebody out there could tell me why the @ symbol is in a different place on the British keyboard?