Archive for the ‘Technology’ Category

Bazaar attraction

Tuesday, July 1st, 2008

My life was saved yesterday.

Less dramatically, a piece of software made my life better whereas, without it, life would have been worse.

Let’s give a bit of context first though: I’ve a very basic form of regression testing for Firtree (reflecting its somewhat volatile nature) which consists of a number of ‘example’ python scripts which exercise Firtree’s features. Each script also prints out the allocated object count at program exit which, if non-zero, indicates something has fecked up in my reference counting, either inside Firtree itself or in the Python bindings.

Usually, being a good little software engineer, after writing a feature, but before committing, I run these scripts confirming they still look right and this reference count is zero. Yesterday I went a bit mad and added a ton of features and an associated ton of commits. As is virtually guaranteed when you behave so recklessly, when I did run the scripts everything looked screwed up and memory leaked like a sieve. This prompted one of the worst things you could hear when, for example, you are sitting in the passenger seat of a moving car: a single, sharp, under the breath uttering of the word ’sh*t’.

Fortunately I had used Firtree as a test-bed for developing with Bazaar, a decision I am now very glad of. Suddenly I had the coding equivalent of a TARDIS and an infinite number of universes to play with. I branched off from the last ‘good’ version of Firtree and gently rolled forward in time until the naughty patch was revealed. Then, in true time-traveller style, I made a change in the past but then let the future merge in. Painless in the extreme with bazaar. Finally we reached the ‘alternate 1985′ where, far from being the apocalyptic vision I had created, all was well and no memory leaked (that I could detect).

I am far from groking Bazaar in any meaningful way (as anyone who cares to notice the fsck-ups in the Firtree tree will attest) but already I have experienced a complex branch and step-by-step merge which would have been incredibly painful with other tools.

Oh, by the way, feel free to s/Bazaar/$MY_VCS/. This is more a post of how rocking modern VCSs are, not how Bazaar is necessarily the best.

Update: An example of the process is available on my website. I’m not recommending this as the ‘Right Way’ but it worked for me.

Chroma key with Firtree

Sunday, June 29th, 2008

The best way to test your dog food is to eat it yourself and so this afternoon I set out to write a little PyGTK app that would use the Firtree Python bindings to allow you to pull an alpha matte via chroma key. Chroma key, for the less SFX minded amongst you, is the process whereby the green backgrounds so beloved by special effects people everywhere are ‘cut out’ and replaced by… well, whatever you want your actors to be standing in front of.

Pulling a matte, as such a process is known, is a little tricksy and requires not a little tweaking. I had in mind an app which would let you load a high-res photo, pan and zoom around it lightning fast and let you see the results of tweaking all the matting parameters in real-time. Just the sort of thing Firtree is supposed to be good at. An afternoon’s hacking later and we have this little gem:

It is a recording of the chroma key app that, as of 10 minutes ago, resides in Firtree’s examples directory. You load your image, select something that is background coloured and fiddle with some sliders. Firtree’s pixel pushing powers allow it to reflect the result in real-time. I love it when software starts to become useful and not just Another Framework TM.

This is actually the second little app I’ve written which has used Firtree. I find writing little apps like this very good for shaking out bugs and exposing use cases I hadn’t though of. The first ‘non-trivial’ Firtree app was one I wrote at work. The app displays streams from a pair of computer vision cameras and allows you to monitor the stream, record it and overlay detected features in real time. It is suprisingly useful to be able to get on-demand feedack as to whether your funcky computer vision algorithm is working :).

Update: Should anyone care, you can also browse the source to the app via launchpad.

Reverting to a previous version of the Matrix

Wednesday, May 28th, 2008

Back in t’day, between using the original Netscape Messenger and GMail, I used two mail clients. They were pine and mutt. Pine was what I read my University mail in and mutt took care of my personal mail.

Spin forward a few years to the Great Unification of my email system which happened when I left University (for the first time). I moved everything over to a large, brittle, system consisting of equal parts exim magic, procmail sourcery and fetchmail pain. This towering edifice of hacks had, at its treacherous pinnacle, mutt and a huge custom .muttrc.

Then along came GMail and all was well. Well, nearly. GMail was missing some of the nice features that I had come to rely on. These included:

  • Mutt would let me edit mail in VIM. GMail wanted me to do serious editing within a TEXTAREA widget. After some pain, I managed to deal with writing slightly less pretty mails.
  • Mutt has a lovely ‘reply to list’ feature. This feature helps me deal with some of the vagarities of various mailing lists I’m on. In particular it allows one to choose to ‘reply to sender’, ‘reply to list’ or ‘reply to all’. GMail lacks this middle option.
  • Mutt has the concept of ‘hooks’. The simplest use of which was to use a different signature automatically if I was either replying from a particular address or the original email had come to me via a rôle list rather than a personal mail. GMail lets you set up multiple sending addresses but doesn’t let you specify rules for signatures or for choosing these.
  • Mutt is prettier. OK, this is entirely subjective but I find Mutt’s clean interface far preferable to web-based email. I’m a bit of a conservative and somehow get reassured by curses-based UIs.

On the other hand, GMail was run by people with email CLU and my email system was run by someone lacking a great deal of this CLU, i.e. me. In time I came to either work around these problems or find Firefox extensions/hacks which fixed some issues. Said workarounds were non-ideal, however, and the extensions would often stop working as GMail was upgraded.

