15th - 21st July 2007
Ruby Weekly News is a summary of the week’s activity on the ruby-talk mailing list / the comp.lang.ruby newsgroup / Ruby forum, brought to you by Krishna Sankar.
This week we had ~1600 messages. Sorry for the tardiness, I was on vacation …
Articles and Announcements
- Russian translation of LTP
- Essential Rails registration now open
- xml-map
Russian translation of Chris Pine’s original tutorial “Learn To Program”
Rails class in Chicago on September 21/22
“xml-map is easy to use XML to ruby object library with rails-like models, validators and more ^^, it uses vary fast libxml instead of slow and old REXML, you need version 0.4 of libxml to work properly”
Quote of the Week
Rules of Optimization: Rule 1: Don’t do it. Rule 2 (for experts only): Don’t do it yet. – M.A. Jackson
“More computing sins are committed in the name of efficiency (without necessarily achieving it) than for any other single reason – including blind stupidity.” – W.A. Wulf
“We should forget about small efficiencies, say about 97% of the time: premature optimization is the root of all evil.” – Donald Knuth
“Optimization hinders evolution.” – Anon. Quotd by Ryan Davis
Threads
Time range min/max inconsistency
An interesting bug/inconsistency where some times results are returned in local time zone instead of UTC. Matz replied that there was indeed a bug and it is fixed.
Force calculation result to BigDecimal
Discussion on coercing calculations to Big Decimal than float
Spin buffers
More discussion on spin buffers, synchronization, fastthread et al. Good read
Creating Output Tables
Ruby Report (ruport) is a good solution to create table outputs. The open source book on ruport is being developed at http://ruportbook.com/
Symbols
Discussion on symbols, usage (they are fast), GC (symbols are not GC-ed),...
What is the fastest way to convert a object?
A good discussion on marshaling remote objects, mixin, et al
Calling a Perl script from Ruby
A discussion on calling Perl from Ruby (as the title suggests) – solutions include the system(), ``,Kernel.``,...
Check Flock Status on File
The problem is to check the lock status of a file before processing it – for example wait until ftp is done before doing something with the file. A good solution is at http://drawohara.tumblr.com/post/5891548
How to colorize text in windows console?
Solutions : http://www.google.com/search?q=ansi+color+codes http://rubyforge.org/projects/win32console/ http://www.jpsoft.com/4ntdes.htm http://viewvc.rubyforge.mmmultiworks.com/cgi/viewvc.cgi/trunk/ highline/examples/ansi_colors.rb?revision=116&root=highline&view=markup
clean nice way (hash)
Couple of good pointers & counter points on hashes. Started out as “i “got a hash { ‘1’ => ‘some’, ‘4’ => ‘thing’, ‘6’ => ‘good’ } and i want to turn it into { ‘1’ => {‘name’ => ‘some’}, ‘4’ => {‘name’ => ‘thing’}, ‘6’ => {‘name’=>‘good’} }
Accessing the name of the current function
How to reclaim memory without GC.start
A good thread on how to reuse a buffer for reading from a file (in a loop) than creating new objects
Loop over an array that changes the elements
map! is probably the most idiomatic way of doing this:
numbers.map! {|x| 2*x}
tail-recursion
running a huge site
Good discussion on scalability of apache with Eruby, ...