Author: anthony

Rails slow on Ubuntu Virtualbox instance

I ran into an issue where a Rails 3.1 application running on Ubuntu 12.04 in a VirtualBox instance (development) was running ridiculously slow. Sometimes, before the server would register a request, it would take >5 seconds, then another 5 seconds just to load a simple view. Obviously, this is an unacceptable amount of time when […]

Rails 4.0 / Postgresql / Heroku / Connection timeout

If you attempt to deploy a new application to Heroku using Rails 4.0.0, with a default postgresql configuration in your gemfile, such as: gem ‘pg’ Then, heroku will assume you are requesting PG version 0.12.2. This causes errors. Instead, to avoid connection errors (timeout, undefined constant, etc), you need a more recent version: gem ‘pg’, […]

rQRCode – Print QR codes on all browsers

There is a problem with the documented method of creating QR codes in HTML for rQRCode, as background colors are not printed. The suggested method is to use background colors to create the appropriate sequence. Instead, use a border-left on all TD elements and change the width to 0px; Additionally, change the border color of […]

Heroku – connect to different database and transfer data to current environment

If you run into a situation where you’ve been developing an application in a live heroku development environment and have entered a substantial amount of live data that you don’t want to reenter into your live production environment, then connecting to your development instance’s database and retrieving the specific data you are interested in might […]

JQuery – Wait until all images load before doing something

You may want to wait until all assets have loaded (such as images and certain JSON requests) prior to performing an action in JQuery. To do this, wrap your code in the following listener: $(window).load(function(){ }); This is different than what is typically done: $(document).ready(function(){ }); This allows us to wait until the DOM has […]

PEAR Mail with Google Business Apps SMTP

If you are using PEAR Mail with Google Business Apps SMTP and are running into connection timeout errors, with the following configuration: $smtp = Mail::factory(‘smtp’, array (‘host’ => $host, ‘port’ => ‘465’, ‘auth’ => true, ‘username’ => $username, ‘password’ => $password)); Try changing the port to 587 (Port for TLS/STARTTLS)