• The Old New Thing

    Not all short filenames contain a tilde

    • 50 Comments

    I'm sure everybody has seen the autogenerated short names for long file names. For the long name "Long name for file.txt", you might get "LONGNA~1.TXT" or possibly "LO18C9~1.TXT" if there are a lot of collisions.

    What you may not know is that sometimes there is no tilde at all!

    Each filesystem decides how it wants to implement short filenames. Windows 95 uses the "~n" method exclusively. Windows NT adds the hexadecimal hash overflow technique. But some filesystems (like Novell) just truncate the name. "Long name for file.txt" on a Novell server will come out to just "LONGNAME.TXT".

    So don't assume that all short names contain tildes. They don't. This means no cheating on skipping a call to GetLongFileName if you don't see any tildes, since your optimization is invalid on Novell networks.

  • The Old New Thing

    Playing on an entirely different level

    • 11 Comments

    Competitive Scrabble® is another game entirely. For example, here's a game from the 2001 World Championship. You can follow it move-by-move, or you can read the game commentary.

    The name "Stefan" you see in the commentary is Wall Street Journal reporter Stefan Fatsis, author of Word Freak: Heartbreak, Triumph, Genius and Obsession in the World of Competitive Scrabble Players, a book that is on my list of "books I really want to read".

  • The Old New Thing

    First thing we do is kill all the jerks

    • 38 Comments

    There a fascinating article in today's New York Times on a troop of baboons which went pacifist:

    ... researchers describe the drastic temperamental and tonal shift that occurred in a troop of 62 baboons when its most belligerent members vanished from the scene. The victims were all dominant adult males that had been strong and snarly enough to fight with a neighboring baboon troop over the spoils at a tourist lodge garbage dump, and were exposed there to meat tainted with bovine tuberculosis, which soon killed them. Left behind... were the 50 percent of males that had been too subordinate to try dump brawling, as well as all the females and their young. With that change in demographics came a cultural swing toward pacifism, a relaxing of the usually parlous baboon hierarchy, and a willingness to use affection and mutual grooming rather than threats, swipes and bites to foster a patriotic spirit.

    It has been twenty years since this cataclysmic event and the amicable atmosphere persists even though none of the original male survivors is still around.

    "We don't yet understand the mechanism of transmittal... but the jerky new guys are obviously learning, ‘We don't do things like that around here.’"

    Of course, baboons will be baboons.

    The new-fashioned Forest Troop is no United Nations, or even the average frat house. Its citizens remain highly aggressive and argumentative, and the males still obsess over hierarchy. "We're talking about baboons here," said Dr. Sapolsky.

    Sounds a lot like the real United Nations to me.

  • The Old New Thing

    Unicode collation is hard

    • 8 Comments

    The principle of "garbage in, garbage out" applies to Unicode collation. If you hand it a meaningless string and ask to compare it to another meaningless string, you get meaningless results.

    I am not a Unicode expert; I just play one on the web. A real Unicode expert is Michael Kaplan, whose explanation of how comparing invalid Unicode strings result in nonsensical results I strongly recommend to those who attempt to generate random test strings in Unicode.

  • The Old New Thing

    The random number seed can be the weakest link

    • 19 Comments

    Random number generation is hard. That's why you should leave it to the experts.

    But even if you choose a good random number generator, you still have to seed it properly. The best random number generator in the world isn't very useful if people can guess the seed. That's why seeding the random number generator with the current time is not very secure; it's not hard to guess the current time!

    So it's important to throw something unguessable into the seed. As the above paper notes, just the time and process id are not good enough.

    So what should you do? Don't ask me; I'm not a cryptography expert. Here are some suggestions from other people. Maybe some of them are good, maybe not.

  • The Old New Thing

    Extraterrestrial income

    • 2 Comments

    As I was reading one of the bajillion annual reports in my mailbox, I happened across a comment regarding extraterrestrial income.

    Space aliens have to pay income tax?

    Oh, no, it was just a misread for the controversial extraterritorial income exclusion.

  • The Old New Thing

    Comparing the Norwegian, Swedish, and Danish languages.

    • 14 Comments

    As I got onto the plane for my outbound flight, I grabbed a Norwegian newspaper, having mistaken it for a Swedish paper. Fortunately, the two languages are so similar I was able to fake my way through it without too much difficulty. (And it's definitely an odd sensation reading U.S. cartoons translated into Norwegian...)

    The on-board entertainment system offered diversions in many languages. So I watched "Loony Tunes" dubbed into German (confirming that I really need to practice my German more) and then listened to some children's stories in various language. Demonstrating my astonishingly poor listening comprehension, I couldn't figure out whether the first story was in Norwegian or Swedish. Eventually I convinced myself that it was Norwegian, which was confirmed when I later heard a story in Swedish.

    Danish, on the other hand, is pretty obviously Danish.

  • The Old New Thing

    A story about USB floppy drives

    • 9 Comments

    A friend of mine used to work on the development of the USB specification and subsequent implementation. One of the things that happens at these meetings is that hardware companies would show off the great USB hardware they were working on. It also gave them a chance to try out their hardware with various USB host manufacturers and operating systems to make sure everything worked properly together.

    One of the earlier demonstrations was a company that was making USB floppy drives. The company representative talked about how well the drives were doing and mentioned that they make two versions, one for PCs and one for Macs.

    "That's strange," the committee members thought to themselves. "Why are there separate PC and Mac versions? The specification is very careful to make sure that the same floppy drive works on both systems. You shouldn't need to make two versions."

    So one of the members asked the obvious question. "Why do you have two versions? What's the difference? If there's a flaw in our specification, let us know and we can fix it."

    The company representative answered, "Oh, the two floppy drives are completely the same electronically. The only difference is that the Mac version comes in translucent blue plastic and costs more."

    This company was of course not the only one to try to capitalize on the iMac-inspired translucent plastic craze. My favorite is the iMac-styled George Foreman Grill. (I'm told the graphite ones cook faster.)

  • The Old New Thing

    Where does the taskbar get grouped button titles from?

    • 52 Comments

    If the "Group similar taskbar buttons" box is checked (default) and space starts to get tight on the taskbar, then then the taskbar will group together buttons represending windows from the same program and give them a common name. Where does this common name come from?

    The name for grouped taskbar buttons comes from the version resource of the underlying program. You can view this directly by viewing the properties of the executable program and looking on the Version tab.

    To set this property for your own programs, attach a version resource and set the name you want to display as the FileDescription property.

  • The Old New Thing

    A very brief anecdote about Windows 3.0

    • 14 Comments

    In an earlier comment, Larry Osterman described why Windows 3.0 was such a runaway success. He got a little of the timeline wrong, so I'll correct it here.

    Windows 2.0 did support protected mode. And it was Windows/386, which came out before Windows 3.0, which first used the new virtual-x86 mode of the 80386 processor to support pre-emptively multitasked DOS boxes. The old Windows 2.0 program was renamed "Windows/286" to keep the names in sync.

    The three modes of Windows then became "real mode" (Windows 1.0 style), "standard mode" (Windows/286 style) and "enhanced mode" (Windows/386 style). Amazingly, even though the way the operating system used the processor was radically different in each of the three modes, a program written for "real mode" successfully ran without change in the other two modes. You could write a single program that ran on all three operating systems.

    And then Windows 3.0 came out and the world changed. Sales were through the roof. I remember that some major software reseller (Egghead?) was so pleased with the success of Windows 3.0 that it bought bought every Microsoft employee a Dove ice cream bar. (Even the employees like me who were working on OS/2.) I was sitting in my office and some people came in with a big box of ice cream bars and they handed me one. "This is from Egghead. Thank you for making Windows 3.0 a success," they said.

    It was a strange feeling, getting a thank-you for something you not only didn't work on, but something which totally destroyed the project you were working on!

    [Raymond is currently on vacation; this message was pre-recorded.]

Page 356 of 388 (3,877 items) «354355356357358»