40364-49617 subjects 40784-41258

RFC: ||= operator
40578 [djberge@qw s] This is a perl-ism that I use from time to time: ||=
40599 [matz@ru y- a] You already have one, along with &&=.  I created it long before you
40618 [patrick-may@] I knew ruby had a mind reader in it!!!!

Re: ||= operator
40579 [nat.pryce@b1] irb(main):001:0> p= nil
40580 [djberge@qw s] Oops - I misread the error message when I ran my code snippet.  I had a
40581 [kgergely@ml ] Just cool down!

Greedy Regexp
40585 [ahumphreys@p] Are Ruby regular expressions, especially those built using the
+ 40588 [ned@bi e- om] Parsing HTML with regexes is not a good idea (that is, it's more complex
| 40593 [ahumphreys@p] Ah yes. Thanks.
+ 40595 [kgergely@ml ] Try something like
  + 40597 [tom.hurst@cl] Um, isn't that just a bit invalid?
  + 40611 [C.Teubner@t-] Could you explain this? To me, it doesn't seem to make any sense.

user-name query
40592 [szegedy@no p] Does someone know how to query the name associated with
40596 [ian@ca ib n.] Ian
40636 [alwagner@tc ] I am unfamiliar with Etc.  What am I doing wrong here?
40637 [kjana@dm la ] The message shows all.  There's no user whose name is `0'.  `nam' is a

function that returns function
40600 [spam@bu be r] I'm writing something showing how you'd write the same
+ 40609 [dossy@pa op ] I think Proc is the mechanism Ruby uses to offer closures.
+ 40641 [edsin@sw s. ] % cat curry.rb
+ 40650 [avi@be a4 co] def foo(x) lambda{|y| x = x+y} end

Exceptions and <=>
40612 [pbrannan@at ] class Foo
+ 40613 [dossy@pa op ] p Foo.new <=> 42
+ 40614 [michael_s_ca] This seems correct to me; you're not calling <=> in the second code
| 40615 [pbrannan@at ] I disagree.  In the second code snippet, I call Foo#==, which is not
| 40616 [michael_s_ca] Are you asking then if the exception behavior of "<=>" is
| 40629 [pbrannan@at ] Perhaps consistency not the problem.  However, if I implement my own ==
+ 40625 [chr_news@gm ] I think you make valid point - however catching the exception in
  + 40630 [pbrannan@at ] It seems to me that it's enough to conclude that A and B are not
  | 40652 [chr_news@gm ] It does not,  the above is an ``if and only if''.
  + 40640 [pbrannan@at ] module Comparable
    40772 [matz@ru y- a] Hmm, I like this one.  Let me consider.
    40837 [chr_news@gm ] ...

Drawing with GUI toolkits?
40619 [W.L.Kleb@la ] I'd like to create a simple GUI ap that contains some dynamic sketches
+ 40620 [sean@BU BY S] I haven't used the library myself yet, but you should be able to do this
+ 40633 [lyle@kn lo y] I think the answer depends on what you mean by "dynamic" sketches. But any
  40634 [W.L.Kleb@la ] All I had to do was read one of the "books"...  I am now drawing triangles,

instance_eval from C API
40621 [vjoel@PA H. ] Does anyone know an efficient way to call instance_eval from C? I'm
+ 40646 [nobu.nokada@] Do you want to make a Proc in C?  If so, recent 1.7 has
+ 40654 [pbrannan@at ] VALUE my_instance_eval(VALUE obj) {

Module#< from C
40627 [vjoel@PA H. ] Ok, here's another one: How do you call Module#< from C? The function

Ruby regex question
40635 [dossy@pa op ] Maybe this is Perl envy, maybe I'm just doing something wrong.
+ 40638 [tim@ve et .a] The main problem I see with this (even as a perl idiom) is that you're
| 40657 [dossy@pa op ] ($x, $y) = ("foo bar" =~ /(foo) (bar)/);
| + 40664 [mike@st k. o] But in perl you should check that the array assignment happened e.g.
| | 40673 [dossy@pa op ] Or, I just test to see if defined($x) or defined($y) is true.  If
| | 40674 [dblack@ca dl] str = gets
| | + 40675 [dossy@pa op ] Hmm.  What does x and y get if the match fails?  I don't have
| | | 40691 [chris@cm -e ] x, y = str.match(/.../).slice(1..-1)
| | + 40677 [michael_s_ca] No more "bad thing" than necessary though.
| |   + 40679 [dblack@ca dl] Remember though: what's really being matched is the whole pattern,
| |   | 40690 [chris@cm -e ] <Pine.LNX.4.30.0205182039210.25793-100000@candle.superlink.net>,
| |   + 40684 [dossy@pa op ] if matched, x, y = str.match /(.)(.)/   # boobies!  sorry, couldn't resist
| |     + 40685 [dblack@ca dl] You want a method called #match that throws away the match? :-)
| |     | 40686 [dossy@pa op ] For simplicity, yes.  $~[0] contains the match, if and when I ever
| |     | + 40688 [dblack@ca dl] Remember that the underlying concept of the "match" is a match between
| |     | + 40734 [michael_s_ca] Why not?  How many times in c do you throw away the return from
| |     |   40738 [dblack@ca dl] A better analogy would be a method called "printf()" that didn't print
| |     + 40732 [michael_s_ca] That's how my brain wants it, yes.
| + 40676 [tim@ve et .a] [ stealth cc's considered harmful ]
|   + 40678 [Dave@Pr gm t] irbsh(main):005:0> /(a)/ =~ "cat"
|   + 40683 [dossy@pa op ] [ accidental use of Mail-Followup-To considered harmful ]
|     40699 [tim@ve et .a] Hmm. I actually added those lines because a omitting them caused someone
|     40709 [dossy@pa op ] Yikes.
|     + 40714 [dblack@ca dl] But in this example, the matches are indeed being checked, prior to
|     | 40716 [dossy@pa op ] True enough, we're relying on $line_count being undef from line 3087.
|     + 40753 [tim@ve et .a] No, I'm saying that foo() should check _its_ inputs, and bar() should
+ 40639 [chris@cm -e ] Well, if you want a somewhat involved one-line approach...
+ 40656 [dblack@ca dl] irb(main):003:0> RUBY_VERSION

Ruby libxslt port?
40642 [sean@ru y- a] Quick ping to Ruby land: is anyone working on, or know of a Ruby port
40655 [mxp@dy al bs] Wai-Sun Chia has made two libraries for accessing libxml2 and libxslt;

백령도 약쑥 무료체험이벤트에 참여하세요 (광고)
40651 [yaksuknara@l] ...

FXDCWindow::drawIcon: illegal icon specified
40653 [barry_shultz] I've included a short code example exhibiting this 'illegal icon specified'
40659 [lyle@kn lo y] specified' error.
40666 [barry_shultz] Thanks for the help, Lyle. I didn't think to check the FOX faq (which I have

What is Test ?
40660 [han.holl@po ] I installed testunit-0.1.4 and aspectr-0-3-5, and did
40668 [kentda@st d.] Isn't Test the toplevel module of testunit?
40670 [han.holl@po ] Ah, I see. The test for aspectr was probably written for one of the

Anyone use Komodo IDE with Ruby?
40663 [nospam@no pa] Works great for Perl, what about Ruby?

Re: A few powered by mod_ruby logos...
40667 [sean@ru y- a] In case there are graphically inclined folks in this crowd that use

Ruby Weekly News - Help Wanted
40669 [ptkwt@sh ll ] Holden Glova and I trade off doing the RWN every other week.

Calling parent constructor from C
40671 [chrris@ma l.] What is the preferred method of calling my parent's initialize() when
40681 [nobu.nokada@] void

Best way to determine a VALUES Ruby type
40672 [chrris@ma l.] What is the cleanest way to determine the type of a VALUE when extending
40680 [lyle@kn lo y] if (rb_obj_is_instance_of(MyValue, rb_cRange) == Qtrue) ...
40682 [nobu.nokada@] In generally, I don't guess it's a good idea to compare a
40692 [vjoel@PA H. ] Maybe I'm paranoid, but I've been using
40694 [nobu.nokada@] Agreed.  It's better to write ruby (interpreter/extension)

[ANN] RubyEclipse released
40687 [awilliams@ro] First release of the highly anticipated (maybe just by me) Ruby IDE. Get it
+ 40689 [james@ru yx ] Um, maybe it's my rusty Java knowledge, but how do you start it?
+ 40701 [tobiasreif@p] What's "L&F"?
| + 40702 [tobiasreif@p] ... and as James asked; how to run it? I can't find a readme in
| | 40707 [sangamon@t- ] Yes, it's an Eclipse plugin. Install Eclipse and unzip
| | 40712 [tobiasreif@p] OK, Eclipse runs now. I copied the dirs to eclipse/plugins, so that I
| | 40717 [sangamon@t- ] Looks the same here.
| | 40719 [tobiasreif@p] dito
| + 40704 [djkea2@mu ca] Look and Feel.
+ 40718 [alwagner@tc ] Sorry, I don't run java apps.
+ 40720 [han@po ox co] Get it
  40741 [awilliams@ro] Okay. So I probably need to work on some documentation.
  + 40742 [james@ru yx ] <snip />
  | 40763 [awilliams@ro] James,
  + 40743 [han@po ox co] I guess you're using Windows. For it to work at all om Linux, I had to
    + 40765 [awilliams@ro] Han,
    | 40805 [han@po ox co] Please do.
    + 40766 [curt@hi bs c] First, I'll apologize in advance to the RubyEclipse people for pushing my
    | + 40787 [curt@hi bs c] That should have said "add additional capability" not "ass additional
    | + 40808 [han@po ox co] I've bookmarked it, and promise to play around with it as soon as
    + 40783 [pbooth@no oi] Han,
    | 40786 [djberge@qw s] Heck, I can't even get the latest version to run on Solaris 8.  I had a
    + 41158 [llothar@we .] Sorry but this will never be possible with scripting languages.
      + 41160 [james@ru yx ] But it's already been done with, for example, ECMAScript in Microsoft's
      | 41164 [llothar@we .] I never tried this (until now :-) but it will never be as useable as
      | 41177 [boognish23@y] VisualWorks Smalltalk has an auto-complete package.  I grant you that the
      + 41170 [han@po ox co] I understand that it will never quite equal the Java possibilities, and it

40693 [research@wi ] This is a multi-part message in MIME format

what happened to rubycookbook site?
40695 [ptkwt@sh ll ] I haven't been able to get to rubycookbook.com (or .org) for a while now,

A few questions..
40696 [comedyharris] I've recetnly downloaded Ruby for windows. It seems great! Very tidy /

Simple google search script
40700 [charlesb@su ] just a quick and simple question.
+ 40703 [djkea2@mu ca] Are you aware of the Ruby/Google project?
| 40705 [charlesb@su ] yes i am, but this is for a client and i was just wanting something that went to the search page if that's possible. I am looking into ruby/google as we speak, but i was wanting something that's nice and simple and doesn't require extra libs that the customer might not have and also so they don't have to get a key etc. if you know what I mean :)
| 40713 [dossy@pa op ] Charles,
+ 40722 [dennisn@pe n] I'm sure more experienced Ruby users can respond to the question of how
| 40760 [sera@fh an .] One caveat: Under most circumstances, using a bot or anything similar
| 40780 [charlesb@su ] Yeah i know what you mean. but as the user would probably be very low, as you say they p[robably wouldn't notice :)
+ 40781 [charlesb@su ] Thanks go to dossy for the help and the pointers. It now works great.

Qs on Ruby and DbC/Smalltalk
40706 [invalid@no p] 1. Is it planned to integrate Design-by-Contract (as described by

passing CGI parameters to ruby MySQL interface
40708 [neil@se ti e] I'm spending a lot of time trying to pass cgi.parameters to a MySQL
+ 40710 [dossy@pa op ] $my.query("insert into agent(_case, name1, name2) values
| 40769 [patrick-may@] $my.query( "insert into agent(_case, name1, name2)
+ 40711 [dblack@ca dl] One way is to use Ruby's capacity to interpolate arbitrary expressions
+ 40715 [sangamon@t- ] parms=... # Get params from CGI
  40740 [neil@se ti e] Thank you very much. These suggestions do just what I need -  I may
  40746 [sean@ch tt n] <security_hat>

Broken protocol.rb behavior?
40721 [msnomer@sp m] There seems to be a problem with ReadAdapter, unless I'm doing something

are there unit tests for cgi.rb?
40723 [patrick-may@] if so, where could I find them?
40798 [wakou@fs ne ] Unfortunately I don't make it.
+ 40799 [wakou@fs ne ] now, I make next cgi.rb and new simple HTML generate librarys.
| + 40806 [tobiasreif@p] Will it support XHTML1.0, which is the current version of HTML?
| | 40812 [wakou@fs ne ] It may support XHTML1.0. Even if it will support HTML, it's String base.
| | 40841 [tobiasreif@p] Sounds great!
| | + 40844 [wakou@fs ne ] Oh, wonderful!  I'll tell Siena. this site (in ruby-list).
| | | 40845 [tobiasreif@p] But as I said, it's not of release quality.
| | + 40881 [hal9000@hy e] This may be old and half-baked, but it is
| + 40864 [patrick-may@] Thanks so much for maintaining cgi.rb!
|   40895 [wakou@ru y- ] I want to accept suggestion at any time. But, I want to make separate
|   40954 [patrick-may@] I tried posting this earlier, but it looks like it got lost
|   40965 [wakou@ru y- ] Thanks.
|   40980 [patrick-may@] Fair enough.  I'm excited to see it!
+ 40830 [patrick-may@] These look great!  I want to merge cgi.rb with the api that I've been
  40842 [wakou@fs ne ] ok, I put it here.

mod_ruby or remove_cost question
40724 [patrick-may@] is there an easier to test way of checking for the mod_ruby enviroment
40739 [sean@ch tt n] Not one that is reliable and works across all Ruby WWW servers.  -sc
40817 [patrick-may@] That's a bummer.  I'm trying to unit test some switches in a cgi lib,
40832 [sean@ch tt n] Using mod_ruby should barely change when using cgi.rb's

Why does open3.popen return status?
40728 [olczyk@in er] The python version of peopen3 allows you to see the staus, so I

Object <-> Relational mapping
40729 [tom.hurst@cl] db.select_all(long_sql_statement) do |row|
+ 40730 [home@cl bs o] Some possible improvements. I'd try to take advantage of .send - so the loop
| 40731 [tom.hurst@cl] Unfortunately, my row names do not map directly to object properties, be
+ 40737 [comedyharris] I posted a very similar question on comp.object (Relational Database
+ 40749 [cputney@wh s] It works the opposite way to many OR mapping systems - by analysing the
+ 40752 [avi@be a4 co] I played with OR mapping in Ruby a long time ago, but mostly just as

40733 [gehlker@fa t] Just saw a blurb on O'Rielly's site about E. Has anyone used it. It sounds a
+ 40744 [harryo@De ek] Can you give us a URL?
| + 40756 [gehlker@fa t] The secret of life is honesty and fair dealing. If you can fake that,
| + 40758 [chr_news@gm ] www.erights.org
| + 40811 [ahumphreys@p] Here is where it gets interesting ...
|   40820 [chrris@ma l.] Would it be impossible to add nonblocking promises to Ruby?
|   + 40824 [pixel@ma dr ] AFAIunderstand, it's more like a conceptual difference than an
|   + 40838 [marick@vi ib] Someone on the E list was talking about implementing promises in
+ 40768 [ADATE@kc rr ] E has a lot more emphasis on being a language for "secure distributed

Errata Ch 13-15 Teach Yourself Ruby in 21 Days
40736 [jzakiya@ma l] These are mostly cosmetic
40874 [ms@ia ta e. ] I can't consider most of these errata. You are objecting to layout

Need Multiline Regexp Help
40745 [jim@fr ez .o] I am trying to collect a set of lines in a string.
+ 40747 [pit.capitain] The RE searches for an "f" followed by as many characters
| 40748 [jim@fr ez .o] Thanks. Actually, I would like to match "fred" followed by
| 40751 [pit@ca it in] irb(main):001:0> s = <<EOF
+ 40755 [dossy@pa op ] f.* is matching "fred\nhell" -- "o" satisfies [^l].

Ruby and UML Modeling
40754 [usenets@fa t] Is there any on-going project to include Ruby Scripting Language(and./or

complicated callcc question (long)
40759 [ptkwt@sh ll ] I'm trying to create processes that can wait for certain events to occur
+ 40773 [avi@be a4 co] It won't restore variables to different values (that's a form of
| 40828 [ptkwt@sh ll ] puts ">>>>>iteration: #{i}"
| 40848 [avi@be a4 co] That's exactly what should happen -
+ 40776 [pit@ca it in] I used continuations in some of my classes but I still sometimes

Binary network protocols
40761 [ruby-talk@el] I'm starting on a projects which requires me to use a spesific network
+ 40762 [gotoken@no w] Maybe Array#pack and String#unpack can helps to such applications.
| 40764 [vjoel@PA H. ] That's more than a joke, since I can imagine actually using it. Maybe
| 40918 [gotoken@no w] Thank you.  But I think PackUtil is too slow in the Networking scene.
+ 40770 [dennisn@pe n] Suggest you use array#pack with arg of 'n' for int16 and 'N' for

[OT] Re: Simple google search script
40767 [dossy@pa op ] ^^^ Have they _ever_ done this?  Is this urban legend or
40774 [ian@ca ib n.] Yes, this happens from time to time, especially when masses of

Ruby Weekly News
40775 [Dave@Pr gm t] Ruby Weekly News: 05/20/2002

[RDoc etc] automatic documentation: using tests in addition to / instead of comments
40778 [tobiasreif@p] Comments are great, but they can become incorrect when not updated with
+ 40779 [tobiasreif@p] - The while thing
+ 40788 [Dave@Pr gm t] Actually, by an amazing coincidence... :)  That's something we've been
  + 40790 [tsiivola@cc ] *snippage*
  + 40791 [tobiasreif@p] Awesome!
  | 40792 [Dave@Pr gm t] Sorry - that was just an example of the kind of thing I'm
  | 40794 [chris.morris] I think I like it -- I've been putting my tests in separate files for a
  | + 40797 [Dave@Pr gm t] I think probably I'd have
  | + 40871 [jean_hugues_] class MyClass
  |   40880 [chris.morris] If the tests are in a separate file, appended to the class, then when not in
  + 40800 [hutch@re ur ] 1) If the tests are included in the source file won't they be installed with
  | 40803 [dossy@pa op ] This was my initial negative reaction to Dave's otherwise
  | 40822 [Dave@Pr gm t] Say you're looking at method 'fred' in RDoc. In the documentation
  | + 40835 [tobiasreif@p] I'd like to have an option where the relevant test code fragments are
  | + 40887 [ser@ge ma e-] Man, how did I miss this thread?
  |   + 40889 [pbrannan@at ] OTOH, it would be nice if one could test the examples, to ensure that
  |   | 40896 [colin@wh st ] Here's my two bits.
  |   | 40898 [Dave@Pr gm t] I think is this a consistent message we're seeing in this thread, and
  |   | 42017 [patrick-may@] + it is good to keep the classes as light as possible, so that
  |   | 42021 [list@ch om t] See comments by Nat Price in [ruby-talk:22920] about meaningful test
  |   | + 42026 [pbrannan@at ] And 22920 > 10000. :)
  |   | + 42048 [patrick-may@] I noticed that in my practice, test_method would often contain the
  |   |   42449 [list@ch om t] Yes, that happens to me too in many cases but there are some methods
  |   + 40893 [tobiasreif@p] The inline tests would be usage examples that can be run automatically
  + 40823 [bcox@vi tu l] I'd warn  against it. Had the same debate with Bertrand  who
  | 40827 [Dave@Pr gm t] True - but nothing precludes doing this too. I'm just thinking that if
  + 40840 [patrick-may@] The second reason does apply to Ruby, just less drastically.
  + 40852 [wconrad@ya n] Dave,
  | 40867 [tobiasreif@p] But RDoc could use the tests even if they are in (a) separate file(s),
  + 40858 [mike@st k. o] Are tests intended to be used that way?  Most of the tests I write after the
  + 40869 [jean_hugues_] I like that. It fits well with the principle of locality ("things that
  + 41043 [listNOSPAM@c] Here are my two cents.
    41046 [jean_hugues_] I like that. What happens if code is "loaded" instead of "required" ?
    41090 [listNOSPAM@c] Actually I don't know, I never use `load'.