353088-369366

352913-353730 subjects 353322-356143

Suggestion of Array#=== which improves case/when behaviour
353088 [dmitryelasti] We already have :=== operator defined in Module, Range, Regexp and Proc

Math errors
353089 [jzakiya@ma l] (-3)**3 => -27
+ 353093 [akr@fs j. rg] Ruby 1.9 has Math.cbrt.
| 353095 [eregontp@gm ] ~ $> ruby -ve 'p v=Math.cbrt(-27); p v**3'
+ 353096 [w_a_x_man@ya] irb(main):001:0> 1/3.0
+ 353097 [w_a_x_man@ya] irb(main):006:0> (-27)**(1/3.0)
| + 353098 [matz@ru y- a] It's -(27 ** (1/3.0)).
| | 353142 ["William Jam] Thanks for the explanation.
| + 353101 [raghav.dasso] I guess, you are right. THIS IS A 'MATH ERROR' in Ruby.
|   353122 [jzakiya@ma l] oints (that are not Integers) =A0
|   + 353123 [jzakiya@ma l] points (that are not Integers) =A0
|   + 353124 [jeanjulien.f] As Matz said, the second two are evaluated as - (27**(1/3.0)), that is
|     353128 [jzakiya@ma l] On Dec 18, 11:05=A0am, Fleck Jean-Julien <jeanjulien.fl...@gmail.com>
|     353135 [jeanjulien.f] Well, I never said that you should do that, I just explained how Ruby
|     353145 ["William Jam] def root base, n
|     353170 [jzakiya@ma l] Remember
|     353179 [jzakiya@ma l] BTW there is an error (sort of) in 'complex' too
|     353183 [jzakiya@ma l] by
|     353186 [jzakiya@ma l] Ruby
+ 353100 [raghav.dasso] Removing the brackets across -27.0 does the trick, though would need to fin=

Re: Suggestion of Array#=== which improves case/when behavio
353090 [dmitryelasti] "Set" class has meaning close to "Range" class. If we will define
+ 353099 [dmitryelasti] So, my question is: Do you agree that Array#=== can be useful for us?
| 353102 [eregontp@gm ] It doesn't look too usefull to me like that. (I mean using classes to
+ 353173 [vikkous@gm i] I long ago did something similar, but much more extensive; I created a
  353198 [tony@me io .] I would absolutely love if Array recursively performed #=== on its
  353200 [dblack@ru yp] It's an interesting idea but I wonder how useful it would be, compared
  353204 [rick.denatal] =3D=3D
  + 353208 [gwtmp01@ma .] I still don't understand that particular change. The 1.8 semantics of =
  | 353276 [eregontp@gm ] 2009/12/19 Gary Wright <gwtmp01@mac.com>
  | 353295 [gwtmp01@ma .] A) making an incompatible change to something so basic as Array#to_s =
  + 353219 [vikkous@gm i] I added this to my tests for 1.9 porting. It at least makes the

Ruby 1.8.7 + Tk8.5 with Windows-RubyInstaller
353092 [a99.googlegr] Windows-RubyInstaller with Ruby 1.8.7 + TK8.5 working.
353163 [rogerpack200] have it by default :)
353176 [luislavena@g] Right now there is no recipe for 1.8.7, TK 8.5 is only compatible with
353189 [nagai@ai ky ] Tcl/Tk8.5.x and 8.6b1 will work with Ruby 1.8.6, when Ruby's tcltklib
353199 [a99.googlegr] Can you tell me the first steps on how to get tk from SVN? What is the
353203 [luislavena@g] but instead of checkout trunk, look for branches/ruby_1_8_6 or
+ 353210 [a99.googlegr] Thank you two times!
+ 353241 [nagai@ai ky ] To get the latest Ruby/Tk, look for trunk (for 1.9) or

Third Ruby and Rails devroom at Fosdem (Brussels, 6 Feb 2010)
353103 [calamitates@] The Belgian Ruby User Group is happy to announce the third Ruby and Rails

problem requiring gems under 1.9.1 mingw
353104 [michel@de az] I have both 1.8.6 and 1.9.1 (both mingw under windows).
353121 [luislavena@g] 1) You're using pre-compiled version of gems that are made to work on
+ 353131 [renard@nc rr] OP should use:  require 'windows/api'  and not  require 'windows-api'
| 353137 [michel@de az] Yes, I should have written : my code requires windows-api by 'require
+ 353138 [michel@de az] Thanks, Luis, I'll try that.
  353139 [michel@de az] Worked most easily and perfectly !

Some questions about sockets
353105 [hypermeister] I am practicing socket programming in Ruby, and I have some questions.
+ 353107 [reid.thompso] They are listed in the Constants section of class Socket
+ 353134 [phil.auriemm] I think that the \n flushes the buffer or something. So if you do

