[#227503] open-uril ECONNREFUSED problem — Cyrus Ghalambor <cyrusg@...>

I'm working on a simple scraping tool and the open() method has suddenly

12 messages 2006/12/01

[#227527] Gateway is malfunctioning — "Trans" <transfire@...>

Someone recently mentioned missing posts. I just did a comparsion of

31 messages 2006/12/01

[#227574] Turtle Graphics (#104) — Ruby Quiz <james@...>

The three rules of Ruby Quiz:

37 messages 2006/12/01
[#227598] Re: [QUIZ] Turtle Graphics (#104) — "Harold Hausman" <hhausman@...> 2006/12/01

On 12/1/06, Ruby Quiz <james@grayproductions.net> wrote:

[#227606] Re: [QUIZ] Turtle Graphics (#104) — James Edward Gray II <james@...> 2006/12/01

On Dec 1, 2006, at 9:42 AM, Harold Hausman wrote:

[#227620] Re: [QUIZ] Turtle Graphics (#104) — "Harold Hausman" <hhausman@...> 2006/12/01

On 12/2/06, James Edward Gray II <james@grayproductions.net> wrote:

[#227661] Re: [QUIZ] Turtle Graphics (#104) — Daniel Martin <martin@...> 2006/12/01

"Harold Hausman" <hhausman@gmail.com> writes:

[#227670] Re: [QUIZ] Turtle Graphics (#104) — James Edward Gray II <james@...> 2006/12/01

On Dec 1, 2006, at 3:44 PM, Daniel Martin wrote:

[#227682] Re: tk.rb warning in Turtle Graphics (#104) — Edwin Fine <efine145-nospam01@...> 2006/12/02

/usr/local/lib/ruby/site_ruby/1.8/tk.rb:1187: warning: instance variable

[#227713] Re: tk.rb warning in Turtle Graphics (#104) — Morton Goldberg <m_goldberg@...> 2006/12/02

On Dec 1, 2006, at 7:22 PM, Edwin Fine wrote:

[#227630] Simple iteration in a function problem — Blake Miller <blakeage@...>

i'm trying to do this, and I'm stuck

34 messages 2006/12/01

[#227702] calculations on lists of numbers — ara.t.howard@...

38 messages 2006/12/02

[#227739] openssl error - ubuntu — "Chad" <carimura@...>

Help!

27 messages 2006/12/02
[#227741] Re: openssl error - ubuntu — Jose francisco Gonzalez carmona <pgonzalez@...> 2006/12/02

[#227787] Re: openssl error - ubuntu — "Chad" <carimura@...> 2006/12/02

Absolutely... I'm not a linux expert though, but I have a feeling

[#227822] Re: openssl error - ubuntu — "Chad" <carimura@...> 2006/12/02

I finally figured it out.

[#305614] Re: openssl error - ubuntu — James George <james@...> 2008/06/19

Thanks a lot pal, it worked perfectly for me too. I had the same openssl

[#305645] Re: openssl error - ubuntu — Marc Heiler <shevegen@...> 2008/06/19

So much for distribution's package managers making your life easier,

[#227801] comma separating output from array.to_s — "jansenh" <henning.jansen@...>

hi comp.lang.ruby

18 messages 2006/12/02

[#227819] Factory pattern, abstract base class — "Daniel Berger" <djberg96@...>

Hi all,

16 messages 2006/12/02

[#227839] Why does a test fail when I predicted it's exception class? — "Richard" <RichardDummyMailbox58407@...>

Hi,

10 messages 2006/12/03

[#227857] File.size() returning negative for large files ???? — "Greg Hauptmann" <greg.hauptmann.ruby@...>

Hi,

13 messages 2006/12/03
[#227859] Re: File.size() returning negative for large files ???? — Damjan Rems <d_rems@...> 2006/12/03

Greg Hauptmann wrote:

[#227860] I'm a new member — "Quỳnh Trần" <quynh_khanh2002@...>

Hi evrybody!

16 messages 2006/12/03

[#227873] Simple and stuppid bug (can anyone find it?) — "paul" <pjvleeuwen@...>

Hi all,

13 messages 2006/12/03

[#227979] method overloading like Java? — Daniel Finnie <danfinnie@...>

In Java, you could write the following code:

12 messages 2006/12/04

[#228031] Question about Ruby philosophy — Zouplaz <user@...>

Hello, when I compare Ruby to Java there is something I don't understand .

46 messages 2006/12/04
[#228134] Re: Question about Ruby philosophy — "Max Muermann" <ruby@...> 2006/12/05

On 12/4/06, Zouplaz <user@domain.invalid> wrote:

[#228047] replace delimiter in unicode encdoded file — "ciapecki" <ciapecki@...>

Is there a way in ruby to:

20 messages 2006/12/04

[#228127] How do I catch a missing method on a passed block? — "J2M" <james2mccarthy@...>

I would like to invoke method_missing on baz in this code;

34 messages 2006/12/04
[#228211] Re: How do I catch a missing method on a passed block? — Daniel Schierbeck <daniel.schierbeck@...> 2006/12/05

On Tue, 2006-12-05 at 08:04 +0900, J2M wrote:

[#228213] Re: How do I catch a missing method on a passed block? — Logan Capaldo <logancapaldo@...> 2006/12/05

On Tue, Dec 05, 2006 at 11:54:06PM +0900, Daniel Schierbeck wrote:

[#228266] md5 function in Ruby — Denys Yakhnenko <dyakhnenko@...>

Hello all:

14 messages 2006/12/05

[#228273] Lisp comprehensions => SQL — "Victor \"Zverok\" Shepelev" <vshepelev@...>

Hi all.

24 messages 2006/12/05

[#228352] Newbie: working with a text file and converting to xml — Adam Teale <ateale@...>

hi Guys,

12 messages 2006/12/06

[#228379] Calling super in overwritten methods — Joerg Diekmann <joergd@...>

Hi - not sure if this is possible - but it feels like it could be with

12 messages 2006/12/06

[#228380] join_with — "Martin DeMello" <martindemello@...>

While golfing with the hex_ip thread, I realised that map takes no

33 messages 2006/12/06
[#229469] map taking an argument (was: Re: join_with) — dblack@... 2006/12/13

Hi --

[#228422] invasive parameters as method mode variables — "Trans" <transfire@...>

Working on a method where I would like one part of it's operations to

15 messages 2006/12/06

[#228605] Show your support for Rubinius! — "Sam Smoot" <ssmoot@...>

(I hope you don't mind a bit of cross-posting, but seeing as how the

17 messages 2006/12/07
[#228613] Re: Show your support for Rubinius! — "Tim Pease" <tim.pease@...> 2006/12/07

On 12/7/06, Sam Smoot <ssmoot@gmail.com> wrote:

[#228618] Re: Show your support for Rubinius! — "Brian Mitchell" <binary42@...> 2006/12/07

On 12/7/06, Tim Pease <tim.pease@gmail.com> wrote:

[#228620] Re: Show your support for Rubinius! — "Wilson Bilkovich" <wilsonb@...> 2006/12/07

On 12/7/06, Brian Mitchell <binary42@gmail.com> wrote:

[#228622] Re: Show your support for Rubinius! — benjohn@... 2006/12/07

I'd like to know more about Rubinius, but all the info I've got on it

[#228628] Array changing after concat function — WKC CCC <wai-kee.chung@...>

Can someone shed some light on this problem. In the example, I am

17 messages 2006/12/07

[#228716] Am I missing something about BER-compressed integer? — "Francis Cianfrocca" <garbagecat10@...>

All:

12 messages 2006/12/08

[#228738] Tournament Matchups (#105) — Ruby Quiz <james@...>

The three rules of Ruby Quiz:

23 messages 2006/12/08

[#228875] Ruby Core + Php FrontEnd (open) — Flaab Mrlinux <flaab_mrlinux@...>

Good afternoon everyone.

13 messages 2006/12/09

[#228945] format problem — chen li <chen_li3@...>

Hi all,

23 messages 2006/12/10

[#229119] else inside rescue is useless? — "cap" <capitain@...>

http://www.awprofessional.com/bookstore/product.asp?isbn=0672328844&rl=1

20 messages 2006/12/11

[#229122] Newbie questions — Dav Jones <kakaze@...21.com>

Hello, I'm quite new to this whole Ruby malarky and I'm having some real

15 messages 2006/12/11

[#229244] Re: Ruby for Kids? — "Jeff_M" <JeffMcGrath@...>

18 messages 2006/12/12

[#229350] C => Ruby plus TCP serialization using Marshal.dump/load — "Nathan Baker" <nathanb@...>

Hey,

12 messages 2006/12/12

[#229351] - Bible 1.0.1 - A bible reference parsing and text retrieval tool — "Justin Bailey" <jgbailey@...>

All,

13 messages 2006/12/12

[#229397] Restricted capture in Regexp — benjohn@...

Is there a regexp feature that lets me require something to be present

16 messages 2006/12/13

[#229398] How to improve my Ruby skills ? — Zouplaz <user@...>

Hello there... Like many others I've discovered Ruby when I started

11 messages 2006/12/13

[#229467] Net::Ldap question — Eduardo Y瘻ez Parareda <eduardo.yanezNOSPAM@...>

Hello, I'm trying this plugin in a rails app and think I need some help.

13 messages 2006/12/13
[#229486] Re: Net::Ldap question — Eduardo Y瘻ez Parareda <eduardo.yanezNOSPAM@...> 2006/12/13

Hehe, sorry again. I've reading documentation of this library and already know

[#229514] Re: Net::Ldap question — "Francis Cianfrocca" <garbagecat10@...> 2006/12/13

On 12/13/06, Eduardo Y瘻ez Parareda <eduardo.yanezNOSPAM@nospamgmail.com> wrote:

[#229511] Random idea - private, blocks, constants — "Daniel Berger" <djberg96@...>

Hi all,

14 messages 2006/12/13

[#229598] CTI Corporativo auto responses — "Daniel Berger" <djberg96@...>

All,

14 messages 2006/12/14

[#229600] Swap contents in two files — Christopher Latif <christopherl@...>

I have two files, I want to swap the contents of the files in my

17 messages 2006/12/14

[#229763] Chess960 (#106) — Ruby Quiz <james@...>

The three rules of Ruby Quiz:

33 messages 2006/12/15

[#229883] ZenTest autotest problems — Zouplaz <user@...>

Hello, I have big troubles using the latest autotest version (3.4.2)

11 messages 2006/12/16
[#229985] Re: ZenTest autotest problems — Eric Hodel <drbrain@...7.net> 2006/12/17

On Dec 16, 2006, at 01:40, Zouplaz wrote:

[#229990] Re: ZenTest autotest problems — Zouplaz <user@...> 2006/12/17

le 17/12/2006 07:43, Eric Hodel nous a dit:

[#230118] Re: ZenTest autotest problems — Eric Hodel <drbrain@...7.net> 2006/12/18

On Dec 17, 2006, at 24:55, Zouplaz wrote:

[#229906] Just some Ruby language ideas, comments wanted. — Daniel Finnie <danfinnie@...>

My first Ruby language idea is simple. Instead of having every method

13 messages 2006/12/16

[#229917] does Ruby generate WINDOWS and dialog boxes? — "Ken Laninga" <personal@...>

I just heard about Ruby and it looks fascinating. I see lots of code being

60 messages 2006/12/16
[#229922] Re: does Ruby generate WINDOWS and dialog boxes? — David Vallner <david@...> 2006/12/16

Ken Laninga wrote:

[#229939] Re: does Ruby generate WINDOWS and dialog boxes? — Joel VanderWerf <vjoel@...> 2006/12/16

David Vallner wrote:

[#229961] Re: does Ruby generate WINDOWS and dialog boxes? — Suraj Kurapati <snk@...> 2006/12/17

Joel VanderWerf wrote:

[#229967] Re: does Ruby generate WINDOWS and dialog boxes? — "Richard" <RichardDummyMailbox58407@...> 2006/12/17

[#229968] Re: does Ruby generate WINDOWS and dialog boxes? — David Vallner <david@...> 2006/12/17

Richard wrote:

[#229973] Re: does Ruby generate WINDOWS and dialog boxes? — "Richard" <RichardDummyMailbox58407@...> 2006/12/17

[#230007] Re: does Ruby generate WINDOWS and dialog boxes? — David Vallner <david@...> 2006/12/17

Richard wrote:

[#230065] Re: does Ruby generate WINDOWS and dialog boxes? — "Richard" <RichardDummyMailbox58407@...> 2006/12/17

> Odds are it Just Won't unless you only

[#230073] Re: does Ruby generate WINDOWS and dialog boxes? — David Vallner <david@...> 2006/12/17

Richard wrote:

[#230127] Re: does Ruby generate WINDOWS and dialog boxes? — "Richard" <RichardDummyMailbox58407@...> 2006/12/18

Disclaimer: All my assertions about Ruby, Rails, WEBrick and MySQL are

[#230008] Grabbing data off a webpage — Bil Kleb <Bil.Kleb@...>

OK, so I haven't done this in years.

12 messages 2006/12/17

[#230011] Ruby IDE — <adaworks@...>

I am new to Ruby, but I have used a lot of other

24 messages 2006/12/17

[#230089] Question regarding threads and I/O — "Michael W. Ryder" <_mwryder@...>

I am a veteran programmer but still am trying to learn Ruby. In the

14 messages 2006/12/17
[#230094] Re: Question regarding threads and I/O — Logan Capaldo <logancapaldo@...> 2006/12/18

On Mon, Dec 18, 2006 at 08:55:10AM +0900, Michael W. Ryder wrote:

[#230147] Problem installing Ruby/Tk — Christopher Latif <christopherl@...>

Installed Linux

14 messages 2006/12/18

[#230256] where have all the experienced users gone? — "Trans" <transfire@...>

seems like there's been a steady drop off in experienced ruby users on

63 messages 2006/12/19
[#230284] Re: [OT] where have all the experienced users gone? — Eric Hodel <drbrain@...7.net> 2006/12/19

On Dec 18, 2006, at 18:50, Trans wrote:

[#230327] Re: [OT] where have all the experienced users gone? — Jeremy Wells <jwells@...> 2006/12/19

Eric Hodel wrote:

[#230332] Re: [OT] where have all the experienced users gone? — "Robert Dober" <robert.dober@...> 2006/12/19

On 12/19/06, Jeremy Wells <jwells@servalsystems.co.uk> wrote:

[#230350] Re: [OT] where have all the experienced users gone? — "Jeremy McAnally" <jeremymcanally@...> 2006/12/19

I think it's also important that we all realize that we use mailing

[#230423] Re: [OT] where have all the experienced users gone? — James Edward Gray II <james@...> 2006/12/19

On Dec 19, 2006, at 7:52 AM, Jeremy McAnally wrote:

[#230322] Re: where have all the experienced users gone? — "Robert Dober" <robert.dober@...> 2006/12/19

On 12/19/06, Trans <transfire@gmail.com> wrote:

[#230507] Re: where have all the experienced users gone? — "Simon Strandgaard" <neoneye@...> 2006/12/20

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

[#230514] Re: where have all the experienced users gone? — "Robert Dober" <robert.dober@...> 2006/12/20

On 12/20/06, Simon Strandgaard <neoneye@gmail.com> wrote:

[#230295] string of strings... — Josselin <josselin@...>

I got an array of id's :

13 messages 2006/12/19

[#230328] compare two objects without take its ID in consideration — Lobosque Lucas <floyd_u2@...>

Is there a way to compare two objects without take its ID in

17 messages 2006/12/19

[#230450] ruby gotchas — Mark Guzman <segfault@...>

I've written up some ruby gotchas that have come up while using ruby.

16 messages 2006/12/19

[#230548] tricky sort for happy visitors of Paris — Josselin <josselin@...>

all happy visitors of Paris know about the 'arrondissement', an

20 messages 2006/12/20

[#230588] openssl on Red Hat not installed — Hueen Hueen <hueen@...>

So I'm one of the unlucky ones that don't have openssl properly

17 messages 2006/12/20

[#230602] Regexp Question: Checking for [joe][/joe] pairs — Joe Peck <joe@...>

Hey, I've got some text in @x and want there to be at least 1 and at

21 messages 2006/12/20

[#230648] Who's maintaining log4r? — jeffz_2002@...

Does anyone know who's maintaining the log4r project? The website at

29 messages 2006/12/20

[#230650] Searching Stings with Arrays? — Phil Cooperking <phil@...>

Hi, I've been having a little problem with this. most of my ruby is from

14 messages 2006/12/20

[#230755] Remove Ruby 1.8.5? — Christopher Latif <christopherl@...>

How do I remove Ruby 1.8.5 from linux? I have built it from source.

20 messages 2006/12/21
[#230874] Re: Remove Ruby 1.8.5? — David Vallner <david@...> 2006/12/21

M. Edward (Ed) Borasky wrote:

[#230879] Re: Remove Ruby 1.8.5? — Vincent Fourmond <vincent.fourmond@9online.fr> 2006/12/21

David Vallner wrote:

[#230792] Method named ***(other) — Julien Gaugaz <gaugaz@...3s.de>

Hi!

15 messages 2006/12/21
[#230799] Re: Method named ***(other) — "Vidar Hokstad" <vidar.hokstad@...> 2006/12/21

[#230829] Ruby's Trac Alternative — Bil Kleb <Bil.Kleb@...>

So I'm trying to use Trac for our FUN3D development,

27 messages 2006/12/21

[#230853] External Ruby Script in HTML — Naked Sushi <runfaster@...>

This probably has a simple answer, but I don't know it.

17 messages 2006/12/21

[#230869] Ruby replacement for ab? — Mat Schaffer <schapht@...>

So I've been hunting for a way to stress test a web application and

17 messages 2006/12/21

[#230983] Merry (slightly early) Christmas! Mr. Neighborly's Humble Little Ruby Book is free! — "Jeremy McAnally" <jeremymcanally@...>

Hello all,

15 messages 2006/12/22

[#231056] Question: Downloading files with open(-uri)? — Mariano Kamp <mariano.kamp@...>

Hi,

16 messages 2006/12/23

[#231072] Help with a ruby idiom — Tim Waters <timgwaters@...>

From the O'Reilly Cookbook there is code that keeps call functions in a

16 messages 2006/12/23

[#231181] Hpricot ri and rdoc documentation — "bbiker" <renard@...>

I have gem installed Hpricot-0.4 (mswin32) but no ri documentation or

15 messages 2006/12/24

[#231198] A problem about replacing a string in a template. — Kuang Dong <kuangdong@...>

File 1: test.tpl

13 messages 2006/12/25

[#231277] Newby - how to round up floating point number? — Dermot Moynihan <der_moyn@...>

Hi guys

14 messages 2006/12/26

[#231303] Hash with two identical keys? — "Trans" <transfire@...>

>From Facets' multiton.rb (which is primarily Floran Franks' work), I'm

15 messages 2006/12/26

[#231341] Peculiar Behavior for a Newby to Undertstand — Charles A Gray <smgspices@...>

I created a class for prime numbers as so:

14 messages 2006/12/27

[#231377] How to do TDD in Ruby? — mekondelta <Chris.Melikian@...>

15 messages 2006/12/27

[#231385] newbie with a weird technical problem (@ least I think it's weird) — "will" <will.graduate@...>

Yep, as the post title implies, I'm a newbie. Being a pragmatic newbie

10 messages 2006/12/27

[#231436] Handling of arbitrary length arrays in arguments to printf builtin — Nick Pavey <nick@...>

Hi Folks,

13 messages 2006/12/27
[#231437] Re: Handling of arbitrary length arrays in arguments to printf builtin — Timothy Hunter <TimHunter@...> 2006/12/27

Nick Pavey wrote:

[#231462] Higher-Order Procedures Tutorial (long) — "Nate Murray" <jashmenn@...>

Hey Guys,

16 messages 2006/12/28

[#231494] Strip is not stripping trailing whitespace — Taylor Strait <taylorstrait@...>

I have files with city names which have one or two trailing whitespaces:

14 messages 2006/12/28

[#231595] What we have here is a retard pretending to be a computer scientist — atbusbook@...

http://www.iam.unibe.ch/~scg/Archive/Papers/Scha04bOOEncapsulation.pdf

14 messages 2006/12/29
[#231602] Paper on strong Object Oriented Encapsulation (Was: some subject with needless insults) — Eric Hodel <drbrain@...7.net> 2006/12/29

On Dec 28, 2006, at 16:05, atbusbook@aol.com wrote:

[#231610] Re: Paper on strong Object Oriented Encapsulation (Was: some subject with needless insults) — "Jeff" <cohen.jeff@...> 2006/12/29

Eric Hodel wrote:

[#231686] how to properly format data when using TCPSocket.send() — Nathan Taylor <onebitcipher@...>

It would be greatly appreciated if someone would clue me in to what I am

12 messages 2006/12/29

[#231726] Methods validating their arguments: good or bad? — Michael Judge <mjudge@...>

15 messages 2006/12/29

[#231763] how to lex javascript for an assert_js system? — Phlip <phlip2005@...>

Ruboids:

14 messages 2006/12/30

[#231785] Proposal to create a new mailing list — Daniel Schierbeck <daniel.schierbeck@...>

Hello fellow Rubyphilics!

31 messages 2006/12/30

[#231801] Little Things — "Trans" <transfire@...>

I was a bit surprised about Matz mention of the little things in his

164 messages 2006/12/30
[#231848] Re: Little Things — Daniel Schierbeck <daniel.schierbeck@...> 2006/12/30

I mostly agree, with some of the additions of course being more

[#231882] Re: Little Things — dblack@... 2006/12/31

Hi --

[#231888] Re: Little Things — "Trans" <transfire@...> 2006/12/31

[#231893] Re: Little Things — Devin Mullins <twifkak@...> 2006/12/31

Trans wrote:

[#231898] Re: Little Things — "Rob Sanheim" <rsanheim@...> 2006/12/31

On 12/31/06, Devin Mullins <twifkak@comcast.net> wrote:

[#232438] Re: Little Things — Paulo Kh <paulo.koch@...> 2007/01/03

On 2006/12/31, at 07:38, Rob Sanheim wrote:

[#232439] Re: Little Things — ara.t.howard@... 2007/01/03

On Thu, 4 Jan 2007, [ISO-8859-1] Paulo Kh wrote:

[#232449] Re: Little Things — "Trans" <transfire@...> 2007/01/03

[#232451] Re: Little Things — ara.t.howard@... 2007/01/03

On Thu, 4 Jan 2007, Trans wrote:

[#232496] Re: Little Things — "Trans" <transfire@...> 2007/01/04

[#232501] Re: Little Things — ara.t.howard@... 2007/01/04

On Thu, 4 Jan 2007, Trans wrote:

[#232502] Re: Little Things — dblack@... 2007/01/04

Hi --

[#232503] Re: Little Things — ara.t.howard@... 2007/01/04

On Thu, 4 Jan 2007 dblack@wobblini.net wrote:

[#232544] Re: Little Things — Devin Mullins <twifkak@...> 2007/01/04

ara.t.howard@noaa.gov wrote:

[#232547] Re: Little Things — "Trans" <transfire@...> 2007/01/04

[#232571] Re: Little Things — Devin Mullins <twifkak@...> 2007/01/04

Trans wrote:

[#232587] Re: Little Things — "Trans" <transfire@...> 2007/01/04

[#232602] Re: Little Things — ara.t.howard@... 2007/01/04

On Thu, 4 Jan 2007, Trans wrote:

[#232615] Re: Little Things — "Trans" <transfire@...> 2007/01/04

[#232616] Re: Little Things — dblack@... 2007/01/04

Hi --

[#232619] Re: Little Things — ara.t.howard@... 2007/01/04

On Fri, 5 Jan 2007 dblack@wobblini.net wrote:

[#232626] Re: Little Things — dblack@... 2007/01/04

Hi --

[#232631] Re: Little Things — ara.t.howard@... 2007/01/04

On Fri, 5 Jan 2007 dblack@wobblini.net wrote:

[#232638] Re: Little Things — "Chris Carter" <cdcarter@...> 2007/01/04

On 1/4/07, ara.t.howard@noaa.gov <ara.t.howard@noaa.gov> wrote:

[#232650] Pervasive Methods [was: Little Things] — "Trans" <transfire@...> 2007/01/04

[#232652] Re: Pervasive Methods [was: Little Things] — ara.t.howard@... 2007/01/04

On Fri, 5 Jan 2007, Trans wrote:

[#232653] Re: Pervasive Methods [was: Little Things] — "Tim Pease" <tim.pease@...> 2007/01/04

On 1/4/07, ara.t.howard@noaa.gov <ara.t.howard@noaa.gov> wrote:

[#232656] Re: Pervasive Methods [was: Little Things] — ara.t.howard@... 2007/01/04

On Fri, 5 Jan 2007, Tim Pease wrote:

[#232657] Re: Pervasive Methods [was: Little Things] — "Trans" <transfire@...> 2007/01/04

[#232659] Re: Pervasive Methods [was: Little Things] — ara.t.howard@... 2007/01/04

On Fri, 5 Jan 2007, Trans wrote:

[#231932] Re: Little Things — Yukihiro Matsumoto <matz@...> 2006/12/31

Hi,

[#231821] Newbie: It works, how can I make it better? — Jay Bornhoft <jbornhoft@...>

I wrote this little prog giving the user two choices.

13 messages 2006/12/30

[#231938] Re: Status of Cardinal (was Re: Proposal to create a new mailing list) — "Francis Cianfrocca" <garbagecat10@...>

I'm not jumping back into this in a big way, since it's obvious

11 messages 2006/12/31

[#231941] Mini-RCR: Extra Argument for Array#join — James Edward Gray II <james@...>

I've been looking at the to_sentence() method in Rails. It's

17 messages 2006/12/31

[#231946] Open source credit card processing in ruby — snacktime <snacktime@...>

Just recently I have the option to open source a credit card

12 messages 2006/12/31
[#231956] Re: Open source credit card processing in ruby — "Francis Cianfrocca" <garbagecat10@...> 2006/12/31

On 12/31/06, M. Edward (Ed) Borasky <znmeb@cesmail.net> wrote:

[#231951] Re: Status of Cardinal (was Re: Proposal to create a new mailing list) — Charles Oliver Nutter <charles.nutter@...>

Robert Dober wrote:

9 messages 2006/12/31

Re: [QUIZ] Tournament Matchups (#105)

From: Daniel Finnie <danfinnie@...>
Date: 2006-12-10 21:12:20 UTC
List: ruby-talk #229031
(Where it says attached, it will be attached in another email, the email 
  was too big)

Following is the version that makes a nice, configurable ASCII chart.
The chart is basically an object that stores a nested hash of [x][y]
values.  Instead of just outputting the data as a string, as above, this
version stores everything in Objects.  Tournament has rounds which have
matches which have teams.  The matching logic is very similar to the
above.  The options for the program can be accessed by running it with
no arguments (or --help or -h or -? or look below):
daniel@daniel-desktop:~$ ./tournie.rb
Usage: tournie.rb [options]

Use one of the following options to determine the teams:
       -n, --numerical TEAMS            TEAMS number of teams where 1 is
the best
                                        and TEAMS is the worst.
       -f, --from-csv FILE              CSV file FILE to get team data from.
                                        <rank>,<name>\n format

And any number of these to determine the output format(s):
       -c, --[no-]chart                 Display an ASCII based chart of
rounds
       -t, --[no-]text                  Display the rounds in a textual
format,
                                        for example:
                                        Round 1: 1 vs. 8, 4 vs. 5...

The following are completely optional:
(the short names correspond with positions on the num-pad)
       -8, --chart-height HEIGHT        Controls the vertical spacing on
the chart,
                                        with a higher HEIGHT meaning more
spacing.
                                        Defaults to 4, must be an integer
above 2.
       -4, --spacing-left SPACE         Controls the space to the left of
the team names.
                                        Defaults to 3, must be a positive,
non-negative integer.
       -6, --spacing-right SPACE        Controls the space to the right of
the team names.
                                        Defaults to 1, must be a positive,
non-negative integer.
       -5, --team-alignment ALIGNMENT   The alignment of team names on
their lines.
                                        Defaults to [l]eft, can be [r]ight
or [c]entered.
                                        Takes -6 but not -4 into account.
       -?, -h, --help                   Show this message

The quiz examples, as decided by this version (and some others):

daniel@daniel-desktop:~$ ./tournie.rb -n 6 -ct
Round 1: 1 vs. bye, 4 vs. 5, 2 vs. bye, 3 vs. 6.
Round 2: 1 vs. 4, 2 vs. 3.
Round 3: 1 vs. 2.
     1
    -----+
         |---+
    -----+   |  1
     bye     +----+
             |    |---+
     4       +----+   |
    -----+   |  4     |
         |---+        |
    -----+            |  1
     5                +----+
                      |    |---> 1
     2                +----+
    -----+            |  2
         |---+        |
    -----+   |  2     |
     bye     +----+   |
             |    |---+
     3       +----+
    -----+   |  3
         |---+
    -----+
     6


daniel@daniel-desktop:~$ ./tournie.rb -n 8 -ct
Round 1: 1 vs. 8, 4 vs. 5, 2 vs. 7, 3 vs. 6.
Round 2: 1 vs. 4, 2 vs. 3.
Round 3: 1 vs. 2.
     1
    ---+
       |---+
    ---+   |  1
     8     +----+
           |    |---+
     4     +----+   |
    ---+   |  4     |
       |---+        |
    ---+            |  1
     5              +----+
                    |    |---> 1
     2              +----+
    ---+            |  2
       |---+        |
    ---+   |  2     |
     7     +----+   |
           |    |---+
     3     +----+
    ---+   |  3
       |---+
    ---+
     6

daniel@daniel-desktop:~$ ./tournie.rb --from-csv tournie.csv --chart
--text --team-alignment c --spacing-right 5
Round 1: Red Devils vs. Underdogs, Metrostart vs. Giants, Mets vs. Jets,
Yankees vs. Red Sox.
Round 2: Red Devils vs. Metrostart, Mets vs. Yankees.
Round 3: Red Devils vs. Mets.
       Red Devils
    ----------------+
                    |---+
    ----------------+   |    Red Devils
        Underdogs       +-----------------+
                        |                 |---+
       Metrostart       +-----------------+   |
    ----------------+   |    Metrostart       |
                    |---+                     |
    ----------------+                         |    Red Devils
         Giants                               +-----------------+
                                              |                 |---> RD
          Mets                                +-----------------+(RD
change
    ----------------+                         |       Mets        d by me
                    |---+                     |                  b/c wrapp
    ----------------+   |       Mets          |                  ing)
          Jets          +-----------------+   |
                        |                 |---+
         Yankees        +-----------------+
    ----------------+   |      Yankees
                    |---+
    ----------------+
         Red Sox

Where tournie.csv had the following:
5,Metrostart
4,Yankees
8,Red Sox
7,Giants
2,Red Devils
9,Jets
3,Mets
56,Underdogs

Source of the program (I recommend viewing attachment because of wrapping):
#! /usr/bin/ruby
require 'enumerator'
require 'optparse'
require 'ostruct'

class String
	# Alias for String#center that fits into the ljust, rjust naming scheme.
	def cjust(*args)
		self.center(*args)
	end
	
	# align(:r, 5) --> rjust(5).  Alignment can be :r, :l, :c
	def align(alignment, *args)
		self.send((alignment.to_s + "just").to_sym, *args)
	end
end	

class Numeric
	# Is the given number a power of self?
	# 16.isPowerOf(2) == true
	# 100.isPowerOf(2) == false
	def isPowerOf(other)
		i = 0
		while (other ** i <= self)
			return true if other ** i == self
			i += 1
		end
		false
	end
	
	def average(other)
		(self + other) / 2
	end
end

# Rounds have matches which have a winning and loosing team.
class Match
	def initialize(*teams)
		@teams = teams.sort
		setLoser
	end
	
	# The loser is defined as the team with the lowest ranking before the
tournament.
	def setLoser
		@teams.last.eliminate
	end
	
	def winner
		@teams.find{|x| !x.eliminated?}
	end
	
	def loser
		@teams.find{|x| x.eliminated? }
	end
	
	# Return in the following format: <winner> vs. <looser>
	def to_s
		@teams.collect{|team| team.to_s}.join(" vs. ")
	end
	
	attr_reader :teams
end

# Tournaments have rounds, which have matches.
class Round
	@@totalRounds = 0
	
	def initialize()
		@matches = []
		@roundNum = @@totalRounds += 1
	end
	
	def addMatch(match)
		@matches.push(match)
	end

	# Prints the round in "Round x: <match>, <match>, etc." format.
	def to_s
		"Round #{@roundNum}: " + @matches.join(", ") + "."
	end
	
	# This changes the order of the matches so that in the next round, the
most extreme teams will face off.
	# Assumes that the matches were previously sorted by favorability (asc
or desc)
	def sort!
		sorted = []
		while @matches.length > 0
			sorted << @matches.shift << @matches.pop
		end
		@matches = sorted.compact
		self
	end
	
	attr_reader :roundNum, :matches
end

# Matches have teams which have info about themselves.
class Team
	@@favored = []
	@@currentRound = nil
	
	def initialize(name)
		@name = name
		@eliminated = false
		@rounds = []
		@@favored.push(self)
	end
	
	# Remove a team from future rounds if they lost.
	def eliminate
		@eliminated = true
		@@favored.delete(self)
		#@@notEliminated -= 1
	end
	
	# If a team has played in a certain round.
	def inRound?()
		@rounds.include? @@currentRound
	end
	
	# Add a round a team has played in
	def addPlayedRound()
		@rounds << @@currentRound
		self
	end
	
	def to_s
		@name
	end
	
	# Returns an array with teams not in the current round by favorability.
	def self.eligibleTeams()
		@@favored.select{|x| !x.inRound?}.sort
	end
	
	def <=>(other)
		@@favored.index(self) <=> @@favored.index(other)
	end
	
	def self.currentRound=(round)
		@@currentRound = round
	end
	
	attr_reader :name, :eliminated
	alias_method :"eliminated?", :eliminated
end

class Tournament
	# Recieves an aray of team names in order of ranking with the best first.
	def initialize(teams)
		@teams = teams.collect {|team| Team.new(team.to_s) }
		@rounds = []
	end
	
	def createNextRound
		currentRound = Round.new()
		Team.currentRound = currentRound
		
		# The top teams have a "bye" opponent if the number of teams isn't a
power of two.  Bye opponents always lose.
		until (Team.eligibleTeams.length.isPowerOf(2))
			currentRound.addMatch( Match.new(
				Team.eligibleTeams.first.addPlayedRound,
				Team.new("bye")
			) )
		end
		
		# Assign the rest of the teams to play their extreme opposites.
		while(Team.eligibleTeams.length > 1)
			currentRound.addMatch( Match.new(
				Team.eligibleTeams.last.addPlayedRound,
				Team.eligibleTeams.first.addPlayedRound
			) )
		end
		
		currentRound.sort! if currentRound.roundNum == 1
		@rounds.push(currentRound)
	end
	
	def createAllRounds
		until (@teams.find_all{|x| !x.eliminated?}.length == 1)
			createNextRound
		end
	end
	
	def to_s
		@rounds.join("\n")
	end
	
	def toASCIIChart(chartHeightModifier, spacingLeft, spacingRight, alignment)
		# Everything goes into this array in output[x][y] format, which is
then printed.  The origin is in the top left.
		output = ASCIICoordinatePlane.new
		
		# This stores the midpoints of the existing games outputted so that
the next round's matches will be aligned in between this round's matches.
		midpoints = Hash.new( Array.new )
		midpoints[1] = [chartHeightModifier]
		@rounds.first.matches.each {midpoints[1].unshift( midpoints[1].first -
(chartHeightModifier + 2) )}
		
		x = 2
		
		# Every round is one column.
		@rounds.each do |round|
			# The longest team name.
			columnWidth = round.matches.collect{|match|
match.teams}.flatten.collect{|team| team.name}.max{|a, b| a.length <=>
b.length}.length + spacingRight
			
			connectTheDots = []
			insertMidpoint = true
			
			# Every iteration makes 1 match appear.
			round.matches.reverse.each do |match|
				y = midpoints[round.roundNum].shift + 2
				
				# The first team's name.
				output.set(x, y, match.teams[0].name.to_s.align(alignment, columnWidth))
				
				# The line under that team's name.
				output.fill(x - spacingLeft, y -= 1, x + columnWidth, y, "-")
				output.set(x - spacingLeft, y, "+")
				output.fill(0, y, x - 1, y, " ") if round.roundNum == 1
				
				# The connector to the next round.
				output.set(x + columnWidth + 1, y -= 1, "-" * 3)
				
				# Deals with the midpoints.
				if insertMidpoint
					midpoints[round.roundNum + 1].push(y)
				else
					midpoints[round.roundNum + 1].push( midpoints[round.roundNum +
1].pop.average(y) )
				end
				insertMidpoint = !insertMidpoint
				
				# The line above the next team's name.
				output.fill(x - spacingLeft, y -= 1, x + columnWidth, y, "-")
				output.set(x - spacingLeft, y, "+")
				output.fill(0, y, x - 1, y, " ") if round.roundNum == 1
				
				# The next team's name.
				output.set(x, y -= 1, match.teams[1].name.to_s.align(alignment,
columnWidth))
				
				# The line on the right of the match going vertically.
				output.vertLine(x + columnWidth, y + 3, y+1)
				
				# To connect the match and the next match to each other.
				connectTheDots.push(y+2)
			end
			x += columnWidth + 4
			
			# Makes the lines vertically between matches.
			connectTheDots.each_slice(2) do |yvalues|
				starting = yvalues[0]
				if yvalues[1]
					ending = yvalues[1]
				else
					ending = starting
				end
				
				output.vertLine(x, starting, ending)
			end
			
			x += spacingLeft
		end
		
		# Print the winning team.
		output.set(x - spacingLeft, midpoints[@rounds.length].last, "> " +
@rounds.last.matches[0].winner.name)
		output
	end
	
	attr_reader :rounds
end

# Represents a coordinate plane with the origin in the top left.  Every
position can store a character.
class ASCIICoordinatePlane
	def initialize
		# Thank you Joel VanderWerf!
		@value = Hash.new {|h,k| h[k] = Hash.new {" "}}
		
		@maxx = 10
		@miny = -10
	end
	
	# Sets a specific character to a point, overflowing onto points to the
right if neccessary.
	def set(x, y, string)
		0.upto(string.length-1) do |index|
			@value[x][y] = string[index].chr	
			x += 1
		end
		
		@miny = y if y < @miny
		@maxx = x if x > @maxx
	end
	
	# Fill a horizontal line with a repeating character.
	def fillHorz(opts)
		set(opts[:startx], opts[:starty], opts[:string ] * (opts[:endx] -
opts[:startx]).abs)
	end
	
	# Fill a vertical line with a repeating character.
	def fillVert(opts)
		yvalues = [opts[:starty], opts[:endy]]
		y = yvalues.max
		
		until (y < yvalues.min)
			set(opts[:startx], y, opts[:string])
			y -= 1
		end
	end
	
	# Fills a straight, non-diagonal line with a repeating character
	def fill(startx, starty, endx, endy, string)
		if startx == endx
			fillVert({:startx => startx, :endx => endx, :starty => starty, :endy
=> endy, :string => string})
		else
			fillHorz({:startx => startx, :endx => endx, :starty => starty, :endy
=> endy, :string => string})
		end
	end
	
	# Creates a vertical line with +'s for the line endings.
	def vertLine(x, starty, endy)
		fill(x, starty, x, endy, "|")
		[starty, endy].each {|y| set(x, y, "+") }
	end
	
	# Outputs the coordinate plane to a string with spaces where no
character was entered.
	def to_s
		output = ""
		0.downto(@miny) do |y|
			0.upto(@maxx) do |x|
				output += @value[x][y]
			end
			output += "\n"
		end
		output
	end
end

class OptParser
	def self.parse(args)
		options = OpenStruct.new
		options.csv = nil
		options.numerical = nil
		options.league = nil
		options.chart = false
		options.chartheight = 4
		options.spacingleft = 3
		options.spacingright = 1
		options.alignment = :l
		options.textual = false
		
		# When called with no options, show the help.
		args = ["-?"] if args.empty?
		
		opts = OptionParser.new do |opts|
			opts.banner = "Usage: tournie.rb [options]"
			opts.separator ""
			opts.separator "Use one of the following options to determine the teams:"
			
			# From 1 to a numerical value.
			opts.on("-n", "--numerical TEAMS",
					"TEAMS number of teams where 1 is the best",
					"and TEAMS is the worst.") do |n|
						options.numerical = n
			end
			
			# From a CSV file
			opts.on("-f", "--from-csv FILE",
					"CSV file FILE to get team data from.",
					"<rank>,<name>\\n format") do |file|
						options.csv = file
			end
			
			opts.separator ""
			opts.separator "And any number of these to determine the output
format(s):"
			
			# Chart based representation
			opts.on("-c", "--[no-]chart",
					"Display an ASCII based chart of rounds") do |chartYesNoMaybeNaN|
						options.chart = chartYesNoMaybeNaN
			end
			
			# Textual representation
			opts.on("-t", "--[no-]text",
					"Display the rounds in a textual format,",
					"for example:",
					"Round 1: 1 vs. 8, 4 vs. 5...") do |text|
						options.textual = text
			end
			
			opts.separator ""
			opts.separator "The following are completely optional:"
			opts.separator "(the short names correspond with positions on the
num-pad)"
			
			# Chart height modifier
			opts.on("-8", "--chart-height HEIGHT",
					"Controls the vertical spacing on the chart,",
					"with a higher HEIGHT meaning more spacing.",
					"Defaults to 4, must be an integer above 2.") do |heigh|
						options.chartheight = heigh.to_i
			end
				
			# Spacing to the left of team names.
			opts.on("-4", "--spacing-left SPACE",
					"Controls the space to the left of the team names.",
					"Defaults to 3, must be a positive, non-negative integer.") do |s|
						options.spacingleft = s.to_i
			end
			
			# Spacing to the right of team names.
			opts.on("-6", "--spacing-right SPACE",
					"Controls the space to the right of the team names.",
					"Defaults to 1, must be a positive, non-negative integer.") do |s|
						options.spacingright = s.to_i
			end
			
			# Alignment of team names.
			opts.on("-5", "--team-alignment ALIGNMENT",
					"The alignment of team names on their lines.",
					"Defaults to [l]eft, can be [r]ight or [c]entered.",
					"Takes -6 but not -4 into account.") do |s|
						options.alignment = s.to_sym
			end
			
			opts.on("-?", "-h", "--help", "Show this message") do
				puts opts
				exit
			end
		end
		
		opts.parse!(args)
		options
	end
end

# Parse command line arguments
opts = OptParser.parse(ARGV)

# Create the tournament.
if (opts.numerical)
	tournie = Tournament.new((1..(opts.numerical.to_i)).to_a)
else
	teams = Hash.new
	orderedTeams = Array.new
	f = File.new(opts.csv)
	
	f.each_line do |line|
		line.chomp!
		line =~ /^([0-9]+), *(.*)$/
		teams[$1.to_i] = $2
	end
	
	teams.keys.sort.each do |rank|
		orderedTeams.push(teams[rank])
	end
	
	tournie = Tournament.new(orderedTeams)
end

# Do the logic
tournie.createAllRounds

# Display the tournament
puts tournie.to_s if opts.textual
puts tournie.toASCIIChart(opts.chartheight, opts.spacingleft,
opts.spacingright, opts.alignment).to_s if opts.chart



In This Thread

Prev Next