[PHP] Re: Php installation

2008-08-30 Thread David Robley
It flance wrote:

 Hi all,
 
 I'm using Fedora 8. I installed php, mysql and apache. Now i can run a
 script connecting to a database from terminal but not from browser.
 
 Any suggestion?

Have you configured apache to process php scripts?

See item 14 at http://php.net/manual/en/install.unix.apache2.php


Cheers
-- 
David Robley

I can't hear you. There's a banana republic in my ear.
Today is Boomtime, the 23rd day of Bureaucracy in the YOLD 3174. 


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



Re: [PHP] Regex for email validation

2008-08-30 Thread Per Jessen
tedd wrote:

 However, it's one thing to have a keyboard designed for a specific
 language and another to be able to enter code-points that aren't
 associated with any specific language (i.e., Dingbats and Math
 Symbols). 

Ah yes, that's true.  How about an APL2 keyboard then? :-)

 For example, note that Rx,com is not associated
 with any language, which is the same as many of
 my other domains, as you can see some here:
 
 http://symboldomains.com/symbol-domains-for-sale.html

Of course, some of those are closely associated with the greek
language/alphabet, but I take your point. 

I think the problem is mostly on the domain owner side though - if you
register a domain for publishing something or other, but most of your
intended audience cannot enter it in an easy, straight-forward way,
you've only shot yourself in the foot, haven't you? 


/Per Jessen, Zürich


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



Re: [PHP] Regex for email validation

2008-08-30 Thread Per Jessen
tedd wrote:

 But as it is now,  it's not so much IF the domain name is easy to
 type in or not, but rather does the Rx.com show up in the URL once
 you get there? And it does for most browsers other than IE.
 
 You can get to the site very easily, try typing:
 
 http://rx-2.com
 
 That wasn't hard, now was it?

What should have happened here, Tedd?  I just got the message you have
the wrong Browser - I'm using Firefox, I thought that was perfectly
capable of using IDNs. 


/Per Jessen, Zürich


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



[PHP] Re: What's with the Rx symbol? (was: Regex for email validation)

2008-08-30 Thread Per Jessen
Yeti wrote:

 That Rx.com domain name is really great stuff, but how do you expect
 the average user to type it in?
 

Completely separate question - I finally managed to get to Tedds site,
where I read this:

The ℞symbol is a truly global icon for Pharmaceuticals. What
Pharmaceutical company would not want to own ℞.com -- if they are
seriously considering Global sales? While languages change throughout
the globe, the ℞ icon remains a constant and highly recognizable symbol
for Pharmaceuticals.

Now, I haven't worked in pharmaceuticals, but I've worked in most
European countries.  So it's probably just me, but I've _never_ come
across the Rx symbol before.  I don't think it's as global as you
think. 


/Per Jessen, Zürich


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



Re: [PHP] Regex for email validation

2008-08-30 Thread Per Jessen
Per Jessen wrote:

 tedd wrote:
 
 But as it is now,  it's not so much IF the domain name is easy to
 type in or not, but rather does the Rx.com show up in the URL once
 you get there? And it does for most browsers other than IE.
 
 You can get to the site very easily, try typing:
 
 http://rx-2.com
 
 That wasn't hard, now was it?
 
 What should have happened here, Tedd?  I just got the message you
 have the wrong Browser - I'm using Firefox, I thought that was
 perfectly capable of using IDNs.

Interesting - I copy-pasted the Rx symbol (from your webpage) into FF
and appended .com - and FF converted the URL symbol to xn--u2g.com. 

I guess FF only works with a limited subset of the many possible special
characters.  



/Per Jessen, Zürich


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



Re: [PHP] ASCII Captcha

2008-08-30 Thread tedd

At 12:05 AM +0100 8/30/08, Stut wrote:

On 29 Aug 2008, at 22:07, tedd wrote:
I hesitated before writing this because I don't want to get into 
another debate with you, but accessibility means that all people 
(disabled or not) can access the data they want in a similar 
fashion.


Why hesitate? If I'm putting you off debating with me then I'm doing 
it wrong so please enlighten me to my faults so I can correct them.


Oh, there's nothing that you're doing wrong -- you're a great debater 
and you're usually right.


I'm just getting tired of having my ass handed to me each time I 
disagree with you -- that's meant in a good way. You know your stuff 
and have excellent communication skills -- that's a hard combination 
to debate against. :-)


But in fairness to both, we're not that far apart on the things we 
debate -- except you usually win. That's the real reason why I 
hesitate, understand?  :-)


Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



[PHP] Javascript mailing list

2008-08-30 Thread Richard Heyes
Hi,

Can anyone recommend a good Javascript related mailing list?

Thanks.

-- 
Richard Heyes

HTML5 Graphing:
http://www.phpguru.org/RGraph

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



Re: [PHP] ASCII Captcha

2008-08-30 Thread Stut

On 30 Aug 2008, at 13:00, tedd wrote:

At 12:05 AM +0100 8/30/08, Stut wrote:

On 29 Aug 2008, at 22:07, tedd wrote:
I hesitated before writing this because I don't want to get into  
another debate with you, but accessibility means that all people  
(disabled or not) can access the data they want in a similar  
fashion.


Why hesitate? If I'm putting you off debating with me then I'm  
doing it wrong so please enlighten me to my faults so I can correct  
them.


Oh, there's nothing that you're doing wrong -- you're a great  
debater and you're usually right.


I'm just getting tired of having my ass handed to me each time I  
disagree with you -- that's meant in a good way. You know your stuff  
and have excellent communication skills -- that's a hard combination  
to debate against. :-)


But in fairness to both, we're not that far apart on the things we  
debate -- except you usually win. That's the real reason why I  
hesitate, understand?  :-)


Wait, am I blushing? :)

Seriously though, don't ever hesitate. It's healthy and fun to  
disagree, the value is in the debate - it's how our knowledge  
continues to evolve regardless of who wins. All opinions are valid  
and valuable, and over the years I've learned that most of mine are  
wrong, it just happens that my success rate in the field of software  
engineering is higher than on other topics. And rest assured I've  
learned just as much from you as I hope you have from me in the past  
few years.


Now, about that recommendation for my linked in profile... ;)

-Stut

--
http://stut.net/

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



Re: [PHP] ASCII Captcha

2008-08-30 Thread tedd

At 11:51 PM +0200 8/29/08, Jochem Maas wrote:

Eric Gorr schreef:
There is no documentation anywhere which claims, as you do, that it 
is impossible to design a captcha which deals with accessibility 
issues.


on behalf of the list, please accept our Crayon of the Week award.


Oh, and please realize we have the sharpest Crayon and dullest Crayon 
of the Week awards, which do you think you've won with your ASCII 
Captcha and performance thus far on this list? That's a  rhetorical 
question -- I don't care what your answer may be.


As I said privately --

As for me, your ASCII art Captcha does nothing to advance the 
use/ease of Captcha's -- the problem remains except you have made it 
even more difficult for people to read without making it harder for 
automated systems to break.


No offense meant, but this were a class I was teaching and you were a 
student, I would give you a C for originality, a D for solving the 
problem at hand, and an F for not doing the required reading.


-- and that gang was what he took offence to off-list AND I 
apologized to him for saying it. But as you can see, he continues.


The problem here Eric is that you've waded into a list that has a lot 
of very smart people on it who give freely of their time and effort 
to help others. Instead of appreciating that fact and taking 
advantage of what we have to offer, you take offense at an honest 
evaluation and then start throwing your weight around as if your 
ASCII art Captcha has given you some measure of credibility. Well, it 
hasn't.


So, continue to rattle on you may, but welcome to my kill file.

Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] Is this a bug?

2008-08-30 Thread Thijs Lensselink
Jochem Maas wrote:
 T Lensselink schreef:
 Catalin Zamfir Alexandru, DATAGRAM SRL wrote:
 Hello guys,

 I've been stalking on the list for some time. Didn't
 have
 anything to report/talk, until now. I have a code like this, maybe
 you guys
 can reproduce it, with output buffering started:

 Echo 'something';

 Echo 'another thing';

 Echo 'something br /'\;

  

 What happens is that ANYTHING that was echo'ed until
 that \,
 will not reach the buffer. Although, this should actually be a Parse
 Error,
 it isn't, it just echoes what was echoed after the god damned \. It
 took me
 two hours to find this typo in the code .


 ouch.
 don't forget you can do:

 $ php - l yourscript.php

 to test for syntax errors (the warning does show up with this).

 additionally a good syntax highlighting editor can help you to spot
 stuff like this ... anything to stop the eyes from bleeding :/



 Can you guys reproduce the error? I can actually
 give you a
 link to the server where this code runs.


   
 The script doesn't cause a parse error Instead it throws a warning.

 'PHP Warning:  Unexpected character in input:  '\' (ASCII=92) state=1
 in'

 Don't think it's a bug. And the reason there's no syntax error is
 because the \ is a PHP
 escape character.

 is this character ever valid as an escape character outside of a string?
 if it is that's news to me and if it isn't then really it is a bug ...
 it should be a straight up parse error ... chances are that it's down
 to limitations in the lexer?

 the output buffer handler that seems to be swallowing the warning every
 second request  now that is weird.
I don't think it should be valid outside a string. But PHP seems to see
this different.
The only reason i could think of. Is that the \ somehow is a registered
symbol. So it throws
a non fatal E_COMPILE_ERROR. Could be a bug. That's for the guys on
internals to decide.
I'd also expect a parse error.

With output buffering enabled i still get the same warning on every request.








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



Re: [PHP] ASCII Captcha

2008-08-30 Thread Stut

On 30 Aug 2008, at 05:32, Robert Cummings wrote:

On Sat, 2008-08-30 at 00:25 -0400, Eric Gorr wrote:

