May, 2004

  • The Old New Thing

    Why is the default 8-bit codepage called "ANSI"?


    Reader Ben Hutchings wanted to know why the 8-bit codepage is called "ANSI" when it isn't actually ANSI.

    But instead of saying, "Oh well, some things mortals were never meant to know," he went and dug up the answer himself.

    A quick Google for Windows ANSI misnomer found me exactly what I was looking for [pdf]:

    "The term "ANSI" as used to signify Windows code pages is a historical reference, but is nowadays a misnomer that continues to persist in the Windows community. The source of this comes from the fact that the Windows code page 1252 was originally based on an ANSI draft, which became ISO Standard 8859-1. However, in adding code points to the range reserved for control codes in the ISO standard, the Windows code page 1252 and subsequent Windows code pages originally based on the ISO 8859-x series deviated from ISO. To this day, it is not uncommon to have the development community, both within and outside of Microsoft, confuse the 8859-1 code page with Windows 1252, as well as see "ANSI" or "A" used to signify Windows code page support.
  • The Old New Thing

    Chewing gum legalized in Singapore


    After twelve years, Singapore has relaxed its ban on chewing gum. But not so fast.

    Before Singaporeans think about unwrapping a pack of Wrigley's Orbit gum that's just started selling here -- and only in pharmacies -- they must submit their names and ID card numbers. If they don't, pharmacists who sell them gum could be jailed up to two years and fined 5,000 Singapore dollars ($2,940).

    Chewing gum, or more precisely the threat of chewing gum, is employed in the wonderful movie I Not Stupid, which I heartily recommend. It seems to revel in the mixed feelings Singaporeans harbor towards their own culture. (My favorite character is the chubby kid.)

  • The Old New Thing



    Apparently that's the term for knitting in public.

    The New York Times covered the online knitting community. I wasn't aware of the Yahoo knitlist group; I may have to go check it out.

    (The NYT article also mentions the yarn Fizz, which I have used, but I much prefer Splash, a totally knock-your-socks-off novelty yarn. Incorporate Splash into a scarf and you've got a friend for life.)

  • The Old New Thing

    How do you undo Minimize All and Show Desktop?


    It seems it's not well-known how to undo a Minimize All or a Show Desktop, two operations which I discussed briefly yesterday.

    To undo a Minimize All, you can right-click the taskbar and select "Undo Minimize All", or at least you used to be able to do that. Minimize All is no longer on the menus, presumably because it ended up redundant with Show Desktop.

    So after you do your ÿ+M to Minimize All, you can type ÿ+Shift+M to Undo Minimize All.

    To undo a Show Desktop, just click Show Desktop again. If you used the keyboard accelerator ÿ+D, just press it a second time.

  • The Old New Thing

    High-performance multithreading is very hard


    Among other things, you need to understand weak memory models.

    Hereby incorporating by reference Brad Abrams' discussion of volatile and MemoryBarrier(). In particular, Vance Morrison's discussion of memory models is important reading.

    (Though I think Brad is being too pessimistic about volatile. Ensuring release semantics at the store of "singleton" is all you really need - you want to make sure the singleton is fully constructed before you let the world see it. volatile here is overkill.)

    Vance's message also slyly introduces the concepts of "acquire" and "release" memory semantics. An interlocked operation with "acquire" semantics prevents future reads from being advanced to before the acquisition. An interlocked operation with "release" semantics prevents previous writes from being delayed until after the release.

    In the absence of explicitly-named memory semantics, the Win32 Interlocked* functions by default provide full memory barrier semantics. However, some functions, like InterlockedIncrementAcquire, forego the full memory barrier semantics and provide only acquire or release semantics.

  • The Old New Thing

    What is the difference between Minimize All and Show Desktop?


    The keyboard shortcut for "Minimize All" is ÿ+M and The keyboard shortcut for "Show Desktop" is ÿ+D. How are they different?

    "Minimize All" is easier to describe. It minimizes all the windows that support the "Minimize" command. You can minimize a window by selecting "Minimize" from its System menu, or by clicking the 0 button in the title bar. So "Minimize All" is effectively the same as going to each window that is open and clicking the Minimize button. If there is a window that doesn't have a Minimize button, then it is left alone.

    "Show Desktop" takes "Minimize All" one step further. After minimizing all the windows that can be minimized, it then takes the desktop and "raises" it to the top of the window stack so that no other windows cover it. (Well, okay, topmost windows continue to cover it.)

    So "Show Desktop" manages to get a few more windows out of your way than "Minimize All".

    Note, however, that when you return the desktop to its normal state (either by selecting "Show Open Windows" or just by switching to another window), all the un-minimizeable windows come back because the desktop has "lowered" itself back to the bottom of the window stack.

  • The Old New Thing

    Meet Anton Chekhov


    (Not to be confused with Star Trek's Pavel Chekov, who spells his name with a plain "k" instead of a "kh". Of course, since this is all transliteration from Cyrillic, of which there are multiple systems, arguing about spelling is rather dubious anyway.)

    The guerilla performance group Improv Everywhere stages events in public places and carefully records the reaction of their unwitting "audience". Perhaps one of their best-known stunts is the appearance of author Anton Chekhov at a New York City Barnes and Noble.

    After the reading, they set up a table in Union Square Park across the street and sold autographed copies of The Cherry Orchard from a table.

    The young man in the jean jacket above insisted that Chekov only sign his autograph, rather than making it out to anyone in particular. He proudly announced, "When you die, this is going to be worth lots of money!"

    Though I think their best performance from an artistic performance point of view was The Moebius.

  • The Old New Thing

    How does the desktop choose the icon label color?


    Many system colors come in pairs, one for background and one for foreground. For example, COLOR_MENU and COLOR_MENUTEXT; COLOR_WINDOW and COLOR_WINDOWTEXT; COLOR_HIGHLIGHT and COLOR_HIGHLIGHTTEXT. More on these colors in a future blog entry.


    How does the desktop choose the icon label color?

    It's not very exciting.

    The COLOR_DESKTOP color is studied to see if it is mostly dark or mostly light. If mostly dark, then the icon text is white. If mostly light, then the icon text is black.

    This works great if you don't have a wallpaper. If you do, then the desktop color doesn't typically correspond to the dominant color in your wallpaper, which may lead to a poor choice of black vs. white.

    To remedy this, you can manually set the desktop color by going to the Display control panel and going to the Desktop tab. Change the desktop color to something dark to get white icon text and to something light to get black icon text.

  • The Old New Thing

    Art too bad to be ignored


    The Museum of Bad Art: Art Too Bad To Be Ignored.

    The Athlete
    Crayon and pencil on canvas by Unknown
    Acquired from trash in Boston by Scott Wilson

    A startling work, and one of the largest crayon on canvas pieces that most people can ever hope to see. The bulging leg muscles, the black shoes, the white socks, the pink toga, all help to make this one of the most popular pieces in the MOBA collection.

    The Athlete also happens to be one of the most controversial works in the MOBA collection. Read the scandalous details!

  • The Old New Thing

    When you change the insides, nobody notices


    I find it ironic when people complain that Calc and Notepad haven't changed. In fact, both programs have changed. (Notepad gained some additional menu and status bar options. Calc got a severe workover.)

    I wouldn't be surprised if these are the same people who complain, "Why does Microsoft spend all its effort on making Windows 'look cool'? They should spend all their efforts on making technical improvements and just stop making visual improvements."

    And with Calc, that's exactly what happened: Massive technical improvements. No visual improvement. And nobody noticed. In fact, the complaints just keep coming. "Look at Calc, same as it always was."

    The innards of Calc - the arithmetic engine - was completely thrown away and rewritten from scratch. The standard IEEE floating point library was replaced with an arbitrary-precision arithmetic library. This was done after people kept writing ha-ha articles about how Calc couldn't do decimal arithmetic correctly, that for example computing 10.21 - 10.2 resulted in 0.0100000000000016.

    (These all came from people who didn't understand how computers handle floating point. I have a future entry planned to go into floating point representations in more detail.)

    Today, Calc's internal computations are done with infinite precision for basic operations (addition, subtraction, multiplication, division) and 32 digits of precision for advanced operations (square root, transcendental operators).

    Try it: 1 / 3 * 10000000000 - 3333333333 =. The result is one third exactly. Type 1/x - 3 = and you get zero back. (Of course, if you don't believe that, then repeat the sequence "* 10000000000 - 3333333333 =" until you're bored and notice that the answer always comes back as 0.33333333333333333333333333333333. If it were fixed-precision, then the 3's would eventually stop coming.)

    Thirty-two positions of precision for inexact results not good enough? The Power Calculator PowerToy uses the same arithmetic engine as Calc and lets you crank the precision to an unimaginable 512 digits.

    Anyway, my point is that - whether you like it or not - if you don't change the UI, nobody notices. That's so much effort is spent on new UI.

Page 1 of 5 (47 items) 12345