255653-256345

255420-365488 subjects 255825-371464

severe newbie question (class, fixnum, array)
255653 [bladenut@gm ] I worked a lot in tcl, and this is my first day of trying something in
+ 255654 [onebitcipher] ...
+ 255655 [matthew.moss] I would say this is a bad idea, since I believe Thread is a core
+ 255656 [grblanco@gm ] a) it's to_s, as in @number.to_s
+ 255658 [florian.assm] First of all: http://whytheluckystiff.net/ruby/pickaxe/
  255662 [bladenut@gm ] Ah, many thanks. Now it works. I should have thought about Thread

XLsuite | Open Source Ruby on Rails based ERP / CRM / CMS
255660 [djriel@gm il] We are a small web development company in Vancouver, BC called <a

Reasonable practice?
255664 [transfire@gm] It the following reasonable? How thread safe is it?
+ 255683 [bladeon@gm i] If you just want to print out all of the members of an array, it looks
| 255692 [transfire@gm] My example is a drastic simplification of what I'm actually doing. My
+ 255704 [robert.dober] Tom I do not know how big the chance is that the scenario above will
  255832 [erwin.abbott] Robert's right, and I added another place threads might step on
  255840 [transfire@gm] Thanks Erwin, that helps. I was toying with not having any methd
  + 255847 [erwin.abbott] Yes, this is thread safe... each thread that calls #go gets its own
  | + 255848 [erwin.abbott] I made a big mistake in that code.  Instead of each instance of DooWop
  | + 255851 [robert.dober] Hmm I am afraid that is impossible, there was a very recent discussion about it,
  | + 255944 [transfire@gm] I was thinking more along the lines of "transparent arguments". Here's
  |   255968 [sonoflilit@g] Wow, you're meddling in some pretty interesting things here. I don't
  |   256042 [transfire@gm] Does my FORTH love show thru? ;D
  |   256044 [gregory.t.br] ...
  + 255940 [shortcutter@] X = Struct.new :ary do

