Writing Good Documentation is Tough

I recently enabled LDAPS authentication for our Drupal site so users can log in with their Active Directory credentials. It wasn’t the most straightforward setup (both from a Drupal standpoint and a networking standpoint, since our website is hosted off-campus) so I wanted to write up documentation for internal reference purposes and a blog post about my LDAP hurdles as they relate to Drupal for anyone else running into the same problems.

I’ve never been one for writing excessive documentation. Usually a couple of notes in comments is all that’s really required to explain why you’re doing something, but when you’re trying to explain all the prerequisites that built up to that point and the logic behind the decision you can easily end up with pages upon pages of rambling notes. How do you organize things like that without going totally overboard?

Typically I also run into a dilema when I’m trying to decide how much to “dumb-down” the documentation. Obviously I’m trying to explain a point to someone who does not have the benefit of my experiences to understand it, so how far back do I go to make sure they get the point?

The adage that if you asked the question you should document the answer is a good guideline, but again that leaves you with many rambling and semi-related topics in a FAQ-style document. That’s great for troubleshooting but not at all ideal for people trying to follow a step-by-step guide and get up and running quickly.

In the end I decided to write a paragraph-long “Abstract” section that outlined the goal and then add a paragraph that explained the two distinct parts – the networking portion and then the PHP and Drupal configuration. I used the default Heading styles in Word 2007 and made each of these parts a new H2 with their respective intro (aka “Abstract”) paragraphs explaining what they did at a high level, followed by sequentially increasing levels of Header tags as I worked my way down through the nitty gritty details.

All told I think I ended up with 5 pages and it took me several hours of writing, editing, reviewing, and expanding sections that needed clarification. If I never had to document anything like that again I would be deliriously happy.

For anyone wondering, I’m still working on the Drupal w/ LDAPS blog post, it’s just a long process.

Posted in Uncategorized | Tagged , , , , | Leave a comment

Crazy Opera and IE Display Quirks

Someone checking out my last entry about CDN performance helpfully let me know that my site was displaying horribly in Opera. I’d checked in Firefox, Safari, and Chrome and hadn’t noticed a problem and just assumed I was pretty safe in other browsers since I wasn’t doing anything especially amazing.

A few minutes with Browser Shots later and I found out that it was broken in at least Opera 10 (8 and 9 seemed to work fine, oddly) and IE – all versions, including 8. I confirmed the IE8 problems in a virtual machine (compatibility view didn’t help) and dug in with the Opera developer tool Dragonfly.

Curiously, Dragonfly’s DOM view only showed the first div in the HTML that contained the header. It took a few minutes of head scratching before I started toggling options and idly hit the button to expand the HTML tree… Suddenly everything was there. I ran the W3C Validator again, just to be sure it wasn’t my imagination, and it checked out fine.

It didn’t take long backtracking up the tree to find out where I’d gone “wrong”:

<button />

Apparently Opera 10 and IE wanted the full closing tag:

<button></button>

I’m not surprised IE choked on the short tag, but I’m really disappointed in Opera… I’ve never been happy using it, but I always respected their rendering engine.

Posted in Uncategorized | Tagged , , , , , , , | 3 Comments

Amazon CloudFront vs. Rackspace Cloud Files CDN Performance

I’ve been playing with both the Amazon CloudFront and Rackspace Cloud Files CDNs over the past week with the eventual aim of offloading all the static files that make up this site (all like 4 of them) to a CDN, mainly for the fun of it.

Having used Amazon’s S3 storage service for quite a while now they were my first choice, but I didn’t want to totally discount the Rackspace offering – they’ve done some seriously cool things in a very short period of time and I swear by their Cloud Servers.

From casually playing around there have only been minor differences. First of all Cloud Files doesn’t seem to support “folders”, so you end up with a much flatter storage pool. For my 4 files that’s really only an issue for my OCD, but Amazon does support hierarchical directory structures, so that’s something to keep in mind.

Otherwise I found Amazon’s system only slightly more annoying in the way you ‘deploy’ an S3 bucket to the CloudFront CDN. It seemed to take slightly longer and emphasize the idea that there were two distinct systems and products being used, whereas Cloud Files seems much more unified – click a check box and you’ve got a CDN URL.

So with one minor annoyance on each side of the aisle I turned to hard quantifiable data, something every programmer loves. I loaded up my stylesheet on both CDNs and pointed a Pingdom check at each. The results were surprising.

Continue reading

Posted in Uncategorized | Tagged , , , , , , , , | 30 Comments

Update to WordPress Migration Script

I’ve updated the Habari to WordPress migration script from my last post. As special thanks to someone who pointed out that comments weren’t being associated with the right posts, they were totally off because I forgot to translate the old Habari post ID to the new WordPress ID… Whoops.

The script can be found via my original post, it’s just been silently updated in place.

Again, best of luck to anyone using it…

Update 10/11/09: One more update related to post comment counts – we only want to ‘count’ ones that have been approved. Again, the original link has been updated.

Posted in Uncategorized | Tagged , , , , | Leave a comment

Migrating Habari to WordPress

While of course we never like to see anyone give up on Habari, it’s obviously not going to be the perfect platform for everyone. Hopefully most people will test it out before they make a final switch, but for those who get stuck and wish to switch back to WordPress (and we know you’re out there), I’ve finally throw together a quick script that should help.

Things this migrates:

  • Posts – published or draft
  • Pages – published or draft
  • Comments – approved only
  • Tags

A few caveats: this is MySQL-only, if you’re using Habari on Postgres or SQLite I’m sorry. It wouldn’t be especially difficult to change, I just have no interest in doing so – it suites my purposes. It’s also quite hacky. There’s very little error checking (make that practically none) and it prints output in plain text. It’s also not a plugin, I wrote it as a one-off script that you use and immediately trash because that’s exactly what you should do with it.

Also note that it writes directly to the WordPress database tables, it uses none of their API functions. That means the slightest schema change could (and probably will) break the whole thing and that things like filtering and other plugin actions aren’t performed. I was using the trunk build of 2.9-rare, so roll back to about r11867 if you have problems.

Finally, it will set the owner of a post to an existing WordPress user with the same username if one exists – if not it will create a new user account that you can then manage any way you like.

So how do you actually use it? Well, you dump it in your Habari root directory, edit the array at the top so it can connect to the MySQL database your WordPress instance is installed in, and you load it up in your browser. You should see a bunch of junk about things it finds – and hopefully no MySQL errors along the way. If you see any errors, you’re on your own.

On my VPS I was able to import my blog back into WordPress in a matter of about 2 seconds. For those who want or need to switch back, best of luck to you, hope this helps.

Snag the script over here: wp_migrate_script.php

Posted in Uncategorized | Tagged , , , , , , , , | 9 Comments