Wednesday, December 19, 2012

How to display Chinese in Graphviz

Graphviz is a very handy tool for drawing plots and firgures.

However, it is not straight forward to display Chinese characters in the generated plots.

One example is as follows using DOT:
node [shape=box,style=dashed,height=0.3,fontname="C:\Windows\Fonts\NSimSun Regular.ttf",fontsize=12]; "你好"; "whr you are ∀";

where you can write UTF-8 encoded Chinese characters in the source file, and alternatively you can write it in xml-like unicode numbers like  "∀" (i.e. ∀). More importantly, you need to specify the Chinese font file such that Graphviz can really display the Chinese characters, since by default Graphviz can hardly find the correct font to use for Chinese characters.


Tuesday, December 18, 2012

How to use JDB on Linux

JDB is quite a powerful debugging tool for Java programs, especially for multi-threading Java programs.

JDB can be found in the JDK package.

You can also learn how to use JDB by reading the manual of JDB (using command "man jdb").

Here I only show the useful parts that I found:
(1) you can run your Java program as usual with the additional option "-agentlib:jdwp=transport=dt_socket,address=8000,server=y,suspend=n"
(2) now you can start JDB using command "jdb -attach 8000"
(3) in JDB, you can first use "suspend" to suspend your JAVA program, and then use "threads" to see the thread list of the JAVA program; if you want to see what code is each thread running, you can use "where 0x22" (0x22 is the thread id which is from the thread list); after finishing debugging, you can use "resume" to resume your JAVA program.
(4) if you want to exit JDB and let your JAVA program go on running, you can simply press Control-C


Friday, November 2, 2012

How to set the priority order of jar files in Eclipse

If you have multiple jar files in your Eclipse project, then you would have some problems, if some jar files have classes with the same name. In this case, the priority order of the jar files should matter, because you always want to import the right class.

How to set the priority order of your jar files in Eclipse?

Right click your project, and then click the Property menu.
In the "Java Build Path" menu on the left of the popup Window.
Then you can see the "Order and Export" tab which shows the order of the jar files and source codes.


Thursday, September 20, 2012

How To Open a Command Prompt in Windows 8

Windows 8 has been released recently, and some people complain of it, since it changes the way in which users used to do with Windows.
However, I really like it, for the simple reason that it integrates nearly all the Microsoft products together, e.g. Windows on PC, Windows on Phone, and also Xbox.

One of the new features that I found useful is that in Windows 8 file explorer, you can easily open a command prompt in the current folder by simply clicking the menu File -> Open command prompt, which is the one that I has been expecting for a long time.

Tuesday, September 18, 2012

Useful add-ons of Firefox

FireBug 1.9
A useful tool used to see the html architectures of web pages.

 HttpFox
A tool used to see the TCP/UDP packages sent from/to Firefox.


Tuesday, July 24, 2012

How to install Git on Linux

1. The easiest way is to install Git using package managers, and you can refer to the following page:
http://git-scm.com/downloads

2. if you really cannot use any package manager, the final choice is to install Git from its source codes, which can be found at:
http://code.google.com/p/git-core/downloads/list
Then you can install Git from the source code (according to the INSTALL in the root directory of the Git source code tarball):
    $ make configure ;# as yourself
    $ ./configure --prefix=/usr ;# as yourself
    $ make all doc ;# as yourself
    # make install install-doc install-html;# as root


Wednesday, June 27, 2012

how to change the language of Windows 7 Business

Microsoft provides free language solutions for Windows 7 Ultimate/Enterprise, but not for Windows 7 Business.
Of course, you can pay some money to upgrade your Windows 7 Business to Ultimate/Enterprise for the privilege of changing languages.

There is also one free solution: using Vistalizator:
http://www.froggie.sk/download.html

This website also provides the language files, MUI language pack, for different Windows systems.