227574-247013 subjects 228047-229825

^ Factory pattern, abstract base class
227819 [djberg96 gma] I'm trying to setup an abstract base class as a factory for its
+ 227821 [TimHunter nc] The return value from initialize has nothing to do with the object
+ 227823 [james graypr] module Foo
| 227863 [robert.dober] A Class does not know anything about its subclasses, be it abstract or not.
| 227882 [pergesu gmai] Of course every rule has exceptions.  For example, in Beck's
| + 227888 [pergesu gmai] btw, check out "Encapsulate Classes with Factory" (p80) in
| + 227908 [robert.dober] Hmm I think your mail has shown a flaw in my reasoning, thanks :)
| + 227929 [james graypr] In Ruby you can even handle this dynamically.  Using the inherited()
+ 227832 [vjoel path.b] module Foo
| 227845 [james graypr] I don't believe that line does what you intend.  Try using your code
| 227855 [vjoel path.b] It's a little funny to say "baz" twice, is your point?
| 227928 [james graypr] No.  My point was that the original code forces the call to be made
| 227954 [vjoel path.b] module Foo
| + 227955 [vjoel path.b] One more suggestion that allows handling of other arguments besides the
| + 227968 [james graypr] Yes, I see that now.  Took me a surprising amount of time to actually
+ 227893 [shortcutter ] I am more inclined to question your approach than not.  After all, if

^ Strange error when loading a shared library
227824 [steviedizzle] I am porting Ruby/SDL to SkyOS (which has Ruby 1.8.5 installed) and I can compile it fine, no errors or warnings, but when I try to execute "require 'sdl'" it bums out with

^ Development hpricot breaks code
227835 [lrlebron gma] I was using this simple script to parse some links from a web page
+ 227836 [chrispearl g] Be sure to include more information, for example the exact error
+ 227837 [transfire gm] Are sure you want to use 'include?' and not 'index' ?
| 227838 [lrlebron gma] Positive. The script works correctly with include? Does not work with
+ 227861 [why ruby-lan] Hey, thanks, this was a problem with script tags found inside javascript blocks.
  227918 [lrlebron gma] After I figured out how to get the svn code in my windows box I ran the

