# My code hangs

**URL:** <https://www.ruby-forum.com/t/my-code-hangs/115391>\
**Category:** Ruby\
**Created:** [September 24, 2007, 8:20pm UTC](https://www.ruby-forum.com/t/my-code-hangs/115391 "2007-09-24T20:20:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![simonsaid](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/b5e925/32.png) [@simonsaid](https://www.ruby-forum.com/u/simonsaid)\
**Post date:** [September 24, 2007, 8:20pm UTC](https://www.ruby-forum.com/t/my-code-hangs/115391/1 "2007-09-24T20:20:09Z")

</div>

it DID (kind of) work and even exit, but only after going through one  
log, rather than appending ALL of them, formatted, into a file like I  
wanted, so I added line 13, and a corresponding end at the bottom. 😛  
now it makes the main\_text.txt, but hangs. I’m new to  
ruby/programming, just thought this’d be a fun learning project.

[http://pastebin.com/m1b60ac85](http://pastebin.com/m1b60ac85)

for the future: formatting based way more on keywords in the dialogue,  
as well as possibly project gutenberg searches of related/random text  
for narrative, and finally using lulu’s API ([http://api.lulu.com/](http://api.lulu.com/)) or  
createspace, if I can find an API for them, to automatically publish  
and purchase a copy. could TOTALLY be extended to have commercial  
value in record-keeping, for companies that use IM and RSS, if that  
were implemented, which it might be anyway because hey, blogs. Title =  
Chaptertitle. yeah they’d be short chapters, but I like richard  
brautigan and thousands of livejournal users would be aching to see  
themselves in print, I’m sure. 🙂

any help in any of these areas is appreciated! thank you kindly.

---

<div class="post-metadata">

**Author:** ![simonsaid](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/b5e925/32.png) [@simonsaid](https://www.ruby-forum.com/u/simonsaid)\
**Post date:** [September 24, 2007, 8:36pm UTC](https://www.ruby-forum.com/t/my-code-hangs/115391/2 "2007-09-24T20:36:11Z")

</div>

On 9/24/07, Simon S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> it DID (kind of) work and even exit, but only after going through one  
> log, rather than appending ALL of them, formatted, into a file like I  
> wanted, so I added line 13, and a corresponding end at the bottom. 😛  
> now it makes the main\_text.txt, but hangs.

at line 30 you have:

> ```
> until y.length > 9
> log_array.delete_at(x)
> end
> 
> ```

as far as I can tell, the delete\_at can’t affect y.length, so this  
will loop forever if y.length \<= 9.

-Adam

---

<div class="post-metadata">

**Author:** ![simonsaid](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/b5e925/32.png) [@simonsaid](https://www.ruby-forum.com/u/simonsaid)\
**Post date:** [September 25, 2007, 2:39am UTC](https://www.ruby-forum.com/t/my-code-hangs/115391/3 "2007-09-25T02:39:50Z")

</div>

thank you, this fixed this problem