On Aug 30, 2008, at 12:19 AM, Robert Cummings wrote:


On Sat, 2008-08-30 at 00:05 -0400, Eric Gorr wrote:

Oh, here's an interesting story:

http://bits.blogs.nytimes.com/2008/03/13/breaking-google-captchas-for-3-a-day/


This was written by a journalist, not a technology expert. Even the
person to which he was talking needed to clarify the meaning of
crack.

From the article:


  If by cracked, you are saying that a machine can solve the
   captcha as easily as a human being, I’m confident that is
   not the case,

Interestingly the word crack only appears in the article in two
places.
In the above quote and in the following excerpt:

  Another piece of evidence that sheds light on the mystery
  was uncovered by Websense, one of the security firms that
  suggested that spammers are having at least some success
  using bots to crack Google’s captchas.

I really don't see how this story supports your arguments in the  
least
and as such I will not be answering anymore of your drivel. You  
appear

to have nothing of usefulness to add to the conversation.


I didn't think it would take very long for you to begin the fear the
intervention of the moderators. I sure the rest of the list will
appreciate your silence as well. But since I doubt you are telling  
the
truth and have the habit of quoting everything I write back to the  
list:


Please, would all of the other readers of this mailing list write  
to [EMAIL PROTECTED]

and ask them to shut Robert Cummings down? Thank you.


I'm sorry list *lol* But this one made me laugh so hard I had to share
this last one with you. I'm gonna be grinning for days *giggle*.


Thanks Rob, this was my first chuckle of the day.

Eric...

1) Quoting an NYT blog as an authority on technical matters is both  
naive and asking for it. The mainstream press have never used industry- 
specific terminology correctly, and they probably never will. Hacker  
vs. cracker is the best example of this.


2) CAPTCHA's have one single purpose... to prevent automated form  
posting. Any system that uses humans to get past them is not breaking  
the CAPTCHA, or cracking it or any other terminology you decide to use.


3) This list is self-moderating so your pleas to the PHP webmaster,  
list moderator and $DEITY (you'd have gotten to her in the end) are  
pointless beyond their comedic value.


4) Rob is one of the most valuable members of this mailing list ...  
don't take him on, you'll lose!!


Have a great weekend folks!

-Stut

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



[PHP] Function __call

2008-08-30 Thread Diogo Neves
hi all,

I'm sending this email only to ask if someone know if the works of
__call in private methods is bug or feature.

ex.

class user {
public function __call ( $name, $arguments ) {
do something
return call_user_func( array( $this, $name ), $arguments );
}
private function xpto ( $arguments ) {
do something
}
}

new $user = new user();
$user-xpto();

error:
Fatal error:  Call to private method user::xpto() from context '' in
xpto.php on line 11

PS:
what a fucking I was thinking?

well, it don't have this public method, then it sholdn't know it
exists, then go to __call()
i really don't know if it make any sense to someone else, but it still
make sense to me

any thoughts?


 
Thanks by your attention,

Diogo Neves
Developer @ Sapo.pt by PrimeIT.pt

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



Re: [PHP] Javascript mailing list

2008-08-30 Thread Benjamin Hawkes-Lewis

Richard Heyes wrote:

Can anyone recommend a good Javascript related mailing list?


http://lists.evolt.org/mailman/listinfo/javascript perhaps.

--
Benjamin Hawkes-Lewis


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



[PHP] Recommendation

2008-08-30 Thread tedd

Hi gang:

At 1:16 PM +0100 8/30/08, Stut wrote:

Now, about that recommendation for my linked in profile... ;)


That's not a bad idea. Daniel and I did an exchange a while back. I 
think it might help to land clients if we can use our linked-in 
status in some way. I haven't done that yet, but there should be a 
way.


As such, if any of the regulars to this list are in need of a 
recommendation, please contact me off-list.


Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



[PHP] 301 redirect

2008-08-30 Thread Feris
Is it possible to do permanent redirect (301) with php ? If possible...
which is more efficient, by using .htaccess or  php redirect ?

Thanks,

Feris


Re: [PHP] ASCII Captcha

2008-08-30 Thread tedd

At 11:39 PM +0200 8/29/08, Jochem Maas wrote:

tedd schreef:

Do you not agree?


yes and no. in the wild a lion with hip atrophy will be forced to
crawl away and die ... no more eating gazelles for him


I hope I don't get finger atrophy.

---

my point being we have a long long long way to go before we can say
much positive about accessibility for everyone.


Not that you said otherwise, but that doesn't mean we shouldn't do 
what we can when we can. And, we CAN do more currently.


Of course, all change take time and money to implement. But once the 
need and solutions are exposed, the general tendency of people is to 
help. The more known, the more help. These discussions are part of 
that process -- we all walk away better informed and better equipped 
to deal with the problems.


---

I think both tedd and Stut make good points, I guess we'll all be
hacking away at such issues for a long time to come.


That's the nature of the beast (no not Stut!), but rather the 
evolution of our species in all venues. We've been hacking away on 
things for a long time -- did I ever tell you about how we used to 
program with rocks?  :-)


---

in the mean time, here's wishing more clean water and internet access
for everyone (and less bombs).


Amend to that.

It's one thing to have the greatest military force that's ever 
existed, but it's another to use that for every solution. Like the 
engineer with only a hammer, not everything is a nail -- we need to 
look deeper into our toolbox to solve problems.


Don't get me started about political issues.  :-)

Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] 301 redirect

2008-08-30 Thread Stut

On 30 Aug 2008, at 13:42, Feris wrote:
Is it possible to do permanent redirect (301) with php ? If  
possible...

which is more efficient, by using .htaccess or  php redirect ?


If using PHP 4.3 or above...

header('Location: http://website.com/some/page.html', true, 301);

See http://php.net/header for more details.

Anything that happens before PHP gets invoked will be more efficient  
since it doesn't involve invoking PHP, but for most setups the  
difference will be negligible.


-Stut

--
http://stut.net/

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



Re: [PHP] ASCII Captcha

2008-08-30 Thread tedd

At 11:51 PM +0200 8/29/08, Jochem Maas wrote:

so orthogonal to the turing test ... I'd wager that research in
turing test passing technology is moving faster that captcha tech.

so in the long run captcha is plain dead in the water.


I agree with that.

Creating a better captcha is a losing proposition.

The problem has to solved differently.

Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] ASCII Captcha

2008-08-30 Thread tedd

At 12:14 AM +0200 8/30/08, Jochem Maas wrote:

 I have no shame ... I'm dutch.


That's obvious.  :-)

Rhetorical

What we (i.e., USA Government) needs to do is to get you people (yeah 
I said you people) down to New Orleans to teach us how to make a 
dike. Seriously, your countrymen are the world's leading experts on 
hydrology -- I don't understand why we're not seeking your expertise 
as to how to keep the ocean out.


/Rhetorical

Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] ASCII Captcha

2008-08-30 Thread Stut

Oh look, you forgot to include the list again.

On 30 Aug 2008, at 13:54, Eric Gorr wrote:

On Aug 30, 2008, at 8:26 AM, Stut wrote:


Eric...

1) Quoting an NYT blog as an authority on technical matters is both  
naive and asking for it. The mainstream press have never used  
industry-specific terminology correctly, and they probably never  
will. Hacker vs. cracker is the best example of this.


It is entirely legitimate to use words like crack or cracked in  
either a narrow or broad sense. That you would assert they can or  
should only be used in their narrowest sense is, well, ignorant. I  
used the article, not as an authority on technical matters, but only  
to show that there are people out there will to pay others to crack  
captcha's. That you do not recognize this only demonstrates a severe  
lack of intelligence on your part.


Wow, straight in there with the personal insults. Please take a moment  
to consider the possibility that you're wrong. If they're paying  
others to develop software to get past CAPTCHA's then I'd agree with  
you. Using humans to get past a CAPTCHA test is not breaking it, it's  
solving it in the way it was meant to be solved. The fact that it's  
being done for evil purposes doesn't enter into it.


2) CAPTCHA's have one single purpose... to prevent automated form  
posting. Any system that uses humans to get past them is not  
breaking the CAPTCHA, or cracking it or any other terminology you  
decide to use.


Captcha's have one single purpose... to make it that much more  
difficult for an evil doer to spam a site or use it to spam.  Any  
system that uses humans to get past them is breaking the Captcha  
despite your need to limit the use of english words and phrases to  
only their narrowest sense.


You see what you did there? You completely ignored my definition of  
what a CAPTCHA is and went back to your definition. Where's the wiggle  
room? I'll say it one more time... when a human gets past a CAPTCHA  
test they have solved it. When a machine does it they've broken  
it. One word, big difference.


3) This list is self-moderating so your pleas to the PHP webmaster,  
list moderator and $DEITY (you'd have gotten to her in the end) are  
pointless beyond their comedic value.


Then, hopefully the other list members will take it upon themselves  
to request these pointless public posts come to an end. I doubt he  
would listen, but there is always hope.


Hold on to the hope Eric, and don't forget your daily prayer to the  
fairies at the bottom of your garden.


4) Rob is one of the most valuable members of this mailing list ...  
don't take him on, you'll lose!!


That only makes it even more interesting to watch him spam a mailing  
list and attempt to provoke a public flame war on a mailing list  
that he would now falsely claim to care about.


Rob is the last person I would expect to intentionally provoke a flame  
war, in public or in private. If someone disagrees with you it's not  
necessarily because they're trying to pick a fight, it's almost  
certainly because they think differently. Nothing more, nothing less.


This discussion is no longer adding value publicly or privately so  
don't expect another response from me. If you feel you need to use  
this opportunity to have the last word feel free.


-Stut

--
http://stut.net/

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



Re: [PHP] ASCII Captcha

2008-08-30 Thread tedd

