Re: [PHP] Re: Stumped! 4.x to 5.1 problem!!

2006-07-26 Thread Jochem Maas
markw@mohawksoft.com wrote:
 markw@mohawksoft.com wrote:
 [snip]
 seems the perceived problem is being caused by something else?

 Sorry, I have to respectfully disagree.
 ok :-).
 
 Men of integrity must be able to disgree peacefully. :-)
 

:-)

 
 Well, the point I was trying to make was that there are other extensions,
 like wddx, that do the same thing, and people should know about it.

extension are version specific so maybe other extension writers/maintainers
have already made the required changes for 5.x version of their work.

you might consider asking the internals mailing list for insight into
the change you perceived, what you *may* have been doing wrong, and/or what
you should be doing to make things works as expected for 5.x.

(I say '*may*' because I have no real knowledge of the engines internals what
so ever)

there are very few people on this list with the requisite engine level
experience/knowledge to help you in a useful way; those that do are more than
likely a to be on the internals list (and more likely to respond to posts made 
there)

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



[PHP] pop up save dialog box

2006-07-26 Thread weetat

Hi all,

 I have code below which save MYSQL to csv file. I am using ADODB 
library to do this.


 The saving MYSQL to csv file is ok .
 However i need to allow the the user to enter file name for csv file.

 Anybody have any ideas how to do this? Thanks


$sql = $_SESSION['CSV_SQL'];
$_logger = new Log4jLogger();
$_logger-logdebug('sql:', $sql);

if (!isset($_REQUEST['maintainall'])) {
$filename = 'tbl_chassis.csv';
CSVUtil::UploadTbtoCSV($sql, $filename);
unset($_SESSION['CSV_SQL']);
header('Location: ../maintain.php?csv');
exit;
} else {
//$sql = 'SELECT * from tbl_card';
$filename = 'tbl_card.csv';
CSVUtil::UploadTbtoCSV($sql, $filename);
unset($_SESSION['CSV_SQL']);
header('Location: ../maintainall.php?csv');
exit;
}

function UploadTbtoCSV($sqltext,$filename)
{
$_logger = new Log4jLogger();
$_logger-logdebug(starting.. upload tb to csv);

$rs = dbQuery($sqltext);
$rs-MoveFirst();
$_logger-logdebug(UploadTbtoCSV csvpath:,CSV_PATH);

$fp = fopen(CSV_PATH./.$filename, w);

if ($fp) {
rs2csvfile($rs, $fp);
fclose($fp);
$_logger-logdebug(starting upload tb to csv done);
}



}

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



Re: [PHP] Efficiency question

2006-07-26 Thread Rory Browne

For something like that that, unless you are doing it inside a loop, I
wouldn't really worry about efficiency as much as I would about security

On 7/26/06, Paul Scott [EMAIL PROTECTED] wrote:



I have googled around a bit, but not really found anything useful...

Which is more efficient? A case switch or a $$method style method?

An example:

switch($action) {
case 'edit':
  //do some stuff
  ...
  return edit_tpl.php;

case 'whatever':
  //blah
  ..
  ..
}

OR:

$method=$this-convertToMethod($action);
unset($action);
return $this-$method();

Hope this is reasonably clear... Note the return on the latter code.

If anyone has any ideas around this, please let me know! Are there
underlying security risks in doing it this way?

--Paul



All Email originating from UWC is covered by disclaimer
http://www.uwc.ac.za/portal/uwc2006/content/mail_disclaimer/index.htm



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




[PHP] Big files management

2006-07-26 Thread Yannick Warnier
Hi there,

I'm trying to deal with big files (over 4GB) with PHP4.3.9 ans PHP4.4
but obviously it's not really possible.

Is there a library somewhere that allows elementary operations on these
kinds of files by, for example, using the operating systems commands
(Linux in this case)?

Or any other solution?

Thanks,

Yannick

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



Re: [PHP] Efficiency question

2006-07-26 Thread Jochem Maas
Paul Scott wrote:
 I have googled around a bit, but not really found anything useful...
 
 Which is more efficient? A case switch or a $$method style method?
 

both examples are just boilerplate 'frontcontroller' code that do pretty much 
nothing
of themselves.

- in terms of speed you will notice nothing. in principle OO code is a little 
slower
because creating objects has quite a lot of overhead as compared to just calling
functions (if your just creating 1 or 2 objects it's not measurable) - but then
it all depends on what the code inside object/function actually does!

 An example:
 
 switch($action) {
 case 'edit':
   //do some stuff
   ...
   return edit_tpl.php;
 
 case 'whatever':
   //blah
   ..
   ..
 }
 
 OR:
 
 $method=$this-convertToMethod($action);

my guess is that there will be a switch statement in convertToMethod()
to 'convert' $action into $method. so it effectively does what you example 
switch()
is doing.

ask yourself whether you prefer to hide some of the complexity of what your
scripts are doing inside the bowels of an object - or whether you prefer to
use procedural code. either is fine, it's up to you - just make sure you write 
neat,
well-documented  properly thoughtout code and even the guy that has to 
maintain your
stuff 2 years from now will be happy regardless of the paradigm you chose.

 unset($action);
 return $this-$method();
 
 Hope this is reasonably clear... Note the return on the latter code.
 
 If anyone has any ideas around this, please let me know! Are there
 underlying security risks in doing it this way?

$action is coming from the client (eg. a GET/POST variable) - sanitize it!
validate it! use 'whitelisting' to trigger a reaction (rather than using the
actual value). don't trust data coming from outside your script/server (don't 
trust
that either ;-).


 
 --Paul
 
 
 
 
 
 All Email originating from UWC is covered by disclaimer  
 http://www.uwc.ac.za/portal/uwc2006/content/mail_disclaimer/index.htm 
 
 

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



Re: [PHP] Big files management

2006-07-26 Thread Jochem Maas
Yannick Warnier wrote:
 Hi there,
 
 I'm trying to deal with big files (over 4GB) with PHP4.3.9 ans PHP4.4
 but obviously it's not really possible.

