Scott Hanselman

Naming a File a Reserved Name in the Windows Vista Operating System

April 6, '07 Comments [7] Posted in Musings | Programming
Sponsored By

Ah, the Compatibility Sins of the Father. Does anyone else think it's a hoot that you can't have a file called lpt1.png on your system? Or a folder called con?

There's a old story about the .NET CLR team - before they took over an entire Top-Level-Domain as their name, thereby effectively thwarting my own .ORG world domination strategy - where they wanted to call the successor to COM and COM++, "COM3."

Apparently it didn't take long for them to realize that this was a sub-optimal name. Probably about this long:

C:\Users\Scott>md com3
The directory name is invalid.

I'm still not clear, however, why this would be a problem in Vista. It's no doubt "compassionate conservative compatibilityism" (my new phrase of the day) on the part of Microsoft.

Of course, it's because the underlying Win32 APIs for opening a file STILL will accept "COM1" as a file name, as in:

portHandle = CreateFile("COM1",
                  EFileAttributes.Device | EFileAttributes.Overlapped, IntPtr.Zero);

There's even a special way in Windows to refer to Serial Ports larger than COM9 in your code, like this -\\.\COM10.

You see, they only choose to oppress us 9 times, for COM1 to COM9. From then on, we can live footloose and fancy-free.

C:\Users\Scott>md com9
The directory name is invalid.

C:\Users\Scott>md com10

C:\Users\Scott>dir com10
Volume in drive C is 70 GIGS SYSTEM
Volume Serial Number is 98A2-64B2

Directory of C:\Users\Scott\com10

From MSDN:

Do not use the following reserved device names for the name of a file: CON, PRN, AUX, NUL, COM1, COM2, COM3, COM4, COM5, COM6, COM7, COM8, COM9, LPT1, LPT2, LPT3, LPT4, LPT5, LPT6, LPT7, LPT8, and LPT9. Also avoid these names followed by an extension, for example, NUL.tx7.

CLOCK$ is also a reserved device name.

Good times.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

Are Blog URLs important?

April 6, '07 Comments [16] Posted in ASP.NET | Musings
Sponsored By

I had an interesting e-conversation with Rob Howard and Scott Watermasysk today. I had noticed recently that a number of blogs I'd visited had things like _2D00_  and similar codes in their URLs. There was a forum post a while back (July of 2006) that asked about things like hyphens getting encoded in some builds of CS2.1.

There were a bunch of posts on that had URLs like: .../2006/09/07/Startup-doesn_2700_t-always-mean-venture-capital... where the 2700 was a single quote or .../2006/09/05/Should-tags-be-moderated_3F00_... where 3F00 was a "?". The non-latin characters in these cases were being encoded in the URL with their Unicode Code Point. This was a bug in a beta of CS that was quickly fixed, but it got me thinking about URLs in blog engines and more generally. These particular URLs and their untidiness really irked me.

Different Ways to Get to the Same Place

Personally I like URLs that use Pascal Casing, like the one for this post, for example, is:

Although URLs are technically supposed to be case sensitive, and you used to see that a lot when URLs belied the underlying case -sensitivity of the file system, they aren't in our case. The only thing that would make it better, IMHO, is the removal of the .aspx extension. More on that later.

Years ago DasBlog had really lame URLs and Jeff Atwood picked on us. ;) These urls live on in some comments pages within DasBlog in some cases, unfortunately.

We started using the blog title to general the URL. This, of course, has problems when you change a title after a pile of folks link to the original URL, but unless you want the engine to keep track of every title a post has ever had and 301 to the "final URL," you've got a nasty problem. Anyway...

There's a number of options in DasBlog that affect your URLs, although DasBlog canonicalizes URLs internally and will always accept any of these formats without breaking your URLs. That is, you can change your URLs scheme and you won't be penalized.

There's options to use a + for a space, as well as including the date, so any of these are potentially valid:

Is One URL Format more Search Engine Friendly?