At 11:56 PM +0100 8/29/08, Stut wrote:

On 29 Aug 2008, at 22:39, Jochem Maas wrote:

in the mean time, here's wishing more clean water and internet access
for everyone (and less bombs).


Hear hear, except that I'd put food above internet access.

-Stut


Yep, right up there with health care (not advocating government doing it).

Once a society has food/water/shelter and health care, their 
productivity increases exponentially and technology leads.


Cheers,

tedd


--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] Recommendation

2008-08-30 Thread Stut

On 30 Aug 2008, at 13:38, tedd wrote:

At 1:16 PM +0100 8/30/08, Stut wrote:

Now, about that recommendation for my linked in profile... ;)


That's not a bad idea. Daniel and I did an exchange a while back. I  
think it might help to land clients if we can use our linked-in  
status in some way. I haven't done that yet, but there should be a  
way.


People should feel free to connect with me: 
http://www.linkedin.com/in/stuartdallas

-Stut

--
http://stut.net/

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



Re: [PHP] ASCII Captcha

2008-08-30 Thread Jochem Maas

Robert Cummings schreef:

...


   using bots to crack Google’s captchas.

I really don't see how this story supports your arguments in the least
and as such I will not be answering anymore of your drivel. You appear
to have nothing of usefulness to add to the conversation.
I didn't think it would take very long for you to begin the fear the  
intervention of the moderators. I sure the rest of the list will  
appreciate your silence as well. But since I doubt you are telling the  
truth and have the habit of quoting everything I write back to the list:


Please, would all of the other readers of this mailing list write to [EMAIL PROTECTED] 
and ask them to shut Robert Cummings down? Thank you.


1. you can't shut Cummings up, period.
2. you can't shut him down either, he does'nt have an off button.
3. there is no moderator.
4. we welcome Rob's input. (well sometimes I hate it we he's right ... again!)
5. see point 3.



I'm sorry list *lol* But this one made me laugh so hard I had to share
this last one with you. I'm gonna be grinning for days *giggle*.


share the joy :-)



Cheers,
Rob.



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



Re: [PHP] Function __call

2008-08-30 Thread Jochem Maas

Diogo Neves schreef:

hi all,

I'm sending this email only to ask if someone know if the works of
__call in private methods is bug or feature.

ex.

class user {
public function __call ( $name, $arguments ) {
do something
return call_user_func( array( $this, $name ), $arguments );


the fatal error occurs because the method exists, but it's
private ... __call() is only called if the method does not exist
at all:

class user {
public function __call($m, $a) {
if (is_callable(array($this, _.$m)))
return $this-{_.$m}( $a );
}

private function _xpto($a)
{
var_dump($a);   
}
}

$u = new user;
$u-xpto(1, 2, 3);


}
private function xpto ( $arguments ) {
do something
}
}

new $user = new user();


the first 'new' is incorrect me thinks.


$user-xpto();

error:
Fatal error:  Call to private method user::xpto() from context '' in
xpto.php on line 11

PS:
what a fucking I was thinking?

well, it don't have this public method, then it sholdn't know it
exists, then go to __call()
i really don't know if it make any sense to someone else, but it still
make sense to me

any thoughts?


 
Thanks by your attention,

Diogo Neves
Developer @ Sapo.pt by PrimeIT.pt




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



Re: [PHP] Re: With regard to: [PHP] ASCII Captcha

2008-08-30 Thread Jochem Maas

Jim Lucas schreef:

Robert Cummings wrote:

On Sat, 2008-08-30 at 00:01 -0400, Eric Gorr wrote:
No, I will not help you troll. But, I certainly cannot prevent you  
from doing so.


Hopefully the list moderators will shut you down.



This is PHP General. We discuss PHP and related issues. CAPTCHA is
certainly an area of interest to many PHP developers.

Cheers,
Rob.


Rob +1
Eric -1


counting cards will get you in trouble ... sorry just watched 21. :-)






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



Re: [PHP] Function __call

2008-08-30 Thread Diogo Neves
thanks,

well, the 'new' woks the same with ou without '()' after class, I think...

and I now how it works, i only don't understand why... if the method
is not available outside of class it should go to __call function like
if it doesn't exist...
it doesn't make any sense to anyone else?


On Sat, Aug 30, 2008 at 2:38 PM, Jochem Maas [EMAIL PROTECTED] wrote:
 Diogo Neves schreef:

 hi all,

 I'm sending this email only to ask if someone know if the works of
 __call in private methods is bug or feature.

 ex.

 class user {
 public function __call ( $name, $arguments ) {
 do something
 return call_user_func( array( $this, $name ), $arguments );

 the fatal error occurs because the method exists, but it's
 private ... __call() is only called if the method does not exist
 at all:

 class user {
public function __call($m, $a) {
if (is_callable(array($this, _.$m)))
return $this-{_.$m}( $a );
}

private function _xpto($a)
{
var_dump($a);
}
 }

 $u = new user;
 $u-xpto(1, 2, 3);

 }
 private function xpto ( $arguments ) {
 do something
 }
 }

 new $user = new user();

 the first 'new' is incorrect me thinks.

 $user-xpto();

 error:
 Fatal error:  Call to private method user::xpto() from context '' in
 xpto.php on line 11

 PS:
 what a fucking I was thinking?

 well, it don't have this public method, then it sholdn't know it
 exists, then go to __call()
 i really don't know if it make any sense to someone else, but it still
 make sense to me

 any thoughts?


  
 Thanks by your attention,

 Diogo Neves
 Developer @ Sapo.pt by PrimeIT.pt




 
Thanks by your attention,

Diogo Neves
Developer @ Sapo.pt by PrimeIT.pt

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



Re: [PHP] ASCII Captcha

2008-08-30 Thread Stut

On 30 Aug 2008, at 14:05, tedd wrote:

At 11:39 PM +0200 8/29/08, Jochem Maas wrote:

I think both tedd and Stut make good points, I guess we'll all be
hacking away at such issues for a long time to come.


That's the nature of the beast (no not Stut!)


I am Stut - hear me Roar!!

CAPTCHA's are not a magic bullet, and I'm definitely of the opinion no  
such bullet exists. Each problem is different and we need to think  
about them differently. We all know there has to be a better way, and  
I think we all agree that if possible we wouldn't be using them at  
all. However, while we must recognise that each site we create will  
present different opportunities for validating UGC without needing to  
fall back to CAPTCHA's we must also recognise that CAPTCHA's work to  
a certain extent and should not be avoided simply because they're not  
perfect.


I can't remember who said it and I apologise for that, but someone  
mentioned that the person who comes up with a better replacement for  
CAPTCHA's will make billions. Unfortunately this is not true. Any idea  
that has the potential to change the way the world works or plays will  
not reach that potential if it comes with prohibitive licenses or  
royalty fees attached. If it works make it free or adoption will be  
severely restricted which makes it essentially worthless.


That's all I've got to say about that.

-Stut

--
http://stut.net/

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



Re: [PHP] ASCII Captcha

2008-08-30 Thread tedd

At 12:05 AM +0100 8/30/08, Stut wrote:

On 29 Aug 2008, at 22:07, tedd wrote:

Do you not agree?


Sort of. I think most disabled people accept that they are different 
and that special provisions sometimes need to be made. In this case 
I would hope people would understand that the current technology we 
have for verifying that users of a website are people do not allow 
us to cover every possible case and that we do try to make things as 
accessible as possible.


I am sure many disabled do understand, partly because they have no 
choice. When confronted with barriers that cannot be moved, then you 
look at the problem a little differently (a personal observation).


The problem I see with the net is that much of the technology that 
can make their life better is either being ignored or passed off as 
sorry about that.


For example, all the clients who I have worked give lip-service to 
disability issues but at every point when they have to make a 
decision re accessibility or what they want -- they get what they 
want. It can be something very simple thing like color contrast, but 
if the client doesn't want a shade darker to comply, then 
accessibility loses.


I don't meant to sound negative, but it sure feels like an uphill 
battle. It's almost comical when I see web sites who claim care and 
compassion for the disabled, but then refuse to make accessibility 
changes when they are pointed out to them -- this includes local, 
state and the federal government.


To me accessibility means that everyone is able to use something to 
achieve a goal regardless of their physical or mental condition. 
Nothing about it says that everyone should be able to reach that 
goal without assistance and that said assistance should be readily 
available and easy to request.


Yes, I agree with that too -- but what I was commenting about was the 
Call us if you're disabled comment as being the ultimate in 
accessibility because that's far from it.


Too many sites simply say If you have problems, call us and that's 
their total effort to improve conditions for the disabled AND they 
think they did their part -- but the truth is they haven't.


But I'll be the first to say that I don't know enough about this 
subject, or enough differently abled people to know how they view 
the world. What I can say is that one persons definition of 
accessibility is not necessarily the same as anyone else's.


That's true. But it's not that hard to put yourself in the other's 
shoes and see what problems they face AND how easy it is to mitigate 
some of those problems. The simple use of the alt attribute comes to 
mind -- this is something that everyone can take the time to fill 
out, but few do.


Clearly there are many things to consider, but I claim that as one 
becomes aware of the problem, it becomes easier to comply.


Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] ASCII Captcha

2008-08-30 Thread tedd

At 12:32 AM -0400 8/30/08, Robert Cummings wrote:

On Sat, 2008-08-30 at 00:25 -0400, Eric Gorr wrote:

  Please, would all of the other readers of this mailing list write 
to [EMAIL PROTECTED]

 and ask them to shut Robert Cummings down? Thank you.


I'm sorry list *lol* But this one made me laugh so hard I had to share
this last one with you. I'm gonna be grinning for days *giggle*.

Cheers,
Rob.


Rob:

I've been saying that for years. :-)

