php-general Digest 29 Jul 2007 17:46:08 -0000 Issue 4931

2007-07-29 Thread php-general-digest-help

php-general Digest 29 Jul 2007 17:46:08 - Issue 4931

Topics (messages 259754 through 259772):

Re: PDO_SQLite Transactions
259754 by: Richard Lynch
259770 by: M. Sokolewicz

Re: Rules of Engagement
259755 by: Richard Lynch
259756 by: Richard Lynch
259764 by: Lester Caine

Re: Comment modes behavior in HTML and PHP
259757 by: Richard Lynch

Re: Hide the real URL
259758 by: Richard Lynch

Re: Profile / Debug w/o server modification?
259759 by: Richard Lynch
259765 by: Instruct ICC

Dealing with ImageMagick from PHP
259760 by: Eric Holt (PHP List)
259771 by: Al

Re: Pirate PHP books online?
259761 by: Richard Lynch
259762 by: Dotan Cohen

About XSL Transformation
259763 by: Kelvin Park

Re: PHP list as a blog
259766 by: Børge Holen

Re: Objects
259767 by: tedd
259772 by: Nathan Nobbe

Re: need insights on encrypting and uploading ASCII file using PHP
259768 by: tedd
259769 by: Satyam

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]


--
---BeginMessage---
I suspect that you are trying to update the record you just inserted.

That may just not be possible in the transaction model, for whatever
internal purposes.

It also seems kind of backwards to me at least.

Why not just do the file move and error checking before you even
bother to insert, and then do a single statement, which won't even
need a transaction, since any one statement is atomic.

Perhaps I'm missing something, but it seems like you've needlessly
complicated the DB side of things.

On Sat, July 28, 2007 8:57 pm, M. Sokolewicz wrote:
 I've been having this problem for a while now,
 when I use transactions in SQLite with PDO it stalls on me with an
 error
 stating my statements are in progress.
 I've tried closing all cursors to my statements, but that does not
 seem
 to resolve this for me. This is my code,
 (obviously shortened quite a bit)

 I hope someone could help me figure out what's going wrong, could it
 be
 that I can't run an update yet because
 the transaction has not been commited yet?? (sounds a bit odd to me)

 ?php
 // setup an SQLite db connection via PDO, this is in $db
 try {
   // $fileName, $fileDesc and $fileType are all existing, cleaned,
 checked values
   $statement = $db-prepare('INSERT INTO Files (file_name, file_desc,
 file_type, file_filename) VALUES (?, ?, ?, ?)');
   $statement-execute(array($fileName, $fileDesc, $fileType, ''));

   $id = $db-lastInsertId();

   $statement-closeCursor();

   $res = move_uploaded_file($tmp_file, $new_file);

   if($res === false) {
   $db-rollBack();

   echo 'error';
   exit;
   } else {
   $statement = $db-prepare('UPDATE Files SET file_filename=? WHERE
 file_id=?');
   $statement-execute(array($new_file, $id));

   $statement-closeCursor();

   OG::$db-commit();
   }
 } catch(Exception $e) {
  var_dump($e);
 }

 And the Exception I recieve (there is only one commit in the file, due
 to shortening for posting
 the line listed here is incorrect):

 object(PDOException)#7 (7) {
[message:protected]=
string(88) SQLSTATE[HY000]: General error: 1 cannot commit
 transaction - SQL statements in progress
[string:private]=
string(0) 
[code:protected]=
string(5) HY000
[file:protected]=
string(43) /home/tularis/public_html/t/createFile.php
[line:protected]=
int(95)
[trace:private]=
array(1) {
  [0]=
  array(6) {
[file]=
string(43) /home/tularis/public_html/t/createFile.php
[line]=
int(95)
[function]=
string(6) commit
[class]=
string(3) PDO
[type]=
string(2) -
[args]=
array(0) {
}
  }
}
[errorInfo]=
array(3) {
  [0]=
  string(5) HY000
  [1]=
  int(1)
  [2]=
  string(54) cannot commit transaction - SQL statements in
 progress
}
 }

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




-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
---End Message---
---BeginMessage---
I was indeed trying to update the record I just inserted, the thing is 
though, if I remove all other queries and keep just

PDO-beginTransaction();
PDO-prepare();
PDOstatement-execute();
PDOstatement-closeCursor();
PDO-commit();

it still returns such an error. Which is very odd indeed...

As for what I'm trying, it's true that this wasn't the best way of doing 
it, but there's actually more code 

[PHP] About XSL Transformation

2007-07-29 Thread Kelvin Park
I have an XML file with 10 products with their registered dates(dates 
when they were created).
My XSL code is set so that it sorts the products in descending 
order(latest to oldest) by registered dates.
I tried to declare xsl:variable to increment within xsl:for-each, 
however I ran in to some dead ends.

How do I print only the 5 latest products?

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



Re: [PHP] Rules of Engagement

2007-07-29 Thread Lester Caine

Daniel Brown wrote:

As a relatively-new contributor to this list (read: under 2
years), I realize that I have no business requesting a change, but
I'll breech etiquette and hope for the best.

Can we update the filters on the list to have the reply-to address
header marked to the php-general address? 


At the risk of extending the religious war 

I'm with you Daniel, but I think it has been decided that what we ACTUALLY 
need is a fix at the reception end. Some email clients will allow you to set a 
reply address for a folder ( apparently ) which is actually what *I* could do 
with, so all [PHP] email goes in the php-general folder, and when I hit reply 
I get a list reply address, just like I get a news list address on news 
folders. Unfortunately the other religious war erupts when you ask for that at 
the client end and many of the same people who INSIST that replies should be 
changed to be private then insist that its not appropriate to allow the client 
end to change them back :(


So until SeaMonkey adds the facility to set a folder reply address I'm stuck 
like you with remembering to hit 'reply all' on the relatively few lists that 
still work the old school way ;) Actually rather than doing that I TRY to be 
nice and replace the private reply address with the list address - so I don't 
get those duplicate replies that are not getting filtered out when someone 
'reply alls' my posts ;)


--
Lester Caine - G8HFL
-
Contact - http://home.lsces.co.uk/lsces/wiki/?page=contact
L.S.Caine Electronic Services - http://home.lsces.co.uk
MEDW - http://home.lsces.co.uk/ModelEngineersDigitalWorkshop/
Firebird - http://www.firebirdsql.org/index.php

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



Re: [PHP] Profile / Debug w/o server modification?

2007-07-29 Thread Instruct ICC

From: Richard Lynch [EMAIL PROTECTED]

On Fri, July 27, 2007 10:01 pm, Instruct ICC wrote:
 If you mean get a dev box.  You don't know how long I've been asking
 for one
 to match the production box.

Your dev box should only match in software versions (okay, and any
really funky specialized hardware like a hardware random number
generator MAYBE).

Don't ask them for a Gigaplex Mu-on 16-cpu 64 Gig RAM 4 Terabyte hard
drive box.

Take an old box out of your closet and install the same versions of
the OS, Webserver, DB, and PHP and call it done.

Now, a QA box, where you do load-testing and serious release
candidate testing, yeah, THAT should match the production box, if at
all possible...


Do you know of any (free as in money) disk imaging software that would 
capture all the patches/configurations/etc.  Actually, as I write this, I 
remember the reason the imaging tool I used had mysterious failures was 
probably due to bad memory, and I could use a different box now.


Thanks for the advice.

_
Local listings, incredible imagery, and driving directions - all in one 
place! http://maps.live.com/?wip=69FORM=MGAC01


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



Re: [PHP] PHP list as a blog

2007-07-29 Thread Børge Holen
On Sunday 29 July 2007 02:18, you wrote:
 I'll top-post for this announcement.  I think we found the winner
 of the Revive An Old Topic award.

