Tuesday, December 26, 2006

Wednesday, December 20, 2006

Windows Vista and Daemon Tools

Yesterday, I installed latest version of Daemon Tools (v4.08). After finishing installation I had no problem, Daemon Tools can create virtual drive and it worked well. But this morning, when I turn on my laptop, I've got a black screen, Windows Vista cannot display logon screen as normal.

If you have this problem, don't worry. Restart in Safe mode and uninstall Daemon Tools, and now your Vista will back.

I think the big problem now with Windows Vista is compatibility with other applications (while they work with Windows XP). You saw my problem with Daemon Tools, and you must know that I cannot make a phone call via Globe7 'cause if I try, Globe7 will crash.

Actually I had a BSD (blue screen death) with Vista but seems it is problem of Kaspersky Anti-Virus's driver (it still beta).

Sunday, December 10, 2006

My daily tools

These days I'm working in a project using .NET and Firebird and also I decided to use UML to support modeling. So I need to find some tools to have me can do my work better. And here are them.

UML modeling tool: Actually I don't like UML tools are made by Java, they look ugly (application and symbols for modeling). So I want to find a UML tool it has a native look (in Windows). On my way, I found UMLStudio, it's really very small, only 3MB. But it's not free. Do more searching, I found StarUML. It has a native look, runs fast, free and open source. Even though it has some bugs but it's good enough to use to model.

Developer and DBA tool for Firebird: As I found, I have 2 options. One is EMS SQL Manager for InterBase/Firebird and another choice is IBExpert. After a try, I really fall in love with IBExpert. If you are familiar with TOAD (actually TOAD does not support for Firebird right now), IBExpert can do better than that. And IBExpert has a personal version, it's free.

And one more thing I cannot forget, it's SmartSVN. Visual Studio has AnkhSVN but I don't like it very much, it's really heavy. Another choice is VisualSVN but it has less features than AnkhSVN and it is underlying on TortoiseSVN. So I decided to use a SVN client rather than a Visual Studio add-in and SmartSVN is my choice.

Friday, December 08, 2006

What the hell is going on with my combo box?

These days I'm very busy with my works. But I found a problem and it can take me about 3 minutes to have a break and I use it to write this post.

The problem I found relates with ComboBox control in .NET Framework 2.0. A ComboBox control has a DataSource property which accepts a List<T> as value. And then you can specify value of ValueMember and DisplayMember for it to use as value and text in combo box.

I have a Tag(int id, string name) and ofcourse a List<Tag> (it is not empty). I filled the list to a combo box, use "id" as ValueMember and "name" as DisplayMember then set SelectedIndex is 0 to make sure that I always select at least one item on the list. When I click the arrow of combo box, the drop down list appears but I don't select any item from list. Then I've got SelectedIndex is -1 while my expected value is 0. At this time I want to crazy 'cause don't understand why it happened.

But later I found that, the problem is the DisplayMember's data. If the first item of the list has a "name" is an empty string, you will have this problem. Seems M$ implemeted to select text value to get the index. But if it's an empty string, the returned index will be -1.

Thanks M$ to make me crazy ;-)

Thursday, November 23, 2006

<script> and XHTML

You already knew that in XHTML, all tags must be closed even it is an empty tag but there are always exceptions. In XHTML, it's <script>.

When you use <script> to add JavaScript code to your page, in familiar way, it will look like that

<script type="text/javascript" language="javascript">
// code here
</script>

And if you want to include a external JavaScript file, you can use (in XHTML way)

<script type="text/javascript" language="javascript" src="blah.js" />

But it doesn't work (in IE and Firefox). If you want to make it works, you must use

<script type="text/javascript" language="javascript" src="blah.js">
</script>

It makes me want to be crazy 'cause I don't understand what happens to my application when the script went mad with JavaScript errors.

FYI: Script and Style elements

Update: Can you find some other tags which do not following the "empty tag" rule in XHTML for me? ;-)

Wednesday, November 22, 2006

t800t8.net is temporary down

Which Java web framework you should learn next?

As in my previous post, I showed you an estimation for several Java web frameworks from Matt Raible. Did you take free time to examine it? OK, in despite of you did it or not, let's take a look at my choice.

For me, the choice is Struts. Struts, again Struts, a Gorilla of MVC web framework. But, not Struts, more exactly, it's Struts2 (former name is WebWork)

Why? Just see the new features of Struts2 2.0.2. You can see: code behind, zero configuration, and many more... All of them (new features in Struts2 2.0.x) are really brilliant.

In the past, WebWork is a good framework but IMO it has the lack of documentation (and also marketing). But now it became under the umbrella of ASF, I bet that it will have the success as its ancestor, Struts.

At this time, I'm working with v2.0.1 beta and I will upgrade to v2.0.2 immediately when it comes out.

Sunday, November 12, 2006

What is it, NetBeans?



Update: Latest NetBeans 6

+ ints is an array of integer



+ Format code with label problem



The text is inside the red border rectangle should be indented.

+ Members View will look annoying if a JAVA file contains several classes


+ When I create new project, if I change the project name after entering main class name, main class name will change to [package_name].Main automatically. Please keep it as I entered (for class name only).

I tried to report to NetBeans team but seems their reporting site does not support to report by images. Sorry NetBeans, I'm a lazy man.

Friday, November 10, 2006

Điều kỳ diệu của thiết bị điện tử

Cách đây khoảng một tuần, cái laptop của tôi đột ngột trở chứng. Không hiểu vì lý do gì mà Windows (cả Ubuntu nữa) báo laptop đang chạy bằng pin với biểu tượng pin xuất hiện ở góc màn hình trong khi tôi vẫn cắm adaptor. Tuy nhiên thực tế khi đó máy của tôi đang chạy bằng nguồn điện bình thường (vì nếu chạy bằng pin đương nhiên nó chẳng thể hoạt động được đến 10 tiếng liên tục).

Nếu tôi rút adaptor ra, khi đó máy thực sự chạy bằng pin vì thấy % lượng điện giảm. Nhưng khi cắm adaptor vào thì dường như pin không chịu sạc , % lượng điện vẫn giữ nguyên, không tăng mà cũng chẳng giảm.

Không hiểu làm sao, tôi bắt đầu thử các trò:

+ Giật pin ra khỏi máy khi máy đang chạy (vẫn cắm adaptor) --> máy tắt
+ Thử bật máy khi cắm adaptor nhưng pin không được lắp --> máy không bật được
+ Chạy update BIOS của Dell --> nó báo "Mày phải cắm cả pin và adaptor vào"

Tôi chắc mẩm: "Teo rồi, chuẩn bị toi hơn 100$ để mua cục pin mới rồi"

Chợt tôi phát hiện một điều lạ. Con Dell Inspiron của tôi khi vào setup BIOS có mục thông báo có adaptor hay không. Tôi thấy nó báo "Không" trong khi vẫn cắm adaptor và máy vẫn đang chạy bằng nguồn điện bình thường (trong BIOS cũng có hiển thị mức pin, nó giữ nguyên và kèm theo "Discharging").

Chuyện kỳ lạ thật phải không các bạn? Nhưng tôi phải giải quyết vấn đề của mình thế nào bây giờ?

Trong lúc loay hoay, tôi để ý thấy khi tôi "lung lay" cái adaptor, BIOS báo "Có" rồi lại "Không", rồi có lúc lại "Có", rồi lại "Không". Eureka, vấn đề đây rồi! Hóa ra kẻ có vấn đề là chiếc adaptor. Ngay chiều hôm đó tôi gửi nó cho công ty sản xuất và ngay chiều hôm sau tôi nhận được một cái khác hoàn toàn mới (điều khó có thể xảy ra ở Việt Nam).

Tuy giờ là một cái adaptor hoàn toàn khác (loại 75W) so với cái cũ (loại 90W) nhưng với tôi thế vẫn OK. Cấu tạo phần dây nối của chiếc adaptor này sẽ khó có thể lặp lại vẫn đề tôi vừa đã gặp phải. Hơn nữa, cái adaptor 90W vừa to vừa nặng. Hạnh phúc!

Thiết bị điện tử vốn mang tiếng chính xác nhưng cũng có khi xảy ra chuyện thần thoại :-D

Sunday, October 29, 2006

Cái gì đây kỳ này?

Ai đã từng đọc Tuổi Trẻ Cười chắc chắn sẽ đều biết đến chuyên mục "Cái gì đây kỳ này?" của anh Hai Cù Nèo. Những dòng dẫn dắt ngắn gọn, hài hước, trào phúng nhưng vẫn đưa người đọc đến đoạn... ngồi đần ra rồi bỗng ngoạc miệng cười "Ha ha...".

Nhưng giờ là chuyện nghiêm túc đây, có cười gì thì cười đi rồi nghiêm chỉnh nào.

Hôm nay tớ làm bún đậu phụ mắm tôm.

Đêm qua ngủ tít mù đến gần 1h trưa mới thèm mò dậy. Bắt tay vào thực hiện kế hoạch nào (tớ định làm từ tuần trước nhưng vướng công việc nên đành lui lại). Bún có rồi, bún khô thôi, hôm trước đã nhờ anh H. mua hộ. Mắm tôm nữa chứ. Công đoạn phức tạp nhất là mua đậu về rán :-D

Kì cục đến gần 2h mới xong nhưng còn làm một số thứ việc nữa nên giờ mới chuẩn bị măm.

