Friday 23 December 2005

This much laughing hurts

I don’t often end up laughing hysterically at musical instruments!

In today’s feeds, an article from the Annals of Improbable Research blog linked to a Mr. Jay C. Easton, who plays the saxophone. Well, not just the saxophone, since there are many different types. Many more than the traditional four.

Including this monster.

There are some very smart saxophone makers out there, and the sound is actually pretty good. Well, except for the very lowest notes. I’m sure you can guess what they sound like, but there are plenty of clips on Easton’s site and Mr Eppelsheim’s. Another player, Fred Bayer, has had his Tubax modified to play much higher notes too (click on Tubax under Music in the navigation frame – a direct link takes you to the German language site).

Thursday 22 December 2005

Revisiting .NET CF Whinges

18 months ago, I wrote an article called “.NET CF whinging”. Now that Compact Framework 2.0 has been released, what’s been fixed?

  • I complained that only DrawLine was available, not DrawLines (which maps better to the underlying Polyline call). In .NET CF 2.0, you can now use DrawLines.
  • Previously, you could only create a one-pixel-wide pen. Now you can create pens of any width.
  • The System.Diagnostics.Process class has been added.
  • WaitHandle.WaitOne now offers a timeout overload. WaitAny is still missing.
  • Thread.Abort and Thread.Join are now present.
  • Control.InvokeRequired makes an appearance, and the Control.Invoke overload that takes an array of object parameters to pass to the delegate is now present. However, the documentation still contains a note that for .NET Compact Framework, you must use the EventHandler delegate, which only offers an empty EventArgs. This appears to be a documentation error – passing other delegate types and parameters does now work! The new BackgroundWorker class of the desktop Framework is not offered.

Rumour has it that the marshalling’s better in this version too.

HOWTO: Program Symbol MC3000 function keys

With my powers of intuition, I divine that someone out there needs to handle or program the function keys on the Symbol MC3000 device.

(Well, OK, it turned up in my referrer log – click the tracker icon at the bottom of the right-hand bar!)

The 28–key variant has F1 through F10 available through pressing the blue Func button and then the corresponding number key. The 38–key variant has F1 through F10 keys, then F11 through F14 on Func+F1 to Func+F4. The 48–key variant has F1 to F13 on Func+A to Func+M. (Nothing like consistency). When pressed, these will appear as VK_F1 through VK_F14 in your application’s WM_KEYDOWN and WM_KEYUP handlers or their equivalent in your environment (Control.KeyDown and Control.KeyUp events in the .NET Compact Framework, the value of KeyEventArgs.KeyCode will be Key.F1 through Key.F14).

That’s the default keyboard map. If you want to change the keyboard map, on any Symbol device, you need the Device Configuration Package for that device, which you can download from Symbol DevZone. In the package, you’ll find under Tools\kbtool a bunch of C++ files and a VC6 project. This is a program for your desktop computer which generates the keyboard map files. Open this with VC6 or later.

Each keyboard layout has (up to) three files associated with it – for the MC3000, MC3000KeynnM, R and S.cpp, where nn is the number of keys. The M file controls the multiple-press key operations, such as the mobile-phone-style input on the 28–key variant. The R file controls remapping key functions in different shift states. Finally the S file controls the scan code that’s output by each key – this is normally the one you want to edit. The available scan codes can be found in the accompanying ScanCode.h file.

Running the program generates the files that the keyboard driver is looking for. For the MC3000 these are named MC3000–{28,38,48}.{sct,rmt,mmt}. You can either overwrite these files in their normal location (\Platform\Keyboard) or modify the registry under HKLM\Hardware\DeviceMap\KEYBD to point to your version of the files.

We did this for New Look to make the two keys below the screen – with the red and green surrounds – perform ‘soft key’ functions in their applications.

Tuesday 20 December 2005

Do I look old to you?

I met up with some of the people from Channel 9 last Saturday – Dave Oliver, Barry Dorrans, Sarah Blow and Richard Peat (and his lovely wife Beth, who I don’t think has her own blog). Richard’s already written it up here.

Separately, Dave and Barry both told me that I looked older than my tender years (ahem) of 27, and suggested that I get rid of my beard. Barry also reckoned the ponytail should go (can’t remember what Dave thought but he did admit he’d had one when younger!)

For comparison:

Passport Photo

What I looked like in 1998, the last photo I have to hand of me with short hair and no beard (digital snapshot of my passport photo!)

2004

What I looked like last year (taken at my friend’s wedding in Toppenish, WA, USA).

The length of hair and beard varies. I was short-haired and clean-shaven at my graduation ceremony in 2001 and frankly I thought I still looked a bit too young in the photo (and very pale!) I’ve been letting the hair grow pretty much since then and it now just reaches the small of my back. I trim my beard every few weeks, normally when it starts itching too much – it’s quite short right now as you can see in Richard’s picture from Saturday where we’re attempting to play Barry’s card game Fluxx while waiting for food and/or Ian to arrive.

So, should I follow their advice?

Can the Windows Vista Network Map Control Panel detect a non-functioning switch?

Adam Nathan blogged today about some new features in the Windows Vista December CTP. One of them is a new Control Panel applet: Network Map.

