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 from a string. A simple solution is shown below, which rejects all the characters from the input except alphanumeric and a space.
Read More

Amazon uses a hierarchy of nodes to organize its various items. Each node represents a collection of items, such as Harry Potter books, not the items themselves. Browse node IDs are positive integers that uniquely identify product collections, for example, Literature & Fiction: (17), Medicine: (13996), Mystery & Thrillers: (18), Nonfiction: (53), Outdoors & Nature: (290060). Amazon uses over 120,000 browse node IDs in the US locale alone.

The BrowseNodes tool automatically gets all the child BrowseNodes and their names. The program recursively traverses the BrowserNode hierarchy and returns all the BrowseNodes and their respective names. You can display the nodes on the console or save it to a CSV file. You can also include the library in your existing projects to process BrowseNodes.
Read More

Waypoints is a small jQuery plugin that makes it easy to execute a function whenever you scroll to a particular element – a ‘waypoint’. This can be used to highlight when a element comes into view, load additional html or throw a popup. In this post we will use it to create a infinite scroll page.

An infinite scroll page can be useful when you do not want to add pagination, but would rather load the content on the same page when the user requests.
Read More

Comparing programming languages

Posted in: software |  

13 Dec 2011

Programming language comparisons raise the most flame wars on blogs and forums. Each developer rooting for his favorite language and deriding all the others. Most comparisons are like comparing apples-to-oranges, devoid of any logic, and arguments frequently hinging on ad-hoc rationalization and technical naïveté.
Read More

It can be surprising how easy it is to overlook security issues in software design. WordPress for example, after all the versions, still displays login error information that can be informative for a potential hacker. Rather than displaying a generic login error message, WordPress admin specifically displays whether a ‘username’ was entered wrong or a ‘password’ as the following screenshot shows.
Read More

With WordPress installations on the rise, security threats are a common concern for users. Below is a small collection of WordPress plugins that I found adequate for use on most WordPress installations to keep security in check. As always security is not 100% achievable, but the following plugins will help you find any loopholes in your site and help you monitor for any security breaches.
Read More

Learning the Language of the Web

Posted in: design,web |  

9 Dec 2011

With the ever increasing presence of the Web, more people are interested in learning the language of the Web. Designers, artists, and newbie’s unfamiliar with Web development are eager to learn to code so that they can understand the Web better and create something original.

Learning through books can take some time and can be a major hindrance for people who find the learn-by-the-book method dry an uninspiring. In a bid to make learning the language of the Web more interesting, some designers and developers have come together and created some interesting and useful web projects.
Read More

My new article describes how to backup your WordPress database to the Amazon S3 cloud infrastructure using a custom plugin. Along with a small description of S3, the article proceeds to build a small plugin to upload your database to Amazon S3. Read the complete article at Smashing Magazine.

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 that we could explore all knowledge by evaluating all possible combinations of those principles.

The design for the Lullian poetry sprouts from this premise. The Lullian generator works by randomly selecting words and phrases which are then placed in a pre-defined ‘Semantic Schema’. The philosophical idea being that randomly chosen words can be used to stimulate the mind in producing startling fictional plots and verbal imagery that you might not otherwise consider.

Take the following example short poems generated by the program. Although the resulting poems are nothing like the ones you would ordinarily encounter, the real facet of the poems is their whimsical nature of word combinations, sometimes ridiculously so.
Read More

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 design. So the idea of building DSL’s was the perfect excuse for learning parser design.

To design a good DSL it is necessary to have some compiler design knowledge under your belt. The classic Dragon book is usually the first choice of reference to pickup on compiler design, but it is too theory oriented, and what I needed was something to get me started with writing code quickly, rather than mull over automata theory, syntax trees and other compiler theory concepts. My first choice was Ronald Maks Writing Compilers and Interpreters. Although it is an incredible book, it is rather elaborate in its presentation. What I instead wanted was a cookbook style presentation, using which I could quickly design some working code, and only later refer to the above books for more in-depth understanding.
Read More