Archive for the ‘code’ Category

Posting to Twitter… carefully

Thursday, November 13th, 2008

I’ve recently picked up my the code for my Windows Mobile Twitter client again.

It was originally written back in April as a hackday idea. The code posts Twitter updates using a variation on the twitter-from-curl approach of HTTP POSTing “status=MyTweet” to the twitter update url.

I started with the update URL, and appended the message I wanted to tweet. This is fine for a quick hackday demo, but it did mean that you could end up with a URL like:

http://twitter.com/statuses/update.xml?status=Hello (twitter) world! Special chars = a problem?

Which fails if you want to post characters such as accents or characters which have special meaning in URLs, like + ? / & etc.

I was encouraged by a number of users to have another look at this, which I’ve done now, and hopefully version 1.1 solves the problems.

A quick Google turned up that a number of other Twitter apps share at least some of the same problems that mine had, so thought I’d share the fix here.

(more…)

My HackDay hack – see where your friends are

Friday, October 24th, 2008

Today was IBM HackDay 6 – an internal HackDay run across IBM‘s many labs – and I managed to spend a bit of today hacking something together.

PhotobucketIn a nutshell, it’s kinda like Plazes, brightkite, dodgeball and others… find out where your friends currently are. And see where they are from your mobile.

The twist is that it gives you quite precise locations for friends within a known indoor campus – such as Hursley Park.

Hursley, like many IBM locations, is a campus, with thousands of employees in a 100 acre site.

What if you’re trying to find someone? Say you’re in a meeting, and a colleague hasn’t turned up yet. Where are they? Are they on their way?

Or you’ve arranged to meet a colleague for lunch or a coffee, and you seem to keep missing each other.

The idea of this hack was to build on the Hursley Maps tool to come up with some way for you to be able to quickly check where your friends are while you’re at work.

Okay… so it’s a fairly flimsy scenario. 🙂

But I’ve enjoyed playing with location-based services ideas before, and thought this would be an interesting twist. Plus, it was an excuse to play with Django which I’ve wanted to try since hearing about it at BathCamp.

(more…)

Comparing your CurrentCost data with others

Wednesday, October 1st, 2008

a Python CurrentCost appBetween holidays, meetings, work and other stuff, I put CurrentCost stuff to one side for a few weeks.

I’m back now, and thought I’d share my plans for the app. If nothing else, I figure it’s useful for me to refresh my memory and plan my next step!

(more…)

Programmatically accessing authenticated Google App Engine services

Friday, September 19th, 2008

This one has been bugging me for a few days, and with help from a very helpful Google engineer I’ve finally got this working, so I thought I’d share my code where the next poor soul to try and do it might find it!

The problem:
I’ve written a small web service which I am hosting on Google App Engine.

By adding “login: required” to specific services in the app’s app.yaml file, I can make sure that you need to login to access a service.

If you’re accessing the service from a web browser, this is fine – you get redirected to a Google login page, and after entering your username and password and hitting ‘submit’, you get sent on to the web service you wanted.

But how do you do that programmatically? I wanted to do it from a Python application on my desktop, without being able to navigate the HTML login form.

(more…)

What info would people want from CurrentCost?

Tuesday, September 9th, 2008

What info would people want from CurrentCost?

I’m playing with having one tab in the CurrentCost app show information in a non-graph way.

But I’m a little stumped for ideas.

Ignoring the styling for the moment, what would people be interested to see displayed?

CurrentCost app … take 2!

Saturday, August 30th, 2008

a Python CurrentCost appI’ve been talking about it for a while, but I finally got around to spending some time working on a CurrentCost app.

The original code was written in C# using .NET 3.5, and I used WPF (Windows Presentation Foundation) to draw the graphs. For a number of reasons this proved unpopular and I got a ton of emails saying how this was no good for them. So I decided to start again.

The new app is written in Python – using wxPython and matplotlib to create the graphs.

a Python CurrentCost appUsing py2exe, I’ve been able to compile the whole thing (combining my script with a Python interpreter and a copy of all of the third-party libraries I’ve used) into a Windows executable that will (hopefully!) run on any Windows computer, without needing installing or requiring any pre-requisites.

I can also make the Python script itself available, making it something that Linux users could run as well. This means I get the low-overhead Windows experience I wanted, together with the ability to make it cross-platform. Neat!

I’ve been able to produce some more interactive graphs – the graphs in the new app can be zoomed in and out, panned, moved around, printed, and exported to images. As the amount of data in the app builds up, I can see this becoming very useful.

(more…)

GPS Intermediate Driver for Windows Mobile (and getting it to work!)

Monday, August 25th, 2008

My last two Windows Mobile phones have both had GPS, so I’ve played with code to get my location from the GPS a few times. These have generally been quick hacked-together bits and pieces. In all of them, I wrote my own GPS code. I knew that the GPS device would be accessible through a serial port, so I just connected to the relevant COM port and started reading. It’s easy to parse – NMEA sentences are written with an update on each line, in comma-separated strings.

After sharing my OpenCellId client last week, I was encouraged to try rewriting the GPS code for it using the Windows Mobile GPS Intermediate Driver. So I had a quick try. I was vaguely aware of it before, but hadn’t taken a proper look. In this post, I’ll describe briefly what it is, it’s benefits over home-grown hacks such as my own, and share a couple of things that I had to do to get it to work.

(more…)

OpenCellId for Windows Mobile

Tuesday, August 19th, 2008

I talked about this yesterday, but it’s ready for sharing now.

screenshotWhat is this?
It’s a OpenCellID client for Windows Mobile

What does that mean?
It uses the GPS device connected to a Windows Mobile device (either internal or connected over Bluetooth) to identify exact latitude / longitude coordinates.

It combines this with the cell id of the GSM tower that your phone is currently communicating with.

These two measurements are uploaded to the database at OpenCellId.org

Why?
Because if enough people do this, then we will be able to build up a picture of where each GSM cell is.

Then people without GPS (either because their mobile devices don’t have GPS, or because their indoors) can work out where they are by looking up their current GSM cell in the OpenCellId database.

(more…)