19th - 25th September 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, with contributions from Christophe Grandsire.
Articles and Announcements
- Ruby 1.8.3
- New RubyForge Mirrors
Ruby 1.8.3 was released, hurrah!
An issue with Rails was reported (error around Logger::Format, Rails’ fault), and a patch was written for Rails to fix the issue.
Tom Copeland thanked HostingZero for becoming the fourth file mirror for RubyForge, “thanks specifically to Scott Braynard for coordinating the mirror setup.”
A few days later he posted A big thank you to Robby Russell… for another mirror, thanks to Robby’s web-hosting company PlanetArgon.
User Group News
- Weekly meeting of the Agile Maryland Ruby on Rails CodeProject CodeFest
- PDX.rb - October 4th special guests
- Toronto Ruby User Group - 2 Oct Meeting
Jeff Waltzer announced the week’s Columbia (Maryland, U.S.) Ruby on Rails CodeProject CodeFest.
Tonight we’re going to continue with the searching story and I’m going to push for adding in some AJAX functionality (Of course the Customer has final say if we do this). It looks like its going to be a nice day and recently we have been doing our coding at the tables right out in front of the Panera Bread. This will be a great chance to catch some sun. :)
“We’re all learning Ruby and Rails so even if you don’t know much about either pelase come and join the fun.”
Robby Russell announced that the Portland Ruby Brigade were excited about their next meeting (Ruby Tuesday the 4th of October), due to the attendance of Derek Sivers of CD Baby, who along with Jeremy Kemper (also coming) have been rewriting CD Baby to use Ruby/Rails/PostgreSQL instead of PHP/MySQL.
This month’s meeting of the Toronto Ruby User group is on Sunday the 2nd of October, at the Linux Caffe.
Link of the Week
Web Development Bookmarklets are a set of bookmarks (each of which is really some Javascript) that assist with web development.
For example, in Firefox, drag the “edit styles” bookmarklet to your bookmarks toolbar folder then go to a web page. Clicking the bookmarklet pops up a window containing the CSS for that page.
Oh yeah, that CSS - it’s editable. Change it, and the page dynamically changes without needing to reload.
Wicked.
Threads
MLTypes: ML-style qualified unions for ruby
Logan Capaldo: “I’ve always liked ML-style languages for declaring new types, and I thought hey, let me try to do that in ruby, its already got a case statement that reminds me of ML.”
An example, using Logan’s MLTypes module.
deftype :Tree do
:Leaf.of(:data => :Object) | :Branch.of( :data
=> :Object, :left => :Tree, :right => :Tree )
end
def print_tree_inorder(tree)
case tree.tag
when :Leaf
puts tree.data
when :Branch
print_tree_inorder(tree.left)
puts tree.data
print_tree_inorder(tree.right)
end
end
MS Access
Steve wanted to know whether it’s possible for Ruby programs to read and manipulate data stored in Microsoft Access files.
The answer was, “yes”, Ruby’s standard database interface (DBI) can use Access, via either ADO or ODBC.
ruby-dev summary 26957-27102
Koichi SASADA posted a summary of the Japanese list ruby-dev.
It includes the news that Ruby’s C code will be changed to use ANSI function definitions, instead of K&R, as well as U.Nakamura’s work to make select() work with pipes on Windows and not just *nix systems.
Places for a programmer to live?
Devin Mullins: “While we seem to be rife with OT threads, I thought I’d throw in an OT question that’s been percolating in my mind for quite a while” – where are good places for programmers to live?
Andrew Stuart:
A programmer should live in a dark room in a city with a cool climate to avoid feeling any obligation to go outside. There should be a fridge close to hand and a cafe over the road. There should be a fast Internet connection and a reliable power supply. The city itself is irrelevant.
Robby Russell pointed out that Portland in Oregon meets this requirement, at least in winter. “The sun will soon be hiding itself in Portland again and all the programmers will go back inside and wait until next year to come out again. :-)”
Hemis said that “Tampere, Oulu and Helsinki in Finland” were even better options according to this criteria.
Difference between summer and winter here is that summertime it’s raining water (and sometimes snow) and in wintertime it’s raining snow (and sometimes water).
Another Portlander, Phil Tomson, asked and answered “Why are all the techies moving to Portland, OR?” – lots of user groups, good weather, reasonable cost of living, very good public transport. And hey – Linus lives there.
Zed A. Shaw gave a list of places he’d lived in, with their ups and downs: Guam, Maryland, Seoul, Tempe (Arizona), Bellingham (Washington), Austin (Texas), Vancouver, Tacoma (Washington), Portland and New York City.
Matt Lawrence asked specifically about places outside the U.S, saying “I’m an American and I’m seriously looking for the chance to work and live elsewhere, preferably somewhere that I can get by only speaking English (and Ruby).”
Daniel Berger suggested “England, Ireland, New Zealand, Australia, Canada” as English-speaking countries, to which Lothar Scholz added Singapore.
ri usage tidbit
Kevin Ballard gave a nice little alias for getting pretty ri output on *nix systems:
alias ri='RI="${RI} -f ansi" LESS="${LESS}-f-R" ri'
“Basically it tells ri to spit out ANSI-formatted text and tells less to not complain about the ANSI escape codes.” —> pretty :-)
Block that takes a block
Edward Faulkner asked how to create a block that takes a block. “This doesn’t parse:”
myproc = proc{|&blk| [1,2,3].each(&blk)}
“The main reason I want to do this is to create a method with ‘define_method’ that takes a block argument.”
Brian Mitchell said that the above works in the development version of Ruby (1.9).
Yet another blog...
Hal Fulton is having Hal-lucinations again.
Math Captcha (#48)
Gavin Kistner came up with this week’s Ruby Quiz:
Overview
--------
"What is fifty times 'a', if 'a' is three?" #=> 150
Write a Captcha system that uses english-based
math questions to distinguish humans from bots.
News is Nice
Trans found a nice site, www.rubyweeklynews.org. Check it out.
New Releases
FuseFS-0.1
<COOL> Greg Millam announced FuseFS, which “lets ruby programmers define filesystems entirely in Ruby. That is – with FuseFS, you can now create a virtual filesystem out of ruby objects, SQL databases, anything!”
(It only works on Linux at the moment, since it uses Linux’s FUSE, but ideas for running on other systems were discussed, e.g. using WebDAV.)
Several hours later, _why posted a RailsFS script to RedHanded. Using FuseFS, it allows you to mount ActiveRecord objects as a filesystem, so that e.g. mnt/items/52 is a YAML document that you can read and edit.
(See also the FuseFS-0.2 and FuseFS-0.3 announcements.) </COOL>
MockFS 0.1.2
“Hi everyone,” sang Francis Hwang as MockFS lumbered forward to version 0.1.2, “MockFS is nothing less than an attempt to simulate a file system in memory for the purposes of testing.”
nbfifo-0.0.0 - non blocking fifos for threads
Ara.T.Howard posted the first version of nbfifo – “thread and process safe non-blocking fifos for ruby”.
when using fifos from ruby threads it is extremely easy to block the entire process via some operation done on a fifo such as opening it or reading/writing to/from it. rbfifo.rb is a proof-of-concept class showing how fifos can be used from a ruby multi-threaded process in a way that ensures no threaded operation will block the entire process.
traits-0.7.0 - hooks and validation
Ara.T.Howard:
traits.rb is set of attr_* like methods on steroids, caffeine, and botox. it encourages better living through meta-programming and uniform access priciples. traits.rb supercedes attributes.rb. why? the name is shorter ;-)
Pre and post ‘hooks’ were added, e.g.
class C
trait 'a',
'pre' => proc { |val| p "#{val} to set with" },
'post' => proc { |val| p "#{val} set" }
end
validate was added as a special case of a pre-hook:
class C
trait 'number', 'validate' => proc { |n| Numeric === n }
end
Lafcadio 0.8.0
Lafcadio is an object-relational mapping library for use with MySQL. It supports a lot of advanced features, including extensive aid in mapping to legacy databases, in-Ruby triggers, and an advanced query engine that allows you to form queries in Ruby that can be run either against the live database, or an in-memory mock store for testing purposes.
Query caching was added, as well as some API improvements.
Rails Analyzer Tools 1.1.0
Eric Hodel:
Rails Analyzer Tools contains Bench, Crawler, RailsStat, IOTail and SyslogLogger libraries, and the programs bench, crawl and rails_stat based on these libraries.
I have used bench and crawl to tune the number of FastCGI processes running on 43things.com, determine if HyperThreading would give a performance benefit or not (it did) and find a fatal threading bug in MySQL.
The new version features the addition of the bench and crawl utilities, and an improved SyslogLogger.
Dissident 0.1, a Ruby dependency injection container
Christian Neukirchen announced the first version of Dissident, a Ruby dependency injection container that is “unobtrusive”, “easy” and “lazy”.
But why write a new DI framework at all? There are some prejudices in the Ruby community with respect to that. People say “they make things complicated” and “there are more frameworks than users”. Of course, that may be true---but it shouldn’t be for all of them. Therefore, I decided to make one that’s not complicated, because you barely notice using it, one that’s easy to pickup, because you can learn it in an afternoon and only need to write a few additional lines of Ruby---no XML or YAML needed, one that actually helps coding, because else it’s a hobble and therefore no fun, one that eases testing, because you can mock the services easily (don’t use a container at all, or simply inject mocks), one that feels like Ruby, because you should never tangle in bad ports of Java libraries; in the end, I decided to make one that I personally like and want to use, because there is no point in making libraries you don’t use on your own.
If you don’t know what “dependency injection” is, check out the thread, as it includes some useful links.
RDE 1.0.0
Sakazuki released RDE version 1.0.0:
RDE is the development environment for ruby on windows. You can edit, run and debug your scripts quickly and easily. RDE debugger is the GUI wrapper of debug.rb. RDE editor has functions that syntax coloring, autocomplete and etc.
There are many enhancements, already a few bug reports, and no Linux version planned!