Saturday, 29 November 2008

Bringing QuickTime to the Wii

OK so while the title is true it is rather misleading. Let me explain.

I have a web application that contains QuickTime movies (film trailers) and I wanted to make sure that if the user of the site didn't have QuickTime installed they could still see the movies. My main reason for this is that I wanted the site to work fully when viewed through the web browser on the Wii and the Wii doesn't support QuickTime.

The solution is to try and use QuickTime but if it isn't installed then to convert, on the fly (using FFmpeg), the QuickTime movie to an FLV file and then play this back in a Flash based movie player (specifically the JW FLV Player) that will work on the Wii.

Now I know that there are a number of systems available that use the web browser on the Wii to turn it into a media player but these are all huge systems with their own front and back end code and didn't seem like a reasonable starting point for what I wanted. A few people have also tried to work on a small scale and do what I wanted to achieve but from my perspective their approaches suffered from two problems 1) none of them used servlets as the back end code and I was already committed to using Tomcat and 2) they all had problems with seeking within the resulting FLV movies. So I set out to solve both of these problems.

It's taken me a few days to get something that works but I'm now happy enough with the code to release it into the wild for others to play with and improve upon. Unfortunately I can't easily show you a demo as the machine hosting this blog doesn't provide me with the ability to run server side scripts but you can download the entire example which when unzipped provides a complete Tomcat webapp.

v0.4 (08/04/2011): Updated to the newest version of JW FLV Player, fixed numerous bugs and re-factored the code to make it more flexible and maintainable. This release should be much more usable then the previous ones.

v0.3 (14/03/2010): Fixed a bug that was causing an error on the Wii and updated the JW FLV Player to the newest version. The code is now also being hosted (and built by Hudson) along with the rest of my projects.

Updated 02/12/2008: I've cleaned up a lot of the server side code to make it easier to understand and maintain. I've also updated the bundled copy of FFmpeg to a much newer build. Finally I've updated the version of the QuickTime embedding script to the newest version.

Friday, 28 November 2008

Where On The Map Am I?

When I blogged about using KMLMapLoader to load easily load KML/KMZ files onto a map I quietly side-stepped one problem. The KMLMapLoader requires you to specify the latitude and longitude on which to centre the map and a zoom level, but where do you get these values from?

You could play around with the main Google Maps page and try and figure out appropriate values but this can be a bit hit or miss. The easiest way it to use a new feature in TagME. Simply open your project, choose to configure Google Maps from the tools menu and then specify the size of the map (in pixels) and it will give you the latitude, longitude and zoom values to use. Nice and simple!

Wednesday, 26 November 2008

Calum's Road

I'm going to a Runrig concert this evening and so was playing some Runrig music on my iPod on the way to work. While listening to Wall of China I decided that I should blog about a book called Calum's Road by Roger Hutchinson. Whilst at first glance this may seem a bizarre jump bare with me for a few more lines and everything will become clear (I hope).

If I was writing the blurb for the dust jacket I'd write:
Calum's Road chronicles one man’s attempt to save a dying community. The north of the Hebridean Island of Raasay didn’t used to be connected to the rest of the island by road. It’s inaccessible nature saw the population dwindle until the population was just two; Calum and his wife. One morning Calum set out to change his world, he started to single-handedly build a road. It took him twenty years but eventually he brought a road to his hamlet at Arnish.
Still confused by the Runrig reference? OK I'll explain. I only found out about the book as it was reviewed in The Wire (the newsletter of the Runrig fan club) as it's subject matter had been used as the basis for the song Wall of China from The Stamping Ground album.

My Rating: 5 Stars I would probably have never picked this book up without having read the review, but I am so glad I did. A heart warming tale of perseverance in the face of an intransigent political system.

Monday, 24 November 2008

F1 Without the Adverts

Next year sees F1 coverage in the UK move back to the BBC. Finally after goodness knows how many years we can again see an F1 race uninterrupted by adverts! Now like most fans I've known about the move for a while but today the BBC have announced their presenting line-up.

