Programming on the Toilet

Bob Roberts:

This is so true. I usually get my epiphanies at the end of the day in the shower. :)

Originally posted on Eat. Sleep. Code.:

It’s 5PM. I’ve been working on the same code for hours, grinding out an implementation one line at a time. It’s been a torturous process. Some days, code just naturally flows from my brain to my fingertips. This is not one of those days.

View original 697 more words

Leave a comment

Posted by on July 12, 2014 in Ruby on Rails


Exploring Rails: Single Table Inheritance

Bob Roberts:

As usual a great article by Ramon!!

Originally posted on Project Ramon:

Hello and happy Wednesday!

In the last post, we covered a solution towards using the Rails’ Form Helper accepts_nested_attributes_for to give us a convenient ability to create data fields for multiple models to save and retrieve. This is also known as creating a multi-part form.

At the time I hadn't figured out how to implement Single Table Inheritance properly, and instead created 2 phone number classes to represent a primary and secondary number. After some quick looking around, I found some pretty insightful tutorials that allowed me to use STI in order to DRY out my two redundant classes from the last post.

What I did Wrong

Lets take a quick look at the code from my last post, in order to demonstrate the problem and set the stage for implementing STI properly in Rails.

I was having an issue with seeing the attribute fields commit or retrieve the…

View original 670 more words

Leave a comment

Posted by on July 9, 2014 in Ruby on Rails


WebSocket over Nginx

Bob Roberts:

Great write up for Websockets and Nginx (and you should be using Nginx!!)

Originally posted on Josh Software - Where Programming is an Art!:

How often do you find that the awesome movie seats you have painstakingly chosen for yourself, is suddenly not available when you proceed to pay for it. “Damn it! Just missed!” you say. Wouldn’t it be  great to be guaranteed the seat you selected everytime!

The problem with the above scenario (as is  with most e-commerce portals) is that, if two users almost simultaneously  select same seat and checkout to book, the seat will be booked with the user who has clicked first. The other user will be redirected to same page with message the Seat has already been booked. We all have used Indian Railway Website and this problem really gets me frustrated.So I wanted to build system in which the seat I select always gets booked.

To avoid this problem, I came up with two solutions

Auto Refresh every 2 seconds (like cricket scores on

  • This would…

View original 732 more words

Leave a comment

Posted by on July 8, 2014 in Ruby on Rails


Ericsson Supports Girls

Bob Roberts:

We need a group in Phoenix

Originally posted on

RailGirls that is. If you have never heard of it before, RailGirls’ aim is to give tools and a community for women to understand technology and to build their ideas. They do this by providing a great experience on building things and by making technology more approachable.

Rails Girls was born in Finland, but is nowadays a global, non-profit volunteer community, and recently held an event in Galway which Ericsson supported with sponsorship and engineers.

If you missed it, don’t worry, I’m sure there will be future events soon, but in the meantime, this might give you a feeling for one of the events if you think RailGirls might be for you and you think you might like to attend:

Ericsson Master Engineer Gerry Kavanagh at RailGirls Galway

View original

Leave a comment

Posted by on July 8, 2014 in Ruby on Rails


Rail Unicorn server start on server boot

So this weekend we were having some power outages where our onsite servers are located.  When the servers booted back up, Unicorn server was not running.  This was quick and easy to fix using the capistrano-unicorn gem:

If you get a generic looking 500 page then it may be the Unicorn server. You can check if Unicorn is running using ps aux as well. There should be one master and 5 workers running. If not you can use:

cap unicorn:reload # Reload Unicorn
cap unicorn:restart # Restart Unicorn
cap unicorn:show_vars # Debug Unicorn variables
cap unicorn:shutdown # Immediately shutdown Unicorn
cap unicorn:start # Start Unicorn master process
cap unicorn:stop # Stop Unicorn

Remember to use the development/staging/production in between the cap and unicorn (e.g. cap development unicorn:stop) In general, I would just use stop and start. It gives pretty good errors when you run it.

But that is a reactive fix and we want to be proactive and not think about these things on the weekend.  So, I tried a few other things like Monit but I could not get it to play nice with Unicorn and even then I realized that there was nothing setting Monit to start on server boot.  I read a couple of things about Bluepill gem and I decided to give it a try.

First off I added the Bluepill gem to my Gemfile but that did not seem to work so I installed on the server:

sudo gem install bluepill

Following the Github README, I created /var/run/bluepill directory for bluepill to store its pid and sock files.

Next I created a Bluepill configuration file in path/to/app/config and named it production.pill.  Bluepill can use different pill files based on the environment.

Bluepill.application("my_app", log_file: "/var/www/my_app/shared/log/bluepill.log") do |app|
  app.process("unicorn") do |process|
    process.working_dir = "/var/www/my_app/current"

    process.start_grace_time = 20.seconds
    process.stop_grace_time = 20.second
    process.restart_grace_time = 20.seconds

    process.pid_file = "/var/www/my_app/shared/pids/"

    process.start_command = "bundle exec unicorn -c /var/www/my_app/current/config/unicorn.rb -E production -D"
    process.stop_command = "kill -QUIT {{PID}}"
    process.restart_command = "kill -USR2 {{PID}}"

    process.uid = "deploy"
    process.gid = "deploy"

We will want to test to see if Bluepill is working.  First we need to load the Bluepill configuration file and start it:

$  sudo bluepill load /var/www/my_app/current/config/production.pill

$  sudo bluepill status

Now we should have Bluepill monitoring our unicorn.  I tested this by stopping the unicorn server and checking the application and sure enough, the Unicorn master was restarted by Bluepill.  You can also watch the Bluepill logfile with sudo bluepill log unicorn.

So now that is all up and running, we need to make sure that Bluepill is started when the server boots.  Create a bluepill.cong in the /var/init/ directory and add this:

description "My App Bluepill"

start on runlevel [2]
stop on runlevel [016]

expect daemon
exec bluepill load /var/www/my_app/current/config/production.pill


Leave a comment

Posted by on June 15, 2014 in Ruby on Rails



The 20 Highest-Paying Jobs You Can Do From Home

Bob Roberts:

I never liked law and I do not have a great voice. So Ruby Programmer it is :)

