Install perl DBD::Oracle module without installing Oracle server onCentOS

I am in the situation of using ora2pg to migrate an Oracle database to postgreSQL. To install ora2pg, DBD::Oracle is required. To install DBD:Oracle, the environmental variable $ORACLE_HOME is required. However, it is not easy to set up an environmental variable for $ORACLE_HOME since I am using a remote dedicated Oracle server. To overcome the problem, I downloaded and installed the following three rpm packages: Please be advised that it should be no problem to set $ORACLE_HOME on a machine which happens to be the Oracle server.
# download link for Linux 64bit
http://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.html
oracle-instantclient11.2-basic-11.2.0.3.0-1
oracle-instantclient11.2-devel-11.2.0.3.0-1
oracle-instantclient11.2-sqlplus-11.2.0.3.0-1
I then added the $ORACLE_HOME to ~/.bashrc file.
#By default, the installation path is /usr/lib/oracle/11.2/client64/
export ORACLE_HOME="/usr/lib/oracle/11.2/client64/"
If you want connect to the Oracle database from command line using sqlplus, you could add $ORACLE_HOME/bin to you PATH, though the syntax for connecting to a remote database using its SID is nasty.
PATH=$PATH:/usr/lib/oracle/11.2/client64/bin
sqlplus AERS/AERS@'(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=remote_server_address)(PORT=1521)))(CONNECT_DATA=(SID=sid_code)))'
Now, you have done all the steps for running sqlplus on a command line. Will you enjoy the using? You probably not at this moment. Since running sqlplus without further tweaking is a pain in Linux command line: you do not have your history(using upper arrow) or you can not use left/right arrow to edit your sql command. Here is a solution, using rlwrap
# install required repository
wget http://www.mirrorservice.org/sites/dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
sudo rpm -Uvh epel-release-6-8.noarch.rpm
# install rlwrap if it does not exit in your system
sudo yum install rlwrap
#then run
rlwrap sqlplus ***
You could also add he following alias in your ~/.bashrc file
vim ~/.bashrc
#add the following into the file
alias sqlplus='rlwrap sqlplus'

Install SQL Developer on CentOS 5

1. Configure $JAVA_HOME if there is nothing outputs when you run
echo $JAVA_HOME
Mine is at /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/ so I put the following line into ~/.bashrc file:
export JAVA_HOME="/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/"
2. Download SQL Developer installation from Oracle SQL Developer RPM for Linux and install.
sudo rpm -ihv sqldeveloper-3.2.20.09.87-1.noarch.rpm
3. add /opt/sqldeveloper to your PATH
PATH=$PATH:/opt/sqldeveloper/
4. Run SQL Developer:
source ~/.bashrc
sqldeveloper

Show Time Stamp on Bash History

Ever wondered when did I execute the command? You could add a time stamp in front of each command you executed.
echo 'export HISTTIMEFORMAT=" %F %T "' >> ~/.bashrc
source ~/.bashrc
You will see time stamps on your commands when you execute history next time.
The result will look like:
1013 2013-05-09 14:47:44 vim scripts_for_Distance_Matrix.txt
1014 2013-05-09 14:48:01 R < scripts_for_Distance_Matrix.txt --no-save

Auto lock windows 7 by removing smart card

Have you ever wanted to lock your windows 7 work station automatically after you pull out your smart card/piv card from card reader? Here is an example of how to set it up.

1. Make sure that "Interactive logon: Smart card removal behavior" is configured with "Lock Workstation".
To set it up,
run gpedit.msc to open Local Group Policy Editor and locate: Computer Configuration\Windows Settings\Security Settings\Local Policies\Security Options. Locate "Interactive logon: Smart card removal behavior" on the right panel, double click it ans select "Lock Workstation".

2. Set "Smartcard Removal Policy" to "Automatic"
In order to make changes made in first step take effect, we have to set the startup type for "Smartcard Removal Policy" service to "Automatic".
Right click "My Computer" logo and choose "Manage" and go to "Services and Applications"", "Services" to change the startup type to automatic.

Keep program running after you close putty session to your CentOS server

If you want to keep your program running after you close your putty session to your CentOS server, you could use the following method: 1. install screen
sudo yum install screen
2. start screen then type whatever process you want to keep running
screen
# the command you want to keep running
3. on keyboard issue ctrl-d 4. exist putty session 5. when you logon next time, you could restore the previous session by doing
screen -r
Please refer here for an alternative solution.

Sourcecode syntaxhighlighter in wordpress

If you want to format source code in your wordpress blog, you could try the "sourcecode" tag.
[sourcecode language="python"]
your code here
[/sourcecode]
Supported languages are bash, python, java, JavaScript, perl etc.
The biggest benefits of doing so is to avoid change "--" to '.' automatically by wordpress when you copy commands from your post.

Install Berkeley DB-5.3.21 on Centos

Berkeley DB source file at Oracle. Install optional dependence: Tcl-8.6.0, OpenJDK-1.7.0.9, and Sharutils-4.13.3 (for the uudecode command)
sudo yum install tcl
sudo yum install java-1.7.0-openjdk java-1.7.0-openjdk-devel
sudo yum install sharutils
Install Berkeley DB
wget http://download.oracle.com/berkeley-db/db-5.3.21.tar.gz
tar zvxf db-5.3.21.tar.gz 
cd db-5.3.21/build_unix
# configure the program
../dist/configure --prefix=/opt --enable-compat185 --enable-dbm --disable-static --enable-cxx
make
# install
sudo make docdir=/usr/share/doc/db-5.3.21 install
sudo chown -v -R root:root /usr/bin/db_* /usr/include/db{,_185,_cxx}.h /usr/lib/libdb*.{so,la} /usr/share/doc/db-5.3.21
Questions:
when you run db_recover or other commands, you may encounter "libdb-5.3.so: cannot open shared object file: No such file or directory" Answer:
sudo /sbin/ldconfig

Datatable static image not found on the server

When you use ```datatables.min.css``` and ```datatables.min.js``` locally, instead of datatables CDN, you may have encountered that ```sort...