But fortunately smarter minds prevailed.

Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] ASCII Captcha

2008-08-30 Thread tedd

At 3:27 PM +0200 8/30/08, Jochem Maas wrote:


2. you can't shut him down either, he does'nt have an off button.


Yeah, he's a lot like his blow-up dolls except you can't deflate him.  :-)

Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] ASCII Captcha

2008-08-30 Thread Stut

On 30 Aug 2008, at 15:02, tedd wrote:

At 12:05 AM +0100 8/30/08, Stut wrote:
To me accessibility means that everyone is able to use something to  
achieve a goal regardless of their physical or mental condition.  
Nothing about it says that everyone should be able to reach that  
goal without assistance and that said assistance should be readily  
available and easy to request.


Yes, I agree with that too -- but what I was commenting about was  
the Call us if you're disabled comment as being the ultimate in  
accessibility because that's far from it.


Too many sites simply say If you have problems, call us and that's  
their total effort to improve conditions for the disabled AND they  
think they did their part -- but the truth is they haven't.


There's a big difference in my mind between If you have problems  
getting past this CAPTCHA please call us and If you have problems,  
call us. I had assumed, perhaps incorrectly, that in the first  
instance the phone call would result in the user being able to get  
past the CAPTCHA. In this instance special steps need to be taken to  
technically enable a phone conversation to get a user past the CAPTCHA.


In more general terms we are in complete agreement. Websites should do  
everything they can to make their sites as accessible as possible. I  
can count on one hand the number of companies I've worked with who  
took colour blindness into consideration when (re)designing their site.


What I find particularly daft is that when you look at requirements  
for accessibility most of them are the same as requirements for good  
SEO, so I don't understand why more sites don't have alt tags  
everywhere, and text-only optimisation.


CAPTCHA's are a special case due to the problem it's trying to solve.  
The very things they're trying to prevent are enabled by making them  
accessible. I'm sure in time progress will be made in this area but in  
the meantime I stand by my assertion that a 'phone number people can  
call with any type of telephone to interact with another human who can  
get them past the check without compromising the protection the check  
affords is ultimate accessibility.


-Stut

--
http://stut.net//

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



[PHP] Re: What's with the Rx symbol?

2008-08-30 Thread tedd

At 1:30 PM +0200 8/30/08, Per Jessen wrote:

 I finally managed to get to Tedds site


It's not that hard, try: http://rx-2.com

And you said:


Now, I haven't worked in pharmaceuticals, but I've worked in most
European countries.  So it's probably just me, but I've _never_ come
across the Rx symbol before.  I don't think it's as global as you
think.


Okay, please permit me some literary license -- after all, this is my 
retirement plan.  :-)


My source for my claim is simply and directly taken from Unicode -- 
that's THE authority on global glyphs.


I am also positive that every Pharmaceutical company in the world 
recognizes that symbol.


Now, does everyone in the world recognize the symbol -- I don't know. 
But I do know that IF there is a global Pharmaceutical symbol, then 
it would be listed in the Unicode database and this is the only 
symbol that's there.


What do you think about the yin-yang symbol?

http://xn--w4h.com

I think one billion Chinese know that one. I just hope that I don't 
have to wait until one billion Chinese have PC's to find a buyer.  :-)


Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



[PHP] Re: What's with the Rx symbol?

2008-08-30 Thread tedd

At 1:20 PM +0200 8/30/08, Per Jessen wrote:

I think the problem is mostly on the domain owner side though - if you
register a domain for publishing something or other, but most of your
intended audience cannot enter it in an easy, straight-forward way,
you've only shot yourself in the foot, haven't you?


That's true, but what are the alternatives?

If you want a single character domain name: 1) you can't get one; 2) 
if and when they do become available the cost is going to be 
prohibitive for most -- see this:


http://www.cbsnews.com/stories/2005/11/28/tech/main1080245.shtml

At present (until keyboard technology gets MUCH better) all I am 
offering is simply a change in what appears in the URL box of the 
browser window IF the browser is capable of showing Unicode 
code-points -- IE's aren't.


Granted, that's not much -- but I've seen fortunes made on from less.

This is just one of my many screwy nit-wit ideas -- and sometimes they pay off.

I wish I could have kept some of the money I pissed away in my 
younger years. But I spent it on liquor, good times, parties, and 
like a damned fool I squandered the rest.


Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



[PHP] Re: What's with the Rx symbol?

2008-08-30 Thread tedd

At 1:23 PM +0200 8/30/08, Per Jessen wrote:

tedd wrote:


 But as it is now,  it's not so much IF the domain name is easy to
 type in or not, but rather does the Rx.com show up in the URL once
 you get there? And it does for most browsers other than IE.

 You can get to the site very easily, try typing:

 http://rx-2.com

 That wasn't hard, now was it?


What should have happened here, Tedd?  I just got the message you have
the wrong Browser - I'm using Firefox, I thought that was perfectly
capable of using IDNs.

/Per Jessen, Zürich


Unfortunately and surprisingly (at least to me), 
FireFox does not allow Unicode code-points to 
appear in the URL -- it uses PUNYCODE instead. So 
you were directed to get a different browser.


Try Safari on either Mac or Windozes or Opera.

Those will get you to the site without a redirect.

If this had been an easier problem, then I'm sure 
I could have sold my names by now.


Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] Re: What's with the Rx symbol?

2008-08-30 Thread Per Jessen
tedd wrote:

 At 1:30 PM +0200 8/30/08, Per Jessen wrote:
  I finally managed to get to Tedds site
 
 It's not that hard, try: http://rx-2.com
 

Yeah, but that _only_ takes me to rx-2.com, nothing else? 

 And you said:
 
Now, I haven't worked in pharmaceuticals, but I've worked in most
European countries.  So it's probably just me, but I've _never_ come
across the Rx symbol before.  I don't think it's as global as you
think.
 
 Okay, please permit me some literary license -- after all, this is my
 retirement plan.  :-)
 
 My source for my claim is simply and directly taken from Unicode --
 that's THE authority on global glyphs.

Well, I guess - sort of.  Just because something is Unicode does not
make it global, in my opinion.
In fact, I would argue that most of Unicode is _not_ global at all. 
Think about the alphabets such as: Arabic, Armenian, Bengali, Bopomofo,
Cyrillic, Devanagari, Georgian, Greek and Coptic, Gujarati, Gurmukhi,
Hangul, Hebrew, Hiragana, Kannada, Katakana, Lao, Latin, Malayalam,
Oriya, Tamil, Telugu, Thai, and Tibetan - and they were all in the
first version of Unicode.  (I'm quoting from wikipedia).

 What do you think about the yin-yang symbol?
 http://xn--w4h.com

That one is probably several orders of magnitude more global than the
Rx, but typing them remains a problem for both :-)

I was actualy very surprised to see that such arbitrary symbols have
been opened for use with e.g. .com.  The national registrars around
Europe have quite a limited set of special chars that can be used -
AFAIK none of them include the special symbols that you've registered. 

Good luck with your retirement plan :-)


/Per Jessen, Zürich


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



[PHP] Re: What's with the Rx symbol?

2008-08-30 Thread tedd

At 1:38 PM +0200 8/30/08, Per Jessen wrote:

Interesting - I copy-pasted the Rx symbol (from your webpage) into FF
and appended .com - and FF converted the URL symbol to xn--u2g.com.

I guess FF only works with a limited subset of the many possible special
characters.


What is happening there is FF and other browsers are afraid of 
homographic attacks.


A homographic attack is simply where the URL in the browser *looks* 
like another, but is not.


For example, early on in this How do we solve the 7-bit problem? 
with the net, it was brought up that there are many code points in 
the Unicode database that look exactly the same as others.


One individual (I can't remember his name at the moment) took the 
liberty of registering a domain name (i.e., PayPal.com) that use an 
a from different charset than English.


While there was no intent to defraud anyone, PayPal wasn't amused and 
legislation followed -- the specifics of which I have no information.


But the entire process demonstrated that evil-doers could register 
domains that look like other domains and thus fool people.


What some browser developers did was to NOT make the conversion from 
PUNYCODE to the correct code-points but rather show the PUNYCODE 
as-is, which was never the intent of the IDNS WG. This act defeated 
the entire process of allowing non-English people to have non-English 
domain names. This like throwing the baby out with the bath water.


I claim that the process can be solved differently and more 
effectively. All browser developers have to do is to evaluate the 
PUNYCODE string and if it's made up from a collection of different 
charsets, then just color it.


I think making the URL RED would be a better warning than showing 
PUNYCODE -- but that's my opinion.


Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] Function __call

2008-08-30 Thread Jochem Maas

Diogo Neves schreef:

thanks,

well, the 'new' woks the same with ou without '()' after class, I think...


you think? I gave you code that shows exactly that.
but you wrote the following:

new $user = new user();

which is not correct, the first new in that line is a syntax error.
that means you didn't cut and paste the exact code you were using,
which is bad practice.


and I now how it works, i only don't understand why... if the method
is not available outside of class it should go to __call function like
if it doesn't exist...


this is not how it works. 'method is not available' does not mean 'method
does not exist', __call is executed when a method does not exist.


it doesn't make any sense to anyone else?



it makes sense that you think it should work the way you describe,
but it doesn't. it's not a bug it's by design.

also your example is rather silly. you make a method private
then you want to expose the very same method publically via __call(),
quite simply the method should be public in that example.



On Sat, Aug 30, 2008 at 2:38 PM, Jochem Maas [EMAIL PROTECTED] wrote:

Diogo Neves schreef:

hi all,

I'm sending this email only to ask if someone know if the works of
__call in private methods is bug or feature.

ex.

