Archive for the ‘php’ Category

It seems that some common elements of programming stump us from time to time. Take the task of filtering a input search string in PHP to remove unwanted characters. Using a RegEx many developers find it easy to search for a substring, but find it difficult to use the same to reject some particular characters [...]

The article describes a Lullian poetry generator in PHP, the idea for which was inspired from Clifford Rickover’s wonderful and eclectic, The Loom of God. The idea is attributed to Ramon Lull, a Spanish theologian, who lived around the 13th century. Lull believed that every branch of knowledge was governed by simple basic principles, and [...]

Compiler design is a complex endeavor, but also one of the most satisfying projects you can undertake. Lately I’ve been interested in compiler and parser design; my interest piqued by Debasish Ghosh’s wonderful book, DSLs in Action. Web development in general provides a far less opportunity to work in the domain of compiler or interpreter [...]

This post is based on Ward Cunningham’s Signature Survey: A Method for Browsing Unfamiliar Code article. Ward suggests that when studying new and unfamiliar source codes, it is vital that a programmer get a intuitive sense of the code structure under consideration. One method he suggests is that of summarizing on a single line select [...]

It is very rare that I have seen some code that employs the PHP XOR logical operator. It is not the case that it is not required or programmers are unfamiliar with it; it probably seems that most programmers have become comfortable with using the more common ‘&&’ and ‘||’ operators to construct all logical [...]

A couple of weeks back I had to write a solution for a client to track the referrer search engine from where the user came to his sites contact page, without using Google Analytics. If a user was to fill the contact form on the website, the referring search engine name and the keyword for [...]

One of the frustrating things with working with MySQL is of importing large sql dump files. Either you get a ‘max execution time exceeded’ error from PHP or a ‘Max_allowed_packet_size’ from MySQL. In a recent task I needed to import a table of around a million records on a remote host, which quickly became an [...]

Creating a database driven web application involves commonly used paradigms for data modification, which we commonly refer to as CRUD. Frameworks provides nice ORM wrappers to help the programmer. But for small projects frameworks can be an overkill. Still the programmer needs to design the basic database CRUD functionality, which can be quite tedious and [...]

Underscore.php is a PHP port of the popular Underscore.js library. Underscore.php provides a utility library for PHP that provides a lot of the functional programming support that a programmer would expect in Ruby, but without adding much overhead during execution. The only caveat is that underscore.php requires PHP 5.3 or greater. Although you could accomplish [...]