Tuesday, November 14, 2006

Something that always bothered me at my previous job was having to install the framework SDK to get a copy of gacutil.exe.  I know the guys still there hate having to install the SDK on a server so they can manipulate the GAC.  Richard Lander gives some interesting information on the topic, but he doesn't go into why it's not included in the redist.

Since I've been at MS, I've learned a great deal more about the Global Assembly Cache (GAC) and the fusion APIs. Last night, I was taking a shower after cutting my hair, and the reason came to me.  That reason is... installers, or more importantly... uninstallers.

During a discussion recently, I heard an amazingly profound saying:

"It is better to fail to do, than to fail to undo"

I don't recall who said it, and they probably got it from someone else, but it is right on the money.

When programs uninstall, they have to correctly remove things they've placed in the GAC.  Let's make up an example.  Let's say I have some software company.  We've developed a magical managed library that makes it wicked easy to develop our software, so we use it in all our products.  Let's say that in our deployment model, it makes sense to deploy that library to the GAC.  So, uninstalling our software should remove it from the GAC, right?  We'll what if one of our other products is on the machine? We don't want to uninstall one and break the remaining one.

When you install an assembly into the GAC via the Fusion APIs, you do so with a traced reference.  That reference tells Fusion "who" installed it.  If 2 installers install the same assembly, it's smart enough to know not to remove the assembly until both uninstall.

GACUtil, as a management tool, enables you to  use traced references as well, but it also allows you to install without a traced references.  It also allows you to force uninstalls and do lots of other screwy things.  In other words, the tool is too powerful.  Devs need to be able to do screwy things.  Administrators need to be able to do screwy things.  Regular users don't.  Give them an install package that handles everything.  Otherwise, you're bound to have a support nightmare.

If I have time, or enough requests, we'll go into how to use the fusion APIs directly to manage the GAC.

posted on Tuesday, November 14, 2006 9:10:30 AM (Pacific Standard Time, UTC-08:00)  #    Comments [0]
 Monday, November 13, 2006

Starting on Halloween (a couple of days shy of 11 months), Jenna passed my criteria for walking on her own.  Becky brought her up for some of the MS-sponsored Halloween fun, and to our surprise was totally capable of walking down the halls of building 42, grabbing candy that people had placed outside their doors.  Evidently, our house was simply too cluttered with the chaos of unpacking for her to be able to demonstrate it fully there.

To add to the hilarity, she was dressed as a monkey.  I've had pictures of this for quite some time, but I haven't uploaded them to Flickr yet.  They are awesome.

So, this weekend, we purchased and installed 3 hardware-mounted baby gates to keep her from getting into too much mischief so that poor Becky doesn't have to case her around all day to keep her from getting into trouble.

posted on Monday, November 13, 2006 12:55:19 PM (Pacific Standard Time, UTC-08:00)  #    Comments [1]

Several people have complained that I haven't made any entries in a while.  There are several reasons for this.  Aside from being generally busy, I'm signed up to do some posts about the CLR in general, and some from my ownership areas as part of my job.  This has resulted in several "half-baked" entries ranging from hosting the runtime to the Global Assembly Cache, to some other more general CLR-related entries.

In addition, MS has had several new products in the queue that were on the verge of releasing, and I've had entries waiting for them to release.  Of course, being on the safe side, I've waited for someone else to blog first, at which point an extra post from me doesn't make much difference.

And thirdly, Jenna is growing like a weed and it's hard to find time to sit down and formulate posts when you're chasing her around the house.

So, regarding technical content.  I'd like to get an idea of what people are interested in hearing about. So shoot me an email or leave a comment with suggestions for posts regarding the CLR in general or specifically within my areas of ownership:

  • The unmanaged hosting API's (CorBindToRuntime, etc.). These are what you'd use to host the CLR in your own app in order to more tightly control things, or provide additional isolation or escalation policies.
  • The global assembly cache
  • "automatic" CLR activation - what I mean by this is what happens when the runtime is spun up my a managed app, or via COM interop.  Things like how to decide which runtime to use, etc.

In addition, I'll try to keep the personal updates coming for those who are not looking for just technical content.

posted on Monday, November 13, 2006 12:49:21 PM (Pacific Standard Time, UTC-08:00)  #    Comments [0]
 Friday, October 27, 2006

I've got a bunch of technical posts cooking, which has made my blogging output suffer, so I thought I'd get a quickie in here.

I've seen lots of people running their monitors in portrait mode rather than landscape.  It's very interesting, as this is a better fit for documents and you can get alot more source code on a screen as well.  The problem is that I love ClearType, and it doesn't work right in vertical mode.  It appears that ClearType is always rendered horizontally.  My video driver knows what the orientation of my monitor, why can't ClearType adjust and render the subpixels vertically?  Booo I say!

posted on Friday, October 27, 2006 7:52:48 AM (Pacific Standard Time, UTC-08:00)  #    Comments [2]
 Friday, October 20, 2006

Today, we've been in the new house for 1 week, and I think we've only gotten about 5% of the unpacking done.  Last night, I finally got the crib put together so Jenna doesn't have to sleep in the pack-n-play anymore.  The TV/cable is set up, but not the sound system.  We've got 1 PC hooked up.  Our bed is set up and we've unpacked some of our clothes.  The kitchen coming along, but we've yet to find the box with the silverware.

