233921-237792

233677-237122 subjects 234174-246860

How does Array.map work for 2D arrays?
233921 [karthik.nar@] pt = [ [ "Check", "check" ], [ "Credit card", "cc" ], [ "Purchase
+ 233925 [shortcutter@] irb(main):001:0> def foo() yield 1,2 end
| 233936 [karthik.nar@] wow, robert, that makes a lot of sense Thanks !
| 233941 [shortcutter@] You're welcome!
| 234552 [slamboy@gm i] ...
+ 234069 [rabbitblue@g] Two points. First, I don't know how it figures it out. Second, your
  234072 [karthik.nar@] yes makes sense!!

"soemthing".pluralize/at/from/... -> NoMethodError
233938 [david.krmpot] I've been wondering about this for some time now.. Why don't any of the
+ 233939 [dblack@wo bl] Those methods are add-ons that come with Rails.  They're not part of
+ 233955 [jamis@37 ig ] David,
  + 234000 [david.krmpot] Ok, that explains everything  - thank you very much Jamis, I appreciate
  | 234150 [david.krmpot] irb(main)> require 'rubygems'
  | 234162 [david.krmpot] irb(main):001:0> require 'rubygems'
  | + 234204 [halostatue@g] Yes. require_gem is deprecated. Don't use it if at all possible.
  | + 234367 [showaltb@gm ] require_gem is "good"; it just isn't doing what you think it does.
  + 234049 [nlloyds@gm i] ...
    234139 [cladev@gm il] I think you must require 'rubygems' after 'active_support'.
    234140 [cladev@gm il] "you must require 'rubygems' before 'active_support'" (s/after/before)

A Game Engine for Ruby somewhere ?
233945 [user@do ai .] Ruby (not a raw opengl binding)
234133 [GGarramuno@a] Irrlitch (spelling?) has some ruby bindings.

Question about Array's size instance method
233946 [matthew.gret] I have a quick question regarding the way the size instance method works
233948 [TimHunter@nc] Ruby always knows the current size of the array. It doesn't have to be
233949 [dblack@wo bl] I'll just add, in case it helps with future understanding of something
233972 [gwtmp01@ma .] Call me pedantic, but I think it is important to point out that Dave's
234094 [dblack@wo bl] I won't call you pedantic, if you don't call me Dave :-)
234112 [robert.dober] ...

Re: Number Spiral (#109) [solution]
233956 [rubytraining] Here's my solution to the quiz.  I used a recursive solution.  An
233964 [rubytraining] Here's a modified version of my previous solution that uses no arrays

possible to un-warn?
233963 [dchelimsky@g] cat.should_eat "tuna"
+ 233982 [wilsonb@gm i] Unfortunately this happens in parse.y, without any conditional code
| 233987 [dchelimsky@g] Bummer. Well, you're a rails developer - how much would this syntax
| + 234001 [wilsonb@gm i] That looks totally fine. "Even" as a Rails developer, I use parens
| | 234023 [dchelimsky@g] Remember the whole sugar causes cancer thing? I've added suppport for
| | 234029 [wilsonb@gm i] @hotel.should.be_booked_solid_on "12/31/2007"
| | 234098 [dchelimsky@g] YES!!!!!!!!!!!
| | 234141 [Gennady.Byst] You may have missed it, but it was exactly what I have suggested (or
| | 234143 [dchelimsky@g] Ah - I did miss it.
| + 234144 [mvette13@gm ] ...
|   234348 [dchelimsky@g] That idea came up a long time ago on the rspec list and got a pretty
+ 233989 [Gennady.Byst] It used not to warn in Ruby 1.6.4, by the way. I also experienced the

how to translate base 10 number into base 2 number
233969 [chen_li3@ya ] I want to write a method to tranlate base 10 number
+ 233974 [rubytraining] def ten_to_two(num1)
| 234570 [chen_li3@ya ] Thanks for the explanations. It helps me out.
| 235677 [roland.mai@g] ...
+ 233975 [khaines@en g] This doesn't answer your question, but in case you were not aware, Ruby
  + 233977 [chen_li3@ya ] Thanks. But is is possible do the opposite, from
  | + 233978 [jtregunna@bl] "111101".to_i(2)
  | + 233985 [khaines@en g] puts '1111101'.to_i(2)
  + 233994 [umageller@gm] TAWLWTDIT
  | 234002 [shortcutter@] Since we start collecting solutions...
  | 234012 [umageller@gm] readable and concise
  + 234085 [raymond.jaco] Is there a way to pad the result with leading zeros
    + 234090 [shortcutter@] irb(main):004:0> "%08b" % 4
    | 234095 [raymond.jaco] Thank you,
    + 234092 [angus@qu va ] (speaking of strings...)

Re: curb problems on OS X [RESOLVED]
233980 [lists@ka am ] Just FYI, it looks like this has been fixed with curb version 0.1.2

Re: Problems with Posting to comp.lang.ruby, due to gateway
233986 [ snk@gn .o g] RubyForum (www.ruby-forum.com) is one such alternative.

[ANN] Curb 0.1.2
234006 [rosco@ro co ] Curb 0.1.2 is now available from the curb project on Rubyforge

Installing FileUtils Module
234018 [lovell.mcilw] Does anyone know how I can install the fileutils module for ruby? or
234024 [wilsonb@gm i] FileUtils is part of the Ruby standard library. You just need to

File.rename says file name is to long
234019 [lovell.mcilw] Hey guys,
+ 234022 [vincent.four] test.to_s is a single string containing the concatenation of all the
+ 234026 [slamboy@gm i] ...
+ 234034 [jan.svitok@g] you can write just (unless you want to append the data, in which case

[QUIZ] Number Spiral (#109) [solution]
234031 [flevour@gm i] This is my first partecipation to Ruby Quiz. I developed a pretty messy
234037 [ruby-talk@do] #!/usr/bin/env ruby

Ruby 1.8.2 install missing mkmf.rb on Red Hat Linux
234042 [billmcn@gm i] My version of Ruby on Red Hat Linux is missing mkmf.rb.
+ 234043 [drbrain@se m] This is probably due to Red Hat breaking ruby.  mkmf.rb has been part
+ 234045 [matt@ke tl w] Isn't Ubuntu a Linux Distro?
  + 234047 [drbrain@se m] No.  This is a bug.
  + 234048 [billmcn@gm i] Ubuntu is a Linux distribution.  I meant to say "..would apply to a Red

Re: Ruby 1.8.2 install missing mkmf.rb
234050 [matt@ke tl w] Well, we'll just have to agree to disagree. It's a Bikeshed matter,with

[ANN] keybox 1.0.0 Released
234052 [jeremy@hi eg] keybox version 1.0.0 has been released.
+ 234056 [gregory.t.br] Neat. you may want to look at Highline for OS independent password entry.
| 234134 [jeremy@hi eg] I considered using Highline and even looked at how it handled stty
| 234149 [gregory.t.br] Just vendor HighLine with your tool.  It's only like, 3 or 4 files,
| 234229 [jeremy@hi eg] I don't know why I didn't think of that.  Sounds good, I should
+ 234066 [andre@bo ho ] Nice, but it looks terrible on my whiteish terminal. Is there an easy =20=
  + 234146 [gregory.t.br] To double plug, Highline would make that easy too. :)
  + 234227 [jeremy@hi eg] Not from a user-configurable standpoint.  But its a great idea so I'll
    + 234234 [gregory.t.br] You don't have to :)
    | 234237 [gregory.t.br] Oh, i didn't quite understand the question.  You should definitely use
    | 234261 [jeremy@hi eg] Yeah, something along those lines.  I'll give it some thought and see
    | 234265 [gregory.t.br] Cool!  If you'd like to submit a patch send it to james <at>
    + 234278 [andre@bo ho ] Sure :-) I have set my Terminal.app to white on black for the time =20
      234281 [jeremy@hi eg] Yeah, a convert!.  Are you able to take advantage of --import-from-csv ?
      234283 [andre@bo ho ] Sure. Works fine.

Error when tryinh to install cached_model
234058 [abhishek@uz ] when i m trying to install cached_model using gem so i m getting error
234060 [abhishek@uz ] The actual problem seems to be that cached_model requires hoe. Hoe
234061 [drbrain@se m] The mirrors should be cleared out now, but you may need to delete

Can anyone try to solve this problems?
234063 [gabilla19992] ...
+ 234107 [slamboy@gm i] ...
| 234547 [gabilla19992] ...
+ 234160 [moose56@gm i] Is this from the Brian Schroder Ruby Course PDF?
| + 234213 [danfinnie@op] That is the classic searching algorithm (almost).  However there is
| + 234222 [gregory.t.br] ['fodfsafdfsdfso','bar','bazzzzzz'].sort_by { |s| s.length }.pop
| | + 234247 [nobu@ru y- a] max_by(&:length)
| | | + 234253 [botp@de mo t] # > ['fodfsafdfsdfso','bar','bazzzzzz'].sort_by { |s| s.length }.pop
| | | | + 234311 [invalid@gm .] enum.max { |x,y| x.length <=> y.length }
| | | | + 234366 [nobu@ru y- a] I don't think so, but Symbol#to_proc was incorporated from
| | | + 234259 [gregory.t.br] Looking forward to 1.9 Nobu! :)
| | + 234260 [moose56@gm i] The beauty of a one line solution :-)
| |   234264 [gregory.t.br] This is an Enumerable method from 1.9
| + 234408 [martin@sn wp] Well, okay, we've heard from folks with their fancy 1.9 ruby with
|   + 234413 [gregory.t.br] Daniel, this is a much better solution than my sort_by one.  So good work! :)
|   + 234415 [ssmoot@gm il] => "three"
|     + 234417 [gregory.t.br] Yep, this is smarter than my ruby attempt :)
|     + 234484 [martin@sn wp] Why build up a separate hash structure?
|       234492 [ssmoot@gm il] It's simpler to my eyes. It's also (admittedly unintuitively) faster
+ 234226 [botp@de mo t] #---------------------------------------------------------------

