php-general Digest 25 Nov 2008 07:47:30 -0000 Issue 5809

Topics (messages 283775 through 283797):

Re: PostTrack Reminder
        283775 by: Wolf
        283776 by: Ashley Sheridan
        283777 by: Daniel P. Brown
        283779 by: Daniel Brown
        283780 by: japruim.raoset.com
        283782 by: Dan Joseph
        283784 by: Ashley Sheridan
        283785 by: Stut
        283786 by: Ashley Sheridan
        283787 by: Stut
        283788 by: Ashley Sheridan
        283789 by: Daniel P. Brown
        283790 by: Nathan Rixham

Re: file_Exists() and case
        283778 by: Bastien Koert

Memcached is driving me nuts
        283781 by: Rico Secada
        283783 by: Al
        283791 by: Rico Secada

SQL - RANDOM
        283792 by: Korgan
        283793 by: Chris
        283794 by: ceo.l-i-e.com
        283795 by: Korgan

getStatic
        283796 by: Craige Leeder
        283797 by: Yeti

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [EMAIL PROTECTED]


----------------------------------------------------------------------
--- Begin Message ---
---- Daniel Brown <[EMAIL PROTECTED]> wrote: 
>     Folks;
> 
>     Just as a reminder, the PostTrack/ListWatch system is back to
> recording and reporting data on the list for the Friday summary
> reports and list metrics.  If you do not want your email address to
> show up in the reports and have not already told me, please let me
> know ASAP and I will permanently remove you from the reports.  Note
> that this will *NOT* unsubscribe you from the list, just keep you from
> showing metrics in the weekly reports.
> 
>     Thanks, all.  And a happy upcoming holiday to my fellow US Americans.
> 
>     Everyone stay safe.
> 

Sure Dan, just pad your metrics with yet another post...  :)

Have a good Thanksgiving as well!  Make sure to eat lots of turkey so you sleep 
through the list emails!

Wolf

--- End Message ---
--- Begin Message ---
On Mon, 2008-11-24 at 14:45 -0500, Daniel Brown wrote:
> Folks;
> 
>     Just as a reminder, the PostTrack/ListWatch system is back to
> recording and reporting data on the list for the Friday summary
> reports and list metrics.  If you do not want your email address to
> show up in the reports and have not already told me, please let me
> know ASAP and I will permanently remove you from the reports.  Note
> that this will *NOT* unsubscribe you from the list, just keep you from
> showing metrics in the weekly reports.
> 
>     Thanks, all.  And a happy upcoming holiday to my fellow US Americans.
> 
>     Everyone stay safe.
> 
> -- 
> </Daniel P. Brown>
> http://www.parasane.net/
> [EMAIL PROTECTED] || [EMAIL PROTECTED]
> 1 LEFT: $149/mo. $0 Setup - Dual-Core/320GB HDD/1GB RAM/3TB
> 100Mbps/cPanel - SAME-DAY SETUP! Contact me to buy.
> 
What exactly are these metrics? Are they part of the mailing list?


Ash
www.ashleysheridan.co.uk


--- End Message ---
--- Begin Message ---
On Mon, Nov 24, 2008 at 2:49 PM, Wolf <[EMAIL PROTECTED]> wrote:
>
> Sure Dan, just pad your metrics with yet another post...  :)

    Much like you just did.  ;-P

> Have a good Thanksgiving as well!  Make sure to eat lots of turkey so you 
> sleep through the list emails!

    I'll actually be working.

    These first few days for the system will be re-acquainting on it,
including the new code.  As you probably remember, there were some
issues with the original code, so everything was rewritten from
scratch.  One of the big things will be making sure it's sending the
special characters properly, as Eric (Butera) reminded me last week.
Zoltan Nemeth and Andres Robinet were among the folks whose names were
butchered a few times.  Oops.

    This will also not be reporting code byte counts until I've made
sure that it's working properly.  Thanks to people (*ahem!*) "helping"
me figure out that the filter wasn't working as it should have been,
I've reworked that part of the engine as well.

    And then, finally, once we have some usable data, I'm going to