hup, yes its that vacation thing you posted about later ;D I just got 2278 
more



 Congrats.

 On 7/28/07, Børge Holen [EMAIL PROTECTED] wrote:
  On Thursday 14 June 2007 00:41, Philip Thompson wrote:
   On Jun 13, 2007, at 1:15 PM, Richard Lynch wrote:
On Wed, June 13, 2007 12:21 am, Crayon Shin Chan wrote:
On Wednesday 13 June 2007 12:39, Paul Scott wrote:
Our interns and students specifically. They are all dead scared of
joining mailing lists in general, and find that using a web based
prettier interface is much easier and friendlier.
   
Not to mention slower, clumsier and more bandwidth hungry than a
mailing list. It's time you did them a favour and show them that
mailing lists
are nothing to be afraid of.
   
Do students and interns still have quotas on their email accounts?...
  
   Yes. It does depend on the university though. For our students, the
   default is only 50 megs - they may request more. However, these text-
   only emails don't really take up that much space.
  
Cuz I *DO* remember the days when the email quotas a University would
have prohibited subscribing to PHP mailing list...
  
   This is not currently the case.
  
Surely in this day and age, the quotas aren't *that* restrictive...
 
  There seems to be some failure to comunicate (I believe the Prodigy said
  that)... whatever, quotas on the universities will not keep you from
  recieving mail... or download anything of the net.  It just defines the
  space available to the user. The temporary space available lets you pull
  way more, and get a delete warning from either an automated system or an
  admin (at my university, wasn't it 10 days or so before forced deletion
  on random objects occured?... dunno).
  Imagine an master or phD degree getting lost because someone set up an
  university server with some weird download quota.
  This could hardly be _A_ reason for makin' this blog... the amount of
  mail or numbers should not be an issue. If it is so... how about them
  digest mails?
 
   True.
  
  
   ~Philip
 
  --
  ---
  Børge
  http://www.arivene.net
  ---
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php

-- 
---
Børge
http://www.arivene.net
---

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



Re: [PHP] Objects

2007-07-29 Thread tedd

At 2:00 PM -0400 7/25/07, Nathan Nobbe wrote:

yes well at the beginning of the design patterns book they basically explain
the same thing.
if you dont understand the basic oo priciples, then design patterns arent
going to make any sense.
these basic concepts are (not looking in the book [testing myself]..)
encapsulation
abstraction
polymorphism
inheritence

ok now i will look in the book; lets see if ive learned anything;
nice; thats what they have there;
ya; get the basics down, but then; dont stop; learn design patterns!



I understand, and have used, the four mentioned above -- but have a 
difficult time with design patterns.


Sure, I get the idea that design patterns are 
concepts/procedures/ideas for how to identify/classify a problem and 
thereby infer a specific solution, but further than that I'm lost.


As I see it, every problem consist of input, calculation, and 
presentation. I don't see the need to classify each problem as a 
specific type and then proceed accordingly.


To me, every problem looks the same, only different. :-)

Cheers,

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] need insights on encrypting and uploading ASCII file using PHP

2007-07-29 Thread tedd

At 2:52 PM -0700 7/27/07, John A DAVIS wrote:

Content-Language:
Content-Type: text/plain;
 charset=utf-8

Very good! Very good! Thank you. Lots of stuff to mull over.

John A. Davis
Programmer
State of Oregon DHS OIS
CNE, MCSE

Don't think of the problem, think of the solution


 Satyam [EMAIL PROTECTED] 7/27/2007 2:19 PM 



There are two different things you might want, ensure that the data 
is not seen by eavesdroppers while in transit or ascertain that the 
data comes from who says it is.


The first, you manage with SSL as with any other secure transaction, 
as already sugested.


For the second is what you might want to use a digital signature, 
that's why someone might have sugested it to you.
As a sample of how this would work you read the file into memory, 
add a long string, the signature,  that is never transmitted but 
that both ends know, and pass it all through an algorithm like MD5 
or such.   At the receiving end, you get the data and the MD5 but, 
as I said, the signature is never transmitted, but you know it as 
well.  You do the same process as in the sending end and you should 
reach the same MD5.  Since MD5 is not reversible, knowing the MD5 of 
this long string, the data plus the signature, cannot reveal the 
signature even if the data is transmitted in clear text, but no 
other except someone who has the signature can produce the right 
MD5. Notice that the data itself is transmitted in clear text, the 
goal is to ensure that who sends it is who is meant. A similar 
process has been in use in the banking industry for wire transfers 
when they were really sent via telex.


As mentioned PGP is a far better solution since it covers both 
requirements and it uses two keys, one for encoding and one for 
decoding so that each end knows just half of the information and 
won't require you to use SSL, the problem is that you have to do 
some processing at the client side and JavaScript alone won't allow 
you to access the file system.  You would have to deploy ActiveX 
controls or Konfabulator widgets (plust the widget runtime).  On the 
other hand, many eMail clients can send PGP protected messages.


Finally, you could get your users to ZIP the files with a password 
before sending them, which is not so secure but is good enough for 
many uses.  IT all depends on what you want.


Satyam


You can also send pieces and parts at different times to be assembled 
afterwards and, if needed, each to have their own protection scheme. 
Or you could burn a CD and sent it through the mail, publish keys in 
the newspaper under personal ads, flash Morse code on clouds, or try 
smoke signals -- all work in one fashion or another to transmit data.


I think that about covers it.  :-)

Cheers,

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] need insights on encrypting and uploading ASCII file using PHP

2007-07-29 Thread Satyam


- Original Message - 
From: tedd [EMAIL PROTECTED]

To: John A DAVIS [EMAIL PROTECTED]; php-general@lists.php.net
Sent: Sunday, July 29, 2007 4:32 PM
Subject: Re: [PHP] need insights on encrypting and uploading ASCII file 
using PHP


Finally, you could get your users to ZIP the files with a password before 
sending them, which is not so secure but is good enough for many uses.  IT 
all depends on what you want.


Satyam


You can also send pieces and parts at different times to be assembled 
afterwards and, if needed, each to have their own protection scheme. Or 
you could burn a CD and sent it through the mail, publish keys in the 
newspaper under personal ads, flash Morse code on clouds, or try smoke 
signals -- all work in one fashion or another to transmit data.


I think that about covers it.  :-)



Perhaps you are missing a station wagon full of 6250BPI magnetic tapes as 
Tanenbaum's classic Computer Networks mentions, with an armed guard on the 
passenger seat, for the sake of security.


Satyam

PS: I wonder if he took that out in later editions or replaced 'van' for 
'station wagon' and 'CDs' for 'magnetic tapes'.





Cheers,

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



--
No virus found in this incoming message.
Checked by AVG Free Edition. Version: 7.5.476 / Virus Database: 
269.10.23/924 - Release Date: 28/07/2007 15:50





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



[PHP] Re: Dealing with ImageMagick from PHP

2007-07-29 Thread Al

You'd be far better off asking your questions on the phpList forum.

There are a number of hints on the forum for speeding up things. Plus, look in 
the examples section.

Eric Holt (PHP List) wrote:

Hello everyone.  This is my first post to the list, so bare with me :)

I have written an application for a client that is used in the Event 
Photography business.  It handles taking photographs, categorizing them, 
making thumbnails of them, and allows parents(customers) to view the 
photos and order them.  It runs on LAMP, and it really works great.


For the past two years, we've used ImageMagick v4.2.9 to process the 
thumbnails.  Image quality was decent enough, but the main reason for 
4.2.9 was SPEED.  In my testing, 4.2.9 was quite a bit faster than the 
lastest releases (in the 6.x.x series).  Anyway -- the clients decided 
they wanted me to do some work on the image quality, so I finally 
decided to move up to ImageMagick v.6.3.4.


