• The Old New Thing

    There's not much luggage space, unless you dump the snow


    Every year, Road and Track magazine reviews a strange vehicle in their April edition. Last year, it was the 1949 MG TC. But my favorite is their 2005 review of the Zamboni 500.

    [T]he Zamboni leaves the line with alacrity (revved to its 3000-rpm redline), rockets up to 9.7 mph and then stays at exactly that speed for the full 200-ft. length of the rink. Those old myths that you will "black out" or "be unable to breathe" at speeds above 9.5 mph proved to be completely untrue. I was perfectly comfortable, once I got over the excitement, and felt no ill effects then or later.

    There's not much luggage space, unless you dump the snow, and $50,000 is a lot of money for any sport ute with a top speed of only 9.7 mph.

    (The page also contains links to previous April Fool's stories.)

  • The Old New Thing

    The conversations backstage at computer Go tournaments


    Steve Rowe linked to an essay on why computers can't play Go well even though they've mastered other "difficult" games like chess. I was reminded of a description I received of what happens backstage at computer Go tournaments (i.e., tournaments that pit Go-playing computers against each other). ("Backstage" is a bit of a misnomer, of course; since the contestants are computers, you can talk all you want as loud as you want without worrying about distracting the players.)

    At computer Go tournaments, the programmers are like parents watching their children compete in a hockey game where they've only just barely learned how to skate. It's not so much a matter of who plays better as it is a matter of who sucks less. One programmer will lean over to the other and say something like "I hope my program realizes its left-hand-side is vulnerable before your program takes advantage of it."

  • The Old New Thing

    Evergreen Philharmonic Baroque Festival 2007


    The Evergreen Philharmonic Orchestra is a student orchestra consisting of the best high school musicians in the Issaquah School District.† Last weekend I attended their annual Baroque Festival, although there was only one Baroque piece on the program. (False advertising, maybe, but I'll let it slide.) Why was I at a high school student concert? Did I know somebody in the orchestra? Nope. A group of us attended because many of the members in the orchestra are former students of my friend the seventh grade teacher, and I figured it'd be interesting.

    Of course, since it's a high school student orchestra, you have to set your expectations accordingly. What I wasn't expecting was how tentatively most of the students performed; it was as if they were scared of the music. I'll have to chalk that up to performance anxiety. The orchestra started playing with more confidence once we reached the part of the concert where the orchestra took the role of accompanist to various soloists, ironically, the moment at which the orchestra needed to play more subdued!

    Not everyone responded to the pressure by playing softly. One‡ of the soloists responded by rushing through a cadenza faster than I've ever heard it played before. Oh, and a little performance tip for the other two soloists: Resist the urge to have a chat during the first soloist's big cadenza.

    Aside: When I was a student, I recall being nervous up there on stage, but once each piece started, I entered some heightened state of focus, and the audience simply disappeared. I remember once, between pieces, I peeked out into the audience, and it was so scary, I promised never to do it again.

    One student emerged as the standout. The second piece on the concert, the Scherzo from Dvořák's Serenade for Strings, was performed without a conductor, but I noticed that the first violinist was practically motionless. How was he managing to keep the ensemble together? Then I noticed two other performers who were noticeably more expressive. One was a bit too expressive, as if dancing to a piece of pop music secretly piped in via headphones. The other was the lead violist, who clearly was the one in charge. She cued the tempo changes, telegraphed entrances, and generally did the work of keeping the group together. She was a soloist for the next piece, and her talent really shone. She played with confidence and poise, and it was hardly a surprise to read in the program that she is heading off to college on a viola scholarship.

    I've made a note to check up in about four years to see if she's made a name for herself.

    Nitpicker's corner

    †s/musicians/orchestral musicians/. I mean, it's an orchestra. Did I really have to clarify that?

    ‡Students are not named due to their age.

  • The Old New Thing

    Blitting between color and monochrome DCs


    When blitting between color and monochrome DCs, The text foreground and background colors play a role. We saw earlier that when blitting from a monochrome DC to a color DC, the color black in the source turns into the destination's text color, and the color white in the source turns into the destination's background color. This came in handy when we wanted to colorize a monochrome bitmap.

    This trick works in reverse, too. If you blit from a color DC to a monochrome DC, then all pixels in the source that are equal to the background color will turn white, and all other pixels will turn black. In other words, GDI considers a monochrome bitmap to be black pixels on a white background.

    This trick comes in handy when you want to convert a bitmap with color-keyed transparency into a color bitmap and a mask. Select the color bitmap into the DC hdcColor, and create a monochrome bitmap with the same dimensions and select it into the DC hdcMask. Then the following operations will construct the mask:

    // let's say that the upper left pixel is the transparent color
    COLORREF clrTransparent = GetPixel(hdcColor, 0, 0);
    COLORREF clrBkPrev = SetBkColor(hdcColor, clrTransparent);
    BitBlt(hdcMono, 0, 0, cx, cy, hdcColor, 0, 0, SRCCOPY);
    SetBkColor(hdcColor, clrBkPrev);

    We can see this in action in our scratch program by making the following changes:

    PaintContent(HWND hwnd, PAINTSTRUCT *pps)
      HBITMAP hbmMono = CreateBitmap(100, 100, 1, 1, NULL);
      HDC hdcMono = CreateCompatibleDC(pps->hdc);
      HBITMAP hbmPrev = SelectBitmap(hdcMono, hbmMono);
      HDC hdcScreen = GetDC(NULL);
      SetBkColor(hdcScreen, GetSysColor(COLOR_DESKTOP));
      BitBlt(hdcMono, 0, 0, 100, 100, hdcScreen, 0, 0, SRCCOPY);
      SetTextColor(pps->hdc, RGB(0xFF,0,0));
      SetBkColor(pps->hdc, RGB(0,0x80,0));
      BitBlt(pps->hdc, 0, 0, 100, 100, hdcMono, 0, 0, SRCCOPY);
      ReleaseDC(NULL, hdcScreen);
      SelectBitmap(hdcMono, hbmPrev);

    We start by creating a 100 × 100 monochrome bitmap and selecting it into a memory DC. This will become our mask. Next, we take a screen DC and set its background color to the desktop color and blit from the screen to the monochrome bitmap. This creates a bitmap which is white where the screen has the desktop color and black where the screen has some other color. We show off we show off this new bitmap by painting it into our client area, but just for fun, I made the foreground pixels (black pixels in the monochrome bitmap) bright red and the background pixels (white pixels in the monochrome bitmap) dark green.

    Minimize your windows so the upper left corner of the desktop is visible, and turn off your wallpaper (so the desktop color actually means something). Run this program and observe a copy of your desktop drawn in the window's client area, but with your desktop color turned to green and all the other pixels turned to red.

    The rest of the job of drawing a color bitmap with transparency is now comparatively straightforward. I'll leave it as an exercise. Hint: Raster operation 0x00220326 (DSna) will probably be handy.

    Next time, we'll look at DIB sections as a way of doing fast color manipulation, thereby avoiding the need to perform the DSna ROP entirely.

  • The Old New Thing

    Computer monitors float, screen upwards


    Oceanographer Curtis Ebbesmeyer made another appearance on my local public radio station. Among the ocean garbage trivia is the fact that computer monitors float screen upwards (timecode 4:00).

    Other fascinating facts:

    • Garbage from Japan collects near the United States; garbage from the United States collects near Japan.
    • Researchers studying dead albatross chicks have found 60-year-old plastic in the birds' stomachs.
    • Some beaches "specialize" in certain types of garbage.
  • The Old New Thing

    It is as if our leaders have not been educated in orbital space colonization


    Yesterday were held the primary elections in the state of Washington. Most of the partisan positions were uncontested, so there wasn't much to research. The one with the most candidates was for one of the state's Senate seats, and among those candidates were some who might be considered "a bit unorthodox".

    • Michael Goodspaceguy Nelson. Since election law requires that candidates file under their legal names, Mr. Nelson's middle name must really be Goodspaceguy. (I will assume that he was not born with that name.) Mr. Nelson's position appears to be that we should focus our efforts on constructing orbital space colonies around the earth, the moon, and Mars. In his statement, he bemoans the lack of progress made along these lines:

      Unfortunately, much of our space money has been wasted. It is as if our leaders have not been educated in orbital space colonization. The waste and destruction of taxpayers space property show a lack of understanding of space colonization.

      Mr. Nelson has not one but two blogs. I'm not sure what the difference is, but you can check them out yourself. Blog the first. Blog the second.

    • Mike The Mover. Mr. Mover's position statement is incoherent, but that's okay, because there's a method to his madness. You see, Mr. Mover pays the $1360 filing fee so that he can get his face and name in front of every registered voter in the state. The result of this name recognition is about $150,000 in extra business for his moving company.

    • William Edward Chovil. Mr. Chovil looks like the cranky old man who lives down the street, and his statement does nothing to dispel this perception. His fixation on communism (oops, sorry, Communism with a capital C) and the New World Order conspiracy seems quaintly out of place in today's political climate. Sort of a throwback to the Cold War years.

    • Gordon Allen Pross. Mr. Pross's statement reads like one of those convoluted math problems you got in school, but with an added obsession with "red headed Lincoln pennies" and Congress apparently legislating pennies to people. I think. His argument is hard to follow, but when he starts doing percentages, that's when he loses me completely.

      USA splits the one Taxed Lincoln cent equally three ways Federal, State and Local Governments receive a third, 33.3% times 3 equals 99.99%. With 00.01% left over for campaign finance reform.

      It's so simple it just might work: Funding the government through rounding errors.

    None of these candidates appears to have won their respective election, so we won't be seeing much more of them this election season. But that's okay. All four of these candidates are "regulars" on the ballot, so they'll almost certainly be back in two years if not sooner.

  • The Old New Thing

    The tale of the radioactive Boy Scout


    Under no circumstances should you attempt this at home.

  • The Old New Thing

    Correctly spell xerophthalmia and the crowd goes wild


    One of the things I did in San Francisco was attend a performance of The 25th Annual Putnam County Spelling Bee. I went into the show with some trepidation, fearing that it would recall painful memories from my own career on the spelling bee circuit as a middle-schooler. Fortunately, my experience as a spelling bee participant only served to make the show more enjoyable.

    Each performance is different because four volunteers from the audience are invited to join the six student characters on the stage to participate in the bee. Things got off to an unexpected start when the first audience member misspelled "Mexican", which threw the script for a minor loop since one of the characters complains later about that "easy" word. A second audience member dropped out shortly thereafter, but the last two managed to hang on a bit longer. The third eventually dropped out on "dengue".

    The last audience member, on the other hand, kept spelling words correctly. It was obvious that we had reached the point in the script where all audience participants were to be eliminated, because they kept calling him to the microphone for another word. He was doing so well that the cast members had trouble keeping straight faces. The crowd went nuts when he spelled xerophthalmia correctly. (You could tell who the spelling bee veterans in the audience were, because we were the ones who cheered wildly as soon as he finished spelling, before the judge ruled him correct. After all, xerophthalmia is not a difficult word, being a simple combination of the Greek roots xeros, meaning dry, and ophthalmos, meaning eye.) After xerophthalmia, he got the "word" pharmacologicalmum. (Yes, the judge mumbled the end of the "word".) And as soon as he started spelling with "p", the judge eagerly rang the bell and declared "no, it's an f."

    The first half of the show was extremely funny, for it is then we are introduced to each of the (cast member) spellers and their quirky spelling techniques. That's also where the bulk of the spelling takes place, and where we are treated to the wickedly twisted sample sentences, two examples of which can be found in the clip I linked to above. (We also get Olive's sweet My Friend, The Dictionary and the wonderfully out-of-control Pandemonium.) The second half drags a bit, but I Speak Six Languages injects some long-absent freneticism, including a little fourth-wall breakage when Marcy displaces the orchestra pianist and starts playing her own accompaniment!

    If this show ever comes into your area, I wholeheartedly recommend seeing it.

  • The Old New Thing

    Things I've written that have amused other people, Episode 2


    In our internal blogging discussion mailing list, somebody asked, "How do you guys manage your blogs? I mean stuff like revising old posts, managing links, categories, etc."

    My reply:

    What specific sort of "management" activities are you trying to do? Typically, once you post an entry that's the end of it. You don't manage a blog so much as keep feeding it.

    For some reason, people got a kick out of that last sentence.

    (Episode 1.)

  • The Old New Thing

    Real Madrid (i.e., proper football) comes to Seattle


    Hot off the presses. Real Madrid (with David Beckham, Ronaldo, and other stars) will play an exhibition match against D. C. United in Seah^H^H^H^HQuest Field on Wednesday, August 9th. I wonder if it'll be anything like the last soccer match I saw. At least let's hope they're ready to play instead of having tired themselves out playing video games.

    Tickets go on sale today.

Page 378 of 431 (4,310 items) «376377378379380»