Monday, January 28, 2008

It is too late - Charlotte is a hoodie!

Posted by Chris @ 9:14 PM

It is too late, Charlotte is destined to terrorise the neighbourhood as she has worn her first hoodie today. The downside to her reign of terror is that she looks far too cute in it. But it could be a sign of times to come, give it 15 years and who knows!

Charlotte in her first hoodie

Thanks to Ant who bought us it tho, she looks really sweet in it. In other Charlotte news she is putting on weight and is probably somewhere around 7lbs now, 7wks old, growing fast! Dawn is doing fine too, so all is good here! There are loads of new pics in the gallery, so check it out!

Wednesday, January 23, 2008

last.fm is AWESOME

Posted by Chris @ 8:22 PM

I first blogged about last.fm back in April of 2006, and back then I was pretty taken with them, they offered a great service and are great for getting info on bands and music of all tastes. You were also able to listen to clips of tracks to get a feel for an artist.

Well today they have become the single best website on the Internet, and that is a bold statement. Now you can listen to the tracks in full, as explained here, streamed right there and then - music when you want it.

The power of this? Now when you hear a track by a band you can go and hear all of their other tracks straight away. Want to listen to a classic, go for it. No waiting for downloads, just instant gratification (and then of course you can buy the download/album if you want). Sheer music genius.

So now you all have no excuses when I tell you that The Wombats are a great band and you should listen to some of their tracks. I particularly recommend “Moving to New York” and “Let's Dance to Joy Division” as you'll have heard these on the radios.

Well done last.fm, you are truly AWESOME!

Thursday, January 17, 2008

No Google Analytics API? No Problem!

Posted by Chris @ 2:23 PM

If you're like me, you probably have a blog and use Google Analytics to track visitor activity. If you've not already got one, you probably want a "Most Popular Posts" section on your blog as it's a great way for new visitors to find your best content. The only problem is that this would usually have to be hard coded, and would therefore need updating periodically after you've checked the "Top Content" report in Google Analytics, or it would require some server-side scripting and a database to track your page views and show the links dynamically.

Wouldn't it be great if you could somehow use Google Analytics to display the "Most Popular Posts" section on your blog automatically? That would be a huge time-saver for you and would make it much more useful for your visitors as it would always be up-to-date. Unfortunately, Google Analytics doesn't have an API, but here's a method that doesn't involve any server-side code or screen-scraping. All you need to do is use a few existing free services from Google and Yahoo and a bit of JavaScript.

Basic Method

  1. Obtain the tracking data in a usable format -- We can schedule Google Analytics to email this as an XML file on a regular basis.
  2. Make the XML file accessible online -- By emailing an attachment to Google Groups, the file is automatically given a public URL.
  3. Work out the URL of the most recent report -- Since Google Groups provides RSS/Atom feeds for all messages, we can easily find the URL of the most recent message and therefore work out the URL of the XML report.
  4. Prepare the data for use -- We need to manipulate the XML and massage it into a handy JSON format that we can use on our blog, which can all be done using Yahoo Pipes.
  5. Display the links on your site -- With just a bit of client-side JavaScript, you can finally add a self-updating "Most Popular Posts" section to your blog.
There you have it! Using your own Google Analytics data, you can create a completely automated way of displaying your most popular posts to your site visitors.

If you're interested in exactly how I did this, the rest of this post expands on each step and take you through the entire process...

Setting up the Google Group

Since Google Analytics doesn't provide an API, or allow you to link directly to any exported reports, we'll use a Google Group to host the files which we'll schedule Google Analytics to email to us. When you setup your Google Group, choose the Announcement-only option. Once created, under the Group settings menu item, select Access and make sure that Anybody can view group content, Do not list this group and People have to be invited are all selected. This is so that no one else can post to the group, which would cause issues when trying to retrieve the Analytics message. Keeping the group unlisted makes it less likely for someone to stumble across your Analytics reports when searching Google Groups. Although it would be preferential to make the group private, this would prevent public access to the feeds for the group, which we'll need later.

