php-general Digest 30 Sep 2011 18:36:14 -0000 Issue 7499

Topics (messages 315075 through 315087):

Re: php5-fpm segfault
        315075 by: áÌÅËÓÁÎÄÒ çÏÎÞÁÒÏ×

Re: Getting meta data (of any type) for an XML file being from it's URL.
        315076 by: Richard Quadling

Re: Input variable from form help request
        315077 by: Richard Quadling

[Friday] Tokyo / Kyoto.
        315078 by: Richard Quadling
        315079 by: Marc Guay

RSS Feed Accented Characters
        315080 by: Ron Piggott
        315081 by: Richard Quadling
        315082 by: Jen Rasmussen
        315083 by: Richard Quadling
        315084 by: Jen Rasmussen
        315086 by: Ron Piggott

Re: Attached without Attachment
        315085 by: Sean Greenslade

Generate CMS based on database schema
        315087 by: Marc Guay

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 ---
You think this is PHP's bug? I'm not sure. Because PHP installed not
latest version and yesterday i tune memory_limit setting to 256M (was
-1) and no segfaults registered since that moment. I think, bad
designed script allocate too much memory and php-fpm worker become mad
and kill himself. But it's hard to find the culprit in a huge number
of scripts.

--- End Message ---
--- Begin Message ---
On 29 September 2011 23:34, Tommy Pham <tommy...@gmail.com> wrote:
> On Thu, Sep 29, 2011 at 3:27 PM, Tommy Pham <tommy...@gmail.com> wrote:
>>
>> On Thu, Sep 29, 2011 at 9:09 AM, Richard Quadling <rquadl...@gmail.com>
>> wrote:
>>>
>>> Hi.
>>>
>>> I'm looking to process very large XML files without the need of first
>>> downloading them.
>>>
>>> To that end,
>>> SimpleXMLIterator('compress.zlib://http://www.site.com/products.xml.gz')
>>> is working perfectly.
>>>
>>> But a downside is that I have no information of my progress.
>>>
>>> Is there any mechanism available to get a position within the XML stream?
>>>
>>> I can use libxml_set_streams_context() to set a context (so I can
>>> provide POST data if needed for the HTTP request), but I can't see how
>>> to gain access to the stream within the libxml code (SimpleXML uses
>>> libxml).
>>>
>>> At the most basic, what I'm looking for is to be able to record a
>>> percentage complete. Even with compression, I'll be reading some bytes
>>> from a stream (either from http or from compress.zlib) and I want to
>>> know where I am in that stream.
>>>
>>> The HTTP header will tell me how big the file is (so that can easily
>>> be a HEAD request to get that data).
>>>
>>>
>>> Even if I DO save the file locally first, I still can't get a position.
>>>
>>> If I use the SimpleXMLIterator::count() method, I am unsure as to what
>>> will happen if I am using a stream (rather than a local file). If I
>>> use ...
>>>
>>> $xml = new SimpleXMLIterator(...);
>>> $items = $xml->count();
>>> foreach($xml as $s_Tag => $o_Item) {
>>>  ...
>>> }
>>>
>>> will the XML file be cached somewhere? Or will that depend upon the
>>> originating server supporting some sort of rewind/chunk mechanism?
>>>
>>>
>>>
>>> Any suggestions/ideas?
>>>
>>>
>>>
>>> Richard.
>>>
>>>
>>> --
>>> Richard Quadling
>>> Twitter : EE : Zend : PHPDoc
>>> @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea
>>>
>>
>> Richard,
>>
>> Only think I can think of is break up into 2 parts.  1st part use cURL for
>> the down streams and monitor it's progress.  2nd part is XML parsing.  If
>> you want to do both simultaneously and only if the remote supports chunked
>> encoding/transfer, you could use multiple handles of cURL into numerical
>> indexed array variable containing the chunks for XML parsing.  This could be
>> memory intensive if the file is very large, depending whether you free the
>> elements in the array as you progress.  So if memory consumption is a major
>> concern, you may want to save to the file locally until the import/migration
>> is done as there maybe a situation where you'll need to review the data and,
>> thus, saving the time and bandwidth of having to re-download the data.
>>
>> Regards,
>> Tommy
>
> An afterthought,  handling streams and parsing at the same may require
> sophisticated XML node validations as the node maybe split between the
> transferred chunks.
>

The SimpleXMLIterator() does do a superb job of providing 1 node at a
time and doesn't remember each node automatically. If I do, then
that's my issue.

Accessing the stream/file meta data doesn't seem possible.


-- 
Richard Quadling
Twitter : EE : Zend : PHPDoc
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea

