Author: Matthew

  • Nomadic programming (part 1)

    I’m a freelance software developer which means I generally work from home unless a client needs me to be on-site. I don’t mind being alone to a certain extent, but after a few straight weeks it can get pretty lonely.

    Recently, I’ve started doing what I’ve termed “nomadic programming.” Namely, spending the day roaming between various wi-fi hotspots instead of working from home. This has worked really well for me. So well, in fact, that I think the concept needs to start spreading.

    Now I realize there are many freelancers out there who already do something similar to what I’m describing. I think it’s worth “formalizing” the process, though, by laying out the pros and cons of nomadic programming, and then giving some advice on how to actually go about doing it.

    nomad [noh-mad]: (1) a member of a people or tribe that has no permanent abode but moves about from place to place, usually seasonally and often following a traditional route or circuit according to the state of the pasturage or food supply. (2) any wanderer; itinerant.

    Why be a nomad? Why not stay at home? While staying at home has its benefits, here are some reasons why a nomadic lifestyle might be a better fit for you:

    • It zaps loneliness. Let’s face it, being at home by yourself isn’t the most exciting of propositions. Many of us have families and that helps a lot with the loneliness factor. For those of us who don’t, getting out into an environment with other people can defeat that pervasive sense that we are the only person left on earth. (Anyone who has seen “I Am Legend” will know what I’m talking about.)
    • It increases focus. This may seem counter-intuitive at first glance, but let me explain. When I’m at home, the temptation is to wander over to the kitchen for a snack, pop in a DVD, or conveniently set aside my work to get to those chores I’ve been meaning to do. The primary reason this happens is because my surroundings are familiar. It can be hard to focus on work at home because we’re used to doing so many other things there… relaxing with the family, mowing the lawn, picking up after the kids, sleeping, etc. If you’re anything like me, you have a natural tendency to procrastinate and substitute household activities for billable work. Nomadic programming kills this temptation. It places us in an entirely new environment with a new set of stimulations. It snaps us out of “being at home” mode. We can’t very well be tempted to grab a spot on the couch and turn on the TV when our home is several miles away. I’ve found that placing myself in fresh environments every so often greatly increases my ability to focus on the task at hand.
    • It boosts productivity. Hand in hand with focus goes productivity. I get so much more done in a new environment than I do at home. I’m not completely sure why this is yet, but part of it probably has to do with the way our minds work. When we get used to routine, time passes more slowly. We get bored. We get distracted. In a new environment, our minds have to be alert to take in the new stimulation that’s being provided. This alertness yields greater productivity gains. On Monday this week, I spent three hours in the morning coding by myself. I then spent three hours during the afternoon coding with a friend at Bruegger’s. I was twice as productive during the afternoon as I was during the morning. This isn’t because I’m not a morning person. It’s because being away from home and interacting with a good friend yanked my mind out of the routine it had slipped into, and the code flowed more freely as a result.
    • It’s a great way to network. With the aid of new location-aware tools (which we’ll cover shortly), nomadic programming is a fantastic way to meet new people that you otherwise wouldn’t have been exposed too. Let’s face it, the only people we interact with at the local user groups are other programmers just like ourselves. Contrast this with the coffee shop or the park. There is potential to run into a fellow entrepreneur, an insurance salesman, an airline pilot, a night stocker from the grocery story, the guy or gal who delivers our mail, etc. Exposure to a whole new set of people becomes not just possible, but likely. This is, again, an area where routine can work against us. If we get used to being around the same set of people all the time, it has the potential to kill not only our networking skills, but also our chances of meeting people that will stimulate our minds in ways that would not otherwise be possible. We shouldn’t just be learning from fellow geeks, folks. We should be branching out and learning from all sorts of people. Nomadic programming enables this kind of networking to occur naturally.
    • It’s just plain fun! Spending your morning sipping a latte, making a new friend, then choosing to migrate over to Panera together to grab lunch and share ideas can be downright enjoyable. It’s not all about cranking out the code to meet the deadline, folks. If your work is never fun, you’re in the wrong career. Being a nomad can make programming fun again.

    These are just a few of the many positive aspects of nomadic programming. What about the downsides, though? It can’t all be a stroll through the flower bed, can it? No, it can’t. There are some bees waiting to sting us:

    • It can be time consuming. Being a nomad requires travel time between the different places you visit. Depending on how far you travel, this can eat up time that could otherwise be used for billable work.
    • It can be expensive. Many places that offer free wi-fi right now are businesses that expect to turn a profit, and rightly so. It’s not ethical to take advantage of a work location without making it worthwhile for the people providing that location. This means that when you visit a coffee shop, you should order something (preferably something other than water). Add small dining costs like this to the gas you blew getting here and the expense can begin adding up.
    • It can distract from more important things. For those of us with families, it can be easy to get carried away with being a nomad and start routinely staying out quite late. Midnight coffee shops don’t help here. It’s very tempting to just keep working, especially if you’re having good, productive interaction with fellow nomads. This can quickly begin eating away at the time you should be spending with your family. It can be equally tempting to start skipping out on home chores, responsibilities at church, etc.

    While the downsides to being a nomad are real, they can definitely be managed. Wi-fi is getting fairly common, even in more rural areas, so travel time can often be limited. Expenses can be kept down by ordering cheaper items and putting in an extra hour of billable work to make up for what you’ve spent. Distraction is a harder nut to crack, but it can definitely be overcome with a dose of self discipline and some verbal accountability to your family and friends.

    When balanced against the advantages, it’s clear that nomadic programming is a good thing overall. So once we decide the benefits are worth it, how do we actually go about being a nomad? There are a few simple, easy guidelines to follow and several tools that can make the process easier and more fun. We’ll find out what to do (and just as importantly, what not to do) in my next post.

    In the meantime, drop a comment and let us know if you’re doing nomadic programming.

  • Where does TextMate store its bundles anyway?

    After spending nearly an hour tracking down where a particular TextMate bundle was coming from, I have surmised that there are no less than four places on my Mac’s hard drive where bundles may be lurking. In no particular order, they are:

    ~/Library/Application Support/TextMate/Pristine Copy/Bundles
    ~/Library/Application Support/TextMate/Bundles
    /Applications/TextMate.app/Contents/SharedSupport/Bundles
    /Library/Application Support/TextMate/Bundles
    
  • Sending mail from Rails through Google SMTP

    I just ran into a problem configuring a Rails app to deliver email through Google’s SMTP servers. ActionMailer doesn’t support TLS/SSL which is required by Google. Fortunately, the action_mailer_optional_tls plugin provides this functionality.

    I wanted to host my SMTP settings in an external YAML file so I wouldn’t end up checking my username and password into the repository. (The YAML file is placed on the production server and a softlink is created during each deploy.) For some reason, I kept getting “connection refused” messages whenever I tried to send email with this configuration:

    # smtp.yml
    production:
      address: smtp.gmail.com
      port: 587
      tls: true
      domain: foo.com
      authentication: :plain
      user_name: someone@foo.com
      password: secret
    
    # production.rb
    smtp = YAML::load(File.open("#{RAILS_ROOT}/config/smtp.yml"))
    ActionMailer::Base.smtp_settings = smtp[Rails.env]
    

    The problem was the hash returned by YAML. The keys were strings, whereas ActionMailer was expecting the keys to be symbols. The fix was to make the hash use indifferent access:

    ...
    ActionMailer::Base.smtp_settings = smtp[Rails.env].with_indifferent_access
    

    That cleared up the “connection refused” problem. Now my app is sending email like a champ.

  • Tweaked railspdf to support 2.1.0

    railspdf is a plugin that adds templating support for the pdf-writer gem to Rails. The project was last updated in January of 2007, but worked fine up until the 2.1.0 release of Rails which broke several things.

    I’ve forked the project on GitHub and tweaked it to run under 2.1.0. I also added support for custom helpers. Your PDF templates can now call methods in helpers with the same name as your controller (which is the expected behavior anyway). I’ve also started maintaining a CHANGELOG.

  • When hot corners stops working…

    OS X seems to get confused when I disconnect my MacBook from an external monitor. This confusion sometimes leads to the hot corners feature not working. This is definitely a bug in Leopard that needs fixing. Until that happens, restarting the Dock is a quick solution to the problem. This can be done through the Activity Monitor, but I think it’s easier to just run this script which I stole and modified:

    #!/bin/sh
    DOCKPID=`ps aucx| grep Dock | awk '{ print $2; }'`
    kill $DOCKPID
    
  • Embedding Google Charts in FXRuby

    Lyle Johnson just wrote a great tutorial on how to integrate Google Charts into an FXRuby application. This is perfect timing since I’ve been doing some experimenting with FXRuby over the past few days.

  • Exploring Google Charts with the gchartrb gem

    Google quietly released their new chart generation web service late last year. It’s a dead simple way to build beautiful charts using nothing but URLs. The gchartrb gem wraps Google’s API to make things even easier. InfoQ recently published this article that I wrote. It introduces the basics of the API and gives some examples of how to use gchartrb to create beautiful charts.

  • Installing FXRuby on OS X

    Thought I’d do some hacking on FXRuby today. I ran into trouble during the installation so I’m posting the solutions here in case anyone else experiences the same issues.

    I attempted installing the fxruby gem first, but didn’t get very far. I ended up having success with the rb-fxruby package for MacPorts so I highly recommend going that route.

    Make sure you uninstall and clean the gem if it’s already installed:

    gem uninstall fxruby
    gem clean fxruby
    

    Now install the MacPorts package:

    port install rb-fxruby
    

    This might take a while. You may have to run the command twice if you get a failure the first time through. Now copy and paste this script into a .rb file and try running it:

    require 'rubygems'
    require 'fox16'
    
    include Fox
    
    app = FXApp.new
    win = FXMainWindow.new(app, 'Hello World')
    
    app.create
    win.show
    
    app.run
    

    You should see an error message that looks something like this:

    FXRbApp::openDisplay: unable to open display :0.0
    

    It means your X11 terminal isn’t running. You can find it in /Applications/Utilities. Double click to launch. If you roll with Quicksilver, you should be able to type in X11 and launch it that way. Once launched, run the Ruby script again and you should see a tiny window with the title “Hello World.”

  • Brightkite is fun

    I’m really enjoying using Brightkite. It’s a location-based social networking tool that lets you see what other people in your vicinity are doing. A GPS unit isn’t required and it integrates fairly well with Twitter and GMaps. (I’d love to see even tighter Twitter integration in the future.) Drop a comment on this post if you want an invite.

  • How does PersistJS compare to Gears and Dojo?

    PersistJS was released just a few days ago by Paul Duncan. It’s a JavaScript framework enabling client-side data storage. Check out my post on InfoQ to learn how it compares with Google Gears and Dojo Storage.