no, we're not quite at the 4GB-flash-header-files-for-webpages stage of
internet evolution ;-)

 
 Is there a library somewhere that allows elementary operations on these
 kinds of files by, for example, using the operating systems commands
 (Linux in this case)?

exec(), system(), shel__exec(), the backtick operators ?

 
 Or any other solution?
 
 Thanks,
 
 Yannick
 

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



[PHP] problem using

2006-07-26 Thread php

Hi

I am reading a username and password from a file. For the moment I am trying to 
test if the username and password are the same as user inputted 
username/password.

My code snippet is as follows:

if( $out[0][0] == $u  $out[0][1] == $p ) {

$error = Login successful!;

}

else {

$error = Invalid username/password. Try again;

}



$out[] is an array containing the file data.

$u is the form username and $p the password.

I echo both values once submitted. Even when they match I get invalid 
username/password message.

If I just test if( $out[0][1] == $u ) it works.

Has anyone any pointers on what I am doing wrong?

Thanks

Eoghan

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



Re: [PHP] problem using

2006-07-26 Thread Jochem Maas
[EMAIL PROTECTED] wrote:
 Hi
 I am reading a username and password from a file. For the moment I am trying 
 to test if the username and password are the same as user inputted 
 username/password.
 My code snippet is as follows:
 if( $out[0][0] == $u  $out[0][1] == $p ) {



   $error = Login successful!;
   }
   else {
   $error = Invalid username/password. Try again;
   }
 
 $out[] is an array containing the file data.
 $u is the form username and $p the password.
 I echo both values once submitted. Even when they match I get invalid 
 username/password message.
 If I just test if( $out[0][1] == $u ) it works.

take a REALLY GOOD LOOK at your [compound] if statement
(hint: what are you checking against $out[0][1]?)

 Has anyone any pointers 

...

simply that array items don't magically swap places in order to
do what you mean.

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



Re: [PHP] problem using

2006-07-26 Thread Sameer N Ingole

[EMAIL PROTECTED] wrote:

if( $out[0][0] == $u  $out[0][1] == $p ) {
$error = Login successful!;
}
else {
$error = Invalid username/password. Try again;
}
  



If I just test if( $out[0][1] == $u ) it works.
If statement above works then $out[0][1] contains user name but in code 
snippet


