280299-281123

280007-298494 subjects 280565-281424

Ruby hashes
280299 [alvaro.pmart] Is there a way in Ruby to pass a hash value from string (or whatever) to
+ 280301 [alex@bl ck e] {"school_name_A" => ["teacher_name_A"],
+ 280303 [sepp2k@go gl] hash = Hash.new {|h,k| h[k] = []}
  280304 [alvaro.pmart] Wow, exactly same solution ;)

[ANN] character-encodings 0.3.0 has been released!
280310 [nikolai.weib] This is an "unstable" release, but you should be able to replace 0.2.0

Checking whether a string is a number in disguise?
280316 [peter.bunyan] I'm working on an RPN calculator (don't ask why...) and I'm having
+ 280318 [stefano.croc] Do you mean you need to find out whether a string contains a number or not?In
| + 280322 [peter.bunyan] Is that the only way to do it? There's no built-in method for telling if
| | + 280324 [stefano.croc] As far as I know, no.
| | + 280337 [ryand-ruby@z] Strings are never numbers in ruby. Ever. That is the beauty of working
| + 280359 [raulparolari] a) the 'dot' should be literally a dot (else it matches any character)
|   280372 [lloyd@2l ve ] I do not think you can unless you can assume that it is base 10 or less.
+ 280327 [shortcutter@] str = gets # chomp is not needed for Float
  280336 [peter.bunyan] class String
  280353 [shortcutter@] That's an error prone approach because it relies on comparing floats

Class Methods from Modules
280319 [lists@gr gw ] Can't see the tree for the forest.
+ 280331 [rubytraining] Well the methods you can call *as* a class is being defined are
| 280333 [lists@gr gw ] The exercise is to figure how to make initialize_colors work as a class
| 280344 [lists@gr gw ] I found class << self, but still here's an even simpler example that
+ 280365 [phrogz@ma .c] Including a module in a class causes instance methods of the module to
  280370 [lists@gr gw ] Cool, thanks. But...
  280378 [lists@gr gw ] OK, nevermind -- I get it now.

unsuscribe
280329 [pablohar@ho ] eigenvectors in Ruby ???)

Regexps and HTML comments
280338 [jari.william] I have troubles with the regexp to get HTML comments ("<!-- some text
+ 280339 [dandiebolt@y] ...
+ 280340 [dandiebolt@y] ...
+ 280341 [lists@gr gw ] result = s.match(/\<!--([\s\S]*?)--\>/)

Iterate through Array?
280345 [ztz@nx r. rg] I've been messing around with generating all possible combinations of a
+ 280346 [sepp2k@go gl] ("aaaaaa".."zzzzzz").each do |string|
| + 280347 [wieczo.yo@go] You might also try the Permutations gem at http://permutation.rubyforge.org/
| | 280348 [dandiebolt@y] ...
| + 280352 [ztz@nx r. rg] Impressive, Signifigantly less RAM usage.
+ 280371 [lloyd@2l ve ] What about something as simple as

Calling and passing blocks in a C extension
280349 [andre@di ir ] How do I do the equivalent of the code below in a C extension?
280419 [andre@di ir ] I've just noticed it works in ruby 1.9 but segfaults in 1.8.6... Can
280427 [andre@di ir ] Guy Decoux pointed me my stupid mistake...

Call overwritten method of included module?
280356 [forum@jo h. ] module MyModule
+ 280360 [m_goldberg@a] <code>
+ 280361 [daniels@pr n] class MyClass
  280401 [forum@jo h. ] Thanks! Especially for the alias_method_chain hint! :-)

Processing-like application in Ruby?
280358 [paulo.schnei] I was wondering if anyone knows any application/framework/stuff
280384 [psi@y0 u. et] I'm not aware of anything quite like Processing that's native to Ruby,

operators in ruby
280366 [martin@an le] How to use logical operators in ruby?
+ 280368 [yermej@gm il] ...
+ 280369 [codemonkey@n] It's just a matter of preference, use english or C-style symbols. The C-Stye
+ 280374 [phrogz@ma .c] Martin, please read a primer on Ruby and Java before posting all your

