php-general Digest 2 Jun 2012 01:28:38 -0000 Issue 7836

Topics (messages 318072 through 318096):

Re: How to insert a file in a class?
        318072 by: sertcetin.itu.edu.tr
        318073 by: LAMP
        318074 by: LAMP
        318075 by: marco.behnke.biz
        318076 by: LAMP

progress indicators in browsers for long running php scripts?
        318077 by: rene7705

Exception Handling
        318078 by: James Colannino
        318079 by: marco.behnke.biz
        318080 by: Mackintosh, Mike
        318081 by: James Colannino
        318082 by: James Colannino
        318083 by: James Colannino
        318084 by: Mackintosh, Mike
        318085 by: FeIn
        318088 by: marco.behnke.biz
        318091 by: James Colannino

Happy Diamond Jubilee everyone!
        318086 by: Ashley Sheridan
        318087 by: Daniel Brown
        318092 by: Jason Pruim
        318093 by: Paul M Foster

Using default argument values in the middle of the argument list
        318089 by: 324706.mail.muni.cz

Re: is there a way to stop HTMLPurifier/CSStidy from forcing input CSS into all 
lowercase?
        318090 by: Govinda

Open Call: Official PHP Mirror
        318094 by: Daniel Brown

Simple Email System (SES) Provider
        318095 by: Don Wieland
        318096 by: Bastien Koert

Administrivia:

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

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

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


----------------------------------------------------------------------
--- Begin Message ---
file_get_contents() ?


--
Ege Sertçetin

Alinti LAMP <l...@afan.net>

Hi to all.

Let's say there is a class

class Box
{
        var $box_title;
        var $box_content;

        function __construct()
        {
                $this->box = '';
        }


        function box_title($title)
        {
                $this->title = $title;
        }

        function box_content($content)
        {
                $this->content = $content;
        }

        function make_box()
        {
                $this->box = '<h3>'.$this->box_title.'</h3>'.$this->box_content;
        }


        function get_box()
        {
                return $this->box;
        }
}


$box = new Box();
$box->box_title('PHP Classes');
$box->box_content('Starting with PHP 5, the object model was rewritten to allow for better performance and more features. This was a major change from PHP 4. PHP 5 has a full object model.')
$box->make_box();
echo $box->get_box();

This works fine.

The problem I have is how to "include" a file as box_content? it could be plain text, but it could be a form or some kind of code.
$box->box_include(include(/path/to/file/file.php)) doesn't work, of course.

Wrapping up the whole code in a variable doesn't make a sense too:
# file.php
$content = '
        <form method="post" action="$_SERVER['PHP_SELF']">
                Email = <input type=text name=email>
                Pass = <input type=password name=pass>
                <input type=submit value=Submit>
        </form>';

# main.php
$box = new Box();
$box->box_title('PHP Classes');
include(file.php);
$box->box_content($content);
$box->make_box();
echo $box->get_box();


Also, I'm sure I read once it's not correct to print directly from a class. First return a value/result to "main" code and then print. Correct?

LAMP




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

On Jun 1, 2012, at 8:00 AM, Gibbs wrote:

On 01/06/12 13:41, LAMP wrote:
Hi to all.

Let's say there is a class

class Box
{
   var $box_title;
   var $box_content;

   function __construct()
   {
       $this->box = '';
   }


   function box_title($title)
   {
       $this->title = $title;
   }

   function box_content($content)
   {
       $this->content = $content;
   }

   function make_box()
   {
$this->box = '<h3>'.$this->box_title.'</h3>'.$this- >box_content;
   }


   function get_box()
   {
       return $this->box;
   }
}


$box = new Box();
$box->box_title('PHP Classes');
$box->box_content('Starting with PHP 5, the object model was rewritten to allow for better performance and more features. This was a major change from PHP 4. PHP 5 has a full object model.')
$box->make_box();
echo $box->get_box();

This works fine.

The problem I have is how to "include" a file as box_content? it could be plain text, but it could be a form or some kind of code. $box->box_include(include(/path/to/file/file.php)) doesn't work, of course.

Wrapping up the whole code in a variable doesn't make a sense too:
# file.php
$content = '
<form method="post" action="$_SERVER['PHP_SELF']">
       Email = <input type=text name=email>
       Pass = <input type=password name=pass>
