Posted by: decster | January 13, 2008

Google Chart and sparklines

Following on from my earlier post on the Google Chart API, I have been playing around with the API a bit more. This time I’ve been focusing on sparklines.

Followers of the work of Edward Tufte will be familiar with sparklines. Properly described, they are small, high resolution graphics embedded in a context of words, numbers, images. Simply described, they are graphs that fit in a line. Examples are always good so returning to the the previous post’ example of Irish generation of electricity from wind over the past six years, were we to represent it with a sparkline and it would look like this: .

Hmmm, but that doesn’t look very informative. There are no labels, for example, and its hard to grasp a sense of scale (full graph for comparison). The simplicity of a sparkline belies its power. With a glance I can see that windpower generation in Ireland has been increasing. The power of sparklines becomes more apparent when you want to quickly visualise and compare several sets of data, share prices of competing companies would be a good example. For my next example though I’m going to depict US military personnel wounded in Iraq since 2003 (data). To show-off the potential of this visualisation method even more, green lines are used to indicate a downward trend in figures, red is upward and grey is used where the trend was ambiguous:

2003
2004
2005
2006
2007

What has really impressed me here is how simple it was for me to generate these sparklines. In the past I’ve played around with graphic modules in both Perl and Ruby in an attempt to generate sparklines but none have come close to the simplicity and ease of use of the Google API. Most impressive of all has been that no matter what image dimensions I feed to Google, the returned sparkline is always properly rendered and well scaled.

Further reading:

Posted by: decster | January 7, 2008

A first look at Google Chart

The Google Chart API has been around for a few months now but I’ve only gotten around to having a play with it this evening. The API offers an easy way to generate simple graphs for embedding in a web page. To use the API you construct a URL with parameters specifying how the graph will appear and including the encoded chart data and in return it then presents you with a PNG representation of your chart. Essentially what you are doing is simply hotlinking to the picture of the chart which is hosted by Google. Of course there’s nothing to stop you saving the image and uploading it to your website later on but for ad hoc generation of charts, Google are onto a good thing. Enough with the prattle, lets take a look at how it works.

To generate a chart one of course needs data. Unbeknownst to many, I take a keen interest in the construction of new wind farms in my native Ireland. This may have something to do with the plans to construct one of the world’s largest offshore wind farms near where I grew up or maybe it’s simply because I like windmills. Anyway this data from Sustainable Energy Ireland on the construction of wind farms in Ireland over the past few years affords me the opportunity to graph some meaningful data.

Adding up the amount of megawattage constructed every year in Ireland between 2000 and 2006 provides the following dataset:

2000 2001 2002 2003 2004 2005 2006
46.67 8.4 12.575 74.4 135.15 152.25 246.5

 

In order to use the API you need to encode the above data into a more compressed version using one of a choice of encoding techniques. As I’m using a small dataset, I’m using the simplest encoding technique. Google provide some sample Javascript so after a few minutes effort I’ve encoded my dataset as JCCPbfy. In addition to the data I also need to include the labels for the X and Y-axes, dimensions of the image, the encoding technique used and a few other parameters which are well documented by Google. So what I’ve ended up with is a URL that looks like the following (I’ve highlighted the bits I’ve had to edit in bold):

http://chart.apis.google.com/chart?chs=400×250&chd=s:JCCPbfy&cht=lc&
chxt=x,y&&chxl=0:|2000|2001|2002|2003|2004|2005|2006|1:||300+MW

And that’s it. I then simply take that URL and either wrap it in an <img> tag or, in this case, just point WordPress at it.

It’s nice to see that the number of wind farms completed each year in Ireland is on the increase but lets say I want a bar chart instead. Well that’s easy-peasy, I just change the cht parameter to say bvs and that’s it, I have a bar chart.

And who doesn’t like pie?

I’m only scratching the surface here and there are a bunch of other features like specifying colours, handling multiple datasets and so on. Sure there are limitations, like you can’t have more than 4,096 values in your dataset, but I suspect Google are onto another hit here. People like to talk about Software as a Service but I think what we are looking at here is another example of Components as a Service. Look at the ubiquity of Google Maps and you can see how Google Charts could become increasingly prevalent.