--- End Message ---
--- Begin Message ---
On 29 September 2011 23:28, PHProg <php...@speedemessenger.com> wrote:
>
> Hello Richard,
>
> Your suggestion worked perfectly.
> ... it works beautifully.

Now that's what I like to hear!

Glad to be of help.

-- 
Richard Quadling
Twitter : EE : Zend : PHPDoc
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea

--- End Message ---
--- Begin Message ---
Tokyo means "Eastern Capital"
Kyoto means "Western Capital"


-- 
Richard Quadling
Twitter : EE : Zend : PHPDoc
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea

--- End Message ---
--- Begin Message ---
http://translate.google.com/#auto|ja|%20vanilla%20hotdogs

--- End Message ---
--- Begin Message ---
I am trying to set up an RSS Feed in the Spanish language using a PHP cron job. 
 I am unsure of how to deal with accented letters.

An example: 

This syntax:

<?php

$rss_content .= "<description>" . htmlentities("El Versículo del Día") . 
"</description>\r\n";

?>

Outputs:


<description>El Vers&iacute;culo del D&iacute;a</description>


When I use an RSS Feed validator I receive the error message

This feed does not validate.

  a.. line 24, column 20: XML parsing error: <unknown>:24:20: undefined entity

I suspect the “;” is the issue, although it is needed for the accented letters. 
 If I don’t use htmlentities() the accented characters can’t be viewed, they 
become a “?”  How should I proceed?

Ron




www.TheVerseOfTheDay.info 

--- End Message ---
--- Begin Message ---
On 30 September 2011 17:26, Ron Piggott <ron....@actsministries.org> wrote:
>
> I am trying to set up an RSS Feed in the Spanish language using a PHP cron 
> job.  I am unsure of how to deal with accented letters.
>
> An example:
>
> This syntax:
>
> <?php
>
> $rss_content .= "<description>" . htmlentities("El Versículo del Día") . 
> "</description>\r\n";
>
> ?>
>
> Outputs:
>
>
> <description>El Vers&iacute;culo del D&iacute;a</description>
>
>
> When I use an RSS Feed validator I receive the error message
>
> This feed does not validate.
>
>  a.. line 24, column 20: XML parsing error: <unknown>:24:20: undefined entity
>
> I suspect the “;” is the issue, although it is needed for the accented 
> letters.  If I don’t use htmlentities() the accented characters can’t be 
> viewed, they become a “?”  How should I proceed?
>
> Ron

Make sure you have ...

<?xml version="1.0" encode="UTF-8"?>

as the first line of the output. That tells the reader that the file
is a UTF-8 encoded file. Also, if you ejecting HTTP headers, make sure
that they say the encoding is UTF-8 and not a codepage.

Go UTF-8 everywhere.


-- 
Richard Quadling
Twitter : EE : Zend : PHPDoc
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea

--- End Message ---
--- Begin Message ---
Would this work?

$content = "El Vers&iacute;culo del D&iacute;a";
$rss_content .= "<description>" . $content . "</description>\r\n";

Cheers!
Jen



-----Original Message-----
From: Ron Piggott [mailto:ron....@actsministries.org] 
Sent: Friday, September 30, 2011 11:26 AM
To: php-gene...@lists.php.net
Subject: [PHP] RSS Feed Accented Characters


I am trying to set up an RSS Feed in the Spanish language using a PHP cron job. 
 I am unsure of how to deal with accented letters.

An example: 

This syntax:

<?php

$rss_content .= "<description>" . htmlentities("El Versículo del Día") . 
"</description>\r\n";

?>

Outputs:


<description>El Vers&iacute;culo del D&iacute;a</description>


When I use an RSS Feed validator I receive the error message

This feed does not validate.

  a.. line 24, column 20: XML parsing error: <unknown>:24:20: undefined entity

I suspect the “;” is the issue, although it is needed for the accented letters. 
 If I don’t use htmlentities() the accented characters can’t be viewed, they 
become a “?”  How should I proceed?

Ron




www.TheVerseOfTheDay.info 


--- End Message ---
--- Begin Message ---
On 30 September 2011 17:41, Jen Rasmussen <j...@cetaceasound.com> wrote:
> Would this work?
>
> $content = "El Vers&iacute;culo del D&iacute;a";
> $rss_content .= "<description>" . $content . "</description>\r\n";
>
> Cheers!
> Jen

The entities are HTML entities. They are not XML entities.

If they are displayed as ? then it is an encoding issue.

What encoding are you using?

-- 
Richard Quadling
Twitter : EE : Zend : PHPDoc
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea

--- End Message ---
--- Begin Message ---
Whoops! Forgive my try at it :)

-----Original Message-----
From: Richard Quadling [mailto:rquadl...@gmail.com] 
Sent: Friday, September 30, 2011 11:47 AM
To: j...@cetaceasound.com
Cc: Ron Piggott; php-gene...@lists.php.net
Subject: Re: [PHP] RSS Feed Accented Characters

