406015-408940 subjects 406565-407762

clear the STDIN
406261 [lists@ru y- ] DL is deprecated, please use Fiddle
+ 406267 [halogenandto] The simple answer is you should never need to do this. So don't.
| 406269 [cliff.rosson] Don't take the bait dude. :)
+ 406279 [w3gat@nw ag ] If you are using short programs where you request something from STDIN

[ANN] ruby2ruby 2.0.4 Released
406272 [ryand-ruby@z] ruby2ruby version 2.0.4 has been released!

Hash with default
406291 [list.push@gm] I would like to make a hash like h2 with the default described by h in one
+ 406292 [lists@ru y- ] If you want to do it in one line you could create a method which does
| 406294 [list.push@gm] Thanks. I was just wondering if there was a way to create the hash and set
+ 406295 [lists@ru y- ] h = Hash.new {|x,y|
+ 406296 [lists@ru y- ] h = Hash.new {|h, k| k=='two' && h[k]=2 or k=='three' && h[k]=3 or
| 406300 [list.push@gm] What!?
+ 406307 [julian@co et] one line when I create the hash instead of 3 lines and 2 hashes like I =
| 406311 [julian@co et] On 30/03/2013, at 2:45 AM, Julian Leviston <julian@coretech.net.au> =
| 406315 [adam@ap es o] Why not use the block to Hash.new instead of overriding #[] ?
| 406321 [julian@co et] super(key) : key; end
+ 406333 [shortcutter@] I don't think this is a good implementation of a default value: you add
  406350 [list.push@gm] Thanks, everybody.

Program with shuffle program
406301 [lists@ru y- ] I am trying to make my own shuffle method instead of the build-in one.
406302 [chris.hulan@] return shuffled if unshuffled.index == 0
406331 [ryand-ruby@z] return shuffled if unshuffled.empty?

Using parse-cron with chronic
406303 [lists@ru y- ] I'm trying to wrap my head around ruby and I'm attempting to figure out

Re: Need help with shuffle program
406304 [lists@ru y- ] Whoops, how can I not notice that? Thanks much.

Is there any equivalent technique of Array#product?
406309 [lists@ru y- ] Is there any equivalent technique of Array#product?
406310 [adam@ap es o] Yes. Why?
406313 [lists@ru y- ] Out of curiosity.

Nil or enter with no input
406312 [lists@ru y- ] How can I tell if someone has enter nothing in a gets prompt, they only
+ 406314 [lists@ru y- ] Sorry I may have gotten it, check this out.
+ 406322 [lists@ru y- ] You might want to look into String#empty?
| 406340 [shortcutter@] That alone is not sufficient.  You need to at least throw String#chomp in
| 406354 [lists@ru y- ] I he was already using chomp, so I didn't see a point in mentioning it
| 406355 [shortcutter@] Right you are.  I am sorry, I didn't notice Phil added it in his second
+ 406342 [sto.mar@we .] if gets == "\n"
+ 406348 [w3gat@nw ag ] Using enter even with no other character will return a \r\n or \n

Ruby Typing?
406316 [lists@ru y- ] of things. Is there any way in ruby to verify the type of whatever
+ 406319 [lists@ru y- ] Sometimes it's best to let the errors occur, there's already a certain
| + 406324 [adam@ap es o] You could also try x.to_int + y.to_int and use respond_to?(:to_int)
| | + 406326 [cliff.rosson] and x.kind_of?(Fixnum) in addition to Adam's points
| | + 406338 [shortcutter@] Why use respond_to?(:to_int) for detection if you write x.to_int + y.to_int
| |   406339 [adam@ap es o] Hm, true. :) I guess there might be cases where you want a specific
| + 406337 [shortcutter@] Better use Integer for the test because Fixnums turn to Bignums from a
+ 406335 [shortcutter@] Welcome to the wonderful world of Ruby!

[ANN] chorus version 0.0.2 Release
406329 [beholdthepan] Chorus is a command line tool that turns your mac into a chorus of throat
+ 406330 [ryand-ruby@z] On Mar 29, 2013, at 11:05 , Stephen Schor <beholdthepanda@gmail.com> =
+ 406334 [beholdthepan] Thanks Ryan!

[ANN] reconsidered 0.9.2 Released
406332 [jwise@dr ga ] reconsidered version 0.9.2 has been released!
+ 406336 [ryand-ruby@z] You couldn't have waited until monday? :P
| 406347 [jwise@dr ga ] Jim Wise
+ 406349 [tamouse.list] Does this mean there's also hope for the COMEFROM operation? I'd

[ANN] ambit 0.13 Released
406346 [jwise@dr ga ] ambit version 0.13 has been released!

Multithreads, years before and now.
406365 [lists@ru y- ] Being taking a look at the threads behaviour in Ruby, I did that before
+ 406372 [robert.w.jac] On Mar 30, 2013, at 5:20 PM, "Dami=E1n M. Gonz=E1lez" =
+ 406405 [lists@ru y- ] Thanks for answer Robert.

[ANN] unific 0.11 Released
406366 [jwise@dr ga ] unific version 0.11 has been released!

[ANN] ply 0.9.1 Released
406367 [jwise@dr ga ] ply version 0.9.1 has been released!

Grasping methods like "to_s"?
406368 [lists@ru y- ] "string".is_i?
406371 [josh.cheek@g] Since all the classes you would want to put it on inherit from Object, you
406373 [peterhickman] Or perhaps just
406440 [shortcutter@] Herewith I call the "useless use of self award" (UUOSA) to life.  We have a
+ 406453 [lists@ru y- ] Yeah, is_i? was just an example but I guess it would qualify!
| 406457 [shortcutter@] Nah, you missed the point of the award.
+ 406454 [tamouse.list] Is this award similar to the "egregious use of cat" in the *nix
  406458 [shortcutter@] Exactly.  See http://partmaps.org/era/unix/award.html

[ANN] diff-lcs 1.2.2 Released
406369 [austin@ru yf] diff-lcs version 1.2.2 has been released!

[ANN] mime-types 1.22 Released
406370 [austin@ru yf] mime-types version 1.22 has been released!

Ruby Gotchas presentation slides
406375 [rubytalk2dav] I recently made available the slides for a presentation I did
+ 406376 [tamouse.list] Nice presentation
+ 406377 [julian@co et] On 31/03/2013, at 10:55 AM, Dave Aronson <rubytalk2dave@davearonson.com> =
| 406417 [rubytalk2dav] Er, well, yeah, that was kinda the point!
+ 406381 [josh.cheek@g] The double vs single quotes doesn't seem like a gotcha to me.
  + 406382 [julian@co et] ...
  | 406383 [josh.cheek@g] It's IEEE floating point math.
  + 406425 [rubytalk2dav] I was debating that one.  The rule is the same in most languages that
  | + 406427 [me@da id wd ] Please keep this discussion going! I'm getting tons of value out of lurking
  | | 406429 [me@da id wd ] Sorry about that reply. I was responding off my cell phone and it seems to
  | + 406431 [lists@ru y- ] It could be handy to have some gotchas explicitly listed under "gotchas
  |   406432 [rubytalk2dav] Right, that's one of the reasons I was considering breaking them up,
  + 406441 [josh.cheek@g] There's also the opposite side of this, which is that a var in a for loop

installing ruby 2.0 -- no checksum error
406378 [lists@ru y- ] $ rvm install ruby-2.0.0-p0
+ 406379 [julian@co et] Install latest rvm.
+ 406384 [lists@ru y- ] Thanks for the response Jullian.  Now there seems to be a ruby gems
| 406385 [julian@co et] if you did rvm get head, it should install ruby 2.0 by default... :)
+ 406430 [lists@ru y- ] I did $ rvm get stable, which from the rvm website seemed like the right
  406456 [julian@co et] Well I did rvm get head and it worked for me is all.

