php-general Digest 3 Feb 2011 20:10:55 -0000 Issue 7164

2011-02-03 Thread php-general-digest-help

php-general Digest 3 Feb 2011 20:10:55 - Issue 7164

Topics (messages 311130 through 311134):

Re: Code formatter
311130 by: Hansen, Mike
311131 by: Ken Guest

Re: nl2br problem
311132 by: Al
311133 by: Donovan Brooke

Memcache problems
311134 by: Jostein Eriksen

Administrivia:

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

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

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


--
---BeginMessage---
 

 -Original Message-
 From: ken.gu...@gmail.com [mailto:ken.gu...@gmail.com] On 
 Behalf Of Ken Guest
 Sent: Monday, January 31, 2011 3:26 PM
 To: Hansen, Mike
 Cc: php-gene...@lists.php.net
 Subject: Re: [PHP] Code formatter
 
 
 
 On Mon, Jan 31, 2011 at 8:27 PM, Hansen, Mike 
 mike.han...@atmel.com wrote:
 
 
   I've got an application that I'm fixing up and I'd like 
 to run it through a code formatter. Is there something like 
 Perl Tidy for PHP? If so, what are you experiences with it. 
 No prob running it on the command line. It'd be great if it 
 followed the PEAR coding standards.
   
   
 
 
 Have you found http://pear.php.net/package/PHP_Beautifier  
 yet? ;) http://www.php.net/unsub.php 
 
 
 Ken
 

It mostly works ok. Unfortunately, there's a bug in it that removes blank 
lines. 

I found this one that seems to work: http://beta.phpformatter.com/

I'd rather have one I can run on the command line, but this will have to do.

Mike
---End Message---
---BeginMessage---
replies inline...

On Wed, Feb 2, 2011 at 3:23 PM, Hansen, Mike mike.han...@atmel.com wrote:



  -Original Message-
  From: ken.gu...@gmail.com [mailto:ken.gu...@gmail.com] On
  Behalf Of Ken Guest
  Sent: Monday, January 31, 2011 3:26 PM
  To: Hansen, Mike
  Cc: php-gene...@lists.php.net
  Subject: Re: [PHP] Code formatter
 
 
 
  On Mon, Jan 31, 2011 at 8:27 PM, Hansen, Mike
  mike.han...@atmel.com wrote:
 
 
I've got an application that I'm fixing up and I'd like
  to run it through a code formatter. Is there something like
  Perl Tidy for PHP? If so, what are you experiences with it.
  No prob running it on the command line. It'd be great if it
  followed the PEAR coding standards.
 
 
 
 
  Have you found http://pear.php.net/package/PHP_Beautifier
  yet? ;) http://www.php.net/unsub.php
 
 
  Ken
 

 It mostly works ok. Unfortunately, there's a bug in it that removes blank
 lines.

 I found this one that seems to work: http://beta.phpformatter.com/

 I'd rather have one I can run on the command line, but this will have to
 do.


Just spotted that bug is reported at
http://pear.php.net/package/PHP_Beautifier/bugs - it's a shame it's been
logged since 2007 or so with no sign of it getting fixed. :(



-- 
http://blogs.linux.ie/kenguest/
---End Message---
---BeginMessage---



On 2/1/2011 2:42 PM, Donovan Brooke wrote:

Hello,

I have CMS form that allows HTML for the body of a site.

To keep the form somewhat WYSIWYG, I am using the
nl2br() function for displaying:

nl2br($t_body)

This works great for normal stuff.. but for pages with tables
etc.. it creates a lot of extra br /'s :-).

I thought about doing an if statement.. if $t_body contains table then
don't use nl2br().. but I'm thinking there has got to be a better way... because
pages that use both WYSIWYG returns in the form AND tables would then not
display well.

Any thoughts?

Thanks,
Donovan




You have an example of a page you'd like to control that we can see?

On the surface, it appears you may be able to control the rendering with 
advanced CSS2/3 selectors. Thus, the browsers will do the work for you.


Al..
---End Message---
---BeginMessage---

Al wrote:
[snip]


You have an example of a page you'd like to control that we can see?

On the surface, it appears you may be able to control the rendering with
advanced CSS2/3 selectors. Thus, the browsers will do the work for you.

Al..



Hello, yes and no.. ;-) Right now browsers receive a google warning of 
malicious site.. which is one of the reasons they are asking me to

redo it. It doesn't actually have any maliciousness ;-) in it, but
I don't want to post the link for that reason. I'm a few days off from
going live though (and fixing that problem).. and could post the
link then if needed. However, I think the solution I came up with
is working fine for the most part.

For Ash, yea, I thought of doing some more sophisticated parsing of
the content as you suggest, but the KISS philosophy has merit as well, 
especially when trying to finish a project within a deadline. ;-)


Thanks for comments.
Donovan


--
D Brooke
---End Message---
---BeginMessage---

Hi,

I've been having some problems with memcache lately.
It seems to me that php is dropping connection to the memcache server 
mid way through the scripts.

[PHP] Memcache problems

