I Hate Windows, Pt. 1 (An On-Going Series)

Perhaps this is true for all platforms, but it seems especially true for Microsoft Windows development: because of the number of tricks, code oddities and places where the way things work is completely unclear, it seems that Windows programming experience is measured not so much by length of time, but by the number of battle scars you accumulate fighting some odd little API call or another. You know the feeling: you read MSDN, you make the call you think should work, you’ve got all of the resources in the right place–yet, instead of success you get a null handle or some obscure error code you’ve never heard of.

So off you go to Google, type in the error code–and find about fifty messages in about fifty different sites all saying the same thing: “WTF?” Occassionally suggestions are made–which are about as worthwhile as shaking voodoo sticks and sacrificing chickens to Odin and Thor. Then, finally, you either try shaking your own voodoo sticks or you come across one brief flicker of light amongst the darkness of ignorance–and you discover finally what when wrong. Sometimes it’s an unclear API, or sometimes it’s some odd exception to an existing API that, had you actually had the time to read the entire MSDN article on the subject rather than just skim it looking for the information you need, you would have known about.

Feeling silly and wondering why you didn’t take your mother’s advice to become an Architect, you move on. And another scar hardens on your brain.

I Hate Windows.

As I encounter them, I’ll try to post them here. And I have one that I recently encountered at work with WinCE, though it appears to also apply to the desktop version of Windows.

Where did my help go?

If you press ‘F1’ on your keyboard on Windows, you should get context-sensitive help for your application.

This little bit of magic works by the Windows OS sending your current WinProc an WM_HELP message, which you can then respond to by opening up the on-line help manual to the page which describes the dialog box or window you’re currently working in.

All well and good.

Well, I was converting a bunch of dialog boxes into a tabbed dialog box by using the PropertySheet() call in Microsoft Windows, which worked fairly well.

Except help stopped working.

Scratching my head I discovered that when you live as a property sheet, the callback for your pane looks very much like a DialogProc that you’d pass to DialogBox or some other call like that. Except all of a sudden many messages that have a perfectly valid WM_XXX counterpart–such as WM_HELP–get turned into WM_NOTIFY messages instead.

So, gratuetously, instead of sending you WM_HELP when someone asks for help, you instead get a WM_NOTIFY message with notification code PSN_HELP.

As I was adding the following switch statement to my code:

    case WM_NOTIFY:
    {
        NMHDR *ppsn = (NMHDR *)lParam;
        if (ppsn->code == PSN_HELP) {
            ::SendMessage(hWnd,WM_HELP,0,0);
        } // other notification handlers go here...
    }

I had to wonder–why didn’t Microsoft do this for me? Something perverse? Historic reasons? I dunno, and I suspect resending the message as a WM_HELP message rather than just processing it there at the SendMessage call would be better.

But I wasted a good hour on this one.

Installing MediaWiki on a LunarPages Account

So just a moment ago I managed to install MediaWiki, the software project which drives Wikipedia, on a LunarPages based web site (this one). It turned out to be fairly straight forward. Here’s what I did:

(1) Downloaded MediaWiki v1.6.8. (Newer version require a newer version of PHP, and the version currently running on the LunarPages servers is 4.4.)
(2) Unpacked and copied the entire MediaWiki folder (mediawiki-1.6.8) into the public_html directory. Renamed the folder to ‘wiki’.
(3) Using the MySQL account maintanance page, created a new database (username_wiki1) and a new MySQL user (username_wiki1), and added the new user to the new database, giving the new user full permissions over the database.
(4) Loaded the Wiki site (chaosinmotion.com/wiki), then followed the directions. Because the database is already created in step 3, you don’t need to have root permissions or anything like that.
(5) Follow the rest of the directions, such as moving the LocalSettings.php file to the wiki directory.

I think MediaWiki looks a lot better than the phpWiki software that comes with LunarPages.

Now I just need to copy the content from the old site, and I should be up and running.

Howdy y’all!

This is the next incarnation of the Chaos In Motion site, a web site I first started putting together on the theory I was going to go off and start my own company. Then I found a job at Symantec, and turned this web site into a Wiki. Well, the Wiki is still here (just as soon as I get around to uploading the files), but I find the more time I spend reading other people’s development blogs, the more I find I want to add to the conversation.

Hello, world!

Me; I’m a software developer and have been for the past 20 years. I have a passion for good user interface design and good design in general, and have written software for a variety of platforms, from MacOS X to the original Macintosh, Microsoft Windows, Linux, various flavors of Linux, embedded development (both for WinCE and other platforms, and also way back when “embedded” meant you had to know the processor’s start vector and debugging was as much about ocilloscopes and flashing EEPROMs), and goodness knows what. Nowadays I spend most of my professional life in C++, my personal life tinkering with Java, and wishing I had more time to play with Objective C.

But who cares about that? Over the next few days I hope to post a few comments about stuff I’ve encountered while writing code, including some quirks in Java, some oddities in WinCE, and why the BMW iDrive is incredibly annoying.