Tech Ed Transportation

I really can't go the week without saying something about the people in charge of getting us from our hotels to the conference centre and back again.

The Buses run often and everyone is bending over backwards to help you get from A to B.

Two examples.

  1. I left the conference today to go to a Staples and stop in at the hotel for something. I got on a bus that was going to a hotel that was near the Staples.  I was the only one on the bus. The driver asked me which hotel, to which I replied I'm actually going to the Staples so I'll get off at which ever hotel is closest. He dropped me off right in front of the Staples.
  2. I was talking to the guy who handles the bus outside our hotel. I asked him when the next bus would go. If it was more then 20 min I was going to walk. He tells me it's going to be 10 minutes. So I said I was going to walk around Quincy Market for a few minutes and I would come right back. On my way back I see him running across the street to find me in the market to tell me the bus was here and ready to take me back.

That is good service. To all those in charge of transportation at Tech-Ed 2006. Thank you!

Tech Ed Key Note

It's Monday morning now. Last night we found Bruce and went to the Key Note. It's was interesting at times, mostly when Mary Lynn Rajskub from 24 came on stage. Barry of course claims that was his idea. ;) We left part way through the Key Note. Hit a pub downtown and played a couple of games of pool accompanied by a few beers.

So far my impression of Tech-ed is not wonderful. I have attended PDC 3 times, but this is my first tech-ed. I'll be honest it's not developer centric enough. I have never cared about supporting servers, Share point, operations or anything even remotely related to these subjects. It's just not my thing. I am very happy there are people out there who do this. Had I known finding a session on development would be like finding an Irish man in the coffee shop next door to the pub. I might have given it a miss. It's only Monday and we are in Boston (my favorite US city) so it will be a good week. I'm sure there will be plenty of sessions where I will learn something.

At the moment I am sitting in a session on Reporting Services Report Builder. It's good. I have been meaning to play with this new part of the product in a while. Today I got a push in the right direction.


Tech Ed

I'm in Boston attending Tech Ed 2006. I flew down with fellow ObjectSharpees Barry Gervin and Rob Windsor. We flew at a ridiculous time. (6:30 am) The Taxi woke me up at 4:30 with a phone call and I was out the door in about 2 minutes.

Flight was OK but the cab driver from the airport to the conference centre. Was an ass. He didn't take Visa. No cab driver should be allowed to work the airport if they don't take Visa. I thought we were going to fight right there on the steps of the Conference centre. I paid him his precious cash while he ranted and raved like an idiot. “Welcome to America”

I'm going for a nap. Tonight at 7 PM is the Keynote. We should hook up with Bruce, John and Jen-Luc then.

The Never Ending Load Test

Ways to mess up your Team System Tests...

In Visual Studio Team System you can create a Manual Test, which is a great tool I know many people will ignore but that is for another Blog entry.  You can also create a Load Test and the developers were smart enough to filter out Manual Tests. This was clever because a manual test, while processing stops to ask you to perform the test and record the result. This would stop the load test and completly mess up any data you are trying to gather.

However you can still add a Manual Test to your Load Test by putting it in an Ordered Test first. So if your Load test seems to have stopped check to see if someone added a manual test to one of your ordered tests.


Developer Night in Canada

One of my Partners in Objectsharp John Lam was interviewed on Developer Night in Canada. It's a good interview.

If you have heard about Ruby and your curious about it you should listen to it.

Tech Support

If you are a mechanic people ask you about their car, if you are a lawyer they ask you legal advise, if you are a doctor they have a pain. I remember a day when being a programmer meant no one talked to you about your work. This is because they didn't understand it. If you said you were a programmer the standard reply was. “Good for you that sure is the up and coming business to be in.”

I remember complaining that I couldn't go to a party and talk about what I did, unless I met another programmer. No one wanted to hear it. Then along came the Personal Computer. Suddenly everyone knows what Ram is.  Now when someone finds out you are a developer they all want to talk to you about pop-ups, viruses, networks you name it. Perhaps the old days were not so bad. :)

The reality is, I don't mind helping out my friends and family at all. I'm happy to be able to talk to people about what I do. This way I can trade computer help with some skills I need help with.

As a matter of fact I recently helped my wifes boss out. He sent me this and this, I got a chuckle out of them. I thought I would pass them along to anyone else who has helped someone they know with their computer.

The Movie Business

This past weekend I spent 5 days on a movie set. This was not in Hollywood, but rather on a farm north of Harriston, ON. Its a production being created by York University students called “The Great Fear“. Why was I there you ask? Well, my son was one of the actors in the movie. Less then a year ago he told me he wanted to be an actor. Well this 11 year old made his dream come true in less then a year. I'm so proud of him, but that is another story.

Like most people I have watched the Oscars waiting like most people for the Best Actress and Best Actor categories to be presented. Scoffing at the set design, lighting, sound, costume, makeup, and camera people. Just to mention a few. Not to mention all the people who setup, tear down, move, get, send, lift, cook, run the list goes on and on.

I always knew it took a lot of people to make a movie and I think, I thought, I appreciated them. Until you actually see it in action you have no idea.