class user {
public function __call ( $name, $arguments ) {
do something
return call_user_func( array( $this, $name ), $arguments );

the fatal error occurs because the method exists, but it's
private ... __call() is only called if the method does not exist
at all:

class user {
   public function __call($m, $a) {
   if (is_callable(array($this, _.$m)))
   return $this-{_.$m}( $a );
   }

   private function _xpto($a)
   {
   var_dump($a);
   }
}

$u = new user;
$u-xpto(1, 2, 3);


}
private function xpto ( $arguments ) {
do something
}
}

new $user = new user();

the first 'new' is incorrect me thinks.


$user-xpto();

error:
Fatal error:  Call to private method user::xpto() from context '' in
xpto.php on line 11

PS:
what a fucking I was thinking?

well, it don't have this public method, then it sholdn't know it
exists, then go to __call()
i really don't know if it make any sense to someone else, but it still
make sense to me

any thoughts?


 
Thanks by your attention,

Diogo Neves
Developer @ Sapo.pt by PrimeIT.pt





 
Thanks by your attention,

Diogo Neves
Developer @ Sapo.pt by PrimeIT.pt




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



Re: [PHP] Re: What's with the Rx symbol?

2008-08-30 Thread tedd

At 5:29 PM +0200 8/30/08, Per Jessen wrote:

Well, I guess - sort of.  Just because something is Unicode does not
make it global, in my opinion.
In fact, I would argue that most of Unicode is _not_ global at all.
Think about the alphabets such as: Arabic, Armenian, Bengali, Bopomofo,
Cyrillic, Devanagari, Georgian, Greek and Coptic, Gujarati, Gurmukhi,
Hangul, Hebrew, Hiragana, Kannada, Katakana, Lao, Latin, Malayalam,
Oriya, Tamil, Telugu, Thai, and Tibetan - and they were all in the
first version of Unicode.  (I'm quoting from wikipedia).


Why does those languages appearing in Unicode NOT make Unicode 
global? Maybe we have a difference in they way we perceive Global.


Unicode is setup to contain ALL the languages in the world, not replace them.

This has come about from an exhaustive (and still continuing) 
analysis of every glyph known to mankind. It is an Herculean effort 
to categorize all languages and dialects known to man -- that's the 
purpose here.


So, if you find a code-point in the Unicode dB, then it's a good 
chance that it's an honest character found in some language or 
charset somewhere.


You also said:


I was actualy very surprised to see that such arbitrary symbols have
been opened for use with e.g. .com.  The national registrars around
Europe have quite a limited set of special chars that can be used -
AFAIK none of them include the special symbols that you've registered.


There's nothing arbitrary about these symbols -- they are symbols. 
Symbols have meanings too.


The DOT COM TLD registrar simply made the decision to allow symbols 
to be registered while other TDL registrars have different rules -- 
some do, some don't.


I'm not sure that I had anything to do with their (IDSN WG) decision 
process, but I was certainly there to support my vested interest. 
Many times I felt that I was going to lose my names. In fact, I was 
only allowed to register my names ($100 a pop) on the basis that a 
test period would ensue and if they did not find any problems, then I 
could keep them -- however, if they did find any problems, then I 
would lose them without refund. Fortunately, no one protested and I 
still have my names.


Are they worth anything? I dunno, but I'm betting that they will be 
someday -- hopefully in my lifetime.


To bring this thread back to php, that's what the mb_ functions are 
about, namely dealing with Unicode strings. The combination of 
Unicode and the mb_ functions provides us with the ability to be able 
to communicate in every language in the world. That's not a small 
accomplishment.


Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] Bug in array_key_exist?

2008-08-30 Thread Jochem Maas

Korgan schreef:

Korgan napsal(a):

Jim Lucas napsal(a):

Korgan wrote:

Hi,
I have a problem with array_key_exists in if statement.

I have a class with this function

class XXX {
private items = array();
...
...
...

public function addXXX($id, $count)
{
   $count = (int)$cout;


 Let me point at it 

Check your spelling

If error_reporting was set to E_ALL AND display_errors were turned 
on, you would see that you are using an undefined variable in your 
method called $cout, casting is as an int and assigning the resulting 
value (which would always be zero) to $count.


Sorry i didnt see it :). In the script is $count = (int)$count;



no point in anyone trying to help you then, because you don't post the code
you use, you post something else instead ... this is not [EMAIL PROTECTED]

btw there is practically no chance of a bug being in array_key_exists() and
you being the first to spot it, as a function it's used way too much to be
able to fly under the bug radar. jmho.



After add a item value is ok look at first B vardump which is on the end 
of the script.




No variable $count is mandatory so that is defined.
But its not main idea of my question...
Function add items correctly, but if go to next page, values in array 
change. Values are changed passing from one page to another one, why 
and where?



if (!array_key_exists($id, $this-items))
   $this-items[$id] = $count;
else
   $this-items[$id] += $count;
}

...
...

}

And I want to send instance of this class with SESSION.
If I add a item to the array, count is ok, but if i go to the next 
page count will change.



There is the code of index.php

 /** its loading classes ***/
 spl_autoload_register('loadClass');

 session_start();
 var_dump($_SESSION['XX']); /** A **/

 
 ...
 ...
 ...
 if ($_SESSION['XX'] instanceof XXX)
$x = $_SESSION['XX'];
  else
new...
  ..
  ..
  /** Do onzl this **/
  if 
$x-addXXX($id, $cnt);


  
  ...
  ...
  $_SESSION['XX'] = X;
  var_dump($_SESSION['XX']); /** B **/


There is a vardump if action addXXX exec:
   A:
object(Kosik)#1 (1) { [zbozi:private]=  array(0) { } }

   B:
object(Kosik)#1 (1) { [zbozi:private]=  array(1) { [1]=  
int(1) } }


And than i will go to some page and vardums are:
   A:
object(Kosik)#1 (1) { [zbozi:private]=  array(1) { [1]=  
int(4) } } 1 : 4


   B:
 object(Kosik)#1 (1) { [zbozi:private]=  array(1) { [1]=  
int(4) } }


I am thinking that do both codes in if statement,
but $this-items[$id] += $count; exec after send page.



I am using PHP Version 5.2.6 and Smarty v.2.6.19

Thanks for help :)









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



Re: [PHP] ASCII Captcha

2008-08-30 Thread tedd

At 3:25 PM +0100 8/30/08, Stut wrote:
in the meantime I stand by my assertion that a 'phone number people 
can call with any type of telephone to interact with another human 
who can get them past the check without compromising the protection 
the check affords is ultimate accessibility.


Well, even you can't be right all of the time.  :-)

That's not bad out of all we discussed to have only one difference of opinion.

Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] Function __call

2008-08-30 Thread Jochem Maas

please keep replies on list unless your intending to pay me
an hourly fee ...

Diogo Neves schreef:

On Sat, Aug 30, 2008 at 4:40 PM, Jochem Maas [EMAIL PROTECTED] wrote:

Diogo Neves schreef:


...



nop... I wanna manipulate the $this and the $arguments, and possible
don't even execute the private method...

I'm tring to develop a hook system for my classes... and i simple
don't wanna to do all the hook verification every method of the class

I'll send my files for you to see what I'm doing in do something on
my __call() funtion


the code looks messy what with the global $hooks, functions required for hooking
(the function name class_hooker() is very funny btw) and you seem to
be mixing static/non-static class calls willy-nilly.

I'd rethink this if I we're you. if every can be hooked, then make the
hooking should be part of a base class, possibly a factory method for object
creation will help to keep things clean and in one place. a generic 'hooking'
decorator object might also be an idea. or maybe just using subclasses to
change/augment behaviour is a much simpler and cleaner approach.

your code makes me think of the hooking mechanism in WordPress ... works okay,
but it's a nightmare to code to (imho).

BTW. function and method names beginning with '__' are considered reserved
by the engine, it's not best practice to name userland functions/methods
things like '__magic'


On Sat, Aug 30, 2008 at 2:38 PM, Jochem Maas [EMAIL PROTECTED] wrote:

Diogo Neves schreef:

hi all,

I'm sending this email only to ask if someone know if the works of
__call in private methods is bug or feature.

ex.

class user {
public function __call ( $name, $arguments ) {
do something
return call_user_func( array( $this, $name ), $arguments );

the fatal error occurs because the method exists, but it's
private ... __call() is only called if the method does not exist
at all:

class user {
  public function __call($m, $a) {
  if (is_callable(array($this, _.$m)))
  return $this-{_.$m}( $a );
  }

  private function _xpto($a)
  {
  var_dump($a);
  }
}

$u = new user;
$u-xpto(1, 2, 3);


}
private function xpto ( $arguments ) {
do something
}
}

new $user = new user();

the first 'new' is incorrect me thinks.


$user-xpto();

error:
Fatal error:  Call to private method user::xpto() from context '' in
xpto.php on line 11

PS:
what a fucking I was thinking?

well, it don't have this public method, then it sholdn't know it
exists, then go to __call()
i really don't know if it make any sense to someone else, but it still
make sense to me

any thoughts?


 
Thanks by your attention,

Diogo Neves
Developer @ Sapo.pt by PrimeIT.pt


 
Thanks by your attention,

Diogo Neves
Developer @ Sapo.pt by PrimeIT.pt








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



Re: [PHP] ASCII Captcha

2008-08-30 Thread Jochem Maas

tedd schreef:

At 3:25 PM +0100 8/30/08, Stut wrote:
in the meantime I stand by my assertion that a 'phone number people 
can call with any type of telephone to interact with another human who 
can get them past the check without compromising the protection the 
check affords is ultimate accessibility.


Well, even you can't be right all of the time.  :-)

That's not bad out of all we discussed to have only one difference of 
opinion.


obviously Cummings' brainwashing program is not 100% effective ;-)



Cheers,

tedd




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



[PHP] Individual bulk e-mails - performance question

