http://skorage.org/2009/03/08/simple-thrift-tutorial/
A pretty nifty tutorial for a server/client in Java.
http://skorage.org/2009/03/08/simple-thrift-tutorial/
A pretty nifty tutorial for a server/client in Java.
I had some simple Ruby code that I was trying to comment out:
def my_method(args)
=begin
args.each { |k, v| puts "#{k} : #{v}\n" }
some other code here
=end
end
syntax error, unexpected ‘=’
=begin
^
syntax error, unexpected ‘=’, expecting kEND
=end
^
After a few minutes, I realized that the =begin and =end should be at the beginning of their line (with absolutely no preceding whitespace):
def my_method(args)
=begin
args.each { |k, v| puts "#{k} : #{v}\n" }
=end
end
Another gem from the ruby-talk mailing list: a fabulous Ruby QuickRef sheet!
Very useful for returning multiple values from a function (which I happen to do fairly often).
var a = (“hello”, 4, 3, true)
is a tuple, and its elements can be accessed through a._1, a._2 and a._3 (indexed at 1, not 0)
Pretty awesome!
I just found this app, and I love it! I’m always a little anal about whether my computer’s battery life is becoming shorter every day, but Coconut Battery also displays the maximum power of your macbook, and what it should be.
Understanding Ruby blocks, Procs and methods
Wonderful post on blocks/procs in Ruby!
21 Ruby Tricks You Should Be Using In Your Own Code
#13 is especially awesome!
From the ruby-talk mailing list, a pretty nifty trick: to change the process/application name (whatever shows up in your Task Manager), all you need is:
$0=”Whatever you want\0”
I now have smiley/sad faces, depending on whether my previous command executed.

PS1=”\n`if [ \$? = 0 ]; then echo \[\e[33m\]^_^\[\e[0m\]; else echo \[\e[31m\]O_O\[\e[0m\]; fi`[\[\033[36m\]\t\[\033[m\]] \[\033[32m\]\w\[\033[m\]\$ “