395607-395956

395429-397888 subjects 395842-396967

How to Iterate Through a Class
395607 [MR-Mencel@wi] How do I iterate through a Class so that I can perform some action on each object?  For example...
+ 395608 [martindemell] do you want to find all objects that belong to that class? you need to
| 395610 [MR-Mencel@wi] Yup that worked....
+ 395609 [lists@ru y- ] Please create your own thread. This has nothing to do with this topic.

Which exception classes does "rescue" trap?
395611 [ibc@al ax ne] [NoMemoryError, Exception, Object, PP::ObjectMixin, Kernel, BasicObject]
+ 395613 [hmaddocks@me] Not for me it doesn't.
| 395614 [ibc@al ax ne] My fault, sorry, I did a wrong code.
| + 395615 [ibc@al ax ne] Code done. If I'm not wrong, "rescue" traps the following exception
| | 395618 [hmaddocks@me] So it does. That's unexpected.
| + 395616 [hmaddocks@me] Here's one prepared earlier
+ 395623 [lists@ru y- ] SignalExceptions are *not* rescued. You probably used a wrong argument
| + 395629 [hmaddocks@me] Correct. That makes more sense.
| + 395632 [ibc@al ax ne] begin
+ 395625 [lists@ru y- ] According to the "IPA Ruby Standardization WG Draft August 25, 2010"
  395633 [ibc@al ax ne] Clear and confirmed now. Thanks a lot.

ruby openssl bug, reset cipher fails
395621 [lists@ru y- ] This is mentioned in this thread
+ 395627 [martin.bossl] this is not a bug and Cipher#reset is working fine. What's "going
+ 395649 [lists@ru y- ] I kind of understand. So where is it getting the IV value from if I
| 395653 [martin.bossl] not specify any IV, an implicit IV of all zeroes ("\0") of the correct
+ 395650 [lists@ru y- ] It seems to be an issue only with CTR mode. When I use CTR mode the

Regarding plugins writing
395635 [lists@ru y- ] I want to write a new plugin, give me the step how to create?
395636 [neleai@se na] google/read "pickaxe extending ruby"

unsubscribe
395641 [leorowe@16 .] ...
395643 [rajajeyammca] unsubscribe

rb_gc_register_address() or rb_gc_mark()?
395646 [ibc@al ax ne] work for me so I end using Ruby hashes and so.
+ 395651 [ibc@al ax ne] I would like to learn a bit more about rb_gc_mark(). In my experiments
| + 395652 [ibc@al ax ne] Ok, I'll symplify my question, which basically is:  WHAT is
| + 395657 [ibc@al ax ne] Forget this please, this happens because I've a thread running
|   395659 [ibc@al ax ne] - I run GC.startt every 0.1 seconds.
|   395660 [ibc@al ax ne] Forget it please! I was storing my_string in a class attribute :(
|   395666 [drbrain@se m] variable)
|   395668 [ibc@al ax ne] Sure, it's fully understood now, and in fact, without the mark crashes occur.
|   395671 [drbrain@se m] calling rb_gc_mark the garbage collector may reclaim your string which =
|   395673 [ibc@al ax ne] Ok, that explains the behavior I've observed. This should be
|   395675 [ryand-ruby@z] It's documented in K&R's C book. This is just a plain C idiom.
+ 395661 [lists@ru y- ] i create an hash from the C-side, mark them with rb_global_variable and
  + 395662 [ibc@al ax ne] void
  + 395667 [drbrain@se m] and=20
    395685 [lists@ru y- ] no its correct i want the control when the GC gets the object or not.
    395710 [drbrain@se m] and

why is else without rescue useless with statement modifiers?
395664 [lists@ru y- ] def sane?
+ 395665 [lists@ru y- ] The first definition simply isn't correct. If you want to use the "if"
+ 395669 [lists@ru y- ] Note that the "sane" variable again doesn't make sense, because you're
| 395670 [code@ap th o] def sane?
+ 395672 [code@ap th o] Others have touched on this, but for more detail, I'll try to explain.
+ 395678 [lists@ru y- ] thanks for the help :)

[ANN] Ruby-Mongrel2 0.23.0 released
395674 [ged@Fa ri MU] Ruby-Mongrel2 version 0.23.0 has been released!