While we could email our reports directly to the Google Groups email address, each message would then contain an "opt-out" link because it's not the email address we've got registered with Google Analytics. Given that our messages will be publicly available, we'll be using Gmail to forward the messages from the same Gmail address we use for Google Accounts so that if anyone manages to find the Google Group, they can't stop our scheduled report. Simply create a new filter, looking for any email with Analytics in the subject that has attachments and have Gmail forward the email to your Google Group. (You can choose to "skip the inbox" so you don't have automated reports cluttering up your inbox too.)

Setting up Google Analytics

In Google Analytics, under the Content section, view the Top Content report and change Show rows from 10 to 50. (You can't configure how many results to include in your report any other way; it just remembers the last setting you selected.) Now click the Email link button near the top of the page, beneath the page title. Select the Schedule tab, change the report format to XML, set the date range/schedule to Monthly (unless you have a really active blog, then you might want to keep it on Weekly) and click the Schedule button at the bottom. Just to test everything, select the Send Now tab, choose XML as the format and click the Send button.

If everything worked correctly, after a few seconds your Google Group should have a Top Content XML report in it! :o)

Yahoo Pipes

You'll need to find the feed URL for your Google Group. You can get this from the XML button at the bottom of your group homepage. Choose one of the New messages feeds, copy the URL and head on over to Yahoo Pipes...

For those that don't know, Pipes is a really powerful service provided by Yahoo that lets you fetch data from all over the web and perform various operations on it, resulting in new or altered XML feeds / JSON output being created, all done using a funky graphical interface -- not a line of programming code in sight!


A screenshot of the Pipe being used.

The Yahoo Pipe I'm using can be found here. If you're familiar with Yahoo Pipes, feel free to view the source, clone this pipe and use it as the basis for you own implementation. For those not familiar with Yahoo Pipes, here's a brief rundown of what's happening:
  • Grab the Google Groups XML feed and truncate it to leave us with the most recent message.
  • Take the message URL and modify it to give us the URL of the XML attachment (basically replaces "msg" with "attach" and appends "?part=2").
  • Select the report data from the XML attachment and filter out any links we don't want to include.
  • Finally, using the filtered links, fetch each blog post from the website to retrieve the page title for use in the link and truncate the results to return only the top five.
The result is a JSON file containing the top five most popular blog posts based on the most recent Top Content report sent from Google Analytics to the Google Group.

Displaying your "Most Popular Posts"

The final step is to take the JSON file returned by Yahoo Pipes and display the contents on you website, which can be done using some client-side JavaScript similar to this:

<script type="text/javascript" src="http://pipes.yahoo.com/pipes/pipe.run?_id=6vhLQfPC3BGM7_UDo_NLYQ&_render=json&_callback=topcontentCallback"></script>
<script type="text/javascript">
<!--
function topcontentCallback(obj) {
var url,title,output,i;
i=0;
output='<ul>';
while (i<5 || i< obj.count) {
url = "http://www.yoursite.com" + obj.value.items[i].Key;
title = obj.value.items[i].loopfetchpage[0].content;
title = title.substring(27, title.length-8); //remove the <title> tags the pipe leaves in.
output+= '<li><a href="' + url + '" title="' + title + '">' + title + '</a></li>';
i++;
}
output += '</ul>';
document.getElementById("popularPosts").innerHTML = output;
}
//-->
</script>

(Basically, we're making the pipe execute a JavaScript function on the web page by using a callback on the JSON URL. To learn more about JSON visit the Yahoo Developer Network's JSON overview, or the official home of JSON, JSON.org.)

Conclusion

This is a simple way of making your Google Analytics data available to use in your own web pages and applications. There are obviously some privacy issues, as your report data is available for everyone to see on Google Groups (which can easily be found by doing a quick search) but if you think that's a worthwhile trade-off for being able to have a maintenance-free top posts section, then the world is your oyster...

And you're not just restricted to displaying your most popular posts. You could also use a similar technique to display your top keywords, referring sites, geographic locations, browsers... and anything else which you can find in Google Analytics!

Have fun mashing up your Google Analytics data!

Also cross-posted on Google Blogoscoped

Sunday, January 13, 2008

Time lapse film of Charlotte sleeping

Posted by Chris @ 8:56 PM

What do you do when you have a HDD camcorder with infrared recording, a tripod, a baby daughter and you're a geek? Why, make a time lapse recording of your daughter sleeping of course! This condenses a night with Charlotte into approx. 5 minutes. Enjoy!


Time lapse film of Charlotte sleeping from smuggyuk on Vimeo.

For the geeks out there wondering how I did this, firstly I've got a HDD camcorder so it can record up to 7.5 hrs in one go. So, setup on a tripod with the infrared recording on I could just leave it, switching it on and off with the remote as and when we had to take her out for feeds. Then once I'd got the video on the laptop I simply used the “Speed Up, Double” effect in Windows Movie Maker 5 times on each clip, nothing too fancy. This made the length of the whole film about 5 mins. Publish and upload to the web, job done!

Thursday, January 03, 2008

Review of 2007 and New Year resolutions for 2008

Posted by Chris @ 8:27 PM

As is customary at this time of the year I've taken a quick look back over what I blogged in 2007. It is a mixed bunch, I went to Hack Day, we nearly got flooded, I developed various bits and pieces, including PhotoWall and Recipe Binder, Dawn got pregnant and had Charlotte(!), I fiddled with Ubuntu, we got a new TV, Wii and laptop, went on holiday in Morzine and Brussels, went to some gigs, redid the Website Validator, discovered Vimeo and Facebook, ditched twitter, went to my sisters wedding and ranted as I do.

So that was some of 2007, but what of 2008? I'm not really one to make New Year resolutions, but after a bit of quick discussion in the pub this lunchtime I've managed to come up with 4! So without further ado:

  • Listen to more podcasts - now I have a decent MP3 player and Dawn won't be traveling to work with me I can listen to more on the train. However I need some help, what are the essential podcasts I should be subscribing to?
  • Climb the stairs at work. Again now I don't have a pregnant wife traveling with me there is no reason I can't climb the 6 flights of stairs instead of getting the lift!
  • Don't become a baby bore. I had things to say before Charlotte was born, and I know people don't want to hear about her all the time (even if she is really cute)!
  • Learn to play the bass guitar - I'm not sure I'll keep this one, but I've put it here as a kind of good intention!

So there we have it, lets see how I do. Podcasts I should subscribe to in the comments please!

Wednesday, January 02, 2008

GlobalSat DG-100 GPS Data Logger

Posted by Chris @ 9:22 PM

This Christmas I pulled the prefect present out of the bag for Mum and Dad, and so I thought I'd share my genius with you, my readers. Mum and Dad have got into walking lately, having joined a group that go on walks every few weeks. With this in mind I decided that one of those GPS thingys could be quite good. I wasn't so fussed about the navigation side of things, but more about tracking where they had been. Chris has got a Garmin GPS watch that he's used in the past when out running to track where he has been, distance and time etc. So, I started looking at those, but they turned out to be quite a bit over budget and had far too many features my Mum and Dad would never use. There were a few handheld GPS devices that were close to the budget I had in mind, but they didn't really have the functionality and connectivity I expected. Finally I found the Globalsat DG-100 GPS Data Logger on EasyDevices.co.uk.

This was exactly what I wanted, somthing that would just track where they had been, and allow them to get it onto the PC quickly and easily, and idiot proof to operate! A read of this review on GPS Passion and I decided to take the plunge and buy it, and all this without the hint of a suggestion from Mum and Dad, aren't I clever!

So, come Christmas day Mum and Dad opened it and were a bit stunned and confused! However, after a quick explanation they soon got it, and a few days later I got to show Dad how to use it. Whilst the software isn't the easiest for the beginner, a quick read of the manual gets you going. And so I'm pleased to report that Mum and Dad successfully took the tracker out on a walk the other day, downloaded the data, and uploaded it to mapmywalk.com. As you can see the walk was 8.41 miles in length around the village of Womersley. So well done Mum and Dad, and well done me for getting a great present! Another thing, GPS Visualizer is great for all manner of GPS data formats so if you're into this kind of thing take a look.

More photos and videos, and Happy New Year

Posted by Chris @ 7:14 PM

Happy New Year to you all, I have a funny feeling this year might be quite eventful!

Anyway there are yet more photos of Charlotte, mainly from our trip up to Carlisle, and a couple of videos where she is looking really cute.

For those interested Charlotte's jaundice has cleared up now and she has been fully discharged, as has Dawn from midwife care - we are now in the hands of the health visitor for the next 5 years! Not much more to report at the moment, she sleeps, eats, poos and wees, as does Charlotte ;o) We're managing to get a few hours sleep each night and only get woken up 2-3 times so we can't really complain, I'm sure other families have it much worse.

Right enough baby talk, Guitar Hero III is calling me....