Categories
development php

Netbeans vs Vim … round 1 … fight

So, I think I’ve changed ‘editor’. Perhaps this is a bit like an engineer changing their calculator or something. For the last 10 years, I’ve effectively only used ‘vim‘ for development of any PHP code I work on. I felt I was best served using something like vim – where the interface was uncluttered, everything […]

Categories
php

A week of fire fighting (aka why you should <3 unit tests).

I feel like I’ve spent most of this week debugging some PHP code, and writing unit tests for it. Thankfully I think this firefighting exercise is nearly over. Perhaps the alarm bells should have been going off a bit more in my head when it was implied that the code was being written in a […]

Categories
development php

SQL Injection with added magic_quotes assistance (the joys of legacy code maintenance)

  Sometimes you really have to laugh (or shoot yourself) when you come across legacy code / the mess some other developer(s) left behind. (Names slightly changed to protect the innocent) class RocketShip { function rahrah() { $sql = “insert into foo (rah,rahrah,…) values ( ‘” . $this->escape_str($this->meh) . “‘, …… )”; mysqli_query($this->db_link, $sql) or […]

Categories
development performance php

Zend_Cache – automatic cache cleaning can be bad, mmkay?

$customer uses Zend_Cache in their codebase – and I noticed that every so often a page request would take ~5 seeconds (for no apparent reason), while normally they take < 1 second … Some rummaging and profiling with xdebug showed that some requests looked like : Note how there are 25,000 or so calls for […]

Categories
development php

PHP Serialization & igbinary

Recently I’ve been trying to cache more and more stuff – mostly to speed things up. All was well, while I was storing relatively small numbers of data – because (as you’ll see below) my approach was a little flawed. Random background – I use Zend_Cache, in a sort of wrapped up local ‘Cache’ object, […]

Categories
php

Gregynog

Once a year, Aberystwyth’s Computer Science department take their second year students to Gregynog, for the purpose of preparing them for job interviews (mostly for the upcoming industrial year placements many students take between years 2 and 3). I’ve attended this for the last few years as an ‘Industrialist’ and help run mock interviews. Initially […]

Categories
development php

Late to the performance party

Everyone else probably already knows this, but $project is/was doing two queries on the MySQL database every time the end user typed in something to search on to get the data between a set range (SELECT x,y….. LIMIT n, OFFSET m or whatever) and another to get the total count of records (SELECT count(field) ….). […]

Categories
development php python

Logging … and how not to do it.

Grumpy man, back from battling with some legacy code, has a rant.

Categories
development php

Adventures in Continuous Integration (PHP, Xinc, Phing etc)

I’ve had cron’ed unit tests running for ages which happily spam me when stuff breaks – and likewise adding e.g. phpdoc generation and so on into the mix wouldn’t be too hard. Anyway, for want of something better to do with my time I thought I’d look into CI in a bit more depth for […]

Categories
php

Google News Sitemap + WordPress

Annoyingly the current version of the google-news-sitemap plugin for WordPress (v1.4) doesn’t work with some silly XML namespace error reported by google. See http://wordpress.org/support/topic/364929 and effectively the ‘patch’ on the Google Support forum thing which works fine (there are two bits of the plugin which need updating – whcih correlate to the two parts mentioned […]