Tuesday, December 29, 2009

2009 & 2010

In 2009, I did 2 important things:

  • Changed the job. Now I'm working in GIS team of a Danish company
  • Got married, sure, it must be one of the most important things in men's life

And in 2010, I planned:

  • Be a master of TeamCity and MSBuild
  • Learn ExtJS as much as possible
  • Learn a new language (F#, Scala, Boo are considering)
  • Spend more time for software architect and agile development
  • Have something RUNS

Monday, December 21, 2009

A WON'T FIX bug or an WELCOME to provide a patch

Today I received a comment of my NetBeans bug report from NetBeans team, and seems it's the only one from NetBeans team:

   This bug was reported against NetBeans IDE 6.0 or an older release, or 
against a non-maintained module. NetBeans team does not have enough
resources to get to this issue, therefore we are closing the issue
as a WONTFIX. If you are interested in providing a patch for this
bug, please see our NetFIX guidelines for how to proceed.

We apologize for any inconvenience.


Thank you.
The NetBeans Team

It's one of the reasons why I prefer to use IntelliJ IDEA as the favorite Java IDE.

Thursday, December 10, 2009

Visual Studio on the web

Simple but looks nice :-)

Thursday, December 03, 2009

Download TeamCity 5.0 now

Even JetBrains didn't update TeamCity's web site yet, maybe because they didn't finish to update its document yet, but you can get it here: http://download.jetbrains.com/teamcity/TeamCity-5.0.exe

Enjoy CI with pleasure :-)

Thursday, October 08, 2009

Rendering a TABLE inside a DIV in IE problem

I've just head a rendering problem on IE (IE8). It doesn't happen in static HTML, but it only happens in generating HTML by using JavaScript dynamically. I did as below:

  
var myDiv = document.getElementById('myDiv');
var table = document.createElement('table');

myDiv.appendChild(table);

var tr = document.createElement('tr');
table.appendChild(tr);

var centerTd = document.createElement('td');
centerTd.innerHTML = 'Hello guys';
tr.appendChild(centerTd);

'Hello guys' doesn't show up even the DIV is there. If I try to create a static HTML inside 'myDiv' DIV, the text shows up. Strange!

Just a try, I add TBODY to wrap the table's body. And then, the text shows up. IE sucks.

var myDiv = document.getElementById('myDiv');
var table = document.createElement('table');

myDiv.appendChild(table);

var tbody = document.createElement('tbody');
table.appendChild(tbody);

var tr = document.createElement('tr');
tbody.appendChild(tr);

var centerTd = document.createElement('td');
centerTd.innerHTML = 'sfsdfsdfsdfsd';
tr.appendChild(centerTd);

Note: This problem doesn't happen on Firefox.

Wednesday, September 02, 2009

Sorry, Denmark

I have an opportunity to work in Denmark in a few months. I really like it because it helps me to have a chance to live in Denmark, and maybe, visit Europe. But because of a big personal plan, I decided to reject it.

Sorry, Denmark, maybe next time.

Saturday, August 01, 2009

Wash your hands too - H1N1 song

Very funny!



And the original song

Friday, July 31, 2009

Configuring TeamCity with SQL Server 2008 Express

I tried to configure TeamCity with SQL Server 2005 (both Express & none Express versions), but I haven't ever try with SQL Server 2008 Express. So when I install Windows 7 RTM, I think it's the time to update to SQL Server 2008 Express. Based on David's post, I update the configuration process as I did.

  • Install SQL Server Express 2008
  • Configure SQL Server Express 2008 to use a static port (default port for SQL Server is 1433) 'cause it uses dynamic port by default.
  • Create an empty database for TeamCity, example "TeamCity", with _CI_AI collation as mentioned here
  • Install TeamCity (you can grap the latest EAP of TeamCity here)
  • Download Microsoft's JDBC driver from here, extract it then copy sqljdbc.jar, but not sqljdbc4.jar, to [TeamCity installation folder]\webapps\ROOT\WEB-INF\lib (I'm not sure why David mentioned that we need to copy auth/x64/sqljdbc_auth.dll to that folder, but even I didn't copy it, seems TeamCity still works well on Windows 7 RTM x64)
  • Create/replace database.properties in [TeamCity Build Server folder]\config with this content
        driverName=com.microsoft.sqlserver.jdbc.SQLServerDriver
    connectionUrl=jdbc:sqlserver://localhost:1433;database=TeamCity;user=[your_user_name];password=[your_password];

    maxConnections=50
    poolPreparedStatements=false

    connectingTimeout=10000
    connectingAttemptsInterval=1000
    validationQuery=select 1
    I don't know why connectionProperties.user and connectionProperties.password don't work and I need to add the user name and password to connection string
  • Start TeamCity Web Server service, TeamCity should use SQL Server 2008 Express as back-end data storage from now on

