# Thursday, 19 March 2009

Toronto Code Camp is happening again this year, and this year I will be there speaking. My session title wasn't deliberately chosen to show up first in the list of sessions, I promise. The talk is:

Boost Developer Productivity: Write Extensions to Visual Studio  
Visual Studio is a complex tool used by a wide variety of developers. Customizing your tool makes you more productive, and Visual Studio is highly extensible. In this demo-heavy session you will see how to write your own Code Snippets, how to write and use macros, how to write a simple add-in, and how to create your own templates for projects and project items, complete with wizards. Streamline development to fit your processes and habits by writing a little code to ensure that Visual Studio works the way you do.

I hope you already know the rules of Code Camp: all code, no fluff, and always free. Come on out and learn!


Thursday, 19 March 2009 17:53:46 (Eastern Standard Time, UTC-05:00)  #    Comments [0]
# Tuesday, 17 March 2009

Women in Leadership & Technology, a subgroup of IAMCP Canada held their first Canadian “Meet & Mingle” on March 9th. It was a networking opportunity for women in technology and leadership both inside and outside Microsoft. This was a nice opportunity to meet some new people for me and to talk about the issue that seems never to go away ... why do so few other women want to be in this business? Maxine Chung from itbusiness.ca was there too and has posted a slideshow (I am not in any of the pictures though) that includes a summary, plus a longer article. Check it out!


Tuesday, 17 March 2009 17:45:20 (Eastern Standard Time, UTC-05:00)  #    Comments [0]
# Sunday, 15 March 2009

Whenever a new OS or major application is released, there's a gap between when people want to start interacting with the functionality and when the .NET Framework supports that interaction. That's only natural - the framework release cycles aren't synced to the OS release cycles. This happened before with Vista, and is happening now with Windows 7. For Vista developers, the Vista Bridge provides easy access from managed code to the fun stuff like Restart and Recovery, Task Dialog, Power Awareness and so on. Stay tuned for announcements about a similar library for Windows 7. In the meantime some slightly more granular wrappers are available for you to use now, covering Taskbar, Libraries, Sensors, and Multi-Touch. Alon's blog has the details and the links.


Sunday, 15 March 2009 17:20:56 (Eastern Standard Time, UTC-05:00)  #    Comments [2]
# Friday, 13 March 2009

If you see the things that go around the internet that everyone's seen, then you've probably seen the list of things you should have seen by now, but maybe not? A neat way to see how many of the memes you've picked up. Me, I'm kind of an old fogey at this stuff, but there are a dozen or so here that I have indeed seen (thus saving me, I hope, from being a loser or old or something). Have you?


Friday, 13 March 2009 17:06:51 (Eastern Standard Time, UTC-05:00)  #    Comments [0]
# Wednesday, 11 March 2009

Most of the developers I know think of SQL Server Express as something you use while you're developing, if that's simpler than getting a full SQL onto your developer machine. They naturally assume that when you want to go into production, or if you want to use some of the higher-end features, you'll need to buy a license of SQL rather than deploying to SQL Express. Well, you may want to, but you may not have to. For example, you can use Reporting Services with SQL Express. That surprised me. The details on what sets Express apart are at http://www.microsoft.com/sqlserver/2008/en/us/editions-compare.aspx and http://www.microsoft.com/sqlserver/2008/en/us/editions.aspx. Worth a read for sure and SQL Express is a valid choice in many data situations where you need a free product, such as distributing with your own applications or for low volume, low budget projects.


Wednesday, 11 March 2009 17:03:13 (Eastern Standard Time, UTC-05:00)  #    Comments [0]
# Monday, 09 March 2009

Here is an interesting video featuring Kevlin Henney (a confident speaker I've seen at SD West before) discussing some philosphy around good and bad OO design. I don't agree with everything he's saying, but I sure am glad he's saying it. The examples are in Java but that will hardly kill you. Worth a watch.


Monday, 09 March 2009 16:50:05 (Eastern Standard Time, UTC-05:00)  #    Comments [0]
# Saturday, 07 March 2009

A lot of applications like to know what version of the operating system they are running on. Sometimes (especially older applications) it's so they can flat-out refuse to run if you're still on, say Windows 98. This is now frowned on, by the way, and if you want a Windows 7 logo you must not refuse to run based on a version check. Other times (and this is bad too) it's as part of some arcane roll-your-own strategy. For example someone I know planned to work out the default hard code paths for user documents (C:\Documents and Settings\ ... vs C:\users\... ) based on OS versions. This is insane! There's already a function you can call that will get you that path, and it works even if the user has changed it from the default.

But there are still legitimate reasons for version checking. If you're using Vista or Windows7 light-up features like the Task Dialog, Restart and Recovery, or Taskbar Jump Lists, you'd better make sure you're on an OS that supports those features. It's pretty easy from managed code: just call System.Environment.OSVersion.Version.Major and System.Environment.OSVersion.Version.Minor. From native code, GetVersionEx() does the same job. Then you have to do some comparing. That's where things can get weird.

For example, a huge incompatibility bucket for Vista was applications whose code checked that the version was exactly 5.1. If not, it would pop up a message box saying it only ran on XP SP2 or better. I've seen these apps in the wild and I just can't keep from laughing. The error message itself says "or better", and that was presumably the intent, but the code is checking for equality. The magic of >= fixes this "incompatibility" bug in the code, and often these applications don't need any other fixes to make them work on newer OS versions. (That's why the logo people frown on refusing to run. How can you know you won't work on a later OS that doesn't exist yet?)

Even if you grasp the magic of >=, comparing major and minor versions can bite you. Larry Osterman shows us this code:

// Example in C#.
internal bool SupportsTaskProgress() {
    if (System.Environment.OSVersion.Version.Major >= 6) {
        if (System.Environment.OSVersion.Version.Minor >= 1) {
            return true;
    return false;

He rightly points out it will return false if the version is 7.0, or 8.0, or any other .0 that's larger than 6. (Yes, Windows 7 returns 6.1 for the version #, that's a long story and well covered elsewhere.)

Version checking is hard. If you can, use a library that does it for you. Vista Bridge, for example, not only wraps up cool new OS features for easy access from managed code, it also does some checking to see if the feature is there for you or not. Don't reinvent wheels. Also, check for the feature rather than the OS if you can. Larry discusses this in his post for Taskbar features. Any feature you plan to use, you should know how to check for. I hope to post some more links and examples on this soon.



Saturday, 07 March 2009 10:45:31 (Eastern Standard Time, UTC-05:00)  #    Comments [0]
# Thursday, 05 March 2009

A quick glimpse of what you'll find if you search for C++ on the Tech Ed Sessions page:

I'm looking forward to it once again!


Thursday, 05 March 2009 14:52:05 (Eastern Standard Time, UTC-05:00)  #    Comments [1]