Quick AirWaves TV Guide update

The version I uploaded yesterday had a bug in the alerts that meant they could not be closed. I have rectified this issue and uploaded a new version.

We are now at version 0.3.

Whilst digging around the code I also moved the update functionality into the code that downloads new TV Data (so it will only happen once every week or 2 and you can still opt out). There was also a couple of minor style changes but nothing of great note.

AirWaves TV Guide

It took longer than I hoped (if you need to replace your central heating pump and mid-position valve I am now the man πŸ˜‰ ), but I will be able to release the new version this weekend. It will now be at V0.2 and the auto-updater should handle the upgrade once I have uploaded the new file.

It can now be resized. I have added a resize handle to the bottom right corner.

New Electronic Programme Guide style view. You can now view the TV data in the classic EPG style with horizontal boxes for programmes and a current time marker.

A few minor issues fixed, such as alarm sounds continuing to be triggered after closing the reminder dialog etc

Oustanding stuff to sort out:

  • Now it can be resized I’d like to get the application to remember what size it was when next opened.
  • Faster: it still takes 4-5 seconds to open the EPG view. I would like to halve this if possible.
  • I still want to make it open source so I’ll look into doing that soon as well

AirWaves TV new functionality

I’m currently in the process of writing a new view on the TV data that resembles the DigiGuide view. Each channel is a long line of boxes. Each box represents a programme, the size of the box shows how long the show is etc. The first version was incredibly slow. I was using a repeater for each channel and a repeater inside each channel for each programme. The processing of the data was over in 2 seconds, it took another 15 seconds for the bound repeaters to display the data! I’ve no idea why the repeater should be so slow.

For the next attempt (which is where I am currently) I tried using a VBox container into which I create, in code using the addChild method, an HBox for each channel and add a load of different sized VBox’s into each for each programme. Into each VBox I add 2 text fields for programme information. The total time came down to 4 seconds. It’s still not great but it is writing out a whole 24 hours worth of 15 channels of TV into little boxes. The result looks OK at the moment but I will look into getting that time down further.

I’ve got no idea what the problem was with the repeater. I may dig deeper into it later.

I also notice that Β with this format of data you need more space to get a decent view. So I’ll also be adding a resize handle onto the transparent window somewhere so you can make it as big as you want. Probably bottom right as that would be where you would expect it to be. With a little luck I’ll have a new version out by next weekend.

Opera browser issues

I have been fighting with Opera under Ubuntu the past few days. It refused to connect to any site whilst Firefox/Konqueror etc all connected fine giving the site unavailable message. I spent a good few hours googling for solutions and came up empty handed. I uninstalled/re-installed, checked DNS settings, wireless network, everything. Nada.

Finally, I came across a few postings that mentioned that Opera was or wasn’t looking at the host computer’s host file before connecting. This wasn’t related but I do make use of a hosts file to minimise tracking cookies and some advertising sites to speed up online browsing (I have a crappy quality adsl line).

It so happened that during upgrade to Gutsy Gibbon or maybe installing a new software package it took all the lines in my host file that looked like: ads.are.us

and concatenated them into 1 huge line thus: ads.are.us ads.are.ustoo ……………

Huge meaning several thousand characters. When I deleted this line from the hosts file it all started working again πŸ™‚

So if you have problems with Opera and not Firefox under Linux try the command:

opera -debugdns

If you get the error:

dns: Thread created
dns: Trying IPv6 lookup for host ‘redir.opera.com’…
dns: gethostbyname failed with return value 34 (Numerical result out of range). hostent pointer : (nil)

Have a look at your hosts file.

Another release of AirWaves

That was quicker than I intended. I’m not sure if anything changed on their side but the data coming from the radiotimes (RT) site started causing problems for the AirWaves parser. I am performing a similar job to XMLTV and creating XML data from the RT data. Today ampersands started causing a failure when parsing the XML that I create. I’m not sure if there weren’t any ampersands before but I have now added code to replace them with the escaped code.

After that I still had problems with the data causing truncated XML, which after several hours and a HEX editor I tracked down to being caused by null characters (0x00) in the data! So I then also added code to replace any nulls with blank strings.

It is now working properly again and I have uploaded a working version.

It should be noted however that the RT site has some problems with the XMLTV data they kindly provide. For example the channels file has been truncated and therefore possibly other files are also invalid for the moment. I believe they generate it daily so hopefully it will be sorted tomorrow.

New version released, now called AirWaves TV Guide

I’ve released a new version.

It has a name change as apparently Adobe doesn’t like people using AIR in the name of the application.

It now plays an alarm sound to help remind you if a favourite is on.

It will, from now on, auto update itself (with your permission)

Version 0.02 can be found from the link on the left πŸ™‚

AIR TV Guide now available

I have uploaded the first version of my Adobe AIR application. Link on the left.

It’s got a few more gaps than I hoped for but it is stable and all the main functionality works. The main problem is that alarm sounds aren’t playing which I’ll be looking into later.

