214919-299477 subjects 215300-321072

Re: [ANN] Ducktator - A Duck Type Validator
215173 [zimba.tm@gm ] just. Isn't checking classes not very ducktyping-alike or did I miss something ?
215177 [zimba.tm@gm ] class Object
+ 215181 [zimba.tm@gm ] Yeah so your project is more a YAML DTD. It uses duck-typing but also
| 215183 [zimba.tm@gm ] This project seem related : http://www.kuwata-lab.com/kwalify/
| 215187 [pit@ca it in] Ola, do you know ruby-contract, also on rubyforge? I haven't used it
| 215191 [leslieviljoe] This might be useful in testing. Thanks for the hard work! I can
+ 215273 [shortcutter@] def quacks_like?(*args)
  215274 [shortcutter@] I do not think that the use of respond_to? is a regular duck typing
  215353 [halostatue@g] You're doing contract validation, perhaps, but not duck typing. Duck
  + 215365 [james@gr yp ] ?>       super
  + 215366 [shortcutter@] Definitively not.  What do you do if that method returns false?
  + 215371 [halostatue@g] You're incorrect here. I do not need to check if someone responds to
  + 215372 [halostatue@g] I snipped context, but I explicitly said "if it's an external
  + 215466 [hal9000@hy e] Austin is right. If you're checking types, that isn't duck typing.
    215478 [matz@ru y- a] Although I am not Dave Thomas, I consider it is a _variation_ of duck
    215487 [twifkak@co c] Boy, we really love to argue about semantics, don't we?
    + 215490 [twifkak@co c] Can we expect everybody in the world to conform to a standard set of
    | + 215531 [shortcutter@] Devin, I don't want to stress this but you may be underestimating the
    | | 215586 [eric.mahurin] ...
    | | 215664 [twifkak@co c] duck-typing philosophy -- as defined in http://wiki.rubygarden.org/Ruby/page/show/DuckTyping
    | + 215775 [robert.dober] ...
    |   + 215871 [rick.denatal] I've put my 10 cents about this thread in my blog.
    |   + 215872 [rick.denatal] I've always been bemused when someone says, "It's just a question of
    + 215570 [toalett@gm i] Haskell is a statically typed programming language. Hugs is a Haskell

=> A newb question
215174 [dominicson@g] why did matz choose to use '=>' to declare things instead of just making
+ 215182 [phlipcpp@ya ] = is assignment.
+ 215185 [nospam@no it] Umm, that isn't what '=>' does.
+ 215186 [jmg3000@gm i] irb(main):001:0> h = {'foo' => 3, 'bar' => 1.05457e-34}
  215193 [dominicson@g] Thanks for the clarification. I feel like an enlightened newbie right
  + 215210 [ruby@mu rm n] AFAIK, one of the things slated for inclusion in Ruby 2.0 is the use
  + 215247 [twifkak@co c] Keep in mind that you *can* use the = sign inside a Hash literal, which
    + 215250 [MonkeeSage@g] Note also that in the context of a hash literal (i.e., { ... }) or the
    + 215260 [mike@ru yw z] It's a little known fact, but just like Perl (but unlike PHP!) you

Why would a DRb process shut down?
215189 [bjohnson@me ] I have a program that runs about 10 DRb processes. Ocassionally one of
+ 215190 [vjoel@pa h. ] Do you have Thread.abort_on_exception=true ? If not, a thread with an
+ 215192 [ara.t.howard] i use a technique i call 'immortal daemon'.  rq and dirwatch both use it.  it
  215209 [bjohnson@me ] Can you attach some code that I could use? I'm still kind of lost, but

[ADV] Mr. Neighborly's Humble Little Ruby Book is now available
215196 [jeremymcanal] Sorry for popping in like this with a commercial, but I'm excited that
+ 215198 [asbradbury@t] Is there an excerpt available somewhere?
| 215202 [jeremymcanal] Sure thing; click on the print link on
| 215206 [asbradbury@t] Ah, I only checked the ebook version, which lacks a link to a preview. Now, I
| 215208 [jeremymcanal] Thanks for the input; I just put that up as a test to make sure it
+ 215207 [gregory.t.br] Interesting.  Vaguely off topic but have you seen what the book looks
  215245 [znmeb@ce ma ] I have an Axiom manual printed by (and purchased from) Lulu. It is well

ruby-exiv2 (exif handling)
215197 [max@ma id or] www.exiv2.org)  library.
+ 215344 [dbalmain.ml@] $CPPFLAGS << " -Wall -I/usr/local/include/exiv2 "    $LDFLAGS << " -lstdc++ -L/usr/local/lib "
+ 411900 [lists@ru y- ] I would like to test this library.

