I was recently writing a demo to showcase the new Google Language API, and in my demo I did the usual thing of instructing users to View > Page Source in order to view the source code and comments. I know this is less than ideal, because it forces users to have to process the [...]
Category Archives: development
Triggering the Source Code view of the current page using JavaScript
Recommended Mozilla Firefox add-ons (aka extensions, aka plugins)
This is a list of my "must-have" Mozilla Firefox add-ons. If you can recommend anything similar or better, be sure to drop me a comment. Page Analysis & SEO Minimise Nuisance Bookmark Management Download Management Productivity Web Development & Design Security Functional Extensions Tab Management Add-Ons Management Page Analysis & SEO About This Site Bookmarks [...]
Selecting a random row using MySQL
There are many examples where you would need to retrieve a random record or more from a set of tables. For example your page template may be cycling through QOTDs, testimonials, offers, specials, and so forth. To retrieve a random row in MySQL, use the ORDER BY RAND() statement to randomly order the rows of [...]
PHP code snippet – Reorder items in a table
This snippet of code reorders items in a table based on the number of steps you want to move an item from its current position. It moves the item of interest to its new position and shifts all other items to their new shifted positions. PLAIN TEXT PHP: function moveItem ($n_steps) { if ($n_steps == [...]
svn – Ignore/exclude files from version control
In most projects there are going to be files that you wish to ignore in version control. These could be temporary files, log or debug files, and so forth. These are files that you can safely ignore when executing commands such as svn commit and svn st. The following shows how to configure your svn [...]
Project configuration
I prefer initialising all my scripts through a bootstrap script that in turn reads a configuration file. I tend to re-use a common set of configuration parameters. PLAIN TEXT PHP: define('DEBUG_PROJECT', false); define('DISPLAY_ERRORS', true);</code> /** * E-mail send/receive related * / define('EMAIL_CONTACT_ADDRESS', 'webmaster@mysite.com'); define('EMAIL_SERVER_FROM_IDENTITY', 'MySite Webmaster'); define('EMAIL_WEB_ADMINISTRATOR', 'admin@mysite.com'); /** * Time-related */ //EOT [...]
