Friday, October 26, 2007

CVNUG (Chippewa Valley .Net User Group)

Last night I was able to explain the basics of Ruby on Rails to the .Net group that I belong to. It was really a great experience and was greatly received by the group. I was nervous about the response I would get initially from the group as some members of the Rails community come across as arrogant bastards.

The presentation when off with out a hitch thanks to the help of Brian Hogan (http://www.napcs.com/) who was there to answer questions and explain information more in depth as I demonstrated building a "Cookbook" application. I stripped down a version of Brian's cookbook tutorial and turned it in to a demonstration.

I want to give a shout out to CVNUG (http://cvnug.wi-ineta.org/) for letting me present to them the wonders of working with Rails. I would also like to thank Brian for helping me out with the presentation.

-CH

Tuesday, October 23, 2007

Connecting to ms SQL from OS X

This one got me again today as I usually do not use SQL Server for my rails apps.  I was having a hard time remembering the steps for updating my odbc connector for SQL server.  Brian Hogan over at New Auburn Personal Computer Services has a great post on how to do this so check it out here: 
http://www.napcsweb.com/blog/2007/03/08/15/#more-15

Thursday, October 11, 2007

Rock N' Roll Jesus

I recently purchased Kid Rock's new album, "Rock N' Roll Jesus"  So far I have really enjoyed this album.  All I can really say is this is a great album and Kid Rock is keeping up his tradition of keeping the southern-rock-rap-country mix flowing.  Like every other Kid Rock album it's going to be a main stay in my car and on my ipod!

Tuesday, October 02, 2007

Installing CS3 in OS X

Today I was upgrading my Adobe products to CS3 from CS2 and ran into a problem.  There was an issue with my "payload" so the installer could not function properly.  After an hour of searching I found the CS3 Clean application from adobe.  It clears out all of your previous adobe information and allows the install of CS3 to work like a charm.  I figured someone else maybe having this same problem so here is the direct link.
http://www.adobe.com/support/contact/cs3clean.html

-CH

Monday, September 10, 2007

Ok Seriously I need to keep blogging

Well Rails Rumble is over, and we have our site up. http://www.elflist.us If you want to check it out. The weekend was great, we had a super team just ran out of time. If there is something that I learned from this contest it is that if you put your mind to something you can get it done. We plan on working on Elf List in the next couple months and I hope we can take the beta version live to the public for use around the beginning of November. For information on the development of Elf List check out http://www.icanhaztrofy.com where you will find our team blog.

In other news I am almost finished with LauraSaidYes.net sometime next week I should have the site live. Its been such a crazy last couple of weeks with the start of school and the Rumble but now that everything has calmed down back to my crazy life I can concentrate on a million things rather than a million and one. :)

One more news worthy note, in October I will be presenting Ruby on Rails to the Chippewa Valley .Net User Group (http://cvnug.wi-ineta.org). This should be an exciting presentation opening some .Net developers to my world as they open me up to theirs every month.

-CH

Friday, August 31, 2007

Busy Busy

The last few weeks I haven't been able to post because I have been super busy. Coming up next weekend is the Rails Rumble (http://www.railsrumble.com) I have joined up with 2 other developers and a really good graphic designer. You can find out more about our project at http://www.icanhaztrofy.com we have a simple blog up that will be used during the 48 hour contest.

In other news I recently got engaged this past weekend. It really has been a blessing to have Laura in my life and her continuing support for me and everything I do.

Lastly I am presenting RoR to a group of .Net developers that I meet with every month. I will try and get my slidedeck up here as soon as I finish it for others to take a look at. Since I have been trying to learn .Net I think this will be a good communication point for me. I will say this, after programing in Ruby it makes it harder to want to give it up for another language. Because everything just makes sense.

Well stay tunned for more to come, as the fall semester is about to start I will inevitably find more information to share with the world.

-CH

Monday, August 13, 2007

Back to Search Results

So today I encountered a problem that I seem to encounter in every web application I develop. Most web applications require a search and a way to view each results details. When you view the details you most of the time want to go back to your search results and not have to re-enter all of the fields of your search form.



There are a few ways to do this.

First you can use the quick and dirty way that will not work all the time.



input value="Go" onclick="history.go(-1)" type="button"

The javascript function history.go is very useful if the client has javascript enabled. If they do not have javascript enabled this button will do absolutely nothing and frustrate your user beyond all means


The second option is to use the server to store the search params



# staff_controller.rb
def view_applications
if params[:type] == "requery"
search_params = session[:search_params]
else
search_params = params
session[:search_params] = params
end
@applications = Staff.find_applications_by_params(search_params)
end

As you can see when the view_applications method is called the params are checked for a variable called type, if this is being called from the original search that field would be empty and the else portion kicks in causing the params to be stored in session. Below you will see the link_to example from the page that shows the details of a record. You will notice that the params have a type that is set to requery, which triggers the function to use the params from session to display the results.



link_to "<< Back to Search Results", :action => :view_applications, :type => "requery"

There you have it, a way in rails to use the search results from before. If you have any other ways of doing this please post a comment.


Enjoy,
-CH

Monday, August 06, 2007

Guitar Hero III

So I found this post on digg........




Wednesday, August 01, 2007

RoR Gotchas

So today I was working on re-factoring an application that I was handed. The application had everything plugged in the controller initially so in the name of MVC I started to move things to the model file. While in the model I had a method that looked like this:


def self.find_applications(params)
composed_cond = Caboose::EZ::Condition.new

cond_three_letter_code = Caboose::EZ::Condition.new :programs do
three_letter_code === params[:find_only_program_codes]
end

cond_status = Caboose::EZ::Condition.new :study_abroad_applications do
status === params[:find_only_statuses].
to_s.downcase.gsub(" ", "").gsub(",", ";").split(";")
end

cond_terms = Caboose::EZ::Condition.new :deadlines do
term_year === params[:find_only_terms].
to_s.downcase.gsub(" ", "").gsub(",", ";").split(";")
end

composed_cond << cond_three_letter_code
composed_cond << cond_terms
composed_cond << cond_status

@applications = StudyAbroadApplication.find(:all,
:include=>[{:deadline => :program}, :user],
:conditions => composed_cond.to_sql, :order => "deadlines.id")

unless @applications == 0
puts "Size: #{@applications.size}"
else
flash[:notice] = "There was an error retrieving your application records"
redirect_to :action => "index"
end
end


With me being a noob to RoR I completely forgot about my background in procedure based programing and thought nothing of the last statement. Hell if it puts out the size of the array thats what I wanted right? Well that was what I got, but what I didn't get was the @applications array that I wanted to display in my view. So there you have it just make sure that the last thing in your method is what you want to return. Learn from my mistakes and save your self some tail chasing. :)

-CH