Right now, I call ImageMagick from a exec call in PHP.  When I first 
wrote the application, it was the quickest and easiest way for me to get 
it working.  Command-line ImageMagick is pretty simple.


So, with ImageMagick 6.3.4, with the sharpening and compression I'm now 
using, the clients are absolutely in love with the thumbnail quality -- 
even though the amount of time it takes to make the thumbnails is much 
longer.  They've asked if anything can be done about that, but I think 
I've optimized the shell script as much as possible.


Now, after that long rambling... My question is this:  Would I see a big 
speed improvement by using the ImageMagick extension built into PHP 
(MagicWand, is it called?)?  I'd hate to spend all the time recoding the 
application to work with MagicWand, only to find out that I dont end up 
with any performance increase -- or worse of all, a decrease.


I wasnt convinced either way, from the Googling I had done on the 
subject, so I thought I would post the question to the PHP list.


A little more background here, before I go:  PHP iterates through a 
directory of full-sized images, directly out of the camera, and exec's 
a shell script thumbcreation.sh with the details of what ImageMagick 
needs to do, and where it needs to store the new thumbnails.  The script 
calls convert, which creates a medium sized thumbnail (333x500), and 
then from that creates a small thumbnail (80x120) from the medium. Then, 
the script calls composite, where is adds a watermark to the medium size 
thumbnail, and saves it in the watermarked directory.


In my initial testing, years ago, I found that ImageMagick v4.2.9 was 
faster than the internal GD library... however, I havnt touched GD since 
my initial testing.  Perhaps GD would be faster now than IM v6.3.4(?).


Okay, I've rambled on plenty now, for my first post.  I greatly 
appreciate any advice anyone on the list could provide.



THANKS!!!
 --Eric


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



Re: [PHP] PDO_SQLite Transactions

2007-07-29 Thread M. Sokolewicz
I was indeed trying to update the record I just inserted, the thing is 
though, if I remove all other queries and keep just

PDO-beginTransaction();
PDO-prepare();
PDOstatement-execute();
PDOstatement-closeCursor();
PDO-commit();

it still returns such an error. Which is very odd indeed...

As for what I'm trying, it's true that this wasn't the best way of doing 
it, but there's actually more code involved with slightly different 
(read: more) changes being done and retrieved from various (non-PDO 
SQLite db) places.


I've removed the Transactions and it works fine =/

- Tul

Richard Lynch wrote:

I suspect that you are trying to update the record you just inserted.

That may just not be possible in the transaction model, for whatever
internal purposes.

It also seems kind of backwards to me at least.

Why not just do the file move and error checking before you even
bother to insert, and then do a single statement, which won't even
need a transaction, since any one statement is atomic.

Perhaps I'm missing something, but it seems like you've needlessly
complicated the DB side of things.

On Sat, July 28, 2007 8:57 pm, M. Sokolewicz wrote:

I've been having this problem for a while now,
when I use transactions in SQLite with PDO it stalls on me with an
error
stating my statements are in progress.
I've tried closing all cursors to my statements, but that does not
seem
to resolve this for me. This is my code,
(obviously shortened quite a bit)

I hope someone could help me figure out what's going wrong, could it
be
that I can't run an update yet because
the transaction has not been commited yet?? (sounds a bit odd to me)

?php
// setup an SQLite db connection via PDO, this is in $db
try {
// $fileName, $fileDesc and $fileType are all existing, cleaned,
checked values
$statement = $db-prepare('INSERT INTO Files (file_name, file_desc,
file_type, file_filename) VALUES (?, ?, ?, ?)');
$statement-execute(array($fileName, $fileDesc, $fileType, ''));

$id = $db-lastInsertId();

$statement-closeCursor();

$res = move_uploaded_file($tmp_file, $new_file);

if($res === false) {
$db-rollBack();

echo 'error';
exit;
} else {
$statement = $db-prepare('UPDATE Files SET file_filename=? WHERE
file_id=?');
$statement-execute(array($new_file, $id));

$statement-closeCursor();

OG::$db-commit();
}
} catch(Exception $e) {
 var_dump($e);
}

And the Exception I recieve (there is only one commit in the file, due
to shortening for posting
the line listed here is incorrect):

object(PDOException)#7 (7) {
   [message:protected]=
   string(88) SQLSTATE[HY000]: General error: 1 cannot commit
transaction - SQL statements in progress
   [string:private]=
   string(0) 
   [code:protected]=
   string(5) HY000
   [file:protected]=
   string(43) /home/tularis/public_html/t/createFile.php
   [line:protected]=
   int(95)
   [trace:private]=
   array(1) {
 [0]=
 array(6) {
   [file]=
   string(43) /home/tularis/public_html/t/createFile.php
   [line]=
   int(95)
   [function]=
   string(6) commit
   [class]=
   string(3) PDO
   [type]=
   string(2) -
   [args]=
   array(0) {
   }
 }
   }
   [errorInfo]=
   array(3) {
 [0]=
 string(5) HY000
 [1]=
 int(1)
 [2]=
 string(54) cannot commit transaction - SQL statements in
progress
   }
}

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

2007-07-29 Thread Nathan Nobbe
tedd,

have you looked at the book we're talking about?
also, there are several other books on design patterns available, but the
Heads First book
is one ive heard mentioned a lot.
you can check out a really sweet site online phppatterns.com; in particular
follow the design
link on the right hand navigation.  if youve been working w/ objects for
more than a few months
design patterns should expose their benefit almost immediately.  it boils
down to a really simple
premise, see, i have been writing code for o, about 3 years and getting paid
for it.  i studied oop
a bit in college for about another 3 years and tinkered w/ them in high
school for probly less than
a year.  well after all that i can still write some pretty weak code.
yes, my code may be clean, but in the greater scheme of things how well will
it scale ?  does it need
to be modified when a new feature should be added ?  does it suffer from
dependency rot ?  in
many cases the answer to these questions is not the preferable one.  so
thats where the motivation for
design patterns comes from.  people who have been writing oop code for the
past 20-30 years or so decided
to start sharing their experiences with one another.  after a while they got
a big collection of dos and donts
together and put together common optimal solutions to common problems.
one of the hardest parts about using design patterns in reality is you have
to be able to recognize a certain
problem and then you can begin to understand how to apply a particular
pattern or set of patterns to your
solution.
also it is not merely about rigidly following the patterns.  there are also
design principals, that guide us in
writing code that doesnt suck.
it should be mentioned the authors of said book have a masters degree and
phd degree from yale in computer
science; thats right, they know a thing or 2.
anyway if you dont know design patterns you dont know what youre missing and
you probly dont know what
youre writing either :)

-nathan

On 7/29/07, tedd [EMAIL PROTECTED] wrote:

 At 2:00 PM -0400 7/25/07, Nathan Nobbe wrote:
 yes well at the beginning of the design patterns book they basically
 explain
 the same thing.
 if you dont understand the basic oo priciples, then design patterns arent
 going to make any sense.
 these basic concepts are (not looking in the book [testing myself]..)
 encapsulation
 abstraction
 polymorphism
 inheritence
 
 ok now i will look in the book; lets see if ive learned anything;
 nice; thats what they have there;
 ya; get the basics down, but then; dont stop; learn design patterns!


 I understand, and have used, the four mentioned above -- but have a
 difficult time with design patterns.

 Sure, I get the idea that design patterns are
 concepts/procedures/ideas for how to identify/classify a problem and
 thereby infer a specific solution, but further than that I'm lost.

 As I see it, every problem consist of input, calculation, and
 presentation. I don't see the need to classify each problem as a
 specific type and then proceed accordingly.

 To me, every problem looks the same, only different. :-)

 Cheers,

 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] PDO_SQLite Transactions

