August 20, 2005 spout

The List

Lord keep me off of the list of people that don’t have to go through regular security checks:

“The Aug. 5 memo recommends reducing patdowns by giving screeners the discretion not to search those wearing tight-fitting clothes. It also suggests exempting several categories of passengers from screening, including federal judges, members of Congress, Cabinet members, state governors, high-ranking military officers and those with high-level security clearances.”

Can’t you just picture the movie where the terrorists kidnap a Cabinet member, hold their family hostage and use them as a mule to blow up some airplane? I’ll take the anal probes at the airport, thank you.

August 19, 2005 spout

Cool New IVR Feature

In a (very) past life, I used to write intergrated voice response (IVR) systems aka “voicemail hell.” It may not seem like it, but we spent a *ton* of time trying to make a voice output/12-key input UI as friendly as possible.

However, I never thought of the IVR feature I ran into today. While transfering my utilities to our new address, one of the utilities put me on hold and offered to call me back when it was my turn in line (promising me that I would not lose my place). I’ve got the world’s most perfect cell phone and the world’s most perfect Bluetooth headset, so staying on hold was just as easy as not, but still, that’s a damn cool feature.

August 12, 2005 tools

Very Cool Nullable Fix

.NET 2.0 has the idea of a “nullable” type built right in, e.g.

Nullable<int> x = null; // legal

This adds nullability to value types as well as reference types. Further, C# adds direct support with this syntax:

int? x = null; // legal

However, while the C# language was updated to support nullability, the CLR was not, which lead to problems with boxing:

int? x = null;
object y = x;
// a boxed Nullable<T> was never null
if( y != null ) Console.WriteLine(“Doh!“);

This problem was fixed this late in the .NET 2.0 game by getting a bunch of folks together to rejigger things so that the following works the way you expect:

int? x = null;
object y = x;
// a boxed Nullable<T> can now be null
if( y == null ) Console.WriteLine(“Wahoo!“);

Somasgar has the full scoop.

August 12, 2005 spout

The Half Monty

The Half Monty

I spent last weekend in Reno with Joel, my fraternity brother, wife’s sister’s husband and business partner (we have an investing business). We’d both been working killer hours lately and we needed a break, so we spent three days on a “dirty boy’s weekend” (as another friend called it). We gambled and drank and ate and slept in and took in a showing of The Dukes of Hazzard and, one night, we went to a comedy club. The main act was a fabulous comedian that took his craft very seriously. In fact, he was so committed to what he did, that he went to all the trouble to have his hair cut so that it looked short with it tucked into his hat, even though it was really very long, just so he could whip it out in his act for comedic effect. During his act, he juggled a chainsaw, did an amazing card trick, road a unicycle, played music on the MP3 player he’d plugged into his mic, brought folks up on stage and had us all laughing the entire time. He had this way of bringing folks up on stage where he’d point at a person, ask them their name (e.g. “Bob”) and then say, “Folks, give Bob a hand as he comes up to help me out with this next bit.” He was a true entertainer.

After he’d had us busting a gut for about an hour, he pointed to me and said, “What’s your name?” I answered him and he said, “Folks, give Chris a hand as he comes up to help me out with this next bit” and up on stage I went. Now, from a distance, I look fairly normal sized, especially sitting down. Our comedian was a tad on the short size, frankly, so when I walked up on stage, I towered over him and his eyes got real big. Of course, I’m shy on stage, so I didn’t say much, but nodded and played along good-naturedly. I mean, hell, I’d once led an audience into a public pie lynching of a suited marketing person, so I knew the drill.

He looked at me and said, “Chris, I want you to follow along with me. Do what I do. If you don’t do what I do, it won’t be funny. The funnier it is, the more likely you are to get laid.” Of course, I was in Reno w/o my wife, so unless Joel got frisky, I wasn’t going to get laid, but that didn’t mean I wasn’t enthusiastic about increasing my chances (and, of course, the audience was egging me on), so I nodded my head earnestly that I would do my best to follow along. He gave me a floppy cabby hat and put a top hat on his own head — I followed along. He did a little bit of “spirit fingers” and I followed. He did some hip gyrations; I followed. Of course, the audience was loving this and I love it when the audience is having a good time, so I’m having a good time.

