Wolfmans Howlings

A programmers Blog about Programming solutions and a few other issues

How to protect a form from accidentally losing data

Posted by Jim Morris on 2006-11-14 22:47:44 +0000

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 2006-10-29 15:40:38 +0000

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 2006-10-25 14:08:38 +0000

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 2006-10-23 13:58:46 +0000

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 2006-10-17 23:45:47 +0000

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.

<% 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 %>

... Show more ...

Posted in Rails  |  Tags rails,text_field_with_auto_complete  |  18 comments

Epsilon Programmers Editor

Posted by Jim Morris on 2006-09-30 17:20:15 +0000

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 2006-09-04 11:51:35 +0000

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 2006-08-27 20:29:43 +0000

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 2006-08-09 22:39:06 +0000

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

Switching to KUbuntu from Redhat 9

Posted by Jim Morris on 2006-07-03 13:07:40 +0000

OK it was time I upgraded my main development workstation from a highly modified Redhat 9 to something more up to date that actually gets security updates and has a good package manager.

I have been using Ubuntu for my servers for some time, and like the package management, but I am used to KDE now and don't really want to switch to Gnome on my workstation. So I decided to try to upgrade to KUbuntu.

... Show more ...

Posted in Linux  |  Tags linux,ubuntu,firefox,thunderbird,dualmonitor,xmodmap  |  no comments