• The Old New Thing

    A complex family calculus


    I spent the other night at a relative's house, and I was woken the next morning by my young niece who politely asked me to make her breakfast. (Her technique for waking me up is to come in and call my name. If the door is closed, she pounds on the bedroom door and shouts, "Wake up! Wake up!" If I fail to open the door, she opens it herself. If the door is locked, she jiggles the handle until she forces the door open. I just leave the door open now. Making the best of a bad situation.)

    Anyway, later that morning, the following conversation took place between my niece and an adult family member (which conversation I have taken the liberty of translating into English):

    "Why did you wake up Uncle Raymond?"

    I wanted cereal for breakfast.

    "Why didn't you ask Mommy?"

    Mommy was still sleeping.

  • The Old New Thing

    News flash: Work-at-home job offers are mostly just scams


    McClatchy Newspapers discovers, to everyone's surprise, that work-at-home job offers are mostly just scams. Of course, this is something Rob Cockerham discovered years ago. (He also has a rundown of all his articles on the subject, in case you haven't gotten enough.)

  • The Old New Thing

    West Bank Story, the movie that sells itself in five seconds


    This weekend, I attended an Oscar-watching party, and when the clips from the nominees for Live Action Short Film were run, I was completely won over by West Bank Story. Five seconds of dancing, finger-snapping Jews and Arabs is all I needed.

    When filling out your Oscar party ballot, "Live Action Short Film" is one of those categories you just close your eyes and pick randomly since you don't know anything about any of the movies. It felt like everybody else at the party felt the same way I did: If we had seen that clip, we would all have voted for it. In our minds, it won the award before the envelope was even torn open.

    Update: Interview with Ari Sandel, director and co-writer.

  • The Old New Thing

    Who decides what can be done with an object or a control?


    This is one of those things that is obvious to me, but perhaps is not obvious to everyone. An object establishes what can be done with it. Any rights granted by the object go to the creator. The creator can in turn grant rights to others. But if you're a third party to the object/creator relationship, you can't just step in and start messing around without the permission of both the object and the creator.

    For example, unless you have permission of the creator of a list view control, you can't go around adding, removing, and changing items in the list view. The creator of the list view decides what goes in it, and at most you can look at it to see what the creator decided to put in it. I say "at most" because you often can't even do that: If the fact that the item is a list view control is not public, then the program that created the list view might decide to use some other control in a future version, and then your code that tries to look at the list view will stop working.

    Naturally, any private data associated with a control (such as the LPARAM associated with a list item) is entirely under the purview of the control's creator. The creator of the control decides what the item data means, and that can change from version to version if not explicitly documented. (For example, the meaning of the item data associated with the main list view in Explorer windows has changed at pretty much every major release of Windows.)

    Generally speaking, without the permission of the creator of a control and the control itself, you can't do anything to it. You can't hide it, show it, move it, change its scroll bars, mess with its menus (assuming it even uses menus at all), change its text, or destroy it. The code that created the control and the control itself presumably maintain their own state (the control maintains state about itself, and the creator maintains state about what it has done to the control). If you start messing with the control yourself, you may find that your changes seem to work for a while and then are suddenly lost when the control decides to re-synchronize its internal state with its external state. Or worse, things will just be permanently out of sync, and the program will start acting strange. If the control and the control's creator have not provided a way to coordinate your actions with them, then you can't mess with the control.

    If you're tempted to go mess with somebody else's controls, think about how you would like it if the tables were turned. How would you feel if somebody wrote a program that took the controls in your program and started messing with them, say adding items to your list box and using the item data to extract information out of your program? What if they started filing bugs against you for changing the way your program operates internally?

  • The Old New Thing

    Seattle to Portland (STP) 2007 trip report, part 2 of 4: Spanaway to Toledo


    Note: This story makes much more sense if you read Part 1 first. It won't be any more interesting, but at least it'll be a coherent sort of boring.

    12:20pm: We arrive in Spanaway for the lunch break (54 miles) [pic]. The consensus among seasoned riders appears to be that the Saturday lunch is pretty lame this year. It consists of a rice and bean wrap, a bagel, and a handful of grapes. I don't think it's so bad, but then again, I don't know what to expect either.

    Given that we lost a good chunk of time, I suggest that S, Z and I get a head start, since we tend to go slower. (S's normal pace is a bit slower; Z is slower thanks to mechanical problems; and I'm slower because I'm making sure we don't lose S and Z.) "Grab our bikes and meet back here." S and I grab our bikes and meet back here. We can't find Z. By the time we find him, the rest of the group (the "fast half" I'll call them) had already decided it was time for them to go, too, so even our head start evaporated before we hit the street at 12:40pm.

    I think that S and Z are ahead of me, so I pick up the pace. Flying down Highway 507 is a blast. The bulk of the riders head single file down the highway, with faster riders forming a "passing lane" just to the left. It's close quarters since the highway still has traffic on it, but everybody seems to know what to do and the miles fly by. I'm glad I have my bell because it saves me from having to put any more stress on my sore throat, which has been worsening throughout the day. Discussing the ride afterwards, A noted that when he did STP in one day, it was on this stretch of road between Spanaway and Roy that he joined a paceline and was able to go really fast. Not everybody thinks that this stretch of 507 is all that great, though. (Day Two.) And here's another rider's impressions of the cars on 507. (Day Two.)

    There was one tricky part about riding along this stretch of road: The white line at the edge of the road had divots cut out of it at regular intervals. For example, it would be clear for twenty feet, and then for twenty feet there would be pits cut into the road. And then clear for twenty feet, and so on. (The purpose is to warn drivers who wander off the edge of the road.) This made changing lanes tricky since you not only had to watch for traffic in the lane you want to change into, but you also have to time your crossing to coincide with one of the clear patches rather than the pitted segment. Apparently not everyone was able to negotiate this obstacle successfully.

    Between Roy and McKenna, around 295th St, I catch up to the lead group and ask them, "Have you seen S and Z?" No they haven't; I must've left them behind. I pull over at the entrance to the gravel facility and wait. Six minutes later, they show up, and I'm back on the road.

    At the end of the day, S asked me, "So did you see the Y in Roy?"

    What, Y as in YMCA?

    "No, Y like a fork in the road. People were talking about 'Make sure you don't miss the Roy Y' but I didn't see it."

    The only Y I remember was back in Spanaway, where we turned right at the Shell gas station onto Highway 507.

    It turns out I was right without even realizing it. The "Roy Y" is the point in Spanaway where Highway 507 starts. It's called the "Roy Y" not because it's in Roy but because it leads to Roy.

    We continue past the McKenna mini-stop without stopping because it's only four more miles to the next mini-stop.

    2:10pm: Yelm (mile 72). We take a longer-than-usual break here because Z is suffering from fatigue thanks to a suboptimal bicycle. ("Where are the sofas?" he asks.) Inside the portable toilets, there's a sticker that reads "Sanitary seat covers supplied for an additional charge, upon request of supperintendent." I don't know what a supperintendent is, but I don't want him hanging around in portable toilets.

    We are by now well into the hottest part of the day, and I have to resort to pouring water on my head to cool off. They do it on TV all the time and make it look so easy. It's quite nice, but also a minor challenge to keep the water from dripping onto your glasses.

    The fast group heads out first, and some minutes later, us slowpokes get on our bikes and continue onward.

    Or at least we try to.

    We are sort of the head of a clump of riders who leave at the same time, and I'm not able to stop them after they miss a turn. I shout feebly (sore throat), but they don't hear me. I finally catch up when they find themselves at a dangerous intersection with no Dan Henry to tell them what to do. "Hey, you missed a turn back there."

    We all turn around and head back, but the damage has been done. We became the trailblazers for hundreds of cyclists who are now heading the wrong way. As we backtrack, we try to tell them, "Wrong way! Go this way!" but they either don't hear us or don't understand what we're trying to say. They probably won't figure it out until they get to the same dangerous intersection and realize, "Oh, they were trying to tell us we were going the wrong way."

    Now on the correct route, we wait for a police officer to stop traffic so we can cross Highway 507 and ride on the Yelm/Rainier/Tenino trail. The first stretch of this trail is tricky since you're in a big clump, but eventually things spread out and you can ride at your target pace. At mile 77, Z's rear tire springs a flat. S goes on ahead, figuring that she's the slowest of the group and could use the head start. (We won't see her again until Centralia.) I pull out my patch kit and repair the puncture. A few minutes later, the tube is back in business, and we resume our travels.

    The bike mirror comes in really handy here, because I can ride ahead of Z and check in the mirror that he's still with me. I've figured out that the trick for not getting too far ahead is to shift to a lower gear to slow down; that way I can keep pedaling at my natural cadence without accidentally pulling away. I'm exerting practically no effort at this point in the ride.

    We reach the crossing at milepost 84 and watch one of the two police officers directing traffic nearly cause an accident. There are two officers at the point where the trail crosses the highway, one standing on each side of the crossing, and each holding a sign that reads STOP on one side and SLOW on the other. The officers agree to stop car traffic, and one one officer turns his sign from SLOW to STOP. The other, however, forgets to turn his sign, so it still reads SLOW. The first officer shouts, "Mike! ... Mike, turn the sign!" But Mike doesn't seem to hear him. Instead, he's distracted by a motorcycle coming down the highway that fails to come to a stop. He shouts at the motorcyclist and waves the sign in the rider's face, nearly knocking the rider off the motorcycle. Mike angrily runs to his police cruiser prepared to chase down the motorcyclist for failing to stop, but his partner finally gets his attention. "Mike, I was trying to tell you: You forgot to turn your sign. It still said SLOW."

    The officers check their signs (STOP) and wave us bicyclists across. A few miles later, we reach the Tenino ministop but keep going because we're pretty far behind schedule at this point.

    3:55pm: We reach the Tenino railroad crossing just in time to watch the Amtrak Cascades 507 go past at 70 mph. I've ridden the Talgo trains many a time, but those are different stories for a different time. It was just interesting seeing the train from the outside.

    5pm: Z and I are in Centralia, drawing close to the official midpoint stop at Centralia College, but oh, we get stuck at another railroad crossing. And this isn't a fast crossing like that Amtrak train. This is a cargo train, so it goes nice and slow, and it drags a hundred boxcars behind it. The midpoint stop taunts me from only a mile away. (At least at this crossing, nobody gets impatient and tries to sneak between two train cars, like they did at the finish, or crawl under a stopped train like people allegedly did in Puyallup.)

    Centralia College is the stopping place for a large number of cyclists, so by the time Z and I roll in under the misters it's a pretty festive atmosphere. We missed the orange creamsicles on the way in, but S helps us find them. Ah, ice cream. Z has been taunted all day by promises of ice cream and met with abject disappointment at each rest stop when he discovers that they don't have any. But now, he has his ice cream.

    5:35pm: We still have another 23 miles to go before we reach our Day One destination, Toledo High School. Once out of downtown Centralia, the route follows Airport Road, with the airport on one side and farmland on the other. There I see the world's largest garden hose reel, about ten feet tall. We also catch up to and chat with a gentleman on a unicycle before resuming speed and continuing to Chehalis. (Here's the web page of a fellow who rode a unicycle in the 2005 STP.)

    In Chehalis, we diverge from the official route and instead take Jackson Highway, which runs roughly parallel to the east. This was the dreariest part of the ride. It's been a long day, we have 17 miles to go, the rural scenery becomes tiresome, there are hills, it sucks the life out of you. But we have to get there before dark, so we soldier on. (If it's any consolation, J says that the main route through Napavine and Winlock is equally dreary.)

    While riding along Jackson Highway, the lead group passes a woman in her sixties who stops her bicycle and starts to turn around. S senses that the woman may be in trouble, and she stops to ask her if she needs any help. Turns out that she's trying to get to the Bethel Church which is her Day One stopping point. (Many churches and schools make themselves available to STP participants.) The woman pulls out a map which has the route to the church highlighted on it. Unfortunately, she's nowhere near that route. We call the church's phone number, but nobody answers. When S asks her what she's doing on Jackson Highway instead of following the directions on the sheet, she responds, "Well, I got a green wristband, so I thought I should follow the green arrows painted on the road."

    Actually, the green arrows lead to Toledo High School.

    S spots a road sign and cycles to it to figure out where we are. (She also calls the lead group to let them know we've stopped to help a lost cyclist.) Meanwhile, I study the map and make small talk. Have you ridden STP before? I ask.

    "This is my first time."

    Are you riding with anybody else?

    "Nope, I'm by myself."

    Wow, that's very, um, courageous of you.

    S returns with a location fix, and we realize that the woman is not too far from her destination, even though she definitely chose a suboptimal route to get there. We ride with her to Bishop Road and give her the rest of the directions ("turn left at Rush Road and you're back on track"). I didn't want to say "Good-bye", since that sounds rather ominous, so instead I said, "See you in Portland." For the rest of the trip, I used that farewell when talking to another rider. It has a very hopeful ring to it.

    After the woman bicycles away, S wonders aloud, "Doesn't she have kids and grandkids that tell her not to go do stuff like this by herself?"

    The woman also happens to have the highest bib number I'll see during the entire ride: 8973. Everybody on STP plays the bib number game, looking for the lowest and highest. Up to this point in the ride, my lowest is 41, part of a group of three riders numbered 41, 42 and 43 who passed me on the Yelm/Rainier/Tenino trail. This record will hold until midway through Day Two, when I see my lowest bib number, 17. (ZappoMan meets Rider Zero, which is the lowest possible bib number unless they have negative numbers.)

    6:45pm: It turns out that our delay for helping the lost woman doesn't cost us any time, because when S and I reach (I am not making this up) Vista Road, we find the lead group sitting by the side of the road tending to a flat tire. M ran over a sharp object. And yes, if you look at the map, Vista Road is a dead end. Omen? Who can say.

    Okay, tube all patched up, back onto the road. Just twelve miles to go. The twelve most dreadful miles of the entire trip. M and A spring ahead, and I take the opportunity to join the lead group for a change, leaving J to make sure we don't lose S and Z. We regroup at the Highway 12 crossing and ride past the John R. Jackson House, a building that I'm sure carries great historical significance for the area, but we weren't really in the mood to care by this point. Not far past the John R. Jackson house is the Jackson Prairie Speedway, which is already roaring with the sound of auto racing when we cycle past. At least now we know what people in Chehalis do on Saturday nights.

    After several shouts of "Are we there yet?" we finally... Nope, just kidding. We're not there yet.

    My sore throat by this point has gotten so bad I can talk only with some difficulty and pain. I try to get by with nods and hand gestures.

    At last, we... nope, still not there. What looks from a distance to be a high school athletic field is just a softball facility. The local softball team won the state championship in 2001, so this area is all softball crazy.

    Okay, finally we reach Toledo High School. The kitchen is making a new batch of spaghetti, so we can't eat quite yet. We take the opportunity to stow our bicycles, move our stuff into the classroom we reserved (our group is large enough that we get an entire classroom to ourselves), take a shower, and settle in. By the time we finish eating, it's nearing ten o'clock, and we really aren't interested in doing much beyond falling asleep.

    That was a long Day One. (You thought reading about it was long and tiring, try doing it!)

  • The Old New Thing

    Rob Cockerham investigates those companies that pay cash for gold


    Rob Cockerham seems to have a lot of spare time, which is great for the rest of us, because he investigates all those things we simply don't have the time for, and then posts the results on his Web site ("The sixth-best website in the world").

    Today's highlight is a pair of investigations he performed some time ago which seem to show two sides of one industry.

    That Web site is a sinkhole of time-wastage. If you're not careful, you'll find yourself clicking around from story to story, like the How much is inside? adventures, in which he investigates things like how many threads per inch are there in 360-thread count pillowcases? Or his gallery of costumes (for Hallowe'en or other events), including my favorite: Paparazzi.

  • The Old New Thing

    Answers to exercises


    Exercise: Explain why we used 0x7FFF to represent infinite height.

    Answer: Commenter "Reiko" got this right. 0x7FFF is the maximum integer coordinate supported by Windows 95, 98 and Me.

    Exercise: Explain the line rcWindow.bottom += rcTemp.top.

    Answer: The more precise way of writing the line would have been

        rcWindow.bottom += (rcTemp.top - rcWindow.top) - (0 - rcWindow.top);
    The first term is the amount of non-client space consumed at the top of the window. The second term is the amount of non-client space consumed at the top of the window, taking wrapping into account. The difference, therefore is the amount by which AdjustWindowRectEx needs to be adjusted. But the two instances of rcWindow.top cancel out, leaving just rcTemp.top.
  • The Old New Thing

    I totally presented to an executive the wrong way


    Some time ago, Gray Knowlton wrote an article on how to present to an executive.

    As you might have guessed, I've done it completely the wrong way.

    Many years ago, I was part of a group presenting to a senior-level executive. I was the one who wrote the document establishing the background for the topic and laying out the various options with their pros and cons. I wasn't the one doing the actual presenting, but I was asked to attend anyway, just in case the senior executive had a question that the presenters couldn't answer.

    For the duration of the meeting, I sat in the back and knitted.

    As it turns out, I wasn't needed. But at least I got some knitting done.

    (I was commended for the quality of the document I had written, so don't think I was just blowing off the issue entirely.)

  • The Old New Thing

    There's only so much you can do to stop running code from simulating UI actions


    Commenter KiwiBlue asks whether Captcha-style tests were considered to prevent unsigned drivers from programmatically clicking the 'Install anyway' button.

    I'm sure somebody considered it, but Captcha has its own problems.

    "Type the (distorted) letters below"-type Captcha cannot be used by people with visual impairments, people who are dyslexic, or people who simply are not familiar with the Latin alphabet. (Believe it or not, the vast majority of people on the planet have a native language which does not use the Latin alphabet.) Using an audio captcha runs into the problem of different accents, letters whose readings vary (zee/zed anyone?), and computers without a sound card (like most servers).

    And yes, there are other types of Captchas (dog/cat, for example), but the strongest argument against Captcha is probably that it's just adding more locks to the front door while leaving the service entrance wide open. Once you make it computationally infeasible to programmatically solve the Captcha, unscrupulous driver vendors would simply inject a DLL into the "Install this unsigned driver?" process and patch the call to Did­User­Answer­Captcha­Correctly so it always returns TRUE.

    Or even easier, just programmatically set the Driver Signing Options to Install the software anyway.

    If somebody is running code with administrative privileges, then they already own your machine. Any roadblocks you put up they can find a way to drive over. The goal is not so much putting up stronger and stronger roadblocks (because eventually people will simply drive around them) but rather making it clear to the developer that what they're doing is driving around a roadblock.

  • The Old New Thing

    See you in Building 109, Conference Room A


    We saw some time ago that if somebody invites you to a meeting in Building 7, they are inviting you off campus to take a break from work.

    If somebody invites you to a meeting in Building 109, Conference Room A, they are inviting you to join them at the Azteca Mexican restaurant next door.

    Update: One of the members of the "Building 109 Conference Room A" mailing list informed me that Building 109 Conference Room A is specifically the bar at the Azteca restaurant.

    Update 2: Building 109 Conference Room A has its own mailing list!

Page 377 of 453 (4,528 items) «375376377378379»