Search Results

Search found 3 results on 1 pages for 'needbeerstat'.

Page 1/1 | 1 

  • PHP/GnuPG Decryption -- Syntax error?

    - by NeedBeerStat
    I'm using php to invoke gpg, but I'm getting a pipe error. I thought that if I read in the password from a file, I could then pipe it to the command itself? But, I keep getting: Syntax error: "|" unexpected Here's the code: (Note: The files are being iterated over in a foreach loop...) foreach($files as $k => $v) { $encrypted = $v; $filename = explode('.',$v); $decrypted = $filename[0].'.txt'; shell_exec("echo $passphrase | gpg --no-tty --passphrase-fd 0 -o $decrypted -d $encrypted"); }

    Read the article

  • Using file() incrementally?

    - by NeedBeerStat
    I'm not sure if this is possible, I've been googling for a solution... But, essentially, I have a very large file, the lines of which I want to store in an array. Thus, I'm using file(), but is there a way to do that in batches? So that every,say, 100 lines it creates, it "pauses"? I think there's likely to be something I can do with a foreach loop or something, but I'm not sure that I'm thinking about it the right way... Like $i=0; $j=0; $throttle=100; foreach($files as $k => $v) { if($i < $j+$throttle && $i > $j) { $lines[] = file($v); //Do some other stuff, like importing into a db } $i++; $j++; } But, I think that won't really work because $i & $j will always be equal... Anyway, feeling muddled... Can someone help me think a lil' clearer?

    Read the article

  • php - using file() incrementally?

    - by NeedBeerStat
    I'm not sure if this is possible, I've been googling for a solution... But, essentially, I have a very large file, the lines of which I want to store in an array. Thus, I'm using file(), but is there a way to do that in batches? So that every,say, 100 lines it creates, it "pauses"? I think there's likely to be something I can do with a foreach loop or something, but I'm not sure that I'm thinking about it the right way... Like $i=0; $j=0; $throttle=100; foreach($files as $k => $v) { if($i < $j+$throttle && $i > $j) { $lines[] = file($v); //Do some other stuff, like importing into a db } $i++; $j++; } But, I think that won't really work because $i & $j will always be equal... Anyway, feeling muddled... Can someone help me think a lil' clearer?

    Read the article

1