238527-245556

238273-388714 subjects 238706-313943

Hash into Two Arguments (for REXML)
238527 [keith@au io ] Hey,
238610 [shortcutter@] a.add_namespace(*RDF_NS..each {|k,v| break k,v}}

Upgrading standard libs in ruby (soap4r)
238533 [jurglic@gm i] I'm trying to upgrade my soap4r ruby standard library. I've installed
238562 [halostatue@g] require 'rubygems'

Do not understand this
238534 [bruparel@me ] I am going through Dave Thomas's Programming Ruby Second Edition book.
238536 [wonado@do ne] Windows waits for an Input!
238537 [rodrigo.berm] As Wolf stated the problem is with the 'date' command on windows.
238541 [bruparel@me ] Thank you gents.
238543 [drbrain@se m] The syntax `cmd` calls the method #`  You don't need the closing

Call a method before a method is called?
238535 [bjohnson@me ] Does ruby have "hooks". Where I can define, let's say, a method called
+ 238540 [rodrigo.berm] def lady
+ 238549 [bofh@so tm d] require 'blank' # http://pastie.caboo.se/26558
  238555 [bofh@so tm d] correction http://pastie.caboo.se/39410 ..

tr does not work with non-english chars
238539 [joaomiguel.p] if I do this
+ 238542 [ruby.hardwar] In your second example, the string contains 'a' but after tr....
+ 238548 [robert.dober] ...
  238551 [joaomiguel.p] I can't get my answer from your answers, sorry
  + 238553 [ruby.hardwar] ...
  | 238554 [joaomiguel.p] cool but what I want is
  | 238564 [ruby.hardwar] Seriously, I only work with English and Japanese characters so if thatdidn't fix your problem then the only thing I know to try is $KCODE ='u'.If that doesn't help, maybe someone else can help.
  | 238566 [joaomiguel.p] Thanks all, i'm done
  + 238558 [robert.dober] ...
    238560 [joaomiguel.p] that's ok :) it seem you're not seeing my problem I'm using the char

Idiom for dynamic loading of an unknown class from a known file
238552 [rubylearner@] ...
+ 238557 [ara.t.howard] dynaload does __exactly__ this.
+ 238559 [vjoel@pa h. ] # http://redshift.sourceforge.net/script

getting warning messages about gem obsolete
238556 [Raeka8@ya oo] I uninstalled my old ruby (v 1.8521 I think it was), and installed
238563 [TimHunter@nc] Do you have an .irbrc file? Does it use "require_gem"? If so, edit the
238587 [Raeka8@ya oo] I just did a search on my computer and I didn't find any .irbrc files.

[ANN] fastthread now default in ruby_1_8
238561 [knu@iD em ns] I have just finished integrating MenTaLguY's fastthread mutex
239224 [mental@ry ia] The version of fastthread which was merged doesn't handle interrupted

validates_confirmation_of not working
238567 [joaomiguel.p] well, here I am again :)
238577 [halostatue@g] This is a rails-specific question asked on the general Ruby mailing

Generating instance variable for a class
238572 [donn@cm cm .] What I am trying to do is use a hash to tie attributes to an input
238576 [gregory.t.br] ri instance_variable_set

Re: gem update --system broke rubygems?
238580 [halostatue@g] Something has gone bonkers with your source cache. Mine is in

Cisco and network products for sales
238583 [smokey_jnr00] S. A. TRADING (UK) LIMITED