Re: Grasping methods and monkey-patching?
406386 [lists@ru y- ] OK, thanks both of you.

Private setters can be called by self, why not getters?
406387 [josh.cheek@g] class Counter
+ 406388 [matma.rex@gm] We not only can - we must. In your example, `count = 0` would set the local variable `count`, not call the `count=` method.
+ 406393 [lists@ru y- ] You have to define setters and getters in ruby more carefully, when you
| 406394 [josh.cheek@g] I rarely want to expose either. In my code example, why can I call
| + 406395 [tony.arcieri] It's a hack, because setters require you to use "self.count=" syntax,
| + 406401 [lists@ru y- ] As Tony asid, it's a hack! Private methods (except attribute_writers) in
+ 406406 [lists@ru y- ] You are right, making these protected instead of private seems to be the
| 406412 [josh.cheek@g] You can't hide methods from subclasses.
+ 406416 [lists@ru y- ] I, know you cannot hide methods from subclasses in Ruby. On my quick

uninitialized constant ActiveRecord (NameError)
406389 [lists@ru y- ] require 'ruby-debug'
+ 406390 [josh.cheek@g] ActiveRecord is a class that talks to databases, this gem is expecting to
+ 406391 [robert.w.jac] ...
+ 406409 [lists@ru y- ] ok
  406413 [josh.cheek@g] You need to look in the directory of the script and see if there is a file
  406414 [robert.w.jac] not exist several years ago.

