FOAFlicious 0.1

FOAFlicious is an application for generating a FOAF file from your del.icio.us inbox.

FOAFlicious is written in Groovy, and can be seen in action on http://philwilson.org:8180/foaflicious/foaflicious.groovy (hopefully this URL will become better in time).

This is the first time I’ve ever used Groovy and so far I’ve not been able to configure it to accept URL parameters (answers on a postcard please) so it’s currently hardcoded to return a FOAF file based on my del.icio.us inbox, here’s looking at v0.2 🙂

The del.icio.us inbox facility is currently turned off except for the list of subscriptions so it currently works by masses of screen-scraping. As soon as the inbox comes back it should be able to switch to using the del.icio.us API (probably using David Czarnecki’s delicious-java API).

Currently it uses the del.icio.us page for each user listed in your inbox to extract a user’s real name and homepage, then looks at their homepage to see if they have a FOAF autodiscovery link, and if so includes it in a <rdfs:seeAlso rdf:resource="blah"/> block.

The (terrible) code is available on http://philwilson.org/projects/foaflicious/foaflicious-0.1.groovy. it was only written in a couple of hours, so no abuse please 🙂 In order to run it you’ll need the Groovy libraries, commons-httpclient, commons-logging and JTidy.

If you want to stay notified about this project, it has its own feed.

For reasons of my own sanity, you can add comments and questions about this over here.

How to export Firefox’s history to a text file

Note that this doesn’t currently work in Firefox 1.5

Specifically, serialised as RDF/XML.

Early last year, Jamie Zawinski asked about how to extract information from Firefox’s history.dat file and ended up having to write a Perl script to do it.

He actually got further than most – most people who try to access the data not via Firefox itself just give up. This is because Firefox’s history is stored in a Mork file, which is an incredibly over-complicated and under-documented proprietary file format. You’ll learn more about it by reading the comments on Jamie’s post that you would by reading the docs.

Mork is used as a file format all over Mozilla, in both Firefox and Thunderbird in various points, but there are plans to replace it with SQLite in Mozilla 2.0 (see Unified Storage on the official Mozilla wiki) possibly with some interfaces made public via RDF (but I’m not 100% sure on this).

As it stands, there’s an open bug asking for history.dat to be easier to parse (which will probably be fixed by the move to SQLite rather than anything else) which actually has a very useful piece of Javascript attached which will convert the Mork history.dat into an RDF/XML history file, which I personally use as a bookmarklet from my toolbar: export history.dat. Just drag it to your toolbar, load a local file in Firefox to ensure you’re in a trusted context and click it like you would any other bookmarklet. It’ll give you a security warning, which you can click “yes” to (if you trust my link – if not, you can get it from the bug linked to above, or look at the code yourself). It’ll take a few seconds to kick in (or longer, depending on the size of your history) but will eventually ask you to specify a location to save the file to. Give it a name, and you’re free to parse it with whatever you like (although preferably an actual RDF parser 🙂

How to find out which books I’m reading

Andrea wants to be able to stalk my reading list.

I use allconsuming.net to keep track of which books I’m reading, which ones I’ve completed, which are my favourites, and so on.

When I start or finish a book I load up Firefox, select the Amazon search engine from the search box, type in the ISBN from the back of the book and then click my consume! bookmarklet, select a status, and hit “save” (adding some extra book metadata if I’m feeling particularly generous with my time) at which point the book is added to my list.

Anyone is then able to browse those books on http://allconsuming.net/weblog.cgi?url=http://www.philwilson.org/blog/ letting them see what I’m currently reading, what I’ve finished reading and what my favourite books are.

What, however, I had planned to do for this site, was to utilise the RSS feed for the books I’m currently reading (also available in a proprietary XML format either via REST or pre-generated XML file) and the PHP-based Magpie RSS Parser to display a list, but it turns out that not only does the ‘currently reading’ RSS file not provide links to images, All Consuming only provides RSS feeds for your “currently reading” and “favourite books” lists, not which ones you’ve completed, which you’ve bought, never finished, and so on so the best I would be able to come up with would be something like this.

So. Until I get around to either writing a stylesheet for converting All Consuming’s XML format (which includes a link to a picture of the cover from Amazon.com) into RSS (or I find one on the web) or something which parses it directly, you’ll have to make do with my page on All Consuming.

So Andrea, happy now? 🙂