Monthly Archives: May 2004

TechEd 2004 Australia

Frank has posted up about TechEd 2004 in Australia. This year it is being held in Canberra so it should be easy for most folks on the east coast to get to. Its only about 20 minutes drive from my house. The developer track agenda that Frank posted looks extremely interesting.

If I were you I would start looking at flights as its going to get pretty congested at Canberra airport. Actually its close enough to Sydney and Melbourne that you might even consider a road-trip! We’ll just have to warn the service stations ahead of time that they’ll need to install wireless access points.

I wonder if Chuck and Frank have considered the shortage of wireless access points in Civic.

Finally Made It: Sydney .NET Users Group

I finally made it to the Sydney .NET Users Group last week (different to the Sydney Deep .NET User Group which I made it to earlier in the month). Adam Cogan was out of town so I didn’t get a chance to meet him in person but there were quite a few of his guys there to take up the slack. There was a good range of presentations – I even took a few notes.

One thing that I liked about the way the group kicked off was how the MC asked for any tips or tricks that folks had discovered over the past month. I know some of the other groups do the same thing but it worked really well this time. Cool.

While I was up at North Ryde I managed to catch up with Rose, Frank (happy thirteen years!), Caroline and Troy.

!RowChanged

Over the past couple of weeks I’ve been working a data validation framework. As part of this development effort I needed to listen to the events raised by DataTable instances in order to trigger automatic background validation. This validation would involve spinning through rows in the data-table and arriving at a result, flagging any errors along the way.

Unfortunately I started having problems when rows were added to the data-table and the RowChanged event got fired. You see, the RowChanged event fires BEFORE the data-table has the row added to it – I think that is kind of counter intuitive. Now its probably a bit late to change the .NET framework now, especially since there is probably a bit of code out there that relies of this behaviour, but I would like to see the addition of a number of events – like RowAdded, which only fires AFTER the data-row is accessible.

So, how did I work around it? Well, since this is really proof of concept code I had some scope to implement a bit of a dirty hack, and it goes like this.

public void InjectHack(DataTable dt)
{
  DataRowCollection collection = dt.Rows;
  Type collectionType = collection.GetType();
  FieldInfo fi = collectionType.GetField(
    “list”,
    BindingFlags.Instance | BindingFlags.NonPublic
    );
  ArrayList list = (ArrayList)fi.GetValue(collection);
  WrapperArrayList wrapperList = new WrapperArrayList(list);
  wrapperList.ItemAdded += new EventHandler(wrapperList_ItemAdded);
  fi.SetField(collection, wrapperList);
}

private void wrapperList_ItemAdded(object sender, EventArgs e)
{
  // Put the code you would expect to be able to
  // have in a handler for the RowChanged event.
}

// Filename: WrapperArrayList.cs
public class WrapperArrayList
{
  public WrapperArrayList(ArrayList list)
  {
    this.AddRange(list);
  }

  public override int Add(object value)
  {
    int index = base.Add(value);
    this.OnItemAdded(new EventArgs());
    return index;
  }

  public event EventHandler ItemAdded;
  protected void OnItemAdded(EventArgs e)
  {
    if (this.ItemAdded != null)
    {
      this.ItemAdded(this, e);
    }
  }
}

See what I mean by hack? It does work though, there are a few other ways to tackle this but they are all pretty hacky, and this is the one that I settled for. What it does is use reflection to grab the internal ArrayList that the DataRowCollection uses to store data-rows and replaces it with an instance of an ArrayList-derived class which overrides the Add method and raises an event at the right time.

I’d love to hear your ideas around a better way to do this.

Hey, look, I’m famous!

I was just setting a blog for a mate and at the same time was installing .Text for the first time. As I was reading through the instructions (gasp) I noticed this up the top of one of the sample Web.configs.

<!–
 PreBuilt Web.config for single blog site ( like
http://notgartner.com)
 
 You will likely only need to
  – rename the file to web.config
  – edit the Connectionstring (DbProvider below)
  – edit the email provider
  
  DELETE THESE COMMENTS WHEN YOU ARE DONE!  
–>

How cool is that, my blog has been immortalised in a Web.config file! Kind of gives me a warm fuzzy feeling, oh crap, thats the cup of tea I just spilt on my lap.

Sun and Microsoft sitting in a tree . . .

I know this is like “so” yesterday, but I thought I would post up my thoughts on the recent Sun/Microsoft love in. This one really took me by surprise, after years of complete zealotry from the Sun CEO this is the last thing that I expected.

Personally I think that Sun lost its marbles when they decided to make Microsoft regret “embracing and extending” the Java platform, and, at the same time jump off the Microsoft Research gravy train (remember, Microsoft at the time had one of the fastest JVM implementations around – not sure how it compares now).

I can’t help but think that Sun is in a death spiral and at some point in the future will be forced to bow out. For quite some time now I’ve felt that IBM is the industries Java powerhouse even more so now that Eclipse seems to be coming of age. It makes me think whether Eclipse could be a hospitable home for .NET developers (sets task in Outlook to pick through Eclipse souce) – but I digress.

One thing is for sure, it’s going to be interesting to see what this new era of cooperation between Microsoft and Sun will result in. I’m hoping for better tools and interoperability.

How do you organise your desktop? (and stuff)

Developers, like users, have preferences, and developers, like users, have an irresistible desire to configure their workstation according to their preferences, and thanks to desktop metaphor our computer screen, over time, accumulates junk. Kind of like the commas in the preceeding sentence.

In my job I get the opportunity to pair program with other developers and in the process am fortunate enough (sometimes) to see how they (dis)organise their windowing environment. How do you organise yours?

The first time I installed Windows 95 way back when, I have to admit that I spent a good few hours getting everything setup just so. There would have easily been more than twenty icons on the screen – but that’s nothing to some of the cesspools that I have seen now that screen real-estate allows for two A4 pages in word to be readable side by side. My desktop of old did have one thing in common with the desktops I am talking about however. They both tend to be glorified launch pads for applications – not the document-based utopia that we were all sold on years ago.

These days I tend to keep a simpiler desktop with just a few folders, the recycle bit, and any documents that I am currently working on (my production source code lives in a source code repository where it should). The apparent order in my life is of course a carefully constructed fabrication. Scracthing beneath the surface of my coarse chronological folder structure it’s easy to see the chaos.

Most months I easily generate and download in excess of one gigabyte of documents and source code, and that’s not even including the big ticket items like the Longhorn WinHEC bits. I’m definitely hanging out for WinFS to help me manage this complexity – if it can’t I might need to hire a PA. In the meantime I think I might give this thing that FrankArr found at CeBIT a try.

Brownie points go to the first person that figures out how to provide an integration point between WinFS and tools like VSS, Vault, CVS and SVN. It would be so cool to be able to do a search for “BUG10052” and have it bring back the revision before and after the fix was applied as well as any documents and e-mails that were associated with it. That sort of tight integration with the shell would probably result in much protesting from some quarters, but I think it would be just dandy.