"Done is better than perfect."


FluentNHibernate SchemaUpdate not working on Azure (FIX)

I was trying to update a schema on an Azure database using FluentNHibernate but I was getting an error while trying to alter a table with existing records (while it was working fine adding new tables). To fix it: Change the MsSqlConfiguration from whatever you are using to MsSqlConfiguration.MsSql2008 and Azure will like it.




Form post mixing AngularJs and Razor

The AngularJs validation is simple and straightforward to use, here’s a typical Razor form using the AngularJs MVVM model. The bit of javascript to init the $scope. We convert the model to json an assign it to a js variable in order to make it available to the $scope: The action on the controller stays […]




Change owner schema for all database tables

Had this issue when restoring an Umbraco database created under a different user. This will alter the schema owner on all tables of the target database.




Resharper vs JustCode vs CodeRush

In case you wonder: Resharper wins hands down. During my last contract, the devs godsent tool (read Resharper) wasn’t available for some reasons (read £££), so I decided to try out the 1 month evaluation offered by each of its main competitors. But not before first trying Resharper itself (one month trial here too), so here’s the conclusion: […]




Nice to have Visual Studio extension

Below a shortlist of the Visual Studio extensions I like the most: CodeMaid – Open source to cleanup, dig through and simplify your code. Productivity Power Tools 2013 – Toolset to increase productivity. ClipboardHistory – Store and enable history changes though the clipboad. PrettyPaste – Format pasted text and removes new blank lines and line numbers. SideWaffle Template Pack […]




Delete duplicated rows on SQL

Assuming these are the incriminated records                   Let’s narrow down the duplicate ones by grouping the records and removing from the resultset the first valid record and by leaving the duplicates only.               Let’s delete them now.  




Fix: Failed to initialize the PowerShell host

While adding the WebApi Nuget package to a class library I was getting the following on VS2013 : Failed to initialize the PowerShell host. To fix it, run this in the PowerShell (admin mode) start-job { Set-ExecutionPolicy Unrestricted } -RunAs32 | wait-job | Receive-Job




Generate and validate Google XML sitemap with Asp.net

Looking to dynamically create a Google friendly sitemap for your site with a list of URLs fetched from somewhere (a db for instance) ? The sample below is using an Asp.net WebForms site (it’s what I’m currently using at work) but it can be easily adapted for an MVC site. Here for the source code. […]




Expect 100 timeout on WS calls.

Noticed that a service call was timing out on a new project while the same call was fine on an older project. By comparing the requests in Fiddler I noticed that the failing one was adding Expect: 100-Continue to the header. Adding the following to the web.config fixed it:




KnownTypeAttribute serialization error

It can happen that you get this exception while deserializing an object from xml: Type ‘xxxx’ with data contract name ‘xxxxxxxxx’ is not expected. Consider using a DataContractResolver or add any types not known statically to the list of known types – for example, by using the KnownTypeAttribute attribute or by adding them to the […]