Network Map applet

At work we commonly have problems with our switched network fabric. Sometimes after a power failure (a regrettably common occurrence at our location) the cheap 5-port switches at each desk will give all the signs of working, but not actually forward network frames – quite literally, “the lights are on, but no-one’s home.” Only power-cycling them gets them working again. Unfortunately there are chains of these in some places before reaching one of the wall sockets which connects to the main switch.

We also have a problem where, if one particular machine is switched on and connected, the entire LAN seems to go nuts, intermittently or permanently causing some routes to fail, unpredictably. We think this is due to the switches’ internal mapping of MAC addresses to ports somehow becoming incorrect, and forwarding packets to the wrong ports, or not at all. This is a mystery to all of us, especially since we’ve replaced the network card with a different model, tried it with different operating systems, tried it on a different wall socket, and repatched the wall socket/main switch connection. Nothing helps! If you have any ideas, leave a comment!

If this Network Map can tell you which device seems to be malfunctioning, that would be a serious boost to network administrators everywhere.

Monday 19 December 2005

Idiotic things to do

Look on Flickr for your own photos, from the machine you uploaded them from.

Doh!

Sunday 18 December 2005

The two-minute Xbox 360 and PGR3 review

I’m underwhelmed.

OK, that evaluation is based on playing a guy for one race on multiplayer on a demo pod yesterday. The shop was pretty loud and the console quiet, which made it not very involving. The rumble didn’t feel that great. The graphics are better than the current generation but actually not that much better than PGR2 – but I had a one foot view, not a ten foot view since the controllers are hard-attached to the pod. I think the screen was set up correctly but I don’t actually know.

We were lost in the game’s UI. Very lost. We ended up having a race with one computer car which zoomed off into the distance – and that was only on Medium skill. I lost – I kept crashing into the corners due to the lack of feedback from the game (audio and rumble), and lost when I crashed into the last corner on the last lap. I lost so badly that I didn’t even reach the finish line before the 30 second timer ran out after the computer car crossed the line (hence ending the game).

Maybe I should go back when it’s quieter and have a go at Career Mode.

Wednesday 14 December 2005

Coining a word

horricious (adj): Mind-numbingly awful. Descriptive of the speed of Microsoft’s first attempt at a ‘real’ Windows CE emulator.

A colleague asked if there was an emulator for one of Symbol’s hand-helds – a customer wanted to evaluate it with some software. While eVC 4.0 and VS.NET 2003 do ship an emulation platform, and Symbol supplies an emulator image for this platform, it is pretty slow. In describing this emulator to my colleague, I inadvertently coined this word. I’d just used ‘horrible’ and ‘horrendous’ and was searching for a third – lists of three, you know – and somehow got ‘horrific’ and ‘atrocious’ mangled together.

Oops.

The Pocket PC 2000 emulator, and earlier Windows CE emulators, ran weirdly compiled x86 code inside an app running on top of Windows. Stable it was not, and it didn’t emulate a CE device at all accurately. This made it completely unusable for actually developing apps.

The Pocket PC 2002 and later emulators were a little better. Now they were based on Connectix’ Virtual PC technology, which virtualises your PC’s processor and other resources (Microsoft bought out Connectix soon after). Unfortunately that’s still a virtualised x86, which is different from the actual Pocket PC 2002 devices, which use ARM processors. The result is that you had to do a special build for the emulator, meaning again that you’re not testing the same code you’re going to ship – and it was very hard to get libraries built for the emulator.

Windows CE on the x86 has always been a slug – Microsoft have never really taken it seriously as a platform, most hand-helds using MIPS or SH3 to begin with, then later ARM. Virtual PC wasn’t really designed to run Windows CE. Putting some form of Additions on the image would have been a) hard and b) defeated the object a little.

Visual Studio 2005 (at least, some editions) includes the Microsoft Device Emulator 1.0. This, finally, emulates an ARM processor. And you know what? It’s quicker than the virtualised x86! At last, it’s possible to use virtually a real OS image and real binaries in an emulated environment.

It’s still quite a bit slower than a real device though, even a 400MHz PXA255.

A rant on programming books

Matt Pietrek – he of the erstwhile MSDN Magazine column ‘Under The Hood’ – has an interesting post:

In a nut shell, there are a lot of books out there, and people are relying on them less and less as search engines become the dominant way to find information. It's pretty hard to pour massive amounts of work into something when you know most people just want the code snippet that gets them past their current problem. No actual learning required.

 ...and then they have no idea how the code works, so cannot adapt it to new requirements, or debug it when it doesn't work.

To me, a good tutorial is worth a thousand times a code snippet - although I do find that often MS Press books (at least, of a certain vintage) will print the entire source of a sample program which leads to the new stuff being lost among the boilerplate.

How new Windows programmers are supposed to learn what's going on when truly excellent books like Jeff Richter's "Programming Applications for Windows" go out of print I don't know. All abstractions leak, and I think you're better off understanding what leaks through the abstraction.

I only really ‘got’ MFC once I’d read “MFC Internals”, and understood the boilerplate that Visual Studio generates for a new MFC project.