217332-225237 subjects 217830-222823

Re: [QUIZ] Story Generator (#96) [SOLUTION] The Quest
217599 [m_goldberg@a] Here is my solution, which is based on Dwemthy's Array.

Why can't I get on Top?
217603 [transfire@gm] $toplevel = self
+ 217606 [MonkeeSage@g] That's correct. In that case self is an *instance* of Object...
| + 217607 [dblack@wo bl] Yes it does: the instance itself *is* a Module (or Class) :-)  There's
| | 217608 [MonkeeSage@g] That's what I was trying to say. ;)
| | 217617 [transfire@gm] Right. So how does one catch if a module is included at the toplevel
| | 217625 [MonkeeSage@g] Hmmm...I'm not the sharpest tool in the shed, but I don't think that is
| | + 217627 [MonkeeSage@g] Nice one Jeffery!
| | + 217630 [interfecus@g] The base level in Ruby runs in the context of an instance of Object.
| |   + 217642 [dblack@wo bl] The singleton class/object relationship isn't quite an instance one;
| |   | 217646 [robert.dober] ...
| |   | 217649 [dblack@wo bl] I was responding to Timothy's description of the default object main
| |   | 217693 [robert.dober] ...
| |   + 217669 [transfire@gm] That's not correct. The methods are being added to Object itself. Main
| + 217652 [transfire@gm] In your example you are controlling the inclusion from the start.
+ 217692 [logancapaldo] I wonder if the powers that be would consider adding some additional
  217729 [MonkeeSage@g] class << self
  217831 [transfire@gm] module Taskable
  217853 [MonkeeSage@g] Right on. I just realized that my last suggestion was retarded anyhow,

open-uri and HTTPS, or net/https with a redirect
217620 [jonathan.ott] Is there anything wrong with using this patch?
217624 [snacktime@gm] Do you need it?  That only provides the ability to check the validity
217626 [jonathan.ott] i am trying to connect to https://login.yahoo.com which redirects to
217628 [snacktime@gm] You mean after you login?  It doesn't redirect me anywhere when I go there.
217629 [jonathan.ott] correct, after you login. the login credentials can be embedded into

Re: [QUIZ] Story Generator (#96) [SOLUTION] Theme Park Vacation
217621 [m_goldberg@a] OK, here's my second solution. It applies the KISS principle with a

Creating modules
217634 [benjohn@fy h] I am dynamically creating modules [1]. I would like to be able to add
+ 217643 [david@va ln ] See David Black's post in the "dynamic include" thread. The module
| + 217644 [benjohn@fy h] Thanks, I'll take a look...
| + 217651 [benjohn@fy h] going to describe it a bit more and see if anyone has a thought about
|   217682 [ruby-ml@ki t] Yes, I think the problem is that this is way overcomplicated. Earlier
|   217792 [benjohn@fy h] that actually makes sense, I _think_ it does), but Ruby doesn't seem to
+ 217705 [logancapaldo] No, well at least not if you know the method name before hand.
  217786 [benjohn@fy h] I presume you meant "... not if you _don't_ know the method name ..."?
  + 217793 [benjohn@fy h] Ah - I get you - you were confirming the first part of my sentence, and
  + 217798 [benjohn@fy h] So, I've been having an experiment, and here's what I've found so far...

Re: is a timepoint DSL possible, like: 10:31 instead of "10:
217638 [ruby-forum@s] thank you all for input on my little question. by now i'm quite sure i
217639 [david@va ln ] =20

'system' and printing in Windows
217640 [Nuralanur@ao] ...
217647 [sgentle@gm i] This can be a little complicated, and might involve all sorts of nutty

Embed Images in eruby
217641 [horacio.sans] I want to read an image from disk, modify it with rmagick (scale) and display
+ 217648 [jan.svitok@g] See http://redhanded.hobix.com/inspect/sparklinesForMinimalists.html
| 217650 [pseudo.meta@] ...
| 217659 [horacio.sans] Cool....  I took me 3 mins to get what I wanted....
| 217748 [esad.nospam@] Beware that here the data is encoded within the URI, so you are limited
+ 217732 [david@va ln ] isplay=20

Always Include Associations
217645 [murdoc_0@ho ] This is probably really simple, but I couldn't find a solution anywhere.

what's wrong in my loop ?
217653 [josselin@wa ] init an array db
217654 [tom.armitage] I think you might find it's the "i++".
217655 [stephane.eli] Tom is right about the "i++".
217704 [josselin@wa ] thansk Tom & Steph
217751 [rick.denatal] The expression i++ isn't valid ruby.