enslave Richard Heyes to help me integrate his RGraph[1] stuff to show
that off a bit, too.  Neat.

    The only big thing is, I don't think I'll have the number one post
count anymore.  I have a ton of things going on, including for PHP
(coordinating with some of the mirror maintainers to get things in
order), so it's shaping up to be just as busy a winter as it was a
summer.

        1: http://www.rgraph.org/

-- 
</Daniel P. Brown>
http://www.parasane.net/
[EMAIL PROTECTED] || [EMAIL PROTECTED]
1 LEFT: $149/mo. $0 Setup - Dual-Core/320GB HDD/1GB RAM/3TB
100Mbps/cPanel - SAME-DAY SETUP! Contact me to buy.

--- End Message ---
--- Begin Message ---
On Mon, Nov 24, 2008 at 3:00 PM, Ashley Sheridan
<[EMAIL PROTECTED]> wrote:
>>
> What exactly are these metrics? Are they part of the mailing list?

    Yes, last year and earlier this year, before you began
contributing to the list, there was a tracking system that displayed a
simple report[1] each week for contributions to the General list.  One
person at the time didn't want his email address displayed, so it was
hidden from the weekly summary emails.

        1: Example: http://marc.info/?l=php-general&m=120431890502817&w=2

-- 
</Daniel P. Brown>
http://www.parasane.net/
[EMAIL PROTECTED] || [EMAIL PROTECTED]
1 LEFT: $149/mo. $0 Setup - Dual-Core/320GB HDD/1GB RAM/3TB
100Mbps/cPanel - SAME-DAY SETUP! Contact me to buy.

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

On Nov 24, 2008, at 3:00 PM, Daniel P. Brown wrote:

On Mon, Nov 24, 2008 at 2:49 PM, Wolf <[EMAIL PROTECTED]> wrote:

Sure Dan, just pad your metrics with yet another post...  :)

    Much like you just did.  ;-P

Nahhh.... If we was going for that he would just get it stuck in an endless loop again and send hundreds of messages through the system :P

Have a good Thanksgiving as well! Make sure to eat lots of turkey so you sleep through the list emails!

    I'll actually be working.