While I can’t see large enterprises ever using Google Charts in a big way, their mindsets aren’t designed to send data beyond their walls, I think there are important take-aways. For example, why not provide something equivalent to Google Charts for your applications? Why have disparate development teams each developing graphing components when those same graphs could be provided as part of a centralised service? In some enterprises the idea of separate software components already exists for things like search or authentication. My bet is that it won’t be too long before we see graphing offered in a similar way.

Plenty to chew over and something I’ll return to in the future .

Posted by: decster | January 6, 2008

Do digital certificates work?

Jeff Atwood over at Coding Horror poses the question of whether digital certificates, a subject very close to my heart, work or not. The post and following comments are worth a read.

My two cents are that certs as a way of verifying a websites authenticity will be around for a long time to come. Server certs though remind me of the photo I posted recently. As a piece of security infrastructure certs are a pretty solid component but there are other things around them that will weaken the system as a whole. Your browser in particular is susceptible to any number of security holes either coded in from the off or introduced later on by user action such as installing malware. Client certs on the other hand have never really taken off beyond the confines of the enterprise. That said I did notice earlier on today that you can log into the British Inland Revenue Service using a digital cert. I also note that they don’t support certs on a Mac. Wonder if they support Firefox?

Anyway before this turns into a rambling post, I’ll leave you with one off-the-wall prediction - OpenID will start to make some serious ground in 2008.

Posted by: decster | January 5, 2008

What I read in 2007 - Fiction

The second in a series on the books I read during the past year. I realise we’ve slid into 2008 but who cares? Anyway after the last post on history, this time it’s fiction.

The People’s Act of Love

Set during the confused aftermath of the Russian Civil War, The People’s Act of Love is a dark tale of murder, cannibalism, betrayal and eunuchs. Actually to try and distil the book down to those keywords does not do this brooding, pondering work justice. At times the plot moves along slowly but the language is always deep and rich. The perfect book to read on a dark, wintry night when the wind is blowing all the way from Siberia.

Napoleon - The Song of Departure

I was drawn to this book by the interesting premise. Take one of history’s best-known figures, Napoleon, and write what is essentially a work of fiction but based around a framework of historical fact. Gallo has taken the life of the Corsican-born general and essentially filled in the blanks - what did the young Naopleon think about in school, what was he thinking as he struggled as a young artillery officer, and so on. These books, this is the first in a series of four, were hugely successful in continental Europe and I can understand why. It’s almost a voyeuristic look into the private life of Napoleon. I’ve half a mind to pick up one of the weightier non-fiction biographies on the future emperor, maybe this one which covers the same period.

Quicksilver

Quicksilver is a monster of a book. A trousers off, pants down, 926-page monster of a book. Set roughly in the period between the Great Fire of London and the Glorious Revolution, Quicksilver follows the story of several fictional characters as they interact with the historical giants of the day. Newton, William of Orange, Loius XIV, Leibniz, Pepys - they are all in here. While the story is at times slow, Stephenson is to be commended on the level of research that must have gone into making this novel feel so authentic. Even more impressive is that Quicksilver is merely the first book in The Baroque Cycle trilogy. (My thanks to Gavin for both insisting I read this book and lending me his copy)

Flashman

I’ve a vague recollection of flicking through my father’s boyhood copy of Tom Brown’s Schooldays when I was young but I’ve never read it myself. Flashman follows the fictional like of one Harry Paget Flashman, who, after being expelled from Rugby School in Tom Brown’s Schooldays, goes onto to live the life of a Victorian rogue bounding about the world dispatching rogues and shagging anything with two legs and a pulse. Flashman is the ultimate anti-hero and this is the kind of book every boy should read in his teenage years. The historical characters that litter the Flashman Papers are well drawn and the attention to detail is impressive. (Anyone noticing the historical theme running through my fiction collection yet?). I was saddened to hear that the book’s author George MacDonald Fraserpassed away this week at the age of 82.

The Wine-dark Sea

Saving the best until last, the twenty-book series of Aubrey-Maturin novels is, for my money at least, the defining work of historical fiction. As I’ve mentioned before, it is far beyond the scope of these blog posts to convey the epic majesty of Patrick O’Brian’s work. The books are written in the language of the time with an apparent authenticity that I’ve yet to encounter the like of. To paraphrase a book review I once saw, the English-speaking world is divided into those who have read Patrick O’Brian and those who are going to read Patrick O’Brian. Nothing short of epic.

