201661-204985

201485-202184 subjects 201823-233190

^ Recursion and Ruby
201661 [glenn.cadman] As a practice to learn ruby I tried to create a recursive program
+ 201662 [curi curi.us] You have a typo. it is elsif not elseif.
+ 201663 [botp delmont] # def fib ( n )
| 201664 [glenn.cadman] Dear Elliot, Peña
+ 201668 [erikveen gma] You could use "case" as well (see version 2). It's faster.
  + 201670 [erikveen gma] Only the lambda version (versions 5) is much slower. Why is the
  | 201675 [rubytalk eac] Try CachedProc
  | 201700 [erikveen gma] I could easily implement a cache myself, even a cleaner one
  | 201710 [robert.dober] Sorry if I misplaced my reply, it was intended for OP and did not in any way
  + 201679 [dbatml gmx.d] Actually version 3 and version 4 are exactly equivalent for Ruby, it
  | + 201692 [robert.dober] It might be of interest to the OP to examine the recursive calls in the
  | + 201703 [erikveen gma] Well, _finally_ the AST is the same. But somehow, it's
  |   + 201711 [erikveen gma] Oops... Wrong headers...
  |   + 201747 [dbatml gmx.d] if a
  |     201756 [the.mindstor] (stupid question): what have you used to parse the code and show the nodes?
  |     201766 [erikveen gma] ...
  + 201696 [martin snowp] All of these suffer from the problem that they make approximately fib(n)
    + 201778 [chneukirchen] Given you have an reasonably exact approximation of the square root of 5,
    | + 201781 [Rob AgileCon] ...
    | + 201796 [robert.dober] I challange this, as there is no algorithm to compute c**n in O(1) it is
    |   201804 [doug mcnaugh] OT, but...
    |   201809 [robert.dober] sqrt(5)), right?
    |   201814 [curi curi.us] sqrt(5) can be pre-computed.
    |   201816 [robert.dober] obviously my didactic powers are limited :(
    |   201851 [Rob AgileCon] ...
    + 201878 [glenn.cadman] Well whilst my orginal exercise was just to get recursion working in
      + 201881 [glenn.cadman] printf("Enter a number: ")
      | 201884 [simon.kroege] maybe
      | 201886 [botp delmont] # puts (0..i).map{|k| fib[k]}.join(' ')
      + 201882 [martindemell] The block form of Hash.new calls the block for every
      | 201925 [phurley gmai] When I am confused (which happens all too often), I like to "see" what
      + 201905 [Rob AgileCon] ...
      + 201948 [Rob AgileCon] (I hate when the email doesn't get through)

^ YARV install on Mac OS X ?
201665 [pere.noel la] what to do in order being able to install YARV on Mac OS X ?
201667 [decoux moulo] The installation say (see http://www.atdot.net/yarv/#i-4-2)
201669 [pere.noel la] Build and Install
201674 [decoux moulo] First retrieve the source
201676 [pere.noel la] ok thanks !

^ Ruby on OpenVMS
201671 [ollin email.] Does anybody have some experience with Ruby on OpenVMS? e.g. link to
201758 [greg.kujawa ] Here's something I googled across -->
201867 [ollin email.] Thanks for your focus, however this is very short and only thing the
201902 [greg.kujawa ] Sorry, that's about the extent of what I came up with. The last time I

^ New C/ruby powered editor
201677 [phil shellar] I've been hacking away at a new editor for a while and have come up with
201681 [pbattley gma] I managed to compile it on OS X PPC (had to do 'chmod +x install-sh'
201685 [phil shellar] 'C-X C-X' should have got you out. 'C-B c' would have created a new buffer.

^ Reading month from timestamp (postgres) [Rails]
201689 [marco.kratze] Does anybody know how to get a month from a timestamp which was made with
201690 [rubytalk eac] created_at.month

^ Re: Enterprise Ruby Studio
201693 [hulachr hotm] I checked out the site, and thought it looked similar

^ cookbook example in InstantRails
201699 [rxv hotmail.] I'm trying to follow along with the code in the cookbook example provided in
201704 [schapht gmai] That's the beauty part, you only need a few lines for basic stuff
201708 [alex blackke] As as example, try looking in
201713 [schapht gmai] [snip: instant rails question]
201721 [dblack wobbl] And the Slashdot review of "Ruby for Rails", in the wake of which said
201722 [znmeb cesmai] Speaking of which ... there's a *reason* "Ruby for Rails" is the number
201765 [rxv hotmail.] Took you guys' advice and went out and bought R4R.

^ [SUMMARY] Panagrams (#86)
201720 [james graypr] First, let me clear up the naming issue, since I missed it when created the
201726 [martin snowp] Note that the discussion of the different ways to solve this problem
201741 [james graypr] Great info all around.

^ [ANN] attributes-3.0.0
201731 [ara.t.howard] NAME

^ Installing gems for a single user
201732 [jennyw dange] I'm used to using gems locally where I can install them systemwide. But
+ 201757 [ruby-talk wh] mkdir ~/.gems
+ 201849 [gsinclair gm] My solution: compile and install Ruby in ~/software (or similar) and

^ Gateway Test
201734 [james graypr] Please ignore.
201736 [Daniel.Berge] Is something up?  I noticed that most threads seem to make it to
201737 [james graypr] Yes, we were having trouble with the mail2news side of the Gateway.

^ Application Map and Navigation\Utility methods
201735 [aidy.rutter ] I have an ObjectMap Class

^ Negative Numbers
201738 [marston mars] Hey all,
+ 201739 [Daniel.Berge] Use the .abs method
+ 201740 [collinsj sea] irb(main):001:0> -7.abs
| 201774 [lists bertra] Be careful. The minus sign is part of the constant. A minus
+ 201743 [gekko bitkei] -12345.abs
+ 201744 [schapht gmai] irb(main):001:0> --7
  201750 [cjkim jcnow.] You can always multiply it by negative one (-1), e.g.
  + 201752 [stmpjmpr gma] You can also call the abs method of a number to get its absolute
  + 201753 [marston mars] Hey everyone,

^ Application Map and Navigation\Utility methods
201746 [aidy.rutter ] I have an ObjectMap Class
201993 [collinsj sea] Usually this means you have a deep recursive call somewhere, possibly

^ Checkbox TreeView availability ?
201748 [mikecourtney] Does anyone know of a RoR implementation of a TreeView in which you can
+ 201761 [ml e4net.com] I did something like this, which I describe in this blog entry.
| 202114 [mikecourtney] Thank you for the information Jim. Pls let me know if/when you add it to
| 202290 [ml e4net.com] I added the entry to my blog, it looks like this...
+ 201764 [drbrain segm] Please ask Rails questions on the Rails mailing lists.

^ tls?
201755 [yottskry gmx] I'm creating a ruby jabber client (I know there's a library for this,
201763 [drbrain segm] OpenSSL is built-in.  You can probably find examples off in the net
201897 [yottskry gmx] Ahh yes, thanks. Trouble is, I create an SSL socket but not a lot else

^ One class per test file (was [PATCH] --fqname option to test/unit/autorunner.rb)
201760 [Daniel.Berge] (Moved to ruby-talk from ruby-core since we're on a more general topic)

^ [ANN] Route plotter for the London Underground network
201770 [ezusbo trans] I have a facility which uses css and ajax to perform live plotting of

^ Re: Route plotter for the London Underground network
201771 [mcyi2mr3 goo] Yeah thats cool david!
201776 [ezusbo trans] Ajaxian.com has got some cool suggestions :-)

^ equivalent of attr_accessor for class variables?
201779 [jtprince gma] class Foo
+ 201780 [ara.t.howard] class C
| + 201783 [jtprince gma] For an intermediate ruby user, could you explain what is happening in
| | + 201786 [ara.t.howard] search the archives - this comes up about once per week.  for now, suffice it
| | + 201787 [dblack wobbl] class << obj
| + 201784 [dblack wobbl] That doesn't use class variables, though -- which is an asset, as far
| | 201789 [ara.t.howard] yeah - what he said ;-)
| + 201846 [transfire gm] require 'facet/functor'
+ 201785 [dblack wobbl] One way or another, if you want a class variable set when you call the
+ 201817 [rsanheim gma] Here's the Rails implementation if you just want to see one working

^ challenge
201788 [ara.t.howard] OPEN = File.method 'open'
+ 201790 [ara.t.howard] correction.  start here
| + 201795 [pit capitain] class << File; self; end.class_eval do
| | 201798 [ara.t.howard] wow.  learn something every day!
| | + 201802 [robert.dober] It does not, open is defined in IO, and becomes visible again :)
| | | 201808 [ara.t.howard] duh - need more coffee.  so - back to original challenge!
| | + 201805 [lopx gazeta.] The open method is in fact defined in IO class which is extended by File
| | + 201806 [pit capitain] Ara, I just called
| + 201842 [transfire gm] (class << File; self; end).instance_eval {
|   201848 [ara.t.howard] and the block?
|   201852 [sean.ohalpin] I had to cheat ;)
|   + 201889 [robert.dober] Block behavior is preserved though when we store a reference to a method
|   | 201898 [sean.ohalpin] Excellent. Don't use the & to convert the Proc into a block - just use
|   | 201916 [robert.dober] Too much honor, I seem to post too fast, furthermore the idea is ara's not
|   | 201919 [sean.ohalpin] Hmmm. I'm still getting "singleton method called for a different
|   | + 201923 [robert.dober] [SOLUTION] ;)
|   | + 201926 [ara.t.howard] me too.
|   |   + 201928 [robert.dober] Me too, what was I executing???
|   |   + 202064 [sean.ohalpin] class Foo
|   |     202458 [ mfp acm.org] Open is a singleton method of IO, not File; this is why the call fails (in
|   |     + 202565 [sean.ohalpin] I think that certainly fits the description of enlightenment :)
|   |     | 202577 [ara.t.howard] yeah - i never solved satisfactorily...
|   |     | 202655 [robert.dober] Just another thaught about it, what is wrong with my OPEN.call solution, is
|   |     | + 202659 [ mfp acm.org] It'd require one constant per method call for Ara's intended use, in the
|   |     | + 202664 [sean.ohalpin] Nothing wrong with it - it's just not an answer to the challenge!
|   |     |   202680 [robert.dober] I guess I fail to understand the challange :(
|   |     + 202729 [pit capitain] The problem is, if you change the method of the superclass (IO), and
|   + 201918 [sean.ohalpin] Replying to myself to correct an error - it's the implicit to_proc (&)
+ 204985 [shortcutter ] It seems there's an "end" too much.  But to the real story: here's a

^ ActiveRecord alternatives
201793 [edgard.riba ] I have a database application running under sybase anywhere SQL server.
201794 [kashia.buch ] I don't think ActiveRecord is that stupid (but I've never tried it).
201800 [ruby philip.] set_primary_key()
201812 [lopx gazeta.] You can override table names and names of all your columns. There are
201819 [kashia.buch ] mh, ok. good to know.

^ Choosing among object/class/module/top-level methods...
201799 [sam.s.kong g] Whenever I try to make a quick solution program,
201803 [ara.t.howard] <snip various methods i've used too>
201810 [sam.s.kong g] I haven't checked out your library yet.
201813 [ara.t.howard] yes.

^ "Self" Reference
201811 [nathan.olber] Is it possible to define new classes that behave like standard datatypes
+ 201815 [lopx gazeta.] class ListOfBuddies < Array
| 201854 [logancapaldo] Ehhh, I wouldn't necessarily choose inheritance. It depends on what
+ 201843 [transfire gm] My word, the possibilites if you could! You could change an object's

^ [ANN] Zerenity 0.8
201818 [farrel.lifso] = Zerenity
+ 201820 [farrel.lifso] Whoops, make that http://www.aimred.com/files/projects/zerenity
+ 201829 [collinsj sea] Looks cool! Thanks!

^ Preferred monkeypatching technique
201821 [tom helmetst] class Firetruck
+ 201824 [drbrain segm] class BigNozzleFiretruck < Firetruck
| + 201828 [djberg96 gma] Or that. :)
| + 201835 [banshee bans] Sounded to me that perhaps he was talking about the problems that I normally
+ 201825 [djberg96 gma] Perhaps add a namespace?
| 201831 [tom helmetst] Well, the idea is that the 3rd party software is going to be using
| 201862 [drbrain segm] Can you give a concrete example where this takes place?
| 201968 [tom helmetst] My specific purpose is to write a plugin for Rails that adds an option
| 201971 [drbrain segm] module X
| 201977 [logancapaldo] Rails does "funny" things. These helpers are usually used from within
| + 201998 [tom helmetst] That's quite true, it does work wonderfully in application_helper.rb.
| | 202002 [ezmobius gma] Tom-
| + 202041 [drbrain segm] This is what ActionController::Base::helper is for.
|   202071 [logancapaldo] Did you miss the rest of my post where I told him to use helpers? Did
+ 201827 [sean.ohalpin] class Firetruck
+ 201837 [dblack wobbl] I don't know whether it qualifies as "monkeypatching" (I always
| + 201853 [hal9000 hype] Actually it was only last week that I first saw this term
| | + 201856 [botp delmont] # Actually it was only last week that I first saw this term
| | | 202048 [hal9000 hype] No, I saw that thread. But it was used in a Python
| | | 202141 [ruby-talk wh] The term "hacking" used to have a negative slant on it, too.  It's not the term,
| | | 202146 [dblack wobbl] But why dance, in the first place, to the tune of whoever says
| | | 202562 [james.britt ] Being called a hacker was a badge of honor, an still is among certain
| | | 202593 [ mfp acm.org] Or, if you want to surround it with an even more positive aura, maybe even
| | | 202594 [dblack wobbl] Awww, I was hoping someone would pick up on the "scopes" part :-)
| | | 202599 [hal9000 hype] I try not to shoot fish in a barrel... not till they evolve
| | | 202604 [sean.ohalpin] If it walks like a fish....?
| | | 202615 [transfire gm] cut SeaDuck < Duck
| | + 201860 [rubyfan gmai] I think the term "monkypatching" as applied to this context (the
| | | 201893 [dblack wobbl] The badge looks an awful lot like the criticism....  :-)
| | + 202527 [james.britt ] Let's hope not.
| |   + 202528 [ezmobius gma] Aparenhtly the term originated as Guerilla patch. As in Guerilla
| |   | 202563 [james.britt ] Ah, thank you.  Quite informative.
| |   + 202530 [transfire gm] I don't think it's quite that bad and tend to agree with _why. If
| |   + 202533 [tom helmetst] Not necessarily. For me, the term "monkeypatch" establishes a
| |     202546 [dblack wobbl] How about we call the whole thing "programming", and at the same time
| |     202583 [james.adam g] I say go to the opposite end of the spectrum - let every subtly
| |     202587 [tom helmetst] Well, I guess we should prepare ourselves to have a lot of threads here
| + 202025 [tom helmetst] This is a bit unrelated, but is there a way to give the block parameter
+ 201838 [dan-ml dan42] module FastFiretruck
| + 201855 [logancapaldo] And I thought the blah = instance_method closure trick was cool, but
| + 201859 [transfire gm] That only works because there is no initialize method defined in
| + 201861 [transfire gm] Hey, thanks Daniel! You actaully led me to a new potential approach.
+ 201900 [martin snowp] It seems to me that you're asking for a ruby version of gensym.  (See
| 201960 [logancapaldo] % cat gensym.rb
| 201969 [drbrain segm] You don't need a mutex.
| + 201973 [logancapaldo] Do you not need a Mutex _now_, since @gensym_count += 1 is
| + 202096 [martin snowp] Okay, but now if two different files include this exact code, you're
|   + 202102 [transfire gm] What if the symbol is already used?
|   + 202123 [ara.t.howard] if two different files have this exact same code inlined the programmer should
|     202137 [drbrain segm] Indeed, but I think you're being too kind.
+ 202010 [daniel.schie] <http://rcrchive.net/rcr/show/321>
  + 202020 [transfire gm] Sure. Although, the name provides a handle if you need to dynamically
  | 202031 [daniel.schie] Neat-o.
  + 202021 [tom helmetst] I looked at that RCR a while back, but only glanced over it as it was
    + 202028 [sean.ohalpin] I can't remember if I've posted this before, but here is my "poor
    + 202030 [daniel.schie] +1
threads.html
top