Creating dynamically named singleton methods. Syntax question.
217656 [Luke.Stark@m] foo = MyThing.new
+ 217657 [pseudo.meta@] ...
| + 217658 [pseudo.meta@] ...
| + 217663 [jean.helou@g] class MyThing; end
+ 217660 [jan.svitok@g] foo = Object.new
  217664 [pseudo.meta@] ...
  + 217666 [jean.helou@g] However this will define the given method for all new instances of
  | 217676 [Luke.Stark@m] Jean,
  | 217679 [jean.helou@g] this seems to work
  | 217707 [Luke.Stark@m] Thank you Jean, that works wonderfully.
  + 217667 [bruno@ex el ] $ cat my_thing.rb

webrick/httpsutils missing?
217670 [maxime.brune] I'm trying to run the 'mechanize' gem from ubuntu and I get the
217826 [gethemant@gm] I am not sure, if this is the fix. Probably first you should install
218044 [maxime.brune] Thanks for your help. I found my problem. I was supposing that webrick
218199 [drbrain@se m] $ ls /usr/local/lib/ruby/1.8/webrick/httputils.rb
218263 [ml.chibbs@gm] Its all there in Instant Rails... everything that is bundled with

Newbie - Source Code Study, Projects
217672 [wood_yee12@h] online sources that has Ruby source code available for study? Also, can
+ 217675 [richard.conr] I find projects that give you good and fast feedback are best. Stuff with a
+ 217678 [jes@lu et nk] I find the Euler project full of fun. It consists of mulitpple small
+ 217680 [james.herdma] The Ruby Quiz page is always a good read -- http://www.rubyquiz.com/
| 217685 [tom.armitage] Another good type of project I found useful to learn from is to build
+ 217709 [toalett@gm i] Playing with DRb and other network stuff is always fun (well, to me, anyway :).
+ 217713 [Mail@Jo as H] try "ruby on rails" and agile "webdevelopment with ruby on rails" (book)

Hpricot - Trying to do a few things...are they possible?
217673 [appleman@gm ] I've been messing with Hpricot and I'm trying to do a few things that
217684 [ruby@an hr p] } I've been messing with Hpricot and I'm trying to do a few things that
217912 [appleman@gm ] Gregory -- I appreciate your reply.  I found it to be very helpful.