2007-07-29 Thread Nathan Nobbe
i had this same problem when trying to do a select directly after an insert
w/ pdo + sqlite3 transactions.
solution in that case was to use last_insert_id (or whatever the actual pdo
method is called, cant remember
and too lazy to lookup, atm :))
anyway if you want to do an update after an insert just use a trigger.

-nathan

On 7/29/07, M. Sokolewicz [EMAIL PROTECTED] wrote:

 I was indeed trying to update the record I just inserted, the thing is
 though, if I remove all other queries and keep just
 PDO-beginTransaction();
 PDO-prepare();
 PDOstatement-execute();
 PDOstatement-closeCursor();
 PDO-commit();

 it still returns such an error. Which is very odd indeed...

 As for what I'm trying, it's true that this wasn't the best way of doing
 it, but there's actually more code involved with slightly different
 (read: more) changes being done and retrieved from various (non-PDO
 SQLite db) places.

 I've removed the Transactions and it works fine =/

 - Tul

 Richard Lynch wrote:
  I suspect that you are trying to update the record you just inserted.
 
  That may just not be possible in the transaction model, for whatever
  internal purposes.
 
  It also seems kind of backwards to me at least.
 
  Why not just do the file move and error checking before you even
  bother to insert, and then do a single statement, which won't even
  need a transaction, since any one statement is atomic.
 
  Perhaps I'm missing something, but it seems like you've needlessly
  complicated the DB side of things.
 
  On Sat, July 28, 2007 8:57 pm, M. Sokolewicz wrote:
  I've been having this problem for a while now,
  when I use transactions in SQLite with PDO it stalls on me with an
  error
  stating my statements are in progress.
  I've tried closing all cursors to my statements, but that does not
  seem
  to resolve this for me. This is my code,
  (obviously shortened quite a bit)
 
  I hope someone could help me figure out what's going wrong, could it
  be
  that I can't run an update yet because
  the transaction has not been commited yet?? (sounds a bit odd to me)
 
  ?php
  // setup an SQLite db connection via PDO, this is in $db
  try {
   // $fileName, $fileDesc and $fileType are all existing, cleaned,
  checked values
   $statement = $db-prepare('INSERT INTO Files (file_name,
 file_desc,
  file_type, file_filename) VALUES (?, ?, ?, ?)');
   $statement-execute(array($fileName, $fileDesc, $fileType, ''));
 
   $id = $db-lastInsertId();
 
   $statement-closeCursor();
 
   $res = move_uploaded_file($tmp_file, $new_file);
 
   if($res === false) {
   $db-rollBack();
 
   echo 'error';
   exit;
   } else {
   $statement = $db-prepare('UPDATE Files SET file_filename=?
 WHERE
  file_id=?');
   $statement-execute(array($new_file, $id));
 
   $statement-closeCursor();
 
   OG::$db-commit();
   }
  } catch(Exception $e) {
   var_dump($e);
  }
 
  And the Exception I recieve (there is only one commit in the file, due
  to shortening for posting
  the line listed here is incorrect):
 
  object(PDOException)#7 (7) {
 [message:protected]=
 string(88) SQLSTATE[HY000]: General error: 1 cannot commit
  transaction - SQL statements in progress
 [string:private]=
 string(0) 
 [code:protected]=
 string(5) HY000
 [file:protected]=
 string(43) /home/tularis/public_html/t/createFile.php
 [line:protected]=
 int(95)
 [trace:private]=
 array(1) {
   [0]=
   array(6) {
 [file]=
 string(43) /home/tularis/public_html/t/createFile.php
 [line]=
 int(95)
 [function]=
 string(6) commit
 [class]=
 string(3) PDO
 [type]=
 string(2) -
 [args]=
 array(0) {
 }
   }
 }
 [errorInfo]=
 array(3) {
   [0]=
   string(5) HY000
   [1]=
   int(1)
   [2]=
   string(54) cannot commit transaction - SQL statements in
  progress
 }
  }
 
  --
  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] About XSL Transformation

2007-07-29 Thread Nathan Nobbe
build or modify the xml w/ php.
or pickup a book on xsl :)

-nathan

On 7/29/07, Kelvin Park [EMAIL PROTECTED] wrote:

 I have an XML file with 10 products with their registered dates(dates
 when they were created).
 My XSL code is set so that it sorts the products in descending
 order(latest to oldest) by registered dates.
 I tried to declare xsl:variable to increment within xsl:for-each,
 however I ran in to some dead ends.
 How do I print only the 5 latest products?

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




Re: [PHP] Rules of Engagement

2007-07-29 Thread Nathan Nobbe
gmail seems to consume these 'double replies' transparently w/ its
'conversations'.

i never notice them :)

sorry to everyone who gets hit w/ the extra mail when i hit reply-to-all.

youll have to forgive my laziness, its just easier that way.

-nathan

On 7/29/07, Lester Caine [EMAIL PROTECTED] wrote:

 Daniel Brown wrote:
  As a relatively-new contributor to this list (read: under 2
  years), I realize that I have no business requesting a change, but
  I'll breech etiquette and hope for the best.
 
  Can we update the filters on the list to have the reply-to address
  header marked to the php-general address?

 At the risk of extending the religious war 

 I'm with you Daniel, but I think it has been decided that what we ACTUALLY
 need is a fix at the reception end. Some email clients will allow you to
 set a
 reply address for a folder ( apparently ) which is actually what *I* could
 do
 with, so all [PHP] email goes in the php-general folder, and when I hit
 reply
 I get a list reply address, just like I get a news list address on news
 folders. Unfortunately the other religious war erupts when you ask for
 that at
 the client end and many of the same people who INSIST that replies should
 be
 changed to be private then insist that its not appropriate to allow the
 client
 end to change them back :(

 So until SeaMonkey adds the facility to set a folder reply address I'm
 stuck
 like you with remembering to hit 'reply all' on the relatively few lists
 that
 still work the old school way ;) Actually rather than doing that I TRY to
 be
 nice and replace the private reply address with the list address - so I
 don't
 get those duplicate replies that are not getting filtered out when someone
 'reply alls' my posts ;)

 --
 Lester Caine - G8HFL
 -
 Contact - http://home.lsces.co.uk/lsces/wiki/?page=contact
 L.S.Caine Electronic Services - http://home.lsces.co.uk
 MEDW - http://home.lsces.co.uk/ModelEngineersDigitalWorkshop/
 Firebird - http://www.firebirdsql.org/index.php

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




Re: [PHP] Profile / Debug w/o server modification?

2007-07-29 Thread Nathan Nobbe
richard,

ive seen plenty of scenarios where the dev box has to be pretty tough
itself.  i think
it depends mostly on how much load its taking on.say you have 30
developers
or so working on a few different viirtual sites simultaneously.  now add in
the problems
that occur during development, like my favorite, the infinite loop.  yeah
ive seen dev boxes
just chill at 99% cpu and we're taking 2xp3 xeon w/ a few gigs of ram in it.
 not saying
OP is dealing w/ sucha scenario just daying sometimes dev boxes need some
juice too.
i found out about the linux vserver
projecthttp://linux-vserver.org/Welcome_to_Linux-VServer.orgonly
recently, but this is a nice solution.  you
can get one decent box and throw dev, qa, stage, w/e on there.  (and
obviously thata
may not be practical depending on hardware reqs)

if youre running linux that is :)

-nathan