Originally posted on Rajesh Paul:

U.S. businesses will spend half a billion dollars hiring remote freelance workers in2014.”The growth is a clear indicator of a transition of work online,” says Fabio Rosati, CEO of Elance-oDesk.The company’s platform – which serves as a broker between companies that need skills and freelancers eager to supply them – sees 2.7 million freelance jobs posted a year. According to the company, the total earnings of freelancers have grown 50% compounded annually over the past five years.From Rosati’s perspective, so many businesses are hiring these workers because they need work done on demand, often for a short stint. In those cases, a marketplace like Elance-oDesk becomes like the Amazon Prime for jobs. It’s a win for the employer, who can hire on an as-needed basis, and for the worker, who has flexibility of schedule and location.

What’s more, freelancers with the right skills can earn a great living from the comfort of…

View original 36 more words

Leave a comment

Posted by on June 15, 2014 in Ruby on Rails


Ruby on Rails Developers Phoenix AZ WANTED

I am looking to bring on a few Ruby on Rails developers to work in-house in Downtown Phoenix AZ.  This is a once in a life time opportunity to get on with a well funded and solid startup.

Here is the ad part:

SocialWhirled is hiring multiple Ruby on Rails developers.

Our developers work onsite in a beautifully remodeled facility in downtown Phoenix.  We will building our in-house team from the ground up, so this is a chance to get in on the ground floor.  Every developer with SocialWhirled will be an intricate part in taking SocialWhirled to the next level.

The successful candidates will be responsible for developing web applications within the Ruby on Rails framework. The individuals must have strong technical skills, be independent and resourceful, be able to communicate and collaborate effectively, and be able to thrive in a fast-paced startup environment.

What you will do:

  • Write clean, maintainable and efficient code
  • Contribute in all phases of the development lifecycle
  • Follow best practices (test-driven development, continuous integration, SCRUM, refactoring, code standards)
  • Experience in web development using the Ruby on Rails web application framework
  • One to three years general programming experience
  • Proactive and resourceful person who achieves with minimal oversight
  • Team player with the ability and desire to become an integral part of a fast-paced team

What you will need:

  • Demonstrable knowledge of front-end technologies such as JavaScript, HTML, CSS & jQuery
  • A firm grasp of object oriented analysis and design
  • Passion for writing great, simple, clean, efficient code
  • Good knowledge of relational databases
  • A great attitude and sense of humor

Mid level skill or better is preferred.

These positions are available immediately.  Salary is DOE.  Please email important data to Resumes, Github account, portfolios, and samples of work are relevant to our interests.

Leave a comment

Posted by on June 12, 2014 in Ruby on Rails


Tags: , ,