Ruby to Perl translation
280377 [gongchengshi] I love the flexibility of writing scripts in Ruby but my work doesn't
+ 280383 [eeklund@gm i] Actually, such a translator would have to be a full compiler, I think.
+ 280429 [adrianh@qu e] Why (he asks curiously)? Any way of addressing that problem directly?
  280442 [lists@so rc ] As long as we're wishing, it'd be nice to have it the other way
  + 280488 [AEtzold@gm .] Is it true that Perl is written completely in C as Ruby is ?
  | 280532 [znmeb@ce ma ] You're being sarcastic, right?
  | 280536 [AEtzold@gm .] Dear Ed,
  | 280570 [AEtzold@gm .] Dear Ed,
  | + 280629 [ryand-ruby@z] Soooo... you're NOT being sarcastic?
  | | 280675 [AEtzold@gm .] Dear Ryan,
  | + 280685 [adrianh@qu e] It's never really worked as far as I am aware. I've a vague
  + 280683 [adrianh@qu e] The thing is that these sorts of automated conversion tools nearly

[ANN] Instant Rails replaced by the BitNami RubyStack
280380 [curt.hibbs@g] ...

New at regexp and Ruby need help on parsing a string.
280382 [granasen@gm ] I'm building a little test console for a ruby project. When using a
+ 280396 [bbxx789_05ss] str = 'and stuff and nice things not bad girls not greasy boys
| 280398 [bbxx789_05ss] str = 'aXbXc'
+ 280397 [raulparolari] smoking_table = { :and => [], :not => [] }
  + 280411 [granasen@gm ] I think Raul just convinced me that I really need to start a deep
  | + 280466 [bbxx789_05ss] Don't be fooled by one liners.  Ruby syntax allows you to string
  | + 280470 [raulparolari] I totally agree with you; this is not a subject that you learn 'just
  |   280472 [raulparolari] When I typed the final solution, an unwanted '}' got in. I post again
  + 280437 [bostonantifa] Raul,
    280593 [RichardDummy] On Nov 23, 10:29 am, Peter Vanderhaden <bostonanti...@yahoo.com>

How to free an unused object forcefully?
280392 [ochronus@gm ] I have a script which serves as a cache, storing "large" (around

Checking File for a line
280393 [loftuz@gm il] Need to check a file for a line
280399 [jarvo88@gm i] File.readlines('file.txt.).each do |line|
280400 [shortcutter@] This is more efficient - no need to load the whole file into mem to
+ 280406 [dejan.dimic@] Check out
| 280460 [shortcutter@] I am not sure I understand this posting of yours.  Are you talking to
+ 280474 [jarvo88@gm i] Ahh, good point, touche my good man.
  280530 [shortcutter@] require 'enumerator'
  280684 [dejan.dimic@] That's Ruby beauty, express yourself in a way that suits you the most
  280694 [bbxx789_05ss] Speak for yourself.  I found that solution particularly distasteful.  It

Two arrays: return only values that exist in both arrays?
280403 [forum@jo h. ] a = [:one, :two, :three, :six]
280408 [dejan.dimic@] Try
280410 [victor.reyes] ...
280414 [garret.kelly] You're looking for "a - b", in that case.
280425 [victor.reyes] ...
280478 [dejan.dimic@] Programming Ruby

Problem getting user input
280405 [bostonantifa] $stdout.print "Do you want to change something else? (y/n): "
+ 280452 [m_goldberg@a] I can not reproduce your problem. When I run
+ 280458 [sepp2k@go gl] I see in your script that ARGV is not empty. That means Kernel#gets is
  280475 [bostonantifa] Sebastian,
  + 280490 [m_goldberg@a] 45       @ARGV = $*   # list of arguments passed to the script
  + 280634 [jeremy@hi eg] If you do write many scripts that require prompting for user input, you

'gem update' making wrong choice
280407 [michel@de az] I work on a Win box, without compiler.
280451 [luislavena@g] I don't think understand your problem.
280453 [michel@de az] @Luis
+ 280457 [michel@de az] - RUBYGEMS VERSION: 0.9.5 (0.9.5)
+ 280479 [luislavena@g] Yes Michel, this was reported and solved for gems marked as 'mswin32'
  + 280483 [michel@de az] Thanks a lot, Luis. I tried the "correct" form --platform x86-win32-60
  | 281123 [drbrain@se m] $ gem help platforms
  + 281121 [drbrain@se m] Gems with string platforms can no longer be built on 0.9.5.  The

read a xml file
280412 [mihai.bulhac] <drive name="c">
+ 280417 [marick@vi ib] I'd use xml-simple.
| 280418 [mihai.bulhac] but i want to read that structure of file; i did try with rexml and i
+ 280428 [hutch@re ur ] You're going to have to work out which 'parser' you want to use. I
+ 280468 [phrogz@ma .c] Note that I had to fix your XML - you were missing a closing tag for
+ 280471 [phrogz@ma .c] Note that if your XML is properly indented already, you don't even

Re: Two arrays: return only values that exist in both arrays
280413 [forum@jo h. ] Thanks! But right - where are they documented?
+ 280415 [mailing.mr@g] in ruby-doc :)
+ 280416 [garret.kelly] ...

Working with regular expressions and "$"?
280421 [forum@jo h. ] I remember to have read somewhere that the matching results of a regular
280433 [rubytraining] If you have the 2nd edition of the pick-axe book, in chapter 22,
+ 280435 [jan.svitok@g] ...
+ 280436 [forum@jo h. ] Thanks a lot :-)