We're very happy with the house.  It's quieter outside, but noisier inside than our place in Austin.  It's an older house and the 2nd floor creaks quite a bit.  The hall has wooden floors, so it amplifies every little step.

The hardest part about unpacking is having enough room to do it.  If a room is full of boxes, how do you open up a box and put its contents away if the rest of the room is already full of stuff.  So, what we've had to do is sacrifice a room as a "stack" where we can just temporarily put stuff that is just in the way so we can have enough room to start the process of unpacking in a room.

The most unanticipated problem with the house is the driveway.  It's pretty steep, so we back down it to make getting out easier.  But it's very hard for me to get my car out because it's a manual transmission.  I have to use both arms and legs in perfect coordination to get myself out without peeling out and loosing traction, or rolling backwards into the house.  Things will get better once we get the garage cleared out so I can start on a flat surface.

posted on Friday, October 20, 2006 8:55:16 AM (Pacific Standard Time, UTC-08:00)  #    Comments [3]
 Thursday, October 19, 2006

IE 7 is now available for XP!  I've been using it now for a couple of months on both XP and Vista, and I think it's pretty solid.  This definitely brings IE back up to speed with modern browsers such as FireFox.  The only thing that bothers me is I can't set it up to automatically open a new tab when I type in an address.  I'm used to that behavior and I constantly clobber my tabs.  But, the streamlined interface, real tab support, and improved performance really make it good.  It really shines on Vista.

posted on Thursday, October 19, 2006 7:46:03 AM (Pacific Standard Time, UTC-08:00)  #    Comments [2]
 Monday, October 16, 2006

We've been going through the unpacking process all weekend.  Becky did some final sweeping and stuff of the apartment and turned in the keys this morning, so we are officially "moved", although I'm sure we have weeks if not months of unpacking and organizing to do.

We originally had envisioned that it would be like Christmas, especially since we've been without these things for 2 months (wow, has it really been that long?).  As it turns out, it's like having Christmas with all presents that came from aunts/uncles.  Sometimes they're great, other times... well... it's the thought that counts.

Aside: Now, this is nothing against aunts and uncles.  I'm talking about people who love and care about you enough to give you a present.  It's just that sometimes, they're not up to speed on your interests, needs, or even age.  You're thankful for their thoughtfulness in giving, but the gift is a little "off".

For instance, sometimes you open a box and there's something you've been dying to have again (socks, underwear, your favorite blanket, etc.).  Other times, you open up a box to find the trash can... complete with all the trash that was in it prior to the move. "Hey! ... it's ... the trash can ... hmmm"

Anyway, it's an interesting experience.  I can't wait until we find the silverware.  We've been using baby spoons for just about everything.

posted on Monday, October 16, 2006 11:50:43 AM (Pacific Standard Time, UTC-08:00)  #    Comments [1]
 Thursday, October 12, 2006

I just got back from our new place, and I couldn't be more excited.  Tomorrow, our stuff arrives and we move in.  I think the previous owners were down to the wire moving stuff out because they left alot of odd things like some clocks and their big movie screen.  They also didn't get around to vacuuming, which sucks (ha ha).

Anyway, I should be live on the net from there tomorrow since I've ensured that there is no interruption to that.  I hope to have a video tour of the place available by tomorrow evening.  Stay tuned!!!!  Mwah ha ha ha ha.

posted on Thursday, October 12, 2006 8:48:31 PM (Pacific Standard Time, UTC-08:00)  #    Comments [1]
 Sunday, October 08, 2006

Those of you who actually visit my blog rather than just consuming my RSS feed may have noticed my new header images.  I couldn't decide which one to use, so I threw together a random image HttpHandler to serve up a random one for each request.  There are several solutions for this available, but I thought my simplistic approach might be useful to someone else.

I just named the images header-XXXX.jpg, where XXXX is a 4 digit number and threw them into a directory, and then created an .ashx file with the following content:

<%@ WebHandler Class="HeaderRotator" Language="C#" %>

using System;
using System.IO;

public class HeaderRotator : System.Web.IHttpHandler {

   static int _HighestHeader = 12;
   static Random _Rand = new Random();

   #region IHttpHandler Members

   public bool IsReusable {
      get { return true; }
   }

   public void ProcessRequest(System.Web.HttpContext context) {
      int next = _Rand.Next(_HighestHeader + 1);
     context.Response.WriteFile(context.Server.MapPath(string.Format("~/headers/header-{0:0000}.jpg", next)));
   }

   #endregion
}

And that's it. Then you just reference the .ashx file in the img tag and you get a random image every time.  The _HighestHeader number needs to reflect the highest-numbered header image.  There's lots of different ways to do that, but I felt that simplicity was important here.

I had a lot of fun creating the images.  Some of them were carefully crafted, while others were more or less "happy accidents". I'm open to more suggestions for a good "tag-line".

[UPDATE] A few of you wanted a way to see them all without wasting time fighting against statistics.  So, here's a link that will show them all.

posted on Sunday, October 08, 2006 12:23:34 PM (Pacific Standard Time, UTC-08:00)  #    Comments [8]