moving a file after processing
353108 [rcf1973@fa t] I'm working on a script and trying to move the file processed to a
353110 [pg@th mi n. ] require 'fileutils' #this is a guess, but should work
353114 [rcf1973@fa t] Sorry if this is a bit simple but something like this then in my
353116 [pg@th mi n. ] That's the theory, yes.

grep a block
353109 [beny18241@gm] Please can anybody tell how to grep a block?
+ 353111 [emr1776@mi d] #!/usr/bin/ruby
+ 353112 [beny18241@gm] ok closed Ifigue it out :)
| 353118 [shortcutter@] Eric's solution is better for large files because it requires reading
| 353202 [lists@be tr ] The name of the feature is flip-flop if you like to google for it.
+ 353141 ["William Jam] The tiny language Awk is good for things like this.

font for ruby ide
353113 [niyazi.ates@] do you know that font of ruby code samples in ruby offical site?
353119 [flo@an er gr] Depending on the fonts you have installed, it is one of (with descending =

simple one
353127 [beny18241@gm] As i wanted to make some kind of test.I have one simple question
+ 353182 [rogerpack200] the highline library might be of use to you
+ 353185 [sfw@si eo fo] I've written a simple program which I believe meets your requirements.
  353214 [beny18241@gm] i used both methods and they works (thanks for that), but i have ine
  + 353239 [rogerpack200] That repeats forever?
  + 353283 [lists@be tr ] There must be a loop around the `ask' method.

Stupid TK
353133 [phil.auriemm] Can anyone please give me a compiled version of Tk 8.4? I have Tk 8.5
+ 353159 [joelvanderwe] the 8.4 windows binaries are in
+ 353160 [rogerpack200] ActiveState has some versions you can download of it.

Setting Windows Enviroment in Ruby Script
353136 [johnsheahan@] I need to set the following windows environment variable at the
+ 353143 [pg@th mi n. ] "Use the set command to create, change, delete, or display environment
+ 353149 [luislavena@g] ENV['http_proxy'] =3D "http://10.1.1.1:8080"
  353157 [johnsheahan@] Thanks alot for the help Luis...that worked perfectly for what I needed.

uninitialized constant Test error when running Fitnisse ruby
353140 [arti.p.singh] has anyone seen this error before? I have no idea on how to fix I have
353150 [pg@th mi n. ] Your suit of tests is lacking a require, somewhere.
353164 [arti.p.singh] Thanks, that was close, I had included Test::Unit::TestCase without

How to reopen the puts method
353144 [adamlauper@g] I am looking for some additional detail regarding the puts method.  Hows
+ 353155 [xenogenesis@] You're creating a new Kernel.puts module method; you want to redefine
| 353158 [adamlauper@g] Ah...so simple.  Thanks for the quick reply.
+ 353156 [aldric@tr vo] 1) open Kernel

Reading from a PDF
353146 [chad.locke@c] I'm looking for a way to read text off of a PDF document in Windows.
+ 353147 [gregory.t.br] ...
| 353148 [chad.locke@c] Thanks for the reply.  This looks like what I'm looking for.  Man, it's
| 369362 [ramsee@sa ea] Hey Max Power (chad locke)
+ 369366 [dsisnero@gm ] <http://www.darknet.org.uk/2009/10/origami-parse-analyze-forge-pdf-documents/>

Question about sum of fibonacci sequene [PROJECT EULER]
353151 [atma@co va e] Dear Sirs,
+ 353154 [Rob@Ag le on] values.  Change the 4000000 to be 10 and you ought to see the
| 353175 [atma@co va e] omg. I missread that part. Yes I thought it was asking for odd numbers... sorry lol.
| 353178 [jzakiya@ma l] Just a quick tip for you.
| 353227 [ shot@ho .p ] Better yet, use
| 353228 [ shot@ho .p ] Or even c.odd?, of course.
+ 353180 [w_a_x_man@ya] sum = 0
  353192 [pmckibbin@gm] One of my favourite bits of sample ruby code is the self memoizing Fibonacci
  353196 [atma@co va e] Thank you all for the very interesting pointers :-)

loses scope?
353166 [rogerpack200] Anybody know why this fails?
+ 353168 [jgabrielygal] Because both "class" and "def" keywords create a new scope. They are
| 353174 [rogerpack200] That I did not know. Thanks!
| 353195 [phil.auriemm] Ah thanks for posting that, I'm rather new to ruby and that was
+ 353171 [joelvanderwe] You may want to call class_eval and define_method with blocks instead.
  353237 [rogerpack200] Hmm. Perhaps an example using class_eval would help me understand that
  353249 [jgabrielygal] irb(main):001:0> class A
  + 353316 [rogerpack200] Many thanks and merry Christmas.
  + 353589 [rubyforum@je] Just curious... is there any difference between using define_method and
    353600 [jgabrielygal] one

Error Running Fitnesse Tests on the Fitnesse Server
353167 [arti.p.singh] I created a folder under C:/Data/Ruby called Fitnesse1 and placed my

special cased?
353184 [rogerpack200] This confused me a bit
+ 353187 [ibc@al ax ne] class A
| + 353188 [ibc@al ax ne] puts "I'm A"
| + 353216 [dblack@ru yp] ...
+ 353211 [b.candler@po] Nope - class variables (@@) have nothing to do with instance variables
| 353240 [rogerpack200] Yeah they must be special cased so that beginning users can use them
| + 353323 [b.candler@po] I believe it's picking up the value from class A, since that's B's
| + 353394 [dblack@ru yp] (3) and lastly, and most importantly, do not use class variables,
+ 353217 [dblack@ru yp] I think you mean shouldn't it just look up @a (not @@a) in the parent
  353218 [ibc@al ax ne] class A
  353221 [dblack@ru yp] ...

:D
353190 [phil.auriemm] Wow thank you so much, I thought no one had any precompiled versions

very noob question about class variables
353193 [angel21ccs@h] use rails...I made a little program but this has a little bug too..for
353194 [phil.auriemm] Class Supah

Ruby 1.9 - US-ASCII vs UTF-8
353201 [wallu667@gm ] So I have source files that contain unicode chars. Do I really have to
353205 [gregory.t.br] No, you can't override the source encoding.  You can use flags to set
353206 [gregory.t.br] Sorry, while the above statement is generally true, I forgot about the

free tour in america just click now
353209 [ramskathirav] ...

Spreadsheet gem -- way to work with a subset of rows?
353213 [tobinj@ma .c] The spreadsheet I'm trying to ingest is quite large, so I tried what

ruby in twenty minutes not work
353220 [niyaziates77] in ruby offical site two links doesnot work.do you know reasons?
+ 353223 [pg@th mi n. ] Do you mean this: http://www.ruby-lang.org/en/documentation/quickstart/2/ ?
+ 353234 [james@gr ys ] I don't seem to be able to reach it right now though.
  353235 [sophrinix@gm] I was planning on making an official announcement about this.
  + 353236 [sophrinix@gm] I should add that once the transfer is done, I will keep
  + 353244 [james@gr ys ] I've switched the sidebar link to this new URL.  Thanks.

Rcov::HTMLCoverage how-to?
353224 [transfire@gm] Putting Rcov to work in program, the FAQ gives the following as the

How to put File lines into postgres query(pg)
353226 [beny18241@gm] I have a script which parsing some xml files(works great :))

=?windows-1252?Q?Stolen_Laptops__=96_JustStolen=2ENet?=
353247 [stolenipods@] Stolen Laptops =96 JustStolen.Net

Correcting complex math
353248 [jzakiya@gm i] I thought I would extract some of the issues
353266 [colinb2r@go ] If this can be made to work, it might be useful.
+ 353267 [paul@po ly n] If you're messing around with complex variables and you come across
| 353285 [marnen@ma ne] Agreed.
+ 353268 [shortcutter@] Done.
| 353286 [colinb2r@go ] Thanks for that! You've embarrassed me into installing Ruby 1.9 for Windows
| 353292 [jzakiya@gm i] Error)
| 353361 [colinb2r@go ] Yes. And < and > are also invalid for complex numbers, at least in Python 3=
| 353674 [jzakiya@ma l] 31.
+ 353282 [jzakiya@gm i] From a mathematical/engineering perspective it is
  353341 [jzakiya@gm i] Example implementation for class Integer.

Regex question
353250 [lolilolicon@] [code]
353251 [w_a_x_man@ya] irb(main):001:0> /(lo){2}x/ =~ 'lolox'
353252 [paul@po ly n] Seems like a bug.
353253 [lolilolicon@] Same for me. I actually had tried what you tried too. Also, {2,2} won't
353254 [lolilolicon@] Sorry for double posting, post too quick.
353259 [shortcutter@] That's definitively a bug! => http://redmine.ruby-lang.org/

how to put unique lines from regexped file
353255 [beny18241@gm] I have such a question, when i open a file doing some grep stuff...
353256 [beny18241@gm] ok i figure it out :)
353260 [shortcutter@] That works only if the input is ordered.  For unordered input here's an
353264 [w_a_x_man@ya] That's fine for the plodding proles, but we cossacks always shout the
353265 [shortcutter@] Strong words, but I hope you are aware that this, taken as a general
353284 [marnen@ma ne] @geekdom = {@everything.reject {|e| !e.fell_swoop?}}.good_advice? ?

international free call just sign in now
353263 [ramskathirav] ...

[ANN] Linux network appliances managed via Sinatra
353272 [guidoderosa@] just to announce the first release or Ruby "OnBoard", a web interface
353274 [pg@th mi n. ] I like the SSL screen, especially creating a certificate. :)

[ANN] kramdown 0.3.0 released
353273 [t_leitner@gm] ## About kramdown

Re: Linux network appliances managed via Sinatra
353280 [guidoderosa@] Thanks! It was an important requirement to make OpenVPN setup more user
353281 [pg@th mi n. ] Certainly. I'm setting up a Linux VM soon, to play around with things

How capture console error messge for logging?
353287 [lists@gr gw ] OS X, Ruby 1.8
+ 353288 [lists@gr gw ] x = $!
+ 353289 [w_a_x_man@ya] ruby -e"puts X" 2>errors.log

[ANN] Try Ruby is back up and better than ever!
353290 [sophrinix@gm] Greetings,
353315 [colinb2r@go ] It looks nice.
+ 353317 [sophrinix@gm] Please open a ticket on github http://github.com/Sophrinix/TryRuby,
| 353363 [colinb2r@go ] Arrow keys: Up=3D>&  Down=3D>)  LeftArrow =3D>%  Right=3D>'
| 353433 [sophrinix@gm] s.
+ 353334 [ninja@sl ph ] I'm in Chrome Beta on Linux. Arrow keys work fine, but backspace seems to be

[ANN] mms2r 2.4.0 Released
353293 [mikemondrago] mms2r version 2.4.0 has been released!

Tk load error
353294 [teodorcarste] diabolator2@book:~$ cd /home/cristi/Desktop
353314 [a99.googlegr] Do you have the Ruby-Tk-binding installed?
353331 [teodorcarste] well, as I know, Tk and Tk binding are different things. I dunno if I
+ 353332 [teodorcarste] Posted via http://www.ruby-forum.com/.
+ 353333 [pg@th mi n. ] It's probably a package called "ruby-tk", or "libtk-ruby", or similar.
  353578 [teodorcarste] I've installed libtcltk-ruby and everything runs well until I require
  353594 [a99.googlegr] I think, TCL/TK is missing "Tile".

DESTROY in ruby
353296 [TechWWW@ya o] Does ruby have a DESTROY method in its class? like,
+ 353297 [walton@vy er] No, objects in Ruby are simply garbage collected
+ 353298 [cmdicely@gm ] There isn't a "DESTROY" (or "destroy") method defined by default. They
+ 353299 [emiddleton@b] Take a look at finalizers[1]
  353303 [TechWWW@ya o] for example, I openned a database handler in a class, and  new an object
  + 353305 [usenet-nospa] You don't.  When you're done, you close it.  More likely, you build your
  + 353313 [shortcutter@] There is keyword "ensure".  You can also use blocks for this like

Nokogiri and xpath for changing value on the web
353300 [soujiro0725@] ruby 1.8.6
353301 [emiddleton@b] Your XPATH is wrong try
353302 [soujiro0725@] It worked!

redirecting stderr in irb
353306 [martindemell] Redirecting $stderr in irb doesn't work but redirecting
353307 [ryand-ruby@z] "doesn't work" is hardly true. You're certainly redirecting $stderr at =
353308 [martindemell] Yeah, i know that, but irb seems to be printing its errors to $DEFAULT_OUTPUT

Value for text_field_tag ?
353309 [tuo_pe@ya oo] @text = params[:data][:text]
353312 [ibc@al ax ne] =3D>

How to get a file contained in a gem "lib" directory?
353310 [ibc@al ax ne] "lib/mylib" dir. Let's imagine that depending on the environment it is stored
353638 [albertschlef] def self.get_xml_pathname

Re: How to get a file contained in a gem "lib" directory?  [SOLVED]
353311 [ibc@al ax ne] Gem.required_location(gemname,"")

Re: Question about sum of fibonacci sequene
353318 [cidza@ti .i ] Not efficient but with no explicit loop (while...)

Help with gem ruby mysql error
353319 [drikting@gm ] I downloaded & double clicked 3 files to install mysql 5.1 for MacOS,
353320 [pg@th mi n. ] Is that verbatim? If so, you need to replace /path/to/mysql_config with
353336 [drikting@gm ] Yes thanks Philip, about the verbatim.
+ 353337 [pg@th mi n. ] It's Phillip, but you are still welcome. ;)
+ 353345 [hassan.schro] None of the above --
  353386 [drikting@gm ] Thanks Phillip and Hassan, path is correct now but below error is still
  353416 [hassan.schro] Sorry, I don't know anything about this "sequel" gem.
  353440 [drikting@gm ] gem list will show
  353444 [hassan.schro] ? why would you do that before getting your gem situation straightened out?
  353540 [drikting@gm ] Hmmm,
  353542 [hassan.schro] Yeah, that sounds completely broken. You could try (in irb)
threads.html
top