Sunday, May 31, 2009

How to attach and detach SQL Server database by command line

SQL Server comes with an useful command line tool (sqlcmd.exe) to help manage your database. And here is how to attach a database to SQL Server:

C:\>sqlcmd -U your_username -P your_password
1> use msdb
2> go
Changed database context to 'msdb'.
1> sp_attach_db 'database_name', 'data_file', 'log_file'
2> go

Update: And here is how to detach a database by command line

C:\>sqlcmd -U your_username -P your_password
1> use msdb
2> go
Changed database context to 'msdb'.
1> sp_detach_db 'database_name'
2> go

Tuesday, May 26, 2009

Should I ignore NUnit 2.5?

I use built-in test runner in ReSharper to run NUnit tests. But this code fragment is passed with NUnit 2.5, but not with NUnit 2.4.8. Try to find, sadly, it is problem of licensing.

public void DivideANumberByZeroShouldThrowException()
// do nothing

I can use NUnit test runner, but I prefer to use ReSharper built-in test runner, which provides visualization to see the result. Should I ignore NUnit 2.5?

Update: After a while, I have the answer is "No". But to use ReSharper to run tests with expected exceptions, I need to change the way how to write test code. There are 2 ways to make the test runs well:

Assert.That(delegate { clz.Divide(3, 0); }, Throws.InstanceOf<ArgumentException>());


Assert.Throws<ArgumentException>(delegate { clz.Divide(3, 0); });

I prefer the first way.

Update: Good to know that now ReSharper's NUnit runner can run tests with ExpectedException attribute, v4.5.1 (

Friday, May 15, 2009

Visual Studio 2010 will support LESBIAN and TDD strongly

Just open this link, you will find out that Visual Studio 2010 will support LESBIAN and TDD strongly.

Thanks Google, you made me fun. And for sure I will get this beta with my MSDN account and try the new BigInteger :-D

Tuesday, May 05, 2009

Windsor 2.0 is released

Today, Ayende and his team released Windsor 2.0. Even I'm more familiar with ActiveRecord than Windsor, I will use Windsor for my future projects. And, for sure, I will take a look at the upcoming version of MonoRail when it'll out as a competitor of ASP.NET MVC.


Why I like MVC

These days there are many discussions about ASP.NET WebForms vs ASP.NET MVC and why they prefer ASP.NET WebForms over ASP.NET MVC, or vice versa. But there is only one REAL reason I prefer MVC, in this particular case ASP.NET MVC (over ASP.NET WebForms), is I HAVE FULL CONTROL. When I like to have full control, it doesn't mean I don't trust others, and even I need to work more (to control), but I HAVE MORE FUN.

So I total agree with Jeffrey, "ASP.NET MVC in Action" author.

Friday, May 01, 2009

Code Progression

Just found a blog about automation building with TeamCity and enjoy reading it :-)