Author

me.jpeg

I am a web developer specialising in web driven applications using PHP, MySQL, Symfony and Zend and I am currently working for the The Drum in Glasgow, Scotland.

Most days I can be found frantically coding away with EuroDance in my ears and consuming what I hope to be a never ending supply of coffee... happy days!

TRUNCATE TABLE with Symfony and Doctrine

I am often importing data into a symfony project from an existing site or a CSV file and re-writing this data into the fixtures.yml is usually too complicated or time consuming so I end up writing bespoke import actions.

While I am writing these actions I often find that I have to delete the contents of the MySQL tables as you can never write the routine complete and accurate in one go so as you build it up in smaller steps you find that you have to get rid of the previously old data.

Read more

Magento API - Update Product Stock Levels

Another day... another magento problem!

I was asked to look into a problem with an automated stock level update script not updating the stock levels.  This update script was using the Magento API and on the face of things everything looked ok as the script ran without any errors, the product prices got updated but the stock levels never changed.

Read more

Raw SQL from a Doctrine Query Object

As my use of Symfony is increasing I find myself frustrated that there doesn't appear to be an easy way to get the raw SQL from a doctrine query object so I can simply output it and paste it into phpMyAdmin to debug problems with the SQL. I may be wrong about this but as yet I have not found a built in function to perform this operation.

Sure I am able to output the query with the "?" indicating where the necessary values are to go and I can also easily output the array of query parameters so I can substitute these manually but this takes time and it would be much much simpler and quicker to just output the whole query with the substitution already done so it's a simply copy and paste of the raw SQL from the doctrine query object straight into phpMyAdmin.

Read more

Why you should answer your own posts?

How many times have you searched for the answer to a problem in Google to find nothing but forums with people who have the same questions but no solutions posted even though the question was raised months, even years earlier?

If you post a question and no-one managed to provide you with an answer do you:-

Read more

Symfony - Does not have a registered handler

Last week I was working away in the office at Line Digital on our latest Symfony based project when our project started giving us a strange error similar to:-

Looking into this a little closer we found that the server had ran out of disk space so after making some space and using "symfony cc" to clear the cache we thought that this would have resolved the problem, however we continued to get the "does not have a registered handler" message being presented.

Read more

Month Names in PHP

One simple thing I keep having to do over and over again is to display the name of the month for a given date.  Normally I have opted to use the first solution that comes to mind which is creating an array with all the month names in it and then when I want to retrieve the month name I just use

However, when I wanted to use PHP to display the month name this time I wanted to see if there was a better solution. The one I came across was posted on The Code Cookbook and was a simple 1 line statement which was great... simpler, neater and far more elegant than my usual method and it looked like

Read more

Magento - Virtual Host Configuration Problems

A few weeks ago the company I work for was changing the server that several client sites are hosted on and this included a website built up using the eCommerce package magento.  All of the migrations went ahead without any problems with the exception of this magento site and it had a couple of us stumped for quite a while.

We followed the basic plan for the migration:-

Read more

Zend clearIdentity() and IE7 and Chrome Caching Problems

A few weeks ago I posted a blog entry about problems with Zend clearIdentity() with IE7 and Chrome but I've since found that the Zend Framework was not at the root of the problem.  After discussing the problem with a colleague we found that there was a line in the bootstrap.php file like:-


ini_set('session.cache_limiter', 'private');

This seems to be what was causing all our clearIdentity() issues.  This seems to give over caching control to the browser hence the reason why Firefox worked fine, IE7 intermittantly worked and Chrome couldn't care less.  We changed this to:-

ini_set('session.cache_limiter', 'none');

and straight away all our clearIdentity() problems in IE7 and Google Chrome disappeared and everything started working as we would expect.

Read more

The local print spooler service is not running - Vista

A few months back both my Windows Vista (Business) computers would not longer print even though they had been printing fine for months.  I tried

Regardless what I tried neither of the Windows Vista computers would allow me to printer and always presented me with the following error when trying to add a printer and almost always when the computer booted:-

Read more

Zend clearIdentity() Problems in IE7 and Chrome

Today I have found a new nemesis in the form of the Zend Framework!  I have been working on a client website that for some reason just will not allow them to log out properly when they're using IE7 or Google Chrome but it works fine in Firefox (please don't post the "get a better browser" comments as it's really not very helpful).

I've check the online examples and my logout function is identical, line for line, as the examples.

Read more

Advertisement

Digital Ocean

Chris's Reading List

www.thoughtworks.com

BFF @ SoundCloud

Our friends at SoundCloud embarked on a journey a few years ago that changed their system and moved it from a monolithic Rails application towards an ecosystem of microservices. Read more

The Drum

The Drum

Google'€™s AMP is bringing some much needed speed to mobile but the transition won'€™t be easy for publishers

A week after launching, the Google-led Accelerated Mobile Pages (AMP) initiative has raised more questions than answers for publishers... Read more

SitePoint

SitePoint

Quick Tip: How to Permanently Change SQL Mode in MySQL

MySQL 5.7 introduced some awkward changes for older codebases and tends to break apps. Here's how to temporarily (or permanently) lower the strictness level Read more

SitePoint

SitePoint

How to Build Your Own Dependency Injection Container

Andrew Carter builds a Dependency Injection container from scratch, showing you how that rocket science is really just fireworks strapped to lego figures! Read more

AuthorityLabs

AuthorityLabs

13 Reasons Your Organic Traffic is in Decline | It's Not a Penalty

The landscape of search engine optimization has changed drastically in the last 3-4 years. Even as it changes, a lot stays the same. It has been very challenging to see a multitude of friends and colleagues approach me with problems that often seem beyond repair with clients that they have worked with for years. Read more

TechCrunch

TechCrunch

WordPress Sites Now Support Google’s AMP To Make Mobile Pages Load Much Faster

Google has some big plans when it comes to making the web faster on your mobile phone. The company just added AMP-enabled pages in its mobile search results... Read more