Tuesday 8 December 2009

Restore SQL Server 2005 DB on 2005 Express

Question:
We have a SQL server 2005 database in a shared production environment.
We do a backup of this database and want to restore it in a development environment having only a SQL-2005 Express Edition.
You cannot restore the prod database using the Management Studio Express.
What to do??


Thursday 5 November 2009

Insert records into SQL Server without constraints

Question:
How do I insert records into a sql database without constrains?

I want to insert a record into the database and
  1. I want to set the primary key
  2. Want to disable any contraints
  3. I want no triggers to fire

Wednesday 16 September 2009

Ben's Journal: The Anatomy of A Blogger Gadget

Question:
I asked myself, how to write a little blogger gadget.

Answer:
Ben tells us to use the Google API: Ben's Journal: The Anatomy of A Blogger Gadget

The Google Gadget API
Gadgets API Blog
Some Samples

But I really think, you should start with a look at BloggerAPI the
Widget Tags for Layouts and available data container.
Wednesday 1 April 2009

Code coverage using PartCover and NUnit

Question:
I looked for a free open-source tool to calculate code coverage for my NUnit tests.

Answer:
NCover has been a good choice until they went commercial. (very bad)

NCover is dead, long live PartCover.

PartCover is an open-source project for code coverage under GNU GPL. That also means, that you're not allowed to commercialize non-free derivatives.
PartCover does most of the things most of us would demand of such a tool. And don't forget - if you really want a new feature, you can add it yourself and help the community.


Sample setup.

I have a business logic assembly "VokAdapt.BLL" that I test using NUnit with a fixture which sits in the assembly "VokAdapt.BLL.Test".
I want PartCover to start NUnit, execute the tests and get the coverage of the business assembly.

1. Open PartCover GUI.
2. Fill in Target Settings.
2.a The "Executable File" here is NUnit.exe. You might want to choose the console version.
2.b The "Working Directory" is the directory that contains your test assembly.
2.c The "Working Arguments" is the test assembly simple name.
2.d Add a rule that tells PartCover which assemblies/classes to consider.



3. Start PartCover. (That will run the target application, here NUnit)
3.a Execute your tests.
4. Close NUnit and view results



You see very nice stats of your coverage and you can even inspect the code.
I get 36% coverage here. That isn't brilliant, so I better stop blogging and write some tests :)

If you like to integrate PartCover into VS2008 read Vlad's blog entry
PartCover has been added to SharpDevelop 3.