239876-240405

239556-241571 subjects 240100-245405
```
^ For loops don't count down
239876 [michael.broo] I just started learning Ruby.  I like it's OOness however I've run
+ 239879 [m.fellinger ] for number in [5, 4, 3, 2, 1]
| + 239901 [david vallne] Syntactically, I'd prefer "for number in 5..1" to that monstrous method
| | 239902 [robert.dober] Completely agree, for esthetically reasoning.
| | 239917 [sonoflilit g] 5.step(-1) do |i|
| | 239919 [matz ruby-la] 5.downto(1) do |i|
| | + 239921 [sonoflilit g] That was already mentioned, but I wanted to show the moer general
| | + 239955 [michael.broo] Thank you for the reply.  I tried the step, as shown above, and it
| | + 239962 [daniel.schie] Is there a necessity for a range such as 5..0 to be empty? It would
| |   + 239966 [sonoflilit g] In math classes, I've seen cases where it's very comfortable that
| |   + 239968 [matz ruby-la] 5..1 is the easiest case, but what if "abz".."abc" where we couldn't
| |     239998 [robert.dober] No it is not, how could we distinguish between a "reversed" range and
| |     240000 [dblack wobbl] See the thread starting at ruby-talk 38910 for an earlier discussion
| |     240002 [robert.dober] I do not like the lack of symmetry it just feels not right.
| |     + 240005 [sonoflilit g] It's really easy: compose
| |     + 240008 [dblack wobbl] David
| |       240013 [robert.dober] It's easy when you are with the majority, do you remember the thread
| |       + 240014 [robert.dober] Done.
| |       + 240016 [dblack wobbl] "10".pred # => ??
| |         240018 [robert.dober] I thought it was "a" :(
| + 239948 [michael.broo] Thank you for the reply.  The syntax-highlighter highlights the "for"
+ 239880 [ruby.hardwar] I never use 'for' loops in Ruby. So I can't explain if or why not, etc.
239882 [martindemell] "for x in xs" translates internally to "xs.each do |x|", so the
+ 239950 [michael.broo] Thank you Harry and Martin!
+ 239988 [chneukirchen] That's not entirely true (there are differences in scope), but the

^ cgi / fcgi?
239878 [beingthexemp] Forgive me for my newbiness. I've never had to deal with cgi's before. I
239895 [david vallne] Your Ruby script needs to run a FCGI binding / listener / dispatcher /
239997 [beingthexemp] I've been looking at rails source code. The way I see it. I need to use

^ Re: The secret of the soul
239881 [mantaintai y] ...

^ Re: [QUIZ] Housie (#114) variant solution
239886 [lerno dragon] Here is a different solution. This first populates each ticket with

^ The peak of the iceberg, was Range cannot loop down and RCR Integer#pred
239887 [robert.dober] I was just following the thread about "loop cannot count down" and
+ 239916 [sonoflilit g] Sometimes #pred is harder than #succ, e.g. singly linked list.
+ 239964 [daniel.schie] It seems you beat me to it :)
239999 [robert.dober] Really my fault, I did not discuss it on the list, I did announce it
+ 240001 [daniel.schie] True all dat, I'm just playing the devil's advocate ;)
| 240003 [robert.dober] Boy that must be a well paying client ;)
+ 240004 [sonoflilit g] -1
240017 [robert.dober] First I want to say that I do not mind hijacking threads at all so be
240019 [sonoflilit g] Well, perhaps we both didn't understand each other :-)
240021 [robert.dober] E.g. for String, alas David just showed me in the countdown thread

^ system(...) redirect output to file ?
239888 [Gilbert.Rebh] i use the system method on Windows like that =
+ 239889 [ruby.hardwar] system("dir > myfile.txt")
+ 239891 [invalid gmx.] output = `command here`
239910 [Gilbert.Rebh] /*
239914 [Gilbert.Rebh] did it with =

^ Screen-scraping
239890 [david vallne] The number of monthly instances where I have to announce to various people
+ 239892 [fxn hashref.] I wholeheartdly understand you.
| 239894 [david vallne] Right, so Watir -can- be applied to more gory screenscraping too. The fact
+ 239893 [peter rubyra] Well, there is a new kid on the block, scRUBYt! (DISCLAIMER: I am the
239899 [david vallne] Hmm.
239903 [peter rubyra] Well, it is more about the navigation part: if you would like to scrape

^ Job Opening for a Quality assurance engineer in a leading Web Application server organisation in Bangalore
239900 [sunainadk gm] Consulting Bangalore . We are a specialist recruitment outfit focused

^ return statement
239908 [derek.teixei] i've been getting confused about what exactly the return statement
+ 239911 [fxn hashref.] Return means "we are done".
| 239922 [derek.teixei] So you are saying that it basically saves the confusion of elsif's and
| + 239931 [dblack wobbl] def is_positive?(n)
| | 239933 [fxn hashref.] Yes David, as I said in the message that method can be wrriten in
| + 239932 [fxn hashref.] Right.
|   239939 [derek.teixei] so right here we could have gotten rid of the "return" and then below
|   + 239940 [dblack wobbl] def square(n)
|   | 239942 [derek.teixei] I UNDERSTAND! (i think =D )
|   + 239941 [fxn hashref.] Exactly.
|   + 239944 [ljz asfast.c] You can do the "puts square(3)" and "9" will print out whether the
+ 239915 [david vallne] Making a wild guess at the signal in the noise.
| 239920 [dblack wobbl] No; Chris knows what he's doing.  It's pretty fundamental -- I always
| 239925 [david vallne] For mathemathical functions with a simple enough control flow, I'm
| 239930 [dblack wobbl] But if an exit point is midway through a method, it will have to have
+ 239923 [sonoflilit g] That is exactly why I started the RubyMentor project last week, which

^ SOAP responses
239943 [nickblack1 g] I'm making a query to a soap server, and I cant figure out how to get
240027 [jan.svitok g] Can't you just assign a File or StringIO instead of STDOUT?

^ Problem with Module/Class name resolution
239946 [thomas.leitn] module A
239949 [sonoflilit g] irb(main):001:0> module A

^ Problem with Module/Class name resolution
239947 [thomas.leitn] module A

^ from byte array to integer
239952 [james_b anyt] How in Ruby would I go about extracting a four byte integer from a byte
239953 [avdi avdi.or] Look into String#unpack (
239954 [james_b anyt] Thanks that works great.

^ include Module in another Module
239956 [briankbuckle] What is the proper syntax/code to include a Module into another
239975 [pit capitain] Brian, this isn't a problem of your syntax/code, but a (well known)
240061 [briankbuckle] Thanks, Pit.
240080 [bofh softmed] (i'm no ruby internals expert, just having some fun poking at rhg[2])

^ Assertions Testing in irb
239963 [bruparel mer] I am working through the Everyday Scripting With Ruby book and am trying
239965 [halostatue g] No. It loads the Test::Unit framework. This gives you
239971 [bruparel mer] I did that and it works!  Thanks.  Why are you saying that you have
+ 239974 [sonoflilit g] Things that work don't necessarily mean good design.
| + 239980 [bruparel mer] Ok, then there has to be "recommended" way to "invoke" the unit testing
| | + 239989 [sonoflilit g] I meant that #require is in general preferred over #load by
| | + 239992 [halostatue g] Yes. The recommended way is "don't." Unit tests are things that are
| |   + 239995 [bruparel mer] Thank you gents.  Very useful.
| |   + 240023 [ snk gna.org] raise unless foo == bar
| |     240025 [bruparel mer] Thanks for the info.  I was more interested in being able to use the
| |     240037 [halostatue g] What are you actually trying to do, Bharat?
| |     240047 [bruparel mer] Please see my more recent post about "IRB Power User's Guide".
| |     240056 [halostatue g] It is; I have recently edited several thousand MP3s quickly, easily, and
| + 239987 [halostatue g] This is not true. It has specialized use, which is different than "rarely used."
+ 239979 [pit capitain] #require looks for a *file* in the Ruby load path and executes it, if it
| 239990 [halostatue g] Note as well that the name-of-file need not have anything to do with
+ 239985 [halostatue g] I don't recommend using Test::Unit assertions in IRB.
240133 [rsanheim gma] If the OP wants to try out assertions in IRB, what is the problem?
240148 [bruparel mer] Just what the doctor ordered!  This is what I call: have your cake and

^ Re: [QUIZ] Housie (#114) [antique edition]
239970 [chneukirchen] When I first read the description, I thought "I already did that".

^ byte array to string
239976 [james_b anyt] I'm sure the must be code for this already without me having to go
+ 239984 [halostatue g] Your question is ... confusing.
+ 239986 [sonoflilit g] Strings are the ruby way to store arbitrary stuff in memory.
239993 [james_b anyt] Thanks for your responses.

^ Pine's tutorial "Word Sorter" exercise
239991 [randyshipp g] To reset slightly, this is an exercise that tells you to accept words
239994 [sonoflilit g] puts input.sort_by{|a| a.downcase}

^ nyc.rb does video
239996 [cashion gmai] Everyone,

^ Web service client help needed
240006 [dejan.dimic ] I still can do this web service right so I ask for some help please.
+ 240026 [jan.svitok g] Just a guess (knowing almost nothing about IIS, NTLM nor WSDL): This
+ 240030 [rcoder gmail] Your web server is rejecting your connection attempt, because you
240089 [dejan.dimic ] Thank you for you swift response.
240165 [dejan.dimic ] I had to use the 3rd party web service that will not change by mine

^ Bus errors & segfaults
240007 [blakeage hot] I've been getting daily Bus Errors on various ruby classes, which is
+ 240015 [efine145-nos] A bus error can occur if there is misaligned data on certain processor
| 240020 [blakeage hot] I believe the problem is actually due to the openbase bindings that we
| 240022 [efine145-nos] I believe no apology is necessary - it was an interesting question and
+ 240031 [rcoder gmail] You don't specify which hardware platform you're running, but it does

^ irb Power User's Guide
240029 [bruparel mer] The more I get into ruby, more I realize the power of "irb".  Long time
240032 [sonoflilit g] I've asked a similar question in a thread called REPL-driven development.

^ Deconstructor to close file
240035 [nappin713 ya] I'm trying to write a logger class.  I open the file in the initialize
+ 240036 [nappin713 ya] Errr... destructor for the non idiots
+ 240038 [halostatue g] There is no meaningful concept of a destructor in Ruby. There are
| 240094 [shortcutter ] Are you sure about that?  I know the statement to be true for Java but
| 240118 [halostatue g] I recall reading a few things over the last couple of years. On
| + 240142 [shortcutter ] Yeah, definitely do not trust on the ti
| + 240143 [shortcutter ] robert@fussel ~
+ 240039 [jan.svitok g] 1. The files are closed automatically when you stop the program.
+ 240042 [logancapaldo] Ruby has no destructors (there are these things called finalizers, but
240045 [nappin713 ya] Thanks for everyone's help!  I may end up just using the standard
+ 240048 [sonoflilit g] Classes are open in Ruby.
+ 240090 [GGarramuno a] Besides what SonOfLift answered regarding open classes, another way to

^ [Facets] Range#overlap?
240041 [daniel.schie] (I'm sending this to the list because I think it has general interest.
240060 [danfinnie op] I think that overlap? and within? are two different things, which I'm not sure you think from your email. Overlap? suggests, to me, that a subset of the things one range includes is the same as a subset of things that the other range includes. Within? suggests that all of one range is contained in a subset of the other range.
240115 [daniel.schie] Exactly, but that's not how it's implemented in Facets ;)
240125 [danfinnie op] That seems to be what facet/range/within does now.
240171 [daniel.schie] It's implementation is rather odd, though.
+ 240187 [dblack wobbl] Ranges don't always have lasts that have #succ, though.  Floats don't,
+ 240188 [danfinnie op] I think your implementation is cleaner however the endpoints of a Range
240194 [daniel.schie] I've tried that implementation, but i doesn't work if you consider this
+ 240195 [danfinnie op] => false
+ 240197 [dblack wobbl] I don't think ranges really yield values.  Some of them can be
240300 [daniel.schie] class RangeSpanTest < Test::Unit::TestCase
240353 [danfinnie op] I see a potential flaw in this if the ends were equal but other has
240404 [hutch recurs] I've worked in systems requiring temporal and interval logics for
240405 [ara.t.howard] indeed.  if people are looking fo a concrete example of why these definitions

^ Strange question:   Convert string to array name
240044 [kenneth.moor] I am coming to Ruby from LISP where I was more competent when it came
+ 240050 [stephen.dunc] eval('bobo')[2]
+ 240051 [aaron_patter] eval() might be what you're looking for.  You can use eval to return the
| 240054 [kenneth.moor] On Feb 19, 7:59 pm, Aaron Patterson <aaron_patter...@speakeasy.net>
| + 240059 [sonoflilit g] There should be, also I don't remember it.
| | 240099 [robert.dober] Are you thinking about Ma****, do not mention it anymore on this list ;)
| | 240107 [eweaver.spam] It's very unusual to need to dynamically reference a local variable. In
| + 240062 [m_goldberg a] I don't know whether or not you will think this better than using
+ 240063 [gwtmp01 mac.] This type of question seems to come up periodically on the list but

^ [YAML] To quote or not to quote (I think it's a bug)
240052 [matthieu.rio] I'm not sure this is the right place to report issues about Syck but that's
+ 240066 [tim.pease gm] Are you certain that 1.2_3 is a valid YAML float?
| 240067 [matthieu.rio] "Any "*_*" characters in the number are ignored, allowing a readable
| + 240076 [daniels pron] [-+]?([0-9][0-9_]*)?\.[0-9.]*([eE][-+][0-9]+)? (base 10)
| + 240079 [daniels pron] Hmmmm... I just noticed that the specification
+ 240083 [why ruby-lan] Only in YAML 1.1.  Syck only speaks YAML 1.0.  Unfortunately, the

^ Re: Housie (#114)
240053 [chubas7 gmai] Yay, I finally got time for this, my first try to submit one. It might

^ Re: [PhRUG:610] A Quantitative analysis of Ruby implementations
240064 [botp delmont] # A Quantitative analysis of Ruby implementations
240065 [botp delmont] yikes! pls ignore post. my utmost apologies everyone.. grrrrr.. am very sorry.

^ How to find out object type
240068 [phyprabab ya] IA,=0APhy=0A=0A=0A=0A=0A =0A_______________________________________________=
+ 240069 [has.sox gmai] object.kind_of?( Array )  #=>  To test if it is something
+ 240070 [gwtmp01 mac.] [1,2].class   # Array
240071 [phyprabab ya] umm, perhaps I am doing something wrong:=0A=0Airb(main):005:0> o.kind_of(0)=
+ 240072 [phyprabab ya] ah, thats better.  So now for the real nubie question, I am lost as to why =
| + 240074 [hhausman gma] irb(main):001:0> o = 42
| + 240075 [gwtmp01 mac.] The #{} notation is only applicable inside a string:  "#{o}".  The
|   240077 [phyprabab ya] But that then would assume I know what the object might be.  I mean, do I r=
|   240081 [phyprabab ya] Ah, that's the ticket!  Great thanks for the explanation!=0A=0A----- Origin=
|   240082 [phyprabab ya] Got it.  thanks!=0A=0A----- Original Message ----=0AFrom: Harold Hausman <h=
|   240116 [halostatue g] I'm not sure you do.
+ 240073 [has.sox gmai] methods may have punctuation in ruby.  kind_of?( OBJECT ) uses a question

^ irb dyamic prompt configuration
240078 [iamdonquixot] on irb.
240084 [bofh softmed] something on the lines of

^ irb completion fails on Intel Mac with ruby-1.8.5
240085 [jim freeze.o] charset=US-ASCII;
240126 [jimfreeze gm] charset=US-ASCII;
240149 [ben bleythin] I suspect something is hosed in your macports directory.  I've been

^ Array#uniq - Comparison doesn't use 'eql?' and 'hash'
240086 [wonado donne] I am confused about "Array#uniq". In

^ Array#uniq - Comparison doesn't use 'eql?' and 'hash'
240087 [wonado donne] I am confused about "Array#uniq". In
240096 [invalid gmx.] definitions = lambda do
240114 [wonado donne] Then another question came up.
240124 [danfinnie op] Set[4, 3] == Set.new(4,3)

^ Templates in Ruport class
240088 [pfocchken ya] How can I use a templates in the ruport. Does the ruport class support
+ 240153 [cdcarter gma] Chris Carter
+ 240172 [gregory.t.br] You mean ERb templates?  Yeah, we support them, though I've never had
240241 [pfocchken ya] No, I mean, that if I have a query and I need to display data in
240268 [gregory.t.br] No.  But let's talk about this over on the Ruport list.  Sounds like a

^ Help with Class design
240092 [chris.lowis ] I'm quite new to object-orientated programming and have a problem with a
+ 240093 [stefano.croc] You don't need to do anything special to be able to do what you want. You only
+ 240095 [shortcutter ] You just need to change the line to
+ 240097 [robert.dober] you could use inject here too
| 240098 [robert.dober] a local variable "mean" exists
+ 240101 [invalid gmx.] I suppose that you variance method should read something like
240103 [chris.lowis ] Thank you all for your help, knowing exactly what "self" refers to in
+ 240104 [benjohn fysh] You can, and I probably would, but you will then be calling the method
+ 240105 [benjohn fysh] I don't think the above will work, and even if it does, I would advise
| 240106 [chris.lowis ] I think I understand what you mean, but I am so used to programming in
| + 240109 [o.renaud lap] You want to return a new Signal so... just do it !
| + 240110 [robert.dober] def diff
| + 240112 [benjohn fysh] Get it to wrap the array in to a signal, and return that.
|   240139 [chris.lowis ] Thanks to all who gave the solution, it seems obvious now I've had it
+ 240111 [dblack wobbl] The disadvantage of that is that it will call the method mean once for
```