Author: Matthew

  • Walk for Life

    I’m participating in the 2010 Walk for Life this month to support Pregnancy Support Services of Wake Forest. The walk is a family-friendly event that raises awareness and funding for the center. The cool thing is that you don’t need to walk or even live in Wake Forest to support the center. You can help by sponsoring me as a walker. It’s quick and easy to do. (There is more information about the center and what you would be supporting on my walker page.) Thanks so much for your help!

  • Federal makes it right

    A $25 check from Federal showed up in the mail yesterday. That more than covers the cost of a new box. It’s always nice when a company makes things right for their customers. I intend to continue buying their products since I know they’ll take care of me.

    Time Warner Cable: are you reading this? Learn something, please.

  • Hinkey Federal .40 S&W round

    Hinkey RoundI was enjoying an IDPA match at the Durham County Wildlife Club this past Tuesday evening and, aside from it being pretty cold, I had a great time. Except at the end of the fourth stage.

    I was almost through my first mag when I experienced a failure-to-fire. The round had fed properly and the slide appeared to be fully closed, but all I got when I squeezed the trigger on my Glock 23 was… nothing. No click. Just… nothing. I racked the slide again to eject the unfired round and I was able to finish the stage, but it cost me at least 2 seconds, perhaps more.

    After retrieving my ejected round, I noticed it looked a bit odd. Comparing it to another round, I discovered the rear of the case hadn’t been trimmed properly. It was a few millimeters too long, as you can clearly see in the photo I’ve posted here. My guess is that it prevented the slide from fully engaging. This is the first time I’ve seen anything like this, and talking with a few other shooters at the match, this was the first time they had seen anything like this either. Cool!

    I’ve sent the questionable round to Federal’s service department to see what they have to say. Hopefully they’ll make things right. The delay ended up costing me first place in the Novice class. What did I learn from this? First, that even quality factory ammo shouldn’t be relied upon to function flawlessly every time. Malfunctions will occur. Practice for them. Second, that every malfunction is different. I’ve practiced my failure-to-feed drill pretty consistently, but running into a situation where the slide closed and the trigger didn’t even click was something I just wasn’t expecting. Instead of treating it like any other failure, I let my surprise delay me from taking action.

    Final note: I’ve been extremely happy with Federal ammo thus far and would be surprised if they don’t make this right for me. This post wasn’t intended to criticize their company in any way, it was just a fascinating occurrence that I thought might interest others as well. Has anyone else seen a factory round that was too long like this?

  • Quote of the Week: Stephen Jay Gould

    “The absence of fossil evidence for intermediary stages between major transitions in organic design, indeed our inability, even in our imagination, to construct functional intermediates in many cases, has been a persistent and nagging problem for gradualistic accounts of evolution.” — Stephen Jay Gould

  • Dirty date/time attrs in Rails lose their time zone

    Dirty attributes were recently added to Rails and they’re quite useful. However, I ran into a problem where a dirty date/time attribute was losing its time zone information after a save. I was doing a comparison between two dates in a before_update callback like so:

    before_update do
      if started_at.to_s(:abbrev_date) != started_at_was.to_s(:abbrev_date)
        errors.add :started_at, "cannot be set to a different day"
      end
    end
    

    The started_at date was coming back in the Eastern time zone as expected. The started_at_was attribute, which was supposed to reflect the value prior to the update, was coming back as a UTC date/time. I would expect it to be returned in the Eastern time zone too. Apparently, I’m not alone in this assumption because a ticket was opened for this issue last month.

    An official fix hasn’t been made yet, but I got around the problem by calling in_time_zone on my dirty attribute:

    before_update do
      if started_at.to_s(:abbrev_date) != started_at_was.in_time_zone.to_s(:abbrev_date)
        errors.add :started_at, "cannot be set to a different day"
      end
    end
    
  • Quote of the Week: Wendell Barry

    “The disease of modern character is specialization…The specialist system fails from a personal point of view because a person who can do only one thing can do virtually nothing for himself.” — Wendell Berry

  • Things I learned today

    1. Compiling Apache and PHP from scratch in DSO mode is a nightmare
    2. Slicehost’s ability to restore a server image from a backup is incredibly useful
    3. I’m glad I’m a developer and not a sys admin

    That is all.

  • WordPress upgrade was moderately easy

    I recently upgraded my blog to WordPress 2.9.1 and I’m very pleased with the results. The upgrade itself was very straightforward. It was just a matter of replacing the correct files in my project. I have my project checked into GitHub so I was able to immediately see what had changed. I also had a safety net in case I wanted to back out of the upgrade.

    One nice benefit to upgrading was that I’m now able to leverage the Syntax Highlighter plugin. It does nifty stuff like this:

    class HelloWorld
      def say_hello
        puts "Hello world!"
      end
    end
    HelloWorld.new.say_hello
    

    If you run a WordPress blog, I would definitely recommend checking it into some sort of source control. Also, being able to run the blog on my development system is very beneficial. I was able to verify that the upgrade hadn’t borked my layout before making everything live. I use Apache to serve it up locally.

    What platform do you use for blogging? What do you like about it?

  • Delete/backspace doesn’t work in nano

    If you’ve ever performed a fresh install of Ubuntu, you’ve probably noticed that the delete/backspace key doesn’t work correctly in nano. This is frustrating, but easy enough to fix.

    This problem also occurs quite frequently for me when logging into a remote server. For example, a default Slicehost instance usually suffers from this behavior.

    If you truly want to understand what causes the problem, check out this article.

  • Mass rename files in UNIX

    Several of my Rails projects surface a RESTful API. I use integration tests to verify that the API calls work as expected. I also version my API calls so I can easily adapt the API to new circumstances while maintaining backwards compatibility.

    To move to a new API version, I copy all of the existing integration tests and rename their prefix to the new version. Instead of renaming the files by hand, there is a nifty UNIX command that handles it for me. For example, to rename all the “v2_*.rb” files to “v3_*.rb” I would type:

    for file in *; do mv "$file" "v3_${file#v2_}"; done