[#271943] Ruby vs. PHP — Marcin Raczkowski <mailing.mr@...>

Hello

63 messages 2007/10/01
[#271948] Re: Ruby vs. PHP — "Richard Conroy" <richard.conroy@...> 2007/10/01

On 10/1/07, Marcin Raczkowski <mailing.mr@gmail.com> wrote:

[#272001] Re: Ruby vs. PHP — Marcin Raczkowski <mailing.mr@...> 2007/10/01

Richard Conroy wrote:

[#272003] Re: Ruby vs. PHP — Marc Heiler <shevegen@...> 2007/10/01

Finally a topic I like :)

[#271996] Reference vs. Reference — "Robert Klemme" <shortcutter@...>

I feel there is a subtle point that needs clarification.

27 messages 2007/10/01
[#272607] Re: Reference vs. Reference — Paul Brannan <pbrannan@...> 2007/10/04

On Tue, Oct 02, 2007 at 12:29:37AM +0900, Robert Klemme wrote:

[#272138] a = b = c order of evaluation weird — SpringFlowers AutumnMoon <summercoolness@...>

i thought if it is

25 messages 2007/10/02
[#272140] Re: a = b = c order of evaluation weird — 7stud -- <dolgun@...> 2007/10/02

SpringFlowers AutumnMoon wrote:

[#272141] Re: a = b = c order of evaluation weird — 7stud -- <dolgun@...> 2007/10/02

7stud -- wrote:

[#272329] Searching through a sorted array — FireAphis <FireAphis@...>

Hello,

16 messages 2007/10/03

[#272427] Non-blocking 'gets' ? — Stephen Ware <sgware@...>

Hi guys, sorry if this is a stupid question, but I've been reading

27 messages 2007/10/03
[#272458] Re: Non-blocking 'gets' ? — 7stud -- <dolgun@...> 2007/10/03

Stephen Ware wrote:

[#272496] opinion on a simple method — Lloyd Linklater <lloyd@2live4.com>

I am trying to find the better way to do things ruby style. I needed to

15 messages 2007/10/04

[#272529] cygwin's Ruby (was: Re: Whats going on!?!?) — "Robert Klemme" <shortcutter@...>

2007/10/2, Phlip <phlip2005@gmail.com>:

20 messages 2007/10/04
[#272552] Re: cygwin's Ruby — Jay Levitt <jay+news@...> 2007/10/04

On Thu, 4 Oct 2007 18:15:36 +0900, Robert Klemme wrote:

[#272581] Re: cygwin's Ruby — "Garry Offord" <droffo@...> 2007/10/04

It's good to know that somebody has successfully done this. I've tried in

[#272589] Re: cygwin's Ruby — "M. Edward (Ed) Borasky" <znmeb@...> 2007/10/04

Garry Offord wrote:

[#272740] Itinerary for a Traveling Salesman (#142) — Ruby Quiz <james@...>

The three rules of Ruby Quiz:

20 messages 2007/10/05

[#272803] The Case for Multiple-Inheritance — Trans <transfire@...>

So I working on little lib that's ripe for an adapter pattern, when I

71 messages 2007/10/05
[#272918] Re: The Case for Multiple-Inheritance — MenTaLguY <mental@...> 2007/10/06

On Sat, 2007-10-06 at 19:17 +0900, Sylvain Joyeux wrote:

[#272924] Re: The Case for Multiple-Inheritance — Sylvain Joyeux <sylvain.joyeux@...> 2007/10/06

On Saturday 06 October 2007, MenTaLguY wrote:

[#272928] Re: The Case for Multiple-Inheritance — James Edward Gray II <james@...> 2007/10/06

On Oct 6, 2007, at 3:55 PM, Sylvain Joyeux wrote:

[#272979] Re: The Case for Multiple-Inheritance — Sylvain Joyeux <sylvain.joyeux@...> 2007/10/07

> Delegation does not mean duck typing. You are confusing your

[#273018] Re: The Case for Multiple-Inheritance — "Austin Ziegler" <halostatue@...> 2007/10/07

On 10/6/07, Trans <transfire@gmail.com> wrote:

[#273030] Re: The Case for Multiple-Inheritance — Trans <transfire@...> 2007/10/07

[#273120] Re: The Case for Multiple-Inheritance — "Austin Ziegler" <halostatue@...> 2007/10/08

On 10/7/07, Trans <transfire@gmail.com> wrote:

[#273132] Re: The Case for Multiple-Inheritance — Trans <transfire@...> 2007/10/08

[#273185] Re: The Case for Multiple-Inheritance — "Austin Ziegler" <halostatue@...> 2007/10/08

On 10/8/07, Trans <transfire@gmail.com> wrote:

[#272894] Can I do this perl code the same in ruby? — kazaam <kazaam@...>

Well I'm trying to "translate" a perl program to ruby and everything worked fine until the near end where I'm now. There we have this perl code:

14 messages 2007/10/06

[#272904] Ternary Usage — Greg Willits <lists@...>

New to Ruby. Having trouble with ternary statements.

13 messages 2007/10/06

[#272952] The old File.rename not working again. . . . — Peter Bailey <pbailey@...>

This always throws me. I keep getting "permission denied" messages when

24 messages 2007/10/07

[#272954] Hiding source code — |MKSM| <mksm.sama@...>

Hello.

17 messages 2007/10/07

[#272982] #sort_by and #sort_obj — Eric Hodel <drbrain@...7.net>

I haven't seen this technique in the wild before.

18 messages 2007/10/07

[#273052] Obfuscator for Ruby/RoR — "Igor K." <testmyeclipse@...>

Hello,

35 messages 2007/10/07
[#273270] Re: Obfuscator for Ruby/RoR — Ryan Davis <ryand-ruby@...> 2007/10/08

[#273308] Re: Obfuscator for Ruby/RoR — John Joyce <dangerwillrobinsondanger@...> 2007/10/09

[#273382] Re: Obfuscator for Ruby/RoR — mortee <mortee.lists@...> 2007/10/09

John Joyce wrote:

[#273403] Re: Obfuscator for Ruby/RoR — Eric Hodel <drbrain@...7.net> 2007/10/09

On Oct 9, 2007, at 09:22 , mortee wrote:

[#273057] considering writing a book on Ruby/Rails? — "Eric H." <REMOVE-CAPSburnFORout@...>

If anyone here is considering writing a book on Ruby or Rails I'd like

41 messages 2007/10/07
[#273063] Re: considering writing a book on Ruby/Rails? — "Phlip" <phlip2005@...> 2007/10/07

> I hate to gripe but as of today I'm at Ruby/Rails book number 7 and it

[#273069] Re: considering writing a book on Ruby/Rails? — John Joyce <dangerwillrobinsondanger@...> 2007/10/07

[#273079] Re: considering writing a book on Ruby/Rails? — "M. Edward (Ed) Borasky" <znmeb@...> 2007/10/07

John Joyce wrote:

[#273109] Translation Service — James Edward Gray II <james@...>

Sorry for being off topic, but I know so many of you know more

16 messages 2007/10/08

[#273152] Bug: Numeric#divmod calculates wrongly — "Dirk Traulsen" <dirk.traulsen@...>

Hi all!

13 messages 2007/10/08
[#274036] Re: Bug: Numeric#divmod calculates wrongly — "Dirk Traulsen" <dirk.traulsen@...> 2007/10/14

Am 8 Oct 2007 um 19:49 hat Dirk Traulsen geschrieben:

[#273154] MATRIX PROBLEMS (AGAIN!) — "John Nott" <JNott@...>

Hi everyone,=20

15 messages 2007/10/08
[#273172] Re: MATRIX PROBLEMS (AGAIN!) — 7stud -- <dolgun@...> 2007/10/08

John Nott wrote:

[#273175] Re: MATRIX PROBLEMS (AGAIN!) — 7stud -- <dolgun@...> 2007/10/08

7stud -- wrote:

[#273158] regexp question - look for parentheses then remove them — Max Williams <toastkid.williams@...>

I'm struggling with a regular expression problem, can anyone help?

12 messages 2007/10/08
[#273160] Re: regexp question - look for parentheses then remove them — "Jes俍 Gabriel y Gal疣" <jgabrielygalan@...> 2007/10/08

On 10/8/07, Max Williams <toastkid.williams@gmail.com> wrote:

[#273265] parts of speech in Ruby — Chad Perrin <perrin@...>

I'm curious -- exactly what class of syntactic element is `=` in Ruby,

13 messages 2007/10/08

[#273305] The Open-Closed-from-a-certain-angle Principle — Jay Levitt <jay+news@...>

Let me start off by saying that I'm SURE this is either a bad idea,

17 messages 2007/10/09

[#273423] Finding shared elements between to arrays. — Sebastian probst Eide <sebastian.probst.eide@...>

Hi

14 messages 2007/10/09

[#273453] will #in? be in ruby2? (was Re: Finding shared elements between to arrays.) — Pe, Botp <botp@...>

Eric wrote:

14 messages 2007/10/10
[#273460] Re: will #in? be in ruby2? (was Re: Finding shared elements between to arrays.) — "Devi Web Development" <devi.webmaster@...> 2007/10/10

T24gMTAvOS8wNywgUGXDsWEsIEJvdHAgPGJvdHBAZGVsbW9udGUtcGhpbC5jb20+IHdyb3RlOgo+

[#273466] Re: will #in? be in ruby2? (was Re: Finding shared elements between to arrays.) — Peña, Botp <botp@...> 2007/10/10

RnJvbTogRGV2aSBXZWIgRGV2ZWxvcG1lbnQgW21haWx0bzpkZXZpLndlYm1hc3RlckBnbWFpbC5j

[#273481] Inter-Process Messaging — Daniel DeLorme <dan-ml@...42.com>

What are the possibilities in ruby for passing information from one

32 messages 2007/10/10
[#273566] Re: Inter-Process Messaging — Joel VanderWerf <vjoel@...> 2007/10/10

Daniel DeLorme wrote:

[#273556] RubyGems Installation Problem on Solaris 10 — cratervoid@...

I've installed Ruby 1.8.6 on a Solaris 10 server without a problem.

10 messages 2007/10/10

[#273575] what does print call internally? — "Martin DeMello" <martindemello@...>

irb(main):001:0> puts nil

14 messages 2007/10/10
[#273584] Re: what does print call internally? — Eric Hodel <drbrain@...7.net> 2007/10/11

On Oct 10, 2007, at 15:31 , Martin DeMello wrote:

[#273612] Why does this use a block — "Anonymous" <jaimrk@...>

So I'm new to Ruby and I'm trying to use OptionParser to parse in some

13 messages 2007/10/11

[#273630] Should *most* memory be release back to the system? — Blackie <mudsweatandears@...>

If anyone can explain this I would appreciate it.

50 messages 2007/10/11
[#273638] Re: Should *most* memory be release back to the system? — Yohanes Santoso <ysantoso-rubytalk@...> 2007/10/11

Blackie <mudsweatandears@gmail.com> writes:

[#273655] Re: Should *most* memory be release back to the system? — "ara.t.howard" <ara.t.howard@...> 2007/10/11

[#274671] Re: [OT] Re: Should *most* memory be release back to the system? — Yohanes Santoso <ysantoso-rubytalk@...> 2007/10/18

"ara.t.howard" <ara.t.howard@gmail.com> writes:

[#274699] Re: [OT] Re: Should *most* memory be release back to the system? — "M. Edward (Ed) Borasky" <znmeb@...> 2007/10/18

Yohanes Santoso wrote:

[#274705] Re: [OT] Re: Should *most* memory be release back to the system? — Yohanes Santoso <ysantoso-rubytalk@...> 2007/10/18

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

[#274709] Re: [OT] Re: Should *most* memory be release back to the system? — "ara.t.howard" <ara.t.howard@...> 2007/10/18

[#274761] Re: [OT] Re: Should *most* memory be release back to the system? — "M. Edward (Ed) Borasky" <znmeb@...> 2007/10/19

ara.t.howard wrote:

[#274810] Re: [OT] Re: Should *most* memory be release back to the system? — khaines@... 2007/10/19

On Fri, 19 Oct 2007, M. Edward (Ed) Borasky wrote:

[#274826] Re: [OT] Re: Should *most* memory be release back to the system? — "M. Edward (Ed) Borasky" <znmeb@...> 2007/10/19

khaines@enigo.com wrote:

[#274884] Re: [OT] Re: Should *most* memory be release back to the system? — "Michal Suchanek" <hramrach@...> 2007/10/19

On 19/10/2007, M. Edward (Ed) Borasky <znmeb@cesmail.net> wrote:

[#274942] Why don't we have "C" machines? (was Re: [OT] Re: Should *most* memory be release back to the system?) — "M. Edward (Ed) Borasky" <znmeb@...> 2007/10/20

Michal Suchanek wrote:

[#275118] Re: Why don't we have "C" machines? (was Re: [OT] Re: Should *most* memory be release back to the system?) — "Michal Suchanek" <hramrach@...> 2007/10/21

On 20/10/2007, M. Edward (Ed) Borasky <znmeb@cesmail.net> wrote:

[#275170] Re: Why don't we have "C" machines? (was Re: [OT] Re: Should *most* memory be release back to the system?) — "Martin DeMello" <martindemello@...> 2007/10/22

On 10/21/07, Michal Suchanek <hramrach@centrum.cz> wrote:

[#275223] Re: Why don't we have "C" machines? (was Re: [OT] Re: Should *most* memory be release back to the system?) — "M. Edward (Ed) Borasky" <znmeb@...> 2007/10/22

Martin DeMello wrote:

[#275227] Re: Why don't we have "C" machines? (was Re: [OT] Re: Should *most* memory be release back to the system?) — Xavier Noria <fxn@...> 2007/10/22

On Oct 22, 2007, at 4:23 PM, M. Edward (Ed) Borasky wrote:

[#273707] How to delete specific characters from a string? — Bazsl <hs@...>

Is there really no method that allows me to delete N characters starting

13 messages 2007/10/11

[#273718] range max — Marek Kasperkiewicz <m.kasperkiewicz@...>

If i try this

31 messages 2007/10/12
[#273727] Re: range max — Brian Adkins <lojicdotcom@...> 2007/10/12

On Oct 11, 9:30 pm, Marek Kasperkiewicz <m.kasperkiew...@gmail.com>

[#273800] Re: range max — Yossef Mendelssohn <ymendel@...> 2007/10/12

On Oct 11, 9:55 pm, Brian Adkins <lojicdot...@gmail.com> wrote:

[#273823] Re: range max — Brian Adkins <lojicdotcom@...> 2007/10/12

On Oct 12, 8:56 am, Yossef Mendelssohn <ymen...@pobox.com> wrote:

[#273755] Syntax error when redefining >> operator to take a block — John Woods <jqwoods@...>

I'm trying to redefine the >> operator for a particular class such that

9 messages 2007/10/12

[#273828] ANN: English 0.1 — Trans <transfire@...>

English 0.1

17 messages 2007/10/12

[#273887] Is there a standard pattern for threaded access to a file? — Jon Handler <jhandler@...>

I'm pretty new to ruby and this is one of those areas where I can't

37 messages 2007/10/12
[#273891] Re: Is there a standard pattern for threaded access to a file? — "ara.t.howard" <ara.t.howard@...> 2007/10/13

[#273896] Re: Is there a standard pattern for threaded access to a file? — 7stud -- <bbxx789_05ss@...> 2007/10/13

ara.t.howard wrote:

[#273940] Re: Is there a standard pattern for threaded access to a file? — "Francis Cianfrocca" <garbagecat10@...> 2007/10/13

On 10/12/07, Jon Handler <jhandler@shopping.com> wrote:

[#273955] Re: Is there a standard pattern for threaded access to a file? — Eric Hodel <drbrain@...7.net> 2007/10/13

On Oct 13, 2007, at 07:29 , Francis Cianfrocca wrote:

[#273974] Re: Is there a standard pattern for threaded access to a file? — Brian Adkins <lojicdotcom@...> 2007/10/13

On Oct 13, 1:32 pm, Eric Hodel <drbr...@segment7.net> wrote:

[#273919] RubyGems Beta 0.9.4.5 — Eric Hodel <drbrain@...7.net>

RubyGems 0.9.4.5 is a beta release for the upcoming 0.9.5 which adds

13 messages 2007/10/13

[#273980] top 10 last played mp3's — Robin Wagenaar <robin87_msn@...>

Hello everyone,

18 messages 2007/10/13
[#273983] Re: top 10 last played mp3's — "Andreas S." <x-ruby-forum.com@...> 2007/10/13

Robin Wagenaar wrote:

[#273995] Re: top 10 last played mp3's — Konrad Meyer <konrad@...> 2007/10/13

Quoth Andreas S.:

[#273984] write_noblock is blocking? — Christoffer Lern<lerno@...>

Anyone know what's up with TCPSocket#write_noblock actually blocking

15 messages 2007/10/13

[#274031] Mac OS X Tiger comes with Tk? — SpringFlowers AutumnMoon <summercoolness@...>

I thought it is said that Mac OS X Tiger comes with Tk?

23 messages 2007/10/14
[#274032] Re: Mac OS X Tiger comes with Tk? — Ben Bleything <ben@...> 2007/10/14

On Sun, Oct 14, 2007, SpringFlowers AutumnMoon wrote:

[#274062] MIT vs. Ruby/GPL License — Trans <transfire@...>

Rails uses the MIT license. The Ruby license is essentially the GPL

46 messages 2007/10/14
[#274075] Re: MIT vs. Ruby/GPL License — Randy Kramer <rhkramer@...> 2007/10/14

On Sunday 14 October 2007 09:31 am, Trans wrote:

[#274080] Re: MIT vs. Ruby/GPL License — Trans <transfire@...> 2007/10/14

[#274093] Re: MIT vs. Ruby/GPL License — "Terry Poulin" <bigboss64@...> 2007/10/14

I don't think the difference between MIT and GPL License has much purpose in

[#274098] Re: MIT vs. Ruby/GPL License — Trans <transfire@...> 2007/10/14

[#274066] Parameter in a block is not local? — SpringFlowers AutumnMoon <summercoolness@...>

I thought a iterator with a block is like an nameless function call...

21 messages 2007/10/14

[#274120] nil.to_i returning zero — "Gerardo Santana Gez Garrido" <gerardo.santana@...>

zero in Ruby is true, not false, in a boolean context.

38 messages 2007/10/14
[#274289] Re: nil.to_i returning zero — "Gerardo Santana Gez Garrido" <gerardo.santana@...> 2007/10/15

John Joyce wrote:

[#274227] Re: [ANN] RubyTraits 0.1 — Yukihiro Matsumoto <matz@...>

Hi,

22 messages 2007/10/15
[#274239] Re: RubyTraits 0.1 — Trans <transfire@...> 2007/10/15

[#274242] Re: RubyTraits 0.1 — Yukihiro Matsumoto <matz@...> 2007/10/15

Hi,

[#274244] Re: RubyTraits 0.1 — Trans <transfire@...> 2007/10/15

[#274236] ruby wish-list — Roger Pack <rogerpack2005@...>

My personal ruby wish-list (for any feedback):

177 messages 2007/10/15
[#274243] Re: ruby wish-list — Yukihiro Matsumoto <matz@...> 2007/10/15

Hi,

[#274245] Re: ruby wish-list — Roger Pack <rogerpack2005@...> 2007/10/15

Thanks Matz.

[#274263] Re: ruby wish-list — Robert Klemme <shortcutter@...> 2007/10/15

On 15.10.2007 17:24, Roger Pack wrote:

[#274264] Re: ruby wish-list — Robert Klemme <shortcutter@...> 2007/10/15

On 15.10.2007 18:45, Robert Klemme wrote:

[#274271] Re: ruby wish-list — James Tucker <jftucker@...> 2007/10/15

I don't really see the reason why the GC would need or want a specific thread to itself - for a start, such a design makes the system slower on low end systems. There may also be cases where it is possible to choose 'optimal' times to run the GC within a single thread context.

[#274282] Re: ruby wish-list — Roger Pack <rogerpack2005@...> 2007/10/15

So you'd prefer a few tweaks:

[#274721] Re: ruby wish-list — Roger Pack <rogerpack2005@...> 2007/10/18

GC wish list:

[#274898] Re: ruby wish-list — Roger Pack <rogerpack2005@...> 2007/10/19

Roger Pack wrote:

[#274910] Re: ruby wish-list — Suraj Kurapati <snk@...> 2007/10/19

Oh, wishing star! Here are my wishes:

[#277588] Re: ruby wish-list — Roger Pack <rogerpack2005@...> 2007/11/05

Suraj Kurapati wrote:

[#277760] Re: ruby wish-list — Roger Pack <rogerpack2005@...> 2007/11/06

> Take care.

[#277902] Re: ruby wish-list — "Rick DeNatale" <rick.denatale@...> 2007/11/07

On 11/6/07, Roger Pack <rogerpack2005@gmail.com> wrote:

[#278435] Re: ruby wish-list — Roger Pack <rogerpack2005@...> 2007/11/11

>> I wish... that Range.to_a wouldn't become obselete, as it seems quite useful

[#278460] Re: ruby wish-list — "Rick DeNatale" <rick.denatale@...> 2007/11/11

On Nov 11, 2007 1:13 AM, Roger Pack <rogerpack2005@gmail.com> wrote:

[#278461] Re: ruby wish-list — Marc Heiler <shevegen@...> 2007/11/11

"unless you wanted to introduce ';'s to ruby too:"

[#279154] Re: ruby wish-list — Suraj Kurapati <snk@...> 2007/11/15

Marc Heiler wrote:

[#279174] Re: ruby wish-list — "Todd Benson" <caduceass@...> 2007/11/15

On Nov 15, 2007 11:48 AM, Suraj Kurapati <snk@gna.org> wrote:

[#279181] Re: ruby wish-list — Suraj Kurapati <snk@...> 2007/11/15

Todd Benson wrote:

[#279189] Re: ruby wish-list — James Britt <james.britt@...> 2007/11/15

Suraj Kurapati wrote:

[#279197] Re: ruby wish-list — "Rick DeNatale" <rick.denatale@...> 2007/11/15

On Nov 15, 2007 5:30 PM, James Britt <james.britt@gmail.com> wrote:

[#279203] Re: ruby wish-list — "Todd Benson" <caduceass@...> 2007/11/16

On Nov 15, 2007 5:28 PM, Rick DeNatale <rick.denatale@gmail.com> wrote:

[#279213] Re: ruby wish-list — James Britt <james.britt@...> 2007/11/16

Todd Benson wrote:

[#279226] Re: ruby wish-list — Suraj Kurapati <snk@...> 2007/11/16

James Britt wrote:

[#279232] Re: ruby wish-list — James Britt <james.britt@...> 2007/11/16

Suraj Kurapati wrote:

[#279318] Re: ruby wish-list — Roger Pack <rogerpack2005@...> 2007/11/16

> I'm arguing that methods that end in "?" should be designed and used as

[#279348] Re: ruby wish-list — "Todd Benson" <caduceass@...> 2007/11/16

On Nov 16, 2007 9:26 AM, Roger Pack <rogerpack2005@gmail.com> wrote:

[#281415] Re: ruby wish-list — Roger Pack <rogerpack2005@...> 2007/11/30

My latest wish for the wishing tree...

[#281422] Re: ruby wish-list — Trans <transfire@...> 2007/11/30

[#281423] Re: ruby wish-list — "Paul McMahon" <pm@...> 2007/11/30

On Fri, 30 Nov 2007 12:06:18 +0900, Trans <transfire@gmail.com> wrote:

[#281427] Re: ruby wish-list — Trans <transfire@...> 2007/11/30

[#286855] Re: ruby wish-list — Roger Pack <rogerpack2005@...> 2008/01/09

My biggest wish list currently is...I wish I didn't have to use # within

[#286856] Re: ruby wish-list — "Alex LeDonne" <aledonne.listmail@...> 2008/01/09

On Jan 9, 2008 2:37 PM, Roger Pack <rogerpack2005@gmail.com> wrote:

[#288183] Re: ruby wish-list — Roger Pack <rogerpack2005@...> 2008/01/21

[#288228] Re: ruby wish-list — "Robert Klemme" <shortcutter@...> 2008/01/22

2008/1/21, Roger Pack <rogerpack2005@gmail.com>:

[#288267] Re: ruby wish-list — Roger Pack <rogerpack2005@...> 2008/01/22

Robert Klemme wrote:

[#289182] Re: ruby wish-list — Roger Pack <rogerpack2005@...> 2008/01/30

I know this is controversial, but I wish that if you did

[#289229] Re: ruby wish-list — Chad Perrin <perrin@...> 2008/01/30

On Thu, Jan 31, 2008 at 04:34:49AM +0900, Roger Pack wrote:

[#309521] Re: ruby wish-list — Roger Pack <rogerpack2005@...> 2008/07/29

> Now you know you can.

[#295325] Re: ruby wish-list — Roger Pack <rogerpack2005@...> 2008/03/21

Roger Pack wrote:

[#295469] Re: ruby wish-list — Nobuyoshi Nakada <nobu@...> 2008/03/24

Hi,

[#296028] Re: ruby wish-list — Roger Pack <rogerpack2005@...> 2008/03/27

Next wish :)

[#296030] Re: ruby wish-list — "Thomas Wieczorek" <wieczo.yo@...> 2008/03/27

On Fri, Mar 28, 2008 at 12:21 AM, Roger Pack <rogerpack2005@gmail.com> wrote:

[#296031] Re: ruby wish-list — Roger Pack <rogerpack2005@...> 2008/03/27

> You want to create a two-dimensional array, right?

[#296035] Re: ruby wish-list — Tim Hunter <TimHunter@...> 2008/03/27

Roger Pack wrote:

[#296067] Re: ruby wish-list — Damjan Rems <d_rems@...> 2008/03/28

[#296083] Re: ruby wish-list — "Thomas Wieczorek" <wieczo.yo@...> 2008/03/28

On Fri, Mar 28, 2008 at 8:34 AM, Damjan Rems <d_rems@yahoo.com> wrote:

[#296810] Re: ruby wish-list — Roger Pack <rogerpack2005@...> 2008/04/02

> Ruby 1.9 supports named parameters, but I don't know anything about

[#296813] Re: ruby wish-list — Gary Wright <gwtmp01@...> 2008/04/02

[#296815] Re: ruby wish-list — Roger Pack <rogerpack2005@...> 2008/04/02

Gary Wright wrote:

[#296854] Re: ruby wish-list — Chad Perrin <perrin@...> 2008/04/02

On Thu, Apr 03, 2008 at 02:06:21AM +0900, Roger Pack wrote:

[#306230] Re: ruby wish-list — Roger Pack <rogerpack2005@...> 2008/06/25

[#298009] Re: ruby wish-list — Chris Shea <cmshea@...> 2008/04/12

On Apr 12, 10:49 am, Roger Pack <rogerpack2...@gmail.com> wrote:

[#298058] Re: ruby wish-list — Robert Klemme <shortcutter@...> 2008/04/13

On 12.04.2008 20:40, Chris Shea wrote:

[#298237] Re: ruby wish-list — Roger Pack <rogerpack2005@...> 2008/04/15

[#299044] Re: ruby wish-list — Roger Pack <roger@...> 2008/04/21

I wish this worked :)

[#299045] Re: ruby wish-list — "Robert Klemme" <shortcutter@...> 2008/04/21

2008/4/21, Roger Pack <roger@doachristianturndaily.info>:

[#299933] Re: ruby wish-list — Roger Pack <rogerpack2005@...> 2008/04/29

Robert Klemme wrote:

[#301521] Re: ruby wish-list — Roger Pack <rogerpack2005@...> 2008/05/12

All right ruby-genie. My next wish!

[#302766] Re: ruby wish-list — Roger Pack <rogerpack2005@...> 2008/05/23

Back to the wishing well...

[#274338] A Ruby/Rails bibliography — "Jeremy McAnally" <jeremymcanally@...>

Howdy all,

13 messages 2007/10/15

[#274374] equal? versus eql? versus == versus === verus <=> — Paul Butcher <paul@...>

I recently found myself explaining to a friend how Ruby's various

13 messages 2007/10/16

[#274400] How to remove "~" in those files — Vidya Vidya <vidhu1232001@...>

14 messages 2007/10/16

[#274426] Struct is slow — Wayne Magor <wemagor2@...>

I have a script in which I was using a 2-element array where a struct

20 messages 2007/10/16
[#274430] Re: Struct is slow — Alex Fenton <aff28@...> 2007/10/16

Wayne Magor wrote:

[#274460] Compound conditionals in case when statements? Syntax? — Randy Kramer <rhkramer@...>

I need (or want ;-) to do something like the following:

12 messages 2007/10/16

[#274461] recommendations for working with PostgreSQL — Chad Perrin <perrin@...>

I have need to work with PostgreSQL via Ruby. What gems/modules do you

13 messages 2007/10/16

[#274470] Mind giving a little help? — Tj Superfly <nonstickglue@...>

Hello everyone! I posted a topic a few days go and got an answer, and I

13 messages 2007/10/16
[#274475] Re: Mind giving a little help? — Ben Giddings <bg-rubytalk@...> 2007/10/17

On Oct 16, 2007, at 19:56, Tj Superfly wrote:

[#274561] rocaml 0.6.0: fast, easy Ruby extensions in Objective Caml — Mauricio Fernandez <mfp@...>

16 messages 2007/10/17
[#274604] Re: rocaml 0.6.0: fast, easy Ruby extensions in Objective Caml — Daniel Berger <djberg96@...> 2007/10/17

[#274611] Re: rocaml 0.6.0: fast, easy Ruby extensions in Objective Caml — Daniel Berger <djberg96@...> 2007/10/17

[#274619] Re: rocaml 0.6.0: fast, easy Ruby extensions in Objective Caml — Mauricio Fernandez <mfp@...> 2007/10/17

On Thu, Oct 18, 2007 at 04:48:13AM +0900, Daniel Berger wrote:

[#274571] extracting values from consecutive lines — baptiste Augui<ba208@...>

16 messages 2007/10/17

[#274615] Class instance variable idiom — Perry Smith <pedz@...>

I am using this technique for class instance variables:

27 messages 2007/10/17
[#274650] Re: Class instance variable idiom — Brian Adkins <lojicdotcom@...> 2007/10/18

On Oct 17, 4:10 pm, Perry Smith <p...@easesoftware.com> wrote:

[#274661] Re: Class instance variable idiom — "Robert Klemme" <shortcutter@...> 2007/10/18

2007/10/18, Brian Adkins <lojicdotcom@gmail.com>:

[#274708] Re: Class instance variable idiom — Brian Adkins <lojicdotcom@...> 2007/10/18

On Oct 18, 2:44 am, "Robert Klemme" <shortcut...@googlemail.com>

[#274717] Re: Class instance variable idiom — "David A. Black" <dblack@...> 2007/10/18

Hi --

[#274770] Re: Class instance variable idiom — "ara.t.howard" <ara.t.howard@...> 2007/10/19

[#274646] combinations listing — Michael Linfield <globyy3000@...>

Making an form of an anagram solver. My approach would be the code

20 messages 2007/10/18
[#274706] Re: combinations listing — mortee <mortee.lists@...> 2007/10/18

Others have already shown you how you can generate all permutations of a

[#274769] Re: combinations listing — Peña, Botp <botp@...> 2007/10/19

RnJvbTogbW9ydGVlIFttYWlsdG86bW9ydGVlLmxpc3RzQGthdmVtYWxuYS5odV0gDQojIEhvd2V2

[#274774] Re: combinations listing — Michael Linfield <globyy3000@...> 2007/10/19

Thanks all ----

[#274840] Re: combinations listing — Brian Adkins <lojicdotcom@...> 2007/10/19

On Oct 19, 2:01 am, Michael Linfield <globyy3...@hotmail.com> wrote:

[#274773] the level of Ruby programmers vs PHP's — SpringFlowers AutumnMoon <summercoolness@...>

i asked the same question on Ruby: how do you write some code to print

18 messages 2007/10/19
[#274779] Re: the level of Ruby programmers vs PHP's — Shuaib Zahda <shuaib.zahda@...> 2007/10/19

do you mean something like this

[#274820] Is it always the norm to skip 'return'? — Tito Ciuro <tciuro@...>

Hello,

24 messages 2007/10/19
[#274822] Re: Is it always the norm to skip 'return'? — "Glen Holcomb" <damnbigman@...> 2007/10/19

On 10/19/07, Tito Ciuro <tciuro@mac.com> wrote:

[#274936] Why's (Poignant) Guide to Ruby (is this guy ok?) — "Jayson Williams" <williams.jayson@...>

Recently, I was looking for a Ruby guide that could help my son catch

11 messages 2007/10/20

[#274958] RubyGems Beta 0.9.4.6 — Eric Hodel <drbrain@...7.net>

RubyGems 0.9.4.6 is a beta release for the upcoming 0.9.5 which adds

20 messages 2007/10/20
[#274979] Re: [ANN] RubyGems Beta 0.9.4.6 — Sasa Ebach <se@...> 2007/10/20

Hi Eric,

[#274986] Re: [ANN] RubyGems Beta 0.9.4.6 — Eric Hodel <drbrain@...7.net> 2007/10/20

On Oct 20, 2007, at 09:43 , Sasa Ebach wrote:

[#275007] Re: [ANN] RubyGems Beta 0.9.4.6 — Sasa Ebach <se@...> 2007/10/20

> On Oct 20, 2007, at 09:43 , Sasa Ebach wrote:

[#275025] Is Ruby For Me? — Tony De <tony@...>

Hi all,

25 messages 2007/10/21

[#275037] Problem using FileUtils to sort JPEG files — forgottenwizard <phrexianreaper@...>

This is an odd problem, I admit. I'm currently working on a short script

14 messages 2007/10/21

[#275156] IronRuby...will it be like J++? — Thufir <hawat.thufir@...>

Could it be that Microsoft won't fully implement the language

22 messages 2007/10/22

[#275177] REXML (1.8.6-p110) backwards compatibility problem with rcov — Brian Candler <B.Candler@...>

When I upgraded my Ubuntu 6.06.1 system from its stock ruby-1.8.4 to

10 messages 2007/10/22

[#275190] Conflicts between using respond_to? and extending Ruby — Trans <transfire@...>

Hi--

27 messages 2007/10/22
[#275193] Re: Conflicts between using respond_to? and extending Ruby — "David A. Black" <dblack@...> 2007/10/22

Hi --

[#275250] Re: Conflicts between using respond_to? and extending Ruby — "ara.t.howard" <ara.t.howard@...> 2007/10/22

[#275280] Re: Conflicts between using respond_to? and extending Ruby — "Sean O'Halpin" <sean.ohalpin@...> 2007/10/22

On 10/22/07, ara.t.howard <ara.t.howard@gmail.com> wrote:

[#275282] Re: Conflicts between using respond_to? and extending Ruby — "Sean O'Halpin" <sean.ohalpin@...> 2007/10/22

On 10/22/07, Sean O'Halpin <sean.ohalpin@gmail.com> wrote:

[#275230] Re: IronRuby...will it be like J++? — James Britt <dangerwillrobinsondanger@...>

Check the archives of Ruby-Talk.

41 messages 2007/10/22
[#275359] Re: IronRuby...will it be like J++? — "Todd Benson" <caduceass@...> 2007/10/23

On 10/23/07, Robert Dober <robert.dober@gmail.com> wrote:

[#275312] Ruby Certification Test — John Joyce <dangerwillrobinsondanger@...>

In the Japanese page of Ruby Association, at http://www.ruby-assn.org/

24 messages 2007/10/23

[#275324] pop/push, shift/unshift — "Simon Schuster" <significants@...>

the inconsistency in naming bothers me. :P I would imagine that it

51 messages 2007/10/23
[#275338] Re: pop/push, shift/unshift — Robert Klemme <shortcutter@...> 2007/10/23

On 23.10.2007 05:53, Simon Schuster wrote:

[#275354] Re: pop/push, shift/unshift — "Simon Schuster" <significants@...> 2007/10/23

*yawn* oh, what? people have been using these terms for a long time?

[#275360] Re: pop/push, shift/unshift — "richard.j.dale@..." <richard.j.dale@...> 2007/10/23

On Oct 23, 10:50 am, "Simon Schuster" <significa...@gmail.com> wrote:

[#275396] Re: pop/push, shift/unshift — "Jes俍 Gabriel y Gal疣" <jgabrielygalan@...> 2007/10/23

On 10/23/07, richard.j.dale@gmail.com <richard.j.dale@gmail.com> wrote:

[#275400] Re: pop/push, shift/unshift — "David A. Black" <dblack@...> 2007/10/23

Hi --

[#275326] recursive array — "Simon Schuster" <significants@...>

207:0> a = [1,2,3,4]

12 messages 2007/10/23

[#275378] to_yaml and international characters — h3raLd <h3rald@...>

Hello,

15 messages 2007/10/23
[#275383] Re: to_yaml and international characters — "Luis Parravicini" <lparravi@...> 2007/10/23

On 10/23/07, h3raLd <h3rald@gmail.com> wrote:

[#275644] Ruby is simple? NooooT! — Casimir P <pikselNOSPAMMi@...>

Hehe whoever said that ruby is not verbose was WRONG!! ;)

16 messages 2007/10/24

[#275697] .each do |foo, bar| what does bar do? — Thufir <hawat.thufir@...>

"code_words.each do |real, code|

27 messages 2007/10/24
[#276096] Re: .each do |foo, bar| what does bar do? — Thufir <hawat.thufir@...> 2007/10/27

On Thu, 25 Oct 2007 06:14:12 +0900, Ben Giddings wrote:

[#276097] Re: .each do |foo, bar| what does bar do? — "David A. Black" <dblack@...> 2007/10/27

Hi --

[#276149] Re: .each do |foo, bar| what does bar do? — Brian Adkins <lojicdotcom@...> 2007/10/27

On Oct 27, 7:05 am, "David A. Black" <dbl...@rubypal.com> wrote:

[#276162] Re: .each do |foo, bar| what does bar do? — 7stud -- <bbxx789_05ss@...> 2007/10/27

Brian Adkins wrote:

[#275742] Intervals in Ruby — Steven D'Aprano <steve@...>

Howdy,

24 messages 2007/10/25

[#275839] Change a string to an integer, report an error if the string does not represent an integer? — Randy Kramer <rhkramer@...>

Can anybody point me to a way to check if a string represents a valid integer

14 messages 2007/10/25

[#275853] Need help understanding metaclassing — Chris Czub <chris.czub@...>

I've been reading lots of Ruby tutorials trying to figure out

17 messages 2007/10/25

[#275866] Ruby Changes in Leopard — "Laurent Sansonetti" <laurent.sansonetti@...>

Hi,

41 messages 2007/10/25
[#276143] Re: [ANN] Ruby Changes in Leopard — Bil Kleb <Bil.Kleb@...> 2007/10/27

John Joyce wrote:

[#276150] Re: Ruby Changes in Leopard — Brian Adkins <lojicdotcom@...> 2007/10/27

On Oct 27, 2:21 pm, Bil Kleb <Bil.K...@NASA.gov> wrote:

[#276154] Re: Ruby Changes in Leopard — James Edward Gray II <james@...> 2007/10/27

On Oct 27, 2007, at 2:15 PM, Brian Adkins wrote:

[#276161] Re: Ruby Changes in Leopard — "David A. Black" <dblack@...> 2007/10/27

Hi --

[#276172] Re: Ruby Changes in Leopard — "Pat Maddox" <pergesu@...> 2007/10/27

Are there any compelling reasons to use the built-in install? I was

[#275888] What's in YOUR Ruby??? Could Ruby ever be a g.p. dev language? — CodeToad <TheOldCodeToad@...>

Hi Folks,

11 messages 2007/10/25

[#275891] cant seem to get system() & pipe to work together — "dtown22@..." <dtown22@...>

I am trying to run a command line utility which converts a wma file to

11 messages 2007/10/25

[#275911] Skip the first invocation e.g. skip_first { foo } — Brian Adkins <lojicdotcom@...>

Consider the following code:

31 messages 2007/10/25

[#275968] Editing Text (#145) — Ruby Quiz <james@...>

The three rules of Ruby Quiz:

34 messages 2007/10/26

[#276035] Newlines included in bracket negation — "Chris Morris" <the.chrismo@...>

(... that subject probably makes no sense ...)

12 messages 2007/10/26

[#276085] open-uri + OpenSSL — Matthew Lagace <matthewlagace@...>

Hello,

13 messages 2007/10/27

[#276137] Checkers library — "Helder Ribeiro" <helder@...>

Does anyone know if there's a sort of library for the game Checkers in

14 messages 2007/10/27

[#276179] A memcached-like server in Ruby - feasible? — Tom Machinski <tom.machinski@...>

Hi group,

27 messages 2007/10/27
[#276216] Re: A memcached-like server in Ruby - feasible? — "ara.t.howard" <ara.t.howard@...> 2007/10/28

[#276185] convert string format — Junkone <junkone1@...>

Hello

18 messages 2007/10/27

[#276228] Talking more about JRuby — Charles Oliver Nutter <charles.nutter@...>

For the most part, we've been pretty good about keeping JRuby

30 messages 2007/10/28

[#276231] JRuby disabling ObjectSpace: what implications? — Charles Oliver Nutter <charles.nutter@...>

As some of you may have heard, we're considering disabling

26 messages 2007/10/28
[#276235] Re: JRuby disabling ObjectSpace: what implications? — Charles Oliver Nutter <charles.nutter@...> 2007/10/28

ara.t.howard wrote:

[#276262] Re: JRuby disabling ObjectSpace: what implications? — Robert Klemme <shortcutter@...> 2007/10/28

On 28.10.2007 08:06, Charles Oliver Nutter wrote:

[#276288] Re: JRuby disabling ObjectSpace: what implications? — Charles Oliver Nutter <charles.nutter@...> 2007/10/28

Robert Klemme wrote:

[#276259] Duplicate elements in array — Shuaib Zahda <shuaib.zahda@...>

Hello

15 messages 2007/10/28
[#276263] Re: Duplicate elements in array — "Sean O'Halpin" <sean.ohalpin@...> 2007/10/28

On 10/28/07, Shuaib Zahda <shuaib.zahda@gmail.com> wrote:

[#276334] Enhancing the Gateway (Help Needed) — James Edward Gray II <james@...>

Here's the short-story on the current situation with our mailing list =20=

23 messages 2007/10/28

[#276422] HTML parser Hpricot? and how to get all text — SpringFlowers AutumnMoon <summercoolness@...>

Would a good HTML parser be Hpricot? I wonder if anyone knows an easy

13 messages 2007/10/29

[#276500] Problem with socket.recv() — "Frank Preiswerk" <frank.preiswerk@...>

Hi everyone,

13 messages 2007/10/29

[#276502] find the closest items in an array to a given value. — trebor777 <mrobert@...777.net>

16 messages 2007/10/29

[#276539] Zip an existing directory? — Peter Marks <petertmarks@...>

Hello,

18 messages 2007/10/29
[#276544] Re: Zip an existing directory? — "Phlip" <phlip2005@...> 2007/10/30

> I am trying to zip an existing directory using the following code:

[#276546] Re: Zip an existing directory? — "M. Edward (Ed) Borasky" <znmeb@...> 2007/10/30

Phlip wrote:

[#276550] Re: Zip an existing directory? — Peter Marks <petertmarks@...> 2007/10/30

Thanks for the help guys. I am developing in osx and will deploy in

[#276587] Re: Zip an existing directory? — "M. Edward (Ed) Borasky" <znmeb@...> 2007/10/30

Peter Marks wrote:

[#276547] Gateway Upgraded — James Edward Gray II <james@...>

We are now running on my new gateway code that will hopefully get

27 messages 2007/10/30

[#276618] the result of Ruby official logo contest — Yukihiro Matsumoto <matz@...>

Hello All,

81 messages 2007/10/30
[#276621] Re: [ANN] the result of Ruby official logo contest — Yukihiro Matsumoto <matz@...> 2007/10/30

Hi,

[#276643] Re: [ANN] the result of Ruby official logo contest — Peter Szinek <peter@...> 2007/10/30

Robert Dober wrote:

[#276711] Re: [ANN] the result of Ruby official logo contest — James Britt <james.britt@...> 2007/10/30

Peter Szinek wrote:

[#276746] Re: [ANN] the result of Ruby official logo contest — "Martin DeMello" <martindemello@...> 2007/10/30

On 10/30/07, James Britt <james.britt@gmail.com> wrote:

[#276799] Re: [ANN] the result of Ruby official logo contest — "Jeremy McAnally" <jeremymcanally@...> 2007/10/30

You can see my comments on the http://www.rubyinside.com/ page, and I

[#276808] Re: [ANN] the result of Ruby official logo contest — Yukihiro Matsumoto <matz@...> 2007/10/30

Hi,

[#277215] Re: the result of Ruby official logo contest — Willem Källman <lefteus@...> 2007/11/02

Yukihiro Matsumoto wrote:

[#277288] Re: the result of Ruby official logo contest — Chad Perrin <perrin@...> 2007/11/02

On Fri, Nov 02, 2007 at 06:07:21PM +0900, Willem K??llman wrote:

[#276682] InstantRails windows Installation, problem with Gem — Ronald Dsouza <rondsouza2000@...>

Hi Good Morning,

15 messages 2007/10/30

[#276686] Array and ASCII Help needed... — "Hiato Xaero" <hiato3@...>

Hello there,

13 messages 2007/10/30

[#276710] RUBY DRY to replace 6 lines in 1 — Josselin <josselin@...>

I have a group of lines (used in Googlemaps display) based on 2 arrays :

17 messages 2007/10/30

[#276767] Bounty: $250 - Successfully log in to AOL Webmail with Mechanize — "dave.myron@..." <dave.myron@...>

We're about to release a gem called Blackbook that will automate

12 messages 2007/10/30

[#276801] Why, oh, why, little regexp? — Daniel Waite <rabbitblue@...>

'cost * tax'.match(/([a-z]+)*/).to_a

15 messages 2007/10/30

[#276831] Rubyconf Attendees — "Rick DeNatale" <rick.denatale@...>

Just wondering how many other regulars of ruby-talk will be in

26 messages 2007/10/31

[#276918] Dinner / drink recommendations for Charlotte? — Francis Hwang <francisphwang@...>

With RubyConf 2007 almost upon us, do any Charlotte natives care to

12 messages 2007/10/31

[#276978] Sorting a string... — Daniel Waite <rabbitblue@...>

I was porting a small Python script over to Ruby and realized Ruby does

15 messages 2007/10/31

[SUMMARY] Itinerary for a Traveling Salesman (#142)

From: Ruby Quiz <james@...>
Date: 2007-10-11 12:12:07 UTC
List: ruby-talk #273635
This time, we tried to put the focus on how you solved the quiz, instead of the
solution itself.  A great aspect of genetic algorithms is that you really don't
need to know much about the problem domain in order to find a workable solution
for it.  That comes with tradeoffs though, naturally.  It takes longer to find a
solution this way and there are no guarantees it will be great when you do
settle on something.  Still, I think it's very valuable to examine just how
these solutions work.

I'm going to show Joseph Seaton's code here.  It's smaller than many of the
solutions submitted, but still quite approachable.  It finds good answers pretty
quickly on my box.

Here's how the code begins:

	#!/usr/bin/env ruby
	require 'rubygems'
	require 'rvg/rvg'
	require 'grid'
	include Magick
	
	class GeneticGridGuess
	 def initialize grid
	   @grid, @min = grid.pts, grid.min*1.05
	   puts "Minumum time (within 5%): #{@min}"
	   @len, @seg = @grid.length, (@grid.length*0.3).ceil
	   @psize = Math.sqrt(@len).ceil*60
	   @mby = (@psize/20).ceil
	   @pop = []
	   @psize.times do
	     i = @grid.sort_by { rand }
	     @pop << [dist(i),i]
	   end
	   popsort
	 end
	 
	 # ...

When I first read the requires for this script, I didn't know what rvg was.  I
went searching for the library I needed to install and couldn't easily find one.
For those that don't know, rvg is a feature of RMagick that provides you with
vector-based drawing tools.  If you have an up-to-date RMagick install, you have
rvg as well.

The constructor in this code should be pretty easy to digest.  It pulls the
point list and minimum path for a passed Grid, careful to increase the minimum
to our looser goal.  It also pulls the Grid.length() and uses that to build a
size for mutated segments.  The @psize holds the population size our selections
will be made from and @mby (for "multiply by," I assume) is a multiplier used in
the reproduction process.  The rest of the code here just builds the initial
population from random sorts of the points.

Next, let's have a peek at the two helper methods used above:

	 # ...
	 
	 def dist i
	   #Uninteresting but fast as I can make it:
	   t = 0
	   g = i+[i[0]]
	   @len.times do |e|
	      t += Math.sqrt((g[e][0]-g[e+1][0])**2+(g[e][1]-g[e+1][1])**2)
	   end
	   t
	 end
	 def popsort
	   @pop = @pop.sort_by { |e| e[0] }
	 end
	 
	 # ...

The dist() method provides a standard Euclidean Distance measure and popsort()
just sorts the current population by this measure.  The thing to note here is
that the population is always stored as a dist(), followed by the path.  This
prevents needing to recalculate the dist() multiple times.

The final two methods of this class do the real work in the solution:

	 # ...
	 
	 def solve
	   while iter[0] > @min
	     puts @pop[0][0]
	   end
	   @pop[0]
	 end
	 def iter
	   @pop = (@pop[0..20]*@mby).collect do |e|
	     n = e[1].dup
	     case rand(10)
	     when 0..6 #Guesses concerning these values
	       seg = rand(@seg)
	       r = rand(@grid.length-seg+1)
	       n[r,seg] = n[r,seg].reverse
	     when 7
	       n = n.slice!(rand(@grid.length)..-1) + n
	     when 8..9
	       r = []
	       3.times { r << rand(@grid.length)}
	       r.sort!
	       n = n[0...r[0]] + n[r[1]...r[2]] + n[r[0]...r[1]] + n[r[2]..-1]
	     end
	     [dist(n),n]
	   end
	   popsort
	   @pop[0]
	 end
	end
	
	# ...

The solve() method drives the process, continuing the search until a solution
drops below our minimum accepted fitness measure.  Many solutions also used time
as a cut-off factor and I would recommend that approach.  Genetic algorithms
don't guarantee a solution and even when they do find one it could take quite
some time.

The iter() method moves the population forward one generation.  The process is
simple:  select the best 20 members of the current population, multiply that set
by some factor, mutate each member of the expanded set in some way, and save the
result as our new population.  The population is then resorted and the best
returned.

I believe there's a small error in that code.  Since the whole population is
mutated, it is possible that a better solution could be discarded and replaced
by inferior solutions.  The code should probably also save the best solution
seen thus far, just in case.

The mutations are largely from the quiz description.  70% of the time a reverse
mutation is performed and 20% of the time an exchange mutation.  10% of the
time, a variation of the exchange is used where just two random segments are
traded.

These are all asexual mutations, but some did try crossovers.  An ordered
crossover works pretty well in this case.  With that approach you select two
parents, pick a crossover point in the path, and build two offspring from
transforms around that point.  The first child has the points of the first
parent up to the crossover point, but the later points are reordered to match
the second parent.  This is reversed in the second child.

With the framework in place, we're ready to see the application code:

	# ...
	
	gridsize = ARGV[0] ? ARGV[0].to_i : (print "Grid size: "; STDIN.gets.to_i)
	grid = GeneticGridGuess.new(Grid.new(gridsize)).solve
	
	puts "In time #{grid[0]}:"
	grid[1].each do |e|
	 print "#{e[0].to_i},#{e[1].to_i} "
	end
	puts
	
	# ...

The first line of this code pulls the grid size from a command-line argument or
STDIN.  The second line builds the Grid, creates the solver, and puts it to
work.  The rest of the code just prints the points of the best solution.

Though that's enough to give us some boring numerical output, Joseph also had
code to draw pretty pictures:

	# ...
	
	if !ARGV[1]
	 image = RVG.new(gridsize*100,gridsize*100) do |canvas|
	   canvas.background_fill = 'white'
	   cgrid = grid[1].collect do |e|
	     [e[0]*100+10,e[1]*100+10]
	   end
	   cgrid.each do |point|
	     canvas.circle(5,point[0],point[1]).styles(:fill=>'black')
	   end
	   canvas.polygon(*cgrid.flatten).
	          styles(:stroke=>'black', :stroke_width=>2, :fill=>'none')
	 end.draw
	 image.display rescue image.write("#{gridsize}x#{gridsize}tour.jpg")
	end

I made a small change in this code so it would draw the picture to disk when the
X Window library needed for display is not available.

This code is run if a second command-line argument is not given to disable it. 
It works by creating a canvas, plotting each point in the path on that canvas,
and finally adding a polygon to represent the path found by the solver.  As you
can see, RMagick's RVG class simplifies the shape drawing quite a bit.

My thanks to all the geneticists brave enough to share your Frankenstein
creations with the rest of us.

Tomorrow we will try generating search results instead of travel plans...

In This Thread

Prev Next