2011-02-03 Thread Jostein Eriksen

Hi,

I've been having some problems with memcache lately.
It seems to me that php is dropping connection to the memcache server 
mid way through the scripts.
I've sat the failure_callback to log failures. And I'm getting a lot of 
them. Several every minute.


I'm quite stuck now and realy dont know where to go from here.
I've tried to telnet into the server. And there is no problem with 
either set nor get commands. I've started the memcached daemon with -vvv 
to see if I can dig anything interesting from the logs, but I can find 
no errors of any kind in them. There is also no errors that I can find 
in the php_error log.


I would appreciate some help, if anyone have any ideas of what is going on.

thanks.

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



Re: [PHP] Memcache problems

2011-02-03 Thread Alex Nikitin
There could be many a reasons for this, and it really depends on your setup.
For example, is php and memcache on the same server, if they are not what is
the network topology like, it could be a piece of hardware starting to
malfunction, it could be an issue with the networking driver, on the other
hand it could be neither; but to help you figure out where to look, one
should hope to see a little bit more info...

~Alex

On Thu, Feb 3, 2011 at 3:10 PM, Jostein Eriksen php-l...@morits.net wrote:

 Hi,

 I've been having some problems with memcache lately.
 It seems to me that php is dropping connection to the memcache server mid
 way through the scripts.
 I've sat the failure_callback to log failures. And I'm getting a lot of
 them. Several every minute.

 I'm quite stuck now and realy dont know where to go from here.
 I've tried to telnet into the server. And there is no problem with either
 set nor get commands. I've started the memcached daemon with -vvv to see if
 I can dig anything interesting from the logs, but I can find no errors of
 any kind in them. There is also no errors that I can find in the php_error
 log.

 I would appreciate some help, if anyone have any ideas of what is going on.

 thanks.

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




Re: [PHP] Memcache problems

2011-02-03 Thread Jostein Eriksen

Both php and memcached is running on the same server.
memcached version 1.2.2
php5-memcache version 2.2.0
php version 5.2.4

here is a snippet from my code that may be of interest
$cfg['serverList'] = array('127.0.0.1', 11211, 1, 1);
...
$this-memcache = new Memcache();
foreach($cfg['serverList'] as $value){
/** host, port, persistent, weight, timeout, retry interval, status, 
failure callback */
$this-memcache-addServer($value[0], $value[1], false, $value[2], 
$value[3], 2, true, array($this, 'fail'));

}

/Jostein

On 02/03/2011 09:34 PM, Alex Nikitin wrote:

There could be many a reasons for this, and it really depends on your setup.
For example, is php and memcache on the same server, if they are not what is
the network topology like, it could be a piece of hardware starting to
malfunction, it could be an issue with the networking driver, on the other
hand it could be neither; but to help you figure out where to look, one
should hope to see a little bit more info...

~Alex

On Thu, Feb 3, 2011 at 3:10 PM, Jostein Eriksenphp-l...@morits.net  wrote:


Hi,

I've been having some problems with memcache lately.
It seems to me that php is dropping connection to the memcache server mid
way through the scripts.
I've sat the failure_callback to log failures. And I'm getting a lot of
them. Several every minute.

I'm quite stuck now and realy dont know where to go from here.
I've tried to telnet into the server. And there is no problem with either
set nor get commands. I've started the memcached daemon with -vvv to see if
I can dig anything interesting from the logs, but I can find no errors of
any kind in them. There is also no errors that I can find in the php_error
log.

I would appreciate some help, if anyone have any ideas of what is going on.

thanks.

--
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] Memcache problems

2011-02-03 Thread Adam Richardson
On Thu, Feb 3, 2011 at 4:19 PM, Jostein Eriksen php-l...@morits.net wrote:

 Both php and memcached is running on the same server.
 memcached version 1.2.2
 php5-memcache version 2.2.0
 php version 5.2.4

 here is a snippet from my code that may be of interest
 $cfg['serverList'] = array('127.0.0.1', 11211, 1, 1);
 ...
 $this-memcache = new Memcache();
 foreach($cfg['serverList'] as $value){
/** host, port, persistent, weight, timeout,
 retry interval, status, failure callback */
$this-memcache-addServer($value[0],
 $value[1], false, $value[2], $value[3], 2, true, array($this, 'fail'));
}


Are you sure you copied this correctly?

In the code above, you set the array key 'serverList' to an array containing
('127.0.0.1', 11211, 1, 1);

Then, you foreach through the values of the 'serverList' array (first
iteration, value would equal '127.0.0.1', second, value would equal 11211,
etc.)

Then, you use array notation to access the first position of $value.  In the
first iteration of the foreach, $value would equal '127.0.0.1', so $value[0]
would give you '1', $value[1] would give you '2', etc.

Do you see what I'm saying? Did you forget or omit other relevant code? Or,
I'm just having a really bad code day (in this case, I'll likely see my
error just after sending this email.)

Adam

-- 
Nephtali:  A simple, flexible, fast, and security-focused PHP framework
http://nephtaliproject.com


Re: [PHP] Memcache problems

