Uncategorized

No to the Alternative Vote

On Thursday 5th May there is a referendum on whether or not the United Kingdom should adopt the instant-runoff (“Alternative Vote”) voting system in place of the “First Past The Post” (FPTP) system that’s currently in use. There are rigorous campaigns for and against this, both from various political parties and from other campaign groups.

Having carefully considered each argument I’ve come to a decision on how to vote on 5th May and I wil be voting “No”. Here are the reasons why I have reached this decision. You may wish to note that none of these reasons are political. I don’t care about any of the party positions. I will admit that the party that I’m a card-carrying member of has a consolidated “no” position, but this had no bearing on my decision.

  1. The instant-runoff system, whereby you “score” the entire list of candidates in order of preference, is the same system that Nominet and the British Computer Society use for various internal elections, so I am familiar with using it already. Here’s the blunt truth about using it in practise: After I’ve marked my second preference, I really don’t give a monkeys about the remaining six candidates and so I assign their numbers arbitrarily, almost randomly. I expect many people will do the same if this system is adopted for parliamentary elections.  Such “votes” that make up the numbers in this way are at best a waste of time and at worst could give a candidate or party more representation than people actually wanted.
  2. It makes what is currently a very simple voting system (marking a sheet of paper with a cross, even illiterates can do it as long as they have someone to tell them which candidate is which) with one that is much more complex and arguably inaccessible to a small handful. This will have a detrimental effect on voter turnout if people believe that the system is more complicated and therefore prone to error. Low voter turnout is one of the most crucial problems with elections these days and anything that threatens it further is unacceptable. I’ve always maintained that voting in parliamentary elections should be mandatory, like it is in Australia. At no point should it ever be possible to apportion the result of an election to any level of voter turnout.
  3. It has the potential to allow more extreme political parties to gain disproportionately more representation than they would otherwise gain. I’m actually very surprised that pro-AV groups, who are typically on the left of politics, are advocating a system that could give parties like the British National Party more power and influence.
  4. Lastly, given this country’s track record with IT projects, I have little to no confidence that the costly and complex vote counting system that will be required will be up to the job. Arguably a minor concern when compared to the others, but still valid.

I’m not saying for a minute that the existing FPTP system is by any means perfect, because it’s far from it. Indeed, I’ve often bemoaned its shortcomings following various general elections after watching in dismay as carefully planned constituency boundaries deliver election victories which they ought not to have and wouldn’t have under a “fairer” system. I just don’t think that AV is the answer to this.

So there it is, I have imparted my decision and the reasons for it. If you’re undecided at this stage I hope that the points I’ve raised help you to decide appropriately.

Uncategorized

Google Chart API PHP classes

Following on from my recent release of AGCDR (Asterisk CDR Statistics), I thought I would make an important sub-set of that project available separately. As part of writing AGCDR I wrote a reasonably extensive set of PHP classes to interact with the Google Chart API. The following chart types are supported, although some do not support all the features that the API offers:

The download contains all the classes, both in separate files and in a combined file (which one you will use will likely depend on whether or not you use class auto-loaders) plus a page of example usages to get you going.

As with AGCDR, this is currently being released as a beta so it’s not perfect and I would welcome comments, suggestions and bug reports. Please submit any comments, suggestions or indeed any code you would like to contribute via the Google Code page in order that all information pertaining to it is kept in the same place.

Here’s a gallery of examples:

Uncategorized

Asterisk CDR Statistics

I’ve been a beneficiary of the open source software community for quite some time now. Ever since downloading Slackware Linux onto upteen floppy disks in 1995, I have used and profited from the use of open source software, whether it it be an operating system, programming language, server technology or desktop application. However, up until this point I’ve never given anything back to the open source community (I really don’t count my Twitter CLI script), chiefly because every software system I have created or worked on has been proprietary and subject to non-disclosure agreements. I’m not grumbling about that, not all software is meant to be or should be open source and working on such systems has paid the bills (just about).

