rubycoloredglasses


I'm Jason, a web applications developer in the Denver, Colorado area.


  1. Rails Performance Statistics

    Again, as I search for things, I stumble onto new tools. I just found out about a tool for monitoring the performance of Java and Ruby applications called New Relic.

    They provide a free service level for Startups and Students even.


  2. RailRoad Gem

    I just discovered that there is a Ruby gem which generates diagrams based on Rails models (ActiveRecord). I ran across this website a while back, but didn’t quite connect the dots. I was just reading an article on placing models into their own namespace, and I realized that the diagram it uses as an example was generated using RailRoad.

    [http://railroad.rubyforge.org/]

    Railroad model diagram


  3. Annotate Models

    There is a rails plugin which adds schema information for the models in comments at the top of your model definition files. It’s really useful. Check out the instructions on installing and using this plugin at:

    [http://pragdave.pragprog.com/pragdave/2006/02/annotate_models.html]


  4. Selenium RC, Firefox 3, and Ubuntu

    Selenium Logo

    I’ve got a system setup which uses Firefox on an Ubuntu machine, with the Selenium RC server (remote control). I had a set of scripts which would run automatically every 15 minutes, which would prompt Firefox to open and go to the site and submit certain forms. This stopped working after I ran an update on some packages in my Ubuntu machine (9.04 Jaunty).

    I was able to resolve this issue by upgrading from Selenium RC 1.0.1 to 1.0.3.


  5. Undefined method 'ref' for ActiveSupport::Dependencies:Module

    After upgrading to Snow Leopard, and trying to run ‘rake db:migrate’, I received this error once. This seems common to others which have upgraded, especially back when Snow Leopard was released in August of 2009:

    rake aborted!
    uninitialized constant MysqlCompat::MysqlRes
    (See full trace by running task with --trace)
    

  6. Setting up Deployment for Rails using Capistrano, Apache with Passenger and Git

    I don’t have time right now to learn how to setup Capistrano. I just want a recipe that works and does the job. Here are my notes.

    1. First install the Capistrano gem
    sudo gem install capistrano
    
    1. Next you need to go into the directory of your Ruby on Rails application and capify it:
    capify .
    

  7. Rake Tasks

    If you’re wanting to know which Rake tasks are available for you to use from the command line, simply use the ‘rake -T’ command:

    $ rake -T
    (in /Users/jason/railsproject)
    rake db:abort_if_pending_migrations       # Raises an error if there are pending migrations
    rake db:charset                           # Retrieves the charset for the current environment's database
    rake db:collation                         # Retrieves the collation for the current environment's database
    rake db:create                            # Create the database defined in config/database.yml for the current RAILS_ENV
    rake db:create:all                        # Create all the local databases defined in config/database.yml
    rake db:drop                              # Drops the database for the current RAILS_ENV
    rake db:drop:all                          # Drops all the local databases defined in config/database.yml
    

    A really useful one is the ‘routes’ option which outputs a list of the routes configured.

    macbook:railsproject jason$ rake routes
    (in /Users/jason/railsproject)
      /:controller/:action/:id
      /:controller/:action/:id(.:format)
    

  8. MySQL Gem Installation on Mac 10.5.8 - 64 bit??

    I’m setting up a new Ruby on Rails application, and tried to run the first migration for the creation of the new database. This failed because I didn’t have the MySQL gem installed. I’m using a 64 bit processor (Intel Core 2 Duo) so I installed the 64 bit MySQL for 10.5.8 (Leopard, I haven’t upgraded to Snow Leopard yet).

    When trying to run the installation command I received an error:

    $ sudo gem install mysql
    Password:
    Building native extensions.  This could take a while...
    ERROR:  Error installing mysql:
        ERROR: Failed to build gem native extension.
    /opt/local/bin/ruby extconf.rb
    checking for mysql_query() in -lmysqlclient... no
    checking for main() in -lm... yes
    checking for mysql_query() in -lmysqlclient... no
    checking for main() in -lz... yes
    checking for mysql_query() in -lmysqlclient... no
    checking for main() in -lsocket... no
    checking for mysql_query() in -lmysqlclient... no
    checking for main() in -lnsl... no
    checking for mysql_query() in -lmysqlclient... no
    checking for main() in -lmygcc... no
    checking for mysql_query() in -lmysqlclient... no
    *** extconf.rb failed ***
    Could not create Makefile due to some reason, probably lack of
    necessary libraries and/or headers.  Check the mkmf.log file for more
    details.  You may need configuration options.
    

  9. Wordpress Plugin - Custom Pages?

    My Dilema

    Okay. I’ve worked on making a Wordpress plugin once. It’s pretty easy to make a plugin which replaces a tag such as [another-plugin-tag parameter="value"] with some sort of other HTML code. For instance it’s pretty straight forward to replace [iframe http://www.google.com/ 800 600] with an iframe tag.

    Something I’ve found difficult to find however is how you can create custom pages as soon as the plugin is activated, which are accessible using a permalink such as http://www.wordpress-site.com/myplugin/search/ which can submit a form to another URL such as http://www.wordpress-site.com/myplugin/results/ and then provide the results with a URL such as http://www.wordpress-site.com/myplugin/results/id/3/ or anything else pretty like that.


  10. Ubuntu 9.10 Karmic Koala - VNC resolution limited without monitor

    Update 04/23/2010 - I’m not finding a solution to this issue. Sorry. I’ve lost interest.

    I recently setup Ubuntu 9.10 on a desktop system, so I could use it as a file server. I’m was able to enable the remote desktop feature for it, which is basically a VNC server.

    The issue is that once I disconnected a monitor from the computer and set it up next to my router (plugged directly in), and restarted it, VNC would only work with a maximum resolution of 640x480.