267942-282604

267778-272179 subjects 268168-269920

easy question: access module/class outside of current scope
267942 [jtprince@gm ] I've seen someone do this, but I forget how it is done and I can't
267957 [angus@qu va ] [bwv549 <jtprince@gmail.com>, 2007-09-06 21.05 CEST]

Using telnet to determin which service is running in ruby?
267948 [kazaam@ol co] $(sleep 1; exit) | telnet ubuntuforums.org 22

OpenSSL
267950 [damnbigman@g] ...
267962 [damnbigman@g] ...

Re: Count and Say (#138)
267953 [phrogz@ma .c] In case the string gets quite long, what is the canonical English
+ 267955 [aledonne.lis] I was taught in the US that "and" in a spelled out number designates
+ 267961 [martindemell] I'd say "ONE HUNDRED AND ONE", but you could always add it as a parameter
+ 267963 [cmshea@gm il] I've always felt that the answer to the question "What is the smallest
+ 268013 [james@gr yp ] This has come up in past quizzes.  Here's a line of thought from and
  268265 [ruby@th ma z] Hehe... I used that for Integer#to_english. That made solving this
  268275 [james@gr yp ] Sure can.

How to make mutt show [ruby-talk] on the index (was: subject line)
267954 [angus@qu va ] [Chad Perrin <perrin@apotheon.com>, 2007-09-05 16.10 CEST]
268101 [perrin@ap th] I imagine that'd be aesthetically kind of noxious, with the way only one
268129 [angus@qu va ] [Chad Perrin <perrin@apotheon.com>, 2007-09-07 15.23 CEST]
268132 [perrin@ap th] I wasn't aware that would insert it into the same column.  Oops.

force output during long process
267960 [jtprince@gm ] I'm running a long process and need to give some feedback to the user
267965 [cmshea@gm il] To flush the buffer, use $stdout.flush

Once again: Interest in "Cologne/Bonn Ruby Users"?
267966 [ jupp@gm .d ] Once again I wish to ask if there are people interested in such a
268066 [mneumann@nt ] Yeah, I'd participate! But only if it's within the next three weeks ;-)

NArray Gem?
267967 [benjohn@fy h] Am I missing the obvious here? Is there not a gem for narray?
+ 267972 [tim.pease@gm] Correct. NArray is an old-fashioned regular ruby install into the
+ 267973 [Bil.Kleb@NA ] No and no.
  268128 [benjohn@fy h] Thanks Bil and Tim. Could it be a gem, or is that not possible?

How do I exit my program at any time?
267971 [nitrohelgso@] if answer == 'exit'
+ 267975 [martindemell] def get_input(prompt)
+ 267976 [phrogz@ma .c] On Sep 6, 3:15 pm, Helgitomas Gislason <nitrohel...@hotmail.com>
+ 267977 [tim.pease@gm] Redefine gets to do what you want ...
  267981 [nitrohelgso@] Thank you very much, people. I really appriciate it.
  267992 [JeremyWoerti] wow, I like their ideas better. I was gonna say, put the whole program

