Panama Pictures

Angela and I just got back from a business trip in Panama with a great group of people. It was awesome. Some of my friends posted pictures:

Group Shots

Totally Awesome Photoset


Amazon Reloaded for WordPress Updated

I’ve just updated my Amazon Reloaded for WordPress plugin. The update includes the following changes:

  • Improved code quality
  • Improved error handling
  • New settings inputs for Amazon secret and API keys
  • New interface for display search results
  • Better formatting of search form
  • Support for Amazon’s new request signature requirements

I’m happy to get this out there and want to thank the individuals who stepped in when I was too busy to update it.  Thanks!


Things Today that Pissed Me Off

Today there were two things that really enraged me. To get them off my chest, I thought I’d post them here:

First, I was at the gym and this skinny little punk wearing plaid cargo shorts and basically being a little douchebag was lifting. I didn’t have a problem with that. However, he decided to place this bar in the middle of the free weights area, clean it up (kind of) and put it on his back and do quarter squats. He was “training” his friend to do the same. The weights were not clipped and moved all over the bar and put both him, his friend, and passer bys in danger. I threw him the clips after his set so he could clip up the weights and he looked at me and threw them back. Then, he just left the fucking bar in the middle of the dumbbell area and walked out, giving me the stink eye the entire time. I wanted to throttle him.

Second, a woman pulled up to Marshall’s and let a middle aged fat woman out of her huge Chevy Trailblazer, then parked 20 feet away and sat in the SUV with her engine on. I went to the bank, and when I came back, the chick was still sitting there in her gas guzzling SUV with the car on and engine running. I was in the bank 20 minutes. I seriously can’t believe that kind of bullshit.

So entitled punk and stupid fat, wasting chick were my triggers today. Did you have any?


Interesting Programming Decisions

As a professional programmer, I come across a lot of places where I need to make tough decisions. Some of the questions I often ask are:

  • Should I split this into a separate function?
  • What conditions should I check here and what is the best order?
  • Are there any programming principles that I know of that apply here?

I was writing a WordPress plugin today and came across a piece of code that I feel exemplifies the decisions you have to make as a programmer and is simple enough to explain to a layman.

When writing conditionals there are two rules that I try to follow:

  1. Always check the positive of the condition
  2. Make the most common case come first

Generally these two principles coincide. However, today I came across a situation where they did not match up. The piece of code is as follows:

if (!is_wp_error($attachmentId)) {
    $attachmentIds[] = $attachmentId;
    add_post_meta($newPost, self::$_post_meta_Image, wp_get_attachment_url($attachmentId));
    $imageCounter++;
} else {
    wp_delete_attachment($attachmentId);
}

The most common case here is that the attachment saves appropriately and the $attachmentId variable is not of type WP_Error, so the first condition will evaluate true and go into that first block. However, given the API I’m working with, I have to check the negation of is_wp_error rather than check a positive value. So, I put the common case first but had to check a negative to do so.

I really thought about swapping this, but decided not to because I believe this is clear enough to not cause confusion. What do you think?


Mount Saint Helens

Mount Saint Helens was awesome. I went there a few weeks ago with Angela for her birthday and we had a blast. Here are some pictures from the trip:


« See older posts