Posted by: decster | January 4, 2008

The never-ending struggle

Came across this photograph today and thought it summed up very nicely that whatever security you put in place there is always a way around it. If anyone ever declares to you that their system is completely secure then they are either a charlatan, an ignoramus or a fool.

(If anyone knows the origin of the photo, I can give credit where credit is due)

Posted by: decster | January 4, 2008

Two bag joy

From this Monday, you’ll be allowed to take more than one item of hand luggage when flying from Heathrow. If ever there was a more annoying, badly explained, frustrating security rule at an airport I’ve yet to hear about it. I could quite happily fly into London with a laptop case and a small wheeled case but out of London the case would have to be checked-in. Security theatre at its illusory worst.

Details from BAA here.

Posted by: decster | December 25, 2007

Thoughts on the iPod Touch

This Christmas the Big Man in Red was good enough to leave me an iPod Touch underneath our Christmas Tree. It’s almost a year since Steve Jobs unveiled the iPhone and its ground-breaking interface but today has been the first time that I’ve had a proper chance to play around with the latest toy from Cupertino.

From the moment you turn it on, the Touch draws you in with just the simple intuitiveness of its interface. It may very well have come with a manual but if it did I sure as hell haven’t read it. Actually I’ve just had a look in the minimalistic packaging and you get not so much a manual as a leaflet that gives a cursory overview of the Touch’s salient features and the customary sales pitch for iTunes. Twelve hours after powering it up I have yet to find a feature that I can’t figure out in more than a few seconds. In fact my clumsy fingers have unearthed even more more features through my inept tapping.

First to the browser. The Touch comes with a special version of Safari as standard. The Web is doubtless scattered with reviews so I won’t re-hash what is already there. What I will say though is that having a fully-featured web device on a mobile device is nothing short of revolutionary. I’ve played around with the mobile version of Opera on Blackberries as well as other browser offerings on things like MDAs and Palms but all they are now consigned to the trash heap of technological history. Sure I’d rather have the open-sourced Firefox on here but that’s but a minor quibble. The web experience on the Touch is fantastic. Within a few minutes I had setup bookmarks for my Google Reader, Facebook and the Economist. That I’m writing this blog post from the Touch, albeit very slowly, is further testament to just how well-rounded the browsing experience is. Even with the Javascript-heavy WordPress, most things appear to just work.

Music on the Touch is just your standard iPod fare although there are some nice features such as flowing cover art. I haven’t had a chance to upload any videos yet so I’ll reserve judgement for the moment. I will say that the screen seems slightly smaller than my PSP so subtitled films may be difficult to watch. Videos on the in-built YouTube browser seemed fine though.

Now before this turns into an Apple love-in, I’d like to take this opportunity to say that iTunes is a pile of utter toss. I’d actually like to use stronger language but seeing as this is a family blog, I’ll try and keep this clean. iTunes is nothing short of an affront to humanity. Its clunky, unintuitive and possesses an almost pathological desire to annoy me. Trying to do something simple like adding a song involves fannying around with libraries, playlists, party shuffle and the riddle of the god-damned Sphinx. Why there can’t be a simple drag-and-drop interface for adding songs is beyond me. For a company that prides itself on interface design, Apple should really be able to do better. The iTunes Store interface is also nothing short of crap.

Lest I end this post on a negative wave, I’d like to emphasise how much I’m in awe of my Touch and am looking forward to playing with it in the coming days and months. And of course a final word of thanks to the Girlfriend for arranging my present with the Big Man in Red. Happy Christmas and many happy returns.

Posted by: decster | December 25, 2007

iPod Touch

My first blog post from my new iPod Touch. More to follow but for now it’s sufficient to say that I’m in awe of the web browser.

Posted by: decster | December 10, 2007

What I read in 2007 - History

The first post in a series on the books I read during the past year. First off it’s my favourite subject, history.

The Great Game
The phrase The Great Game was first coined by Rudyard Kipling in Kim. This book by Peter Hopkirk provides a detailed history of the main protagonists and their struggle for supremacy in Central Asia from the end of the Napoleonic Wars through to the turn of the Twentieth Century.

