Tuesday, December 7, 2010

Turning Over a New Leaf

It has a been few years since I started this blog. I had chosen one of the stock templates offered by Blogspot, and never felt the need to put too much effort into customizing it. Even when Blogspot/Blogger released the new templates, which I have to admit are much nicer than the ones before, yet that alone did not justify switching templates.

This changed today when I realized that the new templates could have a maximum width of 1000px while the old templates had a fixed width. This is something I had desperately needed. The usable area for a text of a blog post was around 460px. The source code snippets and console output dumps which I include in my posts as pre-formatted text often wrap around or need to be scrolled due to the limited width of the post area.

With the new template the usable area for the blog post text is approximately 670px. It doesn't seem like much of an improvement, but it makes a huge difference!

The new design took effect at 11:47pm PST today. It is a slightly modified version of one of the new stock designs. I am not yet done tweaking the new blog design, but I feel that this is a good starting point... for now.

Here is a screenshot of this post with the previous blog template I used, included here more for the sake of nostalgia than anything else.

Tuesday, November 23, 2010

Configuring Aptana to Treat Gemfiles as Ruby Files

Aptana Studio 2 does not recognize Gemfiles used by Bundler as Ruby files. This means that Aptana will treat the Gemfile you are editing as an ordinary plain text file. You will not have Ruby syntax highlighting, word completion, and syntax checking available within the editor. In order to specify that the Gemfile (or any other file for that matter) is a Ruby file, do the following:
  1. Open the "Window Menu" --> Preferences
  2. Go to General --> "Content Types"
  3. Expand "Text" node under "Content types"
  4. Select "Ruby Source File"
  5. Click the "Add..." button and enter "Gemfile" as the content type.
  6. Click the "OK" button to save your changes.



The above procedure can be used to add files for the following content types:
  • CSS Source Files
  • ERB Source Files
  • HAML Source Files
  • HTML Source Files
  • JAR Manifest Files
  • Java Property Files
  • Java Source Files
  • JavaScript Source Files
  • SASS Source Files
  • XML Build Files (Ant, etc)
  • XML Source Files (xml, xslt, etc)

Friday, March 26, 2010

Nondiscriptive Rail Error "Errors running test:units!"

Errors Running test:units!


The "Errors running test:units!" error while creating a brand new Rails application under Cygwin:

rails world_app -d mysql
cd world_app


$ rake test

This results in the following error message:

(in /cygdrive/d/workspace/tt/world_app)
/usr/bin/ruby.exe -I"lib:test" "/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader.rb"
/usr/bin/ruby.exe -I"lib:test" "/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader.rb"
Errors running test:units!

Attempting to execute the Rails tests results in the same eror:

$ rake test --trace
(in /cygdrive/d/workspace/tt/world_app)
** Invoke test (first_time)
** Execute test
** Invoke test:units (first_time)
** Invoke db:test:prepare (first_time)
** Invoke db:abort_if_pending_migrations (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:abort_if_pending_migrations
** Invoke test:functionals (first_time)
** Invoke db:test:prepare
** Execute test:functionals
/usr/bin/ruby.exe -I"lib:test" "/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader.rb"
** Invoke test:integration (first_time)
** Invoke db:test:prepare
** Execute test:integration
/usr/bin/ruby.exe -I"lib:test" "/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader.rb"
Errors running test:units!


Fixing the Error


The following steps fixed the error:

  1. Edit config/database.yml
  2. Make sure the db password is correct.
  3. Make sure the db is created.
  4. Change "host: localhost" to "host: 127.0.0.1" if need be.


$ rake test --trace
(in /cygdrive/d/workspace/tt/world_app)
** Invoke test (first_time)
** Execute test
** Invoke test:units (first_time)
** Invoke db:test:prepare (first_time)
** Invoke db:abort_if_pending_migrations (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:abort_if_pending_migrations
** Execute db:test:prepare
** Invoke db:test:load (first_time)
** Invoke db:test:purge (first_time)
** Invoke environment
** Execute db:test:purge
** Execute db:test:load
** Invoke db:schema:load (first_time)
** Invoke environment
** Execute db:schema:load
** Execute test:units
/usr/bin/ruby.exe -I"lib:test" "/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader.rb"
** Invoke test:functionals (first_time)
** Invoke db:test:prepare
** Execute test:functionals
/usr/bin/ruby.exe -I"lib:test" "/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader.rb"
** Invoke test:integration (first_time)
** Invoke db:test:prepare
** Execute test:integration
/usr/bin/ruby.exe -I"lib:test" "/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader.rb"