Windows and Ruby - Not very good friends?
238584 [bruparel@me ] I am new to Ruby and RoR, so pardon me if I ask naive questions.
+ 238590 [slamboy@gm i] ...
+ 238595 [cmshea@gm il] Bharat,
+ 238596 [cmshea@gm il] I just saw Jason Mayer's response in ruby-talk-google.  I bet he's
+ 238603 [wonado@do ne] This is a typical problem when running a program from inside "SciTE" and and an
  238628 [bruparel@me ] Gents,
  238637 [wonado@do ne] It is <CNTL>+Z or <CNTL>+D in a Windows console (I don't know which one, both
  238640 [bruparel@me ] Thanks Wolfgang.
  238644 [bruparel@me ] Follow-up question for Chris, Wolfgang, and anyone else who has
  + 238665 [wonado@do ne] Well, I started to build some libraries and techniques for textual analysis. To
  + 238698 [slamboy@gm i] ...
  + 238764 [richard.conr] It depends on whether the output of your effort is (1) a Ruby application

Re: - PathEditor 1.0.0 - A command line utility for managing
238585 [apeiros@gm .] Not sure, but if you wanted the latin one, that's "Nota Bene".

fib_example.rb
238588 [Raeka8@ya oo] I am reading the Programming Ruby book by Dave Thomas (2nd edition)
238589 [rubygeekgirl] ...

Firebrigade + hoe?
238593 [schapht@gm i] I used newgem to create my 'sparehand' gem.  The rakefile now depends
+ 238599 [hhausman@gm ] hth,
+ 238624 [cdcarter@gm ] Hoe automatically injects itself as a dependency.
  238718 [schapht@gm i] In the 'newgem' case it doesn't.  Thanks, Harold, for that blog entry.
  238822 [schapht@gm i] w00t!  http://firebrigade.seattlerb.org/gem/show/sparehand

Randomly Sorting Strings
238600 [wood_yee12@h] string each time it's run from a list of strings.
238601 [phillipsds@y] try
238602 [apeiros@gm .] example= %w[one two three cat dog cow table].sort_by { rand }
+ 238608 [robert.dober] ...
| + 238609 [apeiros@gm .] I apologize. I didn't read the current quiz.
| | 238615 [robert.dober] ...
| | 238659 [james@gr yp ] Overlap happens.  No big deal.  It just means I chose well for the
| + 238623 [robert.dober] ...
+ 238614 [dblack@wo bl] puts example

isNaN() ruby equivalent?
238605 [vincent-fran] what is the equivalent to isNaN in ruby?
238606 [sander.land@] Float#nan?

Inter process semaphore
238611 [stonkajr@gm ] Is there a way in ruby to use global system's semaphore. I am using
238622 [ara.t.howard] -a

Inter process semaphore
238612 [stonkajr@gm ] Is there a way in ruby to use global system's semaphore? I am using
238618 [kashia.buch@] Simple C ext + normal semaphores?  AFAIK when calling a C ext, Ruby

Getting my sister to learn programming
238613 [sonoflilit@g] ...
+ 238619 [mushfeq.khan] ...
| 238620 [sonoflilit@g] ...
| + 238621 [sonoflilit@g] ...
| | 238675 [benjohn@fy h] That's really cool! I can't see how it works. Doesn't seem to be SVG.
| | + 238712 [ilmari.heikk] It's using the canvas[1] tag, a vector graphics canvas built into
| | | + 238769 [benjohn@fy h] Oooh, wonderful! That's kind of what I've been looking about for.
| | | + 238876 [botp@de mo t] # You can do fun stuff like
| | |   238982 [ilmari.heikk] Canvas works pretty nicely for making flashy HTML GUIs, here'sa small proof-of-concept http://www.cs.helsinki.fi/u/irkheikk/login2.html
| | + 238751 [sonoflilit@g] ...
| + 238672 [benjohn@fy h] Do you have to pick one language? When people decide to write a game,
+ 238702 [m_goldberg@a] I think Logo is great as a first computer language. There are some
| 238732 [B.Candler@po] How about sticking it up on rubyforge?
| + 238737 [B.Candler@po] $ irb1.8 -rtkturtle
| | 238830 [m_goldberg@a] The Ruby Quiz turtle graphics kit is more Logo-like. One can write in
| + 238829 [m_goldberg@a] 1. It's already available (except for some of my Logo translations)
+ 238744 [v.konrad@ls ] the reason being that the "syntax" of scheme is so regular and easy to
+ 238754 [sonoflilit@g] ...
| + 238786 [v.konrad@ls ] maybe it is not used much (meaning being popular), but my very good
| + 238836 [sonoflilit@g] ...
| | 238838 [martindemell] With PLT scheme, almost certainly. It ships with a very nice
| | 238856 [sonoflilit@g] ...
| | + 238861 [martindemell] Hard to say. I speculate that it's because there are more attractive
| | | 238863 [sonoflilit@g] ...
| | | 238865 [martindemell] None that I can see - it looks like a less powerful language, overall,
| | | + 238866 [sonoflilit@g] ...
| | | | 238868 [martindemell] You misunderstand - you can almost certainly do anything quicker in
| | | + 238922 [GGarramuno@a] Best Basic clone I have found is Blitz Max.  It is the new generation
| | + 238910 [sonoflilit@g] ...
| |   238915 [richard.conr] serious argument against Ruby you have raised is the English factor,
| |   238917 [sonoflilit@g] ...
| + 238916 [GGarramuno@a] On Feb 12, 11:56 am, "M. Edward (Ed) Borasky" <z...@cesmail.net>
|   238918 [sonoflilit@g] ...
+ 239006 [ snk@gn .o g] How about Loro?
  239008 [sonoflilit@g] ...
  239262 [mushfeq.khan] ...
  + 239287 [sonoflilit@g] ...
  + 239288 [martindemell] javascript itself is a beautiful language, but trying to do anything
    239290 [sonoflilit@g] ...

[SOLUTION] One-Liners (#113)
238616 [gavin@re in ] Here are my solutions to Quiz #113. For some of them I just couldn't
+ 238652 [kbloom@gm il] Good answer. you helped me golf mine down a little bit by getting rid of
| 238666 [kbloom@gm il] Another answer, based on yours, this one is exactly one expression (no
+ 238693 [james@gr yp ] When I built the quiz, I used the following solutions to reality-
  + 238739 [robert.dober] ...
  + 238755 [robert.dober] ...

Re: One-Liners (#113)
238617 [gavin@re in ] Bah, of course the 80-char lines wrapped and got confusing with my
238642 [cmshea@gm il] I wasn't able to get down to less than 80 chars on two of the items.
238650 [kbloom@gm il] Too long: 96 characters (but I couldn't get it under 80 either)
238679 [gavin@re in ] Argh! #select is exactly what I should have used. Nice.
238724 [gavin@re in ] On Feb 11, 4:40 pm, James Edward Gray II <j...@grayproductions.net>
+ 238726 [gavin@re in ] Elegantly small!
| 238760 [rubytraining] When I saw that, I thought that it could definitely be shortened by
| 238762 [robert.dober] ...
| + 238763 [robert.dober] ...
| + 238798 [alex@bl ck e] Given the equal lengths, I prefer this - the r=[];...;r idiom strikes me
+ 238803 [james@gr yp ] Thank you.
  + 238810 [gavin@re in ] On Feb 12, 10:29 am, James Edward Gray II <j...@grayproductions.net>
  + 238812 [robert.dober] ...
  | 238815 [robert.dober] ...
  | 238823 [james@gr yp ] How does this code work?  You pass arguments to methods we don't
  | 238850 [robert.dober] ...
  + 238972 [kbloom@gm il] (h=lambda {|n| n==1 ? [1] : [n] + h[n%2 == 0 ? n/2 : n*3+1] })[23]
    238975 [james@gr yp ] Exactly.
    238977 [robert.dober] ...
    238979 [james@gr yp ] Hmm, I wasn't aware of this.  What makes you say that?

remove element from array
238629 [joaomiguel.p] how can I do to rtemove an elemnt from an array,
238630 [joaomiguel.p] sorry for making loosing your time. I'm a looser :)
238631 [dblack@wo bl] See the docs for Hash#delete, Hash#delete_if, and Hash#reject!  (That
238632 [joaomiguel.p] I'm done!

Very interesting paper about future programming models
238635 [garbagecat10] Note the mention of Rails at the end of Section 2.0.
238638 [keith@au io ] It is striking, however, that research from
+ 238648 [garbagecat10] Are you expecting another round (or more) of massive improvements in
| + 238654 [webcontrol@h] 1)  Multivalue Logic (Nasty)
| | 238667 [benjohn@fy h] Seeing as it makes use of a Tuneable Flux Transformer, I'm pretty
| + 238670 [benjohn@fy h] Quite so :)
+ 238658 [halostatue@g] I'd rather have an EE-CS department than a Math-CS department. I'd
+ 239092 [timx@no pa .] I'd rather that than what has happened to my old department, which has become
+ 239567 [Tim.Bray@Su ] Let me rephrase that.... general purpose computers always beat

editing environment.rb files
238636 [Raeka8@ya oo] I did a search on the internet to try to find a way to get rid of
+ 238649 [cdcarter@gm ] The environment.rb suggestion is only if you use Ruby on Rails.  The
| 238664 [Raeka8@ya oo] Thanks for the reply.
| 239037 [ml.chibbs@gm] ...
+ 238733 [B.Candler@po] As usual, the best way to do anything in Windows is to do it in DOS :-)

Creating an object the hard way, made easy with lambda
238639 [grettke@gm i] #!/usr/bin/env ruby

[ANN] AWS Presentation at the Feb. Phoenix Ruby User Group Meeting
238645 [james.britt@] See http://www.rubyaz.org/groups/prug for address and map

Socket Problem
238653 [M1-TIC-ISC@r] I've a problem with socket using in ruby.

What's the correct and fast way to determine if a (gig) number is a perfect square?
238655 [sam.s.kong@g] I'm solving a math problem in Ruby.
+ 238656 [vjoel@pa h. ] x = 123456789123456789
| 238831 [sam.s.kong@g] Yes. Your approach is better than mine.
| 238834 [vjoel@pa h. ] Wrong how?
| 238840 [sam.s.kong@g] I think even if you use #round, the problem won't go away.
| + 238845 [gavin@re in ] irb(main):004:0>
| + 238847 [vjoel@pa h. ] I agree, but I don't think the problem shows up until you have much
|   238942 [neleai@se na] Best is use GMP. Other methods are binary search. Or bigdecimal with
+ 238671 [fxn@ha hr f.] There are faster algorithms based on the fact that most non-squares
  238816 [fxn@ha hr f.] I've been able to consult the book today. There is a specialised
  238833 [sam.s.kong@g] I really appreciate your kind help.

[ANN] Dhaka-2.0.1 housecleaning
238660 [mushfeq.khan] ...

Generator implementation
238663 [godfat@gm il] I was reading the Generator implementation a few hours ago,

How do I put empty directories into a gem package?
238669 [lbayes@gm il] I feel like an idiot for being unable to get this working...
238697 [halostatue@g] Um. I'm not sure that's what you want to do. Why not consider
238703 [lbayes@gm il] I definitely considered that direction, and even got it mostly-
244973 [lbayes@gm il] Does anyone else have any ideas about how to solve this problem?
245556 [drbrain@se m] Please give some code that shows how this is broken.

creating/accessing class vars from modules being used as mixins?
238680 [cjbottaro@gm] I'm writing a module that is to be used as a mixin for classes.  I
238684 [james@gr yp ] Class variables have confusing inheritance rules, that I don't think
238687 [cjbottaro@gm] Wow, thanks for the fast response.  Your solution worked perfectly.

Regular expressions
238681 [joaomiguel.p] I'm burning my head because i don't understand how regular expressions
+ 238682 [TimHunter@nc] I think more details are necessary. What characters are allowed in
+ 238683 [vincent.four] /[a-z]+(\.[a-z]+)?/
  238685 [joaomiguel.p] First of all, thanks for the attention.
  + 238694 [TimHunter@nc] /\A[[:alpha:]][-_.[:alpha:]]{3,28}[[:alpha:]]\z/
  | + 238696 [joaomiguel.p] It works well.
  | + 238734 [B.Candler@po] And if you are being pedantic, RFC2822 doesn't allow E-mail addresses to
  |   238749 [joaomiguel.p] Ok, thanks all, I need a reg expr do what I described before without the
  + 238725 [gavin@re in ] /\A[a-z][a-z.-]{3,28}[a-z]\Z/i
    238745 [joaomiguel.p] Oh damm!! the first should  be allowed but second and the third should
    + 238752 [martindemell] The regexp could be extended to allow this, but it gets ever more
    + 238775 [gavin@re in ] OK, but *why* aren't they allowed. You haven't described exactly what
      238777 [joaomiguel.p] It's a business requirement. The user name will be used before the
      238794 [gavin@re in ] You didn't answer these questions.
      238800 [joaomiguel.p] So, Gavin your last regex allows only valid host names on an URI? I'm
      238824 [gavin@re in ] I think so. I haven't tested it. Actually, I see one minor mistake -

Fwd: Answer to #113
238688 [james@gr yp ] ...

Fwd: Testsuite for #113
238689 [james@gr yp ] ...

Fwd: quiz 113
238690 [james@gr yp ] ...

Fwd: Please Forward: Ruby Quiz Submission
238691 [james@gr yp ] ...

Backport from ruby 1.9, including constants
238695 [vshepelev@im] During last several monthes I've worked on some library, using the latest
+ 238699 [gwtmp01@ma .] The only solutions I can think of involve explicitly referencing the
| 238701 [vshepelev@im] Just due to this ugliness, and, additionally, I can't (or don't want) modify
| + 238707 [gwtmp01@ma .] This uses eval on a string, which can be dangerous, but if you are
| | 238708 [vshepelev@im] Thanks, Gary.
| | 238710 [gwtmp01@ma .] Maybe someone else will come up with something but I think the main
| + 238711 [kbloom@gm il] How about
+ 238704 [kbloom@gm il] class << a
| 238705 [vshepelev@im] Not exactly what I want.
+ 238717 [vjoel@pa h. ] module Constants
threads.html
top