## 224942-231105

224694-231078 subjects 225184-262923
```
lib - generating a list of random number
224942 [josselin@wa ] I try to generate an array of N random numbers in range between 2
+ 224945 [ara.t.howard] n, max, min = 42, 10, 6
+ 224947 [shortcutter@] I am not sure I understand you here.  What does "sue" mean here?
| 224976 [josselin@wa ] sorry sue => usage.... typing mistake...
+ 224965 [nospam@no it] They are very easy to use, but first you have to decide what you want to do.
+ 224974 [gavin.kistne] I think Josselin meant "use".
| 224978 [keynan@ho e.] srand refers to seed rand
| 225068 [josselin@wa ] thanks a lot ! got it ...
+ 224977 [josselin@wa ] thanks
+ 224980 [khaines@en g] Use ruby-doc.org
+ 225009 [nospam@no it] / ...

224946 [ara.t.howard] can anyone interpret this
+ 224959 [shiwei1.zhan] ...
+ 225007 [drbrain@se m] FOREACH_THREAD_FROM(curr, th) {
225030 [ara.t.howard] so, this seems like a bug.  the thread in T state has made a call to 'sleep' -

Is 2.0 Integer or Float?
224949 [srobertjames] x = 2.0
+ 224953 [james@gr yp ] => true
+ 224955 [szymon.rozga] irb(main):001:0> 2.0.class
+ 224962 [nospam@no it] That depends on what you are trying to accomplish. Are you trying to
+ 224966 [tim.pease@gm] class Numeric
| 224971 [gavin.kistne] class Numeric
+ 225010 [gwtmp01@ma .] Maybe it is just me, I don't have a lot of experience with floating
| 225012 [wilsonb@gm i] IEEE floating point can store an exact representation of any integer
| 225013 [james@gr yp ] I'm pretty sure Lua uses floats for everything, for exactly this reason.
| 225014 [vjoel@pa h. ] How does that work? Is there an 11-bit pattern that signifies "use the
| + 225017 [james@gr yp ] James Edward Gray II
| + 225019 [sander.land@] 53 bits is just the mantissa size.
|   + 225026 [vjoel@pa h. ] Ok, so they aren't doing anything exceptional with the format. There's
|   + 225028 [phurley@gm i] But depending upon how the "integer" was generated, it may still make
+ 225228 [nospam@no it] / ...
225407 [dale.martens] Sorry to join this conversation late, but to me this is a strange
225433 [nospam@no it] / ...
225600 [dale.martens] Yes, you can store integers in floats. This is usually done with the
225610 [dale.martens] I agree that storing integers in floats is possible as long as you only

Installing
224954 [dipen001@ho ] ...
224988 [olsonas@gm i] Dipen -
224993 [none@no e. o] Thank you Drew. I seem to like SciTe as well. I think I will use that from

Help installing
224956 [dipen001@ho ] I have just started programming in Ruby as part of my University course.
224957 [rtilley@vt e] You might try using the bundled scite editor. I've found it to work well on
224969 [none@no e. o] Will do!

Net::HTTPS client certificate authentication
224958 [jebarker@gm ] I'm trying to authenticate with an apache web server using client
225020 [snacktime@gm] Doesn't sound like the private key is actually in controller.pem.
225091 [jebarker@gm ] If Firefox can successfully authenticate with the certificate but Ruby
225170 [snacktime@gm] That's not quite how it works.  The certificate contains the public

Ruby <-SWIG-> C arrays
224960 [saveez@ho ma] typedef unsigned long uInt32
+ 225100 [alex@de et m] It looks like you require some typemap here to convert a ruby array of integers to a C array of longs. You probably want %typemap(in), which mangles Ruby function/method params to something that the C function can digest.
+ 225114 [kou@co mi ng] %module "Example";
225131 [roys@mi ds r] Note that RARRAY(x)->len is going away in future versions of Ruby.  Use

Gruff: How to combine two charts in one image
224970 [cschlaefcke@] I´m playing around with gruff and wonder if it´s possible to combine two
224979 [mguterl@gm i] I'm not sure about Gruff supporting it directly, but using RMagick you
224984 [cschlaefcke@] Hmm, sounds complicate. Could you provide an example?

Convert singel dimention array into grid
224981 [ruby-forum@g] I have been learning ruby for the past week and am completely hooked.
+ 224982 [peter@ru yr ] require 'enumerator'
+ 224983 [dblack@wo bl] require 'enumerator'
+ 224985 [tim.pease@gm] Let the golfing commence!
224987 [dblack@wo bl] require'enumerator'

Installing Ruby
224986 [none@no e. o] I have had trouble installing Ruby version 1.8.5. This is supposed the

Northern Virginia Ruby's user group meeting 11/15/06
224990 [tom@in oe he] For those in the northern Virginia/DC area, there's a Ruby user's group

backtick subshell
224992 [noah.easterl] What subshell does ` (backquote) use to run commands?
+ 225005 [nospam@no it] \$ irb
| 225018 [noah.easterl] I don't think it's using the \$SHELL variable to choose which shell to
| + 225021 [nwiger@sc a.] How about
| + 225022 [rakrok@gm il] ...
| + 225029 [noah.easterl] Ok, from skimming process.c in the ruby source, it looks like it's hard
| + 225093 [nospam@no it] No, The \$SHELL variable should be an accurate report of the shell in use. It
+ 225006 [matt@ti bi s] puts `echo \$SHELL`
+ 226498 [powlow@gm il] On Solaris it does seem to just use the sh shell. I tested it out with

