Perl – Template Tool Kit

The Template Toolkit is a template processing system used to create Data Output Files. It is a open source software and runs on all modern stable operating systems. it’s distributed under an Open Source license. So you will get full source code to the template tool kit and you can modify and adapt the code,… Read More »

Return all monday between two dates – using Oracle sql

Return all Monday between two dates – using Oracle sql Query select to_date (’2012-12-30′, ‘yyyy-mm-dd’) + (level – 1) as Date from dual where to_char(to_date(’2012-12-30′, ‘yyyy-mm-dd’) + level – 1, ‘DY’) = ‘MON’ connect by level <= ceil( (to_date(’04-Jan-2014′,’dd-mon-yyyy’) – to_date(’30-dec-2012′,’dd-mon-yyyy’))+1 ) order by Date ; For Example if my start date is 01/01/2013 and… Read More »

EXT.MessageBox Samples

Generating different styles of message boxes // Basic alert Ext.MessageBox.alert(‘Status’, ‘Changes saved successfully.’); // Show a dialog using config options Ext.Msg.show({       title:’Save Changes?’,       msg: ‘Your are closing a tab that has unsaved changes. Would you like to save your changes?’,       buttons: Ext.Msg.YESNOCANCEL,       //fn: processResult,      animEl: ‘elId’ }); //Prompt for user… Read More »

Logical Defined-Or in Perl

// It’s exactly the same as ||, except that it tests the left hand side’s definiteness instead of its truth. Thus, EXPR1 // EXPR2 returns the value of EXPR1 if it’s defined, otherwise, the value of EXPR2 is returned. For Example : $home= $ENV{HOME} // $ENV{LOGDIR} // (getpwuid($<))[7] // die “You’re homeless!n”;    

Finding html tag

Table Expression        =>    “<table[^>]*>(.*?)” Header Expression     =>    “ <th[^>]*>(.*?)” Row Expression          =>    “<tr[^>]*>(.*?)” Column Expression    =>    “ <td[^>]*>(.*?)” Finding HTML tag          =>    “s]+))?)+s*|s*)/?>”

Sort-command alphanumeric

Sort-command alphanumeric If they all actually begin with “page$” echo “page$1 page$20 page$2 page$10” | sort -k1.5n Answer : page$1 page$2 page$10 page$20 sort -k1.5n -k to set the key 1.5 means that the 5th character of the 1st field is the start of the sort field n means that this field is to be… Read More »

The caller() function and $wantarray

The argument of interest is the $wantarray argument. This indicates what return value is expected of the subroutine from where it was called. The subroutine could have been called in void context meaning the return value is thrown away. Or it could have been called and the return value assigned to a scalar. Or it… Read More »

Using the caller() Function in Subroutines

The caller() function can be used in a subroutine to find out information about where the subroutine was called from and how it was called. Caller takes one argument that indicates how far back in the call stack to get its information from. For information about the current subroutine, use caller(0). # # # sub… Read More »