178024-179984 subjects 178502-181499

[LAUGH] Proposal For New Ruby Mailing List Subjects
178305 [zedshaw@ze s] Hey,
+ 178308 [ezmobius@gm ] LOL @ Zedas
+ 178310 [tsumeruby@ts] HeHe
| 178312 [james_b@ne r] We also need
+ 178322 [l.d.u.n.c.a.] I was so disappointed when I read this last paragraph.
+ 178325 [shortcutter@] Well done, Zed!  But I couldn't decide which list to be on. Could you
+ 178577 [david@va ln ] I *so* want the sellouts list. One of these days, I'll get serious mental

Ruby Syntax: 'initialize' versus 'init'
178307 [checketts@gm] ...
+ 178311 [james_b@ne r] I suspect people call to_* more often than they call initialize.
+ 178318 [gmurray@cl u] There is a difference in wrapping to interface to C
+ 178321 [matz@ru y- a] It can be very critical when the name of initializing method conflicts

Debian, gem(?) , and libraries
178319 [furufuru@cc ] I'm using Ruby on Debian GNU/Linux.  Ruby itself
+ 178335 [mtrier@gm il] RubyGems is a separate packaging system that doesn't cause any
| 178338 [stefan@ma li] What is in your sources.list - the package doesn't show up.
| 178348 [kasten.m@gm ] deb http://www.sgtpepper.net/hyspro/deb unstable/ #rubygems
| 178695 [mtrier@gm il] That's where I got it as well
+ 178337 [stefan@ma li] I'm using gems on Ubuntu (and were using it on debian as well).
+ 178367 [ruby@an hr p] } Hello all,
  178498 [furufuru@cc ] Thank you all who responded.
  + 178524 [jim@we ri hh] RubyGems only works for software explicitly packaged as gems.  Although
  + 178573 [otanuki@gm i] I pretty much don't like Debian's packages for ruby.
  + 178667 [furufuru@cc ] [. . .]

I Broke Ruby (i.e. Missing the Brutally Obvious)
178324 [mjudge@su ve] It's been yet another late Friday.  It's practically a lifestyle by this
178329 [g_ogata@op u] Because it hasn't been defined when "class B < A" is evaluated.
178558 [mjudge@su ve] Thanks for your help, George.  That's really interesting how the ruby

178326 [levin@gr nd ] class Fixnum    def to_a(base=10,min_length=0)      self.to_s(base).rjust(min_length).split(//).map { |c| c.to_i(base) }    end  end
178352 [chneukirchen] It should be twos-complement for negative numbers, of course. ;-)
+ 178354 [levin@gr nd ] 12345.encode(10) #=> [5,4,3,2,1]
+ 178358 [chneukirchen] For fun, an implementation of encode/decode.
  + 178376 [hhausman@gm ] Happy hacking indeed!
  + 178378 [levin@gr nd ] ...

[RubyCocoa] setting the items of an?NSPopUpButton programmatically
178327 [pere.noel@la] i'm starting within RubyCocoa, although i've been using Cocoa-Java, i

