Saturday, November 29, 2008

Bigger is better

I saw many people build their PCs with 2 or more monitors, and I like it. But the problem is buying 2 or more monitors needs to spend more money (about 300 bucks for one 22" monitor). It excess my pocket. At the end I decided instead of buying 2 monitors, I bought a 24" Dell UltraSharp monitor (only 378$ for a second hand one), and I have no regret. (And there is a good news, now the price is dropped to 358$)

A bigger monitor gives me more room to work. I don't need to move my head around like I would used many monitors. Also it helps to focus on my work, it's important thing. And in my spare time, I can enjoy full HD movies with my family.

Maybe someday I will buy another 24" monitor. But now I'm happy with my decision. It's worth to spend :-)

Some screenshots, they are big :-)

Friday, November 28, 2008

TeamCity 4.0 is released

JetBrains released TeamCity 4.0 today. For the new features of version 4.0, you can find out here.

Hope that I will have more chances to use TeamCity because, from next year, I will apply SCRUM, TDD and CI in practice with new job :-)

Wednesday, November 26, 2008

Create link logo yourself - a nice marketing idea

Today I found that I can create the link logo for IntelliJ IDEA myself (they call it "Banner Meccano!" - What's the heck?). I think it's a nice marketing idea. "Let's your lovely users to show their proud about your product themself" :-)

You can see how to create and create a link logo for IntelliJ IDEA yourself here: And you can found my link logo on the right-bottom bar :-)

Wednesday, November 12, 2008

Syntax highlight source code for Blogger

Just add this code fragment to your template

<link href='' rel='stylesheet' type='text/css'/>
<script language='javascript' src=''/>
<script language='javascript' src=''/>
<script language='javascript' src=''/>
<script language='javascript' src=''/>
<script language='javascript' src=''/>
<script language='javascript'>

And write your source code inside this <pre> tag
<pre name="code" class="python">
// source code

You can get the source code for SyntaxHighlighter here:

Friday, November 07, 2008

Pocket the Eight

JetBrains has just released IntelliJ IDEA 8 today and it has a bunch of new features. And here are the features of my choice:

+ SQL-92, MySQL, SQLite with coding assistance and Console to run SQL scripts from the IDE
+ Struts 2
+ Subversion 1.5 merge tracking support
+ JavaScript debugger
+ UML class diagrams with navigation to the source code and refactorings

In the near future, maybe I will work more with Java, especially with web programming, so IntelliJ IDEA 8's new features can help me a lot :-)

Sunday, November 02, 2008

QOpen - Quick open an application on your PC

Do you want to open an application, file or folder quickly? Try to use QOpen (QuickOpen).

With QOpen you can assign shortcut keys to open an application, file or even a folder as you want. Every applications, folders or files can be opened by pressing Win key + Space + [asiggn key]. Example, you assigned "NP" for Notepad, you can open it by pressing Win key + Space + N + P.

Maybe you will tell me that you can assign some hot keys like "Ctrl + Alt + ...". But I don't like it because many applications can use same hot key so it will conflict, especially when I'm using IntelliJ IDEA.

And more, it's very light-weight application (about 60KB). Nice application :-)

Saturday, November 01, 2008

Catching fishes on the road

Wanna catch fishes on the road? Go to Hanoi, Vietnam now, immediately. It's 100% real.

Help yourself to stand out of the crowd

When you want to apply a new job, what will help you to stand out of the crowd? For sure, it's your resume (or CV). The employer will read it to find out what you've got and done (experience, knowledge,...), and to know that you're suitable for the job or not.

When you write your resume, you can learn many tips from the books which teach you write it. Example: Use short but clear statements, use active voice, use the verb in past participle when describe about your experience,... But, IMO, they're not enough. What you should do is making the difference, and the difference will help you to stand out of the crowd.

How to make the difference? Actually, it's up to you and your creativity. But I can give you one example I applied and received a good result at the first time I used it. Usually, in your resume, you will list the projects you worked for with a short description and your responsibility. I did the same thing but I ONLY list the projects I was interested in with the title "MOST INTERESTING PROJECTS". Yeah, right, the title is thing which makes the difference.

Thursday, October 30, 2008

BigInteger in .NET Framework 4 - The big WOW

