Resharper Templates


I like and use Resharper because it is cheaper than CodeRush and I don't have to remember as many key commands most things are done with an alt + enter. It also works well with Unit Testing and for more yummy goodness with testing download JP's templates for Resharper.

livetemplates.xml (14.74 KB)

filetemplates.xml (3.79 KB)

Wildwood Campsites


Just finished with a client’s website, I am pretty happy with it and so are they.

Few things that where fun was implementing a "Get Directions," Map with Microsoft Virtual Earth and a Silverlight picture viewer. I have worked with the Google maps api in the past it wasn't bad, but I hate the registration it makes it a pain to move and reuse. I found virtual Earth API far superior with great examples. I was able to get something cool up and working with little Java Script experience. The picture viewer I did not code from scratch, was offering it for free as a Beta version; although it didn't work I was able to fix it by digging around in the source code. I am really excited to see what the web will look like coming up with and Silverlight 2.0

I love my job


I love my job it's the best job in the America.

Configuration System Failed to Initialize


Problem: Your application contains User Scope Settings and you receive the exception.

“Configuration system failed to initialize” when attempting to retrieve these settings.

Solution: The settings file has been corrupted and is unreadable. Close or stop your application and delete the user.config file. The file is located at:

C:\Documents and Settings\[UserName]\Local Settings\Application Data\[AppCompany]\[AppName] \[AppVersion]\

If you are in Visual Studio you can easily find the exact file that is causing the problem by viewing the details and drilling down to the inner exception to find the file name.

Automate ClickOnce with Nant


Problem: You need to deploy a clickonce enabled application using NAnt script.


Solution: Use the MSBuild, version, exec and copy tasks from the NAnt, and NAntContrib Projects.


            When using the clickonce publish wizard, the wizard does some neat things for you. First it increments the version, builds the project then it generates some manifests, signs the manifests, generates a default html page, creates a setup.exe and finally copies all the needed files to your deployment location. This great up until you want to automate this build process and you find out not all of these tasks are being handled in msbuild.


Incrementing Version with NAntContrib task version. I also like to automatically update and commit this version number (the file build.number) so that everyone on the team is on the same page.



Use the MSBuild task from NAntCotrib on the project that is setup for clickonce deployment and use Publish as the target. This will build the project, generate the manifest, sign the manifest, and create the setup.exe. This will not generate a default.htm page; you must create this by hand. I just create a page using the generated page as a template and the application manifest as a datasource to get current build information.


 <!--Get the latest buld number from repositiory-->
<target name="versioning">
<exec program="svn.exe" basedir="tools\svn" 
commandline="up build.number 
--username username 
--password password 
<!--Increment buld number-->
<version buildtype="NoIncrement" revisiontype="Increment" />
<!--Commit buld number to repositiory-->
<exec program="svn.exe" basedir="tools\svn" 
commandline="commit build.number 
-m AutomatedCommit 
--username username 
--password password 


Finally I just copy the files to the production server.


<!--Copy production files to the server-->
<target name ="publish.clickonce"> 
  <copy todir="${Production.dir}">
    <fileset basedir="${ClickOnce.dir}">
      <include name="**/*" />

Complete Source: This contains everything I used for the example the click once hello world project, my project tree, build tools, and build file. (3.93 MB)


How to create a SelfCert .pfx file to sign manifest.

ClickOnce on Multiple Environments

Versioning Using NAnt



Interview Questions - Fibonacci


I found a interesting interview questions that is most likely a bit over done, but I still like it, it reminds me of my intro to programming classes from back in the day, which for me was only about 5 years ago. This one concerns the Fibonacci Numbers. The problem is write the Fibonacci Sequence without Recursion. With Recursion the fib sequence is relatively easy:

public static int GetFibValueRecursive(int place)
     if (place <= 0) return 0;
     if (place == 1) return 1;
     return GetFibValueRecursive(place - 1) + GetFibValueRecursive(place - 2);

First step to this problem I would write a test to make sure my code is correctly solving the problem.

public void GetFibValue_GivenPlace_ReturnCorrectValue()
     Assert.AreEqual(0, Fibonacci.GetFibValue(-1));
     Assert.AreEqual(0, Fibonacci.GetFibValue(0));
     Assert.AreEqual(1, Fibonacci.GetFibValue(1));
     Assert.AreEqual(1, Fibonacci.GetFibValue(2));
     Assert.AreEqual(34, Fibonacci.GetFibValue(9));
     Assert.AreEqual(144, Fibonacci.GetFibValue(12));           

