ruby! rails! kids! oh my! … and other fun from terry heath
RSS icon Email icon Home icon
  • Lamenting the Lack of Science in Parenting

    Posted on July 30th, 2009 terry 4 comments

    I assume most people who read this know me, and know I write software. I really like thinking in terms of code, because it’s unambiguous, and there’s an answer to almost every problem.

    Parenting? Not so much.

    Most people don’t realize that things that they see babies do, well, they had to be taught to do that. Eat from a bottle? Have to teach them that. Suck on a pacifier? Have to teach them that. Stop sucking on a pacifier? Have to teach them that.

    Sleep through the night? Yep, taught. Go to sleep without crying? Taught. Doesn’t hit you in the face (most of the time)? Taught.

    The problems come up when it’s time to teach those things. Take, for example, sleeping. There are several different ways to teach a kid to go to sleep. You can abstain, and just feed them until they’re big enough that they sleep through the night (our niece was lucky enough to get this, I’m pretty sure she went to 18 months until the parents changed methods out of necessity). You can go in at increasing timed intervals – The Ferber Method (Nate) – to comfort the child. You can sit in the room and try to comfort from the corner. You can ignore them by turning off the monitor – the Extinguish Method (Evie, after a failed Ferber attempt).

    I imagine a lot of kidless people will say that the right thing to do is to wake up with them until they’re ready to sleep through the night. Good for you, and let me know how that works out when you’re going on your 6th month (or 180th consecutive night) of bad sleep.

    Of course, whatever choice you make, you worry. If you get up with the kid forever, are they going to have attachment issues? If you turn off the monitor, are they going to have separation issues? Will this affect their growth? Will they turn to drugs at 14 and run away, never to be seen again until they’re 22, wanting drug money and another fix, if you give in and give them ice cream before the last bite of chicken?

    (Also, random aside, I never entertain plausible tragedies for my kids. I only think of outlandish ones, convince myself that they’ll happen, and then act accordingly. I won’t drive with my trunk open with kids in the car for this reason, because I know a ladder will fly off the top of a truck and slam the back seat and squish my kids in horrendous ways.)

    Discipline approaches cause me similar anxiety. We’ve decided that we will put Nate in time out for anything that we consider to be dangerous or extremely antisocial. For everything else, we raise our voice and talk sternly. Touch a knife, go to time out. Hit, go to time out. Throw something that isn’t a ball, go to time out. But are we over-using timeout? Is spanking really as bad as I think it is? Is yelling effective? Am I damaging Nate’s ears? His ego? His appreciation of acceptable conversational volume?

    This lack of science has some parents turning to garbage for advice, and you know what sucks? I have no evidence that they’re doing anything wrong. The number of studies that actually link different child rearing tactics with long term efficacy and child success? Tiny & apocryphal. Instead, for example, parents will do “parenting studies,” and it’s based on, say, the Bible, interpreted through the author’s perspective of how it should be applied. (tl;dr: get the belt).

    And, what I think is worse, is that because there isn’t good science for lots of problems that all of us run into, parents will ignore the science when it’s available. Jenny McCarthy has got parents thinking that they know better than doctors, the FDA, the CDC, and the WHO. Those vaccines have toxins! They’re evil! Don’t give them to your kids, they’ll cause autism!

    Even though they won’t, and study after study has shown no link between the two.

    So, in short, I think I misplaced my kid instruction manual, and if any of you out there have a spare one because you’re on your 18th kid or whatever, we could really use one.

  • Twitter::Deploy

    Posted on July 18th, 2009 terry No comments

    There are a lot of plugins and libraries that I consider must-haves for a Rails project. Capistrano is one of them.

    At work, we use cap to build to all of our different environments. It’s a pretty big script, since some of our instances span several boxes, some don’t, they all require special restart orders, etc. We use the same script to build to our staging environments, and push out to different staging environments several times a day for QE.

    This started to become a bit of a problem, because we couldn’t be sure when someone had deployed (we have timestamps, but who keeps up with the timestamps of when they check things in?). So, while taking one of my pretzel breaks, I added this to our cap script:

    task :tweet_build_started, :roles => :db do
      users = {
        'theath' => "@terrbear",
        'mroeder' => "@donkeyhighway",
        'rdejuana' => "@rdejuana"
      }
    
      env_user = ENV['USER'] || ENV['USERNAME']
      user = users[env_user] || env_user
    
      username = "FILTERED"
      password = "FILTERED"
      message = "building #{application} from revision #{revision} by #{user}!"
      `curl -u #{username}:#{password} -d status="#{message}" http://twitter.com/statuses/update.json`
    end
    
    task :tweet_build, :roles => :db do
      users = {
        'theath' => "@terrbear",
        'mroeder' => "@donkeyhighway",
        'rdejuana' => "@rdejuana"
      }
    
      env_user = ENV['USER'] || ENV['USERNAME']
      user = users[env_user] || env_user
    
      username = "FILTERED"
      password = "FILTERED"
      message = "new build pushed to #{application} from revision #{revision} by #{user}!"
      `curl -u #{username}:#{password} -d status="#{message}" http://twitter.com/statuses/update.json`
    end
    

    This worked out pretty nicely, so if anyone builds, I see the tweet, and know that any issues I’ve marked resolved, I can drop to QE (part of our workflow).

    So that was kind of cool. But then, talking with the QE guys, we realized that there’s lots of times where QE needs a fresh build to test things, and they have to get a hold of one of us for that to happen. I don’t want the QE guys knowing how to use our cap script, or even trying to, because that could be horrible (cap deploy production -> everybody fired).

    So I wrote a bot that runs on our CI server that polls our builder account for direct messages. If it receives one (using Twitter security, where it can only receive a DM from someone it’s following), it checks the environment to see if it’s a staging one, and then builds to the appropriate environment. It even tweets its progress. Here’s the script:

    # Sample loop to show process
    twitter = Twitter::Client.new(:login => "FILTERED", :password => "FILTERED")
    
    ACCEPTABLE_BUILD_ENVS = /staging1|staging2|staging3/
    
    loop do
      begin
      messages = twitter.messages(:received)
      messages.each do |m|
        env = m.text[ACCEPTABLE_BUILD_ENVS]
        unless(env.nil? || env.empty?)
          `cd ~/builder && cap deploy env=#{env} twitter=#{m.sender.screen_name}`
        end
        twitter.message(:delete, m)
      end
      rescue Twitter::RESTError
        puts "rest problem, continuing as normal"
      rescue
        puts "problem: #{$!}"
      end
      sleep 90
    end
    

    I just run that with nohup, and it’s been going strong for several days now. QE doesn’t even have to ask us for a build, and they’re notified when their build is done automatically, instead of asking for a build, then waiting for us to get around to it, then waiting for us to tell them when it’s ready to go.

  • Piston + OSX Fail / Fix

    Posted on July 11th, 2009 terry No comments

    We recently moved all of our external plugins to Piston, which at first seemed great. There were times where the external plugin devs (in house) were keeping code on their machines because they didn’t want it to get deployed, which seemed wrong.

    So I got everything imported happily, and then yesterday I tried to update one of the plugins, only to see “svn: can’t get password.”

    Turns out there’s a bug/glitch/whatever for svn on OSX when using svn in non-interactive mode, where it won’t ask OSX’s Keychain for the credentials. A bug has been reported to both Subversion and Apple, but in the mean time, I forked Piston and just run svn without the non-interactive flag.

    I don’t think it’s worthy of a pull request, because it’d be nicer if Apple or Subversion would get things fixed, but for now, you can gem install terrbear-piston if you need to use Piston on OSX.

  • How I’ll Interview You

    Posted on July 9th, 2009 terry No comments

    I’ve posted something about this several times, but it seems to change as my job requirements change, or as I get older, or something. The place I work is looking to hire some more developers, and I figure if you’re smart enough to bing me, you’ll get an idea of what I’m going to ask you.

    • Friendly, upbeat. This one used to be lower on my list, but I’ve realized in the last few months that if I detect something of a bad attitude in the interview, it’s going to increase exponentially when things go south. I’d prefer someone who can joke a little at 6AM when servers are down and OH MY GOD WHERE IS THAT TECH SUPPORT EMAIL.
    • Ruby and Rails (not just Rails). While this one can be negotiated, I really want someone who will help push Ruby and Rails idioms and patterns, and won’t have to ramp up on the language. The first code you submit, I’d like it to look like Ruby, not Java in a different dialect. If I had to pick between the two, I’d choose a Ruby programmer over a Rails programmer.
    • Linux. You need to know your way around the command line. You should have set up Apache at least once in your life. Bonus points for memcached or a queue. Double bonus for monit or god, and if you can tell me why using god is a bad idea, triple bonus points.
    • Side Projects/Open Source. I think that side projects are necessary for self improvement, because they let you explore technologies in a production-like environment, but not entirely at your employer’s expense. What’s your Github profile look like? Stack Overflow? Do you run any sites for fun? How’d you set them up? Did you go with shared hosting? Really? Why?
    • Fundamental knowledge of data structures and algorithm runtimes. I think understanding how trees, graphs, queues, stacks, etc., look and feel and behave is necessary for solving hard problems. This one’s pretty fundamental.
    • Quick. If I ask you to code something like FizzBuzz, and it takes you 10 minutes, what does that mean when you’re asked to code something hard?
    • Good questions. I’d like to see that you have an idea of what you want where you’re working. It’s ok if we’re not a good fit for you, that’s what the interview is about. If you’re not passionate about finding the right place for you, and we hire you, are you going to be passionate about making this workplace better?

  • Bite off what you can chew

    Posted on July 4th, 2009 terry No comments

    Preface: I’d like to point out that I’ve had this blog post on my todolist for a little over a month. The irony isn’t lost on me that it’s taken so long to get to writing it.

    Also, I love the Dos Equis billboard that reads, “Every once in a while, Bite off more than you can chew.” But that’s another matter entirely.

    For the last year or so, I’ve kept myself pretty busy.

    I love my job, but there are several weeks where I’ll work at least one night of the week until 10. I read a lot to help make myself a better developer and to help out our team. I discovered podcasts. My commute is about 45 minutes each way.

    I co-founded a consulting company with @meezy a few years ago, and we do work for that from time to time. I wrote bgtwt. I rant on bgtwt. I maintain Locked Envelope. We maintain two servers for another client.

    I play College Pick ‘Em (and love college football), and watch football games every Saturday (and sometimes Sunday) that I can.

    I have an adorable two year old, who loves attention (rightfully so). We gained a (now) 7 month old, who deserves just as much attention as her brother.

    I found out I love mowing the lawn (barefoot, and fight about it with @stinkle pretty much every time).

    I try to be present and attentive and helpful for my wife.

    I started keeping my inbox empty, going out of my way to answer/close everything at least once a day. I blog. I tweet. A lot.

    Pretty much everything I do, I really enjoy. I think talking/flaming over Twitter is hilarious and enjoyable. I like the soapbox of the blog. I love my family. I love writing things, building things, learning things, and watching people use things that I wrote/built.

    I also love video games, but those have mostly been absent in the past year, largely because of everything else on my plate.

    I realized a few weeks ago that my todolist (I use Things, and so should you) was never emptied. I’d have a goal of setting aside everything I was going to do that day, and I was never hitting that. So I started committing myself to less, because there’s no point going around every day feeling like a failure (which is a different issue).

    That was a nice improvement. There would be days where I’d get my todolist down to 0, and just say, “wow, now I can do whatever I want.” I’ve found lately that I’m really bad at doing whatever I want, because I haven’t done it in a while. First thing I did? Bought Wolverine X-Men: Origins. It’s fun, mindless killing. We need more of that.

    I’ve also realized that I’ve been keeping up with too many projects. I have some private projects that aren’t ready to be announced that I keep up with. I have some public ones (bgtwt, Locked Envelope). It got to where I’d look at my 4 or 7 projects and think, “sorry, I’m just going to neglect you today.” And it sucked.

    So I’m committing to fewer projects now, in an effort to consciously only rarely bite off more than I can chew. I’ve stopped development on bgtwt for the time being, and if it starts to look like it’s gaining its own culture/crowd beyond the initial users, I might start it up again. LockedEnvelope is at a standstill, and will probably stay that way until I see a good use case for an API. Navoty site rewrite? That might come sooner, but not this month.

    I tried several months ago to drop Twitter and other social networking sites, but I realized (maybe 2 days later) that wasn’t the issue. The reason I’ve had no time to do what I want is because I’ve got too many things to do that I want, and it’s a shitty way to go through life, not completing or having any time to reflect on anything.