php-general Digest 26 Jun 2007 02:01:58 -0000 Issue 4869

Topics (messages 257752 through 257768):

Re: UI toolkit
        257752 by: David Giragosian

Re: Setting Different Temp Directory for Different Application Users
        257753 by: Al
        257755 by: Jim Lucas

Re: path finder
        257754 by: Jim Lucas

Re: Aggressive PHP Smart Caching
        257756 by: Crayon Shin Chan

Byte conversion
        257757 by: Eric Butera
        257758 by: Tijnema
        257759 by: Stut
        257760 by: Eric Butera
        257761 by: Robin Vickery
        257762 by: Eric Butera

Re: Convert Date time into Seconds
        257763 by: Dan

Re: Php script diagnostic app?
        257764 by: William Lovaton

Create .php file with php
        257765 by: Marius Toma
        257766 by: Daniel Brown
        257767 by: Daniel Brown

using CURL or something similar to click on a link
        257768 by: Siavash Miri

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 ---
On 6/24/07, Nathan Nobbe <[EMAIL PROTECTED]> wrote:

Darren,

I recently discovered php5 bindings to qt4
http://www.php-qt.org

although qt is currently leveraged by kde primarily it has been converted
to
a cmake build system instead of a make build system which supposedly will
enable cross platform capabilities.  kde apps will be running on windows
and
what not.
though im not sure what sort of time line all that stuff is on, i know it
is
in the works; and i personally prefer qt/kde over gtk/gnome :)

afaik there are no bindings available for windows ui scripting w/ php

-nathan


Maybe   -->   http://winbinder.org/

David

--- End Message ---
--- Begin Message ---
Doesn't this do what you want?

tempnam ( string dir, string prefix )

[EMAIL PROTECTED] wrote:
Hi All,


I want to set different temp directory to every users of my application. Is it possible. TEMP_DIR is only configurable at system level, so I can do it only in PHP.INI or in apache as PHP_VALUE.

Any Idea how this can be achieved using combination of things?

Thanks in Advance.

Zareef Ahmed

--- End Message ---
--- Begin Message ---
[EMAIL PROTECTED] wrote:
Hi All,


I want to set different temp directory to every users of my application. Is it possible. TEMP_DIR is only configurable at system level, so I can do it only in PHP.INI or in apache as PHP_VALUE.

Any Idea how this can be achieved using combination of things?

Thanks in Advance.

Zareef Ahmed

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


Are you trying to keep user data/files separate?

What are you trying to accomplish?

--
Jim Lucas

   "Some men are born to greatness, some achieve greatness,
       and some have greatness thrust upon them."

Twelfth Night, Act II, Scene V
    by William Shakespeare

--- End Message ---
--- Begin Message ---
elk dolk wrote:
  Hi all,
    When I test my photo album in my IIS testing server relative path in the 
following code works fine :
    echo "<div class='cccc'><img src='/img/{$photoFileName}' width='120' height='160' 
border='0' /></div> ";
    but when I upload it to the web server I don’t see my photos, my  /home 
directory on the web server contains
  public_ftp and public_html where my web site is stored I modify the path to 
this :
    echo "<div class='cccc'><img src='/home/public_html/img/{$photoFileName}' width='120' 
height='160' border='0' /></div> ";
it doesn’t function please comment ---------------------------------
Fussy? Opinionated? Impossible to please? Perfect.  Join Yahoo!'s user panel 
and lay it on us.

Sounds to me as though the public_html/document_root is different on the two 
boxes.

try taking the '/' off the beginning part of the src='' link

This link is base from the web root
        src='/img/{$photoFileName}'

This link is base on relative path
        src='img/{$photoFileName}'


This might help

--
Jim Lucas

   "Some men are born to greatness, some achieve greatness,
       and some have greatness thrust upon them."

Twelfth Night, Act II, Scene V
    by William Shakespeare

--- End Message ---
--- Begin Message ---
On Monday 25 June 2007 11:55, Nathan Nobbe wrote:

>    - why cache script output on disk?  if a fast cache is your goal,
> why not store the result of script output in memory rather than on
> disk; that would be much faster

Under most OSs whatever is on disk will end up cached in memory sooner or 
later. So depending on your application there might not be much 
performance difference either way.

-- 
Crayon

