412684-414325

412463-413069 subjects 412880-413166

Nested_Hash_Creation_in_Ruby
412684 [lists@ru y- ] #!/usr/bin/ruby
412688 [jgabrielygal] 1.9.3-p448 :001 > h = Hash.new {|h,k| h[k] = Hash.new(&h.default_proc)}
412716 [abinoam@gm i] Great!

How do we store hash things in DB?
412685 [lists@ru y- ] #!/usr/bin/ruby
412686 [shortcutter@] If you would like us to reply to this please at least pretend you are

Can I use openssl asynchronously?
412687 [lists@ru y- ] I'm working on a feature, which needs to receive a bunch of parts of a

HTTP Headers
412691 [lists@ru y- ] Hey guys, I need to make a HTTP GET in a page, but I need to use the
412693 [jgabrielygal] I think we need more info to help you. You need to make a GET *in* a
412695 [lists@ru y- ] Yes, I want to use ruby to perform a request with that header, sorry for my bad english.
412696 [jgabrielygal] You can use the stdlib class Net::HTTP, see here an example of setting
412707 [thyagobr@gm ] 2013/12/10 Jes=FAs Gabriel y Gal=E1n <jgabrielygalan@gmail.com>

Class initialization with assignment-like method
412692 [lists@ru y- ] module A
+ 412694 [lists@ru y- ] The interpreter looks at "a = num" and assumes that you're referring to
+ 412697 [lists@ru y- ] I thought that the interpreter should have loaded up all the methods but
  412699 [shortcutter@] It does not have to do with "loading methods" or such. It is purely

OpenSSL PKCS8 Support
412698 [lists@ru y- ] I need to be able to export PKCS8 formatted public keys from Ruby

Ruby Regular expression
412702 [lists@ru y- ] I am reading a file and want to extract. all quotations given in "" or
412703 [lists@ru y- ] How about this?
412704 [fxn@ha hr f.] Doing this is tricky, the robustness of a regexp approach depends on what
412714 [shortcutter@] Interesting solution!  I also tried

Unexpected repeating in 'while true' loop
412708 [lists@ru y- ] I'm writing a program that I hope will function as way to track what
412709 [jgabrielygal] you will see that by default it reads from files present in ARGV. When
412710 [lists@ru y- ] Jesus,

at_exit and Test::Unit::TestCase
412722 [lists@ru y- ] I'm migrating the ruby framework that I have from Ruby 1.8.7 to 2.0
412725 [ryand-ruby@z] run

"Build a Ruby Gem" email course - Register now
412726 [lists@ru y- ] I just launched a FREE 10-day "Build a Ruby Gem" email course where I've
+ 412731 [lists@ru y- ] Out of interest, what sort of gems?  If I'd had someone to talk me
+ 412738 [lists@ru y- ] It's definitely not meant for building cross-platform C-ext-for-MRI and

Test multiple variables
412727 [lists@ru y- ] I need to test for a case where 5 variables are all empty.
+ 412728 [hassan.schro] 2.0.0 (main):0 > a = b = c = d = e = ''
| 412729 [lists@ru y- ] Thanks!
| 412740 [shortcutter@] irb(main):002:0> [a, b, c, d, e].all? &:empty?
+ 412730 [HANSEM1@na i] The general idea is correct, but

[ANN] hoe 3.7.3 Released
412732 [ryand-ruby@z] hoe version 3.7.3 has been released!

[ANN] minitest 5.2.0 Released
412733 [ryand-ruby@z] minitest version 5.2.0 has been released!

[ANN] ruby2ruby 2.0.7 Released
412734 [ryand-ruby@z] ruby2ruby version 2.0.7 has been released!

[ANN] sexp_processor 4.4.1 Released
412735 [ryand-ruby@z] sexp_processor version 4.4.1 has been released!

[ANN] zenweb 3.3.1 Released
412736 [ryand-ruby@z] zenweb version 3.3.1 has been released!

