# Ruby

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

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

---

## [How to split an array in sub arrays of the same length](https://www.ruby-forum.com/t/how-to-split-an-array-in-sub-arrays-of-the-same-length/99099)

<div class="topic-metadata">

**Author:** [@faina](https://www.ruby-forum.com/u/faina)\
**Replies:** 13\
**Last updated:** [July 29, 2006, 9:02pm UTC](https://www.ruby-forum.com/t/how-to-split-an-array-in-sub-arrays-of-the-same-length/99099 "2006-07-29T21:02:08Z")

</div>

Hi, Is there a way to split an array in sub arrays of the same length, that is : \[ 1, 2, 3, 4, 5, 6, 7, 8 \].unknown\_function(3) that returns: \[ \[1, 2, 3\], \[4, 5, 6\], \[7, 8\] \] thanks in advance.

---

## [Wild ideas: Finding a missing 'end'](https://www.ruby-forum.com/t/wild-ideas-finding-a-missing-end/100463)

<div class="topic-metadata">

**Author:** [@Mat\_S](https://www.ruby-forum.com/u/Mat_S)\
**Replies:** 7\
**Last updated:** [July 29, 2006, 7:48pm UTC](https://www.ruby-forum.com/t/wild-ideas-finding-a-missing-end/100463 "2006-07-29T19:48:58Z")

</div>

I was just reading a nuby question from the rails list and I had this thought: class MyClass def foo if true end end This code generates a parse error at the last line. Now most languages do this, so it’s not a …

---

## [Webrick serving php pages?](https://www.ruby-forum.com/t/webrick-serving-php-pages/100502)

<div class="topic-metadata">

**Author:** [@quik77](https://www.ruby-forum.com/u/quik77)\
**Replies:** 2\
**Last updated:** [July 29, 2006, 7:35pm UTC](https://www.ruby-forum.com/t/webrick-serving-php-pages/100502 "2006-07-29T19:35:42Z")

</div>

I carry many .php pages, but I mostly write in Ruby these days. My question is if webrick could be used to serve php pages. Right now I use apache, but I want to be flexible and become less dependant on apache. (Actua…

---

## [About last night](https://www.ruby-forum.com/t/about-last-night/100295)

<div class="topic-metadata">

**Author:** [@MSEdward\_SEdS\_Bora](https://www.ruby-forum.com/u/MSEdward_SEdS_Bora)\
**Replies:** 31\
**Last updated:** [July 29, 2006, 6:45pm UTC](https://www.ruby-forum.com/t/about-last-night/100295 "2006-07-29T18:45:56Z")

</div>

Now that I have your attention :slight\_smile: … last night was FOSCON II – Ruby Rodeo. I was there, though not at OSCON. It was nice to meet folks like Jim W., David A. Black, Phil T., Amy Hoy, and nearly all of our n…

---

## [How can I parse binary files?](https://www.ruby-forum.com/t/how-can-i-parse-binary-files/98672)

<div class="topic-metadata">

**Author:** [@fabvit](https://www.ruby-forum.com/u/fabvit)\
**Replies:** 24\
**Last updated:** [July 29, 2006, 6:10pm UTC](https://www.ruby-forum.com/t/how-can-i-parse-binary-files/98672 "2006-07-29T18:10:39Z")

</div>

I’ve the need to parse a binary file with the following structure: How can I accomplish this in Ruby? Header (36 bytes): Version (4 byte unsigned integer) currently 1 UIDValidity (4 byte unsigned integer) UIDNext (4 …

---

## [Problems installing rubyzip gem on Debian...can someone help](https://www.ruby-forum.com/t/problems-installing-rubyzip-gem-on-debian-can-someone-help/98824)

<div class="topic-metadata">

**Author:** [@subimage](https://www.ruby-forum.com/u/subimage)\
**Replies:** 11\
**Last updated:** [July 29, 2006, 5:51pm UTC](https://www.ruby-forum.com/t/problems-installing-rubyzip-gem-on-debian-can-someone-help/98824 "2006-07-29T17:51:24Z")

</div>

I haven’t had issues with it before, but now I am…I go to install rubyzip via gems and I’m getting this on a fresh Debian box: -\> sudo gem install rubyzip Attempting local installation of ‘rubyzip’ Local gem file not…

---

## [String#chop slow? REALLY slow?](https://www.ruby-forum.com/t/string-chop-slow-really-slow/100198)

<div class="topic-metadata">

**Author:** [@Mat\_S](https://www.ruby-forum.com/u/Mat_S)\
**Replies:** 13\
**Last updated:** [July 29, 2006, 3:54pm UTC](https://www.ruby-forum.com/t/string-chop-slow-really-slow/100198 "2006-07-29T15:54:29Z")

</div>

I just did a quick benchmark to prove something to myself. But I’d like to get a sanity check from the people on the list. Basically I want to drop what will be a trailing “\\n” from input. But it appears that using S…

---

## [Ruby and Visual Basic](https://www.ruby-forum.com/t/ruby-and-visual-basic/100144)

<div class="topic-metadata">

**Author:** [@ike](https://www.ruby-forum.com/u/ike)\
**Replies:** 12\
**Last updated:** [July 29, 2006, 3:48pm UTC](https://www.ruby-forum.com/t/ruby-and-visual-basic/100144 "2006-07-29T15:48:20Z")

</div>

Some years ago I wrote a magazine review regarding Visual Basic. At the time I was informed by Microsoft that it was modelled after an earlier incarnation of a program called “Ruby,” by a fellow named Alan Cooper. Wo…

---

## [Ruby::Tk on OS X event binding hint](https://www.ruby-forum.com/t/ruby-tk-on-os-x-event-binding-hint/100347)

<div class="topic-metadata">

**Author:** [@Morton\_G](https://www.ruby-forum.com/u/Morton_G)\
**Replies:** 10\
**Last updated:** [July 29, 2006, 3:29pm UTC](https://www.ruby-forum.com/t/ruby-tk-on-os-x-event-binding-hint/100347 "2006-07-29T15:29:42Z")

</div>

On Macintosh OS X, one can use ‘Command’ and ‘Option’ as Tk event type modifiers to get Command and Option key shortcuts. For example, Tk.root.bind('Command-q') {exit} Tk.root.bind('Command-Q') {exit} will give the no…

---

## [How to solve Windows PATH in Ruby?](https://www.ruby-forum.com/t/how-to-solve-windows-path-in-ruby/100137)

<div class="topic-metadata">

**Author:** [@zdk](https://www.ruby-forum.com/u/zdk)\
**Replies:** 4\
**Last updated:** [July 29, 2006, 3:26pm UTC](https://www.ruby-forum.com/t/how-to-solve-windows-path-in-ruby/100137 "2006-07-29T15:26:31Z")

</div>

require ‘pathname’ p = Pathname.new(“C:\\ruby\\samples\\myFile”) dir = p.dirname base = p.basename puts base I just like to use “myFile”,but p.basename seems not work on Windows Platform. How to solve this kind of p…

---

## [Ruby comprehensive "slow" reference](https://www.ruby-forum.com/t/ruby-comprehensive-slow-reference/100489)

<div class="topic-metadata">

**Author:** [@leslieviljoen](https://www.ruby-forum.com/u/leslieviljoen)\
**Replies:** 2\
**Last updated:** [July 29, 2006, 1:30pm UTC](https://www.ruby-forum.com/t/ruby-comprehensive-slow-reference/100489 "2006-07-29T13:30:39Z")

</div>

Hi! I tried to find online explanations for the ‘%’ and ‘?’ operators used by Florian in an earlier post, but could not. The closest I saw were quick-references, but is there a comprehensive “slow” reference anywhere…

---

## [Bug in ruby printf/sprintf](https://www.ruby-forum.com/t/bug-in-ruby-printf-sprintf/100419)

<div class="topic-metadata">

**Author:** [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Replies:** 4\
**Last updated:** [July 29, 2006, 11:40am UTC](https://www.ruby-forum.com/t/bug-in-ruby-printf-sprintf/100419 "2006-07-29T11:40:50Z")

</div>

I have encountered what appears to be a bug in ruby’s printf/sprintf This code: str = “test” printf “|%010s|”, str Generates this output: | test| However in C and perl, the same code generates this output: |0…

---

## [Puts bypasses access restrictions on to\_s?](https://www.ruby-forum.com/t/puts-bypasses-access-restrictions-on-to-s/100452)

<div class="topic-metadata">

**Author:** [@leslieviljoen](https://www.ruby-forum.com/u/leslieviljoen)\
**Replies:** 3\
**Last updated:** [July 29, 2006, 11:22am UTC](https://www.ruby-forum.com/t/puts-bypasses-access-restrictions-on-to-s/100452 "2006-07-29T11:22:25Z")

</div>

I read somewhere that “puts” calls “to\_s” on an object to get a string representation and then displays that. This seems to be correct in my experience. My question is: how does puts bypass “private” restrictions to g…

---

## [Using a '-' in a Key name in a Hash](https://www.ruby-forum.com/t/using-a-in-a-key-name-in-a-hash/100377)

<div class="topic-metadata">

**Author:** [@andrewkendall](https://www.ruby-forum.com/u/andrewkendall)\
**Replies:** 12\
**Last updated:** [July 29, 2006, 9:23am UTC](https://www.ruby-forum.com/t/using-a-in-a-key-name-in-a-hash/100377 "2006-07-29T09:23:06Z")

</div>

Hi, This a ruby question but it comes up in the context of Rails, hope that is OK. I am trying to to consume a web service that has a structure element called ‘remote-ip’. (as below) result = server.call(“IsValid”, …

---

## [Debug history, a la irb/ext/save-history](https://www.ruby-forum.com/t/debug-history-a-la-irb-ext-save-history/100476)

<div class="topic-metadata">

**Author:** [@chrismalek](https://www.ruby-forum.com/u/chrismalek)\
**Replies:** 0\
**Last updated:** [July 29, 2006, 6:13am UTC](https://www.ruby-forum.com/t/debug-history-a-la-irb-ext-save-history/100476 "2006-07-29T06:13:14Z")

</div>

Having just now stumbled across setting up .irbrc to store IRB history – is there something similar for the debug module? Such that in between debug sessions I can access previous commands issued in the last session? …

---

## [Rails in Fink](https://www.ruby-forum.com/t/rails-in-fink/100466)

<div class="topic-metadata">

**Author:** [@brahn](https://www.ruby-forum.com/u/brahn)\
**Replies:** 0\
**Last updated:** [July 29, 2006, 4:43am UTC](https://www.ruby-forum.com/t/rails-in-fink/100466 "2006-07-29T04:43:00Z")

</div>

I went to OSCON this week, and after all the great stuff on RoR I just had to play with it more than the little I’d tried when 1.0 came out. I was surprised to see it still wasn’t in Fink, so I went ahead and package…

---

## [Drb-ssl question](https://www.ruby-forum.com/t/drb-ssl-question/100052)

<div class="topic-metadata">

**Author:** [@Ryan\_McGovern](https://www.ruby-forum.com/u/Ryan_McGovern)\
**Replies:** 2\
**Last updated:** [July 29, 2006, 4:07am UTC](https://www.ruby-forum.com/t/drb-ssl-question/100052 "2006-07-29T04:07:54Z")

</div>

I want to have a drb server that uses the drb-ssl library automatically start up on boot. To do this i need a program that can provide the password into the prompt. I’ve tried all combanations of pipes into the drb p…

---

## [How to debug 'ri'?](https://www.ruby-forum.com/t/how-to-debug-ri/99603)

<div class="topic-metadata">

**Author:** [@Harold\_H](https://www.ruby-forum.com/u/Harold_H)\
**Replies:** 2\
**Last updated:** [July 29, 2006, 4:07am UTC](https://www.ruby-forum.com/t/how-to-debug-ri/99603 "2006-07-29T04:07:42Z")

</div>

I’m seeing this all of a sudden: C:\>ri Dir c:/ruby/lib/ruby/1.8/rdoc/ri/ri\_descriptions.rb:99:in concat': can't convert nil into Array (TypeError) from c:/ruby/lib/ruby/1.8/rdoc/ri/ri\_descriptions.rb:99:inmerge\_in’ fr…

---

## [Require\_gem question](https://www.ruby-forum.com/t/require-gem-question/99982)

<div class="topic-metadata">

**Author:** [@esquilax](https://www.ruby-forum.com/u/esquilax)\
**Replies:** 1\
**Last updated:** [July 29, 2006, 4:04am UTC](https://www.ruby-forum.com/t/require-gem-question/99982 "2006-07-29T04:04:32Z")

</div>

Does require\_gem also load all of the listed dependencies in the gem spec or are those dependencies loaded by manually through require statements? so example: require\_gem ‘rails’ the rails gem has: actionwebservice …

---

## [Micro authoritative dns server](https://www.ruby-forum.com/t/micro-authoritative-dns-server/99488)

<div class="topic-metadata">

**Author:** [@unknown](https://www.ruby-forum.com/u/unknown)\
**Replies:** 2\
**Last updated:** [July 29, 2006, 3:57am UTC](https://www.ruby-forum.com/t/micro-authoritative-dns-server/99488 "2006-07-29T03:57:39Z")

</div>

Hi, I’m new in ruby. I know that there is a class called Resolv.rb for writing dns servers, but it’s not well documented. I just want to know if anyone could help me in writing a code for minimal authoritative dns se…

---

## [RubyConf 2006 registration pre-info](https://www.ruby-forum.com/t/rubyconf-2006-registration-pre-info/100351)

<div class="topic-metadata">

**Author:** [@unknown](https://www.ruby-forum.com/u/unknown)\
**Replies:** 8\
**Last updated:** [July 29, 2006, 3:48am UTC](https://www.ruby-forum.com/t/rubyconf-2006-registration-pre-info/100351 "2006-07-29T03:48:11Z")

</div>

Hi – Here’s the current status of RubyConf registration: My current plan, barring unforeseen whatever, is to open registration on August 2. I’m going to be in Los A. doing Rails training, so it’s a bit dependent on …

---

## [PDF::Writer memory error](https://www.ruby-forum.com/t/pdf-writer-memory-error/100218)

<div class="topic-metadata">

**Author:** [@john\_sikorski](https://www.ruby-forum.com/u/john_sikorski)\
**Replies:** 2\
**Last updated:** [July 29, 2006, 3:07am UTC](https://www.ruby-forum.com/t/pdf-writer-memory-error/100218 "2006-07-29T03:07:52Z")

</div>

I’m trying to use PDF::Writer to generate a PDF version of a phone list but I’m having out of memory problems. The document is formatted for 2 column output. I originally added all names (about 500) to a single fou…

---

## [What to use binding for?](https://www.ruby-forum.com/t/what-to-use-binding-for/100273)

<div class="topic-metadata">

**Author:** [@liquid](https://www.ruby-forum.com/u/liquid)\
**Replies:** 3\
**Last updated:** [July 29, 2006, 2:58am UTC](https://www.ruby-forum.com/t/what-to-use-binding-for/100273 "2006-07-29T02:58:22Z")

</div>

Hi everyone, There was a post a couple of days ago that included a call to binding I was interested in this and went to look up the binding docs. All good, it seems simple enough, but I can’t think of how to use it. …

---

## [(no subject)](https://www.ruby-forum.com/t/no-subject/100462)

<div class="topic-metadata">

**Author:** [@daborg69](https://www.ruby-forum.com/u/daborg69)\
**Replies:** 0\
**Last updated:** [July 29, 2006, 2:35am UTC](https://www.ruby-forum.com/t/no-subject/100462 "2006-07-29T02:35:58Z")

</div>

matome 17

---

## [Finding "\\" in a string](https://www.ruby-forum.com/t/finding-in-a-string/100434)

<div class="topic-metadata">

**Author:** [@xmg-eric](https://www.ruby-forum.com/u/xmg-eric)\
**Replies:** 18\
**Last updated:** [July 29, 2006, 2:29am UTC](https://www.ruby-forum.com/t/finding-in-a-string/100434 "2006-07-29T02:29:48Z")

</div>

I’m going crazy, right? Surely it is possible to find a backslash () in a string, and replace it with two backslashes. That’s simple, right? Just gsub("\\", ‘\\’). That’s all there is to it. Except that… #!/usr/bin/e…

---

## [Ruby/Tk code critique](https://www.ruby-forum.com/t/ruby-tk-code-critique/100418)

<div class="topic-metadata">

**Author:** [@rube](https://www.ruby-forum.com/u/rube)\
**Replies:** 1\
**Last updated:** [July 29, 2006, 12:46am UTC](https://www.ruby-forum.com/t/ruby-tk-code-critique/100418 "2006-07-29T00:46:57Z")

</div>

I have a bunch of Tk buttons tied to code. They’re wrapped in an array to process later. What I’d like to do is set each one to have a visual indicator that it was used. So after it’s clicked, it gets configured to ha…

---

## [Calling a task in rant at any time (not just as a prerequisi](https://www.ruby-forum.com/t/calling-a-task-in-rant-at-any-time-not-just-as-a-prerequisi/100444)

<div class="topic-metadata">

**Author:** [@bwv549](https://www.ruby-forum.com/u/bwv549)\
**Replies:** 1\
**Last updated:** [July 29, 2006, 12:43am UTC](https://www.ruby-forum.com/t/calling-a-task-in-rant-at-any-time-not-just-as-a-prerequisi/100444 "2006-07-29T00:43:23Z")

</div>

In rant, we call a task by denoting it as a dependancy: task :test =\> \[:build\] do # calls :build before :test -whatever- end How do you call a task at the end of (or inside) a block? task :myaction do -some acti…

---

## [Re: does ":" have an anolog in another language?](https://www.ruby-forum.com/t/re-does-have-an-anolog-in-another-language/100448)

<div class="topic-metadata">

**Author:** [@unknown](https://www.ruby-forum.com/u/unknown)\
**Replies:** 0\
**Last updated:** [July 28, 2006, 11:43pm UTC](https://www.ruby-forum.com/t/re-does-have-an-anolog-in-another-language/100448 "2006-07-28T23:43:11Z")

</div>

\-------------- Original message ---------------------- From: removed\_email\_address@domain.invalid there’s no direct semantic connection to your variable called ‘a’. Well, that just makes it even more like Lisp than I…

---

## [Weird problem with case expressions](https://www.ruby-forum.com/t/weird-problem-with-case-expressions/100341)

<div class="topic-metadata">

**Author:** [@dasch](https://www.ruby-forum.com/u/dasch)\
**Replies:** 14\
**Last updated:** [July 28, 2006, 11:11pm UTC](https://www.ruby-forum.com/t/weird-problem-with-case-expressions/100341 "2006-07-28T23:11:11Z")

</div>

I have no problem doing this: if foo :bar then … end Yet when I do this: case “foo” when bar :baz then “bur” end I get the following syntax error: SyntaxError: compile error (irb):30: parse error, unexpected tS…

---

## [Regex for whitespace plus vertical bar](https://www.ruby-forum.com/t/regex-for-whitespace-plus-vertical-bar/100445)

<div class="topic-metadata">

**Author:** [@rlorimor](https://www.ruby-forum.com/u/rlorimor)\
**Replies:** 4\
**Last updated:** [July 28, 2006, 11:10pm UTC](https://www.ruby-forum.com/t/regex-for-whitespace-plus-vertical-bar/100445 "2006-07-28T23:10:59Z")

</div>

I am trying to quote arguments that have whitespace or a pipe (vertical bar character = | ) in them. Why doesn’t this work? What does work? if arg.index(/\[\\s|\]/) … end

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

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