Kerberos bindings for ruby, input requested
215199 [snacktime@gm] I have a basic kerberos C extension done and before releasing it I'd
+ 215200 [max@ma id or] Better pack it as gem. Do You know, how it is?
+ 215205 [aredridel@nb] ruby-kerberos is nice and non-annoying. Guaranteed to stick around.

Distributing hidden Ruby code
215201 [leslieviljoe] There was some discussion in the past here about how to distribute
215204 [snail@ob me ] <f204810a0609191440x60da6b51ufb6e74ee945abe0b@mail.gmail.com>, Leslie
215265 [smartgpx@gm ] L H column -> Downloads
215272 [MonkeeSage@g] More importantly...why would you want to distribute obfuscated ruby
215325 [leslieviljoe] They are not really providing Ruby code, but writing their code in C

piping input when shelling out
215213 [lists@v2 tu ] I want to use Kernel#system or one of its friends to manipulate some
+ 215218 [nospam@no it] Could you be a bit more clear? Do you want to write a program that will
| 215219 [lists@v2 tu ] No, from within a ruby program I want to call some shell command to
| + 215225 [nospam@no it] #!/usr/bin/ruby -w
| | 215230 [lists@v2 tu ] I thought about doing it with echo but then I'd have to escape the
| | 215237 [nospam@no it] Yes, except for the fact that you cannot easily find out what the child
| + 215239 [ara.t.howard] require 'open4' # gem install open4
+ 215220 [has.sox@gm i] ...
  215223 [lists@v2 tu ] Looks like it. Thanks a lot.
  + 215224 [has.sox@gm i] ...
  + 215229 [nospam@no it] The problem with File.popen() is that you want bidirectional communication
    215231 [lists@v2 tu ] Hmm, that's not cool. I'll run some tests, but looks like it's back
    + 215234 [has.sox@gm i] ...
    | 215238 [lists@v2 tu ] Yea, I figured out how to open a pipe for both read and write. You
    | 215241 [ara.t.howard] cat = IO.popen 'cat', 'r+'
    | + 215258 [lists@v2 tu ] I guess I was :)
    | | 215259 [ara.t.howard] - you get the child pid returned also with open4
    | | 215270 [caldridge@gm] Is Open4 not win32 compatable? With all win32ole hooks, I'm suprised
    | | 215350 [ara.t.howard] ah.  no - it is not.
    | + 215469 [rick.denatal] Interestingly, I just found a use for popen this morning. I was
    + 215235 [nospam@no it] Did you read my other post? Piping information to child processes is easy.

[ANN] rttool-1.0.2
215217 [rubikitch@ru] == Abstract

mixing C extension classes with ruby classes
215221 [snacktime@gm] I have a C extension that defines a module and two classes in that
215351 [nobu@ru y- a] Do you require modulename.so in modulename.rb?

Can not find superclass
215222 [djhackebeil@] I defined two classes 'Super' und 'Sub' in two separate files that look
+ 215227 [has.sox@gm i] ...
| 215232 [djhackebeil@] I renamed it but unfortunately it had no effect
+ 215228 [nospam@no it] require 'super'
  215233 [djhackebeil@] That's all of the code I have. I have just two empty classes - one
  215236 [nospam@no it] / ...
  215242 [djhackebeil@] Many thanks for the response Paul,
  215243 [logancapaldo] It's require 'active_record' (Note the underscore).
  215244 [djhackebeil@] thnx logan. That's the point. And sorry for the stupid mistake of mine.

Problem with Additional Record in database.yml
215249 [djhackebeil@] I try to set up an additional database. Therefore, I followed the steps

Single character input without pressing 'Enter'
215251 [unni.tallman] how can i read input from stdin, char by char, i want to get the
215252 [bachng@nt v6] This is a simple way to achieve that. Maybe there are others
215256 [eero.saynatk] # Save previous state
215328 [james@gr yp ] Or use HighLine which handles all these details for you.