<input type=submit value=Submit>
</form>';

# main.php
$box = new Box();
$box->box_title('PHP Classes');
include(file.php);
$box->box_content($content);
$box->make_box();
echo $box->get_box();


Also, I'm sure I read once it's not correct to print directly from a class. First return a value/result to "main" code and then print. Correct?

LAMP


Couldn't you just do something like:

function box_content($file = NULL)
{
       $content = file_exists($file) ? include($file) : NULL;
       $this->content = $content;
}

It really depends what is being included (text, HTML, PHP etc). Personally I would create a different method for each different type as they will have to be treated and returned differently.

Gibbs

No. It doesn't work.
And yes, the content of the "box" could be anything.



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

On Jun 1, 2012, at 7:46 AM, David OBrien wrote:



On Fri, Jun 1, 2012 at 8:41 AM, LAMP <l...@afan.net> wrote:
Hi to all.

Let's say there is a class

class Box
{
       var $box_title;
       var $box_content;

       function __construct()
       {
               $this->box = '';
       }


       function box_title($title)
       {
               $this->title = $title;
       }

       function box_content($content)
       {
               $this->content = $content;
       }

       function make_box()
       {
$this->box = '<h3>'.$this->box_title.'</h3>'.$this- >box_content;
       }


       function get_box()
       {
               return $this->box;
       }
}


$box = new Box();
$box->box_title('PHP Classes');
$box->box_content('Starting with PHP 5, the object model was rewritten to allow for better performance and more features. This was a major change from PHP 4. PHP 5 has a full object model.')
$box->make_box();
echo $box->get_box();

This works fine.

The problem I have is how to "include" a file as box_content? it could be plain text, but it could be a form or some kind of code. $box->box_include(include(/path/to/file/file.php)) doesn't work, of course.

Wrapping up the whole code in a variable doesn't make a sense too:
# file.php
$content = '
       <form method="post" action="$_SERVER['PHP_SELF']">
               Email = <input type=text name=email>
               Pass = <input type=password name=pass>
               <input type=submit value=Submit>
       </form>';

# main.php
$box = new Box();
$box->box_title('PHP Classes');
include(file.php);
$box->box_content($content);
$box->make_box();
echo $box->get_box();


Also, I'm sure I read once it's not correct to print directly from a class. First return a value/result to "main" code and then print. Correct?

LAMP

file_get_contents

I still can get the content of a file?!?
echo file_get_contents($content);
doesn't show anything. though,
echo htmlspecialchars(file_get_content($content));
will show the code. means it is "there"


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

LAMP <l...@afan.net> hat am 1. Juni 2012 um 14:41 geschrieben:

> include(file.php);
> $box->box_content($content);
> $box->make_box();
> echo $box->get_box();


Wrong approach.
Right is:

$content = file_get_contents('file.php');
$box->box_content($content);


Marco Behnke
Dipl. Informatiker (FH), SAE Audio Engineer Diploma
Zend Certified Engineer PHP 5.3

Tel.: 0174 / 9722336
e-Mail: ma...@behnke.biz

Softwaretechnik Behnke
Heinrich-Heine-Str. 7D
21218 Seevetal

http://www.behnke.biz

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

On Jun 1, 2012, at 8:11 AM, LAMP wrote:


On Jun 1, 2012, at 7:46 AM, David OBrien wrote:



On Fri, Jun 1, 2012 at 8:41 AM, LAMP <l...@afan.net> wrote:
Hi to all.

Let's say there is a class

class Box
{
      var $box_title;
      var $box_content;

      function __construct()
      {
              $this->box = '';
      }


      function box_title($title)
      {
              $this->title = $title;
      }

      function box_content($content)
      {
              $this->content = $content;
      }

      function make_box()
      {
$this->box = '<h3>'.$this->box_title.'</h3>'.$this- >box_content;
      }


      function get_box()
      {
              return $this->box;
      }
}


$box = new Box();
$box->box_title('PHP Classes');
$box->box_content('Starting with PHP 5, the object model was rewritten to allow for better performance and more features. This was a major change from PHP 4. PHP 5 has a full object model.')
$box->make_box();
echo $box->get_box();

This works fine.

