Autocomplete in Rails 2.0

I’ve been trying out the newly released Rails 2.0. Lots of cool new stuff. However, it takes some time to get used to doing things the new way if you haven’t been working from EdgeRails.

One of the features that came out of the box in previous releases was support for autocomplete using scriptaculous. This has now been moved from the core rails install to an install via plugin.

Just install the plugin via:
script/plugin install http://svn.rubyonrails.org/rails/plugins/auto_complete

Then, you have to turn off the cross-site request forgery protection that comes with Rails 2.0.

You can do this at the Controller level by adding something similar to the following:

class UsersController < ApplicationController
protect_from_forgery :only => [:update, :delete, :create] // exclude the auto_complete method
...
end

If you don’t do this, your autocomplete actions will throw an ActionController::InvalidAuthenticityToken exception which caused me hours of confusion.

Autocomplete in Rails 2.0

Business of Software

It’s been a very relaxing weekend. I spent most of my time plopped on the couch reading Eric Sink on the Business of the Software. The book is really just a collection of blog posts on Eric Sink’s blog but I enjoy holding a book rather than a laptop when reading for long periods of time. After reading countless technical books/blogs, it was extremely refreshing to read something like Sink’s book.

The book is split into four parts: entrepreneurship, people, marketing, and sales. The section that covers entrepreneurship reminds me of Guy Kawasaki’s The Art of the Start. The section on people covers the kind of people you want to work with and hire, which reminds me of Joel Spolsky’s recently released Smart and Gets Things Done. The section on marketing is what really made me enjoy this book. After reading Eric’s book, I have a newfound appreciation and a deeper understanding of the dark science known as marketing. He breaks it down and explains it from a developer’s perspective. The sales section is not surprising about how to get a potential customer to give you money for your software.

The book has a lot of insight into becoming ISV (Indepedent Software Vendor), more specifically a microISV. I think all software developers have pondered the what-ifs and wouldn’t-it-be-cool of starting their own software company. Very few make the jump. I would like to change that statistic.

Business of Software

Mongrel + Apache = rails.notedpath.com

After fighting apache for a couple hours, I finally have mongrel set up to proxy through apache.

At first I had the proxy module enabled but was getting a 403 page. After adding logging to the vhost config, I see

[Mon Sep 10 22:57:00 2007] [warn] proxy: No protocol handler was valid for the URL /. If you are using a DSO version of mod_proxy, make sure the proxy submodules are included in the configuration using LoadModule.

I go ahead and find out I didn’t have proxy_http enabled. After executing sudo a2enmod proxy_http and bouncing apache, TA-DA!

Rails - Hello, World!

Mongrel + Apache = rails.notedpath.com

Apache2.2 up and running finally!

Yay! I got apache upgraded to 2.2 from 2.0. It was a lot easier after I was told by Aaron that Feisty has 2.2 in their apt-get repositories. I just had to update from Dapper to Feisty. Prior to updating I did have to comment out all of the repositories I had added to my /etc/apt/sources.list. I was running into some broken wgets otherwise.

After commenting out the additional repository lines, I just followed the steps here and viola! apache2.2 comes up.

I did have to reinstall mod_jk for apache2.2 but that was a easy.

And the day is mine.

Apache2.2 up and running finally!

apache2/mod_proxy_balancer woes (part 2)

Well, I got to like the second step before I hit another roadblock. Looks like kodefoo’s repository only supports binary-i386 releases. Too bad my slice is on an AMD64 machine which means I need the amd64 release. I guess if I want to cluster mongrel with apache, I’ll have to compile from source. Sigh…

Prior to hitting this road block, I ran apt-get remove apache2 and it didn’t remove apache2 from my slice even though it said it did. So that’s a little confusing. I continued with the kodefoo tutorial regardless until I came across the problem noted above. I’ll eventually have to figure out how to do a clean remove of apache2.

At this point, I think I am just going to try to get a single mongrel served up through apache2. Hopefully, this will be easier…

apache2/mod_proxy_balancer woes (part 2)

Cultivating work environments

Paul Graham just wrote a very insightful piece that I hope companies take note of. The start of the essay speaks to how important it is for programmers to have the ability to store the entire context of a problem in their head so they can navigate to all the pieces they need to work on. This is key for solving big problems and facilitates effective productivity. Graham goes on to provide 8 ways to help programmers to do this.

One of the ways he suggests is to work in small groups. At my work, we do a lot of pair programming and sometimes 3-way programming. I find this to be extremely effective for the way I code. I enjoy being able to constantly ask if this is the right way to approach a problem or am I understanding the problem correctly. With pair programming, I get immediate feedback by my teammate(s) and it helps to spread knowledge of the code base without having to go through code reviews.

The second half of the essay is what really inspired me to write this post. Graham makes the claim that companies deliberately try to do things wrong when it comes to dealing with programmers.

Graham writes:

One of the defining qualities of organizations since there have been such a thing is to treat individuals as interchangeable parts.

It’s not merely true that organizations dislike the idea of depending on individual genius, it’s a tautology. It’s part of the definition of an organization not to.

The weakest point in big companies is that they don’t let individual programmers do great work.

Moral of the story: Create a work environment where developers are truly valued. They are the problem solvers. They are the closest to the product. They are the ones bubbling with ideas. Listen to them. Don’t act like a big company no matter what your size is. This is how to beat your competitors.

Cultivating work environments

apache2/mod_proxy_balancer woes (part 1)

So I’ve still been trying to get mod_proxy_balancer installed. I tried just getting a compiled mod_proxy_balancer.so and drop it into my existing apache2 install but upon start up I get:

Cannot load /usr/lib/apache2/modules/mod_proxy_balancer.so into server: /usr/lib/apache2/modules/mod_proxy_balancer.so: undefined symbol: proxy_hook_post_request

Looks like I have to do a clean uninstall and reinstall of apache2 from source. I’ll have to resetup svn (svn_dvn) and all my virtual hosts so this blog is going to be MIA while I go through this process.

I can’t wait until the Ubuntu repositories update apache2 to 2.2 so mod_proxy_balancer support will be as simple as apt-get install apache2.

I think the next step is to remove my existing apache2 install and give kodefoo’s tutorial a shot.

apache2/mod_proxy_balancer woes (part 1)