March, 2009

  • The Old New Thing

    You can't globally reserve screen space; you can put up signs, but if somebody ignores the sign you'll have to decide how to respond

    • 41 Comments

    A customer sent the following question with the rather unhelpful subject line Need Help. They're not just looking for help; they're looking for Help with a capital H.

    We want to make something like an appbar, but without some of the limitations of appbars. For example, like an appbar, we want applications to avoid using the edge of the screen. The section of the screen the window appears on should be "mine"; nobody else should be permitted to use it. The window should always be on top; nothing should be able to cover it. For example, Internet Explorer in fullscreen (F11) mode should not cover our window; it should go behind.

    In other words, you want to create a window that is never covered by any other windows, not even other topmost windows. There are two groups fighting over the same thing. One of them will lose. That loser is you.

    Everquest/PowerPoint/Picasa/etc team: "I want to cover the screen."

    You: "I want to prevent programs from covering the screen."

    Everquest/PowerPoint/Picasa/etc team: "I want to cover the screen, even if there is a program that wants to prevent me from covering the screen."

    You: "I want to prevent programs from covering the screen, even if there is a program that is overriding my attempt to prevent them from covering the screen."

    Everquest/PowerPoint/Picasa/etc team: "I want to cover the screen, even if there is a program that wants to prevent me from overriding their attempt to prevent me from covering the whole screen."

    You: "Infinity!"

    Everquest/PowerPoint/Picasa/etc team: "Infinity plus one!"

    Creating an appbar says, "If you want to maximize your window, use the part of the screen that I'm not using." But if a program creates a window of size SM_CXVIRTUALSCREEN by SM_CYVIRTUALSCREEN, then it has done it and what are you going to do? You can't prevent them from doing it, but you can make your wishes known and respond intelligently when they choose to ignore you.

    You can build a sign that says "no trespassing" but that doesn't prevent people from trespassing. If somebody walks onto your property right past your "no trespassing" sign, then they have done it and now you have to decide what action you're going to take in response.

  • The Old New Thing

    Raymond's highly scientific predictions for the 2009 NCAA men's basketball tournament

    • 28 Comments

    Once again, it's time for Raymond to come up with an absurd, arbitrary criterion for filling out his NCAA bracket.

    This year, the criterion is the school's graduation rate for basketball players. Lower graduation rate wins. However, if the teams are seeded 11 or more positions apart, I'll give the win to the favorite (just to get rid of highly unlikely upsets).

    Update:

    • Correct predictions are in green.
    • Incorrect predictions are in red.
    • (!) marks upsets correctly predicted.
    • (*) marks upsets predicted but did not take place.
    • (x) marks actual upsets not predicted.

    Opening Round Game

    Alabama State(56%) Alabama State
    (56%)
    Morehead State(57%)

    Midwest bracket

    1Louisville(42%) Louisville
    (42%)
    Louisville
    (42%)
    Louisville
    (42%)
    USC
    (37%)
    16Alabama State(56%)
    8Ohio State(53%) Ohio State
    (53%) (x)
    9Siena(86%)
    5Utah(67%) Arizona
    (20%) (!)
    Arizona
    (20%)
    12Arizona(20%)
    4Wake Forest(100%) Cleveland State
    (71%) (!)
    13Cleveland State(71%)
    6West Virginia(41%) West Virginia
    (41%) (x)
    West Virginia
    (41%)
    USC
    (37%)
    11Dayton(89%)
    3Kansas(64%) Kansas
    (64%)
    14North Dakota State(N/A)
    7Boston College(70%) USC
    (37%) (!)
    USC
    (37%)
    10USC(37%)
    2Michigan State(60%) Michigan State
    (60%)
    15Robert Morris(100%)

    West bracket

    1Connecticut(33%) Connecticut
    (33%)
    Connecticut
    (33%)
    Connecticut
    (33%)
    Maryland
    (10%)
    16Chattanooga(34%)
    8BYU(91%) Texas A&M
    (47%) (!)
    9Texas A&M(47%)
    5Purdue(77%) Northern Iowa
    (67%) (x)
    Washington
    (50%)
    12Northern Iowa(67%)
    4Washington(50%) Washington
    (50%)
    13Mississippi State(53%)
    6Marquette(100%) Utah State*
    (100%) (*)
    Missouri
    (36%)
    Maryland
    (10%)
    11Utah State(100%)
    3Missouri(36%) Missouri
    (36%)
    14Cornell(N/A)
    7California(30%) Maryland
    (10%) (!)
    Maryland
    (10%) (*)
    10Maryland(10%)
    2Memphis(55%) Memphis
    (55%)
    15Cal St. Northridge(8%)

    East bracket

    1Pittsburgh(69%) Pittsburgh
    (69%)
    Tennessee
    (38%)
    Portland State
    (17%)
    Portland State
    (17%)
    16East Tennessee State(60%)
    8Oklahoma State(92%) Tennessee
    (38%) (x)
    9Tennessee(38%)
    5Florida State(100%) Wisconsin
    (86%) (!)
    Portland State
    (17%)
    12Wisconsin(86%)
    4Xavier(82%) Portland State
    (17%) (*)
    13Portland State(17%)
    6UCLA(46%) UCLA
    (46%)
    UCLA
    (46%) (*)
    Texas
    (31%)
    11VCU(53%)
    3Villanova(89%) Villanova
    (89%)
    14American(31%)
    7Texas(31%) Texas
    (31%)
    Texas
    (31%) (*)
    10Minnesota(36%)
    2Duke(89%) Duke
    (89%)
    15Binghamton(100%)

    South bracket

    1North Carolina(86%) North Carolina
    (86%)
    LSU
    (40%) (*)
    LSU
    (40%)
    Clemson
    (29%)
    16Radford(80%)
    8LSU(40%) LSU
    (40%)
    9Butler(92%)
    5Illinois(80%) Illinois
    (80%) (x)
    Akron
    (63%)
    12Western Kentucky(100%)
    4Gonzaga(67%) Akron
    (63%) (*)
    13Akron(63%)
    6Arizona State(38%) Arizona State
    (38%)
    Arizona State
    (38%) (*)
    Clemson
    (29%)
    11Temple(57%)
    3Syracuse(50%) Syracuse
    (50%)
    14Stephen F. Austin(42%)
    7Clemson(29%) Clemson
    (29%) (x)
    Clemson
    (29%)
    10Michigan(46%)
    2Oklahoma(55%) Oklahoma
    (55%)
    15Morgan State(45%)

    Finals

    USC(37%) Maryland
    (10%)
    Maryland
    (10%)
    Maryland(10%)
    Clemson(29%) Portland State
    (17%)
    Portland State(17%)

    *The Marquette/Utah State game is a draw based on graduation rates, so it went to the tie-breaker: players arrested.

    Update 9am: Fixed the prediction for the game between LSU and Akron. Thanks, Adam, for pointing this out.

    My source for graduation data.

    Update 10am: Fixed the prediction for the game between Louisville and Arizona. Thanks, Dave O, for pointing this out.

    Update 1pm: Fixed the prediction of the game between UCLA and VCU (and the subsequent matchup against Villanova). Thanks, Crawford, for pointing this out.

  • The Old New Thing

    Well, duh, I'd sure better get my money back

    • 27 Comments

    The vending machines in my building proudly announce

    Guaranteed to deliver or your money back.

    Well, duh. If I don't get the product, I'd sure better get my money back.

    Pre-emptive snarky comment: "I'm suing Microsoft."

  • The Old New Thing

    Overheard conversation fragment: Shrimp is not vegetables

    • 33 Comments

    I walked past a woman in the grocery store who was talking on her mobile phone. I only caught one sentence. She said, in an annoyed voice, "Shrimp is not vegetables."

    (Then again, purple is a fruit, so anything's possible.)

    Update: manicmarc correctly deduced that the tone and body language of the person on the phone indicated that her previous sentence in the conversation was something like "What vegetables do you want to have with dinner?"

  • The Old New Thing

    Why does the MoveWindow function let you suppress repainting?

    • 8 Comments

    Commenter Phil Quirk asks via the suggestion box why the MoveWindow function lets you suppress repainting. "Shouldn't the OS be able to figure out if the window needs to be repainted?"

    Indeed the window manager does do a very nice job of figuring it out if you pass bRepaint = TRUE, which is the expected value of the parameter. But if you think you're smarter than the window manager, then you can pass bRepaint = FALSE and tell the window manager, "Even though you think the window needs to be repainted, don't repaint it. Trust me on this."

    Why would you try to outwit the window manager? Maybe you have special knowledge about how your application behaves. For example, you might exploit special properties about the source and destination coordinates and decide that certain portions of the window should not be redrawn but rather should be shared between the old and new locations, sort of like the advanced tricks you can play with the WM_NCCALCSIZE message. Or you might know that your program is going to invalidate the entire client rectangle soon anyway, so a repaint immediately after the move would just be a waste of time. The bRepaint parameter provides an escape hatch, a throwback to the days when the window manager let you do strange things because you might be doing them as part of a clever thing.

    Mind you, these are pretty advanced concerns and most of the time you would be best off just passing bRepaint = TRUE and letting the window manager do its job of deciding what needs to be repainted.

  • The Old New Thing

    Raymond rewrites newspaper headlines, episode 2

    • 14 Comments

    The local community newspaper featured a color photograph of a twelve-year-old student holding a bright orange safety flag while another student crosses the street in front of him. The caption reads as follows:

    XYZ School 6th-grader John Doe, at right, will be honored Friday night at Safeco Field as one of the state's top safety patrol students.

    "On Monday morning, he will be found stuffed inside his locker," the caption did not conclude.

  • The Old New Thing

    The perilous quandary of including external drivers on the Windows CD

    • 53 Comments

    (Technically, it's probably more a dilemma than a quandary, but I like the phrase perilous quandary.)

    Driver coverage is always a sticking point for Windows deployments. If the Windows CD doesn't include a driver for your particular hardware, you're probably going to say, "Windows sucks. I installed the latest version on my machine and it didn't work with my video card/sound card/network card/whatever." The people who are responsible for deciding which drivers are included on the CD have to balance a lot of factors. How popular is the hardware? Will the hardware vendor allow Microsoft to include the driver on the Windows CD? Is the vendor willing to spend the additional effort to get the driver WHQL-certified?

    Even after Windows ships, the struggle is not yet over. I was reminded of this when I learned of a hardware vendor whose driver on the Windows CD was discovered to contain a security flaw. The following is a completely fictionalized version of the conversation that took place with the vendor.

    "Hey, it looks like there's a security flaw in the driver you gave us to include on the Windows CD. «details omitted» Can you take a look at it and tell us what you think?"

    — Yes, it appears to be a flaw in the x.y version of the driver. It is fixed in the x.z version.

    "Great, can you send us a copy so it can be made available on Windows Update?"

    — No, we'd rather distribute the updated driver through our resellers.

    "Our data (based on information anonymously and voluntarily provided by Windows users) shows that of all the Windows customers who have your hardware, only 5% of them are running version x.z or higher of your driver. The rest are still running version x.y or earlier. Please reconsider your decision."

    — Thanks for the offer, but we would prefer to distribute the updated driver through our resellers.

    Negotiations continued for three months before the vendor agreed to allow the updated driver to be distributed on Windows Update.

  • The Old New Thing

    If Michael Jackson took up bhangra dancing

    • 5 Comments

    If Michael Jackson took up bhangra dancing, it might look something like this

  • The Old New Thing

    Engineering is about tradeoffs: How hard will you work to save 68KB of disk space?

    • 84 Comments

    One of the recurring themes in the comments to my explanation of the historical reasons why there are two copies of Notepad was to use a hard link (or possibly a symbolic link) to save having to waste the disk space for two whole copies of Notepad. As I like to say, engineering is about tradeoffs. Let's look at the cost-benefit analysis.

    On the one hand: Install two copies of Notepad. Cost: 68KB of disk space.

    On the other hand: Use hard links or symbolic links. Cost: Add support for hard links or symbolic links to the FAT filesystem, to the operating system Setup program, to file formats such as the Windows Imaging Format, and to the various disk duplication systems that system builders (and corporate customers) use for deploying Windows to thousands of machines. Don't forget to count the cost for design and testing.

    Imagine you're the scheduling manager for the Setup team. Which of these two options do you choose? 68KB of disk space or doing all the work to support hard links during Setup and then waiting for all the existing customers to upgrade their tools to versions which support hard links—which could take several years. Are you going to be the one to have to stand up in the Ship Room and say, "We can't ship Windows because ten of our customers hasn't upgraded their deployment tools yet, and I have no idea how long we're going to have to wait until they do"?

    And for those commenters who said that Windows should just get rid of one of the copies, you'll be pleased to know that Windows Server 2008 got rid of the copy in the Windows directory. There is now only one copy¹ of Notepad, and it's the one in the system32 directory. It wasn't long after the product was released that I learned of a program that hard-coded the one that no longer exists; I wish the vendors good luck in getting a patch out quickly.

    Footnotes

    ¹Nitpickers not welcome here. There is only one copy remaining of the two under discussion.

  • The Old New Thing

    Et tu, Fargo

    • 8 Comments

    Last year, our friends over in the Fargo campus mocked us wusses for shutting down the campus over something as weenie as a touch of snow. Yesterday, there was a safety alert on the internal company home page:

    Alert

    The Fargo Campus is closed effective immediately due to inclement weather. The City of Fargo is pulling the plows from the snow emergency routes. Employees are encouraged to leave the Fargo Campus.

    Yup, Fargo has been shut down due to inclement weather.

    Explanation for people who don't get it: Both this and the mock weather advisory issued by the Fargo campus are just examples of friendly teasing between the Redmond and Fargo campuses, like cousins who live in different parts of the country. I encourage readers to interpret the teasing in the spirit in which it was intended. (Though given the nitpicking from yesterday, I'm not sure this caution will be heeded.)

Page 2 of 4 (33 items) 1234