A number of folks have said they preferred hyphens over pluses, specifically that it helps Google. Rob mentioned during our email discussion:

The hyphens, however, are something you guys should investigate using for DasBlog. Search engines actually look at the URL for keywords. The hyphen is considered a word-break indicator, i.e. HelloWorld to Google appears as "HelloWorld" whereas Hello-World is "Hello" and "World". The underscore is also considered a word-break, but given less points.

I'm wasn't sure about this, and initially was skeptical, but it he's right - mostly. However, it seems to matter less and less, as Google seems to have added some smarts.

If you Google for "happybirthdaytomiiwiireview" all-one-word, you'll get my post on the Nintendo Wii with the URL highlighted. You'll also get that post if you Google for "Happy Birthday to Mii" as a list of words, or as a phrase with surrounding quotes because it also happens to be the title.

ASIDE: Oddly, if you Google for the phrase with hyphens (which is odd, in itself) as in happy-birthday-to-mii you'll get less results than if you do it with quotes. Not that there's any reason to do that.

Notice in the screenshot below how the word "Mii" appears bold in the URL. Not in the title, in the URL. That implies to me that Google either cares about casing, in this case the Pascal Casing of my blog's URL, or that it picked "Mii" up as a fragment and really cares about fragments of things in URLs.

Let's see which it is. If we search for "Happy Birthday to Mi" with just one i in "Mii" - where "Mi" is a fragment of "Mii" - we don't see my post anywhere at all, which implies, to me at least, that Pascal Casing in a Blog Post is likely as effective from Google's perspective in delimiting spaces as is a hyphen, so from a Search Engine Optimization (SEO) perspective, hyphens versus Pascal Casing versus whatever is pretty much a moo point.

Not moot, rather, "moo" like a cow's opinion. It just doesn't matter. It's moo.

So, pick the URL style that makes you feel good, I say.

Many Options for URLs

Scott Water has used ISAPI_Rewrite to completely remove the .aspx extension from his site, and he has nice clean URLs like He also has nice "hackable" URLs like which is pretty sweet. You too can remove the .ASPX extension from your ASP.NET site using ISAPI_Rewrite.

Here's some example URL styles I've seen out there in Blog Land:

  • Subtext .../blog/archive/2007/02/11/Subtext_v1.9.4_quotWindwardquot_Edition_Released.aspx
  • CS with ISAPI_Rewrite .../blog/archive/twitter-for-windows/
  • Typo - .../articles/2007/03/27/microsoft-technical-summit
  • DasBlog .../weblog/StringFormattingFun.aspx
  • DasBlog with Dates - .../2007/03/27/Abschlussbericht+Zum+NET+Wintercamp+2007.aspx
  • Radio Userland .../2007/04/05/itsNotTheCoverOfRollingSto.html
  • MovableType - .../blog/archives/000093.html
  • Blogger - .../2007/04/mulan.html
  • Drupal - .../node/133257
  • Blogware - .../blog/_archives/2006/8/18/2242665.html

Yes, there's 1,000 blogging engines out there, each with its own URL style, and yes, this is not an exhaustive list.

The Trailing Slash in a/an URL and removing Technology from your URL

Note that in ScottWater's case, the URLs are lower-case and include the trailing /.

There's a lot of controversy about the Trailing Slash. I've always felt that the trailing slash implied we were visiting a directory, while no slash implied we were visiting a page. Simon Willison seems to advocate for the trailing slash as in his comment at

Personally, I like the trailing slash only for the home page of this blog and set it up that way earlier this year. At least I picked one, as these things matter.

What I'd really like to do is remove the Technology from my URLs. I could remove the .aspx extension from my blog's URLs by:

  • Making it output Permalink URLs with out .aspx
  • Adding a ISAPI_Rewrite rule to add the .aspx before the request gets to ASP.NET
  • Add some magic dust in ASP.NET 1.1 or A Form Control Adapter in ASP.NET 2.0 to change the HTML FORM Action in the case of a Post Back.