2008-08-30 Thread Merlin

Hi everybody,

I am running a travel community where users want to get informed on 
changes inside different groups they have subscribed to.


At the moment I am doing this with a for loop that generates an 
individual e-mail sent to them via phpmailer. That works, however the 
submit of the content upload form (that triggers the e-mail 
notification) now takes several seconds, as more and more users subscribe.


I am thinking about placing the info on the individual e-mail inside a 
ascii txt file that will be read by a cron job which will send the 
e-mail instead. Something like every 5 minutes reading it line by line 
and then after sending it removing the line.

e.g:
for:[EMAIL PROTECTED]; body:individual
for:[EMAIL PROTECTED]; body:other email

Does this sound like a plan? Or do you believe that there are better 
ways doing it? I could imagine that I would run into problems a few 
months from now if for example the cron job will be triggered a second 
time, while the first one has not finished.


Any ideas or suggestions? Thank you for any help.

Best regards,

Merlin

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



Re: [PHP] Recommendation

2008-08-30 Thread Richard Heyes
 As such, if any of the regulars to this list are in need of a
 recommendation, please contact me off-list.

Thank you very much! :-)

http://www.linkedin.com/in/heyesr

-- 
Richard Heyes

HTML5 Graphing:
http://www.phpguru.org/RGraph

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



Re: [PHP] Function __call

2008-08-30 Thread Diogo Neves
Hi,

On Sat, Aug 30, 2008 at 6:20 PM, Jochem Maas [EMAIL PROTECTED] wrote:
 please keep replies on list unless your intending to pay me
 an hourly fee ...

Yeap, i'm new in the list and i missed te cc of list... i'll try to
remember, sorry


 Diogo Neves schreef:

Now in understand schreef is from da system...


 On Sat, Aug 30, 2008 at 4:40 PM, Jochem Maas [EMAIL PROTECTED] wrote:

 Diogo Neves schreef:

 ...


 nop... I wanna manipulate the $this and the $arguments, and possible
 don't even execute the private method...

 I'm tring to develop a hook system for my classes... and i simple
 don't wanna to do all the hook verification every method of the class

 I'll send my files for you to see what I'm doing in do something on
 my __call() funtion

 the code looks messy what with the global $hooks, functions required for
 hooking

Yeap, but i'm only making tests... i'm not too horried about mess yet...

 (the function name class_hooker() is very funny btw)

ok... i missed that in my english... added :)

 and you seem to
 be mixing static/non-static class calls willy-nilly.


I'm never calling something static, i'm?

 I'd rethink this if I we're you. if every can be hooked, then make the
 hooking should be part of a base class, possibly a factory method for object
 creation will help to keep things clean and in one place. a generic
 'hooking'
 decorator object might also be an idea. or maybe just using subclasses to
 change/augment behaviour is a much simpler and cleaner approach.

yep... i'm thinking of a base class, but that has nothing to do with
the __call, if u see, i'm already passing the get_class( $this ) and
not __CLASS__ on call_user_func of the user, but again only testing


 your code makes me think of the hooking mechanism in WordPress ... works
 okay,
 but it's a nightmare to code to (imho).

right again, i'm trying to do a wapper for phpbb class's that have a
similar hook system, but needs to be defined method by method,
function by function... like a big mess... and even like that i don't
get yet the criteria to have a hook or not :)


 BTW. function and method names beginning with '__' are considered reserved
 by the engine, it's not best practice to name userland functions/methods
 things like '__magic'


Yeap, in this case is my naming that is really pretty bad, but i
needed something diferent from the normal hookable methods, then I
simple added a '_'... but again tests, naming and code organization
was not a horry, only logic...


But again, i don't see why your php should see your class's private
methods outside of itself, it should simple look for a public one, if
it exists then call it, otherwise call the _call and let it handle it
:S


Anyway, thanks for answer me and give me that points, and if u know a
really good hoking system, please give me reference ;)


And please anyone else has an opinion of it should work or not?
Thanks

-- 
Thanks by your attention,

Diogo Neves
Web Developer @ SAPO.pt by PrimeIT.pt

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



Re: [PHP] Re: What's with the Rx symbol?

2008-08-30 Thread Andrew Ballard
On Sat, Aug 30, 2008 at 11:38 AM, tedd [EMAIL PROTECTED] wrote:
 At 1:38 PM +0200 8/30/08, Per Jessen wrote:

 Interesting - I copy-pasted the Rx symbol (from your webpage) into FF
 and appended .com - and FF converted the URL symbol to xn--u2g.com.

 I guess FF only works with a limited subset of the many possible special
 characters.

 What is happening there is FF and other browsers are afraid of homographic
 attacks.

 A homographic attack is simply where the URL in the browser *looks* like
 another, but is not.

 For example, early on in this How do we solve the 7-bit problem? with the
 net, it was brought up that there are many code points in the Unicode
 database that look exactly the same as others.

 One individual (I can't remember his name at the moment) took the liberty of
 registering a domain name (i.e., PayPal.com) that use an a from different
 charset than English.

 While there was no intent to defraud anyone, PayPal wasn't amused and
 legislation followed -- the specifics of which I have no information.

 But the entire process demonstrated that evil-doers could register domains
 that look like other domains and thus fool people.

 What some browser developers did was to NOT make the conversion from
 PUNYCODE to the correct code-points but rather show the PUNYCODE as-is,
 which was never the intent of the IDNS WG. This act defeated the entire
 process of allowing non-English people to have non-English domain names.
 This like throwing the baby out with the bath water.

 I claim that the process can be solved differently and more effectively. All
 browser developers have to do is to evaluate the PUNYCODE string and if it's
 made up from a collection of different charsets, then just color it.

 I think making the URL RED would be a better warning than showing PUNYCODE
 -- but that's my opinion.

 Cheers,

 tedd

Wait a minute - you're going to rail on for ever on another thread
about web in-accessibility with CAPTCHA and then you're going to
propose something that relies on color coding for something that
important? What about all those with red/green color blindness?

Andrew

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



Re: [PHP] Function __call

2008-08-30 Thread Jochem Maas

Diogo Neves schreef:

Hi,

On Sat, Aug 30, 2008 at 6:20 PM, Jochem Maas [EMAIL PROTECTED] wrote:

please keep replies on list unless your intending to pay me
an hourly fee ...


Yeap, i'm new in the list and i missed te cc of list... i'll try to
remember, sorry


okay.


Diogo Neves schreef:


Now in understand schreef is from da system...


no my email client in in dutch ... it means 'wrote' ... actually that's
in the list archives already :-)


On Sat, Aug 30, 2008 at 4:40 PM, Jochem Maas [EMAIL PROTECTED] wrote:

Diogo Neves schreef:

...


nop... I wanna manipulate the $this and the $arguments, and possible
don't even execute the private method...

I'm tring to develop a hook system for my classes... and i simple
don't wanna to do all the hook verification every method of the class

I'll send my files for you to see what I'm doing in do something on
my __call() funtion

the code looks messy what with the global $hooks, functions required for
hooking


Yeap, but i'm only making tests... i'm not too horried about mess yet...


(the function name class_hooker() is very funny btw)


ok... i missed that in my english... added :)


and you seem to
be mixing static/non-static class calls willy-nilly.



I'm never calling something static, i'm?


er, no ... but I had to re-read the code a few times.




I'd rethink this if I we're you. if every can be hooked, then make the
hooking should be part of a base class, possibly a factory method for object
creation will help to keep things clean and in one place. a generic
'hooking'
decorator object might also be an idea. or maybe just using subclasses to
change/augment behaviour is a much simpler and cleaner approach.


yep... i'm thinking of a base class, but that has nothing to do with
the __call, if u see, i'm already passing the get_class( $this ) and
not __CLASS__ on call_user_func of the user, but again only testing


your code makes me think of the hooking mechanism in WordPress ... works
okay,
but it's a nightmare to code to (imho).


right again, i'm trying to do a wapper for phpbb class's that have a
similar hook system, but needs to be defined method by method,
function by function... like a big mess... and even like that i don't
get yet the criteria to have a hook or not :)


as you are finding out, creating an elegant solution to this problem
is not as easy as it may seem ... especially if you stuck with
integrating to a 3rd party application.




BTW. function and method names beginning with '__' are considered reserved
by the engine, it's not best practice to name userland functions/methods
things like '__magic'



Yeap, in this case is my naming that is really pretty bad, but i
needed something diferent from the normal hookable methods, then I
simple added a '_'... but again tests, naming and code organization
was not a horry, only logic...


the single prefixed underscore to private method names will probably
be the easiest implementation ... note that passing every method call
via __call() is a rather large performance hit.



But again, i don't see why your php should see your class's private
methods outside of itself, it should simple look for a public one, if
it exists then call it, otherwise call the _call and let it handle it
:S


Anyway, thanks for answer me and give me that points, and if u know a
really good hoking system, please give me reference ;)



I guess AdultFriendFinder is not the right answer :-P



And please anyone else has an opinion of it should work or not?


again, NO it should NOT. it was not designed that way.

search the archives of [EMAIL PROTECTED] for a possible answer as
to why, and you might considering asking that list why it doesn't work
the way you think it should ... note that I doubt very much it will change
because such a change would incur major BC breakage.


Thanks




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



Re: [PHP] Re: What's with the Rx symbol?

2008-08-30 Thread Diogo Neves
Your reply is a bit off-topic, and i agree u should care about all
those with red/green color blindness, but u should care with all those
how dislike spam too.
Then, unless u know a really good alternative to a CAPTCHA, i believe
its yet the better solution...

PS: u can answer and discuse this on the original thread too ;)

-- 
Thanks by your attention,

Diogo Neves
Web Developer @ SAPO.pt by PrimeIT.pt

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



