I stumbled across this useful feature workaround today, when I was trying to work out how to export my Spotify playlists to something more usable – such as plain text or html.
Although there’s no programmatic way to extract playlist information (that I know of), you can highlight tracks and copy and past into another application. Each track is copied on its own line, as “[Artist] – [Track Name]” and is a hyperlink to the associated track.
Incidentally, the reason behind my tinkering with this, is that I wanted a automated way of synchronising playlists between Spotify and iTunes, although I suspect the Spotify team may beat me to this with the rumored “My Music” feature.
Export Spotify Playlists
June 29th, 2009Gravatar Cache
May 10th, 2009Implementing Gravatar powered avatars is as simple as calculating a MD5 hash of the e-mail and loading the remote image at http://gravatar.com/avatar/[hash].
I needed a bespoke caching gravatar system, and decided to follow this simple approach:
- Store all avatars as [hash].jpg
- If [hash].jpg exists, and was created within a defined freshness period – use the stored avatar
- Otherwise, load a new avatar from gravatar.
This method allows batch updating of avatars, which is useful for background batch jobs.
Desktop apps can use this as a local cache of images; while web apps can avoid extra external traffic.
My first attempt in ruby:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | require 'open-uri' require 'md5' $size="200" $default="identicon" $days=7 $dir="avatar" def fill_gravatar_cache(email = null) cacheTime = Time.new - (60*60*24*$days) email.each() { |email| hash = MD5.md5(email).to_s fileName = $dir+"/"+hash+".jpg" if not (File.exists?(fileName) and File.ctime(fileName) > cacheTime) url = "http://gravatar.com/avatar/" + hash + "?s=" + $size + "&d=" + $default open($dir+"/" + hash + ".jpg","wb"). write(open(url).read) end } end |
Thanks to auto un-boxing we can use a string or an array of strings. For example:
email = "an-email@address" email = ["more","than","one","email","address"]
Planned extensions:
- Update all avatars in the cache
- Delete avatars that haven’t been used in a while
- Store more than one size
- Java and Flex implementations
Facebook Application Safety
March 2nd, 2009There’s been a recent outbreak of Facebook applications that spread by taking advantage of the notification system. The Gaurdian quote Mark Zuckerburg‘s interview with the BBC, and he seems to think “an open system anyone can participate in is generally better”; does he not realise that most users are prone to social engineering attacks and the mentality of “guilty until proven innocent” is no-where near enough to protect the main populace?
As for the technically minded, we get to see all of these spam messages from the rouge applications whenever one of our friends add them.
A simple solution as I see it, is not to enforce full vetting of all applications, but to simply change the notification system so that it becomes blatantly obvious when messages are not genuinely from a friend initiated action, but from some application attempting to masquerade. I do support stricter control over applications, but perhaps an interim measure would be to modify the notification display.
The notification system allows too much flexibility over the format of the messages sent out, for those interested, this is what the Error Check System and Closing Down notifications look like.

iPhone Software 2.1
October 9th, 2008I eventually upgraded my iPhone to 2.1, I always delay upgrading because I don’t have a Mac (yet) and hate rebooting my desktop into Windows. The results are all good, I know this isn’t the case for everyone, but each update has seemed to reduce the number of annoying niggles on my iPhone.
The “Genius Playlist” is quite a nice touch, I didn’t give it much consideration before, because I thought it would be limited to iTunes only, but had a plesent suprise at the addition of the genius symbol on the iPhone.
The alledged “battery saving feature” that makes it forget to check for e-mail hasn’t affected me at all.
iPhone 3G Purchase
September 11th, 2008I bought a white iPhone 3G when I was on a weekend holiday to London, as the Apple stores seem to have no problems with stock of any of the three models.
The buying process, from walking into the shop to walking out with a working iPhone, took just over an hour. Although I didn’t mind spending time in such a nice environment, about half of the waiting was sitting in a queue of three people, and the rest sitting in front of an iMac with an Apple member of staff filling out an online form on an O2 website.
I was a bit shocked to find that the O2 website was being used in Internet Explorer on a virtual Windows XP instance. I can’t imagine the conversations Apple would have had with their stores and O2 over such a weird necessity!
(This post has sat as a draft since the 7th of August! Sorry
)
WordPress iPhone App
August 7th, 2008The WordPress iPhone application, available from the app store, is quite nice. It can connect to both wordpress.com and self hosted blogs, and can handle multiple blogs.
The edit interface shows html code, no fancy editors.
Drafts are initially stored locally, for reliable offline editing; and the usual publishing status categories are applied when uploading.
I’m writing this on the train home from Uni, not sure how good it would be for start to finish writing of long posts, but for quick notes, photo posts and minor alterations of existing drafts, this app beats the web interface in my opinion (which also only works with the HTML view!).
(PS: I used the web interface to add the photo gallery!)
Motor Show
July 30th, 2008I had a long weekend holiday in London with my brother and spent 10 hours of Sunday at the British International Motor Show.
I’ve put a selection of photos I took on flickr, not captioned yet, but I’ll be adding tags/descriptions later.

The photo here is of the Mazda Furai, and I’m quite surprised that it looks like a fake photo, even though I can guarantee no post processing has taken place!
Traditional Inaugural Post
July 7th, 2008Starting a blog, so this is where I say what I intend to write about and promise to post really often.
…right…
Well, I’ve never started one before, mainly because I knew that I would get bored and only update infrequently; but recently I’ve realised that, especially with all the new microblogging and social network betas around, I have a lot more to talk about.
Also, with my Masters dissertation under way, I’ve got more interesting technical material to discuss.
So the plan so far is to write a few reviews of beta projects I’ve been part of and see how it all goes.
Enjoy!
