Saturday, October 22, 2005

My brother, Andrew, and his wife, Sara, have started a blog.  He's piggybacking off of my site for now.  Here's his inaugural post.  Let's hope we hear more from him.

posted on Saturday, October 22, 2005 10:55:32 AM (Pacific Standard Time, UTC-08:00)  #    Comments [0]
 Wednesday, October 12, 2005

Here's the logic response to Peter's experimenting:

Hitler Coulter.jpg[UPDATE] Since I've gotten some favorable response to this post, both in the comments and in email, I thought I would give some special, behind-the-scenes information

When I saw Peter's pictures, I immediately thought of the series (1,2) of photoshop trickery I did a while back. Look familiar?

Now, if you'll notice, in Peter's original, he is looking straight at the camera.  So, I had to fix the eyes and distort the nose so he's looking over at Jenkies, who is also obviously added to the scene.

posted on Wednesday, October 12, 2005 5:54:22 PM (Pacific Standard Time, UTC-08:00)  #    Comments [2]
 Monday, October 10, 2005

After discovering he was in town without warning on Sunday.  I finally hooked up with my friend Jason Jenkins  (whom I affectionately call Jenkies) and some of his friends for dinner.  It worked out perfectly because I ended up leaving work pretty late, so I just met them down on 6th street at Hutz, which is like a 50's diner.  Pretty good stuff.  We got caught up and generally had a good time.  I'm glad that I caught him before he left town tomorrow.

Thanks for letting me crash your dinner plans!

posted on Monday, October 10, 2005 6:14:38 PM (Pacific Standard Time, UTC-08:00)  #    Comments [1]

What a geeky post title.  Well, I guess it's a geeky post.

Based on the number of people actually in the bathroom at work when I'm in there, I would think that two people entering/exiting the bathroom at the same time would be a rare event.  Yet, I've come to expect the door to magically open in front of me as my hand nears the handle, or swing violently at my face as I exit.

I always find it amazing the number of things in real life that have dualities in software.  In software, we'd solve the problem of collisions in the doorway by taking a lock on it (although locking on a public object is not always a good idea).  This becomes a problem in the real world because of visibility.  The bathroom door has no window (which is probably good), so you can't see when someone is right on the other side.  You seldom have a collision when the door has a window because you can see who else is going to try to use the door before you can get there.  There are tons of "shared resources" in the world where we've created synchronization mechanisms of various authority.  I think we could learn a thing or two by observing them.

For instance, when roads intersect, we have several different ways of dealing with collisions (we sometimes call them that in the software world as well.):

  • Raw intersection - No traffic signs or anything. Typically found on dirt roads where traffic is scarce and the probability of collision is low.
  • Yield - One street is a lower priority and "yields" the intersection to the other road.
  • Stop signs - you see where I'm going
  • Flashing Lights
  • Traffic Lights
  • Traffic circle - This one always amuses me.  It is actually a very efficient means of managing an intersection IF the drivers are familiar with navigating it.  If they are not, hilarity ensues.
  • Overpass

And there are tons of "in-between" flavors.  Hopefully you see what I'm getting at.  The granularity of synchronization in software can be just as complex.  Simple locks, Mutexes, Reader/Writer locks, etc.

Where am I going with this? I don't know.  I just thought it was interesting how many real-world examples of synchronization there are, and how we avoid them in different scenarios, sometimes delegating that responsibility, sometimes taking a more strict position. Prioritizing etc.

That is all.

posted on Monday, October 10, 2005 12:36:45 PM (Pacific Standard Time, UTC-08:00)  #    Comments [1]
 Wednesday, October 05, 2005

Yup, it's my Dad's birthday again.  This next year of his life holds alot of excitement for him as he becomes a grandfather.  Happy Birthday Grandpa!

posted on Wednesday, October 05, 2005 9:27:12 AM (Pacific Standard Time, UTC-08:00)  #    Comments [3]
 Tuesday, October 04, 2005
