Archive for the ‘code’ Category

Getting the currently selected text from Pocket Internet Explorer

Saturday, October 6th, 2007

As part of my hack for mobileCampLondon, I wanted to get the current selection from the web browser on my Windows Mobile phone.

The plan was to add a new menu item to Pocket Internet Explorer that lets you search for the text you’ve selected in Google. So I needed to get the currently selected text in order to include it in a Google search page URL. I thought it’d be simple, but it turned out to be more of a hassle than I expected.

My final approach is more of a hack than I’d have liked, so in this post, I’ll outline my unsuccessful approaches before showing what I finally ended up doing.

(more…)

Process your emails – an Outlook plugin

Thursday, September 13th, 2007

I got a nice email last week from someone asking why I never made the “triage” Outlook plugin I mentioned last year available as I have with other bits of code. The short answer was obviously because I never got round to finishing it! 🙂

However, the idea feels a bit more topical at the moment so I think it is worth revisiting.

The aim was to create something that would let me process my emails in Outlook Mobile (the cut-down version of Outlook you get on Windows Mobile PDAs and smartphones).

“Processing”, rather than doing emails is an idea that I hear people mention more often since Merlin Mann’s brilliant Inbox Zero talk started doing the rounds as a Google video. I’m even hearing other people use it as a phrase from time to time! I used to call it “triaging” my email, but I think “processing” is actually a better term. Either way, the idea is that I want to be able to go through my inbox as quickly as possible – doing something with each one so that I can finish up with an empty inbox.

Inbox ZeroIt doesn’t mean doing everything right away – just putting the information in it’s right place. If it’s an email asking me to do something, the right place for the email is in my Task List, not my Inbox. If it’s an email telling me about a meeting or appointment, then the right place for the email is in my Calendar. If it’s an email containing information that I need to keep for future reference, then the right place for it is in my wiki.

Mobile phones seem like an ideal tool for processing email, as it’s something that you can do when you have a few spare minutes and without having to do a lot of text entry or other input. Rather rely on manual (and slow!) copy-and-pasting, I wanted Outlook Mobile to be able to move my emails around like this for me. This was the idea of the plugin…

If you are interested in the pain of writing MAPI plugins in C++, read on. If you are… erm… normal – then the short version is that I tidied up the code and made it available.

(more…)

Writing PowerShell cmdlets

Wednesday, September 5th, 2007

After a conversation with someone at IBM last week about PowerShell, I picked it up again and have been having a play. I’ve been trying to write my own cmdlets, which has been an interesting experience – so I thought I’d jot down a few quick notes about what it’s been like.

First… a quick recap. Windows PowerShell is a command-line shell for system administrators. It has a number of neat features, but perhaps the most obvious is it’s object oriented approach – letting you pass objects (rather than strings) between commands in a pipe. I’ve done some work on writing PowerShell scripts before, but this time I approached it more as a developer – looking at how to extend the shell with new commands.

The .NET nature of PowerShell means you can run any .NET API at the Shell. In fact, this is what I did when I first played with PowerShell using the WebSphere MQ .NET API. It’s a quick way to get started without having to learn much about PowerShell – and I played around writing some simple scripts that were a translation of C# programs into the PowerShell syntax.

But it wasn’t really using PowerShell in the PowerShell way. What I have tried doing over the last couple of evenings is to extend PowerShell to include new commands that support WebSphere MQ administration work. I’ve been writing Cmdlets.

(If you’re not too interested in the detail of the whys or the hows of creating cmdlets but you are interested in WebSphere MQ, you might want to skip to the end of this post to see examples of what I’ve done in action…)

(more…)

TinyURL plugin for Windows Mobile

Tuesday, August 7th, 2007

I was surprised by the reaction to my del.icio.us plugin for Pocket Internet Explorer – between my blog post and the download page, I got something like 70 links and over 1,000 downloads in a couple of weeks. Wow.

If I’d known so many people would read it, I might not have made the blog post quite so moany 🙂

I got emails asking for versions of the plugin for their own favourite web service, but had to leave it for a bit because something else came up. Now I’m back, I thought I’d give one a go.

I’ve started with my next most used web service: TinyURL.

