Friday, 31 October 2008


No I'm not talking about the three legged object to which you attach a camera (although if you travel a lot then I'd recommend a Gorillapod).

I've recently been volunteered to be the research groups seminar organiser. Every week the Natural Language Processing (NLP) group holds a meeting and we try to ensure that we have a talk as well. Sometimes people from the group speak and other times we invite people from other universities or from industry to come and speak to us.

The head of the research group recently changed and the person who had been organising the seminars left. So now I' have the job of organising the talks. If you happen to work in NLP and would like to come talk to us in Sheffield, please let me know!

Anyway last weeks talk was about the TRIPOD project. The work being done in Sheffield concerns trying to automatically label photos given their geographical location. Given my recent work on TagME I found the talk very interesting. So interesting in fact that TagME might get some automatic photo labelling facilities at some point in the distant future.

If you are interested in the details then both the slides and a research paper are available.

Tuesday, 28 October 2008

Allergy Advice

Take a moment to look at this food label (if your eyesight is poor click on it for a larger version).

Do you see any problems with this label? As a nut allergy sufferer I'm a little bemused by the fact that it states both Recipe: No nuts and Factory: No nuts yet lists Pine Nuts in the ingredients.

Now I know that technically speak Pine Nuts are not nuts they are seeds. Having said that Peanuts are also not nuts (they are in fact legumes) yet everyone would expect peanuts to trigger a "recipe contains nuts" warning.

It is worrying that the label is misleading. Fortunately I'm not allergic to pine nuts but interestingly the Food Standards Agency suggests that if you are allergic to other nuts then you should avoid eating pine nuts so the omission of a warning on this label is very strange.

Sunday, 26 October 2008

We Regret to Announce....

We regret to announce the death of the application you were using.
The Grim Reaper has called and collected the applications soul,
please do not send flowers.

I've just released version 0.4 of TagME. There aren't really any new features in this version (although there are some bug fixes) what is different is that it now incorporate an error reporting tool that I'm calling AppDeath.

So now if you manage to crash TagME then a nice friendly crash reporting window will appear. If you could fill in the details and press send I'd appreciate it.

At some point I'll release AppDeath for use with other applications and explain how it works, but for now I just hope you never see it.

University Departments

Friday, 24 October 2008

Digital Restriction Madness: The Last Word

Well Fox have finally sent me a reply to my e-mail about not being able to use the digital copy of Dr Seuss' Horton Hears a Who!
Hello Mark,

This message is to inform you that the Windows Media Player codes for Horton Hears A Who have been activated, and that you will be able to transfer your digital copy. Please contact us if you need any further assistance.

We apologizes for any inconvenience this may have caused.

Thank you,

Fox Digital Support Team
It's nice that they a) fixed the problem and b) let me know (even if I'd already spotted this myself). The point still remains though, that this should never have been allowed to happen in the first place.

Thursday, 23 October 2008

Digital Restriction Madness: Success for the Little Guy!

OK maybe I'm not so little (I'm actually much rounder than I'd like) but I've had success in playing the digital copy of Dr Seuss' Horton Hears a Who! which was being held ransom by Fox. As I mentioned in my previous post the serial number that I got with the DVD to unlock the legal digital copy that you can play on a computer or portable media player didn't work. When I contacted Fox about this I was told that it wouldn't work until the 9th of December when the film went on sale in the US.

Well either my mail was looked at by the right person or Fox independently realised they had made a mistake, but I've just tried unlocking the film again and it has worked. Of course I don't actually have time to watch it right now but at least I could if I wanted to -- although only on this computer due to the exceptionally restrictive rights they allow.

Wednesday, 22 October 2008

Digital Restriction Madness

I saw the following trailer for Dr Seuss' Horton Hears a Who! over the weekend.

I think you will agree that it looks funny, and given that I really enjoyed both Ice Age films I decided to order it. So I went to Amazon to place an order to find there were two versions of the DVD available. The standard one disc version and a limited edition 2 disc version. The second DVD actually contains a digital copy for use on your computer or portable media player. Having wanted this feature legally for many years I decided to put down the extra cash and buy the 2 disc version. What a terrible mistake!

