Wolfmans Howlings

A programmers Blog about Programming solutions and a few other issues

Allow a different local and remote subversion repository path for Capistrano

Posted by Jim Morris on Wed Nov 15 14:04:28 -0800 2006

One of the things that bugs me about Capistrano is the requirement that access to the remote subversion repository have the same path from the local machine and the remote machine. This is never the case in my experience.

I have been getting around it by setting the path to svn://localhost/... and running ssh locally to port forward the SVN port to the remote host. This sucks as I usually forget to run ssh in another window first.

... Show more ...

Posted in Rails  |  Tags rails,capistrano,subversion  |  4 comments

How to protect a form from accidentally losing data

Posted by Jim Morris on Tue Nov 14 22:47:44 -0800 2006

Here is a good one, your users are complaining that they have spent 5 minutes filling in a web form, then lose it all by clicking on a link away from the form, and back arrow doesn't restore the fields that were entered. (At least on IE).

I saw an interesting design in the Rails Recipes book for saving form data at regular intervals, but I didn't like the overhead of that one.

... Show more ...

Posted in Rails  |  Tags rails,forms  |  2 comments

Setting the focus in a form

Posted by Jim Morris on Sun Oct 29 15:40:38 -0800 2006

This is a simple one, how do I set the focus in the first item in my form?

Put this in your app/helpers/application_helper.rb:

... Show more ...

Posted in Rails  |  Tags rails,focus,form  |  8 comments

Flash problems with periodically_call_remote

Posted by Jim Morris on Wed Oct 25 14:08:38 -0700 2006

I just ran into this little problem which kept me scratching my head for quite a while. My flash message didn't show up on the next action.

I have a status page which polls a database for status using periodically_call_remote, when the database reaches a certain state I show a button which says the process is complete go to next step.

... Show more ...

Posted in Rails  |  Tags rails,flash,periodically_call_remote  |  no comments

Getting a record id from text_field_with_auto_complete

Posted by Jim Morris on Mon Oct 23 13:58:46 -0700 2006

I ran into this problem a few times,and I have seen others asking the same question, if you use text_field_with_auto_complete and the selection list returns non-unique results, how do you reference the actual record in the database you want?

For instance if you have text_field_with_auto_complete :customer, :name then in your controller: name= params[:customer][:name] and Customer.find_all_by_name(name) returns more than one entry you need to be a little more tricky to retrieve the actual record you wanted to select.

... Show more ...

Posted in Rails  |  Tags rails,text_field_with_auto_complete  |  3 comments

Having multiple text_field_with_auto_complete in the same view

Posted by Jim Morris on Tue Oct 17 23:45:47 -0700 2006

I ran into a problem using text_field_with_auto_complete in a view where I wanted to have many of them created by an iteration. You can use the :index option for the text_field, but it doesn't carry over to the various divs used in the AJAX calls.

<typo:code lang="ruby"> <% 0.upto(10) do |legi| %> <% @leg= @mission.legs.find(:first, :conditions => ['legnum = ?', legi]) %> text_field_with_auto_complete( :leg, :name, {:index => legi, :size => 20}) <% end %> <% end %> </typo:code>

... Show more ...

Posted in Rails  |  Tags rails,text_field_with_auto_complete  |  18 comments

Epsilon Programmers Editor

Posted by Jim Morris on Sat Sep 30 17:20:15 -0700 2006

I use Lugarus excellent Epsilon Editor for most of my programming editing needs, on Win32 and Linux.

(An exception is for Java programming where I use Eclipse).

... Show more ...

Posted in Linux,Rails,Ruby  |  Tags ide,ruby,rails,epsilon,editor  |  1 comments

Using Ruby SVN bindings to get file status

Posted by Jim Morris on Mon Sep 04 11:51:35 -0700 2006

If you Google around for information or even some documentation on the ruby SVN bindings you will find plenty of comments that it simply is not documented, so when I wanted to add an SVN status check to a UI I was working on (a project browser window for Rails), I had to "Use the source Luke". However given the bindings are actually mostly automatically generated by SWIG, and the actual details are hidden in a goo of swig generated c code, even that was a challenge.

Eventually I realized that the API was almost identical to the c level subversion API, not surprisingly, and for the most part it works the way you would expect. However I could not find any examples of the client status call, so here it is for anyone else struggling with this issue.

... Show more ...

Posted in Ruby,svn  |  Tags ruby,subversion,svn,rubysvn  |  3 comments

Getting f-spot to upload to flickr on KUbuntu

Posted by Jim Morris on Sun Aug 27 20:29:43 -0700 2006

f-spot is a good photo importer and organizer, but it is a gnome application. When I installed it on KUbuntu, which uses KDE, using aptitude install f-spot it worked ok, except I got the following error when I tried to send my photos to flickr.

GLib.GException: There is no default action associated with this location
... Show more ...

Posted in Linux  |  Tags kubuntu,flickr,fspot  |  no comments

Experiences with Komodo Pro and Ruby

Posted by Jim Morris on Wed Aug 09 22:39:06 -0700 2006

I got a license for Komodo Pro, (Komodo-Professional-3.5.3-262321-linux-libcpp5-x86) and started trying to use it, I have the latest KUbuntu, with GTK installed so I had no problems installing Komodo as far as libraries and requirements were concerned, however running it had me stumped, I ran into immediate problems (some of my own making I'll admit).

First I saw a stream of errors on the screen, they didn't seem fatal but are annoying, for instance...

... Show more ...

Posted in Rails,Ruby  |  Tags komodo,ide,ruby,rails,editors,epsilon  |  1 comments