Software Blogs

Perl mysqlimport Equivalent
Last edited on: 26/04/2010 - 11:07

MySQL has a command line utility mysqlimport which imports CSV files into an MySQL database. In fact, mysqimport is a command line wrapper for LOAD DATA INFILE. Whilst constructing a price comparison website, I came across the problem of uploading merchant product catalogues, which could be 1,000,000 records+, into my MySQL database. The catalogues were provided in CSV format. Great, I thought, I'll use mysqlimport. My joy however was short lived - my host does not allow the use of the LOAD command from the filesystem. No problem, I thought, I'll use PHP.

»   Read more
Drupal 6 dCaldav Caldav/Webdav Client Module
Last edited on: 23/04/2010 - 19:56

CaldavdCaldavThe sporting fixtures listed on this website under the "Sporting Fixtures" menu item are created automatically using my own Drupal 6 dCaldav module.

»   Read more
openSUSE 11.1 to 11.2 Upgrade: Getting MySQL 5.1 to Work
Last edited on: 23/04/2010 - 11:00

A new version of MySQL, version 5.1, is part of the openSUSE 11.2 upgrade. Once you have got the basic openSUSE 11.2 upgrade working, you will discover to your horror that MySQL is not. There are a couple of changes made to MySQL at this release.

Firstly, The MySQL socket is moved to /var/run/mysql. So you will need to edit your /etc/my.cnf file. Open this file and change all occurrences of the socket path to reflect this new path. So, for example:

socket = /var/run/mysql/mysql.sock

This will occur more than once so make sure you change them all!

»   Read more
openSUSE 11.2: Downgrade PHP 5.3 to 5.2
Last edited on: 23/04/2010 - 11:00

PHP 5.3 is bundled with openSUSE 11.2 which, if you are a Drupal developer, is not a good thing. As of PHP 5.3 the function ereg_replace() is deprecated - and this function is used heavily in Drupal 6 core along with many community modules. I performed the openSUSE upgrade to 11.2, and decided to see what the net result would be with respect to my Drupal development. Drupal generates a load of warnings, most of which are more annoyances than problems, but image_cache doesn't work and I have a dependency on that module so decided to downgrade from PHP 5.3 to PHP 5.2.

»   Read more
Drupal 6 Bulk Save of Taxonomy Terms with Perl
Last edited on: 23/04/2010 - 10:59

You may be faced with the prospect of performing a batch save of taxonomy terms on your Drupal 6 installation. Using the normal interface, despite being clean and efficient, it could be an onerous task of many mouse clicks and wandering concentration resulting in errors. I was faced with such a situation so decided to quickly develop my own utility to perform a bulk save on my behalf. I decided upon Perl as the language to code in because I did not want the development time associated with user interfaces - this utility is for command line aficionados.

»   Read more
Drupal 6 Programmatically Create image_gallery Images in PHP
Last edited on: 23/04/2010 - 10:57

Or since image_gallery items are just images with a taxonomy tag in a vocabulary called Image Galleries, a subtitle could be Programmatically Create Images and Tag with image_gallery. In this tutorial we are going to create a small module which contains the code to create the images and has a button on a form to effect the creation. I will foreground the actual copying code so you can cut and paste it into your own module development.

»   Read more
Installing Drupal GeSHi Filter Module
Last edited on: 23/04/2010 - 10:56

The installation of the Drupal 6 Generic Syntax Highlighter (GeSHi) module is of course trivial and wouldn't be worth further consideration if it wasn't for its dependency on the GeSHi PHP Library. Every time I come to install a new PHP library on my rig I am always faced with remembering (a) where the PHP configuration file is so it can be edited with a new path, and (b) where to stick the new library on my filesystem.

»   Read more
XML SiteMap Print - A Simple Drupal Module for Beginners
Last edited on: 23/04/2010 - 10:55

One of the problems with Drupal is there are three different Drupal modules that generate sitemaps for your website. So why is that a problem? Well, none of them appear to me to be perfect. Maybe I am using them incorrectly - if so, *PLEASE* let me know so I can correct my comments! The three modules are:

Lets have a look at them in turn.

Site Map

»   Read more
Drupal 6 Node Wraps Around Customized Region Sidebar Blocks
Last edited on: 20/04/2010 - 18:18

In this exercise I am going to show you how to to create a customized block region inside the node area, with the node text wrapping around the customized block. A mock-up of what we are after, using the default Garland theme, is shown below. To complete this exercise, you will need to have already created a basic Drupal installation (which obviously includes its respective MySQL database) and be able to navigate around the filesystem and edit a few files. You will also need the Views module installed since we are going to test our solution against our own 'blog' view.

»   Read more
Singleton Pattern and the T_PAAMAYIM_NEKUDOTAYIM Error
Last edited on: 17/04/2010 - 10:58

Whilst developing some code for a price comparison website, I came across a PHP error I hadn't seen before.

[Sat Apr 17 09:08:25 2010] [error] [client 127.0.0.1] PHP Parse error:  syntax error, unexpected T_PAAMAYIM_NEKUDOTAYIM in /srv/www/htdocs/compare/sites/all/modules/compare/includes/merchants/merchantMaster.inc on line 224, referer: http://localhost/compare/

What the dickens is T_PAAMAYIM_NEKUDOTAYIM? It turns out this means 'missing double dots' in Hebrew, and is in reference to the '::' scope identifier in objects.

»   Read more
Syndicate content