September, 2003

  • The Old New Thing

    Why is the readonly property for folders so strange?

    • 10 Comments

    It's actually a signal to Explorer to look harder. It doesn't mean that the directory is read-only.

    If a folder has the Readonly or System flag set, then Explorer will look for a desktop.ini file which describes the folder customizations. For performance reasons, Explorer does this only if the directory has the +R or +S flag. (This is enormously important on slow networks.)

    There are two KB articles on this subject, and I will defer to them for much of the discussion. This is the version that applies to Windows XP and Windows Server 2003. There is also a version that applies to older versions of Windows, although the UseSystemForSystemFolders policy still applies.

    Coders shold use the function PathMakeSystemFolder to mark a folder as requiring special attention from Explorer.

  • The Old New Thing

    Why you can't rotate text

    • 20 Comments
    In a previous entry, I said that the word "Start" disappears because the alternative is worse.

    Somebody in a comment asked, "Why not draw the text vertically?"

    Ah, now you get to learn about the exciting world of vertical text.

    We originally intended to run text vertically in the new XP Start menu. In original designs for the menu, your name ran vertically up the left side of the menu instead of running across the top.

    Rotating text is problematic in languages that traditionally run vertically, such as Chinese. Since you probably don't have Chinese fonts installed, pretend that %, &, and ' are the Chinese characters for your name. In traditional vertical text, it would be written as shown in Example 1 below. Notice that the English text is rotated clockwise. This preserves the top-to-bottom reading order.

    %
    &
    '
    (Amy Smith)
    Amy Smith
    %&' (Amy Smith)
    Example 1 Example 2 Example 3

    As a concession to Western influences, it is permissible to render Chinese characters left-to-right, in which case your name would be written as "%&' (Amy Smith)".

    Compare this to the traditional Western way of rotating text. Text which would normally be rendered as "Amy Smith" is rotated counter-clockwise and rendered as shown in Example 2.

    Now consider what happens if you take a Chinese name rendered the Western way, "%&' (Amy Smith)", then rotate the Western way, resulting in Example 3. Notice that from a Chinese point of view, everything is upside-down! The character that is supposed to be at the top (%) is now at the bottom.

    Windows for many years now has been multilingual. This means that the same underlying code runs regardless of language. Changing a language merely changes the strings being displayed. This means that there can be no language-specific UI. In this case, it means that we can't have separate rotation rules for Chinese as opposed to English or German.

    (And even if we were allowed to have separate rotation rules, we would have to be able to tell whether the name was in the form above or was in the form "Amy Smith (%&')". In this form, we should rotate it as in example 2, since this is an English string with Chinese characters embedded; as opposed to our example above where we had a Chinese string with English characters embedded. Those of you who have seen Arabic and English mixed together get to see punctuation marks bandied about with similar degrees of confusion.)

    Multilingual support also explains why you see things like "1 folder(s)" instead of "1 folder" and "2 folders". Why not have two format strings, one for when the number of items is exactly one, and one for when the number of items is two or more?

    Well, for one, that would significantly increase the number of strings we would have to carry around. (If you say "just add s to make the plural" then you really need to get out more!)

    For two, some languages (such as Slovene) have a "dual" number in addition to singular and plural. The Lahir language has singular (one), dual (two), trial (three), paucal (a few), and plural (many). So now you have to have perhaps five versions of every string that contains a replacable number.

    This also explains why you see a lot of strings of the form "Property: Value" (for example, "Last modified: Monday, September 29, 2003") instead of a phrase ("Last modified on Monday, September 29, 2003"). This is necessary to avoid problems caused by grammar. If you attempt to compose a phrase, you have to worry about subject/verb agreement, gender and number agreement, declensions, all sorts of things that computers aren't good at. The only safe solution is to avoid it entirely and use the "Property: Value" notation instead.

    We did get one special exception to the "grammar independence" rule: Personalized folders. When you view somebody else's "My Documents" folder, it says "Chris's Documents". We made this request to the translators and they worked really hard to make sure that the templates for possessive forms were accurate in all the languages we support. (Fortunately, we didn't have to deal with languages where the form of the template depended on us knowing whether Chris is a man or a woman.)

  • The Old New Thing

    In case people got the wrong impression

    • 16 Comments

    I really did enjoy my trip. I just like talking about the goofy things.

    I intend to go back to Sweden in the spring. I'm currently enrolled in Swedish lessons but this trip came far too soon for me to have learned anything useful aside from "tack", "ursäkta" and "Jag taler inte svenska." Though the lady behind the register was exceedingly pleased to see a blatant foreigner buying Swedish children's books. Everybody in Sweden speaks perfect English (it's quite embarrassing, actually), so Swedes are honored when a foreigner actually bothers to learn Swedish. I'm told that one of the factors contributing to astounding English-language abilities in Sweden is that American TV shows and movies are not dubbed into Swedish when imported; they are merely subtitled.

    The Øresund bridge is totally awesome.

    Amusingly, when you take the ferry from Denmark to Germany, the toll booth agent speaks Danish and expects you to speak Danish. When you take the same ferry in the reverse direction, the toll both agent speaks German and expects you to speak German.

    The ferry schedules are published only in Danish. Just our luck, of all the languages of all the countries we were visiting, that's the only one none of us knew. We had a choice of two ferries, and we were unable to determine with confidence what times each one ran, how much time the crossing lasted, and when the last ferry of the day was.

    I studied German for five years, but that was a long time ago and my vocabulary has decayed heavily since then. Actually, my listening ability never got very good. On all the exercise tapes, they talk painfully slowly and clearly, whereas in real life, people talk rapidly and don't enunciate clearly. I could usually follow about two or three sentences before the rate of input exceeded my ability to process it. I got around okay, but it was slow going. I've also been told that my German is overly formal and stilted. (Is there such a thing as "overly stilted"? As opposed to what, "just stilted enough"?)

    I am myself not a vegetarian, but my two travelling companions are. We discovered the secret to finding vegetarian food: find an Indian restaurant or an Italian restaurant. An Indian restaurant will have an extensive vegetarian menu. ("Scharf" is a good word to know, too.) An Italian restaurant will have a few vegetarian options. We weren't sure about German or French restaurants. We concluded that, while a French restaurant is more likely to have vegetarian dishes or be able to convert an existing dish to vegetarian, a German restaurant would be less likely to be annoyed at the request. (We only tested this theory once: I stopped at a German restaurant and asked if they had any vegetarian entrees; the answer was no.)

    It's a good thing the glockespiel at the Marienplatz is so badly out of tune - it sets expectations for the show that follows.

    The important lessons at Oktoberfest were not learned by me firsthand, thank goodness.

    The Deutsches Museum is ridiculously huge. We spent an entire day there.

    We did not get to spend as much time in Berlin as the city deserved. Berlin is a "real city" as opposed to Munich, which is a "tourist city".
  • The Old New Thing

    Back from Europe

    • 6 Comments

    Here are some things I learned in Sweden, Germany and Denmark.

    • If you are an airplane pilot, you should avoid communicating on the emergency frequency unless you have an actual emergency.
    • In Sweden, marmalade comes in a flexible tube that looks like a really fat sausage.
    • Swedes can't handle spicy-hot food.
    • Road warning signs are blue-and-yellow in Sweden, but red-and-white in Denmark.
    • You can drive really, really fast on the Autobahn.
    • Never drive in the left lane of the Autobahn unless you are actively passing somebody.
    • When you ask at the cafeteria, "Gibt's Fleisch dabei?", and the guy says, "Nein, s'gibt kein Schweinfleisch", don't assume that he understood your question.
    • If somebody at Oktoberfest challenges you to drink your one-liter Maßbier in twenty seconds, you should decline.
    • If you vomit at Oktoberfest, they charge €25 to clean it up.
    • You really don't need to know that much information about lignite mining.
    • Parking in Copenhagen is free on Sunday. Putting money into the machine is a waste.

  • The Old New Thing

    When I dock my taskbar vertically, why does the word "Start" disappear?

    • 7 Comments

    Because the alternative is even worse.

    If the taskbar is not wide enough to display the entire word "Start", then the word "Start" is hidden. To get it back, resize the taskbar wider until the word "Start" reappears.

    This behavior is by design. From a design point of view, a partial word looks very broken.

    Also, there is an apocryphal story of clipping text causing embarrassment during localization. The word "Start", after being translated into some language, and then being clipped, turned into a rude word. (As an analogy, suppose the text on the Start button said "Start button", but it got clipped to "Start butt". Now you have to explain to people why they have to click on the "Start butt".)

  • The Old New Thing

    Pre-travel insomnia

    • 13 Comments
    I can't sleep the night before an airplane flight. Certainly I'm not the only person with this problem, right?
  • The Old New Thing

    How much is that gigabyte in the window?

    • 20 Comments

    Slashdot is in an uproar over a lawsuit charging computer manufacturers for misleading consumers over hard drive capacity.

    The manufacturers use the ISO definition, wherein a "gigabyte" is one billion bytes, even though most people consider a gigabyte to be 1024 megabytes.

    This is a tricky one. The computer industry is itself inconsistent as to whether the "kilo", "mega", etc. prefixes refer to powers of ten or powers of two. The only place you see powers of two is when describing storage capacity. Everything else is powers of ten: Your 1GHz processor is running at one billion cycles per second, not 1,073,741,824 cycles per second. Your 28.8K modem runs at 28,800 bytes per second, not 29,491. And your 19" monitor measures only 17.4" inches diagonally.

    There do exist IEC standard designations for power-of-two multipliers. A kibibyte (KiB) is 1024 bytes, a mebibyte (MiB) is 1024 KiB, and a gibibyte (GiB) is 1024 MiB. Good luck finding anybody who actually uses these terms.
  • The Old New Thing

    Improving the world one bad analogy at a time

    • 9 Comments

    One thing I am known for at Microsoft is my frequent use of bad analogies. Everybody else at work has had to suffer; now it's your turn.

    Why are there so many copies of svchost.exe running? What is svchost.exe anyway?

    Traditionally, each service runs in its own process. When you are developing and testing your service, having it in its own process makes debugging a lot easier.

    But if you look at your list of services (in Computer Management, Services), you can see that if each one got its own process you'd sure have a whole lot of processes lying around. Since there is a cost to each process merely for existing, having so many processes running would be a waste, since many services are used only sporadically. Tapisrv, for example, is active only when you are doing things with your modem.

    For performance reasons, groups of services are thrown together and run in a shared process called svchost. Sort of like a reality TV show, but without the voting.

    This means that if you see a copy of svchost.exe going a bit haywire in Task Manager, you can't really tell which service inside it is responsible. For performance reasons, groups of services are thrown together and run in a shared process called svchost. Sort of like a reality TV show. Knowledge Base article 314056 describes how you can dig into each svchost to see which services are running inside it. This will at least narrow the problem down to a subset of all the services.
  • The Old New Thing

    Emergency vacation

    • 10 Comments

    Hurricane Isabel made a mess of my weekend travel plans, so I decided, "If you can't beat 'em, join 'em." My outbound flight was cancelled, and even with the best possible substitution - a flight out the very next day - losing a day on a weekend trip pretty much kills it. So I extended it to a weeklong vacation. Consequently, don't expect to see many updates from me for the next week or so. I've been led to understand that some parts of Europe have Internet access (amazing!), so maybe I can sneak something in, but don't count on it.

    My "unplanned emergency vacation" will take me to Copenhagen, Uppsala, Munich, and Berlin. We'll see how long before I collapse of exhaustion. (I'm looking forward to Berlin, though. Last time I was there, there was this big concrete wall.)
  • The Old New Thing

    The end of the scrollbar series

    • 60 Comments

    Okay, that's basically the end of the scrollbar series.

    Do people actually like the idea of a coding series? It gets very few comments, and it's a lot of work to write, so if nobody actually cares I can just write about quick little things and not try to be coherent from day to day.

    I guess that's what most blogs are like anyway.

    If you like the idea of a coding series, what other topics would you like covered?
Page 1 of 4 (38 items) 1234