72433-72844

72196-73005 subjects 72661-75237

readline for OS X
72433 [dave@ch rr v] I have put together a script that will add the ruby readline module to the

Re:
72435 [hal9000@hy e] That's fascinating! I wish we had an English translation

Iteration - last detection
72439 [orion2480@ho] Is there any built in functionality for iteration that will allow me to
+ 72441 [hal9000@hy e] Array,
+ 72445 [spam@de k. k] hmmm... I cannot find a really elegant solution to this... it would have
| 72447 [gfb@to es ft] With arrays you can also do this as
+ 72448 [martindemell] module Enumerable
| + 72453 [ahoward@fs .] module Enumerable
| | + 72460 [martindemell] That isn't much better, though - you have the overhead of generating an
| | + 72462 [dblack@su er] Let Ruby do more of the work for you :-)
| | | + 72465 [martindemell] You aren't guaranteed 'size', though.
| | | | 72469 [dblack@su er] Yikes.  So much for conciseness :-)  Thanks for the timely correction.
| | | + 72468 [flori@ni e. ] Hmmm... Too much work isn't good either. If Enumerable#size
| | | + 72472 [ahoward@fs .] this won't work for *anything* Enumerable though - though it works for Array
| | + 72478 [dblack@su er] OK, as penance for clouding the issue with the mythical
| |   + 72487 [nobu.nokada@] Enumerable doesn't guarantee multiple iterations. e.g. IO.
| |   + 72494 [martindemell] My flag version benchmarks fater still
| + 72681 [steven_shaw@] I like Martin's implementation. I've modified it so that it handles an empty
+ 72456 [dave@ch rr v] this might work for you, it has simplicity going for it.
| 72530 [pbrannan@at ] I like that this solution lacks a flag to indicate whether I'm on the
| 72533 [martindemell] Also, "if prev yield prev" fails if there's a nil or a false in the
+ 72486 [volty_x@ya o] I couldn't resist to post to this (so) long thread. It would be nice to
+ 72510 [angus@qu va ] Here is a module that implements it, but you should include it in every
| + 72514 [angus@qu va ] Hmmm... this should handle the #each nesting properly (but still has
| + 72515 [bob.news@gm ] Detecting if the first element might in some circumstances server the same
| | 72517 [jj5412@ea th] a = {}
| | 72555 [spam@de k. k] that would only work if the array is sorted...
| | + 72557 [jj5412@ea th] Ah yes, this is true.
| | + 72564 [B.Candler@po] More precisely, it only works if the array (or other collection) elements
| + 72516 [decoux@mo lo] def last?
| | 72522 [angus@qu va ] Thanks for advice. But this subject is no longer important; what is
| + 72518 [B.Candler@po] Err??!
|   + 72523 [angus@qu va ] The methods in Enumerable don't call #each_with_last, they call
|   | 72532 [B.Candler@po] module Enumerable
|   | 72535 [decoux@mo lo] In 1.8 Array#select don't call Array#each
|   | 72537 [B.Candler@po] Did someone propose implementing each_with_last in terms of select? (I don't
|   | 72538 [decoux@mo lo] see [ruby-talk:72510]
|   | 72544 [B.Candler@po] Oh OK - make 'last?' a sort of pseudo-instance variable rather than passing
|   | + 72545 [decoux@mo lo] But you don't solve the problem, in [ruby-talk:72510] you have
|   | + 72597 [bob.news@gm ] "Brian Candler" <B.Candler@pobox.com> schrieb im Newsbeitrag
|   + 72598 [bob.news@gm ] Great solution.  Thank's for showing how simple some things become if you
+ 72520 [fgp@ph o. rg] What about a method each_tuple(tuple_length) in Enumerable, that would be kind of a
+ 72524 [martindemell] Apologies in advance :)

