Installing ImageMagick on MacPorts and imagick on PECL

Over the last few hours I’ve installed ImageMagick on MacPorts (super easy), and imagick on PECL (not so much). Xentek‘s post on ImageMagick and imagick was a great help, and got me past the first brick wall I hit (passing in the ImageMagick prefix to prevent it complaining about Wand-config)… but then I couldn’t get the darned extension installed. Anyway, here’s the steps I went through, and if anyone has any suggestions for improvements I’m all ears. Continue reading Installing ImageMagick on MacPorts and imagick on PECL

Custom taxonomies in WordPress

I’ve spent quite a bit of time over the last week getting to grips with custom taxonomies in WordPress, and I’m really pleased with what I’ve found. A taxonomy is a classification, and WordPress already has two taxonomies buil in: tags and categories. Categories lean towards a more formal taxonomy, which you might setup with forethought and some planning, whereas tags lean more towards a more casual folksonomy, which you might construct “on the wing” in a less formal and more ad hoc style. WordPress uses a generic taxonomy setup to create the tag and category taxonomies, and you can use the same functions to create your own taxonomies.

I’m going to take you through the process of creating a basic taxonomy, creating some terms in it and relating those terms to some posts. There’s some demonstration code in the form of a proof of concept WordPress plugin, which you may find helpful.

Continue reading Custom taxonomies in WordPress

PHP error logs with MacPorts on OSX

I’ve recently had to switch laptops while my main machine is in for repair (again), and this has reminded me of an issue I seem to encounter with MacPorts PHP. I make extensive use of the PHP function error_log during development, to track variables and ensure that things within the code are as I expect.

Maybe it’s me, but MacPorts PHP seems to have an issue writing to an error log unless you do some quick configuration. So, as this blog is meant to function partly as my outboard brain, here’s what I had to do. (Some of this gleaned from patient advice given by Ryan, the MacPorts PHP maintainer, on a misguided bug report I filed.) Continue reading PHP error logs with MacPorts on OSX

Experiments with WP Cron

I’ve got a couple of projects coming up which are going to require scheduling tasks in WordPress either to go off and get stuff, or to check whether posts displayed are still accurate, etc. Luckily, WordPress has a pseudo-Cron implementation which I plan to use to .

Let’s take a step back first and remember what Cron is: Cron is the scheduling service for UNIX-like systems which can set tasks occur at specific times or to recur at specific intervals. So you can use Cron to tell your system to do something at 12:47 on the 14th April, 2009 or to perform a task at 12 minutes past midnight every Monday, it’s a very useful service.

WordPress is not naturally a proactive beast, so unfortunately your WP site will not spend it’s day checking the time and seeing if it’s got anything to do. This is where the pseudo come in, with the WordPress pseudo-Cron we’re relying on a constant flow of visitors to trigger WordPress into checking for scheduled tasks. The upshot of this is that we cannot rely on WordPress to precisely schedule events, but the system is good enough for most things. (We can always increase the frequency of visitors artificially by targetting the site with five minute checks by Pingdom or similar, with the added benefit that the site is now monitored for downtime.)

So let’s get into the details of how all this stuff works, shall we? Continue reading Experiments with WP Cron

WordPress and basic authentication, problems with WP Cron and file uploads

I have a Google ego search on my name, so I can keep track of what the Internets is saying about me behind my back. The other day the ego search summary email arrived and included was one of my development sites. Which was annoying because I don’t want people browsing around my development, it might be broken or confuse people by looking like a live site (but not contain proper content). So I did what I should have done from the beginning and enabled Basic Authentication on my development sites. (Basic Authentication protection provides those “popup passwords” you see around the place where a little, usually grey, dialog pops up asking for a username and password before you can go any further.)

Basic Authentication is as old as the hills in internet terms, and while it’s not the most sophisticated protection it’s a reliable and simple way to prevent any old Tom, Dick or Harriet poking around where you don’t want them. I’ve used it before for client sites which are hosted on the open internet, but where we only want a small selection of people to see it… add Basic Authentication and bosh, job done. Continue reading WordPress and basic authentication, problems with WP Cron and file uploads

Ignoring visits by IP address in Mint

I use Mint to track the visits to this website (Hi everyone who’s come to look at the Dress a Doll pages!) and it’s a great stats package. One of the issues I’ve had recently is that I constantly delete my cookies in my day to day web development. Unfortunately Mint uses a cookie to ignore visits from the site owner. Surely there was a way of ignoring by IP address? Of course there is, ignore by IP is in the advanced preferences. But where are the advanced preferences? I couldn’t find any link or button to reach them but following the instructions in the link above, I clicked on “preferences” and then pasted “&advanced” onto the end of the URL.