Archive for the ‘code’ Category

Turning C# programs into PowerShell scripts

Tuesday, April 17th, 2007

I mentioned PowerShell – the new Windows command shell and scripting language – last year when I first tried it out. But other than playing with it a little, I kind of put it to one side and forgot all about it.

Yesterday I picked it up again and started playing with it again – using it to develop functions for WebSphere MQ (accessing it through the .NET DLLs that come with WMQ). The idea was to start and produce something which expands on the command line administration tools that come with WMQ – adding features that perhaps we don’t already provide.

You can see a walkthrough of what I’ve come up with so far on a post I wrote for the Hursley WMQ blog, but I thought I’d quickly draw out some of the more interesting bits that I learnt in doing it.

(It’s worth pointing out that if you’ve come to this page from Google looking for PowerShell tips and best practice, that I’m very much a beginner. As I highlight in the WMQ post, this is the product of an evening’s playing around – pretty much just trial and error and seeing what tab-complete suggests. It seems to work, but whether it’s the best way to do it… dunno 🙂 )

(more…)

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! 🙂