223981-336694

223801-232003 subjects 224096-225540

[ANN] Milwaukee Ruby User Group meeting toniight @ 5:30 to 8
223981 [tdjordan@gm ] It's that time again to hear great presentations about my

accessing class constants in included modules
223982 [martindemell] module Foo
224114 [agnewtj@no p] class Object
224147 [martindemell] Ah - nice!
224253 [vjoel@pa h. ] This may be a corner case, but if you're going to define #my at the

Ruby Cgi Puzzle on Apache
223991 [shiwei1.zhan] ...
224091 [david@va ln ] And

Exception catch-all
223996 [leslieviljoe] I have a script that needs to run unattended every night, and I need
+ 224000 [nospam@no it] begin
| 224008 [jan.svitok@g] You should put this begin...rescue...end around each thread body you
| + 224010 [leslieviljoe] Thanks, that helps.
| + 272027 [rogerpack200] If you need more verbose output on unhandled exceptions (i.e. yours says
+ 224090 [david@va ln ] Huh?

[ANN] FastRI 0.1.0: faster, smarter RI docs for Ruby, DRb-enabled
224002 [ mfp@ac .o g] FastRI 0.1.0: faster, smarter RI docs for Ruby, DRb-enabled
+ 224022 [leslieviljoe] Thanks for this. I see it's not working so well on Windows yet.
| 224069 [ mfp@ac .o g] I have pushed a patch to the 0.1 branch
| + 224136 [leslieviljoe] Yes, it was escape codes. I'll try plain.
| + 224140 [leslieviljoe] I get some strange responses on Windows. I'll test on Linux shortly.
|   + 224144 [leslieviljoe] root@kadima:/etc# fri assert
|   + 224145 [botp@de mo t] # c:\Program Files\Microsoft Visual Studio 8\VC>fri -f plain Test::Unit
|   + 224154 [ mfp@ac .o g] As far as I can see from this and your other message,
+ 224106 [botp@de mo t] # FastRI 0.1.0: faster, smarter RI docs for Ruby, DRb-enabled
| 224146 [ mfp@ac .o g] I'll try to fix that in one of setup.rb's hooks, I'm always bumping into it :)
| 224293 [botp@de mo t] # > feature request: i hope fri remove the case sensitivity. eg,
| 224335 [ mfp@ac .o g] Should be fixed in 0.1.1, which I just released, as well as the issue with
| 224442 [botp@de mo t] # $ fri string.split
| 224579 [ mfp@ac .o g] Not right now, but it will be added (we really want this if fastri-server is
| 224751 [botp@de mo t] #   fastri-server -b
| 224776 [ mfp@ac .o g] It's not your fault; it should have been created automatically when you ran
+ 224110 [craigbeck@lu] I'm trying to serve my docs from one machine and have them available
| 224148 [ mfp@ac .o g] ============
+ 224112 [louis.j.scor] Mauricio;
| 224150 [ mfp@ac .o g] Thanks for reporting this; I've wrapped that code with
+ 224818 [dsisnero@gm ] ...
| 224836 [ mfp@ac .o g] fastri-server searches "#{Gem.path}/doc/*/ri" for yaml files holding RI
| + 224885 [botp@de mo t] # FastRI remembers in which gem a
| + 224888 [dsisnero@gm ] ...
+ 224904 [gabriele.mar] I must be missing something.
  225037 [ mfp@ac .o g] (1)
  225051 [gabriele.mar] Thank you for your detailed answer.

[ANN] ActiveRecord-Mimer 0.0.1
224004 [ola.bini@ki ] The initial version of ActiveRecord-Mimer have been released.

Session Eruby.noheader problem
224005 [mbubi@li er ] i have installed Ruby and Apache on Windows Machine.

Re: the name of Matz
224006 [andreas.kroh] ...

win32ole and excel and copy
224007 [chen_li3@ya ] I use wind32ole to import data and create graphs into Excel. I find the
224024 [ghalsey@ya o] require 'win32ole'
224082 [chen_li3@ya ] I try the script but I find it only open  an designated file only. I

replacing a formula from a string
224009 [josselin@wa ] I have a long formula expressed as a string
224125 [nospam@no it] The simplest way to solve this problem is to convert your equation into a

#returning and #tap
224013 [transfire@gm] Had use for this today: #returning is a convenience method you'll find
+ 224015 [james@gr yp ] One of the comments to the original article combines both methods
| 224032 [transfire@gm] Oh yea! I remember #with from way back, but then I don't recall anyone
| 224034 [spoooq@gm il] Just realised that of course tap != k   :P
+ 224019 [invalid@gm .] [about #returning and #tap]
+ 224028 [spoooq@gm il] MenTaLguY's use cases seem the more convincing of the two. Why would I
+ 225210 [drbrain@se m] So... it usually doesn't save any lines, it adds typing, it hides the
  + 225215 [transfire@gm] Er... that seems a backwards and inconsitant interpretation. How can it
  | 225222 [drbrain@se m] Most of the time it adds code.  Look at the two examples on the blog
  | 225239 [transfire@gm] Well, it does add structure, otherwise there would be not be any point
  + 225233 [vjoel@pa h. ] class Object
    + 225234 [vjoel@pa h. ] Oops, sorry. I didn't realize that #tap is the same as #then.
    | 225236 [hal9000@hy e] I suppose it's as in "tap a keg."  :)
    | + 225243 [vjoel@pa h. ] A tee branches. Does a keg tap branch?
    | + 225255 [martindemell] More likely tap as in "tap a phone line", i.e. both siphon off a value
    |   225309 [louis.j.scor] I think where returning really makes a difference is with local
    |   225323 [ryand-ruby@z] I realize this is a contrived example on your part, but you did
    |   + 225324 [james@gr yp ] def foo(a)
    |   + 225335 [louis.j.scor] No.  You're absolutely right that this was a useless, contrived
    + 225358 [drbrain@se m] $ wc
      + 225370 [ara.t.howard] and quite easy to golf if line count matters that much
      | + 225375 [louis.j.scor] def foo; @foo ||= Foo.new.instance_eval{ self.bar = 'bar'; self } end
      | + 225382 [vjoel@pa h. ] ROFL
      |   + 225385 [dblack@wo bl] I'm not getting the semantics of "then".  Do you mean "then" as in, "I
      |   | 225388 [vjoel@pa h. ] Yes. Not much better than #tap, is it? Any ideas...? "and_then"?
      |   | + 225393 [dblack@wo bl] "whereupon" :-)  I guess it's hard to find a name that's general
      |   | | 225399 [vjoel@pa h. ] Does the following technique seem odd?
      |   | | 225420 [dblack@wo bl] Part of what's odd to me about #then is that it's not
      |   | | 225476 [martindemell] "then" actually works fine for me there, Englishwise. Maybe and_then
      |   | | 225488 [dblack@wo bl] I wonder if there's some name that embodies the fact that the object
      |   | | + 225492 [martindemell] Good point! I thought of "pipe" but even that doesn't say that it
      |   | | | 225498 [dblack@wo bl] Although... there might be cases where disturbing the object would be
      |   | | | 225508 [rosco@ro co ] Sweet!
      |   | | | + 225510 [spoooq@gm il] Noooooooooooo! Stop this meme now before it hurts someone!
      |   | | | + 225657 [dblack@wo bl] I rather like it too :-)  I guess if too many of them got chained it
      |   | | + 225494 [spoooq@gm il] I definitely think of it as tapping a phone line.
      |   | |   225495 [spoooq@gm il] Actually, how about giving the proc a copy of the object, rather than
      |   | |   + 225496 [martindemell] Thought of that, but not everything responds to dup (nil and symbols, e.g.)
      |   | |   | 225497 [spoooq@gm il] Can those cases be worked around?
      |   | |   | 225499 [dblack@wo bl] I don't think dup'ing plays well with the intent, which is to do a
      |   | |   | 225500 [spoooq@gm il] The original object -is- getting passed through... the point is to
      |   | |   | 225501 [dblack@wo bl] I see what you mean.  Well, as per my gsub! example, I think modifying
      |   | |   | 225503 [spoooq@gm il] This can be rewritten using existing keywords tho... if you want to
      |   | |   | 225551 [dblack@wo bl] I'm afraid I don't follow.  Can you show how you'd write this in the
      |   | |   | 225857 [spoooq@gm il] What I mean is to chain with gsub instead, or to make it obvious that
      |   | |   | 225861 [spoooq@gm il] I think I need to make this more explicit for it to be clear. Only the
      |   | |   | 225882 [dblack@wo bl] You're mixing real and quasi-pseudo-code examples here, though.  One
      |   | |   | 225899 [spoooq@gm il] Sorry, this was a really bad example from me... I meant the equivalent
      |   | |   | 225902 [dblack@wo bl] I'll just add that I now see exactly what you mean about mixing the
      |   | |   + 225505 [transfire@gm] "Do as if frozen". Perhaps #freeze could take a block?
      |   | |     225507 [spoooq@gm il] Nice. Sounds very reusable.
      |   | + 225404 [ara.t.howard] class Object
      |   | | 225416 [vjoel@pa h. ] To me, "as do" doesn't read as well as "then do".
      |   | + 225504 [transfire@gm] well, #with is the other common synonym. but #returning seems as well.
      |   + 225402 [ara.t.howard] heh.
      + 225381 [vjoel@pa h. ] But you have to type @foo _five_ times, instead of once. Oh, well. It's
        225411 [drbrain@se m] No, just @<Tab>.  I like my friendly editors.

Parse date fields from mysql database
224020 [bart.braem@g] I would like to be able to parse date fields from a MySQL database in order
+ 224023 [gabriele.mar] Just use Date#day, Date#year, Date#hour and so on.
+ 224027 [khaines@en g] require 'time'
  224068 [bart.braem@g] Combined with the methods from Gabriele this works perfectly, thanks!
  224072 [gabriele.mar] Oops! Sorry, I thought you were using ActiveRecord, so it was already

Suprise in Ruby
224026 [just-for-new] I can not remember having read about it before, however the following
+ 224029 [eric.jacobon] Friedrich Dominicus <just-for-news-frido@q-software-solutions.de>
+ 224031 [ruby@ml ic m] Yes. In your first call, 'Array.new' is evaluated ONCE before the call,
| 224111 [just-for-new] Yeah it has come to me this night that it's supposed to be right.
+ 224033 [dblack@wo bl] Array.new(n, obj)

Net::SSH Data Stream Problem
224038 [boss@ai bl d] I am trying to copy a file from my local machine to a remote machine
+ 224041 [hgs@dm .a .u] what platform(s)?
| 224044 [boss@ai bl d] I tried that just now but sadly it didn't change the result.
| 224049 [hgs@dm .a .u] OK, given they're both unices, that figures...  I'd then read and
| 224052 [boss@ai bl d] open(source_path) { |f| stdin.write f.read }
| 224056 [hgs@dm .a .u] [ri output]
| 224065 [boss@ai bl d] Thanks for the suggestion -- it worked.  Here are the code changes
+ 224054 [ara.t.howard] does this help?
| 224058 [boss@ai bl d] undefined method `flush' for
+ 224059 [pgquiles@el ] charset="iso-8859-1"
  224067 [boss@ai bl d] [snipped]
  224071 [eegreg@gm il] I had the same problem where my ssh connection closing early.  I solved

[TIP] Proc as Observer
224039 [tim.pease@gm] Working with an Observable object, I wanted to be able to add a Proc

Simple Math Problem
224040 [tloring@ma .] Can anyone shed some light on a simple math problem I have encountered?
+ 224043 [tim.pease@gm] Machine roundoff error. Floating point values are never precise on any computer.
| + 224046 [hgs@dm .a .u] brains hgs 226 %> irb
| | 224050 [tim.pease@gm] With IEEE 754  floating point values you only have 15 digits of
| | + 224051 [tim.pease@gm] <errata>
| | + 224053 [hgs@dm .a .u] I just picked a large value.  This seemed the clearest way to show
| + 224047 [tloring@ma .] Hmm...yeah, I figured that must be it, but I just didn't expect it with
| | 224123 [nospam@no it] It isn't about the magnitude of the numbers, it is about the unseen bits.
| + 224048 [ara.t.howard] boy,  how bout an rcr for that behaviour if one write this
+ 224045 [ara.t.howard] -a
+ 224271 [ jupp@gm .d ] Visit an introduction to Numerical Mathematics at your favorite
  + 224320 [vihanpandey@] ...
  + 224321 [benjohn@fy h] It's jolly decent of light to be so obliging about the speed it travels
    224322 [vihanpandey@] ...

matz podcast, and, streaming data in Ruby?
224042 [gilesb@gm il] streaming data in Ruby -- anybody know of media servers in Ruby? I

Re: Bytecode Compiler (#100)
224055 [rossrt@ro co] This quiz has turned out to have some interesting solutions, I'm looking
224105 [louis.j.scor] #!/usr/bin/env ruby
224202 [rosco@ro co ] It certainly looks it, too. I've glanced a few times, and put it on my

Flat CSV to Relational DB
224060 [mguterl@gm i] Anyone have any suggestions on pushing a flat CSV file into a
+ 224081 [james@gr yp ] #!/usr/local/bin/ruby -w
| 224226 [mguterl@gm i] Thanks, I was unaware of :header_converters, those look like they
+ 224095 [jeremy@hi eg] Depending on the quantity of data you may want to pick something other
  224231 [mguterl@gm i] In this particular case I do not have a large quantity of data, though
  224367 [jeremy@hi eg] Glad to help.  Let us know how it turns out.
  336694 [gheorghiua@g] Can you please elaborate on how you call natively load data infile from

Re: Proc as Observer
224061 [transfire@gm] Interesting... I'd like to see a simple example of this.
+ 224062 [marcel@ve ni] def add_observer(observer, func=:update)
| 224063 [tim.pease@gm] Good to know. Thanks for the tip.
+ 224074 [james@gr yp ] I thought Tim's solution was far more elegant.  Notice how he
  224076 [ara.t.howard] not to mention tim's solution can be neatly extended to
  + 224077 [transfire@gm] I think that's over zealous about avoidance of core extension. This is
  | 224079 [ara.t.howard] i'm sure not saying it's a bad idea, but i do avoid it when it's not needed
  | 225054 [transfire@gm] Cool. I agree with your there.
  + 224078 [tim.pease@gm] That's a fantastic idea. The only caveat is that the add_observer
  + 224083 [tim.pease@gm] New and improved tip ...
    225062 [nobu@ru y- a] Sorry to bother you, but it reminded me the proposal of
    225063 [transfire@gm] Whoa! I had just written the equivalent code for NilClass a few days
    225098 [nobu@ru y- a] Sorry, I'm not sure what you expect for NilClass.  Isn't this the
    225107 [transfire@gm] My mistake. It is for Symbols that it doesn't work. I was mistakingly
    + 225108 [transfire@gm] Hehe. You realize I've habitualized the mispronounciation of that silly
    + 225110 [nobu@ru y- a] I guess that Symbol in current 1.9 could have singleton
      225115 [transfire@gm] Oh, there was one more thing I got confused about last night (sorry, it
      225132 [nobu@ru y- a] Indeed, you can just do remove_method.
      225148 [transfire@gm] (*slaps forehead*) pfff. Of course. It's right there in front of me and

windows commands and error handling
224064 [rtilley@vt e] I am attempting to handle windows native command errors within a Ruby script on
224066 [wilsonb@gm i] Use "system" if you want the exit code of the system command you are

RubyX11 - how to make it work?
224075 [hramrach@ce ] I tried RubyX11. As seen in some sort of example code I tried to

Charset detection
224080 [ktalanet@ya ] I'm coding a planet software in Ruby, like planet planet, but inserting
+ 224175 [david@va ln ] Look for the XML header? That one should list encoding.
| + 224188 [james@gr yp ] Right, cause XML encoding headers *never* lie.  ;)
| + 225113 [richard.conr] Shouldn't you be looking at the HTTP header instead/also?
+ 224345 [ jupp@gm .d ] The only way is to write an artificial intelligence that a) can

The Ruby Way review on Slashdot
224087 [TimHunter@nc] Whoo-hoo! My review of Hal Fulton's _The_Ruby_Way,_Second_Edition_ is on
+ 224097 [hal9000@hy e] Thanks much for writing this, Tim...
| 224098 [michael.gors] ...
| 224099 [has.sox@gm i] ...
| + 224100 [hal9000@hy e] Through Safari, I think.
| | 224101 [has.sox@gm i] ...
| | + 224102 [mike@st k. a] Mike Stok <mike@stok.ca>
| | + 224103 [hal9000@hy e] Hal
| |   224108 [has.sox@gm i] ...
| + 224191 [leslieviljoe] I got it on PDF but with much DRM.
+ 224168 [david@va ln ] Wow, precisely ZERO posts before the comments degenerated into unrelated
| 224185 [louis.j.scor] I Soviet Russia, slashdot trolls YOU!!
| 224192 [spoooq@gm il] slashdot is a meta-troll. It's obvious when you think about it.
+ 224194 [ebonakDUH_@h] Perfection is achieved, not when there is nothing left to add,
  224198 [andy@pr gm t] My long-time favorite as well; that's why Dave and I put in "The
  + 224213 [gethemant@gm] I have both editions for "Ruby Way" in my safari bookshelf.
  + 224383 [ebonak-a-@t-] Another great Ruby book!

Ruby to C?
224094 [name.goes.he] Okay, I'm working an a robotics project and instead of using C could I
+ 224121 [nospam@no it] If you mean convert automatically, no, not really. Not unless what you write
| 224127 [ryand-ruby@z] Not quite accurate. Depending on what you're doing ruby2c might work.
| 224134 [vihanpandey@] ...
+ 225716 [eric.mahurin] ...
threads.html
top