Dougal Campbell's geek ramblings

WordPress, web development, and world domination.

Status Report

I’m customizing an install of the Mantis bugtracker for my contract job. We want to modify it to authenticate against our own user database. Fortunately, the Mantis code is pretty well modularized and abstracted, so it shouldn’t be too hard. I’m also going to try to integrate a way to submit new issues by email. My employer has already suggested that when I get that working, I could submit the modifications back to the Mantis project. It’s nice to have a boss who “gets” Open Source.

Meanwhile, Jamie and Mary are in the family room watching Esther Williams in Skirts Ahoy!. Susan is slicing up some banana bread in the kitchen. I’m having a brunch of freshly cut pineapple and cantelope (and a small dollop of whipped cream), along with a cup of hot coffee. Later today, we’ll take the kids to the mall.

Life is good.

Work, work, work

No, the storms didn’t wipe me off the face of the earth. I’ve just been consumed by work. Plus, we had out-of-town relatives visiting last weekend, so some of my “free time” (ha!) got subsumed into my “family time”. Even so, I still haven’t gotten myself into the daily schedule that I really need to be on, as Susan has had to remind me several times lately. I’ve been meaning to get up early enough that I can begin working at 7:00am, but more often than not, I don’t get started until 8:30am. Or later. Which leaves me working later in the evenings or on weekends to catch up.

Today was one of my better days (began at 8:30am). But I’ve got to start getting up earlier. Especially if I’m going to follow through on my plan to walk on the treadmill every morning before work. And that’s something I want to start doing, because I recently found our scale, and discovered that I’ve regained the 10 pounds that I had lost earlier this year (as I feared).

Weather

As I write this, there is severe weather about to head through my area, including the possibilities of tornadoes. I’ve seen some pretty spectacular lightning strikes in the distance, so I’d better shut my computer down before something bad hap&@~v7#;+rk*

A PHP Question

Okay, here’s a question for some of you PHP OOP gurus out there: How can you use the preg_replace_callback() function from inside of a class method? I even tried using create_function() to make a self-contained lambda, but it seemed like it couldn’t access class properties via the $this variable.

Continue reading

The Cookout

In my last post, I mentioned that we were running a little bit late getting to the movie theater. Let me go into a little more detail.

See, these events took place on July 4, Independence Day. It’s traditional to have a cookout on Independence Day, right? So we had planned to grill hamburgers, hot dogs, and corn on the gas pit grill that our rental house has in the back yard. The forecast called for a small chance of isolated thundershowers, but we weren’t too worried, because it was mostly sunny as we began to prepare (you can already see where this is going).

Our plan was simple: have a cookout, then go see the movie. We reviewed the show times on the net, decided that the 3:15pm showing would be good, and I drove to the theater to pre-purchase our tickets. We were going to start grilling around noon, which would give us plenty of time to cook, eat, and even relax a bit before we left for the show.

As planned, I went out around noon to begin preparing the grill. There were some dark clouds about, and Susan wondered if we should just do our grilling indoors on the George Foreman Lean, Mean, Fat-Reducing Grilling Machine®. But we decided to take our chances outdoors.

Of course, seconds after I put the burgers on the grill, a few raindrops started falling. “Should we take them inside,” Susan asked? “Nah, a few drops won’t hurt anything,” I replied. It started raining a little harder. “Are you sure you don’t want to move this inside?” I looked up at the sky and frowned. “Well, it’s still not all that bad. I think I can stick it out.”

It started raining harder. Susan offered, “How about I bring you an umbrella?” I looked up at the darkening sky again. “Yeah, okay, that might not be a bad idea.” Susan ran inside. By the time she returned with the umbrella, the raindrops were getting bigger, and they were coming down more steadily. I huddled over the grill, shielding the food and as much of myself as I could, though my back was exposed to the rain, and my shirt was getting pretty wet now. Susan ran back inside and found a second umbrella, and tried to provide additional cover. As I croached, flipping burgers, the rain got harder and harder, becoming an outright downpour.

Susan said, “I think we need to take this inside.” Frowning, I reluctantly concurred. By now, my entire backside, from shoulders to socks, was soaked. Susan ran back inside to get a platter to transfer the burgers onto, while I continued my attempt to shield the food from the monsoon. I silently cursed the weather man. “30% chance, my ass.”

We moved the food inside, went upstairs, stripped off our wet clothes, dried off and changed into fresh clothing. Then it was back down to the kitchen to plug in the George Foreman Grill, and finish cooking the burgers. We decided that since we didn’t have as much cooking room now, we’d skip the hot dogs for now, and just stick with the burgers. As the first batch came off the grill to make way for the second, we glanced out the window into back yard. We looked at each other, then back out at the yard. The sunny yard. The nice, bright, sunny yard.

I sighed, grabbed the corn, and went outside to fire the grill back up.

The rest of the cookout went without incident. And the food was very tasty. Somehow or another, the burgers had remained on the grill long enough to pick up some hickory flavor from the wood we used. And somehow or another, the rain didn’t manage to wash that flavor off the burgers. However, the food transfer and wardrobe change had put us behind schedule.

And that is why we were running late to see the movie.

And of course, it didn’t rain again the entire rest of the day.

Spider-Man 2

Yesterday, Susan and I (and Susan’s parents, as well) saw Spider-Man 2. Awesome movie. I can’t remember the last time I went back to watch a movie in the theater for a second time, but we’re thinking about seeing this one again.

Of course I have extra incentive to see it again, because I missed the opening sequence. We were running a few minutes late getting to the theater, but we got seated just as the opening credits started. I zipped out to the lobby to get our snacks, figuring I’d be back before the action started. Silly me. Out of the eight-or-so registers at the snack bar, only two were open, and they were both already serving customers. Despite the fact that there were four other teenaged employees huddled in a corner behind the counter, babbling about what movies they were going to rent that evening. And to top it off, the lady in front of me was counting out dimes, nickles, and pennies to pay for her order.

