Thursday, March 22, 2007

For some reason, when I'm typing (and especially when I'm coding) I often conciously attempt to capitalize numbers under certain conditions.  For some reason, my brain thinks that there's a difference.  For instance, if I was typing HttpV4Implementation, I would probably end up with HttpV$Implementation because if there had been a letter there instead of a number, I would have capitalized it.  Does anyone else have this problem?  It's really frustrating because I often retype it several times making the same mistake each time before finally realizing what the problem is.

I think this may be caused by my handwriting style, which seems to be typical of engineers, where all letters are in captial form, but differ in size to indicate capitalization.  I've seen this referred to as "smallcaps".  Oddly enough, I didn't pick this up in college as an engineer.  I decided to start writing that way in junior high after noticing how cool my granddad's handwriting was.

posted on Thursday, March 22, 2007 10:13:48 AM (Pacific Standard Time, UTC-08:00)  #    Comments [0]
 Tuesday, March 20, 2007

I've been toying with Orcas extension methods recently, and I came across a situation that could be problematic.  The problem involves value types.  Generally, the advice to people is to always make value types immutable.  That is, once a type is constructed, it's state cannot be changed. There are a number of reasons behind this, and now there's one more.

Extension methods allow you to make a static method look like an instance method on another class via the "this" keyword on the first parameter.  The compiler will then use that method if it is in scope when resolving methods in code. So, the first parameter to the method behaves roughly like the "this" pointer.  However, there is a subtle difference when extending value types in this way.

In a regular instance method, the "this" parameter is passed by reference, even for a value type. (In IL, you load an address onto the stack rather than the instance)  This allows you to change the state of the object within the method.  However, for extension methods, the first parameter is passed by value.

So, if you attempt to make changes to the state of a value type in an extension method on that type, the changes won't be reflected after the method completes.

Like most value type problems, this is because you've made changes to a copy of your instance rather than the "original".  So, keep you value types immutable, or be aware of all the various gotchas of mutable value types.

posted on Tuesday, March 20, 2007 4:22:25 PM (Pacific Standard Time, UTC-08:00)  #    Comments [0]
 Monday, March 12, 2007

Jeff and Bethany brought Micah down and stayed the night with us Friday night.  It was really fun.  In my opinion, Micah did awesome for his first trip away from home.  We watched The Bourne Supremacy on HD-DVD.  We wanted to watch The Rundown, but I couldn't find it on HD-DVD.

After the movie, we fired up the Wii, and played Wii Sports.  Jeff and I played boxing for the first time, and we are still sore from it.  It was an unbelievable workout.

posted on Monday, March 12, 2007 9:47:37 AM (Pacific Standard Time, UTC-08:00)  #    Comments [3]

Many people are lamenting loosing an hour of sleep last night.  I, for one, welcome our new GMT offset.  When you're in school, loosing that hour is rough, but in the last several years, I've really grown to appreciate extra light in the evening.  You can get so much stuff done when it's light out (particularly stuff that needs doing outside).  As a parent, I've also become less annoyed at loosing sleep.  Just 1 hour?  Big deal.

Now that I live in Washington, extra light in the evening is far more desirable.  During the shortest days of the year, it was getting dark at 4:30!  Lots of people prepared me for the gray, rainy days of winter here, and that really hasn't bothered me.  However, I wasn't prepared for the short days of winter. I really hope they make daylight savings last all year.  But, I'll be happy with the few extra weeks we get now.  Last night, it was still plenty light at 7pm (I don't recall when exactly it got dark).  Now, I can't wait until the summer when it's still light out at 10pm.

posted on Monday, March 12, 2007 8:32:45 AM (Pacific Standard Time, UTC-08:00)  #    Comments [0]
 Monday, March 05, 2007

One of the great benefits of moving to Washington has been that we've been able to hang out with my college buddy Jeff Flint and his wife Bethany.  In fact they are coming down for a bit this weekend.  Today is his birthday, so Happy Birthday, Jeff!

Here he is posing for a recent spread in the REI catalog.

posted on Monday, March 05, 2007 12:29:10 PM (Pacific Standard Time, UTC-08:00)  #    Comments [1]