Binding to Java based Websphere MQ libraries
234067 [phillipsds@y] IBM make available a fairly comprehensive collection of Java classes
234172 [Rob@Ag le on] Well, I'd say Google for a bit first...
234303 [phillipsds@y] Thanks for the response Rob,
234328 [Rob@Ag le on] Dave,
234514 [phillipsds@y] Thanks for the tip on Groovy, I'd not come across this before, but it

a 2Dgraphics alike lib for ruby ?
234071 [fugitif@sd .] all in subject :( ... i've seen stuff like tioga (linux) or gnuplot, but
+ 234166 [vjoel@pa h. ] There's the TkCanvas widget, which you can use through Ruby's Tk
+ 234177 [no@sp m. le ] RMagick gives you a drawing API into an in-memory image,

keystrokes detection for non-control, meta key
234073 [teeshift@gm ] I have tried
234167 [vjoel@pa h. ] Try
234476 [teeshift@gm ] Thank you Joel.
234502 [vjoel@pa h. ] You're welcome!
237786 [teeshift@gm ] Thanks. Joel.
237792 [teeshift@gm ] Ignore my previous message. The answer is at

cannot return negative value ?
234078 [josselin@wa ] parse error, unexpected tUMINUS_NUM
+ 234080 [farrel.lifso] return userCredentials.flagged? ? -1 : 1
| 234087 [josselin@wa ] hanks a lot first time I was using this kind of return... ;-))
+ 234081 [peter@ru yr ] You mean
| + 234086 [josselin@wa ] thanks a lot first time I was using this kind of return... ;-))
| + 234088 [farrel.lifso] This seems to work though
+ 234093 [lists@be tr ] when saying
+ 234132 [nobu@ru y- a] Because `return' is a statement.  In Ruby, a "statement" is

How to realize method/function overloading in Ruby?
234079 [shiwei.zhang] I think Function Overloading in C++ is very meaningful. And currently
+ 234117 [gwtmp01@ma .] This is a common question.  The short answer is that function
| 234275 [gregory.t.br] def do_something(a)
| 234276 [gregory.t.br] ...
| 234277 [gregory.t.br] Jeez! Sorry for the 3 emails, I must be tired.  This is the little
+ 234121 [gavin@re in ] Can you provide us with a few real-world cases where you would want to
| 234268 [shiwei.zhang] ...
+ 234129 [shortcutter@] You can find a page linked from this Wiki page - currently our network
+ 234142 [vincent.four] ...
+ 234280 [GGarramuno@a] It isn't.

using ruby in place of C
234082 [christopher.] "there is a C interface provided so that user codes can be written in C
+ 234084 [dido.sevilla] But you will have to work at writing a Ruby extension in C that uses
+ 234122 [shevegen@li ] What are "user codes"?

newbie question about sets
234099 [slamboy@gm i] ...
+ 234100 [slamboy@gm i] ...
| 234101 [fxn@ha hr f.] Yes, that implements sets as defined in math. What you wanted is
| 234103 [zack@bo on a] class MultiSet < Set
| 234105 [zack@bo on a] Answering to myself ...
| 234128 [shortcutter@] irb(main):001:0> multi_set = Hash.new 0
+ 234211 [danfinnie@op] You shouldn't really have to avoid this.  The 6 letter word should be 6
  234216 [slamboy@gm i] ...

unpack 4 bytes to a signed integer
234104 [duzuike@gm i] I' m using unpack to convert 4 bytes to local integer, but ruby just
+ 234109 [mike@st k. a] There are "i" and "I" for signed and unsigned integer respectively,
| 234118 [duzuike@gm i] But the "i" and "I" modifer don't care bytes order.
| 234127 [mike@st k. a] OK then, what about "V"? "treat 4 characters as an unsigned long in
+ 234120 [erikveen@gm ] s = 0xFF.chr * 4
+ 234123 [erikveen@gm ] s = 0xFF.chr * 4
+ 234173 [vjoel@pa h. ] The best way I've found is to unpack with N (to get the swapping right)
  234326 [duzuike@gm i] I tried your codes, it works exactly as what I expected. I havn't

Array#modified
234106 [juozas@tu sd] a = []
+ 234108 [rmagick@gm i] Check out the Observable class in the standard library.
| 234111 [juozas@tu sd] Thanks for your prompt reply. Unfortunately Observable is not what I'm
| 234126 [shevegen@li ] "I'm assuming something like this exists (specifically for the Array
+ 234110 [ruby@an hr p] You can sort of do this, but an object does not know what variable(s) it is
| 234114 [shortcutter@] Alternative approach would be to use Delegator to wrap an Array instance.
+ 234131 [flori@ni e. ] class Changed
  234137 [juozas@tu sd] I like this solution because it's short. However, it requires cloning

ANN: Rails UAE meeting #1 - January 2007
234130 [rbarazi@gm i] Ruby on Rails has taken the development world by storm, and has been

Qtruby - calling a C application
234138 [fredrik.joha] I am writing a GUI with Qtruby, which is working great. I am also using
+ 234147 [richard.j.da] I've just downloaded the RTP sources, and see that they are very old
+ 234153 [vincent.four] If I understand you right, you're running an external application and
+ 234154 [vincent.four] If I understand you right, you're running an external application and
| 234294 [richard.j.da] Yes, you're right it is in Qt4, and it does sound possible to do what
+ 234295 [fredrik.joha] Thanks for helping! I think I am in over my head here though, after
  234296 [vincent.four] Well, I'm disappointed ;-). I hope you would try and explain us

[ANN] Ruby-VPI 15.0.1
234148 [ snk@gn .o g] Ruby-VPI is a Ruby interface to IEEE 1364-2005 Verilog VPI.

Silly codeing error
234152 [adrian@ha g1] I am a new programmer of ruby and am reading the pickaxe book. Working
+ 234156 [wilsonb@gm i] Check the spelling there. :)
| 234200 [adrian@ha g1] Yes thank you I now know my error!!
+ 234157 [tim.pease@gm] def initialize( name, artist, duration )
| 234197 [adrian@ha g1] Yes thank you I now know my error!!
+ 234161 [moose56@gm i] How have you spelt initialize??
  234198 [adrian@ha g1] Yes thank you I now know my error!!

Ruby on Mac OS X
234155 [damphyr@fr e] Looking for pointers to installation guides for Ruby on Mac OS X.
+ 234158 [andy@pe da c] I would (and do) use macports at http://www.macports.org/.  Then it's
+ 234159 [eoghanj@gm i] Have a look at the macports site: http://www.macports.org/
| 234171 [lovethebomb@] ...
| 234189 [ruby@ph li .] And here's an updated version of that... mostly it's just my notes from
+ 234379 [matt@ti bi s] I installed 1.8.5 on Tiger easily without using MacPorts or anything
+ 234602 [ryan@NO PA e] I'm a Mac n00b who needed the same advice. First I found Fink but that
  + 234627 [olsonas@gm i] I completely agree. The key here is that using MacPorts gives you a
  + 234644 [jameshcunnin] It didn't create a symbolic link because it wouldn't want to mess with

regex: \<start-of-word, and end-of-word\> not in gsub?
234163 [shea@nu l. e] I often use \< and \> to denote the start and end of word.  But they
234168 [rodrigo.berm] "xword1 word2 tword3".gsub( /\bword/, 'XXXX' )

Nuby question on Class Variable and Class Instance Variable
234169 [rubylearner@] ...
+ 234202 [slamboy@gm i] ...
+ 234233 [gregory.t.br] article around a recent discussion of this on the list.

Q: How can a Rake task know the caller's directory?
234170 [james.britt@] I'm increasingly using rake files for common system tasks.  Since Rake
+ 234178 [vjoel@pa h. ] No idea. One possible solution is to put a "stub" rakefile in the dir,
| 234209 [james.britt@] Right, that's the whole point.  For example, I have a Rake task that
| 234217 [transfire@gm] how are you accessing "This is my log message" in your task?
| 234218 [james.britt@] ARGV.shift # remove the task name
| 234232 [jim@we ri hh] rake com MSG="This is my log message"
| + 234246 [transfire@gm] why did you choose to use environment vars here. isn't that sort of
| | + 234312 [jim@we ri hh] The fact they look like environment variables is delibrate.  This allows
| | + 234344 [james@gr yp ] rake com RAKE_MSG="This is my log message"
| |   234374 [transfire@gm] Hmm... maybe. Think I'll just use a single env var and parse that I
| + 234251 [james.britt@] Right, but too much effort for the user.  Leaves too much room for James
|   234448 [llasram@gm i] Not perfect, but you could make your 'r' shell alias a shell function
+ 234199 [GENIE@pr di ] Modify rake to log the initial working directory before doing anything
| + 234207 [james.britt@] I've hacked ruby apps in this manner before, but they are prone to "gem
| + 234215 [james.britt@] I've tried that out, and it works quite well.
+ 234231 [jim@we ri hh] task :whereami do
  + 234248 [gfunk913@gm ] Checkmate, Mr. Weirich.  I looked in run/load_rakefile, but neglected to
  | 234313 [jim@we ri hh] You can thank Jim Freeze for suggesting this feature.
  + 234252 [james.britt@] Perfect.  Thanks!
  + 234356 [james.britt@] I had looked for such a method in ri and the Rake rdocs, but saw nothing
threads.html
top