Mac Web Based Till System – launch teething problems
Turns out, the G4 really doesn’t like CakePHP all that much.
Whilst I had tested the system on the G4, I hadn’t tested it in a shop full noise, children and mothers anxious to pay and leave. Waiting 2-3 seconds for a barcode item to enter the system once it has been scanned is simply not good enough.
I examined the severe problems on day one and they were sixfold:
- Scanned items didn’t appear for 3 seconds
- The automated google-instant-type keyword search was terribly slow
- Processing payments took up to 10 seconds from submitting the form to printing.
- The receipts didn’t feature the logo as they had done in practice.
- The receipts were printing out 10 inch long rather than the inch or so they should have been.
- Subsequently we were out of paper and the till wouldn’t open.
All within the first hour of service.
#6 was straightforward – off to the poundshop to buy a screwdriver to undo the screw hiding the release catch. All the others were critical bugs that needed sorting.
Speed issues – solution #1
My first thought was that CakePHP view caching would work wonders on the barcode element. I implemented caching for 30 days and found that instead of 2-3 seconds on the macbook, we were down to 1.5 seconds.
I also turned on MySQL caching on the mac. This didn’t have any more impact on the barcode area, as this was cached as a hard copy, but it did have an impact on other areas of the system.
The improvements were good, but not good enough. My wife was willing to rush straight down to Currys and buy a macbook air to plug in, but I wanted to hold off. When confronted with problems like this, there are always at least two options:
- Throw money at it – buy more RAM, buy better kit, buy more kit
- Make the code better and more streamline.
Whilst I couldn’t make the code better, what I certainly could do was bypass CakePHP’s infrastructure for these crucial AJAX calls.
Speed issues – solution #2
I made 3 separate files in webroot that replaced the functionality in the Model/Controller/View of the till system for the AJAX receivers. This was now returning results in 0.435 secs. I took off the onKeyUp event on the keyword search (when you speed type, the G4 just froze) and made it a regular form – 0.495 secs.
These are times we can live with.
At this time, I also added a mail rule to Apple’s Mail program –
do shell script "svn update /Users/admin/Sites/hoptoyshop.co.uk/app/"
I get this to run whenever I send it an email with the title “doupdate”. Now I can update the system remotely with just an email.
Receipt issues
So, onto receipt issues.
Turns out that on the G4 it was trying to print out on A4 size, hence all the white space. Although the Star manual said this was a system issue, I tried everything I could to change it, but no dice. Instead, I used an option in the CUPS command lpr:
-o media=Custom.78x90mm filename
The logo wasn’t printing out as it was a GIF. Changing to JPG worked a treat.
A week later
After a week, all the staff are happy with the system. We have new till paper. Times for any function are down to less than one second.
Filed under: CakePHP,Coding,Problems,Till System - @ January 10, 2011 8:06 am