The people working on creating “The Great Fear” worked their butts off. They take their craft very seriously and it was great to see young people so passionate about something.  I cant wait to see the final product.

To everyone I met last weekend. You have enhanced Gareth and my lives in more ways then you will ever know. Thank you!

I took some pictures, if you like you can see them here.

The DataSource Attribute

You can use the DataSource attribute to call your TestMethod multiple times with different data each time.

Lets say for example I have an order details table like the one in Northwind.

  • OrderId
  • ProductId
  • UnitPrice
  • Quantity
  • Discount

In your application somewhere you have a method that calculates the cost of an item. Given the OrderId and ProductId it will return the Price for that line item. You want to write a test for this method, easy enough.

<TestMethod()> _
Public Sub TotalPriceTest()
Dim price As
Dim MyDac As New

    price = MyDac.getTotalPrice(10329, 38)

    Assert.AreEqual(price, CDec(4005.2))

End Sub

The problem is this test only tests one particular row. What about the case where there is no discount. I guess we have to write another unit test with a different orderId and productId. Hey we could create a file that contains a bunch of variations and then write a loop in the unit test to go through each one.


We could use a DataSource Attribute along with the TestContext Class.

When you add the DataSource Attribute to a TestMethod it will retrieve all the rows from the table identified for that connection and call your testmethod for each row. Inside your TestMethod you can use the TestContext Object to get information about the current test run. ie: the DataRow. Take a look at the example below.

<TestClass()> Public Class DataTests

  Private testContextInstance As TestContext

  '''Gets or sets the test context which provides
  '''information about and functionality for the current test run.
  Public Property TestContext() As TestContext
      Return testContextInstance
   End Get
   Set(ByVal value As TestContext)
     testContextInstance = Value
   End Set
  End Property

  <TestMethod()> _
  'DataSource Attribute to get the Data from Northwind -> OrderDetailTestData
"Data Source=localhost;Initial Catalog=Northwind;Provider=SQLOLEDB;Integrated Security=SSPI;", "OrderDetailTestData")> _
  Public Sub OrderDataTest()
    Dim price As Decimal
    Dim expectedPrice As Decimal
    Dim MyDac As New MyWindowsApplication.MyDac

      'Use the TestContext Object to get the current DataRow for the current test run
      price = MyDac.getTotalPrice(
CInt(Me.TestContext.DataRow("OrderId")), CInt(Me.TestContext.DataRow("ProductId")))
      expectedPrice =

      Assert.AreEqual(price, expectedPrice)

  End Sub

End Class

Now just populate the OrderDetailTestData table with all the different data you want to pass through your method.

Delegates Delegates

Here is something you may not have noticed before.

I'm sure you have utilized the following code to create an event handler in your code.

VB.NET  AddHandler MsgArrivedEvent, AddressOf My_MsgArrivedCallback
C#      MsgArrivedEvent += new MsgArrivedEventHandler(My_MsgArrivedEventCallback);

I have found it quite useful to create a method called AddHandlers and one called RemoveHandlers. This way I can easily turn on and off event handling. It's very nice when handling events like ColumnChanged in a Dataset. When I want to push data into the Dataset without the events firing I can just call RemoveHandlers. Then when I'm done call AddHandlers. It's analogous to enforceconstraints.

Here is an example in VB.

Public Sub AddHandlers()
   With Me
      AddHandler .Order.ColumnChanged, AddressOf Me.onOrderColumnChanged
End Sub

Public Sub RemoveHandlers()
With Me.OrderEntity.OrderData
      RemoveHandler .Order.ColumnChanged, AddressOf Me.onOrderColumnChanged
   End With
End Sub

If you use something like this be careful. Why you ask? You could turn Handlers on twice in a row inadvertently.

For example:
From the columnchanged event handler you call CalculateTotal which will RemoveHandlers, total the items, recalculate the tax, and then call AddHandlers.
Also from the columnchanged event handler you call CalculateTax which needs to RemoveHandlers, total the taxes for all items, and then call AddHandlers.
How clever of you to reuse the code in CalculateTax. pseudo code sample below.

CalculateTotal( amount )
  'Total values
  if taxable

CalculateTax( amount )
  'Calculate tax

The problem with this scenario is it will call RemoveHandlers twice then AddHandlers twice. The side effects are:

  1. Two handlers get added to the event, therefore the handler will be fired twice each time the event fires. 
  2. You may not have noticed to double event firring. If may call Removehandlers in another method and assume the handlers are turned off, but there is still one handler so RemoveHandler fixed problem one :) but your handler is not disabled like you thought.

There is one simple solution so you don't have to worry about it. Call RemoveHandlers at the beginning of AddHandlers.

Or be more careful.

VS 2005 Start Page

Did you know that the Start page in VS 2005 will display RSS Feeds? 

Try this in VS 2005:

  • Select Tools - Options on the menu.
  • Navigate to Environment - Startup.
  • In the Start Page News Channel textbox paste the following:

Now your start page will be all the ObjectSharp Consultants most recent Blogs. Lucky you!