To anyone brought up on tales of imperial derring-do, some of the elements of this book will be familiar: the Kybher Pass, the British politicals passing for locals, the Afghan Wars and so on. Less familiar, to me at least, was the story of the Great Game from the Russian side. Of course it helps that Russia and Britian were vieing for mastery of a region with cities that evoke mystery in and of themselves - Samarkand, Tashkent, Dushanbe - but Hopkirk is to be commended for compiling this century of history into a flowing narrative. This really was the first Cold War and goes some way toward explaining the paranoia with which the Anglo-Saxon world and Russia still view each other. At the start of the Great Game, Russia’s border stood more than 2,000 miles from British territory. By the end, that distance was less than 20.

The War of the World
Charting the bloody course of the Twentieth Century, Niall Ferguson turns his considered attention to what he terms history’s age of hatred. As with much of Ferguson’s work there are plenty of statistics in here about economic output, demographics and the like. Worthy of special mention, however, are the sections on Jewish pogroms and the fate of the German-speaking inhabitants of the newly created Eastern European countries after Versailles.

After dealing quite well with the first half of the century, Ferguson then goes onto contend that the Third World War has already happened and that it was fought in the Third World by the proxies of the Soviet Union and the United States. It’s an interesting argument and one that Ferguson continues to contend, in this weekend’s FT for example, but too little time in the book is given over to exploring this belief. The last few chapters of the book feel rushed which is a pity as the opening two-thirds are excellent.

God’s War
Stepping back in time almost a millenium, God’s War examines the wars of relegion from the First Crusade through to the Seventh including everything in between and beyond like the anti-pagan crusades in Central Europe and the “liberation” of Spain and Portugal from the Moors. It’s interesting stuff and Christopher Tyerman certainly knows his subject but I found this book a bit of a chore at times as it plods along through it’s 922 pages. Ultimately though the effort was worth it. Given the apparent clash of civilisations we are meant to now be living though, this book helps provide some historical context.

Pursuit of Glory: Europe 1648-1815
Pursuit of Glory is my kind of history book. Covering almost two centuries, Tim Blanning manages to take in both a broad sweep of history coupled with the minutiae of everyday life for the people who lived through the period. Topics covered include water transport, sex, corn production and toll roads. Themes encompassed in the 677 pages include trade, religion and revolution. This is the type of book, I always enjoy. You can open it on any page and discover some nugget of information with which to impress/bore your friends with in the pub. Cracking stuff.

Iron Kingdom
Last and by no means least comes a chronicle of the rise and fall of Prussia from 1600 to 1947. How Brandenburg, a small, strategically unimportant, economically backward region of Europe, came to dominate the history of the continent makes for a fascinating read. At so many points in its history could Prussia have been snuffed out that it’s a wonder that the Prussian system came to dominate Germany let alone go on to participate in the two world wars. The history of Prussia ends with the Faustian pact between the Prussian miliatary aristocracy and the Nazis which led to the extermination of the Prussian way of life at the hands of the Soviet war machine. The last word on the Prussians should probably be left to the ordinary Soviet soldiers who, when they encountered the neat villages and prosperous farms of East Prussia, wondered to themselves why a people from a land apparently so properous would ever want to set forth and conquer.

Posted by: decster | December 10, 2007

The security arms race

I was reading a short article on DNS poisoning this weekend, as you do, and came across one of the best explanations of why complete security is something you can never achieve.

Some guy walks up and says he’s from the gas company. You let him in, he steals your beer.

Next time you ask him for gas company ID. He shows you a fake one. Beer stolen.

Next time you call the gas company phone number printed on his ID. It’s his buddy’s phone number; the buddy tells you the guy’s legit. Beer stolen.

Next time you call the gas company’s number as shown on your latest gas bill. It’s his buddy’s other line; they sent you a forged gas bill. Beer stolen again.

Next time you call the gas company as shown in the phone book. Oops, they sent you a forged phone book. You talk to the people at the gas company building downtown and get their phone number. You dial it but his buddy has broken into the phone company’s switch and forwarded the call to his other line. Or the beer thieves rented office space and set up a whole fake gas company office, a tactic seen in “Sneakers”. Again, beer stolen.

Indeed, perhaps they simply bribe a real gas company employee to steal your beer. It’s a never-ending arms race.

« Newer Posts - Older Posts »

Categories