preserve mtime when using FTP?
224995 [eegreg@gm il] I am using Net::FTP to copy files, but the file stats are not
225003 [nospam@no it] But FTP can't set the mtime on remote files, it can only retrieve it.
225023 [eegreg@gm il] Unless I am mistaken I don't think sftp will preserve the file
225090 [nospam@no it] Not the sftp I'm thinking of. In any case, you can use ssh to force a reset

Assoc method on large array
224997 [greg.kujawa@] I am trying to invoke the assoc method on a large array. It seems to
+ 225000 [greg.kujawa@] I narrowed down the result set so that it's only a few records. For
+ 225002 [nospam@no it] Code?
225015 [greg.kujawa@] require 'dbi'
225081 [shortcutter@] You need an Array of Arrays.  But resultSet is the return value of
225120 [greg.kujawa@] When I try resultSet.class in irb I get back an Array. And the
+ 225121 [greg.kujawa@] I also get this error when trying to sort other array of arrays that
| 225122 [greg.kujawa@] I figured out this one glitch. Pilot error on my part. Some values of
| 225125 [shortcutter@] Why don't you let the DB do the selection?  Why don't you use a Hash?
| 225129 [greg.kujawa@] I didn't let the DB do the selection because I was querying different
| 225178 [nospam@no it] In the case of records from different databases on different servers, I
| 225193 [greg.kujawa@] You got it. In the case of trying to sort things based on a particular
+ 225123 [james@gr yp ] But you're sure that's not just inspect() tricking you with an Array-

Fwd: [urug] Re: Reminder: Meeting tonight 14 Nov 2006
225024 [pat.eyler@gm] Just in case there are folks here on ruby-talk that aren't on our

Excellent Ruby refactoring articles on rubyist magazine -- Also, does nyone know license of code on site?
225025 [dsisnero@gm ] ...

Rails problem with select
225027 [raw@ml ni c.] \$ ls -la