Good chance that I will be right there with you depending on a side job and when I get the content :) (Hi Boss if you're reading this! :))


--
Jason Pruim
[EMAIL PROTECTED]
616.399.2355




--- End Message ---
--- Begin Message ---
On Mon, Nov 24, 2008 at 3:05 PM, [EMAIL PROTECTED] <[EMAIL PROTECTED]>wrote:

>
> On Nov 24, 2008, at 3:00 PM, Daniel P. Brown wrote:
>
>  On Mon, Nov 24, 2008 at 2:49 PM, Wolf <[EMAIL PROTECTED]> wrote:
>>
>>>
>>> Sure Dan, just pad your metrics with yet another post...  :)
>>>
>>
>>    Much like you just did.  ;-P
>>
>
> Nahhh.... If we was going for that he would just get it stuck in an endless
> loop again and send hundreds of messages through the system :P
>
>>
>>  Have a good Thanksgiving as well!  Make sure to eat lots of turkey so you
>>> sleep through the list emails!
>>>
>>
>>    I'll actually be working.
>>
>
> Good chance that I will be right there with you depending on a side job and
> when I get the content :) (Hi Boss if you're reading this! :))
>
>
> --
> Jason Pruim
> [EMAIL PROTECTED]
> 616.399.2355
>
>
>
>
You could both still eat plenty of turkey while working!  Also, don't forget
the stuffing.

-- 
-Dan Joseph

www.canishosting.com - Plans start @ $1.99/month.

"Build a man a fire, and he will be warm for the rest of the day.
Light a man on fire, and will be warm for the rest of his life."

--- End Message ---
--- Begin Message ---
On Mon, 2008-11-24 at 15:04 -0500, Daniel Brown wrote:
> On Mon, Nov 24, 2008 at 3:00 PM, Ashley Sheridan
> <[EMAIL PROTECTED]> wrote:
> >>
> > What exactly are these metrics? Are they part of the mailing list?
> 
>     Yes, last year and earlier this year, before you began
> contributing to the list, there was a tracking system that displayed a
> simple report[1] each week for contributions to the General list.  One
> person at the time didn't want his email address displayed, so it was
> hidden from the weekly summary emails.
> 
>         1: Example: http://marc.info/?l=php-general&m=120431890502817&w=2
> 
> -- 
> </Daniel P. Brown>
> http://www.parasane.net/
> [EMAIL PROTECTED] || [EMAIL PROTECTED]
> 1 LEFT: $149/mo. $0 Setup - Dual-Core/320GB HDD/1GB RAM/3TB
> 100Mbps/cPanel - SAME-DAY SETUP! Contact me to buy.
> 
So how come it isn't on the php.net domain?


Ash
www.ashleysheridan.co.uk


--- End Message ---
--- Begin Message ---
On 24 Nov 2008, at 20:21, Ashley Sheridan wrote:
On Mon, 2008-11-24 at 15:04 -0500, Daniel Brown wrote:
On Mon, Nov 24, 2008 at 3:00 PM, Ashley Sheridan
<[EMAIL PROTECTED]> wrote:

What exactly are these metrics? Are they part of the mailing list?

   Yes, last year and earlier this year, before you began
contributing to the list, there was a tracking system that displayed a simple report[1] each week for contributions to the General list. One
person at the time didn't want his email address displayed, so it was
hidden from the weekly summary emails.

       1: Example: http://marc.info/?l=php-general&m=120431890502817&w=2

--
</Daniel P. Brown>
http://www.parasane.net/
[EMAIL PROTECTED] || [EMAIL PROTECTED]
1 LEFT: $149/mo. $0 Setup - Dual-Core/320GB HDD/1GB RAM/3TB
100Mbps/cPanel - SAME-DAY SETUP! Contact me to buy.

So how come it isn't on the php.net domain?

I think the question you meant to ask was "Is it official?". The answer is no, it's just something that Dan knocked up, but that doesn't make it any less interesting.

-Stut

--
http://stut.net/

--- End Message ---
--- Begin Message ---
On Mon, 2008-11-24 at 20:30 +0000, Stut wrote:
> On 24 Nov 2008, at 20:21, Ashley Sheridan wrote:
> > On Mon, 2008-11-24 at 15:04 -0500, Daniel Brown wrote:
> >> On Mon, Nov 24, 2008 at 3:00 PM, Ashley Sheridan
> >> <[EMAIL PROTECTED]> wrote:
> >>>>
> >>> What exactly are these metrics? Are they part of the mailing list?
> >>
> >>    Yes, last year and earlier this year, before you began
> >> contributing to the list, there was a tracking system that  
> >> displayed a
> >> simple report[1] each week for contributions to the General list.   
> >> One
> >> person at the time didn't want his email address displayed, so it was
> >> hidden from the weekly summary emails.
> >>
> >>        1: Example: http://marc.info/?l=php-general&m=120431890502817&w=2
> >>
> >> -- 
> >> </Daniel P. Brown>
> >> http://www.parasane.net/
> >> [EMAIL PROTECTED] || [EMAIL PROTECTED]
> >> 1 LEFT: $149/mo. $0 Setup - Dual-Core/320GB HDD/1GB RAM/3TB
> >> 100Mbps/cPanel - SAME-DAY SETUP! Contact me to buy.
> >>
> > So how come it isn't on the php.net domain?
> 
> I think the question you meant to ask was "Is it official?". The  
> answer is no, it's just something that Dan knocked up, but that  
> doesn't make it any less interesting.
> 
> -Stut
> 
> -- 
> http://stut.net/
> 
Oh certainly, I'm intrigued more than anything. How does it work? Are
the results collected from the email responses received?


Ash
www.ashleysheridan.co.uk


--- End Message ---
--- Begin Message ---
On 24 Nov 2008, at 20:35, Ashley Sheridan wrote:
On Mon, 2008-11-24 at 20:30 +0000, Stut wrote:
On 24 Nov 2008, at 20:21, Ashley Sheridan wrote:
On Mon, 2008-11-24 at 15:04 -0500, Daniel Brown wrote:
On Mon, Nov 24, 2008 at 3:00 PM, Ashley Sheridan
<[EMAIL PROTECTED]> wrote:

What exactly are these metrics? Are they part of the mailing list?

  Yes, last year and earlier this year, before you began
contributing to the list, there was a tracking system that
displayed a
simple report[1] each week for contributions to the General list.
One
person at the time didn't want his email address displayed, so it was
hidden from the weekly summary emails.

      1: Example: http://marc.info/?l=php-general&m=120431890502817&w=2

--
</Daniel P. Brown>
http://www.parasane.net/
[EMAIL PROTECTED] || [EMAIL PROTECTED]
1 LEFT: $149/mo. $0 Setup - Dual-Core/320GB HDD/1GB RAM/3TB
100Mbps/cPanel - SAME-DAY SETUP! Contact me to buy.

So how come it isn't on the php.net domain?

I think the question you meant to ask was "Is it official?". The
answer is no, it's just something that Dan knocked up, but that
doesn't make it any less interesting.

Oh certainly, I'm intrigued more than anything. How does it work? Are
the results collected from the email responses received?

I didn't write it, but I'd say it receives the emails sent to the list as a subscriber just like you and I do, logs the statistics and sends a weekly report to the list indicating the most active users.

-Stut

--
http://stut.net/

--- End Message ---
--- Begin Message ---
On Mon, 2008-11-24 at 20:45 +0000, Stut wrote:
> On 24 Nov 2008, at 20:35, Ashley Sheridan wrote:
> > On Mon, 2008-11-24 at 20:30 +0000, Stut wrote:
> >> On 24 Nov 2008, at 20:21, Ashley Sheridan wrote:
> >>> On Mon, 2008-11-24 at 15:04 -0500, Daniel Brown wrote:
> >>>> On Mon, Nov 24, 2008 at 3:00 PM, Ashley Sheridan
> >>>> <[EMAIL PROTECTED]> wrote:
> >>>>>>
> >>>>> What exactly are these metrics? Are they part of the mailing list?
> >>>>
> >>>>   Yes, last year and earlier this year, before you began
> >>>> contributing to the list, there was a tracking system that
> >>>> displayed a
> >>>> simple report[1] each week for contributions to the General list.
> >>>> One
> >>>> person at the time didn't want his email address displayed, so it  
> >>>> was
> >>>> hidden from the weekly summary emails.
> >>>>
> >>>>       1: Example: http://marc.info/?l=php-general&m=120431890502817&w=2
> >>>>
> >>>> -- 
> >>>> </Daniel P. Brown>
> >>>> http://www.parasane.net/
> >>>> [EMAIL PROTECTED] || [EMAIL PROTECTED]
> >>>> 1 LEFT: $149/mo. $0 Setup - Dual-Core/320GB HDD/1GB RAM/3TB
> >>>> 100Mbps/cPanel - SAME-DAY SETUP! Contact me to buy.
> >>>>
> >>> So how come it isn't on the php.net domain?
> >>
> >> I think the question you meant to ask was "Is it official?". The
> >> answer is no, it's just something that Dan knocked up, but that
> >> doesn't make it any less interesting.
> >>
> > Oh certainly, I'm intrigued more than anything. How does it work? Are
> > the results collected from the email responses received?
> 
> I didn't write it, but I'd say it receives the emails sent to the list  
> as a subscriber just like you and I do, logs the statistics and sends  
> a weekly report to the list indicating the most active users.
> 
> -Stut
> 
That's what I thought too, just wondering if Dan was willing to share
the methodology! ;) *hint*


