Ubuntu and Amazon on Demand – Make it Work

Running into this error when trying to watch Amazon on Demand on Ubuntu?

An error occurred and your player could not be updated.  
This is likely because your Flash Player or Browser needs to be updated.
This update is required to play back this video.

You’re not alone. ┬áTo get Amazon on Demand to work with Ubuntu 13+, close your Firefox browser, then run the following commands and restart firefox:

sudo add-apt-repository ppa:mjblenner/ppa-hal
sudo apt-get update
sudo apt-get install hal

Why this works: Ubuntu deprecated HAL from 13.10 forward. HAL is required by flash to run DRM protected content (such as Amazon on Demand), so we use a custom PPA to get everything working as before.

Rails remote multipart form with remotipart bind ajax:success

Rails 3.x / 4.0 does not handle remote multipart forms natively, so a workaround is needed. To get remote multipart forms working correctly you can use the following steps (quick solution).

First: Add the remotipart gem to your GemFile

gem 'remotipart', '~> 1.2.1'

Then, Update your javascript manifest file (in basic configurations this is usually found in assets/javascript/application.js). Include the following requirement:

//= require jquery.remotipart

In my case, I’m binding the form via jquery and expecting a JSON response. To ensure you actually receive a JSON response, add the following to your <%= form_for ... %> method:

:html=>{:'data-type' => :json,:multipart=>true}

Obviously, there is going to be more to your form_for method, but this is minimally what your :html option should look like.

Now you can bind on ajax:success in the normal way:

$(document).on("ajax:success","#your-form-element",function(e, data, status, xhr) { ... });

I’m writing this post primarily because my multipart form was processing however I couldn’t bind to ajax:success.

On a side note, you can achieve pretty much the same effect by using the ajaxForm jquery plugin. However, I really just wanted a quick solution that hooked into my current development flow, so I went this way.

Bootstrap Modal – load remote url multiple times

If you’re using Bootstrap 3.x to generate a remote link based modal, you’ll notice that re-clicking the same link does not re-request the content of the remote URL and instead just re-displays the same content from the previous load.

This isn’t a great result in many cases (forms for new objects for instance). To resolve this issue do the following:

  $('body').on('hidden.bs.modal', '.modal', function () {

This allows you to request the remote URL multiple times and refresh the modal on each request. However, it will still blink with the old data. To resolve this you can do the following:

  $('body').on('hidden.bs.modal', '.modal', function () {
    $("#" + $(this).attr("id") + " .modal-content").empty();
    $("#" + $(this).attr("id") + " .modal-content").append("Loading...");

You could use the JQuery ‘html’ method instead of empty() + append(), however I’ve noticed versions of IE less than 9 choke on the html method in this context. I personally think IE should be sent back to the hell fire whence it was sprung….but if you need it to work, then you’ll need to use the method above.

VirtualBox resizing vmdk to increase dev/mapper partition

If you’ve run out of space on a VirtualBox vmdk drive and want to increase the partition’s size, do the following:

1) Download the GParted ISO from their website.

2) Convert your vmdk to a vdi (VBoxManage can be found in your virtualbox “program files” directory. Use explicit file paths if needed)
>> VBoxManage clonehd “source.vmdk” “cloned.vdi” –format vdi

3) Resize the vdi to whatever size you need (units in megabytes)
>> VBoxManage modifyhd “cloned.vdi” –resize 51200

4) You might as well keep the drive in vdi, but if you’re set on vmdk, you can convert back like so:
>> VBoxManage clonehd “cloned.vdi” “resized.vmdk” –format vmdk

5) Now, open your virtualbox manager and attach the GParted ISO as a CD ROM.

6) Run the virtualbox instance and boot from the CD. If CD is not prioritized above the drive, hit F12 at boot.

7) Get yourself to the GParted GUI (there are some language selections and other options before this, just keep accepting the defaults)

8) Now, expand your primary SDx partition into the unallocated space created by the recent resize.

9) Now, expand the sub partition into the newly created space of the primary SDx partition.

10) Apply changes

11) Shutdown the VirtualBox.

12) Now, if you need to expand into a dev/mapper area, manually start your virtual box without running the GParted ISO.

13) Run the command >>df at the prompt, and you’ll notice that the dev/mapper area has not expanded as you might have thought.

14) run the following command
>> pvresize /dev/mapper/fedora-root (obviously, fedora-root is going to change to fit your needs)

15) Then to ensure it worked, you can run the following:

16) Then, Run the following command to allocate the free space
>> lvextend -l +100%FREE /dev/mapper/fedora-root

17) Then, run the following command:
>> resize2fs /dev/mapper/fedora-root

18) Then, run the following command to see that the modifications have taken place
>> df

Helpful resources:

http://blog.jyore.com/?p=121 (last 5 steps)

JQuery Sortable with multiple sections within the same view

I ran into an issue the other day where multiple sortable regions were dynamically created within the same view, all with the same class structure. After running

> $(“.the-class”).sortable({…})

I noticed that only the first sortable region was actually sorting. To resolve this issue iterate over the class and call sortable on each individual element. For instance:


Rails 4 TurboLinks with JQuery document ready

Using JQuery’s $(document).ready() functionality seems to be broken when using’s the Rails Gem Turbolinks. However, to fix any issues you are experiencing, add the jquery-turbolinks gem to your Gemfile

> gem ‘jquery-turbolinks’

Then, add the following line to your JS manifest file, typically application.js in your assets directory:

//= require jquery.turbolinks

After which, restart your server, and you should be good to go.

Rails Capistrano deployment: SSH, Error reading response length from authentication socket

If you’re running a rails application with capistrano and you run into the following error:

Error reading response length from authentication socket

When you attempt to connect via cap, for instance

> cap staging deploy

Then make sure you can answer the following questions with a ‘yes’ before continuing.

1) Is my private key properly created and available on my local system. Simple configurations will generally maintain the key at:


2) Is my public key available on the remote server. If not, you will need to add it to the authorized_keys file on the remote server:


Your public key can be found in the following location (on your local machine):

~/.ssh/id_rsa.pub (or whatever your public key pairing is for your situation)

and paste it as a newline in the above file on the remote server (authorized_keys).

If you are still experiencing the authentication socket error, do the following at your local command prompt:

> eval $(ssh-agent)
> ssh-add

This is particularly important if you are using a private:public key pairing and expecting capistrano to allow agent forwarding.