touch
225041 [bpettichord@] I need to "touch" a file from my ruby script. (This is a unix-based
225043 [ruby@ph li .] What's wrong with FileUtils.touch() ?
225046 [bpettichord@] That looks good. Thanks.

[ARRAYS] Bidimensional Arrays? (opened)
225042 [flaab_mrlinu] I'm just new at ruby and I have a weird issue probably really dumb but i
+ 225044 [tim.pease@gm] The ruby Array class is always a one dimensional array. You can create
+ 225045 [TimHunter@nc] The easiest way to define a multidimensional array in Ruby is to define

225050 [daniel@fl in] I'm using rspec for a Rails project and keep seeing the "assigns" method in
225052 [wilsonb@gm i] Assigns is a feature RSpec borrows from the regular Rails test/unit helpers.
225055 [daniel@fl in] Thanks!

Windows package task, windows cannot fork
225056 [dsisnero@gm ] ...
+ 225060 [reid.thompso] That's wrong.  Cygwin's tar works fine with gzip.  Trying to run
+ 225065 [phurley@gm i] If you are trying to avoid cygwin (and its path handling can be a good
| 225218 [dsisnero@gm ] ...
+ 225067 [gregory.t.br] I have no troubly using msys on windows.

first ruby program, how do I make it faster?
225057 [jigaboophelp] would like some hints on how to speed it up.  When I looked for a
225066 [eegreg@gm il] each will normally profile high because it will be called in multiple

Enterprise Ruby Conference
225064 [joe@th ed ec] EdgeCase is proud to announce erubycon, the first conference

Design problem with 'inject'
225069 [dr@ga yb on ] Ruby's inject has a design that can lead to hard to find bugs. The
+ 225071 [marcel@ve ni] next sum if i == 3
| + 225074 [farrel.lifso] Whoa! That is good to know.
| + 225084 [shortcutter@] In this case I would not even resort to #next.  This seems much more
+ 225072 [shyouhei@tr ] next sum if (i == 3)
+ 225073 [farrel.lifso] I agree using next with inject can be dangerous and probably should be
+ 225075 [lutherfire@y] You should use a '+' instead of a '+='. The return value of the block
| 225086 [dr@ga yb on ] Those are several good suggestions.
| + 225103 [M.B.Smillie@] I think it could be that I'm just too familiar with the whole
| + 225116 [dblack@wo bl] I think you're well advised to know that if you're using inject :-)
+ 225083 [pit@ca it in] Gary, that's not true. The version of inject you use (with an explicit
+ 225135 [ara.t.howard] this last part is dead wrong, the semantics of inject have __nothing__ to do
| 225143 [shortcutter@] Small correction: if called *without arguments* the first invocation
| 225151 [ara.t.howard] wow - you learn something every day - that's great!
+ 225142 [lukfugl@gm i] Others have already posted clarifying the semantics of inject and
| 225176 [GENIE@pr di ] Agree 100% on the use of select
+ 225145 [gregory.t.br] There were lots of good responses to this post already, but if you're
+ 225161 [w_a_x_man@ya] [1,2,3,4,5].reject{|n| n==3}.inject{|s,n| s+n}
+ 225267 [shortcutter@] (1..10).inject(0) {|sum, i| i == 3 ? sum : sum + i}
+ 225310 [louis.j.scor] The assignment to sum is useless.  Only the return value matters to inject.

225076 [crb002@gm il] I am trying to get mpi-ruby-0.4 working on a Bluegene-L system. I
225128 [jeff@sc wa c] On "a" BlueGene/L?  How many of them do you think there are?
+ 225152 [ilmari.heikk] The TOP500 lists 28, so at least that many.
| 225283 [jeff@sc wa c] No, those aren't BlueGene/L's, they're other BlueGenes.  The BlueGene/L
| 225530 [jeff@sc wa c] My failure to understand:  Other BlueGenes based on the L architecture
+ 225378 [crb002@gm il] No clue on the official name IBM calls it. It's one cabinet (1024 nodes)

how can I dynamically get the source of an object's method?
225082 [david@in er ] I've been wondering if it's possible to get an object to print out the
225126 [james@gr yp ] This isn't easy in the general sense with Ruby, because you can use

hoe send_email task (Was: Re: directory_watcher 0.1.1)
225085 [drbrain@se m] \$ mail drbrain@segment7.net

[was parsing unknown options] OptionParser documentation improvements
225094 [vincent.four] I think that it would be a great idea. Personnaly, I always found that

[File -> Lines -> Chars] Logic issue (open)
225095 [flaab_mrlinu] Just a simple question from a newbie =)
+ 225099 [vincent.four] ary = File.open(file).readlines.map {|l|
+ 225101 [nospam@no it] The program below reads lines and creates an array of arrays (a
+ 225102 [farrel.lifso] You can use each_byte to iterate over every character of a string.

[ANN] FastRI 0.2.0: full-text searching, smarter search strategies
225109 [ mfp@ac .o g] FastRI is an alternative to the ri command-line tool. It is *much* faster, and
225303 [gabriele.mar] I like fastri :)
225332 [ mfp@ac .o g] Sorry, it's not in 0.2.0, but you can find it in HEAD; just get
225443 [botp@de mo t] # > I like fastri :)
225680 [ mfp@ac .o g] oh, I'd never used that with ri (actually, I didn't use ri that much, for the

[METHODS] Var types as parameters
225111 [flaab_mrlinu] I want to pass an array as a parameter to a method. But the values of it
225112 [farrel.lifso] Could you show us the code which is doing this?

Re: Var types as parameters
225117 [flaab_mrlinu] - The user inserts a string of 15 signs.
225119 [dblack@wo bl] When you to the to_a, you're going to end up with an array of one

Cursor position in a Gtk::TextBuffer
225118 [ramsayw1@co ] I have not had great luck asking Gtk questions on this site, but I

Converting SVG files to images
225127 [djberg96@gm ] I was just playing with the Ruby svg-graph library, and it seems to work
+ 225130 [vincent.four] You can try convert, from ImageMagick. Basically convert anything to
| 225134 [farrel.lifso] And then you can install RMagick and control it from Ruby.
| 225141 [djberg96@gm ] Thank you Farrel and Vince - I'll take a look.
+ 225136 [kou@co mi ng] You can generate many file types (PNG, JPEG, GIF and so on)
225140 [djberg96@gm ] Thanks Kou, looks interesting.  I couldn't get cairo to build on my
225155 [phurley@gm i] I have a hunch that Kou's solution will work much better. In the
225165 [djberg96@gm ] Indeed.  I've discovered that running 'convert' over the .svg file
225172 [phurley@gm i] I just shelled out to inkscape and used command line parameters to

converting a signed float into unsigned float
225137 [dipesh_bathe] I know this is simple, but i am unable to find how to do this. I have an
225139 [jeff@sc wa c] irb(main):001:0> (-3.14).abs

Re: Nitro + Og 0.40.0
225144 [fabian@fa ia] Everyone looking for docs, have a look at the new, redesigned Oxyliquit
231060 [invalid@gm .] Just trying to get to know something about Nitro, so now replying to an
231091 [kashia.buch@] Oxyliquit.de resides on a (very) crappy virtual server.  When you see a
231105 [invalid@gm .] Thanks for these.  I'll definitely turn up on IRC or mailing list, to see

Windows command & unicode
225149 [m44rt3n@ya o] I have a problem using unicode characters in the windows command.

Re: Windows command & unicod
225153 [wilsonb@gm i] I believe the Windows command prompt displays text using the system
225156 [halostatue@g] Please search the archives. There was a discussion about the
+ 225158 [support@ch l] That's because the DOS console is expecting characters
+ 225185 [m44rt3n@ya o] Thanks, this got me on my way.

ruby odbc and binding OUT parameters in stored procedures
225154 [christopher.] is it possible using ruby-odbc (0.9993) to bind OUT (and/or INOUT)

Group names in regular expressions
225159 [donn@cm cm .] /^(\(?(?<area>[0-9]{3})\)?)?(\-| )?(?<exch>[0-9]{3})(\-|
+ 225173 [nospam@no it] [ 1,2,3,4 ].each do |exch|
+ 225177 [djberg96@gm ] With Ruby's builtin regex engine? No. With Oniguruma (or the Ruby 1.9

Regexp with Ruby
225162 [m_ratheepan@] I have to replace in a File the image tags with an other!
+ 225163 [hgs@dm .a .u] [trimmed]
| 225167 [m_ratheepan@] rubyscript
| 225196 [kbloom@gm il] Works for me with datei_new.scan(/(<img.*?>)/m) (the .*? performs a
+ 225171 [nospam@no it] As another poster has pointed out, you aren't showing enough code for an
225175 [gethemant@gm] If i were to do this..I would use hpricot.

Using diff.rb
225164 [impalapete20] Has anyone ever had any luck getting this to work on a web app.  I am
225194 [halostatue@g] ... so what is diff.rb and where did it come from?

compiling ruby/tk on 64 bit Redhat?
225166 [fkchang2000@] I"m wondering if anyone has successfully done this.  I'm trying to
225930 [nagai@ai ky ] Please try "--with-X11-lib=/usr/X11R6/lib64".
225950 [fkchang2000@] That did the trick.
226018 [nagai@ai ky ] Please try "ruby -r mkmf -e 'create_makefile("tkutil")'".

SVG::Graph::Pie question - labels and padding
225174 [djberg96@gm ] Ruby 1.8.5

*Fast* way to process large files line by line
225179 [dagrawal@cs ] I am using ruby to analyse a huge (around 60G) amount of my networking
+ 225180 [farrel.lifso] Could you not parrallelise the processing of each file? Perhaps using
| 225181 [dagrawal@cs ] Did you mean parrallelizing across multiple files or parrallelizing the
| + 225182 [farrel.lifso] I think this
| | 225183 [farrel.lifso] Whoops! make that
| + 225188 [farrel.lifso] Also try running your code with some sample data through the ruby
| + 225201 [jan.svitok@g] Maybe it's possible to preprocess the files with grep or something
+ 225186 [drbrain@se m] Have you profiled?  Where is your time really coming from?
+ 225205 [shortcutter@] First I have a question: why do you read those files in parallel in the
| 225214 [devesh.agraw] First a couple of stupid things that I am doing, then a couple of more
| + 225226 [nospam@no it] / ...
| + 225265 [shortcutter@] Using regexps inline is the most efficient way in Ruby.  You can find
| + 225268 [aldursys@gm ] Can't harm to try. I use it for uploading large files and it helps
|   225269 [shortcutter@] I beg to differ: it can actually harm to apply an optimization measure
|   225308 [znmeb@ce ma ] Just for the sake of amusement, I did a traceroute to see what the
|   225325 [shortcutter@] Which code?  I saw only the pseudo code from the first posting.  Is
|   225448 [znmeb@ce ma ] I was referring to the pseudo-code.
|   225451 [ara.t.howard] ed.  that quote is aweomse.
+ 225227 [ara.t.howard] <snip commentary>
+ 225246 [znmeb@ce ma ] Basically what you are describing here looks like a poorly specified
```