Author Archives


20
Jun 10

CakePHP Full Text Search

CakePHP’s database abstraction is just one of the reasons to use this powerful framework for agile web development. However, it is not always obvious how to build complex queries. I recently had to implement a MySQL full text search against a music database that searched on titles, descriptions and tags. Full text search is a quick, and not too dirty way to make a pretty decent search, although it does come with a caveat, as described in the MySQL documentation:

Full-text indexes can be used only with MyISAM tables, and can be created only for CHARVARCHAR, or TEXTcolumns.

Continue reading →


19
Jan 10

How to fix the OSX Leopard Set up Assistant Loop Bug.

Today, my G5 (Leopard) started displaying the Set Up Assistant everytime it booted. Even after completing setup it was impossible to access the GUI. It was held in a continuous.

If you get caught in the Leopard Setup Assistant Loop Bug, here is the way to get your Mac booting again with no loss of data.

  1. Boot into Safe Mode by holding down the shift key just after you hear the first boot sound. This takes an eternity so be patient.
  2. Don’t log in to any account. Instead press the back arrow key once (this will highlight an account).
  3. Then click the restart button.
  4. Now just wait while your Mac performs some updates and then reboots as normal again.

Even Macs break occasionally / rarely.


15
Jan 10

Select and Unselect All Checkboxes with jQuery

I’ve been working with jQuery to spice up my interfaces for over 12 months now and figured it’s time to share some of the little techniques I’ve developed on the way.

The first is something I use quite alot when I am giving users the ability to administer lists of items in bulk. That including a checkbox that when checked sets the state of all the checkboxes beside a list of items to “checked”. Naturally unchecking it will uncheck all checkboxes. I’m sure you get the picture here’s the code based on two scenarios depending on your preference. But firstly you need to include the jQuery library in the head of your document (I grab mine straight from Google’s repository to save my bandwidth):

Continue reading →


27
Nov 09

A workaround for the CakePHP alphaNumeric issue

Recently whilst building a CakePHP app on a shiny new server I noticed some unexpected behaviour when using an alphaNumeric rule to validate a model. Whatever I passed into the model returned false. That is to say that even a valid alphanumeric string threw up an exception. (if you haven’t already dived into CakePHP, you should – it’s a rapid development framework based on MVC.)

The issue seems to be tied to PHP 5.1.2 and the way regular expressions are handled, however it seems the it may appear in other configurations too. Before I get to a workaround, note I haven’t levelled the “bug” word at either PHP nor CakePHP – for all I know it could be a difference of opinion on how something should be handled. What I do know is that I would rather harness CakePHP’s flexibility to create custom model rules than try upgrading my current live server PHP installation.

Here is an example of how you should be able to implement the alphaNumeric rule using validation in CakePHP based on a simpliefied model called “User”:
class User extends AppModel

{
var $name = 'User';
var $helpers = array('Form');
var $validate = array(
'username' => array(
'loginRule-1' => array(
'rule' => 'alphaNumeric',
'last' => true,
'message' => 'Only letters and numbers allowed'
));
}

The rule in bold italics above is the one that doesn’t always work. However this can be easily rectified with a custom rule built on a regular expression seeking out valid alphanumeric strings.

To achieve this the alphaNumeric rule just needs to be replaced with this:

"rule" => array('custom', '/^[a-z0-9]*$/i'),

Problem solved.


14
Oct 09

Keep linux scripts running after you have closed a remote shell.

I stumbled across this whilst importing 1.1TB of data from a server to Amazon S3 (more on that another day). What I wanted to achieve was to be able to ssh into my remote server, issue a command to push over 200,000 mp3′s up to Amazon and to be able to exit the shell and keep the process running.

The answer lies in a command line tool called screen.

Screen allows you to start a process on a virtual screen, then detach that screen and do something else (including log out). You can also reattach your screen after logging out and logging in again.

If you dont have the screen command on your remote linux box, first install it either from source or using your favourite package manager. Then login into your remote box and run your desired command prefixed with “screen”. For example:

screen top

Now to detach the screen use CTRL+a followed by d. This will detach your screen and you can go about any other business, including quitting your remote session.

Reattaching you screen at any time is as simple as running the command:

screen -r

You can detach and reatach your screen as much as you want until your running process is finished or you kill it, at which point your virtual screen is killed too.


22
Sep 09

British Sign Language Support – New Zumo Internet Launch

Over at my Web Development Agency in Spain we’ve been busy again and we are pretty chuffed with the results. Once again working with TMax Media we have built and just launched BSL Homework Support a website that offers resources, and assessments for anyone interested in learning sign language.

We cut the XHTML, wrote the CSS and used PHP and MySQL to power the online purchasing and content retrieval system. The site features thousands of video clips that we deliver using jQuery and some elegant third party applications such as Shadowbox and JWPlayer.

If you are looking for something special for your next web project, or you’re a media agency looking for a reliable and talented web development service, please email info@zumointernet.com and we’ll let you know what we can do to you.


10
Sep 09

CEIP Mariana Pineda, Benalmadena, Arroyo de La Miel

Hopefully this may help someone else find the contact number for this school which is not correctly listed on either the Yellow Pages in Spain or the Junta de Andalucia’s website.

The telephone number is 951 293 997

In case you are wondering why it is so hard to find: the school is fairly new and is listed as a plot of land still on the Junta’s site. I’m guessing the amount of paper work needed to get a website change actioned is far greater than the parent’s need to contact a school.

The official listing is here.


3
Sep 09

Summer Fields School – New Zumo Internet Launch

Whoops we did it again. Another Zumo programmed site has left the building, this time in the shiny coat of Summer Fields Prepartory School.

TMax Media designed the site and Zumo Internet cut the code and programmed the CMS and front end from start to finish with a smooth blend of XHTML, CSS, PHP, MySQL and jQuery. More reason to trust us with your web site development.


21
Jul 09

Working with PHP’s simplexml and nodes with hyphens

Here’s a quick GOTCHA that may save at least one developer some time. Recently whilst working with some XML to import music into an mp3 download site I came across an issue accessing the values of specific nodes through the simplexml object that I created. The value always threw up zero.

The issue lies in node names containing hyphens, thus:

$object->album-title     returns     0

The answer is to wrap the object property (node name) containing the hyphen in curly braces.

$object->{‘album-title’}     returns     “London Calling”

Here’s hoping that helps someone.


19
Jul 09

Thunderbird Software Update Failed. One or more files could not be updated

This is a software update loop that has been annoying me for a while now when Thunderbird tries to update itself on Windows. Well, before you go removing any files or removing Thunderbird and starting from scratch, try this somewhat abstract method. I’ll bet more times than not it works:

  1. Ctr+Alt+Delete and open your Process manager.
  2. End the process “Quickcam.exe”.
  3. Restart Thunderbird, install the update and sleep peacefully.