Of course, I'd need to do this without invalidating all the existing permalinks out there. The idea being that once you've put a permalink out there, it's out there. Forever. Only Feed Readers and Search Bots will respect a 301 and update their record of those links. All that static HTML out there cares not about your pretty URLs.

It's probably too late for me, Dear Reader, but perhaps not for you and your URLs. Pick a scheme and be excited about it, for these are religious issues that will never be solved.


I don't think ScottWater will mind me quoting him directly from a private email, in this case, to end this blog post:

What I meant is that if the goal is SEO, nice URLs are well…nice, but there are way better things you can do, such as writing relevant content. - Scott Watermasysk

It's true! I should stop now.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

Dance Dance Revolution and the need for Alternate Human Computer Interaction

April 5, '07 Comments [8] Posted in
Sponsored By

Z and I went over to my buddy John's yesterday to borrow his XBox360 copy of Dance Dance Revolution. I've been avoiding this game for nearly ten years. Partially because I can actually dance in real life (my wife can attest to this, and as she's an African, it's high praise, let me tell you) and DDR doesn't seem like dancing to me, but also because I know I'd get too into it.

But, John talked me into it and I talked my wife, begrudgingly, into playing it once. We didn't stop until 30 songs later. To quote my wife, "I won't stop until I get an 'A'!" She did, on Rapper's Delight, by the way.

I think that we took to this game for the same reason we took to the Wii - it's so physically interactive. After twenty years of twitch-gaming with a controller and my thumbs, and fifteen years of typing for a living, the last thing I want to do is come home and use a controller.

What so funny to me about Dance Dance Revolution to me is that it's just another version of Simon - a frenetic real-time psycho game of Simon set to house music while dancing with much gnashing of teeth - but Simon nonetheless.

Really immersive gaming (computing) requires one of two things. Either...

...a controller that mirrors something in reality...

Guitar Hero, another game I played at John's (loan that to me also, John!), is basically the same thing - it's Dance Dance Revolution with a fret. Addictive, surely, and I'm sure the wife will get a kick out of it, but it's a little too close to typing for these hands.

The original Xbox had an amazing (and VERY expensive) game called Steel Battalion that included a custom controller with over 40 buttons. It was brilliant. We played it at work (at lunch) for months. It was the most immersive gaming experience I'd had short of going to an arcade and getting into one of those $100K flight simulators. Of course, the controller was $200 - as much as an Xbox.

We've got to break out of this Mouse and Keyboard rut we're in as a culture (this includes you Quake and Unreal Tournament folks who insist a mouse and keyboard is the Only Way to Play - you're not helping!) and move into the Minority Report Multi-Touch Interaction world that folks like Jeff Han are pioneering.

...or intuiting intent via hand gestures

Now, $30k for something like Jeff Han's solution is (currently) untenable, but surely with all these Web Cams along with the brilliance of folks like Ashish and his Gesture Recognition stuff or the amazing uMouse stuff that Larry Lart (seriously, rush over there, now and read what he's doing) is working on (Hopefully I'll get a review of his stuff and he'll get a download link up soon. He said it'll be in beta the next week or so.) should give us some reliable moving of windows using our hands.

I figure it can't be that hard to watch a hand with a webcam, and that combined with the fact that there's only so many windows at a time on the screen - that lowers/narrows the number of things you'd want to do. Fine control of the mouse via gestures is a start, but a REALLY compelling solution would augment the mouse by using the web cam to track your hands and allow the push windows from monitor to monitor in a multimon scenario, minimize windows, launch Google, etc.

Certainly we could make it even easier by putting things on our hands (video of Atlas Gloves and Google Earth) and making the functionality very specialized.

Frankly I'm surprised that BillG would put so much work into Voice Recognition and Tablet but miss out on the opportunity to revolutionize User eXperience via a simple webcam. I don't need my webcam or computer to tell me if I'm sad - I'd like it to recognize my intent and act on it.

There's lots of Alternative Pointing Devices to choose from, but they all fall into the same tired metaphors. As mice go, personally I really like the Evoluent Vertical Mouse (it doesn't turn your hand unnaturally) and I also have Tablets for all my computers. I love my Ergodex, but I don't use it for coding like I used to.  I'm convinced that gestures are the next big thing - and no, I don't mean mouse gestures. It's a huge shame that the Fingerworks guys went out of business. Their pad was brilliant. I know Rory is a huge fan of their iGesture pad. It was just too expensive. All these mechanisms are tired shadows of what a good gesture system could do.