On 7/29/07, Richard Lynch [EMAIL PROTECTED] wrote:

 On Fri, July 27, 2007 10:01 pm, Instruct ICC wrote:
 From: Richard Lynch [EMAIL PROTECTED]
   But xdebug and apd are probably moot.
  
   BTW, I'm not using separate development and production machines.
 
 Right there is your first problem.
 
 Solve that first.
 
  If you mean get a dev box.  You don't know how long I've been asking
  for one
  to match the production box.

 Your dev box should only match in software versions (okay, and any
 really funky specialized hardware like a hardware random number
 generator MAYBE).

 Don't ask them for a Gigaplex Mu-on 16-cpu 64 Gig RAM 4 Terabyte hard
 drive box.

 Take an old box out of your closet and install the same versions of
 the OS, Webserver, DB, and PHP and call it done.

 Now, a QA box, where you do load-testing and serious release
 candidate testing, yeah, THAT should match the production box, if at
 all possible...

 --
 Some people have a gift link here.
 Know what I want?
 I want you to buy a CD from some indie artist.
 http://cdbaby.com/browse/from/lynch
 Yeah, I get a buck. So?

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




[PHP] PHP Rating system

2007-07-29 Thread Chris Carter

Hi,

I am trying for a php rating code that can utilized for a restaurant
requirement. First of all I am not sure if there is database that is obvious
with rating system. In case it is or even if its not, is there some site and
code available from where the code can be used.

I have tried some but most of them do not work.

Please advice,

Chris.
-- 
View this message in context: 
http://www.nabble.com/PHP-Rating-system-tf4166430.html#a11853841
Sent from the PHP - General mailing list archive at Nabble.com.

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



[PHP] Re: Rules of Engagement

2007-07-29 Thread Colin Guthrie
Daniel Brown wrote:
 As a relatively-new contributor to this list (read: under 2
 years), I realize that I have no business requesting a change, but
 I'll breech etiquette and hope for the best.
 
 Can we update the filters on the list to have the reply-to address
 header marked to the php-general address?  The reason I ask this is
 because, when people are on vacation (such as Juan is now), we receive
 responses to our personal addresses.  Secondly, we have to continually
 Reply All the messages, which - though it's not a problem - can
 cause issues when attempting to respond to those [URGENT] replies.
 Third, our addresses are included in gmane, et al, which is an
 inherent risk --- I understand.
 
 Maybe it's just the ramblings of someone attempting to read and
 type on a limited-bandwidth mobile device while bored due to delays in
 mass-transit facilities (here, read: I'm fucking exhausted, and yes, I
 dropped the F bomb).  In either case, it's not conducive to a new
 contributor to have to weed through vacation response messages each
 time he/she replies to the list.

I agree here.

I am on many lists and if I'm interested in something then I expect
people to expect me to read the list for replies. But for noobs, the
personal reply is quite good.

I guess the rule should be public list - reply to poster,
subscription list - reply to list.

AFAIK Gmane etc. can be configured to obfuscate email addresses -
certainly other lists I read through Gmane are...

Col

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



Re: [PHP] Authentication

2007-07-29 Thread Stut

Dan Shirah wrote:

I looked on PHP.net but I couldn't not find anything suitable to answer my
question.

Within PHP, is there a way to pull the name of the user that is currently
logged into the PC?

I know with some of the _SERVER functions you can pull the IP of the machine
and other data, is there a function within this family that would work?


I'm assuming you're after transparent authentication where the user 
doesn't need to do anything to authenticate with the site. This is only 
possible with IE as the client on an NT domain with the server on the 
same domain. If you're using IIS on the server then it's as easy as 
removing anonymous and basic authentication from the site/directory. If 
you're using Apache or something else you need to find an 
extension/module that provides NTLM authentication, but not all of the 
ones I tried fully supported the transparent side of it.


I implemented this for a corporate intranet a while back in Apache on 
FreeBSD with mod_ntlm (Google for it - dunno if it's still maintained). 
That was in 2004 and information was sparse, but with a bit of research 
and *lots* of experimenting I was able to get it to work.


To be perfectly honest, if I were doing it again I'd save the time and 
use IIS on the server - sooo much easier.


-Stut

--
http://stut.net/

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



Re: [PHP] need insights on encrypting and uploading ASCII file using PHP

2007-07-29 Thread Stut

Richard Lynch wrote:

On Fri, July 27, 2007 3:21 pm, John A DAVIS wrote:

We have various labs that submit coliform sample results in an ASCII
file, quoted/comma delimited.

We are being asked to encrypt this file for internet transfer. We are
also being asked to create a secure process by which to transfer this
file across the interent.

Currently:
the lab pushes and button and generates the ASCII file (12 columns)
the lab logs in to a PHP webpage and uses the file upload input to
submit the file.
If data is valid, file is saved on our server in a folder where we can
pull it into the respective tables.


Be nice to have some insights on how to encrypt this file at the
source and how to transfer the file securely. We keep hearing the
words, digital signature.


If the concern is about during the TRANSFER of the data, SSL should be
enough to satisfy virtually any requirement.

The data is encrypted during the transfer.

Where they get digital signature from, I dunno...

Encrypting it at the source and decrypting it at the destination
before you transfer it encrypted via SSL is kinda pointless...

Unless there is an untrusted individual handling it somewhere between
Lab and upload, or between your receipt and stuffing it into your
tables?


It's possible they want it digitally signed so they can verify the 
source. SSL won't help here.


-Stut

--
http://stut.net/

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



Re: [PHP] About XSL Transformation

2007-07-29 Thread Kelvin Park

Nathan Nobbe wrote:
this is basically a design decision on your part.  since you are 
working w/ 2 programming languages, ie.
php and xsl, you will need to determine how much logic is implemented 
in each language.  i would
recommend you devise a scheme early on in your application lifetime 
and stay consitent w/ the decisions

you make.
it will save you headaches in the long run.

-nathan

On 7/29/07, *Kelvin Park* [EMAIL PROTECTED] 
mailto:[EMAIL PROTECTED] wrote:


Nathan Nobbe wrote:
 build or modify the xml w/ php.
 or pickup a book on xsl :)

 -nathan

 On 7/29/07, *Kelvin Park* [EMAIL PROTECTED]
mailto:[EMAIL PROTECTED]
 mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED]
wrote:

 I have an XML file with 10 products with their registered
dates(dates
 when they were created).
 My XSL code is set so that it sorts the products in descending
 order(latest to oldest) by registered dates.
 I tried to declare xsl:variable to increment within
xsl:for-each,
 however I ran in to some dead ends.
 How do I print only the 5 latest products?

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


Thanks!

I checked out sitepoint's XSL book, and figured it out. I tried to
do it
with PHP, for me it seemed just a little bit more work than XSL
transformation.


Since I'm not very familiar with XSL most of my applications are in PHP 
and XML (parsed from MYSQL). I have the current project's design planned 
out with just PHP/XML, however I felt like it was more convenient to 
just do the latest item print out part with XSL (couple of files). I 
might run in to some challenges when I get to pagination, I was thinking 
whether I should deviate a little bit from the plan to create XML/XSL 
pagination of list of items. This might just become all hybrid code with 
PHP and XSL, which I'm not looking forward to have.


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



Re: [PHP] Re: Pirate PHP books online?

2007-07-29 Thread Tom Ray [Lists]



Really, I had expected more mature commentary from the adults on this list.



So did I. I expect adults to display morality and values.


  
Really? Have you hung out with many computer geeks? 
Oh..wait..morality..I thought you said maturity. Pardon me. :)


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



Re: [PHP] Re: Rules of Engagement

2007-07-29 Thread Tom Ray [Lists]

Colin Guthrie wrote:

Daniel Brown wrote:
  

As a relatively-new contributor to this list (read: under 2
years), I realize that I have no business requesting a change, but
I'll breech etiquette and hope for the best.

Can we update the filters on the list to have the reply-to address
header marked to the php-general address?  The reason I ask this is
because, when people are on vacation (such as Juan is now), we receive
responses to our personal addresses.  Secondly, we have to continually
Reply All the messages, which - though it's not a problem - can
cause issues when attempting to respond to those [URGENT] replies.
Third, our addresses are included in gmane, et al, which is an
inherent risk --- I understand.