In theory using the digital copy should be really easy the website suggests three steps:
  1. Insert
  2. Transfer
  3. Enjoy
So I started by following step 1 and allowing the autorun programme to start up. I then selected to transfer the film to my computer using Windows Media Player. You can also use iTunes on both Windows and on a Mac which is a nice touch. Once you have chosen how to transfer you are asked to enter a 16 digit serial number printed inside the DVD case. I entered my serial number and clicked next only to be told that the serial number was invalid.

Hmm. I checked and tried re-entering the serial number still no luck. So of I went to the support website address given when the serial number failed. This site admits that they have a problem with some serial numbers not working at all. Fortunately they provide a form you can complete to request a new serial number. Unfortunately Dr Seuss' Horton Hears a Who! isn't one of the films you can choose from.

At this point I was getting rather annoyed. I'd supported what I saw as a media company making a step in the right direction by providing legal digital copying only to find that I couldn't use the copy because of digital rights restriction management (DRM) that keeps it locked up safe, safe from their paying customers at least.

So as the support website was no help I thought I'd try the support e-mail address instead and sent of the following e-mail:

I've just bought a copy of Horton Hears a Who! Which contains a digital copy which I'd like to copy to my Windows PC. Unfortunately when I enter the serial number it tells me that it is invalid and so I can't make the copy. I went to your website and found that because of a mistake on your part some serial numbers won't work. Unfortunately the form to request a new serial number ( doesn't list Horton Hears a Who! And so I can't get it to issue me with a new serial number.

I'd appreciate it if you could fix this at the earliest possible time so that people, like me, who have bought a copy knowing that for once the movie industry has taken a step forward and is allowing legal digital copies could actually make use of the features they have paid for.

Currently those who download illegal versions would be getting a better service than those of us who have actually paid you for the film.

Thanks in advance for your help,

Mark Greenwood
Given my annoyance by this stage I though that was quite polite and restrained. If I was annoyed when I wrote the e-mail I was mad when I read the reply:
Hi Mark,

We apologize for your issue with "Horton Hears a Who" unfortunately at this time the street release date in the US for that title is on Dec 9, 2008. The digital copy will not be available for download until that time.

We apologize for any problems that this may cause at this time

Fox Digital Support Team.
I'm sorry but what does the US release date have to do with this, I bought the DVD in the UK! I've now replied with the following e-mail but I'm guessing it is night in the US at the moment so I don't expect a reply till later this afternoon:

I'm sorry but the fact that the release date in the US is the 9th of December is immaterial. I live in the UK and have bought the region 2 version of the film. Nowhere on the box (or on where I bought it from) does it state that we won't be able to use the digital copy for almost two months.

I'm already annoyed by the digital restriction management placed on the file, and the fact that I have not really bought it only rented it given that the small print says the code will only be useful until October 2010 and that I can only use it on one computer and one portable device. I think that in the UK not allowing people access to the digital copy they have paid for until December will be illegal under the trades description act and so I suggest that you resolve this situation immediately before you start getting a lot of bad press in the UK.

Hopefully I'll hear from you again soon with a more useful response,

As you can see I'm not happy. Not just by the fact that I can't watch the digital copy at the moment but also the fact that contrary to what they may want you to believe you clearly are not buying a digital copy of the film just renting it for two years.

Anyway I have now learnt my lesson. I will no longer be paying extra for the ability to format shift films. If they treat me like an idiot then they cannot expect me to give them more money to be treated the same way again in the future.

I've left a very negative review on Amazon so hopefully no one else will be scammed in this way. Hopefully the film will still be as enjoyable as the trailer suggests but if you want to buy it then I'd suggest the standard DVD.

Thursday, 16 October 2008

Compiled Code Compiles Code

Now and again I try and do something that stretches the limit of a programming language. This usually results in a very bad headache and days of frustration.

At work I have been developing a rule based document annotation system called Saxon. The rules are loaded into the system and converted to Java code which is then compiled, loaded into the running instance of Java and then used to annotate the documents. If you are already getting a headache I'd stop reading here as this post is only going to get more confusing!

For a long time there was no standard way of having a running Java program compile and then use new classes. The only way was to write the source files to disk, call the command line compiler and then create a new class loader to load the compiled classes into memory. Not a simple way of doing things.

With Java 6 Sun introduced a standard API for compiling that was supposed to make life easy. Once you know how the new API works it is in fact very easy to use. On the plus side you can now easily do in-memory compilation which is much faster than reading and writing to disk, but of course you are restricted to using Java 6 which not everyone has upgraded to yet.

Unfortunately there is a much more serious problem. Sun, in their infinite wisdom, decided that compiling code was something only developers would want to do and so only bundle a concrete implementation with the JDK and not the JRE which means that applets and Web Start applications don't have access to a compiler.

Fortunately Eclipse provide the JDT Core Batch Compiler which includes a Java 6 complient compiler. This works great in standalone apps, allowing me to run Saxon from a JRE and still have all the functionallity I need.

However, I was trying to make Saxon available as a Web Start application and ran into a bit of a problem. There is something very strange with the class loading in the Eclipse compiler. It works fine in a standalone application but under Web Start the compiler can only see core Java classes which means I can't reference my own API from the classes I'm trying to compile and everything fails and I end up back at square one.

Don't despair though as their is a solution. Throw away the Java 6 API and use the Eclipse compiler directly. This has the advantage of working under Web Start and under previous Java versions (at least version 5 which is more commonly installed than 6). I can't take all the credit for this solution but I thought it worth blogging about as I'm yet to see anything similar any where else on the web, although I did find lots of posts asking how to do this.

The following code is cobbled together from two main sources; Apache Tomcat and GATE. I actually used the GATE code, which is based on Tomcat code, as my starting point and then simplified it and added some generics support.

You can download the full compiler (a single Java source file and the JDT Batch Compiler) from here. And here is a simple example of how to use it (this is actually the main method of the class for easy testing).
EclipseCompiler compiler = new EclipseCompiler();

String HELLO_WORLD_CLASS_NAME = "HelloWorldTest";
String HELLO_WORLD_SOURCE = "import org.eclipse.jdt.internal.compiler.Compiler;\n\n" +
"public class "+HELLO_WORLD_CLASS_NAME+"{\n" +
" public static void main(String[] args) {\n" +
" System.out.println(\"Hello world\");\n" +
" }\n" +

Class compiledClass = compiler.compile(HELLO_WORLD_CLASS_NAME, HELLO_WORLD_SOURCE);

if (compiledClass==null)
System.out.println("Unable to compile file");

Method m = compiledClass.getMethod("main",String[].class);
m.invoke(null, new Object[]{null});
The interesting thing to note is that the small test case imports a class not from the core Java APIs and this works in standalone applications and when run under Web Start.

Software Testing: Part 2

Yesterday I told you how important software testing is. Well, last night I got bitten again! The moral of this new problem is:
It doesn't matter how well you test your own code if you don't fully understand the implications of all the third party libraries you use.
I fixed a bug in TagME last night which unfortunately has meant that any existing saved projects cannot be reloaded -- sorry! Hopefully no one has created any serious projects with the application yet and so it won't actually affect anyone.

I've taken the opportunity to fix a couple of other annoying features of the saved projects that I hadn't changed before because I didn't want to break anything. The upside of all this is that the project files are now much easier to maintain, about a third of the size, and contain versioning information so if I need to make changes in the future I should be able to silently upgrade project files as they are loaded.

Anyway a new build of TagME has been made available for those who want it.

Wednesday, 15 October 2008

Software Testing

I came across this comment on Slashdot yesterday:
Top flight developers producing quality code don't need large QA departments. They've already written well-designed, bug-resistant code, unit tests, integration tests, and performance tests, all in the course of producing something that works (the first time). If you have to pay a phalanx of QA engineers to find bugs post-facto ("just as important as our development department"), you're doing it wrong. The bugs shouldn't have been there to begin with.
Anyone who has ever done any serious software development knows this is not true so I'm assuming that either the poster was a troll or isn't a software developer -- most likely a troll.

Unfortunately the false nature of this statement was well illustrated this morning in my new TagME project. I do a lot of different things to try and catch bugs as I code but there is no replacement for human testing. When developing the export to KMZ feature I hard coded the output file to be output.kmz in the current directory and forgot to change this and allow the user to choose their own file and directory before I released it last week.

Fortunately, releasing TagME as a Web Start application means that every time anyone starts it up, either from the website or from the shortcuts it installs, it automatically updates itself to the newest version. So I've recompiled everything and placed a new version online so next time anyone launches TagME they will get the bug fix without knowing. They will know something has happened though as the new version also includes some new features. I've restricted a lot of the input fields so they now only take valid values which means it is a lot harder to crash. Also you can now specify the colour, thickness and opacity of the track line, and change the orientation of the photos. I'll update the tutorial later today.

Sunday, 12 October 2008

TagME: A Tutorial

While I think TagME is easy to use I'm guessing that for everyone else a simple tutorial introducing the main concepts would be quite useful, so here goes.

Start by downloading and unzipping the sample GPS track and photos and then TagME.

Now follow these five simple steps to geotag and display the photos:
  1. First we need to load the GPS track file. Click on to bring up a file open dialog and open the track1.gpx file you downloaded. The track details should then appear in the left hand list.
  2. By default the time zone is set to your current location. To properly locate the photos on a map the time zone must be set to the time zone in which the pictures were taken. For the sample images the time zone should be set to "Europe/London". The time zone will default to your local time zone but if this isn't correct then click the button to select the correct time zone.
  3. Now we need to load in the sample photos. Click on the to bring up a directory chooser and select the directory in which you unzipped the sample photos. Once the photos have loaded they should appear in the left hand list.
  4. With the sample images you will notice that the last image in the list is labelled as not appearing within the GPS track. This is because the clock on my camera and the GPS clock are about 2 minutes different to each other. To fix this and shift all the photos to the correct time (and hence position) click on the and then adjust the time to -2 minutes and choose to adjust the time for all the photos then click OK.
  5. That is it you have now worked out where each photo was taken. If you just want to add GPS coordinates to the photos then you can do this by clicking on . More likely though, you want to see on a map where the photos were taken. If you are on Windows and have Google Earth installed then you can click on to preview the output in Google Earth. If not then you can click on to export to a KMZ file which you can then load manually.
That is how simple TagME is to use. Of course you can customize the output further. Clicking on either of the buttons will allow you to edit details of the selected track or photo -- giving them names and/or descriptions. You can also save your project so that you can come back and continue editing it at a later date.

Saturday, 11 October 2008


Well it took me a little longer than I originally planed but here is the first version of my new software project, TagME.

TagME is designed to solve all the geotagging problems I was having with the software that came with the GPS recorder I blogged about last month.

The main issue with the software that came with the GPS recorder was that when geotagging photos the output only worked in Google Earth and not with Google Maps. This first version of TagME fixes that problem by exporting to a KMZ file which can be displayed in either Google Earth or Maps (the ME in TagME stands for Maps and Earth -- clever don't you think!). I've also added support for setting the timezone (the GPS times are always in UTC, which is the same as GMT) which while possible in the bundled software was not very straightforward.

I will, however, be the first to admit that TagME is far from perfect. To start with there is as yet very little error checking going on so I expect you could quite easily crash the programme -- this will be my first priority for the next version. The main glaring omission is that there is no visualisation or ability to edit the GPS track data. Currently you can click a button to show the data in Google Earth (if you have it installed and are running Windows) but this takes a while and isn't ideal. Some form of track editor is definitely high on the list of features that need implementing as well as the ability to customize the photo bubbles as the current formatting is very boring.

I still think it is easier to use and produces better results than the bundled software so altogether not too bad for a fortnights work. Given the shocking state of the code at the moment I'm just making the executable version available which you should be able to run simply by clicking the shiny orange launch button.
You can also download a sample GPS track file and some photos to play with (note that I reckon the time offset for the photos should be -2 minutes).