Ubuntu Logo
Canonical, the company behind Ubuntu, one of the world's most popular Linux distributions, has teamed up with Dell to make roads in to the Chinese personal computer market, which has recently become the largest market in this sector in the world.

Ubuntu's latest version 11.10 will be available pre installed on a range of Dell machines and Canonical has planned a number of strategies to convince consumers that Ubuntu is as good as any operating system they can choose from.

In addition to the operating system a number of applications are preinstalled on the machines to immediately meet the needs of people taking them home. Two of these applications I am proud to say were developed by myself using Adobe Air.

Music an MP3 player

Music Application Screen Shot

A requirement of this project was that the applications needed to be lightweight and straight forward to use. There is after all a much loved fully featured music player that comes with Ubuntu, called Banshee, that doesn't need replacing.

The idea is to get a user up and running quickly enjoying their own media. While the ins and outs of Ubuntu are absorbed for the first time the apps provide the type of rich engaging experience the Flash platform is known and loved for.

ID3 Tags

When run for the first time all the MP3 files in the folder structure beneath the user's Music folder are interrogated and the ID3 data retrieved and stored on the internal Sqlite database. On subsequent starts the application gives the user access to their music immediately and looks for changes in the background.

The ID3 tags proved part of the biggest challenge for this application.

The Sound (flash.media.Sound) class which provides a developer with the id3 property (flash.media.ID3Info) was not good enough as you have to open a file before you get access to the information. Obviously this would slow the indexing process down and so an approach to extract the ID3 info directly from the binary was implemented.

There are two versions of ID3 tags and retrieving information from them is approached in different ways. ID3 V2 is a more up to date protocol, and popular, however I was unable to open file streams asynchronously, while with ID3 V1 it is possible . Obviously opening more than one file at a time is going to speed up the initial index, enhancing the user experience, however this does present a more intricate coding challenge making sure events handling the file once it is opened and tag read are attributed to the correct file. There are many edge cases in this type of operation such as files that are not successfully interrogated for V2 are ear marked to fallback to V1 interrogation. Also when a file is interrogated and tags are not found but no error events are dispatched. The process had to incorporate a time out on each file to avoid the app becoming stuck in index mode.

Picture an Image Viewer

Picture Application Screen Shot

This application was created with the same goals as its sibling Music. The intention is a very lightweight application that allows a new Ubuntu user the ability to start looking at their images as soon as possible while enjoying Ubuntu for the first time. Once the Ubuntu landscape becomes more familiar users can move their image viewing on to the well established and respected Shotwell application which comes with Ubuntu.

EXIF data

As with the ID3 tags in the MP3 files images had to be interrogated for EXIF data. Binary operations such as EXIF or ID3 tag extraction have to be handled with extreme care and this project reinforced the idea that all user generated content has to be treated with extreme suspicion!

One of the pieces of information it is possible to get from EXIF data is the orientation of the image. This delivered the biggest challenge of this application. Ensuring the image was rotated correctly and resized according to the space allocated by the fluid resizable layout.

I immediately turned to Greensock and coded up a solution using AutoFitArea. Take a look at the interactive demo on the AutoFitArea page and you can see that this library provides exactly the type of functionality I needed. It is easy to use and was almost an ideal fit. What stopped me using it in the final release was sometimes when the app window was resized the AutoFitArea lagged behind and the image ended up being positioned incorrectly.

Lucky all was not lost, although I got pretty frustrated with it at one stage! I discovered that the Image Spark Component (spark.components.Image) automatically provides the same functionality without the glitch I was having. It's non trivial functionality and this component gives it to you out the box.

Localisation / Internationalisation

Similar to the Nokia Touch Screen project I was involved in these applications needed support for different languages. Unlike the other project which supported 3 languages these applications support 23 dialects, including two Chinese and two right to left languages Arabic and Hebrew. The locale used by each application is determined by the global settings of the operating system rather than a configuration file.

Luckily for me Flex / Air is really good at bundling locale resources and you can easily chose whether to compile them in to the application or load them at run time.

Licences

One aspect of this project that I have never experienced before was the legal side. For obvious reasons code going into an open source project could not have a licence that restricted its reuse. Every third party library I wanted to use was submitted to two legal teams for ratification and you can imagine sometimes their answers were not what I wanted to hear. Especially in terms of Greensock's Club code which was a pain as I am a big fan but it is worth bearing in mind for distributed apps. If you use Greensock code you are going to have to keep your Club membership up to date as long as the app is offered in an app store. I am happy to do this; the code is rock solid, high quality and value for money but in this case the legal side of life dictated how things were going to be.

TheTeam

I spent 9 months working at TheTeam, the marketing agency hired to produce the work, and by the end of it I was sad to leave despite my dedication to the freelance life. It wasn't very long before I felt comfortable working there and it was the first time in ages I thought about life on the other side!

Ultimately I am grateful to them for the opportunity to work on this project and am super proud that potentially many thousands of people are going to use my applications. Having my work distributed with such a fantastic bit of software, the Ubuntu operating system, is a dream come true for a geek like me.