| bitsweat | arooni: puts krunk-: I don't think so.. I don't know what's going on there |
| krunk- | hm, is there a more low level way to parse a file in ruby or is this a case of should be done in C? |
| arooni | bitsweat: so its enough to just do \n when i'm writing to a file? ruby figures out to put each on a new line? |
| bitsweat | puts always appends a newline to the string or you can print "my string\n" |
| arooni | bitsweat: bitsweat right but i need to do.... File.write("line1\nlin2\nlin3") and have it be 3 separate lines in the file illegal access mode rw ... when i do... File.open('filename', "rw") or even r+w |
| bitsweat | arooni: ri File.open those aren't valid modes get pickaxe by your side, start using irb, and you're golden. |
| matadon | Now all I need to do is figure out why a Ruby program that processes 25M of data requires 500M of RAM. *sigh* Actually, that itself isn't so bad, but the fact that it slows to a crawl after the first third of the data has been parsed is frankly depressing. Nrr. |
| bitsweat | matadon: prob cause it's generating a lot of garbage? |
| technoweenie | because you're being careless with memory? |
| matadon | bitsweat: I kind-of gathered that, and I'm profiling the code right now to see where the biggest CPU hogs are, but I'm having a hard time of finding a good way to cut down on the garbage. technoweenie: Got any good suggestions for tools that I can use to figure out where all that memory is being used/ s/\//\?/g |
| arooni | ok i need to change group ownership for a file but it looks like i have to do this with ints instead of strings is there anyway around this |
| jontec | hey uh... real quick, can I put a variable in for shell like this: `ruby #{ file }.rb` |
| jp_tix | jontec: yup |
| arooni | hey folks how do i move files that i've just created within File.open() (i'm still within the open()'s block) |
| nachos | I dont think you can... because when the block closes then it will try to close a phantom file. maybe someone can enlighten you more, i dunno. |
| decaf | you can't (I just started to learn ruby, but it doesn't seem possible) arooni: what do you want to do exactly? |
| arooni | well |
| technoweenie | logic would dictate you create the file where you want it to be created |
| arooni | i think it is possible... FileUtils#move seems to do the trick :P |
| technoweenie | or you just move it after its created |
| arooni | technoweenie: well i normally would but i'm putting in an overly eager directory of asterisk and it starts reading and running with files even if you're not done writing to it yet |
| nachos | arooni: It may work on some platforms, i think it would work on most unices, but it would break on win32 ( since you cant move open files ) |
| arooni | nachos: i've switched to linux permenently |