Home » Author Archive

The world is slowly adopting HTML5 and it is time to move towards it. HTML5 incorporates many features which were achievable only using third party plug-ins. I am not talking about HTML5 in detail. I just want to give you some light on a great feature which HTML5 ships with, “Canvas”! “Canvas” which is an HTML5 tag, allows you...
Being a flash programmer, I have always had this concern. The way a flash application works differs from a php application. We don’t really need to worry about protecting the PHP code because the code is interpreted in the server and only the html codes are sent to the client browser. But a Flash engine basically lies in the user browser and the AS2...
I have an array with many values and I need to do a search to find all the values that match a pattern. We have functions like in_array & array_search in PHP, but these functions basically try to match the exact needle value in the array. I need to use my Regular Expression Pattern and find all the array values that match the regex pattern. The...
In this tutorial, learn about the get_browser() PHP function and its configuration. We’ll learn how to use Gary Keith’s browser information database (browscap.ini) with the PHP browscap directive. I wanted one of my web applications to have a different appearance on mobile phones and devices. I didn’t really want to set up an entirely...
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...
Dell Vostro 1520 Laptop Freezes – Problem with Dell Laptop. I am using a Dell Vostro 1520 laptop and recently I came across this problem. My laptop hangs randomly and every time it does (it freezes stops responding completely), I have to restart my laptop by pressing the Power button for a few seconds. If some music was being played when it hangs,...
Filed in: Computers
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...
A very basic tutorial. For the beginners who want to pass array values from PHP to Javascript for them to be accessible in the client side JS as an array. It’s really easy to pass PHP array to Javascript. The below code passes a string array in PHP to Javascript. <?php $arr = array("a","b","c"); ?> <script> var...
Sometimes, or very rarely we might need to access a model in AppController (Application Controller). This could be for fetching values from a table and make it available for all the controllers in the application (AppController is inherited by all the other controllers). Also, often we need to access models that are not associated with a controller. I...
Filed in: CakePHP, PHP/MySQL

Page optimized by WP Minify WordPress Plugin