Re: [PHP] Re: What's with the Rx symbol?

2008-08-30 Thread Andrew Ballard
On Sat, Aug 30, 2008 at 2:34 PM, Diogo Neves [EMAIL PROTECTED] wrote:
 Your reply is a bit off-topic, and i agree u should care about all
 those with red/green color blindness, but u should care with all those
 how dislike spam too.
 Then, unless u know a really good alternative to a CAPTCHA, i believe
 its yet the better solution...

 PS: u can answer and discuse this on the original thread too ;)

 --
 Thanks by your attention,

 Diogo Neves
 Web Developer @ SAPO.pt by PrimeIT.pt


Wait a minute. I wasn't trying to jump into the CAPTCHA debate. That
is another thread entirely, and I agree that any further discussion
should be kept in that thread.

I was only contrasting tedd's current suggestion regarding how
browsers could handle his Unicode domain names where he suggested
color-coding the URL in the address bar against his earlier (well
thought out and presented) concerns about maintaining accessibility.

In this case, I'm not even saying that tedd's basic concept --
altering the appearance to indicate a Unicode URL that could otherwise
be confused with something similar -- is flawed. I'm just agreeing
that the as identified by the browser vendors is valid. Combine that
with the steps they've already taken to add icons and color code URLs
for easy confirmation of a site's identity when using SSL, and it
becomes more complicated -- especially when each has to compliment the
others to prevent confusion while still remaining accessible. In that
sense, they have already taken his idea and done something much
simpler: they've simplified the character set. No additional colors,
no extra icons to have to decipher, etc.

Andrew

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



Re: [PHP] Re: What's with the Rx symbol?

2008-08-30 Thread Diogo Neves
Well, i really really believe that urls should keep clear as water...

http://forcaaerea.pt should exist, and not http://forçaaérea.pt...
even because in reality its http://xn--foraarea-u0aw.pt

Its a big mess...

How to keep it clear? don't mess up with your domains if you care
about your clients

-- 
Thanks by your attention,

Diogo Neves
Web Developer @ SAPO.pt by PrimeIT.pt

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



Re: [PHP] Individual bulk e-mails - performance question

2008-08-30 Thread Per Jessen
Merlin wrote:

 I am thinking about placing the info on the individual e-mail inside a
 ascii txt file that will be read by a cron job which will send the
 e-mail instead. Something like every 5 minutes reading it line by line
 and then after sending it removing the line.
 e.g:
 for:[EMAIL PROTECTED]; body:individual
 for:[EMAIL PROTECTED]; body:other email
 
 Does this sound like a plan? Or do you believe that there are better
 ways doing it? 

Sounds pretty good to me.

 I could imagine that I would run into problems a few 
 months from now if for example the cron job will be triggered a second
 time, while the first one has not finished.

That's easily taken care of.  Instead of a cron-job, you could have a
script running as a daemon, checking for emails to be sent every 5mins. 


/Per Jessen, Zürich


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



Re: [PHP] Re: What's with the Rx symbol?

2008-08-30 Thread Per Jessen
tedd wrote:

 At 5:29 PM +0200 8/30/08, Per Jessen wrote:
Well, I guess - sort of.  Just because something is Unicode does not
make it global, in my opinion.
In fact, I would argue that most of Unicode is _not_ global at all.
Think about the alphabets such as: Arabic, Armenian, Bengali,
Bopomofo, Cyrillic, Devanagari, Georgian, Greek and Coptic, Gujarati,
Gurmukhi, Hangul, Hebrew, Hiragana, Kannada, Katakana, Lao, Latin,
Malayalam, Oriya, Tamil, Telugu, Thai, and Tibetan - and they were all
in the first version of Unicode.  (I'm quoting from wikipedia).
 
 Why does those languages appearing in Unicode NOT make Unicode
 global? Maybe we have a difference in they way we perceive Global.
 

Uh, we're not talking about Unicode itself, but about whether individual
symbols (that happen to also be represented in unicode) are global or
not.  AFAIk, every symbol that is currently represented in Unicode
existed before Unicode came around, and Unicode didn't all of a sudden
confer a global status onto them. 

A global symbol to me is something that is used/recognised/present in
several different countries and cultures around the world.  I think the
Ying-Yang is easily a globally recognised symbol, whereas Rx isn't. 
Coca-Cola is global, Mezzo-Mix and Rivella aren't.  


/Per Jessen, Zürich


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



Re: [PHP] Re: What's with the Rx symbol?

2008-08-30 Thread Per Jessen
tedd wrote:

 What some browser developers did was to NOT make the conversion from
 PUNYCODE to the correct code-points but rather show the PUNYCODE
 as-is, which was never the intent of the IDNS WG. This act defeated
 the entire process of allowing non-English people to have non-English
 domain names. This like throwing the baby out with the bath water.

But that's not what FF does though - it has no problem with other domain
names with international characters.  For instance, the normal Danish,
German, French, Spanish and Icelandic characters work just fine. I have
a testing domain which contains an 'ë' - also no problem. It seems to
be just somewhat limited to those (and others I'm sure). 


/Per Jessen, Zürich


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



Re: [PHP] Re: What's with the Rx symbol?

2008-08-30 Thread Eric Butera
On Sat, Aug 30, 2008 at 4:26 PM, Per Jessen [EMAIL PROTECTED] wrote:
 tedd wrote:

 At 5:29 PM +0200 8/30/08, Per Jessen wrote:
Well, I guess - sort of.  Just because something is Unicode does not
make it global, in my opinion.
In fact, I would argue that most of Unicode is _not_ global at all.
Think about the alphabets such as: Arabic, Armenian, Bengali,
Bopomofo, Cyrillic, Devanagari, Georgian, Greek and Coptic, Gujarati,
Gurmukhi, Hangul, Hebrew, Hiragana, Kannada, Katakana, Lao, Latin,
Malayalam, Oriya, Tamil, Telugu, Thai, and Tibetan - and they were all
in the first version of Unicode.  (I'm quoting from wikipedia).

 Why does those languages appearing in Unicode NOT make Unicode
 global? Maybe we have a difference in they way we perceive Global.


 Uh, we're not talking about Unicode itself, but about whether individual
 symbols (that happen to also be represented in unicode) are global or
 not.  AFAIk, every symbol that is currently represented in Unicode
 existed before Unicode came around, and Unicode didn't all of a sudden
 confer a global status onto them.

 A global symbol to me is something that is used/recognised/present in
 several different countries and cultures around the world.  I think the
 Ying-Yang is easily a globally recognised symbol, whereas Rx isn't.
 Coca-Cola is global, Mezzo-Mix and Rivella aren't.


 /Per Jessen, Zürich


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



What about U+FDD0?

http://xkcd.com/380/


Re: [PHP] Javascript mailing list

2008-08-30 Thread mike
look at jquery - it will make working with javascript so much easier
and has it's own community around it too.

On 8/30/08, Richard Heyes [EMAIL PROTECTED] wrote:
 Hi,

 Can anyone recommend a good Javascript related mailing list?

 Thanks.

 --
 Richard Heyes

 HTML5 Graphing:
 http://www.phpguru.org/RGraph

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



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



Re: [PHP] Individual bulk e-mails - performance question

2008-08-30 Thread Diogo Neves
Well, i have done that once and it worked pretty well...
Only diference was that i had a hour limit ( think dreamhost hosting )
and used Swift Mailer, but i think it don't matter a lot ;)
I think is a good solution...

On Sat, Aug 30, 2008 at 6:40 PM, Merlin [EMAIL PROTECTED] wrote:
 Hi everybody,

 I am running a travel community where users want to get informed on changes
 inside different groups they have subscribed to.

 At the moment I am doing this with a for loop that generates an individual
 e-mail sent to them via phpmailer. That works, however the submit of the
 content upload form (that triggers the e-mail notification) now takes
 several seconds, as more and more users subscribe.

 I am thinking about placing the info on the individual e-mail inside a ascii
 txt file that will be read by a cron job which will send the e-mail instead.
 Something like every 5 minutes reading it line by line and then after
 sending it removing the line.
 e.g:
 for:[EMAIL PROTECTED]; body:individual
 for:[EMAIL PROTECTED]; body:other email

 Does this sound like a plan? Or do you believe that there are better ways
 doing it? I could imagine that I would run into problems a few months from
 now if for example the cron job will be triggered a second time, while the
 first one has not finished.

 Any ideas or suggestions? Thank you for any help.

 Best regards,

 Merlin

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



-- 
Thanks by your attention,

Diogo Neves
Web Developer @ SAPO.pt by PrimeIT.pt

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



Re: [PHP] Javascript mailing list

2008-08-30 Thread Shiplu
May be jsninja has mailing list.
I am fond of jquery. so i recommend it too.
-- 
Blog: http://talk.cmyweb.net/
Follow me: http://twitter.com/shiplu


[PHP] how to write good code

2008-08-30 Thread Shiplu
I wanna know how to write good code in php.
Not oop stuff. I wanna know how to write a good php code file.
documentation, comments. indentation etc.
what are the good practices??


-- 
Blog: http://talk.cmyweb.net/
Follow me: http://twitter.com/shiplu


Re: [PHP] how to write good code

2008-08-30 Thread Eric Gorr


On Aug 30, 2008, at 8:17 PM, Shiplu wrote:


I wanna know how to write good code in php.
Not oop stuff. I wanna know how to write a good php code file.
documentation, comments. indentation etc.
what are the good practices??


Studying design patterns are a great start to learning how to write  
good code. Such things apply not only to PHP, but to other languages  
as well.


A couple of good books are:

Design Patterns: Elements of Reusable Object-Oriented Software
# ISBN-10: 0201633612
# ISBN-13: 978-0201633610

Head First Design Patterns (Head First)
# ISBN-10: 0596007124
# ISBN-13: 978-0596007126


As for comments, the best comments are those that include 'why' the  
code was written the way it was. What the code does can be discerned  
by studying the code and is generally less useful.


As for code style (which includes indentation), there is no single  
good style...pick something that looks good to you and use it. The  
most important thing is to be consistent. For example, if you choose  
to write an if statement like:


if ( ... )
{
  ...
  ...
}

don't use that in some parts of your code and

if ( ... ) {
  ...
  ...
}

in other parts.


As for other tips to writing good PHP code, I'd recommend taking a  
look at:


Essential PHP Security
# ISBN-10: 059600656X
# ISBN-13: 978-0596006563


But, basically, it just comes down to practice, practice and more  
practice.





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



[PHP] Re: Individual bulk e-mails - performance question

2008-08-30 Thread Manuel Lemos

Hello,

on 08/30/2008 02:40 PM Merlin said the following:
I am running a travel community where users want to get informed on 
changes inside different groups they have subscribed to.


At the moment I am doing this with a for loop that generates an 
individual e-mail sent to them via phpmailer. That works, however the 
submit of the content upload form (that triggers the e-mail 
notification) now takes several seconds, as more and more users subscribe.


I am thinking about placing the info on the individual e-mail inside a 
ascii txt file that will be read by a cron job which will send the 
e-mail instead. Something like every 5 minutes reading it line by line 
and then after sending it removing the line.

e.g:
for:[EMAIL PROTECTED]; body:individual
for:[EMAIL PROTECTED]; body:other email

Does this sound like a plan? Or do you believe that there are better 
ways doing it? I could imagine that I would run into problems a few 
months from now if for example the cron job will be triggered a second 
time, while the first one has not finished.


Any ideas or suggestions? Thank you for any help.


While it is a good idea to off-load e-mail delivery to a script run from 
cron, it seems odd that each mail takes several seconds to deliver.


I suspect that you sending messages in a less efficient way. Maybe you 
are queueing messages using SMTP (which is the slowest way to queue 
messages) or you are using sendmail on your system and it is configured 
by default to attempt to deliver the messages immediately, making your 
PHP script hang while the message is not accepted by the remote server.


There are much better ways to do it by just telling the mail system to 
queue the messages without holding on the PHP script.


On the other hand, if the time it takes build your messages but the 
messages have the same contents for all the receipients, you can also 
use some good e-mail components with caching support.


In that case, I recommend that you use for instance this MIME message 
class that provides message body caching support, so you can send 
messages to different receipients and cache the building of message body 
parts and avoid overhead when sending to a new receipient.


It also provides different means to send messages and solve the overhead 
of message delivery by forcing the messages to queue by your local and 
be delivered later whenever possible, so your PHP script is freed to 
send messages to other recipients.



http://www.phpclasses.org/mimemessage


--

Regards,
Manuel Lemos

Find and post PHP jobs
http://www.phpclasses.org/jobs/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

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



Re: [PHP] Re: Individual bulk e-mails - performance question

2008-08-30 Thread Diogo Neves
Well, I agree that sending it by an external process more specialized
in sending emails can be faster and more eficient, but it's harder to
control... sometimes you need to know in your php if email was really
sent and do something, and while I'm not saying it's impossible, I'm
sure it's a little more complicated...

Yet, if sending email don't need to be tracked, then external tool
world possible be better...

Anyway, don't ask me how to do that, I'm more confortable doing things in PHP :)

On Sun, Aug 31, 2008 at 2:31 AM, Manuel Lemos [EMAIL PROTECTED] wrote:
 Hello,

 on 08/30/2008 02:40 PM Merlin said the following:

 I am running a travel community where users want to get informed on
 changes inside different groups they have subscribed to.

 At the moment I am doing this with a for loop that generates an individual
 e-mail sent to them via phpmailer. That works, however the submit of the
 content upload form (that triggers the e-mail notification) now takes
 several seconds, as more and more users subscribe.

 I am thinking about placing the info on the individual e-mail inside a
 ascii txt file that will be read by a cron job which will send the e-mail
 instead. Something like every 5 minutes reading it line by line and then
 after sending it removing the line.
 e.g:
 for:[EMAIL PROTECTED]; body:individual
 for:[EMAIL PROTECTED]; body:other email

 Does this sound like a plan? Or do you believe that there are better ways
 doing it? I could imagine that I would run into problems a few months from
 now if for example the cron job will be triggered a second time, while the
 first one has not finished.

 Any ideas or suggestions? Thank you for any help.

 While it is a good idea to off-load e-mail delivery to a script run from
 cron, it seems odd that each mail takes several seconds to deliver.

 I suspect that you sending messages in a less efficient way. Maybe you are
 queueing messages using SMTP (which is the slowest way to queue messages) or
 you are using sendmail on your system and it is configured by default to
 attempt to deliver the messages immediately, making your PHP script hang
 while the message is not accepted by the remote server.

 There are much better ways to do it by just telling the mail system to queue
 the messages without holding on the PHP script.

 On the other hand, if the time it takes build your messages but the messages
 have the same contents for all the receipients, you can also use some good
 e-mail components with caching support.

 In that case, I recommend that you use for instance this MIME message class
 that provides message body caching support, so you can send messages to
 different receipients and cache the building of message body parts and avoid
 overhead when sending to a new receipient.

 It also provides different means to send messages and solve the overhead of
 message delivery by forcing the messages to queue by your local and be
 delivered later whenever possible, so your PHP script is freed to send
 messages to other recipients.


 http://www.phpclasses.org/mimemessage


 --

 Regards,
 Manuel Lemos

 Find and post PHP jobs
 http://www.phpclasses.org/jobs/

 PHP Classes - Free ready to use OOP components written in PHP
 http://www.phpclasses.org/

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





-- 
Thanks for your attention,

Diogo Neves
Web Developer @ SAPO.pt by PrimeIT.pt

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



Re: [PHP] Re: Individual bulk e-mails - performance question

2008-08-30 Thread Manuel Lemos

Hello,

on 08/30/2008 10:40 PM Diogo Neves said the following:

Well, I agree that sending it by an external process more specialized
in sending emails can be faster and more eficient, but it's harder to
control... sometimes you need to know in your php if email was really
sent and do something, and while I'm not saying it's impossible, I'm
sure it's a little more complicated...


Knowing whether the message was successfully delivered or not, is 
something that you often will not know.


Nowadays many SMTP servers use grey listing. This means that first the 
server says it cannot accept the message temporarily, but it will accept 
after several minutes.


Even if the server accepts the message immediately, he may bounce or 
discard it later.


So it is utopic to expect any reliable answer about the deliverability 
of a message. It is better not rely your software on the accuracy of any 
response from the remote server.


In any case, for really urgent messages, the MIME message class can use 
the SMTP driver to deliver messages directly to the remote SMTP server 
bypasing the local mail server. If it fails the delivery, you should 
relay it to the local mail server to retry deliverying it later. Take a 
look at the test_urgent_mail.php script for an example:


http://www.phpclasses.org/mimemessage



Yet, if sending email don't need to be tracked, then external tool
world possible be better...

Anyway, don't ask me how to do that, I'm more confortable doing things in PHP :)


PHP is very efficient if you use it in a smart way. For instance, you 
can cache message bodies using the MIME message above to avoid message 
composition overhead.


As for the actual SMTP delivery, the network connection and TCP data 
exchanging is usually so slow that any overhead of PHP script execution 
is meaningless.


--

Regards,
Manuel Lemos

Find and post PHP jobs
http://www.phpclasses.org/jobs/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

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



Re: [PHP] Re: Php installation

2008-08-30 Thread David Robley
On Sat, 30 Aug 2008, It flance wrote:
 Hi,

 Apache was already installed in my computer. Anyway now i can run php
 scripts without any problem. The problem is just that if a script
 contains database statements like connection to the database server,
 those statements are ignored while run in the browser but they are
 procesed if run from terminal. So i guess this is a configuration
 problem but i have no idea how to fix it.

 Thanks

 --- On Sat, 8/30/08, David Robley [EMAIL PROTECTED] wrote:
  From: David Robley [EMAIL PROTECTED]
  Subject: [PHP] Re: Php installation
  To: php-general@lists.php.net
  Date: Saturday, August 30, 2008, 7:03 AM
 
  It flance wrote:
   Hi all,
  
   I'm using Fedora 8. I installed php, mysql and
 
  apache. Now i can run a
 
   script connecting to a database from terminal but not
 
  from browser.
 
   Any suggestion?
 
  Have you configured apache to process php scripts?
 
  See item 14 at
  http://php.net/manual/en/install.unix.apache2.php

I apologise; I misread your question as not being able to use php through 
apache.

I wonder if your php is configured to log errors to a file, rather than 
displaying them on the screen when you connect via apache? Check your 
apache log files and see if there is something in there that is related.





Cheers
-- 
David Robley

Yes, I have read Gulliver's Travels, said Tom swiftly.
Today is Pungenday, the 24th day of Bureaucracy in the YOLD 3174. 

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



[PHP] Re: how to write good code

2008-08-30 Thread Ross McKay
On Sat, 30 Aug 2008 20:17:18 -0400, Shiplu wrote:

I wanna know how to write good code in php.
Not oop stuff. I wanna know how to write a good php code file.
documentation, comments. indentation etc.
what are the good practices??

Find out what bad is by reading this:

http://thedailywtf.com/Series/CodeSOD.aspx

Then, don't do it like that!

But seriously, you might want to check out this page on Wikipedia, and
follow some of its references:

http://en.wikipedia.org/wiki/Programming_style
-- 
Ross McKay, Toronto, NSW Australia
Let the laddie play wi the knife - he'll learn
- The Wee Book of Calvin

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