300351-301333

300157-318868 subjects 300569-301509

^ Strings
300351 [jason.lillyw] Could someone help me convert a string with a number in it such as "26.7
300352 [dblack rubyp] string[/\w+$/] would give you "feet". A lot depends on how you define

^ strip method
300353 [adam masiare] s = <<EOS
+ 300354 [adam masiare] This works fine ...
+ 300356 [rick.denatal] k$ qri String#strip
+ 300357 [dblack rubyp] Your expectation :-) Sorry, I couldn't resist.
+ 300360 [w_a_x_man ya] a1\t     b1
  300466 [gthiesfeld g] Or split on whitespace instead of on tabs alone.

^ The definitive list of ||= (OR Equal) threads and pages
300370 [twscannell g] Since you can't search google groups for ||=. I have put this thread

^ Method lookup from a Lambda
300373 [john john-co] I am not sure if my question is relatively obvious or instead arcane.
300483 [sean.ohalpin] [snip code]
301325 [john john-co] Is there a way to pass arguments to &grunt during the invocation?  The
301333 [sean.ohalpin] You need instance_exec, which is native in 1.9 but has to be

^ couldn't manage cisco switch interface using Ruby snmp
300374 [toxicodecorp] I'm just created script to shutdown and bring up cisco switch interface

^ [ANN] Rassmalog 11.0.0
300375 [ snk gna.org] Rassmalog
300418 [ snk gna.org] Version 11.0.1

