July, 2007

  • The Old New Thing

    Not my finest hour: Driving a manual transmission

    • 81 Comments

    Sara Ford messed up her leg last month; you can see her on ScooterCam-1 at TechEd 2007. The best part of the name ScooterCam-1 isn't the ScooterCam; it's the 1. That just gives it that extra little kitchy space technology feel that turns a good name into a great name.

    Anyway, she asked around if somebody with a car with an automatic transmission would be willing to swap with her manual transmission car until her leg got better. To me, driving a stick shift is like changing a flat tire: It's something that everybody should know how to do, but it's not something that anybody is expected to enjoy doing. I offered my car and (long boring part of story deleted) we met at her place and exchanged keys. I got into her car, backed out of the parking space, and... stalled right in front of her.

    Great job there. I really know how to instill confidence.

  • The Old New Thing

    Holidays for fireworks (and generally blowing up stuff) from around the world

    • 74 Comments

    Today is Independence Day in the United States, known informally as "The Fourth of July", thereby making it the only holiday◊ to be named after its own date. (The next closest candidate is New Year's Day, but nobody calls it "January 1st".)

    The original purpose of this Independence Day holiday have been lost to the mists of time.° Nowadays, it's a day for a barbecue picnic and fireworks.

    I remember asking a Swede when they celebrate their Independence Day. The response was "Independence? From whom?"

    In Sweden, as it probably is in much of the world, the big holiday for setting off fireworks is New Year's Day. (In Asia, Lunar New Year takes precedence.) In England, Guy Fawkes is the traditional excuse for blowing up stuff. In many parts of the world, Christmas appears also to be a big day for fireworks, but for some reason that is not done in the United States.

    What is the holiday for blowing up stuff in your country?

    Nitpicker's corner

    ◊s/the only holiday/the only major U.S. holiday/

    °I was joking about the original purpose of this Independence Day holiday being lost to the mists of time. Everybody knows that it's a commemoration of the invention of the hot dog.

  • The Old New Thing

    Don't just grab the foreground window and host UI on it

    • 58 Comments

    I was asked to look at an application compatibility bug in a program from a major vendor. But that's actually irrelevant; what I'm writing about today has nothing to do with application compatibility. That's just what drew my attention to the program in the first place.

    At some point during the install, the setup program encountered an error and wanted to display an error message. When it called DialogBox to display the error message, it didn't pass the setup program's main window as the hwndParent. Instead it passed GetForegroundWindow(). They chose the wrong owner for modal UI. (I've also seen people try GetTopWindow(0).)

    It so happened that the foreground window was Task Manager, since I had switched to Task Manager to look at various statistics of their installer as it ran.

    I hope you can see where this is going.

    They passed Task Manager as their modal owner, and since modal dialog boxes disable the owner, they ended up disabling Task Manager. (Meanwhile, their main setup program remained enabled, so I could have clicked on the Cancel button if I wanted to, which would have led to the "stack without support" problem.)

    Now I can't terminate their broken setup program from Task Manager since they inadvertently disabled Task Manager.

    But why did the programmers choose to use the foreground window anyway?

    One possibility is the programmer's version of the politician's fallacy.

    • We must pass a window.
    • The foreground window is a window.
    • Therefore, we must pass it.

    Another possibility is that they did this on purpose in order to ensure that their error message steals focus. Because their program is the most important program in the history of mankind.

    Unfortunately, I see this a lot. People who think their program is so important that they will abuse the rest of the system in order to get what they want instead of just waiting their turn. Of course, these people also fail to realize that setting a window as the owner for UI creates its own problems. As already noted, you disabled a random program. What's more, you've now attached the two input queues and tied your fates together. If the program that owns the foreground window stops responding to messages, then your program will also stop responding to messages.

    But primarily it's just rudeness. You took somebody else's window and started acting as if you owned the place. It's like looking up somebody's address in the phone book and using it as your own. That's not your house, and that's not your window.

  • The Old New Thing

    Food products that are offenses against nature: Fast Franks

    • 55 Comments

    My colleague (who posts under the pseudonym Cloudy Starlight) tipped me off to some wonderful products which made me just stare at the screen agape, unable to express my, um, awe. I'll focus on one of the products today; the others will have to wait for another day.

    First, let's suppose you've got a hankerin' for a hot dog. Your adventure might go like this:

    "Gotta have a hot dog, gotta have a hot dog. Where's that hot dog? In the fridge. Right, in the fridge. Open the fridge, find the hot dog. Find the hot dog. Got it. Need a bun. Where's the bun? Where's the bun! My kingdom for a bun! Oh, there's the bun, «pant pant» ah, my bun, my precious. Okay, get a plate, need a plate. No, that one's too big. No, that's not microwave-safe. Okay, got a small microwave-safe plate. Put bun with hot dog on plate. Put plate in microwave oven. Punch in thirty seconds. Thirty seconds. Go. Oh wait, close door. Okay, go. Twenty-nine. Twenty-eight. Isn't there anything faster than a microwave?! Three. Two. One. DING! Yes! I have a hot dog! Put hot dog in bun. Ow, hot hot hot. Yes! Dog is in the bun! Let the hot dog-lisciousy goodness commence!"

    If that's your experience with cooking a hot dog in a microwave, may I first recommend psychological treatment. You really need help.

    Second, Oscar Mayer Fast Franks has been created just for you. Instead of that entire adventure with the bun and the plate, the good people at Kraft have already put the hot dog in a bun and even provided the plate! Thus you've saved an entire four seconds of hot dog preparation time. Added up over a year of a daily hot dog obsession, that comes out to nearly twenty-five minutes of your life wasted putting hot dogs in buns and putting them on plates. You could watch an entire episode of Futurama with time left over to replay the best jokes!

    Let's take a look at their press release. I reprint it here in its entire awesomeness:

    READY, SET, HOT DOG!
    New Oscar Mayer Fast Franks Speed into Summer

    MADISON, WI, May 31, 2006 —It's mouthwatering to imagine -- a tasty, hot and juicy Oscar Mayer hot dog wrapped inside a soft and warm bakery-fresh bun. And now imagine only having to wait thirty-five seconds for that first delicious bite.

    The great taste and convenience of hot dogs in a bun come together with Oscar Mayer Fast Franks. Each individually wrapped Oscar Mayer Fast Frank tastes great thanks to a specially designed microwavable paper tray that heats the bun just right -- so it's soft and warm right out of the microwave. Preparation is easy, and there's no cook top mess or boiling water! The hot dog is simply unwrapped, placed in the bun on a specially designed microwaveable tray and heated for a quick 35 seconds, making a delicious all-in-one hot after-school snack for kids, a fun dinner item or part of a quick and yummy lunch for the whole family. Whether it's in the kitchen or on the go, Oscar Mayer Fast Franks are a summertime favorite that can now be enjoyed any day or time of the year.

    Innovation in a Bun: An Oscar Mayer Tradition

    For more than 120 years, Oscar Mayer continues to lead the industry in making hot dogs using only quality meat and no fillers. In a trusted brand families love, Oscar Mayer has created this innovative new product to satisfy America's love for hot dogs in a more convenient way. By leveraging proprietary dough technology, Oscar Mayer Fast Franks have made hot dogs easier to enjoy than ever before.

    Oscar Mayer Fast Franks will be available in most grocery and convenience stores' refrigerated sections nationwide beginning this summer.

    About Kraft Foods
    Kraft Foods (NYSE:KFT) is the world's second-largest food and beverage company. For more than 100 years, we've been dedicated to helping people around the world eat and live better. Hundreds of millions of times a day, in more than 150 countries, consumers reach for their favorite Kraft brands including Kraft cheeses and dinners, Jacobs, Gevalia and Maxwell House coffees, Oscar Mayer meats, DiGiorno pizzas, Oreo cookies, Ritz and Wheat Thins crackers and chips, Philadelphia cream cheese, Milka and Côte d'Or chocolates, Honey Bunches of Oats cereals, Good Seasons salad dressings and Tang refreshment beverage. They've also started adding our Tassimo hot beverage system, South Beach Diet line and a growing range of better-for-you Sensible Solution products to their shopping baskets, continually expanding their list of Kraft favorites.

    Julie Roberts, Mercury Recording artist, self titled album, 'A' (May 2004), was certified gold and led to two Horizon Award nominations (2004) from the Country Music Association. She was also nominated for Top New Artist Nominee (2005) and Top New Female Vocalist Nominee (2006) by the Academy of Country Music Awards, as well as Breakthrough Artist Nominee (2005) by the Country Music Television Awards. Roberts sophomore album Men & Mascara, produced by Byron Gallimore, is set to debut June 2006.

    That's right, they use proprietary dough technology. This ain't your grandfather's hot dog bun, no siree. We had researchers toiling away day and night perfecting their dough technology to bring you this perfect specimen of a hot dog bun.

    And what's with that whole Julie Roberts thing at the end? What does that have to do with hot dogs? And "A" isn't a self-titled album. Her name isn't "A"; it's Julie Roberts!

    But that's okay, because it's a quick and yummy lunch for the whole family. Note that that's a family of three people, since only three hot dogs come in a package. We're talking mommy, daddy, and the kid who throws a tantrum unless he gets a microwave hot dog in thirty seconds.

    Wait a second, what did it say at the top? Thirty-five seconds? Not thirty seconds? My four-seconds savings gone down the tubes! Noooo! Don't take away my Futurama!

    Nitpicker's corner

    • The word ain't is inappropriate in formal writing.
    • Same goes for the word hankerin'.
    • The kid might be a girl.
    • This entry contains sentence fragments as well as run-on sentences.

    Apparently there are people who apply the rules of formal scholarly writing under the mistaken impression that blogs are formal scholarly writing. These people should go hang out on LiveJournal until their heads explode.

  • The Old New Thing

    A modest proposal: Solving the problem of traffic in Seattle caused by sporting events

    • 52 Comments

    Whenever there is a sporting event in Seattle, traffic is reduced to gridlock for hours both before and after the event. This affects not only the people attending the sporting event in question, but also people who get caught up in the traffic as a side-effect.

    To resolve this issue, I present this modest proposal.

    In Berlin, a large museum complex can be found on Museum Island. Similarly, in Munich, Museum Island is the home of the Deutsches Museum.† I remember a conversation with a visitor from Germany to Seattle. She asked for suggestions on what to see, and in response to a museum, she asked, "Is it on an island?"

    Although we don't have the tradition of putting museums on islands here in the United States, we can start a new tradition: Sports Arena Island. Something to think about since the owners of the Seattle Supersonics are looking for a new arena.

    All sporting arenas must be built on an island. The beauty of this solution is not so much in the island-ness, but in how the island is connected to the mainland. (This means that we can have "virtual Sports Arena Islands" in parts of the country where an actual island is impractical.) You see, there will be a hundred lanes of traffic leading into Sports Arena Island, but only one lane of traffic leaving it.

    When there is a sporting event, everybody can get onto the island quickly since there is so much incoming capacity. This means that traffic will not back up onto local streets and highways. And when the event is over, cars can leave the island only one at a time since there is only one exit lane. This prevents the sudden surge of traffic from the game from overwhelming local roads. (The inconvenience of leaving the park would also encourage people to use mass transportation to get to the game.)

    Once we've gotten everybody accustomed to the idea of Sports Arena Island, we can take it to the next level: Floating Sports Arena Island. Here in Seattle, we float everything. Houses, bridges, more bridges (not to be confused with its parallel bridge), and still more bridges. The floating island would travel around the perimeter of Lake Washington like a ferry and make stops according to a fixed schedule. If you wanted to get to the Mariners game, you could get on at Bellevue at 5:30pm, Mercer Island at 6:00pm, or Madrona at 6:30pm. (The island couldn't go further north or south due to time constraints and because there are those bridges in the way, but we could have ferries pick up people from other locations and take them to the island.) This would spread out the event traffic around the entire lake instead of focusing it on one place. Similarly, when the event is over, traffic could be trickled out to the surrounding communities.

    There you have it. Now you can have your football game without seriously disturbing the traffic of the surrounding area. And then we can have the same "oops" that we've had before and sink the structure into the lake.

    Next time (if there is a next time), I'll solve the problem of identity theft.

    Footnote

    †It feels weird for me to write of the Deutsches Museum since it violates the rules for German adjective endings. Since it's the object of the preposition "of" (which is a dative preposition in German), perhaps I should say the Deutschen Museum. But this sounds weird to me because my instinct for adjective endings comes not from the analysis of strong and weak forms but rather on whether the case and gender have already been determined by the article, and since "the" is not declined in English, the answer is no. My instinct therefore tells me it should be of the Deutschem Museum, but that sounds insane the moment I say it. Besides, in German, I would have used the genitive case anyway (des Deutschen Museums). Of course, this is all nonsense since I'm just using a foreign phrase in English, in which case English rules apply. That doesn't mean it still doesn't feel weird.

  • The Old New Thing

    Just because you say something in my presence and I don't raise an objection doesn't mean that I agree

    • 51 Comments

    This is a sneaky trick that people try to pull occasionally. They'll say something while I happen to be present (either physically in person or virtually by adding me to an email conversation) and see what my reaction is. If I don't say anything, then they assume that I agree with whatever it is they said.

    Just to make it official: Just because you say something in my presence and I don't raise an objection doesn't mean that I agree. I can usually tell when people are trying to pull this stunt and I refuse to play along.

    I see the same trick being played in the comments of this web site. Just because somebody posted a comment and I didn't post a correction doesn't mean that the original comment is correct.

    On the other hand, the incorrect comment is archived on my Web site, which for many people implies some degree of approval, and which means that when people goes searching for a solution to their problem, they are likely to find the incorrect recommendation on this Web site, by virtue of the fact that it is ranked reasonably well by many major search engines. Did I just inadvertently help steer somebody to a wrong, possibly harmful, solution? Or is that not my problem?

  • The Old New Thing

    What is Dave's frame class?

    • 48 Comments

    Back in 2004, we lost Dave's frame class.

    Dave's frame class, or more accurately, DavesFrameClass, was the window class that drew the CPU meter on the Performance page of Task Manager. As you might have guessed, Dave was the name of the original author of Task Manager. (If the checked version of Task Manager from NT 4 encountered an internal error, it printed a message to the debugger which includes details of the error and Dave's telephone number so you can tell him about it! Mind you, that phone number is several years old, so don't call it, or you'll probably annoy the family who lives in Dave's old house.)

    One of the quirks of Dave's frame class that we had to fix in Windows XP was the digital read-out. The original version of Dave's frame class printed statistics using a display that mimicked an 8-segment LED. It may have been cute and retro, but it was also a bug, because it prevented the translation teams from changing the way the digits were displayed to suit the target language. Not all countries use Arabic numerals. (Somewhat paradoxically, many Arabic-speaking countries don't use Arabic numerals! They use Indic numerals. Then again, Roman numerals aren't used in Rome either.)

    Nitpicker's corner

    • s/aren't used/aren't used for everyday arithmetic by most people/
  • The Old New Thing

    Screwing the computer parts back together is the most dangerous step

    • 43 Comments

    I had removed the cover from one of the computers in my office in order to upgrade one of its hard drives (from 20GB to 200GB, woo-hoo). The hard drives are kept in a removable cage, so first I had to unscrew the cage, then unscrew the drive from the cage, then swap in the new drive. Of course, you don't screw everything back in until you've tested it out, so I had the computer running with its innards strewn about my floor until it ran to my satisfaction.

    Okay, time to put everything back together. I screwed the drives into the cage, screwed the cage into the case, but before I screwed the cover back onto the case, I turned on the computer just to make sure everything was still okay. A colleague of mine happened to stop by as I was doing all this to discuss a technical matter, and we chatted about the problem while I sat on the floor with a screwdriver. I said to my colleague right before I turned the computer on, "Look, I bet it won't work."

    Lo and behold, the computer didn't work. It just made a horrible beeping sound.

    Screwing the computer parts back together is the most dangerous step in computer assembly because once you do that, there's a pretty good chance that something will stop working.

    I spent the next fifteen minutes re-disassembling the computer, removing and re-attaching every cable that might have wiggled loose, all to no avail. Eventually, I found the loose connection: While mashing the cables around, one of them accidentally pushed against one of the RAM release levers on the motherboard. As a result, one of the RAM sticks was not fully-seated.

    Push the RAM back into its socket, power up the machine, everything works again.

  • The Old New Thing

    The real cost of compatibility is not in the hacks; the hacks are small potatoes

    • 42 Comments

    Commenter Myron A. Semack asks how much faster Windows would be if you took out the backward compatibility stuff. Myron is so anxious about this that he asked the question a second time. Asking a question twice typically counts as a reason not to answer it, but since I had already written up the answer, I figured I'd post it anyway. Oh great, and now he asked it a third time. Myron is so lucky I already wrote up the answer, because if I hadn't I would've just skipped the topic altogether. I don't respond well to nagging.

    The answer is, "Not much, really."

    Because the real cost of compatibility is not in the hacks. The hacks are small potatoes. Most hacks are just a few lines of code (sometimes as few as zero), so the impact on performance is fairly low. Consider a compatibility hack for programs that mess up IUnknown::QueryInterface:

    ...
    ITargetInterface *pti = NULL;
    HRESULT hr = pobj->QueryInterface(
                     IID_ITargetInterface, (void**)&pti);
    if (SUCCEEDED(hr) && !pti) hr = E_FAIL;
    

    The compatibility hack here was just two lines of code. One to set the pti variable to NULL and another to check for a common application error and work around it. The incremental cost of this is negligible.

    Here's an example of a hack that takes zero lines of code:

    HINSTANCE ShellExecute(...)
    {
     ...
     return (HINSTANCE)42;
    }
    

    I count this as zero lines of code because the function has to return something. You may as well return a carefully-crafted value chosen for compatibility. The incremental cost of this is zero.

    No, the real cost of compatibility is in the design.

    If you're going to design a feature that enhances the window manager in some way, you have to think about how existing programs are going to react to your feature. These are programs that predate your feature and naturally know nothing about it. Does your feature alter the message order? Does it introduce a new point of re-entrancy? Does it cause a function to begin dispatching messages that previously did not? You may be forced to design your feature differently in order to accommodate these concerns. These issues aren't things you can "take out"; they are inherently part of the feature design.

    Consider for example color NTSC. (Videophiles like to say that NTSC stands for "never twice the same color.")

    The NTSC color model is backward compatible with the existing system for black-and-white television. How much cheaper would your color television be if you could take out the backward compatibility circuitry? That question misses the point. The backward compatibility is in the design of the NTSC color signal. It's not a circuit board (or, to be more historically accurate, a set of vacuum tubes) that you can pull out. You can't "take out" the compatibility stuff from your television set. The compatibility is fundamentally part of the way the NTSC color signal works.

  • The Old New Thing

    That leaves more hot German babes for me!

    • 41 Comments

    Controversial new German law requires non-EU members to be able to speak German before they can move to the country to join their spouse.

Page 1 of 5 (43 items) 12345