Monday, July 13, 2009

How to check exception message in NUnit 2.5

In previous post, I mentioned how to check for expected exceptions in NUnit 2.5 to run with ReSharper and my prefered way but it lacks of how to check for exception messages. In this post, I will address it.

To check exception messages, I cannot use Assert.That(), my prefered way, because it returns nothing. The only way I can use is Assert.Throws(). Assert.Throws() returns an instance of the exception, and using it, I can check the message.

ArgumentException ex = Assert.Throws<ArgumentException>(delegate { clz.Divide(3, 0); });
Assert.AreEqual("Hey man, you need to learn elementary school again!", ex.Message);

Happy testing! :-)

Tuesday, July 07, 2009

Theory, the boring part. Or the second partial (and the last) review of Pro ASP.NET MVC Framework

After having the exciting knowing how to work with ASP.NET MVC in pratice, I move to the boring part, theory, of Pro ASP.NET MVC Framework. This part is broken up to 9 chapters.

Chapter 7, "Overview of ASP.NET MVC Projects", gives me the understand about ASP.NET MVC project structure, how to debug a project, and detail about the request processing pipeline which teaches you what each components in ASP.NET MVC does.

Chapter 8, "URLs and Routing", teaches me how to configure the routing in details, gives me some best practices for URL schemas, and how to test URL routing.

Chapter 9, "Controllers and Actions", explains how a controller receives input, produces output, do filter. It also mentions about controller factory, and again, testing for controller.

Chapter 10, "Views", lets me know how to use inline code, HTML Helper, partial views, Html.RenderAction to produce views. It also gives me some basic about how to create a custom view engine, and introduces some third-party view engine (NVelocity, Spark, Brail, NHaml).

Chapter 11, "Data Entry", you got controllers, you got views, but what makes users use your applications, it's data. This chapter teaches me how to bind data from model and how to validate data.

Chapter 12, "Ajax and Client Scripting", explains me how to get support from ASP.NET MVC's Ajax Helpers and jQuery to make the web application more attractive.

Chatper 13, "Security and Vulnerability", mentions about the most important thing for web appplications, security, and gives me some insights to address it.

Chapter 14, "Deployment", you finish a web application and you need to put it to work in the real world, so what do you need to care about, this chapter will help you.

Chapter 15, "ASP.NET Platform Features", ASP.NET MVC is not just it, it was based on ASP.NET platform, and there are some features you need to know to use them (Windows authentication, forms authentication, data caching, i18n, adressing performance,...)

Chapter 16, "Combining MVC and WebForms", gives you a mixed salad with ASP.NET MVC and ASP.NET WebForms.

At the end, I recommend this book is a MUST READ for developers who need to know and UNDERSTAND about ASP.NET MVC. You will have no regret to read it.

Enjoy reading :-)

Tuesday, June 23, 2009

Partial review of Pro ASP.NET MVC Framework

I've just finished the last chapter of part 1 of Pro ASP.NET MVC Framework. In this part, the author teaches me how to write a small online store where users can browse all products, filters the products by category, add products to cart, remove them from cart, and do check out. The store also has a basic administration area where the administrator can add/update/remove products (with theirs pictures).

What I learn from this part are

  • Understand the steps to create a real ASP.NET MVC application
  • How to write unit tests for routing/controllers with NUnit and Moq
  • There is a surprise that the author used Castle Windsor as IOC container for this application which I want to know the basic

I will continue with part 2, and for sure, I will come back with the review of part 2.