if( $out[0][0] == $u  $out[0][1] == $p ) {

you are testing it against $p which I guess is password..

--
Sameer N. Ingole
weblogic.noroot.org/gallery2/v/travel/lonar/
---
Better to light one candle than to curse the darkness.

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



Re: [PHP] problem using

2006-07-26 Thread Jochem Maas
[EMAIL PROTECTED] wrote:
 
 
 On Wed, 26 Jul 2006 13:22:02 +0200, Jochem Maas [EMAIL PROTECTED] wrote:
 [EMAIL PROTECTED] wrote:
 Hi
 I am reading a username and password from a file. For the moment I am
 trying to test if the username and password are the same as user inputted
 username/password.
 My code snippet is as follows:
 if( $out[0][0] == $u  $out[0][1] == $p ) {


 $error = Login successful!;
 }
 else {
 $error = Invalid username/password. Try again;
 }

 $out[] is an array containing the file data.
 $u is the form username and $p the password.
 I echo both values once submitted. Even when they match I get invalid
 username/password message.
 If I just test if( $out[0][1] == $u ) it works.
 take a REALLY GOOD LOOK at your [compound] if statement
 (hint: what are you checking against $out[0][1]?)
 
 Sorry, that was a typo.

I'm sure it was; and I'm sure that you have lots of typos.
here is test code that proves that if what you say it true regarding
the contents/structure of $out, $u and $p then when the relevant values match 
you
will get the Login Successful! message; seeing as you are not it means you
are testing the wrong variables or something:

// CODE
$out = array(array(user,pwd)); $u = user; $p = pwd;
if($out[0][0] == $u  $out[0][1] == $p) {  
echo Match\n;
} else {
echo No Match!;
}
// OUTPUT
//Match!


 $out[0][1] is the password. Should have read:
 if( $out[0][1] == $p )
 So that works, once i add the  $out[0][0] == $u 
 it no longer works, even though my echo shows both values are the same...

do you know the difference between print_r(), var_dump() and echo?
try:

var_dump($out, $u, $p, ( user  == user));

 Thanks again
 
 Has anyone any pointers
 ...

 simply that array items don't magically swap places in order to
 do what you mean.
 

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



RE: [PHP] pop up save dialog box

2006-07-26 Thread Jay Blanchard
[snip]
  I have code below which save MYSQL to csv file. I am using ADODB 
library to do this.

  The saving MYSQL to csv file is ok .
  However i need to allow the the user to enter file name for csv file.

  Anybody have any ideas how to do this? Thanks
[/snip]

If you want a true pop-up you will have to use a JavaScript
http://www.codefoot.com/javascript/script_invoke_saveas.html

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



Re: [PHP] problem using

2006-07-26 Thread Sameer N Ingole

Dear Eoghan,

May be you should'n just hit Reply/Reply All button.




--
Sameer N. Ingole
http://weblogic.noroot.org/gallery2/v/travel/lonar/
---
Better to light one candle than to curse the darkness.

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



Re: [PHP] pop up save dialog box

2006-07-26 Thread Andrei

This is only an example and threat it as example. Take care about
security too. So don't copy and paste :)

You could do like this:

weetat wrote:
 Hi all,
 
  I have code below which save MYSQL to csv file. I am using ADODB
 library to do this.
 
  The saving MYSQL to csv file is ok .
  However i need to allow the the user to enter file name for csv file.
 
  Anybody have any ideas how to do this? Thanks
 
?

 
 $sql = $_SESSION['CSV_SQL'];
 $_logger = new Log4jLogger();
 $_logger-logdebug('sql:', $sql);
 
   if( !isset( $filename ) )
   $filename = $_GET[filename];

   if( empty( $filename ) )
   {
  ?
  script language=JavaScript
  !--
 var filen = prompt( Please provide a filename.,  );
 if( filen.length )
 {
 document.location = '?=$PHP_SELF??filename=' + filen;
 }
  //--
  /script
  ?
   } else
   {

 if (!isset($_REQUEST['maintainall'])) {

 //$filename = 'tbl_chassis.csv';

 CSVUtil::UploadTbtoCSV($sql, $filename);
 unset($_SESSION['CSV_SQL']);
 header('Location: ../maintain.php?csv');
 exit;
 } else {
 //$sql = 'SELECT * from tbl_card';

 //$filename = 'tbl_card.csv';

 CSVUtil::UploadTbtoCSV($sql, $filename);
 unset($_SESSION['CSV_SQL']);
 header('Location: ../maintainall.php?csv');
 exit;
 }

}

 
 function UploadTbtoCSV($sqltext,$filename)
 {
 $_logger = new Log4jLogger();
 $_logger-logdebug(starting.. upload tb to csv);
 
 $rs = dbQuery($sqltext);
 $rs-MoveFirst();
 $_logger-logdebug(UploadTbtoCSV csvpath:,CSV_PATH);
 
 $fp = fopen(CSV_PATH./.$filename, w);
 
 if ($fp) {
 rs2csvfile($rs, $fp);
 fclose($fp);
 $_logger-logdebug(starting upload tb to csv done);
 }
 
 
 
 }
 

?

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



Re: [PHP] problem using

2006-07-26 Thread php

On Wed, 26 Jul 2006 13:54:15 +0200, Jochem Maas [EMAIL PROTECTED] wrote:

 [EMAIL PROTECTED] wrote:





 On Wed, 26 Jul 2006 13:22:02 +0200, Jochem Maas [EMAIL PROTECTED]

 wrote:

 [EMAIL PROTECTED] wrote:

 Hi

 I am reading a username and password from a file. For the moment I am

 trying to test if the username and password are the same as user

 inputted

 username/password.

 My code snippet is as follows:

 if( $out[0][0] == $u  $out[0][1] == $p ) {





$error = Login successful!;

}

else {

$error = Invalid username/password. Try again;

}



 $out[] is an array containing the file data.

 $u is the form username and $p the password.

 I echo both values once submitted. Even when they match I get invalid

 username/password message.

 If I just test if( $out[0][1] == $u ) it works.

 take a REALLY GOOD LOOK at your [compound] if statement

 (hint: what are you checking against $out[0][1]?)



 Sorry, that was a typo.

 

 I'm sure it was; and I'm sure that you have lots of typos.



huh?



 here is test code that proves that if what you say it true regarding

 the contents/structure of $out, $u and $p then when the relevant values

 match you

 will get the Login Successful! message; seeing as you are not it means

 you

 are testing the wrong variables or something:

 

 // CODE

 $out = array(array(user,pwd)); $u = user; $p = pwd;

 if($out[0][0] == $u  $out[0][1] == $p) {

   echo Match\n;

 } else {

   echo No Match!;

 }

 // OUTPUT

 //Match!

 

 

 $out[0][1] is the password. Should have read:

 if( $out[0][1] == $p )

 So that works, once i add the  $out[0][0] == $u

 it no longer works, even though my echo shows both values are the

 same...

 

 do you know the difference between print_r(), var_dump() and echo?

 try:

 

 var_dump($out, $u, $p, ( user  == user));



Thanks, I will try your suggestions.

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



Re: [PHP] problem using

2006-07-26 Thread php



On Wed, 26 Jul 2006 13:54:15 +0200, Jochem Maas [EMAIL PROTECTED] wrote:

 var_dump($out, $u, $p, ( user  == user));



Jochem

Thank you, var_dump showed me i had an extra space at the end of the password. 
I trimmed the vales from the file and it works fine now.

Eoghan

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



[PHP] Htmlentities vs htmlspecialchars

2006-07-26 Thread Dave Goodchild

Hi all. I know htmlspecialchars converts the smallest set of entities
possible to generate valid HTML, and that htmlentities goes much further, so
what is the difference? Is it not better to use htmlentities in every case,
making htmlspecialchars somewhat redundant, or is there a performance
tradeoff?

--
http://www.web-buddha.co.uk
http://www.projectkarma.co.uk


Re: [PHP] problem using

2006-07-26 Thread Jochem Maas
[EMAIL PROTECTED] wrote:
 
 On Wed, 26 Jul 2006 13:54:15 +0200, Jochem Maas [EMAIL PROTECTED] wrote:
 var_dump($out, $u, $p, ( user  == user));
 
 Jochem
 Thank you, var_dump showed me i had an extra space at the end of the 
 password. I trimmed the vales from the file and it works fine now.

LOL - that's one lesson/trick you probably won't forget in a hurry...
most of us have had similar experiences at one time or the other!

 Eoghan
 

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



Re: [PHP] Htmlentities vs htmlspecialchars

2006-07-26 Thread Jochem Maas
Dave Goodchild wrote:
 Hi all. I know htmlspecialchars converts the smallest set of entities
 possible to generate valid HTML, and that htmlentities goes much
 further, so
 what is the difference? Is it not better to use htmlentities in every case,
 making htmlspecialchars somewhat redundant, or is there a performance
 tradeoff?

1 kind of performance: 'htmlentities' is less chars to type.

another kind of performance: 'htmlspecialchars' converts a *smaller* set of 
entities;
this assumes that the size of the set has a measurable impact on the time 
takento do a
conversion - I doubt that given the actual sizes of the respective entity 
conversion tables
that this is the case. okay so that's guess work ;-)

personally I always use htmlentities() and be done with it, I had the same 
'redundant'
feeling some time back.

I wonder if anyone can given a solid answer to this?

 

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



[PHP] sorting array question

2006-07-26 Thread Angelo Zanetti

Hi all,

Need some advice as to how to sort a array:

Structure:

partnerID
partnerName
total
totalPaid
totalUnpaid


So basically there will be many entries for the following:

eg:

partnerID  | partnerName | total  | totalPaid  | totalUnpaid
1  marc   12  57
5  berty   301218
7  sarah   19127

So they way I want to sort these rows is by total, totalPaid, 
totalUnpaid all descending.

Output should be:
partnerID  | partnerName | total  | totalPaid  | totalUnpaid
5  berty   301218
7  sarah   19127
1  marc   12  57




I have looked at the manual and found uasort and array_multisort, but 
these don't seem to be appropriate unless Im missing something but the 
examples found are very vague.

If anyone can help that would be great,

Thanks in advance
Angelo


Angelo Zanetti
Systems developer


*Telephone:* +27 (021) 469 1052
*Mobile:*   +27 (0) 72 441 3355
*Fax:*+27 (0) 86 681 5885
*
Web:* http://www.zlogic.co.za
*E-Mail:* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]

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



