10
December
2009
  • "Passing the salt will never be the same. We all knew it was inevitable. Passing the salt by hand just isn’t efficient enough in a world of bullet trains and pizza delivery and broadband. Luckily the condiments have come to life! They will waddle wherever you tell them to, so the next time someone wants the pepper, wind up the key, and pepper they shall have! Mercilessly marching towards them like the terminator, more of a threat to dull tastes than the human race." Not sure they're £20-good, but I do like this condiment set made of small robots.
  • "Here’s a complication of some common and useful time & date calculations and equations. Some, though very simple, are often misunderstood, leading to inefficient or incorrect implementations. There are many ways to solve such problems. I’ll present my favorites." These are, indeed, useful, and I've been using a few of them recently.
31
August
2009

Links

Tagged as:
, , , , , , , .

13
August
2009
15
August
2008

Backing up and restoring all your MySQL databases with Ruby scripts

One thing I usually forget to do when I backup a computer is back up my MySQL databases. Partly, because they’re not stored in my Library (I don’t think); partly because I forget how many I have. mysqldump only backs up one database at a time, unfortunately. What would be great is something that dumps all of the databases in the system.

Anyhow, whilst on hold to my ISP this morning, I decided to solve this problem once and for all.

The end result is a pair of Ruby scripts which you can get from github.

The first will iterate over every db on your system (when run with an appropriate username and password) and spit out a .sql file with a filename corresponding to that database. The second look at a folder of .sql files named similarly, and for each one, drop a databases with that name, re-create it, and restore from the .sql file.

I’m sure I could do it just fine in a bash script, but it made sense to use the tool that comes most quickly to my hands, and that means Ruby. Once you’ve got Ruby installed, the rest is easy. Clone them, patch them, fix them; they’re basic, as maintenance goes, but handy.

Get the scripts from github.

09
September
2007

Wordpress 2.3: a look at tagging

So, this blog (for its sins) is running on Wordpress 2.0.5. That’s a bit out-of-date. The main reason is because it has all sorts of jiggery-pokery to make it work the way I want – a tagging solution based on Jerome’s Keywords that was modified when I moved to 2.0; all sorts of template hacking to make the beautiful breadcrumb trail at the top you see work.

I’ve resisted upgrading due to the hell that was hacking plugins and templates into future versions of Wordpress. Until now, that is. Wordpress 2.3 (finally) introduces a proper tagging solution – entirely separate to the “categories” system. Well, not quite, as we’ll see – but it finally means that the architecture of Infovore.org is now entirely possible within Wordpress itself.

Of course, now you’ve got to convert your custom tagging solution to the new schema. I’ve written a small script to do this for myself – only took about an hour, and that’s mainly because I was exploring the schema, and my PHP is a little rusty. Of course, now I know a reasonable amount about how tagging is implemented in Wordpress 2.3, and felt I should write this up properly, so that anybody else converting custom tagging solutions might save themselves some time.

Continue reading this post…

07
August
2005

posts

Tagged as:
, , .

Solving the problem with Ruby on Rails, Tiger, and the mysql gem

Haha! I solved the problem in the previous post with some cunning. And Google.

Basically, even though it looks like the mysql gem has installed correctly, it won’t have, because, once you’ve upgraded to Xcode 2.1, gcc is upgraded to 4.0. If you try and install the gem with gcc 4.0, it breaks. You need to install it with gcc 3.3 as your compiler. Doing this is as easy as typing

sudo gcc_select 3.3

in your terminal window before you run

sudo gem install mysql -- --with-mysql-dir=/usr/local/mysql

Once you’ve done all that, you can then type sudo gcc_select 4.o to return things to normal.

Phew. Scaffolds now work. That was an exciting little detour.

Links & notes for this month

Endnotes