The problem I have is how to "include" a file as box_content? it could be plain text, but it could be a form or some kind of code. $box->box_include(include(/path/to/file/file.php)) doesn't work, of course.

Wrapping up the whole code in a variable doesn't make a sense too:
# file.php
$content = '
      <form method="post" action="$_SERVER['PHP_SELF']">
              Email = <input type=text name=email>
              Pass = <input type=password name=pass>
              <input type=submit value=Submit>
      </form>';

# main.php
$box = new Box();
$box->box_title('PHP Classes');
include(file.php);
$box->box_content($content);
$box->make_box();
echo $box->get_box();


Also, I'm sure I read once it's not correct to print directly from a class. First return a value/result to "main" code and then print. Correct?

LAMP

file_get_contents

I still can get the content of a file?!?
echo file_get_contents($content);
doesn't show anything. though,
echo htmlspecialchars(file_get_content($content));
will show the code. means it is "there"


Works perfect! Me dummy, forgot I had style="display: none;" within the dive tag :) :) :)
Thanks to all for help.



--- End Message ---
--- Begin Message ---
Hi..

I've got several scripts now that may run for a long time; the
self-test script for my htmlMicroscope, my serviceLog component when
it calculates totals for a large number of hits, a curl script that is
likely to one day crawl a hundred or so RSS urls in a single update,
etc, etc.

I'd like to build a generic system (and opensource it) to allow PHP to
execute a long running script, and somehow get a progress bar with
"what am I doing now"-status-msg for such processes, in the browser.

The easiest thing, and maybe the only way this will work, is to load
up a site's framework html (so as to display the site), then call the
long-running script via ajax.
However, a long-running script needs set_time_limit(0), which is
something shared hosters just won't do for browsers.
A moderately good shared hoster will however allow you to
set_time_limit(0) for PHP cron jobs.

So I'd need to build a cron PHP daemon that listens for new tasks.
That won't be much of a problem, I've done it before.

But the task definition itself puzzles me a lot still.
I suppose I'd need an ID for the task/job, and include in the task def
what worker-php-script and worker-php-function to call, with also the
parameters for the worker function.
The worker function would then call back certain daemon functions to
push status updates to the browser.

And the browser can then just kick off the task, and poll every 5
seconds or so for very brief status updates in JSON format.

This is how I can import videos of any length into my CMS, and convert
them to flash video aswell (even optionally converting on another,
dedicated server).

Once again I'm asking you all for input and tips before I begin on
this new workDaemon component of mine..

I suppose most of you'd want a neat PHP object of it? Not my usual
procedural-only PHP coding?

With regards,
 and eager to hear your tips,
  Rene Veerman

--- End Message ---
--- Begin Message ---
Hey guys,

Haven't posted in a long time... Happy Memorial Day! I have an issue with exception handling. I'm using a framework that throws a "Database_Exception" object. I was expecting catch (Exception $var) to be sufficient to catch this, but it doesn't. I have to do catch (Database_Exception $var) to make it work. I've been reading that Exception should be sufficient, since every exception object is a child class of Exception. Did this perhaps change in 5.4? I think it was working properly in 5.3, but I'm not sure.

Any clarification would be greatly appreciated!

James

--- End Message ---
--- Begin Message ---
James Colannino <crankycycl...@gmail.com> hat am 1. Juni 2012 um 16:25
geschrieben:

> Hey guys,
>
> Haven't posted in a long time...  Happy Memorial Day!  I have an issue
> with exception handling.  I'm using a framework that throws a
> "Database_Exception" object.  I was expecting catch (Exception $var) to
> be sufficient to catch this, but it doesn't.  I have to do catch
> (Database_Exception $var) to make it work.  I've been reading that
> Exception should be sufficient, since every exception object is a child
> class of Exception.  Did this perhaps change in 5.4?  I think it was
> working properly in 5.3, but I'm not sure.


Look at the definition of "Database_Exception" and see if it extends Exception,
I'll guess it doesn't.
Nothing changed in PHP 5.4 to that.

>
> Any clarification would be greatly appreciated!
>
> James
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
Marco Behnke
Dipl. Informatiker (FH), SAE Audio Engineer Diploma
Zend Certified Engineer PHP 5.3

Tel.: 0174 / 9722336
e-Mail: ma...@behnke.biz

