Uncheck All Radio Buttons on a PDF Form

I’ve been banging away at this issue today and figured it would be useful to others out there.

I made a PDF form for my company’s web site using Adobe Acrobat 8. In a couple places I have a “radio” control — that’s where you can select one, and only one, option from multiple choices. If you tick one box, all the others in that set are turned off. When distributing the blank form, however, I want all of the options to be blank. No default — the user has to pick one.

Here’s the issue: In the course of making the form, I checked one of the options, and now I can’t turn it off to distribute the form. I hunted around and got a lot of useless “you should use a checkbox instead” answers. No, I don’t need a checkbox, I just need to un-fill this field.

So how do you blank the field? You add an extra radio button to the set. Flip over to Preview, click the extra box. Back to Edit mode, delete that button. Voila! Blank radio buttons.

You’re welcome. ;-)

Search Everywhere in MySQL

In recent months I’ve been tasked with taking over management of a web site programmed by somebody else. They used Drupal, with which I’m not familiar, and so a big part of the job is simply figuring out how that system works. In many cases I’ve wanted to search the entire database for a particular string of text, in order simply to find out where certain data is stored in the database.

I hunted over the web looking for a way to search an entire MySQL database — all tables, all fields — for text. For the most part I find forums with answers such as “Well, you set up your database wrong”. These kinds of responses remind me of the sequence in the movie “Funny Farm” where the truck driver is trying to find the town of Redbud. In short:

“Hey Mac, how do you get to Redbud?”

“If I wanted to go to Redbud, I wouldn’t start from here.”

Nonsensical and useless. If you’re here now, then this is where you’re starting from; telling me to start from somewhere else is simply a non-answer. Funny in a movie, but frustrating in real life.

Today I came across a most excellent script, the MySQL Database Search & Replace Tool. It’s a PHP page that you can drop into a web site and call from your browser. It will search the entire database for a string of text — exactly what I needed.

In a quick test run it threw out a couple errors but then gave me useful results; so it’s not entirely polished, but quite functional and useful. Kudos to Mark Jackson and Eric Amundson for releasing this great tool!

Add New Headers to WordPress Plugins or Themes

I’ve had a few patches committed to WordPress core in the last few versions, and have sadly neglected to do writeups about them so that others could take advantage of the new features. I hope to remedy that in the next few posts. First off, WordPress 2.9 has a new feature that allows you to add to the list of headers that are checked when you run either get_plugin_data() or get_theme_data().

For example: Let’s say you want to make a plugin that works with other plugins. For other plugins to be compatible with it, however, they need to provide some new piece of information, and you want to do this with a custom header. So we’re going declare a new plugin header. Let’s call it… oh…. “Demo Header”. Here’s the code; just drop this in a plugin and activate:

function plugin_header_demo( $extra_headers ) {
	$extra_headers[] = 'Demo Header';
	return $extra_headers;
}
add_filter( 'extra_plugin_headers', 'plugin_header_demo' );

Pretty simple, eh? What we’ve just done is added “Demo Header” to the list of headers that WordPress will check for when get_plugin_data() is run. Now, along with Name, Version, Author, and so forth, a value for Demo Header is returned as well.

Note that this is only for cases where you want any plugin checked for this header. This changes the get_plugin_data() function and takes effect every time that function is run, on any plugin.

Want to do it for themes? The code is almost identical:

function theme_header_demo( $extra_headers ) {
	$extra_headers[] = 'Demo Header';
	return $extra_headers;
}
add_filter( 'extra_theme_headers', 'theme_header_demo' );

Note that this does not allow you to alter the pre-existing headers in any way. You can’t, for example, remove the “Name” header.

Personally, I intend to use this for a third-party update check plugin, which will also be incorporated into Strider Core. For that use, I’ll add an “Update URL” header (or similar).

Next up: How to define your own custom get_XXX_data() function that works like the ones for plugins or themes.

Hackbook finale

In between trick-or-treaters I spent today finishing up the repairs to my new/old laptop. The first optical drive I ordered was DOA, so I had to order a new one. Did the swap today. Took a little testing and such, but I now have a fully operational system, (which is nice).

In the end, a little work and willingness to crack the sucker open got me a $1,100 laptop for about $500. Sometimes its nice to be a geek. ;-)

Hackbook

My laptop has been a bit long in the tooth for a while now. It’s a 12″ Mac Powerbook G4 circa 2003. It actually runs OS 10.5 pretty well, which is impressive considering it originally came with OS 9 (that’s — count ‘em — 6 operating systems ago). The most noticeable issue is that it struggles to play video such as YouTube, and if I’m working with a particularly large file (150+ MB) it struggles to handle it.

So I needed a new one, but didn’t want to drop a grand on it. What to do? Well, I found a fixer-upper on eBay for just over $400. Impressively, it’s last year’s model Macbook with maxed out RAM and a good size hard drive. The down side is that it lacks an optical drive, and the keyboard is en Español.

Got the computer in the mail Tuesday. Thanks to “Target Disk Mode” via Firewire, I was able to wipe the drive and install the OS without an optical drive. Had a small hiccough transferring my old data from my Time Machine backup, in that I had forgotten that my backup doesn’t include my applications. Re-doing the transfer from my bootable backup drive fixed that nicely.

So — I’ll be putting about another $100 into the computer, as I got an English keyboard assembly for $30, and an optical drive for about $75 (both on eBay). I even found an online auction for the *brackets* for the optical drive, which is handy since the computer I bought had the drive completely removed (“it was making a funny noise” I’m told).

So now I get to do surgery. Cool! :) I replaced the hard drive in the Powerbook a couple years back, so I have a bit of experience with cracking open laptops. Should be an interesting exercise, involving steady hands and very, very small screwdrivers.

Every Halloween costume you ev…

Every Halloween costume you ever had was a failure compared to this: http://bit.ly/hLfbY (via @TheBloggess)

Virtual Multiblog 2.6.1

Just released Virtual Multiblog v2.6.1. The primary new feature in the 2.6 line is auto-plugins.

That is, you can specify plugins that are automatically activated for all (or just some) blogs.

Check it out!

Mac OS 9 lives!

Mac OS 9 lives! And it has a browser: http://classilla.org/