Archive

Archive for January, 2012

Difference between replace and translate in SQL Oracle

January 20, 2012 Comments off

Replaces…changes the string by string

select replace(‘karuvachi’,’chi’,’yan’) from dual;

Output:

REPLACE(‘KARUVACHI’,’CHI’,’YAN’)
——————————–
karuvayan

translate…changes the character by character

select translate(‘karuvachi’,’vac’,’vec’) from dual;

Output:

TRANSLATE(‘KARUVACHI’,’VAC’,’ABC’)
———————————-
kbruabchi

Note: the “b” second character also changed.

Advertisements
Categories: SQL, Technical

My First JSP Application

January 16, 2012 Comments off

Step 1: Open Notepad or any text editor

Step 2: Type any string …”Hello J2EE World!!!”

Step 3: save this file in Tomcat’s Web apps\ROOT folder as “first.jsp”

Step 4: open your internet browser, run the jsp file as http://localhost:8080/first.jsp ..you should see ur text in the browser

Categories: J2EE, JSP, Technical

Setting up simple J2EE environment in Windows

January 16, 2012 Comments off

I have said simple j2ee environment in the title because today i have set up the environment for running Jsp and servlets only.

Step 1: Download the latest JRE from http://www.java.com/en/download/index.jsp

Step 2: Download the latest Apache tomcat Server http://tomcat.apache.org/download-60.cgi

(Funny the Apache server is still using CGI… he he i think tomcat is mainly developed to replace cgi to jsp and servlets

I am a CGI Programmer…)

Step 3: Install Java, Run the installer and follow the steps

Step 4: Install Tomcat

Step 5: Open Command Prompt(cmd)

Step 6: Setup java home environment variable “set JAVA_HOME=c:\java\jre6”

Step 7: Go to Tomcat’s bin director (cd c:\tomcat\bin)

Step 8: run Startup.bat

It should open another command prompt window and stating that Tomcat is running

you can confirm it by visiting http://localhost:8080/  localsite.

Congrats!!! ….. Now the environment is ready…..Lets explore J2EE

Categories: J2EE, Technical

split in shell script

January 13, 2012 Comments off

OLDIFS=$IFS
set -f
IFS=’,’ # comma is my delimitter
LISTARRAY=($LIST)
set +f

IFS=$OLDIFS
for i in ${listARRAY[@]}
do
echo “$i”
done

Categories: Technical, unix commands

lower case to upper case in unix

January 13, 2012 Comments off

echo “your string” | tr [:lower:] [:upper]

Categories: Technical, unix commands

Replace a string in VIM

January 4, 2012 Comments off

Replace in the entire file:

——————————

Open Vi Editor, Press Esc

then type :s/string/replacestring/ press enter

Ex:

:s/karu/nand/ press enter

Replace with in some lines:

———————————-

:linefrom,linetos/string/replacestring/ press enter

Ex:

1,10s/karu/nand/ press enter

Categories: Technical, unix commands