Blog


A blog about security, privacy, algorithms, and email in the enterprise. 

Viewing entries tagged
rails

1 Comment

Behind the Data: Sean Kermes

Hello and welcome to our Behind the Data series, in which we aim to give you deeper insight into the minds and personalities of those who make up this eclectic, close-knit group. We are developers, marketers, and technical support engineers, and, at work, we craft everything from Microsoft reporting APIs to mobile email applications, race against the machine during hackathons, build architecturally sound beer towers during retros, and paddle down the Charles during the warmer months. And outside work? Outside work, things get all shook up. 

Alors. Without further ado, allow me to introduce you to employee number 1: Sean Kermes, Software Developer.

1. What do you do?

Write software and swear at computers.  Developers here work on pretty much the full stack, so I’ve got my fingers in everything from CSS and Javascript to Rails and CouchDB.

2. What are you listening to right now?

The Gold We’re Digging by Parts & Labor

3. Describe your personal style in one word.

Metagrobolized

4. Fill in the blank. Contrary to popular belief I  ________. I’m not sure it counts as a popular belief, but I once had a man on the 71 bus very earnestly tell me that I should go live in Alaska.  Apparently if I showed up with a roll of quarters and the clothes on my back then the country’s largest state would take care of me.  This is, in fact, not true.  While I enjoy snow a little bit I don’t think I’d fancy a winter quite that long, and I always kind of think moose are up to something.

5. If you could build any app, what would it be and why?

Maybe this isn’t a problem everyone has and it’s just me, but I’m constantly running across links or videos or blog posts or whatever that either a) I know I’m going to need/want sometime in the future, but not right now or b) are just generically cool but not of any immediate significance.  I’ve experimented with lots of places to put these like delicious (or its many offshoots), random notes files in dropbox or sticky notes in a file somewhere, but all those have the same problem: they do an excellent job at storing the data, but are terrible at reminding me about it.  I’ll find something like a Chrome plugin that lets you have ssh sessions in your browser, which is really cool, but I don’t want to use it now (it’s in beta, I don’t have any strong need for it, etc) and so I’ll file it away for later and then when it’s later and I actually could use it, I don’t even know it exists.  If I remembered I could easily search my delicious for it, but I don’t even remember that there’s something worth searching my delicious for.  What I’d really like is something that I can feed links to, and it’ll periodically (maybe every morning?) pick one at random and tell me about it.  That way these cool things can stay at the periphery of my attention, and while I might not get reminded about them exactly when I need them, they won’t be lost down the memory hole forever.

6. What 3 things would you bring to a deserted island? A record player, a copy of London Calling and a robot that I can set to press a button every hundred minutes or so.

7. When did you last laugh? I laugh exactly once a year on April 16, when the winners of the latest round of the Lyttle Lytton contest go live.

8. What is the last thing you bought? Excluding lunch, I recently upgraded my work peripherals with a Das Keyboard, a Microsoft Arc Touch Mouse, a Whitelines notebook and a Lamy Safari fountain pen.

9. What are your biggest pet peeves? I made the mistake of reading something on the internet the other day, only for someone to (without a trace of irony) use the word ‘irreguardless’ in a sentence.  I think I threw up a little in my mouth.  There are so many things that have to go wrong before that word makes its way across a keyboard, it boggles the mind.

10. Name something that makes you smile. The word ‘assassafrassinate.'  There’s a line somewhere between wordplay and incompetence that makes ‘irregardless’ terrible and ‘assassifrassinate’ wonderful, but I’m not certain where it is.

