Rails 2.0 has introduced a new and easy way to alter the attributes of a model.
To add an attribute “author” to a model “post” :
script/generate migration AddAuthorToPost author:string
To delete this attribute :
script/generate migration RemoveAuthorFromPost author:string
Add and Remove specify the action to do and Post, separated by To or From, is the name of the model.
Don’t forget to run the migration by using :
rake db:migrate
Popularity: 26% [?]
As I reinstalled my MacPro recently, I needed to setup Git again. The last time I installed it, I had to compile all the dependencies and Git myself but things have changed.
Thanks to Tim Charper, you’ll just have to download and install a nice .dmg package ! You can grab your copy here : http://code.google.com/p/git-osx-installer/
Have fun with Git !
NB : For all subversion addicts, Versions is finally out of beta : http://versionsapp.com
Popularity: 32% [?]
We were facing at work a high load on a TomCat application server that is currently configured with Apache acting as a proxy. We had to increase the number of server in order to correctly handle the load. But how do you load-balance multiple TomCat instances ?
We began to test it with Apache’s mod_proxy_balancer but you can only set a theorical server weight (for example : server1 70% of requests, server2 30% of requests). So we began to search for another solution that would do the load-balancing without any new hardware other than simple linux dedicated servers.
After several minutes where we hesitated between nginx and Squid, we actually decided to put nginx on a staging server… and that was wonderfull (even flabbergasting) !
The new setup is as follow :
- Debian Core2Duo 2.66Ghz with 2Gb RAM configured with nginx as a reverse proxy (with load-balancing),
- 2 Debian Quadri-Xeon 3.00Ghz with 8Gb RAM to handle two TomCat instances.
Here is my nginx config with the fair module which test the load on both servers before sending them the real request :
worker_processes 1;
error_log logs/error.log notice;
pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
log_format lb '[$time_local] $remote_addr => $upstream_addr($upstream_status) in $upstream_response_time$
access_log logs/lb.log lb;
sendfile on;
tcp_nopush on;
keepalive_timeout 0;
gzip on;
upstream novacat {
server srv1.xxx.eu:8080;
server srv3.xxx.eu:8080;
fair;
}
server {
listen 80;
server_name xxx.eu;
location / {
proxy_pass http://xxx;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect false;
}
}
}
Popularity: 79% [?]
Many web developpers that used to code with PHP (including me) are now very interested in switching to a more robust language and discovering how you could more quickly create a webapp thanks to a framework.
Some fellow PHP developpers built up a blog to provide everyone many tips & tricks on both language and how they differ : Rails for PHP developpers.
As the main author Mr Paul M. Jones is saying himself :
“This is a thorough and approachable introduction to Ruby and Rails for PHP programmers from fellow developers who are well-versed in both Ruby and PHP.”
All articles are pragmatic examples focusing on the behaviour of both languages. For example :
Popularity: 79% [?]
The web-based subversion browser that doesn’t suck is now opensource and free. The guys at ActiveReload decided to open their great webapp to everyone.

You can checkout the code and enter the community at warehouseapp@github or you can see a demo here.
Also take a look at the official site : http://warehouseapp.com/
Popularity: 100% [?]
As Rails 2.x is now available, you must have saw that the views templates are now .html.erb files instead of .rhtml ones. Those new extensions are not recognized for those who are coding with TextMate on Mac.
All you need to correct this issue is going to Textmate Menu: Bundles -> Bundle Editor -> Show Bundle Editor -> Ruby on Rails -> Rails (HTML) and find the line :
fileTypes = ( 'rhtml' );
Now replace it with :
fileTypes = ( 'rhtml', 'erb' );
And you’re done.
Popularity: 82% [?]


