How Flooded Is Bangkok?

On a Saturday night, when I really should have been watching football, I noticed Vanalli and thai101 discussing the Bangkok floods on Twitter…
Continue reading

Python is… challenging?

I won’t say “Python Sucks” – that would be a terribly irresponsible thing to say. I will say that it’s “challenging”. It’s certainly frustrating to deal with as a Perl programmer.

On the one hand, I was very pleasantly surprised at just how little code I had to write in order to retrieve all of my WordPress comment notifications. Saving them to mbox format was also simple enough, although mutt‘s idea of what constitutes mbox format set me back for a while. There is, of course, no actual defined standard for mbox, but that’s another rant…

Oh, and this site was defaced this morning. Which was nice. Something to do a file called .wp-rocn.php. Google shows 0 results – maybe a zero-day vuln? I’ve tightened things up a little here, and made backups. We’ll see what happens…
Continue reading

Reconstruction

The thing about backups is everyone knows they are critically important. It is like your lungs. You don’t sit around and think about your lungs everyday, all day. Yet, if you loose them, it is pretty much game over #

The quote, ironically, refers to Ma.gnolia, for whom I once created and maintained a wordpress plugin. Pure serendipity – I just searched Google for “the thing about backups” until I found a quote I liked…

But to get to the point, this website was first registered in 1999. Ten years ago. Since then, it’s hosted at various times a static site, a defunct mess, a Movable Type install, WordPress, a Bloxsom install, an Habari blog, and then finally a return to WordPress as I realised that it’s very obviously the least-bad blogging engine around at the moment. Even if it is written in PHP.
Continue reading

Ma.gnolia WordPress plugin 1.2

[Edit: The latest version of this plugin can be found here.]

Just a minor update to allow usage as a K2 Sidebar Module.

nb. To facilitate this, I removed the option for the plugin to output its own title – therefore the syntax involved in calling it has changed slightly – take note.

A note to new readers, this is a plugin for WordPress which lets you display the latest links from your Ma.gnolia account. You can now also display links matching one of your tags instead, if you like.

The options are, in order:

  1. Ma.gnolia username (required)
  2. Number of links to show (optional, can be any integer from 0-20, default is 10)
  3. Whether to show the description of each link (optional, 1 or 0, default is 0)
  4. Whether to show the date you published each link (optional, 1 or 0, default is 0)
  5. Whether to link to the Ma.gnolia page of each link, instead of the links themselves (optional, 1 or 0, default is 0)
  6. Whether to just show links marked with a certain tag (type the name of the tag in quotes if you want to do this, default is none)

So to just show your last 10 links, you only need supply your username:

<?php magnolia('barryprice'); ?>

Or to make it more interesting, to show the last 15 links I published, with descriptions, without dates, and linking to the Ma.gnolia page for each, I would do this:

<?php magnolia('barryprice', 15, 1, 0, 1); ?>

Or to show 20 links, without descriptions or dates, linking to the actual link URLs, we would do this:

<?php magnolia('barryprice', 20, 0, 0, 0); ?>

Of course, the default setting for those last three arguments is 0 anyway, so this would also work:

<?php magnolia('barryprice', 20); ?>

Finally, to do the same thing but only for entries tagged with “apple”, we would do:

<?php magnolia('barryprice', 20, 0, 0, 0, 'apple'); ?>

Download Ma.gnolia plugin 1.2

Ma.gnolia WordPress plugin 1.1

[Edit: The latest version of this plugin can be found here.]

So here’s a few extra features – some requested, others invented.

A note to new readers, this is a plugin for WordPress which lets you display the latest links from your Ma.gnolia account. You can now also display links matching one of your tags instead, if you like.

The new syntax gives many more options – they are, in order:

  1. Ma.gnolia username (required)
  2. Number of links to show (optional, can be any integer from 0-20, default is 10)
  3. Whether to include the H2 tag with the “Ma.gnolia” title above the list of links (optional, 1 or 0, default is 1)
  4. Whether to show the description of each link (optional, 1 or 0, default is 0)
  5. Whether to show the date you published each link (optional, 1 or 0, default is 0)
  6. Whether to link to the Ma.gnolia page of each link, instead of the links themselves (optional, 1 or 0, default is 0)
  7. Whether to just show links marked with a certain tag (type the name of the tag in quotes if you want to do this, default is none)

So to just show your last 10 links, with a “Ma.gnolia->[your username]” title above them, you only need supply your username:

<?php magnolia('barryprice'); ?>

Or to make it more interesting, to show the H2 title, then the last 15 links I published, with descriptions, without dates, and linking to the Ma.gnolia page for each, I would do this:

<?php magnolia('barryprice', 15, 1, 1, 0, 1); ?>

Or to omit the H2 title (just outputting a UL/LI structure, like e.cordero wanted), then show 20 links, without descriptions or dates, linking to the actual link URLs, we would do this:

<?php magnolia('barryprice', 20, 0, 0, 0, 0); ?>

Of course, the default setting for those last three arguments is 0 anyway, so this would also work:

<?php magnolia('barryprice', 20, 0); ?>

Finally, to do the same thing but only for entries tagged with “apple”, we would do:

<?php magnolia('barryprice', 20, 0, 0, 0, 0, 'apple'); ?>

Download Ma.gnolia plugin 1.1