Archive for the ‘code’ Category

Making YouTube (very slightly) more child-safe with a Firefox extension

Tuesday, November 16th, 2010

Kids stuff on YouTubeOur six year old daughter, Grace, has lost interest in kids TV recently – she’s discovered the joys of YouTube!

She can happily spend a half-hour sat in front of the TV on Firefox (our TV set-up is a Linux-based media centre, so it’s proper Firefox with a keyboard and mouse) clicking from video to video.

I’m fine with this. It’s good: she’s getting more familiar with how to use a web browser, getting used to starting the browser, typing “youtube” into the address bar, using the search box to search for what she wants, using the ‘Back’ button to go back to the search results if it’s not what she wanted, and so on. This is all good stuff, let alone the fact that there is a lot of content on YouTube that is actually ideal for kids.

But…

Well, she’s six. Not every video on YouTube is suitable for her. I’m not just talking about the stuff for over-18s. I don’t even want her to come across stuff with, for example, more swearing and violence – such as stuff that you might be happy to show a 12 year old.

The real solution to this is what we do now – she’s doing this in the sitting room on the TV, while we’re in the room watching stuff with her. I’m not saying I want to give her a laptop, send her up to her room, and say “here’s YouTube – off you go, have fun!”.

Even so, I wanted something to help out a little.

(more…)

You need to ask if you want an Android to vibrate

Saturday, November 13th, 2010

I posted a few days ago about a new little app I stuck in the Android Market. An error report appeared from the app in the Market last night that I thought was interesting.

The app does some stuff in the background then when it’s finished, it sticks a notification in the top status bar. In my code, I just use the default notification settings – LED flash, vibrate, etc. And on every Android I’ve tested it on, it’s been fine.

But for one user, it caused the app to crash:

Exception class java.lang.SecurityException

Source method Parcel.readException()

java.lang.RuntimeException: An error occured while executing doInBackground()
at android.os.AsyncTask$3.done(AsyncTask.java:200)
at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:273)
at java.util.concurrent.FutureTask.setException(FutureTask.java:124)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:307)
at java.util.concurrent.FutureTask.run(FutureTask.java:137)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1068)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:561)
at java.lang.Thread.run(Thread.java:1102)
Caused by: java.lang.SecurityException: Requires VIBRATE permission
at android.os.Parcel.readException(Parcel.java:1247)
at android.os.Parcel.readException(Parcel.java:1235)
at android.app.INotificationManager$Stub$Proxy.enqueueNotificationWithTag(INotificationManager.java:368)
at android.app.NotificationManager.notify(NotificationManager.java:110)
at android.app.NotificationManager.notify(NotificationManager.java:90)
at com.dalelane.lovefilm.data.ImageProcessService.publishUpdateNotification(ImageProcessService.java:281)
at com.dalelane.lovefilm.data.ImageProcessService.access$0(ImageProcessService.java:234)
at com.dalelane.lovefilm.data.ImageProcessService$ImageProcesser.doInBackground(ImageProcessService.java:215)
at com.dalelane.lovefilm.data.ImageProcessService$ImageProcesser.doInBackground(ImageProcessService.java:1)
at android.os.AsyncTask$2.call(AsyncTask.java:185)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
... 4 more

(more…)

GaianDB – my talk at bathcamp 2010

Saturday, October 30th, 2010

Here are the slides I used for a talk on Gaian DB – a dynamic, distributed, federated database technology that we produced at work and have made available through IBM alphaWorks.

(more…)

Adjusting mobile web font-sizes to fit screen resolutions

Monday, August 9th, 2010

This might be obvious to someone less ignorant in the mystic ways of CSS, but I thought it was worth sharing anyway. 🙂

I was struggling to work out a suitable font-size for a mobile web page. Whether I tried using size names like “x-large”, or values with em, pt, px or %, the same basic problem remained:

CSS - not working

Font-sizes were either too small on smartphones with high-resolution screens, or too large on other smartphones.

If I increased the font-size to look better on a high-res screen, it was too big for other phones. If I decreased the font-size for those other phones, it looked tiny on a high-res screen.

(more…)

Making the RTM cow more sympathetic

Tuesday, June 15th, 2010

I am a big fan of Remember The Milk (RTM), the online to-do list manager. It’s one of the few sites (like flickr) that I’m happy to pay for.

For some reason, the logo for RTM is a cow’s face. Which means that I get a cow staring at me when I’m deciding what I need to do next.

I had a random thought this evening – that the cow should really look more sympathetic when my task list is so full. Because he’s really quite heartless, even when I’m manically busy. 😉

And once I had the idea, I kinda had to give it a quick try. (And I wonder why I’m busy…)

So I’ve knocked up a quick Greasemonkey script – which should work with Firefox with the Greasemonkey add-on, or with Google Chrome.

rememberthemilkcow.user.js

(more…)

How to generate a wave graph

Thursday, June 10th, 2010

TV watching - split by channel

I revisited the code behind my TV scrobbling this evening. When I first wrote it, I focused on graphs like bar graphs and pie charts.

Tonight, I tried out wave graphs. In this post, I want to share some of the results of my first attempt, and how I wrote the script to generate them.

I have created wave graphs showing my TV watching over the last five months. I’ve tried splitting it out by in a couple of ways:

Programme titles tend to be too long to make for a very useful graph, and there were way too many of them. But I’ve tried limiting them to the top 10 watched programmes to make for a prettier graph. The channels graph seems to work okay, though.

TV watching - split by channel

To generate the graphs, I wrote a Python script using the awesome graphication graphing library by Andrew Godwin.

(more…)

My Google Latitude History as a heat map

Friday, May 28th, 2010

Update (8 May 2011): I revisited this a year later to make a version that you can try online with your own Latitude data
Update (15 Jan 2012): A fixed version of the code to handle the new Google Latitude file format.


Google Latitude is starting to get very interesting. The new dashboard lets you see some graphs of how much time you spend at work, home, and out and about, and a list of your most visited places.

You can also see a Google Map with your 500 latest updates added as pushpins.

I had a random idea while looking at it this evening – why don’t they let you see all your updates on a map, in a heatmap that shows where you’ve been?

Naturally, once I had the idea, I had to give it a quick try.

This is the result:


View Larger Map

From the Google Latitude dashboard, you can export your history of location updates as a KML file. I downloaded my history, and wrote a short, hacky Python script to parse it, and generate a heat map to overlay on a Google map.

In this post, I’ll show the sorts of results it can generate, and share my script, in case any other Latitude users fancy giving it a go.

(more…)

Getting free routing data for the UK

Saturday, May 8th, 2010

I wrote this week about my new Android app, which checks for road traffic problems affecting UK routes. I mentioned that it wasn’t ready for release yet, because there are a few admin issues that I need to sort.

One of the problems is in how I get the routing data.

The app relies on comparing the locations of traffic problems with the user’s route.

Getting the location of traffic problems isn’t too hard as there are feeds from the Highways Agency and the BBC that offer that.

But getting a detailed description of a route between two places, in a format that I can use to compare against the traffic problems, proved harder.

(more…)