[#199818] Help please — "Dark Ambient" <sambient@...>

Recently I asked here about where "end" goes, in relation to code

14 messages 2006/07/01

[#199852] How to open a console and ruby a ruby script from ruby? — transfire@...

I know I can do

12 messages 2006/07/01

[#199959] Re: if problem in loop causing weirdness — Nuralanur@...

You can use the break command to stop iterating through a block, eg.

10 messages 2006/07/03

[#199970] About 1.9 #__method__ feature. — transfire@...

I think the name __method__ is probably a poor choice b/c "shadow

102 messages 2006/07/03
[#199978] Re: About 1.9 #__method__ feature. — Yukihiro Matsumoto <matz@...> 2006/07/03

Hi,

[#199988] Re: About 1.9 #__method__ feature. — dblack@... 2006/07/03

Hi --

[#199993] Re: About 1.9 #__method__ feature. — Yukihiro Matsumoto <matz@...> 2006/07/03

Hi,

[#200002] Re: About 1.9 #__method__ feature. — dblack@... 2006/07/03

Hi --

[#200021] Re: About 1.9 #__method__ feature. — Yukihiro Matsumoto <matz@...> 2006/07/03

Hi,

[#200109] Re: About 1.9 #__method__ feature. — dblack@... 2006/07/04

Hi --

[#200126] Re: About 1.9 #__method__ feature. — Yukihiro Matsumoto <matz@...> 2006/07/04

Hi,

[#200135] Re: About 1.9 #__method__ feature. — dblack@... 2006/07/04

Hi --

[#200136] Re: About 1.9 #__method__ feature. — Yukihiro Matsumoto <matz@...> 2006/07/04

Hi,

[#200145] Re: About 1.9 #__method__ feature. — "Austin Ziegler" <halostatue@...> 2006/07/04

On 7/4/06, Yukihiro Matsumoto <matz@ruby-lang.org> wrote:

[#200156] Re: About 1.9 #__method__ feature. — Yukihiro Matsumoto <matz@...> 2006/07/04

Hi,

[#200159] Re: About 1.9 #__method__ feature. — ara.t.howard@... 2006/07/04

On Wed, 5 Jul 2006, Yukihiro Matsumoto wrote:

[#200204] Re: About 1.9 #__method__ feature. — Yukihiro Matsumoto <matz@...> 2006/07/05

Hi,

[#200216] Re: About 1.9 #__method__ feature. — dblack@... 2006/07/05

Hi --

[#200478] Re: About 1.9 #__method__ feature. — Yukihiro Matsumoto <matz@...> 2006/07/06

Hi,

[#200550] Re: About 1.9 #__method__ feature. — dblack@... 2006/07/07

Hi --

[#200553] Re: About 1.9 #__method__ feature. — Yukihiro Matsumoto <matz@...> 2006/07/07

Hi,

[#200557] Re: About 1.9 #__method__ feature. — dblack@... 2006/07/07

Hi --

[#200559] Re: About 1.9 #__method__ feature. — Yukihiro Matsumoto <matz@...> 2006/07/07

Hi,

[#199983] Re: About 1.9 #__method__ feature. — ara.t.howard@... 2006/07/03

On Tue, 4 Jul 2006, Yukihiro Matsumoto wrote:

[#199991] Re: About 1.9 #__method__ feature. — Yukihiro Matsumoto <matz@...> 2006/07/03

Hi,

[#199994] Re: About 1.9 #__method__ feature. — ara.t.howard@... 2006/07/03

On Tue, 4 Jul 2006, Yukihiro Matsumoto wrote:

[#199979] One-Click Ruby Installer 184-18 Release Candidate 3 is available — "Curt Hibbs" <curt.hibbs@...>

Originally, this was planned to be the final 1.8.4 release of the One-Click

11 messages 2006/07/03

[#200056] Retired Ruby Mascott? — "Pawel Szymczykowski" <makenai@...>

Hi all,

22 messages 2006/07/03

[#200140] progress on "Automated Wrapper Generation for Information Extraction" — "A. S. Bradbury" <asbradbury@...>

As you may or may not be aware, I am currently working on one of the 10

8 messages 2006/07/04

[#200172] Parallel Array — "Nasir Khan" <rubylearner@...>

If I have two arrays a=[1,1,1,1] and b=[2,2,2,2] and I want to add each

16 messages 2006/07/05

[#200202] Problem installing gem — Alex Gian <alexgian@...>

Hi, first post here, hope it's the right forum.

15 messages 2006/07/05

[#200294] debugging proposal — "Max Muermann" <max@...>

Hi everybody,

13 messages 2006/07/06

[#200359] A newbie would like some code criticism, please... — "Just Another Victim of the Ambient Morality" <ihatespam@...>

I'm learning Ruby and I'd like some criticism on a program that I wrote.

14 messages 2006/07/06

[#200366] Re: Rails: http://localhost:3000/say/list_rcv OK on FireFox; nil on IE — "Richard" <RichardDummyMailbox58407@...>

Hi Robert,

10 messages 2006/07/06

[#200382] GC oddness — Alex Young <alex@...>

Hi all,

17 messages 2006/07/06
[#200384] Re: GC oddness — nobu@... 2006/07/06

Hi,

[#200392] Float#==. Legacy? — Guillaume Marcais <guslist@...>

As far as my experience goes, using Float#== is always an error. Float

15 messages 2006/07/06

[#200456] Easy Pathname — transfire@...

I find myself always using File.join, and never utilizing Pathname b/c

20 messages 2006/07/06

[#200470] Redefining core classes — Damaris Fuentes <dfl_maradentro@...>

Hi you all,

17 messages 2006/07/06
[#200472] Re: Redefining core classes — "Patrick Hurley" <phurley@...> 2006/07/06

On 7/6/06, Damaris Fuentes <dfl_maradentro@yahoo.es> wrote:

[#200517] ruby-opengl — "John Gabriele" <jmg3000@...>

I've tinkered a bit with Yoshi's original ruby-opengl. My changes are

20 messages 2006/07/07

[#200579] Panagrams (#86) — Ruby Quiz <james@...>

The three rules of Ruby Quiz:

40 messages 2006/07/07
[#200631] Re: [QUIZ] Panagrams (#86) — brian.mattern@... 2006/07/07

Is it a spoiler if we post a resulting pangram (no code)?

[#200642] Re: [QUIZ] Panagrams (#86) — James Edward Gray II <james@...> 2006/07/07

On Jul 7, 2006, at 12:34 PM, brian.mattern@gmail.com wrote:

[#200627] instance_exec — ara.t.howard@...

27 messages 2006/07/07

[#200758] Why Ruby over Python? — howachen@...

Besides ROR, can you give me a reason why perfer ruby instead of

106 messages 2006/07/08
[#200766] Re: Why Ruby over Python? — "vasudevram" <vasudevram@...> 2006/07/08

howachen@gmail.com wrote:

[#200791] Re: Why Ruby over Python? — "M. Edward (Ed) Borasky" <znmeb@...> 2006/07/08

vasudevram wrote:

[#200942] Re: Why Ruby over Python? — Daniel Martin <martin@...> 2006/07/09

"M. Edward (Ed) Borasky" <znmeb@cesmail.net> writes:

[#200946] Re: Why Ruby over Python? — "Francis Cianfrocca" <garbagecat10@...> 2006/07/09

On 7/9/06, Daniel Martin <martin@snowplow.org> wrote:

[#200795] Sweet Lord! — Daniel Schierbeck <daniel.schierbeck@...>

Why haven't I thought of this before?

22 messages 2006/07/08
[#200814] Re: Sweet Lord! — "William James" <w_a_x_man@...> 2006/07/08

Daniel Schierbeck wrote:

[#200910] Marshal's handling of floats — Brian Palmer <rubytalk@...>

I was thinking about writing a patch to modify how Marshal handles

15 messages 2006/07/09

[#201158] Real newbie question about methods — "simonh" <simonharrison@...>

Hi all. I'm trying to learn ruby using about 5 books(!) but keep

16 messages 2006/07/10

[#201274] Some questions about serious Ruby development... — "Just Another Victim of the Ambient Morality" <ihatespam@...>

I like Ruby. I like it more than Python. It's my PERL replacement. I

11 messages 2006/07/11

[#201323] Nuby Q: Daemonize (other materials have been read!) — Rogue Amateur <rogueamateur@...>

I've read the other references to daemonizing a process in ruby, but ...

16 messages 2006/07/11
[#201327] Re: Nuby Q: Daemonize (other materials have been read!) — ara.t.howard@... 2006/07/11

On Wed, 12 Jul 2006, Rogue Amateur wrote:

[#201339] Re: Nuby Q: Daemonize (other materials have been read!) — Rogue Amateur <rogueamateur@...> 2006/07/11

First, let me say thank you for the help.

[#201340] Re: Nuby Q: Daemonize (other materials have been read!) — Rogue Amateur <rogueamateur@...> 2006/07/11

Rogue Amateur wrote:

[#201333] Processes and Portability — Name Name <exl2@...>

I would like to run a process concurrently (thus if the process goes to

19 messages 2006/07/11

[#201388] Decent HTML Parser? — Kevin Weller <"http://www.itcrucible.com/contact"@...>

Anybody have experience with a decent HTML parser for a Ruby

18 messages 2006/07/11

[#201503] Help with a regexp — Daniel Schierbeck <daniel.schierbeck@...>

I'm trying to write a regular expression that matches bencoded strings,

36 messages 2006/07/12
[#201553] Re: Help with a regexp — "studlee2@..." <studlee2@...> 2006/07/12

Daniel,

[#201569] Re: Help with a regexp — Daniel Schierbeck <daniel.schierbeck@...> 2006/07/12

studlee2@gmail.com wrote:

[#201513] Appending to a CSV file — Bil Kleb <Bil.Kleb@...>

Just got a call from a telecommuting colleague

15 messages 2006/07/12

[#201636] prototype-0.1.0 — ara.t.howard@...

17 messages 2006/07/12

[#201661] Recursion and Ruby — Glenn Cadman <glenn.cadman@...>

As a practice to learn ruby I tried to create a recursive program

33 messages 2006/07/13
[#201668] Re: Recursion and Ruby — "Erik Veenstra" <erikveen@...> 2006/07/13

You could use "case" as well (see version 2). It's faster.

[#201696] Re: Recursion and Ruby — Daniel Martin <martin@...> 2006/07/13

"Erik Veenstra" <erikveen@gmail.com> writes:

[#201788] challenge — ara.t.howard@...

29 messages 2006/07/13
[#201790] Re: challenge — ara.t.howard@... 2006/07/13

On Fri, 14 Jul 2006 Ara.T.Howard@noaa.gov wrote:

[#201842] Re: challenge — transfire@... 2006/07/14

[#201848] Re: challenge — ara.t.howard@... 2006/07/14

On Fri, 14 Jul 2006 transfire@gmail.com wrote:

[#201852] Re: challenge — "Sean O'Halpin" <sean.ohalpin@...> 2006/07/14

On 7/14/06, ara.t.howard@noaa.gov <ara.t.howard@noaa.gov> wrote:

[#201889] Re: challenge — "Robert Dober" <robert.dober@...> 2006/07/14

On 7/14/06, Sean O'Halpin <sean.ohalpin@gmail.com> wrote:

[#201898] Re: challenge — "Sean O'Halpin" <sean.ohalpin@...> 2006/07/14

On 7/14/06, Robert Dober <robert.dober@gmail.com> wrote:

[#201916] Re: challenge — "Robert Dober" <robert.dober@...> 2006/07/14

[snip]

[#201919] Re: challenge — "Sean O'Halpin" <sean.ohalpin@...> 2006/07/14

On 7/14/06, Robert Dober <robert.dober@gmail.com> wrote:

[#201821] Preferred monkeypatching technique — Tom Werner <tom@...>

Allow me to present a scenario:

56 messages 2006/07/13
[#201837] Re: Preferred monkeypatching technique — dblack@... 2006/07/14

Hi --

[#201853] Re: Preferred monkeypatching technique — Hal Fulton <hal9000@...> 2006/07/14

dblack@wobblini.net wrote:

[#201864] How to speed up ruby and make it as fast as possible — Ben Johnson <bjohnson@...>

Hi,

20 messages 2006/07/14

[#201885] About MyClass#my_method — "Jonas Pfenniger" <zimba.tm@...>

Hi,

15 messages 2006/07/14

[#201903] Negative Sleep (#87) — Ruby Quiz <james@...>

The three rules of Ruby Quiz:

24 messages 2006/07/14

[#201950] Re: How to speed up ruby and make it as fast as possible — "Jamal Mazrui" <Jamal.Mazrui@...>

In answer to the multiple messages recommending that I learn C or

14 messages 2006/07/14

[#201990] Re: How to speed up ruby and make it as fast as possible — "Jamal Mazrui" <Jamal.Mazrui@...>

Certainly, Ruby performance is not always a problem. It may not even be

25 messages 2006/07/14
[#202208] Re: How to speed up ruby and make it as fast as possible — "S Wayne" <wrecklass1@...> 2006/07/16

Jamal Mazrui wrote:

[#202042] Mac OSX Ruby Configuration Question — "Steven R." <steverummel@...>

I recently installed Ruby 1.8.4 on my iMac, running OSX 10.4. Ruby,

14 messages 2006/07/14

[#202050] Alternate initializers or alternate class? — transfire@...

Jan Molic recently contacted me about a slighlty modified version of

11 messages 2006/07/14

[#202067] Some questions about Ruby and it's environment... — "Just Another Victim of the Ambient Morality" <ihatespam@...>

I have two issues in Ruby which are bugging me.

15 messages 2006/07/15

[#202091] net/http performance — Luke Burton <luke@...>

15 messages 2006/07/15

[#202109] Who likes Sudoku? — "studlee2@..." <studlee2@...>

Here is the smallest Ruby Sudoku solver I could come up with. I've

21 messages 2006/07/15
[#202113] Re: Who likes Sudoku? — dblack@... 2006/07/15

Hi --

[#202116] Re: Who likes Sudoku? — "studlee2@..." <studlee2@...> 2006/07/15

I'm not really sure about the whole "GOLF" vs. "golf". We'll say

[#202125] Re: Who likes Sudoku? — "studlee2@..." <studlee2@...> 2006/07/15

This is a little smaller.

[#202128] Re: Who likes Sudoku? — "studlee2@..." <studlee2@...> 2006/07/15

Smaller still. Thanks David/Daniel:

[#202250] additional requirements for a Ruby env — "Alexandru Popescu" <the.mindstorm.mailinglist@...>

Hi!

20 messages 2006/07/16
[#202333] Re: additional requirements for a Ruby env — "Alexandru Popescu" <the.mindstorm.mailinglist@...> 2006/07/17

Guys any hints for this? Sorry for pushing it to the top, but I am

[#202340] Re: additional requirements for a Ruby env — Alex Young <alex@...> 2006/07/17

Alexandru Popescu wrote:

[#202280] n00b Q: Obfuscation and locking the source — "Danno" <dh.evolutionnext@...>

I have been doing some Ruby on and off this year, so I am still a n00b.

14 messages 2006/07/17

[#202294] Printing Barcodes from Ruby — listrecv@...

I'd like to be able to generate barcodes from Ruby (to a PDF document).

14 messages 2006/07/17

[#202310] How can I parse binary files? — Fabio Vitale <fabio@...>

I've the need to parse a binary file with the following structure:

24 messages 2006/07/17
[#202317] Re: How can I parse binary files? — Daniel Martin <martin@...> 2006/07/17

Fabio Vitale <fabio@sferaconsulting.it> writes:

[#202338] Re: How can I parse binary files? — Fabio Vitale <fabio@...> 2006/07/17

Daniel Martin wrote:

[#202392] Re: How can I parse binary files? — Daniel Martin <martin@...> 2006/07/17

Fabio Vitale <fabio@sferaconsulting.it> writes:

[#202398] Re: How can I parse binary files? — Daniel Martin <martin@...> 2006/07/17

Daniel Martin <martind@martinhouse.internal> writes:

[#202448] Re: How can I parse binary files? — Fabio Vitale <fabio@...> 2006/07/18

Daniel Martin wrote:

[#202449] Re: How can I parse binary files? — Fabio Vitale <fabio@...> 2006/07/18

Fabio Vitale wrote:

[#202354] irb and readline — listrecv@...

I'm getting funny behavior when using irb (readline) on Windows. When

17 messages 2006/07/17

[#202467] Problems installing rubyzip gem on Debian...can someone help? — "subimage" <subimage@...>

I haven't had issues with it before, but now I am...I go to install

12 messages 2006/07/18

[#202498] One-Click Installer: MinGW? or VC2005? — "Curt Hibbs" <ml.chibbs@...>

The One-Click Ruby Installer for Windows is at a cross-roads. The C++

119 messages 2006/07/18
[#202524] Re: One-Click Installer: MinGW? or VC2005? — "Francis Cianfrocca" <garbagecat10@...> 2006/07/18

On 7/18/06, Curt Hibbs <ml.chibbs@gmail.com> wrote:

[#202529] Re: One-Click Installer: MinGW? or VC2005? — ara.t.howard@... 2006/07/18

On Wed, 19 Jul 2006, Francis Cianfrocca wrote:

[#202534] Re: One-Click Installer: MinGW? or VC2005? — Francis Cianfrocca <garbagecat10@...> 2006/07/18

unknown wrote:

[#202545] Re: One-Click Installer: MinGW? or VC2005? — Mauricio Fernandez <mfp@...> 2006/07/18

On Wed, Jul 19, 2006 at 03:06:10AM +0900, Francis Cianfrocca wrote:

[#202510] Re: One-Click Installer: MinGW? or VC2005? — ara.t.howard@... 2006/07/18

On Wed, 19 Jul 2006, Curt Hibbs wrote:

[#202512] Re: One-Click Installer: MinGW? or VC2005? — "Curt Hibbs" <ml.chibbs@...> 2006/07/18

On 7/18/06, ara.t.howard@noaa.gov <ara.t.howard@noaa.gov> wrote:

[#202515] Re: One-Click Installer: MinGW? or VC2005? — ara.t.howard@... 2006/07/18

On Wed, 19 Jul 2006, Curt Hibbs wrote:

[#203110] Re: One-Click Installer: MinGW? or VC2005? — "Austin Ziegler" <halostatue@...> 2006/07/21

On 7/18/06, ara.t.howard@noaa.gov <ara.t.howard@noaa.gov> wrote:

[#202541] Re: One-Click Installer: MinGW? or VC2005? — Mauricio Fernandez <mfp@...> 2006/07/18

On Wed, Jul 19, 2006 at 12:22:16AM +0900, Curt Hibbs wrote:

[#202741] Re: One-Click Installer: MinGW? or VC2005? — "Sean O'Halpin" <sean.ohalpin@...> 2006/07/19

On 7/18/06, Mauricio Fernandez <mfp@acm.org> wrote:

[#202779] Re: One-Click Installer: MinGW? or VC2005? — Simon Krer <SimonKroeger@...> 2006/07/19

Sean O'Halpin wrote:

[#202784] Re: One-Click Installer: MinGW? or VC2005? — "Curt Hibbs" <ml.chibbs@...> 2006/07/19

On 7/19/06, Simon Krer <SimonKroeger@gmx.de> wrote:

[#202789] Re: One-Click Installer: MinGW? or VC2005? — Simon Krer <SimonKroeger@...> 2006/07/19

Curt Hibbs wrote:

[#202807] Re: One-Click Installer: MinGW? or VC2005? — "Sean O'Halpin" <sean.ohalpin@...> 2006/07/19

On 7/19/06, Simon Krer <SimonKroeger@gmx.de> wrote:

[#202810] Re: One-Click Installer: MinGW? or VC2005? — "Curt Hibbs" <ml.chibbs@...> 2006/07/19

On 7/19/06, Sean O'Halpin <sean.ohalpin@gmail.com> wrote:

[#202814] Re: One-Click Installer: MinGW? or VC2005? — "Sean O'Halpin" <sean.ohalpin@...> 2006/07/19

On 7/19/06, Curt Hibbs <ml.chibbs@gmail.com> wrote:

[#202841] Re: One-Click Installer: MinGW? or VC2005? — "Curt Hibbs" <ml.chibbs@...> 2006/07/20

On 7/19/06, Sean O'Halpin <sean.ohalpin@gmail.com> wrote:

[#202915] Re: One-Click Installer: MinGW? or VC2005? — Ryan Raaum <devlists-ruby-talk@...> 2006/07/20

[#202980] Re: One-Click Installer: MinGW? or VC2005? — Reggie Mr <buppcpp@...> 2006/07/20

Ryan Raaum wrote:

[#203063] Re: One-Click Installer: MinGW? or VC2005? — Lothar Scholz <mailinglists@...> 2006/07/21

[#203075] Re: One-Click Installer: MinGW? or VC2005? — "stu" <yakumo9275@...> 2006/07/21

[#202514] more newbie help with classes and methods please — "simonh" <simonharrison@...>

I posted a question a week or so now which I got some great help with.

24 messages 2006/07/18
[#202622] Re: more newbie help with classes and methods please — "S Wayne" <wrecklass1@...> 2006/07/19

A couple of things:

[#202647] Re: more newbie help with classes and methods please — "simonh" <simonharrison@...> 2006/07/19

Thanks for replies. Just to point out, this code is not meant for

[#202653] Re: more newbie help with classes and methods please — "simonh" <simonharrison@...> 2006/07/19

decided to have a go at using the case statement. Why won't this work?

[#202671] Re: more newbie help with classes and methods please — Morton Goldberg <m_goldberg@...> 2006/07/19

There are two forms of case block and you have sort of mixed them up.

[#202673] Re: more newbie help with classes and methods please — dblack@... 2006/07/19

Hi --

[#202683] Net/HTTP is flaky? — "Just Another Victim of the Ambient Morality" <ihatespam@...>

Inexplicably, the following code fails:

13 messages 2006/07/19

[#202684] Time.parse has never visited Singapore? — "Harold Hausman" <hhausman@...>

I suspect that Time.parse is just not understanding the "Malay

11 messages 2006/07/19

[#202723] sandbox 0.0.11 -- taking the i out of eval — why the lucky stiff <ruby-talk@...>

Oh rapture! Oh, delicious zesty snacks! Oh, steamed uncles in a cabbage

14 messages 2006/07/19

[#202731] Beyond threads? Better concurrency methods? — anmus <anmus@...>

Hi All,

30 messages 2006/07/19
[#202853] Re: Beyond threads? Better concurrency methods? — "M. Edward (Ed) Borasky" <znmeb@...> 2006/07/20

anmus wrote:

[#202866] how to split an array in sub arrays of the same length — Paolo Bacchilega <paolo.bacchilega@...>

Hi,

14 messages 2006/07/20

[#202882] return statement where it is usefull ? — pere.noel@... (Une b騅ue)

i've the habit (from java ;-)) to put a return statement in a method

16 messages 2006/07/20

[#202955] Using .each with constructors — "Ben Zealley" <transhumanist@...>

Is there a nice elegant way of creating several named objects of the

31 messages 2006/07/20
[#203002] Re: Using .each with constructors — "Robert Dober" <robert.dober@...> 2006/07/20

On 7/20/06, Ben Zealley <transhumanist@gmail.com> wrote:

[#203021] Re: Using .each with constructors — transfire@... 2006/07/20

[#203033] Re: Using .each with constructors — Logan Capaldo <logancapaldo@...> 2006/07/21

[#203074] opacity of magic enumerator (was: Re: Using .each with constructors) — dblack@... 2006/07/21

Hi --

[#203076] Re: opacity of magic enumerator (was: Re: Using .each with constructors) — "Martin DeMello" <martindemello@...> 2006/07/21

On 7/21/06, dblack@wobblini.net <dblack@wobblini.net> wrote:

[#202958] "" vs '' — Ben Johnson <bjohnson@...>

I know this is a very simply question, but I've seen many different

19 messages 2006/07/20

[#202967] Re: [ANN] Mongoose 0.1.1 — "Berger, Daniel" <Daniel.Berger@...>

> -----Original Message-----

15 messages 2006/07/20
[#202970] Re: [ANN] Mongoose 0.1.1 — Jamey Cribbs <jcribbs@...> 2006/07/20

Berger, Daniel wrote:

[#203124] Meta-Meta-Programming, revisited — "Erik Veenstra" <erikveen@...>

Do you remember the discussion about monitor-functions and

22 messages 2006/07/21

[#203151] Mongoose 0.2.0 — Jamey Cribbs <jcribbs@...>

You can download it from: http://rubyforge.org/projects/mongoose/

19 messages 2006/07/21

[#203171] Newbie Question: delete all non alphanumeric characters — Theallnighter Theallnighter <theallnighter@...>

Hi all,

17 messages 2006/07/21

[#203216] XML2RB - Executing XML — "Erik Veenstra" <erikveen@...>

----------------------------------------------------------------

11 messages 2006/07/21

[#203333] Infinity — "hadley wickham" <h.wickham@...>

irb(main):084:0> (-1.0/0.0)

15 messages 2006/07/22

[#203352] Set an instance variable before and after initialize — Martin Jansson <martialis@...>

If possible, I would like to set a instance variable in an object before

12 messages 2006/07/22

[#203438] Yadda yadda yadda operator — "Son SonOfLilit" <sonoflilit@...>

Hello.

25 messages 2006/07/23

[#203473] I'll have the duck! — transfire@...

I promised myself I'd shut-up for awhile, maybe I still should, but I

102 messages 2006/07/23
[#203528] Re: I'll have the duck! — benjohn@... 2006/07/24

> Now anything that responded to #to_a could use #transform. I'm not

[#203611] Re: I'll have the duck! — Daniel DeLorme <dan-ml@...42.com> 2006/07/24

benjohn@fysh.org wrote:

[#203615] Re: I'll have the duck! — transfire@... 2006/07/24

[#203628] Re: I'll have the duck! — dblack@... 2006/07/24

Hi --

[#203630] Re: I'll have the duck! — Chad Perrin <perrin@...> 2006/07/24

On Tue, Jul 25, 2006 at 05:48:29AM +0900, dblack@wobblini.net wrote:

[#203632] Re: I'll have the duck! — dblack@... 2006/07/24

Hi --

[#203664] Re: I'll have the duck! — "7rans" <transfire@...> 2006/07/25

[#203681] Re: I'll have the duck! — dblack@... 2006/07/25

Hi --

[#203729] Re: I'll have the duck! — "7rans" <transfire@...> 2006/07/25

[#203792] Re: I'll have the duck! — "Phil Tomson" <rubyfan@...> 2006/07/25

On 7/25/06, 7rans <transfire@gmail.com> wrote:

[#203799] Re: I'll have the duck! — ara.t.howard@... 2006/07/25

On Wed, 26 Jul 2006, Phil Tomson wrote:

[#203813] Re: I'll have the duck! — dblack@... 2006/07/25

On Wed, 26 Jul 2006, ara.t.howard@noaa.gov wrote:

[#203475] rb-gnome and gtkglext — "anne001" <anne@...>

I ran the darwinports install instructions on rb-gnome

16 messages 2006/07/23

[#203488] RLisp - Lisp naturally embedded in Ruby — "Tomasz Wegrzanowski" <tomasz.wegrzanowski@...>

Hello :-)

32 messages 2006/07/24
[#203624] Re: RLisp - Lisp naturally embedded in Ruby — "William James" <w_a_x_man@...> 2006/07/24

Tomasz Wegrzanowski wrote:

[#203639] Re: RLisp - Lisp naturally embedded in Ruby — "Tomasz Wegrzanowski" <tomasz.wegrzanowski@...> 2006/07/24

On 7/24/06, William James <w_a_x_man@yahoo.com> wrote:

[#203721] Re: RLisp - Lisp naturally embedded in Ruby — Christian Neukirchen <chneukirchen@...> 2006/07/25

"Tomasz Wegrzanowski" <tomasz.wegrzanowski@gmail.com> writes:

[#203727] Re: RLisp - Lisp naturally embedded in Ruby — "Tomasz Wegrzanowski" <tomasz.wegrzanowski@...> 2006/07/25

On 7/25/06, Christian Neukirchen <chneukirchen@gmail.com> wrote:

[#203803] Re: RLisp - Lisp naturally embedded in Ruby — Christian Neukirchen <chneukirchen@...> 2006/07/25

"Tomasz Wegrzanowski" <tomasz.wegrzanowski@gmail.com> writes:

[#203514] [ANN] Nitro/Og 0.31.0 — gabriele renzi <surrender_itRemove@...>

(forwarding from nitro's list)

25 messages 2006/07/24

[#203526] Autoloading objects — Ruby equivalent for PHP5 "__autoload — "Naum T." <naum@...>

Does there exist a Ruby equivalent to PHP5 "magic" __autoload method

13 messages 2006/07/24

[#203711] Defining a method with an argument with a default value — "Pedro Cte-Real" <pedro@...>

I have this line in a class method to define an initializer:

12 messages 2006/07/25

[#203752] Hash order bug? — Javier Valencia <jvalencia@...01.org>

I have this piece of simple code:

46 messages 2006/07/25
[#203753] Re: Hash order bug? — dblack@... 2006/07/25

Hi --

[#250371] Re: Hash order bug? — Haoqi Haoqi <axgle@126.com> 2007/05/05

[#250372] Re: Hash order bug? — "Nicholas Clare" <nickclare@...> 2007/05/05

On 5/5/07, Haoqi Haoqi <axgle@126.com> wrote:

[#203778] Mongoose 0.2.5 - The "Two Steps Forward, One Step Back" release — Jamey Cribbs <jcribbs@...>

You can download it from: http://rubyforge.org/projects/mongoose/

19 messages 2006/07/25
[#204393] Re: Mongoose 0.2.5 - The "Two Steps Forward, One Step Back" release — GFunk913@... 2006/07/28

Jamey Cribbs wrote:

[#204401] Re: Mongoose 0.2.5 - The "Two Steps Forward, One Step Back" release — Jamey Cribbs <jcribbs@...> 2006/07/28

GFunk913@gmail.com wrote:

[#204406] Re: Mongoose 0.2.5 - The "Two Steps Forward, One Step Back" release — GFunk913@... 2006/07/28

[#203958] For performance, write it in C — Peter Hickman <peter@...>

Whenever the question of performance comes up with scripting languages

157 messages 2006/07/26
[#203962] Re: For performance, write it in C — benjohn@... 2006/07/26

Peter Hickman gave a very good article about prototyping in a scripting

[#203967] Re: For performance, write it in C — "Tomasz Wegrzanowski" <tomasz.wegrzanowski@...> 2006/07/26

On 7/26/06, benjohn@fysh.org <benjohn@fysh.org> wrote:

[#203995] Re: For performance, write it in C — "Charles O Nutter" <headius@...> 2006/07/26

I'll lob a couple of grenades and then duck for cover.

[#203998] Re: For performance, write it in C — Peter Hickman <peter@...> 2006/07/26

Charles O Nutter wrote:

[#203996] Re: For performance, write it in C — James Edward Gray II <james@...> 2006/07/26

On Jul 26, 2006, at 8:57 AM, Charles O Nutter wrote:

[#204041] Re: For performance, write it in C — "David Pollak" <pollak@...> 2006/07/26

Writing code that runs as fast in Java as it does in C is real work,

[#204085] Re: For performance, write it in C — Chad Perrin <perrin@...> 2006/07/26

On Thu, Jul 27, 2006 at 12:42:46AM +0900, David Pollak wrote:

[#204182] Re: For performance, write it in C — "David Pollak" <pollak@...> 2006/07/27

On 7/26/06, Chad Perrin <perrin@apotheon.com> wrote:

[#204191] Re: For performance, write it in C — Chad Perrin <perrin@...> 2006/07/27

On Thu, Jul 27, 2006 at 09:26:45AM +0900, David Pollak wrote:

[#204196] Re: For performance, write it in C — Keith Gaughan <kmgaughan@...> 2006/07/27

On Thu, Jul 27, 2006 at 10:07:00AM +0900, Chad Perrin wrote:

[#204198] Re: For performance, write it in C — Chad Perrin <perrin@...> 2006/07/27

On Thu, Jul 27, 2006 at 10:35:52AM +0900, Keith Gaughan wrote:

[#204202] Re: For performance, write it in C — Keith Gaughan <kmgaughan@...> 2006/07/27

On Thu, Jul 27, 2006 at 10:50:32AM +0900, Chad Perrin wrote:

[#204205] Re: For performance, write it in C — Chad Perrin <perrin@...> 2006/07/27

On Thu, Jul 27, 2006 at 11:17:44AM +0900, Keith Gaughan wrote:

[#204209] Re: For performance, write it in C — Keith Gaughan <kmgaughan@...> 2006/07/27

On Thu, Jul 27, 2006 at 11:38:34AM +0900, Chad Perrin wrote:

[#204216] Re: For performance, write it in C — Chad Perrin <perrin@...> 2006/07/27

On Thu, Jul 27, 2006 at 12:19:24PM +0900, Keith Gaughan wrote:

[#204020] Re: For performance, write it in C — "Dean Wampler" <deanwampler@...> 2006/07/26

On 7/26/06, benjohn@fysh.org <benjohn@fysh.org> wrote:

[#204094] Re: For performance, write it in C — Chad Perrin <perrin@...> 2006/07/26

On Thu, Jul 27, 2006 at 12:03:50AM +0900, Dean Wampler wrote:

[#204102] Re: For performance, write it in C — Ashley Moran <work@...> 2006/07/26

[#204116] Re: For performance, write it in C — Francis Cianfrocca <garbagecat10@...> 2006/07/26

Ashley Moran wrote:

[#204122] Re: For performance, write it in C — Chad Perrin <perrin@...> 2006/07/26

On Thu, Jul 27, 2006 at 04:59:13AM +0900, Francis Cianfrocca wrote:

[#204120] Re: For performance, write it in C — Chad Perrin <perrin@...> 2006/07/26

On Thu, Jul 27, 2006 at 04:27:57AM +0900, Ashley Moran wrote:

[#203989] Driving Oracle sqlplus with open3 — "Daniel Berger" <Daniel.Berger@...>

Hi all,

12 messages 2006/07/26

[#203993] eRuby: A tutorial on using Ruby on the web — tesla <tesla.nicoli@...>

A group (three) of us wanted to learn Ruby but we decided that Rails was no

12 messages 2006/07/26

[#204108] OO Paradigm and Ruby Exercises for a Beginner — Picklegnome <picklegnome@...>

I am at a loss for where to begin here, so I'll jump in.

16 messages 2006/07/26

[#204247] Ruby and Visual Basic — "Ike" <rxv@...>

Some years ago I wrote a magazine review regarding Visual Basic. At the time

13 messages 2006/07/27

[#204283] Wrapped method causing infinite recursion in rcov — "Pedro Cte-Real" <pedro@...>

I added this to my rails test helper to check for valid HTML automatically:

9 messages 2006/07/27

[#204292] String#chop slow? REALLY slow? — Mat Schaffer <schapht@...>

I just did a quick benchmark to prove something to myself. But I'd

14 messages 2006/07/27

[#204296] Learn to Program - Solutions? — pixelnate <pixelnate@...>

Is there some place that I can solutions to the exercises in the Learn

12 messages 2006/07/27

[#204307] Slow regular expressions :( — Roman Hausner <roman.hausner@...>

I am disappointed to learn that Ruby obviously implements yet another

29 messages 2006/07/27
[#204434] Re: Slow regular expressions :( — "Just Another Victim of the Ambient Morality" <ihatespam@...> 2006/07/28

[#204365] converting some autogenerated ruby code to C — "Eric Mahurin" <eric.mahurin@...>

One of the next things I want to do in my grammar package is to give

16 messages 2006/07/27
[#204803] Re: converting some autogenerated ruby code to C — Eric Hodel <drbrain@...7.net> 2006/07/29

On Jul 27, 2006, at 2:25 PM, Eric Mahurin wrote:

[#205117] Re: converting some autogenerated ruby code to C — "Eric Mahurin" <eric.mahurin@...> 2006/07/31

On 7/28/06, Eric Hodel <drbrain@segment7.net> wrote:

[#205274] Re: converting some autogenerated ruby code to C — "Dominik Bathon" <dbatml@...> 2006/07/31

Hi Eric,

[#204369] GDK#create_cairo_context not found — "Farrel Lifson" <farrel.lifson@...>

What version of rcairo, and ruby-gnome2 do I need to have

13 messages 2006/07/27
[#204500] Re: GDK#create_cairo_context not found — "anne001" <anne@...> 2006/07/28

do you get the same error in irb when you type

[#204412] About last night ... — "M. Edward (Ed) Borasky" <znmeb@...>

Now that I have your attention :) ... last night was FOSCON II -- Ruby

32 messages 2006/07/28

[#204459] For performance, write it in C - Part 2, comparing C, Ruby and Java — Peter Hickman <peter@...>

This is the follow up to my "Write it in C post" and is intended to

49 messages 2006/07/28
[#204477] Re: For performance, write it in C - Part 2, comparing C, Ruby and Java — "Isak Hansen" <isak.hansen@...> 2006/07/28

[#204478] Re: For performance, write it in C - Part 2, comparing C, Ruby and Java — Peter Hickman <peter@...> 2006/07/28

Isak Hansen wrote:

[#204636] Re: For performance, write it in C - Part 2, comparing C, Ruby and Java — "William James" <w_a_x_man@...> 2006/07/28

M. Edward (Ed) Borasky wrote:

[#204809] Re: For performance, write it in C - Part 2, comparing C, Ruby and Java — "M. Edward (Ed) Borasky" <znmeb@...> 2006/07/29

William James wrote:

[#204811] Re: For performance, write it in C - Part 2, comparing C, Ruby and Java — Chad Perrin <perrin@...> 2006/07/29

On Sat, Jul 29, 2006 at 12:22:05PM +0900, M. Edward (Ed) Borasky wrote:

[#204820] Re: For performance, write it in C - Part 2, comparing C, Ruby and Java — "M. Edward (Ed) Borasky" <znmeb@...> 2006/07/29

Chad Perrin wrote:

[#204832] Re: For performance, write it in C - Part 2, comparing C, Ruby and Java — Chad Perrin <perrin@...> 2006/07/29

On Sat, Jul 29, 2006 at 01:18:25PM +0900, M. Edward (Ed) Borasky wrote:

[#204915] Miscellanous Language Ranting (was Re: For performance, write it in C - Part 2, comparing C, Ruby and Java) — "M. Edward (Ed) Borasky" <znmeb@...> 2006/07/29

Chad Perrin wrote:

[#204471] Signaling Ruby from C/C++ — Asterix Gallier <asterixgallier@...>

Hello,

21 messages 2006/07/28
[#204816] Re: Signaling Ruby from C/C++ — "Suraj N. Kurapati" <skurapat@...> 2006/07/29

-----BEGIN PGP SIGNED MESSAGE-----

[#204481] Weird problem with case expressions — Daniel Schierbeck <daniel.schierbeck@...>

I have no problem doing this:

15 messages 2006/07/28

[#204492] Ruby::Tk on OS X event binding hint — Morton Goldberg <m_goldberg@...>

On Macintosh OS X, one can use 'Command' and 'Option' as Tk event

11 messages 2006/07/28

[#204544] state of unicode support — Chad Perrin <perrin@...>

I've heard rumors that "oniguruma fixes everything", and the like. I'm

23 messages 2006/07/28
[#204577] Re: state of unicode support — "Charles O Nutter" <headius@...> 2006/07/28

Oh man, I really don't have the energy for this thread again :) Chad: if you

[#204634] Re: state of unicode support — why the lucky stiff <ruby-talk@...> 2006/07/28

On Sat, Jul 29, 2006 at 01:08:06AM +0900, Charles O Nutter wrote:

[#204554] Using a '-' in a Key name in a Hash — Andrew Knott <aknott@...>

Hi,

13 messages 2006/07/28

[#204572] Re: state of unicode support — Chad Perrin <perrin@...>

On Sat, Jul 29, 2006 at 12:46:25AM +0900, Berger, Daniel wrote:

13 messages 2006/07/28
[#204583] Re: state of unicode support — Cliff Cyphers <cdc@...2go.com> 2006/07/28

Chad Perrin wrote:

[#204589] ruby threads? the point? — Eric Armstrong <Eric.Armstrong@...>

Saw an archived message yesterday that

26 messages 2006/07/28
[#204597] Re: ruby threads? the point? — Justin Collins <collinsj@...> 2006/07/28

Eric Armstrong wrote:

[#204705] Re: ruby threads? the point? — Eric Armstrong <Eric.Armstrong@...> 2006/07/28

Justin Collins wrote:

[#204709] Re: ruby threads? the point? — Justin Collins <collinsj@...> 2006/07/28

Eric Armstrong wrote:

[#204723] Re: ruby threads? the point? — "N Okia" <wrecklass1@...> 2006/07/28

Tested it with cygwin under Windows XP, and it worked fine. Again,

[#204742] Re: ruby threads? the point? — Eric Armstrong <Eric.Armstrong@...> 2006/07/28

N Okia wrote:

[#204749] Re: ruby threads? the point? — khaines@... 2006/07/28

On Sat, 29 Jul 2006, Eric Armstrong wrote:

[#204751] Re: ruby threads? the point? — Eric Armstrong <Eric.Armstrong@...> 2006/07/28

khaines@enigo.com wrote:

[#204610] Chip-8 (#88) — Ruby Quiz <james@...>

The three rules of Ruby Quiz:

19 messages 2006/07/28

[#204623] does ":" have an anolog in another language? — "Ike" <rxv@...>

does the colon operator have an anolog in say, Java or C++ ? It seems to be

28 messages 2006/07/28
[#204628] Re: does ":" have an anolog in another language? — Chad Perrin <perrin@...> 2006/07/28

On Sat, Jul 29, 2006 at 03:40:11AM +0900, Ike wrote:

[#204635] Re: does ":" have an anolog in another language? — "Matt Todd" <chiology@...> 2006/07/28

A simple way to describe it may be to look at it as a singleton object

[#204640] Re: does ":" have an anolog in another language? — Chad Perrin <perrin@...> 2006/07/28

On Sat, Jul 29, 2006 at 04:18:28AM +0900, Matt Todd wrote:

[#204657] Re: does ":" have an anolog in another language? — nothinghappens@...

Sorry if anyone's beat me to this, I find it hard to keep up with such a busy list...

12 messages 2006/07/28

[#204665] Finding "\" in a string — Eric Armstrong <Eric.Armstrong@...>

I'm going crazy, right? Surely it is possible

19 messages 2006/07/28

[#204975] TCPSocket and RFC 821 — "Satish Talim" <satish.talim@...>

I wanted to send an email from my desktop using a simple Ruby program.

17 messages 2006/07/30
[#205066] Re: TCPSocket and RFC 821 — Francis Cianfrocca <garbagecat10@...> 2006/07/30

Satish Talim wrote:

[#205111] Re: TCPSocket and RFC 821 — "Satish Talim" <satish.talim@...> 2006/07/31

I tried the various suggestions given by Francis and Yohanes, but still it

[#205075] Howto Delete 3 Leftmost Characters — "Skeets" <skillet3232@...>

i'm sure this is easy, but i've gone through Pickaxe's string methods,

18 messages 2006/07/30
[#205082] Re: Howto Delete 3 Leftmost Characters — Esteban Manchado Vel痙quez <zoso@...> 2006/07/30

On Mon, Jul 31, 2006 at 06:30:13AM +0900, Skeets wrote:

[#205116] Question regarding postings in comp.lang.ruby — "Michael W. Ryder" <_mwryder@...>

Why do I sometimes see replies to posts in this group but not the

22 messages 2006/07/31
[#205303] Re: Question regarding postings in comp.lang.ruby — "F. Senault" <fred@...> 2006/07/31

Le 31 juillet 2006 22:56, James Edward Gray II a 馗rit :

[#205305] Re: Question regarding postings in comp.lang.ruby — James Edward Gray II <james@...> 2006/08/01

On Jul 31, 2006, at 6:30 PM, F. Senault wrote:

[#205118] using the current method name within current method — "Matthew Heidemann" <matthew.heidemann@...>

Is there a way to get the current method name within the current method?

20 messages 2006/07/31
[#205120] Re: using the current method name within current method — Daniel Harple <dharple@...> 2006/07/31

On Jul 30, 2006, at 11:37 PM, Matthew Heidemann wrote:

[#205121] Re: using the current method name within current method — "Aleks Kissinger" <aleks0@...> 2006/07/31

This is kindof a hack, but it seems to work:

[#205130] Re: using the current method name within current method — "Matt Todd" <chiology@...> 2006/07/31

If you wanted to modularize it just for the sake of it, you could do

[#205150] Re: using the current method name within current method — Robert Klemme <shortcutter@...> 2006/07/31

Matt Todd wrote:

[#205243] Re: using the current method name within current method — Logan Capaldo <logancapaldo@...> 2006/07/31

[#205123] Environment variables with empty value missing from ENV? — Clifford Heath <no.spam@...>

Under Windows XP (using cygwin's bash, but native Ruby), I

12 messages 2006/07/31

[#205174] humanized Xml tree navigation — "chiaro scuro" <kiaroskuro@...>

Does anybody know of a library that allows to go through an xml tree as if

21 messages 2006/07/31

[#205207] Does Ruby need a "line separator" class? — Wes Gamble <weyus@...>

I've run into a problem where Ruby can't handle newlines on Windows

15 messages 2006/07/31
[#205219] Re: Does Ruby need a "line separator" class? — Xavier Noria <fxn@...> 2006/07/31

On Jul 31, 2006, at 5:40 PM, Wes Gamble wrote:

[#205256] I thought this was the one that worked? — Eric Armstrong <Eric.Armstrong@...>

#!/usr/bin/env ruby

139 messages 2006/07/31
[#205266] Re: I thought this was the one that worked? — Logan Capaldo <logancapaldo@...> 2006/07/31

[#205268] Re: I thought this was the one that worked? — Chad Perrin <perrin@...> 2006/07/31

On Tue, Aug 01, 2006 at 04:23:27AM +0900, Logan Capaldo wrote:

[#205277] Re: I thought this was the one that worked? — Logan Capaldo <logancapaldo@...> 2006/07/31

[#205286] Re: I thought this was the one that worked? — Chad Perrin <perrin@...> 2006/07/31

On Tue, Aug 01, 2006 at 04:57:48AM +0900, Logan Capaldo wrote:

[#205290] Re: I thought this was the one that worked? — Logan Capaldo <logancapaldo@...> 2006/07/31

[#205297] Re: I thought this was the one that worked? — Chad Perrin <perrin@...> 2006/07/31

On Tue, Aug 01, 2006 at 07:05:31AM +0900, Logan Capaldo wrote:

[#205307] Re: I thought this was the one that worked? — Logan Capaldo <logancapaldo@...> 2006/08/01

[#205323] Re: I thought this was the one that worked? — Chad Perrin <perrin@...> 2006/08/01

On Tue, Aug 01, 2006 at 09:50:23AM +0900, Logan Capaldo wrote:

[#205331] Re: I thought this was the one that worked? — dblack@... 2006/08/01

Hi -

[#205369] Re: I thought this was the one that worked? — Chad Perrin <perrin@...> 2006/08/01

On Tue, Aug 01, 2006 at 12:05:50PM +0900, dblack@wobblini.net wrote:

[#205406] Re: I thought this was the one that worked? — dblack@... 2006/08/01

Hi --

[#205496] Re: I thought this was the one that worked? — Chad Perrin <perrin@...> 2006/08/01

On Tue, Aug 01, 2006 at 09:03:50PM +0900, dblack@wobblini.net wrote:

[#205505] Re: I thought this was the one that worked? — "Jacob Fugal" <lukfugl@...> 2006/08/01

On 8/1/06, Chad Perrin <perrin@apotheon.com> wrote:

[#205509] Re: I thought this was the one that worked? — Chad Perrin <perrin@...> 2006/08/01

On Wed, Aug 02, 2006 at 04:56:53AM +0900, Jacob Fugal wrote:

[#205525] Re: I thought this was the one that worked? — "Jacob Fugal" <lukfugl@...> 2006/08/01

On 8/1/06, Chad Perrin <perrin@apotheon.com> wrote:

[#205533] Re: I thought this was the one that worked? — Chad Perrin <perrin@...> 2006/08/01

On Wed, Aug 02, 2006 at 05:19:38AM +0900, Jacob Fugal wrote:

[#205472] Re: I thought this was the one that worked? — "Jacob Fugal" <lukfugl@...> 2006/08/01

On 8/1/06, Chad Perrin <perrin@apotheon.com> wrote:

[#205500] Re: I thought this was the one that worked? — Chad Perrin <perrin@...> 2006/08/01

On Wed, Aug 02, 2006 at 01:28:45AM +0900, Jacob Fugal wrote:

[#205310] Re: I thought this was the one that worked? — "Just Another Victim of the Ambient Morality" <ihatespam@...> 2006/08/01

[#205438] Re: I thought this was the one that worked? — "Just Another Victim of the Ambient Morality" <ihatespam@...> 2006/08/01

[#205444] Re: I thought this was the one that worked? — dblack@... 2006/08/01

Hi --

[#205506] Re: I thought this was the one that worked? — Chad Perrin <perrin@...> 2006/08/01

On Tue, Aug 01, 2006 at 11:34:35PM +0900, dblack@wobblini.net wrote:

[#205416] Re: I thought this was the one that worked? — "Just Another Victim of the Ambient Morality" <ihatespam@...> 2006/08/01

[#205503] Re: I thought this was the one that worked? — Chad Perrin <perrin@...> 2006/08/01

On Tue, Aug 01, 2006 at 09:40:05PM +0900, Just Another Victim of the Ambient Morality wrote:

[#205515] Re: I thought this was the one that worked? — ara.t.howard@... 2006/08/01

On Wed, 2 Aug 2006, Chad Perrin wrote:

[QUIZ][SOLUTION] Re: Sokoban (#5)

From: Morton Goldberg <m_goldberg@...>
Date: 2006-07-14 15:10:00 UTC
List: ruby-talk #201932
Here is one more solution to the Sokoban quiz. I think people might  
be interested in seeing this one because 1) it uses a different  
implementation strategy then the solutions posted back in 2004, and  
2) it is somewhat more complete than those solutions.

I know that the Sokoban quiz was posted a long time ago. But I didn't  
even know that Ruby existed back then. I first heard about Ruby and  
became interested it in April of this year. In June, I picked up Best  
of Ruby Quiz. It was from that book that I learned about the Sokoban  
quiz.

I had a lot of fun implementing Sokoban in Ruby. The only difficulty  
I encountered was in dealing with the Curses module, for which l was  
not able to locate up-to-date documentation. In the end, I had to  
fall back on trial-and-error to get the code involving Curses methods  
to work.

Regards, Morton

--------------------------- start of code ---------------------------

#! /usr/bin/ruby -w
# Author: Morton Goldberg
#
# Date: July 13, 2006
#
# An implementation of the Sokoban game based on the model-view- 
controller
# design pattern. It also avoids using case blocks, using hashes  
instead.
# The user interface is implemented with Curses. Games are saved and
# restored using YAML.

require 'curses'

WELCOME = 'Welcome to Sokoban 1.0 -- press h if you need help'

# The SOKOBAN environment variable must be defined and point to the  
folder
# where the file "levels.txt" can be found. Further, any files  
written out
# (such as saved games, level maps, and completion certificates) will be
# written to this folder.
FOLDER = ENV['SOKOBAN']

# LEVELS is the name of a file containing a collection of level maps  
to be
# loaded during start-up.
LEVELS = "levels.txt"

# GAME is the name given to a saved game. If such a file exists in  
FOLDER,
# the game can be restored from it at any time during play.
GAME = "sokoban.yaml"

# Unit vectors representing one-step moves in the four cardinal  
directions.
UVEC = {
    ?e => [0, 1],
    ?w => [0, -1],
    ?n => [-1, 0],
    ?s => [1, 0]
    }

# A sokoban represents the warehouse worker. It knows the following  
things:
#     Where it is
#     How to move around the level map
#     How to push crates
class Sokoban

    # Transition table for simple moves.
    MOVE_TABLE = {
       '@ ' => ' @',
       '@.' => ' +',
       '+ ' => '.@',
       '+.' => '.+'
       }

    # Transition table for crate-pushing moves.
    PUSH_TABLE = {
       '@o ' => ' @o',
       '@o.' => ' @*',
       '@* ' => ' +o',
       '@*.' => ' +*',
       '+o ' => '.@o',
       '+o.' => '.@*',
       '+* ' => '.+o',
       '+*.' => '.+*'
       }

    # Given a level's map, return the position of the token representing
    # the sokoban. When successful, returns an array of form [row, col];
    # otherwise, it returns nil.
    def Sokoban.find(level_map)
       level_map.each_with_index do |row, i|
          j = row.index(/[@+]/)
          return [i, j] if j
       end
       return nil
    end

    attr_reader :row, :col

    # Argument position must be an array of the form [row, col].
    def initialize(position)
       @row = position[0]
       @col = position[1]
    end

    # Perform a simple move; i.e., no crate push.
    # Argument token must be is one of ?e, ?w, ?n, or ?s.
    # Argument map must be a level map.
    def move(token, map)
       dr, dc = UVEC[token]
       r, c = @row + dr, @col + dc
       old = map[@row][@col, 1] + map[r][c, 1]
       new = MOVE_TABLE[old]
       if new then
          rows = [@row, r]
          cols = [@col, c]
          @row = r
          @col = c
          return [rows, cols, old, new]
       else
          return [nil, nil, nil, nil]
       end
    end

    # Perform a crate-pushing move.
    # Argument token must be is one of ?e, ?w, ?n, or ?s.
    # Argument map must be a level map.
    def push(token, map)
       dr, dc = UVEC[token]
       r, c = @row + dr, @col + dc
       rr, cc = r + dr, c + dc
       old = map[@row][@col, 1] + map[r][c, 1] + map[rr][cc, 1]
       new = PUSH_TABLE[old]
       if new then
          rows = [@row, r, rr]
          cols = [@col, c, cc]
          @row = r
          @col = c
          return [rows, cols, old, new]
       else
          return [nil, nil, nil, nil]
       end
    end

    def to_s
       "[#@row, #@col]"
    end

end

# A model represents the state of the level being played. It  
maintains the
# level map and knows the following things:
#     What moves are valid
#     When a level is complete
#     How to perform valid moves
#     How to undo previous moves
class Model

    PASS   = ' '   # marks empty passage cell
    EMPTY  = '.'   # marks empty storage cell
    CRATE  = 'o'   # marks crate in pasaage cell
    FILLED = '*'   # marks crate in storage cell

    # The collection of level maps.
    # Levels are 1-based, so level 0 is just a place holder and is  
not used.
    @@maps = ['#']

    # Load a collection of Sokoban level maps from the specified path.
    def Model.load_maps(path)
       File.open(path, "r") do |f|
          map = []
          f.each_line do |line|
             if line =~ /^\s*#/ then
                map << line.chomp
             elsif ! map.empty? then
                @@maps << map
                map = []
             end
          end
          @@maps << map unless map.empty?
       end
    end

    # Returns the number of levels available for play.
    def Model.levels
       @@maps.length - 1
    end

    attr_reader :map, :rows, :cols, :sokoban, :moves_made

    # Argument level must be an integer in range 1..Model.levels.
    def initialize(level)
       @level = level
       @moves_made = 0
       @history = []
       # Need a deep copy because it will be destructively modified  
during
       # game play.
       @map = @@maps[@level].collect {|r| String.new(r)}
       @rows = @map.length
       @cols = (@map.collect {|r| r.length}).max
       @sokoban = Sokoban.new(Sokoban.find(@map))
    end

    # Returns true if the move is valid and false if it is not. A  
valid move
    # produces the appropriate change in the level's map.
    # Game moves are represented by single character tokens (?e, ?w, ? 
n, ?s)
    # indicating the direction of the move.
    def move(token)
       dr, dc = UVEC[token]
       adjacent = @map[@sokoban.row + dr][@sokoban.col + dc, 1]
       if adjacent == PASS || adjacent == EMPTY then
          rows, cols, old, new = @sokoban.move(token, @map)
       elsif adjacent == CRATE || adjacent == FILLED then
          rows, cols, old, new = @sokoban.push(token, @map)
       else
          return false
       end
       return false unless new
       # Move is valid, so update the level map.
       rows.length.times do |k|
          map_row = @map[rows[k]]
          map_row[cols[k]] = new[k]
       end
       # Update the undo history.
       @history << [rows, cols, old]
       @moves_made = @history.length
       return true
    end

    # Complete undo is simple to implement, but rather memory intensive.
    def undo
       return false if @history.empty?
       rows, cols, old = @history.pop
       rows.length.times do |k|
          map_row = @map[rows[k]]
          map_row[cols[k]] = old[k]
       end
       @moves_made = @history.length
       @sokoban = Sokoban.new([rows[0], cols[0]])
       return true
    end

    # The level is complete when the level map contains no crate tokens.
    def level_complete?
       crates = @map.collect do |row|
          row.include?(CRATE)
       end
       ! crates.any?
    end

end

# A view knows how to draw a visual representation of the level being  
played.
class View

    include Curses

    # A view must be initialized with an instance of Model.
    def initialize(model)
       @model = model
       # The spaces needed on the left side of level's map to center it.
       @left_margin =  ' '* ((cols - @model.cols) / 2)
       # Put four blank lines before the top line of the level's map.
       @top_margin = 4
    end

    # Draw the level's map in the screen buffer.
    def draw
       @model.map.each_with_index do |row, i|
          setpos(@top_margin + i, 0)
          addstr(@left_margin + row)
       end
    end

end

# Provide a Curses-based approximation to the alert box widgets provided
# by GUIs. Somewhat crude but useful as well as easy to use.
class AlertBox < Curses::Window

    # Aids in determining the size of an alert's frame.
    # Returns the height and width of a frame will closely fit the
    # specified text. Provides for a border and left and right margins.
    def AlertBox.size(text)
       text = text.split("\n")
       [text.length + 2, (text.map {|m| m.length}).max + 6]
    end

    # Aids in centering an alert on the screen.
    # Returns a frame that will closely fit the specified text. Provides
    # for a border and left and right margins.
    def AlertBox.center(text)
       h, w = size(text)
       [(Curses::lines - h) / 2, (Curses::cols - w) / 2, h, w]
    end

    # rect is the alert's frame, an array of the form [top_row, top_col,
    # heigth, width].
    # text is the alert's content, a string consisting of one or more
    # lines.
    def initialize(rect, text)
       @top_y = rect[0]
       @top_x = rect[1]
       @height = rect[2]
       @width = rect[3]
       @text = text.split("\n")
       super(@height, @width, @top_y, @top_x)
       box(?#, ?#, ?#)
    end

    # Display the alert on the screen.
    def show
       @text.length.times do |i|
          setpos(i + 1, 3)
          addstr(@text[i])
       end
       refresh
    end

    RESULT = {?y => true, ?n => false}

    # Display the alert and wait for a key press.
    # Return true if the user preses y.
    # Return false if the user presses n.
    # Beep on any other keystrokes.
    def ask_y_or_n
       show
       Curses::noecho
       key_chr = nil
       loop do
          key_chr = getch
          break if key_chr == ?y || key_chr == ?n
          Curses::beep
       end
       Curses::echo
       RESULT[key_chr]
    end

end

# A controller gets the player's keystrokes and translates them in to  
game
# actions.
class Controller

    require 'yaml'
    include Curses

    # Keystroke command dispatch table
    DISPATCH = Hash.new(:beep)

    # general commands
    DISPATCH[?A]         = :abort       # abort
    DISPATCH[?h]         = :key_help    # show help
    DISPATCH[?l]         = :new_level   # change level
    DISPATCH[?m]         = :map_help    # show map legend & sokoban  
position
    DISPATCH[?n]         = :up_level    # advance to next level
    DISPATCH[?p]         = :dn_level    # return to previous level
    DISPATCH[?q]         = :quit        # quit
    DISPATCH[?r]         = :restore     # restore game
    DISPATCH[?s]         = :save        # save game
    DISPATCH[?w]         = :write_map   # write map to file

    # movement
    DISPATCH[Key::RIGHT] = :go_east     # right arrow = one step east
    DISPATCH[Key::LEFT]  = :go_west     # left arrow = one step west
    DISPATCH[Key::UP]    = :go_north    # up arrow = one step north
    DISPATCH[Key::DOWN]  = :go_south    # down arrow = one step south
    DISPATCH[?z]         = :undo        # undo previous move

    def initialize
       unless FOLDER then
          puts "SOKOBAN environment variable not set"
          exit(false)
       end
       map_file = FOLDER + LEVELS
       if File.exists?(map_file) then
          Model.load_maps(map_file)
       else
          puts "Can't find Sokoban levels file"
          exit(false)
       end
       init_screen
       begin
          cbreak
          stdscr.keypad(true)
          @command_line = lines - 1
          @status_line = lines - 2
          @level = 1
          @model = Model.new(@level)
          @view = View.new(@model)
          @key_chr = nil
          say(WELCOME)
          run
       ensure
          close_screen
          puts $debug unless $debug.empty?
       end
    end

    # Command ask-and-dispatch loop
    def run
       catch(:game_over) do
          loop do
             @view.draw
             ask_cmd
             send(DISPATCH[@key_chr])
          end
       end
    end

    # Handle request to abort -- exit immediately without reminding tihe
    # user to save.
    def abort
       throw(:game_over)
    end

SAVE_ALERT = <<TXT
Do you want to save your game before you quit?

Press y to save
Press n to quit without saving
TXT

    # Handle request to quit -- befoe exiting, remind tihe user to save.
    def quit
       alert = AlertBox.new(AlertBox.center(SAVE_ALERT), SAVE_ALERT)
       save if alert.ask_y_or_n
       throw(:game_over)
    end

KEY_INFO = <<INFO
Sokoban keystroke commands
----------------------------------------
General commands
A      immediate quit
h      display this message
l      go to another level -- you will
        be asked for the level number
m      show legend for level map
n      go to next level
p      go to previous level
q      quit -- you will be asked to save
r      restore saved game
s      save game to disk
w      write level map to disk

Movement commands
Right-arrow  move one step east
Left-arrow   move one step west
Up-arrow     move one step north
Down-arrow   move one step south
z            undo previous move

Press any key to dismiss
INFO

    # Handle request for infomation on keystroke commands.
    def key_help
       alert = AlertBox.new(AlertBox.center(KEY_INFO), KEY_INFO)
       alert.show
       ask_cmd
       clear
    end

MAP_INFO = <<INFO
Sokoban map symbols
-----------------------------
@  sokoban (warehouse worker)
+  sokban on storage bin

.  empty storage bin
o  crate needing to be stored
*  crate stored in a bin

#  wall or other obstacle

Press any key to dismiss
INFO

    # Handle request for infomation on map symbols.
    def map_help
       say("Sokoban is at #{@model.sokoban}")
       alert = AlertBox.new(AlertBox.center(MAP_INFO), MAP_INFO)
       alert.show
       ask_cmd
       clear
    end

    # Handle request to change to another level.
    def new_level
       current = @level
       msg = ask_level
       if @level == current then
          say(msg)
       else
          set_level(msg)
       end
    end

    # Handle request to go to the next level.
    def up_level
       nxt = @level + 1
       if nxt > Model.levels then
          beep
       else
          @level = nxt
          set_level("Starting level #@level")
       end
    end

    # Handle request to go to the previous level.
    def dn_level
       nxt = @level - 1
       if nxt < 1 then
          beep
       else
          @level = nxt
          set_level("Starting level #@level")
       end
    end

    # Change to the requested level.
    def set_level(msg)
       @model = Model.new(@level)
       @view = View.new(@model)
       clear
       say(msg)
    end

    # Handle request to write the current level map out to disk.
    # The level map is written to FOLDER. The file name is generated  
from
    # the current level and the number of moves made. For example, if  
a map
    # is written out for level 3 at move 117, the map file is named
    # "level_map.3.117.txt".
    def write_map
       path = FOLDER + "level_map.#@level.#{@model.moves_made}.txt"
       text =
          "Level: #@level\nMove: #{@model.moves_made}\n\n" +
          @model.map.join("\n")
       File.open(path, 'w') {|f| f.write(text)}
       say("Level map written to disk")
    end

    # Handle request to save the current state of game to a YAML file  
from
    # which it can be restored at some later time.
    def save
       game_file = FOLDER + GAME
       game = {'level' => @level, 'model' => @model}
       File.open(game_file, 'w') do |f|
          YAML.dump(game, f)
          say("Game saved to disk")
       end
    end

    # Handle request to restore a game from a YAML file.
    def restore
       game_file = FOLDER + GAME
       if File.exists?(game_file) then
          game = YAML.load_file(game_file)
          @level = game['level']
          @model = game['model']
          @view = View.new(@model)
          clear
          say("Game restored from disk")
       else
          say("Cant find game file on disk")
       end
    end

    # Handle request to move eastward.
    def go_east
       go(?e, "Moved east")
    end

    # Handle request to move westward.
    def go_west
       go(?w, "Moved west")
    end

    # Handle request to move northward.
    def go_north
       go(?n, "Moved north")
    end

    # Handle request to move southward.
    def go_south
       go(?s, "Moved south")
    end

CERTIFICATE_ALERT = <<TXT
Level Completed
---------------------------------------------------------
You qualify for a certificate to commemorate your success

Press y to have the certificate issued
Press n to skip the certificate
TXT

    # Ask the model to move the sokoban in the direction indicated by  
token.
    # if move succeeded, check for level completion.
    def go(token, msg)
       if @model.move(token) then
          if @model.level_complete? then
             @view.draw
             say("Congratulations! You have completed level #@level")
             alert = AlertBox.new(AlertBox.center(CERTIFICATE_ALERT),
                                  CERTIFICATE_ALERT)
             write_certificate if alert.ask_y_or_n
             clear
             up_level
          else
             say(msg)
          end
       else
          beep
       end
    end

    # Ask the model to undo the sokoban's last move. Decrement the  
move count
    # if successful.
    def undo
       if @model.undo then
          say("Undid move #{@model.moves_made + 1}")
       else
          beep
       end
    end

    # Display a message on the status line. The message will be  
prefixed by
    # the level number and the move count.
    def say(text)
       text = "Level #@level, move #{@model.moves_made}: " + text
       setpos(@status_line, 0)
       addstr(text.ljust(cols))
       refresh
    end

    # Display a prompt for imput on the command line.
    # Return the user's response (a string).
    def ask_str(prompt)
       w = prompt.length
       setpos(@command_line, 0)
       addstr(prompt.ljust(cols))
       setpos(@command_line, w)
       refresh
       getstr
    end

    COMMAND_PROMPT = '>> '
    CURSOR_COLUMN = COMMAND_PROMPT.length

    # Prompt for and get a keystroke command.
    def ask_cmd
       setpos(@command_line, 0)
       addstr(COMMAND_PROMPT.ljust(cols))
       setpos(@command_line, CURSOR_COLUMN)
       refresh
       noecho
       @key_chr = getch
       echo
    end

    LEVEL_PROMPT = "What level do you want to play? "

    # Ask the user for a level number. If the response is valid,  
accept it;
    # if not, the current level persists.
    def ask_level
       prompt = LEVEL_PROMPT + "[1 - #{Model.levels}]: "
       begin
          response = ask_str(prompt).to_i
          if (1..Model.levels).include?(response) then
             @level = response
             msg = "Starting level #@level"
          else
             raise RangeError
          end
       rescue
          # Resume current level.
          msg = "Level change cancelled"
       end
       return msg
    end

    # Write a certificate of completion for the current level out to  
disk.
    # The certificate is written to FOLDER. The file name is  
generated from
    # the USER environment variable, the current level, and the  
number of
    # moves it took to complete the level. For example, if user "mg"
    # completes leve 3 in 435 moves, the certificate file is named
    # "mg.3.435.txt". The file's contents repeat the information  
contained
    # in the file name in a more readable format and adds the date.
    def write_certificate
       user = ENV['USER']
       date = Time.now.strftime("%d/%m/%Y")
       path = FOLDER + "#{user}.#@level.#{@model.moves_made}.txt"
       text = <<-TXT
          Sokoban Certificate of Completiion
          ----------------------------------
          Date: #{date}
          Level: #@level
          Moves: #{@model.moves_made}
          Player: #{user}
       TXT
       text.gsub!(/^\s+/, '')
       File.open(path, 'w') {|f| f.write(text)}
    end

end

$debug = []
Controller.new

---------------------------  end of code  ---------------------------

In This Thread