So, what have I written? Unhappy about the lack of a decent (and free of charge) system for analysing caller detail records (CDRs) generated by Asterisk PBX telephone systems, I decided that I would combine a number of techniques that I have learnt and developed over the past year or so to put my own package together, and it’s now at the stage where I think it could be considered a beta. This means that it’s not perfect but it’s more or less there. I’ve started hosting it over at Github.

Principal features

  • Clean, modern interface.
  • Supports multiple Asterisk servers which record their CDRs to a MySQL database.
  • Uses Google Chart API to generate dynamic charts.
  • Quick and advanced search facilities.
  • Rolling monthly and annual reports.
  • MVC framework*.

Screenshots

Further development

Where does it go from here? I’m open to suggestion, which is why I’ve published it and I would welcome comments from anyone who’s interested and/or finds it useful, whether you are a developer or just an end user. Is it useful? Does it work out of the box on your system? Is it easy to install for someone who isn’t a developer? What other features would be useful, bearing in mind that the data produced by the Asterisk CDR MySQL add-on is relatively limited?

I know that the documentation is a little rough around the edges and so I shall be paying attention to that, certainly. I also want to do some really thorough and structured testing in order to ensure it’s as robust as possible. I’ve tested it, obviously, but I’ve not seriously tried to break it yet.

So please feel free to download it, either as a tarball for installation or from the Subversion repository if you would like a good look under the hood. Please submit any comments, suggestions or indeed any code you would like to contribute via the Google Code page in order that all information pertaining to it is kept in the same place. I won’t publish any comments made directly on this blog post for this reason.

Uncategorized

Mac gaming spree

I’ve recently been surrendering large amounts of my spare weekend time to playing computer games after a hiatus of several years. Back when I had a PC I used to play computer games quite a lot, but since switching to Mac it has, until recently, been more difficult to do so, in part due to inadequate graphics hardware but mostly due to the fact that traditionally there simply wasn’t that many decent games available for Mac OS X.

I have two computers, a Mac Mini with a 2.53Ghz Core 2 Duo processor and a 256Mb Nvidia Geforce 9400 graphics controller and a Macbook Pro with a 2.8Ghz Core 2 Duo processor, which actually has two graphics controllers. It has a the same controller as the Mac Mini for “normal” operations and then it has an extra 512Mb Nvidia Geforce 9600 GT controller which you then switch on (requiring a logout instead of a reboot) when you want some serious graphics grunt. The reason why it doesn’t just have the super-duper one is that it absolutely hobbles the otherwise excellent battery life, so you only enable it when you really need it.

I’ve mainly been playing Half Life 2, which is available for the mac along with a plethora of other games via the Steam platform. Half Life 2 really puts my Macbook to the test, but it fares very well as I’m able to play the game at full screen resolution with nearly all the graphics settings turned up to maximum (meaning that it renders very pretty scenes) and still get a consistent frames per second (FPS) rate of between 30 and 60, which is good enough for me. The computer gets jolly hot whilst it’s doing this but appears to be designed to deal with it.

The other thing I’ve been playing is an old favourite from the turn of the century, Quake III Arena, the source code for which is now freely available and can be easily compiled on Mac OS X. All you need are the PAK files from the original game disc (as the content in these files are still under copyright). This game runs at a consistent, unwavering 90 FPS even on my Mac Mini’s relatively humble graphics controller with all the graphics settings turned up to maximum. It’s by no means a clever game, but it’s an awful lot of fun if you just want to blow off some steam in an unapologising shoot-em-up.

I’d really love to get Grand Theft Auto: San Andreas working too. There is a way, apparently, but it’s flaky, difficult to play on a laptop and I can’t play that game and enjoy it without all the mods cheats that I used to use, none of which will work on a Mac even if the game does. It’d be fabulous if other games publishers in addition to Aspyr used something like Steam to distribute their games to multiple platforms. It’s clearly a system that’s working very well and I think that publishers need to take the Mac platform more seriously as it gets more and more popular, especially amongst younger people who are their principle market.

