Pragmatism in the real world

Uninstalling MySQL on Mac OS X Leopard

To uninstall MySQL and completely remove it (including all databases) from your Mac do the following: Use mysqldump to backup your databases to text files! Stop the database server sudo rm /usr/local/mysql sudo rm -rf /usr/local/mysql* sudo rm -rf /Library/StartupItems/MySQLCOM sudo rm -rf /Library/PreferencePanes/My* edit /etc/hostconfig and remove the line MYSQLCOM=-YES- rm -rf ~/Library/PreferencePanes/My* sudo rm -rf /Library/Receipts/mysql* sudo rm -rf /Library/Receipts/MySQL* sudo rm -rf /private/var/db/receipts/*mysql* The last three lines are particularly important as otherwise,… continue reading.

PHPNW Conference

There's a new UK PHP conference coming in November. PHPNW08 will take place on 22nd November 2008 which is a Saturday so there's no excuses not to go! To select the talks that will be presented, a Call for Papers has been announced with a deadline of 21st September 2008. From my reading of the website, this is a developer-centric conference and so if you have something to say about current PHP technologies and development… continue reading.

Busy

I'm kind of neglecting this blog at the moment. Sorry. I was away last week and I'm head down into editing Zend Framework in Action. It's amazing how many details the technical proof reader and our copy editor have found. The book is going to be so much better as a result. I need to go through each suggestion though and ensure that the meaning hasn't changed and to implement the suggested technical changes. When… continue reading.

Recursion

PHPWomen are running an article contest at the moment. All you have to do is write an article for the Best Practices forum and you could win a Zend Studio for Eclipse license and a a 1-year subscription to Linux Pro magazine! Obviously, never one to miss an opportunity to win free swag, I've entered with an article on recursion. Now it's your turn. Write a article on a best practice when coding PHP, but… continue reading.

Notes on Zend_Cache

Recently I needed to speed up a legacy project that makes a lot of database calls to generate each page. After profiling, I discovered that 90% of the database calls returned data that rarely changed, so decided to cache these calls. One of the nice things about Zend_Framework is that its use-at-will philosophy means that you can use any given component with minimal dependencies on the rest of the framework code. In my case, I… continue reading.

UK Readers: Don't buy petrol from BP or ESSO

This is very off-topic, so feel free to skip! Received a round-robin today via email. As I don't send on such things, I thought I'd mention it here as I'm getting fed up with the price of petrol, especially given the profit that the big oil companies have recently announced: Received from a good friend so leave the rest to you! See what you think and pass it on if you agree with it. We… continue reading.

Zend Framework URLs without mod_rewrite

Some of our Zend Framework applications have to run on IIS without ISAPI_Rewrite installed. In these cases we need urls of the form http://www.example.com/index.php?module=mod&controller=con&action=act. I couldn't get this to work out of the box with Zend Framework 1.5, so wrote my own router called App_Controller_Router_Route_RequestVars. This code obviously only supports what I needed and I've only tested it on IIS for Windows 2003 Server, so you may need to tweak to make it do what… continue reading.

Top Tip: XHTML with Zend Form Elements

When you render a Zend_Form, the elements will render to HTML compliance rather than XHTML compliance, even if you have < ?php echo $this->doctype('XHTML1_STRICT');?> at the top of your layout script. Practically, this means that all the input elements do not end in "/>". To resolve this, you need to call the doctype() view helper prior to rendering your form. Within my projects, I do this within a front controller plug-in called ViewSetup that looks… continue reading.

Simple Zend_Form File Upload Example Revisited

I've been thinking about the Simple Zend_Form File Upload Example that I discussed last month. To recap, if you haven't read the comments, if the form fails to validate for some reason then you get a nasty error: Warning: htmlspecialchars() expects parameter 1 to be string, object given in /Users/rob/Sites/akrabat/Zend_Form_FileUpload_Example/lib/Zend/View/Abstract.php on line 786 Essentially, what is happening is that the App_Form_Element_File class that we wrote assigns the $_FILES array to the $value parameter for the… continue reading.

A review of "Learning PHP Data Objects"

Packt Publishing recently sent me a couple of books to review. This post is about the second one I received, Learning PHP Data Objects by Dennis Popel. I was excited to receive this book as PDO underlies a lot of the Zend_Db_Adapter objects that I use in my day to day programming. It seemed like a good idea that I should know more about it. Overview of the book This book starts out introducing PDO… continue reading.