reading from and writing to a Unicode encoded file
395686 [lists@ru y- ] I made a script to read from a Unicode encoded file and also to write
+ 395691 [lists@ru y- ] I refer to this post: http://www.ruby-forum.com/topic/4191662#new
+ 395693 [lists@ru y- ] You can use Iconv standard library of Ruby (Method Name: conv) which
| 395696 [quintus@qu n] Iconv is deprecated and will be removed. Ruby has built-in encoding
+ 395694 [lists@ru y- ] open("data.txt", "rb:UTF-16LE") {|fin|
  395697 [lists@ru y- ] thx, it works for me too, however, I wanted to include it in the script
  395698 [lists@ru y- ] data=nil
  395699 [lists@ru y- ] Thank you very much, works like a charm. I've replaced the actual

Methods as arguments?
395688 [lists@ru y- ] def world
+ 395689 [lists@ru y- ] aaa ('hello', :world)
| 395704 [lists@ru y- ] If I pass the method world as a symbol, certainly this is not executed
| 395705 [matma.rex@gm] You would have to implement def aaa a little differently.
| 395712 [lists@ru y- ] Thanks!, now the method world is invoked exactly as I wanted, in the aaa
| 395713 [matthew@ke w] Just to make sure my head's on straight, the method is still bound to
| 395715 [jgabrielygal] 1.9.2p290 :001 > class A
+ 395700 [neleai@se na] In method call you can omit parenthnes. So this is equivalent to
+ 395708 [lists@ru y- ] If you only want to have an ad hoc method to use in the main method, you

New to Ruby Need a little help from the pros.
395702 [lists@ru y- ] So I've been up reading all night, my eyes are aching.. I've got Hello
+ 395707 [lists@ru y- ] hey James -
+ 395742 [lists@ru y- ] If you installed the reference implementation at

[ANN] Goruco registration is now open
395703 [beholdthepan] Dear Rubyist,

Ruby- puts with accents
395706 [lists@ru y- ] I'm beginning with ruby, and I've a problem with a console app. I was
+ 395709 [ryand-ruby@z] ...
+ 395718 [sean.ohalpin] Codepage 852 isn't the Unicode codepage - it's MSDOS Latin-2 which
| + 395765 [lists@ru y- ] Well, I tried with chcp 852 ; 850 65001, and nothing. Also, I tried
| + 395775 [lists@ru y- ] First, uninstall 1.9.2 and install a recent 1.9.3 (p125 or later) from http://rubyinstaller.org/ If you're using the 1.9 family on Windows, purge every other version except 1.9.3p125 or higher.
+ 395768 [matma.rex@gm] You should encode the output in the same encoding as the one used in

[ANN] loggability 0.2.3 Released
395711 [ged@Fa ri MU] loggability version 0.2.3 has been released!

Version of Ruby used for syntax checking in Eclipse
395722 [echristopher] Does anyone know what version of Ruby Eclipse uses for Ruby syntax

[ANN] R.C. v0.2.0 released
395724 [transfire@gm] R.C. 0.2.0 has been released.

[ANN] QED v2.9.0 released
395725 [transfire@gm] QED 2.9.0 has been released.

Rubygems problem on ubuntu 12 (server)
395726 [lists@ru y- ] well i have a server and im trying to run an app... the thing is that is
+ 395727 [quangduongha] It's seem that you haven't probably set up Ruby and rubygems.
| 395728 [josen.figuer] charset=utf-8
+ 395729 [lists@ru y- ] Awsome now i can run a script :D thanks guys !
+ 395730 [lists@ru y- ] no more problems....

Having trouble with instructions in The Pragmatic Programmers Learn to Program
395733 [lists@ru y- ] I have been reading the book (Pragmatic Programmers) and I'm having
+ 395734 [ian.asaff@gm] right click and choose "edit with" to edit the file. it might say "open with=
+ 395735 [chris.hulan@] This is the "Learn to Program" book by Chris Pine? I haven't read it,
+ 395741 [lists@ru y- ] The book assumes that you have prerequisite knowledge of your OS, in
+ 395751 [lists@ru y- ] That reply would be better if it didn't make a point of insulting
  395762 [lists@ru y- ] ??? Insulting? There is nothing in that reply that constitutes an

Spork gem installation problems
395738 [lists@ru y- ] source 'https://rubygems.org'

[ANN] raindrops 0.9.0 - real-time stats for preforking Rack servers
395739 [normalperson] Raindrops is a real-time stats toolkit to show statistics for Rack HTTP

? Ruby through CGI and Rails
395740 [list@ll yd e] I am trying to find information on why the cgi interface is obsolete and

ruby in a box
395744 [martindemell] I've been thinking about the minimal feature set a beginner-friendly
+ 395745 [shortcutter@] 1. any text editor with syntax highlighting and code indention for
| 395749 [martindemell] Have you used drracket? It's *really* pleasant to have everything
| 395760 [shortcutter@] No.
+ 395746 [wbrisett@at ] While it doesn't cover all the things you've asked for, I think Hackety =
| 395747 [martindemell] Yes, I considered hackety hack, but while I think it is an excellent
| 395748 [wbrisett@at ] You're right, and after re-reading your initial message, I realized you =
+ 395766 [justincollin] This sounds a lot like Kid's Ruby, except for the REPL: http://kidsruby.com/
  395767 [martindemell] That looks really interesting! I've never heard of it before, thanks
  395781 [hmaddocks@me] Henry

Re: reading from and writing to a Unicode encoded file - issues when using Shoes
395750 [lists@ru y- ] something goes wrong with this block of code when I use Shoes to package
395754 [lists@ru y- ] one more note: the same code as attached (without the Shoes elements)
395755 [ashbbb@gm il] What platform and Shoes are you using?
395756 [lists@ru y- ] I'm using Shoes 3 on Win7. I've just tried the above two lines and the
395757 [ashbbb@gm il] data=nil
395758 [lists@ru y- ] it still not working. Now the process runs through, but the stuff that
395774 [ashbbb@gm il] Good!
395792 [lists@ru y- ] Actually the new content is not even written to the file, but the file is stil encoded as Unicode so some special characters in my language ( and ) are not displayed corectly. For example, "" is printed out like ڵڵط
395802 [ashbbb@gm il] Oh, I see.
395817 [lists@ru y- ] I've tried incorporating this into my script, but I guess my knowledge
395828 [ashbbb@gm il] Umm,....

[C ext and GVL] Why UBF() is called even if Ruby traps signals ??
395752 [ibc@al ax ne] *   If another thread interrupts this thread (Thread#kill, signal delivery,
395761 [ibc@al ax ne] 1) The thread running the blocking region is killed with Thread#kill.
395779 [normalperson] Yes, otherwise for a single-threaded Ruby application, signal handlers
+ 395780 [jos@ca no k.] Or use pselect(2). Not sure how portable that is though.
| 395784 [normalperson] Iaki's using libuv/uv_run() as a wrapper to avoid using
+ 395782 [ibc@al ax ne] Therefore I cannot use the ubf() for nothing. Typicall my code will be
  395783 [normalperson] OK, perfect.  You can probably just call in your ubf(), nothing else.
  395816 [ibc@al ax ne] Right, I've got it :)  (more below).

Re: Ruby through CGI and Rails
395753 [lists@ru y- ] I would not consider CGI obsolete.  Unless you are referring to ruby's
+ 395764 [lists@ru y- ] The cost of starting a Rails app is huge - several seconds of startup
| 395786 [list@ll yd e] It's a real huge. I did tests locally, cross country and cross continent.
| 395838 [lists@ru y- ] That just means you're using it wrong. Rails was *never* intended to be
| + 395840 [sophrinix@gm] At the end of the day, look at what rack is using. CGI. It is a realization
| | 395860 [lists@ru y- ] Rack is an API. The request variables it passes on happen to be similar
| + 395856 [list@ll yd e] I installed rails through cpanel installer.
|   + 395861 [lists@ru y- ] Ah, I see. Google "ruby microframework". Sinatra is probably the
|   | + 395863 [matma.rex@gm] I'd say Camping is not that bad, and we have a reasonably good
|   | + 395881 [list@ll yd e] I don't want any framework. Although i have been looking at rails and am
|   |   395897 [lists@ru y- ] You can write applications which talk to Rack directly, and that will be
|   |   395898 [sophrinix@gm] Rails Metal is deprecated. Once again railscasts went over this.
|   + 395871 [hmaddocks@me] How about mod_ruby?
|     395876 [lists@ru y- ] Not recommended. For one thing it's unmaintained, and you'll be lucky to
|     + 395882 [hmaddocks@me] This was in response to the OP's request for ways to execute ruby code in a web server and display output. It was not a recommendation.
|     | 395885 [list@ll yd e] All good henry, i appreciate it. You wouldn't believe how quick you can
|     + 395884 [list@ll yd e] thanks brian, heaps of stuff for me to try :)
|       395896 [lists@ru y- ] Proxy is a separate layer, yes. Proxy can handle multiple concurrent
+ 395785 [list@ll yd e] I came to ruby because of ruby but found rails to be almost as fundamental
  395797 [lists@ru y- ] undoubtedly.  I love/hate that lots of people love rails.
  395855 [list@ll yd e] It's actually the fastest method of all, at least with the parameters

