[#372953] Strange whitespace parsing behavior on Ruby 1.8.7 (patchlevel 249/302) — Ehsanul Hoque <ehsanul_g3@...>

13 messages 2010/11/02
[#372956] Re: Strange whitespace parsing behavior on Ruby 1.8.7 (patchlevel 249/302) — Robert Klemme <shortcutter@...> 2010/11/02

On Tue, Nov 2, 2010 at 5:49 AM, Ehsanul Hoque <ehsanul_g3@hotmail.com> wrot=

[#372978] Re: Strange whitespace parsing behavior on Ruby 1.8.7 (patchlevel 249/302) — Ehsanul Hoque <ehsanul_g3@...> 2010/11/02

[#373013] Regular Expression — Dv Dasari <dv.mymail@...>

I am trying to write a reqular expression to match a word with my input

22 messages 2010/11/02
[#373016] Re: Regular Expression — Richard Conroy <richard.conroy@...> 2010/11/02

On Tue, Nov 2, 2010 at 9:05 PM, Dv Dasari <dv.mymail@gmail.com> wrote:

[#373018] Re: Regular Expression — Kendall Gifford <zettabyte@...> 2010/11/02

On Tue, Nov 2, 2010 at 3:34 PM, Richard Conroy <richard.conroy@gmail.com> wrote:

[#373049] UTF-8 aware chop for 1.8? — Ammar Ali <ammarabuali@...>

Hello,

12 messages 2010/11/03

[#373070] Ruby Perofrmance — Ruby Me <i_baseet@...>

Hi

21 messages 2010/11/03

[#373097] Ruby vs PHP for the web — Ruby Me <i_baseet@...>

Hi

43 messages 2010/11/04
[#373461] Re: Ruby vs PHP for the web — Charles Calvert <cbciv@...> 2010/11/10

On Wed, 3 Nov 2010 20:49:22 -0500, Ruby Me <i_baseet@hotmail.com>

[#373534] Re: Ruby vs PHP for the web — Mike Stephens <rubfor@...> 2010/11/11

Charles Calvert wrote in post #960599:

[#373563] Re: Ruby vs PHP for the web — Jes俍 Gabriel y Gal疣 <jgabrielygalan@...> 2010/11/12

On Thu, Nov 11, 2010 at 11:50 PM, Mike Stephens <rubfor@recitel.net> wrote:

[#373585] Re: Ruby vs PHP for the web — Josh Cheek <josh.cheek@...> 2010/11/12

2010/11/12 Jes=FAs Gabriel y Gal=E1n <jgabrielygalan@gmail.com>

[#373220] Create a class - ideas — flebber <flebber.crue@...>

15 messages 2010/11/06

[#373248] Code in a class but not in a method -- please explain! — "Bruce F." <brucedfeist@...>

I'm a newcomer to Ruby, and I'm confused about what executable

10 messages 2010/11/07

[#373260] sort_by is not stable ? — Michel Demazure <michel@...>

sort_by is not a stable sorting method (ruby 1.9.2 p0)

22 messages 2010/11/07
[#373262] Re: sort_by is not stable ? — Ammar Ali <ammarabuali@...> 2010/11/07

On Sun, Nov 7, 2010 at 12:22 PM, Michel Demazure <michel@demazure.com> wrot=

[#373264] Re: sort_by is not stable ? — Michel Demazure <michel@...> 2010/11/07

Ammar Ali wrote in post #959889:

[#373265] Re: sort_by is not stable ? — Ammar Ali <ammarabuali@...> 2010/11/07

On Sun, Nov 7, 2010 at 1:15 PM, Michel Demazure <michel@demazure.com> wrote:

[#373266] irb misbehaviour with arrow keys on Windows — Marvin Gülker <sutniuq@...>

Hi there,

10 messages 2010/11/07

[#373352] ruby-pg gem fails to install — Rajinder Yadav <devguy.ca@...>

i built postgres 9.0 from source and i am trying to install ruby-pg

11 messages 2010/11/08

[#373397] Analyzer for errors in code ? — David Unric <dunric29a@...>

Hello,

19 messages 2010/11/09

[#373421] help with code, new to programming — Steve Rees <stevoreesimo@...>

I am new to programming and have been learning Ruby using online

13 messages 2010/11/09

[#373479] ruby ORM — zuerrong <zuerrong@...>

Hello,

64 messages 2010/11/11
[#373480] Re: ruby ORM — Sam Duncan <sduncan@...> 2010/11/11

I've been writing Ruby for three days now. DataMapper seems very good.

[#373607] ORM's - Don't Do It! — Mike Stephens <rubfor@...> 2010/11/12

Sam Duncan wrote in post #960638:

[#373616] Re: ORM's - Don't Do It! — Phillip Gawlowski <cmdjackryan@...> 2010/11/12

On Fri, Nov 12, 2010 at 5:47 PM, Mike Stephens <rubfor@recitel.net> wrote:

[#373634] Re: ORM's - Don't Do It! — Petite Abeille <petite.abeille@...> 2010/11/12

[#373663] Re: ORM's - Don't Do It! — Phillip Gawlowski <cmdjackryan@...> 2010/11/13

On Fri, Nov 12, 2010 at 9:56 PM, Petite Abeille

[#373666] Re: ORM's - Don't Do It! — Mike Stephens <rubfor@...> 2010/11/13

My problem is the mismatch.

[#373676] Re: ORM's - Don't Do It! — Phillip Gawlowski <cmdjackryan@...> 2010/11/13

On Sat, Nov 13, 2010 at 10:54 AM, Mike Stephens <rubfor@recitel.net> wrote:

[#373746] Re: ORM's - Don't Do It! — "Skye Shaw!@#$" <skye.shaw@...> 2010/11/14

On Nov 12, 8:47=A0am, Mike Stephens <rub...@recitel.net> wrote

[#374853] DRM Principle - Don't Repeat Microsoft — Mike Stephens <rubfor@...> 2010/12/03

I was thinking about this last night and it's part of a belief I have

[#373481] what's an object? — "Eva" <eva54321@...>

SSdtIGFsc28gc3dpdGNoaW5nIGZyb20gcGVybCBhbmQgcGhwLgpJJ20gbm90IHN1cmUgaW4gcnVi

55 messages 2010/11/11
[#373482] Re: what's an object? — Alex Stahl <astahl@...5.com> 2010/11/11

Simple answer: everything. Everything is considered an object,

[#373490] Re: what's an object? — "Y. NOBUOKA" <nobuoka@...> 2010/11/11

> Simple answer: everything. Everything is considered an object,

[#373500] Re: what's an object? — Alex Stahl <astahl@...5.com> 2010/11/11

Not that I know the internals of the language well enough to debate the

[#373504] Re: what's an object? — "Y. NOBUOKA" <nobuoka@...> 2010/11/11

> Not that I know the internals of the language well enough to debate the

[#373511] Re: what's an object? — Alex Stahl <astahl@...5.com> 2010/11/11

Fair enough. The link even cites the Ruby spec to indicate that

[#373522] Re: what's an object? — "Y. NOBUOKA" <nobuoka@...> 2010/11/11

Did you recognize the difference between a method and a Method object?

[#373528] Re: what's an object? — Josh Cheek <josh.cheek@...> 2010/11/11

Disclaimer: I seem to be in a crabby mood this morning. I went back over it

[#373569] Re: what's an object? — "Y. NOBUOKA" <nobuoka@...> 2010/11/12

Hi, Josh

[#373571] Re: what's an object? — Josh Cheek <josh.cheek@...> 2010/11/12

On Fri, Nov 12, 2010 at 3:01 AM, Xavier Noria <fxn@hashref.com> wrote:

[#373572] Re: what's an object? — Xavier Noria <fxn@...> 2010/11/12

On Fri, Nov 12, 2010 at 12:25 PM, Josh Cheek <josh.cheek@gmail.com> wrote:

[#373576] Re: what's an object? — Robert Dober <robert.dober@...> 2010/11/12

On Fri, Nov 12, 2010 at 12:38 PM, Xavier Noria <fxn@hashref.com> wrote:

[#373582] Re: what's an object? — Xavier Noria <fxn@...> 2010/11/12

On Fri, Nov 12, 2010 at 1:09 PM, Robert Dober <robert.dober@gmail.com> wrot=

[#373536] Parsing XML with Ruby — jackster the jackle <johnsheahan@...>

I need to hit an https link and pass a username and password in order to

17 messages 2010/11/12
[#373547] Re: Parsing XML with Ruby — jackster the jackle <johnsheahan@...> 2010/11/12

It seems to be working...here is my test code:

[#373539] Scheme's (cond ((assertion) (value))...(else (value))) statement implemented in ruby? — timr <timrandg@...>

Hi Rubyists,

10 messages 2010/11/12

[#373599] help sorting objects by their instance field — Aaron Haas <aaron4osu@...>

I'm trying to figure out how to sort objects in an array by one of their

14 messages 2010/11/12

[#373618] Fast Debugger (Ruby 1.9.2, DevKit 4.5.0, JDK 6u22, NetBeans 6.9.1) — Allan Chin <achin5957@...>

I've been trying to run this configuration in debug mode on my Windows

17 messages 2010/11/12

[#373680] an each/block problem — Paul Roche <prpaulroche@...>

Hi, I want to take the value from an each method and place it in a

12 messages 2010/11/13

[#373722] Mysql::Result .each_hash - unexpected result — Andy Tolle <durexlw.register@...>

Consider the following code:

12 messages 2010/11/14
[#373738] Re: Mysql::Result .each_hash - unexpected result — botp <botpena@...> 2010/11/14

On Sun, Nov 14, 2010 at 5:55 PM, Andy Tolle <durexlw.register@gmail.com> wr=

[#373745] Re: Mysql::Result .each_hash - unexpected result — Andy Tolle <durexlw.register@...> 2010/11/14

botp wrote in post #961345:

[#373773] please help load from txt — Lark Work <lars_werkman@...>

hi i new to this forum and i have a problem a made a script containing a

17 messages 2010/11/15

[#373787] Can't get Ruby programs to work from Command Prompt — Dd Dd <dd25@...>

Hello; I'm having a problem running Ruby programs through the command

10 messages 2010/11/15

[#373852] cool.io 0.9.0: a cool event framework for Ruby (formerly known as Rev) based on libev — Tony Arcieri <tony.arcieri@...>

Github: https://github.com/tarcieri/cool.io

15 messages 2010/11/16
[#374061] Re: [ANN] cool.io 0.9.0: a cool event framework for Ruby (formerly known as Rev) based on libev — Eric Wong <normalperson@...> 2010/11/19

Tony Arcieri <tony.arcieri@medioh.com> wrote:

[#373930] Ruby Not observing DRY principle — flebber <flebber.crue@...>

HI I am hoping you can give me some guidance. I feel I really am

17 messages 2010/11/18

[#373990] Where to start from? — Ruby Me <i_baseet@...>

Hi guys,

16 messages 2010/11/18

[#374001] Ruby Programming — Tridib Bandopadhyay <tridib04@...>

Hello

18 messages 2010/11/18

[#374104] gsub and backslashes — Ralph Shnelvar <ralphs@...32.com>

Consider the string

16 messages 2010/11/20
[#374151] Re: gsub and backslashes — Brian Candler <b.candler@...> 2010/11/21

Ralph Shnelvar wrote in post #962847:

[#374114] Problem regarding regular expression — Stanford Ng <ngkooinam@...>

puts( /^[a-z 0-9]*$/ =~ 'Well hello 123' ) # no match due to ^ and

12 messages 2010/11/21

[#374127] why i can't find my ruby ? — Pen Ttt <myocean135@...>

i installed ruby this way:

18 messages 2010/11/21

[#374210] system() or process.create? — Fengfeng Li <lifengfeng@...>

Hi everyone,

13 messages 2010/11/23

[#374229] Regex negative look-behind bug? — Ruby Nuby <b1st@...>

irb, Ruby 1.9.1

14 messages 2010/11/23

[#374232] Ruby 1.8 vs 1.9 — Peter Pincus <peter.pincus@...>

Hi,

85 messages 2010/11/23
[#374313] Re: Ruby 1.8 vs 1.9 — Jörg W Mittag <JoergWMittag+Ruby@...> 2010/11/25

David Masover wrote:

[#374394] Re: Ruby 1.8 vs 1.9 — David Masover <ninja@...> 2010/11/26

On Wednesday, November 24, 2010 08:40:22 pm J=F6rg W Mittag wrote:

[#374406] Re: Ruby 1.8 vs 1.9 — Phillip Gawlowski <cmdjackryan@...> 2010/11/26

On Fri, Nov 26, 2010 at 1:42 AM, David Masover <ninja@slaphack.com> wrote:

[#374425] Re: Ruby 1.8 vs 1.9 — David Masover <ninja@...> 2010/11/27

On Friday, November 26, 2010 05:51:38 am Phillip Gawlowski wrote:

[#374444] Re: Ruby 1.8 vs 1.9 — Phillip Gawlowski <cmdjackryan@...> 2010/11/27

On Sat, Nov 27, 2010 at 9:04 AM, David Masover <ninja@slaphack.com> wrote:

[#374448] Re: Ruby 1.8 vs 1.9 — David Masover <ninja@...> 2010/11/27

On Saturday, November 27, 2010 11:41:59 am Phillip Gawlowski wrote:

[#374452] Re: Ruby 1.8 vs 1.9 — Phillip Gawlowski <cmdjackryan@...> 2010/11/27

On Sat, Nov 27, 2010 at 7:50 PM, David Masover <ninja@slaphack.com> wrote:

[#374462] Re: Ruby 1.8 vs 1.9 — David Masover <ninja@...> 2010/11/28

On Saturday, November 27, 2010 02:47:12 pm Phillip Gawlowski wrote:

[#374470] Re: Ruby 1.8 vs 1.9 — Phillip Gawlowski <cmdjackryan@...> 2010/11/28

On Sun, Nov 28, 2010 at 1:56 AM, David Masover <ninja@slaphack.com> wrote:

[#374472] Re: Ruby 1.8 vs 1.9 — David Masover <ninja@...> 2010/11/28

On Sunday, November 28, 2010 08:00:18 am Phillip Gawlowski wrote:

[#374475] Re: Ruby 1.8 vs 1.9 — Phillip Gawlowski <cmdjackryan@...> 2010/11/28

On Sun, Nov 28, 2010 at 5:33 PM, David Masover <ninja@slaphack.com> wrote:

[#374488] Re: Ruby 1.8 vs 1.9 — David Masover <ninja@...> 2010/11/28

On Sunday, November 28, 2010 11:19:06 am Phillip Gawlowski wrote:

[#374241] Re: Ruby 1.8 vs 1.9 — Chuck Remes <cremes.devlist@...> 2010/11/23

[#374260] Re: Ruby 1.8 vs 1.9 — Brian Candler <b.candler@...> 2010/11/24

Chuck Remes wrote in post #963430:

[#374264] Re: Ruby 1.8 vs 1.9 — Michael Fellinger <m.fellinger@...> 2010/11/24

On Wed, Nov 24, 2010 at 8:14 PM, Brian Candler <b.candler@pobox.com> wrote:

[#374274] Re: Ruby 1.8 vs 1.9 — Brian Candler <b.candler@...> 2010/11/24

Michael Fellinger wrote in post #963539:

[#374278] Re: Ruby 1.8 vs 1.9 — Phillip Gawlowski <cmdjackryan@...> 2010/11/24

On Wed, Nov 24, 2010 at 4:15 PM, Brian Candler <b.candler@pobox.com> wrote:

[#374281] Re: Ruby 1.8 vs 1.9 — Brian Candler <b.candler@...> 2010/11/24

Phillip Gawlowski wrote in post #963602:

[#374287] Re: Ruby 1.8 vs 1.9 — Phillip Gawlowski <cmdjackryan@...> 2010/11/24

On Wed, Nov 24, 2010 at 5:09 PM, Brian Candler <b.candler@pobox.com> wrote:

[#374293] Re: Ruby 1.8 vs 1.9 — Josh Cheek <josh.cheek@...> 2010/11/24

On Wed, Nov 24, 2010 at 12:20 PM, Phillip Gawlowski <

[#374294] Re: Ruby 1.8 vs 1.9 — Phillip Gawlowski <cmdjackryan@...> 2010/11/24

On Wed, Nov 24, 2010 at 8:02 PM, Josh Cheek <josh.cheek@gmail.com> wrote:

[#374332] Re: Ruby 1.8 vs 1.9 — Robert Klemme <shortcutter@...> 2010/11/25

On Wed, Nov 24, 2010 at 5:09 PM, Brian Candler <b.candler@pobox.com> wrote:

[#374299] Ruby's "More than one way to do things." — Jason Lillywhite <jason.lillywhite@...>

There is one point made about Python vs. Ruby on this site:

23 messages 2010/11/24

[#374431] relative-require v1.0 — "zimbatm ..." <jonas@...>

relative-require.rb

12 messages 2010/11/27

[#374437] How to use Ruby like shell script? — Yu-Hsuan Lai <raincolee@...>

Can I use ruby like my linux shell script(e.x. bash)?(or on the other hand,

21 messages 2010/11/27
[#374446] Re: How to use Ruby like shell script? — James Edward Gray II <james@...> 2010/11/27

On Nov 27, 2010, at 8:51 AM, Yu-Hsuan Lai wrote:

[#374550] ruby on server side — Rajesh Huria <rajesh.huria@...>

Hi,

13 messages 2010/11/29

[#374557] Help sorting an array — Jim Burgess <jack.zelig@...>

Hi,

32 messages 2010/11/29
[#374730] Re: Help sorting an array — Mike Stephens <rubfor@...> 2010/12/01

If you've ever read "Real Programmers don't use Pascal" (see

[#374747] Re: Help sorting an array — Ammar Ali <ammarabuali@...> 2010/12/01

On Wed, Dec 1, 2010 at 8:30 PM, Mike Stephens <rubfor@recitel.net> wrote:

[#374751] Try it and see. — Mike Stephens <rubfor@...> 2010/12/01

Ammar Ali wrote in post #965529:

[#374756] Re: Try it and see. — David Masover <ninja@...> 2010/12/01

On Wednesday, December 01, 2010 03:04:42 pm Mike Stephens wrote:

[#374771] Re: Try it and see. — Mike Stephens <rubfor@...> 2010/12/02

David Masover wrote in post #965565:.

[#374587] RFC Future Ruby hash literal syntax — Michael Kaelbling <michael.kaelbling@...>

REQUEST FOR COMMENTS: Change to future Ruby hash literal syntax

15 messages 2010/11/29

[#374619] installing ncurses and IDE — Nikita Kuznetsov <moog_master@...>

Hi all, I was recently advised to use ncurses in order to do some event

11 messages 2010/11/30

[#374632] 'require' is not recognised — Tara Keane <tararakeane@...>

New to Ruby and trying to run benchmark

14 messages 2010/11/30

Re: Create a class - ideas

From: flebber <flebber.crue@...>
Date: 2010-11-07 04:20:25 UTC
List: ruby-talk #373252
On Nov 7, 12:13=A0pm, flebber <flebber.c...@gmail.com> wrote:
> On Nov 7, 11:06=A0am, Mike Cargal <m...@cargal.net> wrote:
>
>
>
>
>
> > On Nov 6, 2010, at 7:00 PM, flebber wrote:
>
> > > On Nov 7, 9:45 am, flebber <flebber.c...@gmail.com> wrote:
> > >> On Nov 7, 2:24 am, Robert Klemme <shortcut...@googlemail.com> wrote:
>
> > >>> On 06.11.2010 10:19, flebber wrote:
>
> > >>>> I am trying to create a class. I am struggling to figure the best =
flow
> > >>>> to get the maths side to work.
>
> > >>>> So say that
>
> > >>>> R is a float given by user input
> > >>>> P is a Total amount(Pool)
> > >>>> Per is a variable %
> > >>>> X is a variable that is a percentage of P defined by a maximum
> > >>>> allocation.
>
> > >>>> So main =3D (( R * X)/P)*100
>
> > >>> First of all you should get your variables right. =A0Variable "Per"=
 does
> > >>> not show up in the formula and "main" is not mentioned in the list.
>
> > >>> The meaning of the formula is totally unclear to me. =A0From what y=
ou gave
> > >>> you are calculating the fraction (R/P) multiply it with 100 (so you
> > >>> actually get (R/P) percent and now you multiply with another percen=
tage
> > >>> (X). =A0So you have a percentage of a percentage.
>
> > >>>> What I want to test is the value of X needed to equal Per from X's
> > >>>> maximum allocation down.
>
> > >>> Can you write down a formula that contains all variables in your li=
st
> > >>> and point at the fixed ones (constants), user inputs and variables =
you
> > >>> want to resolve?
>
> > >>>> What i am thinking but cant get right
>
> > >>>> Say
>
> > >>>> R =3D 5
> > >>>> P =3D 10
> > >>>> Per =3D 190
> > >>>> X =3D max 80% of P
>
> > >>>> For X in main =3D Per ( Closest whole number or half that equals c=
losest
> > >>>> to but greater than Per)
> > >>>> main =3D (( 5 * 8)/10)*100
>
> > >>>> So in example intially main equalled 400%. And answer I would want=
 to
> > >>>> resolve it to is X =3D 4 which is 200% as 3.50 equals 180%.
>
> > >>>> Any ideas?
>
> > >>> Sorry you lost me somewhere along the path. =A0Also it's tea time r=
ight now...
>
> > >>> Cheers
>
> > >>> =A0 =A0 =A0 =A0 robert
>
> > >>> --
> > >>> remember.guy do |as, often| as.you_can - without endhttp://blog.rub=
ybestpractices.com/
>
> > >> So I want to check by changing X when in forumla "main" that it is =
=3D>
> > >> than "per"
>
> > >> In simple terms I want to calculate units needed to reach a rate of
> > >> return, X represents the variable units and per is the ROI(return of
> > >> investment rate I would deaire to acheive), R is the ratio of return
> > >> and P is a pool or base amount, I am using base 10 to start off with=
.
>
> > >> I am trying to test X for a value, the only constraint on X is that =
it
> > >> cannot exceed 80% of the P or Pool amount.
> > >> So if I set per =3D 190%
>
> > >> R =3D 5
> > >> P =3D 10
> > >> Per =3D 190
> > >> X =3D max 80% of P
>
> > >> For X in main >=3D per
>
> > >> main =3D (( 5 * X)/10)*100 >=3D 190%
>
> > >> so for X =3D 80% of P or 8 base units
>
> > >> main =3D (( 5 * 8)/10)*100
>
> > >> which would test out as
>
> > >> main >=3D per
>
> > >> 400 =3D> 190 -
>
> > >> So when X is 8 units the main section is greater than per but its no=
t
> > >> the closest whole unit to per.
>
> > >> So when X =3D 40% or 4 base units
>
> > >> main =3D (( 5 * 4)/10)*100
> > >> main >=3D per
> > >> 200 >=3D 190
>
> > >> this is the largest unit in 0.5 increments that remains greater than
> > >> Per of 190 so I would want X once tested to resolve to this.
>
> > >> I hope that made sense.
>
> > > So how do I best get X to run a loop in 0.5 increments until it
> > > reaches the closest value that makes the left side of an equation
> > > greater or equal to the right. But where it is the lowest value that
> > > is greater than or equal to the the right.
>
> > > Main =3D> Per - where main is the lowest value it can be greater than
> > > per.
>
> > > Cheers
>
> > > Sayth
>
> > Something's not right with your formulas (I suspect)
>
> > >>>> main =3D (( R * X)/P)*100
>
> > and X =3D X*P
>
> > so... main =3D =A0
> > R*(X*P)
> > ----------- * 100
> > =A0 =A0 =A0 P =A0 =A0 =A0 =A0
>
> > the P's cancel out...
> > R*X*100
>
> > varying P will not change the results of your calculations...
>
> > here's what I believe that you're asking for...
> > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D
> > r =3D 5.0
> > p =3D 10.0
> > per =3D 190.0
> > x =3D 0.8
>
> > begin
> > =A0 =A0 =A0 =A0 main =3D ((r*(x*p))/p)*100 =A0
> > =A0 =A0 =A0 =A0 lastSuccess =3D x if main >=3D per
> > =A0 =A0 =A0 =A0 x -=3D 0.05
> > end while main >=3D per
> > puts "#{lastSuccess*100.0}%"
> > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D
> > note: you can change p al day long and always get the same answer
>
> > there are probably more "rubified" ways to express this.
> > I've tried to maintain the approach you've stated. =A0However, I would =
simplify the equation first, and since the last X that succeeds as you decr=
ement is the same thing as the first that succeeds as you're going up, I'd =
probably turn t into something like...
> > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D
> > r =3D 5.0
> > p =3D 10.0
> > per =3D 190.0
> > max_x =3D 0.8
>
> > x =3D 0.05
> > const =3D r*100 # simplified without X
> > x +=3D 0.05 while (x*const < per) && (x <=3D max_x)
> > puts x <=3D max_x ? "#{lastSuccess*100.0}%" : "no answer"
> > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D
>
> > Mike Cargal
>
> > m...@cargal.nethttp://blog.mikecargal.com
>
> Thanks for looking at this for me.
>
> > You've really lost me when 80% turns into 8 (or 8 base units). =A0What =
is a base unit? And why would it be equal to 10%?
> > Are you looking to vary X from 80% down by 5% increments?
>
> This test is the first of 4 I plan to make into one program. For each
> their while be a maximum allocation so in this case 80% so may be 40%
> etc. The pool in future will vary but I am using base 10 while I write
> it(hoping it would be clearer for another person reading it). So that
> means that X has a max allocation of units if 40% was the maximum
> allocation and base 10 then X would be 4 units and I would want my
> loop to test X from 0 to 4 in 0.5 increments.
>
> I am going to need more time to read your solution as I haven't got it
> first read. I had started to look athttp://www.rubyist.net/~slagell/ruby/=
iterators.html
>
> and a solution flow similar to
>
> ruby> def WHILE(cond)
> =A0 =A0 | =A0 return if not cond
> =A0 =A0 | =A0 yield
> =A0 =A0 | =A0 retry
> =A0 =A0 | end
> =A0 =A0nil
> ruby> i=3D0; WHILE(i<3) { print i; i+=3D1 }
> 012 =A0 nil- Hide quoted text -
>
> - Show quoted text -

Actually after re-reading your post I get it. All but one small bit.

In your formula how does the ? "#{lastSuccess*100.0}%" bit work? what
data does lastSuccess pull.

x =3D 0.05
const =3D r*100 # simplified without X
x +=3D 0.05 while (x*const < per) && (x <=3D max_x)
puts x <=3D max_x ? "#{lastSuccess*100.0}%" : "no answer"

In This Thread