Then he started the music: “You Can Leave Your Hat On,” by Tom Jones, made famous in strip routines the world over and most especially in the excellent movie: The Fully Monty.

I can see where this is going.

So can the audience.

Now I’m trying to remember what underwear I’m wearing.

Our comedian starts into his routine, doing flips and tricks with his hat that I try to keep up with, but it’s hard enough to balance a stiff top hat on your head, let alone a floppy cabby hat so, while I make the best of it, I’m only funny because I can’t do what this guy is doing. The best bit, of course, is when he holds his hat over his crotch, I follow, he gyrates, I follow, he lets go of his hat, I follow, his hat stays up and mine… does not (obviously he’s more likely to get laid at this point than I am : ).

After this, he pulls half his belt out and swings it around in a sexy manner; I follow, being as sexy as a giant, overweight geek can be (remember the fat guy from The Full Monty?). He throws his belt over his should and I do the same.

And then the inevitable. The music builds to a fever pitch, he reaches down and pulls off his pull-away pants in one smooth motion, throwing them over his shoulder and the crowd goes wild.

Then he looks at me expectantly and the crowd goes even more wild (especially Joel who’s nearly choking in laughter at this point). I raise my eyebrow to the comedian and he eggs me on. I raise my eyebrow to the audience and they egg me on. I remember that I’m no stranger to public nudity and a crazy audience is even more fun than a quiet photo studio, so I reach for my pants.

Of course, I’m not wearing my tear-away pants, so I’m laboriously unbuttoning and unzipping, following by carefully pulling off my pants over my sandals, which is not an easy thing to do without falling down when you’re 6′5″ and your center of gravity is someone near your left ear. But, I manage it and throw my pants over my shoulder, suddenly reminded of the underwear I chose for my day of revelry:

Now the comedian was nearly choking with laughter, but he said I did a great job and reached out to give me a hug (being careful to keep his hips as far away from mine as I was keeping mine from his), then shoo’d me off the stage. Then, while I’m still struggling to get my pants back on, the house lights go up, the act is over and the comedian is gone. And now, half the audience wants to shake my hand on the way out for showing off my polka dots on stage. It was a good way to start the weekend. : )

August 11, 2005 tools

What should I do w/ the metadata?

Imagine I’ve got some “metadata” that describes some functionality of my system, e.g. the command line parameters to a tool:

<args description=“Two wrongs don’t make a right, but three lefts do”>
  <arg name=“lefts” description=“Number of left turns” type=“int” default=4″ />
  <arg name=“attitude” description=“Driver attitude” required=“true” type=“string” />
</args>

Once I have this “metadata” in place, should I a) use it to generate a class at compile-time that implements the command line parsing, or should I b) use it to drive a command-line parsing framework at run-time?

If I do a), generate the code, the result might look like this:

class Args {
  public void Parse(string[] args) {…}
  public string Usage { get {…} }
  public int Lefts { get {…} set {…} }
  public string Attitude { get {…} set {…} }
}

I’ve got better perf, but I have to generate the code in some way and .NET doesn’t come with any built-in tools to do that (no, I don’t count ASP.NET or XSLT as good codegen tools). Plus, the command-line args are now baked in and require a re-compile to change and who cares about perf to parse the command line? Finally, I’m much more likely to have most of the work done in a base class, e.g.

class Args : ArgsBase {
  public void Parse(string[] args) { return base.Parse(args, …); }
  public string Usage { get {…} }
  public int Lefts { get {…} set {…} }
  public string Attitude { get {…} set {…} }
}

In my experience, most of the work of code-gen is generating the smallest possible bit of code to provide a nice wrapper around a base class that does most of the work in a very interpretive manner.

If I do b), have a run-time interpretter of the “metadata,” I’ve got to build a command-line argument interpreter, but, as I’ve said, you almost always have that anyway. However, I also give up a develop-time wrapper aka “Intellicrack” which will be pried from my cold, dead fingers.

