Mathias Brandewinder on .NET, F#, VSTO and Excel development, and quantitative analysis / machine learning.
26. January 2009 13:54

Since forever, I have lived perfectly happy without a TV. And then came Hulu, which made me an addict. I love that I can watch what I want, when I want it, and I simply feel more at home browsing and searching than sitting in front of a tube with a remote - a matter of generations and geekiness, I guess. Which brings me to my point: when I went there today, I found the following message:

This note, however, is not about the fact that episodes of ''It's Always Sunny in Philadelphia'' were taken down. Rather, this note is to communicate to our users that we screwed up royally with regards to _how_ we handled this specific content removal and to apologize for our lack of strong execution. We gave effectively no notice to our users that these ''Sunny'' episodes would be coming off the service. We handled this in precisely the opposite way that we should have. We believe that our users deserve the decency of a reasonable warning before content is taken down from the Hulu service. Please accept our apologies.

Respect to Hulu, not for messing up (which happens to everyone), but for owning up to it, in straightforward language, instead of the usual obfuscation most corporations opt for in this type of situation. This kind of radical transparency is refreshing.

13. January 2009 05:58
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.
10. January 2009 17:43

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.

6. January 2009 19:05

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.

5. January 2009 14:56

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.