September, 2009

  • The Old New Thing

    Most people who go to an open house aren't actually interested in buying it


    You have a house for sale. You hold an open house. But not everybody who attends is there because they're interested in buying the house. The first wave are neighbors who are curious about the house they've seen for years only from the outside. Then there are the people who just enjoy looking at other people's houses. And occasionally, people drop by looking for chicken wings.

  • The Old New Thing

    If you're handling an out of memory exception, you probably shouldn't allocate memory


    With the assistance of Application Verifier, specifically, low resource simulation (also known as fault injection), a tester found a stack overflow condition. As we learned earlier, the important thing to look at when studying a stack overflow is the repeating section.


    When this stack trace was shown to the development team, they instantly recognized the cause of the problem. And you also have enough information to figure it out, too.

    Hint: Of the most likely reasons that a method named Str::Set would throw an error, which of them match the scenario?

    Since we are simulating low resources, the error being thrown is most likely an out of memory error.

    Reading the stack dump, the constructor for the Error object builds a stack trace object, and the stack trace object tries to allocate memory for a string in order to do its job. But that memory allocation fails, because we are out of memory, so an Error object is thrown, which builds a stack trace, which encounters an out of memory error, and so on.

    Obviously, the mistake was allocating memory as part of the process of reporting an out of memory condition. You need to be careful to avoid generating the very error that caused your error handler to be called.

    Related topics:

  • The Old New Thing

    Start with a $50,000 grant, hold a fundraiser, lose $47,000


    Phase three: Not profit.

    Coolidge High School received a $50,000 grant from AOL Time Warner to help keep the school computer systems running. Add a bizarre and disastrous fundraiser run by a confessed fraudster, and the next thing you know, nearly all of the money vanished before the year was out.

  • The Old New Thing

    Management-speak: Focus


    Management likes to use the word focus. They like it so much, that anything important is called a focus.

    That's an interesting scenario, one which we hope to address, but it's not our main focus.
    We're focusing on three features for this release.

    But how can you focus on more than one thing? The first citation implies that there's more than one focus (a main focus, and maybe some secondary foci); the second citation makes explicit the mutiplicity of foci.

    But a lens doesn't focus on more than one thing. There is one focus, the point at which parallel rays from infinity converge.

    Then again, if a lens is defective, it can have more than one focal point. And there's a term for that phenomenon: Aberration.

  • The Old New Thing

    Hey, you look Chinese, we have a class for people like you


    (The title is a callback to this article from a few months ago.)

    A member of my extended family grew up near the city of Nanaimo, Canada. While it's true that she's ethnically Chinese, it's also true that she's a fourth generation Canadian. The community is overwhelmingly English-speaking, and English is her first language. She grew up going to an English-language school, she watched English-language television, spoke English with her friends and family, and probably dreamed dreams in English.

    Yet when the family moved to Vancouver when she was a child (I don't know the exact age, so let's say eight years old), the school district automatically enrolled her in English as a Second Language, presumably based on her Chinese last name and the fact that Mandarin and Cantonese are the mother tongues in 30% of Vancouver homes.

    Since she was only eight years old, she didn't know that the school had tagged her as a non-native English speaker. She cheerfully went to her special class for an hour each day, enjoying her time with a new teacher and new classmates.

    It wasn't for a long time (I don't know exactly, so let's say six months) that she realized, "Wait a second, this is the class for people who don't speak English well!" Once the mistake was recognized, it wasn't long before she was transferred back to the regular class.

    Though I'm kind of surprised the school district (and the class teacher) never figured out that her English was native, or, failing that, that her English was plenty good enough that she didn't need the class any more.

  • The Old New Thing

    When you agree to write to a particular length, make sure your content is actually that length


    One of the lesser-known skills of writing for print is the ability to write to length. Remember in school when your teacher assigned you a five-page paper? Yeah, it's sort of like that. If your first draft comes up short, you'll have to sit down and come up with some more information. If you have too much, you'll have to decide what to cut.

    When writing a book, your length target has a bit of flexibility. You may have contracted to write a 500-page book, but your editor is unlikely to get upset if you turn in 499 pages or 501. But if you're writing for a magazine, your length requirements are much tighter. If you are asked to write a four-and-a-half page article, you'd better write a four-and-a-half-page article. You still have some room for fudging, say by adding an illustration, but the old schoolboy tricks of changing the margins or the font size won't work here. The magazine has its house style, and you don't get to say, "For my article, please use 11pt instead of 10pt."

    If you're like me and have a fixed-position column, things are even less flexible. My column must be one page long, exactly. If I go over, there's no continued on page to overflow into; if I fall short, there's no advertising to pick up the slack. When I get proofs back from the editors, they will often have remarks like "This article is ten lines short. Please fix." (They don't often tell me my article is long, because editors are very good at cutting on their own!)

    One thing that struck me when I visited the TechNet staff a few years ago was that many people expressed their appreciation that I hit my length (though not usually on the first try). I thought this came with the job of writing: You agreed to write n pages, so you'd better turn in n pages. Apparently, a lot of writers don't realize this. I'm told that when the editors tell a writer that an article is short and ask, "Can you add another ten lines?" they response they get back is sometimes a simple, "No, I don't think there's anything more to add."

    Print periodicals have space requirements. When you're writing for a newspaper or magazine, you have to meet them. That's part of your job as a writer.

    Bonus chatter: Recently, I've found that when the editors cut for space, they have at times failed to detect which of my sentences are "filler" and end up cutting the "good stuff". I've started including notes with my manuscript about which parts should be cut first.

  • The Old New Thing

    Why are developer tools orange?


    The Secret Geek Leon Bambrick wonders why developer tools are orange. Coincidence? Worldwide conspiracy?

  • The Old New Thing

    Things other people have written that have amused me, Episode 2


    Somebody posted a time-saving tip and concluded with "You'll save yourself at least 5 minutes per year."

    I jokingly wrote back, "I already do XYZ which does this automatically, and besides, saving 5 minutes per year isn't much anyway. I spend that much time picking my nose."

    The response: "Yeah, but now you can do both nostrils."

  • The Old New Thing

    Thanks for identifying the good programmers for us


    Many years ago, my manager told me about a recruiting trip he made. In response to a large number of job applications submitted from a city where a major competing software company had its offices, a small group of Microsofties travelled to that city to interview those applicants and hold a mini-job fair, so that other interested parties could also show up and interview for positions.

    When the company learned that Microsoft was coming to interview people, they called an emergency meeting which all their top programmers were required to attend, timing it to coincide with the job fair. The theory must have been that if their top programmers are at the emergency meeting, then they can't go to the job fair. Problem solved.

    Well, except that the plan backfired. Sure, all the good programmers didn't come to the job fair, but it also told the interviewers which of the applicants were the good ones: They were the ones who didn't show up for their interviews!

  • The Old New Thing

    Two-year-old as finite state machine


    Some time ago I joined a family for dinner, and they had a two-year-old. During dinner, the two-year-old accidentally knocked over her glass, and liquid quickly spread across the table. The adults at the table sprang into action, containing the spill on the table, wiping it up, and checking for leakage onto the floor.

    After all the excitement died down, the two-year-old looked down, saw the empty glass, and threw her hands up in the air, proudly announcing, "I drank it all!"

Page 3 of 4 (37 items) 1234