What do you guys do?

August 5, 2005 fun

Fight Club Rules 9-16

If you love Fight Club (who doesn't?!?), then you'll love the rest of the Fight Club rules.
August 5, 2005 fun

I Love Arguing with Ian

Ian and I submitted the final manuscript for Programming Avalon, Beta Edition, on July 13th (right on time, I’ll point out). Since then, the O’Reilly folks have been working overtime to fix my prose (I’m not a big fan of editorial guidelines or templates). As part of that process, they sent Ian and me a 400+ page PDF file for us to check. In the process, I submit changes to the manuscript, Ian argues about the ones with which he disagrees and then I argue with his arguments. It’s great fun.

Here an excerpt in which we’re arguing over a single word that has nothing whatsoever to do with the technical content of the book while two professional editors from ORA watch, waiting for us to decide:

Page 51:  You want to change “breathing space” to “breathing room”?  Why?  The term “breathing space” is a common idiom.  (And judging by Google, that’s not just a UKism.)  I prefer it to “breathing room”, so unless there’s a good reason to change I’d prefer to leave it.

[csells] googlefight shows “breathing room” to be slightly more popular than “breathing space,” plus I’d never personally heard the latter. Also, you use the word “space” in a close previous sentence and I liked the variety.

Here we’re arguing over a single word again and, to help make my argument, I claim super powers:

Page 205: Why do you want to change “useful” to “handy”? Is there something wrong with “useful”?

[csells] because you use the word “used” later in that same sentence. Having “useful” and “used” so close together made my spider sense tingle.

Here we’re dealing with the vagaries of our personal styles and my preference for brevity (Ian can highlight a single word and write several paragraphs on it, while I like to highlight several paragraphs and comment “huh?“). In this case, I circled an URL and said “too big:”

Page 222: Yes it’s a big URL, but there’s not a lot I can do about that — if you can convince Microsoft to make a smaller URL in the next day or so, please do.  There’s a shrinkster URL in there too, so I don’t see what the problem is.  And I’m not going to agree to removing the original URL.

[csells] I didn’t say it was a *long* URL (I can hardly blame you for that, Ian : ); I said it was a *big* URL. What I meant was, the font looks too big in comparison to the size of the fonts around it.

Here we’re arguing over grammatic style, again, while two professional editors look on, letting us fight it out like children in the backseat of the car on a family vacation:

Page 224: I’m not quite sure what you’re proposing as the new text here, although I do see the problem.  How about:

“(It doesn’t matter where the UICulture element appears within this section.)”

[csells] I’m suggesting that I prefer parenthetical comments to be part of the sentence, e.g. “Foo sucks (and by ‘sucks,’ I mean ‘blows’).” You tend to do it the other way and I find it jarring, e.g. “Foo sucks. (And by ‘sucks,’ I mean ’blows.’)” Plus, there’s the matter of consistency, i.e. I do it in the former way in my writing and you do it in the latter way in yours; we should pick one and stick with it (and to be clear — we should pick my way : ). Unfortunately, I packed my Strunk & White, but I have every confidence that they got it right, too. : )

In this case, after reading several hundred pages of the book again, I was getting a little punchy, so I highlighted a Bezier curve, redrew it by a couple of pixels and suggested that after doing the math in my head, I feared a bug in Avalon’s rendering of Beziers; could ORA check it with their Cray?

Page 252: Well those were all drawn in Avalon using the exact positions chosen for the control points.  Also, I’ve been using Bezier curves for about 15 years now, and they all look exactly as I’d expect them to look.  I just cranked up Illustrator on the Mac.  It seems to agree with Avalon…  So does Acrylic.  What maths are you doing that indicates a different result?

[csells] I was just teasing. If my mention of the use of a Cray wasn’t enough, didn’t the bit about me doing the math “in my head” tip you off? I am delighted to know that you spent time double-checking things, however. : )

See? Big fun! : )

August 3, 2005 tools

WinFX Beta 1 Online SDK Docs


← Newer Entries Older Entries →