[ANN] oedipus_lex 2.0.0 Released
412737 [ryand-ruby@z] oedipus_lex version 2.0.0 has been released!

Installing gem datamapper issues
412739 [lists@ru y- ] I'm very new to ruby and can't install datamapper...can anyone help me,

Ruby minor version update and gem versions
412742 [gvimrc@gm il] 1. If I upgrade from Ruby 2.0.0-p247 (using rbenv) to 2.0.0-p353 do I

Progression as beginner
412744 [lists@ru y- ] I have been learning ruby for the last couple of days and have found it
+ 412745 [rbakerjax@gm] Listen to the ruby rogues podcast. Subscribe to Ruby Tapas.
| 412747 [tamouse.list] Both of those are really good sources, as well as Railscasts, which is
+ 412746 [tamouse.list] This mailing list is a good place to ask questions as well as learn from
+ 412748 [lists@ru y- ] Thanks guys I'll keep trying. I tried to get to the irc though I'm on
  + 412752 [shortcutter@] I'd say you are in the primary group for Ruby development right here -
  + 412764 [tamouse.list] Join channel #ruby

mixing types of arguments
412749 [lists@ru y- ] I was wondering why Ruby was designed so that
412750 [lists@ru y- ] Probably because I'd have expected g(1,2) to print
+ 412751 [shortcutter@] In other words: Gandalf, what you ask for is ambiguous.  The parser
| 412756 [lists@ru y- ] There is the following sensible rule: it should always be possible to
| + 412758 [fluido@fl id] Note that, since 2.0, Ruby allows named arguments. At the expense of
| + 412759 [shortcutter@] How do you do that if there are less arguments than parameters?  It's
|   412760 [lists@ru y- ] I meant something different.
|   412761 [shortcutter@] It *is* avoided because the syntax is illegal.
+ 412754 [lists@ru y- ] This way you won't be able to assign to x (the optional parameter).

Files/Folders Iterating through and moving files around conditionally
412753 [lists@ru y- ] I'm struggling with what should be a fairly simple concept, but I'm
412755 [HANSEM1@na i] 1. yes, glob doesn't work with an array, use a regex match
412757 [lists@ru y- ] Thank you!  I was closer than I thought, but I see your points now.  I

Repeating hash information with faulty keys
412762 [lists@ru y- ] I'm creating a command line library program for tracking which books I
412763 [joelvanderwe] Hm, the following works for me...
412765 [lists@ru y- ] Fascinating. Thanks for the suggested solution, Joel. I am curious to
412769 [tamouse.list] Setting results_as_hash gives you a hash with both column name and column

Working through some "puzzles" to learn ruby. However lost on this one. Help?
412766 [lists@ru y- ] Basically, I am working through some puzzles to learn ruby.  I just
+ 412767 [abinoam@gm i] Dear JD JD,
| 412768 [tamouse.list] Given the exercise, it looks at though they want to introduce you to
+ 412771 [HANSEM1@na i] I think you are looking for something like this
+ 412773 [cebirim@gm i] What website are you using for the ruby puzzles?
+ 412792 [lists@ru y- ] This was the solution I came up with, and it appears to have made it
| 412793 [lists@ru y- ] The difference between #map and #each is what they return.  #map is used
+ 412806 [lists@ru y- ] Are you sure you aren't overcomplicating this?
+ 412807 [lists@ru y- ] def reverse
| 412810 [matthew@ke w] We had fun with this on irc yesterday. I guess it's safe for jdjd to check
+ 412812 [lists@ru y- ] yield.gsub(/\S+/){|s|s.reverse}
| 412814 [cebirim@gm i] I'm a newbie rails developer too and would like to know what are the best
| 412815 [abinoam@gm i] Dear Angela,
| 412816 [cebirim@gm i] I wasnt aware that asking a question constituted a hijack in your book and
| + 412819 [jonanscheffl] People can be a bit uppity about their 'rules'. Try
| | 412820 [cebirim@gm i] Thank you jonathan and well said!
| | 412821 [cebirim@gm i] Sorry meant jonan!
| + 412825 [abinoam@gm i] Dear Angela,
+ 412837 [lists@ru y- ] @Matthew Kerwin, Thanks for this response.  I am going to try to read
  412852 [abinoam@gm i] Thank you JD,