If I had more time I would probably play games a lot more as they’re a great (and relatively) cheap way to escape and blow off some steam. That said I wouldn’t want to spend every spare minute playing them, I know what happens to people who do that.

Uncategorized

Outcasts

I’m thoroughly enjoying the BBC’s new science fiction drama series Outcasts. Although I regret the premature demise of Survivors, which Outcasts replaced after just two seasons, I think think it’s a worthy replacement and more than fulfills the BBC’s obligations regarding science fiction drama that isn’t mostly aimed at kids (i.e. Doctor Who). Despite this it is receiving what I consider an undeserved panning by critics, although this panning has dwindled a little now that we’re half way through the series and I think people have warmed to it a little more.

Outcasts is based a number of decades in the future and tells the story of a colony of humans on a distant planet that they have named “Carpathia” (after the ship that came to the rescue of the survivors of the Titanic disaster), established for a number of years and because Earth has become uninhabitable due to an as yet unspecific catastrophe, although several characters have already mentioned nuclear weapons and catastrophic earthquakes. The big budget for the series allowed the BBC to shoot it all on-location in South Africa, which makes a welcome change for a Stargate fan who’s very used to almost all alien worlds looking exactly like British Columbia.

Star actors include Hermione Norris (Ros from Spooks), Eric Mabius (Daniel Meade from Ugly Betty) and Liam Cunningham, who’s been in a number of films. I think the inclusion of Eric Mabius in particular was an enlightened decision given that the BBC sells much of the programming content it makes these days to the US market via the commercial BBC America channel. I believe that having to take this market into account has made it up its game regarding the quality of its content which will allow it to capitalise on the BBC’s already excellent reputation abroad.

The BBC have already changed its weekday prime time schedule spot to a less prime-time spot at the weekend, which I think it a little bit ominous, frankly. Good as I think it is, I don’t expect it’ll see another season and will therefore be even less successful than Survivors was. It will be a real shame. I’ll enjoy it while it lasts though.

Uncategorized

MIDI connection between digital piano and Macbook Pro

Carrie always was fond of the piano stool.

Right, I’ve torn my hair out over this for long enough now and so I’m pleading for help. I must be missing something very basic and elementary, but I cannot for the life of me find what it is.

First some back-story, which you will need to know if you don’t follow me on Twitter. I have recently inherited my late mother’s Technics digital piano (model PX9), as my Dad is moving house and there is no room for it at his new place. I’ve had my eye on it for some years now and my current home does have room for it, so he brought it up last week for me. Given that I cannot actually play the piano, I wish to connect it to my laptop using its MIDI ports.

My reasons for this are simple: All I want to do is:

  1. Download music from the Internet as MIDI files.
  2. Connect my laptop (Macbook Pro, Mac OS X 10.6.6) to the piano using a USB MIDI interface.
  3. Play the MIDI files on the digital piano from the laptop.

So far, I have achieved the first two goals, but I am having serious trouble with the third. Please note that I do not wish to compose music, create MIDI files or use the digital piano as a MIDI keyboard, all I want to do is have the laptop play the piano.

I have tried using the following software to achieve this:

  • iTunes – will play MIDI files, but not via MIDI, only using the computer’s speakers.
  • GarageBand – will play MIDI files on the laptop and will use the piano as a MIDI keyboard. I see MIDI signals being recognised, but it will not use the piano as a MIDI output and I cannot find any settings or options to that effect. Various Google searches suggest that GarageBand does not support MIDI output, despite supporting MIDI input.
  • Reason – this baffled the hell out of me, I couldn’t even load my MIDI file into it, much less find any MIDI output options.
  • Logic Express 9 – again, this is a complicated piece of professional software and I still could not find any MIDI output options. This surprised me given that this is supposed to be Apple’s professional composition software (in contrast to GarageBand which is aimed at amateurs), so I may well have missed them somewhere.

My question to those who know about this sort of thing is simple: How do I achieve what I want to do? What software do I need and which settings do I need to set? Surely it cannot be that difficult? I would imagine that it would be a case of having an option somewhere that changes the output audio device from the local sound card to a MIDI device. I know it’s possible because, back in the day, I had a similar interface for my Acorn Archimedes, and I distinctly remember achieving this with some considerable ease using basic bundled software.

