Wednesday, October 31, 2012

Setting up Puma & Rails on Heroku

I just moved Adstaq over to Puma this weekend because I want to experiment with a multithreaded server as a way to keep our web serving costs down and our efficiency high. We're already doing this with Sidekiq for our worker code, to great effect, and philosophically I much prefer plain old Ruby threads over other Ruby concurrency solutions. Dave Copeland gave a GREAT talk at RubyConf last year called Don't Fear the Threads which I highly recommend for further inspiration.

It took some trial and error to get Rails talking to Puma and to get everything running on Heroku, so I put the needed code into a gist, embedded below.

I'm monitoring the change on New Relic but so far have not noticed any memory savings vs. Unicorn. But we're also not drowning in traffic right now. Nonetheless I'm glad we're getting some Rails multithreading experience before that happens.

Update: Watsi posted some great instructions for adjusting ActiveRecord's connection pool size.

Monday, October 22, 2012

Family calendar setup with Google Apps

A friend was recently admiring the calendaring setup my wife and I use to keep track of childcare and our professional schedules (so each of knows not to schedule something at a time when there's no childcare and the other parent is unavailable). The killer feature is that we each have access to the same calendar with the latest schedule data available to us at all times.

It took a while (and a few different iOS releases) to get it right, but here's what we do:

  • We both have personal online calendars where we track appointments that occur during the work day; these are things the other parent doesn't need to know about. We both have iPhones (though I'm switching to Android soon) but we don't use the iPhone calendar for this purpose. Instead, our phones are synced to our personal Google Calendars via Gmail Exchange. I found Apple's calendaring products very subpar, especially with syncing between the desktop and mobile devices. Also, GCal's integration with Gmail is pretty awesome.
  • I setup a Google Apps account at a custom domain that hosts two shared calendars: "Family" and "Childcare". These also use Gmail Exchange. We put stuff that we're both doing (like "Take kids to the zoo") or stuff that impacts the other parent (like "Ignite Baltimore #11") on the Family calendar. We also put stuff like "Grandma visiting" on the Family calendar. We track the ever-shifting babysitter and nursery-schools schedules on the Childcare calendar.
  • We both subscribe to my TripIt account, which automatically generates a nice travel calendar. That saves me having to manually key-in travel itineraries, which if you travel a lot is pretty awesome.
One thing that makes all of the above harder than it ideally needs to be is getting Google mobile sync working properly. But I just checked out the documentation and it looks much-improved from the time I first set all of this up.

Having shared calendars has been a huge stress-reducer for our family, cutting down on many boring logistics and scheduling conversations. Someday soon I'm sure we will be adding individual kid calendars to our setup.

If you have questions about how to do something similar, hit me up in the comments!

Monday, October 15, 2012

Ruby Dependencies, Notifications, and Adjustments

Here are the slides for the Ruby Dependencies, Notifications, and Adjustments talk I've recently given at DCRUG and Bmore On Rails:

https://github.com/subelsky/tkn/blob/master/examples/ruby_dna.rb

The talk discusses the object peer stereotype concept introduced in the book Growing Object Oriented Software, Guided by Tests. I also mention Jim Weirich's post about Ruby Dependency Injection.

I used the experimental terminal keynote software to make the slides. It was pretty fun writing my slides in Ruby, and I'd definitely recommend using it for code-heavy talks like this one. But if you need diagrams or something more visually-stimulating I'd recommend sticking with GUI-based software.

Wednesday, October 10, 2012

Developing a software education industry in Baltimore

I recorded a video for Technically Baltimore's new series "One Big Idea". My big idea is about creating a new software education industry in Baltimore:


The ideas here build on an earlier post of mine, Towards a New Paradigm for Software Education. They also dovetail nicely with something Anil Dash wrote, The Blue Collar Coder.