# Ruby

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

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

---

## [Help optimizing](https://www.ruby-forum.com/t/help-optimizing/84952)

<div class="topic-metadata">

**Author:** [@technodolt](https://www.ruby-forum.com/u/technodolt)\
**Replies:** 12\
**Last updated:** [February 9, 2007, 7:41pm UTC](https://www.ruby-forum.com/t/help-optimizing/84952 "2007-02-09T19:41:15Z")

</div>

I’m going to cross-post this from the Rails group, because some of the people here are Ruby ninjas and don’t read that forum, and I’d like help getting this function optimized… its results are useful in a Rails perspe…

---

## [Help with Readlines error](https://www.ruby-forum.com/t/help-with-readlines-error/84987)

<div class="topic-metadata">

**Author:** [@Bucco](https://www.ruby-forum.com/u/Bucco)\
**Replies:** 2\
**Last updated:** [February 9, 2007, 7:41pm UTC](https://www.ruby-forum.com/t/help-with-readlines-error/84987 "2007-02-09T19:41:15Z")

</div>

I don’t know if it is me or if something is wrong with Ruby. I am using ruby 1.8.5 (2006-08-25) \[i386-mswin32\] on an XP box. I am following alon with some examples for readline in my new “Everyday Scripting with Rub…

---

## [How to manipulate binary file](https://www.ruby-forum.com/t/how-to-manipulate-binary-file/84849)

<div class="topic-metadata">

**Author:** [@Minxing\_L](https://www.ruby-forum.com/u/Minxing_L)\
**Replies:** 3\
**Last updated:** [February 9, 2007, 7:24pm UTC](https://www.ruby-forum.com/t/how-to-manipulate-binary-file/84849 "2007-02-09T19:24:14Z")

</div>

I love Ruby very much and now Ruby is my first language.But now I meet a problem on Ruby.I want to do as follows: 1:Open a file in binary mode 2:Shift the bit in a algorithm 3:Save the file I don’t know how to shift…

---

## [Passing html params in Ruby](https://www.ruby-forum.com/t/passing-html-params-in-ruby/85067)

<div class="topic-metadata">

**Author:** [@joep](https://www.ruby-forum.com/u/joep)\
**Replies:** 0\
**Last updated:** [February 9, 2007, 7:21pm UTC](https://www.ruby-forum.com/t/passing-html-params-in-ruby/85067 "2007-02-09T19:21:13Z")

</div>

I have an AJAX page that I built. The user enters in some info. I format a query string and want use it to query my DB. something like this: var query\_string = "SELECT \* FROM mydbtable; \<% require ‘dbi’ require ‘c…

---

## [HELP: Ruby profiler crashes under MacOS X](https://www.ruby-forum.com/t/help-ruby-profiler-crashes-under-macos-x/84828)

<div class="topic-metadata">

**Author:** [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Replies:** 2\
**Last updated:** [February 9, 2007, 7:13pm UTC](https://www.ruby-forum.com/t/help-ruby-profiler-crashes-under-macos-x/84828 "2007-02-09T19:13:13Z")

</div>

I’m trying to run the Ruby interpreter with profiling enabled, but when I do, I get a crash: ruby -r profile myprog.rb \[BUG\] cross-thread violation on rb\_gc() ruby 1.8.2 (2004-12-25) \[universal-darwin8.0\] Abort trap …

---

## [Ruby on Pocket PC](https://www.ruby-forum.com/t/ruby-on-pocket-pc/85065)

<div class="topic-metadata">

**Author:** [@mschwab](https://www.ruby-forum.com/u/mschwab)\
**Replies:** 0\
**Last updated:** [February 9, 2007, 7:03pm UTC](https://www.ruby-forum.com/t/ruby-on-pocket-pc/85065 "2007-02-09T19:03:11Z")

</div>

Hello, colleagues! If anyone has a fresh compiled version of Ruby that runs normally on Pocket PC under Windows Mobile 2003, please let me know, where to find it. I use Ruby 1.8.1 on my iPAQ h4150, but it behaves ve…

---

## [SimpleHTTP initial release](https://www.ruby-forum.com/t/simplehttp-initial-release/84910)

<div class="topic-metadata">

**Author:** [@tbobker](https://www.ruby-forum.com/u/tbobker)\
**Replies:** 15\
**Last updated:** [February 9, 2007, 6:56pm UTC](https://www.ruby-forum.com/t/simplehttp-initial-release/84910 "2007-02-09T18:56:08Z")

</div>

I just got through putting together a little wrapper around Net:Http because I keep forgetting how to handle stuff like proxies, ssl, basic auth and redirects with it. Thought it might be useful to others as well. Enj…

---

## [Help begin/rescue/ensure](https://www.ruby-forum.com/t/help-begin-rescue-ensure/85006)

<div class="topic-metadata">

**Author:** [@S\_Kanakakorn](https://www.ruby-forum.com/u/S_Kanakakorn)\
**Replies:** 4\
**Last updated:** [February 9, 2007, 5:47pm UTC](https://www.ruby-forum.com/t/help-begin-rescue-ensure/85006 "2007-02-09T17:47:01Z")

</div>

I have this simple code. require ‘rubygems’ require ‘net/ssh’ begin session = Net::SSH.start(‘aaaa-lnx’, :password=\>‘xyz’, :username=\>‘root’,:timeout=\>5) rescue puts 'cannot connect ’ ensure puts ‘reach ensure p…

---

## [Rubyforge.org question](https://www.ruby-forum.com/t/rubyforge-org-question/85031)

<div class="topic-metadata">

**Author:** [@splattael](https://www.ruby-forum.com/u/splattael)\
**Replies:** 5\
**Last updated:** [February 9, 2007, 5:37pm UTC](https://www.ruby-forum.com/t/rubyforge-org-question/85031 "2007-02-09T17:37:01Z")

</div>

Hi, Is there a possibility to monitor everything on Rubyforge? (trackers, forums…) - I can monitor bugs if they are already there, but I would like to monitor everything automatically - if I have a new bug report, fo…

---

## [Finding help](https://www.ruby-forum.com/t/finding-help/85054)

<div class="topic-metadata">

**Author:** [@technodolt](https://www.ruby-forum.com/u/technodolt)\
**Replies:** 8\
**Last updated:** [February 9, 2007, 5:10pm UTC](https://www.ruby-forum.com/t/finding-help/85054 "2007-02-09T17:10:54Z")

</div>

I’m wanting to figure out what the &: syntax does, but I’m not exactly sure how to search for it given that it contains special characters… a search on google for “ruby &:” doesn’t really give me anything worth looki…

---

## [General Approach to Data Validation](https://www.ruby-forum.com/t/general-approach-to-data-validation/84901)

<div class="topic-metadata">

**Author:** [@dfg59](https://www.ruby-forum.com/u/dfg59)\
**Replies:** 11\
**Last updated:** [February 9, 2007, 4:59pm UTC](https://www.ruby-forum.com/t/general-approach-to-data-validation/84901 "2007-02-09T16:59:33Z")

</div>

Hey all- I posted some questions yesterday about getting ActiveRecord working with Oracle 10g, and I’m happy to say I was successful. ActiveRecord makes pulling and manipulating data so easy. Now, I’m writing some dat…

---

## [Deployment options with Merb or Camping](https://www.ruby-forum.com/t/deployment-options-with-merb-or-camping/85000)

<div class="topic-metadata">

**Author:** [@liquid](https://www.ruby-forum.com/u/liquid)\
**Replies:** 6\
**Last updated:** [February 9, 2007, 4:04pm UTC](https://www.ruby-forum.com/t/deployment-options-with-merb-or-camping/85000 "2007-02-09T16:04:45Z")

</div>

Hi all, Sorry if this is off topic, I’ll be happy to post elsewhere if it’s inappropriate. (Pointer please) I have a light weight web app that I would like to get going and I think that rails is way overkill and wil…

---

## [File.open () Errno::ENOTDIR](https://www.ruby-forum.com/t/file-open-errno-enotdir/85048)

<div class="topic-metadata">

**Author:** [@RebhanS\_Gilbert](https://www.ruby-forum.com/u/RebhanS_Gilbert)\
**Replies:** 1\
**Last updated:** [February 9, 2007, 3:47pm UTC](https://www.ruby-forum.com/t/file-open-errno-enotdir/85048 "2007-02-09T15:47:43Z")

</div>

Hi, i have a problem with File.open = File.open(SRCDIR\<\<’/’\<\<Dir.entries(SRCDIR).sort\[2\]\<\<’/foobar.TXT’) do |f| mymethod(x) end gives me = Not a directory - … (Errno::ENOTDIR) How to get the Dirname Dir.entries(S…

---

## [Ruby and Open Sound Control (OSC)?](https://www.ruby-forum.com/t/ruby-and-open-sound-control-osc/84775)

<div class="topic-metadata">

**Author:** [@MSEdward\_SEdS\_Bora](https://www.ruby-forum.com/u/MSEdward_SEdS_Bora)\
**Replies:** 4\
**Last updated:** [February 9, 2007, 3:11pm UTC](https://www.ruby-forum.com/t/ruby-and-open-sound-control-osc/84775 "2007-02-09T15:11:40Z")

</div>

A Google search turned up a few primitive efforts and some broken links, so I’ll ask here – does anyone know of any Ruby libraries for Open Sound Control? I checked CPAN and there isn’t a heck of a lot even for Perl –…

---

## [Ruby hash equlity](https://www.ruby-forum.com/t/ruby-hash-equlity/84970)

<div class="topic-metadata">

**Author:** [@unknown](https://www.ruby-forum.com/u/unknown)\
**Replies:** 4\
**Last updated:** [February 9, 2007, 2:25pm UTC](https://www.ruby-forum.com/t/ruby-hash-equlity/84970 "2007-02-09T14:25:36Z")

</div>

Based on the description of Hash#== " Equality—Two hashes are equal if they each contain the same number of keys and if each key-value pair is equal to (according to +Object#==+) the corresponding elements in the othe…

---

## [What is really a class instance variable compare to a class](https://www.ruby-forum.com/t/what-is-really-a-class-instance-variable-compare-to-a-class/84918)

<div class="topic-metadata">

**Author:** [@rubarachni](https://www.ruby-forum.com/u/rubarachni)\
**Replies:** 6\
**Last updated:** [February 9, 2007, 2:03pm UTC](https://www.ruby-forum.com/t/what-is-really-a-class-instance-variable-compare-to-a-class/84918 "2007-02-09T14:03:31Z")

</div>

Hi all, Given the following definition : class A @@class\_var = “a class variable” @class\_instance\_var = “a class instance variable” def a\_method @instance\_var = "an instance variable" end end I understand what …

---

## [Problem with Base64 decoding](https://www.ruby-forum.com/t/problem-with-base64-decoding/83736)

<div class="topic-metadata">

**Author:** [@alexander](https://www.ruby-forum.com/u/alexander)\
**Replies:** 8\
**Last updated:** [February 9, 2007, 1:02pm UTC](https://www.ruby-forum.com/t/problem-with-base64-decoding/83736 "2007-02-09T13:02:27Z")

</div>

hi there, last time i accidentely posted this question as a reply to another one… i´m really sorry for that. i will not make that mistake again. so here´s my question again in a fresh new thread :slight\_smile: i´m ha…

---

## [Using RSpec in the Ruby debugger](https://www.ruby-forum.com/t/using-rspec-in-the-ruby-debugger/84984)

<div class="topic-metadata">

**Author:** [@greg](https://www.ruby-forum.com/u/greg)\
**Replies:** 1\
**Last updated:** [February 9, 2007, 1:00pm UTC](https://www.ruby-forum.com/t/using-rspec-in-the-ruby-debugger/84984 "2007-02-09T13:00:26Z")

</div>

Is it possible to run RSpec specs from inside the Ruby debugger? I’ve got a failing spec and I would like to single-step through the failing code so as to figure out what’s going on. The alternative is not very attrac…

---

## [How to "pass" the current binding's block to some other meth](https://www.ruby-forum.com/t/how-to-pass-the-current-bindings-block-to-some-other-meth/84983)

<div class="topic-metadata">

**Author:** [@Lyle\_J](https://www.ruby-forum.com/u/Lyle_J)\
**Replies:** 11\
**Last updated:** [February 9, 2007, 9:54am UTC](https://www.ruby-forum.com/t/how-to-pass-the-current-bindings-block-to-some-other-meth/84983 "2007-02-09T09:54:08Z")

</div>

Suppose I have a method that will yield to a block if one is given: def try(x, y, z) # ... do some other stuff first ... yield self if block\_given? end Now suppose that I create an alias to this method, for the pur…

---

## [Libxml and Windows](https://www.ruby-forum.com/t/libxml-and-windows/85012)

<div class="topic-metadata">

**Author:** [@charlieuk](https://www.ruby-forum.com/u/charlieuk)\
**Replies:** 0\
**Last updated:** [February 9, 2007, 9:30am UTC](https://www.ruby-forum.com/t/libxml-and-windows/85012 "2007-02-09T09:30:06Z")

</div>

About six months ago there was a post about libxml and Windows (see http://blade.nagaokaut.ac.jp/cgi-bin/vframe.rb/ruby/ruby-talk/194031?193863-196012+split-mode-vertical). For anyone still interested, I’ve built a bin…

---

## [Auto indentation in ruby electric mode](https://www.ruby-forum.com/t/auto-indentation-in-ruby-electric-mode/84921)

<div class="topic-metadata">

**Author:** [@unknown](https://www.ruby-forum.com/u/unknown)\
**Replies:** 5\
**Last updated:** [February 9, 2007, 8:43am UTC](https://www.ruby-forum.com/t/auto-indentation-in-ruby-electric-mode/84921 "2007-02-09T08:43:04Z")

</div>

Hi, I’m learning to use Emacs to program Ruby. The ruby-electric-mode works well except that after I hit ENTER, my cursor will not be automatically indented. For example, if I type “def foo” and then ENTER, my cursor…

---

## [Grouping similar attributes](https://www.ruby-forum.com/t/grouping-similar-attributes/84908)

<div class="topic-metadata">

**Author:** [@eddiewould](https://www.ruby-forum.com/u/eddiewould)\
**Replies:** 5\
**Last updated:** [February 9, 2007, 7:46am UTC](https://www.ruby-forum.com/t/grouping-similar-attributes/84908 "2007-02-09T07:46:46Z")

</div>

How would one group attributes which came from an array/db? For example in my DB: | NAME | ETHNIC | | Dominic | Asian | | John | Asian | | Rick | Spanish | I’d like it to group by Ethnicity: Asian Dom…

---

## [Problem changing datetime format](https://www.ruby-forum.com/t/problem-changing-datetime-format/84995)

<div class="topic-metadata">

**Author:** [@reed](https://www.ruby-forum.com/u/reed)\
**Replies:** 2\
**Last updated:** [February 9, 2007, 6:50am UTC](https://www.ruby-forum.com/t/problem-changing-datetime-format/84995 "2007-02-09T06:50:55Z")

</div>

I am trying to format some datetimes like this…2007, February the 9th, 6:30pm I have the following which gets me part way there. ActiveSupport::CoreExtensions::Time::Conversions::DATE\_FORMATS.update(:my\_date\_format =\>…

---

## [Is\_class from a String?](https://www.ruby-forum.com/t/is-class-from-a-string/84989)

<div class="topic-metadata">

**Author:** [@leandro\_nascimento\_S](https://www.ruby-forum.com/u/leandro_nascimento_S)\
**Replies:** 3\
**Last updated:** [February 9, 2007, 2:30am UTC](https://www.ruby-forum.com/t/is-class-from-a-string/84989 "2007-02-09T02:30:39Z")

</div>

I have a dynamic String entry and I want know if it represents some any existing Class name (in a given modules set loaded)? How to do that. PS.: I’m using Rails and I need to know if there is some Model with a given…

---

## [Quiz#112](https://www.ruby-forum.com/t/quiz-112/84974)

<div class="topic-metadata">

**Author:** [@kyle\_s](https://www.ruby-forum.com/u/kyle_s)\
**Replies:** 3\
**Last updated:** [February 9, 2007, 12:03am UTC](https://www.ruby-forum.com/t/quiz-112/84974 "2007-02-09T00:03:24Z")

</div>

\#ok, here’s my perhaps inelegant solution, and hi, I’m Kyle. input=gets("\\n") input.downcase! input.gsub!(/\[^a-z+=\]/,’’) left=input.split("==").first.split(’+’) right=input.split("==").last.split(’+’) exit(1) unles…

---

## [Error while trying to use Socket#accept\_nonblock](https://www.ruby-forum.com/t/error-while-trying-to-use-socket-accept-nonblock/84862)

<div class="topic-metadata">

**Author:** [@gnufied](https://www.ruby-forum.com/u/gnufied)\
**Replies:** 1\
**Last updated:** [February 8, 2007, 11:35pm UTC](https://www.ruby-forum.com/t/error-while-trying-to-use-socket-accept-nonblock/84862 "2007-02-08T23:35:23Z")

</div>

Pretty much sample code included with ri docs: #Server In one script, start this first require ‘socket’ include Socket::Constants socket = Socket.new(AF\_INET, SOCK\_STREAM, 0) sockaddr = Socket.sockaddr\_in(2200, ‘loc…

---

## [Ruby as a configuration language](https://www.ruby-forum.com/t/ruby-as-a-configuration-language/84912)

<div class="topic-metadata">

**Author:** [@Tapio\_K](https://www.ruby-forum.com/u/Tapio_K)\
**Replies:** 8\
**Last updated:** [February 8, 2007, 11:31pm UTC](https://www.ruby-forum.com/t/ruby-as-a-configuration-language/84912 "2007-02-08T23:31:22Z")

</div>

Hi I’m writing an automated software building framework in Ruby. The software compiles software packages from source code using human-written profiles. The profiles should be extremely easy to read and write by huma…

---

## [Calculating a future date](https://www.ruby-forum.com/t/calculating-a-future-date/84603)

<div class="topic-metadata">

**Author:** [@Toine](https://www.ruby-forum.com/u/Toine)\
**Replies:** 6\
**Last updated:** [February 8, 2007, 11:24pm UTC](https://www.ruby-forum.com/t/calculating-a-future-date/84603 "2007-02-08T23:24:22Z")

</div>

Hello, I’m new to Ruby so please bare with me… I need to calculate a date that is exactly 31 days from the current date in YYYY-MM-DD format. I know that Date.today returns the current date, but how can I add 31 days…

---

## [Win32Ole question](https://www.ruby-forum.com/t/win32ole-question/84808)

<div class="topic-metadata">

**Author:** [@NationS\_Carey](https://www.ruby-forum.com/u/NationS_Carey)\
**Replies:** 3\
**Last updated:** [February 8, 2007, 11:21pm UTC](https://www.ruby-forum.com/t/win32ole-question/84808 "2007-02-08T23:21:21Z")

</div>

Hi, I need to do the functional equivalent of a QueryInterface. I have an object but I need access to methods in another interface that it supports. How can I do that? Thanks! Carey Nation mailto:removed\_email\_ad…

---

## [Class-tree variables](https://www.ruby-forum.com/t/class-tree-variables/84959)

<div class="topic-metadata">

**Author:** [@oinkoink](https://www.ruby-forum.com/u/oinkoink)\
**Replies:** 6\
**Last updated:** [February 8, 2007, 10:51pm UTC](https://www.ruby-forum.com/t/class-tree-variables/84959 "2007-02-08T22:51:19Z")

</div>

There’s been a lot of blog traffic lately about class variables vs. class instance variables. I’d like to give an example of something in-between: class-tree variables. These are sort of like class variables, but th…

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

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