how to vary sort's block?
178331 [wybo@se va y] When I have an array of objects (Thing's, say) with two properties (say
+ 178347 [bob.news@gm ] The easiest is probably to use sort_by.
| 178355 [wybo@se va y] this does not allow for more complex sorts, like on name *and* amount,
| 178370 [bob.news@gm ] "Wybo Dekker" <wybo@servalys.nl> schrieb im Newsbeitrag
+ 178350 [rossrt@ro co] orders = {
+ 178371 [james@gr yp ] #!/usr/bin/ruby
  178488 [wybo@se va y] Thanks all for the very valuable explanations and suggestions.
  178571 [mark@mw ld n] Agreed. C# is the same.

Extract hash into local variables?
178332 [cool_screen_] Is there a Ruby function similar to PHP's extract/list? What I'd like to
+ 178340 [bruno.celest] Maybe args.inspect
+ 178345 [bob.news@gm ] You cannot do that as local variables have to be declared in the code.
| 178353 [gene.tani@gm] Robert's correct in the general case, but you can read a hash and have
+ 178377 [bauer.mail@g] args.each_pair { |k, v| instance_variable_set("@#{k}", v) }
| 178379 [bauer.mail@g] Duh... yea, should have read the previously posted link,
+ 178380 [jeff@sc wa c] I'm kind of disturbed by how hard this actually seems.  There does not
  + 178381 [bob.news@gm ] Very weak.  This is by no means thread safe. Also it will keep references to
  | 178385 [jeff@sc wa c] Of course not.  But some code is a lot cleaner if you can use the local
  | + 178406 [shortcutter@] Ruby != Perl && Ruby != Python
  | + 178433 [gene.tani@gm] I think on this specific point you're wrong about python.  Writing to
  | | 178438 [gene.tani@gm] it's here too
  | + 178472 [chneukirchen] If that's true, consider it a good reason *not to*. ;-)
  | + 178483 [jim@we ri hh] It may be common in Perl, but it is just as misguided there as well.
  + 178384 [cool_screen_] def extract(hash)
    178388 [cool_screen_] def foo(args = {'a'=>1, 'b'=>2, 'c'=>3})
    178402 [rosco@ro co ] Careful with that, I think hash order is undefined?

How to use Ruby interpreter as Windows DLL library?
178341 [sunexdev@ma ] I have an idea (program, that uses Ruby interpreter). And I dont know
+ 178342 [sunexdev@ma ] Oh... Calling from C/C++... Windows XP platform.
| 178374 [deanwampler@] I don't know if this helps, but RubyScript2Exe
+ 178389 [billk@ct .c ] Here's some very basic code to load and run a ruby script from C/C++
  178391 [sunexdev@ma ] Thanks a lot for your way!!! Thanks!  Thanks!  Thanks! =)

rcrarchive broken?
178346 [bob.news@gm ] Application error (Rails)
178356 [dblack@wo bl] Whoops.  Let me check.  (I'm in London but at least intermittently
178357 [dblack@wo bl] OK, the MySQL daemon had died for some reason.  It should be OK now.

[OT] Re: Ruby Syntax: 'initialize' versus 'init'
178349 [chneukirchen] Did the T object system influence the design of the Ruby object system?
178365 [matz@ru y- a] No.  I've heard it was pretty interesting but I didn't have any chance
178471 [chneukirchen] It's very lightweight and almost trivial.  In fact, I once ported it

install mysql-ruby on RHEL
178361 [richard@d2 .] Howdy,
+ 178363 [oliver.andri] I just packaged mysql-ruby for Fedora Core and in my SPEC file I use
| 178366 [richard@d2 .] Thanks, Oliver.
| 178372 [oliver.andri] I just checked on my RHEL boxes, and even your method to compile the
| 178383 [richard@d2 .] Hey Oliver,
| 178453 [logancapaldo] Speaking totally out of my rear end here, but it looks like A) its
| + 178458 [richard@d2 .] Good call, Logan.
| | 178670 [logancapaldo] ...
| | 178696 [richard@d2 .] Success!  I spent most of the weekend and today coming back from a
| + 178582 [otanuki@gm i] That's right, in Debian you need mysqlclient-dev (or whatever was the
+ 178369 [ dez@ma .c m] I don't know what is wrong in your case. However, in my case, I

Problem with weak references on OS X 10.3
178364 [vikkous@gm i] I am having problems with weak references. The program below exhibits
+ 178373 [bob.news@gm ] I'm a bit confused: where are the WeakReferences your subject mentions?
| 178387 [vikkous@gm i] The call to __id__ creates the weak reference. Anyway, I consider it a
| 178410 [shortcutter@] You're right - I don't. Object#__id__ returns an object id.
| 178460 [vikkous@gm i] It happens running it with plain ruby (no irb) on my ruby 1.8 (and
| 178465 [bob.news@gm ] ...
| 178588 [logancapaldo] ...
+ 178470 [chneukirchen] o=#<Object:0x1d421c>, i=ea10e, o2=:reject, n=448 (RuntimeError)
  + 178477 [bob.news@gm ] Wow!  Does it exhibit the same behavior with #object_id instead of #__id__?
  + 178486 [ mfp@ac .o g] 0x1d421c.to_s(2)                                   # => "111010100001000011100"

one click installer + gems
178375 [pihentagy@gm] It was expected, that as of  1.8.4, ruby networking works on windows.
178386 [ml.chibbs@gm] I don't have any problem.
+ 178394 [pihentagy@gm] No error message.
+ 178413 [pihentagy@gm] cannot ping gems.rubyforge.org
  178426 [ml.chibbs@gm] How can you say your internet connection is ok when you can't get to
  + 178428 [ mfp@ac .o g] I think he was hinting that the problem lies in Ruby's TCPSocket...
  | 178435 [pihentagy@gm] I've read that 6 month old post, but don't know what to do.
  + 178569 [pihentagy@gm] I can of course connect to google with other methods...

Quiz #65, Principle of Great Surprise, and Array.delete sledgehammer
178392 [groups@gr nd] I thought I was actually going to enter my first RubyQuiz, but I've
+ 178395 [levin@gr nd ] class Array    def without_one(elem)      new = self.dup # make a copy so that the original is not changed      new.delete_at(new.index(elem))      new    end  end
+ 178396 [james@gr yp ] I was just wanting this method yesterday, and not for the first
| 178408 [groups@gr nd] Wouldn't delete_first still ought to return "_obj_ or nil"?
| 178412 [james@gr yp ] Good point.  You are probably right.
+ 178397 [wilsonb@gm i] class Array
| + 178403 [levin@gr nd ] class Enumerable  def delete_one_of(obj)    self.inject([],false) { |(arr, already_deleted), elem|      arr << elem unless elem == obj and not already_deleted      already_deleted = true if elem == obj      [arr, already_deleted]    }[0]  endend
| + 178417 [groups@gr nd] You are, but it isn't. I might well have "nil" as a legitimate item in
|   178434 [wilsonb@gm i] class Array
+ 178398 [ara.t.howard] class Array
| 178419 [groups@gr nd] This is just a list of many other ways to not do what I want, yes?
| 178448 [ara.t.howard] class Array
| 178480 [SimonKroeger] Well, i don't think it's 'amazingly bad'. Array#- doesn't raise an error
| 178519 [ara.t.howard] good points all.  i can only guess
| 178570 [groups@gr nd] I think you're confusing "failure" with something else. If I ask a
+ 178400 [logancapaldo] require 'enumerator'
| 178407 [groups@gr nd] Aha!
+ 178404 [SimonKroeger] You obviously know how to code such a method yourself and i can't answer
| 178405 [groups@gr nd] class Array
| 178456 [adam.shelly@] I ran into that problem too when I was coding the quiz.
+ 178468 [w_a_x_man@ya] This may not be of any use to you, but here's a way to delete all
  + 178489 [pdeuster@gm ] ...
  + 178510 [james@gr yp ] Array.uniq!
    178542 [w_a_x_man@ya] irb(main):008:0> a=[1,1,2,2,3,3]

built-in vs. standard library
178393 [r.mark.volkm] I'm confused about whether the Date class is built-in or in the
178399 [james@gr yp ] It's a standard library.
+ 178401 [wilsonb@gm i] irb(main):001:0> Date.methods(false)
+ 178425 [r.mark.volkm] Then why does this code run?
  + 178430 [rosco@ro co ] Just curious, what is your output from this code?
  | 178436 [r.mark.volkm] I get
  + 178431 [desmarm@gm i] I wonder if you might have required rubygems at some point.  Sifting
    178439 [r.mark.volkm] Good suggestion!  I tried that and I see that "rubygems.rb" is being
    + 178444 [desmarm@gm i] Very odd.  I noticed that earlier in the thread that you said that you
    | 178446 [r.mark.volkm] Oops!  You can color me red.  I do have RUBYOPT set and it's set to
    + 178450 [james_b@ne r] Because I run rdoc over the base set of lib files.

optional yield -- was Re: Quiz #65, Principle of Great Surprise, and Array.delete sledgehammer
178409 [vjoel@pa h. ] def one_two_three

What is YARV?
178411 [narf968@gm i] I see it's a VM for Ruby, but what does that mean and what is it good
+ 178432 [wilsonb@gm i] ...
+ 178557 [david@va ln ] Put shortly, it's a Rubyists (for given values of Rubyist, notably including

rubyforge down?
178414 [ezmobius@gm ] I can't get to rubyforge at all today. Is it down for a reason or is
+ 178427 [gregory.t.br] no problems here
+ 178442 [tom@in oe he] Yours,

libnet binding for ruby
178415 [dave@da ew i] I was hoping to be able to build raw packets in ruby.  I've found and
178420 [vjoel@pa h. ] I don't know libnet (except what I just read on the website) but if you

Scanning a string for decimal numbers
178416 [jeppe88@gm i] ...
+ 178421 [ksruby@gm il] "24,4 + 55,2".scan /[\d,]+/
| 178424 [erne@po er a] try
| 178449 [ara.t.howard] careful.  you'll kill negatives.
+ 178473 [acangiano@gm] a.scan /[-+]?[0-9]*\,?[0-9]+/
| + 178475 [acangiano@gm] Or to be less verbose you can use \d in place of [0-9] :-)
| | 178478 [fxn@ha hr f.] If you have Perl installed, the incantation
| + 179429 [ jupp@gm .d ] Shouldn't that rather be the following?
|   179433 [jeppe88@gm i] Scanning a string for decimal numbers
|   179774 [ jupp@gm .d ] [-+]?([1-9]\d*(\,[0-9]+)?)|(0(\,[0-9]+)?)
|   179895 [jeppe88@gm i] Scanning a string for decimal numbers
|   179905 [david@va ln ] That's a positive zero-width lookahead. I think. Gotta love regexspeak.
|   179989 [bob.news@gm ] These is equivalent (?=\D)
+ 179436 [wilsonb@gm i] This should handle periods or commas as the separator.
  + 179437 [jeppe88@gm i] Scanning a string for decimal numbers
  + 179445 [mail@ko fe n] - signs are disregarded ("-24,4" becomes "24,4")
    179451 [jeppe88@gm i] Scanning a string for decimal numbers
    179452 [jeppe88@gm i] Scanning a string for decimal numbers
    179456 [wilsonb@gm i] Well, that's what I get for dashing off a quick e-mail before dinner.
    179548 [jeppe88@gm i] ...
    179579 [wilsonb@gm i] digits[0] is an Array containing '24.4'.
    179582 [jeppe88@gm i] ...
    179587 [wilsonb@gm i] Yes, as long as the numbers are always at least two digits.

Help with print cgi.header(
178418 [erne@po er a] I'm trying to set a cookie using Apache on RHFedora core3 and Ruby CGI

RubyForge network problems
178423 [tom@in oe he] We're experiencing some network problems upstream from RubyForge.

ruby-mode in emacs
178429 [h.dunnil@gm ] I'm new to emacs, just bought a book and started my way into it.
178437 [rubikitch@ru] Do you complete Ruby tokens like emacs-lisp?
179973 [jussij@ze se] FWIW the Zeus for Windows IDE provides seamless integration

178440 [uval@rz un -] irb(main):005:0* cnt=0
+ 178443 [rosco@ro co ] I've found that certain things like continuations don't work well under
+ 178445 [angus@qu va ] [Sch?le Daniel <uval@rz.uni-karlsruhe.de>, 2006-02-05 01.58 CET]

define_method with a &block?
178441 [pan@er kv en] In the code below, I want test2 to receive a block, like test1,
178455 [ara.t.howard] class Test
178459 [vjoel@pa h. ] module_eval do
178476 [pan@er kv en] The problem is that, in my situation, the name of the method
+ 178516 [ara.t.howard] i'm having a hard time imagining a case where only the name of the method
| 178536 [pan@er kv en] I've got a couple of cases where I want to wrap a method in a
+ 178541 [vjoel@pa h. ] class A

POP email with SSL
178447 [r.mark.volkm] Can someone point me to an example of reading email from a server
178451 [james_b@ne r] I *think* the ruby gmail library (see rubyforge, if it's up) does this.
178462 [linguist@gm ] ...
+ 178467 [sgentle@gm i] I was trying to do a similar thing a while back, and found someone
+ 328495 [poornima_dgl] I want to get my inbox messages from my account.i tried wit pop.i

[ANN] gonzui-emacs-0.3
178454 [rubikitch@ru] == Abstract

DBI::ADO and image (binary) types
178457 [Brondoman@gm] Anyone know how I can insert a binary file into an image field in SQL

178463 [kilivor@ho m] I have been using tar2rubyscript and rubyscript2exe with FXRuby and it
179676 [rubyforum@er] file = File.open(oldlocation("test.txt"), "w")

Continuations and GC
178466 [lerno@dr go ] I have problems getting things GC:ed properly when using

REXML::Parent#index does not return nil
178482 [noriyuki.tak] This is my first posting to ruby-talk.

Re: Indentation vs. "end"s [SPAM]
178490 [david@va ln ] The irony is UNBEARABLE, I tell ya...

Ruby feature request - enum.detect_index
178495 [j@Ti pe l. o] I'd like to propose a new addition to the enum module.
+ 178497 [levin@gr nd ] require 'enumerator'  [1,2,3,4,5,6].to_enum(:each_with_index).detect {|elem, index| elem== 4} #=> [4,3]
+ 178500 [matz@ru y- a] Nice idea.  I'd rather name it 'find_index' though.
| 178506 [bob.news@gm ] Don't we have that already?
| 178508 [james@gr yp ] You can not use a block of Ruby code to select the item you would
| 178514 [bob.news@gm ] Good point.  In that case I'd just change the implementation of #index to
+ 178503 [rosco@ro co ] For this case, this might work?
  178507 [matz@ru y- a] It does so in 1.9.
  + 178513 [rosco@ro co ] Cool, so it does :) I need to update my snapshot more often I guess ...
  + 178517 [j@Ti pe l. o] Ah! in that case my detect_index suggestion was rather unnecessary