lose the first character
255666 [bladenut@gm ] r = r.reverse.chop.reverse  # remove the first character
+ 255667 [florian.assm] Check String.[] and Range
+ 255668 [dan-ml@da 42] if you want to lose the first *character* try r[/./m]=""
| 255676 [vjoel@pa h. ] Or, non-destructively,
| 255756 [dangerwillro] There are a million ways to do this in Ruby.
| 255758 [lists@be tr ] Obey at least some conventions.
| 255772 [dangerwillro] So sweet about it. What conventions do you refer to?
+ 255762 [transfire@gm] Actually, I've been wanting a front version #chomp for a long time
  255764 [sam@po er ou] I thought the pohc! was clever.  But maybe left_chop and right_chop (or

Re: class destruction (evil genius metaprogramming)
255672 [rick.denatal] kermit.class.instance_methods(false).each{|m|
+ 255722 [dblack@wo bl] Muppet.instance_eval { remove_method(m) }
| 255724 [robert.dober] or Muppet.send :remove_method, :m
| 255752 [dblack@wo bl] If you have a method called "m" :-)
| 255754 [robert.dober] Ah I see :(, Probably 50% of my errors come from spurious ":" ARRRRG
+ 255753 [dblack@wo bl] irb(main):019:0> s = ""
+ 255861 [dblack@wo bl] I do sometimes wonder what would happen if the ancestry array were
  + 255884 [twifkak@co c] You mean, like Object#become? :)
  | 255895 [dblack@wo bl] Not exactly.  As I understand it, #become involves references changing
  | 255949 [gregory.t.br] Would you want to be able to switch ordering too?  I wonder what kind
  + 255888 [rick.denatal] Actually the ancestry array only exists as the return value of the
    255910 [dblack@wo bl] By making it writeable I meant making it an interface to the chain

ruby File#sysread
255673 [bladeon@gm i] I am attempting to create a program that can transfer files. It so far
255674 [TimHunter@nc] On Windows? "rb"
255679 [bladeon@gm i] <.< >.> yes. I have no other choice. But yes, I was thinking it might be
255684 [bladeon@gm i] Ahh, thanks. I've had little experience with the File class in ruby.
255936 [nobu@ru y- a] It's an eternal curse against Windows programers. :)

load "file-name" question
255677 [dmoody47@co ] This is my first post to this forum and I am a ruby nood who usually
255678 [dmoody47@co ] EDIT
+ 255680 [bladeon@gm i] Its looks good. I cant really see the problem. As far as i know
+ 255698 [alex@bl ck e] I usually handle this by having a file 'test/boottest.rb' that looks

[ANN] Dhaka-2.2.1
255686 [mushfeq.khan] ...
255738 [anthonyeden@] Mushfeq,

Walking through Tate and Hibbs, running into things that don't work...starting on page 7
255687 [xcampanoli@g] First of all, there seems to be this claim on page 7 that the contents
255781 [xcampanoli@g] My next problem is the "greeting" page which I'm supposed to be able to
255789 [gregory.t.br] mailing list.
255792 [xcampanoli@g] Okay, thanks.

str.scan
255689 [bladenut@gm ] I have a page of html, the usual thing. It has an ordered list. So it has
+ 255690 [peter@ru yr ] Colin,
| 255766 [gavin@re in ] Minor pedantic correction: .* is greedy (it grabs as much as it can).
+ 255703 [mick@ho li s] There are a number of them.
  255706 [peter@ru yr ] and if you decide you need something advanced, you could check out
  255774 [bladenut@gm ] stuff.scan(/<li>(.*?)<\/li>/).flatten

Log file doesn't show message
255695 [bombadil.tom] ...
255708 [florian.assm] I'm not sure what this code should do when it's finished but I
255713 [bombadil.tom] ...
255714 [florian.assm] Add 1 to index when you choose the filename...
+ 255721 [bombadil.tom] ...
+ 255728 [bombadil.tom] ...
  255732 [florian.assm] I'd subscribe the maillist or use a webservice if it exists, otherwise
  255736 [bombadil.tom] ...

Create text files...
255700 [bombadil.tom] ...
+ 255709 [AEtzold@gm .] Dear Tom,
+ 255755 [Reid.Thompso] not ruby, but...

How to set the timeout attr when using open-uri to open a url.
255702 [yedingding@g] ...
255705 [pergesu@gm i] You can use the timeout library.
255739 [yedingding@g] ...
255883 [rick.denatal] Where did you see a read_timeout option?  I can't find it in any
255892 [yedingding@g] ...
255906 [rick.denatal] Well I must have missed where you said that you were using 1.9. <G>

[Solved] Dir copy with rename
255717 [Gilbert.Rebh] finally with your help and the snippets of another thread =
255718 [Gilbert.Rebh] a small improvement to get files renamed also, as
255719 [Gilbert.Rebh] should have been, read as=

rar gem!
255720 [bashar.ayyas] I'm building an application to compress and uncompress files and this
255727 [alex@bl ck e] This came up a little while ago - you're best off calling unrar.

wite an integer to file as binary
255723 [james@di su ] Simple problem but I'm not sure of an elegant solution, I can do it but
+ 255726 [robert.dober] A first idea - not tested - would be something like this
+ 255729 [alex@bl ck e] File.open('output.bin', 'wb'){|f|
| 255730 [james@di su ] Thanks, thought the only way was to but it into an array, my syntax
+ 255734 [anthonyeden@] Take a look at the bindata gem for all your binary needs. I've used it
  + 255780 [dangerwillro] This one is always a stumper.
  | 255971 [rick.denatal] Except that the OP was looking to write the integer as 4 binary bytes.
  | 255973 [dangerwillro] Oops! I missed the part about 4 binary bytes. Sometimes the inbox is
  + 256025 [james@di su ] Gahhh wish I'd heard of bindata gem a few months ago, now I feel like

anybody help me
255725 [mahen.1981@g] i want to open outlook thro my HTML using ruby code(onclick of submit
255731 [has.sox@gm i] ...
255777 [onebitcipher] ...

Ruby Nube
255733 [a.paranoid.a] The concept of Dynamically Typed Languages has peaked my interest.
+ 255735 [shortcutter@] Often scripting languages are dynamically typed, but there are others as
| 255785 [vasudevram@g] that is related to the clean syntax and powerful functionality or to
+ 255779 [dangerwillro] Dynamic typing itself is not such a big deal, but it does mean less
| 255783 [shortcutter@] While I agree to the rest I would not attribute this example to dynamic
+ 255786 [garbagecat10] ...

[QUIZ] Verbal Arithmetic (#128)
255737 [james@gr yp ] 1.  Please do not post any solutions or spoiler discussion for this quiz until
+ 255740 [kazaam@ol co] I really don't get it :) How did you figured out that 2 = y in your example?
| 255741 [james@gr yp ] Well, a non-clever way is to try an exhaustive search of each digit
| 255743 [kazaam@ol co] ohh I totally misunderstood the task here.. I thought the input would be
| 255745 [sam@po er ou] For perhaps a reason to change the wording, that's what I thought as
| + 255747 [james@gr yp ] Sorry for the confusion folks.  You get both sides of the equation
| + 255748 [robert.dober] Hmm maybe this helps to clarify (for emacs users) the problem is like
|   255770 [jameskilton@] ...
|   255788 [warrenb@aq i] Jason,
+ 255912 [aurelianocal] ./quiz_128.rb "a+b=c"a: 5b: 1c: 6
| + 255915 [bulliver@ba ] I think about 12 hours from now...
| + 255952 [aurelianocal] Well, I think I can send it now. My implementation is onhttp://pastie.caboo.se/71198.
+ 255948 [rrafje@gm il] ...
| + 255959 [hmack.gm@go ] ...
| + 256120 [james@gr yp ] #!/usr/bin/env ruby -wKU
|   256199 [moderated@so] On Jun 18, 4:59 pm, James Edward Gray II <j...@grayproductions.net>
|   256208 [james@gr yp ] Thanks.  There have been far more clever submissions though.
+ 255997 [justin.ethie] ...
+ 256029 [Glen.F.Panko] #! /usr/bin/env ruby
+ 256047 [m_goldberg@a] Here is my solution for Ruby Quiz 128. It's a little rough, but I
+ 256145 [m_goldberg@a] Sorry for the second post, but I just noticed that I pasted a wrong
+ 256221 [ruby-talk@lo] This solution requires Gecode/R[1] 0.2.0 (need to install Gecode[3,4]
| + 256237 [ruby-talk@lo] The last part is probably a bit misleading/incorrect. We are not
| + 256345 [ruby-talk@lo] I forgot a node in the middle there (since there are 4 nodes). The
+ 256272 [showaltb@gm ] Here's my solution: http://pastie.caboo.se/72030

Abstract interfaces as a means of documentation
255742 [eliben@gm il] The issue of abstract interfaces has been discussed extensively in
255790 [gavin@re in ] 4) Create a Module and document the method in the module, and then
255808 [eliben@gm il] Is this really different from declaring JumpingClimbingPlayer as a
255822 [gregory.t.br] Yes.  Modules cannot be inherited from or instantiated.
255845 [eliben@gm il] Understood, thanks. Another thing - say that for some reason I want my
255870 [gregory.t.br] module B

JRuby+require in ant, was [Solved] Dir copy with rename
255744 [Gilbert.Rebh] if someone else runs into that ...
255746 [nicksieger@g] We do build and distribute a jruby-complete jar, just not through the

Re: How to set the timeout attr when using open-uri to open
255751 [roseanne@ja ] open(name, *rest, &block)

Dynamic Class Initialization
255757 [peer@ca ad d] I know this can be done, but I can't find out how to do it.  I have a
+ 255759 [ecomba@ma .c] clazz = Object.const_get("Product")
| + 255763 [peer@ca ad d] Thanks all. I knew this couldn't be that difficult.  I must have been
| + 255768 [Rob@Ag le on] # from Jim Weirich (based on email correspondence)
+ 255761 [farrel.lifso] class = "Product"
+ 255769 [Daniel.Kempk] def constantize(camel_cased_word)
| 255879 [ryand-ruby@z] % irb
| 255880 [Daniel.Kempk] Wow, okay. I didn't know about that.
+ 255843 [gpygood@12 .] product=eval("Product").new

Using extend for initialization settings?
255760 [transfire@gm] It's not uncommon to see initialize method take a hash or a setting
+ 255771 [gregory.t.br] Side by side, I have to say the former is clearer than the latter, and
+ 255784 [shortcutter@] irb(main):001:0> require 'ostruct'
| 255797 [transfire@gm] Hmm... I think maybe my point is being missed. The goal is to
| + 255798 [gregory.t.br] class Foo; end
| | 255800 [robert.dober] Hmm control maybe, you are not forcing anybody to call
| | 255801 [gregory.t.br] Then just pass the constant into the constructor :)
| | 255806 [robert.dober] Huh.. that is exactly what I have suggested, right?
| | 255826 [gregory.t.br] Right.  I was basically saying you don't need to_module because if you
| | 255830 [transfire@gm] #to_module is just a convenience so one can pass in a container module
| | + 255833 [gregory.t.br] I understand what it's for, I just don't think it's very useful.
| | + 255852 [robert.dober] Thanks for the clarification, I thaught it was part of the concept and
| + 255802 [shortcutter@] Actually your code is about initializing an instance - not a class.
|   255837 [transfire@gm] Attrsibutes would have precedence with how things work now. But that
|   255839 [transfire@gm] Sorry. I was thingk of #include, not #extensd. So scratch that ...
+ 255834 [dan-ml@da 42] The behavior is substantially different. With hash initialization,

Info regarding Zlib::GzipReader
255767 [ondemannen@g] I'm trying to parse through a gzip'ed proxy access log with

nube soap::mapping::object question
255773 [brking@gm il] I've been banging my head against the wall on this problem. I have a
255855 [nakahiro@sa ] Can you show me a sample response XML?  I don't understand 'empty element'.

mystery deepens
255776 [grehom@nt wo] To further confound me I tried the ruby rails turtorial and to my

(none)
255787 [hraducan@gm ] ...

ruby in cmd
255791 [einaung@ya o] I am new to Ruby and am trying to run a piece of code from Programming
+ 255793 [Daniel.Kempk] You need to put a puts/print in front of everything you want to output.
+ 255794 [a.r.ferreira] As there is no print/puts/etc. statement, this non-output is expected
| 255795 [maung@at -o ] That's explained it. Thanks a lot. It saved me a lot of time.
+ 255796 [chris.hulan@] To see the output, you have to put it out 9^)

test to see if a variable exists
255803 [bladenut@gm ] So I am stealing all these identities and storing everything in a big
+ 255807 [pdanese@Ri -] So I am stealing all these identities and storing everything in a big
+ 255809 [gavin@re in ] Arrays (and Hashes) in Ruby are sparse - they only store the values
+ 255816 [m_goldberg@a] Using a hash is the way to go here. You've already been advised to do
  255865 [dangerwillro] 377-23-4736  (not a real one)
  255882 [m_goldberg@a] I don't doubt that Identity objects could be indexed into some kind

Facets Units.  How do I use it?
255805 [frioux@gm il] I am trying to use the facet units and I am having no luck.  If I do
255815 [calamitates@] => nil
255819 [frioux@gm il] Ah!  Brilliant.  I had forgotten about that.  In my irbrc I defined a
255821 [calamitates@] The exchange rates are not actually the reason for the slow start-up
255828 [frioux@gm il] Thanks for the tips!  I'll look into it for sure.  I think that the
255829 [calamitates@] You need to include the Units module first (this is to prevent
255841 [transfire@gm] A new version of Units will be out in a week or two as part of Facets
255908 [frioux@gm il] Thanks much, I will definitely check that out.
255930 [transfire@gm] Good idea. Will put it on the TODOs.

accessing the count/iteration # within an "each" ???
255810 [greg.hauptma] ...
+ 255812 [donald.ball@] testhash.each_with_index {|d, i| puts i}
+ 255813 [TimHunter@nc] ruby$ ri Enumerable#each_with_index
  255827 [greg.hauptma] ...

alias_method for static method
255811 [borjam@da i3] I was wondering if it is possible to create aliases for class methods,
255814 [dblack@wo bl] ...
255817 [borjam@da i3] Thanks a lot, it worked like a charm.

Get Parameter names from methods
255818 [ssmoot@gm il] There's holes in this. It's not a full Ruby parser. But it should work
255831 [ssmoot@gm il] Now any UnboundMethod (written in Ruby) can be inspected for it's

[ANN] Hpricot 0.6 -- the swift, delightful HTML parser
255823 [why@ru y- an] Hpricot 0.6 is up on Rubyforge.  Or get it from the development gem

Question on Getting back in the swing of things & Time Management
255824 [rubygeekgirl] ...
255875 [bulliver@ba ] Sure it is possible. I am no professional programmer, in fact, I don't even
+ 255887 [rubygeekgirl] ...
+ 255889 [byronsalty@g] Darren is right - as long as you know Ruby and Rails somewhat then you
threads.html
top