Tabular gem release

December 15th, 2009

There’s quite a bit of messy, “hey guys, I’m learning Ruby!” text-parsing code in Racing on Rails. Users must wrestle with a fussy and inflexible interface, and developers can’t improve the code without making more of a mess.

To my surprise, clean-up required more than just plugging in FasterCSV. While nice for parsing CSV, it doesn’t handle tabbed-delimited files well, nor does it like any data changes after parsing (my plan had been to just shove Spreadsheet-parsed data into FasterCSV, because I like FasterCVS’s API).

So, I need something more: support for tabs and Excel, data manipulation, and formatted output from a common interface. More concretely: read race results and event schedules from Excel and text files, and then massage data before saving it all with ActiveRecord. I also need to turn a list of race results into pre-formatted text.

You’d think someone would have been done this before, but my Google skills failed to find them. And, there were some decent, well-tested ideas mixed in with my lousy Ruby code.I took a whack at extracting the code into its own gem. Voila, Tabular: http://github.com/scottwillson/tabular

Capistrano via Cron or FreeBSD Periodic

May 5th, 2009

Running Capistrano from cron or FreeBSD’s periodic can be tricky—both (wisely) limit your environment. Scripts may run just fine in a SSH session, but fail when run by cron.A couple of standard gotchas:

  • Command not found: your PATH is usually chopped down. Either explicitly set PATH to include you commands, or execute commands with their full paths.
  • No terminal. On Linux, try sudo’s -i option.

More puzzling:connection failed for: example.com (RuntimeError: can’t get terminal parameters (Inappropriate ioctl for device))I assumed this was a tty/SSH/login session problem. Turns out it was a permissions problem. The current user couldn’t login to the remote server via SSH, and the remote server was prompting for a password. Of course, it worked when running this script by hand.

Rails 2.3 Plugin Routes

March 19th, 2009

As noted here http://guides.rubyonrails.org/2_3_release_notes.html and here http://rails.lighthouseapp.com/projects/8994/tickets/329-add-an-api-for-plugins-to-register-routes, Rails 2.3 will load routes from a plugin. If the plugin is considered an engine. A blank “app” directory in your plugin’s root is enough for the plugin loader.

Google Group for Racing on Rails

July 29th, 2008

There was a burst of interest in WSBA website development on their mailing list—enough to annoy a few non-coders at any rate. So Racing on Rails has its own Google Group for development. Here’s hoping it’s the tip of the volunteer Rails coder cyclist iceberg.

For those late to the party or too lazy to click the link above, Racing on Rails is the Ruby on Rails application behind several bike racing association websites like the WSBA and OBRA. It’s all open source (except for the association-specific parts), and it pretty much works OK at this point.

I’ve put a lot of time into this code in the last few years. Plenty of cool ideas abound for these sites—it would be great to have more developers to make those ideas happen.

Undefined symbol “dav_hook_gather_propsets”

May 18th, 2008

If you see an error like this when starting Apache …

httpd: Syntax error on line 53 of /usr/local/etc/apache22/httpd.conf: Cannot load /usr/local/libexec/apache22/mod_dav_fs.so into server: /usr/local/libexec/apache22/mod_dav_fs.so: Undefined symbol "dav_hook_gather_propsets"

Make sure that LoadModule dav_module … precedes LoadModule dav_svn_module and LoadModule dav_fs_module

100-Year Anniversary

May 16th, 2008

Well, not quite. But my uncle just pointed out that the original (The) Butler Press was founded 100 years ago.

We’re Hiring Another Rails Developer

February 6th, 2008

“We” means Analog Analytics. It’s fun, personally, to be hiring now instead of trying to be hired. Here’s the job description:

“Terrific opportunity for talented developer to join an exciting team helping to change the advertising industry.”

It’s a remote position — Pacific time zone strongly preferred — I’m in Portland, the CTO is in Los Angeles, and the CEO is in San Diego. There’s no home office. We deploy and develop Rails (and a little C) on OS X, Linux, and Solaris.

Light on the details? Sure. We’re not hung up on any many specific qualifications. Want to earn your salary coding in Rails? Email me at scott.willson@analoganalytics.com

Rails 2 upgrade: .rhtml to .html.erb Script

January 16th, 2008

This is less a post, than a note to myself, but anyway, here’s a handy script to change your view extensions while preserving Subversion history.

#! /usr/bin/env ruby
require 'pathname'
for path in Dir['app/views/**/*.rhtml']
pathname = Pathname.new(path)
p `svn mv #{path}#{pathname.dirname}/#{pathname.basename.to_s.split('.').first}.html.erb`
end

Obscure Oracle JDBC Exception du Jour

December 6th, 2007

I ran across this exception again today, and Google didn’t anything useful until I dug in a bit. Hopefully, this will help someone else searching for UnsatisfiedLinkError and free_c_state exceptions.

Your JDBC URL syntax is wrong.

You need something like jdbc:oracle:oci:@RPTD

java.lang.UnsatisfiedLinkError: free_c_statejava.lang.UnsatisfiedLinkError: free_c_state
at oracle.jdbc.oci8.OCIDBAccess.logoff(OCIDBAccess.java:616)
at oracle.jdbc.driver.OracleConnection.(OracleConnection.java:409)
at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.java:468)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:314)
...

undefined method `dbman’

November 18th, 2007

Upgrading to a Rails app to 2.0 and seeing this error?

undefined method `dbman' for #<ActionController::TestSession

You need to add this line to config/environments/test.rb:
config.action_controller.allow_forgery_protection = false

Obvious to you, maybe, but not to me.

gears