^ Why does a test fail when I predicted it's exception class?
227839 [RichardDummy] I have a test suite that invokes on test set that specifies
+ 227840 [robert.feldt] You are using assert_raise in the wrong way. The call you want to test
+ 227841 [louis.j.scor] You need to run the code that raises the exception in a block.
+ 227849 [RichardDummy] You guys were right on!  Below is one of my actual test sets, the one
  227868 [drbrain segm] require 'test/unit'
  227963 [RichardDummy] Thanks for weighing in on my question.
  228006 [drbrain segm] Numbering tests is not typical behavior (I've seen it very rarely).
  228335 [RichardDummy] Thanks for mentioning them.
  228337 [rsanheim gma] Why do you want to number your tests?  Your tests should be written in
  228532 [RichardDummy] Thanks for adding your views to this discussion.

^ Serializing Ruby code
227842 [vshepelev im] A bit of philosophy.
+ 227844 [chrispearl g] If I understand your question correctly, what you're looking for is
+ 227847 [drbrain segm] You'd need more than that to get a full image to work (like recording

^ File.size() returning negative for large files ????
227857 [greg.hauptma] I'm getting a negative number being returned for large files when using
+ 227858 [nobu ruby-la] 1.8 series on MS-Windows doesn't contain large file support.
+ 227859 [d_rems yahoo] It is not yours, but Windows fault.
| 227862 [greg.hauptma] Is there a work around for this guys?
| 227869 [drbrain segm] [-1001581].pack('l').unpack('L').first # => 4293965715
| + 227881 [greg.hauptma] excellent!!  thanks Eric - who knows how long that would have taken me to
| | 227885 [ mfp acm.org] Are all your files under 4GB?
| + 227884 [pfortuny gma] However, notice that for VERY large files, (larger than 4Gb, I guess,
|   227904 [djberg96 gma] Try 'Q' instead.  Or, just use win32-file. :)
|   227957 [greg.hauptma] where do you get win32-file?  I don't see it in the api or on the wiki?  Is
|   + 227958 [TimHunter nc] ...
|   + 228342 [david vallne] Is
+ 227903 [djberg96 gma] It's a bug in Ruby, not Windows.  You can use win32-file, which

^ I'm a new member
227860 [quynh_khanh2] I'm a new member of forum ruby .
+ 227864 [nospam nosit] Certainly. Please state the problem.
+ 227870 [drbrain segm] I don't know about C++ strings, what are they like?
  227875 [nospam nosit] That depends. If the OP is describing ordinary C++ strings (not the string

^ I'm searching for a ruby-programming penfriend
227866 [anselmthecra] I know this post doesn't really fit into here,
+ 227973 [total_sc yah] you can use this forum ,as penfriend
+ 228073 [coder68 yaho] Anselm,
  228079 [anselmthecra] ilan, thanks for worrying about me

^ can't sort an array
227871 [chen_li3 yah] I want to print all the methods in excel OLE object
+ 227872 [quynh_khanh2] sorry
+ 227877 [nospam nosit] One solution is to convert the entire OLE data array into an equivalent Ruby
+ 227886 [martindemell] sort_by is your friend. I don't have a windows machine handy to
  227906 [chen_li3 yah] Thanks and all of them work. But I just don't
  227907 [dblack wobbl] sort and sort_by work by comparing pairs of objects using the <=>

^ Simple and stuppid bug (can anyone find it?)
227873 [pjvleeuwen g] I thought it to be good programming style to make attribute assignment
+ 227879 [fxn hashref.] "In older Ruby versions, the result of the assignment was the value
+ 227880 [david vallne] There is no bug in your code, apparently Ruby always returns the rvalue
| 227883 [matz ruby-la] It's intended behavior.  Attribute assignment is assignment (even if
+ 227887 [martindemell] If you do want to do this, I'd suggest an attr_setter method, that
  227901 [pjvleeuwen g] suggestion.
  + 227902 [dblack wobbl] I guess my question would be: why invent a new way to assign to
  + 227909 [martindemell] class A
  + 227917 [david vallne] Either way, I don't agree with the motivation, it's very easy to lose
    228017 [mdurham peop] In my opinion, if I understood the problem correctly, if a
    + 228400 [pjvleeuwen g] Without the help of the guy's here I would have probably taken a while
    | 228476 [david vallne] As assignments do.
    + 228510 [daniels pron] Which is exactly what the method will do... if you call it as a method.

^ Re: [OT] can't sort an array
227876 [david vallne] That was a thread hijack. Either there's a problem with one of the

^ Gtk::ProgressBar set_fraction doesn't work
227878 [patrick erdb] i have some problems with the Gtk::ProgressBar. I download a file and i
227889 [nospam nosit] The thread in which your process is running, that would update the progress
+ 227891 [kou cozmixng] In <12n5dc9ofnuge4@corp.supernews.com>
+ 227960 [patrick erdb] "You are probably doing all the changes within a function without
| 227965 [kou cozmixng] while Gtk.events_pending?
| 228018 [patrick erdb] It works very well, thanks!
+ 228026 [richard.j.da] I can't help with the original GTK question. But in QtRuby you would
  228078 [nospam nosit] Yes, tried that method. Doesn't work for a single file, the original
  228087 [richard.j.da] To do that you would need to create a socket, and then use a

^ Weird thing with sockets
227894 [arie_hofland] First off - i'm a n00b at ruby. This doesn't mean i'm a noob at
+ 227895 [pfortuny gma] For the peer's address, you need
| 227897 [arie_hofland] Thank you, i was afraid it was something silly like that.
+ 227898 [shortcutter ] You are misinterpreting: addr is your own address.  After all you *know*
  227899 [arie_hofland] Thanks to both of you, i know much more already now...

^ How to get the values for Excel constants  at once
227911 [chen_li3 yah] Thank you in advance for any feedback.
227912 [martindemell] Use const_get - it's a method defined on Module.
227914 [chen_li3 yah] Thank you very much. BTW it doesn't work when + is
227916 [martindemell] Oops - yes, + assumes that all the constants are strings. Should have
227920 [chen_li3 yah] Once again thank you very much,

^ mailing list question?
227913 [chen_li3 yah] I just join another list at ruby-talk. I send the post to the following

^ Gateway Threading? [was: Re: mailing list question?]
227915 [shortcutter ] Do you mean they are inserted into other threads?  Do you use the reply
+ 227923 [chen_li3 yah] I use the reply function of my email and the outgoing
| 227925 [shortcutter ] Well, there you go.  Then of course your messages will appear in
+ 227927 [james graypr] The Gateway tries to maintain threading.
  228016 [shortcutter ] I did not expect anything different. :-)  However, it seems the gateway

^ VBA to Ruby code translate
227922 [chen_li3 yah] I know I post this question a while ago in Ruby-forum
227956 [chen_li3 yah] changes some of them into a hash in Ruby

^ OOo and regexp
227924 [ishamid colo] [novice]
227953 [nospam nosit] Do you mean an Open Office Open Document format? The sort of data file that

^ Intermittant problem with Hpricot
227930 [demallien ma] I've run into a wierd problem with the Hpricot gem.  I don't know if
+ 227935 [demallien ma] Of interest, if I replace the
+ 227936 [david vallne] This might or might not be related, but I think there was some change to
| 227941 [demallien ma] Yup, that seems to fix the problem, thanks.  It's still wierd that the
+ 227939 [lrlebron gma] You can change the code one of two ways to get it to work
  227943 [demallien ma] Ahhh, ok, so I have to require 'hpricot' regardless of whether I have
  227944 [david vallne] =20
  228070 [why ruby-lan] You are talking about "autorequire", David.  Which is long gone.[1]
  228116 [david vallne] ne.html

^ Can one use line addresses...to select a portion of file
227933 [raymond.jaco] charset="us-ascii"
+ 227938 [david vallne] lines =3D file.to_a
+ 227942 [ruby anthrop] } I would like to select a portion of a file to process like I did with
  + 227949 [raymond.jaco] Thank you,
  + 227989 [twifkak comc] There is a lesser-known (and usually frowned upon?) feature in Ruby that
    228280 [david vallne] So -this- is what that does?
    228285 [ara.t.howard] yes.

