Florian Groß | 1 Apr 2007 02:05
Picon

Implementation for 5 > x > 4 / RSpec fuzz testing

Hi,

before going to sleep I had an idea for how to implement 5 > x > 4.
It's pretty simple an implementation. I remember reading on ruby-talk
years ago that this was impossible to do without changing Ruby's
parser.

So, nothing big. I just don't want this to decay on my hard disk. It
demonstrates a fair bit of meta programming and that Ruby is powerful
as well.

It's available at http://flgr.0x42.net/code/comp_chain.rb

I'm also wondering if somebody has already thought about how to best
do fuzz testing in RSpec? I know about RFuzz, but it seems to be web
specific. Is there any official best practise for using random input
in your specs?

Kind regards,
Florian Gross

Chad Wilson | 1 Apr 2007 02:05
Picon

FXruby in all Distros?

Greetings.

Pardon the newbie Ruby question, but is FXRUBY included with all
distro's of Ruby?  I have been experimenting with Ruby doing
character-based stuff, but now I want to  begin doing some basic
graphical UI.

When I send my next program to a my buddy who uses MacOS X, I want to
know if the program is going to run, or not.

Thank you.

--

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

Lyle Johnson | 1 Apr 2007 02:15
Picon

Re: FXruby in all Distros?

On 3/31/07, Chad Wilson <chadrwilson <at> gmail.com> wrote:

> Pardon the newbie Ruby question, but is FXRUBY included with all
> distro's of Ruby?  I have been experimenting with Ruby doing
> character-based stuff, but now I want to  begin doing some basic
> graphical UI.
>
> When I send my next program to a my buddy who uses MacOS X, I want to
> know if the program is going to run, or not.

FXRuby is not part of the standard Ruby library, but I'm not sure if
that's the question that you're asking.

FXRuby is included with the Ruby One-Click installer for Windows,
which includes not only the standard Ruby distribution but also a
number of third-party libraries (such as FXRuby).

FXRuby runs on Windows, Linux and Mac OS X, so yes, your friend would
be able to run programs that you've written -- as long as he installs
FXRuby first. As far as I know, there's no package like the one-click
installer for Mac OS X.

Hope this helps,

Lyle

_ugly | 1 Apr 2007 02:25
Picon

rails plugin: click_track 0.1 released

This plugin adds simple click tracking to any controller in you rails
application.
http://crookedhideout.com/blog_entry/show/8

Gregory Brown | 1 Apr 2007 02:35
Picon

Re: rails plugin: click_track 0.1 released

On 3/31/07, _ugly <mgarriss <at> gmail.com> wrote:
> This plugin adds simple click tracking to any controller in you rails
> application.
> http://crookedhideout.com/blog_entry/show/8

The direct link is here, for those who don't feel like seeing the digg
link on that blog entry.

http://software.crookedhideout.com/click_track

Sample usage here:
http://crookedhideout.com/statistics

Johnathan Wagner | 1 Apr 2007 02:43
Picon
Favicon

Parsing an text file

Hi,
I cannot find a way to easily parse a text file. I am just starting to
learn ruby so please bear with me.

My text file looks like this:

0 8 2 9 3 0 0 4
9 2 8 3 9 3 0 2
2 3 4 9 8 8 9 0

Basically just numbers and spaces.

So far, I know how to read the file and put each line into an array.

def readfile(file)
  arr = IO.readlines(file)
  parsing(arr)
end

def parsing(arr)
  string1 = arr[0].to_s
  string2 = arr[1].to_s
  string3 = arr[2].to_s
  ans.each_byte {|b|p b.chr}
end

What I wanted to do is, for example, want to find all 8's and change it
to 5's.
I am stuck on how I can use the string and search each char's to find
the 8's and then change it. Also I would like to know if there is a for
(Continue reading)

Drew Olson | 1 Apr 2007 02:47
Picon
Gravatar

Re: Parsing an text file

Johnathan Wagner wrote:
> What I wanted to do is, for example, want to find all 8's and change it
> to 5's.
> I am stuck on how I can use the string and search each char's to find
> the 8's and then change it. Also I would like to know if there is a for
> loop or something to go through each array and store it into a new
> string because there might be more than 3 lines. I have search through
> documentations and trying to find examples but there doesn't seem to be
> much help.
> 
> Any help, especially examples, would be appreciate. Thanks in advance.

The code below reads through your file, replaces 8's with 5's and then 
writes out the lines to a new file:

File.open("newfile,txt","w") do |out|
  File.open("myfile.txt").each do |line|
    out << line.gsub("8","5")
  end
end

--

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

DBH | 1 Apr 2007 02:52
Picon

Multiple files/windows with Tk

I'm currently trying to write a Ruby program using Tk that requires the
use of multiple files and windows.  For instance, I have a main screen,
and when I click on one of the buttons, I want the main window to close
and a new window to open.  The code for these windows is located in
different files (but if possible I could put them all in one).  So far
all I've been able to do is get the second window to attach itself onto
the first, resulting in a very ugly looking GUI.  How can I get the Tk
interface to let me close one window and open another with a button
click or similar event?

Thanks in advance to any help anyone can offer.

--

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

Jim Weirich | 1 Apr 2007 02:58

Re: has anyone implemented a failable dependency for Rake?

Larry Fast wrote:
> What I find myself writing in Rake is the following:
> 
> task xyz => ['abc?'] do
> enc
> 
> # test before proceeding
> task abc? do
>   if !abc
>      exit
>   end
> end
> 
> What I'm creating is failable dependencies. XYZ should not be executed
> unless abc succeeds.  Unfortunately the structure I've shown stops on
> the first failure. What I'd like to do is report all failures but only
> execute if everything passes.
> 
> This could be implemented by processing prerequisites until a prereq
> returns false. Any task containing any false prereqs would not be
> processed.
> 
> Does this exist anywhere?

It's not directly supported by Rake.

The way I think I would approach this is to let each of the 
prerequisites vote on whether the xyz task should run or not.  The 
prereqs would register the voting with in some central location (e.g. a 
global or maybe some central voting object).  I would then write the xyz 
(Continue reading)

Johnathan Wagner | 1 Apr 2007 03:02
Picon
Favicon

Re: Parsing an text file

Thanks for your fast answer.

One last question, if you can help me.

How can I compare each characters in a string?

Drew Olson wrote:
> Johnathan Wagner wrote:
>> What I wanted to do is, for example, want to find all 8's and change it
>> to 5's.
>> I am stuck on how I can use the string and search each char's to find
>> the 8's and then change it. Also I would like to know if there is a for
>> loop or something to go through each array and store it into a new
>> string because there might be more than 3 lines. I have search through
>> documentations and trying to find examples but there doesn't seem to be
>> much help.
>> 
>> Any help, especially examples, would be appreciate. Thanks in advance.
> 
> The code below reads through your file, replaces 8's with 5's and then 
> writes out the lines to a new file:
> 
> File.open("newfile,txt","w") do |out|
>   File.open("myfile.txt").each do |line|
>     out << line.gsub("8","5")
>   end
> end

--

-- 
Posted via http://www.ruby-forum.com/.
(Continue reading)


Gmane