Ash
www.ashleysheridan.co.uk


--- End Message ---
--- Begin Message ---
On Mon, Nov 24, 2008 at 3:45 PM, Stut <[EMAIL PROTECTED]> wrote:
>
> I didn't write it, but I'd say it receives the emails sent to the list as a
> subscriber just like you and I do, logs the statistics and sends a weekly
> report to the list indicating the most active users.

    Sorry, had to run away for a meeting quick.

    Yes, Stut is right.  It receives the emails via stdin, parses them
accordingly, and stores them in the database.  Then each week, on a
cron, the data is processed from the database and emailed back to the
list in summary form.  With version 2, it'll have graphic displays on
the web, too, as well as more statistics.

    Most likely in January 2009, once Richard and I have gotten a
chance to plug in the RGraph stuff and this version of the code has
had some polish, it'll go open source for whomever wants to use it.
There was a lot of interest with the original version, and some folks
are using it around the web, but there was a lot of room for
improvement, too.  Which is what this will do - and without looking
like spaghetti.  ;-P

    It's an extremely simple system, by all accounts.  Nothing that's
going to change the world.

-- 
</Daniel P. Brown>
http://www.parasane.net/
[EMAIL PROTECTED] || [EMAIL PROTECTED]
1 LEFT: $149/mo. $0 Setup - Dual-Core/320GB HDD/1GB RAM/3TB
100Mbps/cPanel - SAME-DAY SETUP! Contact me to buy.