I've had previous problems with obfuscating code with Dotfuscator.  I seem to be cursed...I've found another one.    Is no one else using this product to obfuscate CLR 2.0 code?  This one is quite wicked.  I spend several hours digging through before and after IL. (which is difficult when the purpose for obfuscation is to make it difficult to read) Here's the recipe for disaster:
  • A generic method with the following characteristics:
    • More than one type parameter.
    • A return type composed of one or more of the method's type parameters other than the first one.

Some C# example signatures (Not useful or practical, just simple examples that show the problem):

static IEnumerable<TValues> FindDictionaryValues<TKey, TValue>(IDictionary<TKey, TValue> dictionary)

static TValue FindAValueInADictionary<TKey, TValue>(IDictionary<TKey, TValue> dictionary)
 
After obfuscation with dotfuscator (even with all obfuscation options disabled), those two signatures will look like:

static IEnumerable<TKey> FindDictionaryValues<TKey, TValue>(IDictionary<TKey, TValue> dictionary)

static TKey FindAValueInADictionary<TKey, TValue>(IDictionary<TKey, TValue> dictionary)
 
What happens is fairly simple.  Any reference to the method's type parameters in the return type becomes a reference to the first type parameter (usually !!0 in the IL).  What's more, this corruption also happens at the call site, which I didn't discover until I had written a regular expression to find and repair the corrupt signatures.
 
It is quite as if generics support was cobbled on as a hurried afterthought/sellingpoint rather than being properly integrated into their codebase.  Their support for 2.0 is poor, even for "beta" status.  However, Preemptive seems interested in fixing the issues.  I'll update when I know more.
 
[UPDATE 10/06/2005] I wanted to let everyone know that PreEmptive is being very responsive to this issue.  They've delivered a patch and I am currently evaluating it.  So far, it appears to fix my issues, but we're working through a few other issues.  Will update when I have more info.
posted on Tuesday, October 04, 2005 2:08:26 PM (Pacific Standard Time, UTC-08:00)  #    Comments [0]
 Wednesday, September 14, 2005

I've been distracted all morning, drooling over the C# 3.0 features.  First, I was upset that they would tease us with 3.0 features before 2.0 is even released yet (and it's still a little silly), but being able to download, play with them, and run them makes a world of difference.  Here's my favorites distilled for those who don't want to check it out.

  • Tons of type inference stuff.
    • List<int> list = new List<int>();
    • becomes
    • var list = new List<int>();
    • I'm not sure how I feel about "var".  It makes it feel a little like javascript.  I can see how that makes the language less ambiguous, and three letters isn't that bad.
  • Tons of initialization stuff
    • Initialize any collection-type-thing like you would an array. (new List<int> {1,2,3,4})
    • Intialize objects with a named-parameter feel (new Person {FirstName="Mark", LastName="Miller} //not a constructor)
  • A few AOP-ish goodies with extension methods - This is extremely cool.  Add methods to string, or anything else.  Very sweet.
  • "Fix" the anonymous delegate syntax with lambda expressions
    • delegate(int x) {return x+1;}
    • becomes
    • x => x + 1
    • This will be hard to approach for some, but I think it's great
  • Anonymous Types - This is excellent for working with data where you don't really need a formal type, you just need to work with some data.
  • Language Integrated Query - This is the grand-daddy of them all.  Query against objects, query against XML, query against relational data, query against anything!  All using first-class features of the language!  I'm pretty excited about this.

I'm dissapointed in the lack of first-class duck typing support (late binding).  Yeah, we get half-way there through the use of query and anonymous classes, but there's some scenarios where that seems like hammering a tack with a sledgehammer.

I'm really excited in the innovation I see in the CLR-world.  Sure, lots of the above represent old ideas, but the query stuff represents big innovation in that space that fits right in where the "hurt" is.

posted on Wednesday, September 14, 2005 9:17:46 AM (Pacific Standard Time, UTC-08:00)  #    Comments [1]