If you have experience with Java, maybe you know that Java supports BigInteger type. This data type supports to store and manipulate big integer numeric. But in .NET, there is no BigInteger type (Actually, as I remember, Microsoft added BigInteger to .NET Framework 3.5 2.0 beta, but then removed it in the final version).

Now, in .NET Framework 4, Microsoft decided to add it back (check out the .NET Framework 4 poster). For me, it's a big WOW. Long time ago I need to develop a library which need to store very big integer values and convert from decimal to binary, to hexa and vice versa. And it's a painful experience. Even I used this class but it doesn't work properly for very very very big integer values.

Nice to see BigInteger now :-)

Monday, October 27, 2008

Enable AHCI Mode after installing Windows Server 2008

Today my friend told me about enabling AHCI on Windows, it can help to improve the performance of IO when it can use the advantage of SATA hard disk drives. The problem is I didn't enable AHCI when I install Windows Server 2008. Is there any way to do it after installing the Windows?

Yes, there is. And here it is:

1. Exit all Windows-based programs.
2. Click Start, type regedit in the Start Search box, and then press ENTER.
3. If you receive the User Account Control dialog box, click Continue.
4. Locate and then click the following registry subkey:
5. In the right pane, right-click Start in the Name column, and then click Modify.
6. In the Value data box, type 0 (zero), and then click OK.
7. On the File menu, click Exit to close Registry Editor.
8. Restart the PC and change the settings for RAID/AHCI from "Disabled" to "AHCI" (maybe it will different in your PC)

Windows Server 2008 has built-in SATA driver which support AHCI but disable by default. By tweaking registry, you've just enabled it.

Note: You can apply the same process for Windows Vista.

Saturday, October 25, 2008

Changing Sleep mode to Shutdown mode, and vice versa

In Windows Vista, when you click the Power button in Start menu, Windows Vista will go to sleep. But in Windows Server 2008, it will shut down. So how to change the Power button settings to sleep mode shut down the PC in Windows Server 2008?

It's very simple. Just go to Control Panel, Power Options, select (or create) a power plan then change the setting as in the screenshot

Friday, September 12, 2008

DataSet against DataReader

Some of the scenarios in which a DataSet is easier to use than a DataReader include the following:
  • When you need a convenient package to send the data to another component (for example, if you’re sharing information with other components or distributing it to clients through a web service).

  • When you need a convenient file format to serialize the data to disk (the DataSet includes built-in functionality that allows you to save it to an XML file).

  • When you want to navigate backward and forward through a large amount of data. For example, you could use a DataSet to support a paged list control that shows a subset of information at a time. The DataReader, on the other hand, can move in only one direction: forward.

  • When you want to navigate among several different tables. The DataSet can store all these tables, and information about the relations between them, thereby allowing you to create easy master-detail pages without needing to query the database more than once.

  • When you want to use data binding with user interface controls. You can use a DataReader for data binding, but because the DataReader is a forward-only cursor, you can’t bind your data to multiple controls. You also won’t have the ability to apply custom sorting and filtering criteria, like you can with the DataSet.

  • When you want to manipulate the data as XML.

  • When you want to provide batch updates. For example, you might create a web service that allows a client to download a DataTable full of rows, make multiple changes, and then resubmit it later. At that point, the web service can apply all the changes in a single operation (assuming no conflicts occur).

Basic guidelines to create a database component

Open and close connections quickly: Open the database connection in every method call, and close it before the method ends. Connections should never be held open between client requests, and the client should have no control over how connections are acquired or when they are released. If the client does have this ability, it introduces the possibility that a connection might not be closed as quickly as possible or might be inadvertently left open, which hampers scalability.

Implement error handling: Use error handling to make sure the connection is closed even if the SQL command generates an exception. Remember, connections are a finite resource, and using them for even a few extra seconds can have a major overall effect on performance.

Follow stateless design practices: Accept all the information needed for a method in its parameters, and return all the retrieved data through the return value. If you create a class that maintains state, it cannot be easily implemented as a web service or used in a load-balancing scenario. Also, if the database component is hosted out of the process, each method call has a measurable overhead, and using multiple calls to set properties will take much longer than invoking a single method with all the information as parameters.

