A nifty little WordPress plugin…

The idea for this little plugin has been rattling around in my head for a little while now.  It clocks in at less than 60 lines of code, including comments, and makes it easy to create a “series” for posts.

As I’ve been blogging about my (mis)adventures in building a DrawBot, I’ve been updating each post to contain a link back to all of the prior posts in the series.  However, if someone were to find one of the first posts – they wouldn’t see a link to a later post.  That is, unless I update all the posts.  That’s not really much of an option, since I’ve racked up 23 posts in less than 19 days. 12

This plugin is actually super simple.  Here’s what it does:

  1. Add a “post meta” tag for the current post with the same key as whatever you want to name the post series
  2. Query the database for all posts with the same post meta key as the one for the current post
  3. Output an ordered chronological list of all posts in with the same post meta key as the one for the current post

The simplicity of this plugin are actually some of it’s strongest features.  Unlike a lot of other series plugins out there, it doesn’t create any unnecessary tables in your WordPress database.  There are no settings to mess with, no CSS to fiddle with, no ugly standard formatting to overcome.

The only downside I can perceive is that if you delete the shortcode from a plugin, it will still leave the post-meta attached to the post and the post will still appear in the series.  If you leave the shortcode in and don’t specify a series title, it will delete the post-meta.  I suppose I could include a little button in the interface to delete the post from the series, but really, it’s just not going to be used that often.

Anyhow, this is something that I’ve wanted to have for a long time – I just hadn’t gotten around to building it yet.

Default Series Title
  1. I’ve got a lot to say. []
  2. And, actually, that’s just 23 posts on this one topic.  I’ve probably blogged an equal amount over on the MakerBot blog, with a few totally random additional posts here. []

Creating PDF’s on the fly using PHP and TCPDF

I’ve got a separate website that used to offer a service where you could get a custom report in the form of a PDF sent to you.  For that I used a free open source PHP script/library called FPDF.  It’s reasonably well documented, but there are a lot of nuances that not really intuitive.  Used in combination with a script called FDPI for importing an existing PDF’s, mixing in a little data from users, databases, and the internet, and it was a pretty amazing thing.

An acquaintance of mine suggested I take a look at a similar library for creating PDF’s with PHP called TCPDF.  The documentation borders on the compulsive – which I sincerely appreciate.  While the immediate downside is that it does not have a built-in PDF importer, it is apparently compatible with the aforementioned1 FDPI.  The part that I really like about TCPDF from scanning through these examples is the robust HTML rendering engine.  It would be a really amazing to be able to dump a chunk of HTML directly into a PDF without having to design a script to read through it all, parse it, and then format it specifically for the PDF.

  1. Who the hell uses THIS freaking word?! []

The cake was a lie

So, I’m just learning OpenSCAD when Tony Buser leaves this comment:

This should be in the next version I believe, see: http://gitorious.org/openscad/openscad/commit/d479fca855688c92f4a9f72f4ec18d655c3b351d

Also, you can set variables on the command line like this:
http://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Using_OpenSCAD_in_a_command_line_environment So you could set a variable to a random value in a shell script too.

Unfortunately, since variables aren’t really variable in openscad, it’s often easier to write code in another language that writes out openscad code. :(

Okay, what the hell.  “Variables aren’t really variables”?  What does that mean?  Yes, yes, OpenSCAD is written using a keyboard, but not really a keyboard.  T, are you just messing with me or what?  How the heck am I supposed to learn this language with this kind of nonsense?!

Amusingly, Tony is the second person to mention that sometimes it’s easier to use another language to write OpenSCAD.  Kidding aside, I kinda get that.  I use PHP to write custom javascript and MySQL all the time, since I sometimes have need for more dynamic-ness than those languages can accommodate. 1

  1. And, as we all know, I’m ever so dynamic []