Posted by Eric Stewart
Thu, 09 Mar 2006 23:39:30 GMT
Almost two years have passed since I rode in my last bike tour, and the time has come for me to get back in shape and work for a good cause. I rode in the Tour de Cure twice, raising money for diabetes research. Now it’s time to do something a little closer to my heart and ride in the LiveStrong Challenge.
About 30 years ago, when I was a young child, my mother fought cancer and beat it. It was a tough fight, but she survived and lived to see me graduate high school. But the treatment in those days had taken its toll on her and she is no longer with us. I continue to be inspired by the fight she fought and what she went through.
In honor of my mother’s battle with cancer, and for all of those millions of people in the same fight, I’m participating in the LIVESTRONG Challenge in Austin in October. I’m going to ride my bike 40 miles and raise at least $500 for the Lance Armstrong Foundation.
The Lance Armstrong Foundation was founded in 1997 by cancer survivor and champion cyclist, Lance Armstrong, to provide practical information and tools for people living with cancer. Their mission is to inspire and empower people affected by cancer through advocacy, public health and research programs.
If you would like to help out with a wonderful cause or just root for someone who hasn’t ridden much in a few years, please donate to help cancer survivors and support me in my fundraising efforts for the LiveStrong Challange.
<!- technorati tags start ->
Technorati Tags: bike, cancer
<!
- technorati tags end ->
Posted in Austin, Misc. | Tags biking, cancer | no comments
Posted by Eric Stewart
Sat, 04 Mar 2006 20:22:00 GMT
Richard White has released the latest version of his Ajax Scaffold Generator for Rails. Since I have been heads down on a mostly non-Ajax application until recently I had missed this.
If you appreciate the value of scaffolding in helping you get going in a Rails project and you want to use ajax in your application, this is a very handy way start. It also is a nice way of just generating some code you can play with if you are new to Ajax and want to quickly be able to experiment. And it doesn’t look bad. What is generated looks nice, seems to work well, and might not be too far from production ready depending on your application.
I did perform an accidental experiment. I had previously generated scaffolding for a model/controller in my test project and and re-generated scaffolding using this new ajax generator. All worked well, but I ended up with tests that were testing the original non-ajax scaffold methods. The action methods are just about the same, but they now are designed to only be called via ajax calls. My original functional tests for the controller broke. Enter redirect_or_render.
With Courtenay’s helpful method, it’s pretty easy to get this tests passing again and have these controller actions now support ajax or non-ajax calls. For example, consider the ajax generator created scaffold method create on my sample controller for objects called Tasks:
def create
@task = Task.new(params[:task])
if @task.save
@headers['task-id'] = @task.id
@headers['Content-Type'] = 'text/html; charset=utf-8'
render :partial => 'task', :layout => false, :locals => { :hidden => true }
else
render :partial => 'form_errors', :layout => false, :status => 500
end
end
This method expects to be called via xhr request and only needs to return a snippet of code. If we apply redirect_or_render the action becomes something like:
def create
@task = Task.new(params[:task])
if @task.save
@headers['task-id'] = @task.id
@headers['Content-Type'] = 'text/html; charset=utf-8'
redirect_or_render(
{ :action => 'list' },
{ :partial => 'task', :layout => false, :locals => { :hidden => true } }
)
else
redirect_or_render(
{ :action => 'new' },
{ :partial => 'form_errors', :layout => false, :status => 500 }
)
end
end
Now the create action can be called directly as well via a normal request and still function as expected. Note that there is still a bit of work to be done in this case, since we’d really like to have the action render the new action template again so we can show validation errors on the Task. So for these cases, maybe a render_or_xhr_render method would be useful.
<!- technorati tags start ->
Technorati Tags: accessibility, ajax, rails, ruby
<!
- technorati tags end ->
Posted in Software Development, Ruby, Ruby On Rails | Tags ajax, generator, plugin, rails, scaffold | 1 comment
Posted by Eric Stewart
Wed, 01 Mar 2006 00:57:00 GMT
Dave Thomas (of Pragmatic Programmers fame) has created the annotate_models plugin.
This one solves a pain I have been feeling for quite a while now. Say you are in Textmate, RadRails, vi, or whatever your tool of choice is working on one of your ActiveRecord model classes and you just can’t remember all the field attributes from your schema. This plugin gives you a command line tool to help keep that information close to where you are going to use it most.
Thanks Dave!!!
<!- technorati tags start ->
Technorati Tags: rails, ruby
<!
- technorati tags end ->
Posted in Software Development, Ruby, Ruby On Rails | Tags rails, ruby, tools | no comments
Posted by Eric Stewart
Wed, 22 Feb 2006 20:49:00 GMT
Lately I’ve been trying to make time to finish some plugin updates and get a new one out the door.
Label Helpers
A few responses have come in on the label_helpers plugin, including a contributed patch. I need to track down one report of problems with the error inclusion that I received without many details. If you have encountered this issue please send me more information and include your version of Rails.
Acts As Exportable
I have done some work on making ActiveRecord objects easier to use in exporting data, such as producing csv export files. At this point the code works well for my needs but will need a bit of work to be more generally applicable. I hope to have something out very soon.
Plugin Usage
Not surprisingly, the label_helpers plugin has been getting much more attention than assert_accessible. Web accessibility is unfortunately still not a priority to most web developers. At this point the numbers are:
assert_accessible – 12 downloads
label_helpers – 70+ downloads
See my projects page for more details.
<!- technorati tags start ->
Technorati Tags: rails, ruby
<!
- technorati tags end ->
Posted in Ruby, Ruby On Rails | Tags exporting, helper, label, plugins, rails, ruby | 2 comments
Posted by Eric Stewart
Sat, 18 Feb 2006 16:10:00 GMT
Not quite sure why coding and designing are considered separate activities, particularly with software. Kind of like asking someone to write a song with no instrument present. Sure can be done and many do it but I wouldn’t prescribe it as a precept.
—Bruce Trask from the Pragmatic Programmers mailing list
I like this analogy and would add that the practice should fit the piece/project; use what makes sense. Instruments, metronomes, recordings, mixers, effects processors, etc. are all just tools that a musician can use in performance as well as practice.
A composer might spend great lengths of time with only pencil and paper, recording notes on staffs or chord progressions, harmonies, and other portions of a work as they weave the parts together to make a whole. But occassionally they might go pick up an instrument and try an idea that is in their head, or seek the right sound.
This is like a developer working on a spec, or set of stories stepping aside to work on a spike or other proof of concept. Writing some code not necessarily with the intent of its inclusion in the final product, but to help with overall process. And sometimes those excercises are fruitful enough to use what comes out of them directly, with little rework.
In other cases, a group of musicians might be composing together, or just having a jam session. They bounce ideas off of each other, react to what the others are contributing, maybe perform a solo at times, duet at others, harmony at others, or simply provide the supporting rythm that keeps the piece together and gives it form.
Sounds like group planning, pairing, and other team development activities. Someone has to kick of the group and keep them in type and in the right key, but on top of that the group or sub-group can do some very interesting things.
Since I have now battered this analogy to death I will end witht a parting thought. All those great recordings you listen to on CDs, MP3s, vinyl, eight-track, or just on the radio were developed somehow whether it’s a single song, a concept album, or an entire symphony. All the great musical works you love were composed in many, many different ways.
Try telling all those musicians that they were supposed to compose their works without picking up their instruments and playing a note!
Posted in Software Development | Tags development, quotes, software | no comments