Best-of the PDC comes to San Francisco

If you missed this year’s Microsoft Professional Developer Conference (like me) and live in the San Francisco area, you got a second chance. On February 23rd, the MSDN Developer Conference (MDC) will deliver the core message, content, and experience of the PDC in a one-day, multi-track event. Cloud computing, Azure, Live Mesh, WPF 4.0, Silverlight, Parallel Programming… all the latest bleeding-edge stuff will be there - and you’ll even get a free copy of Windows 7 Beta! More on the event here, and registration info here.

More...

Education Day - Creating WPF Line of Business Applications (MVVM) Using C# and VB.NET

If you want to bring your WPF skills to the next level, you don’t want to miss this all-day event! Bay.Net, the San Francisco Bay Area .NET user group, will have two rock-stars coming all the way from Microsoft, in an exciting workshop, with plenty of time dedicated to hands-on lab time.

Click here for the full event information!

More...

The Last Cell in an Excel Worksheet

I am currently working on an application which requires reading the contents of an Excel worksheet into a 2-dimensional array. I want to avoid loading the entire contents of the worksheet, and want to read only the upper-left quadrant, and leave out all the empty cells on the left and the bottom of the sheet. Problem is, how do you find out the last cell that contains something, that is, the cell such that no cell below it or on its right has content? Everything Google turned up looked pretty nasty - either brute force, or acrobatic usage of Excel functions, until I stumbled across this little gem:

var lastCell = xlWorksheet.Cells.SpecialCells(
    Microsoft.Office.Interop.Excel.XlCellType.xlCellTypeLastCell, 
    Type.Missing);

You learn everyday.

More...

A case of identity

I love the class System.Guid, because it has made my life so much easier; whenever I need a unique identifier on a class, I pop in a Guid, and get code which looks something like:

public class Customer
{
    public Guid CustomerId
    {
        get;
        private set;
    }
}

However, I (painfully) realized today that this also required a bit of discipline. If you have code like this:

public void SetPrice(Guid productId, Guid customerId)
{
    // do something here
}

… and have a change of heart about the order of the arguments, you’d better do that carefully, because everything will still compile just fine, even if you don’t update the places where that method is called - and figuring out in debug mode what is not working can turn into quite an unpleasant experience. This is one case where you will be REALLY happy to have unit tests in place.

More...

Diversification and correlation

Dilbert is one of my favorite comic strips ever. Besides being consistently very funny, it is also surprisingly insightful. Today’s strip is an excellent illustrations of why diversification alone is not necessarily sufficient to reduce risk: one has to account for correlation between the assets.

Dilbert.com Source: Dilbert.com

More...