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

Great hosting with Jumba

Elsewhere

On Identi.ca glenn: Just bought 6 months last.fm subscription, checking out the new beta version [follow me]

Top Rated Posts

Verse of the Day

Blessed be the God and Father of our Lord Jesus Christ! According to his great mercy, he has caused us to be born again to a living hope through the resurrection of Jesus Christ from the dead, to an inheritance that is imperishable, undefiled, and unfading, kept in heaven for you, who by God's power are being guarded through faith for a salvation ready to be revealed in the last time. (1 Peter 1:3-5, ESV) (Listen)

Networks & References

  • Awesomesause Approved
  • Contributor to: Newstex Blogs on Demand
  • TechTalkBlogs