# Ruby

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

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

---

## [Memory usage with blocks](https://www.ruby-forum.com/t/memory-usage-with-blocks/154623)

<div class="topic-metadata">

**Author:** [@John\_Ky](https://www.ruby-forum.com/u/John_Ky)\
**Replies:** 5\
**Last updated:** [December 3, 2008, 9:20am UTC](https://www.ruby-forum.com/t/memory-usage-with-blocks/154623 "2008-12-03T09:20:18Z")

</div>

Hi all, I’ve got some code, which when run uses a lot of memory (aprox 600 MB for a particular given input). I am trying to figure out why it is using so much. When I replace the following code: head.p…

---

## [FFI 0.1.1 (Foreign Function Interface) for Ruby 1.8.6/7 and 1.9](https://www.ruby-forum.com/t/ffi-0-1-1-foreign-function-interface-for-ruby-1-8-6-7-and-1-9/152267)

<div class="topic-metadata">

**Author:** [@headius](https://www.ruby-forum.com/u/headius)\
**Replies:** 61\
**Last updated:** [December 3, 2008, 3:36am UTC](https://www.ruby-forum.com/t/ffi-0-1-1-foreign-function-interface-for-ruby-1-8-6-7-and-1-9/152267 "2008-12-03T03:36:15Z")

</div>

The JRuby team is proud to announce the release of FFI for Ruby 1.8.6/7 and 1.9! FFI (gem install ffi) is a library for programmatically loading dynamic libraries, binding functions within them, and calling those func…

---

## [Crate 0.1.1 Released](https://www.ruby-forum.com/t/crate-0-1-1-released/154564)

<div class="topic-metadata">

**Author:** [@jeremyheiler](https://www.ruby-forum.com/u/jeremyheiler)\
**Replies:** 9\
**Last updated:** [December 3, 2008, 3:25am UTC](https://www.ruby-forum.com/t/crate-0-1-1-released/154564 "2008-12-03T03:25:42Z")

</div>

I’m pleased to announce that Crate, the project I spoke on at RubyConf this year, has reached a releasable stage. gem install crate Crate is a tool to help package up your application as a custom static build of the …

---

## [Substring with "..."](https://www.ruby-forum.com/t/substring-with/154657)

<div class="topic-metadata">

**Author:** [@admon](https://www.ruby-forum.com/u/admon)\
**Replies:** 8\
**Last updated:** [December 3, 2008, 2:40am UTC](https://www.ruby-forum.com/t/substring-with/154657 "2008-12-03T02:40:36Z")

</div>

Hi! I want to know what is the method to take a string and return a substring with 20 characters and “…” if the length of the string is greater, or the complete string if it’s shorter than 20 characters. Thanks all.

---

## [TCP Server](https://www.ruby-forum.com/t/tcp-server/154466)

<div class="topic-metadata">

**Author:** [@bakkhoz](https://www.ruby-forum.com/u/bakkhoz)\
**Replies:** 6\
**Last updated:** [December 3, 2008, 12:24am UTC](https://www.ruby-forum.com/t/tcp-server/154466 "2008-12-03T00:24:54Z")

</div>

Hi, i’m going to code a game server, i’m new in ruby an would like to hear some advice about it. I mean, good practices in server programming and what i have to take into account like security issues. Thanks, and exc…

---

## [Trying to get back into Tk](https://www.ruby-forum.com/t/trying-to-get-back-into-tk/154678)

<div class="topic-metadata">

**Author:** [@Kenneth\_McDonald](https://www.ruby-forum.com/u/Kenneth_McDonald)\
**Replies:** 1\
**Last updated:** [December 3, 2008, 12:05am UTC](https://www.ruby-forum.com/t/trying-to-get-back-into-tk/154678 "2008-12-03T00:05:35Z")

</div>

After a hiatus of many years, I’m trying to get back into Tk via Ruby. Unfortunately, my first attempt–a simple text box with attached scroll bar–doesn’t work very well. The scroll bar doesn’t show up, and the text bo…

---

## [More tk stuff](https://www.ruby-forum.com/t/more-tk-stuff/154683)

<div class="topic-metadata">

**Author:** [@Kenneth\_McDonald](https://www.ruby-forum.com/u/Kenneth_McDonald)\
**Replies:** 1\
**Last updated:** [December 3, 2008, 12:04am UTC](https://www.ruby-forum.com/t/more-tk-stuff/154683 "2008-12-03T00:04:25Z")

</div>

OK, I dug up an answer to my previous question; here’s code to implement a window with scrollbars: require ‘tk’ root = TkRoot.new() { title “(Sc)rolling, (sc)rolling), (sc)rolling…” } xbar = TkScrollbar.new(root, ‘o…

---

## [How do you read text file by creating a Hash in a script?](https://www.ruby-forum.com/t/how-do-you-read-text-file-by-creating-a-hash-in-a-script/154682)

<div class="topic-metadata">

**Author:** [@mmcolli00](https://www.ruby-forum.com/u/mmcolli00)\
**Replies:** 4\
**Last updated:** [December 2, 2008, 11:02pm UTC](https://www.ruby-forum.com/t/how-do-you-read-text-file-by-creating-a-hash-in-a-script/154682 "2008-12-02T23:02:48Z")

</div>

This is some example contents of my text file: logzT09.txt 00834 tue z0sdf 01230 wed z0sdf 34234 tue wet0f How can I read this in another ruby script by using an Hash? I am wanting to use certain lines/words to comp…

---

## [Class atrr\_accessor](https://www.ruby-forum.com/t/class-atrr-accessor/154669)

<div class="topic-metadata">

**Author:** [@ole](https://www.ruby-forum.com/u/ole)\
**Replies:** 2\
**Last updated:** [December 2, 2008, 9:18pm UTC](https://www.ruby-forum.com/t/class-atrr-accessor/154669 "2008-12-02T21:18:30Z")

</div>

Why does this not work? class Foo self.class.attr\_accessor :baz end TypeError: Foo is not a class from (irb):19 I understand that the class \<\< self idiom can be used to work around this problem but I would lik…

---

## [Very strange error when storing a date value in rails session](https://www.ruby-forum.com/t/very-strange-error-when-storing-a-date-value-in-rails-session/154664)

<div class="topic-metadata">

**Author:** [@typej](https://www.ruby-forum.com/u/typej)\
**Replies:** 1\
**Last updated:** [December 2, 2008, 9:07pm UTC](https://www.ruby-forum.com/t/very-strange-error-when-storing-a-date-value-in-rails-session/154664 "2008-12-02T21:07:55Z")

</div>

Hi all, I’ve run into a very strange error and was wondering if anyone out there could give me a hand… I’ve been able to reproduce the error consistently now and still, it seems that I am completely missing where/why…

---

## [Ruby to JSON - how to store javascript functions](https://www.ruby-forum.com/t/ruby-to-json-how-to-store-javascript-functions/154673)

<div class="topic-metadata">

**Author:** [@splattael](https://www.ruby-forum.com/u/splattael)\
**Replies:** 0\
**Last updated:** [December 2, 2008, 8:43pm UTC](https://www.ruby-forum.com/t/ruby-to-json-how-to-store-javascript-functions/154673 "2008-12-02T20:43:50Z")

</div>

Hey guys, I am working on a small plug-in which stores settings in a yaml file, e.g.: :before: var lastsel2; :params: :url: http://www.google.com :datatype: xml :mtype: GET etc., then later turning them into js …

---

## [Code Tunning](https://www.ruby-forum.com/t/code-tunning/154670)

<div class="topic-metadata">

**Author:** [@fearx](https://www.ruby-forum.com/u/fearx)\
**Replies:** 2\
**Last updated:** [December 2, 2008, 8:37pm UTC](https://www.ruby-forum.com/t/code-tunning/154670 "2008-12-02T20:37:23Z")

</div>

Hi! there is a better way to do that? if anArray.include?(id) state=‘YES’ else state=‘NOT’ end puts “#{id}: #{state} included” Thanks!

---

## [No such file to load sqlite3](https://www.ruby-forum.com/t/no-such-file-to-load-sqlite3/154095)

<div class="topic-metadata">

**Author:** [@benjohnson](https://www.ruby-forum.com/u/benjohnson)\
**Replies:** 9\
**Last updated:** [December 2, 2008, 7:21pm UTC](https://www.ruby-forum.com/t/no-such-file-to-load-sqlite3/154095 "2008-12-02T19:21:59Z")

</div>

Ever since I updated my gems I have been getting the following error any time I want to use sqlite in ruby: no such file to load – sqlite3 (MissingSourceFile) I tracked it down to a problem with do\_sqlite3. So I decid…

---

## [Adventures in Optimization... or why CONST frozen is Good](https://www.ruby-forum.com/t/adventures-in-optimization-or-why-const-frozen-is-good/154591)

<div class="topic-metadata">

**Author:** [@amin1426](https://www.ruby-forum.com/u/amin1426)\
**Replies:** 4\
**Last updated:** [December 2, 2008, 4:39pm UTC](https://www.ruby-forum.com/t/adventures-in-optimization-or-why-const-frozen-is-good/154591 "2008-12-02T16:39:41Z")

</div>

…or when a language design level optimization is a pessimization. Ruby allows destructive string operations. String instance methods with a “Bang!” at the end. Consider this code. a = \[‘froot’\] b=a.first c = {“d”=\>b…

---

## [Mechanize and encoding](https://www.ruby-forum.com/t/mechanize-and-encoding/153916)

<div class="topic-metadata">

**Author:** [@aspartam](https://www.ruby-forum.com/u/aspartam)\
**Replies:** 1\
**Last updated:** [December 2, 2008, 4:03pm UTC](https://www.ruby-forum.com/t/mechanize-and-encoding/153916 "2008-12-02T16:03:34Z")

</div>

I’m trying to scrape a page that both HTTP-header and the HMTL document claim is UTF-8, but all special characters are substituted by a question mark when I use Mechanize/Hpricot to scrape some accented strings and sa…

---

## [Ruby Database Application](https://www.ruby-forum.com/t/ruby-database-application/154626)

<div class="topic-metadata">

**Author:** [@rapido](https://www.ruby-forum.com/u/rapido)\
**Replies:** 3\
**Last updated:** [December 2, 2008, 3:49pm UTC](https://www.ruby-forum.com/t/ruby-database-application/154626 "2008-12-02T15:49:34Z")

</div>

Can someone upload a database application on Ruby? preferably an Inventory and Point of Sale that will run on Windows, I want to learn Ruby by learning the codes on a complete app. Thank you

---

## [Does A\_UNDERLINE work in Ncurses-ruby?](https://www.ruby-forum.com/t/does-a-underline-work-in-ncurses-ruby/154486)

<div class="topic-metadata">

**Author:** [@sentinel](https://www.ruby-forum.com/u/sentinel)\
**Replies:** 1\
**Last updated:** [December 2, 2008, 3:47pm UTC](https://www.ruby-forum.com/t/does-a-underline-work-in-ncurses-ruby/154486 "2008-12-02T15:47:11Z")

</div>

Has anyone used this attribute while printing to a window ? It is not working on my system from ruby (although it works from a C program, and also using Highline which uses escape sequences). Please let me know if you…

---

## [Problem migrating from rails 2.1.2 to 2.2.2](https://www.ruby-forum.com/t/problem-migrating-from-rails-2-1-2-to-2-2-2/154630)

<div class="topic-metadata">

**Author:** [@Miika\_LeppSSS\_nen](https://www.ruby-forum.com/u/Miika_LeppSSS_nen)\
**Replies:** 4\
**Last updated:** [December 2, 2008, 3:43pm UTC](https://www.ruby-forum.com/t/problem-migrating-from-rails-2-1-2-to-2-2-2/154630 "2008-12-02T15:43:05Z")

</div>

Hello My setup: Rails application generated with jRuby 1.1.5, Bort and Rails 2.1.2 Upgraded Rails to 2.2.2 Changed AASM, rspec, rspec-rails plugins to gems Upgraded jruby to 1.1.5 (ruby 1.8.6 patchlevel 114) (2008-12-…

---

## [While loop in a here documents](https://www.ruby-forum.com/t/while-loop-in-a-here-documents/154598)

<div class="topic-metadata">

**Author:** [@equinox](https://www.ruby-forum.com/u/equinox)\
**Replies:** 5\
**Last updated:** [December 2, 2008, 3:40pm UTC](https://www.ruby-forum.com/t/while-loop-in-a-here-documents/154598 "2008-12-02T15:40:44Z")

</div>

I have a here documents of something like this: form = \<\<“DONE” while( bla …bla … bla) do this DONE How can I do a while loop inside a here documents in ruby? Is it possible?

---

## [Regexp problem](https://www.ruby-forum.com/t/regexp-problem/154244)

<div class="topic-metadata">

**Author:** [@novice\_user](https://www.ruby-forum.com/u/novice_user)\
**Replies:** 4\
**Last updated:** [December 2, 2008, 3:35pm UTC](https://www.ruby-forum.com/t/regexp-problem/154244 "2008-12-02T15:35:21Z")

</div>

Hi, I have been searching on the Internet about how to solve my problem. I have a string that needs to be split using regexp in ruby. The problem is that I cannot find a way to get it right. The string has a fix form…

---

## [Identity Token (Rails 2) and REST APIs](https://www.ruby-forum.com/t/identity-token-rails-2-and-rest-apis/154602)

<div class="topic-metadata">

**Author:** [@e\_deleflie](https://www.ruby-forum.com/u/e_deleflie)\
**Replies:** 1\
**Last updated:** [December 2, 2008, 2:42pm UTC](https://www.ruby-forum.com/t/identity-token-rails-2-and-rest-apis/154602 "2008-12-02T14:42:44Z")

</div>

All, I’ve got a remote application that is used for posting data to my Rails 2 app. Took me about a day to realise that my posting wasn’t working because my submitted form did not contain an identity token (introduce…

---

## [Timeout error](https://www.ruby-forum.com/t/timeout-error/154609)

<div class="topic-metadata">

**Author:** [@manoah](https://www.ruby-forum.com/u/manoah)\
**Replies:** 1\
**Last updated:** [December 2, 2008, 2:41pm UTC](https://www.ruby-forum.com/t/timeout-error/154609 "2008-12-02T14:41:46Z")

</div>

I am getting timeout error while sending request to API c:/ruby/lib/ruby/1.8/timeout.rb:57:in rbuf\_fill': execution expired (Timeout::Error) from c:/ruby/lib/ruby/1.8/timeout.rb:59:intimeout’ from c:/ruby/lib/ruby/1.8/…

---

## [RubyPeople - I am after a Ruby on Rails Developer for the UK](https://www.ruby-forum.com/t/rubypeople-i-am-after-a-ruby-on-rails-developer-for-the-uk/154627)

<div class="topic-metadata">

**Author:** [@micky](https://www.ruby-forum.com/u/micky)\
**Replies:** 0\
**Last updated:** [December 2, 2008, 11:15am UTC](https://www.ruby-forum.com/t/rubypeople-i-am-after-a-ruby-on-rails-developer-for-the-uk/154627 "2008-12-02T11:15:59Z")

</div>

Ruby-People.com - Due to recent relocation an opportunity has arisen for 2 creative and highly skilled Ruby on Rails Developers with at least 1 year’s commercial experience to join our client - a leading Internet serv…

---

## [Array deletion](https://www.ruby-forum.com/t/array-deletion/154619)

<div class="topic-metadata">

**Author:** [@jazzezravi](https://www.ruby-forum.com/u/jazzezravi)\
**Replies:** 6\
**Last updated:** [December 2, 2008, 10:27am UTC](https://www.ruby-forum.com/t/array-deletion/154619 "2008-12-02T10:27:01Z")

</div>

Hi All, have an array like, a=\[“one”,“xcxc”,“two”,“dadasd”,“three”,“hgfhgfh”\] I want to delete the index of a\[1\],a\[3\] and so on… Thanks in advance, P.Raveendran

---

## [Reddy 0.1.0 released](https://www.ruby-forum.com/t/reddy-0-1-0-released/154621)

<div class="topic-metadata">

**Author:** [@tom-mac](https://www.ruby-forum.com/u/tom-mac)\
**Replies:** 0\
**Last updated:** [December 2, 2008, 9:20am UTC](https://www.ruby-forum.com/t/reddy-0-1-0-released/154621 "2008-12-02T09:20:45Z")

</div>

Just a quick announcement: Reddy 0.1.0 has been released. It’s a libxml-ruby-based RDF library for Ruby (currently just C-based Ruby, although we hope to have it running on top of other Ruby platforms soon). There has…

---

## [Newbie in Ruby...Issues while connecting Ruby with Sqlite3](https://www.ruby-forum.com/t/newbie-in-ruby-issues-while-connecting-ruby-with-sqlite3/154613)

<div class="topic-metadata">

**Author:** [@graphicmist](https://www.ruby-forum.com/u/graphicmist)\
**Replies:** 2\
**Last updated:** [December 2, 2008, 8:11am UTC](https://www.ruby-forum.com/t/newbie-in-ruby-issues-while-connecting-ruby-with-sqlite3/154613 "2008-12-02T08:11:04Z")

</div>

Hi, I am a newbie in Ruby. Its very interesting language. Now, my problem is with the below code. require ‘rubygems’ require ‘sqlite3’ db = SQLite3:atabase.new( “test2.db” ) db.execute(“create table t1 (id INTEGER …

---

## [\[ANN\] Ruby 1.9.1 Preview 2 Released](https://www.ruby-forum.com/t/ann-ruby-1-9-1-preview-2-released/154542)

<div class="topic-metadata">

**Author:** [@Yugui\_SYuki\_S.S](https://www.ruby-forum.com/u/Yugui_SYuki_S.S)\
**Replies:** 1\
**Last updated:** [December 2, 2008, 8:06am UTC](https://www.ruby-forum.com/t/ann-ruby-1-9-1-preview-2-released/154542 "2008-12-02T08:06:58Z")

</div>

Ruby 1.9.1 Preview 2 has been released. This is a preview release of Ruby 1.9, which will be the first stable version of Ruby 1.9 series. If you encounter a bug or a problem, please let us know it via the official is…

---

## [Not a Ruby person but trying to help a newbie](https://www.ruby-forum.com/t/not-a-ruby-person-but-trying-to-help-a-newbie/154615)

<div class="topic-metadata">

**Author:** [@charlie2869](https://www.ruby-forum.com/u/charlie2869)\
**Replies:** 2\
**Last updated:** [December 2, 2008, 6:56am UTC](https://www.ruby-forum.com/t/not-a-ruby-person-but-trying-to-help-a-newbie/154615 "2008-12-02T06:56:07Z")

</div>

Hi there I am a C++ person but trying to help a friend using Ruby. He is supposed to ask for user input by using an index number to change the letter of a word given, like say “dog”. So the user it asked to enter th…

---

## [Retraction and thanks to Aaron Bedra and Relevance](https://www.ruby-forum.com/t/retraction-and-thanks-to-aaron-bedra-and-relevance/154592)

<div class="topic-metadata">

**Author:** [@Rudi\_C](https://www.ruby-forum.com/u/Rudi_C)\
**Replies:** 1\
**Last updated:** [December 2, 2008, 5:33am UTC](https://www.ruby-forum.com/t/retraction-and-thanks-to-aaron-bedra-and-relevance/154592 "2008-12-02T05:33:38Z")

</div>

After the previous thread about copyright and ownership of MPI Ruby, the folks at Relevance asked me to start a new thread setting the record straight: Aaron Bedra and I worked on separate branches of MPI Ruby, with…

---

## [Different between symbol and string?](https://www.ruby-forum.com/t/different-between-symbol-and-string/154601)

<div class="topic-metadata">

**Author:** [@chrislo](https://www.ruby-forum.com/u/chrislo)\
**Replies:** 4\
**Last updated:** [December 2, 2008, 5:11am UTC](https://www.ruby-forum.com/t/different-between-symbol-and-string/154601 "2008-12-02T05:11:25Z")

</div>

What is exactly different between symbol and string ? Symbol has never appear in other language.

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

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