Technology Insights

Dynamic Styles with HTML, CSS, and Javascript

Styles can be dynamically changed in 4 ways: With Javascript (overrides all other styles)el = document.getElementById(‘pageBody’); el.style.backgroundColor = ‘red’; Inline styles (override both embedded and external styles)Inline styles are styles that are written directly in the tag on the document. Inline styles affect only the tag they are applied to. <a href=”” style=”font-size:91%;”> Embedded styles…

Details
Technology Insights

Setting up BackgrounDrb

I decided to use BackgrounDrb 0.2.1 to launch a periodic task that would run every 15 seconds.Warning: After going through the hassle of setting up BackgrounDrb, I found out that it isn’t even supported in Windows (my dev environment)! See step 8. So, these instructions haven’t been fully tested yet on a *.nix environment. Good…

Details
Technology Insights

What Exactly Does the Scaffold_Resource Generator give you?

The regular scaffold generator (e.g. ruby script/generate scaffold model controller) requires you to create your model and controller first. The scaffold_resource generator, on the other hand, generates the (RESTful) model and controller for you. For example: ruby script/generate scaffold_resource Caregiver first_name:string last_name:string In Rails 2.0, use resource instead: ruby script/generate resource Caregiver first_name:string last_name:string Here’s…

Details
Technology Errors

“Multiple Default Values” Migration Error with PostgreSQL 8.2.5

PostgreSQL 8.2.5 error == CreateHeartrates: migrating ================================================ — create_table(:heartrates) NOTICE: CREATE TABLE will create implicit sequence “heartrates_id_seq” for serial column “heartrates.id” rake aborted! PGError: ERROR: multiple default values specified for column “id” of table “heartrates” : CREATE TABLE heartrates (“id” serial primary key DEFAULT NULL, “user_id” integer DEFAULT NULL, “timestamp” timestamp with time zone DEFAULT…

Details
Technology Insights

View for Version Numbers, Hostnames, IPs, Etc.

Here’s some code (and rendered view) for various version numbers, host names, IPs for Ruby, Rails, PostgreSQL, SMTP. <b>Network</b><br> UNIX hostname: <code><%= `hostname` %></code><br> SERVER_ADDR: <code><%= request.env[“SERVER_ADDR”].to_s %></code> <br> HOST_NAME : <code><%= request.host %></code> <br> REMOTE_ADDR: <code><%= request.env[“REMOTE_ADDR”].to_s %></code> <br> <br> <b>Software</b><br> Database: <code><%= ActiveRecord::Base.connection.select_value(“SELECT  VERSION()”) %></code><br> Email delivery method: <code><%= ActionMailer::Base.delivery_method %></code><br> SMTP server:…

Details