Making cheap webcams recognize our hand gestures - even if I have to point the camera at my hand on the mouse - has huge potential. This is a 100% solvable software problem.

Of course, the real tragedy in all this? I'll never dance (or, "Dance Dance" rather) as well as this five-year-old.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

Programmers, keep your wits about you and Code Mindfully

April 3, '07 Comments [19] Posted in Programming
Sponsored By

I was talking with Patrick Cauldwell the other day about what makes a "Good Developer." We talked about a number of different characteristics.

My intent was to write up a list of good personality characteristics that describe effective programmers, but Patrick said, "The real problem with most developers is that they don't keep their wits about themselves."

This was like a slap in the face to me. I realized when I was going through the Programmer Phases of Grief that I hadn't kept my wits about me.

You ever have the very frightening experience when you're driving along, perhaps lost in thought, and next thing you know, you've driven two miles and you don't remember the driving process that got you there?

Many of us who've been programming for a long time, or folks who are very gifted and take get from A to C while skipping B, can have these fugue states while programming. I don't literally mean that one blacks out while coding, but rather one goes "running down a one-way dead-end street." A lot of time is wasted before we realize that some original assumption was wrong.

I think one can be a more effective programmer if they can avoid not-thinking. Call it Mindful Coding if you will. The act of actually thinking while writing code is challenging, especially when your mind is jumping to the next idea or if you're writing code you've written a dozen times before.

Sometimes I'll catch myself asking a question of someone around here, and halfway though the question I'll realize that I haven't really THOUGHT about the problem space. For me, and my learning style, this might involve explaining it to someone (often my wife, who nods in all the right places, but cares not about such things) or drawing a picture.

For many, analytical thinking isn't a passive thing. Often just making the decision to "sleep on it" can be all that's needed to break through a hard problem.

"If you can keep your wits about you while all others are losing theirs, and blaming you. . . . The world will be yours and everything in it, what's more, you'll be a man, my son." - Rudyard Kipling

So, I say, programmers, keep your wits about you. Code Mindfully. I vow to try harder.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

Hanselminutes on Channel 9 - Video #2

April 3, '07 Comments [0] Posted in Musings | Podcast | TechEd
Sponsored By

It's Video #2 in the Hanselminutes on 9 series.

Rory and I did a few videos together a while back to promote TechEd 2005. (Baby Carrots, Designing Software) They kind of worked, but were perhaps a bit forced. We thought they'd be cool at the time because when Rory and I hang out and just riff, we're a hoot. A hoot and a half, even. So, the Rawdawg got the idea for he and I to wander around Microsoft's Building 42 (Developer Division or "DevDiv") and simply pop in to folks offices and ask them "What are you working on?"

For me, I wanted to get back into the "Roots of Channel 9" - raw discussions, preferably with folks who know what they are talking about.

Here's video #2 in our travels through Building 42 on the Microsoft Campus. We didn't plan anything, nor did we warn folks we were coming.

In this short video, we interviewed Vance Morrison, an Architect on the .NET Runtime Team, specializing in performance issues with the runtime or managed code in general.

We actually stopped and bothered Vance because he had a trebuchet on his desk that we saw through the window. We had to stop.

Vance does some pretty amazing stuff around Managed Code Optimization. Take a look at the micro-optimizations around typeof() calls over at his blog. Vance is a busy guy so this video is only six minutes long. 

The first video in this series is still over here: Hanselminutes on 9 - #1.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.