Maybe it's just the ramblings of someone attempting to read and
type on a limited-bandwidth mobile device while bored due to delays in
mass-transit facilities (here, read: I'm fucking exhausted, and yes, I
dropped the F bomb).  In either case, it's not conducive to a new
contributor to have to weed through vacation response messages each
time he/she replies to the list.



I agree here.

I am on many lists and if I'm interested in something then I expect
people to expect me to read the list for replies. But for noobs, the
personal reply is quite good.

I guess the rule should be public list - reply to poster,
subscription list - reply to list.

AFAIK Gmane etc. can be configured to obfuscate email addresses -
certainly other lists I read through Gmane are...

Col

  
Well I think my only issue with it is that this is a group discussion 
list. We all ask for help, advice, suggestions or just bounce ideas off 
each other. When you hit that Reply button and it just goes to the 
person who made the post you're replying to it no long becomes a group 
discussion but a private one. The other issue is that during these 
private discussions the public version continues and if the solution is 
found in private the others don't know it and could actually spend time 
answering/helping with a problem that was fixed last Tuesday but no one 
knew because it was just a thread between two people.


As for your rule, I think it's flawed. All lists, private or public, 
require you to subscribe in some way. They don't magically pick up that 
they should send email to a certain address, they have to be told. If 
the list is meant to be a discussion list then all the replies should go 
to the list by default.


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



Re: [PHP] Re: Dealing with ImageMagick from PHP

2007-07-29 Thread Eric Holt (PHP List)
Al:  Thanks, sorry for messaging this to the list.  Can you point me in 
the direction of the official phpList forum?


Thanks a ton,
 --Eric





Al wrote:

You'd be far better off asking your questions on the phpList forum.

There are a number of hints on the forum for speeding up things. Plus, 
look in the examples section.


Eric Holt (PHP List) wrote:

Hello everyone.  This is my first post to the list, so bare with me :)

I have written an application for a client that is used in the Event 
Photography business.  It handles taking photographs, categorizing 
them, making thumbnails of them, and allows parents(customers) to view 
the photos and order them.  It runs on LAMP, and it really works great.


For the past two years, we've used ImageMagick v4.2.9 to process the 
thumbnails.  Image quality was decent enough, but the main reason for 
4.2.9 was SPEED.  In my testing, 4.2.9 was quite a bit faster than the 
lastest releases (in the 6.x.x series).  Anyway -- the clients decided 
they wanted me to do some work on the image quality, so I finally 
decided to move up to ImageMagick v.6.3.4.


Right now, I call ImageMagick from a exec call in PHP.  When I first 
wrote the application, it was the quickest and easiest way for me to 
get it working.  Command-line ImageMagick is pretty simple.


So, with ImageMagick 6.3.4, with the sharpening and compression I'm 
now using, the clients are absolutely in love with the thumbnail 
quality -- even though the amount of time it takes to make the 
thumbnails is much longer.  They've asked if anything can be done 
about that, but I think I've optimized the shell script as much as 
possible.


Now, after that long rambling... My question is this:  Would I see a 
big speed improvement by using the ImageMagick extension built into 
PHP (MagicWand, is it called?)?  I'd hate to spend all the time 
recoding the application to work with MagicWand, only to find out that 
I dont end up with any performance increase -- or worse of all, a 
decrease.


I wasnt convinced either way, from the Googling I had done on the 
subject, so I thought I would post the question to the PHP list.


A little more background here, before I go:  PHP iterates through a 
directory of full-sized images, directly out of the camera, and 
exec's a shell script thumbcreation.sh with the details of what 
ImageMagick needs to do, and where it needs to store the new 
thumbnails.  The script calls convert, which creates a medium sized 
thumbnail (333x500), and then from that creates a small thumbnail 
(80x120) from the medium. Then, the script calls composite, where is 
adds a watermark to the medium size thumbnail, and saves it in the 
watermarked directory.


In my initial testing, years ago, I found that ImageMagick v4.2.9 was 
faster than the internal GD library... however, I havnt touched GD 
since my initial testing.  Perhaps GD would be faster now than IM 
v6.3.4(?).


Okay, I've rambled on plenty now, for my first post.  I greatly 
appreciate any advice anyone on the list could provide.



THANKS!!!
 --Eric




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



[PHP] Bizarre array create error

2007-07-29 Thread Ken Tozier

Hi

I'm trying to assign two fields of an object returned from a MySQL  
query and have stumbled upon the most bizarre PHP bug where I can't  
create two arrays in succession.


Here's the MySQL query with two dummy fields to be filled in later

select *, 0 as dummy_1, 0 as dummy_2 from table

Here's how I'm grabbing the query results

$result = array();
while ($row = mysql_fetch_object($query_result))
{
$result[]   = $row;
}

Once that's done, I try to set two of the rows to arrays like this

$result- dummy_1= array(1, 2, 3, 4);
$result- dummy_2= array('a', 'b', 'c', 'd');

If I comment out either of the above lines, the script works but with  
both uncommented, it seems to drop dead. It doesn't even return an  
error.


I rebooted my system thinking PHP might have gotten into a funky  
state but that didn't work. I retyped the function from scratch but  
it still breaks on these two lines. I did a show invisibles and  
show spaces in BBEdit to see if there was a hidden character, none  
found. I did a hex dump to see if there was a hidden character that  
BBEdit was missing, nope. And I haven't upgraded PHP in a year so  
it's not a question of an unstable update.


I've been doing assignments like the above for 3 years and never had  
a problem and in fact the exact same function works perfectly in  
another script.This one has me utterly stumped.


Anyone have an idea what might be causing this? Or something else I  
could try to glean more info about the failure?


Thanks in advance

Ken

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



Re: [PHP] Bizarre array create error

2007-07-29 Thread Ken Tozier


On Jul 29, 2007, at 6:49 PM, Ken Tozier wrote:


Hi

I'm trying to assign two fields of an object returned from a MySQL  
query and have stumbled upon the most bizarre PHP bug where I can't  
create two arrays in succession.


Here's the MySQL query with two dummy fields to be filled in later

select *, 0 as dummy_1, 0 as dummy_2 from table

Here's how I'm grabbing the query results

$result = array();
while ($row = mysql_fetch_object($query_result))
{
$result[]   = $row;
}

Once that's done, I try to set two of the rows to arrays like this

$result- dummy_1= array(1, 2, 3, 4);
$result- dummy_2= array('a', 'b', 'c', 'd');


Oops. Left out a step. This is actually how I'm doing the assignments

$result[0]- dummy_1 = array(1, 2, 3, 4);
$result[0]- dummy_2 = array('a', 'b', 'c', 'd');




If I comment out either of the above lines, the script works but  
with both uncommented, it seems to drop dead. It doesn't even  
return an error.


I rebooted my system thinking PHP might have gotten into a funky  
state but that didn't work. I retyped the function from scratch but  
it still breaks on these two lines. I did a show invisibles and  
show spaces in BBEdit to see if there was a hidden character,  
none found. I did a hex dump to see if there was a hidden character  
that BBEdit was missing, nope. And I haven't upgraded PHP in a year  
so it's not a question of an unstable update.


I've been doing assignments like the above for 3 years and never  
had a problem and in fact the exact same function works perfectly  
in another script.This one has me utterly stumped.


Anyone have an idea what might be causing this? Or something else I  
could try to glean more info about the failure?


Thanks in advance

Ken

--
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] Re: Dealing with ImageMagick from PHP

2007-07-29 Thread Al

Google imagemagik forums

