Stefano Rivera (tumbleweed)'s Website, Blog, collected bits of code, cruft and other stuff.

Some Wiki Updates

I’ve just spent an afternoon and evening on the local wikis I look after: CLUG, Freedom Toaster, and GeekDinner.

They’ve all been upgraded to MediaWiki 1.11.0, with reCAPTCHA on sign-ups, and OpenID support.

If you are a user of one of these wikis, you can go to Special:OpenIDConvert (CLUG, FT, GeekDinner) to add OpenID to your account.

In the past, the CLUG wiki has had minimal wikispam, because we thought up some clever regexes, that blocked spammers from editing. However spammers would still sign up, before they tried to edit. This has left the wiki with over a thousand bogous users. Not that that is a problem in itself, but it becomes a bore when you want to guess somebody’s wikiname to give them “Bureaucrat” status for example.

So jerith talked himself into coding up a quick SQL query to find all these bogus users, and a python script to remove them. Any history they’ve had has been assigned to the “Spammer” user, and they have been wiped from the wiki. If, in our zealousness, we’ve deleted any legitimate users who’ve simply never edited the wiki, we apologise. Maybe if you contribute something, it won’t happen again… :-)

Wordpress -> Drupal

This is my script for migrating from Wordpress to Drupal. I know that there is already a migration script out there, but I still wrote my own for a few reasons:

  • My needs are simple, and I knew what I wanted.
  • I wanted to migrate comments and pingbacks if possible. This turned out to be easy.
  • I wanted to learn more about coding for Drupal.
  • I’d already started writing it when I saw Borek’s migrator.
  • I wanted to migrate straight to Drupal 5, not 4 first.

So here it is.

Limitations and bugs:

  • Attached files are copied by requesting them off the old server. But thumbnails aren’t migrated too.
  • Pages aren’t migrated. But I’m sure this would be a piece of cake to fix
  • I put dumped my wordpress tables into my drupal database (They are all prefixed with wp-). This is messy, but while Drupal’s multi-database system is a cool and would be perfect, it’s unworkable when you are debugging. Errors seem to be hooked in drupal, and if you have a broken SQL query (for example) the error handling code hooks Drupal themes, which aren’t findable in the alternate-db world you are visiting.
  • All blog posts are migrated to a single user on the other side.
  • I’m pretty sure that I didn’t solve the character encoding issues, just sidestepped them…
  • I didn’t look into Drupal 6 compatibility.

Drupal Migration

As should be obvious to non-feed readers, I’ve migrated my blog to Drupal. This fits in with my greater plan of organising myself and moving into digs this holiday. Drupal is an awesome CMS - or maybe a better description is “the only decent CMS”. I’ve set up and maintained a few drupal sites, and have been very impressed with it.

I’ve yet to migrate all my previous blog-posts across, but by the time you see this post, that’ll be done. Vhata has walked this road before me (albeit from Serendipity), and I intent do follow his advice.

In the past, I mantained my Wordpress blog as an SVN install. This allowed me to install plugins with svn:externals, which made upgrades a doddle. Drupal uses CVS, so this approach wasn’t an option. After months of procrastination, I investigated config-manager. With it, I built a recipe for downloading drupal and all the modules I use with it. Then I committed this as a bzr tree, so that I could base all my sites on a common base. To install a module, I bzr mv modules/foo drupal/sites/all/modules/.

Now to update all my drupal sites, I update my config-manager recipe, and build a new master tree. Commit it to the repo, and push to launchpad. And then bzr merge in all the sites. It’s pretty quick and painless.

For anyone who’s interested, the modules I’m using are:

So far I’ve had to write a drupal module to support amatomu, and it was a bliss. Drupal’s API and code is some of the neatest PHP I’ve ever had to work with.

I think I’ll be happy here :-)

Amatomu Drupal Module

I’ve written a simple drupal module for including the Amatomu tracker.

It also supports the “What’s hot in South African blogs” tag-cloud, albeit via ugly javascript. I’m not a fan of all this javascript DHTML nonsense, but maybe they can be talked into providing a better API

Todo list (Things amatomu does that I don’t care for, and thus haven’t coded):

  • I’d like to extend this to include support for the shmaak buttons.
  • The rank ribbon.

Available from Drupal.org. Releases for Drupal 5 and 6 are available.

The Brick

You know what happens with old phones, right?

The battery slowly dies, and it needs charging all the time.

So we modded this old brick by attaching the charger to the battery, increasing the phone’s usability by 1000%.

Now you never need to worry about the battery running out, just plug it in. AND because it has a 3-pin plug, you never need an adapter.

Details:

  • The Nokia 2110 in question had a broken charging socket, so it was unchangeable
  • We smashed the charger case open, and took out the PCB.
  • Then we soldered the 3-pin plug’s wires, and the 6V out wires on to the PCB.
  • The PCB was superglued into the blue box, which was cut to fit onto the battery, and holes were gouged for the wires.
  • Then we superglued the box to the battery, leaving the wires poking out.
  • The plug had a hole cut in the top (for the wires) and was attached to the base of the battery & box (superglue again), and wired up.
  • The negative wire was soldered straight onto the battery negative terminal (and the wire embedded flush into the battery).
  • The positive wire was soldered to a copper clip superglued to the battery, that hits the +ve desktop charging contact. (well it just missed, so we enlarged the contact…)
  • Everything got another dollop of superglue, and all the contacts got a good filing.
  • That was it!

It is was in use everyday by Nicholas Abbot for a couple of years (although he had to enlarge his trouser pockets <grin>).

Updates:

  1. The brick has lost it’s aerial. It now has an internal ‘piece of wire’…
  2. One of the clips that holds the battery to the phone has broken, it is now held on by a shoelace.
  3. It has a modular (ie. removable) alarm clock attached to the back, above the battery.
  4. It has suffered beer immersion, but it still works like a bomb (make that ‘works like a brick’).
  5. Unfortunately, due to the beer (and some brandy & coke), the superglue holding the alarm clock dissolved, and the alarm clock is no more.
  6. The ‘piece of wire’ aerial was ineffective (as it was shielded on three sides by the phone), so it has been externalised. The wire has been coiled up and superglued into a little stub aerial above the aerial hole. A strip of bookbinding cloth tape was superglued around the coiled aerial for support and strength.

The ultimate mod!

Pictures:

In Use Profile Battery Removed

Syndicate content