Return from ensure
72450 [gfb@to es ft] Actually, I saw a remark on ruby-talk once that "return" is dagerous,
+ 72471 [lyle@us rs s] Don't trust your instincts next time? ;)
+ 72675 [bob.news@gm ] "Gennady" <gfb@tonesoft.com> schrieb im Newsbeitrag
  72700 [gfb@to es ft] I understand perfectly well that I should not have done this. And in fact I
  72703 [bob.news@gm ] "Gennady" <gfb@tonesoft.com> schrieb im Newsbeitrag
  72706 [gfb@to es ft] I just wanted to save on typing ;-). Now I save the data in "ensure" in an
  72710 [bob.news@gm ] "Gennady" <gfb@tonesoft.com> schrieb im Newsbeitrag

substitution weirdness
72463 [ian@ca ib n.] irb(main):119:0> foo = "'123"
+ 72464 [dblack@su er] What you're hitting is a special meaning of \' -- namely, the
| 72467 [ian@ca ib n.] Thanks. I couldn't see why \' might be getting expanded like that, as I
| 72488 [nobu.nokada@] "'123".gsub(/'/, '\\&')
| 72491 [nobu.nokada@] Sorry, too stupid.  Ignore the previous post.
+ 72466 [rpav@nw in .] \' has special meaning ("after the match", iirc, which makes sense here).
+ 72512 [martindemell] foo = "'123"
  72519 [B.Candler@po] But '\\' and "\\" are the same thing (a single backslash)
  72526 [martindemell] Yeah, that was simply a matter of defaulting to '' for constant strings

FAQ in German - some updates
72479 [ jupp@gm .d ] Saluton!
72490 [hal9000@hy e] Great!
72561 [ jupp@gm .d ] Saluton!
72566 [dcoshel@vc a] ja = de wa, as "soo jya nai" (say, it ain't so), or "X de wa" (inasmuch

mod_ruby installation probs
72481 [lists@de on ] (eval): uninitialized constant ERubyRun at Apache (NameError)
72589 [0bz63fz3m1qt] I never tried using 'eruby', so I have no clue..

[OT] Re: Metakit for Ruby - Would you want it?
72482 [ahoward@fs .] wow.  yet _another_ reason to hate oralce

Object Prevaylence vs. OODBMS or Madeleine vs. DyBase
72492 [waisun.chia@] Rubyists,
72495 [ndrsbngtssn@] Madeleine itself doesn't have the concept of multiuser access or remote
72501 [B.Candler@po] *multiple concurrent method calls* - each incoming request is handled as a
72503 [ndrsbngtssn@] Since all "writes" to Madeleine have to go through the
+ 72506 [B.Candler@po] As you say, reads don't benefit from this protection. It might not be as bad
| 72596 [ndrsbngtssn@] There's a little-known implementation of shared locks in the Ruby
+ 72507 [waisun.chia@] Yes, please. ;-)

amrita parsing
72493 [nospam123@an] I've run into a problem with amrita not liking spaces in directory names.
72542 [ahoward@fs .] eg/ruby > irb -r amrita/template
72573 [nospam123@an] Ok, it's not giving me that error now.  Not sure what I had then before.

output redirection within mod_ruby
72497 [ian@ca ib n.] I have a script that runs under mod_ruby with Apache 2.0.40. At a
+ 72500 [0bz63fz3m1qt] I had kind_of? same problem, so I made a wrapper for system/backquote.
+ 72502 [B.Candler@po] I think that you have to capture the output of the command yourself. Your

VisualuRuby openFilename starting directory
72511 [jj5412@ea th] Is there a way to set the directory for a Swin::CommonDialog.openFilename()
72594 [dooby@d1 .k ] Last I looked, it was not implemented.

local variable and local variable in block behave differently
72521 [Sebastien.Cl] Dear Rubyists,
+ 72525 [dblack@su er] I'm not sure what aspect of it is surprising you, but maybe it has to
| 72527 [Sebastien.Cl] Sorry, I should have been more explicit. What surprises me is that in
+ 72531 [B.Candler@po] From this point, variable "b" is defined (even though the assignment is
  + 72539 [ahoward@fs .] 1.times do
  | 72540 [decoux@mo lo] Well, it's more
  | 72543 [ahoward@fs .] i was *trying* to say that... ;-)
  | 72546 [B.Candler@po] I don't think so - it parses and builds an AST in a single pass, then it
  + 72547 [matz@ru y- a] Maybe a bug.  Let me check.

to_s and concatenation
72528 [rasputin@sh ] rasputin@shrike rasputin$ irb
72529 [decoux@mo lo] String#+ want an object which respond to #to_str
72549 [rasputin@sh ] Right, but when do you use one and when the other?
+ 72550 [decoux@mo lo] svg% ruby -e 'class A;def to_s()"A#object";end;end; p [A.new, "aa"].join(":")'"A#object:aa"
+ 72551 [B.Candler@po] Interpolation into strings - "#{foo}" - uses to_s
  72562 [spam@de k. k] hmm... it seems to me that the real question is this: why have both to_s
  72563 [B.Candler@po] You have a method for explicitly converting an object to a string for
  + 72565 [dblack@su er] Just one addendum: it does hold for to_a/to_ary -- that is, you can
  + 72572 [rasputin@sh ] Exactly, but I think Brians explanation makes sense to me now.

expandtabs
72534 [steven_shaw@] The methods for expanding tabs in the Ruby FAQ don't seem to work.
72621 [ jupp@gm .d ] Saluton!
72623 [0bz63fz3m1qt] def expand_tabs(data, indent=8)
72625 [B.Candler@po] When expanding a tab I guess you are actually interested in the number of
72682 [steven_shaw@] No but here's the test script I've been using. It has all the different
72705 [ jupp@gm .d ] Saluton!

regexp operators
72556 [wjl@ic ca er] In doing some work with parsers the other day, I ended up with a
72567 [nobu.nokada@] Flags are preserved in 1.8.
72570 [wjl@ic ca er] I hadn't tried this in 1.8 yet, so that's cool to see that it has built
72593 [nobu.nokada@] As for +, is it right to just concatinate them?  Regexp#| is
72609 [wjl@ic ca er] Well, + meaning concatination makes sense to me. What else would it
72614 [nobu.nokada@] => /(?:foo|bar).*(?:.*)/u
72622 [wjl@ic ca er] I tend to think of + for regexp to be like + for strings--just a simple

try make dybase 010
72560 [wpinelo@ho m] ...

assistance
72571 [savi40@fs ai] Dear Friend,

Marshall and StringIO objects
72574 [ahoward@fs .] rubyists-
72575 [sdate@ev re ] irb(main):001:0> sio = Marshal.dump('foobar',StringIO.new)
72576 [sdate@ev re ] irb(main):001:0> sio = Marshal.dump('foobar',StringIO.new)
72602 [ahoward@fs .] ahhh...  i tried 1.6 w/shim, not 1.8.  thanks!

IF statement in ruby 1.8.0 (2003-05-26) [i386-mswin32]
72577 [sdate@ev re ] Just when I thought that I had perfectly understood the IF statement in
72581 [dooby@d1 .k ] This could be 'bug-lite' in 1.7+ (or i386)?
72582 [sdate@ev re ] Bug or a feature ? ;-)
+ 72603 [decoux@mo lo] Well, you have 1 trace_func for NODE_NEWLINE and 1 for NODE_IF
| 72607 [sdate@ev re ] Umm... what is the meaning / purpose of NODE_NEWLINE ?
| 72608 [decoux@mo lo] In ruby-core matz has said
| 72611 [sdate@ev re ] Since I am not as conversant with Ruby source as you all are, I am still not
+ 72604 [matz@ru y- a] A feature.  This is added to accomplish better debugger tracing.
  72674 [sdate@ev re ] What is "call timing" ? Time when a particular call was made ?
  + 72680 [matz@ru y- a] Yes.  Duplicates may be removed again when I find workaround for
  | 72694 [sdate@ev re ] Great ! I am using this precisely for debugger tracing ... so looking
  + 72693 [dooby@d1 .k ] I took this to mean that the frequency and/or sequence of
    72695 [sdate@ev re ] This is excellent ... of course, suggestions to improve are always welcome.

