Archive for the ‘code’ Category

RE: Where am I?

Friday, April 13th, 2007

I mentioned yesterday that I never got round to writing the bit of code for my location service client which would look for known wi-fi access points.

To recap, the idea is that my phone should be able to look for the access points within range, comparing the SSIDs against a list of known locations. If a match is found, it looks up the name and GPS coordinates of the location from the known store, and uses an HTTP request to send the update to the server.

It was really easy – the interesting bit of the code looks like this…

(more…)

Where am I?

Thursday, April 12th, 2007

I first come across Plazes a few months ago. The idea is pretty neat – you update a service to let people know where you are.

I’m not a big fan of the implementation though. It’s too tied to using the network you’re connected to to identify where you are – which means it can’t seem to tell the difference between any IBM site in Europe. And as I spend the majority of my time connected to an IBM network, that leaves Plazes thinking that I’m somewhere in Germany half the time. Not very impressive.

It has an API which is always a good thing, but that won’t let you create any new ‘Plaze’ which it doesn’t already know about. Which makes it a little useless for many circumstances.

And it relies on me being at my laptop. This is a bit limiting as I don’t always have my laptop with me. What would be really cool would be a service which actually updates where I am. (Okay, so they have a mobile client, but that’s for Symbian only so that’s no use to me 🙂 )

With this in mind (and my newly rediscovered love for PHP after having to do some work on the SYA database on Tuesday), tonight I decided to have a go at knocking together a solution that would better suit my needs…

(more…)

I miss pine

Friday, March 2nd, 2007

Does anyone still use ‘pine’? We used to use it at my University, and I loved it.

For those who’ve not come across it before, Pine is a very nifty text-based email client. And (as I seem to be going through a nostalgic love for all things command-line based at the moment), I miss it.

With that in mind, for no reason in particular other than that my mind was wandering in a particularly boring meeting, I thought of creating a pine-inspired email client for myself. A bit like pine, but more task-oriented to fit in with my GTD approach to personal organisation.

(more…)

Getting Command Shell working on Windows Mobile 5

Tuesday, February 27th, 2007

Microsoft provide a command shell for Windows Mobile as a part of their Developer Power Tools package.

I fancied giving it a try tonight (for no particular reason other than that I like using the command line, and my phone has a full QWERTY keyboard) so followed the instructions to install it.

No luck – it didn’t work. No errors, it just didn’t work – nothing happened.

It took a bit of playing around with, but I’ve managed to get it running…

(more…)

Accessing Pocket Outlook email programmatically

Tuesday, February 6th, 2007

screenshotI mentioned ages ago about a little extension I wrote for my phone that lets me dump the contents of an email that I receive into any other bit of Pocket Outlook – turning an email about an event into a Calendar item, or an email asking me to do something into a Task item – with a single click.

I recently noticed a problem with it, and finally got around to looking into it tonight. The problem was that sometimes the body of the email wouldn’t make it to the new Calendar or Task item. Everything else, like the subject and the sender’s name would be fine, but the body of the new item would be blank.

(more…)

Making the interface that works best for you

Thursday, January 18th, 2007

I’ve mentioned several times before how easy Visual Studio makes it to knock up mobile applications. This is one of my favourite aspects of Windows Mobile. Why put up with an interface that doesn’t work for you? If you’ve got a spare hour, make a customized interface that gets your phone to work in way that suits you better. You can create a new interface (a ‘form’) without knowing any code – just drag-and-drop to put buttons, pictures and text where you want them. Then fill in the empty methods to get the buttons to do stuff – most of the core applications expose an API that let you drive them from your own forms.

In this post, I’ll go through an example – what I didn’t like about the WM interface, why it didn’t work well for me, and how I hacked together a new interface this evening.

(more…)

Calling the Windows Mobile emulator

Wednesday, January 10th, 2007

This is apparently an old tip, but was new to me so thought it was worth posting:

…you can make phone calls or send SMS messaages to yourself in the [Windows Mobile SDK] emulator. The phone number for the emulator is “+14250010001”. This is really handy for testing SMS interception or how your apps responds to an incoming phone call, etc. Just send an SMS to +14250010001…

…It’s also a great way to freak your buddy out who’s working on the emulator and doesn’t know about this feature.

Write a little app that will place a call to the emulator with a time delay before it places the call, deploy it when he’s not looking and start it. Wait your prescribed timeout and watch as he tentatively answers the call from his emulator 🙂

from Windows Mobile Team Blog

Cool! 🙂

Strings in C can span multiple lines

Tuesday, December 19th, 2006

I came across a multi-line string while doing an inspection on a colleagues C code. I’ve never seen this sort of thing before, and didn’t know it was possible.

Something like this:


    char* welcomeMessage = "Hello "
                           "Dale. "
                           "How are you?";

    printf("%s", welcomeMessage);

will happily print out “Hello Dale. How are you?”.

It seems that you can define a string literal in C across multiple lines, without any need for a concatenation character (like ‘+’ in Java and C#).

I like that, even though I’ve been writing C for years now, I still occasionally come across little bits and pieces in the language that are new to me. And doing code inspections and reviews of other people’s code are a good way to share this sort of stuff and learn from each other.