Then the code.
public static int GetFibValue(int place)
     if (place <= 0) return 0;
     int previous = -1;
     int result = 1;
     for (int i = 0; i <= place; ++i)
         int sum = result + previous;
         previous = result;
         result = sum;
     return result;

Bam! The Fibonacci Sequence without recursion of course if you wanted more than just a value for given place I would write it a little different perhaps return a list of values instead of a single value. (71.66 KB)

General C# Questions


One of my career goals as a developer is to work for Microsoft, now that I have graduated school and have 2 years of development experience I am going to start actively perusing this goal. The word on the street is that the interview process for Microsoft positions is not easy. To prep for interviews I am trolling the web looking for possible interview questions and posting my answers. To start off I found these general questions on C#.

1. What is metadata? What information is stored in Metadata?

Metadata describes every type and member defined in your code in a language-neutral manner. It stores the description of the assembly, description of types, and the attributes

2. What are some of the Tables stored in metadata?

Each metadata table holds information about the elements of your program. For example, one metadata table describes the classes in your code, another table describes the fields, and so on. If you have ten classes in your code, the class table will have tens rows, one for each class. Metadata tables reference other tables and heaps. For example, the metadata table for classes references the table for methods.

3. What are the two basic kinds of types in .net framework?

Two basic kinds of types are value types and reference types.

4. What is boxing and unboxing?

Boxing a value type packages it inside an instance of the Object reference type, unboxing is the reverse.

5. What class does all classes implicitly inherited from?


6. What is namespace, assembly?

Namespace declares a scope that lets you organize code and gives you a way to create globally unique types. An assembly is a collection of types and resources that are built to work together and form a logical unit of functionality.

7. What is global assembly cache, what is the purpose?

The global assembly cache stores assemblies specifically designated to be shared by several applications on the computer.

8. What are Primitive types?

Any data types directly supported by the compiler are called primitive types. Primitive types map directly to types that exist in the base class library.

9. What is reflection?

Reflection allows the inspection of metadata in a PE file and late binding (run time) to types and their members.

10. What is a delegate?

A delegate is a type that references a method with the same signature.

11. Describe the accessibility modifier “protected internal”.

Access is limited to current project or types derived from the containing class.

12. What does the term immutable mean?

It's simply a class that’s state does not change after it was initialized.

13. What’s the difference between System.String and System.Text.StringBuilder classes?

StringBuilder class represents a mutable string of characters. System.String is immutable.

14. What’s the advantage of using System.Text.StringBuilder over System.String?

A StringBuilder object is preferable for a concatenation operation if an arbitrary number of strings are concatenated; for example, if a loop concatenates a random number of strings of user input.

15. Can you store multiple data types in System.Array?

No, array objects with the same array type share the same Type object.

16. What’s the difference between the System.Array.CopyTo() and System.Array.Clone()?

CopyTo() is a deep copy that copies the values. Clone() is a shallow copy that copies only the elements of the Array.

17. What’s the .NET collection class that allows an element to be accessed using a unique key?

System.Collections.Hashtable or System.Collections.Generic.Dictionary, I prefer the Generic Dictionary it is faster.

18. Will the finally block get executed if an exception has not occurred?


19. Can multiple catch blocks be executed for a single try statement?

No, the order of the catch clauses is important because the catch clauses are examined in order. Catch the more specific exceptions before the less specific ones.


DotNetNuke Upgrade - My Rant


I have been using DotNetNuke for a year or more now mostly for personal fun projects but I have setup a site for a family business using DNN, nothing explosive and shinny but it has served its purpose. I manage 2 different DotNetNuke installations and I have to say upgrading DNN application (not the modules) is scary. I have yet to do it successfully on my first try. Here are my steps to failure:

1. Backup my SQL Server as well as my site files. This is the most important step because the fallowing steps are sure to fail.

2. Download the latest install or upgrade package for your DotNetNuke application. I have tried upgrading using both the upgrade and install packages with equal success err failure... successful failure?

3. Create an app_offline.htm with some generic text stating that you are doing maintenance on the site blah blah blah.

4. Rename your current web.config to web.config.old

5. Copy contents of the install/upgrade package to your DNN application folder.

6. Rename release.config to web.config.

7. Merge your old web.config with the new web.config. The areas to merge are: Connection Strings, MachineKey, and the codeSubDirectories. I also like to set AutoUpgrade key too false so nobody but me will trigger the installation.

8. Now I navigate to [Domain Name]/install/install.aspx

9. After I watch the list of Successful, or sometimes on Friday and the moon is full I will get a failure, I navigate to my home page of my DNN application to view the wonderful yellow screen. The error displayed is usually different every time or a different flavor of the same variety "Object Null Reference" being my favorite for its descriptiveness [insert sarcasm].

