Posted on December 20, 2006
ruby-debug 0.5.1 has been released! The installation as usual:
$ sudo gem install ruby-debug
Below is the list of changes:
Post-mortem debugging
First of all, what the heck is post-mortem debugging? Let's say you run a script and instead of the expected result you get an exception trace. Wouldn't it be great if we can roll back to the point where this exception is raised and explore the state of your program (possibly, by moving up and down the frame stack)?
Note that it is different than setting a catch point. By setting a catch point you activate the debugger when an exception (of a specific class) is about to be raised and it doesn't matter whether it's going to be handled later in the code or not. In the post-mortem case you know that an exception's been raised and not handled as expected.
Now I'm going to demonstrate several ways of using this feature, starting from the simplest:
Filed under: Ruby ruby-debug |
Posted on December 16, 2006
Google calculator is a very powerful tool. Besides basic arithmetic, you can use it in many other interesting ways. But I always wanted to use it from the command line without opening a new Safari window.
Ruby to the rescue:
$ cat gcal
#!/usr/bin/env ruby
%w(rubygems open-uri hpricot erb).each {|lib| require lib }
doc = Hpricot(open("http://www.google.com/search?q=#{ERB::Util.u(ARGV*' ')}"))
puts (doc/'/html/body/p/table/tr/td[3]/font/b').inner_text
$ ./gcal 2^20
2^20 = 1 048 576
$ ./gcal 'sqrt(-1)'
sqrt(-1) = i
$ ./gcal 30 rubles in dollars
30 Russian rubles = 1.1379844 U.S. dollars
$ ./gcal 2 gallons in liters
2 US gallons = 7.5708236 liters
It's not too bad for three-liner like this. By the way, did I say that Hpricot is awesome?
Filed under: Ruby |
6 comments
Posted on December 13, 2006
I've been dealing with SOAP/WSDL a lot lately, and this is beside trying to play a role of ActionWebService maintainer. There are several points to mention. First off, everyone wants to use SOAP no matter whether it makes sense or not. Not a single company I've worked with had a slightest idea of what SOAP/WSDL is. OK, I take it back. What a f*ing mess it is...
Anyway, I was quit pleasantly surprised today after reading this article at InfoQ. It means there are still some sane people left in WS-* crowd. Pete Lacey's The S stands for Simple only proves my point.
Also I'd like to thank NAKAMURA Hiroshi, the author of soap4r library. It is a tough job to live in the mess like this, and his library is the best one I know in the dynamic language landscape that provides a decent SOAP/WSDL implementation. He also praises ruby-debug as a quite useful tool for debugging soap4r applications! Very much appreciated.
Filed under: SOAP |
1 comment