# Ruby

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

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

---

## [Array element access](https://www.ruby-forum.com/t/array-element-access/54681)

<div class="topic-metadata">

**Author:** [@tomas](https://www.ruby-forum.com/u/tomas)\
**Replies:** 14\
**Last updated:** [March 14, 2006, 2:10am UTC](https://www.ruby-forum.com/t/array-element-access/54681 "2006-03-14T02:10:54Z")

</div>

Hi, I’ve got an array a= \[1,2,3,4,5,6\] and want to access each second element: b=\[2,4,6\]. How is this done in ruby? I know, that I can use a for-loob and modulo operator, but I think there is a “ruby way” of doing t…

---

## [Formatting dates and times](https://www.ruby-forum.com/t/formatting-dates-and-times/54767)

<div class="topic-metadata">

**Author:** [@rtilley](https://www.ruby-forum.com/u/rtilley)\
**Replies:** 4\
**Last updated:** [March 14, 2006, 2:04am UTC](https://www.ruby-forum.com/t/formatting-dates-and-times/54767 "2006-03-14T02:04:50Z")

</div>

In Python, I do this to format date and time in a certain fashion. q = time.strftime(’%Y-%m-%d’, time.localtime()) r = time.strftime(’%H:%M:%S’, time.localtime()) I am formatting by YYYY-MM-DD and HH:MM:SS (I keep das…

---

## [Python a hungrier beast than Ruby?](https://www.ruby-forum.com/t/python-a-hungrier-beast-than-ruby/54649)

<div class="topic-metadata">

**Author:** [@baalbek](https://www.ruby-forum.com/u/baalbek)\
**Replies:** 7\
**Last updated:** [March 14, 2006, 1:15am UTC](https://www.ruby-forum.com/t/python-a-hungrier-beast-than-ruby/54649 "2006-03-14T01:15:05Z")

</div>

I have tested two implementations of wxRuby/wxPython applications (stock price data displayed as a simple graph, and as candlesticks). The Python implementation only showed graphs from one company, while the Ruby impl…

---

## [Looking for Rake C code building examples with multiple plat](https://www.ruby-forum.com/t/looking-for-rake-c-code-building-examples-with-multiple-plat/81562)

<div class="topic-metadata">

**Author:** [@Stuart\_Hungerford](https://www.ruby-forum.com/u/Stuart_Hungerford)\
**Replies:** 0\
**Last updated:** [March 14, 2006, 1:15am UTC](https://www.ruby-forum.com/t/looking-for-rake-c-code-building-examples-with-multiple-plat/81562 "2006-03-14T01:15:05Z")

</div>

Hi, I’m currently using Rake to manage the building of a smallish C library and associated C programs. There’s some nice C building tutorials on Jim W.'s site but I need to be able to build multiple versions of the l…

---

## [Rake best practices for managing multi-directory project?](https://www.ruby-forum.com/t/rake-best-practices-for-managing-multi-directory-project/54763)

<div class="topic-metadata">

**Author:** [@Stuart\_Hungerford](https://www.ruby-forum.com/u/Stuart_Hungerford)\
**Replies:** 0\
**Last updated:** [March 14, 2006, 1:09am UTC](https://www.ruby-forum.com/t/rake-best-practices-for-managing-multi-directory-project/54763 "2006-03-14T01:09:01Z")

</div>

Hi, I’m currently working on a project with a number of “modules” in different directories. I’m using Rake to manage the running of the module services in the correct order. I have a directory structure something li…

---

## [Soon I will have teh 64-bit words](https://www.ruby-forum.com/t/soon-i-will-have-teh-64-bit-words/81533)

<div class="topic-metadata">

**Author:** [@Asfand\_Yar\_Q](https://www.ruby-forum.com/u/Asfand_Yar_Q)\
**Replies:** 0\
**Last updated:** [March 14, 2006, 12:37am UTC](https://www.ruby-forum.com/t/soon-i-will-have-teh-64-bit-words/81533 "2006-03-14T00:37:42Z")

</div>

Hi. I’m starting work - at last! Time to put together than Athlon 64 X2 3800+ system I’ve been promising myself. Now that one shall have 63-bit FixNums, here is what one want to know: is there a way to simulate 31…

---

## [Soon I will have teh 64-bit words](https://www.ruby-forum.com/t/soon-i-will-have-teh-64-bit-words/54754)

<div class="topic-metadata">

**Author:** [@Asfand\_Yar\_Q](https://www.ruby-forum.com/u/Asfand_Yar_Q)\
**Replies:** 0\
**Last updated:** [March 14, 2006, 12:34am UTC](https://www.ruby-forum.com/t/soon-i-will-have-teh-64-bit-words/54754 "2006-03-14T00:34:22Z")

</div>

Hi. I’m starting work - at last! Time to put together than Athlon 64 X2 3800+ system I’ve been promising myself. Now that one shall have 63-bit FixNums, here is what one wants to know: is there a way to simulate 3…

---

## [Wrapping XML document in Class](https://www.ruby-forum.com/t/wrapping-xml-document-in-class/54736)

<div class="topic-metadata">

**Author:** [@Miles\_Monroe](https://www.ruby-forum.com/u/Miles_Monroe)\
**Replies:** 6\
**Last updated:** [March 14, 2006, 12:12am UTC](https://www.ruby-forum.com/t/wrapping-xml-document-in-class/54736 "2006-03-14T00:12:46Z")

</div>

I would like to use Ruby and REXML to wrap an XML document and allow access to the element nodes, attributes, and text. Essentially I need an XML document builder loosely coupled from the document. It seems like Ruby…

---

## [Posting to an http server using pre-1.8.2 Ruby](https://www.ruby-forum.com/t/posting-to-an-http-server-using-pre-1-8-2-ruby/81506)

<div class="topic-metadata">

**Author:** [@dandante](https://www.ruby-forum.com/u/dandante)\
**Replies:** 0\
**Last updated:** [March 13, 2006, 11:38pm UTC](https://www.ruby-forum.com/t/posting-to-an-http-server-using-pre-1-8-2-ruby/81506 "2006-03-13T23:38:54Z")

</div>

Hello, How do I send data to an http server using POST and basic authentication in Ruby 1.8.2? I know the easy answer is, upgrade to the latest version of Ruby and use Net::HTTP:post\_form(). However, I am stuck with…

---

## [Quickest way to do this string op](https://www.ruby-forum.com/t/quickest-way-to-do-this-string-op/80336)

<div class="topic-metadata">

**Author:** [@unknown](https://www.ruby-forum.com/u/unknown)\
**Replies:** 3\
**Last updated:** [March 13, 2006, 10:20pm UTC](https://www.ruby-forum.com/t/quickest-way-to-do-this-string-op/80336 "2006-03-13T22:20:29Z")

</div>

What’s the quickest way to turn “BOCA RATON” into “Boca Raton”?

---

## [Alias\_method 'stickiness'](https://www.ruby-forum.com/t/alias-method-stickiness/80175)

<div class="topic-metadata">

**Author:** [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Replies:** 4\
**Last updated:** [March 13, 2006, 9:54pm UTC](https://www.ruby-forum.com/t/alias-method-stickiness/80175 "2006-03-13T21:54:27Z")

</div>

any idea if this behaviour is intended or not? mussel:~/eg/ruby/nrtlib/nrtlib-0.0.0 \> cat a.rb the problem module NRT class Subscription def process\_incoming raise NotImplementedError end al…

---

## [Re: FileTest.size \> 2GB?](https://www.ruby-forum.com/t/re-filetest-size-2gb/81462)

<div class="topic-metadata">

**Author:** [@BergerS\_Daniel](https://www.ruby-forum.com/u/BergerS_Daniel)\
**Replies:** 0\
**Last updated:** [March 13, 2006, 9:47pm UTC](https://www.ruby-forum.com/t/re-filetest-size-2gb/81462 "2006-03-13T21:47:22Z")

</div>

Daniel B. wrote: Yes, use win32-file, available on the RAA. Daniel, you are the hero of Ruby users on Windows. Dave. Heh, thanks. :slight\_smile: The long version of this is that win32-file uses GetFileSizeEx() b…

---

## [Re: FileTest.size \> 2GB?](https://www.ruby-forum.com/t/re-filetest-size-2gb/80421)

<div class="topic-metadata">

**Author:** [@BergerS\_Daniel](https://www.ruby-forum.com/u/BergerS_Daniel)\
**Replies:** 1\
**Last updated:** [March 13, 2006, 9:29pm UTC](https://www.ruby-forum.com/t/re-filetest-size-2gb/80421 "2006-03-13T21:29:51Z")

</div>

having problems with FileTest.size and files \> 2GB. Seems it doesn’t return a Bignum for them, but a (wrapped) Fixnum. For a 3GB File, thats a “size” of -1GB. Is there something I can do about it? Is there an alterna…

---

## [The benefits of tail recursion](https://www.ruby-forum.com/t/the-benefits-of-tail-recursion/80302)

<div class="topic-metadata">

**Author:** [@timothy\_g](https://www.ruby-forum.com/u/timothy_g)\
**Replies:** 7\
**Last updated:** [March 13, 2006, 8:55pm UTC](https://www.ruby-forum.com/t/the-benefits-of-tail-recursion/80302 "2006-03-13T20:55:12Z")

</div>

I thought I’d share a useful little trick with the list. I’ve put together a little library (27 lines for the actual implementation) that can convert any function into a partially tail-recursive function, without any …

---

## [Test::Unit mixup](https://www.ruby-forum.com/t/test-unit-mixup/54733)

<div class="topic-metadata">

**Author:** [@wksmall](https://www.ruby-forum.com/u/wksmall)\
**Replies:** 1\
**Last updated:** [March 13, 2006, 8:46pm UTC](https://www.ruby-forum.com/t/test-unit-mixup/54733 "2006-03-13T20:46:07Z")

</div>

Suddenly test::unit is failing for me. The following 2-line script comes up with “testu.rb:2: undefined method \`assert’ for main:Object (NoMethodError)” testu.rb contains: 1: require ‘test/unit’ 2: assert(1==1) Wh…

---

## [How do I post to a form (http) in Ruby 1.8.2?](https://www.ruby-forum.com/t/how-do-i-post-to-a-form-http-in-ruby-1-8-2/54732)

<div class="topic-metadata">

**Author:** [@dandante](https://www.ruby-forum.com/u/dandante)\
**Replies:** 0\
**Last updated:** [March 13, 2006, 8:39pm UTC](https://www.ruby-forum.com/t/how-do-i-post-to-a-form-http-in-ruby-1-8-2/54732 "2006-03-13T20:39:43Z")

</div>

Hi all, How do I do the equivalent of Net::HTTP.post\_form() in Ruby 1.8.2? (This method was not implemented until 1.8.3). This might seem like a strange question but bear with me. Though our production server is runn…

---

## [Ruby equivalent for PHP's strtr?](https://www.ruby-forum.com/t/ruby-equivalent-for-phps-strtr/80065)

<div class="topic-metadata">

**Author:** [@Jeroen\_Heijmans](https://www.ruby-forum.com/u/Jeroen_Heijmans)\
**Replies:** 3\
**Last updated:** [March 13, 2006, 8:21pm UTC](https://www.ruby-forum.com/t/ruby-equivalent-for-phps-strtr/80065 "2006-03-13T20:21:25Z")

</div>

Hi, I’m looking for a function that can do the same thing as the strtr function in PHP (and possibly other languages, I don’t know). That is, I would like to replace multiple parts of a strings simultaneously, so that…

---

## [Running windows shell command](https://www.ruby-forum.com/t/running-windows-shell-command/78098)

<div class="topic-metadata">

**Author:** [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Replies:** 13\
**Last updated:** [March 13, 2006, 7:20pm UTC](https://www.ruby-forum.com/t/running-windows-shell-command/78098 "2006-03-13T19:20:37Z")

</div>

Hi all, Sorry for my english, I’m french. I have some problem running an xcopy command with paths that contains spaces. I’m trying that : output = cmd /c xcopy /r /y \\"C:/Test A\\" \\"C:/Test B\\" Xcopy doesn’t return…

---

## [Init Script Installer](https://www.ruby-forum.com/t/init-script-installer/54687)

<div class="topic-metadata">

**Author:** [@zdennis](https://www.ruby-forum.com/u/zdennis)\
**Replies:** 4\
**Last updated:** [March 13, 2006, 7:17pm UTC](https://www.ruby-forum.com/t/init-script-installer/54687 "2006-03-13T19:17:29Z")

</div>

I’ve got a few scripts which need to run as system daemons. For a while it worked to just manually start them, but it soon became annoying, so I wrote a little script to create and install the init scripts for me. Her…

---

## [What's the best way to split this kind of string?](https://www.ruby-forum.com/t/whats-the-best-way-to-split-this-kind-of-string/80220)

<div class="topic-metadata">

**Author:** [@ssk](https://www.ruby-forum.com/u/ssk)\
**Replies:** 5\
**Last updated:** [March 13, 2006, 6:50pm UTC](https://www.ruby-forum.com/t/whats-the-best-way-to-split-this-kind-of-string/80220 "2006-03-13T18:50:02Z")

</div>

Hi! I’m trying to make a routine to make a Morris Number Sequence. (http://www.ocf.berkeley.edu/~stoll/number\_sequence.html) I need to split a string in the following way, for example. “111223133” =\> \[“111”, “22”, “3…

---

## [Simple one-liners: last line missing](https://www.ruby-forum.com/t/simple-one-liners-last-line-missing/54718)

<div class="topic-metadata">

**Author:** [@Tobi\_R](https://www.ruby-forum.com/u/Tobi_R)\
**Replies:** 5\
**Last updated:** [March 13, 2006, 6:40pm UTC](https://www.ruby-forum.com/t/simple-one-liners-last-line-missing/54718 "2006-03-13T18:40:55Z")

</div>

Hi Let’s say I’d want to modify each line of a file. Here’s the dummy data: $ cat data.txt first foo second foo third foo $ This works: $ ruby -ne ‘$\_ =~ /(\\S+)\\s+(\\S+)/;puts “#{$2} #{$1}”’ data.txt foo first …

---

## [Looking for good reads on Ruby TK GUI programming](https://www.ruby-forum.com/t/looking-for-good-reads-on-ruby-tk-gui-programming/78542)

<div class="topic-metadata">

**Author:** [@rubyman](https://www.ruby-forum.com/u/rubyman)\
**Replies:** 16\
**Last updated:** [March 13, 2006, 6:19pm UTC](https://www.ruby-forum.com/t/looking-for-good-reads-on-ruby-tk-gui-programming/78542 "2006-03-13T18:19:11Z")

</div>

Hello, Could anyone suggest any good examples, articles, books, etc. for Ruby TK GUI programming with particular emphasis on multi-screen/window GUI applications? For example, someone is working on one window, clicks…

---

## [Broken pack/unpack workaround](https://www.ruby-forum.com/t/broken-pack-unpack-workaround/80416)

<div class="topic-metadata">

**Author:** [@Hans\_F](https://www.ruby-forum.com/u/Hans_F)\
**Replies:** 2\
**Last updated:** [March 13, 2006, 5:54pm UTC](https://www.ruby-forum.com/t/broken-pack-unpack-workaround/80416 "2006-03-13T17:54:45Z")

</div>

Array#pack and String#unpack are broken on OS X Tiger’s ruby build. This is known. I’m writing a lib where pack and unpack are used extensively and would like to provide a workaround. Does anyone have such a workaroun…

---

## [Recursive line counter (review?)](https://www.ruby-forum.com/t/recursive-line-counter-review/80375)

<div class="topic-metadata">

**Author:** [@Thibaut\_BarrSSSSre](https://www.ruby-forum.com/u/Thibaut_BarrSSSSre)\
**Replies:** 3\
**Last updated:** [March 13, 2006, 5:42pm UTC](https://www.ruby-forum.com/t/recursive-line-counter-review/80375 "2006-03-13T17:42:29Z")

</div>

Hi I’m practicing ruby everyday on small tools to learn more, could anyone review what I’ve coded today ? This is a basic line of code counter (pure ruby), any feedback welcome! thanks ! Thibaut def loc\_file(file) …

---

## [Re: Integer(nil) and checking numericality](https://www.ruby-forum.com/t/re-integer-nil-and-checking-numericality/54711)

<div class="topic-metadata">

**Author:** [@BergerS\_Daniel](https://www.ruby-forum.com/u/BergerS_Daniel)\
**Replies:** 0\
**Last updated:** [March 13, 2006, 5:36pm UTC](https://www.ruby-forum.com/t/re-integer-nil-and-checking-numericality/54711 "2006-03-13T17:36:01Z")

</div>

\-----Original Message----- From: removed\_email\_address@domain.invalid \[mailto:removed\_email\_address@domain.invalid\] Sent: Thursday, March 09, 2006 8:19 PM To: ruby-talk ML Subject: Integer(nil) and checking numerica…

---

## [Ruby 1.8.4 One-Click Installer](https://www.ruby-forum.com/t/ruby-1-8-4-one-click-installer/54680)

<div class="topic-metadata">

**Author:** [@gregarican](https://www.ruby-forum.com/u/gregarican)\
**Replies:** 3\
**Last updated:** [March 13, 2006, 4:19pm UTC](https://www.ruby-forum.com/t/ruby-1-8-4-one-click-installer/54680 "2006-03-13T16:19:10Z")

</div>

I just wanted to say good job for the folks responsible for the integrated IRB and Ruby help app that’s bundled with the Ruby 1.8.4 One-Click Installer. This app is a great resource so folks can browse the various cla…

---

## [Svn pre-commit hook](https://www.ruby-forum.com/t/svn-pre-commit-hook/79707)

<div class="topic-metadata">

**Author:** [@Bil\_K](https://www.ruby-forum.com/u/Bil_K)\
**Replies:** 4\
**Last updated:** [March 13, 2006, 4:16pm UTC](https://www.ruby-forum.com/t/svn-pre-commit-hook/79707 "2006-03-13T16:16:04Z")

</div>

OK, I give up. Can someone (Kou?) please sketch out how to intercept a Subversion transaction with a pre-commit hook and throw each file matching, say, /.rb$/ to some StyleChecker? Based on Kou’s svnlook, https://sv…

---

## [FileTest.size \> 2GB?](https://www.ruby-forum.com/t/filetest-size-2gb/80093)

<div class="topic-metadata">

**Author:** [@manuelkiessling](https://www.ruby-forum.com/u/manuelkiessling)\
**Replies:** 1\
**Last updated:** [March 13, 2006, 3:23pm UTC](https://www.ruby-forum.com/t/filetest-size-2gb/80093 "2006-03-13T15:23:37Z")

</div>

Hello, I’m using “ruby 1.8.4 (2005-12-24) \[i386-mswin32\]” and I’m having problems with FileTest.size and files \> 2GB. Seems it doesn’t return a Bignum for them, but a (wrapped) Fixnum. For a 3GB File, thats a “size” …

---

## [Newbie question about mkmf and dir\_config](https://www.ruby-forum.com/t/newbie-question-about-mkmf-and-dir-config/79993)

<div class="topic-metadata">

**Author:** [@Ralph\_Kon](https://www.ruby-forum.com/u/Ralph_Kon)\
**Replies:** 1\
**Last updated:** [March 13, 2006, 3:20pm UTC](https://www.ruby-forum.com/t/newbie-question-about-mkmf-and-dir-config/79993 "2006-03-13T15:20:36Z")

</div>

Please help a beginner! I’m trying to write my first c-extension, and I don’t understand the dir\_config command. I need to include 2 .h headers and a library for some equipment. Does the ‘name’ in dir\_config(‘name’) …

---

## [Re: Quickest way to do this string op](https://www.ruby-forum.com/t/re-quickest-way-to-do-this-string-op/54703)

<div class="topic-metadata">

**Author:** [@KroegerS\_Simon\_Sext](https://www.ruby-forum.com/u/KroegerS_Simon_Sext)\
**Replies:** 5\
**Last updated:** [March 13, 2006, 3:20pm UTC](https://www.ruby-forum.com/t/re-quickest-way-to-do-this-string-op/54703 "2006-03-13T15:20:35Z")

</div>

“BOCA RATON”.replace “Boca Raton” # :stuck\_out\_tongue: Probably “BOCA RATON”.split(/\\b/).map{|s| s.capitalize }.join It is quick to write, at least… HTH “BOCA RATON”.gsub(/\\w+/){|w| w.capitalize} is even shorter :…

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

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