May, 2009

  • The Old New Thing

    When advanced users outsmart themselves: The device removal notification icon


    A customer submitted a suggestion to the user interface team about the device removal notification icon.

    The device removal notification icon is far too hard to use. When I click on it, I get a menu that says Safely Remove Hardware, and when I click on that menu item, I get a dialog box that lists all the removable devices, with vague names like USB Mass Storage Device and propeller-beanie details like Connected on Port 0006, Hub 0004. When I click the Display device components check box, I'm presented with a tree view of hardware devices that only a geek could love.

    This is far too complicated. When I click on the device removal notification icon, I expected to get a simple menu that listed the devices that could be removed in an easy-to-identify manner, such as USB Mass Storage Device on Drive E:. Please consider making this improvement in the next version of Windows.

    Um, actually, that menu you are describing is already there, on the left click menu. Because, according to the traditional rules for notification icons (and the device removal icon was written back in Windows 95, when the traditional rules were operative), left clicking gives you the simple menu and right clicking gives you the advanced menu. This customer was so accustomed to right-clicking on notification icons that the idea of left-clicking never even occurred to him.

    When I tell this story to other advanced users, I often get the same reaction: "What? You can left-click on that thing and it does something different from right clicking? Dude, why didn't anybody tell me this? I've been doing it the hard way all this time!"

    I find this story interesting for a few reasons. First, it shows that differentiating the left click from the right click on notification icons as a way to determine whether to show the simple menu or the advanced menu is now obsolete. Just show the same menu for either click, because users (and these are advanced users, mind you, not just novices) don't even realize that a left click and a right click are different operations at all! And second, it highlights the ineffectiveness of having an Expert mode. These were all advanced users. If there were an Expert setting, they would have set it. And then they not only would have found themselves having to micro-manage the process of removing hardware devices, but also would have asked for a feature that was the same as restoring the novice UI.

    Update: Remember, this is part three of a series. Don't forget to read the other two parts.

  • The Old New Thing

    How do I get a window back on the screen when it moved far, far away?


    Commenter Aggravated notes that some programs remember their location when the window is closed and restore to that location when the window is reopened, even if that position is off the screen. These programs clearly were using screen coordinates instead of workspace coordinates to save and restore the window.

    Okay, so you've got a program that restored its window position incorrectly and ended up putting it off the screen. Now what do you do?

    The keyboard interface comes to the rescue.

    Switch to the application, say by clicking on its taskbar button or by Alt+Tab'ing to it. Then type Alt+Space to call up the System menu: You should get a window floating at the edge of the screen. Type M to select Move, then press an arrow key to enter Move mode. (Doesn't matter which.)

    At this point, you could stick with the keyboard motif and hold down the appropriate arrow key to move the window back onto the screen. Or you can pull a little magic trick: Wave the mouse around. Boom, the window leaps to the mouse like one of those cheapo magic tricks where something leaps into your hand.

    I'm like 95% sure they use string. But it could be magic. No, I'm going with the string.

  • The Old New Thing

    First, try reading the error message: Episode 1


    Quite some time ago, a customer had forgotten that they were using an evaluation edition of Windows, and they were awakened one morning with the following error message:

    The evaluation period for this installation of Windows has expired. This system will shut down in 1 hour. To restore access to this installation of Windows, please upgrade this installation using a licensed distribution of this product.

    The customer submitted an urgent request for assistance. "Please advise how we can get this machine working again. We need it to run a demo for a major client later this week."

    In the customer's panic, they forgot to read the actual error message, which tells them what they need to do:

    To restore access to this installation of Windows, please upgrade this installation using a licensed distribution of this product.

    In other words, get a non-evaluation edition of Windows and perform an upgrade install. (Kick it off as soon as you finish booting up so you don't get the rug yanked out from under you if you dawdle and take more than an hour to get through setup.) This will preserve all your existing data while upgrading it from an evaluation edition to the real thing.

    Pre-emptive snarky comment: "The existence of evaluation editions with expiration dates proves that Microsoft is evil."

  • The Old New Thing

    Writing a sort comparison function, redux


    Prerequisites: Experience with sort functions such as qsort.

    Overqualifications: Familiarity with sort algorithms.

    If you break the rules for sort comparison functions, then don't expect the result of a sort call to be meaningful. In fact, if you really mess it up, you can corrupt memory or go into an infinite loop.

    My program hangs when I used this sort comparison function (pseudocode):

    int compare(x, y)
     return x >y ? +1 : -1;

    What's even more strange is that sometimes instead of hanging, the program crashes. It all works correctly if I add one line:

    int compare2(x, y)
     if (x == y) return 0; // added
     return x >y ? +1 : -1;

    What's going on? The array I am sorting contains no duplicate elements, so the two items x and y should never be equal.

    First of all, your first comparison function clearly violates the requirements for being a comparison function: It must return zero if the two items compare equal. As a result, the behavior is undefined, and hanging, crashing, or returning an incorrect result are all legitimate behavior.

    But let's dig a little deeper to see why hanging and crashing are plausible responses to an invalid sort comparison function.

    A common sorting algorithm is quicksort. I'll leave you to go off and learn on your own how the quicksort algorithm works. Come back when you're done.

    Okay, welcome back. The central step in quicksort is the partition, and some variants of the quicksort algorithm rely on the partition element comparing equal to itself in order to remove a comparison from the inner loop. For example, an index may walk through the array looking for an element greater than or equal to the partition, fully expecting at least one such element to be found because in the worst case, it will find the partition itself. But if your comparison function fails to report the partition as equal to itself, this search may run off the end of the array and eventually crash with an access violation when it reaches invalid memory.

    That explains the crash, but what about the hang? Well, notice that the comparison function is also inconsistent. In particular, the anti-symmetry rule is violated: compare(x, y) and compare(y, x) return the same value (as opposed to the opposite value) if x==y. The function returns -1 both times, saying "x is less than y" and "y is less than x" simultaneously. This inconsistency can easily send a sort algorithm running back and forth trying to find the right place for the partition.

    The moral of the story is the same: Your comparison function must meet the criteria for a proper comparison function. If you fail to do this, then the results you get will be very strange indeed.

  • The Old New Thing

    The social skills of a thermonuclear device: Why did you hang up?


    One morning I'm working in my office and I'm interrupted by a telephone call. The caller-ID shows that it came in through the switchboard. (I.e., somebody called the main Microsoft number and asked for me by name.)

    Me: Hello?

    Caller: [angrily] Mr. Chen, why did you hang up?

    I don't recognize the voice, and I haven't received a phone call in several days, so I have no idea who this person is or what he's talking about. But if somebody starts out rude to me, that doesn't put me in the friendliest of moods. Still, I use a polite tone of voice.

    Me: Oh, I'm sorry. I'll do it again. [click]

    A few minutes later, my phone rang again. The caller-ID shows that it is once again a call from the switchboard. I let it go to voice mail.

    Shortly thereafter, I received a notification that I have a new voicemail message. Here's a transcript:

    [swearing in a language I don't recognize] Why do you keep hanging up on me? I asked you, are you Raymond Chen, and then I talk to you, and you hang up. Are you stupid or something? [click]

    Now I kind of feel bad that the caller probably got the wrong person. There are at least four people at Microsoft who share my name (or a name very similar to it).

  • The Old New Thing

    Chicken chicken chicken chicken


    Chicken chicken chicken chicken. [pdf]

    Chicken: Chicken chicken chicken.

  • The Old New Thing

    Signs that your new building was originally designed for another purpose: Rest rooms


    There's always a settling-in period when you move offices, learning where things are, like the rest room, the kitchen, the printer room, the cafeteria, the locker room, your boss...

    My new office is conveniently close to the rest room. Actually, this building is laid out kind of weird. There are two sets of rest rooms within a short distance of each other, on opposite sides of a stairwell. You can wave hello from one to the other and have a conversation. My office is nearly halfway between them. But I can use only one of them.

    On the south side, there are two rest rooms, a men's room and a women's room. On the north side, there is a women's rest room and a storage closet.

    Clearly the people who originally commissioned this building were not a tech company with a sterotypical gender balance.

    Bonus rest room imbalance: There is a men's room on the upper floor near some conference rooms. It has no urinals, only stalls. This was clearly a former women's room that merely has a new sign on the door. Whenever I use it, I have this brief moment of panic when it appears that I went into the wrong rest room by mistake.

    Double bonus rest room quirk: There is a rest room just off a large gathering area. It is a unisex rest room which serves only one person at a time, and it is huge—maybe two thirds the size of an office. Last year, a friend of mine flew up to Redmond to interview with Microsoft. (It was for a group I have no connection to, so there's no conflict of interest, thanks for asking.) Her inbound flight was delayed, so she arrived at Microsoft campus with only a half hour to spare before her first interview. I took her to the luxury rest room, which gave her plenty of space to change from her travel clothes to her interview clothes, freshen up, and make it to her first interview.

  • The Old New Thing

    Windows Vista User Experience Guidelines is online and downloadable


    Get it before it's obsolete. The Windows Vista User Experience Guidelines document is available in PDF format.

  • The Old New Thing

    Parents billed when kids miss school: Pay for play


    The Scotts Valley school system is asking parents to compensate the district when they take their kids out of school to go on vacation. Adds a new wrinkle to the phrase "pay for play".

    I remember the days when we were taught the difference between the things you must do (obligations, responsibilities) and the things you want to do.

  • The Old New Thing

    You can tell which people listed blogging as a performance review goal


    I had been kind of baffled by some of the Microsoft employee blogs that appear to consist almost entirely of rehashes of Knowledge Base articles, or sometimes even just "A new Knowledge Base article on topic X has been published." Now, that's useful information to have if you're interested in topic X, but is it really something you can build a blog around? Can't you just sign up for KB notifications manually? (That's probably how the blog author found them anyway.) And then there are the head-scratcher blog entries like There are no new KB articles this week.

    But I never really thought too much about them. They merely registered as noise to me. Baffling noise, but still noise.

    And then I learned why these types of blogs exist: Because somebody put down blogging as a goal on their annual performance review. If you want to say that one of your goals for the next year is to maintain a blog, you have to specify how to determine whether that goal was met. As I've noted earlier, Microsoft is obsessed with measurement, so the way to tell whether your blog was a "success" is to come up with some sort of metric for success. These people naturally chose Number of blog postings per month as their metric. Running behind this month? No problem, just crank out a few Hey, here's a Knowledge Base article you might be interested in postings and you've filled your quota.

    This is another example how deciding how you're going to measure something affects the people you're measuring: They alter their behavior to maximize the metric rather than the concept the metric is supposed to be tracking. If you decide that you want to expand the Knowledge Base and set numeric goals for employees on how many Knowledge Base articles they should write each year, don't be surprised if you find that in the waning weeks of the year, there's a spurt of largely useless Knowledge Base articles.

    In an internal discussion of this topic, I wrote, "Blogging to improve your review score is like entering politics to get rich." While it may be true that politicians tend to get rich, and many people enter politics in order to get rich (or more legally, enter politics in order to exit politics in order to get rich), I believe that getting rich shouldn't be the motivation for entering politics. And improving your review score shouldn't be the motivation for blogging.

Page 1 of 3 (29 items) 123