sigsuspend in ruby
412770 [lists@ru y- ] Is there anything in ruby that parallel to sigsuspend functionality?
412772 [shortcutter@] Not sure what you mean by "parallel".  You can use regular process

simple, simple stuff
412774 [lists@ru y- ] I just rebuilt my Mac, with Ruby. I'm getting these what I think are
+ 412775 [jgabrielygal] I don't work with a Mac, so take this with a grain of salt: it looks
| 412776 [lists@ru y- ] Thanks, Jesus. I checked my script and I do have the shebang there. Thanks, anyway.
| 412780 [tamouse.list] It might help if you pasted the script.
| 412782 [lists@ru y- ] Uh, it's pretty big. But, here it is. Thanks.
| 412796 [tamouse.list] Thanks -- it's not *that* long, but I guess I could have asked for the head
| + 412809 [HANSEM1@na i] Are you pointing to the ruby directory or the executable, you need to
| | 412851 [lists@ru y- ] #!/Users/peterbailey/.rbenv/shims/ruby
| | 412890 [tamouse.list] If what you have for your shebang matches exactly what you get when you
| + 412813 [mike@st k. a] ...
+ 412783 [lists@ru y- ] Do you need the 'bang' - ! - in your shebang?
  412784 [lists@ru y- ] I tried it with the screamer (!), but, I still get the same results.

Need help - Array and function
412777 [lists@ru y- ] Im a girl form Germany and I need your help.
+ 412778 [carlos.agari] The use of "for loops" isn't very common in Ruby. It's preferable to use
+ 412779 [lists@ru y- ] Thank you :). But where is the return?I need to return the mean. Our
| 412795 [saji@u- iz .] You can explicitly add a 'return', if you like to the following code
+ 412794 [lists@ru y- ] What returns is the last expression evaluated in the method writed by
+ 412800 [lists@ru y- ] def main(aArray)
+ 412804 [lists@ru y- ] Well, if we're all just going to post our own ideas...

[ANN] ifelse 0.6.0 Released
412781 [jwise@dr ga ] charset=us-ascii

Count numbers - please help
412785 [lists@ru y- ] a=[1,-8,4,6]
+ 412786 [rob.biedenha] irb1.8.7> a = [ 1, 2, -4, 8 ]
+ 412787 [wbrisett@at ] ...
+ 412788 [lists@ru y- ] Dear Wayne,
+ 412789 [lists@ru y- ] Rob's message contains the exact code you need.
+ 412817 [lists@ru y- ] Yes, but we have to do it in a loop in a function.
+ 412818 [lists@ru y- ] One way to do it would be to initialise a local variable outside the
+ 412823 [lists@ru y- ] Thank you so much :). That helped me! Now I understand :).
  412824 [abinoam@gm i] a.inject(0) { |count, element| element >= 0 ? count+1 : count }

Patricia Trie Ruby Library
412790 [lists@ru y- ] Although I have called my implementation a "Generic one" I will be
412830 [sandor.szuec] There is a Trie implementation as rubygem and a public git repository
412956 [lists@ru y- ] I am aware of this gem.

How to use sqlite3 UPDATE command correctly in ruby program
412791 [lists@ru y- ] I'm using sqlite3 for storage in my ruby program. I want to be able to
+ 412797 [tamouse.list] What is the error you get, please?
+ 412798 [fluido@fl id] Rather than attaching the scripts, you should have copy-and-pasted the
+ 412808 [lists@ru y- ] Sorry for the delay. Night time here in Massachusetts.
  412811 [fluido@fl id] What sort of an object is book_to_loan? Check it. Add a printout,

