RandomEntries 1.0

I’ve managed to resurrect and rewrite my old old RandomEntries plugin. Turns out it was really really inefficient on blogs with a sufficient number of entries. Currently it will only work on index templates (or, more specifically, in contexts without a stashed entries list) because it works at the SQL level, but I plan to address that in the future.

So, an example of usage, to select 5 random entries:

<mt:entries limit="5" random="1">
* <mt:entrytitle>
</mt:entries>

Note the use of limit instead of lastn. This plugin will not work with lastn as lastn implies a specific sorting to the entries that overrides the random sorting.

The RandomEntries plugin requires Movable Type 4.25 and works with the mt:entries tag so generally it should work with most mt:entries arguments (except lastn and sort_by). You can download it from the github repository for the plugin.

One of the things I’ve wanted for a while with Movable Type was more control of periodic tasks. I’ve been able to get by with just looking at code and manual SQL commands, but that’s hardly a long-term solution. Thus was born TaskMaster.

The first thing that was available to plugin developers for Movable Type was writing new template tags, so let’s start there.

We’re going to:

  • Create a plugin skeleton
  • Add a template tag named ‘helloworld’ that will output a greeting (“Hello World!”)

My goals for this are to demonstrate:

  • Basic plugin structure and layout
  • Basic template tag development

I just thought I should follow up the Intro with some of my thoughts and expectations for this series of plugin development posts I’m writing and for whom I am writing them.

My main goals are:

  • To teach plugin development for Movable Type. I am planning to focus on the perl side of plugin development, mostly because that is where I work. I have not yet had any real need to develop a significant amount of php plugin code for Movable Type.
  • To communicate and demonstrate what I consider to be best practices for plugin development. Maybe you agree. Maybe you disagree. I would love to hear your opinion and I am open to discussion, but these are practices I use in my day-to-day plugin development work that I have put together over the last couple years.

What I am not going to do:

  • Teach perl. There are so many better resources for this than me. I’m going to do my best to avoid any wacky perl-specific techniques, so anybody with a general programming background should be able to follow along, but I am not here to teach you how to write perl.
  • Write your plugin for you. I am more than happy to discuss the myriad of options for integrating code into Movable Type, but anything beyond that is generally going to be outside the scope of this series. If you need a plugin written, there is a great bunch of folks that do just that at Six Apart Services as well as many distinguished members of the ProNet and Movable Type community at large.

I am in the process of finishing up the first Hello World plugin post right now, so that should be up soon. My goal is to get roughly one actual programming post up per week.

I think I’m actually going to do it now. Somehow I’ve managed to light a fire under myself to get this started.

So, Plugin Writing 101. I don’t yet have any kind of set outline for this, but I figure I’ll start with the standard ‘Hello World’ style plugins (yes, plugins). The first should be finished in another day or two. I’ll also try to demonstrate my personal set of plugin development best practices as I go.

Hopefully, I’ll manage to make some sense. And, please, feel free to let me know what topics you would like me to touch upon.

T-Shirt Temptation

A Simple Plan - Threadless, Best T-shirts Ever

I’ve never bought anything from Threadless before, but I have to admit this is very very tempting. I just thought I should share.

Awesome, innit?

It’s amazing to watch the boys interact with the technology around them everyday. As cliche as it sounds, they really do have a different and amazing perspective on things.

So much of what we use around them involves touchscreens (iPhones, Nintendo DS, etc.), so they just assume that lots of other things work that same way. They try to interact with our laptops by touching the screens. When we put on a DVD for them, they will sometimes try and interact with the menus by tapping the screen with their fingers. By the time they’re old enough to really use those things themselves, maybe touchscreens will be as ubiquitous as they think they are right now.

It’s not because they say please and thank you so often (and appropriately). It’s not that they hug each other and say they’re sorry (eventually) after they fight. It’s not that they love fruit, oatmeal, cheese, pancakes and any number of non-candy foods.

The one reason I think we must be doing something right is that William loves to rock out to classic rock (especially The Who lately).

A colleague of mine just shared this particular frustration:

yargh. my test passes if all of the objects are created within the same second, but fails if not. don’t ask how long it took me to figure that one out.

I would have tweeted it, but it was a bit too long and I didn’t want to break it up. I found it pretty amusing, but I have an odd sense of humor and I have been spending alot of time with unit tests lately.

I was browsing through SF Signal’s latest books received post and I was happy to notice an anthology of urban fantasy containing stories by two of my current favorite authors: Jim Butcher (of The Dresden Files) and Simon R. Green (of The Nightside). This is in addition to stories by two authors (Kat Richardson and Thomas E. Sniegoski) I have not yet read, but I would certainly be willing to try out if they are included with the previous two.

That one went right on my wishlist. It’ll be out in a few days and I may just have to snag it.

Upgraded to MT 4.23

So, yeah, it’s a month late or so, but I’ve been really busy. I finally upgraded this site to Movable Type 4.23. Maybe I’ll even write more plugins sometime soon.

I’m deploying a development version of my MediaConsumer plugin and a number of entries might appear as updated in feed readers as I start applying it.

From Pat’s Fantasy Hotlist: ASOIAF on HBO: It’s a go!:

Martin fans rejoice! ;-)

Well, let me get things started by saying “Yippie!”

More information at The Hollywood Reporter: HBO conjuring fantasy series.

The television series based on the first novel of Terry Goodkind’s Sword of Truth series, Wizard’s First Rule, premieres this weekend in syndication.

There are a number of folks out there that are very much not fans of Terry Goodkind, but I enjoyed the novel when I read it years ago; it was hardly the best novel of the 20th century to be sure, but I liked it. Between that and the fact that Sam Raimi is involved with it as executive producer, I am more than willing to give this series the benefit of the doubt and watch a few episodes before I decide to give up on it. If nothing else, I hope this will be at least a marginal enough success so that other great fantasy novels could be serialized into season (or longer) television programming.

Recent Comments