December, 2008

  • The Old New Thing

    Being lucky may be a matter of observing things you weren't planning to observe


    On BBC's The One Show, presenter Michael Mosley tests a theory of Professor Richard Wiseman that part of being lucky is simply being more aware of incidental information in your surroundings, information seemingly unrelated to the task at hand but which may ultimately help you achieve your goal.

    (Professor Wiseman has many interesting videos on YouTube. I particularly like the colour-changing card trick. (Spoiler: I noticed only one of the changes myself. What I found fascinating was that he made no effort to hide the sound of the backdrop changing, because he knew nobody would notice.)

    We've seen manifestations of this phenomenon earlier, such as learning about what is ordinary so you can recognize things that are out of the ordinary, or people who ignore the answer that's right in front of them even after it's pointed out to them.

  • The Old New Thing

    The Washington 2008 unclaimed property auction


    After five years, the contents of abandoned safe deposit boxes are turned over to the state, which attempts to contact the owners, but if the owners cannot be located after three years, they are put up for auction. Things like this antique watch with a Swedish dedication: "Till min kära syster Nanny fr. Elin — Mors klocka" = "To my dear sister Nanny, from Elin — Mom's watch". It's sad that something with such obvious sentimental value is being sold off.

    Or, if you are more of the nerdy type, you could bid on Star Trek comic books graphic novels or a Michael Jordan rookie trading card.

  • The Old New Thing

    Don't use global state to manage a local problem


    We've seen a few instances where people have used a global setting to solve a local problem. For example, people who use the LockWindowUpdate function to prevent a window from redrawing, toggle a global setting to see what its value is, or who change the system time zone as part of an internal calculation. To this, I'll add as an example a program which figures that if you don't want the program's feature, you don't want that feature in any competing products either.

    The first service pack of Windows XP introduced the Set Program Access and Defaults control panel. Among other things, media players can register here to allow users to choose them as the default media player, to enable access to the media player, or to remove access. The guidelines for the use of this control panel recommend that in response to the Remove access command, media players should remove their user interface entry points (such as shortcuts on the Start menu and notification icons), disable their autoplay feature, and generally act as if they weren't there.

    One media player decided that if the user instructed it to remove its access points and disable its autoplay, it would dutifully remove its user interface entry points, and it would also go into the configuration manager and disable media insertion detection on the CD drive. "If you don't want me to autoplay your CDs, then fine, and I'll make sure nobody else can autoplay your CDs either." They also disabled autorun, a related but separate feature.

    This program addresses a local problem (disable autoplay for Program X) by applying a global solution (disable all media insertion detection). Whether media insertion detection is enabled or disabled, and which programs should be notified when it occurs, is the decision of the computer user. Programs should not be altering hardware configuration unless the user specifically requested it. The correct thing for Program X to do is to remove its autoplay registration, leaving intact the behavior of other programs.

    It turns out that Program X was not disabling media insertion detection out of spite. The people responsible for Program X simply followed the description literally without understanding the big picture. "The documentation says that we should disable our autoplay feature. Well, I guess if we disable media insertion detection, that'll disable our autoplay feature."

    I wonder if their uninstaller reformats the hard drive.

    Moral of the story: Don't use global state to manage a local problem.

  • The Old New Thing

    A bar on Microsoft main campus? What should we call it?


    When my colleagues discovered that Seattle bar Spitfire is opening a bar on the main Microsoft campus, a quick game of Name that bar sprung up. (Todd Bishop has his suggestions.)

    Here are some names we came up with:

    Though I suspect they'll just call it Spitfire.

    Sidebar: Although alcohol is available at many company-sponsored social events, there is no pressure to drink an alcoholic beverage, and people don't even notice one way or the other. (Just like nobody notices that you had the vegetarian appetizers and avoided the meat ones.)

  • The Old New Thing

    How do I change the directory Windows uses for user profiles?


    To change the directory Windows uses for user profiles (by default, the \Users directory), set the ProfilesDirectory setting in your unattend file.

    This setting is available only via the unattend file. There is no GUI interface for this, nor can it be changed after Windows has been installed. Sorry.

  • The Old New Thing

    The role of vitamin D in beta cell function: The dance


    In January 2008, John Bohannon held a contest titled Dance your PhD, wherein contestants were invited to express their PhD thesis in five minutes through the medium of dance. It was such a hit that it came back for a sequel: The 2009 Dance Your Ph.D. contest.

    Only a Game interviews John Bohannon [mp3]. You can also watch the winning dance, The role of vitamin D in beta cell function on YouTube, along with the other winners.

  • The Old New Thing

    Email tip: If you want people to look at a screen shot, you have to tell them what they're looking at


    Some time ago, Ry Jones decided to take something that I wrote and condense it to make it funnier:

    Don't embed pictures. ... This isn't Highlights magazine.

    Those ellipses are deceptive, because they hide a change of topic! As a result, the two unrelated sentences appeared to be connected to each other.

    The comment about Highlights magazine was not a response to "Don't embed pictures." It was a response to a different part of that message. Here's the complete message, or an approximation thereof:

    Don't embed pictures. Send a link to your pictures. And when you ask us to look at the pictures which demonstrate the change in in behavior you're talking about, you have to tell us what change we're looking for. This isn't Highlights magazine.

    In the original message, the person included two screen shots. The question was something along the lines of, "The first screen shot shows the feature behaving correctly, and the second screen shot shows it behaving incorrectly. Can somebody explain why it isn't working?"

    The problem was that the two screen shots were practically identical. It wasn't obvious what the difference was between them. Now sure, to the person asking the question, the difference was as plain as the nose on your face, but to somebody who hasn't spent the last 48 hours of their life staring at this specific screen, the difference is a bit harder to pick out.

    One of the regular features of the children's magazine Highlights is a Can you spot the difference? puzzle in which two nearly identical pictures are presented to the reader, who is invited to find the difference between them.

    When you're sending screenshots please describe what part of the screenshot the reader should be focusing on. Or even better, circle it. Windows comes with a super-advanced bitmap editing tool to help you with that.

    Sometimes, the person asking the question doesn't even include the Before part of the puzzle. All that is provided is the After picture, with the question, "Can somebody explain why this changed?"

    Creating devious puzzles and challenging other people to solve them can be fun, but there is a time and place for puzzles. Asking somebody for help is not one of those times.

  • The Old New Thing

    A file can go by multiple names, but two files can't have the same name


    Thanks to short file names and hard links, a single file can go by multiple names. (And for the purpose of today's discussion, I'm treating the full path as the name instead of just the part after the last backslash. Don't make me bring back the nitpicker's corner.) For example, C:\PROGRA~1 and C:\Program Files are two possible names for the same directory thanks to short names. [Typo fixed 7:15am.] If you've created hard links, then you can give a single file two entirely unrelated names, and those names need not even be in the same directory.

    On the other hand, you can't have two files with the same name. What would that even mean? Which one would you get if you issue an Open call? How would you open the other one? Heck, even before we get to this point: How do you even create two files with the same name? If you call CreateFile to create the "second" file, it'll just open the existing one!

    That's why I am baffled by this question that asks:

    I've seen a few cases where people write their own version of GetLongPathName (usually because they need to support NT4) using FindFirstFile. Are there situations where that approach would return an incorrect path? Is it safe in practice because FindFirstFile("") always will return the exact match first before returning "foo.barbaz"?

    This question assumes that it's possible to have two files in a directory with the same name: One is the file ""; the other is the file that goes by the long name "foo.barbaz" and the short name "".

    I'm not sure what the sequence of events would be that could result in two files with the same name. Here's one scenario:

    1. Create file "foo.barbaz". It gets assigned the short name "".
    2. Create file "". This creates a new file called "" which conflicts with the short name of the existing file "foo.barbaz".

    Except that's not what'll happen. When you perform step 2, the attempt to create the file "" merely overwrites the existing file which has "" as one of its names. Result: A single file with long name "foo.barbaz" and short name "".

    Another scenario might go like this:

    1. Create file "".
    2. Create file "foo.barbaz". The file system auto-assigns the short name "".

    Except that's not what happens either. At the second step, the file system generates a short name like "" specifically to avoid the name collision.

    You can run these experiments yourself from the command line to confirm. The "dir /x" command will come in handy.

  • The Old New Thing

    Thrift stores drowning in Christmas impulse gifts from yesteryear


    Last year, the Washington Post covered the fates of The Thing, that Christmas impulse gift that stores place in enticing locations in the store to convince you that you simply gotta have it. The twirling apple peeler, the liquor carousel, the portable chocolate fountain (for your fancy party, no doubt).

    After a few years, some of them show up by the garbage-bagful at the Opportunity Shop thrift store. "We get three or four fondue sets a month... Sometimes we get stuff and I don't even know what the stuff is."

  • The Old New Thing

    Why are the generic version numbers called NTDDI?


    In my earlier discussion on the variety of symbols that describe the target Windows version, I pointed out that the NTDDI symbols attempt to cut through the mess and consolidate everything into a single symbol. But why the name NTDDI?

    One of my colleagues contacted me privately with the story. When setting out to change the operating system version number, my colleague was shocked to find so many different version number mechanisms were scattered throughout the various Windows header files. It so happened that the DDK people were already in the process of cleaning up the version number mess and were using NTDDI as their version number system. Seeing no reason to invent a new different system for user mode, my colleague proposed using the DDK system in the SDK and asked if anybody had any better ideas.

    Nobody came up with any better ideas, no compelling reason why we should have two different version number systems, so the NTDDI name stuck. And it stands for NT Device Driver Interface.

Page 3 of 4 (38 items) 1234