Softwaretechnik Behnke
Heinrich-Heine-Str. 7D
21218 Seevetal

http://www.behnke.biz

--- End Message ---
--- Begin Message ---
-----Original Message-----
From: James Colannino [mailto:crankycycl...@gmail.com] 
Sent: Friday, June 01, 2012 10:25 AM
To: PHP-General List
Subject: [PHP] Exception Handling

Hey guys,

Haven't posted in a long time...  Happy Memorial Day!  I have an issue
with exception handling.  I'm using a framework that throws a
"Database_Exception" object.  I was expecting catch (Exception $var) to
be sufficient to catch this, but it doesn't.  I have to do catch
(Database_Exception $var) to make it work.  I've been reading that
Exception should be sufficient, since every exception object is a child
class of Exception.  Did this perhaps change in 5.4?  I think it was
working properly in 5.3, but I'm not sure.

Any clarification would be greatly appreciated!

James

--

Hi James,

You would have to catch Database_Exception. It is also good practice to
also always catch exception afterwards.

Ex:

Class Database_Exception extends Exception{
        Public function __construct($message){
                parent::__construct($message);
        }
}

Try{
        $pdo = new PDO();
        If($pdo === false){
                Throw new Database_Exception("Failed To Connect");
        }
}
Catch(Database_Exception $e){
        Echo $e->getMessage();
}
Catch(Exception $e){
        Echo $e->getMessage();
}

--- End Message ---
--- Begin Message ---
On 06/01/12 07:30, ma...@behnke.biz wrote:
James Colannino<crankycycl...@gmail.com>  hat am 1. Juni 2012 um 16:25
geschrieben:
Hey guys,

Haven't posted in a long time...  Happy Memorial Day!  I have an issue
with exception handling.  I'm using a framework that throws a
"Database_Exception" object.  I was expecting catch (Exception $var) to
be sufficient to catch this, but it doesn't.  I have to do catch
(Database_Exception $var) to make it work.  I've been reading that
Exception should be sufficient, since every exception object is a child
class of Exception.  Did this perhaps change in 5.4?  I think it was
working properly in 5.3, but I'm not sure.
Look at the definition of "Database_Exception" and see if it extends Exception,
I'll guess it doesn't.
Nothing changed in PHP 5.4 to that.


Hey Marco,

Thanks for the reply!  That was the first thing I checked.

class Database_Exception extends \FuelException {}
class Fuel_Exception extends \Exception {}

It's extending Exception, as expected. Also, can you throw classes that don't extend Exception? It was always my understanding that doing so would cause a fatal error.

James

--- End Message ---
--- Begin Message ---
On 06/01/12 08:08, James Colannino wrote:
On 06/01/12 07:30, ma...@behnke.biz wrote:
James Colannino<crankycycl...@gmail.com>  hat am 1. Juni 2012 um 16:25
geschrieben:
Hey guys,

Haven't posted in a long time...  Happy Memorial Day!  I have an issue
with exception handling.  I'm using a framework that throws a
"Database_Exception" object.  I was expecting catch (Exception $var) to
be sufficient to catch this, but it doesn't.  I have to do catch
(Database_Exception $var) to make it work.  I've been reading that
Exception should be sufficient, since every exception object is a child
class of Exception.  Did this perhaps change in 5.4?  I think it was
working properly in 5.3, but I'm not sure.
Look at the definition of "Database_Exception" and see if it extends Exception,
I'll guess it doesn't.
Nothing changed in PHP 5.4 to that.


Hey Marco,

Thanks for the reply!  That was the first thing I checked.

class Database_Exception extends \FuelException {}
class Fuel_Exception extends \Exception {}

It's extending Exception, as expected. Also, can you throw classes that don't extend Exception? It was always my understanding that doing so would cause a fatal error.