Hãy cùng chiêm ngưỡng tác phẩm của tớ nào.


Giờ tớ măm đây, mọi người chúc tớ ngon miệng nào. Cuộc đời đẹp làm sao ;-)

PS: Honey, khi em đọc được bài này thì anh đã măm xong rồi. Đừng trách anh ko mời nhé, ăn mảnh đấy :-P

Saturday, October 28, 2006

IoC pattern

IoC (Inversion of Control) pattern is a very popular pattern in Java world. It is used in J2EE, Spring, WebWork,... Maybe you don't figure out what is meaning of inversion of control, but actually it's very simple.

To explain inversion of control, we see active and passive actions. In active actions, I say "I'm going to get object X". And in passive actions, I say "Give me object X when I need it". Please see this example, here I implement an action in WebWork, it needs to retrieve a request object to set an attribute.

Active way

public class SetBlahAction implements Action {

public String execute() {
HttpServletRequest request =
ServletActionContext.getHttpServletRequest();
request.setAttribute("blah", "blah");

return SUCCESS;
}

}

Passive way (applied IoC pattern)

public class SetBlahAction implements Action, ServletRequestAware {

private ServletRequest request;

public void setServletRequest(ServletRequest request) {
this.request = request;
}

public String execute() {
request.setAttribute("blah", "blah");

return SUCCESS;
}

}

Here ServletRequestAware interface only defines setServletRequest(ServletRequest).

When using IoC pattern, you can reduce the works you need to do in a class by moving some implementation outside. Also it makes your class more clearly.

Friday, October 27, 2006

Integrate Tomcat 6 to Apache 2 with mod_jk

Requirements