^ rubygarden wiki
227940 [martindemell] I was a bit hesitant to post this, since it is mostly complaining, but

^ How to get operating system type info
227945 [zhoubo61 msn] I'm writing a software building script in Ruby for Unix and Windows.
+ 227950 [kallen19918 ] The RUBY_PLATFORM constant is what you want.
+ 227951 [nospam nosit] puts RUBY_PLATFORM
  227952 [zhoubo61 msn] Thanks Ken and Paul!
  228004 [drbrain segm] Yes, should be /mswin/.

227961 [gbtec btopen] charset="us-ascii"
227962 [pergesu gmai] Sending a message to the list itself won't do anything.  Go to

^ Redefining rb_str_init()
227964 [djberg96 gma] I'm just messing around with a custom String class, so I did this to
227974 [matz ruby-la] I don't think it's a good idea to invoke function for every string
227984 [djberg96 gma] Well, I'm just tinkering around for now.  However, I did realize
227985 [vjoel path.b] Strings like this...

^ Testing use of binding:  got spurious error message
227967 [RichardDummy] The program below ends with eval(...) producing an error message, as
227988 [m_goldberg a] show(obj1.methods) # <= insert this
228074 [RichardDummy] That's perfect.  Thank you very much.

^ Re: Turtle Graphics (#104)
227969 [demetriusnun] class Turtle

^ number format
227970 [chen_li3 yah] I have a number, for example, 1.123456789. What is the Ruby way to
+ 227976 [danfinnie op] You can use the number.round method, but this doesn't take a number of
| 228013 [nospam nosit] This is not a good idea. Because the number being manipulated is binary but
+ 227978 [george.ogata] It might be better to leave the precision alone until you print it, in
| 227981 [chen_li3 yah] I think I prefer the suggestion.
+ 227983 [jeremy hineg] % sudo gem install facets

^ Ruby 1.8.5-p2 released.
227977 [shyouhei rub] We released a new Ruby release called 1.8.5-p2, fixing some DoS
228051 [tom infoethe] Yours,
228339 [m.fellinger ] And in ArchLinux current repository :)

