Archives / 2010 / May
  • TechEd 2010 Important Events

    If you’ll be attending TechEd in New Orleans in a couple of weeks, make sure the following are all on your calendar:   Party with Palermo – TechEd 2010 Edition Sunday 6 June 2010 7:30-930pm Central Time RSVP and see who else is coming here.  The party takes place from 730pm to 930pm Central (Local) Time,  and includes a full meal, free swag, and prizes.  The event is being held at Jimmy Buffett’s Margaritaville located at 1104 Decatur Street.   Developer Practices Session: DPR304 FAIL: Anti-Patterns and Worst Practices Monday 7 June 2010 4:30pm-545pm Central Time Room 276 Come to my session and hear about what NOT to do on your software … more

  • Don’t Throw Duplicate Exceptions

    In your code, you’ll sometimes have write code that validates input using a variety of checks.  Assuming you haven’t embraced AOP and done everything with attributes, it’s likely that your defensive coding is going to look something like this: public void Foo(SomeClass someArgument) { if(someArgument == null) { throw new InvalidArgumentException("someArgument"); } if(!someArgument.IsValid()) { throw new InvalidArgumentException("someArgument"); }   // Do Real Work } Do you see a problem here?  Here’s the deal – Exceptions should be meaningful.  … more

  • REST to Objects in C#

    RESTful interfaces for web services are all the rage for many Web 2.0 sites.  If you want to consume these in a very simple fashion, LINQ to XML can do the job pretty easily in C#.  If you go searching for help on this, you’ll find a lot of incomplete solutions and fairly large toolkits and frameworks (guess how I know this) – this quick article is meant to be a no fluff just stuff approach to making this work. POCO Objects Let’s assume you have a Model that you want to suck data into from a RESTful web service.  Ideally this is a Plain Old CLR Object, meaning it isn’t infected with any persistence or serialization goop.  It might look something like this: … more

  • Could not load type System.Configuration.NameValueSectionHandler

    If you upgrade older .NET sites from 1.x to 2.x or greater, you may encounter this error when you have configuration settings that look like this: <section name="CacheSettings" type="System.Configuration.NameValueFileSectionHandler, System"/> Once you try to run this on an upgraded appdomain, you may encounter this error: An error occurred creating the configuration section handler for CacheSettings: Could not load type 'System.Configuration.NameValueSectionHandler' from assembly 'System.Configuration, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. Microsoft moved a bunch of the Configuration related classes into a … more

  • Custom Configuration Section Handlers

    Most .NET developers who need to store something in configuration tend to use appSettings for this purpose, in my experience.  More recently, the framework itself has helped things by adding the <connectionStrings /> section so at least these are in their own section and not adding to the appSettings clutter that pollutes most apps.  I recommend avoiding appSettings for several reasons.  In addition to those listed there, I would add that strong typing and validation are additional reasons to go the custom configuration section route. For my ASP.NET Tips and Tricks talk, I use the following example, which is a simple DemoSettings class that includes two fields.  … more

  • Shared Folders in VirtualBox on Windows 7

    In my adventures with VirtualBox, my latest victory was in figuring out how to share folders between my host OS (Windows 7) and my virtual OS (Windows Server 2008).  I’m familiar with VirtualPC and other such products, which allow you to share local folders with the VM.  When you do, they just show up in Windows Explorer and all is good.  However, after configuring shared folders in VirtualBox like so:   I couldn’t see them anywhere within the machine. Where are Shared Folders in a VirtualBox VM? Fortunately a bit of searching yielded this article, which describes the problem nicely.  It turns out that there is a magic word you have to know, and that is … more