I was right. From the documentation (http://php.net/manual/en/language.exceptions.php):

"The thrown object must be an instance of the Exception <http://www.php.net/manual/en/class.exception.php> class or a subclass of Exception <http://www.php.net/manual/en/class.exception.php>. Trying to throw an object that is not will result in a PHP Fatal Error."

James

--- End Message ---
--- Begin Message ---
On 06/01/12 07:32, Mackintosh, Mike wrote:
Hi James,

You would have to catch Database_Exception. It is also good practice to
also always catch exception afterwards.


Hey Mike,

Thanks for the reply! I saw this comment in the documentation (http://www.php.net/manual/en/language.exceptions.extending.php) -- it's the first one:

"|It's important to note that subclasses of the Exception class will be caught by the default Exception handler"

Of course, I haven't tested the code they posted. I'll do that tonight and confirm or deny the expected result.

James
|

--- End Message ---
--- Begin Message ---
-----Original Message-----
From: James Colannino [mailto:crankycycl...@gmail.com] 
Sent: Friday, June 01, 2012 11:14 AM
To: PHP-General List
Subject: Re: [PHP] Exception Handling

Hey Mike,

Thanks for the reply!  I saw this comment in the documentation
(http://www.php.net/manual/en/language.exceptions.extending.php) -- it's
the first one:

"|It's important to note that subclasses of the Exception class will be
caught by the default Exception handler"

Of course, I haven't tested the code they posted.  I'll do that tonight
and confirm or deny the expected result.

James
|

Well look at that..

class James_Exception extends \Exception{
        function __construct($message){
                parent::__construct($message);
        }
}

try{
        throw new James_Exception('Testing Exception Catch-All');
}
catch(Exception $e){
        print_r($e);    
}

Output:

"James_Exception Object
(
    [message:protected] => Testing Exception Catch-All..."

--- End Message ---
--- Begin Message ---
Maybe "catch(Exception $e)" should be "catch(\Exception $e)"?

On Fri, Jun 1, 2012 at 5:25 PM, James Colannino <crankycycl...@gmail.com> wrote:
> Hey guys,
>
> Haven't posted in a long time...  Happy Memorial Day!  I have an issue with
> exception handling.  I'm using a framework that throws a
> "Database_Exception" object.  I was expecting catch (Exception $var) to be
> sufficient to catch this, but it doesn't.  I have to do catch
> (Database_Exception $var) to make it work.  I've been reading that Exception
> should be sufficient, since every exception object is a child class of
> Exception.  Did this perhaps change in 5.4?  I think it was working properly
> in 5.3, but I'm not sure.
>
> Any clarification would be greatly appreciated!
>
> James
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

--- End Message ---
--- Begin Message ---
Am 01.06.12 17:08, schrieb James Colannino:
>
> Hey Marco,
>
> Thanks for the reply!  That was the first thing I checked.
>
> class Database_Exception extends \FuelException {}
> class Fuel_Exception extends \Exception {}
>
> It's extending Exception, as expected.  Also, can you throw classes
> that don't extend Exception?  It was always my understanding that
> doing so would cause a fatal error.

Ah, I guess that is the problem. Your application framework uses namespaces.
I guess you should try

catch (\Exception $e)

instead of

catch (Exception $e)

:-)

>
> James
>


-- 
Marco Behnke
Dipl. Informatiker (FH), SAE Audio Engineer Diploma
Zend Certified Engineer PHP 5.3

Tel.: 0174 / 9722336
e-Mail: ma...@behnke.biz

Softwaretechnik Behnke
Heinrich-Heine-Str. 7D
21218 Seevetal

http://www.behnke.biz


Attachment: signature.asc
Description: OpenPGP digital signature


--- End Message ---
--- Begin Message ---
On Fri, Jun 1, 2012 at 12:51 PM, Marco Behnke <ma...@behnke.biz> wrote:

Ah, I guess that is the problem. Your application framework uses namespaces.
> I guess you should try
>
> catch (\Exception $e)
>
> instead of
>
> catch (Exception $e)
>
> :-)
>

Ah, that was probably it.  Will try it out tonight to confirm.  Thanks!

James

--- End Message ---
--- Begin Message ---
This is a bit of a shameless plug, but it is a Friday and a pretty
special weekend over here.

I recently got to work on something a bit fun at work in my spare time
and they liked it so much that it got used internally to celebrate the
jubilee weekend.

This is the result http://jubilee.themlondon.com 

For those of you interested, the leg-work is done by a bunch of PHP
scripts run in the background via cron, split into 3 tasks:


     1. A script goes out and searches Twitter for tweets that mention
        the jubilee, one instance per keyword and records those to a DB
        to limit the draw on the Twitter API
     2. A second script goes over those tweets and pulls in all the
        non-default profile images for each unique user
     3. Lastly, the image is built as 12 separate tiles every half hour,
        using PHP and GD to match the average colour of each profile pic
        to a spot on the image, and then these are stitched together for
        the final image

Anyway, hope you guys all have a great weekend, more so if you're
unlucky enough to be working over the whole 4 days :-/

-- 
Thanks,
Ash
http://www.ashleysheridan.co.uk



--- End Message ---
--- Begin Message ---
On Fri, Jun 1, 2012 at 1:44 PM, Ashley Sheridan
<a...@ashleysheridan.co.uk> wrote:
> This is a bit of a shameless plug, but it is a Friday and a pretty
> special weekend over here.
>
> I recently got to work on something a bit fun at work in my spare time
> and they liked it so much that it got used internally to celebrate the
> jubilee weekend.
>
> This is the result http://jubilee.themlondon.com
>
> For those of you interested, the leg-work is done by a bunch of PHP
> scripts run in the background via cron, split into 3 tasks:
>
>
>     1. A script goes out and searches Twitter for tweets that mention
>        the jubilee, one instance per keyword and records those to a DB
>        to limit the draw on the Twitter API
>     2. A second script goes over those tweets and pulls in all the
>        non-default profile images for each unique user
>     3. Lastly, the image is built as 12 separate tiles every half hour,
>        using PHP and GD to match the average colour of each profile pic
>        to a spot on the image, and then these are stitched together for
>        the final image
>
> Anyway, hope you guys all have a great weekend, more so if you're
> unlucky enough to be working over the whole 4 days :-/

    Congrats, Ash, and nice work.  Looks great!

-- 
</Daniel P. Brown>
Network Infrastructure Manager
http://www.php.net/

--- End Message ---
--- Begin Message ---
And this is when I realize that I still have so much to learn!!!! Looks amazing 
ash!


Jason Pruim
352.234.3175 Google Voice
352.682.1073 Cell

On Jun 1, 2012, at 1:44 PM, Ashley Sheridan <a...@ashleysheridan.co.uk> wrote:

> This is a bit of a shameless plug, but it is a Friday and a pretty
> special weekend over here.
> 
> I recently got to work on something a bit fun at work in my spare time
> and they liked it so much that it got used internally to celebrate the
> jubilee weekend.
> 
> This is the result http://jubilee.themlondon.com 
> 
> For those of you interested, the leg-work is done by a bunch of PHP
> scripts run in the background via cron, split into 3 tasks:
> 
> 
>     1. A script goes out and searches Twitter for tweets that mention
>        the jubilee, one instance per keyword and records those to a DB
>        to limit the draw on the Twitter API
>     2. A second script goes over those tweets and pulls in all the
>        non-default profile images for each unique user
>     3. Lastly, the image is built as 12 separate tiles every half hour,
>        using PHP and GD to match the average colour of each profile pic
>        to a spot on the image, and then these are stitched together for
>        the final image
> 
> Anyway, hope you guys all have a great weekend, more so if you're
> unlucky enough to be working over the whole 4 days :-/
> 
> -- 
> Thanks,
> Ash
> http://www.ashleysheridan.co.uk
> 
> 

--- End Message ---
--- Begin Message ---
On Fri, Jun 01, 2012 at 06:44:17PM +0100, Ashley Sheridan wrote:

> This is a bit of a shameless plug, but it is a Friday and a pretty
> special weekend over here.
> 
> I recently got to work on something a bit fun at work in my spare time
> and they liked it so much that it got used internally to celebrate the
> jubilee weekend.
> 
> This is the result http://jubilee.themlondon.com 
> 
> For those of you interested, the leg-work is done by a bunch of PHP
> scripts run in the background via cron, split into 3 tasks:
> 
> 
>      1. A script goes out and searches Twitter for tweets that mention
>         the jubilee, one instance per keyword and records those to a DB
>         to limit the draw on the Twitter API
>      2. A second script goes over those tweets and pulls in all the
>         non-default profile images for each unique user
>      3. Lastly, the image is built as 12 separate tiles every half hour,
>         using PHP and GD to match the average colour of each profile pic
>         to a spot on the image, and then these are stitched together for
>         the final image
> 
> Anyway, hope you guys all have a great weekend, more so if you're
> unlucky enough to be working over the whole 4 days :-/

*Very* nice work!

Paul

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

--- End Message ---
--- Begin Message ---
Hi,

as I accidentally found out that PHP allows default argument values
to occur not only at the end of parameter list:

function ( Classname $a, Classname $b = null, Classname $c ) ...

Unfortunately, documentation does not state what is supposed to happen in such situation.
It appears $b can be an instance of Classname or a null.

I've draw up simple test case (https://gist.github.com/2829626) to verify my assumption and it seems to work at least since PHP 5.3.0. It is extremely useful to allow null
value and retain the power of type hints at the same time.

Is there anything else to test? Does it work for your setup? Can it be used that way?
And if yes, can it be officially documented?

Do not hesitate to prove I'm wrong.

-- Oliver

--- End Message ---
--- Begin Message ---
we got off list, without meaning to, it seems.

Here are  the last few posts in the thread:


> 
>>> On Fri, Jun 1, 2012 at 12:46 AM, Govinda <govinda.webdnat...@gmail.com> 
>>> wrote:
>>>>> Perhaps you should spend some time looking for a better text editor
>>>>> for your OS. :)  When the current tools I use does not give
>>>>> satisfactory progress in what I'd like to do, I replace the tool(s).
>>>> 
>>>> I am happy with my editor.  It (BBedit) has good multi-file 
>>>> search-replace... and I can also generate that/a full list of where all is 
>>>> strtolower()..  BUT I do not want to just willy nilly comment out/remove 
>>>> all those instances of strtolower(), because even if it seems to "work", I 
>>>> won't really know what damage I may have done to the library(ies).  If I 
>>>> can find just the one instance that is the culprit, without spending days 
>>>> trying every single spot, one at a time, then great.. but since a lot of 
>>>> the code in those libraries is a bit over my head (without spending a lot 
>>>> of time on it), I want something more definitive than just stabbing at 
>>>> every strtolower().
>>>> 
>>>> I appreciate your time and attention.   When I post my OP, I was/am hoping 
>>>> for a reply where someone knows what really is the situation; where is the 
>>>> specific offending line(s) I can hack in the source, or better yet, just 
>>>> how can we set CSStidy config options through HTMLpurifier at runtime, and 
>>>> so not hack the source at all.
>>>> 
>>>> -Govinda
>>> 
>>> You don't need to modify every strtolower statement.  Just open up the
>>> files and look at that code block and the surrounding code blocks.  If
>>> that doesn't make sense, then most likely it's not what you're looking
>>> for.
>> 
>> 
>> I tried that..  and some of the instances of strtolower() I thought very 
>> well could be the culprit.. and so I commented it out... but it did not help 
>> (it was not the culprit, or else it was still being overridden by another 
>> one).
>> 
>> Many other instances I could not tell by looking at the code.
>> 
>> Some were pretty clearly not the culprit.
>> 
>>>  In Notepad++, double clicking on a line in the search results
>>> window will open up the file and bring you right to that line.  If
>>> BBedit doesn't do that, then refer back to my comment about the tools
>>> you use :)  Just my 2 cents.
>> 
>> BBedit too does do that  :-)
>> 
>>> 
>>> BTW, I rather dig through the code 1st and see what strength and
>>> weakness that framework provides and to fully comprehend if all its
>>> bells and whistles are as others claim.  What may work for others may
>>> not for you.  For example, in all my past searches for a PHP
>>> framework, only Yii managed to fulfill the most of what I want in a
>>> framework, including and specifically ability to create CRUD UI by
>>> just specifying the table name after the DB configurations are set.
>>> But more than that, Yii went beyond my expectation by providing the
>>> client side validation for the CRUD too.  Granted the UI doesn't fit
>>> my liking but it does more than the other frameworks I've looked at.
>>> :)
>> 
>> I have been pleased with the frameworks and libraries I have picked to help 
>> me out.. even HTMLpurifier and CSStidy have been great.. It was not until 
>> now (too deep in to want to go back) that I realized I have this one issue.
>> 
>> I am just about to hand off this code.. just need to find a way to 
>> patch/workaround this one thing.. have another new project stating monday.
>> 
>> In case I seem irreverent.. it is not my intention... I appreciate you even 
>> bothering to reply :-)
>> -Govinda
> 
> Have you tried using xdebug and step through the code to look for
> changes?  IIRC, xdebug is capable of monitoring variables and their
> values.