[PHP] jpg to pdf using fpdf

2006-07-26 Thread nicolas figaro

Hi,

I'd like to convert a jpg image to a pdf document using the fpdf class. 
(www.fpdf.org).


here is the code :
?php

require(fpdf.php);
$image=/pat/to/image.jpg;

$pdf = new FPDF();
$pdf-open();

$pdf-image($image,0,0);

$pdf-Output(/path/to/image.pdf,'F');
?

but I only get a blank a4 pdf document when I open image.pdf using 
acroread.


does anyone have an idea how I can convert a jpg to a pdf ? (without 
paying if possible

the price for a commercial library).

thanks

N F

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

RE: [PHP] jpg to pdf using fpdf

2006-07-26 Thread Peter Lauri
Correct me if I am wrong, but do fpdf allow jpg? I think you must convert to
PNG or GIF and then use that image.



-Original Message-
From: nicolas figaro [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, July 26, 2006 8:24 PM
To: PHP List
Subject: [PHP] jpg to pdf using fpdf 

Hi,

I'd like to convert a jpg image to a pdf document using the fpdf class. 
(www.fpdf.org).

here is the code :
?php

require(fpdf.php);
$image=/pat/to/image.jpg;

$pdf = new FPDF();
$pdf-open();

$pdf-image($image,0,0);

$pdf-Output(/path/to/image.pdf,'F');
?

but I only get a blank a4 pdf document when I open image.pdf using 
acroread.

does anyone have an idea how I can convert a jpg to a pdf ? (without 
paying if possible
the price for a commercial library).

thanks

 N F

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



Re: [PHP] Htmlentities vs htmlspecialchars

2006-07-26 Thread Michael Rasmussen
On Wed, 26 Jul 2006 14:59:46 +0200, Jochem Maas wrote:

 
 I wonder if anyone can given a solid answer to this?
If I remember correctly, htmlspecialchars does what its name indicate:
konvert any character with special meaning according to the HTML
specification. htmlentities converts any character to its HTML
representation.

One caveat of using htmlentities is that it is really hard to read for a
human being, but as long as the output is only used inside a browser there
is no problem. Nowadays I do a lot of XML stuff which only leaves one
option: htmlentities. Another thing: PHP is designed to be used on the web
in browser so htmlspecialchars, in my opinion, is redundant.

-- 
Hilsen/Regards
Michael Rasmussen
http://keyserver.veridis.com:11371/pks/lookup?op=getsearch=0xE3E80917

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



Re: [PHP] jpg to pdf using fpdf

2006-07-26 Thread nicolas figaro

Peter Lauri a écrit :

Correct me if I am wrong, but do fpdf allow jpg? I think you must convert to
PNG or GIF and then use that image.

  

I correct you.
FPDF allow jpg.
take a look at ttp://www.fpdf.org/en/doc/image.htm
 Supported formats are JPEG and PNG. 

N F

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

RE: [PHP] jpg to pdf using fpdf

2006-07-26 Thread Peter Lauri
So then it was the opposite of what I had in memory :)

-Original Message-
From: nicolas figaro [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, July 26, 2006 8:30 PM
To: 'PHP List'
Subject: Re: [PHP] jpg to pdf using fpdf

Peter Lauri a écrit :
 Correct me if I am wrong, but do fpdf allow jpg? I think you must convert
to
 PNG or GIF and then use that image.

   
I correct you.
FPDF allow jpg.
take a look at ttp://www.fpdf.org/en/doc/image.htm
 Supported formats are JPEG and PNG. 

 N F

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



RE: [PHP] jpg to pdf using fpdf

2006-07-26 Thread Peter Lauri
This is code how it works for me:

$pdf = new FPDF('p','pt','a4');
$pdf-AddPage();
$pdf-Image(pdf/profilechart.png,145,$pdf-GetY());
$pdf-Output(pdf/temp/thepdf.pdf,'F');

Add the $pdf-AddPage(); and it might work :)


-Original Message-
From: nicolas figaro [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, July 26, 2006 8:24 PM
To: PHP List
Subject: [PHP] jpg to pdf using fpdf 

Hi,

I'd like to convert a jpg image to a pdf document using the fpdf class. 
(www.fpdf.org).

here is the code :
?php

require(fpdf.php);
$image=/pat/to/image.jpg;

$pdf = new FPDF();
$pdf-open();

$pdf-image($image,0,0);

$pdf-Output(/path/to/image.pdf,'F');
?

but I only get a blank a4 pdf document when I open image.pdf using 
acroread.

does anyone have an idea how I can convert a jpg to a pdf ? (without 
paying if possible
the price for a commercial library).

thanks

 N F

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



Re: [PHP] problem using

2006-07-26 Thread Jochem Maas
tedd wrote:
 [EMAIL PROTECTED] wrote:

  On Wed, 26 Jul 2006 13:54:15 +0200, Jochem Maas
 [EMAIL PROTECTED] wrote:
  var_dump($out, $u, $p, ( user  == user));

  Jochem
  Thank you, var_dump showed me i had an extra space at the end of the
 password. I trimmed the vales from the file and it works fine now.

 LOL - that's one lesson/trick you probably won't forget in a hurry...
 most of us have had similar experiences at one time or the other!
 
 Jochem:
 
 How did you know that he had an extra space in $u?
 
 I reviewed his code and didn't see anywhere where he defined it in his
 post.
 
 Are you clairvoyant?   :-)

no my dear watson, it's rather elementary.

1. I read his code and it was fine in principle
2. I checked the code with some known values, this confirmed 1
3. given that the expression was evaluating to false it had to be
   either a case of:

