GoldenKing | 4 Jul 16:49

WORLD BEAUTIFUL ARTICAL AND WALLPAPERS

HI This is my first website just visit and free down load Gud Articals
And beautiful wallpapers And fantastic Actres Pics...
http://cineacters.blogspot.com/

Roger Pack | 4 Jul 15:37

[ANN] allgems.ruby-forum.com "release 440ca77a867a317bd9b35"

Pleased to announce release version "commit
440ca77a867a317bd9b3549f6009cc8745c1c291" (ok that's a joke number, but
hey).

of my ruby allgems docs site.

http://allgems.ruby-forum.com
http://rubydoc.ruby-forum.com

Changes:
 * new urls, thanks Andreas!
 * added latest gems [currently have 4905 versions of 4721 gems--see if
yours is there, plan to do daily updates]

=== Description

Why this site? Because some gem rdocs aren’t online, and lots (most?)
aren’t in the hanna theme, which is much easier to read and has
searchable methods.  Having centralized docs also allows you do skip
local gem rdoc install, which makes gem installs sooo much faster.

That's it.

=== A few success stories (ok so they're just mine):

1) Ruby doesn't by default allow for hash arithmetic
>> {:a => 3} - {:a => 3} 
=> {}

Searching gems for the word "hash" I found one that adds set operations
(Continue reading)

dzw! | 4 Jul 09:25

How to remove/delete/destroy class variable in Ruby 1.9?

Ok, code below shows better what I am talking about, I understand that
@@var is acting like global variable.
But how to get rid of it when is not needed anymore?

class A
  @@var = 'var in A'
  def self.item
    @@var
  end

  def self.item=(var)
    @@var=var
  end

end

class B
  @@var = 'var in B'
  def self.item
    @@var
  end
  def self.item=(var)
    @@var=var
  end

end

A.item =>  "var in A"
B.item =>  "var in B"

(Continue reading)

golfdude | 4 Jul 07:39

ruby beginner...


I have ruby 1.8.6 installed on windows. I want to view the doc
offline. I downloaded from ruby-docs.org a .tgz file which when
extracted was a 6-core-rdocs file. Not sure what to do with this. When
I run "gem server" and access the page i do not see the "core" and
"stdlib" documentation. How do I get these documentations ?

Thanks

gd

Greg Willits | 4 Jul 00:02
Favicon

file.seek and unused bytes

Ruby 1.8.6

(sorry this one takes some setup to explain the context of the question)

I'm using file seek to create equal fixed length rows in a disk file.
The row data itself is not fixed length, but I am forcing the seek
position to be at fixed intervals for the start of each row. So, on disk
it might look something like this:

aaaaaaaaaaaaaaaaaaaaaaaaaX0000000000000
bbbbbbbbbbbbbbX000000000000000000000
ccccccccccccccccccccccccccccccccccccccccX00

I'm really only writing the "aaaa..." and "bbbb...." portions of the
rows with an EOL (an X here so it's easy to see).

I have one operation step which uses tail to grab the last line of the
file. When I do that, I get something like this:

000000000000000000000cccccccccccccccccccccccccccccccccccccccc

which is the empty bytes past the EOL of the line "bbb..." plus the
valid data of the following line.

After some fiddling, it became apparent that I can test the value of the
byte against zero to know if there's data in it or not -- if byte_data
== 0 so that I can trim off that leading set of zeros, but I'm not
certain those empty bytes will always be zero.

And finally my question.....
(Continue reading)

Re: String += vs <<

On Thu, Jun 18, 2009 at 3:08 AM, Robert Dober<robert.dober <at> gmail.com> wrote:
> ---------------------------------------------------------
> 512/19 > cat strings.rb
>
> N = 10_000
> b = "Wassitmean"
> require 'benchmark'
> Benchmark.bmbm do | bench |
>  a = "Ruby Rules Re Rowld"
>  bench.report "+=" do
>    N.times do
>      a += b
>    end
>  end
>  a = "Ruby Rules Re Rowld"
>  bench.report "<<" do
>    N.times do
>      a += b
>    end
>  end
> end

Someone else noted the += in the << section, but there's another
issue: the "a" string is initialized only *once* for both rehearsal
and actual runs, since the body of the bmbm block is only executed
once to prepare the reports. If you modify it to put the a
initialization into the report blocks, it behaves more like you'd
expect. Here's a run with JRuby, with the bmbm above, "a" init fix,
"<<" fix, and 5 iterations (only last iteration shown):

(Continue reading)

Dimas Cyriaco | 3 Jul 21:07

$stdout to printer

Still trying to print stuff...
someone knows how to redirect $stdout to a printer??

Thanks!
--

-- 
Posted via http://www.ruby-forum.com/.

Daniel Moore | 3 Jul 20:50
Gravatar

[QUIZ] Genetic Programming (#212)

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

The three rules of Ruby Quiz:

1.  Please do not post any solutions or spoiler discussion for this
quiz until 48 hours have elapsed from the time this message was
sent.

2.  Support Ruby Quiz by submitting ideas and responses
as often as you can!
Visit: http://rubyquiz.strd6.com/suggestions

3.  Enjoy!

Suggestion:  A [QUIZ] in the subject of emails about the problem
helps everyone on Ruby Talk follow the discussion.  Please reply to
the original quiz message, if you can.

RSS Feed: http://rubyquiz.strd6.com/quizzes.rss

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

## Genetic Programming (#212)

Buon giorno Rubyists,

Let's say that we have a table of outputs for an unknown function, and
we want to find out what that function is. One possible method of
finding a solution is to use genetic programming[1]. In genetic
programming we begin with a random population of programs, then rank
(Continue reading)

Mario Gr | 3 Jul 20:08

Using Dir.glob to grab only Directories

Hi,

I was wondering if there were a way to use Dir.glob to grab only
directories.  After searching google for a bit I found ways to pull only
file listings, but couldn't find one for just directories.

Currently, I'm using FileTest.directory?(dir) before running any
operations to test for a directory.
--

-- 
Posted via http://www.ruby-forum.com/.

Mario Gr | 3 Jul 20:03

Pass variables to arbitrary ruby script: ruby script.rb

Does anyone know if there is a way to pass variables to a arbitrarily
run script?  I tried this with no luck.

ruby script.rb VARIABLE=value

Thanks!
--

-- 
Posted via http://www.ruby-forum.com/.

Installing tar2rubyscript and rubyscript2exe

I'm trying to install tar2rubyscript and rubyscript2exe. I executed the
following 2 statements:

     sudo gem install tar2rubyscript
     sudo gem install rubyscript2exe

Gem indicates that it installed them. In addition if I execute

     gem search --local tar2rubyscript

It reports that it is installed. The problem is that I can't find the
executable tar2rubyscript - or the ruby script tar2rubyscript.rb. The
same is true for rubyscript2exe. I even did a "find /usr -name
'tar2rubyscript*' - and nothing turns up.

Is there another (better) way to install these? I openly admit that I
must be doing *SOMETHING* wrong, but I don't see it.

Thanks in advance.
---Michael
--

-- 
Posted via http://www.ruby-forum.com/.


Gmane