Friday, December 28, 2007

Tuning Garbage Collection - Sun's JVM

If you are a Java developer, you have to face the memory leak problem sooner or later. The first step is under the Java’s Garbage Collection. Each version of JVM behave differently, here is a list of Sun documents about how to tune Garbage Collection:

1.4.2

5

6

Thursday, December 27, 2007

java classpath separator

In Unix/Linux/Solaris
CLASSPATH are separated by colons(:)


In Windows
CLASSPATH are separated by semicolons(;)

Sunday, December 9, 2007

Apache HTTPD 2.2 with LDAP authentication

Recently I need to setup LDAP authentication on Apache Httpd. I tried the usual wayto find out how – googleing. I found that a lot of good posts do not work any more as 2.2 had gone through a major refactoring on the Authn and Authz module.

Here are some highlights ( for full version changes made in 2.2 see new features):

  • mod_access has been renamed mod_authz_host.
  • mod_auth is now split into mod_auth_basic and mod_authn_file
  • mod_auth_dbm is now called mod_authn_dbm

For LDAP related, I found Christophe Gravier’s post in users@httpd very useful. I put it here:

If you're using apache >= 2.2 and you want to:

1/ allow "any" authenticated user to enter (whatever his group membership is (i.e. no authorization control), you must "bypass" the authz_ldap authorization module by setting "AuthzLDAPAuthoritative" to off (else apache searches for require ldap-user or ldap-group directives)

AuthType basic
AuthName "Authentication domain"
AuthBasicProvider ldap
AuthzLDAPAuthoritative off
AuthLDAPURL "ldap:///ou=Development,ou=Corporate
Users,dc=financialcad,dc=com?sAMAccountName?sub?(objectclass=*)"
AuthLDAPBindDN "cn=,ou=Development,ou=Corporate
Users,dc=financialcad,dc=com"
AuthLDAPBindPassword ""
SSLRequireSSL
require valid-user


2/ allow a limited list of known users of the directory (need require ldap-user directive and not require ldap-user)

AuthType basic
AuthName "Authentication domain"
AuthBasicProvider ldap
AuthzLDAPAuthoritative *on*
AuthLDAPURL "ldap:///ou=Development,ou=Corporate
Users,dc=financialcad,dc=com?sAMAccountName?sub?(objectclass=*)"
AuthLDAPBindDN "cn=,ou=Development,ou=Corporate
Users,dc=financialcad,dc=com"
AuthLDAPBindPassword ""
SSLRequireSSL
require *ldap-user* myuser_uid


3/ allow a group of user (authorization based on group membership).


AuthType basic
AuthName "Authentication domain"
AuthBasicProvider ldap
AuthzLDAPAuthoritative *on*
AuthLDAPURL "ldap:///ou=Development,ou=Corporate
Users,dc=financialcad,dc=com?sAMAccountName?sub?(objectclass=*)"
AuthLDAPBindDN "cn=,ou=Development,ou=Corporate
Users,dc=financialcad,dc=com"
AuthLDAPBindPassword ""
SSLRequireSSL
require *ldap-group* my_group_full_dn

Friday, December 7, 2007

Linux - Better "ls" coloring scheme against dark background

After fixing the the vi(vim) problem, now we are going to fix a similar problem for "ls". Again, if your terminal has dark background, the result of ls is hard to read. I used to disable the ls coloring altogether by

>unalias ls

Since most Linux, alias the ls command as 'ls --color=tty'

It is some over kill, I found a better solution here

You can just simply unset the LS_COLORS as:
>export LS_COLORS=""

ls now use a better color scheme to display the result

Thursday, December 6, 2007

dsadm exited with unexpected error code 11

Install Sun Directory Server Enterprise Edition 6.2

While creating the DSCC registry
Get "dsadm exited with unexpected error code 11"

Found out from here that my password is too short, it has to be at least 8 characters long!!

Wednesday, December 5, 2007

yum through proxy

1) You can set the environment variable, http_proxy and ftp_proxy, each time before you start yum as

export http_proxy="http://ip:port"
export ftp_proxy="http://ip:port"

For corporate environment, you likely need the uesrname and password as well as:
export http_proxy="http://username:password@ip:port"
export ftp_proxy="http://username:password@ip:port"

or

2) Update the /etc/yum.conf add the following line under
proxy=http://ip:port/

Make sure you include the last slat(/)

It saves you from setting the environment variable every time, but having you plain password store in a file may not be a good idea


To get a GUI front end for yum get the yumex
>yum install yumex

vim with dark backgound

If your terminal has dark background, such as black, it is hard to read highlighted search result (white text with yellow background). Here is the fix

Under ~/.vimrc (create it if it does not exist) add the following line
set background=dark