Tuesday, December 21, 2010

Install Apache Http Sever using yum

> yum install httpd
> service httpd start

Install mysql using yum

Install MySQL Sever & Dev Tools

> sudo yum install mysql
> sudo yum install mysql-server
> sudo yum install mysql-devel
> sudo /sbin/service mysqld start

To change root password:

/usr/bin/mysqladmin -u root password 'mysql'

Optional Steps:

> chgrp -R mysql /var/lib/mysql
> chmod -R 770 /var/lib/mysql

Wednesday, November 03, 2010

Use of static inner classes

We have HashMap.Entry class that is declared as a static inner class, I was searching for why it has been declared as static inner class and I found this post, which talks about when to use what type of inner classes.

In Short,

  1. Convenient way of grouping classes without using packages
  2. To create an instance of this class, we don't need outer class's object
  3. It will help you to extend from some other class

java.util.HashMap.Entry is used in
  • java.util.LinkedHashMap.Entry
  • java.util.HashMap.EntrySet
  • java.util.HashMap.HashIterator
  • java.util.LinkedHashMap

Wednesday, September 22, 2010

Fast way to multiply a number by 7


/**
* @author Vijayan Srinivasan
* @since Sep 22, 2010 3:47:15 PM
*/
public class MulBy7 {

public static void main(String[] args) {
for(int i=0;i<10;i++){
System.out.print("i="+i+",");
int value=(i<<3)-i;
System.out.println("i*7="+value);
}
}

}


Output:

i=0,i*7=0
i=1,i*7=7
i=2,i*7=14
i=3,i*7=21
i=4,i*7=28
i=5,i*7=35
i=6,i*7=42
i=7,i*7=49
i=8,i*7=56
i=9,i*7=63

Tuesday, August 31, 2010

Comparison of different SQL implementations


Most of the time when we port application from one database to other we look for equivalent command in other database. Here is a site that provides a comprehensive list of different sql implementations. more info at http://troels.arvin.dk/db/rdbms/

Wednesday, June 30, 2010

எளிமையாய் சொன்னேன்


என் பிறந்தநாள் வாழ்த்தே
முதன்முதலாய் இருக்க
முந்தியநாள் நள்ளிரவே
வாழ்த்து சொல்லியிருக்கிறேன்
தொலைபேசியில்...

உன் விழிகள் என்னையே
முதன்முதலாய் சந்திக்க
அதிகாலை ஐந்து மணிக்கே
உன் விடுதி வாயிலில் நின்றிருக்கிறேன்
வாழ்த்து அட்டைகளுடன்...

உன் பிறந்தநாளின்
முதல் மின்னஞ்சல்
என் கவிதையாய் இருக்க
மென்பொருளொன்று செய்திருக்கிறேன்
ஆயிரம் கவிதைகளுடன்...

இதுவரை இப்படித்தான்
உன்னை ஆச்சரியமூட்டியிருகிறேன்
என் வாழ்த்துகளால்...

இன்று உன் பிறந்தநாள்
இது என் மனைவியாக
உனக்கு முதல் பிறந்தநாள்...

எப்படி சொல்வது
என் வாழ்த்துகளை
இதுவரை இல்லாத வகையில்?
என்று எண்ணி எண்ணி
ஏதும் கிடைக்காமல்
எளிமையாய் சொன்னேன்
"இனிய பிறந்தநாள் வாழ்த்துக்கள்..."

வாழ்த்துக்களுடன்
விஜயன் சீனிவாசன்

Thursday, April 15, 2010

Check what all ports running

If you know the port at which that service runs then issue the following command
[vijayan@boarddown-dr ~]$ netstat -an | grep LISTEN | grep 80
tcp 0 0 0.0.0.0:807 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:5801 0.0.0.0:* LISTEN
tcp 0 0 :::80 :::* LISTEN

To know which process id owns this port
[vijayan@boarddown-dr ~]$ sudo /sbin/fuser 80/tcp
80/tcp: 25529 25530 25531 25532 25533 25534 28522

To know which executable/script runs on that process id
[vijayan@boarddown-dr ~]$ ps -lfwwwwwp 25529
F S UID PID PPID C PRI NI ADDR SZ WCHAN STIME TTY TIME CMD
5 S root 25529 1 0 75 0 - 953 - Feb17 ? 00:00:00 /home/vijayan/dev/Apache2/bin/httpd -k start

Thursday, February 04, 2010

Get Password without displaying it on console

JDK 1.6 provides option to get secret inputs without displaying them on console. Here is the code sample to do that.



System.console().readPassword("[%s]", "Password:");

Tuesday, February 02, 2010

Online Free Flex based Building Plan Software

If anyone of you thinking to build a new home and looking for a software that can help you model your home. Here is the link you can use this for free.
http://dragonfly.autodesk.com/

Thursday, January 28, 2010

Specifying default schema name in JPA

Often we use different user name to connect to oracle database instead of the using the same user name with schema name. In that case queries needs to be prefixed with schema names. to do that in JPA we can add the following property in persistence.xml file




com.foo.bar.Test




Tuesday, January 19, 2010

Access Oracle Blob and Timestamp Columns

Many of the time we use Blob and Timestamps column in Oracle. When we access them using JDBC, we will get Oracle specific Java objects when result set is returned from DB. e.g oracle.sql.BLOB, oracle.sql.TIMESTAMP but we may need them in the form of java.sql.Blob and java.sql.Timestamp

To get it in right way we need add the following start-up properties

-Doracle.jdbc.J2EE13Compliant=true