Tech Demo

1 Comment

So in preparation for Rails Rumble I’ve been researching a lot of sexy little plugins.  We have also had a need to test this plugins to make sure they’ll work not just locally but in a shared hosting environment (the first time you get burned and spend an entire weekend, 16 hours, trying to figure out why something that works perfectly on your local box dies horribly on shared hosts you learn to test everything).  To accomplish this testing we’ve needed a small little app so I can get the bare minimum for the plugins in there.  I’d like to post everything I did while I wait for Lynn to push everything up to test. Mostly this is just a quick run down because someone else has already done a far better job than I could explaining in depth how to install and configure all this stuff. This is also by no means how you should do any of this, this is solely for testing out various plugins and packages.

The plugins, gems, and kitchen sink

What I’ve got up and working on my local box so far is:

  1. Simple Email Notification with ActionMailer
  2. SMS Fu
  3. Twitter4r
  4. Gravatar Profile Image
  5. Juggernaut
  6. BackgrounDRB
  7. GoogleCalendar/ICal

Simple Email Notification

Won’t really go into this, it’s obvious and everyone has done it a million times


  • Clone it
  • Include it
  • Put this code in there:


def index
@carriers = %w(alltell ameritech at&t bellsouthmobility blueskyfrog boost cellularsouth helio kajeet metropcs powertel pscwireless qwest southernlink suncom t-mobile virgin verizon)

def text_message
deliver_sms(params[:pages][:phone_number],params[:pages][:carrier],"Test Text Message")
redirect_to :action => 'index'


<% form_for :pages, :url => {:action => :text_message} do |f| -%>
Phone Number: <%= f.text_field :phone_number %>
Carrier: <%= :carrier, @carriers %>
<%= submit_tag "Send Text" %>
<% end -%>


  • Install the gem
  • require the gem
  • Use the following code


def twitter_message
client = => params[:pages][:user_name], :password => params[:pages][:password])
if client.authenticate?(params[:pages][:user_name], params[:pages][:password])
new_message = client.status(:post, params[:pages][:text_message])
return redirect_to :action => 'index'
flash[:notice] = "Failed to authenticate"
return redirect_to :action => 'index'


<% form_for :pages, :url => {:action => :twitter_message} do |f| -%>
Twitter User Name: <%= f.text_field :user_name %>
Twitter Password: <%= f.password_field :password %>
Text To Post: <%= f.text_field :text_message, :limit => 140 %>
<%= submit_tag "Send Twitter" %>
<% end -%>


Just use the code in your application helper


  • Make sure you have json and eventmachine installed
  • install the gem
  • install the plugin
  • juggernaut -g juggernaut.yml (to make the config file)
  • Use the following code
  • juggernaut -c juggernaut.yml (to start the push server)

Layout (or anywhere you want to use Juggernaut)

<%= javascript_include_tag 'juggernaut/swfobject' %>
<%= javascript_include_tag 'juggernaut/juggernaut' %>
<%= juggernaut(:channels => ['chat', 'notifications']) %>


<ul id="chat_data" style="list-style:none">
<%= form_remote_tag(
:url => { :action => :send_data },
:complete => "$('chat_input').value = '#{}'" ) %>
<%= text_field_tag( 'chat_input',, { :size => 20, :id => 'chat_input'} ) %>
<%= submit_tag "Chat" %>
<ul id="notification_data" style="list-style:none">


- :port: 5001
:public_port: 5001


  • install chronic and packet requirements
  • Clone the code
  • rake backgroundrb:setup
  • ruby script/generate worker notifications
  • use the following code
  • ruby script/background start (to start the backgrounDRB)


:port: 11006
:start: <%= + 5.seconds %>
:end: <%= + 1.year %>
:repeat_interval: <%= 5.minutes %>


class NotificationsWorker < BackgrounDRb::MetaWorker
set_worker_name :notifications_worker
def create(args = nil) 'created worker'

def check_notifications
if true 'sending notification'
Juggernaut.send_to_channel("new Insertion.Top(\"notification_data\", \"<li>Sending Notification at #{}<\/li>\");", "notifications")


<ul id="notification_data" style="list-style:none">


  • Install the gem
  • require the gem
  • Use the following code
  • Add to Google Calendar to check your work


def calendar
@cal =

[{:name => 'Meeting', :start =>, :end =>},
{:name => 'Greeting', :start =>, :end =>}].each do |comp|
event =
event.start = comp[:start].strftime("%Y%m%dT%H%M%S")
event.end = comp[:end].strftime("%Y%m%dT%H%M%S")
event.summary = comp[:name]
@cal.add event
headers['Content-Type'] = "text/calendar; charset=UTF-8"
render :text => @cal.to_ical, :layout => false

What you will end up with is a very ugly little app that will look like this:

Phone Conversions


I’ve become a fanboy.  I keep telling myself no, but slowly I’m coming to terms.  Last week I picked up an iPhone (bought off ebay so I wouldn’t have to extend my ATT contract).  So I’m going to list some thoughts, and I’m going to compare it to my steallar little Nokia E70 that I had before.  This should hopefully be both similar and contrasting to something that a good friend Michael wrote here on his phone changing experiences.