I have confirmed that my USB MIDI interface is working correctly and that it is connected to the digital piano correctly. I think the fact that GarageBand recognises input signals from the piano confirms this. I would welcome help and advice from anyone who can help me.

Incidentally I think it’s amazing that an up to date laptop is able to connect and talk to a 24 year old piece of equipment using nothing more than a smart cable that cost £2.50 from Amazon.

Uncategorized

Command line Twitter script

I mentioned on Twitter the other day that I have a relatively basic but functional command line Twitter script, for use when you can’t or just don’t want to load the full-fat Twitter site in your web browser or you don’t want to use a third party GUI client. I received much more interest in this than I thought I would (i.e. more than zero) and so after some thought* I’ve decided to make it available to anyone who wants it.

The script, which supports a single Twitter account, supports the following actions:

  • Update (tweet), with option to specify an existing update ID to reply to.
  • Retrieve your public timeline (your tweets and those of who you follow).
  • Retrieve your own timeline.
  • Retrieve the public timeline.
  • Retrieve your recent mentions.
  • Retrieve recent re-tweets of your updates.
  • Search Twitter.

In order to work, you must authorise your Twitter account with SuperTweet, and provide the script with the username and secret that you specify in your SuperTweet account. This is because the script does not support oAuth (at least, not yet). Also, if you use Twitter to post URLs (and you probably do) you will also require a Bit.ly API key. Edit the script and provide both sets of credentials at the top.

The script is self contained, containing all the various classes that it depends on in the same file. I’ve verified that it works “out of the box” on Ubuntu Linux 10.04 and Mac OS 10.6. It will probably work on many other systems too, assuming they have PHP installed. With a small modification to the first line you can probably get it to work on Windows too, but that’s as far as I can advise, you’re on your own from there. The version I use doesn’t contain the included classes as I link it to my local class library.

To get started, download the script, unpack it with gzip -d, add execute permissions with chmod +x and then type ./twitter.php commands for a usage summary. Some commands when called without arguments will present further usage summaries which will tell you how to use them. You’ll probably want to start with something like:

./twitter.php update "Testing @stuartford's pitiful command line Twitter script."

Don’t forget to add your Twitter and Bit.ly credentials to the top of the script otherwise it definitely won’t work first time for you and I’d rather that didn’t happen.

If you don’t understand most of this post then this script probably isn’t for you, sorry, it is what it is, no warranty, etc.

* I say it required some thought because it’s rare that I make my code available for public use. I don’t know why, because I believe I am a talented software developer, I guess it might be the slight family creative gene within me that might be forcing a behaviour equivalent to an artist who’s perpetually reluctant to show people his work, who knows, that’s one for the shrink’s chair. Certainly the script isn’t my best work, it grew out of something quick and dirty, and as any developer will tell you, anything that grows out of something quick and dirty will always be quick and dirty at its heart.

Uncategorized

New houses next door

Since the summer the vacant plot next door to where I live has been a building site. We knew that it would probably become one at some point when we moved in, having noticed the vacant premium corner plot next door and having observed on Google Maps that up until recently it used to have a house on it, since demolished.

So sure enough, one random morning in August some men turned up with some noisy machines and started clearing the previously overgrown plot, in readiness for the construction of two new 5 bedroom houses on it. The six day per week early morning noise of this project is what I’ve been moaning about so much on Twitter recently. We couldn’t imagine how they would get two 5 bedroom houses on the plot but it turns out they both have three storeys, allowing smaller footprints.

My side bedroom window looks out upon this building site, which is chiefly why I have suffered so much with the noise. Angle grinders outside your window at 7.45am aren’t funny. Still, regardless of this, I was able to slowly observe the construction and I took a number of photos of key points of progress. Even though the houses aren’t complete, I cannot take any more than I already have because my vantage point is now completely blocked by the brick wall of the side of one of the houses.

1 3 4 5 6 7 22