Monthly Archives: April 2006

WordPress Plugin: Hicksdesign Style Archives

The Hicksdesign Style Archives plugin now has a permanent URL.

Looking for a better way of displaying your blog archive list than a list of links to your monthly archive pages? There are many ways to display an archive list of posts, most common is a series of links to your ‘monthly archive’ pages. While perfectly functional, it just wasn’t working for me.

After looking around, I really liked the way that Jon Hicks displays his blog archive list. Using Jon’s method gives a little more substance to an otherwise fairly sparse page and the post titles break up the page nicely with their varying length.

Usage

  1. Download arl_hicksdesign_archives.zip
  2. Unzip the file locally
  3. Upload arl_hicksdesign_archives.php into your plugins folder (normally: /wp-content/plugins/)
  4. Enable the plugin via your administration console
  5. Edit your appropriate WordPress template file and add a call to arl_hicksdesign_archives()

Download

Zip: arl_hicksdesign_archives.zip
Source: arl_hicksdesign_archives.phps

ChangeSet

  • 2006-05-01:
    • Implemented get_permalink() to fix bug
    • Implemented get_month_link() to fix potential bug
  • 2006-04-29: Fixed spelling mistake in plugin name, arl_hicksdesign_archives().
  • 2006-04-26: Initial release.

Upcoming WordPress Plugin Releases

Quite regularly I attempt to do something in WordPress, which I can’t find a simple way to achieve through the use of the Templating Tags. When this happens, I usually whip up a very simple plugin – which in most cases is just a simple function I can then reuse somewhere else.

In the coming days, I’ll be releasing some of the plugins I’ve written. A few of them had previously been written, however I reinvented the wheel so I could gain an understanding of how the WordPress works on the inside.

Currently slated for release:

The plugins should be considered in beta, as I spent as little time on them as required to get the job done. That being said, they are enabed and have been running here error free for quite some time.

Ragdoll Retriever

Since you are all familiar with Princess now, I’m going to reveal a new talent that she has developed in the last fortnight – retrieving! Yes, you are thinking of the right thing – just like the Labrador Golden Retriever.

We first noticed it when she found a pink peg in our laundry basket and was having a merry old time playing with it on the tiles. When she finished batting it around on the tiles, we’d pick it up and throw it again; at which point she would chase and subsequently play with it again. Soon enough, we’d throw it and she’d play with it and started bring it back to our general vicinity.

The video below was taken not long after we found out about this new skill, so the second retrieval is a little sketchy. We now play fetch with Princess regularly and she loves it. She is now taking to initiating the game herself by finding her toy and bringing it to us so that we’ll throw it!

If you’re having trouble viewing it above, you can view it directly on YouTube at http://www.youtube.com/watch?v=iriOxbeoyIE.

More to come.

Oracle DECODE Function

The Oracle DECODE function provides similar functionality to an IF-THEN-ELSE statement. The general format for an Oracle DECODE function is:

DECODE(expression, value1, result1 [, valuen, resultn], [default])

In the above example, expression represents what you want to evaluate. The valueX fields represent what you would like expression evaluated against, while the resultX fields are the values you want substituted if a match is found.

Anything you can do with an Oracle DECODE function, you could just as easily achieve with an IF-THEN-ELSE block. You would normally use a DECODE function over the IF-THEN-ELSE when you have a simple comparison or you prefer the readability of a DECODE function.

As a practical example, consider the small block of data below which might represent a subset of data from a multi-user system.

userid username power
10 john 1
11 cameron 2
12 al 5
13 simon 4
14 lucas 0
15 sally 3

If you issued the following SQL statement against that data, you should expect the output below:

SELECT userid, username, DECODE(power, 1, 'Registered', 2, 'Trusted', 3, 'Moderator', 4, 'Author', 5, 'Administrator', 'Pleb') As status FROM Users;

userid username status
10 john Registered
11 cameron Trusted
12 al Administrator
13 simon Author
14 lucas Pleb
15 sally Moderator

The caveat of using the Oracle DECODE function is that the expression must evaluate to a single value. As such, you can not use an evaluation which has multiple possible values. In such a circumstance, you would need to find a way (read: algorithm) to make each possible value evaluate to a single value. By doing so however, you are removing the simplicity of the DECODE function and an IF-THEN-ELSE block would probably suit better.

Next time you’re going to reach for the trusty IF-THEN-ELSE block by default, consider using a DECODE function – in the right circumstances, it’ll make your SQL simpler.

Shopping Trolley Etiquette

It would seem that the greater population needs a refresher course in the fine art of shopping trolley etiquette. When you’re at the supermarket and pushing a trolley around, from now on please consider yourself like a 4WD on the road. Just like driving a 4WD, you need to be aware of your surrounding space and show a little consideration to other drivers.
Following is a short list of things to consider when you’re next pushing around a shopping trolley.

  • Walk with the flow of other shoppers. You wouldn’t drive into oncoming traffic in your car – so don’t do it in the supermarket.
  • If you need to stop for something in an aisle, take notice of where your trolley is. Most supermarket aisles aren’t very wide, so when you leave your trolley on a 45° angle – it is a hassle for other shoppers to get past.
  • Don’t take your trolley into an area where you can see it is congested. Contrary to popular belief, you are allowed to separate yourself from your trolley. No one is going to steal a trolley full of food which you haven’t paid for yet, in a supermarket full of that same food.
  • Don’t let your child steer the shopping trolley, I know you think it is cute but my heels don’t.
  • When exiting an aisle, you really need to give way to the other shoppers on that aisle already.

While we’re in the shopping environment, you might as well take notice of these other gems:

  • Organise yourself, make a list of things you need before you get to the supermarket. Honest, it’ll save you time and save everyone else thinking you’re an unorganised twat.
  • Where appropriate, take a number and patiently wait to be served.
  • I know it surprises you, but you’re fully loaded shopping trolley doesn’t fulfill the requirements of ‘express‘.

You are now equipped to piss off your fellow shoppers less.