Monday, August 24, 2009

Chinese Lunar Calendar source code release

Hi, This is my first open source library. This lib tend to convert Georgian Calendar to Chinese Lunar Calendar. Please download and review the code.
Chinese Lunar Calendar download

Tuesday, July 14, 2009

Passwordless ssh

1)Let say both machine with user tux.
2)login to machine A, with "tux"
3)Generate RSA key.

ssh-keygen -t rsa

Generating public/private rsa key pair.
Enter file in which to save the key (/home/tux/.ssh/id_rsa): # Press 'enter' here
Enter passphrase (empty for no passphrase): # Press 'enter' here
Enter same passphrase again: # Press 'enter' here
Your identification has been saved in /home/tux/.ssh/id_rsa.
Your public key has been saved in /home/tux/.ssh/id_rsa.pub.
The key fingerprint is:
Example:
40:01:53:a3:fe:6c:91:24:e9:ed:a1:26:ac:e4:96:67 user@host

4) Ensure the public key id_rsa.pub is created in folder .ssh

5)Copy the key to machine B
scp ~/.ssh/id_rsa.pub tux@machineB:~/.ssh

With this command will copy the key to remote host /home/tux/.ssh

6) Login to machine B with tux, and run this comment to append the key to authorized_keys
cat id_rsa.pub >>~/.ssh/authorized_keys
rm id_rsa.pub


note: the permission for authorized_keys must set to 600. To change it try >chmod 600 authorized_keys

7) Done. Try to ssh to machine B without password entered.

P/S: This approach is applicable to different users. Let say tux1 and tux2. To connect to machine B with tux2. Follow the step 1 to step 6 to copy the tux1's public key to tux2, and connect with command tux1> ssh tux2@machineb. DONE!!!

Wednesday, June 3, 2009

Java new garbage collector

http://java.sun.com/javase/6/webnotes/6u14.html

In the latest release 1.6.0_14 (6u14) , a new G1 garbage collector is included.

To try G1, specify these command line options:

-XX:+UnlockExperimentalVMOptions -XX:+UseG1GC

In addition, the following options can be used to affect G1's behaviour:

  • To set the max GC pause time goal in milliseconds that G1 will attempt to meet:
     -XX:MaxGCPauseMillis=<x> 
  • To set the time interval over which GC pauses totaling up to MaxGCPauseMillis may take place:
    -XX:GCPauseIntervalMillis=<x>

But before you try on this new G1 garbage collector, you need to obtain the Java SE for Business support contract. Seem like the Oracle phenomena is stared.