43893-45166

43611-44681 subjects 44025-44713

String#each
43893 [hal9000@hy e] Well, let's come full circle and get back
43904 [transami@tr ] do you think its just over the top to change how .each works ?
+ 43910 [ms@ia ta e. ] Whenever there's some defensible reason for why something works as it
| 43938 [list@NO PA c] Imagine this...
| + 43942 [transami@tr ] Massimiliano, THAT'S GENIUS!!!!!!!!!!!!!
| + 43995 [transami@tr ] Has no one else read this post?
+ 43915 [matz@ru y- a] String index and length will be based on characters, not bytes.  There
  44033 [ser@ge ma e-] So, even with i17m support, there will be no easy way to itterate over
  44038 [matz@ru y- a] Other than split(//)?
  + 44062 [tobiasreif@p] cool :)
  | 44065 [matz@ru y- a] Not yet.  Anyone?
  | + 44067 [tobiasreif@p] Intuitively, I'd try
  | + 44097 [ser@ge ma e-] Well, split() is fine with me in this case.  I don't think it is unintuitive
  |   44136 [matz@ru y- a] If you want to split a string into per character strings, you should
  + 44098 [ser@ge ma e-] Bingo.

SV: SV: [ANN] Archive 0.2
43894 [tsondergaard] ...
43896 [ned@bi e- om] I'm wary because I've seen some very touchy behavior from some Zip