I also have a few comments from users on usability and look and feel which I’ll be addressing in later versions.

VMWare Server and Ubuntu Gutsy Gibbon – network bridging

Seeing that Gutsy Gibbon had been released I decided to upgrade my machine this weekend. I left it downloading/running overnight and apart from a couple of minor issues in the morning it all seemed to go fairly smoothly.

I use VMWare Server to run a windows only program that I need. I re-ran the install script to compile the modules for the new kernel but after running my Win XP VM the bridged networking wasn’t working. The host could not see the VM and the VM couldn’t see the host. After 1/2 a day googling this issue and learning all about bridged networking and virtual adapters it transpired that with this version of the Linux kernel (2.6.22) the VMWare bridged networking is broken.

I had all but given up when I saw that someone had released a patched library (Ubuntu forum post) which links to the patch file: patch

After having a quick perusal of the patch source code I replaced the file on my system with the patched version and after running vmware-config.pl again and reconfiguring networking I was back in business. It took a little while to find where to put the patch but it ended up here: /usr/lib/vmware/modules/source/
Just shows the advantages of having access to source code πŸ™‚

AIR TV Guide, first version coming soon

TV Guide

This is a screenshot from the AIR TV Guide I have been writing for a while now. It currently does the bare minimum to be useful but I intend building on this as time goes on. See the AIR TV Guide page linked on the left for more details.

I will be making this open source fairly soon when I feel it is at a point where I am happy considering it a version 1 release. There isn’t a lot missing at the moment, just quite a lot of polishing.

Simultaneous AJAX calls and OO JavaScript

In my day job we had an issue with performing multiple simultaneous data lookups using AJAX to pre-populate forms.

For example a user has filled in a form that requires entry of multiple product ID’s, one row for each product. For each ID as it is entered, AJAX is used to populate details of the item in a field with ID productx.details where x is the number of the row. On re-entry to the form we would like for the same JavaScript code to perform the same AJAX calls all at once and populate the details for each one.

The issue came about because in order to know which row to populate on return from the AJAX call (in the response handler) we set a page variable “prefix” to a value of “productx.” to indicate which row we are looking up the ID for. The AJAX response handler can then set the value of the field prefix + “details”. When all rows are requested at once with asynchronous AJAX calls, by the time the first call has returned subsequent calls have overwritten the prefix variable so we get the wrong product details for the product ID’s.

I was aware that JavaScript has some form of OO so I thought we should be able to create a small JavaScript object inside the page for each row. This object would hold the prefix it is responsible for and be able to call the AJAX service and populate the details data in the row it is responsible for.

I’ve constructed a very simple example to show what I mean using UK telephone area codes. The actual code we have is more complicated since the returned data is a JSON string with multiple fields but the idea is exactly the same. Prototype is used to handle all the AJAX stuff and PHP is used for the server side component as it’s the simplest way to achieve the results.

Here is the web page with embedded javascript:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script src="prototype.js" type="text/javascript"></script>

<label for="areaCode1">Telephone Area Code 1:</label>
<input type="text" name="areaCode1"
    id="areaCode1" onkeyup="lookup1.findCode($F('areaCode1'));" />
<input readonly="true" id="areaCode1.name" value="Unknown" size="50">
<br /><br />
<label for="areaCode2">Telephone Area Code 2:</label>
<input type="text" name="areaCode2"
    id="areaCode2" onkeyup="lookup2.findCode($F('areaCode2'));" />
<input readonly="true" id="areaCode2.name" value="Unknown" size="50">

<script type="text/javascript">

    function LookupClass(url, prefix) {
        var localPrefix = prefix;
        var localUrl = url;
        this.findCode = findCode;
        this.processResults = processResults;

        function findCode(myAreaCode) {
            var params = {areaCode: myAreaCode};
            new Ajax.Request(localUrl, {method:'get',
                    parameters: params,
                    onSuccess: function(transport){processResults(transport)}});

        function processResults(transport) {
            var response = transport.responseText;
            $(localPrefix + 'name').value = response;


    // On load code
    var lookup1 = new LookupClass('simpleAjaxResponse.php', 'areaCode1.');

    var lookup2 = new LookupClass('simpleAjaxResponse.php', 'areaCode2.');



Here is the PHP back end that returns some data:


if (strlen($areaCode) != 5) {
        print "$areaCode must be 5 characters long";
} else {
        if ($areaCode == "01582") {
                print "$areaCode is the area code for Luton";
        } else if ($areaCode == "01525") {
                print "$areaCode is the area code for Leighton Buzzard";
        } else if ($areaCode == "01908") {
                print "$areaCode is the area code for Milton Keynes";
        } else if ($areaCode == "01823") {
                print "$areaCode is the area code for Taunton";
        } else {
                print "Unknown Area Code";


Β© Copyright 2007 - BoraDev Consulting