regular expression,
412799 [lists@ru y- ] "M.raja.gopalan".gsub(/(.*)\./,'')
+ 412801 [lists@ru y- ] Use "sub", and the non-greedy operator: "?"
| 412822 [rob.biedenha] "M.raja.gopalan".sub(/\A[^.]*\./,'')
+ 412802 [lists@ru y- ] Thank you Joel Pearson
+ 412841 [lists@ru y- ] OK, thank you.

Optional type annotations
412803 [lists@ru y- ] Is there any plan (discussion) to add optional types to Ruby? Something
412805 [matz@ne la .] No. I don't like the optional static typing.
414325 [lists@ru y- ] great to see Matz replied here!

Iterating a string through an array, need help?
412826 [lists@ru y- ] I'm working on making a word game with my friend, but ran into this
+ 412827 [lists@ru y- ] Why does "gingerly" -> "ingy" rather than "ing"?
| 412828 [lists@ru y- ] Both of these contain consecutive characters in the word "stringy"
+ 412829 [mickylmartin] You cannot do it in one shot. You have to come up with the perfect
+ 412835 [lists@ru y- ] I'm not even sure where to begin. I want to iterate every letter of
+ 412836 [hmaddocks@me] ...
| 412838 [lists@ru y- ] I think I may be able to figure this part out.  But I can't figure out
| 412839 [hmaddocks@me] Array#uniq
+ 412840 [lists@ru y- ] I just have to say, this is quite a complicated little task you've set
| 412843 [ammarabuali@] On Dec 19, 2013, at 5:30 AM, Matthew Kerwin <lists@ruby-forum.com> =
| 412847 [abinoam@gm i] Dear Jim Whittaker,
| 412850 [lists@ru y- ] Dear Abinoam,
| 412859 [hmaddocks@me] ...
+ 412861 [lists@ru y- ] Very clever Regexp building! I like that one :D

2 Arrays into 1 Array with all possible combinations?
412831 [lists@ru y- ] arr1 = [a, b, c]
+ 412832 [ammarabuali@] =3D> ["a", "b", "c"]
| + 412833 [abinoam@gm i] a1 =3D ["a", "b", "c"]
| + 412834 [lists@ru y- ] That's it!  Thank you!
| | 412845 [ammarabuali@] I actually like Abinoam=92s suggestion better.
| | 412849 [abinoam@gm i] Thanks.
| + 412842 [sto.mar@we .] @Ammar: ">>" is rendered as quote by many email clients,
|   412844 [ammarabuali@] I did not notice that. Thanks for pointing it out.
+ 412881 [lists@ru y- ] ar1=['a','b','c']
  412886 [johnmoonyy@g] ar3 = [ar1, ar2]

How to test if date is ISO 8601 type or not ?
412846 [lists@ru y- ] In Ruby how would I test if the date is `ISO 8601` type or not ?
412853 [sto.mar@we .] That doesn't make any sense. ISO 8601 is about date representations,

Re: ifelse 0.6.0 Released
412848 [lists@ru y- ] I'm curious why you didn't implement this using this approach?
+ 412854 [joelvanderwe] Very slightly simpler...
| + 412855 [lists@ru y- ] Very nice, Ruby is beautiful :D
| + 412893 [tamouse.list] That is gorgeous.
+ 412862 [lists@ru y- ] Different strokes for different folks.  I've have taken the OP's
  412871 [lists@ru y- ] I see, so by defining the methods that way, you get a performance boost
  412873 [lists@ru y- ] Such as it is, yes, a tiny boost.  A tiny bit more maintenance, though,
  412904 [jwise@dr ga ] charset=windows-1252
  412905 [jwise@dr ga ] charset=windows-1252

by reference or by value? Or Fixnum assignment is different?
412856 [jtao@di it l] ...
+ 412857 [lists@ru y- ] Fixnum is immutable. What happens when you add 1 to your Fixnum is that
+ 412858 [flo@an er gr] ...
+ 412860 [jtao@di it l] ...
  412972 [shortcutter@] on