11. If you could teach a college course what would it be? CS 350 – How to Actually Write Software.  A lot of practical software development skills –version control, testing, how to effectively collaborate with a team, planning and estimation to name a few – are largely ignored or glossed over in a traditional CS curriculum, or at least were in mine.  The most common reason for this I’ve heard is that a Computer Science degree is supposed to impart you with theoretical knowledge about computation, rather than prepare you to be a worker bee in the engines of industry.  That may be true, but it ignores the fact that even in the rarified air of academia people still need to produce useful software, and that doing that is orders of magnitude easier when you have the right tools.  I use git on every piece of code I write, even projects that never leave my local machine, because it’s just that useful.  In my entire time as an undergraduate I never had a professor suggest that I should write an automated test suite to make sure that my code was doing what I thought it was.  In retrospect, I wouldn’t be surprised if writing effective tests wouldn’t have bumped a few of my projects up a letter grade.  If that would have been so useful to me as a student, I can’t imagine it wouldn’t be just as useful for postgraduates and researchers.  Given that these techniques are so fundamental to just about every level of writing code, it’s downright absurd and foolish that they aren’t more widely taught.

1 Comment

Comment

Getting Started with Heroku (Ruby on Rails edition)

So What's Heroku?

Heroku is effectively a cloud-based web application platform. By using it you don't have to worry about any physical hardware - Heroku'll take care of it. This is pretty groovy when you just want to put a site up and not worry about getting the actual boxes plugged in and running. On top of that, Heroku supports most of the trendier platforms and languages. In particular, they support Ruby on Rails, which we'll be using here. Pricing can be a little tricky, but for a quick application, one web worker thread with the smallest shared database is free. This is enough for our purposes. We'll be assuming that Ubuntu 11.10 is the operating system of choice.

Setup your Account

The first thing that needs to be done is setting up your account. The signup page is pretty straight forward. Heroku is nice enough to link everyone to their own quick start guide, which we will be paraphrasing here. You'll first want to grab the Heroku toolbelt, which is a client-side application that you can use to manage your applications. On Ubuntu, you just need to run...

wget -qO- https://toolbelt.heroku.com/install.sh | sh

...to install the toolbelt. Typing...

heroku login

...will prompt you for your Heroku username and password. It will also ask if you want to generate and upload a SSH key for your account - you'll want to do that so you don't need to later. At this point you have a working Heroku user account and can authenticate against it.

Installing Ruby and Rails

For whatever reason, this can be kind of tricky on Ubuntu, particularly if Ruby or Rails is already on the system or was installed by aptitude. Luckily, we've made a script that takes a lot of the pain out. It is specifically for Ubuntu 11.10, but feel free to modify it to serve your purposes:

#! /bin/bash
sudo apt-get update
sudo apt-get install build-essential git-core curl postgresql libpq-dev
bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)
echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"' >> ~/.bashrc
. ~/.bashrc
sudo apt-get install build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison subversion
rvm install 1.9.3
rvm --default use 1.9.3
gem install rails -v 3.2.1
Basically, it will update Ubuntu with aptitude, install a number of Heroku dependencies like Postgresql, and then grab RVM, the Ruby Version Manager. It uses this to install Ruby and Rails. One should do it this way on Ubuntu, and never directly with aptitude.

Creating your Application

You'll want to make a new folder for this - let's place it in ~/projects. From the projects directory, do...

heroku create --stack cedar

This will have Heroku create your actual application. It will have an application name in the form of adjective-noun-####. If you open a browser window and visit adjective-noun-####.herokuapp.com, you should see a Heroku welcome page. It's easiest to pull down the repository via git to actually put rails on it. For this, you should do something like

git clone git@heroku.com:adjective-noun-####.git

The actual repository is empty at this point, but the clone operation will create the application folder in your projects directory. We're now going to do something loosely like the guide here. First, we need to create our Rails app locally. From the projects directory, we can create it with

rails new adjective-noun-####

This will populate your application folder with a Rails skeleton. We then need to swap out the sqlite3 gem for the PostgreSQL gem from the Gemfile in the root of the application folder. Just change...

gem 'sqlite3'

...to...

gem 'pg'

and then run 'bundle install' to grab the correct PostgreSQL gems. We can then commit and push our changes to our Heroku server with

git commit -a

git push origin master

If all goes well, Heroku will compile and run the pushed Rails app. If you visit your application web site in a browser, you should see this:

If so, all is well, and you now have Ruby on Rails running on the Heroku environment.  Happy hacking!

 

Comment