Thursday 29 May 2014

- Execution time In Php & Javascript

php:
$startTime =  microtime(true);
// do functionality here
$endTime =  microtime(true);
echo " Time Taken: " . number_format(($endTime - $startTime),2) . " sec";

javascript:

var start = new Date().getTime();
// do functionality here
var end = new Date().getTime();
var diff = end - start;
//Result will be in miliseconds..
" Time taken " +  (diff/1000)%60 +" sec"; 

- To setup cron file in ubuntu

- Open the Terminal

- Type crontab -e

- Setup the cron file
1 2 3 4 5 /path/to/command arg1 arg2

Where,
1: Minute (0-59)
2: Hours (0-23)
3: Day (0-31)
4: Month (0-12 [12 == December])
5: Day of the week(0-7 [7 or 0 == sunday])
/path/to/command - Script or command name to schedule

- Symbolic link in ubuntu


To Create Symbolic Link : ln -s /usr/bin/bar(real folder) /opt/foo(link folder)
To View Symbolic Link : ls -l

To Remove Symbolic Link: rm link_name