Ruby Weekly News 7th - 13th February 2005

T

Tim Sutherland

http://www.rubygarden.org/ruby?RubyNews/2005-02-07

Ruby Weekly News 7th - 13rd February 2005
-----------------------------------------

A summary of the week's activity on the ruby-talk mailing list / the
comp.lang.ruby newsgroup. This summary is brought to you by Tim Sutherland
(TimSuth).

Articles and Announcements
--------------------------

* [[WANTED] Feedback and developers for Win32 Utils]

Daniel Berger announced that the "Win32 Utils Team is looking for
a little help". Firstly, input from people using Ruby on Windows as
to which functionality needs to be added. Secondly, they're looking
for developers who can help with writing interfaces to the Windows
API. Example projects to be done are adding image support to the
win32-clipboard package and writing a port of the Win32::Screenshot
Perl module.

* [raleigh.rb February Meeting]

Nathaniel Talbott reminded Rubyists in North Carolina that the
Raleigh-area Ruby Brigade (raleigh.rb) are having another user
group meeting on the 10th of March.

* [extra Seattle.rb meeting]

In other user group news, pat eyler announced that there's an
extra Seatte.rb meeting coming up in a different location from
usual. "Since there are some Seattle.rb folks who live south of
Seattle, we've decided to get together for a hacking
session/meeting in Kent this Saturday."

* [Ruby developers in Argentina]

Michel Martens would like to be able to get in contact with Ruby
developers in Argentina, and encouraged them to sign up at the
BuenosAiresGroup wiki page.

Quote of the Week
-----------------

Jeremy Henty [sputtered] "Look, I'm *not* addicted to Ruby! I could give
up writing Ruby code any time I wanted to, just like that! I just don't
*want* to!"

Threads
-------

Interesting threads this week included:

[Stopping a thread]
-------------------

Bill Atkins had an instance variable @Thread that referred to some Thread.
He wanted to know how to stop @Thread from the main thread. Assaph Mehr
said that @thread.kill was what he wanted.

[a Ruby pdf writer that supports images]
----------------------------------------

Artotoy has a website that produces invoices as PDFs, using PDF::Writer,
but recently discovered that PDF::Writer seemed not to have support for
images.

Dan Fitzpatrick said that he was working on porting the PHP FPDF library
to Ruby. It was working for simple cases but needed a few weeks to work
out the bugs and add more advanced features.

Fredrik Jagenheim pointed out that the CVS version of PDF::Writer did have
support for images, through a method add_jpeg_from_file. The library's
author, Austin Ziegler, just hasn't got around to releasing a new version
yet.

[How come this doesn't work as expected?]
-----------------------------------------

Chris Gehlker was curious as to why the code
"testAry = testAry.each { |n| n.to_i }"
didn't modify testAry. Several people explained that each just
returns the original receiver and does not keep the block return-values
around. map (a.k.a. collect) should be used instead.

[Object#to_ruby and Object#to_c]
--------------------------------

Ben Giddings saw [a post] on the Ruby blog [RedHanded] that he thought was
interesting. (That post quoted Ryan Davis' blog, so you're now reading
this fourth-handed: a summary of a post that pointed to a blog that quoted
another blog that actually said something.)

It shows how ParseTree and RubyToC can be used to add to_c and to_ruby
methods to any Method. For example,

class Example
def example(arg1)
return "Blah: " + arg1.to_s
end
end

e = Example.new
puts(e.method:)example).to_ruby)

results in

def example(arg1)
return "Blah: " + arg1.to_s
end

[access to process list]
------------------------

Sven Bauhan wanted to get a list of system processes from within Ruby and
wondered if there was a better way than "proclist = `ps ax`". Daniel
Berger said that a library called sys-proctable is available for this.

[Performance of CGI::Cookie]
----------------------------

benny found that his web application was three times slower when
CGI::Cookie was used. He discovered a post on ruby-talk that linked the
problem to the CGI::Cookie's use of SimpleDelegator. Matz said that the
fix would be merged into Ruby 1.8.3. The patch is as simple as

- class Cookie < SimpleDelegator
+ class Cookie < DelegateClass(Array)

The reason for the big performance difference is that with
SimpleDelegator, every time you create an instance of Cookie it has to
define all the delegated methods on itself. In comparison,
DelegateClass(someClass) defines these methods just once.

