# Ruby

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

[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:** 685

---

## [Making a counter for each word's occurrences in a string](https://www.ruby-forum.com/t/making-a-counter-for-each-words-occurrences-in-a-string/180687)

<div class="topic-metadata">

**Author:** [@brblakley](https://www.ruby-forum.com/u/brblakley)\
**Replies:** 8\
**Last updated:** [December 26, 2009, 9:31pm UTC](https://www.ruby-forum.com/t/making-a-counter-for-each-words-occurrences-in-a-string/180687 "2009-12-26T21:31:20Z")

</div>

By looking at this method below, I couldn’t understand a few things. Let me list the method first! def count\_frequency(word\_list) counts = Hash.new(0) for word in word\_list counts\[word\] += 1 end counts end p count…

---

## [How to know if a process is zombie?](https://www.ruby-forum.com/t/how-to-know-if-a-process-is-zombie/180700)

<div class="topic-metadata">

**Author:** [@ISSSSaki\_Baz\_C](https://www.ruby-forum.com/u/ISSSSaki_Baz_C)\
**Replies:** 5\
**Last updated:** [December 26, 2009, 9:07pm UTC](https://www.ruby-forum.com/t/how-to-know-if-a-process-is-zombie/180700 "2009-12-26T21:07:55Z")

</div>

Hi, after some forks I need to know if a process still is alive or not, but in case it’s alive I also need to know if it’s a zombie process (it died without Process.wait or Process.detach). Unfortunatelly I couln’t …

---

## [Newbie: if is not null else](https://www.ruby-forum.com/t/newbie-if-is-not-null-else/180596)

<div class="topic-metadata">

**Author:** [@al\_S](https://www.ruby-forum.com/u/al_S)\
**Replies:** 14\
**Last updated:** [December 26, 2009, 8:33pm UTC](https://www.ruby-forum.com/t/newbie-if-is-not-null-else/180596 "2009-12-26T20:33:34Z")

</div>

Hi forum, how can I replace this PHP syntax with Ruby? $x = (isset($x) and !empty($x)) ? $x : ‘-’; I would like assign a default value if $x is Null. Thank you very much, Al

---

## [Thunderbird 3.0 threaded view of comp.lang.ruby](https://www.ruby-forum.com/t/thunderbird-3-0-threaded-view-of-comp-lang-ruby/180691)

<div class="topic-metadata">

**Author:** [@robkuz](https://www.ruby-forum.com/u/robkuz)\
**Replies:** 4\
**Last updated:** [December 26, 2009, 11:06am UTC](https://www.ruby-forum.com/t/thunderbird-3-0-threaded-view-of-comp-lang-ruby/180691 "2009-12-26T11:06:18Z")

</div>

All, does anybody else experience weird things with thread view of comp.lang.ruby (the newsgroup, not mailing list or forum)? I have just reported an issue over at Mozilla’s. Details can be found here Kind regard…

---

## [\[ask\]How to remove HTML part of a text](https://www.ruby-forum.com/t/ask-how-to-remove-html-part-of-a-text/180644)

<div class="topic-metadata">

**Author:** [@inittial\_d](https://www.ruby-forum.com/u/inittial_d)\
**Replies:** 3\
**Last updated:** [December 26, 2009, 4:25am UTC](https://www.ruby-forum.com/t/ask-how-to-remove-html-part-of-a-text/180644 "2009-12-26T04:25:56Z")

</div>

i’m using Hpricot to parsing html and my output is: GrÃ¶ÃŸe: 37 - 54 Maßtabelle does anyone knows how to get the string “GrÃ¶ÃŸe: 37 - 54” and remove the rest of that string ? thanks

---

## [Invalid date error when installing syntax gem](https://www.ruby-forum.com/t/invalid-date-error-when-installing-syntax-gem/178409)

<div class="topic-metadata">

**Author:** [@Joel\_VanderWerf](https://www.ruby-forum.com/u/Joel_VanderWerf)\
**Replies:** 7\
**Last updated:** [December 26, 2009, 2:56am UTC](https://www.ruby-forum.com/t/invalid-date-error-when-installing-syntax-gem/178409 "2009-12-26T02:56:10Z")

</div>

Anyone else getting this error? I didn’t find any recent mention of it. gem install syntax --backtrace ERROR: While executing gem … (ArgumentError) invalid date /usr/local/lib/ruby/1.8/date.rb:727:in new' /usr/local…

---

## [My Creation](https://www.ruby-forum.com/t/my-creation/180686)

<div class="topic-metadata">

**Author:** [@diya\_sinha](https://www.ruby-forum.com/u/diya_sinha)\
**Replies:** 2\
**Last updated:** [December 26, 2009, 1:30am UTC](https://www.ruby-forum.com/t/my-creation/180686 "2009-12-26T01:30:21Z")

</div>

Hello friends i"m new webmaster and website designer i"m starting website designing few days ago so i having many query’s regarding website designing so i want your suggestion to improve my skills i use basic html and…

---

## [FFI Memory Leak](https://www.ruby-forum.com/t/ffi-memory-leak/180663)

<div class="topic-metadata">

**Author:** [@James\_Edward\_GSII](https://www.ruby-forum.com/u/James_Edward_GSII)\
**Replies:** 4\
**Last updated:** [December 26, 2009, 12:56am UTC](https://www.ruby-forum.com/t/ffi-memory-leak/180663 "2009-12-26T00:56:24Z")

</div>

I’ve found a memory leak in some FFI code. I’ll give example code below, but I can explain the issue easily enough first. When calling a function provided by Tokyo Cabinet, it returns a value in the form of a pointer…

---

## [ClothRed use / interest in successor?](https://www.ruby-forum.com/t/clothred-use-interest-in-successor/180690)

<div class="topic-metadata">

**Author:** [@Phillip\_G](https://www.ruby-forum.com/u/Phillip_G)\
**Replies:** 0\
**Last updated:** [December 26, 2009, 12:55am UTC](https://www.ruby-forum.com/t/clothred-use-interest-in-successor/180690 "2009-12-26T00:55:49Z")

</div>

Season’s greetings! While catching up with the world of Ruby and software development in general, I’ve noticed that my age-old ClothRed gem has a number of downloads, meaning that there is certainly an interest in it. …

---

## [How to pass commandline arguments to a file loaded with "irb -r file"?](https://www.ruby-forum.com/t/how-to-pass-commandline-arguments-to-a-file-loaded-with-irb-r-file/180688)

<div class="topic-metadata">

**Author:** [@ISSSSaki\_Baz\_C](https://www.ruby-forum.com/u/ISSSSaki_Baz_C)\
**Replies:** 2\
**Last updated:** [December 26, 2009, 12:12am UTC](https://www.ruby-forum.com/t/how-to-pass-commandline-arguments-to-a-file-loaded-with-irb-r-file/180688 "2009-12-26T00:12:30Z")

</div>

Hi, I run “irb -r myfile.rb” and would like “myfile.rb” to receive commandline arguments, and these not to conflict with irb parameters. Is it possible? I couldn’t get it. What I’d like is something as: ~# irb -r myf…

---

## [Strange behavior of unary +@ for Fixnum?](https://www.ruby-forum.com/t/strange-behavior-of-unary-for-fixnum/180569)

<div class="topic-metadata">

**Author:** [@alexandremutel](https://www.ruby-forum.com/u/alexandremutel)\
**Replies:** 13\
**Last updated:** [December 25, 2009, 11:39pm UTC](https://www.ruby-forum.com/t/strange-behavior-of-unary-for-fixnum/180569 "2009-12-25T23:39:08Z")

</div>

It seems that it’s not possible to use the unary +@ operator for Fixnum in a “short form” way : class Fixnum def +@ puts “YES #{self}” end end =\> nil +50 =\> 50 # Unexpected result : should print YES 50 …

---

## [Date.gregorian\_leap? code](https://www.ruby-forum.com/t/date-gregorian-leap-code/180682)

<div class="topic-metadata">

**Author:** [@colinbm](https://www.ruby-forum.com/u/colinbm)\
**Replies:** 3\
**Last updated:** [December 25, 2009, 11:08pm UTC](https://www.ruby-forum.com/t/date-gregorian-leap-code/180682 "2009-12-25T23:08:42Z")

</div>

from date.rb Is a year a leap year in the Gregorian calendar? All years divisible by 4 are leap years in the Gregorian calendar, except for years divisible by 100 and not by 400. def self.gregorian\_leap? (y) y % 4 == 0 &…

---

## [Correcting complex math](https://www.ruby-forum.com/t/correcting-complex-math/180490)

<div class="topic-metadata">

**Author:** [@jzakiya](https://www.ruby-forum.com/u/jzakiya)\
**Replies:** 10\
**Last updated:** [December 25, 2009, 10:55pm UTC](https://www.ruby-forum.com/t/correcting-complex-math/180490 "2009-12-25T22:55:49Z")

</div>

I thought I would extract some of the issues and ideas raised from the thread ‘Math errors’ http://groups.google.com/group/comp.lang.ruby/browse\_thread/thread/75cad8ec7b137fd8# that dealt with taking the roots of nega…

---

## [Dir.chdir does not work on windows (xp)](https://www.ruby-forum.com/t/dir-chdir-does-not-work-on-windows-xp/180642)

<div class="topic-metadata">

**Author:** [@sathvikl](https://www.ruby-forum.com/u/sathvikl)\
**Replies:** 3\
**Last updated:** [December 25, 2009, 9:41pm UTC](https://www.ruby-forum.com/t/dir-chdir-does-not-work-on-windows-xp/180642 "2009-12-25T21:41:29Z")

</div>

Hi all , I am using Dir.chdir to change my current working directory. class Test def initialize spin end def spin dire = “/c/Target/tioga-1.11/samples” dire2 = “c:\\Target\\tioga-1.11\\samples” Dir.chdir(dire2) #s…

---

## [SoLVED Re: rest-client headers or cookies](https://www.ruby-forum.com/t/solved-re-rest-client-headers-or-cookies/180685)

<div class="topic-metadata">

**Author:** [@Ed\_Howland](https://www.ruby-forum.com/u/Ed_Howland)\
**Replies:** 0\
**Last updated:** [December 25, 2009, 9:10pm UTC](https://www.ruby-forum.com/t/solved-re-rest-client-headers-or-cookies/180685 "2009-12-25T21:10:28Z")

</div>

The secret sauce for cookies: resp = RestClient.post(server\_url’ + ‘/resource’, :args =\> “”) @session\_cookies = resp.cookies Then when calling again: RestClient.put(’#{server\_url + ‘/resource/id’, {:args =\> args}, {…

---

## [Suggestions for a distributed job queue](https://www.ruby-forum.com/t/suggestions-for-a-distributed-job-queue/180605)

<div class="topic-metadata">

**Author:** [@murfhy](https://www.ruby-forum.com/u/murfhy)\
**Replies:** 14\
**Last updated:** [December 25, 2009, 7:56pm UTC](https://www.ruby-forum.com/t/suggestions-for-a-distributed-job-queue/180605 "2009-12-25T19:56:06Z")

</div>

I’m looking at replacing our homebrew job queue with something better, and I’m wondering what’s out there. If there’s something that meets our needs I’d like to use it; otherwise I may end up building our next gen j…

---

## [Ruby's implementation of Fixnum-assignment](https://www.ruby-forum.com/t/rubys-implementation-of-fixnum-assignment/180549)

<div class="topic-metadata">

**Author:** [@RichardOnRails](https://www.ruby-forum.com/u/RichardOnRails)\
**Replies:** 18\
**Last updated:** [December 25, 2009, 7:55pm UTC](https://www.ruby-forum.com/t/rubys-implementation-of-fixnum-assignment/180549 "2009-12-25T19:55:31Z")

</div>

Hi, I’ve made the following observations about Ruby’s apparent implementation: Integer’s in the range -230 to 230-1 are Fixnum’s. Integers outside that range are Bignum’s For Fixnum “i”, i’s object\_id is twice i’s …

---

## [Why this works not right](https://www.ruby-forum.com/t/why-this-works-not-right/180645)

<div class="topic-metadata">

**Author:** [@Eva](https://www.ruby-forum.com/u/Eva)\
**Replies:** 5\
**Last updated:** [December 25, 2009, 6:54pm UTC](https://www.ruby-forum.com/t/why-this-works-not-right/180645 "2009-12-25T18:54:01Z")

</div>

Hi, Please take a look at below: def mytest return \[1…10\] end x = mytest x.each do |c| puts c end this works not as I expected. I want the output of: 1 2 3 4 5 6 7 8 9 10 But if I change return \[1…10\] …

---

## [Bluecloth 2.0.5](https://www.ruby-forum.com/t/bluecloth-2-0-5/172167)

<div class="topic-metadata">

**Author:** [@unknown](https://www.ruby-forum.com/u/unknown)\
**Replies:** 22\
**Last updated:** [December 25, 2009, 6:50pm UTC](https://www.ruby-forum.com/t/bluecloth-2-0-5/172167 "2009-12-25T18:50:02Z")

</div>

Version 2.0.5 of bluecloth has been released. BlueCloth is a Ruby implementation of \[Markdown\]\[1\], a text-to-HTML conversion tool for web writers. To quote from the project page: Markdown allows you to write using an …

---

## [Nailgun failed on Windows7](https://www.ruby-forum.com/t/nailgun-failed-on-windows7/180678)

<div class="topic-metadata">

**Author:** [@thebugslayer](https://www.ruby-forum.com/u/thebugslayer)\
**Replies:** 1\
**Last updated:** [December 25, 2009, 6:31pm UTC](https://www.ruby-forum.com/t/nailgun-failed-on-windows7/180678 "2009-12-25T18:31:46Z")

</div>

Hi there, I get errors when I tried jruby --ng-server on Windows7. I can start the server fine: C:\\Users\\Zemian\>C:\\apps\\jruby-1.4.0\\bin\\jruby --ng-server NGServer started on all interfaces, port 2113. But when I try…

---

## [Newbie: argh! array of array](https://www.ruby-forum.com/t/newbie-argh-array-of-array/180628)

<div class="topic-metadata">

**Author:** [@al\_S](https://www.ruby-forum.com/u/al_S)\
**Replies:** 3\
**Last updated:** [December 25, 2009, 6:04pm UTC](https://www.ruby-forum.com/t/newbie-argh-array-of-array/180628 "2009-12-25T18:04:48Z")

</div>

Hi forum, I’m fighting with a function like this! :slight\_smile: function(\[“x”,“y”,“x”\]) do |a,b|c| printf("%10s %10s %10s\\n",a,b,c) end It works fine, but I would like a “pseudo-code” like this :slight\_smile: new …

---

## [Newbie Question](https://www.ruby-forum.com/t/newbie-question/180674)

<div class="topic-metadata">

**Author:** [@lalawawa](https://www.ruby-forum.com/u/lalawawa)\
**Replies:** 3\
**Last updated:** [December 25, 2009, 6:04pm UTC](https://www.ruby-forum.com/t/newbie-question/180674 "2009-12-25T18:04:48Z")

</div>

How do I turn the string “4.5” into the number 4.5 so I can do arithmetic on it?

---

## [Happy Holidays](https://www.ruby-forum.com/t/happy-holidays/180664)

<div class="topic-metadata">

**Author:** [@Rajinder\_Y](https://www.ruby-forum.com/u/Rajinder_Y)\
**Replies:** 5\
**Last updated:** [December 25, 2009, 6:01pm UTC](https://www.ruby-forum.com/t/happy-holidays/180664 "2009-12-25T18:01:52Z")

</div>

I just like to thank everyone in the Ruby community for being wonderful to each other. This community rocks! I’m grateful to everyone who took the time to read and reply to my post, for helping me become a better Ruby…

---

## [Ruby/rails/debugger variable dump question](https://www.ruby-forum.com/t/ruby-rails-debugger-variable-dump-question/180680)

<div class="topic-metadata">

**Author:** [@ralphshnelvar](https://www.ruby-forum.com/u/ralphshnelvar)\
**Replies:** 0\
**Last updated:** [December 25, 2009, 5:53pm UTC](https://www.ruby-forum.com/t/ruby-rails-debugger-variable-dump-question/180680 "2009-12-25T17:53:39Z")

</div>

newb here. (OT: Merry Christmas, all.) So I placed a debugger statement into my ROR app and run ruby script/server webrick --debugger My app hit the debugger statement. I then did a var local (rdb:68) var local …

---

## [Time.now + str $B$H(B #to\_r](https://www.ruby-forum.com/t/time-now-str-b-h-b-to-r/179884)

<div class="topic-metadata">

**Author:** [@Yukihiro\_M](https://www.ruby-forum.com/u/Yukihiro_M)\
**Replies:** 8\
**Last updated:** [December 25, 2009, 5:47pm UTC](https://www.ruby-forum.com/t/time-now-str-b-h-b-to-r/179884 "2009-12-25T17:47:13Z")

</div>

e$B$^$D$b$He(B e$B$f$-$R$m$G$9e(B \[ruby-core:23729\]e$B$G;XE&$5$l$?e(BTimee$B$He(Bstringe$B$N2C;;$,%(%i!\<$K$Je(B e$B$i$J$$M}M3$O!"e(B1.9e$B$Ge(BRationale$B$,AH$\_9~$^$l$?$3$H$G!"e(B String#to\_re$B$,Ds6!$5$l$?e(B Str…

---

## [How to fund an open-source project?](https://www.ruby-forum.com/t/how-to-fund-an-open-source-project/180343)

<div class="topic-metadata">

**Author:** [@Eleanor\_McHugh](https://www.ruby-forum.com/u/Eleanor_McHugh)\
**Replies:** 22\
**Last updated:** [December 25, 2009, 5:33pm UTC](https://www.ruby-forum.com/t/how-to-fund-an-open-source-project/180343 "2009-12-25T17:33:44Z")

</div>

In the recent thread on Ruby VMs I mentioned my newly launched RubyGoLightly project \[0\], currently a bit of non-compilable vapourware forked from Marc-Andre Cournoyer’s TinyRb codebase. Whilst Google’s public release…

---

## [How to test an iterator method](https://www.ruby-forum.com/t/how-to-test-an-iterator-method/180667)

<div class="topic-metadata">

**Author:** [@Edgardo\_H](https://www.ruby-forum.com/u/Edgardo_H)\
**Replies:** 1\
**Last updated:** [December 25, 2009, 5:22pm UTC](https://www.ruby-forum.com/t/how-to-test-an-iterator-method/180667 "2009-12-25T17:22:35Z")

</div>

Hi guys, I have a class that looks like this class MyClass def each\_object # do something really fun end end I’d like to write some tests for the #each\_object method but don’t know how to. Could you please sugges…

---

## ["No block given" error -- spurious?](https://www.ruby-forum.com/t/no-block-given-error-spurious/180660)

<div class="topic-metadata">

**Author:** [@rjlyders](https://www.ruby-forum.com/u/rjlyders)\
**Replies:** 2\
**Last updated:** [December 25, 2009, 5:16pm UTC](https://www.ruby-forum.com/t/no-block-given-error-spurious/180660 "2009-12-25T17:16:44Z")

</div>

The code below, found at http://github.com/eregon/RPCFN4/blob/master/solutions/benoit\_daloze.rb (with the last two lines added for testing it) produced the error: Polynomials.rb:15:in \`each\_with\_index’: no block give…

---

## [watir:How to click on play player obj embeded in browser](https://www.ruby-forum.com/t/watir-how-to-click-on-play-player-obj-embeded-in-browser/180577)

<div class="topic-metadata">

**Author:** [@ysuman](https://www.ruby-forum.com/u/ysuman)\
**Replies:** 5\
**Last updated:** [December 25, 2009, 5:04pm UTC](https://www.ruby-forum.com/t/watir-how-to-click-on-play-player-obj-embeded-in-browser/180577 "2009-12-25T17:04:52Z")

</div>

How to click on play icon in a media player object embeded in web browser.

---

## [\[Bug #2401\] Array splat bug: a=\[1,2\]; p \[\*a\] #=\> \[\]](https://www.ruby-forum.com/t/bug-2401-array-splat-bug-a-1-2-p-a/179444)

<div class="topic-metadata">

**Author:** [@Akinori\_MUSHA](https://www.ruby-forum.com/u/Akinori_MUSHA)\
**Replies:** 1\
**Last updated:** [December 25, 2009, 5:04pm UTC](https://www.ruby-forum.com/t/bug-2401-array-splat-bug-a-1-2-p-a/179444 "2009-12-25T17:04:52Z")

</div>

Bug #2401: Array splat bug: a=\[1,2\]; p \[\*a\] #=\> \[\] http://redmine.ruby-lang.org/issues/show/2401 e$B5/I\<\<Te(B: Akinori MUSHA e$B%9%F!\<%?%9e(B: Open, e$BM%@hEYe(B: High e$B%+%F%4%je(B: core, Target version: Ruby 1.8.8 …

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

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