Home » Programming Techniques

Often we search for records in a database table for fetching records that were created or modified on a particular date or between two dates. We match against a date field and add multiple conditions to find records with a date field value ranging between two dates. It would look something like this: Select * from tables where CREATE_TIME >= "2007-03-14...
When we need to swap the values of two variables, we use a third variable temporarily to hold the data between swapping.  Something like this: <?php $tmp = $a; $a = $b; $b = $tmp; ?> Here is another way without using a temp or a third variable. <?php list($b, $a) = array($a, $b); ?> And if you want to make it a function: <?php function...
The Auth Component in CakePHP redirects the user to the log-in page when a user tries to access any protected pages in the application. The default log-in page is set by defining the loginAction variable in the beforeFilter function in your UsersController or AppController. But if you have used plug-ins in your application, and if a user tries to access...
Developers normally use functions that use Regular Expression to convert under_scored strings in to CamelCased strings. Usage of Regular Expression is quite heavy. We can use a simple yet powerful method to convert these strings to CamelCase without using RegEx in PHP. Here is the method: echo join(””, array_map(“ucwords”, explode(‘_’,...
Do you think your website is sluggish? Does it take a lot of time to download on to a user computer? Here are some techniques to make your site load faster on user computers and enhance it’s performance. These are some of the best practices followed in the Web industry. Implementing these practices has proved that your site will become 20-30%...
Often, we come across situations where we need to INSERT multiple rows in to a database table from an Array, File or even from another Database Table. I am explaining various methods for inserting multiple rows using a single query using MySQL and PHP. MySQL documentation says you can use the following methods to speed up inserts: If you are inserting...
A small article for those who want to experience with Regular Expressions in PHP. Regular expressions, also referred to as regex or regexp, provide a concise and flexible means for matching strings of text, such as particular characters, words, or patterns of characters. Regular expressions are used by many text editors, utilities, and programming languages...

Error Handling in Perl & EVAL Block

Posted by on January 28, 2010
This article covers two things. 1) Error handling in Perl using EVAL Block 2) Using the EVAL Block feature to check whether a directory exists on a remote FTP location. The first time ever I had to work in Perl was last month when I was asked to look in to an issue with sending a file to a remote FTP from the server. Basically, the perl script fetches...
I have no reasons for posting this article here. But I’m sure someone can get some insight from this. This is a good example of making use of recursive function calls also known as recursion. It takes the form of a function that calls itself. Recursive functions or recursion are something that needs a little more attention as you have to be sure that...

Page optimized by WP Minify WordPress Plugin