XSLT: for loop done through template

For loop template code:

To Call template:


Prepared statement with IN Query clause



Ever wondered, how to see create table code in Oracle?
as available in MySQL “show create table”

Here is how to do it

SQL> set pages 0
SQL> set long 999999
SQL> select dbms_metadata.get_ddl(‘TABLE’, ‘EMPLOYEES’, ‘EMP’) from dual;

MySQL: dropping all tables of a database with ease

So there is a need to delete all tables from database?


  1. Drop database and recreate, what if you don’t want to drop database, could be many reasons.
  2. Fire drop table [tbl_name ...] command on MySQL prompt but then who is going to type all tables names.

Run following command from command line

mysqldump -u [USERNAME] -p[PASSWORD] –add-drop-table –no-data [DATABASE] | grep ^DROP | mysql -u [USERNAME] -p[PASSWORD] -D [DATABASE]


  1. First one takes dump of all tables of database without any data along with drop table command.
  2. Second part fetches lines starting with Drop from the output of first command.
  3. Third command executes queries fetched by second command which are only drop table commands.

MySQL: Load timezones info in MySQL Server

Run following command on command line:

mysql_tzinfo_to_sql  /usr/share/zoneinfo | mysql -u root -p mysql

and to change timezone of the mysql server, add following line in the my.cnf file (/etc/my.cnf)


or run following query on MySQL prompt (this will be valid for current session only)

SET time_zone = ‘Asia/Kolkata’;

Run PHP scripts in background on Linux

To run a PHP script in background from command line and keep it running even if you exit the terminal, use following syntax:

nohup php script.php < /dev/null &

nohup‘ is a POSIX command to ignore the HUP (hangup) signal, enabling the command to keep running after the user who issues the command has logged out.

In Unix-like operating systems, ‘/dev/null‘ or the null device is a special file that discards all data written to it.

‘&’ is to send the process in the background and return the command line prompt.

Common MySQL Data Types

Text Data Types
CHAR( ) fixed from 0 to 255 characters long
VARCHAR( ) variable from 0 to 255 characters long
TINYTEXT maximum length of 255 characters
TEXT maximum length of 65535 characters
BLOB maximum length of 65535 characters
MEDIUMTEXT maximum length of 16777215 characters
MEDIUMBLOB maximum length of 16777215 characters
LONGTEXT maximum length of 4294967295 characters
LONGBLOB maximum length of 4294967295 characters

Numeric Data Types
TINYINT( ) -128 to 127 SIGNED or 0 to 255 UNSIGNED
SMALLINT( ) -32768 to 32767 SIGNED or 0 to 65535 UNSIGNED
MEDIUMINT( ) -8388608 to 8388607 SIGNED or 0 to 16777215 UNSIGNED
INT( ) -2147483648 to 2147483647 SIGNED or 0 to 4294967295 UNSIGNED
BIGINT( ) -9223372036854775808 to 9223372036854775807 SIGNED or 0 to 18446744073709551615 UNSIGNED
FLOAT small number with a floating decimal point
DOUBLE( , ) large number with a floating decimal point
DECIMAL( , ) DOUBLE stored as a string , allowing for a fixed decimal point

Date Data Types

Javascript: Always define variable with ‘var’

So today, I found one more unseen behavior of Javascript (at least for me).

I wrote a very simple function in Javascript and forgot to add ‘var’ in front of variable definition. This function worked first time but for second time I got JS error saying the function does not exist. I was like what the hell, where did my function go? It just worked as expected for first time and suddenly browser is not able to find it.
It took me 20 minutes to find out the reason of my biggest mistake of tonight. Such a waste of precious 20 minutes at 3:00 AM :(
Lesson learned, always define variables in Javascript with ‘var’ keyword or else stay up till late night ;)

Install Memcached on Windows 7

To install Memcached on Windows 7 you need administrative rights. Grab your copy of Memcached for Windows (I got it from here, so I will explain this one). Now follow the steps below:

  1. Download and unzip Memcached binaries.
  2. Press the Win key, type cmd, press Ctrl+Shift+Enter.
  3. Select yes from elevation prompt.
  4. A command window will open with administrative rights.
  5. Go to Memcached folder (mine is c:\memcached\)
  6. Type and run [ c:\>memcached -d install ], this will install Memcached as service.
  7. Now start the service with [ c:\>memcached -d start ]
  8. FIN
Now Memcached is installed and running.

Less know JavaScript operator ‘Delete’

One of the lesser known operators in JavaScript is the ‘delete’ operator. I came to know about while reading John Resig’s blog.

What does it do?
The delete operator deletes an object, an object’s property, or an element at a specified index in an array.

More about it at Mozilla Reference Docs.

Small Example:

1 2 3 5  Scroll to top