Since PHP 5, there has been a bundle of built-in exceptions – the “SPL exceptions” – in PHP. However, the documentation for these classes is quite lacking in examples, and it can be difficult to understand when you should be using them. The short answer is always. You’ll find a longer answer if you continue reading :) There is also …
Writing HTML is fun (if you don’t have to deal with IE)
HTML and CSS are relatively straightforward languages. Yet there’s a certain amount of elegancy to them – I think you could even call well written markup art. I quite enjoy writing HTML and CSS from time to time. Despite being simpler than programming languages, writing HTML still provides a challenge: How to put a design into code in the most …
Using spatial data in Doctrine 2
In this post I’ll introduce you to extending Doctrine 2 to provide ways to use custom data types and DQL functions. We needed a simple way to store locations and calculate distances between points on maps and some other stuff for Wantlet. Since we are using MySQL, we decided to use MySQL’s Spatial Extensions for it since they seemed suitable. …
What was the point of XHTML?
XHTML was the fad for a while – you were a bad coder if your markup wasn’t valid XHTML. Now it’s fading out. Giorgio Sironi’s recent look at what happened to XHTML got me thinking: What was the point of all this? Why was XHTML useful, or was it?
Link: Refactoring a service class for better separation of concerns
RV David has an interesting post on his blog about refactoring a service class for better separation of concerns compliancy. I also left some ideas in the comments as I’m currently working on something similar.
How to create Doctrine 1 -style Soft-Delete in Doctrine 2
Doctrine 1 has the concept of behaviors which you could add to your models. One of these was the soft-delete behavior, which allowed you to “delete” records without really deleting them. Doctrine 2 does not have behaviors due to various reasons. However, I needed a way to have a model which worked like soft-delete. Let’s see one approach to creating …
11 common Dojo gotchas
Dojo is a great JavaScript toolkit, but it’s not perfect: It has a couple of gotchas that can be hard to debug just based on the error (or the lack of it). To rectify this, here’s a list of some common mistakes and their solutions. It’s usually good to just go through each of these if you can’t figure out …
Optimizing SQL: Removing queries inside loops
I mentioned shortly on twitter that you should avoid using SQL queries inside loops. There was some questions on how, so here’s a short post that hopefully explains some tricks that you can use.
Using unit tests as requirements when refactoring
What should you do to make sure new code works properly when you’re refactoring old code? I asked myself this question recently, when I needed to refactor a big bunch of procedural PHP code into a neat, testable, OOP-style interface. The conclusion I came into is that you should write unit tests – not to test the old code, but …
Zend Framework 1.8 Web Application Development book review
So you want to learn to use Zend Framework, and develop a web app with it. Maybe you’ve been looking at a book to help, too. This is what Keith Pope’s book Zend Framework 1.8 Web Application Development promises to teach you. And I think this is the best book for the job. Continue reading to find out why.