On 30 September 2011 17:41, Jen Rasmussen <j...@cetaceasound.com> wrote:
> Would this work?
>
> $content = "El Vers&iacute;culo del D&iacute;a";
> $rss_content .= "<description>" . $content . "</description>\r\n";
>
> Cheers!
> Jen

The entities are HTML entities. They are not XML entities.

If they are displayed as ? then it is an encoding issue.

What encoding are you using?

-- 
Richard Quadling
Twitter : EE : Zend : PHPDoc
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea



--- End Message ---
--- Begin Message ---

-----Original Message----- From: Richard Quadling
Sent: Friday, September 30, 2011 12:31 PM
To: Ron Piggott
Cc: php-gene...@lists.php.net
Subject: Re: [PHP] RSS Feed Accented Characters

On 30 September 2011 17:26, Ron Piggott <ron....@actsministries.org> wrote:

I am trying to set up an RSS Feed in the Spanish language using a PHP cron job. I am unsure of how to deal with accented letters.

An example:

This syntax:

<?php

$rss_content .= "<description>" . htmlentities("El Versículo del Día") . "</description>\r\n";

?>

Outputs:


<description>El Vers&iacute;culo del D&iacute;a</description>


When I use an RSS Feed validator I receive the error message

This feed does not validate.

a.. line 24, column 20: XML parsing error: <unknown>:24:20: undefined entity

I suspect the “;” is the issue, although it is needed for the accented letters. If I don’t use htmlentities() the accented characters can’t be viewed, they become a “?” How should I proceed?

Ron

Make sure you have ...

<?xml version="1.0" encode="UTF-8"?>

as the first line of the output. That tells the reader that the file
is a UTF-8 encoded file. Also, if you ejecting HTTP headers, make sure
that they say the encoding is UTF-8 and not a codepage.

Go UTF-8 everywhere.


--
Richard Quadling
Twitter : EE : Zend : PHPDoc
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea




Hi Richard:

Having " <?xml version="1.0" encoding="UTF-8"?> " as the starting line didn't correct the problem.

The RSS Feed is @
http://www.elversiculodeldia.info/peticiones-de-rezo-rss.xml

There are a variety of errors related to accented characters while using a feed valuator
http://validator.w3.org/feed/check.cgi?url=http%3A%2F%2Fwww.elversiculodeldia.info%2Fpeticiones-de-rezo-rss.xml

- Also While viewing the feed in Firefox once the first accented character is displayed none of the rest of the feed is visible, except by right clicking and "view source"

The RSS Feed content will be populated by a database query. The database columns are set to utf8_unicode_ci

How should I proceed?
Ron
--- End Message ---
--- Begin Message ---
On Wed, Sep 28, 2011 at 12:15 PM, Gustavo - Emar Plásticos <
supo...@emar.com.br> wrote:

> Hi all, i made a code in PHP to save in a directory the XML attachments !
> All goes well until it comes across an email that has attachment but can
> not save !
>
> analyzing the source code of this email, i realized it has no line:
>
> Content-Disposition: attachment; filename="name of the file.xml"
>
> but only this line:
>
> Content-Type: application/octet-stream; name=name of file.xml
> Content-Transfer-Encoding: base64
>
> I´m using IMAP and the account is from Google: $host = "{
> imap.gmail.com:993/imap/ssl}**INBOX<http://imap.gmail.com:993/imap/ssl%7DINBOX>
> ";
>
> What happend ?
> Thanks any help
>
> Gustave
>

My suspicion is that the email contained no actual text body, so google
converted the entire email message into the attachment (in octet-stream
format).

Unfortunately, email is only somewhat standardized. You'll have to make your
programs deal with these sort of oddities, as they'll be inevitable.

-- 
--Zootboy

Sent from my PC.

--- End Message ---
--- Begin Message ---
Howdy,

I'm looking for a FOSS equivalent to PHPMaker, or at least something
which comes close to it.  For those who don't know the program, it
syncs with your database and allows you to generate an entire CMS
system based on it.  To be clear, I am not looking for a CRUD code
generator, I'm looking for something that can generate the whole
shabang so I can get on with it.

Perhaps someone could sassily tell me why I don't need this tool or
propose another method, that would be good too.  I really enjoy
building sites up from the DB schema but hate creating web interfaces
for editing them.  I've also taken a stab at Drupal, which is like
doing it the other way around, using the CMS to create the schema, but
a lot of the time it seems ass backwards and I'm not in the mood to
get another hand cramp from clicking through the interface for 6 hours
setting everything up.

Marc

--- End Message ---

Reply via email to