--- End Message ---
--- Begin Message ---
Daniel Brown wrote:
    Folks;

    Just as a reminder, the PostTrack/ListWatch system is back to
recording and reporting data on the list for the Friday summary
reports and list metrics.  If you do not want your email address to
show up in the reports and have not already told me, please let me
know ASAP and I will permanently remove you from the reports.  Note
that this will *NOT* unsubscribe you from the list, just keep you from
showing metrics in the weekly reports.

    Thanks, all.  And a happy upcoming holiday to my fellow US Americans.

    Everyone stay safe.


I keep hitting reply all in newsgroup view in dunderbird (habit from replying via email) - and when i do it's sends in twice. Will these dup's be filtered out from the count or not?

+glad to hear it's coming back - nice little system

--- End Message ---
--- Begin Message ---
On Mon, Nov 24, 2008 at 10:02 AM, Stut <[EMAIL PROTECTED]> wrote:

> On 24 Nov 2008, at 14:41, Stan wrote:
>
>> Shouting is something that happens when people are actually speaking and
>> listening.  In a medium where there is no other way to emphasize salient
>> points in a message, capitalization is all that works.  I'm sorry it
>> offended your sensabilities.
>>
>
> It's actually well-established that capital letters indicate shouting. To
> emphasise words or phrases you should surround them with _ or *. The is also
> common practice.
>
>
>  realpath() fails, just like file_exists() fails, to report the file as
>> non-existant.
>>
>> echo "realpath(\$basePicture) returns '" . realpath($basePicture) .
>> "'<br>\n";
>> echo "when \$basePicture is '" . $basePicture . "'<br>\n";
>> -------------------------------------------------------------------
>> generates
>> -------------------------------------------------------------------
>> realpath($basePicture) returns '/Stan-and-Jeanne.com/pictures/2008 west
>> coast trip/2008-06-10 first week at Chris'/DSC_0011.jpg'
>> when $basePicture is '../pictures/2008 west coast trip/2008-06-10 first
>> week
>> at Chris'/DSC_0011.jpg'
>> -------------------------------------------------------------------
>> but ls DSC_0011.* in ../pictures/2008 west coast trip/2008-06-10 first
>> week
>> at Chris' returns only
>> -------------------------------------------------------------------
>> DSC_0011.JPG
>> -------------------------------------------------------------------
>> and
>> -------------------------------------------------------------------
>> try {$image = new IMagick($basePicture);
>> } catch (Exception $e) {
>>   echo 'Caught exception: ',  $e->getMessage(), "\n";
>> }
>> -------------------------------------------------------------------
>> results in
>> -------------------------------------------------------------------
>> Caught exception: unable to open image `/Stan-and-Jeanne.com/pictures/2008
>> west coast trip/2008-06-10 first week at Chris'/DSC_0011.jpg': No such
>> file
>> or directory
>> -------------------------------------------------------------------
>> so ... the following takes care of the extension problem in a very time
>> expensive way
>> -------------------------------------------------------------------
>> try
>> {
>> $image = new IMagick($basePicture);
>> }
>> catch (Exception $e)
>> {
>> $basePicture =
>>  substr($basePicture, 0, strrpos($basePicture, ".")) .
>>  "." .
>>  strtoupper(substr($basePicture, strrpos($basePicture, ".") + 1));
>> }
>> unset($image);
>> -------------------------------------------------------------------
>> I don't actually consider this solved and I'll return to it after
>> everything
>> else at least works.
>>
>> Now I can proceed to my next problem.
>>
>
> You never answered one of my questions. Where are you getting $basePicture
> from? Why does it differ in case from the actual file on disk. If you ask me
> you'd be better off trying to resolve this problem further upstream at the
> point where the case gets changed but your workflow doesn't appear to notice
> it.
>
> -Stut
>
> --
> http://stut.net/
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
why not just create a small script that will move the files into the correct
folder from a temp storage spot and rename them to lowercase, then you are
always dealing with the same case and it should make things easier for you.

-- 

Bastien

Cat, the other other white meat

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

This post has also been posted on the Debian list.

I have two different Debian Etch machines running with the exact same
packages installed, when I use PHP memcached with compression (zlib) it
works at one machine but not the other. No errors are thrown. 

I need to know why it is only working on one machine and not the other.

I am talking about the MEMCACHE_COMPRESSED flag if anyone knows about
this.

I am using this small script to test with:

<?php
        error_reporting(E_ALL);

        $memcached = new Memcache;

        $memcached->connect('localhost', 11211);

        $version = $memcached->getVersion();
        print ("<p>Memcached version: ".$version."</p>");

//      $memcached->flush();

        $output = $memcached->get('var_key');

        if (empty($output)) {

                $memcached->set('var_key', 'Hello I am Memcached',
MEMCACHE_COMPRESSED, 3600);

                print ("Memcached has just been set!");

        } else {

                print ("Memcached is already set with this value:
$output");

        }
?>

If I disable the compression flag (using the 'false' value or zero
value) on the failing machine, all works correctly, but when I enable
it like in the above script it fails without error.

I have also tried running memcached with "-vv" options, and checked the
log, but no errors show up.

I am suspecting that zlib isn't working right on the failing machine,
but using phpinfo() it shows that zlib is enabled.

On both machines the following packages are installed:

ii  libcompress-zlib-perl       1.42-2  
ii libio-zlib-perl              1.04-1
ii zlib1g                       1.2.3-13

ii  libapache2-mod-php5         5.2.0-8+etch13
ii php5                         5.2.0-8+etch13
ii php5-common                  5.2.0-8+etch13
ii php5-gd                      5.2.0-8+etch13
ii  php5-imagick                0.9.11+1-4.1
ii php5-memcache                2.0.1-1.1
ii  php5-mysql                  5.2.0-8
+etch13 
ii php5-pgsql                   5.2.0-8+etch13

Any help in understanding what is going on would be greatly
appreciated.

Best regards.

Rico






--- End Message ---
--- Begin Message ---
Try debug_backtrace()

Rico Secada wrote:
Hi.

This post has also been posted on the Debian list.

I have two different Debian Etch machines running with the exact same
packages installed, when I use PHP memcached with compression (zlib) it
works at one machine but not the other. No errors are thrown.
I need to know why it is only working on one machine and not the other.

I am talking about the MEMCACHE_COMPRESSED flag if anyone knows about
this.

I am using this small script to test with:

<?php
        error_reporting(E_ALL);

        $memcached = new Memcache;

        $memcached->connect('localhost', 11211);

        $version = $memcached->getVersion();
        print ("<p>Memcached version: ".$version."</p>");

//      $memcached->flush();

        $output = $memcached->get('var_key');

        if (empty($output)) {

                $memcached->set('var_key', 'Hello I am Memcached',
MEMCACHE_COMPRESSED, 3600);

                print ("Memcached has just been set!");

        } else {

                print ("Memcached is already set with this value:
$output");

        }
?>

If I disable the compression flag (using the 'false' value or zero
value) on the failing machine, all works correctly, but when I enable
it like in the above script it fails without error.

I have also tried running memcached with "-vv" options, and checked the
log, but no errors show up.

I am suspecting that zlib isn't working right on the failing machine,
but using phpinfo() it shows that zlib is enabled.

On both machines the following packages are installed:

ii libcompress-zlib-perl 1.42-2 ii libio-zlib-perl 1.04-1
ii zlib1g                       1.2.3-13

ii  libapache2-mod-php5         5.2.0-8+etch13
ii php5                         5.2.0-8+etch13
ii php5-common                  5.2.0-8+etch13
ii php5-gd                      5.2.0-8+etch13
ii  php5-imagick                0.9.11+1-4.1
ii php5-memcache                2.0.1-1.1
ii  php5-mysql                  5.2.0-8
+etch13 ii php5-pgsql 5.2.0-8+etch13

Any help in understanding what is going on would be greatly
appreciated.

Best regards.

Rico






--- End Message ---
--- Begin Message ---
On Mon, 24 Nov 2008 15:13:32 -0500
Al <[EMAIL PROTECTED]> wrote:

> Try debug_backtrace()

Thanks for your reply.

I get an empty array:

array(0) { } 
 
> Rico Secada wrote:
> > Hi.
> > 
> > This post has also been posted on the Debian list.
> > 
> > I have two different Debian Etch machines running with the exact
> > same packages installed, when I use PHP memcached with compression
> > (zlib) it works at one machine but not the other. No errors are
> > thrown. 
> > 
> > I need to know why it is only working on one machine and not the
> > other.
> > 
> > I am talking about the MEMCACHE_COMPRESSED flag if anyone knows
> > about this.
> > 
> > I am using this small script to test with:
> > 
> > <?php
> >     error_reporting(E_ALL);
> > 
> >     $memcached = new Memcache;
> > 
> >     $memcached->connect('localhost', 11211);
> > 
> >     $version = $memcached->getVersion();
> >     print ("<p>Memcached version: ".$version."</p>");
> > 
> > //  $memcached->flush();
> > 
> >     $output = $memcached->get('var_key');
> > 
> >     if (empty($output)) {
> > 
> >             $memcached->set('var_key', 'Hello I am Memcached',
> > MEMCACHE_COMPRESSED, 3600);
> > 
> >             print ("Memcached has just been set!");
> > 
> >     } else {
> > 
> >             print ("Memcached is already set with this value:
> > $output");
> > 
> >     }
> > ?>
> > 
> > If I disable the compression flag (using the 'false' value or zero
> > value) on the failing machine, all works correctly, but when I
> > enable it like in the above script it fails without error.
> > 
> > I have also tried running memcached with "-vv" options, and checked
> > the log, but no errors show up.
> > 
> > I am suspecting that zlib isn't working right on the failing
> > machine, but using phpinfo() it shows that zlib is enabled.
> > 
> > On both machines the following packages are installed:
> > 
> > ii  libcompress-zlib-perl       1.42-2  
> > ii libio-zlib-perl              1.04-1
> > ii zlib1g                       1.2.3-13
> > 
> > ii  libapache2-mod-php5     5.2.0-8+etch13
> > ii php5                     5.2.0-8+etch13
> > ii php5-common              5.2.0-8+etch13
> > ii php5-gd                  5.2.0-8+etch13
> > ii  php5-imagick            0.9.11+1-4.1
> > ii php5-memcache            2.0.1-1.1
> > ii  php5-mysql                      5.2.0-8
> > +etch13 
> > ii php5-pgsql               5.2.0-8+etch13
> > 
> > Any help in understanding what is going on would be greatly
> > appreciated.
> > 
> > Best regards.
> > 
> > Rico
> > 
> > 
> > 
> > 
> > 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 



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

i would ask what is the best method for random select from database. I have table with 20k items..

-   If i use ,,select * from table order by rand() limit 3", the query
        took 0.0524 sec ... its slightly enough

-   but if i generate rand id and then i use ,,select .... where id
        in(rand1, rand2, rand3), the query took only 0.0005 sec, but            
        there is a problem that id doesnt exist


thanks for responses

--- End Message ---
--- Begin Message ---
Korgan wrote:
Hi,

i would ask what is the best method for random select from database. I have table with 20k items..

-   If i use ,,select * from table order by rand() limit 3", the query
    took 0.0524 sec ... its slightly enough

and as your table grows in size, it gets slower and slower.

Try this:

http://edrackham.com/featured/get-random-row-with-mysql-without-order-by-rand/

There are other suggestions out there too, search for "mysql don't use random()".

--
Postgresql & php tutorials
http://www.designmagick.com/


--- End Message ---
--- Begin Message ---
For large tables, I generally create a "static_rand" column, and pre-populated 
it with random numbers and create an index on it.



Then, after "using up" the records, I have application logic to reset those 
records (and only those records) to new random numbers.



This provides MUCH better performance than using rand() on huge tables.



alter table whatever add static_rand float;

create index rand_index on whatever(static_rand);



select id from whatever order by static_rand limit 3;



-- PHP code to create an array of the 3 IDs you got:

$ids_sql = implode(',', $ids);

$query = "update whatever set static = rand() where id in ($ids_sql)";



It's a bit crude in that you have to remember to do the UPDATE, but quite fast, 
and not THAT tricky to modularize your code to always do the UPDATE.



Or not, actually, if it's okay to "cache" the random answer for a short period 
of time.  Then you can just have a cron job that does:

update whatever set static_rand = rand() order by static_rand limit 3;



--- End Message ---
--- Begin Message ---
thx it looks good

[EMAIL PROTECTED] napsal(a):
For large tables, I generally create a "static_rand" column, and pre-populated 
it with random numbers and create an index on it.

Then, after "using up" the records, I have application logic to reset those 
records (and only those records) to new random numbers.

This provides MUCH better performance than using rand() on huge tables.

alter table whatever add static_rand float;
create index rand_index on whatever(static_rand);

select id from whatever order by static_rand limit 3;

-- PHP code to create an array of the 3 IDs you got:
$ids_sql = implode(',', $ids);
$query = "update whatever set static = rand() where id in ($ids_sql)";

It's a bit crude in that you have to remember to do the UPDATE, but quite fast, 
and not THAT tricky to modularize your code to always do the UPDATE.

Or not, actually, if it's okay to "cache" the random answer for a short period 
of time.  Then you can just have a cron job that does:
update whatever set static_rand = rand() order by static_rand limit 3;


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

So, I was working on my framework today, and noticed unfortunately that PHP does not allow using the magic method __get for static variables. There is a patch available, but I'm not sure how long it will be before it makes it into the stable PHP release.

Anyway, my question is about what route I should take now.

The reason I was looking for this was for the built in template engine. I expected to be able to put in a page

{HTML::$variable1}
or
{self::$variable1}

and have it evaluate using native PHP variables, instead of doing a large number of PHP str_replace for text based variables, a process which is surely slower.

As I see it, my options are:

Create

public static function get($fpName)

And have my templates littered with the extra

{HTML::get(variable1)}

OR

use PHP str_replace based variable parsing creating what I imagine would be a significantly higher overhead.

What would you do?

- Craige



--- End Message ---
--- Begin Message ---
> What would you do?

I think PHP's string functions are pretty fast and even with large
documents we are talking about a couple of extra microseconds on a
modern machine. I once saw someone do pretty much the same as you are
trying to do with strtr() [1], but I don't know if that function is
faster than str_replace(). You should also consider that if you
framework is going to manage someone's site one day then it could
possibly be on a server with an older PHP version. I disagree with
those on the list saying one should just stick to an existing
templating framework, since it can be quite exciting to think some
neat thingy out. Of course, most people (including me) hardly have any
time at all to spend 1000s of hours on a more or less private project.

[1] http://in.php.net/manual/en/function.strtr.php

--- End Message ---

Reply via email to