a, the array was not in the form the OP thought it was
b, the values of the array were the other way around than the OP 
thought they were
c, the values were not what the OP thought they were

   given that he was adament that niether a, nor b, was the case this only left 
c,.
4. although the OP stated the values were the same he also mentioned he was 
using 'echo'
   to display the values - whitespace does not show with 'echo' but does make a 
difference
   when comparing strings, which explains the mismatch nicely.

PS - If I had a penny for every time I have made the same kind of mistake I 
would be
paying someone else to write this. needless to say I use a lot of trim()s

;-)

 
 tedd

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



Re: [PHP] jpg to pdf using fpdf

2006-07-26 Thread nicolas figaro

Peter Lauri a écrit :

This is code how it works for me:

$pdf = new FPDF('p','pt','a4');
$pdf-AddPage();
$pdf-Image(pdf/profilechart.png,145,$pdf-GetY());
$pdf-Output(pdf/temp/thepdf.pdf,'F');

Add the $pdf-AddPage(); and it might work :)

  

addpage did the trick.
thanks peter.

next question : how to set the pdf size to the size of the image ? :)

N F

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

RE: [PHP] jpg to pdf using fpdf

2006-07-26 Thread Peter Lauri
Check the FPDF function in the manual http://www.fpdf.org/en/doc/fpdf.htm, I
think you can set custom size of the PDF. You have to figure out how to get
the image size first, hint: getImageSize();), and then convert it to the
units you use for the pdf.

-Original Message-
From: nicolas figaro [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, July 26, 2006 8:44 PM
To: PHP List
Subject: Re: [PHP] jpg to pdf using fpdf

Peter Lauri a écrit :
 This is code how it works for me:

 $pdf = new FPDF('p','pt','a4');
 $pdf-AddPage();
 $pdf-Image(pdf/profilechart.png,145,$pdf-GetY());
 $pdf-Output(pdf/temp/thepdf.pdf,'F');

 Add the $pdf-AddPage(); and it might work :)

   
addpage did the trick.
thanks peter.

next question : how to set the pdf size to the size of the image ? :)

N F

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



Re: [PHP] sorting array question

2006-07-26 Thread John Wells

On 7/26/06, Angelo Zanetti [EMAIL PROTECTED] wrote:

Hi all,
So they way I want to sort these rows is by total, totalPaid,
totalUnpaid all descending.


Hi Angelo,

So the first question the list will ask is if the array of data is
coming from a database.  Because then you'd be urged to perform the
sorting from within your database query.

Barring that, you can use the usort() function to create custom
sorting.  What I've done below should do what you want, and I've tried
to generalize the functions a bit, so that you can mix descending and
ascending as you wish:

[code]
// Basic function for comparing arrays based on a particular column
function compareColumn($x, $y, $idx, $lessThan, $greaterThan)
{
if ( $x[$idx] == $y[$idx] )
 return 0;
else if ( $x[$idx]  $y[$idx] )
 return $lessThan;
else
 return $greaterThan;
}

// Calls compareColumn so that it sorts in descending order
function compareColumnDesc($x, $y, $idx)
{
return compareColumn($x, $y, $idx, 1, -1);
}

// Calls compareColumn so that it sorts in ascending order
function compareColumnAsc($x, $y, $idx)
{
return compareColumn($x, $y, $idx, -1, 1);
}

// Your customer comparison function.  The order in which you call each
// compareColumn*() is the ultimate order in which your multi-dim
array is sorted.
function compare($x, $y)
{
// total is index 2 of the array
$total = compareColumnDesc($x, $y, 2);
if($total != 0) return $total;

// totalPaid is index 3 of the array
$totalPaid = compareColumnDesc($x, $y, 3);
if($totalPaid != 0) return $totalPaid;

// totalUnpaid is index 4 of the array
$totalUnpaid = compareColumnDesc($x, $y, 4);
if($totalUnpaid != 0) return $totalUnpaid;

// arrays were equal
return 0;
}

$record = array(
array(1, 'marc', 12, 5, 7),
array(5, 'berty', 30, 12, 18),
array(7, 'sarah', 19, 12, 7)
);

// sort your array
usort($record, 'compare');

// print sorted array
echo 'pre';
var_export($record);
echo '/pre';
[/code]


HTH,
John W

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



[PHP] strptime() compatibility function ...

2006-07-26 Thread Jochem Maas
out of frustration of needing and not having strptime() on certain machines 
[read: windows]
and on certain versions of php [read: pre5.1] I wrote a crude userland 'compat' 
function.

it works in so far as I have tested it... but it feels like a crap 
implementation,
my attempt is below, the question can anyone else to else do better (or has 
anyone already
done so?) - bare in mind that the real php strptime() is capable of producing 
very different
bullshit than mine is [if you want to see try this: 
var_dump(strptime(23:28:00, %H:%M:00))]:

if (!function_exists('strptime')) {
function strptime($str, $fmt)
{
$rtn = array(
'tm_sec'= 0,
'tm_min'= 0,
'tm_hour'   = 0,
'tm_mday'   = 0,
'tm_mon'= 0,
'tm_year'   = 0,
'tm_wday'   = 0,
'tm_yday'   = 0,
'unparsed'  = ''
);

$valueBits  = preg_split('#\W+#', $str);

$formatBits = array();
preg_match_all('#%[^%]#', $fmt, $formatBits);

foreach ($valueBits as $k = $v) {
if (!$v || !isset($formatBits[0][$k])) continue;

switch ($formatBits[0][$k]) {
case '%d':
case '%e':  
$rtn['tm_mday'] = intval($v);
break;

case '%m':
$rtn['tm_mon'] = intval($v);
break;

case '%Y':
case '%y':
$i = intval($v);
if ($i  100/*strlen(trim($v)) == 2*/)
$i += ($i  29) ? 1900 : 2000;  


$rtn['tm_year'] = $i;
break;  

case '%b':
case '%B':
/*
// ER?? how to turn the month name
// (given in locale X) back into a month number?
// can't figure that out in less than 30 seconds,   
// so forget about it :-/
$rtn['tm_mon'] = ??;
//*/
break;

case '%H':
case '%I':
case '%k':
case '%l':
$rtn['tm_hour'] = intval($v);
break;

case '%P':
case '%p':
if (stristr($v, 'pm')) {
$rtn['tm_hour'] += 12;
} else if (stristr($v, 'am')) {
$rtn['tm_hour'] -= 12;
}
break;

case '%M':
$rtn['tm_min'] = intval($v);
break;
}

}

return $rtn;
}
}

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