Re: [QUIZ][SOLUTION] Secret Agent 00111 (#94)
215254 [Pierre.Barbi] ...

Re: Mr. Neighborly's Humble Little Ruby Book is now available
215261 [MonkeeSage@g] You book looks very nice. I'll definitely have to get a copy. It looks
215434 [jeremymcanal] [I'm cross-posting this on the Rails and Ruby lists]

[SOLUTION][QUIZ] Secret Agent 00111 (#94)
215263 [boris.prinz@] here's my solution. It's based on strings of "1"s and "0"s, so the

Re: Ducktator - A Duck Type Validator
215268 [MonkeeSage@g] Thanks for your efforts. I have several uses in mind for this already.
215279 [MonkeeSage@g] Not to push the issue, but Wikipedia seems to think that this is a
215302 [shortcutter@] The article does not claim that a client needs to check this.  And in
215354 [halostatue@g] This is demonstrably untrue. Duck typing is not about validation. It's
+ 215360 [MonkeeSage@g] By asking if object O respond_to? method M, we can impose certain
| + 215368 [MonkeeSage@g] Of course, respond_to? doesn't tell you about what the method does. But
| | 215374 [halostatue@g] Not without doing more than #respond_to? checking. See other responses
| | 215379 [MonkeeSage@g] Then you'd be asking if the object _acts like_ (quacks like) an
| | + 215381 [toalett@gm i] Because with duck typing, you break exactly at the point where an
| | + 215395 [halostatue@g] As Simen Edvardsen says, preconditions or exception handling can
| + 215373 [halostatue@g] No, you better not. If I use #<<, then I can "write" to a String, a
+ 215419 [vjoel@pa h. ] To extend Austin's point a little: In ruby, it really has to be this
  + 215424 [leslieviljoe] Of course the whole scheme really relies on the library writer to
  | 215435 [shortcutter@] Maybe it has to be a String - maybe not.  If not, you can use a probe
  | 215443 [leslieviljoe] Ah thank-you, that's great. But it would not work unless every
  | 215446 [shortcutter@] Well, yes.  I didn't say it's perfect. :-)
  | 215451 [leslieviljoe] Yes, it starts out as a nice idea. And while it's doing all that
  | 215494 [eero.saynatk] You know, it would really help :)
  | + 215503 [MonkeeSage@g] The great majority of whom? If you mean rubyists, perhaps you're right
  | | + 215505 [hal9000@hy e] [snippage]
  | | + 215507 [twifkak@co c] (Well, I paraphrased that a bit...)
  | |   215521 [MonkeeSage@g] if not coined it. I just meant that I didn't know if he used the term
  | + 215572 [gene.tani@gm] remember the eigenclass / metaclass / singleton / virtual / adhoc /
  |   215576 [MonkeeSage@g] For posterity, I just want to say that I love all you guys (i.e., all
  + 215602 [ruby@an hr p] } >>The problem with "just use it", is that you will have no control over
    + 215604 [halostatue@g] Maybe. I did point out that in my early days of programming Ruby, I
    | + 215608 [MonkeeSage@g] Very true. In the same way (as others have mentioned), method_missing
    | | 215609 [zimba.tm@gm ] And should #method, #instance_methods, ... also be overridden ? IMHO
    | + 215610 [ara.t.howard] that's pretty interesting austin - i haven't considered that before.  i'm
    | | 215639 [eric.mahurin] ...
    | | 215657 [ara.t.howard] it doesn't really - it's totaly backward compatible - it just happens to
    | + 215612 [ruby@an hr p] } >Actually, it is the developer's responsibility to override respond_to? when
    |   215620 [ara.t.howard] but it certainly can - it's up to you whether is does or does not.
    + 215753 [hal9000@hy e] An interesting point, and tentatively it seems reasonable (though there

the point of omitting parentheses
215280 [nospam@a. .c] I'm fairly new to Ruby, so bear with me. Anyway, on with the question.
+ 215285 [MonkeeSage@g] I'm not sure for the reasoning, but I always parenthesize arguments. I
| 215289 [vincent.four] I nearly always use parentheses for the functions I define, except the
+ 215288 [jan.svitok@g] class Book < ActiveRecord::Base
| 215315 [zbl@op ra ai] Yes, this would be less attractive than without parentheses, I think.
| 215327 [interfecus@g] Yes.
| 215337 [zbl@op ra ai] join without parentheses is a function call like self.join, returning
+ 215346 [gavin@re in ] class Foo
| + 215378 [nospam@a. .c] Yes, I would and I'll tell you why. attr_accessor is a method call.
| | + 215384 [ara.t.howard] i'm going on 7 years of full time ruby and it's bitten less than 5 times.
| | | 215413 [nospam@a. .c] Good to know. I don't really see it as a major problem. I was just
| | + 215515 [drbrain@se m] Because it gives you a syntax error if you try to write it like a
| |   215523 [joeat303@ya ] One thing, at least with RoR, is if the first param is a hash then
| + 215708 [joevandyk@gm] Or hell,
+ 215352 [ara.t.howard] exit
| 215382 [nospam@a. .c] Wow, public, private and protected are actually method call. I wonder
| 215456 [gavin@re in ] See if the following helps: code in classes isn't compiled, it is
| 215681 [nospam@a. .c] Got it. That's pretty cool. Thanks for the help.
| 215684 [joeat303@ya ] I feel like such a n00b -- I don't think I've ever created a DSL and
| 215705 [kmgaughan@ei] You do, you have, and you will: a library with a well-designed API is
| 215709 [joeat303@ya ] Phew! It's good to know I've been buzzword-compliant all these years. ;P
+ 215512 [drbrain@se m] '(' and ')' is harder to type than just ' '
+ 215593 [adeveloper.g] The point of being able to omit parentheses is to make it easier to
  215595 [wilsonb@gm i] I would say that that's this year's 'point'.  For me, I just think
  215597 [thomas.adam2] Like everyone else who has replied to this thread -- they're either
  215768 [zbl@op ra ai] To use or not to use -- is a matter of taste.

Setting Windows environment variable
215281 [puppet@ra bl] How can I set environment variable for windows(not for currect process)?
215286 [jan.svitok@g] Look for the older thread "Setting Windows Environment Variables".
215291 [puppet@ra bl] require 'win32ole'

Ruby Apps Databases
215283 [marinho.tobo] Well i know that there is rubyforge and the RAA (and non ruby specific like sourceforge and so on ...). But doesn anybody know of other app databases for ruby programs ? Are there others i should know of , because they are useful /interesting ? searching the inet wasn?t that succesful :(
+ 215287 [thomas.adam2] Maybe if you told us what you were after, then we could help.  The RAA
+ 215290 [m.fellinger@] Here is one of the few other places i've seen 'lots' of interesting stuff :)
  215298 [marinho.tobo] Well, I?m not after something specific right now. I was just wondering, if there are some other usefull ressources out there.
  215340 [chris.hulan@] Hugh Sasse's Ruby Page http://www.eng.cse.dmu.ac.uk/~hgs/ruby/

Something strange in ruby or I'm a newbie?
215292 [siberhus@ho ] #IS THIS A BUG
+ 215295 [siberhus@ho ] nil in ruby can put in condition statement
| + 215296 [ryand-ruby@z] % irb
| | 215305 [siberhus@ho ] Thank you Davis.
| + 215299 [robert.dober] ...
|   215311 [siberhus@ho ] Thank you Dober.
+ 215310 [m_goldberg@a] No, I'm afraid it's a feature ;).  if you rewrite
| + 215313 [robert.dober] ...
| | + 215320 [m_goldberg@a] No. The two cases aren't comparable. "a" is an object; 'super' is a
| | | 215364 [robert.dober] ...
| | + 215464 [hal9000@hy e] Morton is right. Do you get *his* point?
| + 215314 [jan.svitok@g] In other words,
|   + 215317 [robert.dober] ...
|   + 215318 [simon.kroege] def test *args; 41; end
|   + 215319 [m_goldberg@a] That's the way I see it. In Ruby I think its best to consider 'super'
+ 215326 [twifkak@co c] Congratulations! You stumped the parser! (Actually, it's really easy.)

[ANN] Hoe 1.0 released
215294 [ryand-ruby@z] Farmer Ted came to me the other day with a problem. He has about 10
+ 215329 [leslieviljoe] Zenspider keeps coming up with great stuff!
| 215335 [zimba.tm@gm ] desc "Look for TODO and FIXME tags in the code"
| 215400 [ryand-ruby@z] Actually, I have a script called progress for stuff like this. See
+ 215348 [khaines@en g] How does the use case for Hoe differ from REAP?
| + 215349 [Daniel.Berge] Apparently, you Reap what you Hoe.
| | + 215358 [ara.t.howard] touche teacher.  touche.
| | + 215425 [lyle.johnson] Best post to ruby-talk, EVER. ;)
| + 215399 [ryand-ruby@z] % find hoe -type f | grep -v svn | xargs wc -l | tail -1
|   + 215405 [ara.t.howard] a man after my own heart!
|   | 215468 [hal9000@hy e] Run, Ara! Ryan is after your heart!
|   + 215415 [khaines@en g] At least compare apples to apples there.
|     215440 [ryand-ruby@z] You need to learn your fruits! It just so happens Farmer Ted is a
+ 215417 [gregory.t.br] interfacing with RAA a while ago and I haven't gotten around to
| 215442 [ryand-ruby@z] Sounds like your tool is more akin to codeforpeople's rubyforge
+ 215429 [vjoel@pa h. ] Does this do what the rubyforge gem does, or do you need both? Does the
| 215444 [ryand-ruby@z] Yes, it plugs into and uses the rubyforge gem.
+ 215965 [chneukirchen] I'm already excited to see how many gems will appear to be published
  216059 [ryand-ruby@z] Yeah, I thought about changing that but then I decided it'd be funny. :)