[#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] Numbers Can Be Words (#133)

From: Ruby Quiz <james@...>
Date: 2007-08-09 13:32:31 UTC
List: ruby-talk #263958
We all know this problem isn't tough at all.  Myself and several others solved
it with a one-liner.  We all enjoy a good one-liner, right?

Actually, I built this solution before the quiz was posted and when I shared it
with Morton, he, very politely, mentioned the G-word.  The fact is that I wasn't
really trying to "golf" though.  I was using a strategy of problem solving I
call Thinking With The Command-Line.  Let me take you through my process to my
solution and beyond to show your what I mean.

First, it's important to remember that Ruby has a lot of command-line switches
that help with these quick tasks.  It's not a sin to use these tools.  They make
short work of jobs like this because the easy things should be easy.  You're not
golfing when you use these, you're just telling Ruby this is a quick job and you
trust her to handle the details on this one.

Let's start with the basics.  Obviously, we want to read over the dictionary and
print some words in it.  Let's begin with just that much:

	$ ruby -pe 1 /usr/share/dict/words

The -p switch asks Ruby to wrap your program in a read and print loop over the
files given as arguments (or STDIN).  That was really all I wanted, so I just
needed a program to be wrapped.  That's where -e comes in.  It let's you give
the code on the command-line and I provided the most trivial code I could think
of.  It does nothing of course.  It just gives Ruby something to wrap and let's
her do all of the work for me.

OK, so I'm now printing the dictionary, but I really want to print just some
words of the dictionary.  I need to introduce some conditional that only prints
when I say it's OK to do so.  For that, we move to -p's twin -n and actually
resort to writing a little code:

	$ ruby -ne 'print if true' /usr/share/dict/words

The -n switch gives us the same loop around our code, just minus the print()
statement.  This lets me choose when I want to print() something.

The read loops that Ruby creates for us always stick the current line in $_.  By
default, that exactly what print() spits out.

Great.  That's about half of this task.  Now I just need the if condition and
I'm done.  Before I figure that out though, let's examine one other command-line
switch.  I want to set a base for the code to use.  It's true that I could just
drop a number in the code and change it as needed, but it would be better if the
number was separate.  Ruby has a shortcut switch for that too:

	$ ruby -se 'p $base' -- -base=14

The -s switch adds some rudimentary variable processing to switches passes to
the program.  Note that I said switches passed to the program, not to Ruby.  I
used the -- switch above to end Ruby's switch processing and switch into the
program context.  You can then see that the switch just sets a global for us. 
That's fine for our purposes.

That means all we need is a Regexp that selects the words we want.  I came up
with:

	/\A[\d\s#{("a".."z").to_a.join[0...($base.to_i - 10)]}]+\Z/i

That's really just one big character class describing the accepted characters. 
The Ruby code inside it creates a String of the alphabet and pulls enough
letters off the front of it to match the current base.  Note that we also allow
for digits and the whitespace that will be at the end of each line.

If we put all of that together, we pretty much have my solution:

	$ ruby -sne
	'print if $_ =~ /\A[\d\s#{("a".."z").to_a.join[0...($base.to_i - 10)]}]+\Z/'
	-- -base=12 /usr/share/dict/words

If you're not found of the Regexp, we could remove it.  That involves two
changes:

	1.  Convert our base into an Array of acceptable characters.  We only want
	    such code to run one time, so we will place it in a BEGIN { ... } block.
	2.  Bring the characters in as an Array so that we can ease the testing of
	    letters.  Ruby's has switches for that too.  We can use -a to split()
	    the line of input and -F to provide the pattern to split() on.  We will
	    also add -l to remove the line ending for us.

Here's the code:

	$ ruby -slap
	       -F'\b|\B'
	       -e 'BEGIN { $hex = ("a".."z").to_a.first($base.to_i - 10) }'
	       -e 'next unless $F.all? { |l| $hex.include? l.downcase }'
	       -- -base=14 /usr/share/dict/words 

Note that I snuck in another change in addition to those described.  I switched
back to -p and just skipped word that aren't numbers.

The trick in this version is that -a causes each line of input to be split()
into the variable $F.  I also added the -F switch with a pattern that will match
between each character to control how the split() works.

Of course, we could argue the point of if this is still a one-liner since I'm
now passing Ruby two lines of code, but I try not to loose a lot of sleep over
such things.

A final weakness of this solution is that it doesn't finish processing as soon
as it could.  We can easily add that if you can tolerate one more line:

	$ ruby -slap
	       -F'\b|\B'
	       -e 'BEGIN { $hex = ("a".."z").to_a.first($base.to_i - 10) }'
	       -e 'break unless $hex.include? $F.first.downcase'
	       -e 'next unless $F.all? { |l| $hex.include? l.downcase }'
	       -- -base=14 /usr/share/dict/words 

Now might be the right time to consider putting all of this in a file,
especially if we wanted to do more with it.  I'm done though, so I'll leave that
as an exercise for the interested reader.

My thanks to all who showed how easy this can really be.

Tomorrow we're back to simulations and drawing pretty pictures...

In This Thread

Prev Next