What to use for OS-specific module namespaces?
43901 [piman@sa re ] I'm working on a Ruby module to parse/write to files in the Linux /proc
+ 43906 [piman@sa re ] I don't usually talk to myself, but I just realized (stupidly) that the
+ 43908 [nobu.nokada@] Just my opinion.  You'll want to install it into system
  43912 [piman@sa re ] If I name it Proc::ACPI, I need some prefix, or else I conflict with
  + 43913 [nobu.nokada@] I agree about the first sentence, but cannot imagin the
  | 43914 [piman@sa re ] The only function that came to mind at the time for distributions was
  + 43940 [list@NO PA c] There have been two modules in the RAA recently dealing with
    43956 [djberge@qw s] You're going to *write* to the /proc filesystem?!  Note that parsing /proc
    43978 [piman@sa re ] Yeah; a number of files in /proc do things when you write to them;
    43985 [djberge@qw s] like
    + 43986 [djberge@qw s] I realized I didn't really answer this question.  I meant it might be
    + 43997 [piman@sa re ] Well, the problem is that while some parts of ACPI are solely ACPI (like

How to determine EOF with sysread?
43916 [jim@fr ez .o] How does one determine the eof when using
+ 43919 [sean@ch tt n] file = '/etc/passwd'
+ 43920 [ned@bi e- om] So don't use eof?. Use the EOFError that sysread raises
| 43923 [jim@fr ez .o] Thanks all for the answers.
| + 43927 [sean@ch tt n] My C roots tell me, yes, but my Ruby roots tell me no.  Having an
| | 43955 [austin@ha os] It still seems wrong to me, since an end of file condition is an
| | + 43958 [peter@se an ] But eof is the exception when reading a file, because a read will
| | | 44009 [jim@fr ez .o] You have a point, but everyone that provided code to answer my question
| | | 44018 [ned@bi e- om] Depends on whether you know how big it needs to be.
| | + 43964 [ned@bi e- om] I look at exceptions as communicating "out of band" information. In
| |   43996 [Tim.Hunter@s] I haven't messed with PL/I in over 18 years, but my memory is that EOF
| + 43937 [dblack@ca dl] begin
+ 43924 [phasis@ko ne] How about?

Shorthand for def class methods?
43929 [pmak@an me l] class SomeLongClassName
+ 43930 [hwyss@yw se ] Class SomeLongClassName
+ 43947 [jim@fr ez .o] class SomeClass

SV: SV: [ANN] Archive 0.2
43943 [tsondergaard] ...
44095 [list@NO PA c] Here is the skeleton of Archive::(Reader|Writer|Modifier|Entry)::Ar.
+ 44110 [ned@bi e- om] So the assumption is that headers precede data?
| + 44125 [list@NO PA c] No, the assumption (at least without modifying Reader::XYZ#scan) is
| + 44126 [thomass@de t] The information in the central directory structure is not too relevant
|   44140 [ned@bi e- om] I have seen zips in which the two headers each have (different) extra
|   + 44170 [thomass@de t] Is that allowed according to the spec? I just looked at pkware's Zip
|   | 44178 [ned@bi e- om] Their spec isn't too helpful on the extra fields.
|   + 44171 [thomass@de t] Is that allowed according to the spec? I just looked at pkware's Zip
+ 44132 [thomass@de t] Isn't this unnecessarily low level access - I don't see a need for exposing
  44157 [list@NO PA c] Perhaps, but it has worked fine for me so far. :-)
  44168 [thomass@de t] exposing
  45076 [list@NO PA c] Do you suggest adding a more abstracted interface to the archive

Ruby Weekly News
43946 [Dave@Pr gm t] Ruby Weekly News: 07/08/2002

again: Ruby program without ruby installation
43948 [kgergely@ml ] I'm still missing how can I send a program to my friend, who doesn't
+ 43970 [ned@bi e- om] Put the executable(s) and required .dll/.so files into that directory.
+ 43974 [james@ru yx ] I believe that Blender ships Python as a DLL.  Nicer, I suppose, than a
  44047 [tomas_brixi@] Yes you are right. py2exe does this work. It scans your sources for module dependecies and builds
  44108 [kgergely@ml ] Just a silent note, that you cannot do a require inside an eval.
  + 44122 [thomass@de t] Why do you say that? I just tried it in irb, and it seems to work just fine.
  + 44189 [dsafari@pa a] I have been educated many times to try and avoid using eval, this is one case

for ... else ... end
43949 [kgergely@ml ] I've seen a somewhat unique structure in python. The for - else - end
+ 43953 [decoux@mo lo] Something like this ?
| + 43963 [detering@is ] Heaven ... this will recall the Misuse-of-exception Thread
| | + 44000 [hal9000@hy e] IMO, this is not a misuse. The throw/catch construct is
| | | + 44055 [detering@is ] [... Ruby code using catch/throw ...]
| | | + 44056 [matz@ru y- a] But I don't feel "for .. else" is intuitive.  The "else" seem like
| | |   + 44058 [detering@is ] Yes, indeed. It is semantically very different to
| | |   + 44063 [sean@ch tt n] Hmm...  I work around not having this construct constantly when doing
| | |   | + 44069 [detering@is ] (Epiloque: *argh* Do not have time to reedit this mail now,
| | |   | | + 44070 [decoux@mo lo] What do you call a `for' loop ?
| | |   | | | 44079 [detering@is ] (iterative means: every entry starts with a
| | |   | | + 44073 [sean@ch tt n] ensure should catch break... break strikes me as being identical to an
| | |   | | | + 44076 [detering@is ] *question-mark above my head*
| | |   | | | + 44081 [caelumse@ya ] Sean,
| | |   | | |   44101 [detering@is ] No it isn't.
| | |   | | + 44112 [austin@ha os] They're not, though. It's entirely possible that the begin ... end
| | |   | |   + 44113 [qrczak@kn .o] Usually you can just put this before break, so IMHO it doesn't need
| | |   | |   | 44119 [kgergely@ml ] Azt irtad, hogy
| | |   | |   + 44117 [detering@is ] Yes, I answered this question to myself some mails
| | |   | + 44077 [dblack@ca dl] To me this introduces a seriously criss-crossed quality to the logic
| | |   |   + 44084 [detering@is ] puts (arr.empty? ? "no rows" : arr )
| | |   |   + 44087 [caelumse@ya ] while very_time_consuming_operation
| | |   + 44068 [justinj@mo i] At first, I didn't think this kind of construct would be that useful, but
| | |   + 44082 [tsiivola@cc ] while cond {
| | |   + 44093 [austin@ha os] I can't say that I like the construct, although I can see its
| | |   | 44102 [detering@is ] <cite>
| | |   + 44103 [ser@ge ma e-] else
| | |     + 44107 [kgergely@ml ] For the keyword war: (silly, dummy example)
| | |     | 44114 [austin@ha os] cnt=0
| | |     | 44141 [dblack@ca dl] I still don't see how a code block can have an 'else' clause.
| | |     | 44146 [austin@ha os] 1. How would this work in a case where there is no loop, but just a
| | |     | + 44149 [ned@bi e- om] class Array
| | |     | + 44150 [dblack@ca dl] if array.empty?
| | |     | | 44213 [detering@is ] I've got the feeling that this thread is
| | |     | | 44218 [dblack@ca dl] One problem is the definition of "success" in looping.  Personally I
| | |     | + 44219 [g_ogata@op u] Instead of passing one block with 'else' or 'on_exit' clauses in it, I
| | |     |   44237 [kgergely@ml ] What is the reason one cannot pass multiply block simply
| | |     |   + 44271 [matz@ru y- a] Because I don't know how to receive/call multiple block.
| | |     |   + 44363 [qrczak@kn .o] By putting '&proc1, &proc2' in parameter list.
| | |     |     44382 [vjoel@PA H. ] if { $x > 0 } { puts positive } { puts nonpositive }
| | |     |     44447 [jeremy@ch os] But in Tcl, those "blocks" are syntactically just strings.  The "if"
| | |     + 44133 [dossy@pa op ] for ...
| | + 44036 [ser@ge ma e-] I feel like such a novice... but would someone explain to me why such a
| |   + 44039 [hal9000@hy e] My $0.02. Disclaimer: IDKP (I Don't Know Python).
| |   + 44054 [detering@is ] [...Your example...]
| + 44111 [detering@is ] Playing around a bit now I recognized
+ 44106 [qrczak@kn .o] callcc do |out|

ruby-dev summary 17609-17666
43950 [ttate@kt ja ] [ruby-dev:17615] substitution at when-clause
43991 [tobiasreif@p] Did you check RDoc? It's awesome.
+ 44042 [ttate@kt ja ] RWiki to manage documentations before the above proposal.
| 44061 [tobiasreif@p] That's what I thought; perhaps you want to try RDoc and see if it fits
+ 44043 [wakou@ru y- ] Thanks. Yes, It's good, too. I hope bundled tools for RD.
  44060 [tobiasreif@p] Ah OK. Dave, will RDoc feature man page output?

Right recursive
43952 [kgergely@ml ] I know, that recursive functions fill the stack.
+ 43967 [matz@ru y- a] It is oftern called "tail recursion".
+ 43969 [juergen.kati] I don't know the correct formula for right recursion of fibunacci numbers,
  43976 [meier@me st ] The given function calculate n! not the fibonacci numbers.

Redirecting standard error
43957 [gilles.filip] I saw many examples about how to redirect standard output to - say - a
+ 43971 [list@NO PA c] out, err = StringIO.new, StringIO.new
| + 44008 [gilles.filip] Thanks a lot. I'll have a look at it.
| + 44012 [gilles.filip] irb(main):001:0> require "StringIO"
|   44064 [list@NO PA c] I've only tested it for $stderr.  Seems like commands' stderr doesn't
|   44156 [gilles.filip] Do you have any pointer about this issue?
|   44235 [list@NO PA c] It should be all in ruby-talk archives.  Check www.ruby-talk.org.
+ 44186 [phasis@ko ne] def redir(redout, rederr)
  + 44234 [list@NO PA c] Ok, someone please shed some light on this.  The following works
  | 44261 [nobu.nokada@] Redirection works for IO descriptors.  This TempIO has meaning
  | 45075 [list@NO PA c] I see!  Makes sense.  So is redirecting external commands output/error
  | 45166 [nobu.nokada@] Open3 is to do it.  When you need its variant, you can copy and
  + 44255 [gilles.filip] So, to redirect them to something else than a file I have then to use

bdb "make test" failed under cygwin
43973 [olonichev@sc] I have compiled Berkeley DB 3.3.11 and bdb-0.3.1 under cygwin.
+ 43979 [decoux@mo lo] The problem is here, try this modification
| 44045 [olonichev@sc] tests/recno.rb now works
+ 44048 [eban@os ri .] @@ -224,2 +224,3 @@
  44051 [olonichev@sc] Tahnk you very much, now all tests are ok except  tests/marshal.rb.
  44053 [eban@os ri .] Sorry for the typo.
  44075 [decoux@mo lo] Thanks, for the patch

Thread dumping
43975 [ruby-talk@je] Anyone know how to thread dump or any method that allows me where each

Ruby.DBI -- select where ...
43977 [probertm@no ] This is a Ruby-DBI question.  I am using 0.0.15 under ruby 1.6.6 (cygwin).
+ 43981 [dossy@pa op ] sth = dbh.prepare("select au_lname, au_fname from authors where state = '#{state}'")
| 43982 [probertm@no ] Thank you so much!
+ 43983 [hwyss@yw se ] Mark,
+ 43984 [nat.pryce@b1] #{state}")
| 43988 [tom.hurst@cl] Also note you can use ?'s as placeholders, then pass the literal to the
+ 43989 [uu9r@rz un -] sth = dbh.prepare("select au_lname, au_fname from authors where state = ?")
  43990 [djberge@qw s] Just to follow-up, this is actually the "better" way of doing it Mark.

[ANN] YAML4R 0.14 -- Objects in plain-text
43992 [ruby-talk@wh] #  This ANN is structured in YAML, as I figured it might help to see how readable

cgi.rb - sending same named headers
44001 [dennis@su ch] Does cgi.rb have the ability to send two headers of the same name?  For
44002 [meier@me st ] the

Parameterized Mixin (Re: is there a better string.each?)
44017 [pit@ca it in] I also found it interesting. Here's a quick hack that allows the

String#split converts string args to regexes -- ?
44019 [dblack@ca dl] [This comes from some peripheral playing around having to do with the
+ 44022 [transami@tr ] yikes! off the cuff, i would think this would cause some significant
+ 44026 [matz@ru y- a] % perl -le 'print join(":", split(".b", "abcabc"))'
  + 44028 [dblack@ca dl] But the distinction between 1-char and multi-char string arguments
  | 44030 [vjoel@PA H. ] For consistency, what about gsub('string') and gsub(/re/) ? The former
  | 44031 [dblack@ca dl] I agree that it makes sense, pretty generally, for methods that take
  + 44104 [kasal@ma sr ] I guess Perl has inherited it from awk.  awk is somewhat simple language
  | 44137 [matz@ru y- a] sub/gsub
  | + 44142 [dblack@ca dl] Why the one-character exception?  I'm still not getting that.
  | | + 44144 [michael_s_ca] Me too, for what that's worth.
  | | + 44185 [matz@ru y- a] AWKish behavior is used too much to omit, and useful as well.
  | |   44214 [dblack@ca dl] I'm probably OT here, but I'm very curious about this....  What is it
  | |   44223 [dossy@pa op ] awk being typeless can't distinguish between a regex vs. a string,
  | |   44285 [kasal@ma sr ] the reson is simple: the one-char separator was there long before
  | + 44148 [tsiivola@cc ] ...
  | | 44172 [vjoel@PA H. ] One more vote for (b) (d).
  | + 44154 [transami@tr ] b-d, IMHO (more versitle)
  | + 44161 [nobu.nokada@] I prefer b-d too.
  | + 44194 [kasal@ma sr ] [BTW: I wasn't able to express my ideas so simply and clearly, thanks!]
  | | 44195 [matz@ru y- a] I think you can use Regexp.quote for that purpose, i.e.
  | | 44209 [kasal@ma sr ] I've forgotten about this, sorry.
  | | 44212 [dblack@ca dl] Quick reminder, for reference :-)
  | | + 44220 [transami@tr ] and, if implemented without regexps, could easily boost performance,
  | | | 44227 [matz@ru y- a] regex is highly optimized for searching.  search using regex
  | | | 44230 [transami@tr ] matz,
  | | | 44231 [decoux@mo lo] It don't use String#index in this case
  | | | 44233 [transami@tr ] ummm..the thread is called String#split converts...
  | | | + 44236 [decoux@mo lo] Your string as len == 1
  | | | | 44242 [transami@tr ] yes, quite. that's the only way to get split to not convert to a regular
  | | | + 44239 [matz@ru y- a] Remember String#split only searches for one character length string,
  | | |   44243 [transami@tr ] i'm sorry, matz, but even understading what you told me about how it
  | | + 44287 [kasal@ma sr ] The disadvantage is that people will often write "error[.]log", hoping
  | |   + 44288 [transami@tr ] stepan,
  | |   + 44290 [dblack@ca dl] Ummm, yes: there is (self-evidently) a backward compatibility issue.
  | |   | 44366 [kasal@ma sr ] I agree that writing such a long story about such a trivial thing was not
  | |   + 44305 [matz@ru y- a] You will be warned if you specify a string that contains regexp
  | |     44367 [kasal@ma sr ] sorry, Matz, for bothering you again :-(
  | |     44369 [matz@ru y- a] Not at all.
  | + 44202 [hgs@dm .a .u] I'd go for (b) and (d) as well, but notes in the docs about
  + 44120 [qrczak@kn .o] It's a pity that "convert a string to regexp" means "compile it".

UPDATE Re: Net::FTP hangs when connecting to a windows server...
44021 [rich@li hi o] Well - I looked at the windows 2000 server logs - didn't say much more than

Should libraries perform type checking?
44023 [pmak@an me l] When coding a library that is meant to be reused in other code, is it
44121 [jason@jv eg ] One option you have is to use the Design By Contract package[1], which would

about class method, What's the function of "initialize" in matrix.rb? and ...
44024 [sylvia_v_cha] My question is about the "class method". Why, in
threads.html
top