# Ruby

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

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

---

## [A backwards N+1 problem](https://www.ruby-forum.com/t/a-backwards-n-1-problem/151906)

<div class="topic-metadata">

**Author:** [@indigoi](https://www.ruby-forum.com/u/indigoi)\
**Replies:** 1\
**Last updated:** [October 27, 2008, 10:57pm UTC](https://www.ruby-forum.com/t/a-backwards-n-1-problem/151906 "2008-10-27T22:57:18Z")

</div>

Hey, iâ€™m running into an N+1 problem, but i don’t exactly know how to :include in this situation. (controller code is at the bottom). I’m trying to find all of the highest ranked definitions, and then render their a…

---

## [File manipulation](https://www.ruby-forum.com/t/file-manipulation/151916)

<div class="topic-metadata">

**Author:** [@Vandana](https://www.ruby-forum.com/u/Vandana)\
**Replies:** 3\
**Last updated:** [October 27, 2008, 10:41pm UTC](https://www.ruby-forum.com/t/file-manipulation/151916 "2008-10-27T22:41:30Z")

</div>

Hi All, I have one more question with file manipulation. Suppose I have the following structure in a file : Instance J1 ( net n1() net n2 () net n3() ) Instance J2 ( net n1() net n2() net n3() ) Instance J3 ( …

---

## [How to find directory of currently running .rb file](https://www.ruby-forum.com/t/how-to-find-directory-of-currently-running-rb-file/151909)

<div class="topic-metadata">

**Author:** [@Kenneth\_McDonald](https://www.ruby-forum.com/u/Kenneth_McDonald)\
**Replies:** 2\
**Last updated:** [October 27, 2008, 10:18pm UTC](https://www.ruby-forum.com/t/how-to-find-directory-of-currently-running-rb-file/151909 "2008-10-27T22:18:36Z")

</div>

FILE is just giving me the file name, with no path, and Dir.getwd is giving me an error: “ENOENT: No such file or directory.” What is the proper way to get this info? Thanks in advance, Ken McDonald

---

## [Float equality](https://www.ruby-forum.com/t/float-equality/151902)

<div class="topic-metadata">

**Author:** [@guille\_lists](https://www.ruby-forum.com/u/guille_lists)\
**Replies:** 13\
**Last updated:** [October 27, 2008, 9:41pm UTC](https://www.ruby-forum.com/t/float-equality/151902 "2008-10-27T21:41:34Z")

</div>

Hi, sorry if this is a very naive question (I’m new to ruby), but I haven’t found an explication yet. When comparing to floats in ruby I came across this: a = 0.1 =\> 0.1 b = 1 - 0.9 =\> 0.1 a == b =\> false …

---

## [Help with regular expressions](https://www.ruby-forum.com/t/help-with-regular-expressions/151735)

<div class="topic-metadata">

**Author:** [@Vandana](https://www.ruby-forum.com/u/Vandana)\
**Replies:** 9\
**Last updated:** [October 27, 2008, 9:30pm UTC](https://www.ruby-forum.com/t/help-with-regular-expressions/151735 "2008-10-27T21:30:25Z")

</div>

Hi all, I’m fairly new to programming with regular expressions. I would like some help with the following. Consider the format given below as what I will receive in a file. While reading from the file, Im intereste…

---

## [JRuby method dispatch problem under rspec](https://www.ruby-forum.com/t/jruby-method-dispatch-problem-under-rspec/151915)

<div class="topic-metadata">

**Author:** [@mauricio](https://www.ruby-forum.com/u/mauricio)\
**Replies:** 0\
**Last updated:** [October 27, 2008, 9:15pm UTC](https://www.ruby-forum.com/t/jruby-method-dispatch-problem-under-rspec/151915 "2008-10-27T21:15:42Z")

</div>

Hello guys, I’ve got a completely unexpected behaviour in my specs, if a protected method is called under any controller spec, JRuby throws an error like this one: NameError in ‘SampleController on index calls Should…

---

## [Rails 2.2](https://www.ruby-forum.com/t/rails-2-2/151757)

<div class="topic-metadata">

**Author:** [@ADADAD](https://www.ruby-forum.com/u/ADADAD)\
**Replies:** 12\
**Last updated:** [October 27, 2008, 8:20pm UTC](https://www.ruby-forum.com/t/rails-2-2/151757 "2008-10-27T20:20:28Z")

</div>

I think its (thread) safe to say things are about to get very interesting for JRuby. Anyone download the RC and run some benchmarks ? Cant wait… Adam

---

## [How to detect if #super exists?](https://www.ruby-forum.com/t/how-to-detect-if-super-exists/151892)

<div class="topic-metadata">

**Author:** [@cremes](https://www.ruby-forum.com/u/cremes)\
**Replies:** 8\
**Last updated:** [October 27, 2008, 8:11pm UTC](https://www.ruby-forum.com/t/how-to-detect-if-super-exists/151892 "2008-10-27T20:11:41Z")

</div>

I’m writing some modules that I use to replace/extend the functionality in a base class. I want to test these modules without adding them to the original class. My problem is that some of the module methods call #supe…

---

## [Problems with Pcacp Library](https://www.ruby-forum.com/t/problems-with-pcacp-library/151838)

<div class="topic-metadata">

**Author:** [@rubystudent](https://www.ruby-forum.com/u/rubystudent)\
**Replies:** 1\
**Last updated:** [October 27, 2008, 7:41pm UTC](https://www.ruby-forum.com/t/problems-with-pcacp-library/151838 "2008-10-27T19:41:07Z")

</div>

Hi! I want to work with the pcap library, and I installed libpcap and pcap library in Ubuntu, but when I try a code, there is an error: /usr/lib/ruby/1.8/pcaplet.rb:51:in lookupdev': no suitable device found (Pcap::Pc…

---

## [Undefined method 'uid' for nil::NilClass when running gem](https://www.ruby-forum.com/t/undefined-method-uid-for-nil-nilclass-when-running-gem/151883)

<div class="topic-metadata">

**Author:** [@gaudimila](https://www.ruby-forum.com/u/gaudimila)\
**Replies:** 2\
**Last updated:** [October 27, 2008, 5:20pm UTC](https://www.ruby-forum.com/t/undefined-method-uid-for-nil-nilclass-when-running-gem/151883 "2008-10-27T17:20:45Z")

</div>

Just updated to gem 1.3.0 on XP. gem -v 1.3.0 gem list ERROR: while executing gem … undefined method ‘uid’ for nil::NilClass Any ideas on this? If I wanted to try an earlier version of gem instead, how do I re…

---

## [Bowling Scores (#181)](https://www.ruby-forum.com/t/bowling-scores-181/151698)

<div class="topic-metadata">

**Author:** [@mansfiem](https://www.ruby-forum.com/u/mansfiem)\
**Replies:** 9\
**Last updated:** [October 27, 2008, 5:16pm UTC](https://www.ruby-forum.com/t/bowling-scores-181/151698 "2008-10-27T17:16:13Z")

</div>

Apologies for not having the Long Division quiz summary done yet. It will come sometime today or tomorrow. Meanwhile, I have the next quiz ready… -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- T…

---

## [Save object reference in db?](https://www.ruby-forum.com/t/save-object-reference-in-db/151877)

<div class="topic-metadata">

**Author:** [@jamal](https://www.ruby-forum.com/u/jamal)\
**Replies:** 3\
**Last updated:** [October 27, 2008, 4:51pm UTC](https://www.ruby-forum.com/t/save-object-reference-in-db/151877 "2008-10-27T16:51:31Z")

</div>

Hi everyone, I want to ask if it’s possible to save object reference in database for later use? Regards, Jamal

---

## [UTF-8 out of Hpricot](https://www.ruby-forum.com/t/utf-8-out-of-hpricot/151621)

<div class="topic-metadata">

**Author:** [@Diogo\_do\_Nascimento](https://www.ruby-forum.com/u/Diogo_do_Nascimento)\
**Replies:** 1\
**Last updated:** [October 27, 2008, 4:51pm UTC](https://www.ruby-forum.com/t/utf-8-out-of-hpricot/151621 "2008-10-27T16:51:24Z")

</div>

Hey, I’m trying to get some text out of an Hpricot Element but it’s not giving me the correct encoding. The text displays alright when I inspect the element. I’ve already set $KCODE to ‘U’ Thks.

---

## [Pro/Cons of Load System](https://www.ruby-forum.com/t/pro-cons-of-load-system/151886)

<div class="topic-metadata">

**Author:** [@tcsnide](https://www.ruby-forum.com/u/tcsnide)\
**Replies:** 0\
**Last updated:** [October 27, 2008, 3:16pm UTC](https://www.ruby-forum.com/t/pro-cons-of-load-system/151886 "2008-10-27T15:16:43Z")

</div>

When a path is added to the $LOAD\_PATH, all paths within it become part of the Ruby “libspace”. This means two separate packages can potentially conflict. Package 1 “foo”: lib/ foo/ ... baz/ ouch.rb Pack…

---

## [Join all text files in a folder, with a single line of Ruby code](https://www.ruby-forum.com/t/join-all-text-files-in-a-folder-with-a-single-line-of-ruby-code/151777)

<div class="topic-metadata">

**Author:** [@luisbebop](https://www.ruby-forum.com/u/luisbebop)\
**Replies:** 25\
**Last updated:** [October 27, 2008, 2:27pm UTC](https://www.ruby-forum.com/t/join-all-text-files-in-a-folder-with-a-single-line-of-ruby-code/151777 "2008-10-27T14:27:50Z")

</div>

I did a single line of code in Ruby, which joins all text files in a folder to a bigfile. I got some tests, and it’s works! Does anyone knows a better way, or other ‘Ruby Way’ to do that ? File.open(‘bigfile’,‘w’) { |…

---

## [Convert html to image](https://www.ruby-forum.com/t/convert-html-to-image/151482)

<div class="topic-metadata">

**Author:** [@cjokomay](https://www.ruby-forum.com/u/cjokomay)\
**Replies:** 5\
**Last updated:** [October 27, 2008, 2:21pm UTC](https://www.ruby-forum.com/t/convert-html-to-image/151482 "2008-10-27T14:21:23Z")

</div>

I would like to take an html file, or even just an html string, and convert it to an image (e.g. jpg or png). Unfortunately I have no idea where to even begin. I imagine that it would involve the use of rmagick, in fa…

---

## [Iconv problem - not handling \\r correctly](https://www.ruby-forum.com/t/iconv-problem-not-handling-r-correctly/151847)

<div class="topic-metadata">

**Author:** [@rainyglade](https://www.ruby-forum.com/u/rainyglade)\
**Replies:** 2\
**Last updated:** [October 27, 2008, 12:12pm UTC](https://www.ruby-forum.com/t/iconv-problem-not-handling-r-correctly/151847 "2008-10-27T12:12:39Z")

</div>

I have an XML file that I need to process. I’m working in the Windows environment. Here is the head of the file: 0000000000 Â â– \< \\0 A \\0 u \\0 t \\0 o \\0 S \\0 t \\0 0000000020 a \\0 …

---

## [Difference in behaviour using 'require' within threads](https://www.ruby-forum.com/t/difference-in-behaviour-using-require-within-threads/151779)

<div class="topic-metadata">

**Author:** [@captaffy](https://www.ruby-forum.com/u/captaffy)\
**Replies:** 2\
**Last updated:** [October 27, 2008, 8:55am UTC](https://www.ruby-forum.com/t/difference-in-behaviour-using-require-within-threads/151779 "2008-10-27T08:55:36Z")

</div>

Hi list, Following on from my previous question regarding threading I have observed what appears to be a difference in behaviour of ‘require’ when running code within a number of different threads. I’m not sure whethe…

---

## [Changing the gems version for ruby1.9 (in Ubuntu)](https://www.ruby-forum.com/t/changing-the-gems-version-for-ruby1-9-in-ubuntu/151865)

<div class="topic-metadata">

**Author:** [@puexian](https://www.ruby-forum.com/u/puexian)\
**Replies:** 0\
**Last updated:** [October 27, 2008, 7:45am UTC](https://www.ruby-forum.com/t/changing-the-gems-version-for-ruby1-9-in-ubuntu/151865 "2008-10-27T07:45:38Z")

</div>

I need a newer version of gems visible to my ruby1.9 installation. Ruby1.9 came bundled with an old version of gems. I have another gem installation which is visible to my ruby1.8 installation that would work, but I c…

---

## [Code Review: ido1](https://www.ruby-forum.com/t/code-review-ido1/151861)

<div class="topic-metadata">

**Author:** [@grujildo](https://www.ruby-forum.com/u/grujildo)\
**Replies:** 1\
**Last updated:** [October 27, 2008, 6:38am UTC](https://www.ruby-forum.com/t/code-review-ido1/151861 "2008-10-27T06:38:07Z")

</div>

tfpt review “/shelveset:ido1;REDMOND\\tomat” Comment : Implements Call, GetMember and Create dynamic object operations. Removes IOldDynamicObject dependencies. Improves Ruby hosting API. Also simplifies implementati…

---

## [Ncurses-ruby bugs](https://www.ruby-forum.com/t/ncurses-ruby-bugs/151862)

<div class="topic-metadata">

**Author:** [@sentinel](https://www.ruby-forum.com/u/sentinel)\
**Replies:** 0\
**Last updated:** [October 27, 2008, 5:02am UTC](https://www.ruby-forum.com/t/ncurses-ruby-bugs/151862 "2008-10-27T05:02:08Z")

</div>

Sorry for posting here. I mailed the email in the code 3 weeks back but no response. Berlios.de has closed bug reporting. dynamic\_field\_info (form\_wrap.c): The function takes 3 arrays, but was not allowing 3. I chan…

---

## [SimpleDelegator.new(SystemCallError.new(0)) and ==](https://www.ruby-forum.com/t/simpledelegator-new-systemcallerror-new-0-and/138401)

<div class="topic-metadata">

**Author:** [@Tanaka\_A](https://www.ruby-forum.com/u/Tanaka_A)\
**Replies:** 2\
**Last updated:** [October 27, 2008, 5:00am UTC](https://www.ruby-forum.com/t/simpledelegator-new-systemcallerror-new-0-and/138401 "2008-10-27T05:00:30Z")

</div>

e$B0J2\<$N$h$&$Ke(B == e$B$,BP\>N$G$J$$$N$O$h$m$7$/$J$$$s$8$c$J$$$G$7$ge(B e$B$&$+!#e(B % ./ruby -rdelegate -ve ‘e = SystemCallError.new(0) p SimpleDelegator.new(e) == e p e == SimpleDelegator.new(e)’ ruby 1.9.0 (2008…

---

## [Word + win32ole - how to find formatting of a word?](https://www.ruby-forum.com/t/word-win32ole-how-to-find-formatting-of-a-word/151768)

<div class="topic-metadata">

**Author:** [@mohits](https://www.ruby-forum.com/u/mohits)\
**Replies:** 5\
**Last updated:** [October 27, 2008, 4:21am UTC](https://www.ruby-forum.com/t/word-win32ole-how-to-find-formatting-of-a-word/151768 "2008-10-27T04:21:21Z")

</div>

HI! I’m trying to use Ruby and win32ole to parse a Word document. So far, I’m able to extract the style and text of each paragraph. That works great to convert it into individual divs (in the HTML CSS sense). Now, …

---

## [{Complex,Rational}::Unify](https://www.ruby-forum.com/t/complex-rational-unify/149191)

<div class="topic-metadata">

**Author:** [@Tadayoshi\_F](https://www.ruby-forum.com/u/Tadayoshi_F)\
**Replies:** 34\
**Last updated:** [October 27, 2008, 3:55am UTC](https://www.ruby-forum.com/t/complex-rational-unify/149191 "2008-10-27T03:55:02Z")

</div>

Complex e$B$He(B Rational e$B$G$O!“e(BUnify e$B$,Dj5A$5$l$?\>l9g!“2DG=$J$i@0?tEy$K@55,e(B e$B2=$9$k!”$H$$$&;EAH$,$”$j$^$9!#%.%j%.%j$G$9$,!"$3$N5!G=$r$3$N$^$^;D$7$Fe(B e$B$$$$$N$+3NG’$7$?$$$G$9!#e(B e$B$3$N5!G=$O!“KX$I…

---

## [XDG v0.4.0 released](https://www.ruby-forum.com/t/xdg-v0-4-0-released/151852)

<div class="topic-metadata">

**Author:** [@unknown](https://www.ruby-forum.com/u/unknown)\
**Replies:** 0\
**Last updated:** [October 26, 2008, 11:54pm UTC](https://www.ruby-forum.com/t/xdg-v0-4-0-released/151852 "2008-10-26T23:54:44Z")

</div>

= XDG 0.4 hits the streets! http://xdg.rubyforge.org XDG provides a module for supporting the XDG Base Directory Standard\[1\]. This release removes the xdg\_ prefix from the instance-level method names. Now module and …

---

## [Mac OS X Leopard - Ruby is 3X faster with disable-pthreads](https://www.ruby-forum.com/t/mac-os-x-leopard-ruby-is-3x-faster-with-disable-pthreads/151814)

<div class="topic-metadata">

**Author:** [@ericgoodwin](https://www.ruby-forum.com/u/ericgoodwin)\
**Replies:** 2\
**Last updated:** [October 26, 2008, 11:34pm UTC](https://www.ruby-forum.com/t/mac-os-x-leopard-ruby-is-3x-faster-with-disable-pthreads/151814 "2008-10-26T23:34:16Z")

</div>

I have a fast mac pro computer. I ran simple benchmark, and my computer took 13 seconds when equal/slower macs around my office were only taking 2.5 seconds to complete the exact same task. I also noticed that my rub…

---

## [Re: Unicode Source Files](https://www.ruby-forum.com/t/re-unicode-source-files/151844)

<div class="topic-metadata">

**Author:** [@raker\_t](https://www.ruby-forum.com/u/raker_t)\
**Replies:** 2\
**Last updated:** [October 26, 2008, 10:39pm UTC](https://www.ruby-forum.com/t/re-unicode-source-files/151844 "2008-10-26T22:39:10Z")

</div>

A lot of the work in 1.9 and 2.0 has gone to better unicode support. Most string handling functions are now codepoint aware, and there is now the ability for the source file to have an encoding attached to it. Like Cu…

---

## [Two Variables to One Definition?](https://www.ruby-forum.com/t/two-variables-to-one-definition/151841)

<div class="topic-metadata">

**Author:** [@superfly](https://www.ruby-forum.com/u/superfly)\
**Replies:** 3\
**Last updated:** [October 26, 2008, 10:28pm UTC](https://www.ruby-forum.com/t/two-variables-to-one-definition/151841 "2008-10-26T22:28:43Z")

</div>

Is it possible to send two different variables to one definition and then use them separately in that definition? Here’s what I’m trying to do. ============== #item = url #species = pet def exists(item) existingit…

---

## [Unicode Source Files](https://www.ruby-forum.com/t/unicode-source-files/151836)

<div class="topic-metadata">

**Author:** [@tmilker](https://www.ruby-forum.com/u/tmilker)\
**Replies:** 4\
**Last updated:** [October 26, 2008, 9:39pm UTC](https://www.ruby-forum.com/t/unicode-source-files/151836 "2008-10-26T21:39:23Z")

</div>

Is the DLR going to be fixed so that it properly supports Unicode source files or is this an issue with IronRuby? If you attempt to create a new Code File with Visual Studio 2008 and call it test.rb and then execute …

---

## [Long Division (#180)](https://www.ruby-forum.com/t/long-division-180/151843)

<div class="topic-metadata">

**Author:** [@mansfiem](https://www.ruby-forum.com/u/mansfiem)\
**Replies:** 0\
**Last updated:** [October 26, 2008, 9:01pm UTC](https://www.ruby-forum.com/t/long-division-180/151843 "2008-10-26T21:01:52Z")

</div>

Apologies for the delay with this quiz’s summary. Here ya go. Long division is sometimes called long division with remainders and is done repeatedly dividing the divisor into each digit of the dividend combined with t…

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

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