Thursday, April 17, 2008

Nexus : a powerful and robust Maven repository manager

Today, I found a google Maven repository manager tool - Nexus.
Home site : http://nexus.sonatype.org/
An useful document : http://www.sonatype.com/book/reference/repository-manager.html

Wednesday, April 16, 2008

SSH Without Password

[Original Address : http://www.csua.berkeley.edu/~ranga/notes/ssh_nopass.html]



Steps:

  1. On the client run the following commands:

    $ mkdir -p $HOME/.ssh
    $ chmod 0700 $HOME/.ssh
    $ ssh-keygen -t dsa -f $HOME/.ssh/id_dsa -P ''
    This should result in two files, $HOME/.ssh/id_dsa (private key) and $HOME/.ssh/id_dsa.pub (public key).
  2. Copy $HOME/.ssh/id_dsa.pub to the server.

  3. On the server run the following commands:

    $ cat id_dsa.pub >> $HOME/.ssh/authorized_keys2
    $ chmod 0600 $HOME/.ssh/authorized_keys2
    Depending on the version of OpenSSH the following commands may also be required:
    $ cat id_dsa.pub >> $HOME/.ssh/authorized_keys
    $ chmod 0600 $HOME/.ssh/authorized_keys
    An alternative is to create a link from authorized_keys2 to authorized_keys:
    $ cd $HOME/.ssh && ln -s authorized_keys2 authorized_keys
  4. On the client test the results by ssh'ing to the server:

    $ ssh -i $HOME/.ssh/id_dsa server 
  5. (Optional) Add the following $HOME/.ssh/config on the client:

    Host server
    IdentityFile ~/.ssh/id_dsa
    This allows ssh access to the server without having to specify the path to the id_dsa file as an argument to ssh each time.

Monday, April 14, 2008

Solaris 10: Runtime.exec throw out java.io.IOException: Not enough space

On solaris os, when I use Runtime.exec to create a new process, sometimes, it throw out the following exception:
java.io.IOException: Not enough space
at java.lang.UNIXProcess.forkAndExec(Native Method)
at java.lang.UNIXProcess.(UNIXProcess.java:53)
at java.lang.ProcessImpl.start(ProcessImpl.java:65)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:451)
at java.lang.Runtime.exec(Runtime.java:591)
at java.lang.Runtime.exec(Runtime.java:464)
...
My programe use the below method to create the process:
...
for(int i = 0; i <=10000; i++) { Process process = Runtime.getRuntime().exec(new String[] {"/home/kongxx/test.sh}); ... } ... If the programe run some time, the above exception was thrown out.
After investigation, I found the java need some /tmp space to fork a new process, but in my test environment the /tmp only has less than 5xxM space. So when the /tmp space is not enough to create a new process, the exception appeared. For this reason, I extends the /tmp space and re-run my programe, it worked well.

Change sql/plus prompt

In the login.sql file(if haven't, create one and place to the location that you run sqlpluse), add the following sql in it.

define gname = 'not connected'
column global_name new_value gname
set termout off
select lower(user) || '@' || replace(global_name,'.WORLD',null) global_name
from global_name;
set termout on
set sqlprompt '&&gname> '


And then, login the sqlplus, the prompt will like below:
fkong@XE>