Ruby 1.8, mod_ruby-1.1.1, and Apache 2
72579 [ljz@as as .c] Can anyone point me to a coookbook recipe (or at least some detailed
72587 [ ted@ph .n t] Is this what you mean?
72592 [ljz@as as .c] Thank you very much.

Tk - list all options available for configure()
72584 [phlipcpp@ya ] Me again, droning about Ruby/Tk again.
+ 72590 [ptkwt@sh ll ] Is it just that it returns a hash (er... dictionary) and prints all the
+ 72612 [nagai@du bo ] In this case, please use canvas.configinfo().

console tables
72595 [culley@fa tm] Has anyone seen or developed a class for producing tables on the
+ 72605 [spam@de k. k] ncurses may be a bit overkill for just a few tables... but there is an
+ 72606 [B.Candler@po] Have a look at DBI::Utils::TableFormatter in the ruby-dbi-all package.

What is BER compression? (was RCR: unpack/pack Bignum)
72600 [sroberts@un ] Is it documented anywhere, what this 'w' template is useful for?
72648 [matz@ru y- a] Ask Perl people, it's there only for Perl pack compatibility.
+ 72649 [W.B.Hill@ue ] s/pack/back/
| 72650 [matz@ru y- a] Did I have to say "compatibility with Perl pack function"?
| + 72654 [dcoshel@ma .] No, one can always stack nouns in English, just like German :)
| + 72655 [martindemell] No, it was just a pun on 'back compatibility'.
|   72659 [hal9000@hy e] Ohh... I thought he was misunderstanding Matz.
+ 72651 [dan@si he or] It's an old format for storing indefinite precision integers. I have
| 72670 [cjh_nospam@m] BER = Basic Encoding Rules. The term comes from ISO networking, all
+ 72662 [sroberts@un ] Well, I can't find any reference to its usefulness in Perl, and I don't