Difference between Signal.trap("EXIT") and at_exit()?
395759 [ibc@al ax ne] The special signal name EXIT or signal number zero

Sinatra learning problem [$_GET]
395763 [lists@ru y- ] Im learning Sinatra, while i was doing that.... i realize that i didnt
+ 395769 [justincollin] For any url that looks like "/blah" the variable "params[:something]"
+ 395770 [lists@ru y- ] one.rb
  395772 [justincollin] If all you want is to access the query parameters (the key-value pairs

[ANN] JRuby 1.7.0.preview1 released
395771 [tom.enebo@gm] The JRuby community is pleased to announce the release of JRuby 1.7.0.previ=

spawn a process and keep the output, but stdout -> $stdout
395773 [lists@ru y- ] I basically "want" to run a sub process within ruby, having its stdout
+ 395776 [lists@ru y- ] Ok I figured it out.
| 395778 [matma.rex@gm] I was thinking of io = IO.popen('process', 'r+'). You can now both
+ 395777 [matma.rex@gm] IO.popen() and just write program's output to STDOUT yourself?
+ 395788 [lists@ru y- ] open("|cmd"..) is the simplest, but if you want a simple way to examine
  395799 [shortcutter@] I'd rather use the block form - as always.

Changing self class from inside a method??
395787 [lists@ru y- ] Let's start off with the assumption I want a method that allows an
+ 395789 [lists@ru y- ] I don't think you can reassign self in the middle of an instance, but
+ 395790 [shortcutter@] You can't do this.
| 395794 [mikaa123@gm ] The class-oriented idiom is very strict. I.e An object is an instance of a c=
+ 395795 [lists@ru y- ] I also don't think you can reassign self without digging into Ruby's
| 395798 [shortcutter@] What are you guys talking about reassigning self all the time?  David
+ 395815 [matma.rex@gm] Fun fact: it's possible in Python. (It tends to lead to segfaults.)
| 395818 [lists@ru y- ] Yes, indeed it is achievable using a C extension, at least for the
| 395819 [shortcutter@] Still it does not help for the use case at hand since nil is a
+ 395822 [lists@ru y- ] h = Hash.new { |h,k| h[k] = [] }

remove Modules
395800 [lists@ru y- ] How is it possible to remove modules from memory
+ 395801 [lists@ru y- ] You can use the (private) method Module#remove_const. However, this will
| 395803 [lists@ru y- ] This is exactly what I wanted
+ 395825 [ryand-ruby@z] Why? That seems like a design smell to me.

Disginguishing object types
395804 [lists@ru y- ] Frequently hash values are a mixture of object types.  In the case at
+ 395805 [jez.walker@g] ...
| + 395807 [ian.asaff@gm] Using a case statement is handy for this
| | 395809 [lists@ru y- ] The keyword for the default case is "else", not "default".
| | 395810 [ian.asaff@gm] Oops--careless. Thanks for the correction.
| + 395808 [lists@ru y- ] To explain this a bit: In Ruby you usually don't judge objects by their
|   395835 [hmaddocks@me] Also, where possible, don't check for an arbitrary method, check for a method you need or are about to call on the object in question. This will indicate more clearly why you care what type the objects are.
+ 395813 [michel.reves] ...
+ 395830 [lists@ru y- ] Wow!!  Thanks so much for the very thorough answers.

Opinion on String#camelcase
395806 [transfire@gm] ...
+ 395811 [echristopher] It might be painful, but I'd change the names `uppercase` and
| + 395821 [viabsb@gm il] Sorry do no understand: do you want Capitalize or capilatizE?
| + 395873 [transfire@gm] ...
+ 395812 [lists@ru y- ] I would expect a camelcase() method to leave the first character alone
+ 395814 [matma.rex@gm] While your change might be more "correct", I can't think of a single
  + 395823 [hmaddocks@me] I agree with this.
  + 395831 [matthew@ke w] Not everyone who writes Ruby scripts uses them to generate other Ruby scripts.
  + 395872 [transfire@gm] ...

Net:SSH , how to give password for Sudo commands
395820 [lists@ru y- ] I am using net/ssh (script) to SSH into an ubuntu box and install a
395824 [lists@ru y- ] This works

[ANN] glorify 0.1.0 Sinatra extension to parse markdown with syntax highlighting
395826 [zachary@za h] It brings me much joy to announce the 0.1.0 release of glorify!

[ANN] ruby_parser 3.0.0.a1 Released
395832 [ryand-ruby@z] ruby_parser version 3.0.0.a1 has been released!

Help with function calls
395833 [lists@ru y- ] I am using the trac4r gem to send tickets to Trac.
395834 [lists@ru y- ] I have literally been trying to figure this out for days and now I

[ANN] Finder v0.3.0 released
395836 [transfire@gm] Finder 0.3.0 has been released.

soap/wsdlDriver
395837 [lists@ru y- ] I use a product called spirateam which is an ALM tool including testing,
395839 [ryand-ruby@z] That ships with ruby 1.8 but not ruby 1.9.
395847 [lists@ru y- ] Thanks for the info I'll install 1.8

Memory-efficient set of Fixnums
395841 [lists@ru y- ] 1) generate a database of a couple dozens of millions of Fixnums
+ 395848 [chris.hulan@] Did you try a Hash?
| 395858 [justincollin] Set uses a Hash internally. It's basically just a different interface to
+ 395850 [lists@ru y- ] Thanks, but Hash has an even bigger memory imprint, so that won't do
| 395851 [matma.rex@gm] Well, how about using binary search on a sorted array? That's the simplest way.
| 395853 [chris.hulan@] How about an array, where the the generated numbers are the indexes?
+ 395854 [shortcutter@] You could use a BigNum as bitset.  But that might be slow.  I once
+ 395857 [lists@ru y- ] For memory efficiency, if you are on Windows, you can use RTensor with
+ 395859 [lists@ru y- ] Can you afford a fixed 512MB of RAM? Then you can just have a 2^32 entry
+ 395862 [lists@ru y- ] Thank you for your help,
| 395864 [lists@ru y- ] Based on your parameter description, I think the bitmap suggested by
| 395866 [shortcutter@] Just for the record: that is the same approach as I suggested earlier.
| 395868 [lists@ru y- ] I am sorry that I did not look at your github.
+ 395867 [lists@ru y- ] Alright, using Robert Klemme's BitSet class, Brian Candler's suggestion
+ 395874 [rogerdpack2@] google_hash gem may help.
+ 395875 [ryand-ruby@z] much
| 395877 [lists@ru y- ] Whether it is a homework or not, it is a very realistic problem that we
| 395878 [ryand-ruby@z] billion-distinct-objects-us.html
| 395879 [lists@ru y- ] I think we just helped the original poster to handle the software
| 395880 [ryand-ruby@z] I'm not so sure that we helped.
+ 395900 [lists@ru y- ] Sorry, I should have given more details. While I am doing this is an
| + 395903 [lists@ru y- ] I think in Ruby speed is not the primary objective.  So if you need the
| | 395949 [josh.cheek@g] +1
| + 395941 [shortcutter@] I advanced the implementation a bit
+ 395956 [lists@ru y- ] Thank you very much, this is incredibly useful!
threads.html
top