December, 2009

  • The Old New Thing

    Just like in real life, you can hire someone to do your programming taxes for you

    • 37 Comments

    Commenter denis bider considers accessiblity an altruistic endeavor and suggests that it would be more efficient to outsource accessibility to another company.

    Sure, why not. Just like in real life, you can hire someone to do your programming taxes for you. If you would rather hire another company to come in and add accessibility support to your application, then more power to you.

    Yes, accessibility is one of those altruistic things, but so too is not consuming 100% of the CPU all the time, or being usable at high DPI or color schemes different from the Windows default. Sure, you can write your program so it doesn't work at high DPI, and requires the user to use the Windows default color scheme, and consumes 100% of the CPU all the time, but each time you do this, you alienate another percentage of your audience. (Not supporting accessibility will cost you a pretty large audience, because governmental agencies usually have accessibility as one of their requirements.)

    And don't be so sure that the audience that appreciates accessibility is just your test team and people with disabilities. It also means that people can't write tools that extract the text from your program or use voice recognition to control your program.

  • The Old New Thing

    You are listening to Radio Free Bob, a pirate radio station broadcasting on the Microsoft corporate network

    • 43 Comments

    Back in the late 1980's, when NETBIOS ruled the land at Microsoft, one of my colleagues ran a pirate radio station on the Microsoft corporate network. Let's call this colleague Bob, my generic name for a Microsoft employee.

    Bob had converted a bunch of songs to WAV format (mp3 not yet having been invented) and kept them on his machine to listen to while he worked. But he also travelled from room to room to investigate problems in various offices and labs. This was also the days before laptop computers and iPods. A portable computer was one of these puppies, affectionately known as a luggable because it was the size of (and weighed more than) a suitcase.

    Bob liked to listen to music while he worked, and since he couldn't take his music with him, he did what he thought was the next best thing: He had his music come to him.

    Bob wrote a program to stream his music collection over the Microsoft corporate network. Of course, Bob didn't want to have to pre-program the list of offices and labs he was going to visit during the day (in part of course because at the start of the day, he didn't know where he was going to be), so the program broadcasted his music collection to every computer at Microsoft. That way, no matter where he (or anybody else) was, he could listen to his music collection. He called this service Radio Free Bob.

    Radio Free Bob was not on the air for very long, however, before getting the heat from The Man. Pumping that much data to every computer at Microsoft, even the machines in overseas offices like Hong Kong and Berlin, doesn't sit well with corporate network administrators. I don't know the exact number, but it was consuming some huge percentage of the network bandwidth of the entire company. The IT department frantically triangulated the packets, identified the building that was the source of the network broadcasts, narrowed it down to a specific wing of the building, then began a room-by-room search for the offending computer, descending upon it like a SWAT team.

    Thus ended the short life of Radio Free Bob.

  • The Old New Thing

    Why did the word Start disappear from the Start button?

    • 48 Comments

    Commenter Mike Dunn would like to know why the word Start disappeared from the Start button in Windows Vista. After all, adding the word Start helped new users figure out what they should click first.

    I don't know but I can guess. To emphasize that these are guesses, I went back in after I wrote them and added all sorts of weasel words. It sort of saps the punch from the statements, but it's one of those things I've learned that I have to do to avoid the more egregious forms of willful misunderstanding.

    First of all, it might have been a leftover from one of the older designs for the Vista taskbar, one which, as I dimly recall, changed the default taskbar docking position from the bottom of the screen to the right-hand edge. (I am under the impression that this design may have been shown off at a PDC from a few years ago, but perhaps not.) Under those circumstances, we would be in the situation where the word Start disappears, so there would be no point showing a helpful piece of text when the only people it helps would be people who wouldn't know how to re-dock the taskbar anyway.

    Second, the design folks might have wanted to give Windows Vista a distinctive new "look", and a fancy new Start button could serve as one of those elements.

    Third, introducing a new element with a new design might be one of those things that lawyers like to see, because it might make a copyright claim more defensible. As I recall, during the period of Windows Vista development, there was an ongoing issue with a competing operating system which appeared to have copied many visual elements from Windows XP, and I'm guessing that lawyers like it when a new element is even more distinctive, because, in my totally uninformed, unofficial, and untrained legal opinion, doing so might help to remove the defense that the element is generic and therefore is not subject to copyright.

    Yes, the word Start was added specifically to address a usability concern, but it may have been the feeling that in the over ten years since the Start button was introduced, people had been exposed to it in other ways, perhaps even ways they didn't expect. You may have noticed that the Start button cues have been slowly disappearing over the years. The big dialog box that appears the first time you boot Windows which has a miniature screenshot with an arrow pointing to the Start button? Gone. The arrow that animates across the taskbar which says Click here to begin? Gone.

    By the time the first-time user has reached the desktop, the circular Windows Vista logo has been presented numerous times. It's on the boot screen, it's on the logon screen, it's on the box packaging. When it appears in the corner of the screen, the feeling of the designers may have been that the user has already been nudged plenty of times into clicking on it.

  • The Old New Thing

    Lamebook: The best of Facebook

    • 22 Comments

    Craig's List has a Best of Craig's List, but Facebook doesn't.

    Well now it does: LameBook (warning: often NSFW). My favorite: Lameonella.

  • The Old New Thing

    The format of bitmap resources

    • 10 Comments

    Another in a sporadic series on the format of Win32 resources.

    Here's a question from a customer:

    I'm noticing some strange behavior: When I call LoadResource then LockResource on an embedded bitmap, the data being returned by LockResource is not a properly formatted bitmap. The data is missing the BITMAPFILEHEADER, but the rest of the file is there. SizeOfResource also states that the bitmap resource is 14 bytes smaller than it actually is. 14 bytes happens to be equal to sizeof(BITMAPFILEHEADER).

    However, if I load the bitmap directly using LoadBitmap, everything works fine. If I look at the resource using Visual Studio, the Bitmap displays correctly and the binary data correctly includes the BITMAPFILEHEADER.

    Anyone have any ideas as to why LoadResource is not correctly returning the BITMAPFILEHEADER?

    Amusingly, a change to the word order changes the question to its own answer: LoadResource is correctly not returning the BITMAPFILEHEADER.

    In other words, LoadResource is not stripping off the BITMAPFILEHEADER: rc.exe is.

    The format of bitmap resources are pretty simple. They are just a bitmap file with the BITMAPFILEHEADER stripped off. Because it's just the file header, the thing tacked onto the front when saved as a file. It's not part of the bitmap itself. For example, if you are using a BITMAPINFOHEADER-formatted bitmap, then the resource format is a BITMAPINFOHEADER followed by the pixels.

    I can't explain why Visual Studio is showing you a BITMAPFILEHEADER that doesn't exist. They're probably trying to reduce confusion for people who don't know the format of bitmap resources and wonder why the binary data doesn't match their .bmp file. Of course, in so doing, they end up creating confusion for people who do know the format of bitmap resources, or—as happened here—people who don't know the format of bitmap resources and think that the LoadResource function is messing with their bitmaps.

    (For the record, the LoadResource function doesn't mess with bitmaps, icons, menus, or whatever. It just returns the raw binary data of a Win32 resource. It doesn't know the internal format of those resources any more than the file system knows the internal format of a Quicken data file or a shortcut file.)

  • The Old New Thing

    Those houses are too small for anyone to live in

    • 24 Comments

    Not Always Right is a collection of brief stories told by people in customer service. One of my favorites is from somebody who lives on Catalina Island and had to answer the question, "What time does the island close?"

    Runners-up: (I've left off the punch lines so as not to spoil the surprise.)

    • The person who called 9-1-1 because...
    • The person who didn't read the sign because...
    • The person who didn't read the sign because...
    • The person who couldn't get out of the building because...
    • The person who can't get into the bathroom because...
    • The person who can't enter the password because...

    The stories have been collected into a book, The Customer Is Not Always Right: Hilarious and Horrific Tales of Customers Gone Wrong. It's almost certainly a funnier and more enjoyable read than my own book. What's more, they have a Facebook group and I don't. Maybe I should start one?

  • The Old New Thing

    Only an idiot would have parameter validation, and only an idiot would not have it

    • 59 Comments

    The great thing about parameter validation is that there are people who say that only idiots would have it, and other people who say that only idiots wouldn't.

    Back in the old days, Windows didn't do parameter validation. If you called a function with an invalid window handle, your application crashed. If you called a function with an invalid pointer, your application crashed. If you called a function with an invalid bitmap handle, your application crashed.

    There was a lot of crashing going on.

    These crashes manifested themselves in the infamous Unrecoverable Application Error dialog, commonly known as the UAE message.

    Windows 3.1 added parameter validation to all of the functions in KERNEL, USER, and GDI. If an application passed an invalid window handle, then instead of crashing, it just got an error back.

    This change was met with derision. "Oh, I'm so impressed. You finally got around to doing something you should have been doing all along. Not doing parameter validation was a totally idiotic decision."

    But nowadays, parameter validation is out of fashion again. If you detect an invalid parameter and return an error code, then all you're doing is masking a latent bug in the application. It should crash and burn with a big red fat'n'ugly blinking exception.

    In other words, we should go back to the way things were before we added parameter validation. (Well, except that the bit fat ugly exception wasn't red and it didn't blink.)

    Who's the idiot now?

  • The Old New Thing

    What are those little overlay icons: Windows 7 edition

    • 28 Comments

    Some time ago, I summarized the overlay icons that come with Windows. There have been some changes in Windows 7, so I figured it'd be worth coming up with a new list.

    • A small arrow. This is still the shortcut overlay.
    • A padlock. This means that you have a private item in a non-private directory. (See below.)
    • A downward-pointing blue arrow. This is still the "to be written to CD" overlay.
    • A pair of green swirly arrows. This means that the item is available offline. This used to be a pair of blue swirly arrows. Apparently, green is the new blue. (See below for more discussion.)
    • A gray X. This means that the file has been archived to tape and will take a very long time to access. (Formerly, a black clock.)

    A private item is an item where the only user account with access is you.¹ You create one of these, for example, by going to the sharing wizard and saying Share with: Nobody. To avoid clutter, the overlay is shown only when there is a transition from non-private to private. (Otherwise you'd have a lock overlay on everything in your Documents folder, for example.)

    No longer present as an overlay is the sharing hand. Why was the sharing hand removed in favor of the private overlay?

    Given the changes in how people use computers, sharing information is becoming more and more of the default state. When you set up a HomeGroup, pretty much everything is going to be shared. To remove the visual clutter, the information was moved to the Details pane. What's more, a single overlay cannot express the different ways an item can be shared, so in order to figure out what the deal is, you have to go to the Details pane anyway.

    A similar thing happened to the offline files swirly arrows. They used to be placed on every item that was available offline, but feedback from customers highlighted that this was unnecessarily noisy because it trumped other (more informative) overlays. Instead, the swirly arrows are shown only on the root of the folder that is pinned and not on everything contained within it. In other words, the swirly arrows are placed on the thing you clicked on to make the files available offline, and conversely, on the things you need to click on to stop making them available offline. Per-file overlay information is still displayed in the preview pane, but it's been taken out of the icon list.

    Generally speaking, overlays are not a good way of presenting information because there can be only one overlay per icon, and there is a limit of 15 overlays per ImageList. If there are two or more overlays which apply to an item, then one will win and the others will lose, at which point the value of the overlay as a way of determining what properties apply to an item diminishes since the only way to be sure that a property is missing is when you see no overlay at all. (If you see some other overlay, you can't tell whether it's because your property is missing or because that other overlay is showing instead of yours.)

    Footnote

    ¹Even though you are the only user account, there can still be access granted to groups and non-user accounts such as the Administrators group and the SYSTEM account.

  • The Old New Thing

    How do I determine the processor's cache line size?

    • 40 Comments

    When doing high-performance computing, you need to worry about the CPU cache line size in order to avoid issues like false sharing. But how can you determine the processor's cache size?

    The GetLogicalProcessorInformation function will give you characteristics of the logical processors in use by the system. You can walk the SYSTEM_LOGICAL_PROCESSOR_INFORMATION returned by the function looking for entries of type RelationCache. Each such entry contains a ProcessorMask which tells you which processor(s) the entry applies to, and in the CACHE_DESCRIPTOR, it tells you what type of cache is being described and how big the cache line is for that cache.

    Windows 7 adds the function GetLogicalProcessorInformationEx which does the RelationCache filtering for you.

  • The Old New Thing

    Things I've written that have amused other people: Episode 6

    • 4 Comments

    On an internal discussion group, somebody decided to quote one of my blog entries.

    Jim Medding was amused by my response: Bloggers are just idiots with a Web site.

    (My blog was dug up in order to refute a claim, even though the blog entry applied to a situation different from the one under discussion.)

Page 3 of 4 (40 items) 1234