From: timsuth@... (Tim Sutherland) Date: 2005-08-14T19:26:18+09:00 Subject: Ruby Weekly News 8th - 14th August 2005 http://www.rubyweeklynews.org/20050814.html Ruby Weekly News 8th - 14th August 2005 --------------------------------------- Ruby Weekly News is a summary of the week's activity on the ruby-talk mailing list / the comp.lang.ruby newsgroup, brought to you by Tim Sutherland. Articles and Announcements -------------------------- * OSCON videos, medias ---------------------- why the lucky stiff posted videos from the OSCON conference. Foxes and magic elves abound. In a related thread, Matz talk at oscon, a link to Matz' slides was given. The presentation was about Ruby's blocks. * The next Web revolution ------------------------- An article on Salon discusses web applications, in particular 37 Signals and Ruby on Rails. (Click the "print" button to see the whole article without needing to view an advert.) * Interview with Biologist Pjotr Prins -------------------------------------- Ara Howard and Justin Crawford interviewed Pjotr Prins for the SciRuby project. Pjotr is using Ruby to assist with Biology research. * Agile Web Development with Rails ---------------------------------- The book Agile Web Development with Rails is "Now In Stock and Shipping!". It's written by Dave Thomas and David Heinemeier Hansson with Leon Breedt, Mike Clark, Thomas Fuchs, and Andreas Schwarz. Dave is the co-author of Programming Ruby, and David created Rails. That's credibility :-) Quote of the Week ----------------- Austin Ziegler responding to a question about how you can make money from Ruby software if you release it under an Open Source license. | I can't speak for Tom, but I've actually never earned a penny from my | open source projects. Not that I wouldn't *love* to, but for me, it | isn't about making money from these projects. | | Don't get me wrong -- if anyone wants to donate to the "Encourage | Austin" fund, I'll not turn it down. It'll help defray my costs to | RubyConf ;) I do this because I *love* it, and it keeps me thinking | about different programming mechanisms and paradigms that I don't get to | work with at my day job. This is *very* valuable, because I've been able | to present ideas that have been accepted even though they're a bit | "off-the-wall". Because I love doing this, why should I be selfish? I | share what I do. Link of the Week ---------------- http://www.malevole.com/mv/misc/killerquiz/ Programming Language Inventor or Serial Killer? A Flash quiz. Too late for OSCON, hope everyone made it out okay. Threads ------- Interesting threads included: Ruby report generation tool --------------------------- Greg Brown announced his project "Ruport"; a pure-Ruby reporting tool. It allows you to run queries against a database, and output the result to formats such as PDF. (Using Austin Ziegler's PDF::Writer.) "So...if you had your ideal reporting tool in Ruby, what would it be like?" Daniel Berger and James Edward Gray II said that they too had developed (in-house) reporting software. Both output CSV data, which is then imported into Excel. James then uses Excel macros to "pretty it up". James: "I've looked at using Excel's XML format in the past, which allows most formatting, but its lack of chart support (when I last checked, some time ago) was a show stopper for my company." Daniel noted that he originally created Spreadsheet::WriteExcel in order to directly create Excel reports. "However, I decided that PHB's wasted too much of my time with inane crap like, "Can you make the column headers blue?". From now on they get CSV files only. Nyah." "PS - The html-table package was also written with reports in mind. :)" Ruby PDF text extractor ----------------------- Kevin Olbrich: "I notice that Ruby has lots of tools for creating PDF files, are there any that let you extract text from a PDF file?" Austin Ziegler said "Not yet", but added that he will probably be releasing PDF::Reader in early 2006. Scheduling ---------- This week's Ruby Quiz was written by Hans Fugal. | You have a list of employees along with the hours they would like to | work, and the hours they cannot work. You have a list of hours that need | to be worked. (Extra credit for allowing for a different number of | employees needed at different hours.) | | Write a scheduler that schedules employees without scheduling them on | hours they cannot work. It would be nice if the employees got as many of | the hours they wanted as possible. It would be nice if the employees | didn't end up with split shifts, had more or less consistent hours from | day to day (e.g. Joe gets scheduled in mornings), and so forth. force_recycle ------------- Simon Kroeger's program was using a lot of memory, and he wanted to tell Ruby explicitly that some objects should be recycled - even though there were still references to them. Nobu said that such a feature would be too dangerous, giving the following example. "Accessing recycled object would raise "terminated object" exception if you're lucky." |x = Foo.new |GC.force_recycle(x) |x.inspect Joel VanderWerf pointed to a patch he had written back in the Ruby 1.6 days. It adds a method GC.reachability_paths(obj) "which returns a list of all the ways you can reference that object, starting from the basic references such as C and ruby globals, stack variables, and others." Simon coud use this method to find out why the objects he thought were "obsolete" were not being collected, and fix his program to behave correctly. Nobu thought this was interesting, and ported the patch to the current CVS version of Ruby. event driven framework for ruby ------------------------------- Snacktime asked if Ruby had an "event driven framework", Perl's POE or Python's Twisted. One use of such a framework is when a large number of clients are connected to a server. If you use one Ruby thread for each client, then Ruby will use `select' internally to monitor for data on the sockets. Yohanes Santoso noted that most `select' implementations degrade "linearly wrt number of sockets to be monitored". In contrast, `event driven frameworks' usually use different operating system APIs that perform better with a large number of connections. Zed Shaw said that he'd written a library called Ruby/Event. It wraps the libevent C library. Zed also wrote a small framework on top of this, named Myriad. "I used Myriad to write the SCGI client/server which can host Ruby on Rails applications." Tanaka Akira posted a comprehensive look at issues with non-blocking IO. Time to vote for Ruby: SD's 2005 Readers' Choice Awards ------------------------------------------------------- Bil Kleb posted a link to a research company's "Readers' Choice Awards", and suggested people vote for Ruby as the "best scripting language". Rob responded, saying | The poll is devoid of any meaning. I'm not voting because it will | increase the purported validity of this "alledged" survey concocted by | Wilson Research Group. | | These alledged "research" companies are in business to sell validity to | the proprietary model of software production. In general the free | software community has no money to pay for surveys, so "research" | companies have little incentive to acknowledge the community-based | peer-production model of software development. | | This poll is part of the inefficient enterprise software industry | apparatus that we are undermining with dynamic languages and agile | development approaches. Leave the dinosaur to die in peace. Date from dd-mmm-yyyy --------------------- Chris Roos asked how to convert a string like "10-Aug-2005" into a Date object. Kirk Haines suggested: |require 'date' |d = Date.parse('10-Aug-2005') Patrick Fernie gave the more explicit |require 'date' |d = Date.strptime("10-Aug-2005", "%d-%b-%Y") Which Regex-Engine will be used in Ruby 1.8.3 Release? ------------------------------------------------------ Wolfgang Nadasi-Donner asked "One short question" - "Which Regular Expression Engine will be used in the Ruby 1.8.3 release (Is it still the old one or Onigurama 2.4.*)?" Matz replied: "One short answer: old one." Loading XML file from web ------------------------- Singee15 was trying to get an XML document from a webpage. The following didn't work: |file = File.new( "http://www.digg.com/rss/index.xml" ) Kevin Olbrich suggested using open-uri. An example: |require "open-uri" |data = open("http://www.digg.com/rss/index. xml") { |f| f.read } FXRuby or wxRuby? ----------------- Various toolkits for developing Ruby GUI applications were compared: FOX, wxWidgets, Qt and Gtk+. Bindings at the time of Exceptions ---------------------------------- Adam Sanderson wanted to know if, given an exception, you could get the binding from the point at which the exception was raised. Using this, you could see the values of variables at that point. "Can anyone think of some trickery to do this? I think it would be of great use for debugging and whatnot, and massive points for cool ruby hackery ;)" Joel VanderWerf said "No trickery, but you do have to have the cooperation of the code which raises", and gave a solution whereby you simply pass binding in when you raise and exception. Lothar Scholz added that the ArachnoRuby IDE provides this feature through its debugger.