356812-359462 subjects 357202-376433

How to change stdin separator (perl vs ruby)
357001 [sak@pr xe to] I have to process very very big text files and not line per line, I have
+ 357002 [perfectly.no] STDIN.each_line("%") { |line|
| 357007 [sak@pr xe to] Thanks Stefan for the answer, that's exactly what I need, thanks Xavier
+ 357003 [fxn@ha hr f.] Ruby has also $/ among its global variables. The methods #gets and
+ 357004 [ruby@sl gh l] File.open(path_to_file, 'r') do |f|
  357006 [shortcutter@] Note that this statement is true for \n as well!

Hurry Up Now, Free Check Of $327 With Your Name.
357008 [m.76ahesh@gm] Hurry Up, Free Check Of $327 With Your Name.

difference between [] and Array[]
357021 [am@ar bo .d ] all the time i thought [] would be a shortcut for the corresponding
+ 357024 [shortcutter@] You defined Array#[] and nothing else.
+ 357027 [ryand-ruby@z] no. [1, 2, 3] is an array literal and part of the syntax. It does not =

ruby cross-platform File.basename
357023 [jtprince@gm ] What is the best idiom for generating a cross-platform basename?
+ 357025 [shortcutter@] What's wrong with using File.basename?
| 357028 [jtprince@gm ] File.basename("C:\\path\\to\\file.txt")  # -> gives: "C:\\path\\to\
| 357072 [shortcutter@] Well, File.basename will work properly on a Windows system.  Do you
+ 357029 [marnen@ma ne] No it doesn't.  The problem is that there is no easy way to tell what OS
  357031 [s.korteling@] No,  a / is not a valid filename character. None of these characters are
  357032 [marnen@ma ne] Thanks for the correction.  However, \ *is* a valid filename character

Exit method?
357030 [artemisc360@] I am new to programming and am writing a program in ruby that serves as
357033 [marnen@ma ne] If you need to ask the mailing list a question like this, then you are
+ 357034 [artemisc360@] Thanks for the encouragement. I guess I should stick to 'Hello World'
| 357041 [ehsanul_g3@h] =20
+ 357035 [echristopher] That's a little harsh, although it would probably be true if the
| + 357036 [marnen@ma ne] Oh, if that's the case, then yes, my response was uncalled-for.  I did
| | 357089 [shortcutter@] "I am [...] writing a program in ruby that serves as a tutorial for
| | 357099 [marnen@ma ne] Yeah, I thought so too -- und ich bin Englischmuttersprachler.
| | 357107 [masonkelsey@] Harsh and shock tactics seem to be universal solutions for problems that
| | 357112 [marnen@ma ne] The problem appeared to exist.  Nothing is to be gained from mincing
| | 357115 [usenet-nospa] If the goal is to cause someone's behavior to change, politeness is
| | 357117 [marnen@ma ne] Agreed.  And I really don't think I was impolite.
| | 357120 [usenet-nospa] It came across as more confrontational, but that is in practice easier
| | 357125 [marnen@ma ne] OK, how would you have put it?
| | 357126 [usenet-nospa] That's a good question, and I don't remember enough of the initial context
| + 357770 [echristopher] Sorry to resurrect this, but I've had second thoughts. Are
|   357785 [shortcutter@] robert@fussel:~$ ruby19 -e 'p File.method(:foreach)'
|   357795 [b.candler@po] A similar concept you can use is module_function, which can be used as
+ 357134 [josh.cheek@g] I'm not sure that this is true. Sometimes, when the person writing the
  + 357138 [marnen@ma ne] Quite true.  I certainly didn't know the answer off the top of my head
  + 357140 [usenet-nospa] The problem is that the newbies will often figure things out *incorrectly*,
    + 357146 [marnen@ma ne] Yes indeed!  And skilled newcomers could play an important role here.
    + 357148 [albertschlef] He said we was going to *write* a tutorial. This doesn't necessarily

Re: difference between
357037 [albertschlef] I don't think so. Array() is a method of the Kernel module. So, I think,
+ 357038 [xenogenesis@] Array([1,2,3]) calls the Array kernel method on the Array created by [1,
| + 357039 [xenogenesis@] ffffff passes the Array created by [1, 2, 3] to the Array method of
| + 357040 [albertschlef] Right. Thanks for correcting me.
+ 357049 [ryand-ruby@z] think,=20
  357078 [am@ar bo .d ] thanx so far, nice trick Ryan to see the difference

trouble using blowfish
357042 [lathty@gm il] ruby version: ruby 1.9.1p243
357045 [justincollin] The gem you are using apparently has not been updated to work with Ruby 1.9.
357046 [lathty@gm il] Thank you for your advise. That did the trick.

fastest readline method
357044 [kvetch@gm il] I have a script that parses a bunch of data off the wire and pipes it
357082 [shortcutter@] File.foreach file_name do |line|

Test script
357050 [twaynz@ho ma] I am new to ruby and scripting.
+ 357054 [justincollin] First, pick a testing framework and set up your tests. If you have
+ 357056 [jazzezravi@g] Already ruby has framework named as Test::Unit.
  357057 [twaynz@ho ma] I have used Test:Unit and the assert_equal function, but I am just able
  357104 [richard.conr] What you are attempting to do here is an acceptance test, not a unit test.
  357109 [twaynz@ho ma] Yes I know, but I need to call my program with different arguments
  + 357116 [justincollin] You can use backticks (``) to call your program and return the output as
  + 357119 [richard.conr] Well thats what I thought I said - you invoke the shell from within your

Call for Paper The International Journal of Computer Science (IJCS)
357051 [ijcsorgedito] Call for Paper

Need help with Code (Input Functionality)
357052 [mikejoebro@y] puts 'What is your name?'
+ 357055 [jazzezravi@g] Did you heard about chomp method earlier?
+ 357058 [usenet-nospa] Hmm, that's odd.  My quick trial produces the "expected" output.
| + 357059 [justincollin] Really? Because you shouldn't be (unless we have a different idea of
| | 357064 [usenet-nospa] I was expecting to see output from all of them, but if I understood the
| + 357061 [jazzezravi@g] The exact solution for above(first post) issue
|   357083 [jgabrielygal] puts 'What is your name?'
|   357101 [marnen@ma ne] Or use chomp! on first call, though that's a bit less maintainable.
+ 357062 [josh.cheek@g] Here is an explanation of why you get what you do, and examples of how to
+ 357063 [mikejoebro@y] Hey Guys!

Global rescue - DRY (don't repeat yourself)
357065 [jan@ja -r sl] I am trying to implement report to a bug management system in rails.
357066 [jazzezravi@g] class Library
+ 357067 [jazzezravi@g] You can use the first line as,
+ 357068 [jan@ja -r sl] Thanks P.Raveendran
+ 357069 [jan@ja -r sl] Sorry, but I ends up adding
  357070 [boesemar@gm ] class Code
  357073 [jan@ja -r sl] Thanks for your suggestion. It Works.
  357131 [boesemar@gm ] local = 'test'
  357163 [jan@ja -r sl] class VariableStack
  357232 [jan@ja -r sl] Is there a way to include "raw" ruby source code in ruby method, or an
  357336 [vikkous@gm i] It seems to me that a macro is the best way to get to almost what you

Newbee question. Runtime classloading
357075 [serega.sheyp] programming knowledge. I want to understand runtime class loading
357076 [fxn@ha hr f.] Ruby needs to interpret the file where the class is defined before you
357077 [serega.sheyp] I understand it.
357081 [fxn@ha hr f.] Ah yes let me explain a bit more. Doing
357086 [serega.sheyp] Nice opportunity to make silly mistakes, especially if you work in group
357106 [serega.sheyp] Excuse me for disturbing you again.
357111 [fxn@ha hr f.] Yes you have the __FILE__ keyword. That evaluates to the filename of

Find has key from a value
357084 [johnnybutler] I cant seem to figure this out, if i have a hash value can i then get
+ 357087 [jacob.d.mitc] value exists in the hash but what i need to know is what is the key for
+ 357088 [shortcutter@] Hash#rassoc
  357090 [johnnybutler] Thanks,

Building Ruby 1.9 in HP-UX IA 11.31
357085 [sebastian@ye] Has anyone tried to build Ruby 1.9 on the HP-UX 11.31 platform?
+ 357121 [ryand-ruby@z] You'd be better off writing ruby-core@
+ 357158 [sebastian@ye] After searching around and doing some more testing I have managed to
  357424 [sebastian@ye] Just a minor update on building Ruby 1.9 on HP-UX 11.31, in the previous

how to use rdebug in ruby script
357091 [thillaibooks] how to use rdebug in a pure ruby script file.Please me
+ 357253 [rogerpack200] I've wondered that myself.
+ 357256 [marco-oweber] require 'rdebug' at the location where you want to start debugging.
  357285 [rogerpack200] Which rdebug is it loading ("gem which rdebug")?  My system doesn't seem
  357287 [marco-oweber] Sorry, I mixed them up: rdebug is not debug. I was talking about the

Re: [ANN] Ripple 0.5 (Initial Release)
357092 [aldric@tr vo] I, for one, am enthused. Riak is open-source, too. Neat!

Re: Ripple 0.5 (Initial Release)
357093 [transfire@gm] Link?
357097 [aldric@tr vo] Posted via http://www.ruby-forum.com/.

Can SWIN CommonDialog.openFilename() select multiple files?
357103 [alex.decaria] Can the SWIN CommonDialog.openFilename() method be used to select
357130 [chris.hulan@] On Feb 11, 10:32=A0am, Alex DeCaria <alex.deca...@millersville.edu>
357139 [s.korteling@] OFN_EXPLORER  = 0x00080000
357206 [chris.hulan@] I was able to get your code to work, surprisingly the docs seem to
357227 [alex.decaria] matter how many files I select, files.length is coming out to be 1.
357247 [chris.hulan@] I installed the latest Ruby 1.9 via RubyInstaller.org
+ 357257 [alex.decaria] I'm running Ruby v.1.8.6 that I installed using the Windows 1-click
| 357264 [alex.decaria] I forgot to mention that I'm running it from the Windows command line.
+ 357309 [alex.decaria] unzipped the DevKit into my C:\Ruby directory.  I don't know what to do
  357494 [chris.hulan@] I followed the instructions in install.txt and it Just Worked!
  357554 [alex.decaria] SUCCESS!  I installed Ruby 1.9 and vrswin090207, and your code works as
  357609 [chris.hulan@] On Feb 17, 2:44=A0pm, Alex DeCaria <alex.deca...@millersville.edu>

can you help me about this deal?
357105 [gilsapir86@g] i saw this very cheap macbook pro

Re: Welcome to our (ruby-talk ML)         You are added automatically
357110 [mardughard@h] ...

n00b: text processing from magnetic stip input
357122 [john@jm nd .] I'm trying to make a program and I'm really bad at text processing. The
+ 357123 [marnen@ma ne] Then you will have to get better. :)
+ 357124 [jgabrielygal] Show us what you tried, it's easier to help that way. Anyway, you
  357127 [john@jm nd .] Sorry about the confusion. Apparently I asked the question wrong. I was
  357128 [Rob@Ag le on] Well, break it into parts...  I'll use %r{ } for Regexp literals

[ANN] johnson 2.0.0 prerelease 1
357129 [smparkes@sm ] johnson version 2.0.0.pre1 has been released!=20

ruby sspi
357133 [ttjk0115@gm ] Is there any way that I can read user name through SSPI in Ruby on Rails?

Delete Item In Array If Conditions Met
357141 [thinkfuture@] having a tough time of it. Can anyone else please help me out?
+ 357142 [thinkfuture@] reject!
+ 357143 [mat@pa ch co] The #reject! method is an iterator; so is the for loop (effectively).
| 357147 [thinkfuture@] Thanks guys that did it!
| 357149 [albertschlef] You've better ask your question in the Rails forum. You're using some
+ 357144 [s.korteling@] reject! does the iterating for you, so you can (must) leave out the for
  357145 [tony@me io .] In addition to reject! there's also Array#delete_if

REXML translate (XPath?)
357150 [andrew.cove@] Can somebody explain or put me to an explanation of how to use
357184 [mark@th ma z] group_list.elements["entry[translate(title,
357186 [andrew.cove@] That appears to work for REXML.  Thanks Mark.

Finding exact date before specified months & weeks
357153 [martin@an le] Dear All,
357154 [Rob@Ag le on] I'm not sure that I understand exactly what you need, but perhaps this
357155 [martin@an le] Thanks rob,

String to symbol
357156 [serega.sheyp] #Base class for all models.
357159 [shortcutter@] IMHO that method would rather be called ensure_attr_allowed - if you
357161 [serega.sheyp] I've added "!" to show that it can throw exception (like in rails)
357165 [shortcutter@] irb(main):031:0* d1 = Dates.new(:start=>1,:end=>2,:current=>3)
357168 [serega.sheyp] Is there any opportunity to add attributes to instance, not to class?
+ 357171 [serega.sheyp] 2435:         self.class.send(:scope, :create).each { |att,value|
+ 357172 [jgabrielygal] Send the define method to the singleton class of the object, instead

how to set permission '777' to dir?
357162 [hb.pat87@ho ] permission '777'.
357174 [albertschlef] That's because, on POSIX systems, the permissions of a new
357349 [hb.pat87@ho ] I try FileUtils.chmod() after create new file but it still has permision
357353 [b.candler@po] begin
357358 [hb.pat87@ho ] it's show me
357359 [hb.pat87@ho ] oh I try in Linux with the same code it's
357415 [albertschlef] You mean to say that Windows 7 has the unixy owner/group/world

Problem with array in hash
357166 [serega.sheyp] require 'p'
357167 [jgabrielygal] This is because the + method of Array doesn't modify the array, it
357169 [serega.sheyp] Thank you for explaining.

how to detect used protocol (SOAP, JSON, XML etc.)
357170 [jeljer@me co] I am building an ESB (Enterprise Service Bus) for a Content Management
+ 357173 [jeljer@me co] Wel after a discussion with a few students I realized i could of course
+ 357180 [hassan.schro] If all these "protocols" are being delivered over HTTP, you can look
| 357215 [jeljer@me co] Hmm no it isn't :( mostly they are send with just a tcp connection.)
+ 357229 [b.candler@po] This is an encapsulation issue.
| 357294 [jeljer@me co] Thank you for your insights in this matter. I do think it is not
| 357319 [b.candler@po] Then you're not just squirting the object over a raw TCP socket; you're
| 357341 [jeljer@me co] Yes you are right. I could use an extra field. But I need the ability to
| + 357351 [b.candler@po] So either force the clients to use the same protocol you have defined,
| | 357361 [jeljer@me co] Yes i have gone with the second option. Because now I can for example
| + 368700 [me@wa to ho ] Actually, in threads if one crashes, everything crashes.  If you have
+ 368530 [unsure@ta ti] Silly wabbit!  Just take a look at the JSON, XML and SOAP files you are
  + 368531 [unsure@ta ti] oops sorry, take the vertical bar out of that regex.
  + 368539 [b.candler@po] Note that even when fixed, that regexp would match
    368545 [jeljer@me co] Ehm guys. Why are you all commenting on a 6 months old  post  ;)

[noob] Problem with arrays
357177 [sokaos@gm il] I have a few issue using arrays.
+ 357178 [sokaos@gm il] Ok, my mistake, I was lost in loops :p
+ 357179 [marnen@ma ne] I saw your later post that this is working, but I thought that since
  357181 [luc@ho k- on] just=20
  357195 [josh.cheek@g] I would also define getters for boolean variables

Re: Problem with arrays
357182 [marnen@ma ne] Thanks!  I forgot about until.


Skipping headers in FasterCSV
357185 [john.mcleod@] I'm having one heck of a day.
357367 [john.mcleod@] I guess what I'm asking is...
357370 [b.candler@po] Try using Row#fields
357372 [john.mcleod@] Thanks Brian for the reply.
357375 [b.candler@po] That's because you're still using row.to_hash and not row.fields !!
357377 [john.mcleod@] Thanks again.
357448 [john.mcleod@] Hold on there cowboy!!!!
357456 [b.candler@po] Where did "Please try again" come from? Is this your own exception
357458 [john.mcleod@] Sorry, I should have posted the entire method.
357481 [john.mcleod@] Ah, found a solution.

Is there a way to get a method to always run at the end of any descendent's initialize method?
357187 [xeno.campano] I have an initialize method I want to run at the end of any daughter or
+ 357188 [ryand-ruby@z] or granddaughter 'initialize' to make sure the state has been created =
| 357191 [xeno.campano] The problem with that is you may want some things from super available before
| + 357193 [shevegen@li ] This actually reminds me of conditionally running hook-up methods.
| + 357212 [shortcutter@] Template method pattern.
+ 357189 [mat@pa ch co] There's no simple way to do this. One possibility is to create a
| 357209 [transfire@gm] require 'facets/kernel/as'
| 357261 [higgs.bozo@g] Yeah, that was Ryan's point about overly clever solutions. That may
| 357289 [aaron@te de ] I was wondering where my concrete dildo went.  Please clean the Fruit
+ 357196 [higgs.bozo@g] This is a designed-in feature of Common Lisp, where you can define
+ 357862 [ shot@ho .p ] Other than what others already said, you could try either an AOP

Bug in Ruby YAML interpreter?
357190 [ralphs@do 32] When I run this through
+ 357192 [ryand-ruby@z] that's per spec... quote it to ensure the string NO.
+ 357194 [Ruby@Go gl M] This is how Booleans are represented in YAML. An unescaped string