Then GMail allowed IMAP access. Recently, at home, I was testing evolution, mainly to try out the Google Calandar integration. I set up IMAP access to GMail while I was there and suddenly realised the obvious: I could have the best of both worlds, using mutt to read/send/compose mail and using GMail’s far better maintained email servers.

So today I dusted off my old .muttrc, deleted the lines relating to my old setup, added some simple stuff to let mutt use GMail’s IMAP service and fired it up. I’m trialling mutt as my primary client for the next week and we’ll see if I regain my former email joy.

As a corollary to the above, email from me might be a bit… erratic… this week as I retune myself to the One True Way. :)

The World Comes to an End

Thursday, April 24th, 2008

Oh noes! I’m goling to have to do some work!

We’re sorry, but your Google Mail account is currently experiencing errors. You won’t be able to use your account while these errors last, but don’t worry, your account data and messages are safe. Our engineers are working to resolve this issue.

C# Metaprogramming

Monday, April 7th, 2008

I often have a number of little ’side projects’ on the go at any one moment. Mostly these projects are not designed to ever see the light of day; I mostly use them to teach me various technologies that I might find useful at some point. At the moment I am writing a little compiler for a domain specific language targeted at image processing. I’m doing this mostly to learn a) how to write a compiler and b) to learn a bit more about C#.

So, first things first: I know C# is a bit of an emotive issue for many people, what with its heritage and all. Personally I’m enjoying writing code with it. I’m having happy memories of Delphi along with finding there to be a pleasingly complete standard library (which is, admittedly, more a function of .NET than C#). Plus I’m developing under Mono so I hope I’m not offending the freedom lovers too much :).

The first part of writing a compiler is parsing your code into a parse tree and thence into an abstract syntax tree (AST). Now, being all for re-using technology, I thought I’d experiment with storing the AST in an internal XML document as opposed to a custom tree structure. This had two advantages I could see:

  1. I could trivially dump the AST out to disk to run unit tests or manually inspect it for bugs.
  2. I could (partially) verify the AST using an XML Schema document.

It was also, of course, fully buzzword compliant and allowed me to learn a bit more about XML processing in general.

Once the AST was generated from the parse tree, I wanted to run a pass over it to do type- and scope-checking, etc. To this end I made use of a new—to me, but not the world at large—concept: method attributes.

(more…)

Microsoft interoperability

Tuesday, March 18th, 2008

Microsoft recently announced that they would release over 30,000 pages of specifications to allow developers to interoperate with their products. Look at the long press release they put out:

I wondered to myself what specifications these were and how to find them. I stupidly thought that finding them should be trivial from the press release. Read on to find how wrong I was :(.

(more…)

BBC video production pipeline

Friday, February 15th, 2008

Recently I was reminded of an interesting bit of stuff hanging off the BBC R&D website. It covers the BBC’s new automated tapeless production system. For an overview there is, as one might expect from the BBC, quite a nice 8 minute video available.

The production system is interesting not only because of the way it allows almost immediate access to logged and tagged takes from a filming but also because of the heavy use of Free and Open Source software in the pipeline. For example, from the site:

Our file server, MediaHarmony, is also based on commodity hardware and open source software. It uses a SAMBA file server with virtual file system extensions to provide the additional features needed to support multiple editing clients.

Even better, from the point of view of a video geek such as myself, is that the guts of this pipeline has been released by the BBC on SourceForge.net. Props to the BBC R&D guys for that!

Impressed

Thursday, February 14th, 2008

I’m impressed with the ease of getting a mobile phone these days. At 2pm yesterday afternoon I decided to change my mobile, 3:15pm I ordered a new one and 1pm today it was sitting in my hand. All for the princely initial outlay of £1.95.

Even getting the required magic codes to change number went smoothly. I’m bracing myself for some un-godly Bad Thing that will happen. At the moment, however, I’m squee-ing about being able to check my mail on my phone and browse actual real websites without having to worry about per-Mb fees.

On the down side I feel like poo. My legs hurt and I’m tired. I suspect the workload has been too high this week. It will only get worse though, on Saturday I have the day of death in which I have to direct 2 hours of CULES rehearsal, drive to Oxford, perform in a charity comedy show and then stay vertical until the wee hours. The latter staying vertical should be at a fun gathering of friends though.

There are only 500 Linux users in the UK…

Thursday, November 1st, 2007

The BBC’s head of technology has claimed that “[there are] 17.1 million users of bbc.co.uk in the UK and, as far as our server logs can make out, 5 per cent of those [use Macs] and around 400 to 600 are Linux users.” If you are one of those select few and are a member of Facebook, join the effort to find them all.

Yay (I hope)

Tuesday, October 16th, 2007

So the BBC have announced that the iPlayer, their ‘catch-up TV service’, will be available to Linux and Mac users “from the end of the year”. And how will this be? Are they porting the Windows DRM stuff? Are they creating some horrible in-house DRM system? No. From the article: “The broadcaster has signed a deal with Adobe to provide Flash video for the whole of the BBC’s video services, including a streaming version of its iPlayer.” Yup, Flash video. A fiver says that 10 minutes after launch there’ll be a JavaScript bookmark for Firefox that saves the video to your disk.

This is, of course, a Good Thing since FLV can be relatively easily transcoded onto your iPod or TV-connected media display device of choice.