+ JDK 1.5 or later (http://java.sun.com/javase/downloads/index.jsp - Tomcat 6 cannot run with JDK before 1.5)
+ Apache 2 (http://ftp.apache-kr.org/httpd/binaries/win32/ - already setup and run)
+ mod_jk (http://www.apache.org/dist/tomcat/tomcat-connectors/jk/binaries/win32/)
+ and of course, Tomcat 6 (http://tomcat.apache.org/download-60.cgi)


Our Configuration

+ Java JDK path : C:\jdk1.5.0_09
+ Apache path : C:\www\Apache2
+ Tomcat path : C:\www\Tomcat6
+ Apache's webroot : C:\www\webroot
+ JSP/Servlet webroot (via Apache2/mod_jk) : C:\www\Tomcat6\webapps
+ JSP/Servlet webroot (via native Tomcat server, port 8080) : C:\www\Tomcat6\webapps
+ Access JSP/Servlet pages via Apache2/mod_jk : http://localhost/[jkmount-mapped url of your webapp]
+ Access native Tomcat server : http://localhost:8080/


Install JDK

+ Run file jdk-1_5_0_09-windows-i586-p.exe to install under your %SystemDrive% (C:\), forming C:\jdk1.5.0_09


Unpack and place Tomcat6 and mod_jk

+ Unpack file apache-tomcat-6.0.0.zip under directory C:\www
+ Rename directory C:\www\apache-tomcat-6.0.0 to C:\www\Tomcat6
+ Rename file mod_jk-apache-2.x.xx.so to mod_jk.so, and place under directory C:\www\Apache2\modules


Configuration and Setup

+ Set Environmental Variables : JAVA_HOME=C:\jdk1.5.0_09 and CATALINA_HOME=C:\www\Tomcat6
+ Create empty file C:\www\Apache2\conf\workers.properties, insert code...

workers.tomcat_home=C:/www/Tomcat6
workers.java_home=C:/jdk1.5.0_09
ps=\

# Define worker 'example'
worker.list=example

# Set properties for worker 'example' (ajp13)
worker.example.type=ajp13
worker.example.host=localhost
worker.example.port=8009

worker.example.cachesize=10
worker.example.cache_timeout=600
worker.example.socket_keepalive=1
worker.example.reclycle_timeout=300

+ Edit file C:\www\Apache2\conf\httpd.conf, insert code...

LoadModule jk_module modules/mod_jk.so

<IfModule mod_jk.c>

JkWorkersFile conf/workers.properties
JkLogFile logs/mod_jk.log
JkLogLevel error
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
JkRequestLogFormat "%w %V %T"

Alias /examples "C:/www/Tomcat6/webapps/examples/"

<Directory "C:/www/Tomcat6/webapps/examples/">
Options Indexes +FollowSymLinks
AllowOverride None
Allow from all
</Directory>

<Location /*/WEB-INF/*>
AllowOverride None
deny from all
</Location>

JkMount /examples/jsp/*.jsp example
JkMount /examples/servlets/* example

</IfModule>

+ Edit file C:\www\Tomcat6\conf\tomcat-users.xml, insert lines...

<role rolename="manager"/>
<user username="manager" password="manager" roles="manager"/>


Install and Start Tomcat

Tomcat can be installed as a Service or started as a Standalone Console application. Note to make sure that Apache has been started at this point.

As a service

+ Open the command-line prompt (Start » Run... cmd.exe)
    C:\www\Tomcat6\bin> service.bat install
    ...> NET START Tomcat6
+ To shutdown the Tomcat Service : ...> NET STOP Tomcat6
+ To remove/uninstall the Tomcat Service : C:\www\Tomcat6\bin> service.bat remove

As a standalone console application

+ Open the Command-Shell (Start » Run: cmd.exe), change to dir C:\www\Tomcat6\bin...
    Run file startup.bat to start Tomcat
    Run file shutdown to shutdown Tomcat


Testing

+ Test the native Tomcat server...
    http://localhost:8080/
    http://localhost:8080/manager/status -- User:manager, Password:manager

+ Test Apache/mod_jk...
    http://localhost/examples/jsp/
    http://localhost/examples/servlets/

Saturday, October 14, 2006

Welcome to t800t8.net

I've just finished to set up my web site at t800t8.net. Take your free time to visit it :-)

Friday, October 13, 2006

Google Code Search 1.1.0 is released

As I mentioned here about new feature in Google Code Search 1.1, this new release supports to search word at caret for appropriate language.

For more details, you can see here and here.

Tuesday, October 10, 2006

Google Code Search updates to v1.0.1

New features: Added supports for C and C++

You can find out more here.

I'm considering new feature for v1.1. Google Code Search should support to find source code at caret for specified language (depends on type of file which is opening in editor) when user presses a shortcut key (example: Ctrl + Alt + G). Seems I need to create another action for this feature.

What do you think about this? Any suggestion and feedback are welcome :-)

Update: I'm not familiar with Ruby and Python. Seems Ruby source code only has RB extension, and for Python is PY. Are there any more extensions for these languages? Thanks

Sunday, October 08, 2006

Rockstar

Rockstar
Nickelback

I'm through with standing in line
to the clubs i'll never get in
It's like the bottom of the ninth
and I'm never gonna win
This life hasn't turned out
quite the way I want it to be

(Tell me what you want)

I want a brand new house
on an episode of Cribs
And a bathroom I can play baseball in
And a king size tub big enough
for ten plus me

(so what you need)

I'll need a, a credit card that's got no limit
And a big black jet with a bedroom in it
Gonna join the mile high club
At thirty-seven thousand feet

(Been there done that)

I want a new tour bus full of old guitars
And my own star on Hollywood Boulevard
Somewhere between Cher and
James Dean is fine for me

(So how ya gonna do it?)

I'm gonna trade this life for fortune and fame
I'd even cut my hair and change my name

[CHORUS]
'Cause we all just wanna be big rockstars
Living in hilltop houses driving fifteen cars
The girls come easy and the drugs come cheap
We'll all stay skinny 'as we just won't eat
And we'll hang out in the coolest bars
In the VIP with the movie stars
Every good gold digger's
Gonna wind up there
Every Playboy bunny
With the bleach blond hair
and well..
Hey hey I wanna be a rockstar
Hey hey I wanna be a rockstar

I wanna be great like Elvis without the tassels
Hire eight body guards that love to beat up assholes
Sign a couple autographs
So I can eat my meals for free

(I'll have a quesadilla haha)

I'm gonna dress my ass
with the latest fashion
Get a front door key to the Playboy mansion
Gonna date a centerfold that loves to
blow my money for me

(So how ya gonna do it?)

I'm gonna trade this life
For fortune and fame
I'd even cut my hair
And change my name

'Cause we all just wanna be big rockstars
Living in hilltop houses driving fifteen cars
The girls come easy and the drugs come cheap
We'll all stay skinny 'as we just won't eat
And we'll hang out in the coolest bars
In the VIP with the movie stars
Every good gold digger's
Gonna wind up there
Every Playboy bunny
With the bleach blond hair
And we'll hide out in the private rooms
With the latest dictionary and
TV's who's who
We'll get you anything
with that evil smile
Everybody's got a
drug dealer on speed dial
well..
Hey hey I wanna be a rockstar

I'm gonna sing those songs
that offend the censors
Gonna pop my pills
from a pez dispenser
Get washed-up singers writing all my songs
Lip sync 'em every night so I don't get 'em wrong

Well we all just wanna be big rockstars
Living in hilltop houses driving fifteen cars
The girls come easy and the drugs come cheap
We'll all stay skinny 'as we just won't eat
And we'll hang out in the coolest bars
In the VIP with the movie stars
Every good gold digger's
Gonna wind up there
Every Playboy bunny
With the bleach blond hair
And we'll hide out in the private rooms
With the latest dictionary and
TV's who's who
We'll get you anything
with that evil smile
Everybody's got a
drug dealer on speed dial well..
Hey hey I wanna be a rockstar
Hey hey I wanna be a rockstar

Saturday, October 07, 2006

Google Code Search 1.0 is released

Google released code search service, and now I release Google Code Search 1.0, an IntelliJ IDEA's plugin supports users to search source code via Google's code search.

For more information, you can see here.

Update: Batch Generator is downloaded over 200 times :-)

Monday, October 02, 2006

IntelliJ IDEA 6 is released

Time after time, and now time is came, IntelliJ IDEA 6 is released. JetBrains spent many resource to born a new version of IDEA. IDEA 6 has many new features to provide more powerful to developers who want to create more productive software.

I followed the road JetBrains created IDEA 6 from the first EAP. I knew that JetBrains met many problems during that journey with many users' blames and complains. And the lesson I learned from it is "Listen to the users but under pressure you must always follow your own way".

Congratulation, JetBrains! Congratulation, developers! Development with pleasure is here!

Update: At the same time, JetBrains released version 1.0 of Team City, an integrated team environment.

Saturday, September 30, 2006

Which Java web framework you should choice?

Matt Raible at Virtuas made a presentation about some Java web frameworks, they are included Struts, Spring MVC, Tapestry, WebWork and JSF. He provided basic information about them and the criteria you should consider before choose any framework to work.

For this presentation, you can download it here.

And here you can find a series of interviews web framework authors did by Matt. Interesting interviews!

IntelliJ IDEA 6.0 Release Candidate 3 (build 5755) is available

At this time JetBrains only focuses in fixing critical bugs and improvement. This build has many good feedback from users. For changes in this build, you can see here.

Wednesday, September 27, 2006

IntelliJ IDEA 6.0 Release Candidate 2 (build 5745) is available

This is a bugfixes build with some minor improvements. For more details, you can see here.

I guess that IDEA 6 final will be released about October 15.

Batch Generator 1.1 is released

Change notes:
   New feature: Supports to generate hardcode arguments
Fixed bug: Need to reset return value of dialog if user click Cancel
Fixed bug: Some minor bugs

Batch Generator 1.1: plug-in, source code, license, user's guide, contest

Monday, September 25, 2006

And now is new feature for 1.2

If users generate batch file in current project's context which is under control of a VCS, Batch Generator should ask users to add the batch file to VCS.

At this time, it's only the idea because I need to research IDEA's OpenAPI also it will depend on my time. But I will try my best before the contest reaches to the end.

Plan for Batch Generator 1.1

After v1.0 is released, I found that Batch Generator should support users enter hard code arguments.

I will start the next release, v1.1, today and hope that it can be finished this weekend.

Update: At this time (September 26, 2006 12:18 AM), after about 3 days, Batch Generator is already downloaded 31 times (of course, I didn't download it 30 times ;-). I encouraged because I didn't think the download times of my plug-in is over 20. Maybe somebody will remove it after a try, but users can know about my plug-in's features via the user's guide. It's very simple plug-in but if it's not useful, nobody will give it a try.

Congratulation me ;-)

Sunday, September 24, 2006

How Can I Not Love You

How Can I Not Love You
Joy Enriquez

Cannot touch, cannot hold, cannot be together
Cannot love, cannot kiss, cannot love each other
Must be strong and we must let go
Cannot say what our hearts must know

Chorus:
How can I not love you
What do I tell my heart
When do I not want you here in my arms
How does one walks away
From all of the memories
How do I not miss you when you are gone

Cannot dream, cannot share sweet and tender moments
Cannot feel how we feel, must pretend its over
Must be brave and we must go on, must not say
What weve known all along

Chorus:
How can I not love you
What do I tell my heart
When do I not want you here in my arms
How does one walks away
From all of the memories
How do I not miss you when you are gone

How can I not love you

Bridge:
Must be brave and we must be strong
Cannot say what weve known all along

Chorus:
How can I not love you
What do I tell my heart
When do I not want you here in my arms
How does one walks away
From all of the memories
How do I not miss you when you are gone

How can I not love you
When you are gone

What's next?

After releasing Batch Generator, I've just had a new idea. At the first time when I had this idea, it aimed to resolve my own problem. Later I think it can help others too. It can be provided as a service or value-added product.

At this time, it's only the idea and you can only know it with the name "SSRSS".

Saturday, September 23, 2006

Batch Generator 1.0

I attended IntelliJ IDEAL plug-in contest with Batch Generator. It's my first IntelliJ IDEA plug-in. It's not complex enough to earn me $5000 plus a bunch of software but it's good enough to help me to have a new T-shirt. Beyond this, after a painful lesson, I learned a new lesson: When you have an idea, please do it, do it immediately. It's the biggest prize for me at this time.

Batch Generator 1.0: plug-in, source code, license, user's guide

For the idea to create this plug-in, you can see here.

Thursday, September 21, 2006

IntelliJ IDEA 6.0 Release Candidate 1 (build 5734) was released

JetBrains released IntelliJ IDEA 6.0 Release Candidate 1 (build 5734). Here are changes in build 5734 from 5706:

* Plugins. Included sources of GWT Studio, JBoss, Geronimo
and GlassFish plugins in the Plugin Development Package.
* Bugfixes and minor improvements.

Complete list of changes here

Update: New splash of IDEA 6. I like it than the old one in IDEA 5, it looks more professional

Bài học tiết kiệm của người Hàn

Hôm kia và hôm nay công ty có chuyện lạ. Chẳng hiểu sao mấy thằng ở công ty lại vác cơm đi ăn trong khi bình thường cả lũ vẫn kéo nhau ra ngoài. Mấy thằng Việt ngố chẳng hiểu gì cứ đoán già đoán non: "Chắc chúng nó có việc gì bận nên ăn vậy cho nhanh". Hôm nay, mình cũng thử ngồi ăn với chúng nó xem sao.

Mẹ kiếp, cơm gì mà lèo tà lèo tèo toàn thứ vớ vẩn. Tí thịt, tí trứng còn toàn là rau linh tinh. Những thứ được nhồi vào bụng nhiều nhất là một hộp mì ăn liền và một hộp cơm (cơm hộp bên này có loại giống như nấu sẵn vậy, hâm nóng lên là ăn luôn, mà là cơm không thôi nhé).

Hỏi Park xem hôm nay có phải ngày gì đặc biệt không (tại sắp tới là Chusok - trung thu, mà trung thu của người Hàn thì to như Tết, nghỉ tận 3 ngày liền). Park bảo không phải. Hỏi tại sao lại tự nhiên cả lũ lại ăn như vậy, Park bảo, "Tao đếch biết". Hỏi Nam, Nam bảo chẳng phải ngày đếch gì đặc biệt cả, "bọn tao đang thử nghiệm để saving money".

Ăn thì đói mờ mắt ra, thế mà còn học đòi saving money. Đã muốn saving money mà còn không dám nhận. Thay vào đấy chúng nó bớt hút thuốc lá đi, rồi nhồi cơm, nhồi thịt vào có phải saving được tốt hơn không. Nhưng nhìn bọn nó cũng ngãm lại ở VN mình. Quan trên thì phè phỡn, dân cũng phung phí tơi bời. Riêng điều này đáng để học tập dân Hàn đấy ;-)

Tuesday, September 19, 2006

Getting file extension

Java doesn't give you a way to get the extension of a file so you must do it yourself.

Usually you will get the position of the dot then use it to extract the extension. But it is not a correct way. Why? Because it depends. Depends on what? Depends on you and the OS you target.

If you use Windows, it's OK. Files in Windows can have extension. But in *nix, it's a different story. So you target to run your application both in Windows and *nix, you should consider this problem.

If your application target to run on Windows only, it's fine if you use the position of the dot to extract the extension (but remember, you must use lastIndexOf("."), not indexOf(".") because in Windows, extension will be determine by the position of the dot and from right to left of filename, not from left to right).

The below code fragment runs well in Windows and Linux.

public String getExtension(File file) {
String osName = System.getProperty("os.name");

if (osName.startsWith("Windows")) {
String filename = file.getName();
int index = filename.lastIndexOf(".");

if (index > 0 && index < filename.length() - 1) {
// extesion in Windows doesn't include the dot
// so we must use (index + 1) to substring
return filename.substring(index + 1).toLowerCase();
} else if (index == filename.length() - 1) {
// the dot is the last character in filename
// so extension is blank
return "";
}

// otherwise, this file doesn't have extension
// so we should return null
}

return null;
}


Update: Correct the source code

1-to-0..* and 1-to-1..*

This afternoon I think about how can I represent 1-to-0..* and 1-to-1..* relationship between objects.

First, I should describe what are 1-to-0..* and 1-to-1..*. 1-to-0..* means 1 object of this class can have relationship with 0 or more objects of another class. And 1-to-1..* means 1 object of this class can have relationship with 1 or more objects of another class.

A tourist guide can guide zero or more tours. But an order, it must contains at least one order item. In contrary, a tour and an order item cannot exist without tourist guide and order.

Of course, in TouristGuide class and Order class should contains a collection to keep the tours and order items. But how to represent the 1-to-0..* and 1-to-1..* relationships? User can call getTours() or getOrderItems() any time he wants.

I think in 1-to-0..* relationships, when user invokes getTours() on a TouristGuide, he can have a collection contains no element if that TouristGuide doesn't have any Tour to guide. But in 1-to-1..* relationthips, when user invokes getOrderItems() on an Order, he can have a null value if that Order didn't contain any OrderItem yet.

class TouristGuide {

private ArrayList<Tour> tours = new ArrayList<Tour>();

public ArrayList<Tour> getTours() {
return tours;
}

public void addTour(Tour tour) {
tours.add(tour);
}

...

}

class Order {

private ArrayList<OrderItem> orderItems;

public ArrayList<OrderItem> getOrderItems() {
return orderItems;
}

public void addOrderItem(OrderItem orderItem) {
if (orderItems == null) {
orderItems = new ArrayList<OrderItem>();
}

orderItems.add(orderItem);
}

...

}

IntelliJ IDEA 6 build 5706 was released

Yesterday night, after I went to sleep about 15 minutes, JetBrains released IntelliJ IDEA 6 build 5706. It's a bug fixed build. For more details, you can see here.

JetBrains will focus on fix Critical and Blocker priority bugs rather than implement new features. Also, lower priority bugs will be fixed after releasing IDEA 6.

IDEA 6 RC1 will come soon...

Other news relate with SVN and TestNG:

   + TortoiseSVN 1.4 was released last Friday
   + JavaSVN will support SVN 1.4 in next release
   + TestNG 5.2 was released 2 days ago also with an update for TestNG-J.

Preparing to release

I've just finished the first version of my project 5 minutes ago. Now I can take a rest with some breads and a little of milk.

What're next steps? Hmmm, I need to choose the license and write some documents. Hope that I can release it this weekend :-)

Go to sleep now...

Saturday, September 16, 2006

An old opportunity

Tonight, here and alone, I just remember an opportunity I missed in the past. I think it was a good opportunity, but I didn't catch it when I could and now I must regret.

4 years ago, I graduated the university and started to work at Hobo Hanoi. It's a small company with about 15 members. There was a place I will keep it in my memory for a long time where I had the first job, where I improved my little knowledge and my experience.

Most of jobs I did in Hobo Hanoi at that time relate with NorthShore project (more extractly, some projects). It's a real state management system for NorthShore Inc. and we deveploped a client/server version (with Visual Basic) and 3 web versions (2 with ASP, 1 with Java). The Java version started but never finish. The most interesting things are in 2 ASP versions: The client required us to develop a "grid style" form to support they enter data.

We did it. It's not perfect solution but it's good enough to satisfy client's requirement. Our "grid" can enter text, number, date (with validation and format), calculate total for "number" column (result will be showed in footer). It can has combo box columns, also radio button and checkbox. It supports dependency between columns (example: when you change this combo box, values of the depended combo box will be changed). It only update the rows you changed. You can delete some rows at one time. Also you can add a new row on the "grid" (don't need to use another form). But it's very hard to reuse because we didn't implement it as a component. And now you can guess what was my opportunity.

At that time, as I searched, there was only one grid component for ASP, ASPGrid. But they only supports in basic level (enter text, number, date with validation and format, combo box column). They created a ActiveX component and use an XML configuration file. All the things developer need to do is creating an XML configuration file and do Server.CreateObject() in ASP pages. Developers don't need to use Response.Write() to write the grid out 'cause ActiveX component did it.

I implemented a very simple ActiveX component, it supported to enter text only (no validation, no combo box, no format,...) But I threw it away, at that time .NET Framework is released in beta. I decided to move to Java 'cause at that time in Java field, there wasn't any "grid" component. (display:tag can show data only with sorting). I read JSTL, JSP tag libraries. But... Now I must regret.

Some days ago I have an opportunity to move to another company, they work in RIA (Rich Internet Applications - more detail: Java/Flash/Flex). But I decided to stay. I'm having a challenge (at current company) and I want to win it. If I win, it will open a big opportunity for me. But if I fail, no problem, I will have a good lesson and I will find another one.

Friday, September 15, 2006

How to read a specification?

These days, I need to do a research on EPCIS specification. It's the first time I read a spec carefully (I played with JLS but in a "overview" way). I tried to read the spec likes I want to eat each by each words. But it's very slow and the spec is really hard to remember. I decided to find a better way to read a spec.

Here is an article can help you to read a spec easier. Even though it focuses on W3C specs, but it still provides some useful information. And another one for functional spec.

Thursday, September 14, 2006

Blogger added label

Seems today Blogger added supporting for labels, somebody will familiar with it by "tag". During the upgrading process, you can't browse blogs even though you can post, edit blog items.

I think they should provide supporting to add label for old blog items. At this time you need to edit each item to set its label.

IntelliJ IDEA 6 build 5692 is released

About 38 minutes ago, JetBrains released IDEA 6 build 5692. Here are changes in build 5692 from 5661:

* JavaScript. Bundled Inspection-JS plugin.
* Java EE. Bundled JBoss, Geronimo and GlassFish plugins.
* Bugfixes and minor improvements.

More details, see here.

Wednesday, September 13, 2006

Subversion 1.4.0 was released

3 days ago, Subversion 1.4.0 was released. But at this time, there aren't any SVN clients support for Subversion 1.4.0 (TortoiseSVN 1.4.0 still release candidate and compiled for Subversion 1.4.0 RC4)

Here is Subversion 1.4.0 release notes.

Tuesday, September 12, 2006

StringEx 0.2.2 and t800t8.net

Sorry to take you wait in a long time, today I decided to publish StringEx 0.2.2 source code, tests and binary files. You can download it here.

And a new news, t800t8.net will come soon. I hope it will not late like StringEx 0.2.2 ;-)

Saturday, September 09, 2006

Hamburg song - a very sad song

Hamburg song
Kean

I don't wanna be adored
Don't wanna be first in line
Or make myself hurt
I'd like to bring a little light
To shine a light on your life
To make you feel loved

No, don't wanna be the only one you know
I wanna be the place you call home

I lay myself down
To make it so, but you don't want to know
I give much more
Than I'd ever ask for

Will you see me in the end
Or is it just a waste of time
Trying to be your friend
Just shine, shine, shine
Shine a little light
Shine a light on my life
Warm me up again

Fool, I wonder if you know yourself at all
You know that it could be so simple

I lay myself down
To make it so, but you don't want to know
You take much more
Than I'd ever ask for

Say a word or two to brighten my day
Do you think that you could see your way

To lay yourself down
And make it so, but you don't want to know
You take much more
Than I'd ever ask for

Thursday, September 07, 2006

IntelliJ IDEA 6 build 5661 was released

I miss this new version when it's out yesterday 'cause at that time I was learning to write a plug-in for IDEA. I only know JetBrains released it today.

Here are changes in build 5661 from 5650:

* CVS. Offline mode support.
* Intention to create enum constant.
* Bugfixes and minor improvements.

More details you can see here.

You can download it here (required registration)

Wednesday, September 06, 2006

IntelliJ IDEA plug-in contest's T-shirt


Do you like these T-shirts? I don't like them very much. I hope that JetBrains will change them.

A suggestion: Why don't make a "Plug with pleasure" T-shirt (with an IDEA icon)?

Check required arguments for batch files

Sometimes you need to create a batch file (*.BAT, *.CMD) to run a Java application, but your application need to pass some arguments from outside. It will be better if you can provide the arguments from command prompt instead using hard code inside the batch file. At that time, you should provide some basic logical to check the number of arguments you pass into the batch file.

Of course, it cannot replace logical to check required arguments inside your Java application ('cause user can run your Java application without the batch file). But it can provide a more flexible way to run Java application.

And here is your solution:

HelloKitty class requires to pass 2 arguments, they're presented by %1 and %2 and assume that you store this code segment into hello.bat

@echo off
if "%2"=="" goto error

java HelloKitty %1 %2
goto end

:error
echo Usage: hello arg1 arg2

:end

Tuesday, September 05, 2006

H2 1.0 is out

A very fast, small, new open source database from Hypersonic author is out, H2. It has a very nice feature: web client with supporting for i18n (English, German, French, Spanish, Chinese)


Performance
(source: http://www.h2database.com)

Saturday, September 02, 2006

IntelliJ IDEA 6 build 5650 was released

Yesterday night, when I was drinking with my friends, JetBrains released IntelliJ IDEA 6 build 5650. Here are changes in build 5650 from 5646:

* GUI Designer. Better GridBagLayout support (all properties of
GridBagConstraints are now editable).
* JUnit. Intenion to add junit.jar to classpath.
* Bugfixes and minor improvements.

For more detail, you can see here.

Now, after waking up with a heavy head (I drank a lot of beer and whisky), I have something to play with :-)

Friday, September 01, 2006

JUnit 4 vs. TestNG

An interesting article from Andrew Glover. You can find it here.

Linspire makes Click and Run FREE

Read it here. A good news for any Windows users want to move to Linux.

I'll give it a try :-)

Thursday, August 31, 2006

Mysaifu JVM 0.2.9

Mysaifu JVM was updated 5 days ago with new supports for Windows CE 5.0

You can find out more about Mysaifu JVM here.

IDEA Plugins contest

Write plug-ins now and earn prizes later: http://plugins.intellij.net/contest

Update: An article about writing IDEA plug-in. Don't wait anymore, earn prizes now ;-)

Wednesday, August 30, 2006

IntelliJ IDEA 6 build 5646 is released

JetBrains released IntelliJ IDEA 6 build 5646.

Changes in build 5646 from 5622:

* Possibility to suppress Unused Property inspection in .properties files.
* VCS. Update and commit are performed in background.
* VCS. Actions to move files between changelists and to select files
in Changes view.
* IDETalk. SSL support.
* Permute arguments quickfix on method calls which have reversed order
of arguments - for example, (int,String) instead of (String,int).
* VCS. New search scope "Changed files".
* OpenAPI. Possibility to plug custom FormattingModel.
* OpenAPI. Custom suppression actions for inspections.
* Bugfixes and minor improvements.

Complete list of changes here

Update: A bug

Tuesday, August 29, 2006

Manifest drives me crazy

I have a manifest file. Here is its content:

Manifest-Version: 1.0
Main-Class: kr.co.xxx.rfReader2SerialPort.RFReader2SerialPort

I create a BAT file to run my application. Here is its content:

java -cp ./lib/converter.jar;./lib/comm.jar
-jar ./RFReader2SerialPort.jar

When I run it, command prompt shows me ConnectionException. It means my application cannot connect to reader (via socket connection). It's not correct, my reader still working. I tried some times and got another error, NoClassDefFoundError, seems it cannot find comm.jar

But if I change the BAT file to

java -cp ./RFReader2SerialPort.jar;./lib/converter.jar;./lib/comm.jar
kr.co.xxx.rfReader2SerialPort.RFReader2SerialPort

It works well.

What happens with my manifest? Or do I miss something?

JavaTech: An Introduction to Scientific and Technical Computing with Java

An easy to read book, read here

Another resource for Java beginners: http://javaworkshop.sourceforge.net

What is a small ISV?

+ ISV stands for Independent Software Vendor
+ An ISV is not a consulting shop but sometimes it does consulting
+ An ISV is not a value-added reseller but sometimes it resell something from other stuff
+ An ISV makes, markets and sells software by itselt. This means it accepts the risky from its products and maybe its customers will go away and take it alone
+ A small ISV is not big. A small ISV has 5 developers, 25 developers, 50 developers but if over 100 developers, you should consider it still small or not

Monday, August 28, 2006

You're gone


You're gone
Diamond Rio


I said hello I think I'm broken
And though I was only jokin'
It took me by surprise when you agreed
I was tryin' to be clever
For the life of me I never
Would have guessed how far the simple truth would lead
You knew all my lines
You knew all my tricks
You knew how to heal that pain
No medicine can fix

And I bless the day I met you
And I thank God that He let you
Lay beside me for a moment that lives on
And the good news is I'm better
For the time we spent together
And the bad news is you're gone

Lookin' back it's still surprisin'
I was sinking you were rising
With a look you caught me in mid-air
Now I know God has His reasons
But sometimes it's hard to see them
When I lie awake and find that you're not there
You found hope in hopeless
You made crazy sane
You became the missing link
That helped me break my chains

And I bless the day I met you
And I thank God that He let you
Lay beside me for a moment that lives on
And the good news is I'm better
For the time we spent together
And the bad news is you're gone
The bad news is you're gone

Saturday, August 26, 2006

Rafting

Today I went to play rafting with my company. After about 3 hours start from Seoul, we finished the journey. Nothing special at the place we'd gone but playing rafting, it's another story.

Most of time we stayed in the boat on quiet surface of water. It's OK 'cause we are not professionals also this is the first time I play rafting. But sometimes we met bumpy area and the team need to work together to win. I had a lot of joy and fun.

But the most interesting thing is I have an opportunity to analyze what I read in "Practices of an Agile Developer: Working in the Real World": Developing software like surfing (at this time, rafting), the way to get success is adapting to the waves which come non-stop to dominate them.

This journey is a good memory for me when I were working in Korea. In the future, I want to have more opportunities to play rafting and other danger games. And of course, I hope that my girlfriend will join with me.

Friday, August 25, 2006

Be careful before install IE 7 RC 1

I've just install IE7 RC1. After restart, I want to be crazy when Windows shows me "Explorer.exe cannot run because Normaliz.dll could not be found".

After searching around on Internet, I found the solution (God blesses me, I have a Linux notebook :-D).

If you want to install IE 7 (seem this problem relates with all IE7 versions, included Beta 2, Beta 3 and RC1, which maybe happen when you install or uninstall IE7), please backup Normaliz.dll first. After install IE 7, don't be crazy if you meet this problem. Here is the solution:

+ Press Ctrl + Alt + Del then click Task Manager
+ In tab Applications, click New Task...
+ In Create New Task dialog, click Browse...
+ In Browse dialog, copy Normaliz.dll you already backed up to Windows\System32
+ Now run explorer.exe (in Windows folder) and smile with a large mouth

Buildix - The Agile Development Platform


Buildix's homepage: http://buildix.thoughtworks.com/

Some blogs

+ Buildix
+ Introducting Buildix - The Agile Development Platform on a disk
+ Buildix: Project in a Box

FYI:

+ Agile software development
+ Manifesto for Agile Software Development
+ Continuous Integration

Thursday, August 24, 2006

A bug in IntelliJ IDEA 6 build 5622 relate with Thread class

See it here.

Seems JetBrains needs to do many things to release IntelliJ IDEA 6 final :-(

Spam

Riêng hôm nay đã gửi post này là post thứ 5 rồi, spam lắm thế.

Công việc đã vượt được qua phần khó khăn nhất rồi. Giờ mình đã có thể làm việc với cổng serial được cả bằng .NET lẫn Java. Còn ngày mai với tuần sau nữa để hoàn thành công việc. Vẫn còn nhiều thứ để làm...

Firefox 2 Beta 2 and FlashGot

With the new beta version of Firefox 2, you will not have the option to download a file by using FlashGot when you click the link (and option to open the file by program you want). You must right click and then FlashGot Link or Ctrl + F1.


How can I open it when you only provide Save and Cancel option?

My short answer for Java closures

Thanks, but no thanks. Don't make my life more complex. In Vietnam, we're typing worker so it's not difficult to type a little more :-D

Some acronyms

Sometimes you see AFAIK, FYI, KISS, DRY,... and you don't understand what the hell are here. But they're only acronyms. Some of them are very popular in general world, some of them are popular in IT world only. And here are some of them:

+ KISS: Keep It Simple Stupid
+ WYSIWYG: What You See Is What You Get
+ DRY: Don't Repeat Yourself
+ LOL: Laughing Out Loud
+ AFAIK: As Far As I Know
+ IMO: In My Opinion

and there are many more.

You can found more here, here and here.

Mysaifu JVM

These days I play around with Pocket PC & Windows CE but I stuck with communication with serial port. I played with .NET and now Java but I did not resolve my problem yet. But I found an up-and-coming JVM for Pocket PC, it's Mysaifu, from Japan.

As you can see the Mysaifu's objective, the author of Mysaifu wants to make a JVM which conforms to J2SE. It means that you can write an application for PC and then run on Pocket PC without limitation. I think it's a nice project.

If you have some experience with other JVMs for handle devices (except the one from Sun) you seems don't like them very much. An example is Ewe VM. When you write an application to run on Ewe VM, your source code will look like Visual J++, not pure Java.

If you have time, and of course, a Pocket PC, please try to play with Mysaifu you will have something fun.

FYI: A ported library of Java Communications API for Windows CE/Pocket PC --> http://www.teilo.net/software/CEJavaComm/

Wednesday, August 23, 2006

New method in Java SE 6 makes IDEs more difficult

In Java SE 6, Sun adds to System a static method console() which returns an instance of java.io.Console. But at this time, most of IDEs do not accept to use output pane as a console so in IDE when you run your application tries to access methods of System.console(), you will have a NullPointerException.

Tuesday, August 22, 2006

How to mount a flash drive manually

Today my Ubuntu 6.06's X Windows is broken, I ask my problem on VnOSS.org and a member ask me to post xorg.conf to forum to help him see what happens with my Ubuntu.

With my very little experience, I don't know how to get the content of xorg.conf. Suddenly, I remember my flash drive. EUREKA!!!

I tried to find a solution to mount my flash drive and found here and here. The first post is very good one but when I try

sudo mount -t vfat -o uid=t800t8,gid=users /dev/sda /media/flash

it doesn't work.

OK, try with

sudo mount -t vfat -o uid=t800t8,gid=users /dev/sda1 /media/flash

Now everything is fine. I can copy xorg.conf and Xorg.0.log to my flash drive.

With the second post, I know how to unmount a device.

sudo umount /media/flash

Friday, August 18, 2006

TestNG 5.1 is released

A few minutes ago, Cedric announced TestNG 5.1 but he uploaded it some days ago for testing.

Now waiting for Mark (and Hani?) update their TestNG-J...

IntelliJ IDEA's trend

I tried to find IntelliJ IDEA in Google Trends and here is the result: http://www.google.com/trends?q=IntelliJ+IDEA&ctab=0&geo=all&date=all

If it's correct, IDEA should support for Czech's language and Chinese, not Japanese.

Just for fun :-D

Gyach-E - Yahoo! Messenger for Linux

What make the differences between Gyach-E and other IM clients (that support Yahoo! Messenger)?

+ Gyach-E can log on with invisible mode (Gaim can't do)
+ Gyach-E can voice chat others (Kopete and Gaim can't do)
+ Gyach-E supports web cam (Gaim can't do)
+ Gyach-E can show popup when someone logs on and logs off (Kopete and Gaim, again Gaim, can't do)
+ Gyach-E can show popup when receives a new mail (with a voice message) (Gaim can't do)
+ Gyach-E supports to open your Yahoo! Mail directly from Gyach-E (Kopete and Gaim can't do)
+ Gyach-E can detect an user is invisible if he's online then change status to invisible (nice feature, huh?)
+ Gyach-E can keep connection really well (Try to log on to your account by another computer, it will be out immediately)

If you only need to chat with other YM users, Gyach-E is for you.

(I will provide more when I found any nice features Gyach-E can do)

How to install Gyach-E? (Thanks endersshadow)

1. Download http://www.politicalcrossfire.com/temp/enderavsig/gyach-install.tar.bz2, and save it to your home directory (important!).

2. Run these commands in the terminal, in sequential order:

tar -xjf gyach-install.tar.bz2
cd gyach
sudo ./install

Now try to run Gyach-E by "gyach" at terminal console.

Note: Maybe you need to install libtldl package to run Gyach-E.

Thursday, August 17, 2006

Black belt

Do you want to have Judo black belt? Oops, sorry, Java black belt. Come here.

It's a good site which has many volunteers they participate to guide you the basic of J2SE, Servlet, JSP, Spring, Hibernate and many more. It's really good for you if you want to get Java certificates.

Learn and contribute!

No Dolphin anymore, get the first build of JDK 7 now

No Dolphin anymore, get the first build of JDK 7 now.

Wednesday, August 16, 2006

IntelliJ IDEA 6 build 5622 is released

About 7 minutes ago, JetBrains release IntelliJ IDEA 6 build 5622. Here are changes in this build from build 5594:

* HTML Preview plugin for previewing Web pages in an embedded Mozilla
browser.
* Bugfixes and minor improvements.

For more details, see here.

Tuesday, August 15, 2006

Sun and open source Java

According to some news and blogs, Sun will open source Java ME (Java Micro Edition) and some components of Java SE (Java Standard Edition). Sun plans to open source javac compiler and HotSpot virtual machine, two crucial components of the Java SE platform, by the end of the year. The rest of the SE platform should be open sourced during the next year.

Monday, August 14, 2006

My desk


I want to replace my Samsung Sens X10 by a PC with Athlon 64 X2 4600+, 2 GB RAM, 300 GB HDD and 20' wide screen.

Can you help me? ;-)

One thing I don't like in Ubuntu Dapper Drake

I don't understand why in Ubuntu Dapper Drake when I change wireless network profile, it's too slow. Also when I apply a chosen profile, it's more slow.

Another problem in SuSE 10.1 relates with wireless network: I saved my wireless network's properties but every time I reconnect, I need to re-enter my network key.

I don't have these problems with a very little experience with Fedora Core 5.

Thursday, August 10, 2006

Decided to move

I decided to move my laptop from Windows to Ubuntu (Dapper Drake) after 3 weeks using dual-boot (Windows - Ubuntu). I only have a little experience as a Linux user but Ubuntu gave me an attractive impression. It supports me basic features I need also it's easier to use than SuSE and Fedora. Another thing, it's really fast and only need 1 CD to install.

After my Samsung Sens X10 is fixed, I will install Ubuntu in my Dell Inspiron 8600.

And beyond this, I decided to move a big bigger thing... ;-)

Tuesday, August 08, 2006

A song for Vietnamese men who are lovelorn

Just give this song for your (ex-)girl friend and live for yourself.

Lệ Đêm (by Linh Kent)

(Thanks my young cousin, a jolly guy)

Friday, August 04, 2006

IntelliJ IDEA Demetra build 5594 is released

About 10 minutes ago, JetBrains released IntelliJ IDEA Demetra build 5594. This is bug fix build. More detail, you can see here.

This weekend I have many things to do, they are included trying this build. And I cannot use Internet :-(

Update: And the first bug.

HOWTO setup xvnkb to type Vietnamese in Ubuntu

Note: If you don't have "gcc", "cvs" and "make" on your Ubuntu, please install them first

$sudo apt-get install gcc xlibs-dev libxft-dev make cvs


1. Get xvnkb source code from CVS (When it prompts password, please press Enter)

$ cvs -d ':pserver:anonymous@xvnkb.cvs.sf.net:/cvsroot/xvnkb' login
$ cvs -z3 -d ':pserver:anonymous@xvnkb.cvs.sf.net:/cvsroot/xvnkb'
checkout xvnkb


2. Make the source code

$ cd xvnkb
$ ./autogen.sh
$ ./configure
$ make


3. Install xvnkb

$sudo make install


Now you can start to type Vietnamese by using "xvnkb" at terminal console.

Update: After install xnvnkb, you can type Vietnamese in Word or gedit but cannot in Firefox. To type Vietnamese in Firefox, you need to install CHIM extension for Firefox from this address: http://xvnkb.sourceforge.net/chim/chim.xpi

Get free domain name now

You want to have a free domain name like mine (http://t800t8.net.tf)? Try it.

New bug in IntelliJ IDEA build 5581

See it here.

Ngày nhiều việc

Gần 6h tối rồi, xem hôm nay làm được những trò gì nào.

+ Reconstruct cái cấu trúc của dự án
+ Đánh vật với cái Ant build dài 488 dòng
+ Download được 3 album nhạc: Queen - Greatest Hits 2, Lifetime Of Romance - Be My Love và Lifetime Of Romance - Heartbreakers
+ Download được 2 cuốn sách
+ Cài cái IETab extension cho Firefox + viết hướng dẫn cho cái H nhà mình
+ Cơm ăn no
+ Rửa mặt 2 lần
+ Ngáp nhiều cái
+ Giờ thì đang mỏi mắt, buồn ngủ và chuẩn bị report một lỗi của IDEA

Ha ha, mình làm được khối việc đấy chứ.

Giờ này cô ấy đang làm gì nhỉ? Mấy hôm nay ở nhà đang bão nên giờ này chắc cô ấy đang ngủ khì. Hôm trước nói chuyện với cô ấy thấy cô ấy thật vui vẻ với nụ cười có lẽ lâu lắm mình mới thấy ở cô ấy.

"Em cứ yên tâm nghỉ ngơi ở nhà, không phải lo lắng gì cho anh đâu. Mọi việc của anh tốt cả. Báo cáo em, đêm qua anh tiêu diệt được 4 con muỗi."

Thursday, August 03, 2006

How do you construct your projects?

In IDEA 6, default project's structure has some changes. And everybody has his own way to construct his projects. But I want to know what is best way to organize it (at least, the best way with IDEA).

In my opinion, I construct my projects like this

[project-root]
|
|------- \Module1
| |
| |------- \src
| |------- \test
| |------- \javadoc
| |------- \lib
| |------- build.properties
| |------- build.xml
|
|------- \Module2
| |
| |------- \src
| |------- \test
| |------- \javadoc
| |------- \lib
| |------- build.properties
| |------- build.xml
|
|------- \build
| |
| |------- \production
| | |
| | |-------- \Module1
| | |-------- \Module2
| |
| |------- \test
| |
| |-------- \Module1
| |-------- \Module2
|
|------- \dist
| |
| |------- \Module1
| |------- \Module2

How about your opinion?

A bug in IntelliJ IDEA build 5581

See it here.

Sometimes the icon of files in tab bar will disapear. If I close IDEA then reopen, they will appear.

Wednesday, August 02, 2006

Subversion + Apache2 + SSL on Ubuntu in 10 steps

1. Install required packages

sudo apt-get install subversion libapache2-svn
libapache-mod-dav apache2

2. Enable SSL support in Apache

sudo a2enmod ssl

3. Stop Apache

sudo /etc/init.d/apache2 stop

4. Let Apache2 listen on port 443

sudo gedit /etc/apache2/ports.conf

Add to the end of file

Listen 443

5. Create SSL certificate

sudo apache2-ssl-certificate

Provide some information following the prompt

Country Name: <country_code> (example: VN)
State or Province Name: <state_name>
Locality Name: <city_name>
Organization Name: <organization_name>
Organization Unit Name: <organization_unit_name>
Server Name: <server_name>
Email Address: <email_address>

6. Configure site

sudo cp /etc/apache2/sites-available/default
/etc/apache2/sites-available/<sitename>

then edit

sudo gedit /etc/apache2/sites-available/<sitename>

        
  1. Change NameVirtualHost to NameVirtualHost *:443
        
  2. Change <VirtualHost> to <VirtualHost *:443>
        
  3. Append before </VirtualHost> the following

SSLEngine on
SSLCertificateFile /etc/apache2/ssl/apache.pem
SSLProtocol all
SSLCipherSuite HIGH:MEDIUM

Then create a symbol link to your site configuration in sites-enabled

sudo ln -s /etc/apache2/sites-available/<sitename>
/etc/apache2/sites-enabled/<sitename>

Note: <sitename> should be same as your hostname

7. Create a Subversion Repository

sudo svnadmin create /var/lib/svn
sudo chown -R www-data:www-data /var/lib/svn
sudo chmod -R g+ws /var/lib/svn

8. Use Apache for Authentication

sudo htpasswd -c -m /var/lib/svn/conf/htpasswds <username>

9. Configure mod_dav

edit dav_svn.conf

sudo gedit /etc/apache2/mods-available/dav_svn.conf

DAV svn
SVNPath /var/lib/svn
AuthType Basic
AuthName "Subversion Repository"
AuthUserFile /var/lib/svn/conf/htpasswds
Require valid-user
SSLRequireSSL

Disable anonymous browsing by commenting out the following:

#<LimitExcept GET PROPFIND OPTIONS REPORT>
# Require valid-user
#</LimitExcept>

10. Start Apache

sudo /etc/init.d/apache2 start

Now try to browse https://<sitename>/svn and import something

Tuesday, August 01, 2006

Nice tool for Bloggers

Blogger for Word is a nice tool for bloggers. See it here (in Vietnamese) and here (in English) :-D

New blog's address

Now you can visit my blog via 3 address: http://www.t800t8.net.tf, http://t800t8.net.tf and http://t800t8.blogspot.com

KIẾM TIỀN

Trưa nay ngồi ăn cơm một mình tự nhiên lại nhớ đến có lần nói chuyện với anh C (anh ấy đã nói với mình: "Nếu phải lựa chọn giữa 2 công việc, anh sẽ lựa chọn công việc ít tiền hơn một chút nhưng được làm cái mình thích") mình lại ngẫm đến mình.

"Em cũng muốn thế lắm nhưng khốn một nỗi em chưa tìm được cái công việc em thích làm mà tiền lại ít hơn một chút. Giữa lựa chọn hiện giờ, tháng hơn 1000$ ở đây và tháng cùng lắm 300 - 400$ ở VN, thì cái khoảng chênh lệch kia là cả một vấn đề lớn rồi." (Tất nhiên là mình nhìn nhận trên thực tế khả năng của mình và cả môi trường xung quanh nữa.)

Cũng vì cuộc sống, vì tiền mà phải làm ở một công ty thế này. Có những thằng tốt như Park, Nam, Lee nhưng cũng có những thằng củ chuối như Kang. Chúng nó nhìn nhận mình làm việc thế nào dựa vào việc trên màn hình của mình hiển thị gì. Nếu mình vào Internet, đọc sách, mẹ khỉ, "thằng này có vẻ lười". Thiếu điều mình mở cửa sổ code quay bốn phía và mộng mơ.

Cuộc sống chó thế đấy. Mà mục đích của mình sang đây là để làm gì? Phải rồi, KIẾM TIỀN. Mẹ kiếp, mình đang KIẾM TIỀN đấy chứ...

Thursday, July 27, 2006

IntelliJ IDEA 6 Beta is released

Yesterday, JetBrains released IntelliJ IDEA 6 Beta. I'm glad to hear it. But seems JetBrains need to do many things before IDEA 6 final release. There are 2 threads (here and here) of users' suggestion about IDEA 6.

Detail change list in this build, here.

I don't know which build this exists but in this build, when I want to revert a file from Subversion, IDEA will show me a dialog to choose the files I want to revert. It didn't revert only the current file silently.


Keep going with "Deveplop with pleasure" slogan, JetBrains! :-)

Update: IDEA's TestNG plugin still works fine with TestNG 5.0

Tuesday, July 25, 2006

IntelliJ IDEA build 5561 is released

This is bug fixed build. More details, see here.

This build fixed a bug I reported before.

Saturday, July 22, 2006

C# enumeration problem

In C#, I have an enumeration

public enum Orientation
{
East = 1,
West = East,
South = 2,
North = 3
}

At this time, East and West has same underlying value (1) and I cannot write a switch like this

switch (orientation)
{
case Orientation.East:
Console.WriteLine("East");
break;

case Orientation.North:
Console.WriteLine("North");
break;

case Orientation.South:
Console.WriteLine("South");
break;

case Orientation.West:
Console.WriteLine("West");
break;
}

Because when I compile, I will have an error: "The label 'case 1:' already occurs in this switch statement"

I don't understand why C# supports to declare enumeration like that. If East and West has same meaning, I will not waste my time to create both of them.

Can anybody has experience with C# help me?

Friday, July 21, 2006

IntelliJ IDEA build 5557 is released

This is bug fixed build but still have some small new features.

More detail, see here.

Thursday, July 20, 2006

TestNG 5.0 is released

Yesterday, Cedric released TestNG 5.0. It has many change as in v4.7

* The configuration annotations are now called @BeforeTest,
@BeforeSuite, etc...
* The reports are now created in their own directory (one per suite)
and a main index file shows a list of all the suites that were
just run. They have also received a series of improvements in
appearance and content.
* It is now possible to specify the suite and test names directly in
the @Test annotations, which allows you to do without a testng.xml.
* expectedExceptions has moved inside @Test.
* TestNG shows you friendly stack traces.

For more information, go here.

Waiting for upgrade IDEA's TestNG plugin...

Wednesday, July 19, 2006

A Short History of Design Patterns

The title shows you what is here.

Finished Pragmatic Version Control: Using Subversion 2nd

This is a good book about Subversion. From starting, it will show you a story of daily working tasks relate with Subversion: You update your working copy, commit your changes, resolve the conflict...

This book will show you

   + The advantages of Subversion
   + How to create repository
   + What you should import to your repository and how to do
   + Why you need to create tags and branches and how to do
   + How to organize your repository also project
   + And many things...

I prefer this book than Version Control with Subversion 'cause I'm a developer, I don't need to focus in administration.

Next step: Practices of an Agile Developer - Working in the Real World

Tuesday, July 18, 2006

Small is great

Small is great. An ideal team should contain from 4-6 persons...

Two articles about building great team:

+ How to build a great team
+ Is your team too big? Too small? What's the right number?

Monday, July 17, 2006

IntelliJ IDEA 6 UI designer demo

Really nice demo. When I saw it, I just can say "WOOOW".

I never try to use IDEA to design UI. I have a little experience with NetBeans's Matisse, it's nice. But I will give IDEA's UI designer a try :-)

You can see the demo here.

A video about Team Server / Ajax Development with IntelliJ IDEA I found at Google.

Came back from Deajon

Over 4 PM today, I came back Seoul from Deajon.

I visited my cousin's house. It's a boring weekend 'cause it's raining during days. But I met my cousin's son. A nice and obedient boy. He's just 6 months old.

Now I need to prepare for Wednesday's lecture. This week will a busy week.

Friday, July 14, 2006

IntelliJ IDEA build 5383 is released

This is bug fixed build. More details, you can see here.

This build fixed 2 bugs I reported long time ago:
+ http://www.jetbrains.net/jira/browse/IDEADEV-7011
+ http://www.jetbrains.net/jira/browse/IDEADEV-7012

Update: Found a bug.
Update: Another bug.

Thursday, July 13, 2006

Buồn ngủ qúa

Đêm qua mưa rõ to, nói chuyện với cô ấy xong cóc về được nhà vì sợ bị ướt hết. Về nhà còn loay hoay một lúc rồi mới đi ngủ được, hình như lúc đó cũng hơn 1h đêm rồi. Dạo này mình ngủ được, chắc tại đợt đá bóng vừa rồi thức xem nhiều qúa nên giờ cần ngủ bù.

Hôm nay làm việc rõ chăm, trưa đếch ngủ gì cả. Cái dự án mình "vẽ" ra đã thực hiện xong phần 1 rồi. Mai test thêm một chút nữa rồi chuyển sang phần 2.

Giờ chuẩn bị lecture nào...

Buy 5.1 now, get 6.0 early autumn

JetBrains has just announced new features of IntelliJ IDEA 6.0, the price (same as 5.1) and when it will be released (early autumn).

Buy IntelliJ IDEA 5.1 now, you will get 6.0 for free, plus TeamCity.

I draw project






Stupid Firefox bug

Please follow me:

+ Open Firefox
+ Now connect to your external drive (HDD or flash drive)
+ Try to upload from Firefox, you will not find new drive (in
Browse dialog)
+ Restart Fifefox then try to upload again, now you can find new drive

This bug exists long time ago.

Wednesday, July 12, 2006

Just received Ubuntu 6.06 LTS CDs

I've just received Ubuntu 6.06 LTS CD (5 CDs) after near 6 weeks waiting. Do you want it? Give me a comment ;-)

Ubuntu creates a better CD (than v5.05) 'cause it also contains live CD in installation CD. Nice!

JLicense, a bad license library

JLicense is a free Java license library, it supports to create and validate license keys. The license key will be store in license.lic which contains some information like licensor, licensee, expire date,... also you can add more information you need, they called "feature".

As I guess, JLicense will encrypt the information you gave into a signature which also is stored in license.lic. When program runs, JLicense will decrypt the signature and compare it with the information. If they match, program will run. Ofcourse, you can do more validating by using "feature"s.

But when I try to generate new DSA key (seems JLicense uses symmetric algorithm to encrypt data) then create new license, it will invalid (when you download JLicense, it already contained a DSA key, with this one you can create valid licenses). Another problem is I don't understand why JLicense need license.lic in classpath before it creates a new license.

In JLicense web site, they advertise "You can also write your own class, such as a Servlet, to create the license file more dynamically based on user input data." but the example demonstrates how to create license awfully, I still don't know how to create a valid license (from my source code).

These things I found in JLicense v2.7

Tuesday, July 11, 2006

IntelliJ IDEA build 5380 is released

About 30 minutes ago, JetBrains released IntelliJ IDEA Demetra build 5380. Here are changes in build 5380 from build 5368:

* JSP. Major performance improvements.
* Perforce. Synchronization of changelists between IDEA and Perforce.
* New scope configuration UI.
* CSS. Intention to extract inline style.
* Improved detection of invalid @Nullable/@NotNull annotations.
* Other improvements and bugfixes.

More details here.

Two bugs I reported are fixed (http://www.jetbrains.net/jira/browse/IDEADEV-6870?rc=1 and http://www.jetbrains.net/jira/browse/IDEADEV-6861?rc=1). I will check the big bug later.

Update: They fixed big bug in a clever way: Removes capability to detach library directly from module's root :-D
Update: This build has a better performance but it has some terrible errors, they relate with Ant build and Perforce plugin.
Update: In this build, Unused symbol inspection doesn't work. Resolved: They changed from unused symbol inspection to UnusedDeclaration inspection.
Update: A request for new feature - http://www.jetbrains.net/jira/browse/IDEA-8213

Wednesday, July 05, 2006

IntelliJ IDEA build 5368 is released

Yesterday night, JetBrains released build 5368 of IDEA. Here are changes in build 5368 from 5350

* EJB. Support for EJB 2.1 spec.
* Subversion. New repository browser.
* GWT Studio. Major functionality improvements.
* Updated project roots configuration UI.
* Intentions. Create enum from usage.
* Intentions. When creating method from usage in inner class,
possibility to place created method in outer class.
* GUI Designer. Support for binding button groups to class fields.
* Other improvements and bugfixes.

More details here.

Here is new project roots configuration UI

New Output tab


Default template project settings



This build fixed one bug I reported in build 5250 and this bug seems not happen any more.

Update: A bug that I found in this build.
Update: another bug. (But it's my bug :-D)
Update: Two more bugs (http://www.jetbrains.net/jira/browse/IDEA-8148
and http://www.jetbrains.net/jira/browse/IDEA-8149)
Update: A big bug.

Tuesday, July 04, 2006

TestNG test class template for IDEA


#parse("File Header.java")

package ${PACKAGE_NAME};

import static org.testng.Assert.*;
import org.testng.annotations.*;

public class ${NAME} {

@Configuration(beforeTestClass = true)
public void setUp() {
// Code to set up the test class comes here
}

@Configuration(afterTestClass = true)
public void tearDown() {
// Code to clean up the test class comes here
}

@Test
public void testSomething() {
// Code to test comes here
}

}

What is mixed revision working copies in Subversion?

Assume that you have 2 files Day.txt and Number.txt which are contained in sesame directory at revision 1 in Subversion repository. You checkout them and change something in Day.txt then commit it to repository. At this time, if you run "svn log Day.txt" command, Subversion will show you the log of Day.txt and its revision is 2. But if you run "svn log sesame", the command's output will return revision 1.

Why? 'Cause Subversion treats directories as first class objects, it remembers the revision number for each directory in your working copy.

I guess Subversion works this way: When I commit Day.txt to repository, Subversion client will update Day.txt (its content, history and revision number) to repository, also in working directory and sesame directory to repository. It doesn't update sesame directory and Number.txt in working directory. That's why if I run "svn log sesame", the command's output only returns revision 1. Only after I do "svn update", sesame's revision number will change, it comes from repository.

One sentence is from Version Control with Subversion is "'push' action does not cause a 'pull'"

Monday, July 03, 2006

Foxit Reader

You want to view PDF files but hate Acrobat Reader 'cause it's big, slow, waste memory and need to install. You have another choice, please use Foxit Reader. It's small (over 1MB), fast, don't eat too much memory and don't need to install. Also its UI really looks like Acrobat Reader so you don't need too much time to learn to use it.

Try it and like it!

Friday, June 30, 2006

BootDisk2USBStick

If you want to boot from USB stick, you can try BootDisk2USBStick. (require .NET Framework 2.0)

See it here (in German) :-D

Monday, June 26, 2006

Java News Brief

A collection of Java articles from Object Computing, Inc.

See them here: http://www.ociweb.com/articles/publications/jnb.html

Sunday, June 25, 2006

Vài người vớ vẩn

Mẹ kiếp, đéo hiểu sao có những người vớ vẩn như vậy. Mang tiếng dân học Tin học chuyên ngành, chưa đến cái độ tuổi là già nhưng đã có những tư tưởng lười biếng. Ơ cũng xính làm kinh doanh, ơ mơ có một công việc nhàn nhã nhưng lại kiếm được nhiều tiền... Nhưng kiến thức, kinh nghiệm thì không chịu bồi bổ, tu dưỡng, suốt ngày cắm đầu vào chơi 3 cái trò game.

Với mình những người biết rõ mình đang ở đâu, khả năng của mình ở mức độ nào, biết mình muốn gì, có chí tiến thủ, có đầu tư thời gian để nâng cao kiến thức phù hợp với khả năng và định hướng của mình, người đó mới có thể nên người được.

Okie, chơi game, giải trí cũng tốt nhưng nên có hạn định về thời gian thôi chứ. Chứ cứ chơi game suốt ngày thì khi nào có với tới được cái ước mơ kinh doanh, công việc nhàn nhã nhưng lại kiếm được nhiều tiền kia?

Vớ vẩn và hoàn toàn vớ vẩn.

Saturday, June 24, 2006

I'm running V400

I've just bought a Logitech V400 Laser Cordless mouse - a dual laser engine and based on 2.4 GHz technology mouse. It has a sport style, solid design and fit in my hand. I love it!

For more information about V400, you can see here.


Friday, June 23, 2006

IntelliJ IDEA Demetra build 5350 is released

At an abnormal time, about 8:40 PM (Seoul time), JetBrains released IntelliJ IDEA Demetra build 5350.

2 nice changes that I want to see are supporting to import into SVN and new Ant itegration plugin.

Changes in build 5350 from 5321

* Ant. New Ant integration plugin included in the distribution.
* GWT Studio plugin included in the distribution.
* New project roots configuration UI.
* Subversion. Import into SVN action.
* Possibility to exclude certain packages from class name completion
and auto-import prompts.
* Emacs like expand word completion (Alt-slash).
* Other improvements and bugfixes.

Complete list of changes: here.

Tonight I will sleep late. :-)

Update: After installing IDEA Demetra 5350, I've found a bug. See it here.
Update: Another bug.
Update: UI changes


Update: SVN - "Browse changes" seems change. I don't know which build it changed but I see it the first time in this build (5350)



Update: One more bug.

Thursday, June 22, 2006

Phượng hoàng tung cánh

Phoenix rising
Annihilator

Day by day, watching you disappear
Wishing that you were still here beside me
On my own, swimming against the tide
Theres nobody on my side but your memory
Then you'll rise right before my eyes
On wings that fill the sky
Like a phoenix rising
Like a phoenix rising

Wings on fire, tearing into the night
Screaming into the light of another day
Carry me out the hurricane
Into the smoke and flame and well fly away
And well rise right before their eyes
On wings that fill the sky
Like a phoenix rising
Like a phoenix rising

Higher, higher, hear the thunder roar from above
Fire, fire, fire makes me whole
Into the smoke and flame and well fly away
And well rise right before their eyes
On wings that fill the sky
Like a phoenix rising
Like a phoenix rising

Wings on fire, tearing in to the night
And well fly away

HOWTO: Pick an open source license

You're considering to open your source code and want to choose the right license? Ed Burnette's article can help you to decide it.

Part 1
Part 2

I used it to choose the license for StringEx library.

Tuesday, June 20, 2006

StringEx v0.2.2 - first public release

What StringEx?
   A free Java library supports to extract values from text based on a regex. StringEx also supports to get sub regex constructs from initialized regex.

Why StringEx?
   'Cause somtimes I need it for my works and I do it for fun.

How to use?
   Assume that you create a StringEx instance with regex "((\\w+)(\\(\\d{2}\\)))(\\w+)", at that time

     + matchesWithRegex("Super(99)Java") will return true, while
        matchesWithRegex("Super(99Java") will return false.

     + extractAll("Super(99)Java") will return an array {"Super(99)", "Super", "(99)", "Java"}

     + extractAt("Super(99)Java", 0) will return "Super(99)"
        extractAt("Super(99)Java", 1) will return "Super"
        extractAt("Super(99)Java", 2) will return "(99)"
        extractAt("Super(99)Java", 3) will return "Java"
        extractAt("Super(99)Java", 4) will throw IndexOutOfBoundsException

     + getAllRegexConstructs() will return an array {"(\w+)(\(\d{2}\))", "\w+",
        "\(\d{2}\)", "\w+"}

     + getRegexConstructAt(0) will return "(\w+)(\(\d{2}\))"
        getRegexConstructAt(1) will return "\w+"
        getRegexConstructAt(2) will return "\(\d{2}\)"
        getRegexConstructAt(3) will return "\w+"
        getRegexConstructAt(4) will throw IndexOutOfBoundsException

License: LGPL

You can see the source code here. I will upload the binary, also the source code as soon as possible.



If you want to discuss about StringEx or report error, just leave a comment here.

Update: Change license policy.
Update: Change How to use