Archive for the ‘code’ Category

Adding remote system admin support to PowerShell (before PowerShell V2)

Thursday, January 17th, 2008

Jeffrey Snover of Microsoft has written a very interesting post on PowerShell cmdlet development, prompted by the release of my latest updates to the WebSphere MQ PowerShell cmdlets.

By way of background, the cmdlets let you administer WebSphere MQ from the Windows PowerShell command prompt and scripting environment. One of WebSphere MQ’s biggest strengths is the breadth of it’s platform support, so it was no surprise that one of the most requested features to be added to the cmdlet library has been to be able to use PowerShell with WebSphere MQ queue managers on non-Windows servers.

(more…)

Displaying constant names (rather than values) in PowerShell cmdlets

Wednesday, November 21st, 2007

I’ve mentioned before that I’m working on some PowerShell cmdlets for WebSphere MQ. I thought I’d pass on a few tips that I picked up this week on improving the usability of the information displayed by Get- cmdlets in PowerShell.

The easiest way to explain it is to demonstrate with an example:

(more…)

New file and directory open and save dialogs for Windows Mobile

Tuesday, November 20th, 2007

Windows Mobile – like standard Windows – has a default “file open” and a “file save” dialog that all applications can use. If you’re writing an app, you can use it in your code with just a few lines. Great!

Except… no. Because they’re rubbish.

This has come up as an issue raised with a couple of apps that I’ve written that use the standard dialogs. I would defend my apps by saying that I didn’t write the dialogs, and that they’re the same that you get in other Windows Mobile apps like Microsoft Word Mobile. But I can’t, really. For a user, this is just an excuse. Wherever the dialog came from, it is rubbish.

I’ve written a couple of new ones for use in my applications. They’re fairly small, so I’ve made them available if anyone else wants to use them with their apps.

In this post, I’ll quickly outline what is wrong with the standard dialogs, and introduce my new ones.

(more…)

Registering file extensions with Windows Mobile apps

Tuesday, November 20th, 2007

I took a break from playing with the Android SDK for the first time tonight by making a quick update to my Windows Mobile notepad app.

Previously, to open files I’ve had to launch the notepad, then use File -> Open and choose my file. I wanted to register the .txt file extension with the notepad app, so that I can open files in the notepad by clicking on them. It’s a fairly straightforward thing to do, but I thought it might be helpful to share.

I couldn’t find much information about it, but it’s fairly simple to work out if you use Visual Studio’s Remote Registry Editor to see how other apps do it.

(more…)

Shortest app yet – Windows Mobile reset

Tuesday, October 23rd, 2007

I have to reset my Windows Mobile PDAs depressingly often. Both the HTC Universal and Advantage seem to need resetting every other day or so.

This has one big problem. You can lose stuff if you’re not careful. From Windows Mobile 5 onwards, a lot of data is kept in memory for performance reasons – written to persistent storage periodically. If you reset before this has been done, you can lose the most recent data.

For example, if I get a text message, then reset the phone, that text message will almost certainly be lost.

The trick is, if you need to do a reset you switch the phone off, leave it for 20 seconds then reset it. Normally, after being idle for a bit the phone will write pending data to storage.

This is a bit unscientific, so (after losing stuff from Outlook again today) I looked for a software way to ensure recent stuff is saved.

(more…)

A PowerShell command you should avoid

Tuesday, October 23rd, 2007

While I was writing my presentation on PowerShell, I did one spectacularly dumb thing which I thought might be fun to share.

I was doing some screen-captures for use in slides, to show how you can stop a process.

What I meant to type was:

Get-Process notepad | Stop-Process

Get me all of the notepad processes, and pipe them to Stop-Process which will stop them.

But stuck deep in PowerPoint slide-producing-hell, my fingers ran quicker than my brain and what I actually typed was:

Get-Process | Stop-Process

Crap.

Fancy taking a guess what that did?

(more…)

An introduction to mobile development on Windows Mobile

Tuesday, October 23rd, 2007

Another day, another HackDay presentation. This one is a little more lightweight than yesterday (a breakneck crash course through learning how to use and extend PowerShell).

It’s basically a beginner’s guide to mobile development – some scene-setting and a few walkthroughs how to do “Hello World”-type stuff with the key Windows Mobile libraries.

Hopefullly will be interesting to someone!

I guess I’ll know in about an hour 🙂

An introduction to Windows PowerShell

Monday, October 22nd, 2007

Later today, I’m giving a presentation on Windows PowerShell as a part of the lead-up to this year’s internal IBM HackDay.

It’ll be good to address some of the misunderstandings I had about PowerShell when I wrote about it before. In the presentation, I will be giving an introduction to Windows PowerShell – what is it, and how it works.

I’ll also be talking about how you can extend it to provide support for administering your own product or project (which is where the HackDay element comes in – hopefully to encourage some PowerShell projects!).

Impatient people can get a sneak peek at my slides here…

(more…)