04.11.09
Problem: You try to open a .mdf file in visual studio and you get one of the following errors.
Connections to SQL Server files (*.mdf) require SQL Server Express 2005 to function properly. Please verify the installation of the component or download from the URL: http://go.microsoft.com/fwlink/?LinkId=49251
Failed to generate a user instance of SQL Server due to a failure in starting the process for the user instance. The connection will be closed.
Solution: Open Server Explorer add Data Connection. Make sure the Data Source = Microsoft SQL Server Database File (SqlClient) and browse to the .mdf file located in your source directory(There maybe on located in the bin directory but this will get copied over by what is in src on a build). Click the Advance button. In order to work I needed to switch the Data Source to .\SQLEXPRESS2005 (This will be different for each computer).
Final connection string should look something like this:
Data Source=.\SQLEXPRESS2005;AttachDbFilename=|DataDirectory|\NerdDinner.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True


04.10.09
Problem: You want to be able use the Ninject frame work with the new and shiny ASP.Net MVC framework.
Solution: Assembly: Ninject.Framework.MVC Contains an Abstract Base class you can Inherit from to do most of your heavy lifting.
Some Code
Global.asax.cs
public class MvcApplication : NinjectHttpApplication
{
private static IKernel _kernal;
protected override void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute("Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Home", action = "Index", id = "" } // Parameter defaults
);
}
protected override IKernel CreateKernel()
{
if (_kernal == null)
{
var modules = new IModule[]
{
new AutoControllerModule(Assembly.GetExecutingAssembly()),
new DemoModual()
};
_kernal = new StandardKernel(modules);
}
return _kernal;
}
}
02.18.09
Warning this my understanding as of today, who knows what tomorrow will bring.
I often hear the terms Inversion of Control(IOC), Dependency Injection(DI) and the Strategy Pattern thrown around in the same context, this was getting really confusing for me. So, I spent a couple of hours trying to clarify the differences.
IOC vs DI: Basically DI is a type of IOC. IOC is a broad abstract principle that covers not only DI but Event-Driven programming and numerous others.
So What is DI? DI is the way you provide the implementation for a dependent service. There are a number of DI frameworks out there I have recently been playing with Ninject mostly because I like ninjas... and the flow syntax for wiring up the dependencies looks nice.
DI vs Strategy Pattern: For a while now I have been using the Strategy pattern thinking it was the same as DI. I know, "Gosh such an idiot :p", but DI assembles the appropriate algorithms for the calling class. Strategy is just one of the patterns that lends itself well to DI.
More Info:
Dependency injection
Inversion of control
Inversion of Control Containers and the Dependency Injection pattern by Martin Fowler
Inversion of Control vs Strategy Pattern
IoC containers are not about a design pattern
Thank you, Eric Ridgeway for answering my 200 questions.
02.17.09
Problem: After deploying your silverlight application to your Web server you get the following error.
Error: Unhandled Error in Silverlight 2 Application Code: 2104 Category: InitializeErrorMessage: Could not download the Silverlight application. Check web server settings Source File: TestPage.htmlLine: 53 Solution: The MIME types on your webserver are not setup correctly to host your silver light application. The MIME types needed are:
.xaml application/xaml+xml
.xap application/x-silverlight-app
.xbap application/x-ms-xbap
Hack: If you are like me and have your silverlight hosted on a shared hosting environment like godaddy you cannot change your MIME types. Instead change the .xap to .zip you must also change the source parameter value inside your page to match.
<object data="data:application/x-silverlight," type="application/x-silverlight-2" width="100%" height="100%">
<param name="source" value="Microsoft.Windows.Controls.Samples.zip"/>
<param name="onerror" value="onSilverlightError" />
<param name="background" value="white" />
<param name="minRuntimeVersion" value="2.0.31005.0" />
<param name="autoUpgrade" value="true" />
<a href="http://go.microsoft.com/fwlink/?LinkID=124807" style="text-decoration: none;">
<img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="Get Microsoft Silverlight" style="border-style: none"/>
</a>
</object>
02.05.09
I just joined twitter I have played around with it before and never understood the appeal. Well I understand now you really need a good client app, I use TweetDeck. After that its all about the search, people use "hash codes" to assign categories to there tweets(cool kid lingo for messages on twitter). e.g. #Seattle doing a search on this hash forms a pseudo chat room then you just add #Seattle to any messages you want to show up. Its a lot of fun.
Scott has a good guid on twitter
My Twitter
Search on a topic:


Send tweets on this topic:

See whats going on:

02.04.09
Problem: You need a quick and easy way to manipulate elements contained in a list.
Solution: Lambda Expression, these expressions are used in the same fashion you would use anonymous methods but are less wordy.
Anonymous methods:
employees.FindAll(delegate(employee e1)
{
return e1.Name == "Dave";
})
Lambda Expression:
employees.FindAll(e1 => e1.Name == "Dave");
employees.Sort((e1,e2) => e1.LastName.CompareTo(e2.LastName));
For more complex expression use the syntax like (params) => {statment}.
employees.Sort((e1, e2) =>
{
if (e1.LastName.CompareTo(e2.LastName) == 0)
{
return e1.FirstName.CompareTo(e2.FirstName);
}
else
{
return e1.LastName.CompareTo(e2.LastName);
}
});
For more Info: MSDN
06.12.08
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)
06.12.08
Just finished with a client’s website www.wildwoodcampsites.com, 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, dnntemplet.com 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 Flex.org and Silverlight 2.0
06.11.08
I love my job it's the best job in the America.
05.23.08
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.