And when I eventually *did* get served, the kid taking my order wasn’t the sharpest tool in the shed.

Snack Counter Kid: “What can I get for you?”

Me: “A large Coke, a large buttered popcorn, and a box of Raisinets, please.”

SCK: (holding up drink cup) “This size?”

Me: “Yeah.”

SCK: (pours drink, sets it on the counter, fiddles with the lid because he didn’t get it on straight, fetches popcorn bag) “Butter?”

Me: (didn’t I say ‘large buttered popcorn?’) “Um, Yes.”

SCK: (fills bag with popcorn, then holds the bag up) “Did you want butter?”

Me: (slightly irritated) “Yeah!”

SCK: (butters popcorn, rings up order) “Eleven dollars.”

Me: (pay, rush to the end of the counter for napkins and a straw, go back into theater) “…grumble…”

Peter Parker’s Manager: “You were late again, Peter. You’re fired!”

Peter Parker: “Hey, look at that guy coming into the movie ten minutes late. He’s even more of a loser than I am!”

Despite all of that, I enjoyed the movie immensely. And based on my wife’s synopsis, I really didn’t miss all that much. The special effects were incredible — even better than the first Spider-Man movie. The acrobatics and web effects looked quite realistic. And the effects for Doctor Octopus were awesome, as well. Plus, the script was pretty darned good (though, I feel like they might have been a little too gratuitous with the whole “Peter Parker is a loser with no life” theme).

Greetings, spammers!

Early this morning, a spammer flooded this site with around 20+ comment spams. Thanks to MooKitty‘s Spam Words Plugin, I was able to delete them all quickly, and ensure that the spammer will not be able to attempt spamming me again with any of the porn links he used in this morning’s attack.

The spammer’s attack was interesting. There were two separate batches, but obviously the same person, because they all came from the same IP number (217.110.169.122, ad96ea97a.dsl.de.colt.net) within the space of just a few minutes.

The first batch of comments all had an author URI that pointed to a particular (obviously porn) site, and the comment bodies each contained just a link to a different (for each comment, and again obviously porn) site.

In the second batch, the author URI was again the same for every comment, but to a different site than the first batch, and with a domain name that doesn’t appear porn-related. The comment bodies were all different, and they were all short snippets of text snatched from other web sites, mostly from articles talking about WordPress. In fact, they appear to be the excerpts generated by a Google search for “wordpress”. I wonder if any of the abuse admins at Google would be interested in pursuing the spammer for this misuse of their service? I’ve still got my email copies of all the spams if anyone wants them.

I wonder if this ties in to the recent bounty for a blog spamming engine? Yes, I’ve reported that to the Rent-A-Coder admins as a violation of their TOS.

Peeking out of of the Window

Okay, where was I?

Oh yes, I was going to poke my head out of the window for a minute to let you know what’s been going on in my life.

I have relocated from Enterprise, Alabama to Woodstock, Georgia. I always felt like my old hometown was a friendly place, but I still can’t get over how nice everyone here in Woodstock is. I think that everyone we’ve met, without exception, has welcomed us to the area.

Another change is that I am now working as an independent consultant. My current contract is with XLT Software. As I’ve mentioned before, I’ve signed an NDA, so I can’t give any details. But I’ll be coding a web version of some Windows software, and working on other web-related functions for the company.

Now that I’m getting settled into my new work, I should start posting more often again. It’s mainly a matter of getting into a good routine where I feel like I’m getting enough work done to justify taking some time out.

Doors and windows

An old proverb says, “Every time God closes a door, He opens a window.”

This is the last post I’ll make as a resident of Alabama. I’m about to leave my passkey on my manager’s desk, and take my last box of personal belongings out to my car. Then, I’m going to go meet my wife for lunch. By this evening, We’ll be full-time residents of Georgia. I’ll be back here for the occassional visit, though.

But right now, I’ve got to go out this particular door for the last time. I’ll post more later, when I’ve got more time to explain about the window.

My first WordPress plugin: HeadMeta

Mark Pilgrim was in the #wordpress IRC channel earlier, asking if there was some way to add <link> and <meta> tags to the <head> section of a page for specific posts. It seems he wants to control how various search engines and other bots index individual posts. I replied that he could do this using the custom fields feature.

A short while later, I had written my first plugin for WordPress: HeadMeta: .ZIP, .tar.gz, .phps, .txt.

To use this plugin, you add key/value pairs in the Advanced Editing interface. In particular, you’ll want to add keys named “head_link” and “head_meta”. The value will be plugged into the generated <link> or <meta> tag. For example, if you added the following keys and values:

Key Value
head_link rel=”seealso” href=”http://example.com/movies/”
head_meta name=”keywords” content=”entertainment,movies”

This would generate two tags in the <head> of the page, when someone visited the permalink for the post:


<link rel="seealso" href="http://example.com/movies/" />
<meta name="keywords" content="entertainment,movies" />

This will be useful for any situation where you want special <link> or <meta> tags generated for specific posts.

UPDATE 2005/07/14: I’ve updated the plugin to version 1.1, which adds a new feature: if you have a key named “keyword” or “keywords”, it will automatically generate a standard “keywords” meta tag. For example, if you have the following custom field:

Key Value
keyword pets, dogs, canines, training

The result would be:


<meta name='keywords' content='pets, dogs, canines, training' />

UPDATE 2005/10/15: I updated with a bugfix. The new version is 1.2.

UPDATE 2007/02/05: Version 1.3 is the newest version, which is now WordPress 2.1 compatible (it should still work with older versions, as well). Thanks to Gerald for pointing out the problem!