Before Netbeans 6.0, change ${Netbeans_HOME}/etc/netbeans.conf, add:
--locale language=en
in netbeans_default_options, and restart is OK.
For Netbeans 6.0+, this will lead to error message:
"An attempt was made to look up a localized manifest attribute named: openide-module-deprecation-message_nb_language=en
This name is in an invalid format. If you are running the Macintosh MRJ on MacOS X, make sure that your locale settings are valid. Currently: language=en"
The new way now is to add:
-J-Duser.language=en -J-Duser.region=US
in netbeans_default_options
Ref: http://blogs.sun.com/tao/...
Monday, December 22, 2008
Convert Subversion Repositories to Mercurial
Finally found some time to migrate some projects from SVN to Hg. The enterprise SVN became so cumbersome and slow as people keep throwing all junks into it, which you have no control of.
- The 1st recipe was trying to convert directly using Hg in Working With Subversion Repositories
But there seemed a bug in Hg when the SVN requires HTTP authorization - even the user and password were correct it still could not pass through:hg convert --config convert.hg.tagsbranch=0 http://marshal.com/trunk/project1
initializing destination project1 repository
http authorization required
realm: crowd
user: marshal
password:
real URL is http://marshal.com/trunk/project1/
http authorization required
realm: crowd
user: marshal
password:
http authorization required
realm: crowd
user: marshal
password:
abort: HTTP Error 401: Authorization Required
- Now veer to the Python tool for Hg, which requires Python 2.5+ (already included on Ubuntu 8.1+) & SVN.Do the following:
Best match: hgsvn 0.1.6# svn not installed by default
sudo apt-get install subversion
# easy_install not included in Python package by default
sudo apt-get install python-setuptools
# download & install hgsvn
sudo easy_install hgsvn
Downloading http://pypi.python.org/packages/2.5/h/hgsvn/hgsvn-0.1.6-py2.5.egg#md5=8d15f42a8f4cb8516e219b7952bd9607
Processing hgsvn-0.1.6-py2.5.egg
Moving hgsvn-0.1.6-py2.5.egg to /usr/lib/python2.5/site-packages
Adding hgsvn 0.1.6 to easy-install.pth file
Installing hgimportsvn script to /usr/bin
Installing hgpullsvn script to /usr/bin
Installed /usr/lib/python2.5/site-packages/hgsvn-0.1.6-py2.5.egg
Processing dependencies for hgsvn
Finished processing dependencies for hgsvn
- The real staff:
* svn 'info' '--xml' 'http://marshal.com/trunk/project1'hgimportsvn http://marshal.com/trunk/project1
Password for 'marshal':
Then the program froze after you typed the password. (Well, it happened to me).
So I have to manually run:
And key in the user name/password there, it passed.svn info http://marshal.com/trunk/project1
- Import SVN project again:
This will import SVN's project1 into current directory and no authorization required any more.hgimportsvn http://marshal.com/trunk/project1
pulls all SVN history. Then the daily use of mercurial starts...cd project1
hgpullsvn
Saturday, December 6, 2008
Ubuntu SSH How-to
Scenario: generate SSH key pairs and use PuTTY to logon to Ubuntu without inputing user & password each time.
Steps:
Reference:
Steps:
- Create the Cryptographic Keys:
Assign the pass phrase (press [enter] key twice if you don't want a passphrase). It will create 2 files in ~/.ssh directory as follows:$ ssh-keygen -t rsa
~/.ssh/id_rsa : identification (private) key
~/.ssh/id_rsa.pub : public key
- Use WinSCP to copy the id_rsa (private key) to desktop, use PuTTYgen.exe to load this key and save private key to PuTTY's format.
- Add id_rsa.pub in ~/.ssh/authorized_keys (or authorized_keys2), just in 1 line. Or simply
mv id_rsa.pub authorized_keys
- Be sure both the home directory and the .ssh directory be owned and writable only by the owner (700 recommended for .ssh)
- Any error see /var/log/auth.log
- sshd protocol 1 is insecure, so vi /etc/ssh/sshd_config:
[...]
Protocol 2
PasswordAuthentication no # if want to disable interactive logon
- Restart sshd:
$ sudo /etc/init.d/ssh restart
- Use the saved private key in PuTTY:
PuTTY Configuration -> Connection -> SSH -> Auth -> Private key file for authentication,
then load the private key. Or use PAGEANT to load this automatically.
- Change passphrase:
If it's already converted to PuTTY format, use PuTTYgen.exe to convert it back to OpenSSH format, then
Enter file in which the key is (id_rsa):...$ ssh-keygen -p
Reference:
Friday, December 5, 2008
'tree' script under Linux/Unix/Cygwin
A simple script to traverse all the directories and do whatever you want. The byproduct is a MS-DOS tree command.
#!/bin/bash listAll() { local f local i=$1 for f in `ls -1`; do # 1 file per line if [ -f "$f" ]; then indent $i echo "|- $f" if [ "$COMMAND" != "" ]; then IFS=$oIFS $COMMAND "$f" IFS=$nIFS fi elif [ -d "$f" ]; then indent $i echo "+- $f" let i+=$INDENTS cd "$f" listAll $i cd .. let i-=$INDENTS fi done } indent() { local i=0 while (( i < $1 )) # or: while [ i -lt $1 ] do echo -n " " let i+=1 done } echo "Usage: shred-tree [-u]" echo "-u: shred; otherwise just list" echo if [ "$1" = "-u" ]; then COMMAND="" # put your command here, eg. ls -l fi # space delimitered: oIFS=$IFS # \n delimitered: nIFS=' ' IFS=$nIFS # For file names containing spaces INDENTS=3 listAll 0
Tuesday, November 11, 2008
Use TortoiseHg 0.5 to clone a Mercurial 1.0.2 SSH repository
If you just downloaded TortoiseHg v0.5, and try to clone the remote SSH repository, you'll get error message: "The system cannot execute the specified program." Now try:
Now I just fall back to Putty as this is much more direct and prime. Modify Mercurial.ini under TortoiseHg:
Note: As Putty uses user's relative path to home, //home/env/... is to tell it this is an absolute path /home/env/...
Ref:
TortoiseHg> TortoisePlink.exe
The system cannot execute the specified program.
So you have to install Microsoft Visual C++ 2005 SP1 Redistributable Package (x86) according to TortoiseHg FAQ. But even you have done that, it seems that TortoisePlink does not support private key for SSH well.Now I just fall back to Putty as this is much more direct and prime. Modify Mercurial.ini under TortoiseHg:
; In order to push/pull over ssh you must specify a ssh tool
;ssh = "C:\TortoiseHg\TortoisePlink.exe" -ssh -2
ssh = "C:\Putty0.6\Plink.exe" -ssh -2 -i "C:\key\ubuntu-1.ppk"
Then right click->TortoiseHG->Clone a Repository->Source Path, input something likessh://root@192.168.10.1//home/env/mercurial/open-source/openJDK
Then click "clone", it works without a hitch.Note: As Putty uses user's relative path to home, //home/env/... is to tell it this is an absolute path /home/env/...
Ref:
Sunday, November 9, 2008
Install Mercurial 1.0.2 on Ubuntu 8.1 server using source code package
(Using root recommended)
If compiler and python not installed:
Checking encoding (UTF-8)...
Checking extensions...
Checking templates...
Checking patch...
Checking commit editor...
Checking username...
No username found, using 'root@hubuntus' instead
(specify a username in your .hgrc file)
No problems detected
And that's it.
Ref: http://www.selenic.com/mercurial/wiki/index.cgi/UnixInstall
If compiler and python not installed:
apt-get install build-essential python-dev
tar xvf mercurial-1.0.2.tar.gz
cd mercurial-1.0.2
make install
To verify,hg debuginstall
Hopefully, you'll seeChecking encoding (UTF-8)...
Checking extensions...
Checking templates...
Checking patch...
Checking commit editor...
Checking username...
No username found, using 'root@hubuntus' instead
(specify a username in your .hgrc file)
No problems detected
And that's it.
Ref: http://www.selenic.com/mercurial/wiki/index.cgi/UnixInstall
Tuesday, November 4, 2008
Eliminate some of ehcache warnings in Hibernate 3
When configuring Hibernate second-level cache using ehcache as cache provider, most articles (eg. Java Persistence with Hibernate) or hibernate manual tell you to use:
But this way you will get some warning log message like:
To avoid this warning consider using the CacheManager factory methods to create a singleton CacheManager or specifying a separate ehcache configuration (ehcache.xml) for each CacheManager instance.
To eliminate that, you can simply change the cache provider class to:
Ref: http://ehcache.sourceforge.net/documentation/hibernate.html
hibernate.cache.provider_class=org.hibernate.cache.EhCacheProvider
But this way you will get some warning log message like:
To avoid this warning consider using the CacheManager factory methods to create a singleton CacheManager or specifying a separate ehcache configuration (ehcache.xml) for each CacheManager instance.
To eliminate that, you can simply change the cache provider class to:
hibernate.cache.provider_class=net.sf.ehcache.hibernate.SingletonEhCacheProvider
Ref: http://ehcache.sourceforge.net/documentation/hibernate.html
Sunday, November 2, 2008
Install vmware-tools on Ubuntu 8.1 desktop
Installing vmware tools on Ubuntu 8.10 seems not a piece of cake these days. If you install the vmware-tools that come with vmware workstation 6.0.5, you may end up with a incorrectly configured Ubuntu system that hangs during boot. By searching the internet and customerizing to my own system, here are the steps that finally made it work:
(Update on 3/8/2009:
Reference and thanks to:
1. http://diamondsw.dyndns.org/Home/Et_Cetera/Entries/2008/4/25_Linux_2.6.24_and_VMWare.html
2. http://muffinresearch.co.uk/archives/2008/07/13/ubuntu-hardy-setting-up-vmware-tools-from-the-cli/
If you disabled Shared Folders in your VM settings, you’ll see a message “Mounting HGFS shares: failed”. Just enable shared folders and reboot.# install vmware-tools on Ubuntu 8.1 desktop
#
# Mount image:
# Select "VM-> install vmware-tools" from vmware server console or:
# mount /dev/cdrom /media/cdrom0
# Don't use the default one by VMware:
# cp /media/cdrom0/VMwareTools-6.0.5-109488.tar.gz /home/tmp
# tar xvf VMwareTools-6.0.5-109488.tar.gz
# Get the latest open-vm-tools
wget http://downloads.sourceforge.net/open-vm-tools/open-vm-tools-2008.10.10-123053.tar.gz?modtime=1223858287&big_mirror=0
tar xvf open-vm-tools-2008.10.10-123053.tar.gz
apt-get update
apt-get upgrade
apt-get dist-upgrade # if there’s a new kernel available
shutdown -r now # if you’ve updated the kernel
apt-get install linux-headers-`uname -r`
apt-get install build-essential
apt-get install libproc-dev libdumbnet-dev libicu-dev
apt-get install libgtk2.0-dev
# Can bypass this:
# apt-get install libxinerama-dev libxrender-dev libxrandr-dev
apt-get install libxtst-dev libxss-dev
# Try to get this lib but the script always complains it's old:
# apt-get install liburiparser-dev
apt-get install libgtkmm-2.4-dev # foropen-vm-tools-2009.07.22-179896
cd open-vm-tools-2008.10.10-123053
./configure --disable-unity
make
cd modules/linux
for i in *; do mv ${i} ${i}-only; tar -cf ${i}.tar ${i}-only; done
cd ../../../
mv -f open-vm-tools-*/modules/linux/*.tar vmware-tools-distrib/lib/modules/source/
cd vmware-tools-distrib/
./vmware-install.pl
(Update on 3/8/2009:
Not successful running VMwareTools-6.0.5-109488's vmware-install.pl
with open-vm-tools-2009.07.22-179896
:
compilation failed as missing header files in that release)Reference and thanks to:
1. http://diamondsw.dyndns.org/Home/Et_Cetera/Entries/2008/4/25_Linux_2.6.24_and_VMWare.html
2. http://muffinresearch.co.uk/archives/2008/07/13/ubuntu-hardy-setting-up-vmware-tools-from-the-cli/
Subscribe to:
Posts (Atom)