[ANN] Serif version 0.5 released
406392 [adam@ap es o] I'm pleased to announce version 0.5 of Serif. (Note that this release

respond_to? vs include?
406396 [edd.rossi@gm] between respond_to? and include?...
406399 [adam@ap es o] Your benchmark looks okay. I added a comment to your Gist about a fork
406407 [edd.rossi@gm] Thank you so much Adam.
406459 [shortcutter@] Yeah, Array lookup is O(n) - that's what one would expect.  But the Array
+ 406460 [edd.rossi@gm] Considerably more dramatic!
+ 406461 [adam@ap es o] creation has overhead as well.

Refactoring unless statement
406397 [lists@ru y- ] Hey guys,
406398 [lists@ru y- ] puts "Games in your vast collection: #{games.count}" unless games.empty?
406400 [lists@ru y- ] Thanks Joel!
406439 [shortcutter@] Another option

How to quote variable of an array
406402 [lists@ru y- ] Consider the following example;
+ 406404 [windwiny.ubt] p number.to_s
+ 406408 [jgabrielygal] puts %Q{"#{number}"}
+ 406410 [lists@ru y- ] Thank you. Both the answers worked. I have chosen Jesu's answer though.
+ 406411 [lists@ru y- ] If you "p" (inspect) a string, then you'll get quotes because that's how
| 406433 [lists@ru y- ] Thank you. The problem is not solved. The above example does not work
| 406455 [tamouse.list] This looks interesting. What actually does #EnumerateDevice return? In
| 406507 [lists@ru y- ] The mistake is from my part. As you said #EnumerateDevice produces array
+ 406435 [lists@ru y- ] arr = ['a', 'b', 'c']

406403 [gawain0416@g] # help

406415 [echristopher] To get help, you need to send the word "help" to

Ruby Mechanize - Issue in parsing bugzilla page
406418 [lists@ru y- ] I am setting some search parameters on bugzilla Advanced search page
406426 [lists@ru y- ] It sounds like the 'Add' button is triggering an ajax call, which
406438 [lists@ru y- ] Thanks for your response. I came across a post where following is

Recursion with Hash
406419 [lists@ru y- ] h = {a: {b: {c: 23}}}
+ 406420 [lists@ru y- ] p RUBY_VERSION
+ 406421 [tamouse.list] ...
| 406422 [lists@ru y- ] I didn't make the recursion properly. Now I made it proper,but thanks
| 406423 [tamouse.list] the output of that new version looks different from the output you
| 406424 [lists@ru y- ] Yeah! finally changed it.
| 406444 [tamouse.list] What do you mean by 'return the whole modified array' ?
| 406445 [lists@ru y- ] [1,2,3][-1] = 12 returns 12 on same update it would return - `[1,2,12]`
| 406446 [lists@ru y- ] (a = [1, 2, 3])[-1] = 12; a
| 406447 [lists@ru y- ] irb(main):001:0> (a = [1, 2, 3])[-1] = 12; a
+ 406448 [lists@ru y- ] If you want to change the return value of a basic operation like that,
+ 406449 [lists@ru y- ] To be honest, I hope it's not. I was just having a little fun.
| 406450 [lists@ru y- ] Actually I need the last element to be replaced,and after the update I
+ 406451 [lists@ru y- ] If it's something you do commonly then you could always write a method