Monitoring Socket Disconnect during gets or readline
217674 [exabrial@gm ] problem. I ask for a client to provide a handle, but it he disconnects
217761 [nospam@no it] IO#gets blocks forever if the input goes away, while IO#readline throws an
217825 [gethemant@gm] Use Eventmachine (http://rubyforge.org/projects/eventmachine).

Ruby for Sysadmin
217681 [rawn027@gm i] I need to write a script that pulls usernames our of a file that is
+ 217683 [james@gr yp ] Try reading the lines one at a time.  See if you can locate the name
+ 217690 [logancapaldo] % cat parse.rb
  217714 [jmg3000@gm i] Just curious, why do you backslash escape the double-quote marks? I
  217727 [logancapaldo] take those out

instance_eva()l-ing a proc with parameters
217697 [Gennady.Byst] Dear friends,
217701 [logancapaldo] Google for instance_exec, there are various and sundry implementations,
217723 [Gennady.Byst] Thanks a lot, Logan. That's exactly what I need and what I have missed

Special variable within iterators to hold results?
217700 [weyus@at .n ] FILTER_COLUMNS = Array.new
+ 217702 [ruby-ml@ki t] Take a look at Enumerable, specifically #inject.
+ 217703 [logancapaldo] FILTER_COLUMNS = DISPLAYABLE_COLUMNS.collect { |field_array| [field_array[1],
+ 217743 [rick.denatal] filter_columns = displayable_columns.inject([] {|
| 217745 [rick.denatal] darn that itchy trigger finger.
| 217746 [rick.denatal] Okay, one last try
+ 217924 [interfecus@g] Firstly, you shouldn't capitalize your variables like that. Ruby will
  + 217925 [dblack@wo bl] filter_columns = displayable_columns.map {|field_array|
  | 217943 [vikkous@gm i] filter_columns = displayable_columns.map {|(a,b)| [b,a] }
  | 217949 [weyus@at .n ] Nice!  That wins! :)
  + 217948 [weyus@at .n ] Who said it wasn't a constant ;)?  It's a set of static lookup data to

Web User State Management and Serialization
217710 [Mail@Jo as H] I am currently playing with RoR and I wanted to get State Management

redefining splat?
217716 [adam.shelly@] Can you redefine the * prefix operator?
+ 217717 [jeremy@bi sw] ...
| + 217718 [flori@ni e. ] You mean #to_a?
| | 217720 [binary42@gm ] class C
| | + 217736 [MonkeeSage@g] class C
| | | 217738 [binary42@gm ] As was my point ;-). There was a reason I reopened the class.
| | | 217742 [MonkeeSage@g] Just trying to emphasize your point. :)
| | + 217740 [flori@ni e. ] Well, #to_ary expresses a bit more than just splatability (is this even
| + 217719 [adam.shelly@] perfect, thanks.
+ 217771 [chiology@gm ] Why do you need to? I know slight modifications to do some cool
  217864 [netghost@gm ] I would agree with Matt, if you are trying to redefine the splat
  217868 [pseudo.meta@] Pshaw. Somebody who's never read the INTERCAL reference manual?

rubygems.org down?
217721 [rick.denatal] I've been getting 500 "Internal server error" messages from

replace a string delimited by 2 other string, regexp problem
217725 [sebastienmau] I want to replace a string in a file who is delimited by 2 other string.
+ 217733 [logancapaldo] Learn about regular expressions, and then look into the gsub method of
+ 217735 [vincent.four] left = "/*startdel2*/"
  217747 [david@va ln ] The "right" could be in a positive lookahead making things probably a

Speeding up ri
217731 [gavin.kistne] ...
219777 [drbrain@se m] This seems to be normal, ri is searching a larger file set now.
+ 219781 [znmeb@ce ma ] Hmmm ... could ferret do this?
| 219786 [drbrain@se m] That would be using a sledgehammer to solve a problem you could fix
+ 219844 [kristof@vl e] Or use emacs, ri-emacs just reads the information once.

libxml 0.3.8 - How to validate document with schema ?
217744 [peter.fitzgi] ...
218349 [rossrt@ro co] Problem here - The argument to XML::Document.new is interpreted as the
218490 [david@va ln ] POLS violation? Seriously, has anyone of you ever seen a XML document of
218498 [rossrt@ro co] Yeah, I agree it's pretty confusing, but for 0.3.8 we tried to keep the
218520 [david@va ln ] Ah yes, the usual ;P

File Access Issues with File creation
217749 [michael.brig] ...
217752 [headius@he d] Make sure the Java code is flushing the streams; System.exit() won't
217753 [michael.brig] ...

Email embedding
217750 [leslieviljoe] Seeing the XML-like format one of the quiz posters used for sending in

Parser bug?
217754 [logancapaldo] So I was playing around, and decided that I wanted to define a method
217755 [lopx@ga et .] the ? operator takes an ascii symbol and returns numerical value for it
217756 [lopx@ga et .] at parse time of course...

regular expressions
217757 [tallison@ta ] config = YAML.load_file('config.yaml')
+ 217758 [MonkeeSage@g] You have it right.
| 217759 [tallison@ta ] This prints out the entire message.
| + 217762 [nospam@no it] Well, if the regexp as written correctly identifies the beginning and end of
| + 217763 [MonkeeSage@g] In ruby .. is a range operator. If you want a grouped match, use parens
|   217769 [ruby-ml@ki t] And you almost certainly want to Regexp.escape that interpolation.
+ 217760 [nospam@no it] Yes, it doesn't, and I think I know why. I have been hearing for years how
| 217810 [tallison@ta ] You make a pretty good example of another lost art...
+ 217834 [leslieviljoe] To eliminate a possibility, do

How would I go about doing this in ruby..
217764 [pinkmanonfir] Quick question, I have asked some other programmers, they were not
+ 217772 [collinsj@se ] ...
+ 217816 [smartgpx@gm ] If you need to implement this for Windows, as that screenshot suggests,

[ANN] Stupid Ruby Tricks Wiki
217773 [cdcarter@gm ] ...

how to retrieve current ruby stacktrace
217776 [ray.c.chen@g] My ruby program is stuck somewhere on some blocking call, but I don't
+ 217777 [ezmobius@gm ] -Ezra
+ 217804 [shortcutter@] How about "ruby -debug"?
  217807 [MonkeeSage@g] s/-debug/-d/

shell, ruby and regexp
217778 [pere.noel@la] over Mac OS X the latest and ruby 1.8.4 i've found strange interferences
217781 [nospam@no it] This is a classic error in the use of a shell. You need to understand that
217782 [pere.noel@la] ok i've done THE MISTAKE to rememeber zsh as a priority over ruby )))
+ 217784 [MonkeeSage@g] this_arg=Regexp.new(this_arg[1..-2])
| 217785 [pere.noel@la] clever idae, thanks again !!!
+ 217788 [ruby-ml@ki t] Everything you get in ARGV is a String. You cannot create Ruby
+ 217796 [m.fellinger@] Regexp.new('/.*rb/'[%r(/(.*?)/), 1])
+ 217803 [shortcutter@] It's not so much a "priority" as simple order of things happening (you can
  + 217806 [pseudo.meta@] ...
  + 217808 [pere.noel@la] arg = Regex.new(arg)...

JRuby scripting for Mozilla?
217783 [kenneth.m.mc] Given that JRuby runs on Java, and Java can, I believe be used to script
217787 [vincent.four] I'm afraid you're making a common confusion: Javascript runs natively
217791 [kenneth.m.mc] Yes, but there is a Java plugin capability for Mozilla--I aware of the
217797 [vincent.four] a place where Java can display and get user interaction, but that's
+ 217801 [headius@he d] Back in the day there were ways to have Java code access stuff in the
+ 217802 [richard.conr] The java plugin capability that you describe is just the method that
| 217813 [MonkeeSage@g] Regards,
| + 217820 [peter@ru yr ] I just wanted to mention JavaXPCOM ;-)
| | 217866 [headius@he d] I knew there'd be something. It's too good an idea to not have some
| + 217929 [skurapat@uc ] Let's not forget Ruby-XPCOM! :-)
|   217954 [peter@ru yr ] 1) It is in a very-very... hmmm... early state, which would not be a
+ 218603 [jwkenne@at g] There /is/ defined Java/JavaScript glue for when a Java applet is

Couple of questions about constant lookups
217789 [chrisjroos@g] I asked something along these lines recently (subject: "const_defined?

[ANN] codeforpeople's rubyforge 0.3.0 released
217790 [ryand-ruby@z] I'm proud to announce that codeforpeople's rubyforge 0.3.0 has been

[ANN] hoe 1.0.5 Released
217795 [ryand-ruby@z] hoe version 1.0.5 has been released!
217809 [Bil.Kleb@NA ] Thank you
217911 [ryand-ruby@z] Yup... I was definitely tired. :)

dynamically changing superclass/mixins
217812 [  ask@me co ] I have strong interest in highly dynamic languages, particularly
+ 217891 [transfire@gm] Not going to happen. But you can use modules and delegation to get a
+ 217932 [logancapaldo] This may be considered blashpemous, but have you seen Io?
| 218084 [transfire@gm] Io does look interesting but I for one couldn;t help but shy aways b/c
| 218085 [jtregunna@bl] We don't need block notation, everywhere you'd use blocks in Ruby, we
| 218126 [transfire@gm] Which is why you write a for loop like this?
| 218135 [pbattley@gm ] Clippy says, 'It looks like you're being sarcastic!' (Correct me if I'm wrong.)
| 218148 [transfire@gm] A tinge perhaps, but not meant in a mean way. Just pointing out what I
| 218168 [jtregunna@bl] No, Io doesn't support currying out of the box; we just don't empose
+ 218327 [michele.simi] print 'called B.meth'

