Monday, June 25, 2007

I have been developing the Rails app on my Powerbook using Subversion with file:/// protocol. So when I had to migrate it to Subversion repository hosted remotely by Rimu I had to do the following:

1) On the laptop:

svnadmin dump ~/home/path/to/svn/repos > some-file-name

2) I used Transmit FTP client to use SFTP to the remote host and copied the some-file-name to the remote machine.

3) Login to the remote machine and run:

svnadmin load subversion-repo-name < some-file-name

I created a new directory on my laptop and did a checkout from remote repository: svn co --username some_user --password some_password http://www.your-domain.com/project_name/trunk

then svn info shows that the repository is http:// pointing to the remote repository.

svn log http://www.your-domain.com/project_name/trunk

shows all the log messages. Note this did not show all the 10 revisions that I had on my local repository. It showed only the changes that I had made after the migration. So the local repository version was at 10 but the remote repository was moving from version 3.

1) include the line: breakpoint "some description goes here" where you want the program execution to stop.2) From the rails app root directory run: script/breakpointer3) Fire the browser and let the app hit the breakpoint, you will be taken to the >> prompt where you can examine variables.

This helped me to customize the Attachment_fu plugin so that image upload is optional.

When you have an object, you can set the values for its attributes by:

obj.send(#{attribute}, value) where attribute is the actual attribute while looping through an array of strings that contains the attribute names. The value is the actual value that is used to initialize the attribute.

Wednesday, June 20, 2007

This was a interesting question during the interview. I never understood recursion. The interviewer skillfully provided some clues for me to figure this one out myself. I wrote down some sample values for x and y in a tabular format. Worked through the problem and surprisingly come up with the right answer!

This version is compatible with FasterCSV. Hivelogic instructions will work, but you need to use the the url ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.6-p36.tar.gz to install the latest Ruby distribution. This release was announced on Ruby-Talk mailing list.

You can skip the readline installation if you have it already installed for Ruby 1.8.6 released on march 07.

Sunday, June 17, 2007

1) Find out how deploy_with_migrations Capistrano switch works.2) Change the style.css for the site.3) How to connect to the database during deployment without using database.yml?4) How to upgrade if you freeze gems?

1) I looked at the mongrel.log file, the error message said that it could not find staging.rb. So I created an empty staging.rb file under config/environments directory.

2) staging configuration for socket value was set to the output of locate mysql.sock.

3) The staging.log showed that require 'turn' statement in environment.rb was missing the turn gem. I moved this statement to development.rb, since it is required only for development.

Missing gem headaches: I also learned about rake freeze gem that allows taking gems to the deployment environment. But I don't know if I freeze a gem I will be able to upgrade it later. I will get this clarified from Rails mailing list.

http://#{ActionMailer::Base.smtp_settings[:domain]}/activate/#{user.activation_code} line in the rhtml template takes the smtp_settings defined for that environment. Sodefine the domain in staging.rb to fix this problem

Wednesday, June 13, 2007

When you run the Komodo it loads all the code intelligence for PHP, Python etc. Very annoying when you want to just work on Ruby. After installation the tutorial instructions tell you to load a certain file. Uhh? Where did it install? It does not know where it installed so you have to manually search to load the tutorial.

There is no way to customize the appearance, no themes. No thanks, I will stick with Textmate for now. Maybe Netbeans might be a good alternative one day.

Mike clark's weblog has a good article on how to use attachment_fu to upload images. In my application I did not need any thumbnails. In this case to display the image in the show.rhtml I had to use the image_tag(@person.public_filename) to display the image.

Nice book from Apress written by Trotter Cashion. I finished reading this book last night. It has a very good coverage of the RESTful goodness in Rails. Short and sweet. Learned a lot from this book. Very well written. I give it 4.5 out of 5 stars. The reason is ActiveResource in the latest Rails is not discussed in the book.

Saturday, June 09, 2007

When I commit the changes to the svn, I got: svn ci .Sending .svn: Commit failed (details follow):svn: Out of date: '/trunk' in transaction '2-1'svn: Your commit message was left in a temporary file:svn: '/Users/balaparanj/work/zepho/ard/svn-commit.tmp'

Out of date here means the repository version is not the same as the local version. It works after doing svn up.