Don’t let the client use wide-open queries: Every query should judiciously select only the columns it needs. Also, you should restrict the results with a WHERE clause whenever possible. For example, when retrieving order records, you might impose a minimum date range (or a SQL clause such as TOP 1000). Without these safeguards, your application may work well at first but will slow down as the database grows and clients perform large queries, which can tax both the database and the network.

A good, straightforward design for a database component uses a separate class for every database table (or logically related group of tables). The common database access methods such as inserting, deleting, and modifying a record are all wrapped in separate stateless methods. Finally, every database call uses a dedicated stored procedure.

Thursday, September 11, 2008

Some practices for working with transactions

  • Keep transactions as short as possible.

  • Avoid returning data with a SELECT query in the middle of a transaction. Ideally, you should return the data before the transaction starts. This reduces the amount of data your transaction will lock.

  • If you do retrieve records, fetch only the rows that are required so as to reduce the number of locks.

  • Wherever possible, write transactions within stored procedures instead of using ADO.NET transactions. This way, your transaction can be started and completed more quickly, because the database server doesn’t need to communicate with the client (the web application).

  • Avoid transactions that combine multiple independent batches of work. Put separate batches into separate transactions.

  • Avoid updates that affect a large range of records if at all possible.

Sunday, August 24, 2008

Why is a variable which represents a Web control declared as protected in ASP.NET?

'Cause ASP.NET uses inheritance in web-page model.

Example I have a ASP.NET page named A.aspx, which has a code-behind file named A.aspx.cs. Class A inherits a basic set of functionality from Page class. When class A is compiled, it will be merged with some extra code (with control declarations) automatically. Then the ASP.NET compiler wil create one more class for the actuall .aspx page. This class inherits from your custom code-behind class.

Friday, August 22, 2008

Tuesday, August 19, 2008

Picture of the day

Have fun guys :-)

Note: It wasn't taken by me :-D

Saturday, August 16, 2008

The Contrast

It was taken in Do Son, Hai Phong, Vietnam

Thursday, July 31, 2008

A painful experience with Windows Vista

Yesterday, I downloaded Microsoft SQL Server Management Studio Express and installed it on Windows Vista but I had a error code 29506 message (What the heck!). I've never seen this problem with Windows XP.

Today, I gave it another try (re-download, re-install) but I had the same problem. Try to google, I found that many people have the same problem. And someone can install it with some tricks. Here is the resolution (at least it works for me):

   1. Click the Start icon.
