[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

stack level to deep?

STEPHEN BECKER I V

10/3/2004 9:09:00 PM

aaaaa
C:/Documents and Settings/IV/Desktop/crazy.rb:5:in `nextl': stack
level too deep (SystemStackError)

from C:/Documents and Settings/IV/Desktop/crazy.rb:4:in `each'
from C:/Documents and Settings/IV/Desktop/crazy.rb:4:in `each'
from C:/Documents and Settings/IV/Desktop/crazy.rb:4:in `nextl'
from C:/Documents and Settings/IV/Desktop/crazy.rb:5:in `nextl'
from C:/Documents and Settings/IV/Desktop/crazy.rb:4:in `each'
from C:/Documents and Settings/IV/Desktop/crazy.rb:4:in `each'
from C:/Documents and Settings/IV/Desktop/crazy.rb:4:in `nextl'
from C:/Documents and Settings/IV/Desktop/crazy.rb:5:in `nextl'
... 2083 levels...
from C:/Documents and Settings/IV/Desktop/crazy.rb:11
from C:/Documents and Settings/IV/Desktop/crazy.rb:10:in `each'
from C:/Documents and Settings/IV/Desktop/crazy.rb:10:in `each'
from C:/Documents and Settings/IV/Desktop/crazy.rb:10
Press any key to continue . . .


Is there away to increase the allowed space for the stack info?
I want to print out ever permutation of the alphabet. I know it
sounds crazy, but i want to.

def nextl (a,d)
if d==0 then print a # max depth
print "\n" end
for i in 'a'..'z' # add the next letter in the alphabet
nextl(a<<i.to_s,d-1) #concat and call
print "\n"
end
end

for i in 'a'..'z'
nextl(i.to_s,4)
print "\n"
end

is my code, it should print out all aaaaa,aaaab,aaaac....
becker


9 Answers

gabriele renzi

10/3/2004 9:37:00 PM

0

STEPHEN BECKER I V ha scritto:

>
> Is there away to increase the allowed space for the stack info?
> I want to print out ever permutation of the alphabet. I know it
> sounds crazy, but i want to.

on unix there is the ulimit setting.. but you can just do that
iteratively, I think

STEPHEN BECKER I V

10/3/2004 9:45:00 PM

0

yes='a'*47
while true do
yes.succ!
print yes,"\n"
sleep 1
end


i guess what would work to?


On Mon, 4 Oct 2004 06:39:55 +0900, gabriele renzi
<rff_rff@remove-yahoo.it> wrote:
> STEPHEN BECKER I V ha scritto:
>
> >
> > Is there away to increase the allowed space for the stack info?
> > I want to print out ever permutation of the alphabet. I know it
> > sounds crazy, but i want to.
>
> on unix there is the ulimit setting.. but you can just do that
> iteratively, I think
>
>


Markus

10/3/2004 11:36:00 PM

0

On Sun, 2004-10-03 at 14:09, STEPHEN BECKER I V wrote:

> Is there away to increase the allowed space for the stack info?
> I want to print out ever permutation of the alphabet. I know it
> sounds crazy, but i want to.
>

> is my code, it should print out all aaaaa,aaaab,aaaac....

Why not something like:

(1..6).each { |n|
(('a'*n)..('z'*n)).each { |s| print s,"\n" }
}

Although, if you are using this to tell people about the amazingly low
mortgage rates you might try:

(1..6).each { |n|
(('a'*n)..('z'*n)).each { |s| print s,"\n" unless s == 'markus'}
}

instead.

-- MarkusQ



STEPHEN BECKER I V

10/3/2004 11:46:00 PM

0

No its not a spamer, it was a stupid idea on to how to crack some
ciphered text.
PBEGUUYMIQICUUFGUUYIQGUUYQCUIVFIQGUUYQCUQBEMEVP
And they gave no hints!
Becker


On Mon, 4 Oct 2004 08:35:41 +0900, Markus <markus@reality.com> wrote:
> On Sun, 2004-10-03 at 14:09, STEPHEN BECKER I V wrote:
>
> > Is there away to increase the allowed space for the stack info?
> > I want to print out ever permutation of the alphabet. I know it
> > sounds crazy, but i want to.
> >
>
> > is my code, it should print out all aaaaa,aaaab,aaaac....
>
> Why not something like:
>
> (1..6).each { |n|
> (('a'*n)..('z'*n)).each { |s| print s,"\n" }
> }
>
> Although, if you are using this to tell people about the amazingly low
> mortgage rates you might try:
>
> (1..6).each { |n|
> (('a'*n)..('z'*n)).each { |s| print s,"\n" unless s == 'markus'}
> }
>
> instead.
>
> -- MarkusQ
>
>


Markus

10/4/2004 12:10:00 AM

0

On Sun, 2004-10-03 at 16:45, STEPHEN BECKER I V wrote:
> it was a stupid idea on to how to crack some
> ciphered text.
> PBEGUUYMIQICUUFGUUYIQGUUYQCUIVFIQGUUYQCUQBEMEVP
> And they gave no hints!

So roll your own. (Hints, that is). Frequency analysis generally
doesn't help much in cyphers this short, but Q is just begging to be
space:

PBEGUUYMI ICUUFGUUYI GUUY CUIVFI GUUY CU BEMEVP

Which, assuming the plain text is English, makes GUUY on of:

Abba abbe Abby adds ally ammo Anna Anne
beef been beep beer bees beet book
boom boon boor boos boot cook cool coon
coop deem deep deer doom door ebbs eddy
eggs Ella Emma errs feed feel fees feet
food fool foot good goof Haag Haas heed
heel hood hoof hook hoop hoot ills illy
inns jeep jeer keel keen keep leek leer
lees look loom loon loop loot meek meet
mood Moon Moor moot need nook noon odds
offs Otto peek peel peep peer pool poor
reed reef reel roof rook room root seed
seek seem seen seep seer sees soon soot
teem teen took tool veer weed week weep
wood woof wool woos zoom zoos

...with the caveat that it isn't "peep" (that would make G == Y).
Noticing that the middle cypher symbol U is also the last in the two
letter cypher word CU and that GUUY occurs inside the two longest
words...

Well, you get the idea.

-- MarkusQ




STEPHEN BECKER I V

10/4/2004 12:22:00 AM

0

Enter file loc (use // for ): PBEGUUYMIQICUUFGUUYIQGUUYQCUIVFIQGUUYQCUQBEMEVP
Size = 47
B 2
C 3
E 3
F 2
G 4
I 5
M 2
P 2
Q 6
U 12
V 2
Y 4

*******************************************************
PB 1
EG 1
UU 5
YM 1
IQ 1
IC 1
FG 1
YI 1
QG 2
YQ 2
CU 2
IV 1
FI 1
QB 1
EM 1
EV 1

*******************************************************
PBE 1
GUU 4
YMI 1
QIC 1
UUF 1
YIQ 1
YQC 2
UIV 1
FIQ 1
UQB 1
EME 1


Ruby made this is so easy :)
Becker


On Mon, 4 Oct 2004 09:10:00 +0900, Markus <markus@reality.com> wrote:
> On Sun, 2004-10-03 at 16:45, STEPHEN BECKER I V wrote:
> > it was a stupid idea on to how to crack some
> > ciphered text.
> > PBEGUUYMIQICUUFGUUYIQGUUYQCUIVFIQGUUYQCUQBEMEVP
> > And they gave no hints!
>
> So roll your own. (Hints, that is). Frequency analysis generally
> doesn't help much in cyphers this short, but Q is just begging to be
> space:
>
> PBEGUUYMI ICUUFGUUYI GUUY CUIVFI GUUY CU BEMEVP
>
> Which, assuming the plain text is English, makes GUUY on of:
>
> Abba abbe Abby adds ally ammo Anna Anne
> beef been beep beer bees beet book
> boom boon boor boos boot cook cool coon
> coop deem deep deer doom door ebbs eddy
> eggs Ella Emma errs feed feel fees feet
> food fool foot good goof Haag Haas heed
> heel hood hoof hook hoop hoot ills illy
> inns jeep jeer keel keen keep leek leer
> lees look loom loon loop loot meek meet
> mood Moon Moor moot need nook noon odds
> offs Otto peek peel peep peer pool poor
> reed reef reel roof rook room root seed
> seek seem seen seep seer sees soon soot
> teem teen took tool veer weed week weep
> wood woof wool woos zoom zoos
>
> ...with the caveat that it isn't "peep" (that would make G == Y).
> Noticing that the middle cypher symbol U is also the last in the two
> letter cypher word CU and that GUUY occurs inside the two longest
> words...
>
> Well, you get the idea.
>
> -- MarkusQ
>
>


Brian Candler

10/4/2004 8:46:00 AM

0

On Mon, Oct 04, 2004 at 06:09:20AM +0900, STEPHEN BECKER I V wrote:
> Is there away to increase the allowed space for the stack info?

Not enough to allow for infinite recursion, I'm afraid :-)

> def nextl (a,d)
> if d==0 then print a # max depth
> print "\n" end
> for i in 'a'..'z' # add the next letter in the alphabet
> nextl(a<<i.to_s,d-1) #concat and call
> print "\n"
> end
> end

Try adding "puts d" at the very top of this method (before if d==0 ...) and
you'll see where the problem is. Hint: "return" is your friend :-)

Regards,

Brian.


STEPHEN BECKER I V

10/4/2004 1:25:00 PM

0

the cook was a good cook as cooks go and as cooks go she went

YEAH! reverse Caesar !

On Mon, 4 Oct 2004 09:10:00 +0900, Markus <markus@reality.com> wrote:
> On Sun, 2004-10-03 at 16:45, STEPHEN BECKER I V wrote:
> > it was a stupid idea on to how to crack some
> > ciphered text.
> > PBEGUUYMIQICUUFGUUYIQGUUYQCUIVFIQGUUYQCUQBEMEVP
> > And they gave no hints!
>
> So roll your own. (Hints, that is). Frequency analysis generally
> doesn't help much in cyphers this short, but Q is just begging to be
> space:
>
> PBEGUUYMI ICUUFGUUYI GUUY CUIVFI GUUY CU BEMEVP
>
> Which, assuming the plain text is English, makes GUUY on of:
>
> Abba abbe Abby adds ally ammo Anna Anne
> beef been beep beer bees beet book
> boom boon boor boos boot cook cool coon
> coop deem deep deer doom door ebbs eddy
> eggs Ella Emma errs feed feel fees feet
> food fool foot good goof Haag Haas heed
> heel hood hoof hook hoop hoot ills illy
> inns jeep jeer keel keen keep leek leer
> lees look loom loon loop loot meek meet
> mood Moon Moor moot need nook noon odds
> offs Otto peek peel peep peer pool poor
> reed reef reel roof rook room root seed
> seek seem seen seep seer sees soon soot
> teem teen took tool veer weed week weep
> wood woof wool woos zoom zoos
>
> ...with the caveat that it isn't "peep" (that would make G == Y).
> Noticing that the middle cypher symbol U is also the last in the two
> letter cypher word CU and that GUUY occurs inside the two longest
> words...
>
> Well, you get the idea.
>
> -- MarkusQ
>
>


Eric Hodel

10/5/2004 4:29:00 AM

0

STEPHEN BECKER I V (Becker004@gmail.com) wrote:

> is my code, it should print out all aaaaa,aaaab,aaaac....

Ruby already knows how to do this:

('aaaaa'..'zzzzz').each do |x|
puts x
end

--
Eric Hodel - drbrain@segment7.net - http://se...
All messages signed with fingerprint:
FEC2 57F1 D465 EB15 5D6E 7C11 332A 551C 796C 9F04