Eric Holt (PHP List) wrote:
Al:  Thanks, sorry for messaging this to the list.  Can you point me in 
the direction of the official phpList forum?


Thanks a ton,
 --Eric





Al wrote:

You'd be far better off asking your questions on the phpList forum.

There are a number of hints on the forum for speeding up things. Plus, 
look in the examples section.


Eric Holt (PHP List) wrote:

Hello everyone.  This is my first post to the list, so bare with me :)

I have written an application for a client that is used in the Event 
Photography business.  It handles taking photographs, categorizing 
them, making thumbnails of them, and allows parents(customers) to 
view the photos and order them.  It runs on LAMP, and it really works 
great.


For the past two years, we've used ImageMagick v4.2.9 to process the 
thumbnails.  Image quality was decent enough, but the main reason for 
4.2.9 was SPEED.  In my testing, 4.2.9 was quite a bit faster than 
the lastest releases (in the 6.x.x series).  Anyway -- the clients 
decided they wanted me to do some work on the image quality, so I 
finally decided to move up to ImageMagick v.6.3.4.


Right now, I call ImageMagick from a exec call in PHP.  When I 
first wrote the application, it was the quickest and easiest way for 
me to get it working.  Command-line ImageMagick is pretty simple.


So, with ImageMagick 6.3.4, with the sharpening and compression I'm 
now using, the clients are absolutely in love with the thumbnail 
quality -- even though the amount of time it takes to make the 
thumbnails is much longer.  They've asked if anything can be done 
about that, but I think I've optimized the shell script as much as 
possible.


Now, after that long rambling... My question is this:  Would I see a 
big speed improvement by using the ImageMagick extension built into 
PHP (MagicWand, is it called?)?  I'd hate to spend all the time 
recoding the application to work with MagicWand, only to find out 
that I dont end up with any performance increase -- or worse of all, 
a decrease.


I wasnt convinced either way, from the Googling I had done on the 
subject, so I thought I would post the question to the PHP list.


A little more background here, before I go:  PHP iterates through a 
directory of full-sized images, directly out of the camera, and 
exec's a shell script thumbcreation.sh with the details of what 
ImageMagick needs to do, and where it needs to store the new 
thumbnails.  The script calls convert, which creates a medium sized 
thumbnail (333x500), and then from that creates a small thumbnail 
(80x120) from the medium. Then, the script calls composite, where is 
adds a watermark to the medium size thumbnail, and saves it in the 
watermarked directory.


In my initial testing, years ago, I found that ImageMagick v4.2.9 was 
faster than the internal GD library... however, I havnt touched GD 
since my initial testing.  Perhaps GD would be faster now than IM 
v6.3.4(?).


Okay, I've rambled on plenty now, for my first post.  I greatly 
appreciate any advice anyone on the list could provide.



THANKS!!!
 --Eric




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



Re: [PHP] About XSL Transformation

2007-07-29 Thread Andrew Ballard
 I tried to declare xsl:variable to increment within xsl:for-each,
 however I ran in to some dead ends.

Variables in XSL are not most programmers think of when they hear the
term variable. They are variable in the sense that they can be
assigned a value at run-time, but they are really more like constants.
Once set, they can't be changed.

 How do I print only the 5 latest products?

Assuming you've correctly ordered the products by date (dates are
handled as strings in XSL, so you'll want to make sure you're using
the correct date format to get them to sort correctly), you can add
something like ... and position() lt;= 5 in your node test.

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



Re: [PHP] HTML Email Composing Problem.

2007-07-29 Thread Chris

Tom Ray [Lists] wrote:

Chris wrote:

Richard Lynch wrote:

On Thu, July 26, 2007 2:46 pm, Tom Ray [Lists] wrote:

I'm trying to use PHP to compose an HTML formatted email


Don't do that...


3) Spam Assassin doesn't like it either way and tags the email as SPAM
for the following reasons:

 0.6 HTML_SHORT_LENGTH  BODY: HTML is extremely short
 0.0 HTML_MESSAGE   BODY: HTML included in message
 1.5 MIME_BASE64_TEXT   RAW: Message text disguised using base64
encoding


snip

However, I would still like to get answers on questions 1 and 2 for 
future reference so any thoughts would be great.


They're pretty self explanatory.

1) Make your message longer
2) Your message contains html. Your rules are set up to flag anything 
with html as spam.


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

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



Re: [PHP] Re: Pirate PHP books online?

2007-07-29 Thread Larry Garfield
On Sunday 29 July 2007, Dotan Cohen wrote:
 On 29/07/07, Larry Garfield [EMAIL PROTECTED] wrote:
  1) Something can be illegal without it being theft.  The idea that if
  it's not theft then it must be OK is the bullshit argument that I am
  pointing out as bullshit.

 That's a valid point, but you are playing lawyer's games. It's not
 theft, it's QQQ, which is different from theft in X Y and Z. Nobody
 likes lawyers or their games. Call it what you will, copyright
 infringement is taking something without paying for it.

You can call whatever you want anything you want, but that doesn't make it 
true.  For instance, no, copyright infringement is NOT taking something 
without paying for it.  Copyright infringement is duplicating an expression 
of an idea that is fixed in a medium without the permission of the copyright 
holder.  Money doesn't enter into it.

If copyright infringement were taking something without paying for it, then 
anyone who's ever installed PHP is guilty of copyright infringement unless 
they sent Rasmus a check.  That is, of course, nonsense.

  3) At no point in this conversation have I ever said that I engage in or
  support copyright infringement, and I am insulted that you would accuse
  me of such without any evidence or justification to back it up.

 You are insinuating it. 

And you are making things up.

 I was also accused of supporting copyright 
 infringement earlier in the thread, yet I was not insulted. Don't be
 so sensitive. There are bigger jerks than me on the Internet. And I
 was not targeting you specifically. I was targeting your comments.

  I am pointing out that you are saying things that are *factually
  inaccurate by the laws of the United States*.  And for that you accuse me
  of copyright infringement and being immoral?  That is without a doubt the
  most offensive comment I've seen on this list so far.  I would say I
  expect an apology, but given that you fall back on insulting someone's
  ethics just because they don't buy into the same lie that the media
  cartels have been spreading that you do I won't hold my breath.

 I never said anything about the laws of the United States. I don't
 even live there, what do I care about their laws? I am, however, a
 moral human being, and that is my motivation.

