php-general Digest 16 Sep 2011 00:46:47 -0000 Issue 7480
Topics (messages 314868 through 314884):
Re: Sort problem
314868 by: yeer tai
lost return value during a static call
314869 by: chamila gayan
314872 by: Robert Williams
314873 by: Richard Quadling
Re: Stop PHP execution on client connection closed
314870 by: Marco Lanzotti
Re: innerHTML triple quotes issue
314871 by: Jen Rasmussen
314874 by: Andrew Ballard
XML enabled but not working
314875 by: Matthew Pounsett
314881 by: tamouse mailing lists
Bug?
314876 by: Igor Escobar
314877 by: Daniel Brown
314878 by: Igor Escobar
314879 by: Shawn McKenzie
314880 by: Igor Escobar
314882 by: tamouse mailing lists
314883 by: Tim Streater
Re: Repetitive answers . . .
314884 by: Jason Pruim
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 ---
Yeah well, it is indeed sometimes, for someone a bit sleepy yet rather
responsible hehe. Btw, m new here, need to get my head around soon i guess.
Cheers.
> From: marc.g...@gmail.com
> Date: Thu, 15 Sep 2011 07:54:00 -0400
> CC: php-gene...@lists.php.net
> Subject: Re: [PHP] Re: Sort problem
>
> > use natsort.
>
> For the "repetitive answers" specialists: Is it possible that 15
> hours later someone is still only seeing the original question?
>
> Marc
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
--- End Message ---
--- Begin Message ---
hi All,
I'm seeing a weired behavior in following code http://pastebin.com/B5q8i1RY
when it goes through 2 static methods, at some point it stops returning
value to the calling method. (please see comments in-line).
may be I'm doing this in a wrong way so your suggestions are welcome. And I
really appreciate if someone can explain how 'return' behaves with static
methods specially when they are called recursively. thanks a bunch
chamila
--- End Message ---
--- Begin Message ---
On Sep 15, 2011, at 6:03, "chamila gayan" <cgcham...@gmail.com> wrote:
> when it goes through 2 static methods, at some point it stops returning
> value to the calling method. (please see comments in-line).
The getArray() method and the 'else' portion of the getChild() method both lack
a return statement, so they're basically just tossing out whatever value they
come up with.
--
Bob Williams
Notice: This communication, including attachments, may contain information that
is confidential. It constitutes non-public information intended to be conveyed
only to the designated recipient(s). If the reader or recipient of this
communication is not the intended recipient, an employee or agent of the
intended recipient who is responsible for delivering it to the intended
recipient, or if you believe that you have received this communication in
error, please notify the sender immediately by return e-mail and promptly
delete this e-mail, including attachments without reading or saving them in any
manner. The unauthorized use, dissemination, distribution, or reproduction of
this e-mail, including attachments, is prohibited and may be unlawful. If you
have received this email in error, please notify us immediately by e-mail or
telephone and delete the e-mail and the attachments (if any).
--- End Message ---
--- Begin Message ---
On 15 September 2011 14:01, chamila gayan <cgcham...@gmail.com> wrote:
> hi All,
>
> I'm seeing a weired behavior in following code http://pastebin.com/B5q8i1RY
>
> when it goes through 2 static methods, at some point it stops returning
> value to the calling method. (please see comments in-line).
>
> may be I'm doing this in a wrong way so your suggestions are welcome. And I
> really appreciate if someone can explain how 'return' behaves with static
> methods specially when they are called recursively. thanks a bunch
>
> chamila
>
New pastie http://pastebin.com/AnZ1r7yR
Output is ...
Z:\ppp.php 108parentclass::getChild 29parentclass::getChild
40parentclass::getArray 22parentclass::getChild
29parentclass::getChild 32parentclass::childload
6parentclass::childload 9childA::__construct 54childA::setA
67childA::setA 69childA::__construct 56parentclass::getChild 34childA
Object( [a:childA:private] => 1)parentclass::getArray
24parentclass::getChild 42parentclass::getChild 44Z:\ppp.php
110Z:\ppp.php 112
Using PHP 5.3.9-dev on Win32.
--
Richard Quadling
Twitter : EE : Zend : PHPDoc
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea
--- End Message ---
--- Begin Message ---
Il 14/09/2011 19:34, Alex Nikitin ha scritto:
> Perhaps if I, or we can understand your application a little better,
> we could suggest better solutions, just remember that you are not the
> first person to have to solve these similar issues. I can help you if
> you want, glimpse over your database design and queries for a fresh
> look, i have fairly extensive php (and many other languages)
> programming experience, as well as database design and administration,
> system development and administration, optimization, security, caching
> (many other things, that don't directly pertain to this) though we
> should probably keep it off the list.
Table and queries are very simple.
Table is like this:
CREATE TABLE `TABLE1` (
`ID` int unsigned NOT NULL,
`Service` char(2) NOT NULL,
`Lang` char(2) NOT NULL,
`Text1` varchar(100) DEFAULT NULL,
`Char1` char(1) NOT NULL,
`Date1` date NOT NULL,
`Num1` int unsigned NOT NULL,
`Num2` smallint unsigned NOT NULL,
`Num3` smallint unsigned NOT NULL,
`Num4` tinyint unsigned NOT NULL,
`Num5` int unsigned NOT NULL,
`Num6` tinyint NOT NULL,
`Num7` int unsigned NOT NULL,
PRIMARY KEY (`ID`,`Service`,`Lang`),
KEY `index_1` (`Char1`),
KEY `index_2` (`Date1`),
KEY `index_3` (`Num1`),
KEY `index_4` (`Num2`),
KEY `index_5` (`Num3`),
KEY `index_6` (`Num4`),
KEY `index_7` (`Num5`),
KEY `index_8` (`Num6`),
KEY `index_9` (`Num7`),
KEY `index_10` (`Text1`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
And this is an example query:
SELECT COUNT(*)
FROM TABLE1
WHERE Char1='A'
AND Num2=10
The WHERE clause can contain any indexed column.
Bye,
Marco
--- End Message ---
--- Begin Message ---
Grega,
Do you HAVE TO use PHP to echo the output or can you just write it in HTML? It
seems much simpler and if
so... below will work. The code is not indented properly but I did this so you
can see what's going on.
HTML VERSION
<h3>My Heavenly profession is being</h3>
<span class="see"
onmouseover="this.innerHTML='<img
src=\'http://imagecache2.allposters.com/images/PF_New/102008/3070943.jpg\' />'"
onmouseout="this.innerHTML='an angel'"
>
an angel</span>
Hope that helps, cheers!
Jen
-----Original Message-----
From: Grega Leskovšek [mailto:legr...@gmail.com]
Sent: Thursday, September 15, 2011 4:01 AM
To: php-general
Subject: [PHP] innerHTML triple quotes issue
<h3>My Heavenly profession is being <span class="see"
onmouseover='<?php echo "this.innerHTML=' <img
src=\"http://imagecache2.allposters.com/images/PF_New/102008/3070943.jpg\"
alt =\"close to my heavenly face\" />'";?>'
onmouseout="this.innerHTML='an angel'">an angel</span>,
I first tried this but got a mistake and then I tried to use php to
settle this look above, but got parsing mistake.
although not fully liberated I came to work in this world for <span class="see"
onmouseover="this.innerHTML='<img
src=\"http://t1.gstatic.com/images?q=tbn:ANd9GcTaxIC0HvMMWTlZ2ozXMcwTsqRcStUXRWItISeVyDrVkzVtv2s-AVmn6v3x\"
alt =\"Lord Krishna in His garden of flowers, that's a spiritual world\" />'"
onmouseout="this.innerHTML='Lord Krishna\'s Realisation.'">Lord
Krishna's Realisation.</span></h3>
Could YOu please look a t my code and exlpain me what to do if I need
to use triple quotoes - we only have " and ' in onmouseover 1,
thisINNERHTML 2 and in src 3
Please help me!
♥♥♥ When the sun rises I receive and when it sets I forgive! ♥♥♥
˜♥ -> http://moj.skavt.net/gleskovs/ <- ♥ Always, Grega Leskovšek
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
On Thu, Sep 15, 2011 at 5:01 AM, Grega Leskovšek <legr...@gmail.com> wrote:
>
> <h3>My Heavenly profession is being <span class="see"
> onmouseover='<?php echo "this.innerHTML=' <img
> src=\"http://imagecache2.allposters.com/images/PF_New/102008/3070943.jpg\"
> alt =\"close to my heavenly face\" />'";?>'
> onmouseout="this.innerHTML='an angel'">an angel</span>,
>
>
> I first tried this but got a mistake and then I tried to use php to
> settle this look above, but got parsing mistake.
>
It's easy to forget that, although you are embedding JavaScript in the
onmouseover and onmouseout attributes of the element, the content of
those attributes is still technically HTML, so the single and double
quotes as well as the tag angle brackets inside the attribute should
probably be the HTML entities (" ' < and >) instead of
the literal characters. This avoids the issue with nesting and
escaping quotes across three languages (PHP -> HTML -> Javascript).
Of course, when testing this, my first attempt worked in Firefox,
Opera, Safari and Chrome but failed in IE (version 8). (Go figure)
<span class="see"
onmouseover="this.innerHTML='<br><img
src="http://imagecache2.allposters.com/images/PF_New/102008/3070943.jpg"
/>'"
onmouseout="this.innerHTML='an angel'"
>
an angel</span>
So then I tried a mixed approach and it seems to work in all of them:
<span class="see"
onmouseover="this.innerHTML='<br><img
src="http://imagecache2.allposters.com/images/PF_New/102008/3070943.jpg"
/>'"
onmouseout="this.innerHTML='an angel'"
>
an angel</span>
YMMV
Andrew
--- End Message ---
--- Begin Message ---
I seems to behaving issues with php5 on one particular server, and I haven't
been able to find the issue. Basically, php says XML is enabled, but xml
functions are missing.
> php -i | grep "XML support"
libXML support => active
> echo "<? print xml_parser_create(''); ?>" | php
Fatal error: Call to undefined function xml_parser_create() in - on line 1
The machine in question is FreeBSD 8.2-RELEASE running the most recent ports of
php5 and expat.
> php -v
PHP 5.3.8 with Suhosin-Patch (cli) (built: Sep 15 2011 13:58:49)
Copyright (c) 1997-2011 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2011 Zend Technologies
> sudo portversion -v expat
expat-2.0.1_2 = up-to-date with port
What's baffling is that this is a basically identical configuration to another
server where php is behaving just fine. I haven't been able to find the
variation yet.
Anyone have any thoughts on what to look at?
--- End Message ---
--- Begin Message ---
On Thu, Sep 15, 2011 at 3:20 PM, Matthew Pounsett <m...@conundrum.com> wrote:
>> echo "<? print xml_parser_create(''); ?>" | php
Not anything to do with the problem, but you can just write:
php -r "print xml_parser_create('');"
--- End Message ---
--- Begin Message ---
Anyone can explain this?
https://gist.github.com/1220404
Part of the code are in portuguese so...
iguais = equal
diferentes = different
Regards,
Igor Escobar
*Software Engineer
*
+ http://blog.igorescobar.com
+ http://www.igorescobar.com
+ @igorescobar <http://www.twitter.com/igorescobar>
--- End Message ---
--- Begin Message ---
On Thu, Sep 15, 2011 at 17:07, Igor Escobar <titiolin...@gmail.com> wrote:
> Anyone can explain this?
>
> https://gist.github.com/1220404
>
> Part of the code are in portuguese so...
> iguais = equal
> diferentes = different
About this part are you confused?
--
</Daniel P. Brown>
Network Infrastructure Manager
http://www.php.net/
--- End Message ---
--- Begin Message ---
I'm confused about the output of the code... very disturbed. But
@*augustohp<https://gist.github.com/augustohp>
* already respond the question on the gist thread (in portuguese) and
explained why those results.
Regards,
Igor Escobar
*Software Engineer
*
+ http://blog.igorescobar.com
+ http://www.igorescobar.com
+ @igorescobar <http://www.twitter.com/igorescobar>
On Thu, Sep 15, 2011 at 6:17 PM, Daniel Brown <danbr...@php.net> wrote:
> On Thu, Sep 15, 2011 at 17:07, Igor Escobar <titiolin...@gmail.com> wrote:
> > Anyone can explain this?
> >
> > https://gist.github.com/1220404
> >
> > Part of the code are in portuguese so...
> > iguais = equal
> > diferentes = different
>
> About this part are you confused?
>
> --
> </Daniel P. Brown>
> Network Infrastructure Manager
> http://www.php.net/
>
--- End Message ---
--- Begin Message ---
On 09/15/2011 04:07 PM, Igor Escobar wrote:
> Anyone can explain this?
>
> https://gist.github.com/1220404
>
> Part of the code are in portuguese so...
> iguais = equal
> diferentes = different
>
> Regards,
> Igor Escobar
> *Software Engineer
> *
> + http://blog.igorescobar.com
> + http://www.igorescobar.com
> + @igorescobar <http://www.twitter.com/igorescobar>
>
1. Obviously because of the issues with floating point precision these
are stored as the same float, a la your next example.
2. Using bc math for binary calculations on string representations of a
number overcomes the problems in 1.
3. This one is peculiar, but it seems that since they are numeric
strings that they are being juggled to float for the comparison since
using == there is no type checking. Using === yields a different
result, presumably because forcing a type check compares them as
strings. Use strcmp() to overcome this.
4. Do I need to explain this one?
--
Thanks!
-Shawn
http://www.spidean.com
--- End Message ---
--- Begin Message ---
Thank you guys.
Regards,
Igor Escobar
*Software Engineer
*
+ http://blog.igorescobar.com
+ http://www.igorescobar.com
+ @igorescobar <http://www.twitter.com/igorescobar>
On Thu, Sep 15, 2011 at 6:32 PM, Shawn McKenzie <nos...@mckenzies.net>wrote:
> On 09/15/2011 04:07 PM, Igor Escobar wrote:
> > Anyone can explain this?
> >
> > https://gist.github.com/1220404
> >
> > Part of the code are in portuguese so...
> > iguais = equal
> > diferentes = different
> >
> > Regards,
> > Igor Escobar
> > *Software Engineer
> > *
> > + http://blog.igorescobar.com
> > + http://www.igorescobar.com
> > + @igorescobar <http://www.twitter.com/igorescobar>
> >
>
> 1. Obviously because of the issues with floating point precision these
> are stored as the same float, a la your next example.
>
> 2. Using bc math for binary calculations on string representations of a
> number overcomes the problems in 1.
>
> 3. This one is peculiar, but it seems that since they are numeric
> strings that they are being juggled to float for the comparison since
> using == there is no type checking. Using === yields a different
> result, presumably because forcing a type check compares them as
> strings. Use strcmp() to overcome this.
>
> 4. Do I need to explain this one?
>
> --
> Thanks!
> -Shawn
> http://www.spidean.com
>
--- End Message ---
--- Begin Message ---
Hit reply instead of reply-all /o\
---------- Forwarded message ----------
From: tamouse mailing lists <tamouse.li...@gmail.com>
Date: Thu, Sep 15, 2011 at 4:39 PM
Subject: Re: [PHP] Bug?
To: Igor Escobar <titiolin...@gmail.com>
On Thu, Sep 15, 2011 at 4:07 PM, Igor Escobar <titiolin...@gmail.com> wrote:
> Anyone can explain this?
>
> https://gist.github.com/1220404
For the floats, http://us2.php.net/operators.comparison makes it
pretty clear (and this has been a well-known thing about floats as far
back as Uni for me, in 1979).
The string thing is noted in PHP as far back as 2004:
http://us2.php.net/manual/en/language.types.string.php#41986
--- End Message ---
--- Begin Message ---
On 15 Sep 2011 at 22:43, tamouse mailing lists <tamouse.li...@gmail.com> wrote:
> For the floats, http://us2.php.net/operators.comparison makes it
> pretty clear (and this has been a well-known thing about floats as far
> back as Uni for me, in 1979).
The fact that floating point hardware has limited precision has been known ever
since the first such hardware in the mid-1950's, in fact.
--
Cheers -- Tim
--- End Message ---
--- Begin Message ---
Jason Pruim
li...@pruimphotography.com
On Sep 15, 2011, at 3:22 AM, Nathan Nobbe wrote:
> On Wed, Sep 14, 2011 at 10:06 PM, Joshua Stoutenburg
> <jehoshu...@gmail.com>wrote:
>
>> On Wed, Sep 14, 2011 at 11:59 AM, Govinda <govinda.webdnat...@gmail.com>
>> wrote:
>>>> As for duplicate answers...,
>>>
>>>> [snip]
>>>
>>>
>>> Also newbies may tend to like the multiples answers.. for the different
>> perspectives, as Dan said, but also when they are exact dupe answers -
>> because then the newbie knows the answer is definitive.. and then stops
>> asking the list.. and starts doing what work is called for.
>>>
>>> -Govinda
>>> --
>>> PHP General Mailing List (http://www.php.net/)
>>> To unsubscribe, visit: http://www.php.net/unsub.php
>>>
>>>
>>
>> That's a good point. The absence of objection to a provided answer
>> doesn't necessarily make it definitive since it could just be the
>> masses passed over the conversation. Therefore, yes, duplicate
>> answers are a good thing.
>>
>> Thanks everybody for your patience in helping this mailing list
>> newcomer understand how things work.
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
> wait, it sounds like we could use another answer .., yes ppl like to answer
> things many times here, often with almost identical suggestions, and many
> spins on how to approach the problem, including alternative perspectives on
> life..; the ebb-&-flow of php-general ;)
I've always thought that getting a couple fairly similar answers to the same
question helped to validate the answer for someone who is in the early process
of learning ;)
>
> -nathan
--- End Message ---