Sunday, April 26, 2009
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:
For futher information, see here.
- 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.
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.
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.
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.
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 :-)


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 :-)
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: http://www.jetbrains.com/idea/features/linklogos.jsp. And you can found my link logo on the right-bottom bar :-)
You can see how to create and create a link logo for IntelliJ IDEA yourself here: http://www.jetbrains.com/idea/features/linklogos.jsp. 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
And write your source code inside this <pre> tag
You can get the source code for SyntaxHighlighter here: http://code.google.com/p/syntaxhighlighter/downloads/list
<link href='http://t800t8.googlepages.com/SyntaxHighlighter.css' rel='stylesheet' type='text/css'/>
<script language='javascript' src='http://t800t8.googlepages.com/shCore.js'/>
<script language='javascript' src='http://t800t8.googlepages.com/shBrushCSharp.js'/>
<script language='javascript' src='http://t800t8.googlepages.com/shBrushJava.js'/>
<script language='javascript' src='http://t800t8.googlepages.com/shBrushXml.js'/>
<script language='javascript' src='http://t800t8.googlepages.com/shBrushSql.js'/>
<script language='javascript'>
dp.SyntaxHighlighter.BloggerMode();
dp.SyntaxHighlighter.HighlightAll('code');
</script>
And write your source code inside this <pre> tag
<pre name="code" class="python">
// source code
<pre>
You can get the source code for SyntaxHighlighter here: http://code.google.com/p/syntaxhighlighter/downloads/list
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 :-)
+ 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 :-)
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
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.
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 :-)
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:
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Msahci
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.
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:
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Msahci
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
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.
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.
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
Saturday, August 16, 2008
Saturday, August 02, 2008
[Serializable] versus ISerializable
A short description (do not miss to checkout the comments): http://www.dev102.com/2008/04/22/is-serializable-iserializable-no/
And a detail description: http://www.markdawson.org/software/serialization/serialization_5.aspx
And a detail description: http://www.markdawson.org/software/serialization/serialization_5.aspx
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):
PS: Thanks for the resolution.
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.
THIS IS IMPORTANT!
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
either!)
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)
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
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.
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)
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)
Outside

Inside

The field

The scoreboard

The match


The fans