Jake Humphrey (who I've never heard of) will anchor the show and be joined by David Coulthard and Eddie Jordan, who with their experience, as former F1 driver and team owner respectively, should make good pundits (I doubt they could be worse than Mark Blundell). Martin Brundle will continue as race commentator and be joined by Jonathan Legard (who currently works for 5 Live). I think it's a shame they couldn't have kept with James Allan as I actually quite liked his commentating style. And finally the pit-lane reporters will be Ted Kravitz and Lee McKenzie.

Hopefully the coverage of F1 on the BBC will be at least as good as the coverage ITV have provided, but with uninterrupted races it should be even better. Of course I won't need the TV coverage at next years British race as we have full 3 day passes to Silverstone, so watch out for us in the crowd!

Saturday, 22 November 2008

Easy Map Embedding

Every since starting the development of TagME I've been thinking about finding an easy way of showing the geotagged photos on my blog. Now it is quite easy to display a KMZ file in Google Maps (and of course Google Earth) using the simple method Google provides. Unfortunately this method doesn't allow you to access all the features of the Google Maps API. So to allow me more flexibility I've written some javascript to allow for easy map embedding. Here is the script in action:

To achieve this you need to have already loaded the Google Maps API and then in the head section of your page load my KMLMapLoader. The when you want to embed a map you create a DIV to contain it. For example, to create the map I showed above you add the following to your page:
<div kml=""
zoom="11" latitude="53.4717" longitude="-1.511993"
config="map.addControl(new GLargeMapControl());"
style="border: 1px solid black; width: 600px; height: 700px;">
It is reasonable straightforward but here is an explanation of the different attributes you can set:
This should be the URL of the KML or KMZ file you wish to display on the map.

The latitude of the centre of the map.

The longitude of the centre of the map.

The zoom level (level 0 shows the whole earth, each increase in zoom level increase the area seen be a power of 2).

The map type. The default is the street level map, but you can specify any of the types Google supports. Note that id you specify G_SATELLITE_3D_MAP and the Google Earth plugin isn't installed then rather than an error message the script will revert to using G_SATELLITE_MAP

If specified this should be JavaScript that will be executed once the map has been initialised. The map itself is available in the variable map and this can be used to further configure the map (for example adding a large map control rather than the default small control the script uses).
Only the kml attribute is required, but to set the location of the map latitude, longitude and zoom must all be specified.

The script actually does a little more than loading the map, it also provides a fix for a bug in the current version of the Google Maps API. When loading a KMZ file the images etc are accessed through a server side script. Unfortunately the API uses a relative URL to point to this script and so KMZ files display properly if loaded through the main Google Maps website but not when loaded using the API. KMLMapLoader adds code to fix this bug which you can reuse even if you don't want to use the loading facilities.

Thursday, 20 November 2008

Heads I Win, Tails You Lose!

When we went to St. Andrews we made the mistake of escaping from the cold wind by looking around Waterstones. This is always an expensive mistake! One of the books I bought was How Many Socks Make A Pair? by Rob Eastaway. How Many Socks Make A Pair? aims to make mathematics interesting. Whilst there isn't an equation in sight you will learn about probability theory via the old choosing socks blindly from a draw problem, as well as learning magic and card tricks.

Having previously blogged about the changes to our coins I was particularly interested in a section on coin based probability, particularly the following fact about spinning a penny to determine heads or tails:
What happens if you try and remove the human error by spinning the coin on its axis instead [of flipping it in the air], on a smooth table? It turns out that this is even more biased. Depending on the currency you use, the results can be a long way from 50-50. If you spin an American penny, it has been found to end up showing tails as much as 80 per cent of the time. British pennies are also heavily biased towards tails.
Now given that the tail designs on our coins have changed I was interested to know if this was still true or not. So I conducted my own little experiment. I found two almost mint 2008 pennies; one with the old design and one with the new design. I then spun each coin a hundred times and recorded the outcome. I didn't record spins which didn't get fully up to speed or those that bounced off something else on the table as I felt that these may affect the result.

The first thing to note is that I couldn't replicate the result from the book as the old design penny actually landed 53 to 47 for heads. The new design, however, fell equal with 50 heads and 50 tails.

So what does this all tell us. Firstly the experiment isn't very scientific I'd need a lot more than a hundred spins to show a very small bias. Having said that it looks as if the new design is a fairer coin when spun than the old design.

My Rating: 5 Stars A really interesting book, that makes maths both fun and relevant without resorting to equations.

Tuesday, 18 November 2008

Dell Software License Agreement

I tend to treat license agreements like I do manuals -- I don't read them. However, as I was sorting out the junk that came in the box with my Mini 9 the sentence at the bottom of the first page of the Dell Software License Agreement caught me eye. It reads as follows:
If the package accompanying your computer contains compact discs, 3.5" and/or 5.25" disks, you may use only the disks appropriate for your computer.
Now I'm guessing it's been a while since Dell actually shipped a 3.5" floppy disk to a customer (most of their machines haven't even contained a floppy disk drive as standard for quite a while) but I'm guessing it may have been decades since they last shipped a 5.25" floppy! I think they need to seriously think about updating their license agreement to bring it into the twenty first century, especially that, as written, it doesn't seem to apply to the DVD of drivers and utilities I found in the bottom of the box.

Monday, 17 November 2008

Wensleydale and Ginger Cheesecake

Over the years I have eaten some wonderful deserts in restaurants but I still love the Wensleydale and Ginger Cheesecake from the Hawes creamery possible more than any other. It is made with Wensleydale Cheese with Ginger and digestive biscuits and while it isn't a baked cheesecake it has that relatively heavy feel to it. No matter how hard I try and describe it I will never be able to do it justice so if you only ever go to the Hawes creamery once make sure to try the cheesecake or if you are feeling adventurous why not try and cook it for yourself.

Sunday, 16 November 2008

Travelling Light

As you may have noticed from this blog I do travel quite a bit, both with work and for fun. In fact I've since this blog started I've had trips to Bled, The Reeds Hotel, Marrakech, St. Andrews, Bordeaux and a long honeymoon in Scotland. On all these trips I've taken my laptop with me. In fact here is a photo of it sunning itself by the pool in Marrakech. Now it's not huge or particularly heavy but it can still be quite awkward to cart around, especially when flying. If I'm flying then the laptop bag becomes my one piece of cabin luggage and so I can manage a few books as well as the laptop but everything else has to go in my suitcase. So even if I'm away for only a day or so I have to have the added hassle of checking in luggage and hopping that it makes it to the same destination at the same time as me. Well I now have a solution to this problem -- take a netbook instead of a laptop.

Netbooks are designed to be exceedingly portable. They are small and lightweight and leave lots of room in a bag for other luggage. While there may have been small lightweight laptops for a while, netbooks are relatively new. The first was the Eee from Asus, but there are now quite a few different models, and I've bought the Mini 9 from Dell -- thanks to everyone who gave me money for my birthday as this is what I bought!

Lets start by looking at it next to my normal laptop. As you can see it really is small. In fact the spec sheet from Dell tells us that it is just 9.13" (232mm) wide, 1.25" (31.7mm) high and 6.77" (172mm) deep and weighs just 2.28 lbs. (1.035 kg) -- in other words it is about the size of a large hardback novel and weighs very little.

Now the netbook isn't as fast as a laptop or desktop machine. For example, the CPU is a dual core Intel Atom clocked at 1.6GHz whereas my laptop contains a 3Ghz dual core processor. But in reality you often don't want to do lots of heavy processing while away but you do want to be able to check e-mail or give presentations and for that a netbook is ideal. It maybe that netbooks could be built with faster processors but they are currently limited due to licensing deals with Microsoft. Microsoft want to sell licenses for Windows Vista while their customers clearly prefer Windows XP. They have relented a little and allowed OEMs to continue to sell XP with systems that are not powerful enough to run Vista. So the netbook manufacturers are deliberately not putting more than 1Gb of RAM in the netbooks so they can sell them with either XP or a flavour of Linux. Fortunately the Dell is very easy to upgrade (2 screws remove the base giving access to the memory, hard drive and wireless networking card) and so while it arrived on Thursday with only 1Gb of RAM by Thursday evening it was running quite happily with 2Gb (I bought this 2Gb memory module if anyone is interested in doing the same).

I've been looking at buying a netbook for a while but found it difficult to choose between the different models available. I eventually bought the Mini 9 from Dell as it doesn't have any moving parts and so should hopefully withstand being bounced around a bit while travelling. This means it doesn't have a fan so doesn't get noisy but more interestingly it has a solid state hard drive (SSD).

If you are salivating over the pictures and description then a word of advice -- even if you want to run Linux on the Mini 9 spend the extra £30 and get the Windows XP version. The reason for this is that you get a 16Gb hard drive instead of an 8Gb one which given the current price of SSDs is a bargain.

I'm sure there will be more postings about the netbook as I find more interesting things to say about it, but already it has proven useful as I'm writing this sat in the Marton Arms Hotel, Thornton-in-Lonsdale without having dragged my large laptop bag along with me!

My Rating: 5 StarsA fantastic netbook that is going to make traveling so much more enjoyable than when taking a full sized laptop.

Wednesday, 12 November 2008

Quantum of Meaning

I haven't seen the new Bond film, Quantum of Solace, yet although it looks good from the trailer.

I was however, confused by a BBC news article which stated that "The film, Craig's second Bond outing after 2006's Casino Royale, is currently top of the UK box office chart". Now am I just being pedantic again or can that be read as to suggest that this is the third Bond film starring Daniel Craig, i.e. two films after Casino Royale?

Sunday, 9 November 2008

St. Andrews: A Blood Thirsty Town

I never realised quite how much history had taken place in St Andrews (golf doesn't count) or quite how blood thirsty a place it has been until we visited it back in September.

First by the castle we find

At the University Chapel we find
Unfortunately I couldn't find the initials anywhere.

Finally out at the main bay we find

TagME: Version History

I've decided that instead of a new blog posting every time I release a new version of TagME I'm simply going to update this version history page instead. Of course if there is a major new feature or something worthy of a separate post then I will do one. So without further ado here is the release history to date:

v0.8.1 - 06/02/2010: Open-sourced the code. See here for details.

v0.8.0 - 25/11/2008: Fixed a nasty bug in the map zoom level calculation which might have been causing problems with the time properties display. Added a new feature which calculates the latitude, longitude and zoom level for displaying the KMZ files TagME exports within Google Maps, via the Google Maps API, or with my new KMLMapLoader script.

v0.7.0 - 19/11/2008: Quite a few behind the scene changes to improve performance and stability. Updated the KML output to be more conformant to the spec and introduced the ability to specify author and website.

v0.6.1 - 09/11/2008: I have finally added the ability to embed the GPS coordinates into the photos so that they can be re-used by other programmes.

v0.5.0 - 03/11/2008: The Now with Improved When and Where! release. Added a time zone chooser and a map to the time offset editor. Both of these make TagME a lot easier to use. See this blog post for details.

v0.4.0 - 26/10/2008: Quite a few bug fixes but the major change was the addition of the AppDeath crash reporting tool. See this blog post for details.

v0.3.0 - 16/10/2008: Changed the project file format. Projects saved with earlier versions can no longer be loaded. See this blog post for details.

v0.2.0 - 15/10/2008: Mostly a bug fix release but added the ability of the user to choose the KMZ file name. See this blog post for details.

v0.1.0 - 11/10/2008: The first release of TagME. See this blog post for details.

Wednesday, 5 November 2008

Am I A Pedant?

Now before you all rush to answer I know that in general I can be pedantic. But what I'm interested in is this specific case. So without further ado...

I know a lot about questions and answers. For those of you who don't already know, my PhD thesis was entitled Open Domain Question Answering. If you are bored or an insomniac then you can even read it if you like. Chapter 1 deals with the problem of exactly what constitutes a question and more importantly what forms valid answers can take. For the purpose of this post, however, the OED definitions of question and answer will probably suffice.
question noun a sentence worded or expressed so as to elicit information.

answer noun a thing that is said, written, or done to deal with or as a reaction to a question, statement, or situation.
Seems simple right? Well in reality it is quite complex. For example, if in response to the question How tall is the Eiffel Tower? I was given the answer Belgium, then either a) I'm being sworn at by Zaphod Beeblebrox or b) the answer isn't valid as it doesn't answer the question. Now we know all there is to know about questions and answers let us move on to the meat of this tale of pedantic question answering.

Yesterday I saw an advert on the side of a bus which read:
How many UK children live in poverty? 1 in 3
Now am I being pedantic in saying that 1 in 3 is not a valid answer to the question? I would argue that only a specific number can form a valid answer to a How Many X? type question. Asking what proportion, ratio or percentage of UK children live in poverty could, however, be answered by 1 in 3 (I know 1 in 3 isn't a percentage but it is close enough).

So am I just being pedantic, is the advert wrong, or both?

Tuesday, 4 November 2008


Over the years I've written quite a few acknowledgements at the end of academic papers. They are usually very short, due to lack of space, and simply acknowledge a source of funding. For example, on my recent papers the simple acknowledgement is:
This work was funded by the X-Media project ( sponsored by the European Commission as part of the Information Society Technologies (IST) programme under EC grant number IST-FP6-026978.
I've also written a much longer acknowledgement section in my PhD thesis, where I had the space to be able to thank everyone who had helped.

As well as writing acknowledgements I also read quite a few as I'm often asked to review papers and articles for journals, conferences and workshops. I've never really seen a funny academic acknowledgement until I came across this:
This work was partially supported by wife to me and my lover.
Now I'm guessing that the author's first language isn't English (the papers are blind reviewed so I've no idea who the author is) but I'm struggling to work out how many people are involved in that relationship!

On a slightly separate note I'm now confused as to exactly how I should be spelling acknowledgements. I've always thought it was spelt with an e between the g and m but I've recently seen it without the e. Unfortunately a trip to the OED doesn't make things any clearer. Their main entry is spelt without the e but then they add:
Also acknowledgement (a spelling more in accordance with Eng. values of letters).
Now I'm totally confused!

Monday, 3 November 2008

TagME: Now with Improved When and Where!

I'm releasing another version of TagME today which should along with a number of bug fixes and improvements should fix two of the main problems I had with previous versions; choosing a time zone and setting the camera's time offset from the GPS clock.

To make choosing a time zone easier I've hacked up an as yet rudimentary time zone chooser. Basically you start by choosing a continent or large land mass (not quite sure why they are group as they are) such as Europe, Pacific or Canada and then choose (usually) a capital city to set the time zone. So for example, to choose the UK's time zone you would select Europe and then London. If you can't find your time zone then you can select Etc which then gives you the option of GMT-14 to GMT+12 as well as Zulu and UTC! This still needs work (for example, I don't really think we need the SystemV entries) but should make life a little easier.

The second problem was determining the difference between the GPS clock and the clock in the camera. Getting this right is important otherwise the location of the photos will be wrong. In previous versions the best way of doing this was to view the output in Google Earth and try and work out what how far out the pictures were and then experiment with different offsets. I've improved this by including a little map in the time offset window on which changes are instantly reflected. Currently only the first selected photo (or the first in the list if no photos are selected) is shown, so it may be easier to choose one photo that you know exactly where it was taken and then correct the time offset by applying the changes to all photos.

And in case my descriptions of these new features aren't very good here are some screenshots.

If you want more than a screenshot then as usually you can it directly or if you have the shortcuts installed from trying it before then they are already pointing to the new version.

Let me know what you think.