# Ruby

**URL:** https://www.ruby-forum.com/c/ruby/7.md?page=1156

[Latest](https://www.ruby-forum.com/latest.md) · [Categories](https://www.ruby-forum.com/categories.md) · [Tags](https://www.ruby-forum.com/tags.md)

**Page:** 1157

---

## [Noob random number question](https://www.ruby-forum.com/t/noob-random-number-question/135013)

<div class="topic-metadata">

**Author:** [@zoephoenix](https://www.ruby-forum.com/u/zoephoenix)\
**Replies:** 9\
**Last updated:** [April 17, 2008, 7:46am UTC](https://www.ruby-forum.com/t/noob-random-number-question/135013 "2008-04-17T07:46:19Z")

</div>

If I wanted a program to return a random percentage of a number, like, 3% to 5% of 237, how would I do this? I know rand(101) would return a random number between 0 and 100, but I’m not sure how to have a random perc…

---

## [Calculating elapsed time](https://www.ruby-forum.com/t/calculating-elapsed-time/134935)

<div class="topic-metadata">

**Author:** [@owc](https://www.ruby-forum.com/u/owc)\
**Replies:** 7\
**Last updated:** [April 17, 2008, 4:33am UTC](https://www.ruby-forum.com/t/calculating-elapsed-time/134935 "2008-04-17T04:33:32Z")

</div>

I have a program where i put the time at the beginning: puts $t1=Time.now and then after running some commands, i put the time again: puts $t2=Time.now and then have a method to calculate the time elapsed: def calTi…

---

## [Ruby execution](https://www.ruby-forum.com/t/ruby-execution/134704)

<div class="topic-metadata">

**Author:** [@sumantacaptain](https://www.ruby-forum.com/u/sumantacaptain)\
**Replies:** 11\
**Last updated:** [April 17, 2008, 3:55am UTC](https://www.ruby-forum.com/t/ruby-execution/134704 "2008-04-17T03:55:51Z")

</div>

can i execute ruby program step by step? like c language…pressing F7… i can debug my program. is there any way to do the same? thanx

---

## [Create server](https://www.ruby-forum.com/t/create-server/134751)

<div class="topic-metadata">

**Author:** [@Vince\_F](https://www.ruby-forum.com/u/Vince_F)\
**Replies:** 5\
**Last updated:** [April 17, 2008, 12:00am UTC](https://www.ruby-forum.com/t/create-server/134751 "2008-04-17T00:00:05Z")

</div>

Hi all, I am interested in using GServer but the server hangs after ~5-10 attempts (per max connections to allow). Example code I used is from Peter Coopers book, Beginning Ruby From Novice to Professional: http:/…

---

## [TypeError when fetching gems with --source](https://www.ruby-forum.com/t/typeerror-when-fetching-gems-with-source/134964)

<div class="topic-metadata">

**Author:** [@df-sean](https://www.ruby-forum.com/u/df-sean)\
**Replies:** 2\
**Last updated:** [April 16, 2008, 11:10pm UTC](https://www.ruby-forum.com/t/typeerror-when-fetching-gems-with-source/134964 "2008-04-16T23:10:43Z")

</div>

When I attempt to fetch gems while specifying a source, like so: gem fetch activerecord-sqlserver-adapter –source=http://gems.rubyonrails.org …I receive the following error: ERROR: While executing gem … (TypeError) …

---

## [Rdoc 2.0.0 Released](https://www.ruby-forum.com/t/rdoc-2-0-0-released/134464)

<div class="topic-metadata">

**Author:** [@miracleofmagick](https://www.ruby-forum.com/u/miracleofmagick)\
**Replies:** 10\
**Last updated:** [April 16, 2008, 11:01pm UTC](https://www.ruby-forum.com/t/rdoc-2-0-0-released/134464 "2008-04-16T23:01:53Z")

</div>

rdoc version 2.0.0 has been released! http://rubyforge.org/projects/rdoc/ http://rdoc.rubyforge.org/rdoc/ RDoc is an application that produces documentation for one or more Ruby source files. RDoc includes the rdoc …

---

## [Problem with direct assignment versus setter method](https://www.ruby-forum.com/t/problem-with-direct-assignment-versus-setter-method/134747)

<div class="topic-metadata">

**Author:** [@rawroe](https://www.ruby-forum.com/u/rawroe)\
**Replies:** 3\
**Last updated:** [April 16, 2008, 10:55pm UTC](https://www.ruby-forum.com/t/problem-with-direct-assignment-versus-setter-method/134747 "2008-04-16T22:55:57Z")

</div>

Hello, I’m a newcomer to JRuby and updated my install this morning to: JDK 1.5.0 update 15 jruby-1.1RC3 To test it I found a sample (courtesy of http://www.codecommit.com/blog/java/rapid-prototyping-with-jruby): r…

---

## [How to reliably setup require path](https://www.ruby-forum.com/t/how-to-reliably-setup-require-path/134725)

<div class="topic-metadata">

**Author:** [@chrisjo](https://www.ruby-forum.com/u/chrisjo)\
**Replies:** 11\
**Last updated:** [April 16, 2008, 10:33pm UTC](https://www.ruby-forum.com/t/how-to-reliably-setup-require-path/134725 "2008-04-16T22:33:31Z")

</div>

I’m writing my first Ruby command line application (beyond a simple script) and I’m little unsure about how to structure the application and the best use of require. I’ve come as far as to have the following file stru…

---

## [Does the implementation of Ruby use Yacc?](https://www.ruby-forum.com/t/does-the-implementation-of-ruby-use-yacc/134993)

<div class="topic-metadata">

**Author:** [@robert](https://www.ruby-forum.com/u/robert)\
**Replies:** 1\
**Last updated:** [April 16, 2008, 10:02pm UTC](https://www.ruby-forum.com/t/does-the-implementation-of-ruby-use-yacc/134993 "2008-04-16T22:02:51Z")

</div>

Or does it use a hand-made customized parser? Or another pre-packaged parser tool?

---

## [Gsub with Hash$B$r;H$C$?(BCGI::unescapeHTML](https://www.ruby-forum.com/t/gsub-with-hash-b-r-h-c-bcgi-unescapehtml/134965)

<div class="topic-metadata">

**Author:** [@Kazuhiro\_NISHIYAMA](https://www.ruby-forum.com/u/Kazuhiro_NISHIYAMA)\
**Replies:** 1\
**Last updated:** [April 16, 2008, 6:48pm UTC](https://www.ruby-forum.com/t/gsub-with-hash-b-r-h-c-bcgi-unescapehtml/134965 "2008-04-16T18:48:00Z")

</div>

e$B@\>;3OB9-$G$9!#e(B e$B:#$N$H$3$me(B\[ruby-core:15637\]e$B$,F~$C$F$$$J$$$N$G!"e(Bencodee$B$Ne(Binvalide$B$N$H$3$m$,e(B e$B$@$a$G$9$,!"e(BCGI::unescapeHTMLe$B$Oe(Bgsub with Hashe$B$r;H$&$H0J2\<$N$h$&$Ke(B e$B$G$-$k$N$G$…

---

## [Net/http - Confirming the right implementation](https://www.ruby-forum.com/t/net-http-confirming-the-right-implementation/134911)

<div class="topic-metadata">

**Author:** [@aginghipster](https://www.ruby-forum.com/u/aginghipster)\
**Replies:** 2\
**Last updated:** [April 16, 2008, 6:35pm UTC](https://www.ruby-forum.com/t/net-http-confirming-the-right-implementation/134911 "2008-04-16T18:35:00Z")

</div>

Hey folks, I am trying to use net/http and net/https to implement a specific POST call for youtube’s video upload service (am trying to use the direct upload API) and am looking to confirm that I am implementing the n…

---

## [Logging stdout/stderr/stdin of an spawn process (Open4::spawn)](https://www.ruby-forum.com/t/logging-stdout-stderr-stdin-of-an-spawn-process-open4-spawn/134973)

<div class="topic-metadata">

**Author:** [@Ed\_Hames](https://www.ruby-forum.com/u/Ed_Hames)\
**Replies:** 0\
**Last updated:** [April 16, 2008, 6:27pm UTC](https://www.ruby-forum.com/t/logging-stdout-stderr-stdin-of-an-spawn-process-open4-spawn/134973 "2008-04-16T18:27:16Z")

</div>

Hi dear rubyists, I need to log all the input (typed by the user) and the stdout/stderr of a process. The #script method below should behave pretty much like the Unix script application. This way, my application can i…

---

## [Looking for a net/http example](https://www.ruby-forum.com/t/looking-for-a-net-http-example/134961)

<div class="topic-metadata">

**Author:** [@aginghipster](https://www.ruby-forum.com/u/aginghipster)\
**Replies:** 2\
**Last updated:** [April 16, 2008, 5:58pm UTC](https://www.ruby-forum.com/t/looking-for-a-net-http-example/134961 "2008-04-16T17:58:16Z")

</div>

Hey folks, I am hoping someone can post a quick net/http example which illustrates a POST method call with multipart/related content, I think I am confused as to which info is specified in the headers and which is pas…

---

## [Ruby and lampp](https://www.ruby-forum.com/t/ruby-and-lampp/134944)

<div class="topic-metadata">

**Author:** [@dds974](https://www.ruby-forum.com/u/dds974)\
**Replies:** 3\
**Last updated:** [April 16, 2008, 5:39pm UTC](https://www.ruby-forum.com/t/ruby-and-lampp/134944 "2008-04-16T17:39:37Z")

</div>

Hello, I have a problem whith my ruby configuration. I explain : I have lampp installed in my computer and I use Joomla AND Redmine My /etc/hosts is like this: 127.0.0.1 localhost localhost.localdomain 85.31.216.21…

---

## [Return type](https://www.ruby-forum.com/t/return-type/120873)

<div class="topic-metadata">

**Author:** [@martin\_mercy2001](https://www.ruby-forum.com/u/martin_mercy2001)\
**Replies:** 5\
**Last updated:** [April 16, 2008, 5:01pm UTC](https://www.ruby-forum.com/t/return-type/120873 "2008-04-16T17:01:17Z")

</div>

Actually the following code is a java return type. could any one help to do the same in ruby. return processNamespaces ? elUri\[depth\] : NO\_NAMESPACE Thank you in advance

---

## [At\_exit handlers and Process.kill](https://www.ruby-forum.com/t/at-exit-handlers-and-process-kill/134834)

<div class="topic-metadata">

**Author:** [@danielb](https://www.ruby-forum.com/u/danielb)\
**Replies:** 21\
**Last updated:** [April 16, 2008, 4:54pm UTC](https://www.ruby-forum.com/t/at-exit-handlers-and-process-kill/134834 "2008-04-16T16:54:13Z")

</div>

Hi all, Ruby 1.8.6 p114 OS X 10.4 None of these handlers get picked up when I kill the ‘process\_test.rb’ program with an external program. Why not? process\_test.rb File.open(“pid.txt”, “w”){ |fh| fh.print Process.pi…

---

## [How to get number of active threads in C?](https://www.ruby-forum.com/t/how-to-get-number-of-active-threads-in-c/134959)

<div class="topic-metadata">

**Author:** [@macournoyer](https://www.ruby-forum.com/u/macournoyer)\
**Replies:** 0\
**Last updated:** [April 16, 2008, 4:47pm UTC](https://www.ruby-forum.com/t/how-to-get-number-of-active-threads-in-c/134959 "2008-04-16T16:47:21Z")

</div>

Hi all, I’m writing a Ruby C extension and I need a fast way to get the number of active threads. I got something working for 1.8.6 but it’s not portable to other Ruby version like 1.9 (because I can’t include the he…

---

## [How to send a file via XML RPC](https://www.ruby-forum.com/t/how-to-send-a-file-via-xml-rpc/134902)

<div class="topic-metadata">

**Author:** [@e\_deleflie](https://www.ruby-forum.com/u/e_deleflie)\
**Replies:** 2\
**Last updated:** [April 16, 2008, 4:11pm UTC](https://www.ruby-forum.com/t/how-to-send-a-file-via-xml-rpc/134902 "2008-04-16T16:11:21Z")

</div>

Does anyone have some sample code showing how to send a file via XML RPC? Sending string values is easy … like the below example… server = XMLRPC::Client.new2(“http://rpc.technorati.com/rpc/ping”) result = server.cal…

---

## [Ruby library for cron and at](https://www.ruby-forum.com/t/ruby-library-for-cron-and-at/134946)

<div class="topic-metadata">

**Author:** [@batguano](https://www.ruby-forum.com/u/batguano)\
**Replies:** 1\
**Last updated:** [April 16, 2008, 2:39pm UTC](https://www.ruby-forum.com/t/ruby-library-for-cron-and-at/134946 "2008-04-16T14:39:01Z")

</div>

I have to build an application that will drive other processes which will have to be started at given times. Some of these will have to be started periodically, but most only once. This will take place on a Linux mach…

---

## [Patch for ruby-Bugs-19304](https://www.ruby-forum.com/t/patch-for-ruby-bugs-19304/134945)

<div class="topic-metadata">

**Author:** [@wanabe](https://www.ruby-forum.com/u/wanabe)\
**Replies:** 0\
**Last updated:** [April 16, 2008, 1:59pm UTC](https://www.ruby-forum.com/t/patch-for-ruby-bugs-19304/134945 "2008-04-16T13:59:42Z")

</div>

e$B%o%J%Y$H?=$7$^$9!#e(B \[ruby-Bugs-19304\] e$B$KBP$9$k%Q%C%A$r=q$-$^$7$?!#e(B define\_method e$B$G:n$i$l$?%a%=%C%I$Ne(B return e$B$NHt$S@h$,D\>A0$N%U%l!\<%\`$K$J$j$^$9!#e(B e$B$G$9$,!“e(Brb\_mod\_define\_method() e$BCf$G$Oe…

---

## [Patch for ruby-core:14813](https://www.ruby-forum.com/t/patch-for-ruby-core-14813/134943)

<div class="topic-metadata">

**Author:** [@wanabe](https://www.ruby-forum.com/u/wanabe)\
**Replies:** 0\
**Last updated:** [April 16, 2008, 1:56pm UTC](https://www.ruby-forum.com/t/patch-for-ruby-core-14813/134943 "2008-04-16T13:56:42Z")

</div>

e$B%o%J%Y$H?=$7$^$9!#e(B \[ruby-core:14813\] e$B$KBP$9$k%Q%C%A$r=q$-$^$7$?!#e(B e$B%V%m%C%/0z?t$,M?$($i$l$?%V%m%C%/!"$\*$h$Se(B define\_method e$B$N%V%m%C%/Cf$G$Ne(B given\_block? e$B$He(B yield e$B$N5sF0$,JQ$o$j$^$9!#e(B …

---

## [Patch for](https://www.ruby-forum.com/t/patch-for/134576)

<div class="topic-metadata">

**Author:** [@wanabe](https://www.ruby-forum.com/u/wanabe)\
**Replies:** 5\
**Last updated:** [April 16, 2008, 1:41pm UTC](https://www.ruby-forum.com/t/patch-for/134576 "2008-04-16T13:41:11Z")

</div>

e$B%o%J%Y$H?=$7$^$9!#e(B Fiber e$B$N%H%C%W%U%l!\<%\`$Ke(B ISeq e$B$r2C$($k%Q%C%A$r=q$-$^$7$?!#e(B e$B$D$$$G$J$N$Ge(B Thread e$B$bF1MM$K$7$^$7$?!#e(B test\_knownbug.rb e$B$Ne(B \[ruby-dev:34128\] e$B$H$"$k%F%9%H$,DL$k$h$&$…

---

## [CLOB handling](https://www.ruby-forum.com/t/clob-handling/115178)

<div class="topic-metadata">

**Author:** [@crazybass](https://www.ruby-forum.com/u/crazybass)\
**Replies:** 2\
**Last updated:** [April 16, 2008, 12:42pm UTC](https://www.ruby-forum.com/t/clob-handling/115178 "2008-04-16T12:42:12Z")

</div>

Hello In an oracle table, I hava a field of CLOB type (named “VXML”). This column have a XML text and i would like to parse it to extract several informations. In ruby when i access to this column, and for exemple, i…

---

## [Can't start ruby with RUBYOPT=-T4](https://www.ruby-forum.com/t/cant-start-ruby-with-rubyopt-t4/134849)

<div class="topic-metadata">

**Author:** [@Yusuke\_ENDOH](https://www.ruby-forum.com/u/Yusuke_ENDOH)\
**Replies:** 2\
**Last updated:** [April 16, 2008, 11:26am UTC](https://www.ruby-forum.com/t/cant-start-ruby-with-rubyopt-t4/134849 "2008-04-16T11:26:53Z")

</div>

e$B1sF#$H?=$7$^$9!#e(B e$B0J2\<$N5sF0$O0U?^E\*$G$7$g$&$+!#e(B $ RUBYOPT=-T4 ./ruby ./ruby: Insecure: can’t set constant (SecurityError) $ ./ruby -v ruby 1.9.0 (2008-04-15 revision 16040) \[i686-linux\] e$B\<B32$O$J$$5$$…

---

## [Annoying block variable behaviour!](https://www.ruby-forum.com/t/annoying-block-variable-behaviour/134905)

<div class="topic-metadata">

**Author:** [@ISSSSaki\_Baz\_C](https://www.ruby-forum.com/u/ISSSSaki_Baz_C)\
**Replies:** 2\
**Last updated:** [April 16, 2008, 9:58am UTC](https://www.ruby-forum.com/t/annoying-block-variable-behaviour/134905 "2008-04-16T09:58:18Z")

</div>

Hi, I remember reading somewhere that the Ruby handling of block local variables is deprecated and will be fixed, but for now it gives very anoying behaviour. For example: This is obvious and correct: a) \[1,2,3,4\].e…

---

## [Code for modeless dialog window](https://www.ruby-forum.com/t/code-for-modeless-dialog-window/134928)

<div class="topic-metadata">

**Author:** [@pranjal\_jain](https://www.ruby-forum.com/u/pranjal_jain)\
**Replies:** 1\
**Last updated:** [April 16, 2008, 9:31am UTC](https://www.ruby-forum.com/t/code-for-modeless-dialog-window/134928 "2008-04-16T09:31:01Z")

</div>

Hi All Can anyone share the Code for “modeless dialogs window”. I tired to write but of no use. thanks in advance :slight\_smile:

---

## [Tempfile.unlink $B8e$K(B tempfile.close](https://www.ruby-forum.com/t/tempfile-unlink-b8e-k-b-tempfile-close/132447)

<div class="topic-metadata">

**Author:** [@SATOH\_Fumiyasu](https://www.ruby-forum.com/u/SATOH_Fumiyasu)\
**Replies:** 2\
**Last updated:** [April 16, 2008, 7:28am UTC](https://www.ruby-forum.com/t/tempfile-unlink-b8e-k-b-tempfile-close/132447 "2008-04-16T07:28:04Z")

</div>

e$B$5$H$&$U$\_$d$9e(B @ OSS e$B%F%/%N%m%8$G$9!#e(B Tempfile e$B%\*%V%8%’%/%H$re(B unlink e$B$7$?8e$Ke(B close e$B$9$k$H!"e(B e$B0J2\<$N$h$&$KNc30$,H/@8$7$F$7$^$$$^$9!#e(B $ ruby -v ruby 1.8.6 (2008-03-03 patchlevel 114)…

---

## [Leaking weirdness](https://www.ruby-forum.com/t/leaking-weirdness/134920)

<div class="topic-metadata">

**Author:** [@rogerdpack](https://www.ruby-forum.com/u/rogerdpack)\
**Replies:** 0\
**Last updated:** [April 16, 2008, 7:11am UTC](https://www.ruby-forum.com/t/leaking-weirdness/134920 "2008-04-16T07:11:15Z")

</div>

Perhaps someone out there can help give me a clue about the following situation: My mongrel processes seem to be leaking. As an example of this, if I add this code to the bottom of environment.rb Thread.new {loop do…

---

## [Uninitialized constant ActionController](https://www.ruby-forum.com/t/uninitialized-constant-actioncontroller/134810)

<div class="topic-metadata">

**Author:** [@Tae\_Hyeon\_Choe](https://www.ruby-forum.com/u/Tae_Hyeon_Choe)\
**Replies:** 1\
**Last updated:** [April 16, 2008, 6:37am UTC](https://www.ruby-forum.com/t/uninitialized-constant-actioncontroller/134810 "2008-04-16T06:37:47Z")

</div>

Hi~! I’m start RoR. but meet error when first program… Help me… Error Message : copy output RubyMate r8136 running Ruby r1.8.6 (/opt/local/bin/ruby) application.rb NameError: uninitialized constant ActionCon…

---

## [Net/imap - imap.search "TO" can't find email](https://www.ruby-forum.com/t/net-imap-imap-search-to-cant-find-email/134918)

<div class="topic-metadata">

**Author:** [@jasonnaylor](https://www.ruby-forum.com/u/jasonnaylor)\
**Replies:** 1\
**Last updated:** [April 16, 2008, 6:10am UTC](https://www.ruby-forum.com/t/net-imap-imap-search-to-cant-find-email/134918 "2008-04-16T06:10:51Z")

</div>

I’m having trouble with the “search” feature of Net::IMAP. I’m attempting to search for a message “TO” a particular recipient. The email recipient is something like: removed\_email\_address@domain.invalid A search fun…

[Previous page](https://www.ruby-forum.com/c/ruby/7.md?page=1155)

[Next page](https://www.ruby-forum.com/c/ruby/7.md?page=1157)