The cheerleaders (they're beautiful and hot)


And the last thing, the winner is LG Twins.
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)
Outside
Inside
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
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.
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
Beef-piplomacy
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.
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.
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.
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.
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
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.
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:
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.
- Seam support
- FreeMaker support
- JavaScript debugging
- Flex debugging
- SQL support
- Struts 2 support
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:
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
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:
<HostApplication>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)
<Name>Microsoft Visual Studio</Name>
<Version>8.0</Version>
</HostApplication>
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"
default="debug"
xmlns="http://nant.sf.net/release/0.86-beta1/nant.xsd">
</project>
Wednesday, March 19, 2008
Wi-Fi trolley? We did it, but...
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.
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?
Check some screenshots.
Figure 1. Setup
Figure 2. Administration UI
Figure 3. Create repository
Figure 4. Browse repository
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
Check some screenshots.
Figure 1. Setup
Figure 2. Administration UI
Figure 3. Create repository
Figure 4. Browse repositoryWednesday, 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
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
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
Thursday, January 17, 2008
SigmaK3
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.
Updated:
- 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
- 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
Sunday, December 16, 2007
Saturday, December 08, 2007
The weekly bag - Dec 8
- What's Ailing ASP.NET Web Forms
- ASP.NET MVC Framework (Part 2): URL Routing - Lack of support for URL routing configuration in web.config?
- ASP.NET MVC Framework (Part 3): Passing ViewData from Controllers to Views
- Spring 2.5 Makes Unit Testing Easy with Annotations
Thursday, December 06, 2007
TeamCity 3.0 is released with a FREE version
These days continuous integration (CI) becomes popular in software development 'cause it aims to support software developers to produce higher quality products. To apply CI in your project, usually, you need to use a CI server. There are many CI severs you can found: CruiseControl, Hudson, Luntbuild, Parabuild,... and most of them are free.
If you've ever heard about IntelliJ IDEA - the most intelligent Java IDE - is from JetBrains, you should know that they also have a CI server which has many innovative features, TeamCity. And today, JetBrains releases TeamCity 3.0, especially there is a free version.
For more information about TeamCity 3.0, you can find here: http://www.jetbrains.com/teamcity/
Try it out and have fun :-)
If you've ever heard about IntelliJ IDEA - the most intelligent Java IDE - is from JetBrains, you should know that they also have a CI server which has many innovative features, TeamCity. And today, JetBrains releases TeamCity 3.0, especially there is a free version.
For more information about TeamCity 3.0, you can find here: http://www.jetbrains.com/teamcity/
Try it out and have fun :-)
Saturday, December 01, 2007
What will the new features in Diana?
With Diana (a.k.a. IntelliJ IDEA 8) will appear in Q4 2008, it's time to think about the new features. As my experience with JetBrains and IntelliJ IDEA, I don't think they will provide support for other frameworks but they will have more support for team work. Even IDEA can do some tasks for team work in conjunction with Team City and IDETalk, but they're not too many. So here the main feature list I think they will provide in Diana:
Even I want to see UML support in IDEA (support for popular diagrams, generate source code from UML, reverse engineering from source code, synchronize between diagrams and source code,...) but I don't think it will appear in Diana.
OK, now wait and see, in a few weeks later, they will post the road map for Diana.
Update: Added Facetlet, Flex
- A Task-Focused user interface, like Eclipse's Mylyn and even better
- Improvement in supporting Spring, Hibernate, Seam, Facelet, Flex
- Improvement in integration between Hibernate and Spring
- Improvement in Ruby and JetGroovy plugin
Even I want to see UML support in IDEA (support for popular diagrams, generate source code from UML, reverse engineering from source code, synchronize between diagrams and source code,...) but I don't think it will appear in Diana.
OK, now wait and see, in a few weeks later, they will post the road map for Diana.
Update: Added Facetlet, Flex
Tuesday, November 27, 2007
How to restore a tab which has just closed in Firefox?
Just closed a Firefox's tab unfortunately? There is a solution for it, you can use Ctrl + Shift + T to restore the tab.
And even more suprise, if your text box contains text, it will not be lost :-)
And even more suprise, if your text box contains text, it will not be lost :-)
Monday, November 19, 2007
How to call EasyMock.verify() when you expect an exception in TestNG
I have this test which is written in JUnit
I converted it to use TestNG as below
then found that
Spend more time to read TestNG document and search in TestNG forum, I found that I can use
Now I have a clear understanding about
The test works as expected. Smile :-)
Updated: Re-think about my TestNG test version, I will remove
One reason to use dependent methods 'cause it makes the test clearly. I know exactly where the test fails, 'cause it doesn't throw exception or 'cause EasyMock.verify() fails.
public void testConvertWithUnknownCurrency()
throws UnknownCurrencyException {
EasyMock.expect(
exchangeRateService.getExchangeRate(
EasyMock.isA(String.class),
EasyMock.isA(String.class)
)
).andThrow(new UnknownCurrencyException());
EasyMock.replay(exchangeRateService);
try {
converter.convert(10.0, "EUR", "-UNKNOWN-");
fail("an unknown currency exception was expected");
} catch (UnknownCurrencyException e) {
// do nothing, was expected
}
EasyMock.verify(exchangeRateService);
}
I converted it to use TestNG as below
@Test(expectedExceptions = {UnknownCurrencyException.class})
public void testConvertWithUnknownCurrency() {
EasyMock.expect(
exchangeRateService.getExchangeRate(
EasyMock.isA(String.class),
EasyMock.isA(String.class)
)
).andThrow(new UnknownCurrencyException());
EasyMock.replay(exchangeRateService);
converter.convert(10.0, "EUR", "-UNKNOWN-");
EasyMock.verify(exchangeRateService);
}then found that
EasyMock.verify(exchangeRateService) will never be called 'cause converter.convert(10.0, "EUR", "-UNKNOWN-") throws UnknownCurrencyException. So how to make the test works as same as JUnit version?Spend more time to read TestNG document and search in TestNG forum, I found that I can use
@Test's dependsOnMethods attribute. But note that TestNG supports 2 kinds of dependencies: hard and soft. And here is explaination from TestNG document:
* Hard dependencies. All the methods you depend on must have run and succeeded for you to run. If at least one failure occurred in your dependencies, you will not be invoked and marked as a SKIP in the report.
* Soft dependencies. You will always be run after the methods you depend on, even if some of them have failed. This is useful when you just want to make sure that your test methods are run in a certain order but their success doesn't really depend on the success of others. A soft dependency is obtained by adding "alwaysRun=true" in your @Test annotation.
Now I have a clear understanding about
dependsOnMethods, what I need is a soft dependency. And here is TestNG version of above test.@Test(expectedExceptions = {UnknownCurrencyException.class})
public void testConvertWithUnknownCurrency() {
EasyMock.expect(
exchangeRateService.getExchangeRate(
EasyMock.isA(String.class),
EasyMock.isA(String.class)
)
).andThrow(new UnknownCurrencyException());
EasyMock.replay(exchangeRateService);
converter.convert(10.0, "EUR", "-UNKNOWN-");
}
@Test(alwaysRun = true,
dependsOnMethods = "testConvertWithUnknownCurrency")
public void verifyAfterTestConvertWithUnknownCurrency() {
EasyMock.verify(exchangeRateService);
}The test works as expected. Smile :-)
Updated: Re-think about my TestNG test version, I will remove
alwaysRun = true from verifyAfterTestConvertWithUnknownCurrency(). Why? 'Cause if testConvertWithUnknownCurrency() fails, it means the test fail, don't need to waste my time to verify something it was failed.One reason to use dependent methods 'cause it makes the test clearly. I know exactly where the test fails, 'cause it doesn't throw exception or 'cause EasyMock.verify() fails.
Sunday, November 18, 2007
The weekly bag - Nov 18
- Software Testing With Spring Framework - The article is a bit interesting, but it is more interesting in the comments ;-)
- ASP.NET MVC Framework (Part 1)
- Spring 2.5 RC1 is here - introducing new configuration approaches
- F#
Thursday, November 15, 2007
Custom or Standard?
Modern languages like Java, C#,... provide powerful APIs with many libraries which are ready to use. But sometimes I consider I should use the "standard" class or create my own custom class. Spending more time to think about it, I realize that it depends.
Assumes that I want to have a list of members, if I use Java, I can use
Now consider that I only need to use the read-only list inside my application, which solution can I choose? One of two but maybe one of three. I also can use
To have a clearer design, using
Assumes that I want to have a list of members, if I use Java, I can use
List<Member> or create my own MemberList to store all members. If I want to have more features than the standard List<Member> provides, of course, I need to create my own MemberList, which bases on List<Member>. But what will I do if I only need a read-only list? A List<Member> cannot do it. To have a read-only list, I need to use Collections.unmodifiableList(myMemberList) or create MemberList which supports read-only only.Now consider that I only need to use the read-only list inside my application, which solution can I choose? One of two but maybe one of three. I also can use
List<Member> and forget about its "edit" methods.To have a clearer design, using
MemberList will be the best solution but it needs time to implement. To be lazy, using Collections.unmodifiableList(myMemberList) or List<Member> without using its "edit" methods is an acceptable answer.
Wednesday, November 14, 2007
The rest books
Today, I received the last 2 books for my order from Amazon. They came earlier than the estimation 3 days :-)
Too many books to read, too much works to do :-)
Too many books to read, too much works to do :-)
Tuesday, November 13, 2007
Monday, November 12, 2007
The first delivery
Even though I chose to pack all items in one package but Amazon delivered my order in 2 separate ones. And I've just received the first package, it contains 3 books
Amazon estimated my first package will be delivered from Nov 12 to Nov 20. And today, I received it. Their service works exactly :-)
The second one will be here from Nov 17 to Nov 30. Then I will spend more time for reading about testing.
FYI: Spring 2.5 supports to test by TestNG (and JUnit 4)
- Head First Design Patterns (Head First)
- Refactoring: Improving the Design of Existing Code
- The Business of Software: What Every Manager, Programmer, and Entrepreneur Must Know to Thrive and Survive in Good Times and Bad
Amazon estimated my first package will be delivered from Nov 12 to Nov 20. And today, I received it. Their service works exactly :-)
The second one will be here from Nov 17 to Nov 30. Then I will spend more time for reading about testing.
FYI: Spring 2.5 supports to test by TestNG (and JUnit 4)
Sunday, November 11, 2007
The weekly bag - Nov. 11
- Test-Driven Everything - An interesting story
- Java EE 6 - I would like to see how they can provide a hassle-free way to mix frameworks, like Spring, Hibernate, Struts 2,... to work together in web applications
- Introduction to Groovy - Part 2
Monday, November 05, 2007
The weekly bag - Nov. 4
- Holding a Program in One's Head
- Easy 2 Test == Less Reason to Test? - It's the question sometimes I ask myself
Monday, October 29, 2007
Saturday, October 27, 2007
Waiting for delivering
With JetBrains' Amazon.com gift certificate, I decided to buy some books and here they're:
Even though I had a soft copy of most of them but a hard copy will help me don't need to touch my laptop while I'm reading.
- Test Driven: TDD and Acceptance TDD for Java Developers
- Head First Design Patterns (Head First)
- Next Generation Java Testing: TestNG and Advanced Concepts
- Refactoring: Improving the Design of Existing Code
- The Business of Software: What Every Manager, Programmer, and Entrepreneur Must Know to Thrive and Survive in Good Times and Bad
Even though I had a soft copy of most of them but a hard copy will help me don't need to touch my laptop while I'm reading.
Friday, October 26, 2007
No Java 6 in Leopard - I quit
In the past, I thought I would buy a Mac Book Pro to replace my old 3 years Dell Inspiron. That time I heard "MacOS is a comprehensive Java development environment". Also in the point of view of an end user, GUI in MacOS it's more beautiful than the one in Linux and it has many more popular (and better) applications than Linux (You must know that when I used Ubuntu, even I could listen to the music, Skype's voice feature stopped to work without any errors)
But now there is no Java 6 in Leopard (MacOS X 10.5), so I quit. I think you too if you're a Java developer.
But now there is no Java 6 in Leopard (MacOS X 10.5), so I quit. I think you too if you're a Java developer.
Thursday, October 25, 2007
Stubs, Fakes, and Mocks
Funny descriptions about stubs, fakes and mocks, they help me easily to distinguish stubs, fakes and mocks.
Stubs - Looks like a duck but it's not a duck
Fakes - Looks like a duck, walks like a duck but it's not a real duck
Mocks - It's a mechanical duck
Stubs - Looks like a duck but it's not a duck
Fakes - Looks like a duck, walks like a duck but it's not a real duck
Mocks - It's a mechanical duck
TestNG's @DataProvider versus JUnit 4's Parameterized
In "Test Driven - Practical TDD and Acceptance TDD for Java Developers", Koskela used JUnit 4 as unit testing framework but I want to use TestNG so I need to "translate" from JUnit 4 to TestNG. I think it's a good opportunity to know about both of these unit testing frameworks.
In chapter 4, Koskela described about test patterns and one of them is Parameterized Test. To apply this pattern, we need to follow the rule to write the test class as below:
+ The test class must be annotated by
+ Supply a static method, is annotated by
+ And we need to write a constructor which has parameters for expected value and input values.
Example:
It looks very complicated, huh? Now, I will "convert" it to TestNG.
After awhile, I found that TestNG's
+ Supply a method (don't need to be
+ Test method is annotated by
The above source code after was "converted":
The test class is written with TestNG is much simpler also you can have many data providers as you want. And what will happen if you want to test the Calculator for substraction? If you use JUnit 4 as unit testing framework, seems you need to write another test class.
In chapter 4, Koskela described about test patterns and one of them is Parameterized Test. To apply this pattern, we need to follow the rule to write the test class as below:
+ The test class must be annotated by
@RunWith(Parameterized.class),+ Supply a static method, is annotated by
@Parameters and returns a Collection<Object[]> or its subclass,+ And we need to write a constructor which has parameters for expected value and input values.
Example:
@RunWith(Parameterized.class)
public class ParameterizedTest {
// Provide parameterized data
@Parameters
public static Collection<Object[]> parameters() {
Object[][] data = new Object[][] {
{ 0, 0, 0 }, { 1, 1, 0 },
{ 2, 1, 1 }, { 3, 2, 1 },
{ 4, 3, 1 }, { 5, 5, 0 },
{ 6, 8, -2 } };
return Arrays.asList(data);
}
public int expected, input1, input2;
// Data is bound through constructor
public ParameterizedTest(int expected, int input1,
int input2) {
this.expected = expected;
this.input1 = input1;
this.input2 = input2;
}
//Test method invoked once for each data set
@Test
public void executeParameterizedTest() throws Exception {
assertEquals(expected, new Calculator().add(input1,
input2));
}
}
It looks very complicated, huh? Now, I will "convert" it to TestNG.
After awhile, I found that TestNG's
@DataProvider can do the same thing. And here is the rule to write test class with TestNG following Parameterized Test pattern:+ Supply a method (don't need to be
static) is annotated by @DataProvider(name = "dataProviderName") and returns Object[][],+ Test method is annotated by
@Test(dataProvider = "dataProviderName") and has parameters as same as the Object[]'s elements in data is supplied from data providerThe above source code after was "converted":
public class ParameterizedTest {
@DataProvider(name = "data")
public Object[][] parameters() {
return new Object[][] {
{ 0, 0, 0 }, { 1, 1, 0 },
{ 2, 1, 1 }, { 3, 2, 1 },
{ 4, 3, 1 }, { 5, 5, 0 },
{ 6, 8, -2 } };
}
@Test(dataProvider = "data")
public void executeParameterizedTest(int expected,
int input1,
int input2)
throws Exception {
assert (expected == new Calculator().add(input1,
input2));
}
}The test class is written with TestNG is much simpler also you can have many data providers as you want. And what will happen if you want to test the Calculator for substraction? If you use JUnit 4 as unit testing framework, seems you need to write another test class.
Wednesday, October 24, 2007
TDD - The hardest thing
These days I spend my spare time to read "Test Driven - Practical TDD and Acceptance TDD for Java Developers". I've just finished chapter 2 and started to bump in chapter 3 but I found out that "Test Driven" is an interesting book (more interesting than "Agile Java: Crafting Code with Test-Driven Development")
In chapter 2 and 3, the author teaches me how to start TDD (test-driven development) with a template parser step by step. IMO, the hardest thing when we start TDD is find out the tests from the requirements or user stories. In simple application, it's easy to find them out. But in more complicated one, it's very hard to find.
In template parser application, I can easy to find out some tests:
+ Test for empty template
+ Test for replacing a variable in the template with its value
+ Test for replacing multiple variables with their values respectively
but in case of an employee management application, how can I find the tests? This question is not easy to answer.
Update: Fix typo
In chapter 2 and 3, the author teaches me how to start TDD (test-driven development) with a template parser step by step. IMO, the hardest thing when we start TDD is find out the tests from the requirements or user stories. In simple application, it's easy to find them out. But in more complicated one, it's very hard to find.
In template parser application, I can easy to find out some tests:
+ Test for empty template
+ Test for replacing a variable in the template with its value
+ Test for replacing multiple variables with their values respectively
but in case of an employee management application, how can I find the tests? This question is not easy to answer.
Update: Fix typo
Wednesday, October 17, 2007
Tip: How to get an IntelliJ IDEA license for free
A few minutes ago I received an email from JetBrains, and do you know what did it say? It said "Hey guy, it's an IntelliJ IDEA license, it's for you, and it's FREE", just kidding :-) Here is a part of email from JetBrains
I greatly appreciate JetBrains' kindness when they give me this present, a 249$ present. But more than the cost, actually they give me a FREE super weapon to work with, to play with and to have fun with.
And now it's the tip: Please download, use and report the bugs you would found in EAP versions of IntelliJ IDEA, you will have a chance to get an IntelliJ IDEA license for free.
Again, thanks JetBrains. Now it's the time to develop with "FREE" pleasure ;-)
Update: After reading the email more carefully, I found that JetBrains will have another gift for me this week. Waiting for another big surprise... :-)
Update: JetBrains gave me a big surprise one more time, I've just received an Amazon.com Gift Certificate. Again, I want to say thanks to JetBrains, you gave me surprise time after time :-)
Hello,
We appreciate your participation in development of IntelliJ IDEA 7.0, and we hope you will continue using IntelliJ IDEA with even more pleasure with the attached below personal license.
Be prepared to receive another gift from JetBrains this week :-)
-The JetBrains Team-
I greatly appreciate JetBrains' kindness when they give me this present, a 249$ present. But more than the cost, actually they give me a FREE super weapon to work with, to play with and to have fun with.
And now it's the tip: Please download, use and report the bugs you would found in EAP versions of IntelliJ IDEA, you will have a chance to get an IntelliJ IDEA license for free.
Again, thanks JetBrains. Now it's the time to develop with "FREE" pleasure ;-)
Update: After reading the email more carefully, I found that JetBrains will have another gift for me this week. Waiting for another big surprise... :-)
Update: JetBrains gave me a big surprise one more time, I've just received an Amazon.com Gift Certificate. Again, I want to say thanks to JetBrains, you gave me surprise time after time :-)
Tuesday, October 16, 2007
IntelliJ IDEA 7.0 reaches to final
Early this morning JetBrains released IntelliJ IDEA 7.0. This new version provides many new and interesting features and also it supplies many improvement (include performance) to support the developers to develop the software with pleasure. You can find the complete list of new features here. And the news about it also was published on several sites: here, here and here.
IMO, these features are the ones I love:
+ Support for Spring
+ Support for Hibernate
+ Integration between Spring and Hibernate
+ Improvement in Change View
+ Support for Groovy
Congratulations, JetBrains! It's the time to develop with more pleasure :-)
Monday, October 15, 2007
Sunday, October 14, 2007
The weekly bag - Oct. 14
- Open Source Tools for the Agile Developer
- 5 Questions on Agile Development - An interesting interview with Steve McConnell
- Introduction to Groovy
- Introduction to Code Coverage
- New C# "Orcas" Language Features: Automatic Properties, Object Initializers, and Collection Initializers
- New "Orcas" Language Feature: Extension Methods
Saturday, August 18, 2007
Vì sao bạn bị mất việc?
Nhân đọc bài báo "Vì sao bạn bị mất việc?” và cũng là tranh thủ trước khi qua nhà bạn chơi, tôi thử tự đặt mình vào hoàn cảnh mà nhà tuyển dụng hỏi tôi câu hỏi đó. Tôi sẽ trả lời như sau (tất nhiên đây là câu trả lời trung thực):
"Trước tiên tôi có thể khẳng định với ngài rằng, tôi không bị mất việc. Tôi nghỉ việc ở công ty đó. Và nếu câu hỏi được chuyển thành "Vì sao bạn nghỉ việc?" thì tôi có thể trả lời ngài thế này. Tôi nghỉ việc ở công ty đó vì tôi muốn tự tìm kiếm cho mình một môi trường làm việc tốt hơn, năng động hơn, cạnh tranh hơn, phù hợp với nhu cầu, khả năng cũng như mong muốn tiếp thu những kiến thức và kinh nghiệm mới cho bản thân."
Bạn nghĩ thế nào về câu trả lời như vậy? Và nếu bạn ở trong trường hợp đó, bạn có trả lời như tôi không?
"Trước tiên tôi có thể khẳng định với ngài rằng, tôi không bị mất việc. Tôi nghỉ việc ở công ty đó. Và nếu câu hỏi được chuyển thành "Vì sao bạn nghỉ việc?" thì tôi có thể trả lời ngài thế này. Tôi nghỉ việc ở công ty đó vì tôi muốn tự tìm kiếm cho mình một môi trường làm việc tốt hơn, năng động hơn, cạnh tranh hơn, phù hợp với nhu cầu, khả năng cũng như mong muốn tiếp thu những kiến thức và kinh nghiệm mới cho bản thân."
Bạn nghĩ thế nào về câu trả lời như vậy? Và nếu bạn ở trong trường hợp đó, bạn có trả lời như tôi không?
Sunday, July 08, 2007
FYI - First stable version of JetGroovy
JetBrains released first stable of JetGroovy in silence. It's a good plugin for Goorvy. Also many thanks to JetBrains for nice contribution to Groovy.
You can get first stable version of JetGroovy here.
Thanks Graeme for this information.
Update: JetBrains has just updated JetGroovy. You can get the latest version at above link. But note that it requires Selena build 7038 or later. And they also blog about it. JetGroovy looks very nice :-)
One more information, seems IntelliJ IDEA 7.0 will be delayed to early 2008.
Update: JetGroovy 0.1 now is available on IntelliJ IDEA's plugin repository server and you can install it via Plugin Manager.
You can get first stable version of JetGroovy here.
Thanks Graeme for this information.
Update: JetBrains has just updated JetGroovy. You can get the latest version at above link. But note that it requires Selena build 7038 or later. And they also blog about it. JetGroovy looks very nice :-)
One more information, seems IntelliJ IDEA 7.0 will be delayed to early 2008.
Update: JetGroovy 0.1 now is available on IntelliJ IDEA's plugin repository server and you can install it via Plugin Manager.
Thursday, June 28, 2007
Came back from Kuk Ki Won
I'm tired now, yes, very tired. But I had a lot of fun, yes, a lot. KOIVA organized an workshop for foreign high-tech professionals at Kuk Ki Won and I attended it.
I played Taekwondo, it's the first time. I enjoyed it very much although my actions are very basic. I met Martin - an Irish guy, Dung - a Vietnamese guy I knew before, Tien - a Vietnamese girl she live in Hochiminh City and has worked here for 3 years, and many people. I listened a Chinese girl sang "Big big girl" (actually she's a small girl, not big ;-). I watched a Yoga show which was performed by an Indian Yoga instructor and he made me say "WOW" and clapped many times. I took some pictures (I will post them later if possible). I had a new Romanson watch. And over of all I had a lot of fun :-)
The workshop was very interesting and I will attend it next time (this workshop is organized every year)
Work hard and play much when you can. Enjoy your life!
I played Taekwondo, it's the first time. I enjoyed it very much although my actions are very basic. I met Martin - an Irish guy, Dung - a Vietnamese guy I knew before, Tien - a Vietnamese girl she live in Hochiminh City and has worked here for 3 years, and many people. I listened a Chinese girl sang "Big big girl" (actually she's a small girl, not big ;-). I watched a Yoga show which was performed by an Indian Yoga instructor and he made me say "WOW" and clapped many times. I took some pictures (I will post them later if possible). I had a new Romanson watch. And over of all I had a lot of fun :-)
The workshop was very interesting and I will attend it next time (this workshop is organized every year)
Work hard and play much when you can. Enjoy your life!
Monday, June 25, 2007
Are there any places to use contructors of an abstract class with public or default access modifier?
As we already knew, we cannot create instances of an abstract class. So there are only 2 places to access constructors of an abstract class:
+ From the internal of that class (we can use private access modifier for this situation, it's enough), and
+ From its subclasses (we can use protected access modifier for this situation and it also satisfies the above situation)
And for other reasons, if we need to use instances of an abstract class, we will provide factory method(s) to create them (actually, at this time, we will return an instance of a "DEFAULT" subclass). So I don't see any reasons to declare constructors of an abstract class with public or default access modifiers.
Can you give me the reasons why I "need" to do it? Thank you.
+ From the internal of that class (we can use private access modifier for this situation, it's enough), and
+ From its subclasses (we can use protected access modifier for this situation and it also satisfies the above situation)
And for other reasons, if we need to use instances of an abstract class, we will provide factory method(s) to create them (actually, at this time, we will return an instance of a "DEFAULT" subclass). So I don't see any reasons to declare constructors of an abstract class with public or default access modifiers.
Can you give me the reasons why I "need" to do it? Thank you.
Sunday, June 24, 2007
Sorry Firefox, you don't understand "polymorphism"
While I was typing for my previous post, I found that Firefox displayed a red-dot-underline line under "polymorphism". It means Firefox doesn't recognize "polymorphism" as a valid word in English. Or it means Firefox doesn't understand "polymorphism".
Hey Firefox, you should learn more. And please start from here.
Hey Firefox, you should learn more. And please start from here.
Interface - Where and When?
I understand that if I use interface, my application can a high flexible construction. I can easily extend class to add more function, and also make use of strong point of polymorphism and dynamic binding. But I'm wondering that where and when I should use interface.
At this time I'm developing a small application it contains a Tourist class and I can't imagine that when I need to create some more specific kinds of Tourist. Even I need to extend Tourist, I can re-factor Tourist to be a abstract class (or keep it unchanged) and then create subclasses of Tourist. Where is the place I need to consider to use interface here?
As I told you, I'm developing a small application and I know it still keep in small level, hardly to become bigger. So what is the matter I need to use interface here? That is WHEN question.
What do you think about the WHERE and WHEN?
At this time I'm developing a small application it contains a Tourist class and I can't imagine that when I need to create some more specific kinds of Tourist. Even I need to extend Tourist, I can re-factor Tourist to be a abstract class (or keep it unchanged) and then create subclasses of Tourist. Where is the place I need to consider to use interface here?
As I told you, I'm developing a small application and I know it still keep in small level, hardly to become bigger. So what is the matter I need to use interface here? That is WHEN question.
What do you think about the WHERE and WHEN?
Saturday, June 23, 2007
Lack of something
I spent a little of time to think about my work, my knowledge and my experience. And I found that I'm lack of knowledge, MUCH.
I'm a techno guy. I love new technologies, really love. And I always try to catch the trend of new technologies by collecting every little amount of information about them. I cannot remember how many times I said "WOW" when I found something interesting. But when I knew about it (a little, again, sadly) I threw it away to catch a new one.
Till now, about 6 years from the time I graduated university. I knew Spring, I knew Hibernate, I knew JSF, Struts, Wicket... and many things but I'd just knew, NOT UNDERSTAND. Even I can use them but I don't know how they works, how they make this or that interesting.
Of course, you cannot UNDERSTAND everything, but you should understand SOMETHING, something that can make you love, are interested in, something can make you fun and of course, it can help you to earn money. And here is my list, something I want to understand:
+ Algorithms
+ OOP (and how to apply it CORRECTLY)
+ Design Patterns
+ Software Development Process (I choose ICONIX to start)
+ Swing
+ Servlet
+ Spring
+ Hibernate
+ Struts
+ Wicket
(the list will be continued...)
I'm a techno guy. I love new technologies, really love. And I always try to catch the trend of new technologies by collecting every little amount of information about them. I cannot remember how many times I said "WOW" when I found something interesting. But when I knew about it (a little, again, sadly) I threw it away to catch a new one.
Till now, about 6 years from the time I graduated university. I knew Spring, I knew Hibernate, I knew JSF, Struts, Wicket... and many things but I'd just knew, NOT UNDERSTAND. Even I can use them but I don't know how they works, how they make this or that interesting.
Of course, you cannot UNDERSTAND everything, but you should understand SOMETHING, something that can make you love, are interested in, something can make you fun and of course, it can help you to earn money. And here is my list, something I want to understand:
+ Algorithms
+ OOP (and how to apply it CORRECTLY)
+ Design Patterns
+ Software Development Process (I choose ICONIX to start)
+ Swing
+ Servlet
+ Spring
+ Hibernate
+ Struts
+ Wicket
(the list will be continued...)
Thursday, June 21, 2007
JetGroovy - Groovy plugin for IntelliJ IDEA
Michal already figured out how to build JetGroovy from source. (Thanks Michal!) But if you're lazy, you can get JetGroovy here.
Installation: Download groovy.zip and extract it to IDEA_HOME/plugins, then start IDEA to fight ;-)
Note: This JetGroovy build ONLY works with IDEA 7 EAP build 7020. I'm not sure that it will work with other EAP builds (and of course it doesn't work with IDEA 6 or earlier)
If you have problem in downloading groovy.zip, please replace "us.share" in "http://us.share.geocities.com/t800t8/2007-06-21/groovy.zip" by "www". Sorry for inconvenience. (Yahoo suck!)
Update: I've just updated to IDEA build 7027 and JetGroovy doesn't work anymore. IDEA hangs while loading JetGroovy and there is no exception in log file.
Installation: Download groovy.zip and extract it to IDEA_HOME/plugins, then start IDEA to fight ;-)
Note: This JetGroovy build ONLY works with IDEA 7 EAP build 7020. I'm not sure that it will work with other EAP builds (and of course it doesn't work with IDEA 6 or earlier)
If you have problem in downloading groovy.zip, please replace "us.share" in "http://us.share.geocities.com/t800t8/2007-06-21/groovy.zip" by "www". Sorry for inconvenience. (Yahoo suck!)
Update: I've just updated to IDEA build 7027 and JetGroovy doesn't work anymore. IDEA hangs while loading JetGroovy and there is no exception in log file.
Subscribe to:
Posts (Atom)






