Thursday, 30 July 2009

Could not load file or Assembly CustomMarshalers.dll

I had an interesting error after installing VS2008 and trying to create ANY new project. I tried, web, console, services, and none would be created. Each time I had the following error:

Could not load file or assembly CustomMarshalers, Version=2.0.0.0 etc

For some reason, this file was not installed into the GAC

c:\>gacutil -i C:\Windows\Microsoft.NET\Framework\v2.0.50727\CustomMarshalers.dll

command into the VS2008 command prompt solved the issue.

Useful Links for New Projects

NHibernate Download
NHibernate Homepage

NHibernate Profiler

Resharper

NVelocity and Engine Wrapper


Template Web Project Structure using NHibernate and NVelocity

Wednesday, 15 July 2009

Validation and Testing

We all know that validation of user input is always a good thing. After all, even the most astute of user, is still at the end of the day, a user and that means if there is a way to cock something up, they normally find it... So therefore we validate what a user inputs to make sure it is sensible.

So when I read this article on the BBC news site http://news.bbc.co.uk/1/hi/world/americas/8152278.stm I was left pondering quite what had gone wrong. For those that don't want to read the article, it is basically about a man being charged $23 quadrillion for a packet of cigs! Maybe America are trying a new tactic of health awareness, preventing people from smoking? We'll probably not, since that amount is several times more than the entire national debt of the USA!

Just how could someone be charged so much, and just how big was his credit limit? I want one of those cards! I did find his response of "Something I could never, ever, afford to pay back. " was very astute. If he worked 8 hours a day, for 364 days of the year (well let's have Christmas off!) and for 20 years, he would need to earn $397,473,477,132 per hour. that's $400 Billion an hour.

I want that job :)

Thankfully, the bank has rectified the "blip" and even refunded the $15 overdraft fee. How kind of them :-) perhaps some more unit testing would be beneficial here, it would be most unfortunate if the transaction credited him that much!

Monday, 22 June 2009

Microsoft's Web Standards

Just a little light humour from the microsoft website...





Oops!

NHibernate Parameter Error

We were getting an IndexOutOfRange Exception when trying to save a Period object in our application. Invalid Index 17 for this SqlParameterCollection with Count=17

It was a little confusing as we'd not seen any error like this before:




After a bit of head scratching, we interrogated the mapping file, see if you can spot the error:



Did you spot it? Well, there are two columns called "MORId", one in the main class, and one in the component AgreedWorkLevel. The important thing to remember is that components are stored in the same table and although they are in different classes, they need to be uniquely named.

I would imagine if you wanted the component property to be the same as the class' property, you could link this in code and leave NHibernate pointing to the single reference point.