AFAICT that is a brilliant idea -  put a watch on the var(s) until I can trace 
just exactly where the offending line is.  
[snip]
 I have yet to bring my tools up to speed to do that here in PHP.  I won't have 
time before this thing is out the door..   but thanks for reminding me I need 
to check out something like xdebug sooner than later.

-G

--- End Message ---
--- Begin Message ---
    Greetings, all;

    Have you ever wanted to get directly involved in the PHP project
in an official capacity, but don't have the time, resources, or
knowledge required to contribute to the core, documentation, or other
roles?  Did you know about our Official Mirrors program?

    Starting today, we are putting out an open call to all web
development firms, web hosts, ISPs, and academic institutions to apply
to our official php.net mirror waiting list.  And if you're
interested, please, read on.  If not, delete this email with extreme
prejudice and muttered profanity.

    We're presently undergoing a complete overhaul of the mirror
infrastructure, and will quite likely need to replace some of the
mirrors in some countries.  It's for this reason that we want to
invite others to join the program and help support one of the world's
most popular and most prolific open source projects in history.  Sure,
it's a short history, but still --- it makes for impressive
discussions at the pub, should you find yourself surrounded by
like-minded geeks.

    Who should apply?

    Any web development firm, web hosting provider, ISP, or recognized
academic institution capable of providing a LA*P server running PHP
5.3.10+ or PHP 5.4.0+ with at least 60GB bandwidth per month allocated
at 10Mbps or better, with the server physically located in the country
for which you wish to provide service.

    Who should not apply?

    Third-party sponsors, those who want to try to run the mirror from