Re: Twisting a Rope (#137)
267982 [jfmiller28@y] I'm very sorry that this quiz ended up coming out over the labor day
268038 [rubify@so to] At least two implementations did this (James Koppel's and mine). OTOH this
268091 [eric.mahurin] I'd think you'd treat depth as log2(length) and do something similar.
268125 [rubify@so to] In reality all in-time short-cut  rebalancings will perform worse than the

RE : [ANN] VimMate 0.6.4
267985 [guillaume.be] "Install the Ruby bindings to GTK and GNOME (for the VTE terminal). [...]

RE : VimMate 0.6.4
267986 [guillaume.be] As far as I know, it doesn't work under Windows... But, it might be
268185 [bigboss64@ip] If I had to use an IDE, I think that would be it.

Reg Ex
267989 [chuckdawit@g] I'm querying through the .com's looking for any www name with Cisco in
+ 267991 [diego.suarga] ...
+ 267993 [fxn@ha hr f.] /\b((C|c)isco|CISCO)\b/
+ 267998 [arifsaha@ya ] /\b([Cc]isco|CISCO)\b/
| 268059 [diego.suarga] ...
| 268072 [shortcutter@] I'd probably use a second rx like
| 268122 [koflerjim@ma] Maybe also try something like:  print line if line =~
+ 268147 [phrogz@ma .c] Instead of modifying the regex, how about simply working on the data
  268703 [chuckdawit@g] dnsfile.each { |line| newfile.puts line if line =~

Wiki engine for no shell hosting?
267990 [arifsaha@ya ] Do you know wiki engines in Ruby which can be installed in a
+ 267999 [dzwell@gm il] Well, you will need some database. If they won't let you run or access
+ 268001 [phlip2005@gm] If you can't reach out to httpd.conf, you might upgrade .htaccess
  268024 [arifsaha@ya ] Thanks for the info. I took a look. Documentations seems a bit

Re: Program which calculates earnings (with some difficultie
268000 [jeremywoerti] Not sure if you still need this, but if so, then this should give you a
268011 [jeremywoerti] WOW! yeah, totally forget what I just posted.

help me condence my code?
268006 [significants] I know this could be more idiomatic to ruby.
+ 268007 [jeremywoerti] ok, here's my first shot at a newbie to programming trying to solve
| + 268015 [lloyd@2l ve ] OMG!  You can call methods in an end???  I have lived far to long in the
| | + 268016 [jmettraux@op] irb(main):004:0> [1, 2].collect do |i| i+3; end.join " : "
| | | 268094 [lloyd@2l ve ] That is just too cool for words.  Thanks for getting back to me!
| | + 268017 [alexg@ku cr ] Remember do..end is just another way of saying {..}
| + 268021 [significants] ph-test.rb:3: undefined method `delete_at' for nil:NilClass (NoMethodError)
|   268164 [jeremywoerti] hmm, well I guess that means that the delete_at(-1) isn't being called
+ 268009 [phlip2005@gm] Write unit tests for it, then refactor it, one tiny change at a time,
| 268022 [significants] eek. I've never written a unit test before. that's all incredibly
| + 268029 [bulliver@ba ] I used to think that too, but finally I got around to trying them, and they
| + 268255 [logancapaldo] Hah! Writing code that actually _does_ stuff doesn't seem scary to
+ 268014 [Bil.Kleb@NA ] Don't know about idiomatic, but here's my
| 268023 [significants] my local copy has some extra (probably important) authorship/proj
| 268083 [Bil.Kleb@NA ] Yes, you could drop the open-uri stuff and just use your
+ 268025 [alexg@ku cr ] The main problem is that you loop through the Array four separate
+ 268027 [Christopher.] While this does not handle everything in the input stream you mention,
+ 268034 [pete@no ah t] Ok, I'm going to try break this down a bit more than the other answers.
+ 268050 [botp@de mo t] be gentle to yourself. it is not sloppy. in fact i find it readable and it clearly shows what the code is trying to do (wc may not be what you want to do)..  you can refactor it and put some tests as you go along.
+ 268056 [expandafter@] a = IO.read("phrases_no_extra.txt").
| 268058 [expandafter@] That contained some redundancy.
| 268061 [expandafter@] I wish that I were awake.  That regular expression
+ 268112 [w_a_x_man@ya] puts IO.readlines("phrases_no_extra.txt").

quechup is a spam robot.
268019 [paradisaeida] Nuts. It got past the 'filters'.

Help a ruby newb!
268026 [richietommy@] So...here's the deal. I've never looked at Ruby before last week. I do

error using my own classes in camping (namespace issue?)
268028 [kyleaschmitt] I'm having troubles, and I'm guessing it's due to both namespaces in

Equivalent of "source" in ruby?
268031 [tjacobs-sndr] Contrary to my expectations, if I have some variable assignments in an
+ 268035 [alexg@ku cr ] Would globals work for you?
+ 268036 [ttmrichter@g] @a =3D 5
| 268080 [shortcutter@] Yes, you are missing the local variable bit. :-)
| 268089 [ttmrichter@g] That would do it.  :D
+ 268078 [erikveen@gm ] Load starts a new scope without reusing the local scope. Eval
| 268082 [erikveen@gm ] a       = nil
| 268452 [drbrain@se m] echo "Thread.critical = true; sleep" >> vars.rb
+ 268081 [shortcutter@] It is also unsafe - not only because of the eval but also because this
  268463 [shortcutter@] That was intended to read "global" of course. Sorry for the noise.

Accessing variable names in ruby
268033 [tjacobs-sndr] I found myself trying to do a bit of ruby debugging, and was going crazy
+ 268197 [devi.webmast] ...
| 268521 [tjacobs-sndr] That doesn't work with symbols (raises "NoMethodError: undefined method
+ 268628 [shortcutter@] When you use %w you can easily use strings for this.  I'd also use

building an extension gem and including a library source
268039 [oga_emmanuel] I'm building an extension gem for http://libharu.sourceforge.net/ My
268103 [thomas.mackl] Are you using the Gem::Specifications#extesions method? in your

self-calling method
268041 [jonsdenni@gm] I'm making a program to rename files based on the date/time they were
268076 [erikveen@gm ] Replace "check(newString)" by "finalString = check(newString)"
+ 268107 [significants] whaaaa, changing the base of a string? this is totally bizarre to me.
| 268144 [phrogz@ma .c] Er, you're not changing the base of a string. (That would be something
| 268161 [significants] ok ok. I'm glad I read that wrong, it caused me some confusion.
+ 268454 [jonsdenni@gm] I simply didn't know about to_s(36)

how to type { [ in irb?
268042 [jkhaledsouei] I have danish keyboard, and I cannot figure out how to type { [ in the
268048 [lists@be tr ] Suppose you're on a really poor O$.
+ 268054 [jkhaledsouei] Thanks,
+ 268123 [jkhaledsouei] I facing the same problem with RubyonRails console ??? :((((
  268126 [ben@bl yt in] That's because the Rails console *is* irb.  Whatever you did to fix IRB
  268130 [jkhaledsouei] I just type
  268150 [matthewrudyj] here's a slightly hacky way to do it;
  268151 [jkhaledsouei] Thank you very much :)

Chaining external commands using pipes.
268044 [phelan@tt ec] I have come up with a little script that works well in IRB for issuing
268046 [konrad@ty er] charset="iso-8859-1"
268158 [bradphelan@x] Perhaps but there is zero documentation for any of the classes in the

REXML performance gap between XP and OS X
268047 [damphyr@fr e] I usually don't notice these things as the differences are usually

is out of the office.
268049 [Ryan_McDonal] I will be out of the office starting  09/07/2007 and will not return until
268098 [logancapaldo] Thanks! We really needed to know that. Without that warning ruby-talk

read a specific line from a file
268052 [mihai.bulhac] how can i read only a line from a txt file?
+ 268053 [pcdavid@gm i] % cat one_line.rb
+ 268055 [botp@de mo t] # how can i read only a line from a txt file?
| + 268062 [diego.suarga] ...
| | 268159 [james@gr yp ] line_three = File.foreach(path) { |line| break line if $. == 3 }
| + 268096 [Christopher.] Or even
|   + 268100 [shortcutter@] ruby -ne 'puts $_ if $. == 3' your_file
|   + 268201 [botp@de mo t] # Or even
|     268218 [w_a_x_man@ya] He ought to learn and experiment with Ruby first.
|     268228 [botp@de mo t] # > rio has simple solutions for line grabbing, like eg, "get
+ 268064 [expandafter@] ruby -e "puts ARGF.to_a[2]" myfile
+ 268071 [shortcutter@] sed -ne '3 p' your_file
  268106 [w_a_x_man@ya] awk "3==NR" your_file
  268115 [shortcutter@] When I think about it, this is probably more efficient for large files
  + 268117 [fwmailinglis] charset="us-ascii"
  + 268118 [fwmailinglis] charset="us-ascii"
  + 268121 [w_a_x_man@ya] On Sep 7, 10:30 am, "Robert Klemme" <shortcut...@googlemail.com>
    268154 [shortcutter@] LOL

Trapped signals killing my subprocesses
268065 [port001@gm i] ...
268145 [rogerpack200] Yeah that seems like unexpected behavior.  I guess ctrl-c is being by

Re: simple way to encapsulate class << self ; attr_accessor :xyz ; end?
268069 [stefano.croc] class Base
268070 [shortcutter@] This might be an indication that you are using the framework wrongly -
268084 [transfire@gm] module Kernel
268287 [ara.t.howard] i always define this in lib/rubyext.rb

winxp multicast socket reading problem
268079 [akifusenet@g] I am trying to read some data from a multicast address. So I googled and
+ 268085 [akifusenet@g] I tried the same code in Linux. It doesnt give any error. So it has to
+ 282604 [erubin@va co] I ran into this same problem and finally discovered that in Windows you

Changing class of object foobar
268087 [shevegen@li ] Please no "redesign" proposal as in "do not try to do this
+ 268088 [cdcarter@gm ] Changing the class of the Button object won't work.  I would suggest
+ 268092 [logancapaldo] There is a way to do this. It's in a lib, and the name of that lib is
+ 268127 [noah.easterl] Why convert when you can just lie?  Does the user ever have to know
+ 268136 [wilsonb@gm i] foobar = Gtk::Button.new
| 268189 [rick.denatal] This only binds the VARIABLE foobar in the current scope to a
| 278316 [shevegen@li ] I think i will go with evil.rb, at least digging into it as much as
| 278333 [dblack@ru yp] Then you're adding rather enormous complexity where the language
+ 278331 [apeiros@gm .] foobar = Button.new

Netbeans, Eclipse and ruby! How to...?
268108 [thyandrecard] well, i should start to say that i'm pretty new to ruby!!
+ 268109 [kyleaschmitt] I've setup both Eclipse+Ruby and Netbeans 6.0 Milestone 10 :) they
| 268113 [thyandrecard] Ok, my mistake!!! I forgot to tell you that I've done that!!! In both
| + 268116 [kyleaschmitt] Ewww.  Maybe?  I'm running Eclipse on Windows & Netbeans on windows &
| + 268120 [martin.kraus] There is bunch of wiki pages with a lot of information about hopefully
|   268131 [thyandrecard] Ok.
|   268133 [jamesthepipe] I'm about as unofficial as you can get, sorry :-).
|   + 268134 [jamesthepipe] bld=`wget -q -O -
|   + 268247 [thyandrecard] Well, i've uninstalled netbeans and ruby.
|     268263 [jamesthepipe] Exactly when do you get that message?  (What menu option/keystroke do
|     268267 [thyandrecard] These were my steps(after changing jruby to
+ 268114 [jamesthepipe] NetBeans M10 is ancient history - try the latest build from
| 268138 [vjoel@pa h. ] The thing that turned me off of netbeans almost immediately was this: I
+ 268280 [itsme213@ho ] Have you tried http://eclipse-shell.sourceforge.net/docs/index.html ?
  268282 [thyandrecard] Ok.

[ANN] The Ruby East Conference is Now 3 Weeks Away (Reminder)
268110 [aok@ch ri ts] ...

ANN: Sequel 0.2.0.2 Released
268111 [ciconia@gm i] Sequel version 0.2.0.2 has just been released. This release includes a
268119 [aff28@de et ] Congratulations on the release. I like to hear about new and evolving
268171 [mneumann@nt ] I like it to see announcements like this on ruby-talk! I don't want to

array handling advice
268135 [christopher.] I have an arbitrarily large input array, like
+ 268139 [fwmailinglis] charset="us-ascii"
| 268208 [botp@de mo t] # irb(main):002:0> b = [[], [], []]
+ 268141 [gthiesfeld@g] require 'enumerator'
| 268156 [shortcutter@] $ irb -r enumerator
| 268163 [a99.googlegr] input = ['a','b','c','d','e','f','g']
+ 268155 [a99.googlegr] input = ['a','b','c','d','e','f','g']
+ 268167 [w_a_x_man@ya] On Sep 7, 12:38 pm, Chris McMahon <christopher.mcma...@gmail.com>
+ 268170 [erikveen@gm ] For better readability, define it in a library. And if it's
| 268173 [w_a_x_man@ya] 1. Doesn't enum_slice do this?
+ 268177 [SimonKroeger] Well, no, not exactly simple.

Singleton aliases
268140 [qpadla@gm il] I have a class with instance method "each" and i want to add variable
+ 268142 [phrogz@ma .c] class Foo
+ 268143 [wilsonb@gm i] This is one way. There are several.
| 268157 [qpadla@gm il] Wow. Thanks for all suggestions. But that one was really helpful and simple
+ 268148 [phrogz@ma .c] class Foo

nil.to_s
268152 [rubylearner@] ...
+ 268162 [phlip2005@gm] nil is a potential source of confusion and bugs. Ideally, a method should
+ 268166 [m_goldberg@a] This has come up on the mailing list before, and there are some
  268169 [grzm@se sp t] As I read it, OP is asking specifically about the behavior of nil.to_
  268179 [SimonKroeger] p proc{|k| 's' if k != 1}.call(1) #nil
  + 268196 [dangerwillro] It's this way with every language. You will find things you like and
  + 268205 [grzm@se sp t] Of course. Thanks, Simon :)

Mysql DBD and DBI -- affected_rows
268160 ["Venkat" <>] This is my first post on c.l.ruby. So, bear with me if this has been

Onsite Training
268165 [doug.sparlin] We're beginning to move to RoR and our company is offering to provide
+ 268190 [dangerwillro] If you've got several years with mod_perl, you'd probably save
| 268192 [znmeb@ce ma ] I disagree with this point of view. I'm guessing there are budgets and
| 268193 [znmeb@ce ma ] P.S.: Does anybody actually use "mod_perl" any more? I thought "mod_php"
| 268198 [fwmailinglis] charset="us-ascii"
+ 268199 [JeremyWoerti] Where is your company located? There is a site called "Working With
  268216 [znmeb@ce ma ] Uh oh ... I think I just invented MOD_COBOL
  268242 [doug.sparlin] On Sep 8, 12:32 am, "M. Edward (Ed) Borasky" <zn...@cesmail.net>
threads.html
top