248874-249723 subjects 249291-252053

[QUIZ][SOLUTION] Morse Code (#121)
249098 [brian@kr hm ] Here is my solution to the morse code problem.  The meat of is only

Net::Http multiple parameters with the same name.
249101 [scott.archer] I'm trying to use the Net::Http libraries to do a post request to a
249250 [scott.archer] I updated a method in http.rb

gsub question
249102 [traktorman@g] i'm new to ruby, and working mostly with text.
+ 249105 [lyle.johnson] Within a double quoted string (like your txt) the backslash character
+ 249107 [ganesh.gunas] The slash in the txt variable should be escaped
| 249188 [traktorman@g] Thanks All,
+ 249108 [ari@ar br wn] Newbie taking a stab at it.....

Getting Browser information
249106 [veeraa2003@y] I'm newbie to ruby. I want to get user's browser and OS information like
+ 249110 [ganesh.gunas] request.env["HTTP_USER_AGENT"]
| 249114 [veeraa2003@y] Thank you very much for your prompt reply .
| 249116 [veeraa2003@y] I have one more doubt, here i want split the browser and OS information.
+ 249151 [timx@no pa .] This information is part of the standard 'agent' information passed by browsers
+ 249155 [pgquiles@el ] As you have been tool, user agent information is not 100% reliable.

Hoq to send a message/mail to particular ip
249115 [veeraa2003@y] I'm newbie to ruby. Is there anyway to send a message or mail to
+ 249170 [cmdjackryan@] Not emails. email addresses aren't linked to IPs. Your only chance is,
+ 249179 [shortcutter@] What exactly do you mean by this?  Can you elaborate a bit more?
+ 249259 [botp@de mo t] # I'm newbie to ruby. Is there anyway to send a message or mail to

More concise code
249119 [barjunk@at g] I found this snippet in code called acts_as_authenticated.  I thought
249121 [alexg@ku cr ] Perhaps I'm misunderstanding what you're saying here, but I think

How to run script file using system command
249123 [dgirdhar@ar ] I am trying to run a script file using system command, but it is not
+ 249126 [alexg@ku cr ] If that is really what you ran then you have a space in your command.
| 249127 [dgirdhar@ar ] Please tell me if i have a script file say scriptfile, then how i can
| + 249129 [gabhijit@gm ] Please see below.
| + 249130 [alexg@ku cr ] I was a bit terse with my previous answer. I was just pointing out
|   249132 [dgirdhar@ar ] I tried above in following manner, but i got following error.
|   249135 [alexg@ku cr ] Sorry, I don't have access to a Solaris machine so I can't reproduce
+ 249157 [ari@ar br wn] The problem is right here. system doesn't need a puts to be used, so
| 249158 [dgirdhar@ar ] Here variable abc is ued to collect the return value of system command
| 249463 [ari@ar br wn] <snipxor>
+ 249258 [botp@de mo t] # abc = system(". /export/home/dhiraj/scriptfile.sh")

Problem in Rmagick
249124 [sidana.saket] ...
249198 [rmagick@gm i] Posted via http://www.ruby-forum.com/.

clear screen
249125 [cschyma@go g] Is there a way to clear the terminal screen by using Ruby directly?
+ 249133 [fxn@ha hr f.] Nothing builtin. A lighter approach is to print an ANSI escape
+ 249134 [dzwell@gm il] Christian,
  249184 [cschyma@go g] Thanks a lot. I will stick to the escape characters because I also
  249185 [gwtmp01@ma .] Gary Wright

[patch] Re: test/unit inconsistencies between 1.9 and 1.8
249131 [adam.boz@gm ] ...
+ 249138 [ryand-ruby@z] Awesome. Please post the patch to the ruby project on rubyforge.org.
+ 249148 [ mfp@ac .o g] AFAIK #arity was redefined in 1.9 to return 0 for Procs with no arguments.
  249149 [adam.boz@gm ] ...
  249154 [ mfp@ac .o g] * compile.c, parse.y, eval.c, intern.h, iseq.c, lex.c, node.h,

does Object#to_enum exist?
249136 [dzwell@gm il] I saw someone post a snippet of code that turned an object (with some
+ 249139 [matz@ru y- a] It's available only for 1.9.  You can use it with Enumerator
| 249142 [dzwell@gm il] Thank you. I feel silly for making such a newbie-ish mistake, but then
| 249145 [robert.dober] It is from our mistakes that we learn, I was about to check for
+ 249141 [stefano.croc] You need to require 'enumerator'. Doing this will result in the to_enum method

Programming Ruby: Improvements, copyright issues
249140 [twinxor@gm i] I've been learning Ruby with the help of version 1 of the introductory
+ 249215 [dave@pr gp o] The license changed? Maybe I did that, but I can't remember doing it,
| 249285 [twinxor@gm i] "Copyright ? 2000 Addison Wesley Longman, Inc. Released under the
| + 249288 [botp@de mo t] # Distribution of substantively modified versions of this document is
| + 249512 [dave@pr gp o] I honestly don't remember making the change, but I don't see what
+ 249279 [shortcutter@] There *is* an index.  See http://www.ruby-doc.org/docs/ProgrammingRuby/
  249286 [twinxor@gm i] That's a good point. ri is designed to be updated, while this is an

Net::SSH expect like interface
249146 [manishs@gs l] I have been looking for expect like interface for Net::SSH lib,
270566 [B.Candler@po] This is something I've been wanting for a long time too, ideally to use ssh
270766 [B.Candler@po] Here's my attempt at this. It provides Net::SSH::Telnet which has an almost

Getting user input on windows...
249153 [edcrosbys@gm] I'm new, please bear with me?
+ 249169 [cmdjackryan@] Tcl/Tk
| 249176 [lyle.johnson] I'd also throw in a plug for FXRuby (http://www.fxruby.org/).
+ 249186 [edcrosbys@gm] Everyone - thank you very much for pointing me in the right directions!
+ 249189 [richard.conr] Welcome to the group.
| 249192 [edcrosbys@gm] Richard-
+ 249201 [lrlebron@gm ] You may want to take a look at Ruby Web Dialogs

Net::HTTP and the need for all-capital http header names
249160 [ruby-forum@t] upon initialization and upon writing to the socket. While
278074 [liu_edward@e] I also designing an application where I want to use http headers without

Re: :SSH expect like interface
249161 [fwmailinglis] charset="us-ascii"

How do i get involved in ruby core?
249162 [chris.hulber] I'd like to get involved in the development of ruby core, especially
249164 [jan.svitok@g] 1. subscribe to ruby-core
249219 [matz@ru y- a] Yes, we are open for ideas, suggestions, bug reports and bug-fix
249244 [chris.hulber] Cheers - i'll subscribe to ruby core then.

[SUMMARY] Morse Code (#121)
249165 [james@gr yp ] I always forget how much I love the simple problems.  Everyone plays when we
249172 [showaltb@gm ] I didn't understand that when I first saw it. I kept looking for
249175 [james@gr yp ] There are two ways to handle blocks passed to methods.  One is to

[RAILS] How to integrate video flash player into the rails app
249166 [arjun4ruby@g] ...
249190 [dudu@du u. o] If it's there, and you can see it, it's real.

[Rails] How to integrate video flash player into the rails app
249167 [arjun4ruby@g] ...

cannot read a page with open-uri
249200 [sxain@ho ma ] open-uri have been working fine, until I used it to open
249214 [dzwell@gm il] I don't have time to take a close look right now, but when I had this
249222 [sxain@ho ma ] It works. Thanks

Re: file-find 0.1.0
249203 [djberg96@gm ] I just put out 0.2.0 today. This version adds "prune" and "perm", as
249263 [renard@nc rr] Can find the file-find gem but cannot install it.
249264 [djberg96@gm ] Strange. I just tried a remote install and it worked fine. Try again
249314 [leslieviljoe] Works for me.
249362 [renard@nc rr] delete the  "source cache" from c:\ruby\lib\ruby\gems\1.8\cache
249370 [renard@nc rr] Thanks all

[ANN] apt-sary-0.2
249205 [rubikitch@ru] == Abstract

Re: DHH vs. WHY style [OT]
249207 [sam@po er ou] On the whole, were you all a pretty crappy team?
249209 [jcribbs@ne p] Well, we didn't have a lot of time to practice together, so I guess you

Accessing gems from /home dir
249208 [jzakiya@ma l] I have Linux on a Toshiba Satellite laptop.
249213 [dzwell@gm il] I would set the environment variable (in .bashrc)
249549 [jzakiya@ma l] I set the GEM_HOME variable as you suggested, but no luck.
249581 [dzwell@gm il] jz,

SOAP problems
249217 [barjunk@at g] irb -r soap/wsdlDriver
249223 [Philipp.Tapr] Unlikely. The error is pretty obvious: the XML parser encountered an
249251 [barjunk@at g] On Apr 26, 10:46 am, Philipp Taprogge <Philipp.Tapro...@gmx.net>
249253 [barjunk@at g] OK...so here it is.
249846 [barjunk@at g] Further study gives more information, the two fields are the 'names'

Re: How to send a message/mail to particular ip
249220 [veeraa2003@y] For example if an user registered his information in my application with
+ 249230 [dzwell@gm il] If you want a general solution that will work for anybody, you are out
+ 249278 [shortcutter@] So we have two tasks here

Rails suggestions/examples on Rails view architecture for spreadsheet-like tables?
249225 [kenneth.m.mc] I'm building an application where the user is working with something

10 millisecond delay/callback
249226 [eclubb@va co] I need to perform a task every 10ms.  I've been using
+ 249228 [khaines@en g] Try select()
| + 249232 [eclubb@va co] irb(main):001:0> 25.times do
| | 249235 [ganesh.gunas] Are you running Fedora inside a virtual machine?
| | 249237 [eclubb@va co] Nope. No VM here.
| + 249239 [vjoel@pa h. ] What kind of system are you on? It doesn't work so well for me.
| | + 249256 [lionel-subsc] I'm wondering too, I see a nearly constant 2ms delay added to the 10ms
| | | 249265 [dangerwillro] Have you all tried this outside of irb?
| | | 249284 [_mwryder@wo ] I tried your script on Windows under irb and using ruby and get similar
| | + 249320 [khaines@en g] Interesting.
| |   250619 [eclubb@va co] #!/usr/bin/ruby -w
| + 249240 [gavin@re in ] irb(main):001:0> 0.upto(25) do
|   + 249294 [shortcutter@] ruby 1.8.5 (2006-12-25 patchlevel 12) [i386-cygwin]
|   + 249357 [hhausman@gm ] I think Time.now.usec on windows is just whack. :P
+ 249270 [evanwebb@gm ] It's unlikely to get 10ms intervals reliably even in C, so getting it
| 249310 [edder@tk sp ] I've been reading about this a bit lately and as far as I understand it,
+ 249289 [list.push@gm] ...
+ 249336 [pbrannan@at ] I believe part of the problem is that you are not correcting for the
  250682 [lloyd@2l ve ] # see above for the code
  250789 [pbrannan@at ] It depends on what you mean by fast.  For some applications I write, ten
  250919 [swistak@ma l] ruby is interpreted langue and becouse of some restrictions on select and

Using Ruby in a Corporate Environment
249238 [stevemolitor] Curt,
+ 249242 [ruby@ph li .] I can't see how learning a language even if it's not one actively being
| 249245 [gdonald@gm i] I agree.  But it's also much easier to get confused.  Today I couldn't
| 249247 [ruby@ph li .] True, but that's the same with switching anything... I usually drive an
+ 249249 [jgbailey@gm ] ...
+ 249267 [cmdjackryan@] Start looking for developers skilled in Ruby.
+ 249346 [DDENNISON@UP] I'm also looking at Ruby/JRuby in a very large corporate setting.  Those
| 249385 [charles.nutt] That works now. See the JRuby wiki for information on how. It's
+ 249397 [robert.dober] For sure, they will write beautiful Smalltalk and Python programs in Ruby.
+ 249427 [alexey.verkh] Depends on what your needs are, but with modern hardware you can

Date Format Change - Help request
249241 [snoopy.pa30@] Newbie question about changing a date format
249257 [dzwell@gm il] the #each method does not modify the contents of the item that is being
249262 [snoopy.pa30@] THANK YOU DAN

Ruby gotcha? [].all? always returns true
249246 [dan.stevens.] Something in caught me out today. I wanted to test that the contents
+ 249254 [logancapaldo] ...
+ 249255 [fxn@ha hr f.] Yeah, it is suprising at first sight but that's standard semantics in
+ 249319 [martin@sn wp] It seems perfectly intuitive to me.
  249365 [fxn@ha hr f.] A good explanation.

Grabbing banners from other sites.
249248 [jimjohnlists] I want my banner ads to be rotated using ruby.
249266 [cmdjackryan@] Phillip "CynicalRyan" Gawlowski

RDoc & Proc constants
249260 [jesse.d.merr] I've been having a problem getting RDoc to recognize some Proc constants, and

Ruby VM Serial Interview
249261 [james@gr yp ] I've avoided publicizing this too much in the past, because I wanted
249297 [chris.hulber] Great article. Answered some of my concerns about the new threading

Looking for thoughts and opinions on Ruport, and reporting in Ruby in general.
249268 [gregory.t.br] I announced Ruport 1.0 RC1 a few days ago, and a few folks here on
+ 249334 [lyle.johnson] OK, I'll bite. ;)
| + 249337 [gregory.t.br] I have an example from yesterday I could probably expand a bit and add
| | + 249349 [lyle.johnson] Yes, that example looks like just about the right level of detail for
| | | 249353 [gregory.t.br] a.to_html
| | + 249351 [gregory.t.br] I actually just found a way to make that a whole lot shorter.  (With
| + 249338 [jcribbs@ne p] Damn!  I take off my tinfoil hat for one minute, and Lyle ends up
|   249340 [gregory.t.br] The webpage is worse-off-then-ever.  We deleted everything that isn't
|   249342 [dangerwillro] ...
|   249343 [gregory.t.br] Well the easiest way for me to make a formatted report from Ruport if
|   249347 [dangerwillro] I got it. You mean you don't have CSS available to you for PDF files?
|   249350 [gregory.t.br] Correct.  As far as I know there is no formattting facility for PDF
|   + 249354 [dangerwillro] Oh I hear you, especially for things to be printed overly pretty-
|   + 249358 [skoot@id ic ] Maybe generating TeX and then PDF from it may be good solution?
|   | 249359 [gregory.t.br] It's not stupid.   I just don't think TeX styling is going to be anyhigher level than our PDF::Writer wrappers, and it introduces a hugetoolchain.   We at one point were doing TeX output for tables butdropped it.
|   + 249366 [dangerwillro] Naturally, it would be ideal if there were general intermediary data
|     249367 [gregory.t.br] I had very seriously considered integrating XML/Fo as I figured that'd
+ 249376 [donald.ball@] (apologies for the resend, my subject was mysteriously stripped from my
| 249382 [gregory.t.br] This is a real pain point for us for sure.  We're looking at our
| 249395 [gwtmp01@ma .] Perhaps it would help to have some examples of the types of reports
| 249400 [gregory.t.br] I guess the issue is that I don't run into the problem that often in
+ 249586 [gregory.t.br] Thank you everyone who responded on and off list to these questions.

Output A File w/ Line Numbers?
249269 [dangerwillro] I'd like to read a file and output its contents (just to terminal is
+ 249273 [w_a_x_man@ya] On Apr 27, 1:39 am, John Joyce <dangerwillrobinsondan...@gmail.com>
| 249287 [come.news@fr] ruby -ne 'print "#{$.} : #{$_}"' file
| 249300 [w_a_x_man@ya] I forgot about $..
+ 249296 [shortcutter@] 1 aaa
+ 249414 [robert.dober] ARGF.readlines.each_with_index{
| 249415 [robert.dober] But Robert's solution is nicer, I did not know about ARGF.lineno, and
| 249424 [shortcutter@] have to read the whole file into mem before printing it.
| 249431 [dangerwillro] This .each_with_index seems to be an invaluable method... I'd like to
| 249444 [shortcutter@] There's not much to it.  It's defined in module Enumerable and yields
| 249450 [dangerwillro] each_with_index is like each in that it alows you to iterate through
| + 249452 [martindemell] Wait till you feel the need for map_with_index :)
| + 249457 [james@gr yp ] Right.
| | 249464 [dangerwillro] ...
| | 249468 [james@gr yp ] => true
| | 249471 [dangerwillro] Sure enough it's in the Ruby Standard LIbrary, among the things the
| + 249495 [shortcutter@] Correct.
+ 249939 [chneukirchen] Also, nl(1).

Timer Class
249272 [pshussain@gm] Hai Dude
+ 249281 [alex@bl ck e] while true do
| 249293 [siddharth.ka] After seeing this code, I thought, how we can make this reentrant.
+ 249332 [pbrannan@at ] - use threads

string replacement...
249274 [josselin@wa ] I have a string :  str = "/proposal/list/31551"
+ 249276 [stefano.croc] If the text you need to replace is always at the end of the string, you can
| 249327 [josselin@wa ] Thnaks Stefano , it gives the expected result
+ 249277 [dzwell@gm il] str.gsub!(/31551/, "9999")
| 249328 [josselin@wa ] thanks Dan, but I looked for more generic replacement.. as Stefano mentionned
+ 249280 [w_a_x_man@ya] str[/\d+/] = "9999"
| + 249282 [alex@bl ck e] Whoa.  I hadn't seen that syntax before.  Nice.
| | 249330 [josselin@wa ] irb(main):007:0> str = "/proposals/list/31555"
| + 249329 [josselin@wa ] irb(main):007:0> str = "/proposals/list/31555"
|   249360 [sepp2k@go gl] The return value of the assignment is "9999", but the value of str will be the
+ 249299 [shortcutter@] How about
| 249331 [josselin@wa ] I forgot to mention my main objective > replacing the term after the last '/'..
| 249333 [shortcutter@] In that case I'd use the File approach or do str[%r{[^/]+$}]="9999"
+ 249326 [josselin@wa ] thanks Bj?rn , expected result for digits, but I forgot any other
  249388 [robert.dober] (str.split("/")[0..-2] + ["9999"]).join("/")