--- End Message ---
--- Begin Message ---
I've been trying to figure out a way to do this all day and I'm afraid
I might need a bit of help.  Basically I am trying to port over
something from Java to PHP and I'm stuck on one particular piece of
code:

if ((ba[i + 0] == (byte)0xa7) && (ba[i + 1] == (byte)0x51)) {

The code is looping through a byte array and checking if the current
value matches "(byte)0xa7", etc.  If there is a match, then it breaks
and returns the value of i.  There are quite a few more values than
this in the conditional, but I figure this is enough to get the point
across.  My problem is I'm not exactly sure what the value of
(byte)0xa7 is.

I tried
$buffer = file_get_contents('Dining_Room.rti');
$count = strlen($buffer);
for ($x=0; $x < $count; $x++) {
        $char = substr($buffer, $x, 1);
        echo $char;
        if ($char == 0xa7 && $char == 0x51) {
           return $x;
        }
}

but it never matches.  Any pointers?

--- End Message ---
--- Begin Message ---
On 6/25/07, Eric Butera <[EMAIL PROTECTED]> wrote:
I've been trying to figure out a way to do this all day and I'm afraid
I might need a bit of help.  Basically I am trying to port over
something from Java to PHP and I'm stuck on one particular piece of
code:

if ((ba[i + 0] == (byte)0xa7) && (ba[i + 1] == (byte)0x51)) {

The code is looping through a byte array and checking if the current
value matches "(byte)0xa7", etc.  If there is a match, then it breaks
and returns the value of i.  There are quite a few more values than
this in the conditional, but I figure this is enough to get the point
across.  My problem is I'm not exactly sure what the value of
(byte)0xa7 is.

I tried
$buffer = file_get_contents('Dining_Room.rti');
$count = strlen($buffer);
for ($x=0; $x < $count; $x++) {
       $char = substr($buffer, $x, 1);
       echo $char;
       if ($char == 0xa7 && $char == 0x51) {
          return $x;
       }
}

but it never matches.  Any pointers?


$char contains a token at the point, and you can't compare that with a
hex value AFAIK.
You could use ord[1] to get the ASCII value of $char, and compare it
with the decimal value of 0xA7(167) and 0x51(81).

Tijnema

[1] http://www.php.net/ord

--
Vote for PHP Color Coding in Gmail! -> http://gpcc.tijnema.info

--- End Message ---
--- Begin Message ---
Eric Butera wrote:
I've been trying to figure out a way to do this all day and I'm afraid
I might need a bit of help.  Basically I am trying to port over
something from Java to PHP and I'm stuck on one particular piece of
code:

if ((ba[i + 0] == (byte)0xa7) && (ba[i + 1] == (byte)0x51)) {

The code is looping through a byte array and checking if the current
value matches "(byte)0xa7", etc.  If there is a match, then it breaks
and returns the value of i.  There are quite a few more values than
this in the conditional, but I figure this is enough to get the point
across.  My problem is I'm not exactly sure what the value of
(byte)0xa7 is.

I tried
$buffer = file_get_contents('Dining_Room.rti');
$count = strlen($buffer);
for ($x=0; $x < $count; $x++) {
    $char = substr($buffer, $x, 1);
    echo $char;
    if ($char == 0xa7 && $char == 0x51) {

This is *never* going to be true, mainly because $char cannot be equal to both 0xA7 *and* 0x51 at the same time.

       return $x;
    }
}

but it never matches.  Any pointers?

Yeah, understand the code before attempting to port it. The if you posted at the top is trying to find 0xA7 followed by 0x51. Your ported code is not.

Try this...

$buffer = file_get_contents('Dining_Room.rti');
$count = strlen($buffer);
for ($x=0; $x < $count; $x++) {
    $char1 = substr($buffer, $x, 1);
    $char2 = substr($buffer, $x+1, 1);
    echo $char1;
    if ($char1 == 0xa7 && $char2 == 0x51) {
       return $x;
    }
}

-Stut

--
http://stut.net/

--- End Message ---
--- Begin Message ---
On 6/25/07, Stut <[EMAIL PROTECTED]> wrote:
Eric Butera wrote:
> I've been trying to figure out a way to do this all day and I'm afraid
> I might need a bit of help.  Basically I am trying to port over
> something from Java to PHP and I'm stuck on one particular piece of
> code:
>
> if ((ba[i + 0] == (byte)0xa7) && (ba[i + 1] == (byte)0x51)) {
>
> The code is looping through a byte array and checking if the current
> value matches "(byte)0xa7", etc.  If there is a match, then it breaks
> and returns the value of i.  There are quite a few more values than
> this in the conditional, but I figure this is enough to get the point
> across.  My problem is I'm not exactly sure what the value of
> (byte)0xa7 is.
>
> I tried
> $buffer = file_get_contents('Dining_Room.rti');
> $count = strlen($buffer);
> for ($x=0; $x < $count; $x++) {
>     $char = substr($buffer, $x, 1);
>     echo $char;
>     if ($char == 0xa7 && $char == 0x51) {

This is *never* going to be true, mainly because $char cannot be equal
to both 0xA7 *and* 0x51 at the same time.

>        return $x;
>     }
> }
>
> but it never matches.  Any pointers?

Yeah, understand the code before attempting to port it. The if you
posted at the top is trying to find 0xA7 followed by 0x51. Your ported
code is not.

Try this...

$buffer = file_get_contents('Dining_Room.rti');
$count = strlen($buffer);
for ($x=0; $x < $count; $x++) {
     $char1 = substr($buffer, $x, 1);
     $char2 = substr($buffer, $x+1, 1);
     echo $char1;
     if ($char1 == 0xa7 && $char2 == 0x51) {
        return $x;
     }
}

-Stut

--
http://stut.net/


Oops!  I'm actually not doing that exactly.  I just wanted a simple
example to get the point across.  I should have checked my work twice.
The main goals of my post were to find out if a literal 0xa7 is ok to
compare with, and if that value would be the equivalent the Java
typecast (byte)0xa7.

--- End Message ---
--- Begin Message ---
On 25/06/07, Eric Butera <[EMAIL PROTECTED]> wrote:
I've been trying to figure out a way to do this all day and I'm afraid
I might need a bit of help.  Basically I am trying to port over
something from Java to PHP and I'm stuck on one particular piece of
code:

if ((ba[i + 0] == (byte)0xa7) && (ba[i + 1] == (byte)0x51)) {
[...]
I tried
[...]
        if ($char == 0xa7 && $char == 0x51) {
[...]
but it never matches.  Any pointers?

$char can't have two values at once...

-robin

--- End Message ---
--- Begin Message ---
On 6/25/07, Tijnema <[EMAIL PROTECTED]> wrote:
On 6/25/07, Eric Butera <[EMAIL PROTECTED]> wrote:
> I've been trying to figure out a way to do this all day and I'm afraid
> I might need a bit of help.  Basically I am trying to port over
> something from Java to PHP and I'm stuck on one particular piece of
> code:
>
> if ((ba[i + 0] == (byte)0xa7) && (ba[i + 1] == (byte)0x51)) {
>
> The code is looping through a byte array and checking if the current
> value matches "(byte)0xa7", etc.  If there is a match, then it breaks
> and returns the value of i.  There are quite a few more values than
> this in the conditional, but I figure this is enough to get the point
> across.  My problem is I'm not exactly sure what the value of
> (byte)0xa7 is.
>
> I tried
> $buffer = file_get_contents('Dining_Room.rti');
> $count = strlen($buffer);
> for ($x=0; $x < $count; $x++) {
>        $char = substr($buffer, $x, 1);
>        echo $char;
>        if ($char == 0xa7 && $char == 0x51) {
>           return $x;
>        }
> }
>
> but it never matches.  Any pointers?
>

$char contains a token at the point, and you can't compare that with a
hex value AFAIK.
You could use ord[1] to get the ASCII value of $char, and compare it
with the decimal value of 0xA7(167) and 0x51(81).

Tijnema

[1] http://www.php.net/ord

--
Vote for PHP Color Coding in Gmail! -> http://gpcc.tijnema.info


Tijnema,

I've tried building up a variable with ord called on each value as I
append it.  When this is built I cannot find the sequence 167 81, etc
in it.

I've also tried using bin2hex on the entire buffer and checking for a7
51 to no avail.

--- End Message ---
--- Begin Message --- Also if you're planning on doing regular math with the outputs it's pretty easy to check if it's been 24 hours if you're using a unix time stamp, if((larger - smaller) >= 86400) do something. ""kvigor"" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]
Cool,

Like Ambien, It worked like a dream.


"Robert Cummings" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]
On Sat, 2007-06-23 at 21:29 -0500, kvigor wrote:
Good Day,

I'm chech if 24hrs has passed between these 2 datetimes:

$dTime1 = 2007-06-21 11:08:09;

$dTime2 = 2007-06-22 07:08:09;

I'd really like to convert the datetimes above into a format I can do
regular math them.

<?php

echo ($foo = strtotime( '2007-06-21 11:08:09' ))."\n";
echo date( 'Y/m/d H:i:s', $foo )."\n";

?>

$foo contains a unix timestamp (the time in seconds since the Epoch).

Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for       |
| creating re-usable components quickly and easily.          |
`------------------------------------------------------------'


--- End Message ---
--- Begin Message ---
If you have little knowledge about C you can use sysprof on a relatively
new Linux distribution and you can see on a live system where the CPU is
consumed the most.

[] http://www.daimi.au.dk/~sandmann/sysprof/
[] http://live.gnome.org/Sysprof

With a little help of Google you can map C functions to the PHP
equivalents and this way you can get a bit more of understanding about
what is going on in your code.

Finally, xdebug is real nice too.


-William


On Sun, 2007-06-17 at 13:35 -0400, MIKE YRABEDRA wrote:
> 
> I was wondering if there was some kind of application that would process a
> php script, logging any functions (or classes) it encounters along the way.
> Logging times and memory use.
> 
> I am trying to figure out what in a script slows it down so much.
> 
> Any ideas?
> 
> 
> -- 
> Mike Yrabedra B^)>
> 

--- End Message ---
--- Begin Message --- I can not create .php files from PHP. I can save them as *.php5, *.php3, asp, *.txt , etc... but not as .php. I tried both touch and fopen but
none of them worked.

I'm running PHP 5.1.6 on Apache 2, safe_mode is off

Is this a security measure somewhere? How can I bypass it?

Thank you,
Marius

--- End Message ---
--- Begin Message ---
On 6/25/07, Marius Toma <[EMAIL PROTECTED]> wrote:
I can not create .php files from PHP. I can save them as *.php5, *.php3,
asp, *.txt , etc... but not as .php. I tried both touch and fopen but
none of them worked.

I'm running PHP 5.1.6 on Apache 2, safe_mode is off

Is this a security measure somewhere? How can I bypass it?

Thank you,
Marius

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



   I doubt it will help you, but with a default installation of 5.2.2
on a Linux box (fresh install), I was able to do this from the CLI
with no issues whatsoever:
<?
       $handle = fopen('writetest.php','w');
       fwrite($handle,"This is a test.");
?>

   I know that you said that you were able to write a file, but are
you using the correct parameters in your .php writes to create or
append to a file (as needed), and are the write permissions set
properly for the exact directory to which you're attempting to write?


--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107

--- End Message ---
--- Begin Message ---
   Hmm.... Google gave me an error when sending before.

---------- Forwarded message ----------
From: Daniel Brown <[EMAIL PROTECTED]>
Date: Jun 25, 2007 8:28 PM
Subject: Re: [PHP] Create .php file with php
To: Marius Toma <[EMAIL PROTECTED]>
Cc: [EMAIL PROTECTED]


On 6/25/07, Marius Toma <[EMAIL PROTECTED]> wrote:
I can not create .php files from PHP. I can save them as *.php5, *.php3,
asp, *.txt , etc... but not as .php. I tried both touch and fopen but
none of them worked.

I'm running PHP 5.1.6 on Apache 2, safe_mode is off

Is this a security measure somewhere? How can I bypass it?

Thank you,
Marius

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



   I doubt it will help you, but with a default installation of 5.2.2
on a Linux box (fresh install), I was able to do this from the CLI
with no issues whatsoever:
<?
       $handle = fopen('writetest.php','w');
       fwrite($handle,"This is a test.");
?>

   I know that you said that you were able to write a file, but are
you using the correct parameters in your .php writes to create or
append to a file (as needed), and are the write permissions set
properly for the exact directory to which you're attempting to write?


--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107


--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107

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


I just recently started writing a php script that would get some search
results from some other sites and display them.

I believe the only php way to do this is using CURL. am I correct?? or is
there a more efficient way to do this?



Anyways, i got it working fine with curl, except one site where I need to
click on a link before doing the search. I can't find a way to click on a
link using CURL. is this possible?


Thanks in advance,
Siavash

--- End Message ---

Reply via email to