Ruby and OpenMP
406434 [lists@ru y- ] Has anyone tried to get the OpenMp project to work with Ruby?
406508 [lists@ru y- ] A quick search around shows that yes, some people have tried, but not

[ANN] R2CORBA 1.3.1 released.
406436 [mcorino@re e] Remedy IT is pleased to announce the release of version 1.3.1 of

Saaspose.Newsletter for April 2013 is Out Now!
406437 [lists@ru y- ] Saaspose Newsletter for April 2013 has now been published that

confusion with class_eval
406442 [lists@ru y- ] class A
+ 406443 [lists@ru y- ] is telling you that using a cvar inside #class_eval doesn't do what you
+ 406479 [lists@ru y- ] class A

Modifying Remote Registry with Ruby
406452 [lists@ru y- ] require 'win32/registry'

C API version / functionality detection
406463 [lists@ru y- ] What is a reliable and future proof way of detecting available functions
+ 406464 [matma.rex@gm] The RUBY_VERSION macro?
+ 406582 [lists@ru y- ] Macros containing text such as RUBY_VERSION can't be usefully used by
  406585 [normalperson] Instead of version.h, I suggest ruby/version.h

Exclusively for Rubyists, a community on Facebook
406465 [lists@ru y- ] I was surprised to know that there is no community for Ruby Programming
+ 406467 [lists@ru y- ] Thing is, some people do not use Facebook and never will.
| 406468 [aghorishaivi] Yeah... but some people don't use email, or the internet, or computers.  So
| 406469 [julian@co et] ...
| + 406470 [aghorishaivi] I understand the difference but what I am saying is that just because some
| | + 406471 [julian@co et] ...
| | | 406473 [tamouse.list] I think you should go for it.
| | | 406502 [RubyTalk@gm ] I started an exclusive ruby Diaspora pod in October. No one seems to have
| | + 406499 [shortcutter@] My complain would rather be that a public and open forum like this one is
| + 406506 [normalperson] (top-posting corrected)
+ 406477 [me@da id wd ] Err? There most definitely is a Ruby community on Facebook. There's also a
  406498 [rubytalk2dav] It has over 3200 members, versus the 35 of the new one.  Also the new

Eigenclass: why this syntax?
406466 [lists@ru y- ] module Foo
+ 406472 [josh.cheek@g] module A
+ 406474 [tamouse.list] I can't speak for why this particular notation was used, obviously,

is ruby CGI the good way
406475 [yhpeng@or ng] ...
+ 406476 [julian@co et] ...
+ 406478 [fluido@fl id] What do you need as performance? Lots of hits per second? Because, for

is ruby CGI the good way
406501 [yhpeng@or ng] ...
+ 406503 [me@da id wd ] ...
+ 406504 [adam@ap es o] There were responses, they reached the mailing list and hit the forum.
+ 406505 [jgabrielygal] I saw two answers to your question, one from Julian Leviston and one

I'm writing a Ruby book for SysAdmins!
406509 [lists@ru y- ] I'm writing a Ruby book for SysAdmins and would love to hear any advice

nested loop for xpath
406510 [lists@ru y- ] Rails 1.9.3
+ 406512 [shortcutter@] That does not work.  You need to escape single quotes or use double quotes.
+ 406669 [lists@ru y- ] thank you for your help! It worked.

