FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » query: how many use PHP for linux scripts
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: query: how many use PHP for linux scripts [message #185968 is a reply to message #185964] Thu, 15 May 2014 16:48 Go to previous messageGo to previous message
The Natural Philosoph is currently offline  The Natural Philosoph
Messages: 993
Registered: September 2010
Karma:
Senior Member
On 15/05/14 17:13, crankypuss wrote:
> On 05/15/2014 07:52 AM, The Natural Philosopher wrote:
>> On 15/05/14 13:34, Jasen Betts wrote:
>>> including files with lines larger than RAM + swap.
>>
>> THAT is challenge!
>>
>> Have to use temporary files..
>>
>>
>
> Whatever for? You need enough "disk" space to contain the input file
> and the output file, you need enough memory to contain the two largest
> contiguous records

but in the case specified, you dont have that space.


and the code to read-2-(swap-2)-write-2. Whether the
> swap involves actual data movement or not is a nit, it boils down to a
> file-copy 2 lines at a time. (Wouldn't surprise me if the "cp" command
> has some option for this kind of thing along with the rest of the
> kitchen sink... or is that "tar" that I'm thinking of...)
>
> Unless of course I'm missing something, I'm feeling stupider with each
> post about this exercise that I read. <g>

"*lines* larger than RAM + swap" is the key.

you need to essentially read through the input file and tag where the
line begins and ends are.

THEN start reading it sequentially from the tag marks and assembling the
output a few megabytes at a time

i.e. you will end up wit at worst enough storage needed to hold an array
of 'line start and end' offsets in the original file.

Or if space is REALLY tight you do it the way COBOL used to do things.
Yuu scan the file to the first line end and then write thet second line
out, too the new file, then store that location as line 3, and write
line one to the tail of file 2, and so on

The point is that's fairly trivial with C. It doesn't ENFORCE a
particular way of dealing with files on you.

And C with a good library can be really high level too.

BUT if that doesn't work for you, no problem in going near to the
hardware either.


--
Ineptocracy

(in-ep-toc’-ra-cy) – a system of government where the least capable to
lead are elected by the least capable of producing, and where the
members of society least likely to sustain themselves or succeed, are
rewarded with goods and services paid for by the confiscated wealth of a
diminishing number of producers.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: How to get the POST name of a field in a form that uses a counter
Next Topic: PHP-SOAP/5.4.21 SoapClient terminating POST without waiting for reply, but still complaining "error fetching http headers".
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Thu Sep 19 12:31:50 GMT 2024

Total time taken to generate the page: 0.04475 seconds