Marshaling
72601 [dwerder@gm .] I need to dump some objects but they have references to files. These
+ 72615 [ahoward@fs .] i *just* had this same problem yesterday... here's the two approaches i
+ 72689 [jbshaldane@h] class File

Patch for mod_ruby-1.1.1 (was: Ruby 1.8, mod_ruby-1.1.1, and Apache 2)
72610 [ljz@as as .c] ...

Accessing utmp/wtmp in Ruby
72616 [ralph@do ph ] Please be gentle, if this is a stupd or often
72619 [dcoshel@vc a] `who`.each { |w| p w }

newbie questions
72617 [stedak@ch rt] Moving from C++
+ 72618 [mneumann@nt ] BLUE, RED, WHITE = (0..2).to_a
| 72626 [stedak@ch rt] I am probably confusing concepts but in C++ you can pass a parameter by reference, pointer or value. Copy constructors,
| + 72627 [B.Candler@po] - the thing passed is always a reference to an object (even if it's just
| + 72629 [jweirich@on ] You have a "shoebox" mentally.  In other words, you are thinking of
+ 72620 [jim@fr ez .o] Is this what you are looking for?
| 72624 [stedak@ch rt] ...snip...
| + 72633 [lyle@us rs s] If you're just using an enumerated type to differentiate between
| + 72636 [jim@fr ez .o] I think Lyle answered this for me.
+ 72637 [jj5412@ea th] Congratulations!

Auction Education -->E B A Y<--  genus leucadendron
72628 [zg39x34a7yf@] ...

ncurses + redirect output
72630 [0bz63fz3m1qt] I am having a hard time debugging my ncurses code...
72631 [B.Candler@po] I think such things are normally written to stderr, so you should be able to
72634 [0bz63fz3m1qt] Thanks Brian.

[RCR] attr_reader :foo?
72632 [vjoel@PA H. ] Would it make sense for attr_reader and friends to associate :foo? with
+ 72635 [nobu.nokada@] Like this?
+ 72639 [B.Candler@po] instance_variables works for me: I get
  72640 [nobu.nokada@] attr_(reader|writer|accessor) don't create instance variable

'line' trace event  (was Re: IF statement in ruby 1.8.0 ......)
72638 [dooby@d1 .k ] < abbreviated ri 1.8 description>

rdoc: embarrassingly minor complaint
72641 [martindemell] Posted in the hope that someone (i) agrees with me and (ii) has the
72643 [dave@pr gp o] I'd love to have folks submit templates that produce better-looking output.
+ 72653 [martindemell] Won't be me, I'm afraid - my sole brush with web design is my
+ 72838 [rodrigo.berm] how would you like this templates  ?
  72844 [dave@pr gp o] Check out rdoc from sf.net/projects/rdoc (get the cvs version, not the

Advantages of Symbols over constants
72642 [childNOSPAM@] I wonder what are the advantages of using symbols over constants.  For
+ 72644 [jim@fr ez .o] One advantage is that symbols are faster than constants.
| + 72646 [jj5412@ea th] One of my concerns with symbols is they spring into exsistence on their own,
| | + 72656 [jim@fr ez .o] I see your point. If the code was supposed to be
| | | 72657 [qrczak@kn .o] Not quite. If a dynamically typed language is statically scoped and doesn't
| | + 72660 [vangczung@ya] def foo(op)
| + 72707 [childNOSPAM@] I don't use constants too much, so speed is not a problem.
+ 72647 [vjoel@PA H. ] One advantage of symbols is that they know how to print themselves, but
  72663 [jweirich@on ] Well, yes ... but I imagine that in the cases we are talking about the
  + 72708 [childNOSPAM@] Isn't it better to do eg.
  + 72711 [B.Candler@po] class Myclass

thread-unsafe stuff: could you summarize?
72645 [schatten@no ] I'd be glad to see a short summary of what I should be aware of when writing
72673 [tcfelker@mt ] While you're asking that, I have a similar question: is the following
72678 [bob.news@gm ] First, accesses to @deferRunning should be done synchronized. But: Why do
72794 [tcfelker@mt ] Looking back, I can't remember why I even have that.  If you remove all
72819 [bob.news@gm ] "Tom Felker" <tcfelker@mtco.com> schrieb im Newsbeitrag

Re: [European Ruby Conference] - Accomodation...
72652 [Stephan.Kaem] I guess it will be time to choose some kind of accomodation in the near
72683 [mneumann@nt ] University, Karlsruher Castle and the central city are next to each other.

[OT] Re: Metakit for Ruby - Would you want it?
72658 [news-1@no pa] I know this is offtopic, but you could probably use "UPPER(foo) LIKE
72712 [B.Candler@po] Thanks, not a bad idea, although I imagine that Oracle would not use the
+ 72713 [hal9000@hy e] that)
| 72720 [pit@ca it in] If you're going The Ruby Way, why not
| + 72722 [ahoward@fs .] relation.select(:field0, :field1){|tuple| tuple[:field0, :field1] === [/foo/, /bar/]}
| | 72726 [hal9000@hy e] [/foo/, /bar/]}
| | 72727 [ahoward@fs .] sure, i considered it, but it doesn't work out too well (IMHO) in actual dbms
| + 72725 [hal9000@hy e] Touche', mon capitain. :)
+ 72721 [news-1@no pa] That's why Oracle let you create function based indexes, e.g. you can
threads.html
top