Role of bundler in creating and installing a gem
406528 [lists@ru y- ] I have a question about the role of bundler when creating a gem. I'm
+ 406529 [josh.cheek@g] I'm pretty sure `bundle new` isn't a thing. If it is for you, then maybe
| 406532 [lists@ru y- ] Urgh, my bad. I meant `bundle gem mygem`!
| + 406533 [adam@ap es o] You can include all (runtime + development) dependencies in the
| + 406536 [josh.cheek@g] The only things I put in the Gemfile would be if they were on Github and
+ 406537 [lists@ru y- ] Yes, I know that you specify dependencies this way in the gemspec, but
| 406540 [josh.cheek@g] You *can* but why would you?
+ 406539 [lists@ru y- ] That makes sense, thanks.
| 406542 [josh.cheek@g] There isn't one
| 406543 [adam@ap es o] I agree with you, but it seems there's a documentation mismatch on
+ 406545 [lists@ru y- ] The reason I brought this up was because I incorrectly specified the

Getting the input of an user with gets() before he hits Enter
406544 [lists@ru y- ] with gets(), I mean I want to know what is he typing before he hits
+ 406553 [matma.rex@gm] Yes, using the 'io/console' library (included in stdlib). it provides, among other things, IO#getch.
+ 406567 [lists@ru y- ] That's great Bartosz! thanks! I'll try it soon.

Exception Errno::EWOULDBLOCK in net/protocol.rb
406547 [lists@ru y- ] I am using the 'rsolr' library on ruby-1.9.3 (Windows 7 64 bits) to
406549 [akr@fs j. rg] I'm not sure what happen.
406552 [lists@ru y- ] I found where the exception came from. My code was called inside a Qt

Best way to strip XML header/tag
406548 [lists@ru y- ] I have a very basic web service written in C# that runs some stuff and
+ 406550 [wbrisett@at ] ...
+ 406551 [lists@ru y- ] I think Nokogiri is the usual tool to navigate XML and HTML documents.

Change fond color based on dark/light bg [Sinatra,HAML,CSS]
406554 [atma@co va e] Dear Sirs,
406556 [fluido@fl id] You can extract the average luminosity from an image - just decompres
406557 [atma@co va e] Thanks, that's a great idea. I'll give it a shot.

How do you know what the main file in Ruby Projects is?
406555 [pete0verse@g] I have been using C for a while and I was wondering how you can tell
+ 406558 [fluido@fl id] Ruby is an interpreted language - you always execute the interpreter
| 406560 [lists@ru y- ] this line is wrong, use
| + 406561 [fluido@fl id] ??
| + 406562 [me@da id wd ] Actually its not wrong. What it does is explicitly state which ruby
|   406563 [matt@te hn r] As and operations person, I will point out that using
|   406564 [lists@ru y- ] or on the other hand, when #!/usr/bin/ruby is used in a gem, users gets
|   406566 [matt@te hn r] No, it can't.  Been there, done that.  Most developers are really smart
|   406570 [halogenandto] I'm interested in the issue with using env, but I find you explanation a but=
|   + 406571 [me@da id wd ] The simplest issue is that env uses the first ruby it finds in the PATH variable. Now, say you're running an application that works fine, and uses Ruby 1.9.x specific syntax such as the new Hash syntax. Now, the PATH gets modified and the Ruby in the path is changed to, say, Ruby 1.8.7. The application in question (script/whatever) will puke. Ruby 1.8.x doesn't understand that new syntax.
|   | 406574 [halogenandto] I suppose the problem is that osx comes with a system ruby install which is d=
|   + 406573 [matthew@ke w] but hard to follow. What are some situations that lead to the problems you
|     + 406576 [halogenandto] only ever required by other ruby scripts?
|     | 406575 [halogenandto] Looking into rails, even it uses /usr/bin/env for determining the ruby
|     + 406577 [matma.rex@gm] Some gems include executable scripts. Examples would be Ocra or ruby_parser.
|       406578 [matthew@ke w] Interesting.  How do they get added to the shell path, so you can execute
|       406579 [halogenandto] them?  Or do you have to write
+ 406559 [shortcutter@] robert@fussel:~$ ruby a.rb