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 testing new functionality. There are two things you can do to make your implementation much [...]
Read More
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’, ’0.15.1′
Read More
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 the alternating divs to the appropriate black or white sequence. Something like this: td.qr { [...]
Read More
If you want to see the difference between the same file on separate branches, use the following snippet at the CLI: git diff branch1 branch2 — your-file.ext
Read More
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 help. To do this, you can use the following snippet within your production environment’s console: [...]
Read More
If you just created a new PostgreSQL database for your Heroku App and are running into the following error: “password authentication failed for user” Try running the following command at the CLI: heroku pg:promote THE_DATABASE_NAME_HERE This should clear up the issue.
Read More
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 successfully loaded before executing additional code, but does not wait for the additional assets.
Read More
To check if an HTML checkbox is checked with JQuery, do the following: if($("#the-element).is(":checked")){ }
Read More
To retrieve the root domain within the Rails framework, use the following method: request.domain Given the following GET request: http://www.example.com/users/1/edit The above method will retrieve: example.com Caveat: This will not work within your models.
Read More
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)
Read More
Recent Comments