2. Type CMD into the Search box.
3. Right-click on cmd.exe then select Run as Administrator.
4. On the Command window, use the cd command to change the
directory to where the file you want to install is located.
(NOTE: It must be on a local drive—I tried entering a UNC
path to the server where it was located, but got a message
that ‘CMD does not support UNC paths as current directories’;
I also tried the mapped drive letter, but it didn’t like that
5. Type the location and name of the executable or MSI file
(e.g. C:\Users\\Documents\),
then press Enter.
6. The installation will happen as normal, except this time it
will work!

PS: Thanks for the resolution.

Sunday, July 27, 2008

Wednesday, July 09, 2008

Introduce about yourself - The first big step in an interview

When I do an interview, I usually ask the candidates to introduce about themself. Maybe you feel strange, and tell me "Hey, you've got their resumes, just read them". But I don't think it's a good way to know about the candidates. Actually, when I ask them to introduce about themself, I give them an opportunity to expose themself. If they can do it fluently, it means they have enough self-confidence to expose their ideas and opinions, the first step to get the job done.

And what will you need to do to introduce about yourself? IMO, you need to introduce:

+ A little about your information (name, which major and university you graduated,...)
+ A little about your position and your responsibility in the current company
+ And, again, a little about your current project (if you don't need to keep it in secret)

Saturday, July 05, 2008

Starting to count down

The time to come back home is getting closed...

Firefox 3 sucks

Firefox 3 crashes at least 3 times per day in my computers, both at home and office. And I heard many people have the same problem. It really sucks.

Update: If you didn't update your Firefox to v3.0.1 yet, you should do it. After trying it several days, I found that it was fixed for crashing problem.

Monday, June 30, 2008

Monday, June 16, 2008

The revolution of the API and the lack of knowledge in the API

About 2 years ago, I developed an application which supports user to "draw" rectangle and line by mouse at runtime. They need to handle some events (like double-click, right-click), also user can change its background color, set its background image, and do something else. At that time I made them as user controls 'cause I found that Microsoft didn't provide Rectangle and Line controls.

The revolution of API (Why do they make it lately?)
A few days ago, I found that in .NET Framework 3.5 SP1, Microsoft will provide several vector shape controls (Rectangle, Line, Oval,...) for all languages.

And the lack of knowledge in API
Also a few days ago, I found that Microsoft already provided Rectangle, Line controls but only in VB.NET (Microsoft Visual Basic 2005 Power Packs 2.0). If I could found it long time ago, I would not need to spend too much time in creating the user controls. (Yes, I know I can use them in C# even they are for VB.NET)

Friday, June 13, 2008

Baseball - The first, and maybe the last

Tonight I went to watch a baseball match between LG Twins and Hanhwa Eagles. It's so boring 'cause I don't understand the rules of baseball (in Vietnam, we don't play baseball). If comparing with a football match (a soccer match, if you are an American), a baseball match is too long, the match I watched it took about 3.5 hours to finish. Anyway, for me, it's a new experience but it's the first and maybe the last.

Here are some pictures I took by my first digital camera and also DSLR, Canon Kiss X2 (you may know it under the international name EOS 450D, or Rebel XSi if you're in America while Kiss X2 is for Japanese market)



The field

The scoreboard

The match

The fans

The cheerleaders (they're beautiful and hot)

And the last thing, the winner is LG Twins.

"I don’t afraid a new technology..."

When you see the title of this post, you can imagine some funny things. Exactly! When I read it, it made me laugh and I couldn't stop. It's a statement in a resume I had just received yesterday. (The full statement is "I don’t afraid a new technology, for me a few time I can work with any technology.")

I know many Vietnamese lack of knowledge and experience in English, even me. But it's not just about grammar, it's about the meaning of the statement. What is the point of it in your resume? Are you trying to excite yourself?

When you write down some fucking things in your resume, you should understand what you're fucking doing. If you couldn't understand what you're fucking doing, how could you get your fucking job done?

You "don't afraid a new technology"? Yes, you "don't". But I "do" afraid of you :-D

Tuesday, June 10, 2008

ReSharper 4.0 reaches the destination

JetBrains just has released ReSharper 4.0 (R#) final after the first release candidate one week. For the new features of this version, you can check it here.

The sad thing is R# 4 didn't do full support for XAML. I can see a lot of errors and warnings when I open a XAML file. Hope that they will resolve it in one of the next versions soon.

Anyway, I will try to find a workaround for this problem. And I can find it, I will post it here.

Sunday, June 08, 2008


These days in Korea there are many demonstrations when Korean worry about the impact of American mad beef to their health. It's one of the factors which make the trust in Lee Myung Bak, new Korean president, is going down. Also there are many titles on newspapers talk about America-Korea piplomacy under the name of "Beef-piplomacy" (Korean government wants a FTA with America so they need to open beef market in Korea to American beef producers).

Maybe they, Korean, worry about mad beef a little, but if you live in Korea, you already know that they're trying to protect their benefit. The price of Korean beef is over 2-3 times of Australian beef. It's too expensive.

Tuesday, June 03, 2008

ReSharper 4.0 reaches Release Candidate

JetBrains has just released first RC of ReSharper 4.0. This new version supplies many new and improvement features for C# 3.0, LINQ and more than that.

These days I'm quite busy in studying ICONIX process and learn how to apply it in my works so I don't have time to try this RC build. But when I come back to Vietnam, I will use it for my NEW works for sure.

Thursday, May 15, 2008

Monday, April 28, 2008

Short review Pro C# 2008 and the .NET 3.5 Platform 4th

After about 2 months, I finished reading Apress' Pro C# 2008 and the .NET 3.5 Platform 4th. Actually it's the first book about programming I read from the beginning to the end (even I ignore a small section about pointers in chapter 24).

In my opinion, Andrew did a good job. For the first large part, from chapter 1 to chapter 13, he described about syntax and feartures of C# 3. The pro side here is he didn't only describe about them, he did explain it in more details and sometimes in low level (by CIL code).

For the rest part, from chapter 14 to chapter 33, he introduced about LINQ, WCF, WF, Windows Forms, and more details about ADO.NET, WPF, ASP.NET. Why did he focus on ADO.NET, WPF and ASP.NET? I think because they're are the most important parts when we develop applications (web or desktop) on Windows. It's not mean other parts are not important, but it's the room for other books. And that's not all, he also described about processes, AppDomains, Object Contexts, how to build multithreaded applications and CIL.

A book covers most of things in C# 3 and .NET 3.5 (1400 pages), it's worth to read. In my opinion, I give it 4.5/5.

Now I'm continuing with the next book, Manning's C# in Depth.

Wednesday, April 16, 2008

IntelliJ IDEA 8.0 Technology Roadmap

You can find it here.

There are not too many technologies I will use in an early future.

Wednesday, April 09, 2008

Thursday, March 27, 2008

Sunday, March 23, 2008

First touch TeamCity

Yesterday I tried TeamCity the first time, and also it's the first time for CI (continuous integration). My first impression about TeamCity is it's very easy to use. But if you're new to TeamCity and CI (like me), you need to read the description for each fields carefully and consult TeamCity document when creating a build configuration.

After creating a build configuration, I fire up VS2008, write a test, run the build but it fail with an error message "Could not locate the assembly nunit.framework...". I don't understand why. I added reference to NUnit assembly to test project. I could compile and run the test on my PC. But why TeamCity cannot locate NUnit assembly?

After some tries, I found that I can fix the problem by adding nunit.framework.dll to test project manually (create a "lib" folder, copy nunit.framework.dll into it, add reference to the "local" nunit.framework.dll and commit to server). Seems TeamCity cannot resolve dependencies if the assemblies were not in GAC.

OK, now I'm happy with adding NUnit assembly to project manually. But it will better if TeamCity can resolve it for me.

And one thing maybe you will interested in, JetBrains is now developing their own issues tracker. I imagine that someday when I go to office I will fire up my favorite IDE (IntelliJ IDEA), receive my tasks, reports from my issues tracker (in my IDE), write code and run tests in conjunction with my CI server (Team City). I think that day will come soon ;-)

Let's continue with CI :-)

PS: You can read here to find out how TeamCity roooocks.

Friday, March 21, 2008

Next version of the most intelligent Java IDE

The first EAP build of IntelliJ IDEA 8, the most intelligent Java IDE, has just been released. In this version, JetBrains brought to you:
  • Seam support

  • FreeMaker support

  • JavaScript debugging

  • Flex debugging

  • SQL support

  • Struts 2 support
and many more. You can grab it here to have fun :-)

But where is the road map? I cannot find it now but hope that they will post it soon and we will have many big suprises.

How to fix NAntAddin to run with Visual Studio 2008

I can install NAntAddin v1.0.3 for Visual Studio 2005, and it's OK, at office, I only need to use Visual Studio 2005. But it's really annoying when I cannot install it for Visual Studio 2008 at home.

Play with NAntAddin.AddIn I found that I can fix it to install NAntAddin for Visual Studio 2008. And if you want, you can do it easily. Just open NAntAddin.AddIn in a text edtior, you will find this XML fragment:
<Name>Microsoft Visual Studio</Name>
then just replace "8.0" by "9.0" and restart your Visual Stusio 2008, NAntAddin will start. (Of course, you need to configure NAntAddin in your Visual Stusio 2008 first via Tools|Options...|Environment|Add-in/Macro Security)

Another information relates with NAnt: If you want to get NAnt intellisense in Visual Studio, just copy nant.xsd from NAnt to [VS_HOME]\Xml\Schemas. VS_HOME is the path to Visual Studio folder, in case of Visual Studio 2008, it is "C:\Program Files\Microsoft Visual Studio 9.0" and add a custom namespace to your build file as below
    <?xml version="1.0" encoding="utf-8" ?>
<project name="NAnt Build Sample"


Wednesday, March 19, 2008

Wi-Fi trolley? We did it, but...

I've just found an interesting information. You can read it here (in English) and here (in Vietnamese).

For this kind of Wi-Fi trolley, we did it about 2 years ago (even it doesn't have voice recognition function) but... it wasn't successful yet ;-)

Monday, March 10, 2008

Fixed VS 2008 ASP.NET MVC Templates

After trying VS 2008 MVC Templates, I found that the test project cannot resolve references to System.Web.Mvc, System.Web.Routing and System.Web.Abstractions (and Rhino.Mocks if you use the NUnit & Rhino Mocks template). The reason is, in project template, they used relative path while the absolute path should be used (or maybe it has another way but I don't know).

You can easily fix the templates by extract the ZIP file, open the CSPROJ file and replace relative path to MVC and Rhino assemblies by absolute path. But you can download fixed version of the templates here. (For installation these templates, you can follow the same steps as in "ASP.NET MVC Test Framework Integration Walkthrough")

Remember, if you install Rhino Mocks and ASP.NET MVC assemblies in different folders than "C:\Program Files\Rhino.Mocks-3.4" and "C:\Program Files\Microsoft ASP.NET MVC Preview 2", you need to fix them yourself.

Thursday, March 06, 2008

A powerful tool for Subversion

Are you tired with setting up Subversion (and integrate it with Apache) on Windows? If the answer is "Yes", you should check VisualSVN Server.

What does it provide?
  • An all-in-one installer with up-to-date components (Subversion 1.4.6, Apache 2.2.8 - for VisualSVN Server v1.0.3)
  • Supports SSL out of box
  • An UI for administration repositories and security - a superior feature, right?
  • It doesn't use port 80 so it cannot conflict with IIS
And it's completely FREE.

Check some screenshots.

Figure 1. Setup

Figure 2. Administration UI

Figure 3. Create repository

Figure 4. Browse repository

Wednesday, March 05, 2008

GS1 Check Digit Calculator

I wrote a check digit calculator, maybe somebody will need it.
public static class CheckDigitCalculator {

public static int CalculateCheckDigit(string input) {
int sum = CalculateSum(input);
int checkDigit = CalculateCheckDigit(sum);
return checkDigit;

private static int CalculateSum(string input) {
int factor = 3;
int sum = 0;
for (int i = input.Length; i > 0; i--) {
sum += Convert.ToInt32(input[i - 1].ToString())
* factor;
factor = 4 - factor;
return sum;

private static int CalculateCheckDigit(int sum) {
if (sum % 10 == 0) {
return 0;
} else {
int nearestEqualOrHigherMultipleOfTen =
(sum / 10) * 10 + 10;
return nearestEqualOrHigherMultipleOfTen - sum;

Note: The perfect one should check for the input string only contains numeric values.

Monday, February 25, 2008

The news from future

If you are care about my RSS Reader, it's FeedDemon.

Monday, February 18, 2008

Phoenix Park and snow boarding

Last weekend I went to Phoenix Park (in Gangwon, Korea) with my colleagues. There I played snow boarding, it's the first time and IT'S VERY EXCITING!

We played from about 5:30 PM to 11:30 PM and my whole body is hurt. IMO, I don't have any problems to keep the balance. But, for me, the hardest thing is how to control the knees. My knees seems are very rigid so I cannot control them as I want.

I tried to flow my colleagues' basic instruction to control the board to move forward then stop, then forward... but then I gave up. I couldn't do it. But later I tried the more advanced instruction, this time I could do it better. At that moment, the hardest thing for me is how to stop the board and can you guess how? Most of times I used my buttock to stop, ha ha.

The boarding road is >950m long and I board 6 or 7 times. Time after time, I did it better and I satisfied myself. Hope that I will have more opportunities to play boarding :-)

Some pictures of Phoenix Park

A picture of me

Tuesday, January 29, 2008


I will not come back to Vietnam next month, but a few months later.

Thursday, January 17, 2008


With me, SigmaK3, the first micro processor is made in Vietnam, is more interesting than acquiring MySQL AB by Sun.

And here are 2 application of SigmaK3: Led Matrix Display System and Robot.

- Changed title
- Changed link to English. For Vietnamese, you can see here and here.
- Added links to applications.

Monday, January 14, 2008

Getting old & Time to come back home, or The Past & The Future

Just some brief information

- One week ago (8th of January 2008) was my 29th birthday.
- One month later (15th of February 2008), if there is no special change, I will come back to Vietnam