Skip to main content

Posts

Showing posts from July, 2009

Interactive "Over-by-Over" Reports using the Guardian Open API

I recently applied for and was given a developer key for the Guardian Open Platform, an initiative from the Guardian newspaper to make available content and data for use by other developers and websites.

My idea was to pull in data from their excellent, and humourous, "over-by-over" coverage of the Ashes cricket, to display on an interactive chart. You would be able to select a particular batsmen and match, view their innings graphically and be able to hover over each over to see the score, state of play and commentary from the time.

And I'm pleased to say it came together very well. Please click to view the result - interactive over-by-over reports - and let me know your thoughts.

Finally, I've also set up a related blog post if you are interested in how it was put together.

Building Interactive "Over-by-Over" Reports

As mentioned in a related post, I've been granted a developer key for the Guardian Open Platform and have used it to put together a website displaying interactive cricket scores and reports. This post details how I've put this together.

Web Service Back End

The application is in two parts. My initial thoughts were to build this purely on the client side using jquery - the API provides JSON as well as XML response formats. But of course this would mean exposing my developer key to anyone who thought to "view source"... and I expected the Guardian wouldn't be too pleased with that. So instead I set up a web service, that will be called by the client side code AJAX style, in order to protect this information.

I also took this opportunity to simplify the output going to the client side code to what I really needed, in order to ease the complexity of the JavaScript manipulations.

The API provides a means of loading the full details of any piece of content via an ID, a…

Setting Up Ruby on Rails on Vista

Possibly going slightly around the houses, but I'm sure similar to otherdevelopers who have started using ASP.Net MVC, I've recently started setting up and taking a look into Ruby On Rails. Only had an quick look so far, and had a read through the rails guides to get started - but already can see why it's proved such a popular environment for web development, how it's influenced the development of ASP.Net MVC, and how it's come to promote the MVC pattern more widely in web development circles.

Also probably oddly for a RoR developer, but similar to others from a Microsoft background, I'm running Vista. There are some useful posts out there for setting up RoR on Vista, but as I found a few issues that weren't covered figured it worth noting here.

MySQL Setup

Whilst setting up Rails I also installed MySQL to use as the database. The link provided above provides all the details for installing this. Note though that when it comes to configuring the installatio…

Serialization and Deserialization of Class with Changed Structure

In building a CMS versioning system, I had the idea of using database saved, serialised versions of my objects to represent revisions - which could then be loaded and reverted to the live record in the database when required.

A potential problem though was what if my object structure had changed between the save and the retrieval? i.e. what if I add a new field to my object, that won't be in the serialised data.

I wrote this test to find out:

    1using System;
    2using System.Collections.Generic;
    3using System.Linq;
    4using System.Text;
    5using System.IO;
    6using System.Runtime.Serialization.Formatters.Binary;
    7
    8namespace SerializationTests
    9 {
   10     [Serializable]
   11classSampleClass
   12     {
   13privateint mintID;
   14privatestring mstrName;
   15privatestring mstrName2 = "Default value";
   16privateint mintNumber = 2;
   17
   18publicint ID
   19         {
   20get { return mintID; }
   21set { mintID = value; }
   22         }
   23
   24publicstring…