Re: [PHP] sorting array question

2006-07-26 Thread Angelo Zanetti

hi guys,

thanks for the replies! yes Melanie, you were correct the last example 
(i had an old version of the manual). seemed to do the trick =)


Thanks to john as well for the reply.

Angelo

Melanie Maddix wrote:


[snip]
So they way I want to sort these rows is by total, totalPaid, 
totalUnpaid all descending.

Output should be:
partnerID  | partnerName | total  | totalPaid  | totalUnpaid
5  berty   301218
7  sarah   19127
1  marc   12  57




I have looked at the manual and found uasort and array_multisort, but 
these don't seem to be appropriate unless Im missing something but the 
examples found are very vague.

If anyone can help that would be great,

Thanks in advance
Angelo
[/snip]


Hi Angelo,

Take a look at Example 3 under array_multisort, the one that sorts by
volume and edition. 


You first build arrays of the columns you want to sort by, then pass
them as an argument to array_multisort, along with your original array.

Melanie

 



--

Angelo Zanetti
Systems developer


*Telephone:* +27 (021) 469 1052
*Mobile:*   +27 (0) 72 441 3355
*Fax:*+27 (0) 86 681 5885
*
Web:* http://www.zlogic.co.za
*E-Mail:* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]

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



Re: [PHP] problem using

2006-07-26 Thread php





On Wed, 26 Jul 2006 14:53:34 +0200, Jochem Maas [EMAIL PROTECTED] wrote:

 [EMAIL PROTECTED] wrote:



 On Wed, 26 Jul 2006 13:54:15 +0200, Jochem Maas [EMAIL PROTECTED]

 wrote:

 var_dump($out, $u, $p, ( user  == user));



 Jochem

 Thank you, var_dump showed me i had an extra space at the end of the

 password. I trimmed the vales from the file and it works fine now.

 

 LOL - that's one lesson/trick you probably won't forget in a hurry...

 most of us have had similar experiences at one time or the other!



I sure wont.

On the topic of my array, what would be an efficient way of checking my 
username/passwordd pairs match the user input form my login form.

The text file contains username and passwords in the following format:

username1,password1

username2,password2

Given I have only 2 its easy to do this in one if statement testing like so:

if( ($out[0][0]) == ($u)  ($out[0][1]) == ($p) || $out[1][0] == $u  
$out[1][1] == $p )

But if I had more or n amount, what would be an efficient way to check the 
pairs?

Thanks

Eoghan

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



Re: [PHP] problem using

2006-07-26 Thread Jochem Maas
[EMAIL PROTECTED] wrote:
 
 
 On Wed, 26 Jul 2006 14:53:34 +0200, Jochem Maas [EMAIL PROTECTED] wrote:
 [EMAIL PROTECTED] wrote:
 On Wed, 26 Jul 2006 13:54:15 +0200, Jochem Maas [EMAIL PROTECTED]
 wrote:
 var_dump($out, $u, $p, ( user  == user));
 Jochem
 Thank you, var_dump showed me i had an extra space at the end of the
 password. I trimmed the vales from the file and it works fine now.

 LOL - that's one lesson/trick you probably won't forget in a hurry...
 most of us have had similar experiences at one time or the other!
 
 I sure wont.
 On the topic of my array, what would be an efficient way of checking my 
 username/passwordd pairs match the user input form my login form.
 The text file contains username and passwords in the following format:
 username1,password1
 username2,password2

I dunno, something like this maybe:

$u = trim($_POST['usr']);
$p = trim($_POST['pwd']);

$lines = file('/you/pwd/file');
$users = array();
foreach ($lines as $line) {
list($usr, $pwd) = explode(',',$line);
$users[ $usr ] = $pwd;
}

if (isset($users[ $u ])  ($users[ $u ] === $p)) {
echo Found {$u}, and password is correct.;
}

 Given I have only 2 its easy to do this in one if statement testing like so:
 if( ($out[0][0]) == ($u)  ($out[0][1]) == ($p) || $out[1][0] == $u  
 $out[1][1] == $p )
 But if I had more or n amount, what would be an efficient way to check the 
 pairs?
 Thanks
 Eoghan
 

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



Re: [PHP] jpg to pdf using fpdf

2006-07-26 Thread tedd

At 3:23 PM +0200 7/26/06, nicolas figaro wrote:

Hi,

I'd like to convert a jpg image to a pdf document using the fpdf 
class. (www.fpdf.org).


here is the code :
?php

require(fpdf.php);
$image=/pat/to/image.jpg;

$pdf = new FPDF();
$pdf-open();

$pdf-image($image,0,0);

$pdf-Output(/path/to/image.pdf,'F');
?

but I only get a blank a4 pdf document when I open image.pdf using acroread.

does anyone have an idea how I can convert a jpg to a pdf ? (without 
paying if possible

the price for a commercial library).

thanks

N F



This code from mine that works:

define('FPDF_FONTPATH','font/');
require('fpdf.php');
require('PDF_Rotate.php');
require('PDF_RotPos.php');
//--- open a new page 
$pdf = new PDF_RotPos('L','in','Legal');
$pdf-Open();
$pdf-AddPage();
// Do Image
$pdf-Image('medal.jpg',0.3,0.3,2);

I use 'PDF_Rotate.php' and 'PDF_RotPos.php' because I rotate text in my PDF's

hth's

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

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



Re: [PHP] problem using

2006-07-26 Thread php