I am not as familiar with the laws of Canada, the EU, or Australia (I'm 
assuming you're probably in one of those), but my understanding is that the 
law is similar in those countries, except less restrictive on duplication 
than US laws are; at least for now.

  Really, I had expected more mature commentary from the adults on this
  list.

 So did I. I expect adults to display morality and values.

It's not just a simple lawyer game.  The distinction does make a difference.  
Here's why:

A great many people -- myself included but also the Creative Commons folks, 
the FSF, many open source developers, and many others -- believe the current 
system of copyright law to be fundamentally flawed.  Not that we shouldn't 
have copyright, but that the current form of copyright is broken.  A work 
restricted for an entire generation after the original author is 
dead?  Digital Restriction Management software that makes even Fair Use a 
felony?  Retroactively extending copyright terms?  Making experimentation 
with either art or technology either prohibited or prohibitively expensive?  
Yes, broken.  

As many people in this thread have already stated, most artists/authors don't 
actually benefit from this system.  The public certainly doesn't.  The only 
people who actually benefit from it are the Robert Igers (Disney President, 
CEO, and COO) and Britney Spears of the world.  Those people, however, have 
spent the last 40 years trying to convince people that copyright is 
really property, and therefore is a moral right as inviolate as Life, 
Liberty, and Pursuit of Happiness.  Witness your own reply, where you quite 
openly accuse me of not having morality and values because I dare say that 
copyright infringement is not a mortal sin.  You have bought into a lie.

And the rank-and-file artists and authors of the world do not benefit from 
perpetuating that lie.  The current direction the law is moving, toward more 
restrictions on the exchange of information, is bad for anyone who isn't 
Robert Iger or Britney Spears.  That's why it is important to confront and 
correct that lie.  It must be corrected before copyright can be sanely 
reformed to benefit the public (its supposed goal) and original 
artists/authors, not a select few mega-corps.  

At no point have I said that copyright infringement is not illegal.

At no point have I said that copyright infringement is a good thing.

At no point have I encouraged people to engage in copyright infringement.

At every point, I have pointed out what the law actually says, and why it says 
it.

And for that, I am accused of having no morality and values.

Yes, I do take this issue very seriously, as should anyone who 

[PHP] php not working anymore in IIS

2007-07-29 Thread Guus Ellenkamp
After changing my php folder from e:\php to f:\php php does not work anymore 
in my webserver. I found out regsvr32 phpisapi.dll gives an error. I 
remember having a similar problem but am not sure what and how.

Anyone know how to fix? 

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



Re: [PHP] Bizarre array create error

2007-07-29 Thread Tom Ray [Lists]

Ken Tozier wrote:

Hi

I'm trying to assign two fields of an object returned from a MySQL 
query and have stumbled upon the most bizarre PHP bug where I can't 
create two arrays in succession.


Here's the MySQL query with two dummy fields to be filled in later

select *, 0 as dummy_1, 0 as dummy_2 from table

Here's how I'm grabbing the query results

$result= array();
while ($row = mysql_fetch_object($query_result))
{
$result[]= $row;
}

Once that's done, I try to set two of the rows to arrays like this

$result- dummy_1= array(1, 2, 3, 4);
$result- dummy_2= array('a', 'b', 'c', 'd');

If I comment out either of the above lines, the script works but with 
both uncommented, it seems to drop dead. It doesn't even return an error.
Is this all of your code? Do you have some sort of output display for 
your results? Does PHP generally return errors to the browser? When I 
tried your code above with a test table with four data fields I got this 
error:

*
Warning*: Attempt to assign property of non-object in 
*/usr/local/apache/htdocs/test-script.php* on line *14
**Warning*: Attempt to assign property of non-object in 
*/usr/local/apache/htdocs/test-script.php* on line *15


*Then I re-read your code and realized that you made $row an object not 
$result, it's just an array. Changing this:


$result-dummy_1= array(1, 2, 3, 4);  
$result-dummy_2= array('a', 'b', 'c', 'd'); 


to this:

$row-dummy_1= array(1, 2, 3, 4);  
$row-dummy_2= array('a', 'b', 'c', 'd'); 

Yielded no errors for me what so ever. However, since it's unclear on 
what you are doing with this data I can't vouch that it's actually what 
you need. Double check your display_errors setting in your php.ini and 
make sure it's set to On. Because you're either not giving us all the 
code to work with and something else is happening and that's why you 
don't get the error but not your desired result or you're not displaying 
the errors.


I've been doing assignments like the above for 3 years and never had a 
problem and in fact the exact same function works perfectly in another 
script.This one has me utterly stumped.


Does that script run on the same machine? If it's on another machine is 
that machine running the same version? I ran this on  a server with 
Apache 2.2.4, PHP 5.2.3 and mySQL 5.0.18. Have you referenced that other 
script to make sure that it *is* exactly the same?


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



Re: [PHP] Re: Rules of Engagement

2007-07-29 Thread Micky Hulse

Tom Ray [Lists] wrote:
Well I think my only issue with it is that this is a group discussion 
...snip...

to the list by default.


I agree with Tom.

I ussually hit reply, and take a few seconds to delete all the emails 
except the list email -- not very hard. :)




--
Wishlists: http://snipurl.com/1gqpj
   Switch: http://browsehappy.com/
 BCC?: http://snipurl.com/w6f8
   My: http://del.icio.us/mhulse

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



Re: [PHP] Bizarre array create error

2007-07-29 Thread Ken Tozier


On Jul 30, 2007, at 12:05 AM, Tom Ray [Lists] wrote:


Ken Tozier wrote:

Hi

I'm trying to assign two fields of an object returned from a MySQL  
query and have stumbled upon the most bizarre PHP bug where I  
can't create two arrays in succession.


Here's the MySQL query with two dummy fields to be filled in later

select *, 0 as dummy_1, 0 as dummy_2 from table

Here's how I'm grabbing the query results

$result= array();
while ($row = mysql_fetch_object($query_result))
{
$result[]= $row;
}

Once that's done, I try to set two of the rows to arrays like this

$result- dummy_1= array(1, 2, 3, 4);
$result- dummy_2= array('a', 'b', 'c', 'd');

If I comment out either of the above lines, the script works but  
with both uncommented, it seems to drop dead. It doesn't even  
return an error.



Is this all of your code?


No. Here's the full function:
function get_document_type_for_pub($inPubID)
{
	$query	= select doc_type.*, 0 as rect, 0 as usable_rect, 0 as  
usable_width, 0 as usable_height, 0 as column_width, 0 as  
column_offsets, 0 as box_widths from publication, doc_type where  
publication.id=.$inPubID. and publication.doc_type=doc_type.id;

$queryResult= $this-db-query_database($query);
$result = $queryResult[0];

// convert numbers
$result-id  += 0;
$result-page_width  += 0.0;
$result-page_height += 0.0;
$result-top_margin  += 0.0;
$result-left_margin += 0.0;
$result-bottom_margin   += 0.0;
$result-right_margin+= 0.0;
$result-column_count+= 0;
$result-gutter_width+= 0.0;
$result-folio_height+= 0.0;
$result-usable_width+= 0.0;
$result-usable_height   += 0.0;
$result-column_width+= 0.0;

// calculate derived values
	$result-usable_width	= $result-page_width - $result-left_margin -  
$result-right_margin;
	$result-usable_height	= $result-page_height - $result-top_margin  
- $result-bottom_margin;
	$result-column_width	= ($result-usable_width - $result- 
gutter_width * ($result-column_count - 1)) / $result-column_count;


/*--*/
/* Next two lines are where the problem starts  */
/* If I comment either of them out the script runs  */
/* but with both uncommented, it dies
/*--*/
// create the rect and usable rect records
	$result-rect			= array(0, 0, $result-page_width, $result- 
page_height);
	$result-usable_rect	= array($result-left_margin, $result- 
top_margin, $result-usable_width, $result-usable_height);


// create the offset and box width arrays
$offsets= array();
$widths = array();
$left   = $result-left_margin;
$width  = $result-column_width;
$inc= $result-column_width + 
$result-gutter_width;

for ($i = 0; $i  $result-column_count; $i++)
{
$offsets[]  = $left;
$widths[]   = array('column_width'= $i + 1, 
'point_width'= $width);
$left   += $inc;
$width  += $inc;
}

$result-column_offsets  = $offsets;
$result-box_widths  = $widths;

return $result;
}



Do you have some sort of output display for your results?


No. Once it hits the create the rect and usable rect records  
assignments, it's like the script didn't even get called. Nothing  
returns.



Does PHP generally return errors to the browser?


I'm not using a browser, I'm making direct calls to the script from a  
Cocoa class on a Mac



Does that script run on the same machine?


Yes. I'm doing all development on my MacBook and the scripts all live  
in my local web folder.


If it's on another machine is that machine running the same  
version? I ran this on  a server with Apache 2.2.4, PHP 5.2.3 and  
mySQL 5.0.18. Have you referenced that other script to make sure  
that it *is* exactly the same?


I cut and pasted it from its original home to a new script and it  
stopped working.


Thanks for replying Tom. I'll check out the php.ini settings tomorrow

Ken

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