[#262740] Any experience with Bluehost? — joviyach <joviyach@...>

I am looking for hosting for RoR, but I'd also like to be able to do

15 messages 2007/08/01
[#262768] Re: Any experience with Bluehost? — Brett Simmers <bsimmers@...> 2007/08/01

joviyach wrote:

[#262749] Railless ActiveRecord — Ari Brown <ari@...>

Hey all. More ActiveRecord trouble.

16 messages 2007/08/01

[#262782] Dynamic method call — "Andrea Maschio" <andrea.maschio@...>

I'm trying, for the purpose of making something similar to a grammar, to do

32 messages 2007/08/01
[#262785] Re: Dynamic method call — Sharon Phillips <phillipsds@...> 2007/08/01

> I'm trying, for the purpose of making something similar to a

[#262791] Re: Dynamic method call — "Andrea Maschio" <andrea.maschio@...> 2007/08/01

Thank you very much guys, it worked. I was doing this for the purpose of

[#262827] Re: Dynamic method call — "Gregory Brown" <gregory.t.brown@...> 2007/08/01

On 8/1/07, Andrea Maschio <andrea.maschio@gmail.com> wrote:

[#262882] Re: Dynamic method call — "Andrea Maschio" <andrea.maschio@...> 2007/08/01

the problem is that method_name is a static call, i need to make it dynamic

[#262883] Re: Dynamic method call — "Gregory Brown" <gregory.t.brown@...> 2007/08/01

On 8/1/07, Andrea Maschio <andrea.maschio@gmail.com> wrote:

[#262904] Private methods not so private? — Frank Meyer <lolz.llolz@...>

Hello,

15 messages 2007/08/01

[#263011] Beginner's tutorial and poor attempt at classes — Gabriel Dragffy <gabe@...>

Hi all

16 messages 2007/08/02
[#263012] Re: Beginner's tutorial and poor attempt at classes — dblack@... 2007/08/02

Hi --

[#263034] #send in 1.9 — Trans <transfire@...>

Looking over 1.9's change of #send, ie.

61 messages 2007/08/02
[#263036] Re: #send in 1.9 — "Tim Pease" <tim.pease@...> 2007/08/02

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

[#263093] Re: #send in 1.9 — Ari Brown <ari@...> 2007/08/02

[#263672] Re: #send in 1.9 — Trans <transfire@...> 2007/08/07

[#263674] Re: #send in 1.9 — "Gregory Brown" <gregory.t.brown@...> 2007/08/07

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

[#263684] Re: #send in 1.9 — Trans <transfire@...> 2007/08/07

[#263687] Re: #send in 1.9 — "Gregory Brown" <gregory.t.brown@...> 2007/08/07

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

[#263736] Re: #send in 1.9 — Trans <transfire@...> 2007/08/07

[#263747] Re: #send in 1.9 — "Gregory Brown" <gregory.t.brown@...> 2007/08/08

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

[#263781] Re: #send in 1.9 — dblack@... 2007/08/08

Hi --

[#263825] Re: #send in 1.9 — Trans <transfire@...> 2007/08/08

[#263837] Re: #send in 1.9 — James Edward Gray II <james@...> 2007/08/08

On Aug 8, 2007, at 9:52 AM, Trans wrote:

[#263841] Re: #send in 1.9 — "Robert Dober" <robert.dober@...> 2007/08/08

On 8/8/07, James Edward Gray II <james@grayproductions.net> wrote:

[#263845] Re: #send in 1.9 — James Edward Gray II <james@...> 2007/08/08

On Aug 8, 2007, at 10:30 AM, Robert Dober wrote:

[#263115] Determining the common prefix for several strings — Todd Burch <promos@...>

I have several strings to analyze. The strings are the names of a list

38 messages 2007/08/03
[#263137] Re: Determining the common prefix for several strings — Xavier Noria <fxn@...> 2007/08/03

El Aug 3, 2007, a las 2:31 AM, Todd Burch escribi鷓

[#263140] Re: Determining the common prefix for several strings — Xavier Noria <fxn@...> 2007/08/03

El Aug 3, 2007, a las 4:26 AM, Xavier Noria escribi鷓

[#263141] Re: Determining the common prefix for several strings — Xavier Noria <fxn@...> 2007/08/03

El Aug 3, 2007, a las 4:41 AM, Xavier Noria escribi鷓

[#263195] Numbers Can Be Words (#133) — Ruby Quiz <james@...>

The three rules of Ruby Quiz:

14 messages 2007/08/03

[#263200] Getting the 'Sender' or 'Caller' object of a method — Peter Laurens <peterlaurenspublic@...>

Hi,

12 messages 2007/08/03

[#263250] ruby on the zaurus — "Sy Ali" <sy1234@...>

I'm happy with the older ruby 1.8.4 which I have for my Zaurus

17 messages 2007/08/03
[#263253] Re: ruby on the zaurus — gregarican <greg.kujawa@...> 2007/08/03

On Aug 3, 2:56 pm, "Sy Ali" <sy1...@gmail.com> wrote:

[#263257] Re: ruby on the zaurus — gregarican <greg.kujawa@...> 2007/08/03

On Aug 3, 3:13 pm, gregarican <greg.kuj...@gmail.com> wrote:

[#263303] Better way to do this? Currently using two method_missing calls... — Dan <dan.gottlieb@...>

Hi,

15 messages 2007/08/03
[#263306] Re: Better way to do this? Currently using two method_missing calls... — Xavier Noria <fxn@...> 2007/08/04

El Aug 4, 2007, a las 1:50 AM, Dan escribi鷓

[#263331] Re: Better way to do this? Currently using two method_missing calls... — Dan <dan.gottlieb@...> 2007/08/04

Thanks for the reply. I'm probably being dense here, but I don't see

[#263339] Re: Better way to do this? Currently using two method_missing calls... — Xavier Noria <fxn@...> 2007/08/04

El Aug 4, 2007, a las 1:29 PM, Dan escribi鷓

[#263344] Re: Better way to do this? Currently using two method_missing calls... — Dan <dan.gottlieb@...> 2007/08/04

Ok, I see where you were going now. I guess I could go in that

[#263304] python-style decorators — Keith Rarick <kr@...>

I've been using ruby for about 8 months now and I've come to appreciate

35 messages 2007/08/03
[#263505] Re: python-style decorators — Trans <transfire@...> 2007/08/06

[#263719] Re: python-style decorators — "Keith Rarick" <kr@...> 2007/08/07

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

[#266555] Re: python-style decorators — Trans <transfire@...> 2007/08/28

[#266763] Re: python-style decorators — Daniel DeLorme <dan-ml@...42.com> 2007/08/29

Trans wrote:

[#266765] Re: python-style decorators — "Keith Rarick" <kr@...> 2007/08/29

On 8/29/07, Daniel DeLorme <dan-ml@dan42.com> wrote:

[#266769] Re: python-style decorators — Trans <transfire@...> 2007/08/30

[#266844] Re: python-style decorators — "Keith Rarick" <kr@...> 2007/08/30

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

[#266845] Re: python-style decorators — Trans <transfire@...> 2007/08/30

[#266873] Re: python-style decorators — "Keith Rarick" <kr@...> 2007/08/30

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

[#263347] building rubygems without documentation — "Sy Ali" <sy1234@...>

I see no way to build rubygems without documentation. I checked the

13 messages 2007/08/04
[#263359] Re: building rubygems without documentation — Ben Bleything <ben@...> 2007/08/04

On Sat, Aug 04, 2007, Sy Ali wrote:

[#263480] yield or call? — "Ronald Fischer" <ronald.fischer@...>

def f(&b)

24 messages 2007/08/06
[#263481] Re: yield or call? — "Phlip" <phlip2005@...> 2007/08/06

Ronald Fischer wrote:

[#263586] Alternate Regular Expressions? — Ari Brown <ari@...>

Just randomly curious -

27 messages 2007/08/07
[#263588] Re: Alternate Regular Expressions? — "Phlip" <phlip2005@...> 2007/08/07

Ari Brown wrote:

[#263592] Re: Alternate Regular Expressions? — Ari Brown <ari@...> 2007/08/07

[#263596] Re: Alternate Regular Expressions? — Kenneth McDonald <kenneth.m.mcdonald@...> 2007/08/07

Ari,

[#263602] Re: Alternate Regular Expressions? — Ari Brown <ari@...> 2007/08/07

I'm moderately serious. This is going to be one of those projects

[#263613] I came from Perl, and would ask for some quick start point — Lee NL <ruby@...>

Dear all,

12 messages 2007/08/07

[#263627] Feature request (pretty_inspect variant, yielding single quotes instead of double) — "Ronald Fischer" <ronald.fischer@...>

require 'pp'

8 messages 2007/08/07

[#263688] Need Solaris Help — James Edward Gray II <james@...>

I'm told the following bit of code doesn't work on Solaris:

20 messages 2007/08/07

[#263728] non-constant strings — Dmitry Bilunov <kmeaw@...>

Hello. Why does Ruby have non-constant strings? It seems there is a way

15 messages 2007/08/07

[#263796] case statement — Shai Rosenfeld <shaiguitar@...>

hi guys,

22 messages 2007/08/08

[#263853] deadlock in ThreadPool using backtick — Justin Johnson <justinjohnson@...>

Hello,

19 messages 2007/08/08

[#263930] Collect objects from an array based on one unique parameter — Milo Thurston <knirirr@...>

If one has an array of objects, each containing various values, what

13 messages 2007/08/09
[#263932] Re: Collect objects from an array based on one unique parameter — Konrad Meyer <konrad@...> 2007/08/09

On Thursday 09 August 2007 02:24:46 am Milo Thurston wrote:

[#263989] define_method with default parameters — Emmanuel Oga <oga_emmanuel_oga@...>

how can i use define_method to assign default parameters?

13 messages 2007/08/09

[#264089] Cellular Automata (#134) — Ruby Quiz <james@...>

The three rules of Ruby Quiz:

32 messages 2007/08/10

[#264113] Any recommendations on ruby editor — "harry pillei" <Hari@...>

Hi,

31 messages 2007/08/10
[#264122] Re: Any recommendations on ruby editor — franco <flazzarino@...> 2007/08/10

On Aug 10, 12:37 pm, "harry pillei" <H...@pillai.co.uk> wrote:

[#264135] Sorting a logfile, how would you write it? — Frank Meyer <lolz.llolz@...>

I've written a little ruby program which can sort logfiles with the

15 messages 2007/08/10
[#264149] Re: Sorting a logfile, how would you write it? — William James <w_a_x_man@...> 2007/08/10

On Aug 10, 1:29 pm, Frank Meyer <lolz.ll...@gmail.com> wrote:

[#264172] Re: Sorting a logfile, how would you write it? — Ryan Davis <ryand-ruby@...> 2007/08/11

[#264160] Split a string based on change of character — Andrew Savige <ajsavige@...>

For a string "ZBBBCZZ", I want to produce a list ["Z", "BBB", "C", "ZZ"]

27 messages 2007/08/11

[#264193] global_variable_set (like instance_variable_set) — Thomas Hafner <thomas@...>

Hello,

15 messages 2007/08/11

[#264211] Interesting garbage collection article on LTU — Lionel Bouton <lionel-subscription@...>

Hi,

11 messages 2007/08/11

[#264234] launchy 0.1.2 Released — Jeremy Hinegardner <jeremy@...>

launchy version 0.1.2 has been released.

19 messages 2007/08/12
[#264243] Re: launchy 0.1.2 Released — Trans <transfire@...> 2007/08/12

[#264244] Re: launchy 0.1.2 Released — Sebastian Hungerecker <sepp2k@...> 2007/08/12

Trans wrote:

[#264270] Ubuntu as a Ruby dev environment? — joviyach <joviyach@...>

Developing using things like MySQL, PHP, and Ruby has been an absolute

27 messages 2007/08/12

[#264305] Can .rhtml files include text from .txt or .html file? — Sfdesigner Sfdesigner <daniel@...>

Hi,

11 messages 2007/08/12

[#264314] Non Existent Method Dir.empty? Description via "ri" — "Wolfgang Nádasi-donner" <ed.odanow@...>

Moin, moin!

24 messages 2007/08/12
[#264586] Re: Non Existent Method Dir.empty? Description via "ri" — Daniel Berger <djberg96@...> 2007/08/14

[#264598] Re: Non Existent Method Dir.empty? Description via "ri" — "Wolfgang Nádasi-donner" <ed.odanow@...> 2007/08/14

Daniel Berger wrote:

[#264350] TCPSocket Flushing — David -- <neko18@...>

I have two programs, a server and a client. I want to send two messages

13 messages 2007/08/13

[#264445] Why don't Ruby libraries share memory? — "Matt Harvey" <matt@...>

This paragraph is motivation. While my question is not Rails-specific, I am

12 messages 2007/08/13

[#264508] Why is rake really slow? — richpoirier@...

Is rake supposed to be really slow?

13 messages 2007/08/14

[#264532] Does an Array#apply make any sense at all? — "nikolai.weibull@..." <nikolai.weibull@...>

Hi!

29 messages 2007/08/14

[#264783] mp3 file magic number identification — John Joyce <dangerwillrobinsondanger@...>

Does anybody know how to identify (validate) mp3 files (other audio

15 messages 2007/08/15

[#264817] grep a csv? — Michael Linfield <globyy3000@...>

If i had a huge CSV file, and i wanted to pull out say all the lines

27 messages 2007/08/16
[#264821] Re: grep a csv? — "M. Edward (Ed) Borasky" <znmeb@...> 2007/08/16

Michael Linfield wrote:

[#264826] Re: grep a csv? — Michael Linfield <globyy3000@...> 2007/08/16

M. Edward (Ed) Borasky wrote:

[#264911] Double quote escape character — Alvaro Perez <alvaro.pmartinez@...>

Hi all,

13 messages 2007/08/16

[#264923] Does singleton variables have any meaning ? — "Arno J." <jub@...>

Hello,

17 messages 2007/08/16
[#264967] Re: Does singleton variables have any meaning ? — dblack@... 2007/08/16

Hi --

[#265015] Re: Does singleton variables have any meaning ? — "Arno J." <jub@...> 2007/08/16

>> class << self #or class << A

[#265115] wishing of reactive programming in ruby — ashishwave <ashishwave@...>

ruby integrates power of functional programming from lisp , purest OO

17 messages 2007/08/17

[#265130] method access to the enclosing method's locals? — Larry Kluger <rubyforum@...>

18 messages 2007/08/17

[#265154] 8086 simulator in ruby — Vasil Vangelovski <vvangelovski@...>

I'm thinking of writing a simulator for the intel 8086 processor in

22 messages 2007/08/17

[#265223] Problem with Array#delete — Matthew B Gardner <weather@...>

Hello, I'm baffled by the following problem:

16 messages 2007/08/18
[#265226] Re: Problem with Array#delete — Morton Goldberg <m_goldberg@...> 2007/08/18

On Aug 18, 2007, at 12:59 AM, Matthew B Gardner wrote:

[#265230] Re: Problem with Array#delete — Matthew B Gardner <weather@...> 2007/08/18

Sorry, I only meant the code I posted as an example of what is happening --

[#265244] How do you print the first 5 records in an array? — Bob Sanders <small.business.strategy@...>

Let's say I have an array defined as:

29 messages 2007/08/18

[#265273] Emulating a Groovy feature? — John Wells <lists@...>

Guys,

17 messages 2007/08/18

[#265303] Is this the perfect regex for validating first & last names? — Todd Burch <promos@...>

Perhaps a fairly bold statement, coming from a novice regex'er. :)

11 messages 2007/08/18

[#265381] Detecting duplicates in an array, anything in the standard library ? — Thibaut Barr鑽e <thibaut.barrere@...>

Hi!

35 messages 2007/08/19
[#265594] Re: Detecting duplicates in an array, anything in the standard library ? — Pe, Botp <botp@...> 2007/08/21

From: Thibaut Barr鑽e [mailto:thibaut.barrere@gmail.com]

[#265614] Re: Detecting duplicates in an array, anything in the standa — Jimmy Kofler <koflerjim@...> 2007/08/21

Duplicates can also be extracted from an array like this:

[#265488] Current rubygems require idiom — Bil Kleb <Bil.Kleb@...>

Hi,

15 messages 2007/08/20

[#265543] Regexp: named captures — Ari Brown <ari@...>

How do named captures in Ruby work? This is what I've tried:

21 messages 2007/08/20

[#265592] Dear Lazyweb: Gem Platforms — Eric Hodel <drbrain@...7.net>

As you may or may not have heard, RubyGems will be merged into Ruby

14 messages 2007/08/21

[#265596] Test if file is binary ? — "Rebhan, Gilbert" <Gilbert.Rebhan@...>

26 messages 2007/08/21

[#265635] How to "cast" in Ruby — Marcin Tyman <m.tyman@...>

Hi,

15 messages 2007/08/21
[#265636] Re: How to "cast" in Ruby — "David A. Black" <dblack@...> 2007/08/21

Hi --

[#265729] Get Date Modified value for a directory (folder) — Hayato Iriumi <hiriumi@...>

Hello, folks.

12 messages 2007/08/22

[#265843] time class changed in ruby-1.8.6? — "Ball, Donald A Jr (Library)" <donald.ball@...>

Hi guys. I'm in the process of migrating a ruby app from 1.8.5 to 1.8.6

11 messages 2007/08/22

[#265888] ruby shell? — "Simon Schuster" <significants@...>

what about a shell based on ruby? would such a thing be

26 messages 2007/08/23
[#265892] Re: ruby shell? — "Robert Klemme" <shortcutter@...> 2007/08/23

2007/8/23, Simon Schuster <significants@gmail.com>:

[#265930] Re: ruby shell? — "Daniel Aquino" <mr.danielaquino@...> 2007/08/23

It would be cool if we could some how write a patch that would alter

[#265971] Functional Programming — benjohn@...

I'm interested in functional programming.

26 messages 2007/08/23
[#266017] Re: Functional Programming — Brian Adkins <lojicdotcom@...> 2007/08/23

On Aug 23, 1:32 pm, benj...@fysh.org wrote:

[#266080] Re: Functional Programming — Sharon Phillips <phillipsds@...> 2007/08/24

> If you like Ruby, you may also enjoy Lisp since it influenced Ruby.

[#266039] something I just found out, am sharing (:newbish) — "Simon Schuster" <significants@...>

075:0> a = "hello"

13 messages 2007/08/24

[#266067] How to append some data at the beginning of a file — Uday Thokala <udaykanth_t@...>

Hi,

10 messages 2007/08/24

[#266085] ID3 Tags (#136) — Ruby Quiz <james@...>

The three rules of Ruby Quiz:

38 messages 2007/08/24

[#266087] Combining Array Elements — gregarican <greg.kujawa@...>

I have an array that I would like to combine elements. Here's a sample

14 messages 2007/08/24

[#266159] Thread safety techniques for server applications? — Aaron Smith <beingthexemplary@...>

Hey all,

24 messages 2007/08/25
[#266173] Re: Thread safety techniques for server applications? — "dtuttle1@..." <dtuttle1@...> 2007/08/25

Hi Aaron,

[#266190] Re: Thread safety techniques for server applications? — khaines@... 2007/08/25

On Sat, 25 Aug 2007, dtuttle1@gmail.com wrote:

[#266199] Re: Thread safety techniques for server applications? — "Terry Poulin" <bigboss64@...> 2007/08/25

> Remember that Ruby threads, being green threads, are all in the same

[#266202] Re: Thread safety techniques for server applications? — "ara.t.howard" <ara.t.howard@...> 2007/08/25

[#266162] How can I make this if/else more succinct? — eggie5 <eggie5@...>

How can I make this if/else more succinct?

13 messages 2007/08/25

[#266274] Ruby Vs. Java — Nick Nick <schaefer88@...>

Which programming language is faster - Ruby or Java?

49 messages 2007/08/26
[#266276] Re: Ruby Vs. Java — "simon jenkins" <simojenki@...> 2007/08/26

It depends what you mean by faster,

[#266280] Re: Ruby Vs. Java — Nick el <schaefer88@...> 2007/08/26

[#266293] Re: Ruby Vs. Java — Phrogz <phrogz@...> 2007/08/26

On Aug 26, 6:16 am, Nick el <schaefe...@gmail.com> wrote:

[#266304] Re: Ruby Vs. Java — "I. P." <stack.tcpip@...> 2007/08/26

|Phrogz|

[#266279] 2D MMORPG — Nick el <schaefer88@...>

I've been trying to find out what programming language would be best for

20 messages 2007/08/26

[#266285] sort_by { rand } not working — Mike Dershowitz <michael.dershowitz@...>

Hello:

22 messages 2007/08/26

[#266309] Why does: system("./ati-driver-installer-8.40.4-x86.x86_64.run --buildpkg Ubuntu/feisty") not work ? It always fails without any error? — kazaam <kazaam@...>

Well,

11 messages 2007/08/26

[#266403] Ruby Pocket Reference — John Joyce <dangerwillrobinsondanger@...>

I picked up the new OREILLY book Ruby Pocket Reference today, by

23 messages 2007/08/27
[#266414] Re: Ruby Pocket Reference — Thomas Worm <usenet@...4r.de> 2007/08/27

On Mon, 27 Aug 2007 14:39:53 +0900, John Joyce wrote:

[#266452] Re: Ruby Pocket Reference — Karl von Laudermann <doodpants@...> 2007/08/27

On Aug 27, 3:58 am, Thomas Worm <use...@s4r.de> wrote:

[#266456] Re: Ruby Pocket Reference — "Kyle Schmitt" <kyleaschmitt@...> 2007/08/27

But ruby already _has_ animals.

[#266464] Re: Ruby Pocket Reference — John Joyce <dangerwillrobinsondanger@...> 2007/08/27

No, I'm not that dense, I know OREILLY chooses random animals at

[#266471] Substitution within system quoted string — "Victor Reyes" <victor.reyes@...>

Team,

11 messages 2007/08/27

[#266497] IDE's With Indentation Guides Like SciTE? — "list. rb" <list.rb@...>

I've used SciTE for quite some time now and have become addicted to the

18 messages 2007/08/28

[#266616] idiomatic way to assign if not nil? — Jay Levitt <jay@...>

I know I can use "a ||= b" to assign b to a if a is nil.

21 messages 2007/08/28

[#266664] Difference between Distributed ruby and Rinda — Hema Latha <hema_aspire@...>

Can anyone tell me the difference between Distributed ruby and rinda?

9 messages 2007/08/29

[#266728] How to make an array of hashes to a single array with all the values of these hashes ? — kazaam <kazaam@...>

Take a look at this,

13 messages 2007/08/29
[#266731] Re: How to make an array of hashes to a single array with all the values of these hashes ? — Phrogz <phrogz@...> 2007/08/29

On Aug 29, 12:39 pm, kazaam <kaz...@oleco.net> wrote:

[#266768] Bug in % (Float)? — "Charlie Lehardy" <charlie.lehardy@...>

Modulo should be a fairly simple operation, however I'm finding some very

25 messages 2007/08/30
[#266781] Re: Bug in % (Float)? — Pe, Botp <botp@...> 2007/08/30

From: Charlie Lehardy [mailto:charlie.lehardy@gmail.com] :

[#266789] Re: Bug in % (Float)? — Morton Goldberg <m_goldberg@...> 2007/08/30

On Aug 29, 2007, at 10:14 PM, Pe, Botp wrote:

[#266794] Re: Bug in % (Float)? — Calamitas <calamitates@...> 2007/08/30

On 30/08/2007, Morton Goldberg <m_goldberg@ameritech.net> wrote:

[#266804] Re: Bug in % (Float)? — Morton Goldberg <m_goldberg@...> 2007/08/30

On Aug 30, 2007, at 3:39 AM, Calamitas wrote:

[#266865] Re: Bug in % (Float)? — Calamitas <calamitates@...> 2007/08/30

On 30/08/2007, Morton Goldberg <m_goldberg@ameritech.net> wrote:

[#266975] Re: Bug in % (Float)? — Morton Goldberg <m_goldberg@...> 2007/08/31

On Aug 30, 2007, at 5:56 PM, Calamitas wrote:

[#266806] Important Research Project — "E.D.G." <edgrsprj@...>

Important Research Project (Related to computer programming)

15 messages 2007/08/30

[#266841] Changing date backward messes up threaded sleep — Earle Clubb <eclubb@...>

Can anyone explain this behavior? If the system time is set backward,

13 messages 2007/08/30

[#266882] 0.06 == 0.06 returns false in Ruby? — "Jason G." <jasonpurchase@...>

Hi

45 messages 2007/08/31
[#266885] Re: 0.06 == 0.06 returns false in Ruby? — Peña, Botp <botp@...> 2007/08/31

From: Jason G. [mailto:jasonpurchase@yahoo.com]

[#266914] Re: 0.06 == 0.06 returns false in Ruby? — Michael Ulm <michael.ulm@...> 2007/08/31

Pe単a wrote:

[#266924] Re: 0.06 == 0.06 returns false in Ruby? — Daniel DeLorme <dan-ml@...42.com> 2007/08/31

Michael Ulm wrote:

[#266931] Re: 0.06 == 0.06 returns false in Ruby? — "Robert Klemme" <shortcutter@...> 2007/08/31

2007/8/31, Daniel DeLorme <dan-ml@dan42.com>:

[#266933] Re: 0.06 == 0.06 returns false in Ruby? — Pe, Botp <botp@...> 2007/08/31

From: Robert Klemme [mailto:shortcutter@googlemail.com]

[#266894] Ruby stupidities — Kenneth McDonald <kenneth.m.mcdonald@...>

The title is intentionally (but semiseriously) contentious, but I'm not

16 messages 2007/08/31

[#266945] Twisting a Rope (#137) — Ruby Quiz <james@...>

The three rules of Ruby Quiz:

32 messages 2007/08/31

[SUMMARY] Cellular Automata (#134)

From: Ruby Quiz <james@...>
Date: 2007-08-16 14:18:04 UTC
List: ruby-talk #264898
I chose this quiz because I felt it was easy and interesting.  It seems the jury
is still out on the easy aspect though.  I believe there were only two correct
solution this week.  Most of them had problems with at least some rules,
including my own code.  Let's have a look at what went wrong.

The issue is that any rule which sets the one's bit, creates a case where 000
activates the middle cell.  Since all cells not on are off and our area of cells
is theoretically infinite in width, that means those rules create long strands
of active cells on the very first step.

This is only a problem because many of us tried a shortcut like my own code of:

	options[:steps].times do
	  cells << "00#{cells.last}00".scan(/./).
	                               enum_cons(3).
	                               inject("") { |nc, n| nc + RULE_TABLE[n.join] }
	end

However, adding two zeros to either end is not enough to properly display these
patterns.

A better approach is to create a viewing window of the cell space large enough
to show the interesting parts of the pattern.  We will get the idea of the
infinite spans when we see the cells running off the edges of such a window.

It was Simon Kr旦ger who pointed out these issues in the discuss and I believe
his solution was the first correct submission, so let's take a peek at that
code.  Here's the setup:

	require 'optparse'
	
	rule, steps, cells = 145, 20, '1'
	
	OptionParser.new do |opts|
	  opts.on("-r RULE", Integer) {|rule|}
	  opts.on("-s STEPS", Integer) {|steps|}
	  opts.on("-c CELLS", String) {|cells|}
	end.parse!
	
	# ...

You can see Simon require the OptionParser library here and put it to work. 
Take a close look at just how the parameters are assigned though, because the
code is tricky.

First, some defaults are setup in normal variables.  Then the OptionParser code
gets run, passing the user's settings into blocks that don't seem to do anything
with the values.  Note though that those block variables have the same names as
the variables where the defaults were placed.  In Ruby 1.8.x this will actually
change the value of the outer variable.

This is probably a good habit to start breaking now, if you catch yourself using
it.  A future version of Ruby will change these variable assignment rules and
break code like the above.

Now that the variables are assigned, Simon creates the current row of cells:

	# ...
	
	size = steps + cells.size + steps
	line = cells.center(size, '0')
	
	# ...

This is just the starting cells padded with zeros.  The key though is the amount
of padding.  There are only two cases for how the cells grow.  We've talked
about the infinite growth for rules with the one's bit on already, but all other
rules can growth at most one cell in either direction each step.  That's the
padding Simon adds, step zeros to either side.

Now we are ready for the application code:

	# ...
	
	steps.times do
	  puts line.tr('01', ' X')
	  widened = line[0, 1] + line + line[-1, 1]
	  line = (0...size).map{|i| rule[widened[i, 3].to_i(2)]}.join
	end

This code loops over the requested number of steps.  At each step, it prints the
current row of cells.

Now the widening step is another clever trick.  Remember, we have two growth
rates, one cell at a time and infinite growth.  In the first case, we will have
zeros at both ends and beyond that there should be more zeros.  In the latter
case, all the cells on the edges will be ones to represent the infinite growth. 
Beyond those would be more ones.  By expanding the grid with what is already on
each end, both cases are covered.

The final line of the iterator does the actual change of cells.  It walks the
widened row, but takes the cells three at a time.  This will drop the two extra
cells at the end back off and give us the proper row length.

The actual application of the rule is done here with bit indexing.  By treating
the three cells as a bit pattern and converting them to an Integer, we get the
index for the rule that will fetch the proper zero or one for that pattern.

You may want to work through this code with a pencil and paper until it all
clicks.  I did.  There's a lot going on in that tiny bit of code.

My thanks to all of the others who submitted as well.  These other solutions
were interesting as well, despite my claims that they weren't completely
correct.  Most of them worked on all of the rules that didn't expand infinitely
and that includes the interesting rules.  Do browse through those.

Tomorrow we will fiddle with with an Erlang problem I found interesting...

In This Thread

Prev Next