Double quote in url causes URI.parse to raise URI::InvalidURIError
412863 [lists@ru y- ] I'm not sure if this is desired behavior or not, but when I pass a url
+ 412864 [hassan.schro] Recommended reading: http://www.ietf.org/rfc/rfc1738.txt
| 412865 [matthew@ke w] Technically RFC 1738 is obsolete, and in either case the syntax rules are
| 412866 [hassan.schro] If someone hasn't (apparently) read the standards that govern the
+ 412867 [lists@ru y- ] Definitely understandable. I've looked at 1738, and see that (at that
+ 412891 [tamouse.list] Others have shown the RFCs for URLs. What isn't altogether clear is that
+ 412941 [lists@ru y- ] Thanks, tamouse_m, that's really helpful.

Iterate the Hash_in_hash
412868 [lists@ru y- ] #we know that way to create hash_in_hash
+ 412892 [tamouse.list] ...
+ 412895 [abinoam@gm i] Dear Selvag,
+ 412924 [lists@ru y- ] consider this inheritance, where parent hash contains more user_id

utils.rb break-down?
412869 [lists@ru y- ] I am still new in programming but have now started to get a big
+ 412872 [lists@ru y- ] Usually you'd break down your own methods by module, class, or whatever
+ 413021 [lists@ru y- ] Thanks Joel for your reply!!

Need help to pick up the live objects while using ObjectSpace#each_object
412870 [lists@ru y- ] class Animal
412923 [lists@ru y- ] Here's the result of a simple experiment I did.  It shows that

/usr/bin/env: ruby: No such file or directory
412874 [lists@ru y- ] I am getting the error "/usr/bin/env: ruby: No such file or directory"
412875 [lists@ru y- ] check your shebang line, it should be
412889 [tamouse.list] Not necessarily. The env is a standard way of invoking ruby with the
412908 [jtao@di it l] ...
412925 [tamouse.list] /usr/bin/env ruby

Is there better way to replace these case statement?
412876 [lists@ru y- ] Is there better way to replace these case statement?
+ 412877 [lists@ru y- ] result = cmd[ /\A(astro|core|fm_shell|formality|gca_shell|xa)\z/i, 1 ]
| 412878 [lists@ru y- ] How to go on with this and set toolName accordingly? Could you gic=ve an
+ 412879 [lists@ru y- ] I see it's better don't use long case statement, is there good way to do
+ 412882 [lists@ru y- ] Can we do like the way below? How to process the Regular express in it?
| 412885 [lists@ru y- ] types = {
+ 412883 [lists@ru y- ] Once you've got the return you can do any substitutions required for
+ 412884 [lists@ru y- ] Previn,
+ 412887 [jtao@di it l] cmd="Astro"
| + 412888 [jtao@di it l] BTW the code_book={ Astro: "astro", core: "coretools", fm_shell: "fm", formality: "fm" } works in 2.0 (or 1.9)?
| + 412902 [lists@ru y- ] tool_name = code_book[cmd.to_sym] || ''
|   + 412906 [jtao@di it l] ...
|   | 412911 [jtao@di it l] ...
|   + 412919 [lists@ru y- ] I can't believe I missed this obvious option
|     412921 [mike@st k. a] no
|     412945 [tamouse.list] +++ for Avdi's books and for RubyTapas, where I saw Hash#fetch used quite
+ 412894 [joelvanderwe] class Tool
+ 412907 [hmaddocks@me] Learn about polymorphism.
| 412914 [lists@ru y- ] This is the solution in the book of "Refactoring", but how to implement
+ 412913 [lists@ru y- ] Dear Joel, Eric, Jason, Joel(VanderWerf),
| 412917 [joelvanderwe] Please do ask. Happy to help...
+ 412929 [lists@ru y- ] Nice, I'd never used fetch before. That opens up a whole host of
threads.html
top