Monthly Archive for March, 2009

Problems with Time Machine endlessly preparing

We use Time Machine with a network disk connected via AirPort Extreme for backup in our household (writeup), and it’s generally a great solution. However recently my wife’s laptop had got stuck in an endless “preparing backup” situation. There didn’t seem to be any significant details in the error log, and when I ran a Disk Utility on the Sparse Bundle associated with her laptop nothing came up. My laptop was backing up over the network from the same drive, so I was fairly sure everything was working with the setup.

After a fair bit of googling I came up with Patty Patty’s solution (scroll down to Patty Patty’s post on Jun 1, 2008 12:45 PM) on the Apple discussion boards which I’ll rekey here for convenience:

  • Turn Time Machine off
  • Trash the com.apple.TimeMachine.plist in /Library/Preferences
  • Restart

I then turned Time Machine back on, and the next backup ran fine. Bear in mind that although this worked for me, any issue you have may be different and your mileage may vary. Patty Patty (gender unknown) went on to suggest the following, although I didn’t need to go this far:

  • Full Spotlight reindex of the Macintosh HD
  • Added a bunch of folders to the “Do Not Backup” list in Time Machine
  • Turn Time Machine on

The one difference I could spot between my wife’s setup with her laptop (which had the issues) and mine (which didn’t), is that her network connection is almost solely wifi and mine is often ethernet. Some other reports I read suggested that when connections are interrupted over wifi it can screw with Time Machine. Other reports I read suggest that Apple may still be working on this in upcoming releases… but given Apple’s usual level of transparency and predictability I think we should all take that one with a pinch of salt.

Hope this helps someone.

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’