php-general Digest 23 Jun 2013 08:27:14 -0000 Issue 8274

Topics (messages 321454 through 321459):

Re: scandir doesn't find all files
        321454 by: Ken Robinson
        321455 by: Ken Robinson
        321456 by: Tamara Temple

Re: json stream filter
        321457 by: Tamara Temple
        321458 by: Larry Garfield
        321459 by: Markus Staab

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscr...@lists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscr...@lists.php.net

To post to the list, e-mail:
        php-gene...@lists.php.net


----------------------------------------------------------------------
--- Begin Message ---

Sent from my iPhone

On Jun 22, 2013, at 3:10 PM, Daniel Pöllmann <poellmann.dan...@gmail.com> wrote:

> Hi,
> I have some files in a directory - some are uploaded via ftp and some other
> are created by a php script.
> 
> Scandir just finds the uploaded files, but none of the created files.
> I can't run chown() because the server is part of shared hosting.
> 
> I can't find anything about this behavour in the documentation.
> 
> Best wishes,
> Daniel

--- End Message ---
--- Begin Message ---
Did you try the glob function? http://php.net/glob

Ken

Sent from my iPhone

On Jun 22, 2013, at 3:10 PM, Daniel Pöllmann <poellmann.dan...@gmail.com> wrote:

> Hi,
> I have some files in a directory - some are uploaded via ftp and some other
> are created by a php script.
> 
> Scandir just finds the uploaded files, but none of the created files.
> I can't run chown() because the server is part of shared hosting.
> 
> I can't find anything about this behavour in the documentation.
> 
> Best wishes,
> Daniel

--- End Message ---
--- Begin Message ---
Daniel Pöllmann <poellmann.dan...@gmail.com> wrote:
> I have some files in a directory - some are uploaded via ftp and some other
> are created by a php script.
> 
> Scandir just finds the uploaded files, but none of the created files.
> I can't run chown() because the server is part of shared hosting.

Please show code and output.

--- End Message ---
--- Begin Message ---
Markus Staab <maggus.st...@gmail.com> wrote:
> first post on the list, so please bare with me ;-)

No, I'm getting nekkee with you... :)

> we are handling a lot of cache files in our apps and use json to persist
> those contents on the filesystem, because it seems to be the fastest
> possible way to read/write files with PHP.
> 
> Since I discovered stream-filters, http://www.php.net/manual/en/filters.php,
> we use those also for base64 encoding files before sending them over the
> wire, which preserves a lot of memory and allows even bigger files.
> 
> Would it make sense to also have a native stream filter for fileformats
> like JSON, to get maximum performance for reading/writing those (and also
> to be able to write big files)?

I think this could be a real win for some folks; I personally haven't
got a use for it at the moment, but I can see where it would make
a lot of sense of some applications.




--- End Message ---
--- Begin Message ---
On 06/20/2013 04:26 AM, Markus Staab wrote:
Hi!

first post on the list, so please bare with me ;-)

we are handling a lot of cache files in our apps and use json to persist
those contents on the filesystem, because it seems to be the fastest
possible way to read/write files with PHP.

Since I discovered stream-filters, http://www.php.net/manual/en/filters.php,
we use those also for base64 encoding files before sending them over the
wire, which preserves a lot of memory and allows even bigger files.

Would it make sense to also have a native stream filter for fileformats
like JSON, to get maximum performance for reading/writing those (and also
to be able to write big files)?

Thanks,
Markus

What would it do, exactly? Stream filters still have to read/write a string, don't they? Unless you're talking about reading directly into a nested array structure (what json_decode() does), I am not sure what the benefit is of what you're describing. (And I'm not sure you could do that, although it would be neato if you could.)

--Larry Garfield

--- End Message ---
--- Begin Message ---
Gruß, Markus

Am 23.06.2013 um 05:08 schrieb Larry Garfield <la...@garfieldtech.com>:

> On 06/20/2013 04:26 AM, Markus Staab wrote:
>> Hi!
>>
>> first post on the list, so please bare with me ;-)

Yes the usual typo ;)

>>
>> we are handling a lot of cache files in our apps and use json to persist
>> those contents on the filesystem, because it seems to be the fastest
>> possible way to read/write files with PHP.
>>
>> Since I discovered stream-filters, http://www.php.net/manual/en/filters.php,
>> we use those also for base64 encoding files before sending them over the
>> wire, which preserves a lot of memory and allows even bigger files.
>>
>> Would it make sense to also have a native stream filter for fileformats
>> like JSON, to get maximum performance for reading/writing those (and also
>> to be able to write big files)?
>>
>> Thanks,
>> Markus
>
> What would it do, exactly?  Stream filters still have to read/write a string, 
> don't they?  Unless you're talking about reading directly into a nested array 
> structure (what json_decode() does), I am not sure what the benefit is of 
> what you're describing.  (And I'm not sure you could do that, although it 
> would be neato if you could.)

I also thought that the types could be a problem. The writing
functions expect strings and all reading functions return strings.
When handling json values, most of the time we need to handle arrays or objects.
But nevertheless I want to open this discussion maybe some people chim
in and have great ideas how to solve it.

Maybe there are other ways how we could improve the json handling from
within php in a more native way.
The actual problem is handling json within streams, which cannot be
fast enough for todays applications.

I also played with the idea to use a generator-like approach to make
iterating a json-stream possible without the need to built the whole
object into memory at first.

Just some additional random thoughts, though.


>
> --Larry Garfield
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

--- End Message ---

Reply via email to