Ferret install, rake failing on make
217814 [dougal.s@gm ] I'm currently trying to install the latest version of Ferret (0.10.9)
217815 [chris.lowis@] Chris
217819 [dougal.s@gm ] Thanks Chris, I'll give that a look.

Boost.Python equivalent for Ruby?
217817 [pavel_vozeni] Does something like Boost.Python exist for Ruby?
217890 [rubyfan@gm i] At the moment SWIG is probably as close as it gets to boost.python.
217892 [pavel_vozeni] Thanks, I'll play with it.

Ruby DSL for invoices
217818 [chris@ed nd ] I've been playing around with DSLs recently, inspired by the dynamism
218132 [chris@ed nd ] i = new_invoice do

Newbie: Question => How to do this with Classes ?
217823 [matz@ey ma z] class Important
+ 217828 [dblack@wo bl] In the second snippet, you're sending the message
| 217851 [matz@ey ma z] Thanks for your reply!  This was very much the way I was trying to do
+ 217836 [sastph@sa .c] more accessible to "visual people."
| + 217843 [jean.helou@g] see also http://whytheluckystiff.net/articles/seeingMetaclassesClearly.html
| | 217858 [matz@ey ma z] Great one Jean !! Thanks !
| + 217857 [matz@ey ma z] Thanks for your reply. Yes, I've tried Why's Guide about 30 times by
+ 217845 [MonkeeSage@g] Since you asked for a fundimental level explaination I hope this helps
| 217863 [matz@ey ma z] <SNIP>
| 217875 [MonkeeSage@g] LOL! Well, it would be a very short book since that's about the extent
+ 217852 [matz@ey ma z] Thanks you VERY much for making that example clearer !
  217854 [jean.helou@g] he understood the how but not the why... hope this helps.