^ method overloading like Java?
227979 [danfinnie op] public void foo(int x)
+ 227986 [dblack wobbl] It's not just a matter of dynamic vs. static typing.  In Ruby, an
+ 227987 [TimHunter nc] Java's (and C++'s) kind of method overloading just isn't do-able in
+ 227990 [twifkak comc] 1. That's the only way to do it.
+ 227991 [gthiesfeld g] What about this?
| 227992 [pergesu gmai] EXACTLY
| 227995 [bob.yang.dev] class FooClass {
| + 227999 [halostatue g] class Foo
| | 228019 [bob.yang.dev] it's good and simple. thanks
| + 228001 [ruby muerman] def foo opts={}
|   228020 [bob.yang.dev] I prefer this method if I have many parameters, and when I have just fewer
+ 228015 [shortcutter ] You can emulate it - although I am not convinced that it is a good idea.

^ FastRI, handling identical class names and methods
227980 [djberg96 gma] FastRI 0.2.1
+ 228011 [nospam nosit] Yes, there is. The best solution is to give your own class a different name.
| 228035 [djberg96 gma] My class is meant as a replacement for the one in the stdlib.
| 228076 [nospam nosit] IMHO this is an even better reason to avoid a name collision. You may
| 228093 [drbrain segm] resolv-replace.rb disagrees with you.
| 228095 [nospam nosit] I am sure many reasonable people will disagree on excellent grounds. But all
+ 228048 [ mfp acm.org] What you're getting is the result of merging the documentation from the

^ other way to send message to parent class in unit testing
227996 [akbarhome gm] method to be tested. So I make parent class to do the duplicate work.
227997 [akbarhome gm] My mistake. @con_name should be $con_name and you can put $con_name in

^ Why this script doesn't work?
227998 [chen_li3 yah] I copy a script from WIN32OLE documentation and run it. I find that Ruby
228010 [nospam nosit] Where is the Win32OLE documentation located, please? That way, others can
+ 228014 [bob.yang.dev] <http://www.ruby-doc.org/stdlib/libdoc/win32ole/rdoc/index.html>
+ 228023 [chen_li3 yah] It is here
  228045 [chris.hulan ] cells = sheets.Range("A1:A5")

^ Re: [QUIZ] Turtle Graphics (#104)
228000 [m_goldberg a] Your solution passes all the unit tests I supplied and is certainly

^ Re: Gems zlib problem
228002 [drubdrub yah] ~/tmp/browser_dowloads/ruby-1.8.5-p2/ext/zlib$ ruby extconf.rb
228009 [drbrain segm] Install zlib (and, if your OS is that weird, its headers too).

^ utilizing dlls in windows programming?
228003 [beingthexemp] I have been reading the pick-axe book and was reading the chapter on
228024 [phasis68 hot] Refer to
228104 [beingthexemp] Thanks, do you have previous experience with Phidgets and ruby?

^ How to populate a 2D array data into Excel using WIN32OLE
228025 [chen_li3 yah] I  process a raw data file into a 2D array. The only way I can think of
228027 [gustav rails] Hey
228050 [chen_li3 yah] Yes it works. Thank you very much, Paul.
235334 [donn cmscms.] Any examples for doing just the opposite?  Taking the Excel range and

^ Getting the source code of a block
228028 [peter rubyra] Is the following thing possible somehow?
+ 228029 [shortcutter ] No.  Alternatively you could cook your own
| 228032 [peter rubyra] crap = define_my_object do
| 228042 [shortcutter ] So you are modifying the state of an object and want to emit code that
| 228053 [peter rubyra] Thanks for the answer. I guess to use yaml and maybe modify it a bit to
+ 228049 [james graypr] James Edward Gray II
| 228054 [peter rubyra] Thanks! Nice :-)
+ 228091 [drbrain segm] $ cat x.rb

^ problem with ActiveRecord and PDFWriter
228030 [gethemant gm] Probably this has been discussed earlier elsewhere.
228044 [halostatue g] You look like you're doing something threaded. I don't know if that's
+ 229131 [jerome.loyet] I have exactly the same problem. But the problem doesn't appear if I
| 229155 [gethemant gm] I have tried in vain to patch AR, but it doesn't seem to ( sorry for
| 229165 [halostatue g] Trust me. PDF::Writer isn't trying to dump a mutex here (this is
| 229170 [gethemant gm] Good point Austin, and honestly I was populating some PDF variables
| 229175 [halostatue g] Sure. Don't expect a quick response, though. I've written one Rails application.
+ 229184 [halostatue g] I will not be doing so. I provide a *Ruby* library. I have told the

^ Question about Ruby philosophy
228031 [user domain.] For example, let say that I create instances of JDBCFooBaseDriver in
+ 228034 [stephen.dunc] 1) Yes
| 228038 [transfire gm] A typo I know, but that's a perfect way to put it: You can "should
+ 228036 [transfire gm] You are correct and your worry is not uncommon. And yes, it does _seem_
| 228043 [robert.dober] It is scary unless you have a very  good testing environment, but that is
+ 228117 [shortcutter ] Are you sure this is true?  True, people frequently are scared of Ruby's
| + 228122 [martindemell] First I've heard of the 'used to'! When did that change?
| | 228177 [shortcutter ] irb(main):001:0> 1 / 2
| | 228184 [matz ruby-la] Perhaps, you've confused 'rational' and 'mathn'.
| | + 228192 [shortcutter ] Exactly!
| | + 228363 [martindemell] Aha! I was making the same mistake.
| + 228138 [david vallne] <rant>
+ 228121 [pergesu gmai] Not really.  Presumably if you're using a third-party library, you
+ 228134 [ruby muerman] I can only speak from a Java perspective here, but if you look at what
| + 228136 [efine145-nos] The bottom line seems to be that the current crop of Ruby programmers
| | + 228139 [ara.t.howard] irb(main):001:0> Array.freeze
| | | 228159 [efine145-nos] Ah, but here's the difference. You have to know a fair amount of C to
| | | + 228165 [ara.t.howard] gcc -shared a.c
| | | + 228166 [twifkak comc] Unfortunately, Ruby's killer app makes use of pretty much every one of
| | + 228141 [james graypr] Perl has had the same issue for a long time now and it probably was
| | | 228155 [efine145-nos] <rant>
| | | + 228163 [pergesu gmai] You either trust the programmer or you don't.  There's no in between,
| | | + 228445 [jeremy chaos] You shoot yourself in the foot and make a really quick, clean job of
| | + 228142 [james.britt ] (Yes, a shameless plug.  But hey; Christmas is coming!	)
| | | 228167 [fredjean fre] Such shameless self promotion... Go to http://www.cafepress.com/pitythefoo
| | + 228178 [shortcutter ] I guess so.
| + 228144 [david vallne] Though to me it seems like runtime bytecode manipulation is still rather
+ 228171 [mshock shadr] It's a serious question concerning language philosophy and design.
  228174 [matz ruby-la] You don't have to, when you trust other programmers, and you have time
  228455 [chneukirchen] Do you consider Ruby a good language for teaching people that haven't
  + 228695 [mshock shadr] Sorry for answering the question addressed not to me,
  + 228711 [david vallne] I personally consider teaching programming in any language without a
    228772 [allergic-to-] What is a REPL?
    228774 [david vallne] of
    229010 [allergic-to-] Thanks!