# Ruby

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

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

---

## [Mixin module with class variables and class methods](https://www.ruby-forum.com/t/mixin-module-with-class-variables-and-class-methods/183167)

<div class="topic-metadata">

**Author:** [@johnlester](https://www.ruby-forum.com/u/johnlester)\
**Replies:** 6\
**Last updated:** [February 9, 2010, 10:48pm UTC](https://www.ruby-forum.com/t/mixin-module-with-class-variables-and-class-methods/183167 "2010-02-09T22:48:29Z")

</div>

Hello, I am trying to learn ruby and am experimenting with a Mixin. I have the following test module: http://pastie.org/816001 On line 17, the class variable @@name gives an error: uninitialized class variable @@name …

---

## [Reset the whole state](https://www.ruby-forum.com/t/reset-the-whole-state/140404)

<div class="topic-metadata">

**Author:** [@Remi\_Gillig](https://www.ruby-forum.com/u/Remi_Gillig)\
**Replies:** 3\
**Last updated:** [February 9, 2010, 10:40pm UTC](https://www.ruby-forum.com/t/reset-the-whole-state/140404 "2010-02-09T22:40:08Z")

</div>

Hello, I just seached about this problem and found two 2 years old threads : http://groups.google.com/group/comp.lang.ruby/browse\_thread/thread/875a099efd08f70d http://groups.google.com/group/comp.lang.ruby/browse\_thr…

---

## [Algorithm to truncate date to beginning of week?](https://www.ruby-forum.com/t/algorithm-to-truncate-date-to-beginning-of-week/183189)

<div class="topic-metadata">

**Author:** [@cremes](https://www.ruby-forum.com/u/cremes)\
**Replies:** 7\
**Last updated:** [February 9, 2010, 9:37pm UTC](https://www.ruby-forum.com/t/algorithm-to-truncate-date-to-beginning-of-week/183189 "2010-02-09T21:37:58Z")

</div>

I need to be able to take any date after Jan 1, 1980 and truncate it to the nearest week. Example: Wed Jan 09 17:53:23 -0600 1980 should truncate to Sun Jan 06 00:00:00 -0600 1980 Tue Feb 09 12:29:51 -0600 2010 shou…

---

## [Match/scan does not return multiple matches](https://www.ruby-forum.com/t/match-scan-does-not-return-multiple-matches/183038)

<div class="topic-metadata">

**Author:** [@Michal\_S](https://www.ruby-forum.com/u/Michal_S)\
**Replies:** 11\
**Last updated:** [February 9, 2010, 7:48pm UTC](https://www.ruby-forum.com/t/match-scan-does-not-return-multiple-matches/183038 "2010-02-09T19:48:31Z")

</div>

Hello I tried scanning for multiple occurences of a group in a string and match/scan would return only one. “ajabcabck”.match /^aj(?:b(a+)b+c\*)+k$/ =\> #\<MatchData “ajabcabck” 1:“a”\> “ajabcabck”.scan /^aj(?:b(a+)b+c\*…

---

## [Re: Why Ruby?](https://www.ruby-forum.com/t/re-why-ruby/183187)

<div class="topic-metadata">

**Author:** [@Jonathan\_Schmidt-Do](https://www.ruby-forum.com/u/Jonathan_Schmidt-Do)\
**Replies:** 0\
**Last updated:** [February 9, 2010, 6:27pm UTC](https://www.ruby-forum.com/t/re-why-ruby/183187 "2010-02-09T18:27:45Z")

</div>

There are also some nice specials like blocks and mixins. Those aren’t specials; they’re core language features. Specials = Feature which are not part of most OO programming languages. Depends on the implementat…

---

## [An Array of Arrays using Array.sort\_by](https://www.ruby-forum.com/t/an-array-of-arrays-using-array-sort-by/183180)

<div class="topic-metadata">

**Author:** [@tomzoo](https://www.ruby-forum.com/u/tomzoo)\
**Replies:** 2\
**Last updated:** [February 9, 2010, 5:09pm UTC](https://www.ruby-forum.com/t/an-array-of-arrays-using-array-sort-by/183180 "2010-02-09T17:09:52Z")

</div>

Hi, I have: myarray = Array.new mylist = \[1,2\] mylist2 = \[3,1\] mylist3 = \[2,1\] myarray.push(mylist) myarray.push(mylist2) myarray.push(mylist3) myarray.sort myarray.each do |x| puts x\[0\] end And I would like…

---

## [Recommendations for a PostgreSQL driver for Ruby that supports bytea types correctly?](https://www.ruby-forum.com/t/recommendations-for-a-postgresql-driver-for-ruby-that-supports-bytea-types-correctly/183178)

<div class="topic-metadata">

**Author:** [@CyclingGuy](https://www.ruby-forum.com/u/CyclingGuy)\
**Replies:** 3\
**Last updated:** [February 9, 2010, 4:56pm UTC](https://www.ruby-forum.com/t/recommendations-for-a-postgresql-driver-for-ruby-that-supports-bytea-types-correctly/183178 "2010-02-09T16:56:23Z")

</div>

Can anyone recommend a PostgreSQL driver for Ruby that supports selecting and inserting bytea types? I’m not looking to write server functions in Ruby, just client applications. Thank you Eric.

---

## [Problems using the 'extensions' gem - can anyone help?](https://www.ruby-forum.com/t/problems-using-the-extensions-gem-can-anyone-help/183172)

<div class="topic-metadata">

**Author:** [@innes](https://www.ruby-forum.com/u/innes)\
**Replies:** 2\
**Last updated:** [February 9, 2010, 3:40pm UTC](https://www.ruby-forum.com/t/problems-using-the-extensions-gem-can-anyone-help/183172 "2010-02-09T15:40:52Z")

</div>

I’m running Ruby 1.9.1-p378 (RC2) on windows, installed from the RubyInstaller.org site. I’ve installed ‘extensions’ gem (“gem install -r extensions”). When I run irb and try and “require 'extensions/all” I get the f…

---

## [Patch for ruby-core:17472](https://www.ruby-forum.com/t/patch-for-ruby-core-17472/142270)

<div class="topic-metadata">

**Author:** [@wanabe](https://www.ruby-forum.com/u/wanabe)\
**Replies:** 15\
**Last updated:** [February 9, 2010, 3:28pm UTC](https://www.ruby-forum.com/t/patch-for-ruby-core-17472/142270 "2010-02-09T15:28:35Z")

</div>

e$B%o%J%Y$H?=$7$^$9!#e(B \[ruby-core:17472\] \[Ruby 1.8 - Bug #206\] e$B$KBP$9$k%Q%C%A$r=q$-$^$7$?!#e(B e$B\<j85$G$O0lDL$j%F%9%H$7$?$D$b$j$G$9$,!"$3$l$G$$$$$N$+$$$^$$$A3N?.$,$b$F$^$;$s!#e(B e$B$I$J$?$+8!\>Z$7$F$$$?$@$1$J$$…

---

## [Recursive mkdir](https://www.ruby-forum.com/t/recursive-mkdir/183138)

<div class="topic-metadata">

**Author:** [@S-gw](https://www.ruby-forum.com/u/S-gw)\
**Replies:** 5\
**Last updated:** [February 9, 2010, 2:41pm UTC](https://www.ruby-forum.com/t/recursive-mkdir/183138 "2010-02-09T14:41:10Z")

</div>

So, I was surprised to find out that Dir.mkdir will not create all folders in a path when more than just the last level does not exist. Example: Dir.mkdir(’/f1/f2/f3’) will not create /f3 when /f2 does not exist. I ex…

---

## [\[Bug #2712\](Closed) TCPServer#gets gets stuck](https://www.ruby-forum.com/t/bug-2712-closed-tcpserver-gets-gets-stuck/183173)

<div class="topic-metadata">

**Author:** [@Yusuke\_E](https://www.ruby-forum.com/u/Yusuke_E)\
**Replies:** 0\
**Last updated:** [February 9, 2010, 2:38pm UTC](https://www.ruby-forum.com/t/bug-2712-closed-tcpserver-gets-gets-stuck/183173 "2010-02-09T14:38:50Z")

</div>

e$B%A%1%C%He(B #2712 e$B$,99?7$5$l$^$7$?!#e(B (by Yusuke E.) e$B%9%F!\<%?%9e(B Opene$B$+$ie(BClosede$B$KJQ99e(B e$B?JD=e(B % 0e$B$+$ie(B100e$B$KJQ99e(B This issue was solved with changeset r26625. Yusuke, thank you fo…

---

## [Working directory for external commands](https://www.ruby-forum.com/t/working-directory-for-external-commands/183150)

<div class="topic-metadata">

**Author:** [@king\_duckz](https://www.ruby-forum.com/u/king_duckz)\
**Replies:** 5\
**Last updated:** [February 9, 2010, 2:22pm UTC](https://www.ruby-forum.com/t/working-directory-for-external-commands/183150 "2010-02-09T14:22:25Z")

</div>

Hello everyone, I’ve been searching on google for a while now but I can’t find any solution to my question. Basically I want to be able to specify the working directory for any external command I might launch, without…

---

## [Create pseudo sandbox for hosted IronRuby script](https://www.ruby-forum.com/t/create-pseudo-sandbox-for-hosted-ironruby-script/183105)

<div class="topic-metadata">

**Author:** [@acampos](https://www.ruby-forum.com/u/acampos)\
**Replies:** 2\
**Last updated:** [February 9, 2010, 1:11pm UTC](https://www.ruby-forum.com/t/create-pseudo-sandbox-for-hosted-ironruby-script/183105 "2010-02-09T13:11:35Z")

</div>

Hi, I have an multi-user VoIP application that allows users to execute IronRuby scripts for their call dial plans. I’m looking to restrict what the IronRuby scripts are allowed to do to protect the server in case a n…

---

## [Ruby and gui on X11 based displays](https://www.ruby-forum.com/t/ruby-and-gui-on-x11-based-displays/183124)

<div class="topic-metadata">

**Author:** [@saLOUt](https://www.ruby-forum.com/u/saLOUt)\
**Replies:** 2\
**Last updated:** [February 9, 2010, 12:26pm UTC](https://www.ruby-forum.com/t/ruby-and-gui-on-x11-based-displays/183124 "2010-02-09T12:26:30Z")

</div>

Hi all, how can I reparent a X11 window with ruby? For C++ there is a Xlib interface which provides the function call “XReparentWindow”. Greets Robert

---

## [Trunk \\w match](https://www.ruby-forum.com/t/trunk-w-match/183159)

<div class="topic-metadata">

**Author:** [@WATANABE\_Tetsuya](https://www.ruby-forum.com/u/WATANABE_Tetsuya)\
**Replies:** 6\
**Last updated:** [February 9, 2010, 12:10pm UTC](https://www.ruby-forum.com/t/trunk-w-match/183159 "2010-02-09T12:10:42Z")

</div>

e$BEOJUE/Li$G$9!#e(B Trunk e$B$Ne(B \\w e$B$N%^%C%A$,4A;z$GF0:n$7$F$$$J$$$h$&$G$9!#e(B $ ruby -v ruby 1.9.2dev (2010-02-09) \[i686-linux\] ------- e$B%5%s%W%k%3!\<%Ie(B kstr = “e$B4A;z%3!\<%Ie(BEUC” if kstr =~ /^(\\w+)/ …

---

## [Jruby and multi-threaded background processing](https://www.ruby-forum.com/t/jruby-and-multi-threaded-background-processing/183113)

<div class="topic-metadata">

**Author:** [@pyr0](https://www.ruby-forum.com/u/pyr0)\
**Replies:** 3\
**Last updated:** [February 9, 2010, 11:43am UTC](https://www.ruby-forum.com/t/jruby-and-multi-threaded-background-processing/183113 "2010-02-09T11:43:47Z")

</div>

Coming from the java world, I am wondering if people are taking advantage of java threads for background processing in the jruby world. What tools are people using? Are people leveraging jms for this type of work? …

---

## [Looking for external program invocations](https://www.ruby-forum.com/t/looking-for-external-program-invocations/183153)

<div class="topic-metadata">

**Author:** [@markh](https://www.ruby-forum.com/u/markh)\
**Replies:** 6\
**Last updated:** [February 9, 2010, 10:10am UTC](https://www.ruby-forum.com/t/looking-for-external-program-invocations/183153 "2010-02-09T10:10:44Z")

</div>

I have some open source software packages that were written in Ruby by a third party that make use of external programs. For the purposes of security auditing, and for making appropriate fixes, I need to locate all i…

---

## [ANN: toamqp 0.3.1](https://www.ruby-forum.com/t/ann-toamqp-0-3-1/183165)

<div class="topic-metadata">

**Author:** [@kaspar](https://www.ruby-forum.com/u/kaspar)\
**Replies:** 0\
**Last updated:** [February 9, 2010, 10:07am UTC](https://www.ruby-forum.com/t/ann-toamqp-0-3-1/183165 "2010-02-09T10:07:48Z")

</div>

toamqp 0.3.1 has been released today. toamqp will allow you to transport thrift\[1\] messages via an AMQP broker. The interface makes this really super-easy - allowing you to concentrate on your stuff, as usual. Change…

---

## [C embed assistance](https://www.ruby-forum.com/t/c-embed-assistance/183088)

<div class="topic-metadata">

**Author:** [@schala](https://www.ruby-forum.com/u/schala)\
**Replies:** 14\
**Last updated:** [February 9, 2010, 4:26am UTC](https://www.ruby-forum.com/t/c-embed-assistance/183088 "2010-02-09T04:26:40Z")

</div>

I was wondering if there was a site with reliable documentation covering the C embed API? The one on ruby-lang.org is near useless as it was simply generated without commentary. I could have sworn there was another si…

---

## [Honest opinion needed](https://www.ruby-forum.com/t/honest-opinion-needed/183065)

<div class="topic-metadata">

**Author:** [@schala](https://www.ruby-forum.com/u/schala)\
**Replies:** 14\
**Last updated:** [February 9, 2010, 4:23am UTC](https://www.ruby-forum.com/t/honest-opinion-needed/183065 "2010-02-09T04:23:38Z")

</div>

I’ve been trying to find a scripting language to integrate into a game I’m developing in C and my choices are pretty much either Ruby or Lua. See, game developers tell me Lua is the way to go for performance and flexi…

---

## [Ruby-based equivalent to SCons?](https://www.ruby-forum.com/t/ruby-based-equivalent-to-scons/183139)

<div class="topic-metadata">

**Author:** [@nicksnels](https://www.ruby-forum.com/u/nicksnels)\
**Replies:** 4\
**Last updated:** [February 9, 2010, 1:48am UTC](https://www.ruby-forum.com/t/ruby-based-equivalent-to-scons/183139 "2010-02-09T01:48:46Z")

</div>

First of all, I’d like to point out that while the “What does this Ruby code do?” CAPTCHA when signing up at ruby-forum.com is admittedly a very clever idea, it’s a bit of a pain for Ruby novices like me. You have to …

---

## [Why is Ruby+MySQL memory usage way better than C, Perl, Python?](https://www.ruby-forum.com/t/why-is-ruby-mysql-memory-usage-way-better-than-c-perl-python/183140)

<div class="topic-metadata">

**Author:** [@weliwarmer](https://www.ruby-forum.com/u/weliwarmer)\
**Replies:** 2\
**Last updated:** [February 9, 2010, 12:30am UTC](https://www.ruby-forum.com/t/why-is-ruby-mysql-memory-usage-way-better-than-c-perl-python/183140 "2010-02-09T00:30:39Z")

</div>

I’ve got a table that consists of about 2.6 millions rows, each row containing 5 columns (a short string, 3 integers, and a decimal fraction). A program needs to read the whole table. At first, programming without br…

---

## [Code Review: Control Flow Optimizations](https://www.ruby-forum.com/t/code-review-control-flow-optimizations/183147)

<div class="topic-metadata">

**Author:** [@grujildo](https://www.ruby-forum.com/u/grujildo)\
**Replies:** 0\
**Last updated:** [February 8, 2010, 11:12pm UTC](https://www.ruby-forum.com/t/code-review-control-flow-optimizations/183147 "2010-02-08T23:12:13Z")

</div>

Implements a new block return optimization. It targets frame unwinding in the cases of returning from (nested) blocks like these: def foo x.times do y.times do return end end end We were throwing an except…

---

## [Ruby equivalent for php openssl\_pkey\_get\_public](https://www.ruby-forum.com/t/ruby-equivalent-for-php-openssl-pkey-get-public/183143)

<div class="topic-metadata">

**Author:** [@LiMan](https://www.ruby-forum.com/u/LiMan)\
**Replies:** 0\
**Last updated:** [February 8, 2010, 11:01pm UTC](https://www.ruby-forum.com/t/ruby-equivalent-for-php-openssl-pkey-get-public/183143 "2010-02-08T23:01:40Z")

</div>

Hello all I have the php script where the password encoding done using the openssl: $key = openssl\_get\_publickey($certificate); openssl\_public\_encrypt($pass,$userPassCrypted, $key,OPENSSL\_PKCS1\_PADDING); openssl\_fr…

---

## [Gateway down?](https://www.ruby-forum.com/t/gateway-down/183102)

<div class="topic-metadata">

**Author:** [@robkuz](https://www.ruby-forum.com/u/robkuz)\
**Replies:** 5\
**Last updated:** [February 8, 2010, 10:35pm UTC](https://www.ruby-forum.com/t/gateway-down/183102 "2010-02-08T22:35:54Z")

</div>

Hi, despite the traffic I am seeing on the mailing list side the news side seems to be quite mute since yesterday. Any troubles? Cheers robert

---

## [Getting started with become\_java!](https://www.ruby-forum.com/t/getting-started-with-become-java/182941)

<div class="topic-metadata">

**Author:** [@Jonas\_T](https://www.ruby-forum.com/u/Jonas_T)\
**Replies:** 4\
**Last updated:** [February 8, 2010, 9:01pm UTC](https://www.ruby-forum.com/t/getting-started-with-become-java/182941 "2010-02-08T21:01:38Z")

</div>

I’m having problems getting the Java \<-\> Ruby integration to work in jRuby 1.4.0 and signed up to the list in order to tap into the more experienced crowd. When I try to cast a new instance of the jruby-generated ja…

---

## [Strange error message: Java methods can only be invoked on Java objects (TypeError)](https://www.ruby-forum.com/t/strange-error-message-java-methods-can-only-be-invoked-on-java-objects-typeerror/183080)

<div class="topic-metadata">

**Author:** [@rogergue](https://www.ruby-forum.com/u/rogergue)\
**Replies:** 2\
**Last updated:** [February 8, 2010, 8:44pm UTC](https://www.ruby-forum.com/t/strange-error-message-java-methods-can-only-be-invoked-on-java-objects-typeerror/183080 "2010-02-08T20:44:39Z")

</div>

The code below produces the following error message: Java methods can only be invoked on Java objects (TypeError) Why ? I thought I created a java class ? Regards Roger require ‘java’ require ‘jruby/core\_ext’ incl…

---

## [Documentation conventions](https://www.ruby-forum.com/t/documentation-conventions/183130)

<div class="topic-metadata">

**Author:** [@quintus](https://www.ruby-forum.com/u/quintus)\
**Replies:** 3\
**Last updated:** [February 8, 2010, 8:15pm UTC](https://www.ruby-forum.com/t/documentation-conventions/183130 "2010-02-08T20:15:29Z")

</div>

Hi there, I’ve been searching the web for some time now, but I can’t find any reasonable conventions on how to write Ruby documentations. There are some pages out there describing what’s the best way to write Ruby sou…

---

## [Escaping a period (.)](https://www.ruby-forum.com/t/escaping-a-period/183129)

<div class="topic-metadata">

**Author:** [@jmaenpaa](https://www.ruby-forum.com/u/jmaenpaa)\
**Replies:** 1\
**Last updated:** [February 8, 2010, 7:10pm UTC](https://www.ruby-forum.com/t/escaping-a-period/183129 "2010-02-08T19:10:30Z")

</div>

Hello all, I’m in my 4 month of Ruby on Rails and had a question about escaping special characters. How do I escape a period(.)? ie (John F. oobar) I wish to change the period to an ASCII representation. Thank you …

---

## [Same character show different code in two machine](https://www.ruby-forum.com/t/same-character-show-different-code-in-two-machine/183081)

<div class="topic-metadata">

**Author:** [@dissolved](https://www.ruby-forum.com/u/dissolved)\
**Replies:** 9\
**Last updated:** [February 8, 2010, 6:57pm UTC](https://www.ruby-forum.com/t/same-character-show-different-code-in-two-machine/183081 "2010-02-08T18:57:16Z")

</div>

one chinese character show different code in two different machine. machine A: \\243\\244 machine B: \\302\\245 so I have to using different pattern for two machines, like this: machine A: text.split("\\243\\244") ma…

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

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