Wednesday, July 23, 2008

To check type of variable in XQuery

XQuery has a very easy way to check type of variable same as Java.

Use
$variable instance of 'type'
where 'type' can be
xs:string
xs:date
or any type you want to check.

Wednesday, July 16, 2008

Search Using Grep

1. grep -r "keyword" .
here we are searching for the word "keyword" , in current directory and sub-directories.
This will return the list of files and lines which contain this word.
2. grep -lr "modules" .
This will return only list of files .
3. grep -lr "mod.*" .
grep also supports regular expressions

General tag : grep "options" "keyword" "drive specification"

Where options are:

-a All disks.
-c Show the matched characters in Colour.
-f List the File name.
-h Hard disks only.
-i Make the pattern case Insensitive.
-n List the line Number.
-o Only list the file name.
-s Subdirectories.
-x List the lines which do NOT have the pattern in them.

There are many more options , to explore use:
grep man

Tuesday, July 15, 2008

Cron on Linux ( Learn easy and fast)

Schedule a job on Linux Machine. ( Job Scheduler)
1. Using Cron$ crontab -ewhich will start the editor (or vi) and load the current cron table file for this user, or a blank file if none exists.
2. Time Discription
#mh hd dm my dw command
(every line starting with a pound symbol (#) is a comment) fields are:
minute of the hour
hour of the day
day of the month
month of the year
day of the week
command line
3. Crontab Examples
0 12 * * * /opt/command.sh
This command will execute every day at noon.

4. Cron Job Output
0 12 * * * /opt/command.sh > /opt/file.log
output of command.sh will be overwritten to file.log everytime cron job runs
0 12 * * * /opt/command.sh >> /opt/file.log
output of command.sh will be appended to file.log everytime cron job runs

Check time on Linux Machine

Use
date
hwclock