Friday, June 16, 2006

Copying a File in Java

I just wrote a little monitor program. It watches one directory, and when it finds a file, copies it to a 2nd dir, processes it, and deletes it. Using Java's File object, the whole thing was simple, except for the copying part. Any reason why the standard Java libraries don't have a file copy method?

With Google's help, I found one online at Java Almanac, which was almost as handy, but why, pray tell, ... oh, never mind. Now where'd I put my Ruby book...


Friday, June 09, 2006

Rails said: AdapterNotFound

Oh yeah, as part of my playing with Ruby on Rails, when I went to run generate, I got an error message saying ActiveRecord::AdapterNotFound. Turned out I had put down postgres instead of postgresql. I'm still not sure where I should have seen that, (rather than the tutorial text, obviously).

Thursday, June 01, 2006

First Tiny Steps in Rails

Time to learn something about Ruby on Rails.

I started going through the tutorial, and had a minor hiccup that I thought I'd report.

We use PostgreSQL, so I wanted to use that as my db. This meant doing a gem install postgres to get the correct db adapter. Except I got many screens full of error messages.

At the top of these was:

postgres.c:18:22: error: libpq-fe.h: No such file or directory
postgres.c:19:70: error: libpq/libpq-fs.h: No such file or directory

so I went looking for how to tell it where the postgres include files are. Turns out that

gem install postgres -- --with-pgsql-include-dir=/usr/local/pgsql/include

is the simplest way, but you can also go into /usr/local/lib/ruby/gems/1.8/gems/postgres-0.7.1 and do this:

ruby extconf.rb --with-pgsql-include-dir=/usr/local/pgsql/include
make install