If you’re not familiar with it, TinyURL turns long web addresses into shorter, easy to share ones. It’s particularly useful when you’re trying to cram a link into a 140 character twitter update!

And – similarly to del.icio.us – using it on the Windows Mobile web browser is fiddly and long-winded. So here is a plugin for Pocket Internet Explorer to help.

It adds an entry to the Pocket Internet Explorer menu that gets a TinyURL for the webpage you are looking at, copying it to your clipboard so you can paste it into an SMS, email, tweet, IM message etc.

As always, anyone is welcome to give it a go – and any feedback would be gratefully received. It should run on any Windows Mobile 5/6 device, shouldn’t need any pre-reqs, and you can download it for Pocket PC (touchscreen) or Smartphone.

Read on if you are interested in a bit more ramble about how it works. 🙂

(more…)

Why doesn’t Windows Mobile have a mobile Notepad?

Saturday, August 4th, 2007

I’ve been relying on my PDA quite a bit while I’ve been travelling, and it’s frustrating when you have a file that you can’t open. MS Word on Windows Mobile is an okay text editor, but it’ll only open files with extensions like .doc .rtf .txt and so on.

I don’t want anything fancy – just the ability to view and make minor edits to text files! If I get emailed a file with an obscure extension, want to make a quick tweak to a settings or config file, view the source of something like a webpage, or anything like this, I’m basically stuck. You can’t click on them – you just get an error message that no application is associated with them. You can’t change the file extension to something MS Word will open because the Windows Mobile file explorer hides file extensions (you can rename files but not change their extensions).

My Internet access is a little limited at the moment so I’ve not had a chance to search if this has been done already – I figured it’d be easier to throw together my own version. It’s basically a TextBox control with File-Open and File-Save dialogs bolted on the front. It only took about 20 mins to write, and (as I’ve already got .NET Compact Framework 2) it’s very lightweight.

If anyone else thinks they might find it useful, you’re very welcome to give it a try. If anyone has any recommendations for lightweight Windows Mobile text editors, it’d be interesting to hear what people like.

A del.icio.us plugin for Windows Mobile (or C++ is a pain)

Wednesday, July 18th, 2007

screenshotIncreasingly, I’m doing more of my (non-work) web browsing on my PDA.

And as a big fan of using del.icio.us to store and share interesting sites that I come across, I’ve missed the tools you can get for desktop browsers (like Internet Explorer or Firefox) that let you throw your current page at your del.icio.us list.

If you’ve not used them before, the idea is to have a popup window that gets prefilled with the URL and name of the page you are looking at in your browser, lets you add a few tags, then submit it to del.icio.us when you hit ‘Save’.

So I thought I’d have a go at creating something similar for Pocket Internet Explorer – the browser you get with Windows Mobile.

To cut a long story short, I’ve put something together and it seems to work. If you have a Windows Mobile PDA and fancy giving it a try, feel free to give it a go.

(more…)

Do GPS units spit out wacky coordinates?

Monday, July 9th, 2007

I’ve mentioned before that I wrote some simple code to access the GPS device in my phone and upload the coordinates to a Google Maps mashup.

This is what it was showing when I got home yesterday evening:

google map showing me somewhere in Kazakhstan

Either my minibus driving was more eventful than I remember and I took a quick detour via Kazakhstan, or there are still a couple of problems with the code…

(more…)

Programming with Microsoft Money

Thursday, June 21st, 2007

I’ve used Microsoft Money for years – ever since I started using MS Money 97 at Uni. I can’t imagine how I’d keep on top of finances without it.

The tricky bit is having to enter transactions into the software every time you buy something – something which lends itself perfectly to a mobile solution. Rather than waiting until you next get to your computer, enter the transaction immediately by jotting a quick note on your mobile.

I bought a copy of Spb Finance. It’s almost perfect…. except that the syncing between PDA and PC sucks*. I’ve tried everything to get it to work – including working with the support guys at Spb, collecting trace and log files for them and multiple re-installs in different configurations. No joy – syncing is still unreliable, has corrupted my Money file a few times, and even when it works it has a habit of chewing up all remaining CPU cycles on the computer, making my ThinkPad run scarily hot.

So I thought I’d have a go at writing something for myself.

(more…)