On Wed, 26 Jul 2006 17:01:51 +0200, Jochem Maas [EMAIL PROTECTED] wrote:

 I sure wont.

 On the topic of my array, what would be an efficient way of checking my

 username/passwordd pairs match the user input form my login form.

 The text file contains username and passwords in the following format:

 username1,password1

 username2,password2

 

 I dunno, something like this maybe:

 

 $u = trim($_POST['usr']);

 $p = trim($_POST['pwd']);

 

 $lines = file('/you/pwd/file');

 $users = array();

 foreach ($lines as $line) {

   list($usr, $pwd) = explode(',',$line);

   $users[ $usr ] = $pwd;

 }

 

 if (isset($users[ $u ])  ($users[ $u ] === $p)) {

   echo Found {$u}, and password is correct.;

 }



That works very well.

Thanks Jochem.

Eoghan


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



[PHP] Books: PHP and WAP

2006-07-26 Thread Angelo Zanetti

Hi all,

I need some recommendations for books:
are there any good books on PHP and WAP/WML? Also (OT) a recommendation 
regarding books for CSS2 and XHTML.


Thanks in advance
--

Angelo Zanetti
Systems developer


*Telephone:* +27 (021) 469 1052
*Mobile:*   +27 (0) 72 441 3355
*Fax:*+27 (0) 86 681 5885
*
Web:* http://www.zlogic.co.za
*E-Mail:* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]

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



Re: [PHP] Books: PHP and WAP

2006-07-26 Thread Paul Scott

Angelo,

On Wed, 2006-07-26 at 17:53 +0200, Angelo Zanetti wrote:
 I need some recommendations for books:
 are there any good books on PHP and WAP/WML? Also (OT) a recommendation 
 regarding books for CSS2 and XHTML.
 

Not sure about books, but if you are interested in this area, I would
recommend taking a look at the HAWHAW classes. I learnt all I know about
WAP/WML from there, and have never needed any further assistance in a
few years of doing WML sites...

--Paul



All Email originating from UWC is covered by disclaimer  
http://www.uwc.ac.za/portal/uwc2006/content/mail_disclaimer/index.htm 

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

RE: [PHP] Books: PHP and WAP

2006-07-26 Thread Peter Lauri
http://www.w3schools.com/wap/default.asp

That is a good start...


-Original Message-
From: Angelo Zanetti [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, July 26, 2006 10:54 PM
To: PHP List
Subject: [PHP] Books: PHP and WAP

Hi all,

I need some recommendations for books:
are there any good books on PHP and WAP/WML? Also (OT) a recommendation 
regarding books for CSS2 and XHTML.

Thanks in advance
-- 

Angelo Zanetti
Systems developer


*Telephone:* +27 (021) 469 1052
*Mobile:*   +27 (0) 72 441 3355
*Fax:*+27 (0) 86 681 5885
*
Web:* http://www.zlogic.co.za
*E-Mail:* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]

-- 
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] Books: PHP and WAP

2006-07-26 Thread Austin Denyer
Angelo Zanetti wrote:
 Hi all,
 
 I need some recommendations for books:
 are there any good books on PHP and WAP/WML? Also (OT) a recommendation
 regarding books for CSS2 and XHTML.

http://www.hudzilla.org/phpbook/

Regards,
Austin.



signature.asc
Description: OpenPGP digital signature


[PHP] APC + Fatal error: Cannot redeclare class...

2006-07-26 Thread jon
So... I've got some code that works just fine without APC, but dies when 
I add it.


Here's the error:
Fatal error: Cannot redeclare class

php -v =
PHP 5.1.2 (cli) (built: Jul 18 2006 23:21:00)

... any ideas what's up? Obviously, there are other ways I can improve 
performance on that box, but I'd love to try APC.


Thanks...
-- jon

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



[PHP] card scanners and PHP

2006-07-26 Thread Jay Blanchard
For our retail application (written in PHP) we are looking for a class
that will work with a scanner to scan a driver's license or business
card and populate the forms properly with that data. I have found a
product (IDScan) that may work with PHP, but I was hoping to find others
to compare it to. Anyone have or know of anything like this?

Thanks!

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



RE: [PHP] card scanners and PHP

2006-07-26 Thread Jim Moseby
 
 For our retail application (written in PHP) we are looking for a class
 that will work with a scanner to scan a driver's license or business
 card and populate the forms properly with that data. I have found a
 product (IDScan) that may work with PHP, but I was hoping to 
 find others
 to compare it to. Anyone have or know of anything like this?

The ones I have experience with simply emulate keyboard entry, and as such
would work with any PHP application where the same data could be entered via
keyboard.  I believe the ones we used were made by either Symbol or Wasp.

JM

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



Re: [PHP] card scanners and PHP

2006-07-26 Thread Miles Thompson

At 04:31 PM 7/26/2006, Jay Blanchard wrote:


For our retail application (written in PHP) we are looking for a class
that will work with a scanner to scan a driver's license or business
card and populate the forms properly with that data. I have found a
product (IDScan) that may work with PHP, but I was hoping to find others
to compare it to. Anyone have or know of anything like this?

Thanks!



Jay,


Do you mean a magnetic stripe reader?
Information is scattered all over business cards.

Miles 



--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.1.394 / Virus Database: 268.10.4/399 - Release Date: 7/25/2006

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



RE: [PHP] card scanners and PHP

2006-07-26 Thread Jay Blanchard
[snip]
Do you mean a magnetic stripe reader?
Information is scattered all over business cards.
[/snip]

Most states do not allow access to their mag stripes, and one company
that I have found so far uses what is essentially an OCR scanner and a
software called IDScan to parse the data. They even claim to be able to
scan business cards.

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



Re: [PHP] Big files management

2006-07-26 Thread Yannick Warnier
Le mercredi 26 juillet 2006 à 12:27 +0200, Jochem Maas a écrit :
 Yannick Warnier wrote:
  Hi there,
  
  I'm trying to deal with big files (over 4GB) with PHP4.3.9 ans PHP4.4
  but obviously it's not really possible.
 
 no, we're not quite at the 4GB-flash-header-files-for-webpages stage of
 internet evolution ;-)
 
  
  Is there a library somewhere that allows elementary operations on these
  kinds of files by, for example, using the operating systems commands
  (Linux in this case)?
 
 exec(), system(), shel__exec(), the backtick operators ?

I meant some class or library that already deals with parsing the
results from the commands you might use on the system, like exec(ls
-lh) with a parsing to get the file size directly and so on. No need to
reinvent the wheel, is there?