Let’s start with the Pro’s of the iPhone:

  • Beautiful large display screen
  • Novel multitouch navigation
  • Accurate GPS
  • Almost Fully Functioning Web Browser
  • Nice Looking Applications

The Screen

The screen is on par, if not better, than the screen on iPod 5th Gen that I have, and at over double the size it’s amazing.  I’ve been watching Dr. Horrible on it and just amazed at the clarity (this also really gets me interested in buying movies and shows off iTunes, except for their crappy interface for letting me download my content onto multiple computers). Applications look great and you can see details almost on par with my 1920×1200 Mac Book Pro.

The Multitouch

The multitouch is a neat thing to play with for a while.  Similar to DS stylus, this can add a lot of functionality for some stuff and can make for frustrating user experience for other stuff.  Moving around Vay ( a remake of a Sega CD RPG is horrible, while moving around Google Maps is great.

GPS Functionality

The GPS functionality almost makes me want to drop the money for an iPhone SDK and learn Objective C, because it’s accurate enough that you could make a lot of neat apps for it (and looking at the app store people are already starting).  This is my first time having built in GPS in my phone (my car has an awesome GPS system in it) and just imagining the possibilities of things you could do with it has me excited to see what other developers can come up with.

Safari in your pocket

This would be the one thing I think that makes it worth while to get an iPhone.  Although the Nokia’s browser is pretty good, some of the stuff it does can really ruin a web experience (not rendering CSS right, sometimes barely rendering anything at all).  As someone who does web development for a living, and whose secondary job is just keeping up with all the new developments and sites coming out on the internet (Lynn keeps me well informed), this is almost a necessity.  I don’t think I could ever go back to an experience less than the standard the iPhone has set, the large screen, speedy connection and near full featured experience has really made me question how I could live with out it.

Look at the pretty little app

The application designs for most things, looks great.  I’ll talk about the cons of the UI a bit later.  The applications with reflective surfaces and easy to understand buttons.  Every app has a very iPhone feel to it, and you are fairly comfortable moving between apps without the bone jarring feel of a completely different layout, and completely different icons.

Now on to the cons:

  • Text entry sucks
  • The UI layout is pretty bad
  • Working with iTunes and multiple computers is impossible
  • Just using touch controls is irritating

Text Entry or how the helk van u tuoe on thus thomg

Coming from the Nokia E70 with it’s flip out real QWERTY keyboard to the iPhone’s virtual keyboard was and still is a real challenge.  Typing on the Nokia had the feel of a real key being depressed and the keys were big enough to type with my thumbs, typing on the iPhone has no tactile feedback and the touch screen makes for some pretty inaccurate key presses when trying to use it to type in the vertical position.  I’ve read enough about it to know to just type the words you’re trying to get and the iPhone will hopefully figure out the word you’re typing and replace it when you hit space.  That works somewhat, however, as someone who prides himself on not using all the acronyms that have sprung up, and who tries to spell everything right, this is annoying when you type in a full word, only to realize that the iPhone has no idea what you’re typing.  Even when everything is working perfectly and it’s correcting my typing mistakes I still type slower than on the real Nokia keyboard.

The UI

The UI on the iPhone really annoys me, menu’s are the worst offender, where you have to hit the upper left corner to go back to the previous level.  The problem with that layout is normally I’m using my right hand to hold and navigate my phone, so I have to move my thumb up to the top of the phone to press the button or I’ll have to bring a second hand into the action, with the phone laying down this isn’t a bad thing, but I hardly ever use the iPhone on a flat surface.  Other things about the UI bother me, how it takes more than one key press to bring up certain things like voice mail.  The whole SMS process, while neat that it displays it in a chat like format, is extremely hard to use and figure out.

iTunes and multiple computers

While I generally like iTunes for managing content on my iPod the iPhone is a different story.  Unbeknownst to me, who figured it would work just like an iPod, I setup my iPhone on my MBP laptop, intending to also set it up on my home desktop since I tend to keep only one copy of my downloads and then just connect the device to the computer that has what I want.  Once I got home with the iPhone and attempted to set it up to my desktop I found out that I couldn’t actually access my items on my desktop without first syncing it to my desktop and losing everything, which would mean that I would no longer be able to sync it to my laptop.  This is annoying because this system has worked for almost a year with my iPod with no problems.  Now I have to make sure that my PC and Mac sync up and share their iTunes libraries so that I can access all my content, not a major problem, but a giant inconvenience.

Only Touching

This is probably a giant limitation to the iPhone.  I understand they were going for the sleek and elegant look and didn’t want a bunch of buttons and knobs and whatnot on their phone, however this limits the iPhone to just the touch based approach, and honestly somethings would be a lot better with a different mode of input.  What I’m imagining is actually similar to the DS, where you would have a little directional pad and maybe a button or two.  This would allow you to navigate certain programs (like the RPG mentioned above) that aren’t conducive to the touch only mentality.


The iPhone is a neat gadget and some things like the web browser really make an experience for me.  However I think that I might be happier with my Nokia as a phone and an iPod Touch as a web browser (if I could get one that would connect to the internet via my Nokia’s bluetooth connection and use the GPS functionality of the bluetooth GPS receiver).  It’s a nice phone and well designed, but I feel like there are some fundamental flaws in the way it does things and the things that it does really well have nothing to do with actual phone functionality.  I’m going to stick with the phone for a while to see how it fares after more than a week’s use, I’m hoping I’ll grow to understand the reasoning behind some of the things I think of as flaws, and if not, then at least there are some Android phones down the pipeline, not to mention some really cool stuff coming out of Nokia.

On Conversion

No Comments

This week, after running into one RubyGem too many that was required to be compiled, I’ve switched over to the Mac for development. For the last 4 months (since I bought the 17inch MBP) I’ve been flirting with development on it. Until now it’s been the trophy wife that has been trotted out when I needed to do something “unixy”.  The transition hasn’t been easy, years of UltraEdit and Windows have engrained a muscle memory of hot keys deep into my subconscious.  I’ll go over some of the pros and cons I’ve noticed in my first 3 days as a hard core mac only user.


  • It’s pretty – I am still blown away by how even little things are pretty in MacOS.  Things like the dock, the icons, even the transition between desktop spaces, are fun to just look at.  None of these things are extremely new to me (Windows Vista has a very pretty task switcher and Ubuntu’s Compiz has a neat desktop transition). But the amazing thing is that as pretty as it looks all those things don’t seem to slow it down.
  • Hot keys – It seems like there is a hot key for everything. As I start to learn more and more of them I’m starting to need the mouse less and less.
  • It’s a Unix environment – Things like the terminal, compiling, SSH are all built in. You don’t have to use DOS which is like a crippled kid, compared to a Unix terminal.  You don’t have to deal with running one “administrator” console and one “normal” console.
  • Unix Programs – You can run things like memcached (this is important because some of our sites have gotten to the point where we need it, and this way I don’t have to setup a special environment where memcached isn’t running.


  • The trackpad sucks – I don’t know what it is, the giant track pad just doesn’t seem to work as well as any of my other laptop’s track pads.  I could hook up a wireless mouse, but when I’m sitting outside or in my recliner working a mouse isn’t feasible.  It also lacks a right click, why I just need one giant button is beyond me.
  • The keyboard layout – I’m almost certain the mac keyboard is a slightly different size than a standard pc keyboard.  Not to mention the lack of a 10-key pad even on the large 17 inch laptop.
  • The Apple, Option and Ctrl keys still trick me – muscle memory works against me ctrl+s doesn’t save my document.  Ctrl+arrow doesn’t jump around words.  I’m still trying to teach my fingers where they need to be to do things that I don’t even think about in windows/unix machines.
  • Task switching – I love alt+tabbing (apple+tabbing) and when the task switcher comes up I don’t see 20 things, however you pay for that because firefox browser windows are all open under the same task and to switch between windows in a task you need to push F10.  And I have to admit that besides F1-F5 I don’t tend to use the function keys in Windows/Unix.

So far I love TextMate, as limited as my understanding of the hotkeys are it seems like anything I want to do can be done by typing a little then hitting a button and it will do the rest for me.  I love going into a terminal and typing “mate project” and it opens my entire project up.

I also think that the 1920×1200 resolution is a bit too high for a 17 inch monitor (yes I’ve got oodles of desktop space but the font is a little impractical).  Watching movies on it looks amazing (if only it came with a bluray player).

Working with Rails on the Mac is a dream.  You have the ultra powerful text editor with TextMate, and you also have the ease of working in a Unix environment.  Something needs to be compiled?  No problem, you don’t need to install mingw or visual studio, spend hours setting it up, send the right flags.  This also applies to things like SSH.  Working with a private/public based ssh keys in windows with putty, was alright, but had serious limitations.  I installed OpenSSH on windows then spent hours upon hours configuring and getting it to finally work with key (which after about 5 hours I did get it working exactly like a Unix ssh environement).  With my Mac I do the same thing I have done a half million times in Linux, took me 30 seconds.

I can see now why so many Rails developers sound like Apple fanboys.  After working with Windows so long I had learned to work around strange errors and compile problems and turn a blind eye to all the issues I had, because I knew the environment I could whip out code from memory, hot keys were all based on muscle memory, but I seemed to be living in a very primitive age, one where all the time I saved not learning a new environment was lost fixing random errors and problems working in that environment.

The one thing I’m still wary about is using both a Windows/Linux OS at the same time as the Mac OS.  It’s easy to fall into old habits and just go back to what you know and feel safe with (it’s what happened about 2 weeks after I got my Mac).  I’m in the process of getting my boss to get a Mac or Mac Clone for me so I can go into total Mac Goodness immersion.