The good news and one of the reasons that I like DNN is it has a great community and I have fixed every problem with the help of people on the forums. Also once it is updated and running it is a solid application and very easy to extend and write custom modules for. I just wish for a one click update and BAM you are getting your "real" work completed. Anyway my SQL Server and root files are done restoring, time for try number two.

Note: Currently DotNetNuke was on version 4.8.2 when I wrote this.

Here are a few tutorials on upgrading your installation: 1 2

Guild Wars vs Lord of the Rings Online vs World of Warcraft


This post is just some vague rambling on game mechanics and character generation I am only writing it because I graduated finally with my BS degree  and I have declaired this month of the game.

I have been trying to nail down the most important part of a character in LOTRO. So in order to do this I have been comparing it to the other MMOs that I have played.

World of Warcraft: Gear gear gear. Basically everyone in the same class has the same amount of points to spend on the same skills/traits. The only thing left to diversify your character was the gear. This makes for a very addicting game specially when most of the good gear is on "X" mob located at the End of "X" dungeon and it only has a 5% drop rate and you need 15 people to get it. I think I did Upper Black Rock Spire 30+ times trying to get my Valor chest plate. That instance was about an  hour long not to mention it took about 30mins just to get a group, so I probly spent 30+ hours for one piece of equipment which I never got. Sounds like bitching but I still had fun doing it.

Guild Wars: Skill Combos. The best description I have herd for character development in Guild Wars was comparing it to a Collectable Card Game (CCG) like Magic. The Equipment was very easy to Acquire and did not give your character a major advantage. It was all about the skills and there where a million and once at the level cap everyone had the same amount of Attribute points (i.e. str, int). It was basically trial and error trying to get a cool combination of skills for the role you wanted to accomplish. You built your character like you would build a CCG deck you had 5 skills to pick out of a few hundred then adjust your gear and attributes to match the skills gimmick you where going for. It was very fun game pvp was 100x more balanced than wow and was based more on your skills instead of I have been to MC 200 times so I have the current best gear. But it didn’t have the same social feel to it that wow did, I didn’t randomly run into the guy I use to grind with at level 15 or that retarded healer I always got stuck with when grinding UBS.

LOTRO: Lord of the rings characters are driven with traits the gear is important but it comes second. The traits are acquired by grinding mobs, doing x number of quests in an area, exploring regions, or given in quest rewards. Some traits are available to everyone, some only to a given Race, some only for given class. Gear is pretty easy to come by compared to WoW. The best gear is acquired through quests, crafting, or Reputation grinding. In the end when you are at the level cap it all comes down to if you can play, all players are diverse in there equipment and build but more or less equally effective (unless you are retarded or cant read English) there isn’t much of an Elitist factor.


World of Warcraft Likes: Because of the gear driven nature the economy for WOW was HOT. The Auction House was always on fire, it was a game in its self buying low selling high. Also It was really rewarding once you finally got that set of armor or that kick ass weapon you have been trying to get for the past month or two.

World of Warcraft Dislikes: Competitive/Elitist nature. You can tell from a mile off who is the noob and who is the shit this was a turn off for me because I am not online 24 hours a day but I am competitive it was a hard pill to swallow knowing I couldn’t enjoy all aspects of the game because I was on the more casual side of the players. Casual meaning I played at least 4 hours a day for over a year! There isn’t really an engaging story line.

Guild Wars Likes: It has a story! The level grind is really easy or non existent if you just want to pvp. Finding and capturing skill is fun. You can change your character play style at a whim given the role you want to fulfill.

Guild Wars Dislikes: Being that it isn’t really a Full MMORPG it is missing some of the basics like an Auction House and the ability to link Items in chat. I also like having some non-instanced areas that you can play in. It can be fun to randomly run into some one and group up.

LOTRO Likes: I like the story, the middle earth lore, engaging environments. It’s full of non essential fluff that has no other purpose than just being fun. It’s a very casual player friendly game. I really love just exploring in this game I have had some of the best experiences I have ever had in an mmo just wondering around in this game.

LOTRO Dislikes: PVP kind of sucks, the auction house is not really active and deed grinding can get old. Other than that it’s my favorite so far.



Problem: You are using Select Method to retrieve rows from a typed DataTable and you keep getting the fallowing exception:

System.Data.EvaluateException: Cannot perform '=' operation on System.String and System.Int32.

This isn't the most helpful error message.

Solution: You are missing hyphens.



CustomerRow[] rows = Select(string.Format("LastName = {0}", LastName)) as CustomerRow[];


CustomerRow[] rows = Select(string.Format("LastName = '{0}'", LastName)) as CustomerRow[];