[[SUMMARY] Solving Tactics (#18)]
---------------------------------

James Edward Gray II summarised last week's [Ruby Quiz]. The problem was
to take a simple board game and determine who would win if both players
chose optimal moves: the first player or the second.

From the [original quiz description] by Bob Sidebotham, "There's a little
pencil and paper game, Tactics, played on a 4x4 grid. The play starts with
an empty grid. On each turn, a player can fill in one to four adjacent
squares, either horizontally or vertically. The player who fills in the
last square loses."

They key optimisation in the solutions was to recognise that since squares
are either "on" or "off", the board state can be represented as a 16-bit
integer. That means there are only 65536 board we need to consider. The
rest of the solution simply determines which boards will result in
eventual wins for the first player and which will end in eventual losses.
(It uses the "dynamic programming" algorithmic technique.)

[ruby-dev summary 25481-25641]
------------------------------

Kazuo Saito summarised the Japanese list ruby-dev. One of the items was
about the process of merging the Ruby/DL2 library into Ruby 1.9.

[Amazon + 43Things]
-------------------

martinus heard that Amazon was investing in [43 Things], a website well
known to many in the community for its use of the [Ruby on Rails] web
framework. If you've seen recent news articles about Amazon investing in a
"blog site", this is the site they're talking about.

As Tobias Luetke observed, "[t]he future of Ruby on Rails is indeed bright
on so many levels its not even funny".

[[QUIZ] Yahtzee (#19)]
----------------------

James Edward Gray II posted this week's [Ruby Quiz]: to make a game that
plays the game "Yahtzee" dice game.

For those looking for an extra challenge, adding an AI player or
implementing "Triple Yahtzee" were suggested.

[A Ruby-relevant quote from Alan Kay]
-------------------------------------

Curt Hibbs quoted Alan Kay (the creator of Smalltalk) in a recent ACM
Queue interview: "Even if you're designing for professional programmers,
in the end your programming language is basically a user-interface design.
You will get much better results regardless of what you're trying to do if
you think of it as a user-interface design."

Curt felt that this was the approach Matz took in designing Ruby.

PA posted an old [page] that quotes some tongue-in-cheek comments by Steve
Wart on "why Smalltalk never caught on". Also on the page was the
following quote

"
So, yes, in Smalltalk you can definitely dig your own grave.
But you can also climb out of it.
At least Smalltalk gives me a shovel and ladder.

I'm not sure that's a good metaphor. It conjures up images of an army of
once-dead Smalltalk zombies digging themselves out of their graves and
terrorising the Land of the Statically Typed. :)
"

New Releases
------------

* [LXL (Like Excel) 0.2.0 - A mini-language that mimics Microsoft Excel
formulas]
* [LXL (Like Excel) 0.3.0]

Kevin Howe improved quoting and parsing in [LXL], an evaluator for
a language similar to that used for formulas in Microsoft Excel.
He later released version 0.3.0 which added some major new
features: namespaces, ranges, percentages and deferred function
calls. It is also now installable as a gem.

* [Net::SSH 1.0.0]

Jamis Buck released the one-dot-oh-dot-oh version of Net::SSH, a
library that implements the SSH2 client protocol. Some bugs were
fixed, and the project is now in maintenance mode, with no new
features planned.

* [Daemons 0.0.1: control your daemon scripts with start/stop commands]

Thomas Uehlinger was "proud to release the first version of
Daemons", a tool that allows you to run Ruby scripts in the
background, providing commands to start, stop and restart them.

* [Syck 0.50 -- The new YAML is here for testing]

why the lucky stiff announced that the new Syck branch is ready
for testing. This is a library for dealing with the YAML markup
format. It's several times faster than the old version, and _why
expects that there will be no major API changes between now and
the 1.0 release. "Finally, I can go back to drawing ponies out on
the bridge by the old reservoir..."

* [rubydium 0.3 and nanovm 0.1]

Alexander Kellett released a complete rewrite of the first
rubydium - it is now aiming to be a fast Ruby interpreter written
in Ruby.

* [Recipe Browser 0.4]

Belorion rewrote his Recipe Browser to use the [Rails] web
framework.

* [RedCloth 3.0.3 -- Humane Text for Ruby]

why the lucky stiff put out some small fixes for RedCloth, a
library that processes the humane text-formats Textile and a
Markdown-subset into XHTML (and soon LaTeX and PDF). "Humane" text
formats are those often used in Wikis, forums and blogs to allow
people to write text that ends up formatted without having to use
ugly tags (for example, many humane formats turn '*foo*' into
bold-text 'foo').

* [Announcing a respawned rcairo]

Øyvind Kolås announced Ruby support for Cairo, "a resolution and
device independent vector graphics drawing library, which provides
a postscript like drawing model".

* [ParseTree 1.3.4 Released]

Ryan Davis released a new version of [ParseTree], a "little brown
stinky ferret that digs down a hole and violently rips the AST
away from the warm bosom of ruby" (to
Ryan in another
thread). In other words, it extracts the parse-tree for a class or
method from the Ruby interpreter and returns it as an s-expression
using Arrays, Strings, Symbols and Integers. A couple of bugs were
fixed in this release.

* [Samizdat RDF Storage 0.1]

Dmitri Borodaenko announced the first release of Samizdat RDF
Storage as a stand-alone library. It provides optimised storage of
RDF data in relational databases.

* [Numeric Integration Library (calculus, analysis)]

beng released a new library for doing numerical integration of
single-variable functions. It includes several different
integration methods, including Simpson's, Monte Carlo sampling,
Gauss', Adaptive Quadrature, and Romberg's.

* [RubyTorrent 0.3 (beta)]

William Morgan was "happy" to announce the first beta of
RubyTorrent, a peer library for BitTorrent.
 
A

Austin Ziegler

[a Ruby pdf writer that supports images]
----------------------------------------
Artotoy has a website that produces invoices as PDFs, using PDF::Writer,
but recently discovered that PDF::Writer seemed not to have support for
images.

Dan Fitzpatrick said that he was working on porting the PHP FPDF library
to Ruby. It was working for simple cases but needed a few weeks to work
out the bugs and add more advanced features.

Fredrik Jagenheim pointed out that the CVS version of PDF::Writer did have
support for images, through a method add_jpeg_from_file. The library's
author, Austin Ziegler, just hasn't got around to releasing a new version
yet.

To make my current work a bit more prominent (I think it's buried in a
couple of other messages): I am working on PDF::Writer again and will
be making a release soon after upgrading a *lot* of functionality,
fixing numerous bugs, and (most importantly) making the API much more
Ruby-friendly.

I am currently working with the image support and have abstrascted it
out such that instead of #add_jpeg_from_file, you will have
#add_image_from _file -- which supports either JPEG or PNG. I'm not
sure that the PNG transparency support is going to be as solid as it
should be, because I'm pretty sure that there's a few bugs in the
code, and although it appears to support alpha channel or greyscale
transparency, that information is never inserted into the resulting
PDF the way that palette transparency is inserted.

I have heavily modified the ImageSize library to support obtaining
additional information from JPEG images so that PDF::Writer can
support JPEG images in CMYK colourspace. This means that, once I get a
bit of other stuff done, PDF::Writer *will* be able to be used for
pre-press PDF work (including the markers).

The API changes will be mildly painful to existing users, but I have
attempted to keep the argument count and meaning for the new calls the
same as the old calls, and I have made wrapper functions that warn
that the API in question is going to be deprecated.

The biggest change that should make it into the code which will not
make it in this iteration, I think, will be a change and
simplification to the table code.

I have houseguests for the week, so I will not be able to get nearly
as much time on this as I would like, but I would look for a release
of PDF::Writer 0.7.0 (or higher) toward the end of the month.

-austin
 
P

Paul Robinson

http://www.rubygarden.org/ruby?RubyNews/2005-02-07

Ruby Weekly News 7th - 13rd February 2005
-----------------------------------------

A summary of the week's activity on the ruby-talk mailing list / the
comp.lang.ruby newsgroup. This summary is brought to you by Tim
Sutherland
(TimSuth).

This is a really useful summary you're doing. Assuming you're going to
be able to keep this going in the long-term (perhaps get some help to
cover for those inevitable weeks real life gets in the way?) is there
any way you can send this out to its own mailing list or perhaps make
it available via RSS? It would mean I'd be able to 'mark all read' when
I get behind here a lot more easily. :) I *might* even be able to
unsub from some of the lists I'm on!
 
T

Tim Sutherland

Paul Robinson said:
This is a really useful summary you're doing. Assuming you're going to
be able to keep this going in the long-term (perhaps get some help to
cover for those inevitable weeks real life gets in the way?) is there
any way you can send this out to its own mailing list or perhaps make
it available via RSS? It would mean I'd be able to 'mark all read' when
I get behind here a lot more easily. :) I *might* even be able to
unsub from some of the lists I'm on!

