# Ruby

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

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

---

## [Pretty\_print woes](https://www.ruby-forum.com/t/pretty-print-woes/108014)

<div class="topic-metadata">

**Author:** [@ronaldfischer](https://www.ruby-forum.com/u/ronaldfischer)\
**Replies:** 4\
**Last updated:** [June 28, 2007, 11:26pm UTC](https://www.ruby-forum.com/t/pretty-print-woes/108014 "2007-06-28T23:26:54Z")

</div>

I like the formatting one gets by require ‘pp’ pp foo() # etc. In my application however, I don’t want the pp-formatted string to be printed, but to be returned as a string to my application. Searching the Net, I ca…

---

## [Possible to get a row count from Faster::CSV w/out parsing?](https://www.ruby-forum.com/t/possible-to-get-a-row-count-from-faster-csv-w-out-parsing/108083)

<div class="topic-metadata">

**Author:** [@weyus](https://www.ruby-forum.com/u/weyus)\
**Replies:** 1\
**Last updated:** [June 28, 2007, 11:24pm UTC](https://www.ruby-forum.com/t/possible-to-get-a-row-count-from-faster-csv-w-out-parsing/108083 "2007-06-28T23:24:54Z")

</div>

All, I’m using Faster::CSV to process CSV files. It appears that the only way to get the number of rows in my CSV file is to call one of the methods which actually reads through all of the data, like read(). Is this…

---

## [Getting fixtures to work without Rails](https://www.ruby-forum.com/t/getting-fixtures-to-work-without-rails/108064)

<div class="topic-metadata">

**Author:** [@Vassilis\_R](https://www.ruby-forum.com/u/Vassilis_R)\
**Replies:** 5\
**Last updated:** [June 28, 2007, 10:50pm UTC](https://www.ruby-forum.com/t/getting-fixtures-to-work-without-rails/108064 "2007-06-28T22:50:49Z")

</div>

Yes, this is ActiveRecord without Rails again. Specifically testing with fixtures. I’m stuck making them work and I know exactly where the code is checking out and leaving me in the dark. Now, the following will not …

---

## [Ruby Forward Slash (/)](https://www.ruby-forum.com/t/ruby-forward-slash/108080)

<div class="topic-metadata">

**Author:** [@vpredoehl](https://www.ruby-forum.com/u/vpredoehl)\
**Replies:** 6\
**Last updated:** [June 28, 2007, 9:58pm UTC](https://www.ruby-forum.com/t/ruby-forward-slash/108080 "2007-06-28T21:58:37Z")

</div>

I thought I knew everything about the Ruby syntax, then I saw this: (doc/"#sidebar").remove What does the slash do, is it an operator? What’s it called?

---

## [Escaping/stripping all user HTML input](https://www.ruby-forum.com/t/escaping-stripping-all-user-html-input/108061)

<div class="topic-metadata">

**Author:** [@luis](https://www.ruby-forum.com/u/luis)\
**Replies:** 1\
**Last updated:** [June 28, 2007, 9:13pm UTC](https://www.ruby-forum.com/t/escaping-stripping-all-user-html-input/108061 "2007-06-28T21:13:30Z")

</div>

I am writing an application where I know that I do not need to allow any HTML input from a user. I am considering using before\_filter at the controller level to call a method that essentially performs the following on…

---

## [Gems not working](https://www.ruby-forum.com/t/gems-not-working/108051)

<div class="topic-metadata">

**Author:** [@vpredoehl](https://www.ruby-forum.com/u/vpredoehl)\
**Replies:** 6\
**Last updated:** [June 28, 2007, 9:00pm UTC](https://www.ruby-forum.com/t/gems-not-working/108051 "2007-06-28T21:00:04Z")

</div>

I do not have rails, but I like to use Ruby Gems. I installed gem hpricot and when I run my script with ‘ruby’, it has trouble finding the Hpricot library. When I run the same code in IRB, it finds the gem. I do have…

---

## [Array.join for nested arrays](https://www.ruby-forum.com/t/array-join-for-nested-arrays/108065)

<div class="topic-metadata">

**Author:** [@unknown](https://www.ruby-forum.com/u/unknown)\
**Replies:** 0\
**Last updated:** [June 28, 2007, 8:42pm UTC](https://www.ruby-forum.com/t/array-join-for-nested-arrays/108065 "2007-06-28T20:42:22Z")

</div>

Doing arr = \[1, \[2, \[3, 4\], 5\], 6\] arr.join(‘,’) in Ruby 1.8.6 produces the following string: 1,2,3,4,5,6 Looking at the docs (e.g. http://www.noobkit.com/ruby-array-join), Array.join should work as following: “Re…

---

## [Undefined method(s) in a gcalapi class](https://www.ruby-forum.com/t/undefined-method-s-in-a-gcalapi-class/108060)

<div class="topic-metadata">

**Author:** [@codecarpenter](https://www.ruby-forum.com/u/codecarpenter)\
**Replies:** 0\
**Last updated:** [June 28, 2007, 8:14pm UTC](https://www.ruby-forum.com/t/undefined-method-s-in-a-gcalapi-class/108060 "2007-06-28T20:14:51Z")

</div>

Hi, I am using the gcalapi v 0.1.0 library and ran into a error when I called the add action. It generated “NoMethodError in EventController#Add undefined method \`insert’ for GoogleCalendar::ServiceBase:Class” error…

---

## [Splitting a string](https://www.ruby-forum.com/t/splitting-a-string/108019)

<div class="topic-metadata">

**Author:** [@pappa-gottis](https://www.ruby-forum.com/u/pappa-gottis)\
**Replies:** 4\
**Last updated:** [June 28, 2007, 8:10pm UTC](https://www.ruby-forum.com/t/splitting-a-string/108019 "2007-06-28T20:10:14Z")

</div>

I’ve got a problem when trying to split a string after the thrid occurrence of a slash (’/’), I’m so used to java-thinking so I keep wanting to iterate through it and save the position of the third occurence and then …

---

## [{\*0} dumps core](https://www.ruby-forum.com/t/0-dumps-core/107943)

<div class="topic-metadata">

**Author:** [@Yusuke\_ENDOH](https://www.ruby-forum.com/u/Yusuke_ENDOH)\
**Replies:** 8\
**Last updated:** [June 28, 2007, 7:18pm UTC](https://www.ruby-forum.com/t/0-dumps-core/107943 "2007-06-28T19:18:00Z")

</div>

e$B1sF#$H?=$7$^$9!#e(B 1.9 e$B$G0J2\<$N$h$&$K$9$k$HMn$A$^$9!#e(B $ ./ruby -e ‘{\*0}’ – control frame ---------- c:0001 p:---- s:0001 b:-001 l:000000 d:000000 ------ – backtrace of native function call (Use addr2line) – …

---

## [Bad file descriptor error using Net::HTTP](https://www.ruby-forum.com/t/bad-file-descriptor-error-using-net-http/108034)

<div class="topic-metadata">

**Author:** [@unknown](https://www.ruby-forum.com/u/unknown)\
**Replies:** 3\
**Last updated:** [June 28, 2007, 7:08pm UTC](https://www.ruby-forum.com/t/bad-file-descriptor-error-using-net-http/108034 "2007-06-28T19:08:59Z")

</div>

I am trying to access a .net page via my ruby app and pass it a couple parameters. Every thing I have tried has resulted in this Bad file descriptor, I am wondering if it is something wrong with my configuration, not …

---

## [0..:" dumps core](https://www.ruby-forum.com/t/0-dumps-core/108050)

<div class="topic-metadata">

**Author:** [@Yusuke\_ENDOH](https://www.ruby-forum.com/u/Yusuke_ENDOH)\
**Replies:** 0\
**Last updated:** [June 28, 2007, 7:03pm UTC](https://www.ruby-forum.com/t/0-dumps-core/108050 "2007-06-28T19:03:58Z")

</div>

e$B1sF#$H?=$7$^$9!#e(B 1.8.6 e$B!"e(B1.9 e$B6&$K0J2\<$N$h$&$K$9$k$HMn$A$^$9!#e(B $ ./ruby -e ‘0…:"’ -e:1: unterminated string meets end of file -e:1: empty symbol literal -e:1: \[BUG\] Segmentation fault ruby 1.8.6 (2…

---

## [Need help posting a base64-encoded binary via xml-rpc](https://www.ruby-forum.com/t/need-help-posting-a-base64-encoded-binary-via-xml-rpc/108032)

<div class="topic-metadata">

**Author:** [@phildog](https://www.ruby-forum.com/u/phildog)\
**Replies:** 1\
**Last updated:** [June 28, 2007, 4:36pm UTC](https://www.ruby-forum.com/t/need-help-posting-a-base64-encoded-binary-via-xml-rpc/108032 "2007-06-28T16:36:42Z")

</div>

Hi folks. I’m trying to post a base64-encoded binary (an mp3 file) via xml-rpc. But it isn’t working. Everything seems to work but the resulting mp3 won’t play in my browser. I think the encoding is getting garbled so…

---

## [Ruby versus Java threading?](https://www.ruby-forum.com/t/ruby-versus-java-threading/108002)

<div class="topic-metadata">

**Author:** [@surf](https://www.ruby-forum.com/u/surf)\
**Replies:** 6\
**Last updated:** [June 28, 2007, 4:14pm UTC](https://www.ruby-forum.com/t/ruby-versus-java-threading/108002 "2007-06-28T16:14:39Z")

</div>

This paragraph is part of the Java Performance tunning newsletter someone sent to me. I’m curious what the article means in regards to threads. My Ruby book has a section on threads, but I’m not sure if threads in Jav…

---

## [Can i calculate the data number in array?](https://www.ruby-forum.com/t/can-i-calculate-the-data-number-in-array/108003)

<div class="topic-metadata">

**Author:** [@coolwong](https://www.ruby-forum.com/u/coolwong)\
**Replies:** 8\
**Last updated:** [June 28, 2007, 4:12pm UTC](https://www.ruby-forum.com/t/can-i-calculate-the-data-number-in-array/108003 "2007-06-28T16:12:39Z")

</div>

Array = \["a", "a", "a", "b", "b", â€œcâ€, "c", "c","d", "d", "e"\] Can i calculate the data in the Array??? a a a b b c c c d d e For example: ArrayNumber = \[“3”, “2”, “3”, “2”, “1”\]

---

## [Hash banging #! - Distributing precompiled sharable linux bi](https://www.ruby-forum.com/t/hash-banging-distributing-precompiled-sharable-linux-bi/107988)

<div class="topic-metadata">

**Author:** [@amin1426](https://www.ruby-forum.com/u/amin1426)\
**Replies:** 1\
**Last updated:** [June 28, 2007, 3:41pm UTC](https://www.ruby-forum.com/t/hash-banging-distributing-precompiled-sharable-linux-bi/107988 "2007-06-28T15:41:33Z")

</div>

This may, in a very odd set of circumstances, be useful to somebody… If you try interpret a #! script with another #! script it fails. (I wrote about this problem before…) http://tinyurl.com/287pez One fix is to use …

---

## [Processing rc file - critical comment asked](https://www.ruby-forum.com/t/processing-rc-file-critical-comment-asked/108029)

<div class="topic-metadata">

**Author:** [@ronaldfischer](https://www.ruby-forum.com/u/ronaldfischer)\
**Replies:** 0\
**Last updated:** [June 28, 2007, 3:17pm UTC](https://www.ruby-forum.com/t/processing-rc-file-critical-comment-asked/108029 "2007-06-28T15:17:28Z")

</div>

I have already a solution for my problem, but I would be glad if some kind soul could have a look on it and give suggestion for improvement… Problem: My application can be controled by a kind of “rc file”, specifying …

---

## [Re: IO.write problem on "raw" Windows](https://www.ruby-forum.com/t/re-io-write-problem-on-raw-windows/108028)

<div class="topic-metadata">

**Author:** [@stickstone](https://www.ruby-forum.com/u/stickstone)\
**Replies:** 0\
**Last updated:** [June 28, 2007, 3:11pm UTC](https://www.ruby-forum.com/t/re-io-write-problem-on-raw-windows/108028 "2007-06-28T15:11:28Z")

</div>

On Windows, when running “normal” ruby from a command prompt (Windows’ cmd.exe), it blocks on write. … The “other” program itself is working fine - it’s a simple echo-clone. I expect the other program is blocking,…

---

## [IO.write problem on "raw" Windows](https://www.ruby-forum.com/t/io-write-problem-on-raw-windows/108025)

<div class="topic-metadata">

**Author:** [@unknown](https://www.ruby-forum.com/u/unknown)\
**Replies:** 0\
**Last updated:** [June 28, 2007, 2:46pm UTC](https://www.ruby-forum.com/t/io-write-problem-on-raw-windows/108025 "2007-06-28T14:46:26Z")

</div>

Hi, I have a problem with the following code: prg = “c:\\path\\to\\some\\program” # for cmd prg = “/cygdrive/c/path/to/some/program” # for cygwin IO.popen(prg, “r+b”) do |pipe| File.open ARGV\[0\], ‘rb’ do |fin| pipe.writ…

---

## [Re: Regexp rescue method](https://www.ruby-forum.com/t/re-regexp-rescue-method/108009)

<div class="topic-metadata">

**Author:** [@stickstone](https://www.ruby-forum.com/u/stickstone)\
**Replies:** 0\
**Last updated:** [June 28, 2007, 11:38am UTC](https://www.ruby-forum.com/t/re-regexp-rescue-method/108009 "2007-06-28T11:38:56Z")

</div>

I can’t catch it even with rescue Object… wow. That’s not surprising. Malformed regexps are a parse time error. Parsing is what builds the Annotated Syntax Tree which Ruby runs. No Ruby code can be executed until …

---

## [Re: how to get data from database as string](https://www.ruby-forum.com/t/re-how-to-get-data-from-database-as-string/107927)

<div class="topic-metadata">

**Author:** [@stickstone](https://www.ruby-forum.com/u/stickstone)\
**Replies:** 4\
**Last updated:** [June 28, 2007, 11:07am UTC](https://www.ruby-forum.com/t/re-how-to-get-data-from-database-as-string/107927 "2007-06-28T11:07:53Z")

</div>

How can i read a cell from database and retrieve as a string in ruby with OCI8? There are working examples in the documentation at http://ruby-oci8.rubyforge.org/ Click on “ruby-oci8 API” on the left-hand side, e.g…

---

## [Change path for require](https://www.ruby-forum.com/t/change-path-for-require/108006)

<div class="topic-metadata">

**Author:** [@mihai](https://www.ruby-forum.com/u/mihai)\
**Replies:** 1\
**Last updated:** [June 28, 2007, 10:55am UTC](https://www.ruby-forum.com/t/change-path-for-require/108006 "2007-06-28T10:55:52Z")

</div>

how can i change the path for require? for example my script is in C:\\test and a have require ‘watir’ and i want to add another require to a file wich is in C:\\test\\tst\\requiered\_file.rb

---

## [Signal handler problem](https://www.ruby-forum.com/t/signal-handler-problem/107999)

<div class="topic-metadata">

**Author:** [@Nasir\_K](https://www.ruby-forum.com/u/Nasir_K)\
**Replies:** 0\
**Last updated:** [June 28, 2007, 8:52am UTC](https://www.ruby-forum.com/t/signal-handler-problem/107999 "2007-06-28T08:52:42Z")

</div>

Consider the snippet - #------------------------------ require ‘socket’ require ‘thread’ t = Thread.new do sock = UDPSocket.new sock.bind(“127.0.0.1”, 9000) 2.times do IO.select(\[sock\]) msg = sock.recvfrom\_nonbl…

---

## [Is there a ruby source code formatter?](https://www.ruby-forum.com/t/is-there-a-ruby-source-code-formatter/107954)

<div class="topic-metadata">

**Author:** [@vfcforums](https://www.ruby-forum.com/u/vfcforums)\
**Replies:** 4\
**Last updated:** [June 28, 2007, 8:17am UTC](https://www.ruby-forum.com/t/is-there-a-ruby-source-code-formatter/107954 "2007-06-28T08:17:35Z")

</div>

Is there a ruby source code formatter somewhere out there? My ruby code is looking pretty terrible as I chop and change here and there to get the code to work right. Something that can take a ruby file and output anot…

---

## [RCR: hybrid case expression](https://www.ruby-forum.com/t/rcr-hybrid-case-expression/107996)

<div class="topic-metadata">

**Author:** [@greg](https://www.ruby-forum.com/u/greg)\
**Replies:** 0\
**Last updated:** [June 28, 2007, 7:51am UTC](https://www.ruby-forum.com/t/rcr-hybrid-case-expression/107996 "2007-06-28T07:51:33Z")

</div>

I always use a case expression with the target/comparison style, but sometimes I find myself wanting to put in a condition. For example: while( arg=args.shift ) case arg\[0,2\] when /^-.$/ then short\_opts.push arg\[1…-1…

---

## [Copying files to remote machine](https://www.ruby-forum.com/t/copying-files-to-remote-machine/107973)

<div class="topic-metadata">

**Author:** [@enchanter](https://www.ruby-forum.com/u/enchanter)\
**Replies:** 1\
**Last updated:** [June 28, 2007, 7:26am UTC](https://www.ruby-forum.com/t/copying-files-to-remote-machine/107973 "2007-06-28T07:26:32Z")

</div>

Hey all, I’ve got a little script that is attempting to copy images to a remote server. The significant parts of the script were taken directly from recipe 14.11 in the ruby cookbook. relevant sections: directly f…

---

## [More Regexp and file load problems](https://www.ruby-forum.com/t/more-regexp-and-file-load-problems/107987)

<div class="topic-metadata">

**Author:** [@Don\_L](https://www.ruby-forum.com/u/Don_L)\
**Replies:** 2\
**Last updated:** [June 28, 2007, 7:24am UTC](https://www.ruby-forum.com/t/more-regexp-and-file-load-problems/107987 "2007-06-28T07:24:32Z")

</div>

Hi All, I am struggling here and would be most appreciative of any help. I have a regular expression problem I can’t seem to figure my way out of. I had sent a similar request this morning, and gratefully received tw…

---

## [Conditional jump or move depends on uninitialised value(s) i](https://www.ruby-forum.com/t/conditional-jump-or-move-depends-on-uninitialised-value-s-i/107991)

<div class="topic-metadata">

**Author:** [@Tanaka\_A](https://www.ruby-forum.com/u/Tanaka_A)\
**Replies:** 0\
**Last updated:** [June 28, 2007, 5:42am UTC](https://www.ruby-forum.com/t/conditional-jump-or-move-depends-on-uninitialised-value-s-i/107991 "2007-06-28T05:42:26Z")

</div>

valgrind e$B2\<$Ge(B StringIO.new(“a”).gets("\\n") e$B$H$9$k$H!"e(B strio\_getline e$B$Ge(B Conditional jump or move depends on uninitialised value(s) e$B$H$J$j$^$9!#e(B % valgrind ./ruby -rstringio -ve ‘StringIO.new(“a…

---

## [Getting an \<iframe\> in Watir](https://www.ruby-forum.com/t/getting-an-iframe-in-watir/107856)

<div class="topic-metadata">

**Author:** [@jack](https://www.ruby-forum.com/u/jack)\
**Replies:** 1\
**Last updated:** [June 28, 2007, 5:30am UTC](https://www.ruby-forum.com/t/getting-an-iframe-in-watir/107856 "2007-06-28T05:30:26Z")

</div>

I am new to Ruby and Watir. I need to access a frame (iframe) in a popup window and click a link in the frame. The frame tag is as follows: If I ie.show\_frames I get the following: there are 1 frames frame index: …

---

## [File permissions w/Dir.mkdir](https://www.ruby-forum.com/t/file-permissions-w-dir-mkdir/107985)

<div class="topic-metadata">

**Author:** [@john\_old](https://www.ruby-forum.com/u/john_old)\
**Replies:** 1\
**Last updated:** [June 28, 2007, 4:45am UTC](https://www.ruby-forum.com/t/file-permissions-w-dir-mkdir/107985 "2007-06-28T04:45:23Z")

</div>

In OS X 10.4.9, Ruby 1.8.4 when I use: Dir.mkdir(file\_name, 755) The directories created are drop-box, owner-only. It seems the Dir class expects the leading bit. So, it should be 0755 and not 755. When using: Dir.…

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

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