Thursday, January 19, 2012
Monday, December 19, 2011
ruby step iterator
A loop from 0 to 12 by 3 can be written as follows.
0.step(12, 3) {|x| print x, " " }
produces:
0 3 6 9 12
Wednesday, December 7, 2011
Tuesday, December 6, 2011
Custom timeout for Net::HTTP Requests in Ruby
http = Net::HTTP.new(host, port)
http.read_timeout = "timeout in milliseconds"
Saturday, December 3, 2011
Open current directory in terminal from nautilus
install nautilus-open-terminal.
1 . sudo apt-get install nautilus-open-terminal.
2 . logout and login or give "nautilus -q" in terminal.
Now in your right-click menu you can open a terminal, and it will be in what ever directory you are currently in in Nautilus
1 . sudo apt-get install nautilus-open-terminal.
2 . logout and login or give "nautilus -q" in terminal.
Now in your right-click menu you can open a terminal, and it will be in what ever directory you are currently in in Nautilus
Wednesday, November 30, 2011
Partial deploy using capistrano
Real projects are big and often have several megabytes of code. Sometimes, you need to quickly apply a ‘hotfix’ for a critical bug. Usually, a fix like that is small enough (containing only several lines of code) and affects only a part of the application. If so. it’s not necessary to restart the whole application – you need to restart only part of the running processes. In the end, you don’t need to go through the entire deployment process.
check this out http://blog.railsware.com/2011/10/25/delivery-via-patch/
check this out http://blog.railsware.com/2011/10/25/delivery-via-patch/
Thursday, September 15, 2011
Ctrl+C to exit from exception ruby
rescue SystemExit, Interrupt
raiserescue Exception => e
#...
end
you can use SystemExit, Interrupt classes to exit from script with Ctrl+C
Subscribe to:
Posts (Atom)