ODBC and Ruby
280422 [    me@me it] db, in tbles with thousand records my program always retruns no rows,
280444 [gerardo.sant] May I suggest you to try the Informix extension instead?
280455 [quadrilor@ma] Is not so easy, I'm using Macosx and I don' have informix sdk for it
280463 [gerardo.sant] I see.
280482 [quadrilor@ma] Yes, but querying the table, the rs seems to be empty, ruby give me

Searching for the C-Method which is invoked by any (ruby) methodcall
280423 [saladin.mund] ...
280710 [saladin.mund] *push*

corresponding C-method for setting and changing a local or global variable
280426 [saladin.mund] ...
+ 280506 [TimHunter@nc] Define a global variable with rb_define_variable. Set and get the
+ 280711 [saladin.mund] *push*

chomp - works in irb, not in program
280443 [bostonantifa] private method `chomp' called for nil:NilClass (NoMethodError)
+ 280445 [sepp2k@go gl] You can't get user input with chomp. The only thing you get from chomp is a
| 280473 [bostonantifa] Sebastian,
+ 280446 [douglas@be r] How are you using it in the program?  Are you using gets.chomp?  Can you
  280447 [bostonantifa] Douglas,
  280448 [bostonantifa] I forgot to mention that the puts command outputs the prompt to the
  + 280456 [sepp2k@go gl] Are you by any chance running the script with any command line arguments?
  + 280461 [douglas@be r] Yes, as you imply, it's an issue with gets, not with chomp.  The method
    280462 [sepp2k@go gl] gets is reading from the file, that's been passed as a command line argument,

Class variable as parameter
280487 [filipedlarca] class MyClass
+ 280492 [m_goldberg@a] Your call to setVar can not change the value of an variable. Only
| + 280500 [filipedlarca] The key point is that the setVar method is supposed to do a couple
| | 280505 [m_goldberg@a] That was a bad idea, since it made it impossible for anyone to
| | 280657 [chiology@gm ] class MyClass
| | 280715 [filipedlarca] I would still have to writer a myVar=(value) method for every single
| | 280736 [bermonruf@gm] ...
| + 280501 [bbxx789_05ss] class MyClass
+ 280502 [bbxx789_05ss] def initialize

REXML: Raw tags in element text?
280489 [jari.william] In REXML, is it possible to add raw tags to element text, without having
280509 [phrogz@ma .c] On Nov 23, 2:26 pm, Jari Williamsson
280525 [jari.william] Yes, this is what I want.
280531 [shortcutter@] I believe you can do it (i.e. add raw tags to text) BUT they will not
280557 [jari.william] string, parses it and passes all nodes to the parent element. Here's the

Parsing nested JSON data
280503 [marko.anasta] I didn't find a mailing list dedicated to ruby-json, so I assume that
+ 280508 [bbxx789_05ss] #the value that t points to is stored in your 'value' variable
| 280517 [bbxx789_05ss] Whoops.  Never mind.  I'm not even sure why anyone would use the
| 280527 [bbxx789_05ss] require 'rubygems'
| 280537 [marko.anasta] Thanks a lot 7stud. I didn't realize that each val (as in your last
+ 280515 [transfire@gm] 7stud probably covered your question, so if you don't mind I'd like to

Iterating through class names using a block
280521 [boomstik@gm ] Hey all,
+ 280522 [phrogz@ma .c] Search the archives (this is not just a forum on a website, but a
| + 280523 [phrogz@ma .c] Oh, and...welcome to Ruby :)
| + 280617 [boomstik@gm ] Yep, i'm getting to this list via ruby-forum.com... However i did
| + 280639 [boomstik@gm ] This worked beautifully! love the solution.
+ 280529 [bbxx789_05ss] ['some_item', 'other_item'].each do |this_array|
+ 280573 [dusty.doris@] Something like this will work.
| 280574 [dusty.doris@] Sorry, forgot to instantiate the objects.  Should have been.
| 280585 [boomstik@gm ] foo = [1foo, 2foo, 3foo]
| + 280587 [boomstik@gm ] btw, i do have to admit that i have no clear idea of why eval() works
| | 280612 [bbxx789_05ss] Just a thought:  Are you under the impression that if you specify a
| + 280590 [bbxx789_05ss] You didn't learn your lessons very well.  Look up what the method to_s
|   280615 [boomstik@gm ] You're right, no sense to use it there - it was a leftover from my
+ 280591 [bbxx789_05ss] By the way, are you aware that your arrays can contain the class objects

Hashes, Sets, and eql?
280524 [aaron@te de ] Hey everyone!
280526 [MonkeeSage@g] Set#eql? is probably just Object#eql?, which, as I understand it would
280528 [aaron@te de ] Nope.  I don't want a shallow comparison.  I need to use my sets as hash
280539 [MonkeeSage@g] On Nov 24, 1:25 am, Aaron Patterson <aa...@tenderlovemaking.com>
280552 [phrogz@ma .c] irb(main):001:0> a1 = [:a,1,'foo']
+ 280566 [MonkeeSage@g] Point taken. But still should not be relied on.
+ 280579 [aaron@te de ] Yes.  I guess my point is this: given the behavior of eql? and hash on

Access modifier : private
280534 [dharmarth@gm] I'm missing some core ruby concept here that I just can't figure out;
280535 [stefano.croc] First of all, private only works for instance methods, not for variables,
280540 [dharmarth@gm] Thanks a lot Stefano! That was really helpful.
280553 [phrogz@ma .c] Instead of using class level variables, use instance variables of the

Extending to an existing case menu
280538 [shevegen@li ] user_input = $stdin.gets.chomp
280555 [phrogz@ma .c] The simplest, most elegant way, would be to just type it into the same

Convert words to numbers and back?
280542 [jordon@en yg] I was wondering if somebody could give me some insight and help on how
+ 280543 [andrei@an re] ...
| 280544 [saladin.mund] I don't know exactly what you mean.
| 280545 [andrei@an re] ...
| 280548 [shortcutter@] I could also imagine that the OP wants conversion of char sequences to
| 280549 [andrei@an re] ...
| 280559 [shortcutter@] You are not the OP.
| 280596 [andrei@an re] ...
+ 280631 [jordon@en yg] What I need to do is convert "22/11/2007" to
  280668 [phrogz@ma .c] The reverse would make a fun problem to solve, too.

populate select with first_name & last_name
280550 [scott@sc tt ] Hey,
280563 [phrogz@ma .c] Try asking this question on the Rails (web framework) group, not the

identification of VALUE recv
280551 [saladin.mund] ...
280628 [ryand-ruby@z] On Nov 24, 2007, at 06:33 , <saladin.mundi@gmx.de>

will there be ability to use both native and green threads in Ruby 1.9/2.0
280554 [artem.vorozt] Does anybody know will there be support for both native and green

Obtaining ip address of client socket in ruby
280558 [victorrosill] How can I obtain the ip address of the originating (client) socket ,
280560 [shortcutter@] robert
280575 [billk@ct .c ] sock_domain, remote_port, remote_hostname, remote_ip = socket.peeraddr

[ANN] RubyCocoa 0.13.0
280561 [laurent.sans] I am honored to announce the immediate release of RubyCocoa 0.13.0.

newbie question - Problems in installing rails
280562 [ngabrani@gm ] 0.9.2
280567 [yizhih@gm il] Are you bebind a fire wall?

RSpec installation problems
280564 [coreyhaines@] All,
threads.html
top