their Blackberry, people without servers located in the respective
country for which they're applying, shared hosting clients, Droids,
Borg, Klingons, Romulans, toddlers, and the gum disease known as
"gingivitis."

    Want to know more?

    Please ask.

    Want to join the waiting list?

    Fill out the form at http://php.parasane.net/mirrors/waitinglist.php

    We now return you to your regularly-scheduled Friday, already in
progress.  Unless it's already Saturday in your time zone, in which
case you've been warped through a time-shift paradox.  Way to go.

-- 
</Daniel P. Brown>
Network Infrastructure Manager
http://www.php.net/

--- End Message ---
--- Begin Message ---
Hi all,

I built a system in PHP/mySQL where a group of users post events, sign- up for events, change their arrival times, remove thier names from events, and post related notes on the events. Each time an action is done, an email is generated to the entire group that their has been a change. Pretty standard stuff...

Today I just got an Mail Delivery System email with this error:

Domain dwdcweb.info has exceeded the max emails per hour (350/350 (100%)) allowed. Message will be reattempted later

I contacted my VPS provider and they just alerted me that there is a limit on how many emails my server can send per hour.

They recommended I find a 3rd party service provider with support PHP API connections.

My budget is limited. Does anyone have any suggestions of companies that might work for my scenario?

Any feedback is appreciated ;-)

Don

--- End Message ---
--- Begin Message ---
On Fri, Jun 1, 2012 at 8:32 PM, Don Wieland <d...@pointmade.net> wrote:
> Hi all,
>
> I built a system in PHP/mySQL where a group of users post events, sign-up
> for events, change their arrival times, remove thier names from events, and
> post related notes on the events. Each time an action is done, an email is
> generated to the entire group that their has been a change. Pretty standard
> stuff...
>
> Today I just got an Mail Delivery System email with this error:
>
> Domain dwdcweb.info has exceeded the max emails per hour (350/350 (100%))
> allowed.  Message will be reattempted later
>
> I contacted my VPS provider and they just alerted me that there is a limit
> on how many emails my server can send per hour.
>
> They recommended I find a 3rd party service provider with support PHP API
> connections.
>
> My budget is limited. Does anyone have any suggestions of companies that
> might work for my scenario?
>
> Any feedback is appreciated ;-)
>
> Don
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

Amazon has an email service you can plug in to with php

http://aws.amazon.com/ses/


-- 

Bastien

Cat, the other other white meat

--- End Message ---

Reply via email to