These sound like good ideas. Trans has offered to help me out when I have
"real life" issues.

I'm intending to write a simple Rails app at same stage to help with
creating the weekly news. (e.g. "ignore this thread", "summarise this
thread", plus some info on what threads are likely to be interesting, e.g.
number of new posts in the thread this week. This will all be open so anyone
can go to the site and summarise one or two threads.)

Once I've done that, adding in RSS support shouldn't be too hard, and I
would put in a mailing list too.

Maybe I'll get a domain name like rubyweeklynews.org and stick a
textdrive.com site up. (I've been inspired by James Edward Gray II's
rubyquiz.com.) Other suggestions for the domain name?

Thanks for the feedback.
 
T

Tim Sutherland

Tim Sutherland wrote: said:
I'm intending to write a simple Rails app at same stage to help with
creating the weekly news. (e.g. "ignore this thread", "summarise this
thread", plus some info on what threads are likely to be interesting, e.g.
number of new posts in the thread this week. This will all be open so anyone
can go to the site and summarise one or two threads.)

Once I've done that, adding in RSS support shouldn't be too hard, and I
would put in a mailing list too.

Maybe I'll get a domain name like rubyweeklynews.org and stick a
textdrive.com site up. (I've been inspired by James Edward Gray II's
rubyquiz.com.) Other suggestions for the domain name?
[...]

NB: The "weekly news" doesn't have to be restricted to ruby-talk /
comp.lang.ruby.

e.g. could have a section which covers ruby-core, one that lists interesting
ruby-related blog messages, one for articles (we already have that one).
 
P

pat eyler

NB: The "weekly news" doesn't have to be restricted to ruby-talk /
comp.lang.ruby.

e.g. could have a section which covers ruby-core, one that lists interesting
ruby-related blog messages, one for articles (we already have that one).

I'd love to see this happen, but it'd take a *lot* more work than one
person should be expected to do (especiially as a hobby). Maybe 2-4
folks, each with editorial oversight of a specific area.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top