Technical difficulties

A reader recently pointed out that the site isn’t working properly — comments were not showing up on posts. This is a bit of a problem, since the plugins have a lot of good discussion and troubleshooting information in the comments.

For the time being I’ve replaced the theme with one of the generic WordPress themes. That fixes the comment problem, but may cause one or two oddities elsewhere. Just an FYI to readers.

Meh. The custom theme was getting old anyways. Maybe time for an upgrade. ;-)

Posted in 'Nuff said | Leave a comment

Salvaging ebooks from Stanza for iPhone or iPod.

I’m a long-time user of Stanza on the iPhone, so I was surprised and a bit dismayed to discover that Stanza does not work with the new iOS 5.

As much as I love the program, it’s always possible to switch to a different program, but I had a different problem: many of my ebooks had been downloaded directly within the app itself, and I didn’t have copies anywhere else. Some of these, in turn, were no longer available for download. (A good example of this are books from sites such as the Baen Free Library.)

I took a look at iTunes sharing as a possibility for rescuing the books, but Stanza doesn’t share the books for downloading from the phone. I then spent some time figuring out what did work, and here’s what I found:

First off, you need an app that lets you look at the file directory on the iPhone. I used an OS X app called PhoneView, though I have no doubt there are others. (Incidentally or not, my iPhone is NOT jailbroken!)

  1. Within PhoneView, select “Stanza” in the “Apps” list.
  2. Go into the .Stanza folder. (If it’s not visible, go into Preferences and check the “Show Entire Disk” checkbox.)
  3. Within .Stanza, your books are in the “Library” folder. Copy this folder to the hard drive of your computer.
  4. I’ve noticed that the directories can be shown a bit differently depending on the program you’re using to view them. to be clear: within Stanza’s directory, you’re looking for this folder: /Documents/.Stanza/Library/
  5. Quit PhoneView.

Okay, now you have a folder on your computer that contains a whole bunch of numbered folders: “0″, “1″, “2″ and so on. These contains your books, which unfortunately are still a bit inconvenient. Your books are the files that have no extension, e.g. “30″. All you really need is to add file extensions to the filenames, but first you have to figure out what extension to add (and the name of the book is helpful too!).

What I did was to open the files in a text editor. (On a Mac you can use the free TextWrangler; on Windows, you might try the free Notepad++.) You’ll see a whole lot of gobbledegook, but the file format can probably be determined by text found in the first line of the file. Generally, the name of the book is ther very first thing in the file, or close to it.

  • If you see “epub”, or (in the case of TextWrangler) it opens up as an “xml container”, you’re looking at an Epub file. Close the file and add “.epub” to the end.
  • If you see “PNRdPPrs”, that’s a Palm Doc file. Add “.pdb” to the filename.

Stanza reads a whole lot of file types, although these are the only two I’ve encountered. Also likely are .mobi files, and I’ll update this article as I come across other format hints. But suffice it to say that after adding the file extensions, the files will work in another e-reader capable of reading that format.

I also use a program called Calibre to organize my ebooks, and conveniently it can also convert between formats — so if you want to put an Epub or Palm book on your Kindle, say, Calibre can convert it for you.

Posted in On the Front Lines | Tagged , , , | 1 Comment

How to Close a WordPress Site

I recently was asked to close down a site I had put up using WordPress. I didn’t want to just delete the whole thing, as I figured somebody might want it put back up in the future. There are several easy ways to do this, but I think I’ve found the best.

My first impulse was to add an exit; line to index.php. The problem there is that it doesn’t close off the wp-admin section. I could comment out the database password in config, but that leaves a “Could not connect to database” message. I wanted every aspect of the site gone. Then it struck me: One file that absolutely every single call to WordPress must pass through is wp-config.php.

So if you want to “disappear” a WordPress site quickly and easily, just open up wp-config.php and add the following right after the opening PHP tag:

exit;

If you want to put up some kind of “goodbye” message in HTML, you can do something like this at the top of that file:

<?php
?><!DOCTYPE html>
<html><body><p>This site is closed.</p></body></html>
<?php
exit;

...

Even more briefly, of course, you could stick a short message inside a die() statement. The HTML gives you a bit more flexibility though.

Hope somebody finds this useful. ;-)

Posted in 'Nuff said, Webcraft | Tagged , | 4 Comments

Graceful Pull-Quotes is now “Official”

Just letting you all know that my Graceful Pull-Quotes plugin is now hosted on the official WordPress Extend repository. That means it will automatically pop up updates in the WP admin, and hopefully more people will find it and use it. It also makes it a bit easier for me to post updates, as I merely have to commit to the repository rather than manually creating a zip file, uploading to my site, and updating the plugin’s page with the new version info.

So… advantages all around. Some small drawbacks as well (fiddly technical stuff). No significant feature changes, just some minor code adjustments for the change of venue, and the plugin’s directory has been changed to reflect its new name.

If you install the new version you may have to manually deactivate and delete the old one — on my blog they both showed up as separate plugins. This happens because of the change in the folder containing the plugin. Just delete the old one and activate the new one. You shouldn’t have any issues.

Enjoy!

Posted in Codecraft | Tagged , | 2 Comments

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. ;-)

Posted in On the Front Lines | Tagged , , , | 6 Comments

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!

Posted in 'Nuff said, Gadgets and Gewgaws, On the Front Lines | Tagged , , , , , , | Leave a comment

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.

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

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. ;-)

Posted in 'Nuff said, Technology | Tagged | Leave a comment