# Ruby

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

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

---

## [\#{} in xpath](https://www.ruby-forum.com/t/in-xpath/194852)

<div class="topic-metadata">

**Author:** [@luofeiyu](https://www.ruby-forum.com/u/luofeiyu)\
**Replies:** 3\
**Last updated:** [September 13, 2010, 7:15am UTC](https://www.ruby-forum.com/t/in-xpath/194852 "2010-09-13T07:15:59Z")

</div>

code1 data=doc.xpath(’.//small//span\[@id=“yfs\_t10\_aacc”\]’) puts data.text code2 str=“aacc” data=doc.xpath(’.//small//span\[@id=“yfs\_t10\_#{str}”\]’) puts data.text code1 can work,code2 can’t,would you mind to tell me…

---

## [Maven gems](https://www.ruby-forum.com/t/maven-gems/194887)

<div class="topic-metadata">

**Author:** [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Replies:** 0\
**Last updated:** [September 13, 2010, 6:46am UTC](https://www.ruby-forum.com/t/maven-gems/194887 "2010-09-13T06:46:43Z")

</div>

hello, I just want to draw your attention to blog post of mine which explains how to generate a gem out of a maven artifact: http://blog.mkristian.tk/2010/09/gem-wrappers-for-maven-artifacts-maven.html of course the …

---

## [Uninitialized constant Connector(Name Error)](https://www.ruby-forum.com/t/uninitialized-constant-connector-name-error/194846)

<div class="topic-metadata">

**Author:** [@thotheolh](https://www.ruby-forum.com/u/thotheolh)\
**Replies:** 3\
**Last updated:** [September 13, 2010, 6:00am UTC](https://www.ruby-forum.com/t/uninitialized-constant-connector-name-error/194846 "2010-09-13T06:00:30Z")

</div>

I have seen a thread that has nearly the same problems but I guess mine should be some other problems. I had my Connector.rb and test.rb classes next to each other so it should be able to interact. Do bear with me as…

---

## [Creating trivial classes with Struct.new (adding constraints](https://www.ruby-forum.com/t/creating-trivial-classes-with-struct-new-adding-constraints/194857)

<div class="topic-metadata">

**Author:** [@sentinel](https://www.ruby-forum.com/u/sentinel)\
**Replies:** 1\
**Last updated:** [September 13, 2010, 5:38am UTC](https://www.ruby-forum.com/t/creating-trivial-classes-with-struct-new-adding-constraints/194857 "2010-09-13T05:38:49Z")

</div>

I’d like to use this form for making small classes rather than hand coding my “beans”. ActionEvent = Struct.new(:source, :id, :text) do def xxx … end end However, is there anyway I can add some constraints, such as…

---

## [Rspec-2.0.0.beta.22 has been released!](https://www.ruby-forum.com/t/rspec-2-0-0-beta-22-has-been-released/194885)

<div class="topic-metadata">

**Author:** [@crucoba](https://www.ruby-forum.com/u/crucoba)\
**Replies:** 1\
**Last updated:** [September 13, 2010, 5:03am UTC](https://www.ruby-forum.com/t/rspec-2-0-0-beta-22-has-been-released/194885 "2010-09-13T05:03:43Z")

</div>

rspec-2.0.0.beta.22 has been released! We’re getting very close to a 2.0 release candidate, so if you’re not already using rspec-2 (with or without rails-3), now is the time to start. I need your feedback, so from her…

---

## [\[Ruby 1.9-Bug#3820\]\[Closed\] Float('0x0.') $B$,%(%i!\<$K$J$i$J$$(B](https://www.ruby-forum.com/t/ruby-1-9-bug-3820-closed-float-0x0-b-i-k-j-i-j-b/194884)

<div class="topic-metadata">

**Author:** [@Yui\_NARUSE](https://www.ruby-forum.com/u/Yui_NARUSE)\
**Replies:** 0\
**Last updated:** [September 13, 2010, 3:17am UTC](https://www.ruby-forum.com/t/ruby-1-9-bug-3820-closed-float-0x0-b-i-k-j-i-j-b/194884 "2010-09-13T03:17:46Z")

</div>

e$B%A%1%C%He(B #3820 e$B$,99?7$5$l$^$7$?!#e(B (by Yui NARUSE) 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 r29239. tadayoshi, thank yo…

---

## [64-bit integer](https://www.ruby-forum.com/t/64-bit-integer/194882)

<div class="topic-metadata">

**Author:** [@rawroe](https://www.ruby-forum.com/u/rawroe)\
**Replies:** 0\
**Last updated:** [September 13, 2010, 2:56am UTC](https://www.ruby-forum.com/t/64-bit-integer/194882 "2010-09-13T02:56:42Z")

</div>

Hi, I’m doing a lot of bitwise operations and I need numbers that are truly 64 bits. My problem is that I can’t seem to contain them as such. If I shift off the left or right side, I want the bits to just fall off a…

---

## [RJB - getting NoClassDefFoundError on import of JAVA class](https://www.ruby-forum.com/t/rjb-getting-noclassdeffounderror-on-import-of-java-class/194847)

<div class="topic-metadata">

**Author:** [@anukulsinghal](https://www.ruby-forum.com/u/anukulsinghal)\
**Replies:** 3\
**Last updated:** [September 13, 2010, 12:44am UTC](https://www.ruby-forum.com/t/rjb-getting-noclassdeffounderror-on-import-of-java-class/194847 "2010-09-13T00:44:21Z")

</div>

Hi, I am using rjb gem, and trying to import a JAVA class. The JAVA API documentation is located at: http://www.jarvana.com/jarvana/view/com/jayway/android/robotium/robotium-solo/1.1.1/robotium-solo-1.1.1-javadoc.jar…

---

## [Wait on external program?](https://www.ruby-forum.com/t/wait-on-external-program/194864)

<div class="topic-metadata">

**Author:** [@larryj](https://www.ruby-forum.com/u/larryj)\
**Replies:** 3\
**Last updated:** [September 12, 2010, 10:21pm UTC](https://www.ruby-forum.com/t/wait-on-external-program/194864 "2010-09-12T22:21:32Z")

</div>

Launching external .exe (windows) using: IO.popen(appname) I need to wait for that app to finish(close) so I can use its results. Any help? Thanks.

---

## [Sqlite3-ruby failing on 1.9.2?](https://www.ruby-forum.com/t/sqlite3-ruby-failing-on-1-9-2/194822)

<div class="topic-metadata">

**Author:** [@sentinel](https://www.ruby-forum.com/u/sentinel)\
**Replies:** 4\
**Last updated:** [September 12, 2010, 9:53pm UTC](https://www.ruby-forum.com/t/sqlite3-ruby-failing-on-1-9-2/194822 "2010-09-12T21:53:27Z")

</div>

I have apps working on 1.9.1 but simple inserts are failing on 1.9.2. Is there some change in versions required, I’ve got latest versions. OS X 10.6 sqlite3 3.6.22 sqlite3-ruby 1.3.1 If I issue as simple stat…

---

## [How to do same as perl's crypt?](https://www.ruby-forum.com/t/how-to-do-same-as-perls-crypt/194867)

<div class="topic-metadata">

**Author:** [@twtw](https://www.ruby-forum.com/u/twtw)\
**Replies:** 1\
**Last updated:** [September 12, 2010, 8:27pm UTC](https://www.ruby-forum.com/t/how-to-do-same-as-perls-crypt/194867 "2010-09-12T20:27:11Z")

</div>

in linux type: $ openssl passwd ruby get the encrypted string ‘2z8GoTY1O2T3A’, and paste to the followed perl script: test.pl $encrypted\_password = “2z8GoTY1O2T3A”; $input = $ARGV\[0\]; if (crypt($input,$encrypted\_pa…

---

## [Key Associated w/ Maximum Value in Hash](https://www.ruby-forum.com/t/key-associated-w-maximum-value-in-hash/194689)

<div class="topic-metadata">

**Author:** [@tuatha](https://www.ruby-forum.com/u/tuatha)\
**Replies:** 10\
**Last updated:** [September 12, 2010, 8:10pm UTC](https://www.ruby-forum.com/t/key-associated-w-maximum-value-in-hash/194689 "2010-09-12T20:10:59Z")

</div>

Simple question: what’s the cleanest way to retrieve a key associated with the maximum value of a hash. For instance, how do I retrieve ‘b’ from the following example: hash = Hash.new hash\[‘a’\]=4 hash\[‘b’\]=10 has…

---

## [Variations to gets.chomp for user input?!](https://www.ruby-forum.com/t/variations-to-gets-chomp-for-user-input/194862)

<div class="topic-metadata">

**Author:** [@timrohde](https://www.ruby-forum.com/u/timrohde)\
**Replies:** 0\
**Last updated:** [September 12, 2010, 4:55pm UTC](https://www.ruby-forum.com/t/variations-to-gets-chomp-for-user-input/194862 "2010-09-12T16:55:33Z")

</div>

What good alternatives to read user input are their in Ruby?! I have been using the gets.chomp method. But if you wanna pass in a range of valid options to get read?! Like for example option 1 takes you somewhere and …

---

## [How to do foo.chomp!.rstrip!.downcase!?](https://www.ruby-forum.com/t/how-to-do-foo-chomp-rstrip-downcase/194761)

<div class="topic-metadata">

**Author:** [@geometic](https://www.ruby-forum.com/u/geometic)\
**Replies:** 14\
**Last updated:** [September 12, 2010, 3:22pm UTC](https://www.ruby-forum.com/t/how-to-do-foo-chomp-rstrip-downcase/194761 "2010-09-12T15:22:24Z")

</div>

Rather than: foo.chomp! foo.rstrip! foo.downcase! …it seems like I should be able to do: foo.chomp!.rstrip!.downcase! …but I get: undefined method \`downcase!’ for nil:NilClass (NoMethodError) This is probably a b…

---

## [\[Ruby 1.9-Bug#3820\]\[Open\] Float('0x0.') $B$,%(%i!\<$K$J$i$J$$(B](https://www.ruby-forum.com/t/ruby-1-9-bug-3820-open-float-0x0-b-i-k-j-i-j-b/194856)

<div class="topic-metadata">

**Author:** [@tadayoshi\_funaba](https://www.ruby-forum.com/u/tadayoshi_funaba)\
**Replies:** 0\
**Last updated:** [September 12, 2010, 2:57pm UTC](https://www.ruby-forum.com/t/ruby-1-9-bug-3820-open-float-0x0-b-i-k-j-i-j-b/194856 "2010-09-12T14:57:14Z")

</div>

Bug #3820: Float(‘0x0.’) e$B$,%(%i!\<$K$J$i$J$$e(B http://redmine.ruby-lang.org/issues/show/3820 e$B5/I\<\<Te(B: tadayoshi funaba e$B%9%F!\<%?%9e(B: Open, e$BM%@hEYe(B: Low ruby -v: ruby 1.9.3dev (2010-09-12 trunk 29233)…

---

## [Rcairo 1.10.0](https://www.ruby-forum.com/t/rcairo-1-10-0/194849)

<div class="topic-metadata">

**Author:** [@Kouhei\_S](https://www.ruby-forum.com/u/Kouhei_S)\
**Replies:** 0\
**Last updated:** [September 12, 2010, 9:47am UTC](https://www.ruby-forum.com/t/rcairo-1-10-0/194849 "2010-09-12T09:47:02Z")

</div>

Hi, I released rcairo(\*1) 1.10.0 that supports cairo 1.10.0: http://raa.ruby-lang.org/project/rcairo/ (\*1) A library to use cairo(\*2) from Ruby. (\*2) A 2D graphics library that is used by GTK+/Firefox/WebKit/… as re…

---

## [Best way to get compile-time configuration for building/linking against Ruby?](https://www.ruby-forum.com/t/best-way-to-get-compile-time-configuration-for-building-linking-against-ruby/194823)

<div class="topic-metadata">

**Author:** [@Eric\_MSP\_Veith](https://www.ruby-forum.com/u/Eric_MSP_Veith)\
**Replies:** 4\
**Last updated:** [September 11, 2010, 11:00pm UTC](https://www.ruby-forum.com/t/best-way-to-get-compile-time-configuration-for-building-linking-against-ruby/194823 "2010-09-11T23:00:57Z")

</div>

\-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hello list, I want to embed the Ruby interpreter in a project and am currently fiddeling with getting Ruby’s compile-time configuration, e.g. include and libraries pat…

---

## [Redundant utf-8 sequence](https://www.ruby-forum.com/t/redundant-utf-8-sequence/194807)

<div class="topic-metadata">

**Author:** [@pyr0](https://www.ruby-forum.com/u/pyr0)\
**Replies:** 1\
**Last updated:** [September 11, 2010, 9:44pm UTC](https://www.ruby-forum.com/t/redundant-utf-8-sequence/194807 "2010-09-11T21:44:16Z")

</div>

I am calling to\_json on a string using jruby-1.5.2 and json-jruby 1.4.6 and i am receiving the following error: INFO: ArgumentError - redundant UTF-8 sequence: /home/ubuntu/.rvm/gems/jruby-1.5.2/gems/activesupport-2.3…

---

## [Simply open a file using a variable](https://www.ruby-forum.com/t/simply-open-a-file-using-a-variable/194826)

<div class="topic-metadata">

**Author:** [@doxxer](https://www.ruby-forum.com/u/doxxer)\
**Replies:** 3\
**Last updated:** [September 11, 2010, 9:10pm UTC](https://www.ruby-forum.com/t/simply-open-a-file-using-a-variable/194826 "2010-09-11T21:10:47Z")

</div>

Hi, iÂ´m totally new to ruby and have a tiny little problem. IÂ´d like to open a file located in a specific directory on a specific drive with spaces in the path (Vista). Example: “f:\\abc def\\new\\this is my file.txt…

---

## [SecureRandom$B$,CY$$(B](https://www.ruby-forum.com/t/securerandom-b-cy-b/194783)

<div class="topic-metadata">

**Author:** [@unknown](https://www.ruby-forum.com/u/unknown)\
**Replies:** 1\
**Last updated:** [September 11, 2010, 8:07pm UTC](https://www.ruby-forum.com/t/securerandom-b-cy-b/194783 "2010-09-11T20:07:06Z")

</div>

MoonWolfe$B$G$9!#e(B lib/securerandom.rbe$B$,$$$m$$$m$JLL$GCY$$$h$&$J5$$,$7$^$9!#e(B (a)random\_bytese$B$,\<B9T$5$l$k$^$G\<BAu$,7h$^$i$J$$e(B loade$B;~$Ke(Brandom\_bytese$B$r$=$l$\>$lDj5A$7$?$\[$&$,8zN(E\*$8$c$J$$$G$9$+e(B? …

---

## [Username Generator](https://www.ruby-forum.com/t/username-generator/194828)

<div class="topic-metadata">

**Author:** [@humandictionary](https://www.ruby-forum.com/u/humandictionary)\
**Replies:** 1\
**Last updated:** [September 11, 2010, 8:05pm UTC](https://www.ruby-forum.com/t/username-generator/194828 "2010-09-11T20:05:20Z")

</div>

How would one go about starting to write this? I don’t want you to write the code for me, but I don’t want to use any gems. I just need to know of some modules or something I should look into. Thanks in advance.

---

## [File descriptor leak using persistent connections with Net::Http](https://www.ruby-forum.com/t/file-descriptor-leak-using-persistent-connections-with-net-http/192275)

<div class="topic-metadata">

**Author:** [@pardeeb](https://www.ruby-forum.com/u/pardeeb)\
**Replies:** 10\
**Last updated:** [September 11, 2010, 6:32pm UTC](https://www.ruby-forum.com/t/file-descriptor-leak-using-persistent-connections-with-net-http/192275 "2010-09-11T18:32:16Z")

</div>

Our webapp is a mashup of several suppliers who we communicate with using Net::Http. I thought it would improve performance if we used persistent connections so I modified one of the suppliers to use the Net::Http::…

---

## [Why is pathname being moved to ext?](https://www.ruby-forum.com/t/why-is-pathname-being-moved-to-ext/194777)

<div class="topic-metadata">

**Author:** [@Yusuke\_ENDOH](https://www.ruby-forum.com/u/Yusuke_ENDOH)\
**Replies:** 1\
**Last updated:** [September 11, 2010, 4:49pm UTC](https://www.ruby-forum.com/t/why-is-pathname-being-moved-to-ext/194777 "2010-09-11T16:49:14Z")

</div>

akr e$B$5$se(B e$B1sF#$G$9!#e(B akr e$B$5$s$O:G6ae(B Pathname e$B$re(B pure Ruby e$B$+$ie(B C e$B$K0?"$5$l$F$$$^$9$,!"e(B e$BL\\E\*$O$J$s$G$7$g$&$+!#e(B http://redmine.ruby-lang.org/issues/show/3478 http://redmine.ru…

---

## [Rubyzip - \`dup': can't dup NilClass (TypeError)](https://www.ruby-forum.com/t/rubyzip-dup-cant-dup-nilclass-typeerror/189805)

<div class="topic-metadata">

**Author:** [@lukich](https://www.ruby-forum.com/u/lukich)\
**Replies:** 10\
**Last updated:** [September 11, 2010, 2:13pm UTC](https://www.ruby-forum.com/t/rubyzip-dup-cant-dup-nilclass-typeerror/189805 "2010-09-11T14:13:40Z")

</div>

Hello. I’ve trying to figure out rubyzip. Here’s the code I had: require ‘rubygems’ require ‘zip/zip’ zf = Zip::ZipFile.open(‘616910.zip’) However, when I run it, it throws an error /Users/lukastolyarov/.gem/ruby/…

---

## [How to run redmine under ruby 1.9.2?](https://www.ruby-forum.com/t/how-to-run-redmine-under-ruby-1-9-2/194818)

<div class="topic-metadata">

**Author:** [@jason\_joo](https://www.ruby-forum.com/u/jason_joo)\
**Replies:** 1\
**Last updated:** [September 11, 2010, 12:53pm UTC](https://www.ruby-forum.com/t/how-to-run-redmine-under-ruby-1-9-2/194818 "2010-09-11T12:53:23Z")

</div>

ubuntu 10.04 ruby 1.9.2 I use ruby 1.9.2 for some new applications and i found that redmine can’t be run under it. how to solve this? or how to install both 1.9.2 and 1.8.7 and both work correctly? thanks jason

---

## [\[ANN\] Mail 2.2.6 Released](https://www.ruby-forum.com/t/ann-mail-2-2-6-released/194813)

<div class="topic-metadata">

**Author:** [@Mikel\_L](https://www.ruby-forum.com/u/Mikel_L)\
**Replies:** 0\
**Last updated:** [September 11, 2010, 7:49am UTC](https://www.ruby-forum.com/t/ann-mail-2-2-6-released/194813 "2010-09-11T07:49:05Z")

</div>

So after an intense day of bug squashing, I am pleased to announce Mail 2.2.6. Mail 2.2.6 is a bug fix release mainly, all users of the 2.2 series should definitely update. Changes include: Fixed parsing an email w…

---

## [Ruby's regex](https://www.ruby-forum.com/t/rubys-regex/194809)

<div class="topic-metadata">

**Author:** [@Young\_W](https://www.ruby-forum.com/u/Young_W)\
**Replies:** 2\
**Last updated:** [September 11, 2010, 5:50am UTC](https://www.ruby-forum.com/t/rubys-regex/194809 "2010-09-11T05:50:18Z")

</div>

However, regular expression support is typically built into only scripting languages, such as Ruby, Perl, and awk. This is a shame: regular expressions, although cryptic, are a powerful tool for working with text. An…

---

## [Problem in hash and symbol](https://www.ruby-forum.com/t/problem-in-hash-and-symbol/194802)

<div class="topic-metadata">

**Author:** [@amiref](https://www.ruby-forum.com/u/amiref)\
**Replies:** 3\
**Last updated:** [September 11, 2010, 12:42am UTC](https://www.ruby-forum.com/t/problem-in-hash-and-symbol/194802 "2010-09-11T00:42:31Z")

</div>

Hi everybody I have a question about hash and symbol. when I use symbol for key in hash , it didn’t for me. what is the problem ? (example : hash = { :odd =\> \[ 1 , 3 , 5 \] , :even =\> \[ 2 , 4 , 6 \] , :7 =\> “chance” , …

---

## [Rubyforge \<-\> gemcutter issues](https://www.ruby-forum.com/t/rubyforge-gemcutter-issues/194787)

<div class="topic-metadata">

**Author:** [@ahoward](https://www.ruby-forum.com/u/ahoward)\
**Replies:** 6\
**Last updated:** [September 10, 2010, 10:30pm UTC](https://www.ruby-forum.com/t/rubyforge-gemcutter-issues/194787 "2010-09-10T22:30:50Z")

</div>

this is an issue gem publishers need to be aware off: RubyGems.org: Discussion until it’s fixed it’s possible that your releases are not making it to other people’s machines during ‘gem install’ fyi.

---

## [Rake task dependencies question](https://www.ruby-forum.com/t/rake-task-dependencies-question/194785)

<div class="topic-metadata">

**Author:** [@rawroe](https://www.ruby-forum.com/u/rawroe)\
**Replies:** 3\
**Last updated:** [September 10, 2010, 10:24pm UTC](https://www.ruby-forum.com/t/rake-task-dependencies-question/194785 "2010-09-10T22:24:59Z")

</div>

Quick question about rake task dependencies. Suppose I have the following: task :prepare\_to\_fight =\> :has\_weapons do … end task :attack\_with\_gun =\> :prepare\_to\_fight do … end task :attack\_with\_sword =\> :prepare\_t…

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

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