/* PHP & MySQL Journal */
A couple of days back I created a Firefox toolbar for my blog as an experiment in learning XUL. Once installed on my blog I wanted Firefox to recognize it as an addon and install it rather than displaying a ’save/open’ dialog. For that I needed to add the following directive to the servers .htaccess [...]
Searching and replacing content in files is a common task all of us do regularly. Most programmers will implement it using Perl a shell script or through a editor. Perl offers itself as an excellent tool for the required purpose; we PHP programmers are not quite so lucky in that matter. Search/replace is easier from [...]
In: algorithms| php
20 Apr 2009In this post we will see how to use a Stemming algorithm for search purposes.
A stemming algorithm lets you reduce each English input word to its basic root or stem (e.g. ‘walking’ to ‘walk’) so that variations on a word (‘walks’, ‘walked’, ‘walking’) are considered equivalent when searching. This stems can than be used [...]
Charts are an indispensable part of any data visualization work. People can grok visual representation of data easily than a textual variety. Today there are a huge number of free chart libraries available to display visualizations on websites. Below is a small list of some of the libraries available for displaying charts using php.
There are three ways to access a website data. One is through a browser, the other is using a API (if the site provides one) and the last by parsing the web pages through code. The last one also known as Web Scraping is a technique of extracting information from websites using specially coded programs.
In: php
20 Feb 2009The New York Times has started offering a set of APIs for their various data services. On January 27th they released the API for their Best-Seller list. According to NYTimes :
Like many organizations, we hope to encourage innovation through collaboration. When you build applications, create mashups and otherwise reveal the potential of our data, we [...]
In: php| visualization
16 Jan 2009Wordle is a online Java Applet for generating word clouds. The application is simple. You enter a bunch of text and Wordle does the rest. The applet provides options to change color, font and layout. Just for fun I created a Wordle cloud to display php’s built in functions. Two samples are shown below. The [...]
In: php
11 Jan 2009Most PHP programmes may not be familiar with the colon syntax used for control structures. If you regularly code in wordpress than you already are acquainted with it.
PHP offers a alternative syntax for some of its control structures- if, while, for, foreach, and switch, where you change the opening brace to a colon (:) and [...]
In: php| refactoring
4 Jan 2009As said in the previous post, I’m kick-starting the refactoring series with the ‘Consolidate Conditional Expression’ pattern. Bear in mind that the examples that will be given are deliberately made simple to keep the refactoring ideas in focus. So lets start with our first pattern.
Consolidate Conditional Expressions
Many times you see a group of conditionals where [...]
Validating POST data from a form is a common requirement for a developer. If the number of form fields are few than the validation is a small matter. But the case is different when the form contains more than 15 or 20 fields and some of the fields are mandatory. The following code will give you an idea [...]