Development on a Shoestring

Archive for September, 2007

Tumblelog

I’ve started a Tumblelog in an attempt to post more regularly.  I’m finding that I’ve got a lot of stuff that I want to post, but not much to say about it, so this is a solution.  I’m going to keep this blog for more lengthy posts and post the incidental stuff to the Tumblelog

For an explanation of what a tumblelog is, I defer to Wikipedia:

A tumblelog is a variation of a blog, that favors short-form, mixed-media posts over the longer editorial posts frequently associated with blogging. Common post formats found on tumblelogs include links, photos, quotes, dialogues, and video. Unlike blogs, this format is frequently used to share the author’s creations, discoveries, or experiences without providing a commentary. One of the many tumblelog services is tumblr.

There’s an RSS feed you can subscribe to which will also include the link blog links.  I’ll probably phase out the link blog feed if everyone goes with the Tumblr feed.  The only downside is that Tumblr doesn’t do comments yet, but apparently they’re on the todo list.

Nullable types & lazy loading FTW

Visual Studio 2005 & .NET 2.0 introduced a bunch of new concepts to .NET development, probably the most well known being Generics. One of the possibly less well know & certainly less well understood was the introduction of nullable types, specifically nullable value types. 

For the uninitiated, I’ve got a very brief intro below.  Here’s a more in-depth article on Nullables.

Value types (int, long, float, double, etc.) are not able to be set to a null value, they’re set to their default value (for numeric value types this is 0).  To make an int nullable, you append the type with a question mark, i.e. int? This means that you can now do this:

   1:  int? x;
   2:  //Some processing
   3:  if (x == null)
   4:  {
   5:      //Do something
   6:  }

Actually the nullable type wrapper gives you a more elegant way of checking for null with the HasValue property. All nullable types have this property & if the object is not null it will be true.  The nullable type specification is actually a bit of syntactic sugar: int? is just a compiler shortcut for the real Nullable type of Nullable<int>.

Right, nifty, but so what? How do we use this? Well a simple use is when you need to pass through an optional value to a SQL Server stored proc. Previously you’d have to write an overloaded version of the method that didn’t have the optional parameter and just create a null sql parameter for the command. With a nullable int, you can just pass the parameter through as null.

(more…)

Subscribe by email

Enter your email address:

Delivered by FeedBurner

TweetDeck, you need a minimise to tray option

Tuesday 10:13

Verse of the Day

Put on then, as God's chosen ones, holy and beloved, compassionate hearts, kindness, humility, meekness, and patience, bearing with one another and, if one has a complaint against another, forgiving each other; as the Lord has forgiven you, so you also must forgive. And above all these put on love, which binds everything together in perfect harmony. (Colossians 3:12-14, ESV)