^ Extracting a value from an array
300384 [albertschlef] headers = [
+ 300387 [jan.svitok g] headers.select {|header| header[:name] == 'content-length'}.first[:value]
+ 300388 [sandro.pagan] (headers.select{ |h| h[:name] == 'content-length' }.first)[:value]
| 300390 [bbxx789_05ss] That seems pretty typical of ruby programmers: cram everything into one
| + 300395 [celtic sairy] It's still done in a very neat fashion, and the one that makes the most
| | 300405 [james graypr] Well, the find() iterator makes the most sense, I would say.
| | 300410 [albertschlef] Thanks you all for these snippets.
| | + 300411 [albertschlef] A typo. I meant "((some_expression).first || {})[:value]".
| | + 300414 [luc honk-hon] content_type_header = lambda { |h| h[:name] == 'content-type' }
| |   300415 [luc honk-hon] Or, since you can pass a proc to the find method which gets called
| |   300423 [albertschlef] (HTTP servers may return several headers having the same name, so I
| |   + 300429 [luc honk-hon] Because "there's more than one way to do it" :)
| |   + 300430 [luc honk-hon] headers = {
| + 300398 [caduceass gm] It looks a lot cleaner to me than using 'break'.
+ 300389 [bbxx789_05ss] headers = [
+ 300417 [overlord gmx] why not use a Hash?
  300477 [ibc aliax.ne] Maybe because in some text protocol (as HTTP or SIP) there can be some head=
  300487 [overlord gmx] Yeah, maybe, or maybe not. That's why I ask.

^ Re: using net::ssh shell to sudo to another user and execute
300393 [james islets] I have got the shell to work, I would like to know if its possible to

^ Repeated parameter in the INI file
300397 [agnibhu gmai] I, trying to make a configuration file system with ruby.
300647 [shortcutter ] Now, what was the question again?  Was there any?  I cannot find one.

^ Adapter: JDBC Oracle
300399 [johnaby1 red] Im trying to migrate the AR script on to Oracle database. Im using jdbc

^ Beginner Question on Ruby
300400 [arunnandu gm] I am beginning to learn ruby and cant seem to reason this behaviour. I
300401 [dblack rubyp] You're inserting an array into itself. Ruby represents that kind of
300402 [arunnandu gm] Thanks for the answer.
300403 [dblack rubyp] You can't add 10 to nil. You'll get an error if you try to do that,
300404 [arunnandu gm] And now i do :) thanks.

^ | versus || Any reason for this issue?
300416 [ibc aliax.ne] SGksIHdoeSBpbiB0aGUgc2Vjb25kIGNhc2UgdGhlIG5vbiBkZWNsYXJlZCAibXlfdmFyIiB2YXJp
+ 300419 [dblack rubyp] This message is in MIME format.  The first part should be readable text,
+ 300420 [flo andersgr] to evaluate both Operands while the value of a logical OR (||) is =20
| 300426 [shortcutter ] This is only mostly correct.  Semantics of | depend on the class that=20
+ 300422 [shortcutter ] Because || does short circuit while | does not.
  300424 [ibc aliax.ne] MjAwOC81LzIsIFJvYmVydCBLbGVtbWUgPHNob3J0Y3V0dGVyQGdvb2dsZW1haWwuY29tPjoKPiBP

^ [QUIZ] Reverse Divisible Numbers (#161)
300431 [matthew.moss] This is a fairly simple quiz this week, as I'm in the middle of
+ 300435 [kbloom gmail] 1089 * 9 = 9801
| 300439 [Rob AgileCon] 2178 * 4 = 8712
| + 300445 [semmons99 gm] ptime 1.0 for Win32, Freeware - http://www.pc-tools.net/
| + 300467 [kbloom gmail] I did it in a *really* stupid way for my first pass. That's all.
| + 300498 [shortcutter ] robert@fussel /cygdrive/c/Temp
|   300604 [shortcutter ] robert@fussel /cygdrive/c/Temp
+ 300610 [kbloom gmail] Everyone's posted benchmarks, but nobody's posted code yet. It's been
| 300614 [sandro.pagan] MAXNUM = (( ARGV[0].to_i == 0 ) ? 1000000 : ARGV[0].to_i)
+ 300736 [list.push gm] Here is my solution.
+ 301251 [list.push gm] Now *I think* the patterns are complete so it is a complete solution.

^ something straange with cgi
300432 [unbewusst.se] i have a cgi reading a post cgi['search']
+ 300434 [decoux moulo] Try with
| 300540 [unbewusst.se] OK, thanks !
+ 300480 [ged FaerieMU] This is done to protect you from using unsafe input from untrusted =20
  300542 [unbewusst.se] Fine, thanks for the refs.

^ Ruby 1.9 wishlist
300437 [coderrr.cont] Hey I just put together a list of stuff I totally wish Ruby had and I
+ 300440 [ snk gna.org] IMHO a C-style single-line if statement is more trouble than it's worth.
| 300449 [coderrr.cont] I don't care to use the single line if as we already have that (just in
| 300454 [ snk gna.org] In fact, an if statement in Ruby is nothing more than shell-style
| 300458 [rick.denatal] Not quite
+ 300441 [kbloom gmail] I'd like this too.
| + 300447 [jameskilton ] #1: makes sense. You can do that with regular methods, but not blocks?
| | 300452 [coderrr.cont] Hrm I had a feeling this one might be controversial.  I never had an issue
| + 300453 [coderrr.cont] Are you sure?  While loops already require "semantically significant
|   300469 [kbloom gmail] You've got an end on the end of that while loop that you didn't have for
|   300482 [shevegen lin] I can understand this partially. If one wants to fit in ~80 chars /
|   300577 [kbloom gmail] Python's whitespace isn't the dealbeaker for me about that langage. It's
|   300659 [coderrr.cont] So it sounds like everyone is pretty much in agreement on #1, having
+ 300463 [onepoint sta] I usually find I can do  this fairly neatly by breaking the line after
| 300464 [coderrr.cont] Yea, I'm aware you can do this but I find it extremely ugly and hard to
+ 300494 [cmdicely gma] I agree.

^ Re: RMagick 2.3.0
300438 [david.scheff] Thanks for the great work!
300479 [TimHunter nc] You're welcome!
+ 300481 [shevegen lin] And one that has an astounding quality (especially considering usable
| 300484 [TimHunter nc] (Blush!) That's my Friday "paycheck".
+ 300500 [david.scheff] I know that and I greatly appreciate it.
  + 300503 [cmdjackryan ] Which means that the GraphicsMagick folks are too lazy to fix critical bugs.
  | 300518 [david.scheff] Well, I've just checked. In "testing" stage the package version of
  | 300525 [cmdjackryan ] That, and Debian is rather.. slow when incorporating fixed packages
  | 300529 [david.scheff] My server doesn't need a rich UI, thanks *g*
  + 300544 [TimHunter nc] The ImageMagick forum is at http://www.imagemagick.org/discourse-server/

^ Re: Reverse Divisible Numbers (#161)
300443 [matthew.moss] Change the upper limit. In addition to one million, try one thousand,
300444 [matthew.moss] One of the interesting things I found is that those are all divisible
+ 300450 [micathom gma] Pah!
| 300486 [marcelo.maga] $ time reverse_divisible 2_000_000
| 300492 [micathom gma] Yes, much-too-clever version 1 doesn't scale. Anyway, I still suspect
| 300496 [micathom gma] I probably don't have the time to prove my mtc2 works correctly. So I
| 300580 [list.push gm] So far I have
| 300597 [marcelo.maga] $ time ./reverse_divisible 10_000_000_000_000_000
| + 300598 [semmons99 gm] class Integer
| | 300599 [micathom gma] Here are two most likely non-working non-solutions that rely on
| + 300606 [marcelo.maga] The proof I'm stuck on is that numbers with this property are divisible
|   300630 [micathom gma] An observation: it seems that any reverse divisble number (we found so
|   300662 [marcelo.maga] 10989 98901
|   300676 [micathom gma] I didn't mean "derive" in a mathematical sense. I rather had something
|   300818 [micathom gma] Ok, I had some free time. The enclosed solution still finds less
+ 300456 [matthew.moss] Actually, I just did a quick-n-dirty proof to myself that this is
+ 300460 [martindemell] Let the numbers be x = a....c and y = c....a
  + 300465 [semmons99 gm] With that info, I was able to get the code to run under 1 sec.
  + 300468 [kbloom gmail] I think this may fall into the category of a spoiler.
    + 300471 [matthew.moss] real    0m0.338s
    + 300472 [matthew.moss] Perhaps... though for most folks, they'll still have to write the Ruby

^ How to search words starting with a particular char?
300448 [toki84 gmail] I need to search how many words are starting with a specific character
300459 [micathom gma] A word border can be matched with \b.
300475 [toki84 gmail] Thanks a lot for the helpful and fast answer.

^ many attributes, same behavior
300457 [pwinward lbl] I have a growing list of readable attributes that all essentially do the
300462 [james.britt ] Have you tried writing your own versions of attr_reader and attr_writer?

^ HTTPClient download binary file
300473 [banditgsf600] I'm writing a simple program which downloads a resource from the
300485 [phasis gmail] my_file = File.new("x:\\temp\\logo2.gif", "wb")
300489 [banditgsf600] Thanks works ok now. Since the b parameter is DOS\Windows only, would

^ Re: issue running watir on 64 bit winxp
300474 [debuke gmail] [BUG] Segme
300478 [luislavena g] That is xp sp2 32bits, or what?

^ How to access to an Array element without doing "find" each time
300476 [ibc aliax.ne] =2D------------------------------------
+ 300488 [phasis gmail] class Message
+ 300490 [dblack rubyp] This message is in MIME format.  The first part should be readable text,
  300501 [ibc aliax.ne] or
  300513 [dblack rubyp] This message is in MIME format.  The first part should be readable text,
  300514 [ibc aliax.ne] Great !!!

^ Ruby Hash/Array to_yaml is slow
300495 [sgwong513 ho] I try to convert a ruby array(contains hash and array) to yaml and it
300559 [ryand-ruby z] if it is, this isn't the right forum to report it. File a bug on

^ workings of the freaky freaky sandbox
300497 [ngrandy gmai] a couple questions directed towards a greater understanding of the

^ Re: Accessing Windows actions(Shutdow.Restart)
300502 [jazzezravi g] I got simple solution. But need t sharp it.
+ 300505 [dezertir pos] I tried your code and all OK!
| 300506 [jazzezravi g] i did this already. But need to get in a single variable. I think it is
| + 300508 [gthiesfeld g] => "\r\nWindows IP Configuration\r\n\r\n\r\nEthernet adapter Wireless
| + 300509 [shevegen lin] a = `ipconfig`
| + 300510 [dezertir pos] var = system('ipconfig')
+ 300507 [phasis gmail] a = `ipconfig`
  300511 [jazzezravi g] Fantastic idea from u. Thank a lot.
  300512 [jazzezravi g] Previously i am used 'ipconfig' --> It should be `ipconfig`

^ regarding MS Office properties
300504 [pranjal.jain] If we want to open the outlook & write in it , we use the command

^ a ? b : c
300515 [dezertir pos] please explain, what is it? what he is doing?
+ 300516 [sepp2k googl] if a then
| 300519 [dezertir pos] Posted via http://www.ruby-forum.com/.
+ 300517 [caduceass gm] x = 6 # assignment
| 300520 [dezertir pos] Posted via http://www.ruby-forum.com/.
+ 300521 [ttmrichter g] irb(main):001:0> x =3D 6
  + 300522 [dezertir pos] Yes thanks. I get it.
  + 300523 [caduceass gm] Absolutely silly way if all things are constant (just for fun :) ...
    300524 [dezertir pos] And I have 1 question.
    + 300526 [sepp2k googl] For strings and regexen it is defined to return the position at which the
    + 300527 [cmdjackryan ] I strongly suggest you avail yourself of a copy of Programming Ruby (and
    | 300567 [greenewm yah] On May 3, 10:42 am, Phillip Gawlowski <cmdjackr...@googlemail.com>
    + 300528 [ttmrichter g] Regular expression matching.

^ Ruby mentoring
300530 [ttmrichter g] Luka luka's recent messages here to the list have made me note
+ 300531 [dblack rubyp] I'll bet you'll get at least a dozen answers to this one :-)
+ 300532 [ibc aliax.ne] Doesn't it break the concept of a maillist? this is: public questions and=20
+ 300533 [hassan.schro] I rarely post questions, just monitor the list to learn.  Seeing multiple
+ 300536 [cmdjackryan ] - --
+ 300761 [eeklund gmai] I think the problem is that people won't know when they're good

^ Backreferences in case statements
300537 [loveajax gma] I am not sure if this is possible. I have a case statement which
+ 300539 [ara.t.howard] $1, $2, etc.
+ 300579 [shortcutter ] $ irb
| 300591 [loveajax gma] Hey Robert,
| 300608 [shortcutter ] That's complete nonsense.  Did you try it out?  I guess not.  Come on,
+ 300582 [pit.capitain] Subbu, there's also Regexp.last_match. Sometimes this reads better
  300592 [loveajax gma] I did use Regexp.last_match. But its a class method. I am interested
  + 300596 [dblack rubyp] This message is in MIME format.  The first part should be readable text,
  | 300620 [rick.denatal] And $~ is actually a thread local global, so it holds the matchdata
  | 300631 [dblack rubyp] I believe it just returns $~, so it should be identical in terms of
  + 300601 [james graypr] Regexp.last_match.pre_match

^ What to cover for a TDD and BDD toolkit/course?
300538 [cmdjackryan ] I've volunteered to create a new course for Satish Talim's rubylearning.org.
+ 300568 [w.wilfinger ] Something about ZenTest / autotest?  I've never had autotest set-up
+ 300660 [eeklund gmai] What I see as important - more important than training people in the

^ Why there is not "replace" method for Fixnum?
300545 [ibc aliax.ne] =20
+ 300546 [sepp2k googl] a =3D 5
| 300547 [ibc aliax.ne] re.
+ 300548 [gerardo.sant] or
+ 300550 [rick.denatal] or
  300552 [ibc aliax.ne] I hope explanations like this would appear in some Ruby manual and so :)
  300553 [gerardo.sant] "Fixnum objects have immediate value. This means that when they are
  300554 [ibc aliax.ne] o :)
  300555 [rick.denatal] o :)
  300557 [ibc aliax.ne] s-

^ Error compiling ruby under AIX 5.3 with GCC during the make phase
300549 [victor.reyes] Team,
300551 [gerardo.sant] I haven't used AIX yet, but here's the clue. You need to install the
300556 [victor.reyes] Gerardo, thank you for the info. However, I am having heck of a time
300563 [gerardo.sant] where you can find how to install GCC on AIX. There's even a link to a

^ Matrix-element extractor -- How to define it
300558 [RichardDummy] I defined and populated a 9x9 matrix (Array of Arrays) of strings, m
300566 [dan danfinni] class Array
300612 [RichardDummy] Thanks for the "kick start" and the Matrix class.  I got the latter
+ 300613 [RichardDummy] On May 4, 4:38 pm, RichardOnRails
+ 300615 [dan danfinni] I'm glad super worked out for you.  That's the "right way" to do it
  300626 [RichardDummy] Thanks for your additional response.

^ Ruby Class documentation
300560 [banditgsf600] I noticed that when I save an internet resource to my local disk, ruby
+ 300561 [TimHunter nc] File gets close from its parent IO. On the page you linked to, the
+ 300562 [jan.svitok g] In the upper lefthand corner there is Parent: IO, and IO is a
  300565 [banditgsf600] Thanks, I probably missed that because it doesn't look like something
  300664 [d_rems yahoo] And can become an oneliner.

^ FTP and/or RIO (module) connection problem
300564 [apenny umd.u] uses the module RIO to actually copy it to the HD. And every random
threads.html
top