Wolfmans Howlings

A programmers Blog about Programming solutions and a few other issues

A HAML edit mode for JEdit

Posted by Jim Morris on Fri Dec 01 18:09:47 -0800 2006

I've just started a new RoR project and thought I'd try out HAML for the views instead of rhtml.

Seeing as I just switched to JEdit, I looked for a HAML language mode, and to my surprise no one had done one yet.

... Show more ...

Posted in HAML,JEdit,Rails  |  Tags rails,jedit,haml  |  9 comments

JEdit Ruby/Rails Snippets or superabbrevs

Posted by Jim Morris on Fri Nov 24 19:05:52 -0800 2006

I imported the rest of the Textmate ruby and rails snippets I had to combine them into the one ruby file though.

I have added about 80 new ones to the existing ones by Scott Becker that I found here

... Show more ...

Posted in JEdit,Rails,Ruby  |  Tags ruby,rails,jedit,snippets,superabbrevs  |  8 comments

JEdit - Textmate for the rest of us?

Posted by Jim Morris on Tue Nov 21 23:20:07 -0800 2006

OK after expounding on how much I like Epsilon as an editor, I finally hit a wall with it. I wanted tabs of the currently open files, and it simply does not provide that facility yet. (I know all modern editors do!). On X11 (IE Linux and OS/X) Epsilon is not really a graphical app, it does open an X11 window, but within it most dialogs and lists (like buffer lists etc) are text, a little like a curses app. The advantage is it opens really fast, and loads huge files pretty fast. The downside is you don't get all those nice windowing facilities like movable pop-up windows, dialogs, trees and tabs!

So after hearing so much about JEdit, I bit the bullet and gave it a whirl. Following the instructions from a number of blogs (too numerous to mention) I installed it on my KUbuntu Linux box, with all the plugins people recommend, and of course the Ruby plugin and SupperAbbrevs (The beta version), so I have my snippets!

... Show more ...

Posted in JEdit,Rails,Ruby  |  Tags ruby,rails,jedit,textmate  |  6 comments

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