2011-02-03 Thread Jostein Eriksen

On 02/03/2011 10:49 PM, Adam Richardson wrote:

On Thu, Feb 3, 2011 at 4:19 PM, Jostein Eriksenphp-l...@morits.net  wrote:


Both php and memcached is running on the same server.
memcached version 1.2.2
php5-memcache version 2.2.0
php version 5.2.4

here is a snippet from my code that may be of interest
$cfg['serverList'] = array('127.0.0.1', 11211, 1, 1);
...
$this-memcache = new Memcache();
foreach($cfg['serverList'] as $value){
/** host, port, persistent, weight, timeout,
retry interval, status, failure callback */
$this-memcache-addServer($value[0],
$value[1], false, $value[2], $value[3], 2, true, array($this, 'fail'));
}



Are you sure you copied this correctly?

In the code above, you set the array key 'serverList' to an array containing
('127.0.0.1', 11211, 1, 1);

Then, you foreach through the values of the 'serverList' array (first
iteration, value would equal '127.0.0.1', second, value would equal 11211,
etc.)

Then, you use array notation to access the first position of $value.  In the
first iteration of the foreach, $value would equal '127.0.0.1', so $value[0]
would give you '1', $value[1] would give you '2', etc.

Do you see what I'm saying? Did you forget or omit other relevant code? Or,
I'm just having a really bad code day (in this case, I'll likely see my
error just after sending this email.)

Adam



My bad.

it should be:
'serverList' = array(
/** host, port, weight, timeout */
'default' = array('127.0.0.1', 11211, 
1, 1),
)),

Didn't copy/paste the $cfg = line, so it got messed up.

/Jostein

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



Re: [PHP] Memcache problems

2011-02-03 Thread Alex Nikitin
Short of some process going crazy, which you should check for, some psing,
top and netstat, i cant think of any reason you should ever get a connection
drop, short of a hardware failure (memory perhaps), or an experimental
kernel settings or modules or something... i cant think of any way that a
connection to 127.0.0.1 would ever possibly get dropped, loopback device
never hits your network hardware...

~Alex

On Thu, Feb 3, 2011 at 5:00 PM, Jostein Eriksen php-l...@morits.net wrote:

 On 02/03/2011 10:49 PM, Adam Richardson wrote:

 On Thu, Feb 3, 2011 at 4:19 PM, Jostein Eriksenphp-l...@morits.net
  wrote:

  Both php and memcached is running on the same server.
 memcached version 1.2.2
 php5-memcache version 2.2.0
 php version 5.2.4

 here is a snippet from my code that may be of interest
 $cfg['serverList'] = array('127.0.0.1', 11211, 1, 1);
 ...
 $this-memcache = new Memcache();
 foreach($cfg['serverList'] as $value){
/** host, port, persistent, weight,
 timeout,
 retry interval, status, failure callback */
$this-memcache-addServer($value[0],
 $value[1], false, $value[2], $value[3], 2, true, array($this, 'fail'));
}


  Are you sure you copied this correctly?

 In the code above, you set the array key 'serverList' to an array
 containing
 ('127.0.0.1', 11211, 1, 1);

 Then, you foreach through the values of the 'serverList' array (first
 iteration, value would equal '127.0.0.1', second, value would equal 11211,
 etc.)

 Then, you use array notation to access the first position of $value.  In
 the
 first iteration of the foreach, $value would equal '127.0.0.1', so
 $value[0]
 would give you '1', $value[1] would give you '2', etc.

 Do you see what I'm saying? Did you forget or omit other relevant code?
 Or,
 I'm just having a really bad code day (in this case, I'll likely see my
 error just after sending this email.)

 Adam


 My bad.

 it should be:
 'serverList' = array(
/** host, port, weight, timeout */
'default' = array('127.0.0.1',
 11211, 1, 1),
)),

 Didn't copy/paste the $cfg = line, so it got messed up.

 /Jostein

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




[PHP] bread and buytter php

2011-02-03 Thread Kirk Bailey
Where is a good place for bread and butter day in day out routinely 
needed functionality in php?


--
end

Very Truly yours,
 - Kirk Bailey,
   Largo Florida

   kniht
  +-+
  | BOX |
  +-+
   think


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



Re: [PHP] bread and buytter php

2011-02-03 Thread Paul M Foster
On Thu, Feb 03, 2011 at 10:47:08PM -0500, Kirk Bailey wrote:

 Where is a good place for bread and butter day in day out routinely
 needed functionality in php?

I reeeally think you're going to have to be a little more specific.

Paul

-- 
Paul M. Foster
http://noferblatz.com


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



[PHP] Re: bread and buytter php

2011-02-03 Thread David Robley
Kirk Bailey wrote:

 Where is a good place for bread and butter day in day out routinely
 needed functionality in php?
 
Content management system? Framework? PEAR? Write your own library/classes?



Cheers
-- 
David Robley

Iraqi Bingo B-52..F-16..A-10.. F-18..F-117..B-2
Today is Setting Orange, the 35th day of Chaos in the YOLD 3177. 


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