Yannick

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



Re: [PHP] APC + Fatal error: Cannot redeclare class...

2006-07-26 Thread Jochem Maas
jon wrote:
 So... I've got some code that works just fine without APC, but dies when
 I add it.
 
 Here's the error:
 Fatal error: Cannot redeclare class

that error doesn't tell us much more than you in the context you give...
but I'm gonna put money on the fact that your doing something like 
include_once()ing
some class file then include_once()ing the same file but with a different 
[relative]
path and that APC is getting confused thinking that these files are different...

try going through you code and making all [include|require]_once calls to use a 
single
form of path (i.e. that all includes for a given file are identical)

you can use echo statements in the top of each class file to track down which 
class is
seemingly being included twice.

if all that fails you can still use the 'apc.filter' ini setting to exclude 
certain
files from being cached (using regexp declarations to exclude files based on 
filename)
- this assumes your class files have a 'std' naming convention (e.g. 
Foo.class.php).
I use the same technique to stop class definitions being cached to overcome a 
problem
that my cached class defs cause segfault which I can figure out (that reminds 
me I
should try a newer version of APC if it's been release :-)

 
 php -v =
 PHP 5.1.2 (cli) (built: Jul 18 2006 23:21:00)
 
 ... any ideas what's up? Obviously, there are other ways I can improve
 performance on that box, but I'd love to try APC.
 
 Thanks...
 -- jon
 

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



Re: [PHP] APC + Fatal error: Cannot redeclare class...

2006-07-26 Thread jon
Thanks man... it turns out that I really was redeclaring the class, but 
it didn't throw an error until I added APC.


Kinda weird, yeah? Anyway... it's all good now.

-- jon


Jochem Maas wrote:

jon wrote:

So... I've got some code that works just fine without APC, but dies when
I add it.

Here's the error:
Fatal error: Cannot redeclare class


that error doesn't tell us much more than you in the context you give...
but I'm gonna put money on the fact that your doing something like 
include_once()ing
some class file then include_once()ing the same file but with a different 
[relative]
path and that APC is getting confused thinking that these files are different...

try going through you code and making all [include|require]_once calls to use a 
single
form of path (i.e. that all includes for a given file are identical)

you can use echo statements in the top of each class file to track down which 
class is
seemingly being included twice.

if all that fails you can still use the 'apc.filter' ini setting to exclude 
certain
files from being cached (using regexp declarations to exclude files based on 
filename)
- this assumes your class files have a 'std' naming convention (e.g. 
Foo.class.php).
I use the same technique to stop class definitions being cached to overcome a 
problem
that my cached class defs cause segfault which I can figure out (that reminds 
me I
should try a newer version of APC if it's been release :-)


php -v =
PHP 5.1.2 (cli) (built: Jul 18 2006 23:21:00)

... any ideas what's up? Obviously, there are other ways I can improve
performance on that box, but I'd love to try APC.

Thanks...
-- jon







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



RE: [PHP] fpdf

2006-07-26 Thread Peter Lauri
Yes you can...

$pdf-Output(thelocation/filename.pdf, F);

Just make sure that thelocation has permission to write for the web server.

/Peter

-Original Message-
From: João Cândido de Souza Neto [mailto:[EMAIL PROTECTED] 
Sent: Thursday, July 27, 2006 7:05 AM
To: php-general@lists.php.net
Subject: [PHP] fpdf

Hi everyone.

Could someone tell me if fpdf class can write the pdf file into the server? 
I've reading about and just found that it save the pdf document in a local 
place or open it in browser.

I need to write it in server, it's possible?

Thanks a lot. 

-- 
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



[PHP] Return Values Copied? Copied if By Reference?

2006-07-26 Thread Michael B Allen
Is a function return value copied? If the value is an integer I suppose
it is but what about a string or an array? If you pass by reference is
the return value still copied?

For example, is this:

  function foo($arr) {
  $arr[] = bar;
  }

faster than this?

  function foo($arr) {
  $arr[] = bar;
  return $arr; // is this copied?
  }

I'm working on some code that would be called to generate a cell in a
possibly large table and therefore a small difference in performance
may have a significant impact.

Thanks,
Mike

-- 
Michael B Allen
PHP Extension for SSO w/ Windows Group Authorization
http://www.ioplex.com/

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



Re: [PHP] Return Values Copied? Copied if By Reference?

2006-07-26 Thread Robert Cummings
On Wed, 2006-07-26 at 22:29, Michael B Allen wrote:
 Is a function return value copied? If the value is an integer I suppose
 it is but what about a string or an array? If you pass by reference is
 the return value still copied?
 
 For example, is this:
 
   function foo($arr) {
   $arr[] = bar;
   }
 
 faster than this?
 
   function foo($arr) {
   $arr[] = bar;
   return $arr; // is this copied?
   }
 
 I'm working on some code that would be called to generate a cell in a
 possibly large table and therefore a small difference in performance
 may have a significant impact.

PHP uses copy-on-write and so copies are essentially shared until such
time as you modify one of them. If you don't need references then copies
are faster than references.

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.  |
`'

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



Re: [PHP] Return Values Copied? Copied if By Reference?

2006-07-26 Thread Larry Garfield
On Wednesday 26 July 2006 21:41, Robert Cummings wrote:

  I'm working on some code that would be called to generate a cell in a
  possibly large table and therefore a small difference in performance
  may have a significant impact.

 PHP uses copy-on-write and so copies are essentially shared until such
 time as you modify one of them. If you don't need references then copies
 are faster than references.

By the same token, then, if I have a function that generates a large string 
and returns it, is there any benefit to return-by-reference?

-- 
Larry Garfield  AIM: LOLG42
[EMAIL PROTECTED]   ICQ: 6817012

If nature has made any one thing less susceptible than all others of 
exclusive property, it is the action of the thinking power called an idea, 
which an individual may exclusively possess as long as he keeps it to 
himself; but the moment it is divulged, it forces itself into the possession 
of every one, and the receiver cannot dispossess himself of it.  -- Thomas 
Jefferson

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