BTW, if you want to learn ASP.NET MVC in practical, you must read this book.

Monday, June 01, 2009

How to create a SQL Server database by command line

In previous post, I show you how to attach a SQL Server database by command line, and here I want to show you how to create a SQL Server database by command line.

C:\>sqlcmd -S .\SQLEXPRESS -E
1> use master
2> go
Changed database context to 'master'.
1> create database teamcity collate Latin1_General_CI_AI_KS
2> go

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.

[Test]
[ExpectedException(typeof(ArgumentException))]
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>());

and

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

I prefer the first way.

Reference:
Update: Good to know that now ReSharper's NUnit runner can run tests with ExpectedException attribute, v4.5.1 (http://www.jetbrains.net/devnet/thread/281286?tstart=0)

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.

Congratulation!

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 :-)

Sunday, April 26, 2009

TeamCity 4.5 was released

While I was having a team building tour with my colleagues, JetBrains released TeamCity 4.5.

Here are some of the release highlights in this new version:

  • LDAP integration with automatic user profiles synchronization
  • User groups management engine allowing to fine-tune team members’ roles and access rights, set up groups hierarchy and notification rules
  • CVS and Perforce plugin version 2008.2 support in Eclipse plugin
  • Perforce support in Microsoft Visual Studio plugin
  • Build Agent compatibility with Mono testing framework as a .NET platform for continuous builds
  • Test results grouping letting you filter tests by suites, packages/namespaces, and classes
  • Handling external tools reports in XML format (ANT’s JUnit tasks, NUnit, Surefire, PMD, and FindBugs)
  • Git integration

For more details, you can see them here.

Nha Trang - Team Building 2009

I came back home this morning from Nha Trang for a team building tour. There I played games with my colleagues and had 3 DAYS WITHOUT COMPUTER to relax under the sunshine with blue sea and white sand. It's very nice trip :-)






Sunday, April 12, 2009

ReSharper 4.5 was released

My favorite tool for .NET development, ReSharper, has new version. In this version, JetBrains brought many improvements and enhancements:

  • Performance and memory consumption: When working on large solutions, you will feel a great deal of difference between ReSharper 4.0 and 4.5.
  • New solution-wide warnings and suggestions: Analyze usage of non-private types and type members within your whole solution (or don’t!).
  • Visual Basic 9 support: ReSharper’s cross-language refactorings and editing experience enhancements now support VB9 code.
  • Improved setup for naming conventions, which are now supported by all ReSharper features.
  • New Inline Field refactoring and enhancements in existing refactorings.
  • Go to Implementation: Go from the usage of a class or method straight to its implementation, bypassing its declaration.

For futher information, see here.

Wednesday, March 18, 2009

Quite busy

These days I didn't update my blog 'cause I'm quite busy with my job. If you're care about my work, thanks, I'm working on an internal project which uses ASP.NET, Castle ActiveRecord and, maybe, Castle Windsor.

And there is a surprise news to you, JetBrains will start the EAP of their issue tracker soon. Looking forward to try it. And if you want to take a look on it, check out here.

Wednesday, January 21, 2009

Case sensitive - a headache experience

In a few days, I met some problems relate with case sensitive. The first one is with PostgreSQL and the second one with Subversion. These problems happened on Windows, even it is not a case sensitive OS.

When I create a table (or a field) which its name is not in lower case, example: User, FirstName. PostgreSQL will create the name with double quotes (User -> "User", FirstName -> "FirstName"). When you execute "SELECT * FROM User", it will not work. The correct statement should be "SELECT * FROM "User"". Please note that User must be bound by double quotes.

The same problem happend with a Subversion repository. If you create a "BlahBlah" repository, and checkout or update with "blahblah" in URL, it works fine. But it doesn't work when you commit.

Friday, January 16, 2009

Goodbye Korean - Hello Danish

Today is the last day of the first week I work for a Danish company. Even my general director is a Vietnamese (and most of my colleagues are Vietnameses), I'm working under management of a Danish guy.

We have a small IT group with 7 people. 6 of them are Vietnameses, included me, and we are almost at the same age. The working environment is open, I like it. Even we have some problems in start up, but I think it will be better in the future.