Re: [PHP] counting with leading zeros

2007-09-26 Thread Jim Lucas

brian wrote:
I have a directory that contains many images (no, not pr0n, 
unfortunately) and i'm working on an admin script for adding to it. I've 
got something that works alright but i'm wondering if there's a Better Way.


Each image is named like: foo_01.jpg, foo_02.jpg, bar_01.jpg, and so on. 
When adding a new image it should be assigned the next number in the 
series (the prefix is known). Thus, given the prefix 'bar' i do 
something like:


function getNextImage($path, $prefix)
{
  $pattern = "/^${prefix}_([0-9]{2})\.[a-z]{3}$/";

  $filenames = glob("${path}${prefix}*");

  if (is_array($filenames) && sizeof($filenames))

  {
sort($filenames);

/* eg. 'foo_32.jpg'
 */
$last = basename(array_pop($filenames));

/* pull the number from the filename
 */
$count = intval(preg_replace($pattern, '$1', $last));

/* increment, format with leading zero again if necessary,
 * and return it
 */
return sprintf('%02d', ++$count)
  }
  else
  {
return '01';
  }
}

Note that there almost certainly will never be more than 99 images to a 
series. In any case, i don't care about there being more than one 
leading zero. One is what i want.


brian




Well, I didn't want to get into the middle of this cat fight, but now 
that the talks have completely gotten off topic.  I will interject...


Here is a function that is a bit simpler then either of yours.

Now, if you plan to delete any images in the list, this will not work.

But if you don't expect to delete any images in the list and always want 
the ($total_images + 1), then follow along.




This should work, I don't have a setup to test it on, but you should get 
the idea...


...

now remember...

if glob fails, it will return '01'
if glob returns and empty array, it will return '01'
if glob succeeds, it will return the array length + 1 padded (if needed) 
 by one zero


You asked for less function calls in your function, here you go

Jim

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



Re: [PHP] counting with leading zeros

2007-09-26 Thread Robert Cummings
On Thu, 2007-09-27 at 00:23 -0400, brian wrote:
> Robert Cummings wrote:
> > When you use sort() the default behaviour is a lexical sort. This is why
> > the 100th index breaks your system. I'm not trying to be a dickhead,
> > just pointing out the flaw in your logic. You may be well aware that in
> > counting 100 comes after 99, but it would seem you are not well aware
> > that in a lexical sort 100 will come first.
> > 
> 
> I realise that this has been going on for some time now but i did say 
> that this app will not--cannot--reach to 100. If it were to do so, my 
> "system" would have become broken *long* before it reached sort(). 
> Lexical sorting of '99' & '100' has nothing to do with this.
> 
> Just pointing out the flaw in your persistence with this.

Actually your original message said the following:

"Note that there almost certainly will never be more
 than 99 images to a series. In any case, i don't care
 about there being more than one leading zero. One is
 what i want."

"Almost certainly" last time I checked does not equal "will not".

Cheers,
Rob.
-- 
...
SwarmBuy.com - http://www.swarmbuy.com

Leveraging the buying power of the masses!
...

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



Re: [PHP] counting with leading zeros

2007-09-26 Thread brian

Robert Cummings wrote:

When you use sort() the default behaviour is a lexical sort. This is why
the 100th index breaks your system. I'm not trying to be a dickhead,
just pointing out the flaw in your logic. You may be well aware that in
counting 100 comes after 99, but it would seem you are not well aware
that in a lexical sort 100 will come first.



I realise that this has been going on for some time now but i did say 
that this app will not--cannot--reach to 100. If it were to do so, my 
"system" would have become broken *long* before it reached sort(). 
Lexical sorting of '99' & '100' has nothing to do with this.


Just pointing out the flaw in your persistence with this.

b

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



Re: [PHP] PDOStatement execute memory issue?

2007-09-26 Thread Larry Garfield
On Wednesday 26 September 2007, Carlton Whitehead wrote:

> Could this be some bug in the way PHP, PDO, ODBC, and/or MS SQL are
> communicating?  Maybe 'image' columns aren't being handled correctly?
> I'm fairly certain my code is correct.  I appreciate all of your comments.
>
> Has anyone even tried querying an 'image' type column out of MS SQL 2005
> using PDO ODBC?
>
> Regards,
> Carlton Whitehead

Try isolating the problem.  If you have a literal query through PDO that 
fails, in isolation, try the same query using the old-skool odbc routines; 
just a trivial test script.  If that works but the same test script converted 
to minimal PDO fails, you've found a bug.  If it fails in both cases, I'd 
start blaming something else.

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



Re: [PHP] counting with leading zeros

2007-09-26 Thread Robert Cummings
On Wed, 2007-09-26 at 22:39 -0400, brian wrote:
> Robert Cummings wrote:
> > On Wed, 2007-09-26 at 19:10 -0400, brian wrote:
> > 
> >>If my response to that gave you the impression i was
> >>complaining, i assure you that i wasn't. I was simply suggesting
> >>that i was wondering if there was a *much* simpler way to do this, ie.
> >>without using several functions to process the filename. Yes, your
> >>version *does* have some improvements. I'm not disagreeing with you. 
> >>Perhaps i could have been more forthright in my praise for said 
> >>improvements (i'm even going to use some of them--how about that?!)
> > 
> > 
> > Well, I'm not looking for praise... but asking a concise question goes a
> > long way towards meeting your desires.
> 
> How was my question *not* concise? If anything, it was my first reply to 
> you that i could have spent more time on. Once again: your reply was 
> valid, your corrections were taken into consideration, *but* i was 
> simply wondering if there was a more (yes) concise way to do what i 
> wanted. My humble apologies (really).
> 
> >>IOW, i'm not stupid; i'm well aware that 100 comes after 
> >>99 and that it contains 3 digits, not 2, thanks very much.
> > 
> > 
> > Nope, 100 comes *before* 99 when lexically sorting.
> > 
> > You must be new around here.
> > 
> 
> Did i say anything there about lexically sorting? The query i posted 
> here was about counting. That last comment? Yep, counting again. Now 
> you're obviously just trying to be a dickhead. Well done.

When you use sort() the default behaviour is a lexical sort. This is why
the 100th index breaks your system. I'm not trying to be a dickhead,
just pointing out the flaw in your logic. You may be well aware that in
counting 100 comes after 99, but it would seem you are not well aware
that in a lexical sort 100 will come first.

> You must be charming to work with.

Quite.

Cheers,
Rob.
-- 
...
SwarmBuy.com - http://www.swarmbuy.com

Leveraging the buying power of the masses!
...

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



Re: [PHP] PDOStatement execute memory issue?

2007-09-26 Thread Carlton Whitehead
No, the faxes aren't 4GB.  Most of the faxes are less than 50KB, 
although they can be as large as a few MB.  4GB is a ridiculous amount 
of memory to try to allocate for this.  4GB is the max that 32bit 
versions of Windows can see.  Is something causing the memory allocation 
to loop until it reaches this maximum value?


When I execute the same SQL in the MS SQL management studio interface, I 
get the expected resultset.


When I change the where clause portion in the prepared statement from 
"WHERE id = :id AND attid = :attid" to contain "WHERE id = 
119085977300014 AND attid = 0" and comment out my bindValue() lines, I 
get the exact same memory allocation error in my PHP script.


I have isolated the problem to the query against the attdata column.  If 
I remove the attdata column from the query, the query executes just 
fine.  It may be worth noting this is an 'image' type column.


Could this be some bug in the way PHP, PDO, ODBC, and/or MS SQL are 
communicating?  Maybe 'image' columns aren't being handled correctly?  
I'm fairly certain my code is correct.  I appreciate all of your comments.


Has anyone even tried querying an 'image' type column out of MS SQL 2005 
using PDO ODBC?


Regards,
Carlton Whitehead

Jeffery Fernandez wrote:

On Thursday 27 September 2007 04:21, Carlton Whitehead wrote:
  

Hi everyone,

I'm working on a script that downloads archived fax images (TIFFs and PDFs)
from a MS SQL Server using the PDO ODBC driver. I get the below error
regardless of which fax I try to get from the database. Each fax is a
different size, and both of the memory allocation numbers are always the
same:

Fatal error: Out of memory (allocated 262144) (tried to allocate 4294967295
bytes) in C:\Inetpub\wwwroot\FMarchive\library\faxInbound.php on line 81



Ho big are those faxes? 4294967295 bytes = 4GB

have you tried executing that SQL directly into the database? Does it return 
the right results?


  
The above error happened when querying a fax with a size of 17723 bytes. 
According to my phpinfo(); page, the memory_limit is 128MB.


My machine has the below specs:
Windows Server 2003 SP2
IIS 6
2GB RAM
Microsoft SQL Server 2005 SP2
PHP 5.2.4

Here is the excerpt from my code:

public function downloadFax($id, $attid, $attsize)
{
try
{
$stmt = 'SELECT filename, attdata FROM 
fm_faxin_att WHERE id = :id AND
attid = :attid'; $pstmt = $this->db->prepare($stmt);
$pstmt->bindValue(':id', $id);
$pstmt->bindValue(':attid', $attid);
$pstmt->execute(); // this is the Line 81 
referenced by the error
message $pstmt->bindColumn('filename', $filename, PDO::PARAM_STR);
$pstmt->bindColumn('attdata', $data, 
PDO::PARAM_LOB);
$pstmt->fetch(PDO::FETCH_BOUND);

return array('attdata' => $data, 'filename' => 
$filename);
}
catch (PDOException $e)
{
die($e->getMessage());
}
}

Any ideas?

Regards,
Carlton Whitehead



  


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



Re: [PHP] counting with leading zeros

2007-09-26 Thread brian

Robert Cummings wrote:

On Wed, 2007-09-26 at 19:10 -0400, brian wrote:


If my response to that gave you the impression i was
complaining, i assure you that i wasn't. I was simply suggesting
that i was wondering if there was a *much* simpler way to do this, ie.
without using several functions to process the filename. Yes, your
version *does* have some improvements. I'm not disagreeing with you. 
Perhaps i could have been more forthright in my praise for said 
improvements (i'm even going to use some of them--how about that?!)



Well, I'm not looking for praise... but asking a concise question goes a
long way towards meeting your desires.


How was my question *not* concise? If anything, it was my first reply to 
you that i could have spent more time on. Once again: your reply was 
valid, your corrections were taken into consideration, *but* i was 
simply wondering if there was a more (yes) concise way to do what i 
wanted. My humble apologies (really).


IOW, i'm not stupid; i'm well aware that 100 comes after 
99 and that it contains 3 digits, not 2, thanks very much.



Nope, 100 comes *before* 99 when lexically sorting.

You must be new around here.



Did i say anything there about lexically sorting? The query i posted 
here was about counting. That last comment? Yep, counting again. Now 
you're obviously just trying to be a dickhead. Well done.


You must be charming to work with.

brian

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



Re: [PHP] counting with leading zeros

2007-09-26 Thread Robert Cummings
On Wed, 2007-09-26 at 19:10 -0400, brian wrote:
> Robert Cummings wrote:
>
> >> Well, this is almost precisely the same thing i have, save for 
> >> using POSIX character classes, str_pad instead of sprintf(), and 
> >> incrementing elsewhere. What i was really wondering is if there was
> >>  a *much simpler* way to do this, not just re-arranging things.
> > 
> > 
> > You asked for a "Better Way". I gave you a "Better Way". I improved 
> > the regex, removed the useless basename() call, performed 
> > incrementation in the extraction step, used better function and 
> > variable names, and used the str_pad() function because sprintf() is 
> > overkill. I also removed your redundant else clause. My version is 
> > much simpler. How much is much? You know... much! Other than using a 
> > database, it doesn't really get any simpler. Although you obviously 
> > have race condition issues also. But that's not getting "simpler". 
> > It's getting more correct but also a bit more complex.
> > 
> 
> Bad day or something?

Nope.

> Did it really seem that i was bitching about your 
> response?

Kinda.

> If my response to that gave you the impression i was
> complaining, i assure you that i wasn't. I was simply suggesting
> that i was wondering if there was a *much* simpler way to do this, ie.
> without using several functions to process the filename. Yes, your
> version *does* have some improvements. I'm not disagreeing with you. 
> Perhaps i could have been more forthright in my praise for said 
> improvements (i'm even going to use some of them--how about that?!)

Well, I'm not looking for praise... but asking a concise question goes a
long way towards meeting your desires.

> >>> Note that the moment you get 100 images the code breaks because 
> >>> _100 sorts before _99 and so you will always write over the 100th
> >>>  index. To fix this you need to loop through all found files and 
> >>> pull the index out and record the highest found.
> >> 
> >> For my purposes, if any series gets much beyond 40 i'll have bigger
> >>  problems to worry about. I'm content to not worry about overflow 
> >> in this case.
> >
> > Suit yourself. But better programmer's don't just wave their hands in
> >  the air and hope for the best. 
> 
> While i agree with you in principle, i'm not interested in that aspect
> of it. The application would have halted *long* before it could reach
> that many. This is why i went to the trouble of pointing this out in the 
> original mail. IOW, i'm not stupid; i'm well aware that 100 comes after 
> 99 and that it contains 3 digits, not 2, thanks very much.

Nope, 100 comes *before* 99 when lexically sorting.

You must be new around here.

Cheers,
Rob.
-- 
...
SwarmBuy.com - http://www.swarmbuy.com

Leveraging the buying power of the masses!
...

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



[PHP] Re: [horde] Requirement of IMP / Horde

2007-09-26 Thread Ashley M. Kirchner

[EMAIL PROTECTED] wrote:

post_max_size = 10M
max_execution_time = 3600 ; Maximum execution time of each script, in
seconds
max_input_time = 3600 ; Maximum amount of time each script may spend
parsing request data
memory_limit = 512M ; Maximum amount of memory a script may consume
file_uploads = On
upload_max_filesize = 8M

But For IMP Display result :

1, Maximum Attachment Size: 2,097,152 bytes ( only 2MB ??? )
2, Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to
allocate 1519127 bytes) in
/home/itawm/html/horde/lib/Horde/MIME/Part.php on line 1027 ( limit 8MB
??? )
   You obviously don't ever read any of the numerous replies that 
people have sent you so far, on the Fedora list, on the PHP list, and 
now you want to come here on Horde/IMP and ask the same exact question 
again.  You have had several replies to this problem now, all of them 
pointing you directly to where you need to go inside of your Horde/IMP 
configuration to fix this problem.


   READ YOUR E-MAIL RESPONSES AND STOP BOTHERING PEOPLE ON MULTIPLE 
LISTS WITH THE SAME PROBLEM OVER AND OVER AGAIN.




--
H | It's not a bug - it's an undocumented feature.
 +
 Ashley M. Kirchner    .   303.442.6410 x130
 IT Director / SysAdmin / Websmith . 800.441.3873 x130
 Photo Craft Imaging   . 3550 Arapahoe Ave. #6
 http://www.pcraft.com . .  ..   Boulder, CO 80303, U.S.A. 


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



Re: [PHP] SOAP in PHP on very restricted host?

2007-09-26 Thread Larry Garfield
On Wednesday 26 September 2007, David Christopher Zentgraf wrote:
> On  26. Sep 2007, at 16:45, Nathan Nobbe wrote:
> > i hate to suggest it, but you might want to take a little time and
> > investigate what other restrictions you host has.  if the list is
> > long you may want to consider a
> > move. it may seem arduous now, but the longer you wait the more
> > arduous it will
> > become.
>
> Oh, we know our host sucks major [primate] [primate][bodypart].
> The plan is to eventually have our own servers in-house, but until
> then, there really isn't that much choice unfortunately. As far as we
> observed all of the major hosts in Tokyo (Hi from Japan!) are pretty
> much the same. And hosting abroad is out of the question, since
> latency goes right up and throughput down with every inch off the
> Japanese coast. Unless somebody has a good tip for a good host...

http://gophp5.org/hosts

Doesn't look like there's any in Japan, but perhaps there's one nearby in Asia 
that could be good enough.  

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



Re: [PHP] trouble trying to connect to gmail server.

2007-09-26 Thread Fábio Generoso
*Hi Cris,*

*I have tried to use:*

*$mbox = 
imap_open('{**pop.gmail.com:995/pop3}INBOX
**<**http://pop.gmail.com:995/pop3%7DINBOX**>',*

*> '@**gmail.com**', ');*

 *As you suggest but it didn't work. *



*The time out is not for the function:*

*imap_num_recent($mbox);*

*It is for the function:*

*imap_open('{pop.gmail.com:995/pop3}INBOX', '@**gmail.com**',
'**);*



*In order to confirm that, I have created a new account with just 5 e-mails
and I have gotten the same problem.*

*And... I also check that using the code without the function*:
imap_num_recent($mbox); *as* *bellow:*

*$mbox = imap_open('{pop.gmail.com:995/pop3}INBOX','[EMAIL PROTECTED]',
'O3S/4o1*');*

*print_r(imap_alerts());*

*print_r(imap_errors());*



*I got the same message error:*

*Warning**: imap_open(): Couldn't open stream
{pop.gmail.com:995/pop3}INBOXin c:\arquivos
de programas\easyphp1-8\www\index.php on line 4

Fatal error: Maximum execution time of 30 seconds exceeded in c:\arquivos de
programas\easyphp1-8\www\index.php on line 4

Notice: (null)(): POP3 connection broken in response (errflg=2) in
Unknownon line
0*

* *

*So I have tried to use the function* *set_time_limit(0);* *to suppress  the
time out but it still didn't work:*

*set_time_limit(0);*

*$mbox = imap_open('{pop.gmail.com:995/pop3}INBOX','[EMAIL PROTECTED]',
'O3S/4o1*');*

*print_r(imap_alerts());*

*print_r(imap_errors());*



*I got these errors:*

*Warning**: imap_open(): Couldn't open stream
{pop.gmail.com:995/pop3}INBOXin c:\arquivos
de programas\easyphp1-8\www\index.php on line 4
Array ( [0] => POP3 connection broken in response )*



*Looks like I have reached the gmail server but for same configuration or
network issue, I'm not able to receive the answer. *

*Any suggestion?*

* *

*Tks.*


On 9/24/07, Chris <[EMAIL PROTECTED]> wrote:
>
>
> > Array ( [0] => Host not found (#11001): pop3.gmail.com )
>
> So pop3.gmail.com doesn't exist.
>
> >  > $mbox = imap_open('{pop.gmail.com:995/pop3}INBOX<
> http://pop.gmail.com:995/pop3%7DINBOX>',
> > '@gmail.com', ');
> > print_r(imap_alerts());
> > print_r(imap_errors());
> > $num_mens_not_read = imap_num_recent($mbox);
> > imap_close($mbox);
> > ?>
> >
> > I get these errors:
> >
> > Warning: imap_open(): Couldn't open stream {
> > pop.gmail.com:995/pop3}INBOXin
> > c:\arquivos de programas\easyphp1-8\www\index.php on line 4
> > Fatal error: Maximum execution time of 30 seconds exceeded in
> c:\arquivos de
> > programas\easyphp1-8\www\index.php on line 4
> > Notice: (null)(): POP3 connection broken in response (errflg=2) in
> Unknown
> > on line 0
> >
> >
> > This second code looks like ok for me, but for some reason I get this
> time
> > out. Do you have any idea what's going on? Did I miss some
> configuration?
>
> Line 4 is
>
> $num_mens_not_read = imap_num_recent($mbox);
>
> so it's taking too long to work out how many are recent.
>
> How many unread messages are there in your account? How many messages in
> total?
>
> --
> Postgresql & php tutorials
> http://www.designmagick.com/
>


Re: [PHP] [Fwd: Attachment Size and Memory limit with php and FC6 System]

2007-09-26 Thread Jim Lucas
[EMAIL PROTECTED] wrote:
> Jim Lucas wrote:
> 
>> [EMAIL PROTECTED] wrote:
>>
>>> post_max_size = 10M
>>> max_execution_time = 3600 ; Maximum execution time of each script, in
>>> seconds
>>> max_input_time = 3600 ; Maximum amount of time each script may spend
>>> parsing request data
>>> memory_limit = 512M ; Maximum amount of memory a script may consume
>>> file_uploads = On
>>> upload_max_filesize = 8M
>>>
>>> But For IMP Display result :
>>>
>>> 1, Maximum Attachment Size: 2,097,152 bytes ( only 2MB ??? )
>>
>> Not sure what Maximum Attachment Size is referring to. Never heard of
>> that setting
>>
>> Where are you getting #1 reading from? Are you sure that isn't a
>> preset limit in Horde?
>>
>>> 2, Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to
>>> allocate 1519127 bytes) in
>>> /home/itawm/html/horde/lib/Horde/MIME/Part.php on line 1027 ( limit 8MB
>>> ??? )
>>
>> your file upload was larger then 8MB... ?? What is confusing about this?
>>
>>> Mine is Linux FC6 System...
>>>
>>> Many thanks your help !
>>>
>>> Edward.
>>>
>>
> Hello Jim,
> 
> Are you using the imp with FC6 also ?

no

> If so, have you meet this kind of problem ?

no

> Any more help or idea for me ?

Not at this time since you didn't answer my questions about Horde.

> 
> Many thanks !
> 
> Edward.

it looks like PHP is doing exactly what it should be doing.  I read that you 
tried uploading a file
that was larger then the 8MB limit.  That is a PHP error you showed us.

How and where is the #1 error show to you?

Never mind, I took 30 seconds and had Google tell me.

http://www.google.com/search?q=imp+%22maximum+attachment+size%22+site%3Awiki.horde.org

Check it out here

http://wiki.horde.org/FAQ/Admin/Config?referrer=FAQ%2FAdmin#

About two thirds the way down the page it will give you the answer the my 
initial question.

" How can I configure IMP's maximum attachment size? "

*  man they should insert anchor tags so someone can link directly to what we 
are referring to

It is not PHP that is setting the limit.  2MB is the default for the "maximum 
attachment size"

-- 
Jim Lucas

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

Twelfth Night, Act II, Scene V
by William Shakespeare

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



Re: [PHP] [Fwd: Attachment Size and Memory limit with php and FC6 System]

2007-09-26 Thread edwardspl
Jim Lucas wrote:

> [EMAIL PROTECTED] wrote:
>
>>
>> post_max_size = 10M
>> max_execution_time = 3600 ; Maximum execution time of each script, in
>> seconds
>> max_input_time = 3600 ; Maximum amount of time each script may spend
>> parsing request data
>> memory_limit = 512M ; Maximum amount of memory a script may consume
>> file_uploads = On
>> upload_max_filesize = 8M
>>
>> But For IMP Display result :
>>
>> 1, Maximum Attachment Size: 2,097,152 bytes ( only 2MB ??? )
>
>
> Not sure what Maximum Attachment Size is referring to. Never heard of
> that setting
>
> Where are you getting #1 reading from? Are you sure that isn't a
> preset limit in Horde?
>
>> 2, Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to
>> allocate 1519127 bytes) in
>> /home/itawm/html/horde/lib/Horde/MIME/Part.php on line 1027 ( limit 8MB
>> ??? )
>
>
> your file upload was larger then 8MB... ?? What is confusing about this?
>
>>
>> Mine is Linux FC6 System...
>>
>> Many thanks your help !
>>
>> Edward.
>>
>
>
Hello Jim,

Are you using the imp with FC6 also ?
If so, have you meet this kind of problem ?
Any more help or idea for me ?

Many thanks !

Edward.

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



Re: [PHP] counting with leading zeros

2007-09-26 Thread brian

Robert Cummings wrote:

On Wed, 2007-09-26 at 15:58 -0400, brian wrote:


Robert Cummings wrote:


On Wed, 2007-09-26 at 15:11 -0400, brian wrote:


I have a directory that contains many images (no, not pr0n, 
unfortunately) and i'm working on an admin script for adding to

 it. I've got something that works alright but i'm wondering if
 there's a Better Way.

Each image is named like: foo_01.jpg, foo_02.jpg, bar_01.jpg, 
and so on. When adding a new image it should be assigned the 
next number in the series (the prefix is known). Thus, given 
the prefix 'bar' i do something like:


function getNextImage($path, $prefix) { $pattern = 
"/^${prefix}_([0-9]{2})\.[a-z]{3}$/";


$filenames = glob("${path}${prefix}*");  if 
(is_array($filenames) && sizeof($filenames)) { 
sort($filenames);


/* eg. 'foo_32.jpg' */ $last = basename(array_pop($filenames));



/* pull the number from the filename */ $count = 
intval(preg_replace($pattern, '$1', $last));


/* increment, format with leading zero again if necessary, * 
and return it */ return sprintf('%02d', ++$count) } else { 
return '01'; } }


Note that there almost certainly will never be more than 99 
images to a series. In any case, i don't care about there being

 more than one leading zero. One is what i want.



function getNextImageIndex( $path, $prefix ) { // // Matches 
files like foo_123.png // $pattern = 
'/.*_([[:digit:]]+)\.[[:alpha:]]{3}$/';


$filenames = glob( "${path}${prefix}*" );

if( $filenames ) { sort( $filenames );

$last = array_pop( $filenames );



It needs basename here because the array has the full path of each 
file.



No it doesn't. I changed the pattern to make it simpler.


My bad. I didn't look at it closely enough.






$nextIndex = (int)preg_replace( $pattern, '$1', $last ) + 1;

return str_pad( $nextIndex, 2, '0', STR_PAD_LEFT ); }

return '01'; }

?>



Well, this is almost precisely the same thing i have, save for 
using POSIX character classes, str_pad instead of sprintf(), and 
incrementing elsewhere. What i was really wondering is if there was

 a *much simpler* way to do this, not just re-arranging things.



You asked for a "Better Way". I gave you a "Better Way". I improved 
the regex, removed the useless basename() call, performed 
incrementation in the extraction step, used better function and 
variable names, and used the str_pad() function because sprintf() is 
overkill. I also removed your redundant else clause. My version is 
much simpler. How much is much? You know... much! Other than using a 
database, it doesn't really get any simpler. Although you obviously 
have race condition issues also. But that's not getting "simpler". 
It's getting more correct but also a bit more complex.




Bad day or something? Did it really seem that i was bitching about your 
response? If my response to that gave you the impression i was

complaining, i assure you that i wasn't. I was simply suggesting
that i was wondering if there was a *much* simpler way to do this, ie.
without using several functions to process the filename. Yes, your
version *does* have some improvements. I'm not disagreeing with you. 
Perhaps i could have been more forthright in my praise for said 
improvements (i'm even going to use some of them--how about that?!)


Note that the moment you get 100 images the code breaks because 
_100 sorts before _99 and so you will always write over the 100th
 index. To fix this you need to loop through all found files and 
pull the index out and record the highest found.


For my purposes, if any series gets much beyond 40 i'll have bigger
 problems to worry about. I'm content to not worry about overflow 
in this case.



Suit yourself. But better programmer's don't just wave their hands in
 the air and hope for the best.



While i agree with you in principle, i'm not interested in that aspect
of it. The application would have halted *long* before it could reach
that many. This is why i went to the trouble of pointing this out in the 
original mail. IOW, i'm not stupid; i'm well aware that 100 comes after 
99 and that it contains 3 digits, not 2, thanks very much.


b

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



Re: [PHP] PDOStatement execute memory issue?

2007-09-26 Thread Jeffery Fernandez
On Thursday 27 September 2007 04:21, Carlton Whitehead wrote:
> Hi everyone,
>
> I'm working on a script that downloads archived fax images (TIFFs and PDFs)
> from a MS SQL Server using the PDO ODBC driver. I get the below error
> regardless of which fax I try to get from the database. Each fax is a
> different size, and both of the memory allocation numbers are always the
> same:
>
> Fatal error: Out of memory (allocated 262144) (tried to allocate 4294967295
> bytes) in C:\Inetpub\wwwroot\FMarchive\library\faxInbound.php on line 81

Ho big are those faxes? 4294967295 bytes = 4GB

have you tried executing that SQL directly into the database? Does it return 
the right results?

>
> The above error happened when querying a fax with a size of 17723 bytes. 
> According to my phpinfo(); page, the memory_limit is 128MB.
>
> My machine has the below specs:
> Windows Server 2003 SP2
> IIS 6
> 2GB RAM
> Microsoft SQL Server 2005 SP2
> PHP 5.2.4
>
> Here is the excerpt from my code:
>
>   public function downloadFax($id, $attid, $attsize)
>   {
>   try
>   {
>   $stmt = 'SELECT filename, attdata FROM 
> fm_faxin_att WHERE id = :id AND
> attid = :attid'; $pstmt = $this->db->prepare($stmt);
>   $pstmt->bindValue(':id', $id);
>   $pstmt->bindValue(':attid', $attid);
>   $pstmt->execute(); // this is the Line 81 
> referenced by the error
> message $pstmt->bindColumn('filename', $filename, PDO::PARAM_STR);
>   $pstmt->bindColumn('attdata', $data, 
> PDO::PARAM_LOB);
>   $pstmt->fetch(PDO::FETCH_BOUND);
>
>   return array('attdata' => $data, 'filename' => 
> $filename);
>   }
>   catch (PDOException $e)
>   {
>   die($e->getMessage());
>   }
>   }
>
> Any ideas?
>
> Regards,
> Carlton Whitehead

-- 
Internet Vision Technologies
Level 1, 520 Dorset Road
Croydon
Victoria - 3136
Australia


pgp7uvSwuepL9.pgp
Description: PGP signature


Re: [PHP] counting with leading zeros

2007-09-26 Thread Robert Cummings
On Wed, 2007-09-26 at 15:58 -0400, brian wrote:
> Robert Cummings wrote:
> > On Wed, 2007-09-26 at 15:11 -0400, brian wrote:
> > 
> >>I have a directory that contains many images (no, not pr0n, 
> >>unfortunately) and i'm working on an admin script for adding to it. I've 
> >>got something that works alright but i'm wondering if there's a Better Way.
> >>
> >>Each image is named like: foo_01.jpg, foo_02.jpg, bar_01.jpg, and so on. 
> >>When adding a new image it should be assigned the next number in the 
> >>series (the prefix is known). Thus, given the prefix 'bar' i do 
> >>something like:
> >>
> >>function getNextImage($path, $prefix)
> >>{
> >>   $pattern = "/^${prefix}_([0-9]{2})\.[a-z]{3}$/";
> >>
> >>   $filenames = glob("${path}${prefix}*");
> >>
> >>   if (is_array($filenames) && sizeof($filenames))
> >>   {
> >> sort($filenames);
> >>
> >> /* eg. 'foo_32.jpg'
> >>  */
> >> $last = basename(array_pop($filenames));
> >>
> >> /* pull the number from the filename
> >>  */
> >> $count = intval(preg_replace($pattern, '$1', $last));
> >>
> >> /* increment, format with leading zero again if necessary,
> >>  * and return it
> >>  */
> >> return sprintf('%02d', ++$count)
> >>   }
> >>   else
> >>   {
> >> return '01';
> >>   }
> >>}
> >>
> >>Note that there almost certainly will never be more than 99 images to a 
> >>series. In any case, i don't care about there being more than one 
> >>leading zero. One is what i want.
> > 
> > 
> >  > 
> > function getNextImageIndex( $path, $prefix )
> > {
> > //
> > // Matches files like foo_123.png
> > //
> > $pattern = '/.*_([[:digit:]]+)\.[[:alpha:]]{3}$/';
> > 
> > $filenames = glob( "${path}${prefix}*" );
> > 
> > if( $filenames )
> > {
> > sort( $filenames );
> > 
> > $last = array_pop( $filenames );
> 
> 
> It needs basename here because the array has the full path of each file.

No it doesn't. I changed the pattern to make it simpler.


> > $nextIndex = (int)preg_replace( $pattern, '$1', $last ) + 1;
> > 
> > return str_pad( $nextIndex, 2, '0', STR_PAD_LEFT );
> > }
> > 
> > return '01';
> > }
> > 
> > ?>
> 
> 
> Well, this is almost precisely the same thing i have, save for using 
> POSIX character classes, str_pad instead of sprintf(), and incrementing 
> elsewhere. What i was really wondering is if there was a *much simpler* 
> way to do this, not just re-arranging things.

You asked for a "Better Way". I gave you a "Better Way". I improved the
regex, removed the useless basename() call, performed incrementation in
the extraction step, used better function and variable names, and used
the str_pad() function because sprintf() is overkill. I also removed
your redundant else clause. My version is much simpler. How much is
much? You know... much! Other than using a database, it doesn't really
get any simpler. Although you obviously have race condition issues also.
But that's not getting "simpler". It's getting more correct but also a
bit more complex.

> > Note that the moment you get 100 images the code breaks because _100
> > sorts before _99 and so you will always write over the 100th index. To
> > fix this you need to loop through all found files and pull the index out
> > and record the highest found.
> 
> For my purposes, if any series gets much beyond 40 i'll have bigger 
> problems to worry about. I'm content to not worry about overflow in this 
> case.

Suit yourself. But better programmer's don't just wave their hands in
the air and hope for the best.

Cheers,
Rob.
-- 
...
SwarmBuy.com - http://www.swarmbuy.com

Leveraging the buying power of the masses!
...

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



Re: [PHP] Compile issue

2007-09-26 Thread Nathan Nobbe
you might try experimenting w/ the configure command;
perhaps if you start w/ a minimal php installation it will compile.
then you could one-by-one enable the things you have in your
standard configure command.
maybe at least you could narrow down the problem that way.

-nathan

On 9/26/07, Eric Butera <[EMAIL PROTECTED]> wrote:
>
> Yep!  I made a little sh script that I keep the same ./configure
> string in.  When a new version comes out I extract it, copy my script
> in there, and run it.  Usually everything works out perfectly.  I've
> been using it happily since 5.1.2 and now all of a sudden after 5.2.2
> I can't anymore.
>
> On 9/26/07, Nathan Nobbe <[EMAIL PROTECTED]> wrote:
> > are you using the same configure command when compiling all 3 versions?
> >
> > -nathan
> >
> >
> > On 9/26/07, Eric Butera < [EMAIL PROTECTED]> wrote:
> > >
> > > The last version of PHP I've been able to compile on my work machine
> > > was 5.2.2.  It is a PowerPC OS X 10.4.10.  I'm curious if anyone else
> > > has had this problem.  I'm sure it is something stupid I'm doing but I
> > > can't seem to figure it out.  I can still compile 5.2.2 just fine so
> > > nothing on that end has changed but 5.2.3 & 5.2.4 just crap out.
> > >
> > > It always dies with this message:
> > >
> > > /usr/bin/ld: warning multiple definitions of symbol _locale_charset
> > > /sw/lib/libiconv.dylib( localcharset.o) definition of _locale_charset
> > > /sw/lib/libintl.dylib(localcharset.lo) definition of _locale_charset
> > > /usr/bin/ld: Undefined symbols:
> > > _mysql_set_character_set
> > > collect2: ld returned 1 exit status
> > > make: *** [sapi/cgi/php-cgi] Error 1
> > >
> > > Any ideas?
> > >
> > > --
> > > PHP General Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> > >
> > >
> >
> >
>


Re: [PHP] Compile issue

2007-09-26 Thread Eric Butera
Yep!  I made a little sh script that I keep the same ./configure
string in.  When a new version comes out I extract it, copy my script
in there, and run it.  Usually everything works out perfectly.  I've
been using it happily since 5.1.2 and now all of a sudden after 5.2.2
I can't anymore.

On 9/26/07, Nathan Nobbe <[EMAIL PROTECTED]> wrote:
> are you using the same configure command when compiling all 3 versions?
>
> -nathan
>
>
> On 9/26/07, Eric Butera < [EMAIL PROTECTED]> wrote:
> >
> > The last version of PHP I've been able to compile on my work machine
> > was 5.2.2.  It is a PowerPC OS X 10.4.10.  I'm curious if anyone else
> > has had this problem.  I'm sure it is something stupid I'm doing but I
> > can't seem to figure it out.  I can still compile 5.2.2 just fine so
> > nothing on that end has changed but 5.2.3 & 5.2.4 just crap out.
> >
> > It always dies with this message:
> >
> > /usr/bin/ld: warning multiple definitions of symbol _locale_charset
> > /sw/lib/libiconv.dylib( localcharset.o) definition of _locale_charset
> > /sw/lib/libintl.dylib(localcharset.lo) definition of _locale_charset
> > /usr/bin/ld: Undefined symbols:
> > _mysql_set_character_set
> > collect2: ld returned 1 exit status
> > make: *** [sapi/cgi/php-cgi] Error 1
> >
> > Any ideas?
> >
> > --
> > 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] counting with leading zeros

2007-09-26 Thread brian

Robert Cummings wrote:

On Wed, 2007-09-26 at 15:11 -0400, brian wrote:

I have a directory that contains many images (no, not pr0n, 
unfortunately) and i'm working on an admin script for adding to it. I've 
got something that works alright but i'm wondering if there's a Better Way.


Each image is named like: foo_01.jpg, foo_02.jpg, bar_01.jpg, and so on. 
When adding a new image it should be assigned the next number in the 
series (the prefix is known). Thus, given the prefix 'bar' i do 
something like:


function getNextImage($path, $prefix)
{
  $pattern = "/^${prefix}_([0-9]{2})\.[a-z]{3}$/";

  $filenames = glob("${path}${prefix}*");

  if (is_array($filenames) && sizeof($filenames))
  {
sort($filenames);

/* eg. 'foo_32.jpg'
 */
$last = basename(array_pop($filenames));

/* pull the number from the filename
 */
$count = intval(preg_replace($pattern, '$1', $last));

/* increment, format with leading zero again if necessary,
 * and return it
 */
return sprintf('%02d', ++$count)
  }
  else
  {
return '01';
  }
}

Note that there almost certainly will never be more than 99 images to a 
series. In any case, i don't care about there being more than one 
leading zero. One is what i want.




if( $filenames )

{
sort( $filenames );

$last = array_pop( $filenames );



It needs basename here because the array has the full path of each file.


$nextIndex = (int)preg_replace( $pattern, '$1', $last ) + 1;

return str_pad( $nextIndex, 2, '0', STR_PAD_LEFT );
}

return '01';
}

?>



Well, this is almost precisely the same thing i have, save for using 
POSIX character classes, str_pad instead of sprintf(), and incrementing 
elsewhere. What i was really wondering is if there was a *much simpler* 
way to do this, not just re-arranging things.



Note that the moment you get 100 images the code breaks because _100
sorts before _99 and so you will always write over the 100th index. To
fix this you need to loop through all found files and pull the index out
and record the highest found.


For my purposes, if any series gets much beyond 40 i'll have bigger 
problems to worry about. I'm content to not worry about overflow in this 
case.


brian

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



Re: [PHP] Compile issue

2007-09-26 Thread Nathan Nobbe
are you using the same configure command when compiling all 3 versions?

-nathan

On 9/26/07, Eric Butera <[EMAIL PROTECTED]> wrote:
>
> The last version of PHP I've been able to compile on my work machine
> was 5.2.2.  It is a PowerPC OS X 10.4.10.  I'm curious if anyone else
> has had this problem.  I'm sure it is something stupid I'm doing but I
> can't seem to figure it out.  I can still compile 5.2.2 just fine so
> nothing on that end has changed but 5.2.3 & 5.2.4 just crap out.
>
> It always dies with this message:
>
> /usr/bin/ld: warning multiple definitions of symbol _locale_charset
> /sw/lib/libiconv.dylib(localcharset.o) definition of _locale_charset
> /sw/lib/libintl.dylib(localcharset.lo) definition of _locale_charset
> /usr/bin/ld: Undefined symbols:
> _mysql_set_character_set
> collect2: ld returned 1 exit status
> make: *** [sapi/cgi/php-cgi] Error 1
>
> Any ideas?
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


Re: [PHP] counting with leading zeros

2007-09-26 Thread Robert Cummings
On Wed, 2007-09-26 at 15:11 -0400, brian wrote:
> I have a directory that contains many images (no, not pr0n, 
> unfortunately) and i'm working on an admin script for adding to it. I've 
> got something that works alright but i'm wondering if there's a Better Way.
> 
> Each image is named like: foo_01.jpg, foo_02.jpg, bar_01.jpg, and so on. 
> When adding a new image it should be assigned the next number in the 
> series (the prefix is known). Thus, given the prefix 'bar' i do 
> something like:
> 
> function getNextImage($path, $prefix)
> {
>$pattern = "/^${prefix}_([0-9]{2})\.[a-z]{3}$/";
> 
>$filenames = glob("${path}${prefix}*");
>   
>if (is_array($filenames) && sizeof($filenames))
>{
>  sort($filenames);
> 
>  /* eg. 'foo_32.jpg'
>   */
>  $last = basename(array_pop($filenames));
> 
>  /* pull the number from the filename
>   */
>  $count = intval(preg_replace($pattern, '$1', $last));
> 
>  /* increment, format with leading zero again if necessary,
>   * and return it
>   */
>  return sprintf('%02d', ++$count)
>}
>else
>{
>  return '01';
>}
> }
> 
> Note that there almost certainly will never be more than 99 images to a 
> series. In any case, i don't care about there being more than one 
> leading zero. One is what i want.



Note that the moment you get 100 images the code breaks because _100
sorts before _99 and so you will always write over the 100th index. To
fix this you need to loop through all found files and pull the index out
and record the highest found.

Cheers,
Rob.
-- 
...
SwarmBuy.com - http://www.swarmbuy.com

Leveraging the buying power of the masses!
...

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



[PHP] counting with leading zeros

2007-09-26 Thread brian
I have a directory that contains many images (no, not pr0n, 
unfortunately) and i'm working on an admin script for adding to it. I've 
got something that works alright but i'm wondering if there's a Better Way.


Each image is named like: foo_01.jpg, foo_02.jpg, bar_01.jpg, and so on. 
When adding a new image it should be assigned the next number in the 
series (the prefix is known). Thus, given the prefix 'bar' i do 
something like:


function getNextImage($path, $prefix)
{
  $pattern = "/^${prefix}_([0-9]{2})\.[a-z]{3}$/";

  $filenames = glob("${path}${prefix}*");

  if (is_array($filenames) && sizeof($filenames))
  {
sort($filenames);

/* eg. 'foo_32.jpg'
 */
$last = basename(array_pop($filenames));

/* pull the number from the filename
 */
$count = intval(preg_replace($pattern, '$1', $last));

/* increment, format with leading zero again if necessary,
 * and return it
 */
return sprintf('%02d', ++$count)
  }
  else
  {
return '01';
  }
}

Note that there almost certainly will never be more than 99 images to a 
series. In any case, i don't care about there being more than one 
leading zero. One is what i want.


brian

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



Re: [PHP] IF's!

2007-09-26 Thread Dan Shirah
Thanks!

I think I saw mssql_error() somewhere on a forum a long time ago so I just
inherently started using it.  Thanks for pointing that out.

Jim, yes you are right...that was just a portion of my code.  The entire
page in which that section resides is over 900 lines and I didn't want
everyone to wade through the trash to get to the issue.

Thanks for the help,

Dan


On 9/26/07, Daniel Brown <[EMAIL PROTECTED]> wrote:
>
> On 9/26/07, Dan Shirah <[EMAIL PROTECTED]> wrote:
> > Okay, I know this is probably a real easy fix, and I could swear I've
> done
> > it before, but for some reason it's just not working.
> >
> > Below is my query, it does a conditional search based on info put in a
> form
> > by the user. If I put in a valid letter/name for the last_name that I
> know
> > is in my database everything works fine.
> >
> > BUT, if I put in a character/name for the last_name that does not exist
> in
> > my database I get the following error: Call to undefined function
> > mssql_error() when I should be getting the echo, "No results"
> >
> > The snipet of my code that is throwing the error is:
> > if (!empty($tot_result)) {
> > $total_results = mssql_num_rows($tot_result) or die(mssql_error());
> > }
> >
> > Should I not use (!empty()) when checking to see if a query did not
> return
> > any results?
> >
> > MY CODE:
> >  > // Figure out the total number of results in DB:
> > $sql_total= "SELECT * FROM payment_request WHERE
> payment_request.status_code
> > = 'P'";
> >  if ($customer_last != "") {
> >  $sql_total.=" AND last_name LIKE '$customer_last%'";
> >  if ($customer_first != "") {
> >  $sql_total.=" AND first_name LIKE '$customer_first%'";
> >}
> >   }
> > $tot_result = mssql_query($sql_total) or die(mssql_error());
> > if (empty($tot_result)) {
> >  echo "No results";
> >  }
> > if (!empty($tot_result)) {
> > $total_results = mssql_num_rows($tot_result) or die(mssql_error());
> > }
> > // Figure out the total number of pages. Always round up using ceil()
> > $total_pages = ceil($total_results / $max_results);
> > //echo "Results per page: ".$max_results."\n ";
> > //echo "Total results: ".$total_results."\n ";
> > //echo "Total number of pages needed: ".$total_pages."\n ";
> > ?>
> >
>
>Dan,
>
>Your syntax is correct, but mssql_error() doesn't exist in PHP to
> my knowledge.  Try replacing that with `mssql_get_last_message();`
> (sans quotes, of course) and see if that fixes the problem.
>
> --
> Daniel P. Brown
> [office] (570-) 587-7080 Ext. 272
> [mobile] (570-) 766-8107
>
> Give a man a fish, he'll eat for a day.  Then you'll find out he was
> allergic and is hospitalized.  See?  No good deed goes unpunished
>


Re: [PHP] IF's!

2007-09-26 Thread Daniel Brown
On 9/26/07, Dan Shirah <[EMAIL PROTECTED]> wrote:
> Okay, I know this is probably a real easy fix, and I could swear I've done
> it before, but for some reason it's just not working.
>
> Below is my query, it does a conditional search based on info put in a form
> by the user. If I put in a valid letter/name for the last_name that I know
> is in my database everything works fine.
>
> BUT, if I put in a character/name for the last_name that does not exist in
> my database I get the following error: Call to undefined function
> mssql_error() when I should be getting the echo, "No results"
>
> The snipet of my code that is throwing the error is:
> if (!empty($tot_result)) {
> $total_results = mssql_num_rows($tot_result) or die(mssql_error());
> }
>
> Should I not use (!empty()) when checking to see if a query did not return
> any results?
>
> MY CODE:
>  // Figure out the total number of results in DB:
> $sql_total= "SELECT * FROM payment_request WHERE payment_request.status_code
> = 'P'";
>  if ($customer_last != "") {
>  $sql_total.=" AND last_name LIKE '$customer_last%'";
>  if ($customer_first != "") {
>  $sql_total.=" AND first_name LIKE '$customer_first%'";
>}
>   }
> $tot_result = mssql_query($sql_total) or die(mssql_error());
> if (empty($tot_result)) {
>  echo "No results";
>  }
> if (!empty($tot_result)) {
> $total_results = mssql_num_rows($tot_result) or die(mssql_error());
> }
> // Figure out the total number of pages. Always round up using ceil()
> $total_pages = ceil($total_results / $max_results);
> //echo "Results per page: ".$max_results."\n ";
> //echo "Total results: ".$total_results."\n ";
> //echo "Total number of pages needed: ".$total_pages."\n ";
> ?>
>

Dan,

Your syntax is correct, but mssql_error() doesn't exist in PHP to
my knowledge.  Try replacing that with `mssql_get_last_message();`
(sans quotes, of course) and see if that fixes the problem.

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

Give a man a fish, he'll eat for a day.  Then you'll find out he was
allergic and is hospitalized.  See?  No good deed goes unpunished

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



Re: [PHP] IF's!

2007-09-26 Thread Jim Lucas

Dan Shirah wrote:

Okay, I know this is probably a real easy fix, and I could swear I've done
it before, but for some reason it's just not working.

Below is my query, it does a conditional search based on info put in a form
by the user. If I put in a valid letter/name for the last_name that I know
is in my database everything works fine.

BUT, if I put in a character/name for the last_name that does not exist in
my database I get the following error: Call to undefined function
mssql_error() when I should be getting the echo, "No results"

The snipet of my code that is throwing the error is:
if (!empty($tot_result)) {
$total_results = mssql_num_rows($tot_result) or die(mssql_error());
}

Should I not use (!empty()) when checking to see if a query did not return
any results?

MY CODE:


Fist off, mssql_error() is not a valid function... You should be using 
mssql_get_last_message() instead.

But, read on first...

You have a couple choices here.
if ( $tot_result ) {

or

if ( is_resource($tot_result) ) {

or (my favorite)

\n";
echo "Total results: {$total_results}\n";
echo "Total number of pages needed: {$total_pages}\n";

}
}

?>

This should work for you...



if (empty($tot_result)) {
 echo "No results";
 }
if (!empty($tot_result)) {
$total_results = mssql_num_rows($tot_result) or die(mssql_error());
}
// Figure out the total number of pages. Always round up using ceil()
$total_pages = ceil($total_results / $max_results);
//echo "Results per page: ".$max_results."\n ";
//echo "Total results: ".$total_results."\n ";
//echo "Total number of pages needed: ".$total_pages."\n ";
?>




--
Jim Lucas

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

Twelfth Night, Act II, Scene V
by William Shakespeare

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



[PHP] simple product selection guide

2007-09-26 Thread David
This is probably pretty basic but : I'd like to create a page where the end 
result is the product(s) listed based on certain criteria selected by the 
user, so I would like a drop down menu or other means that they select from 
and based on that selection a second list apears and then a third list, and 
then from those criteria have the product or products listed  I have a 
php/mysql host.  What would you recomend to develop this.  Thanks. 

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



Re: [PHP] SOAP in PHP on very restricted host?

2007-09-26 Thread Paul Scott

On Wed, 2007-09-26 at 13:26 +0900, David Christopher Zentgraf wrote:
> But I just found out about NuSOAP (http://dietrich.ganx4.com/ 
> nusoap/), which seems to be what I'm looking for, a no-strings- 
> attached SOAP implementation. I'm trying my luck with this one for  
> now. :)

If you are using nuSoap on PHP5, be sure to change the class names etc,
otherwise you will get conflicts in our namespaceless world.

--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] PDOStatement execute memory issue?

2007-09-26 Thread Carlton Whitehead
Hi everyone, 

I'm working on a script that downloads archived fax images (TIFFs and PDFs) 
from a MS SQL Server using the PDO ODBC driver. I get the below error 
regardless of which fax I try to get from the database. Each fax is a different 
size, and both of the memory allocation numbers are always the same: 

Fatal error: Out of memory (allocated 262144) (tried to allocate 4294967295 
bytes) in C:\Inetpub\wwwroot\FMarchive\library\faxInbound.php on line 81 

The above error happened when querying a fax with a size of 17723 bytes.  
According to my phpinfo(); page, the memory_limit is 128MB.

My machine has the below specs:
Windows Server 2003 SP2
IIS 6
2GB RAM
Microsoft SQL Server 2005 SP2
PHP 5.2.4

Here is the excerpt from my code: 

public function downloadFax($id, $attid, $attsize)
{
try
{
$stmt = 'SELECT filename, attdata FROM 
fm_faxin_att WHERE id = :id AND attid = :attid';
$pstmt = $this->db->prepare($stmt);
$pstmt->bindValue(':id', $id);
$pstmt->bindValue(':attid', $attid);
$pstmt->execute(); // this is the Line 81 
referenced by the error message
$pstmt->bindColumn('filename', $filename, 
PDO::PARAM_STR);
$pstmt->bindColumn('attdata', $data, 
PDO::PARAM_LOB);
$pstmt->fetch(PDO::FETCH_BOUND);

return array('attdata' => $data, 'filename' => 
$filename);
}
catch (PDOException $e)
{
die($e->getMessage());
}
}

Any ideas?

Regards, 
Carlton Whitehead 

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



Re: [PHP] [Fwd: Attachment Size and Memory limit with php and FC6 System]

2007-09-26 Thread Jim Lucas

[EMAIL PROTECTED] wrote:


post_max_size = 10M
max_execution_time = 3600 ; Maximum execution time of each script, in
seconds
max_input_time = 3600 ; Maximum amount of time each script may spend
parsing request data
memory_limit = 512M ; Maximum amount of memory a script may consume
file_uploads = On
upload_max_filesize = 8M

But For IMP Display result :

1, Maximum Attachment Size: 2,097,152 bytes ( only 2MB ??? )


Not sure what Maximum Attachment Size is referring to.  Never heard of that 
setting

Where are you getting #1 reading from?  Are you sure that isn't a preset limit 
in Horde?


2, Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to
allocate 1519127 bytes) in
/home/itawm/html/horde/lib/Horde/MIME/Part.php on line 1027 ( limit 8MB
??? )


your file upload was larger then 8MB... ??  What is confusing about this?



Mine is Linux FC6 System...

Many thanks your help !

Edward.




--
Jim Lucas

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

Twelfth Night, Act II, Scene V
by William Shakespeare

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



[PHP] IF's!

2007-09-26 Thread Dan Shirah
Okay, I know this is probably a real easy fix, and I could swear I've done
it before, but for some reason it's just not working.

Below is my query, it does a conditional search based on info put in a form
by the user. If I put in a valid letter/name for the last_name that I know
is in my database everything works fine.

BUT, if I put in a character/name for the last_name that does not exist in
my database I get the following error: Call to undefined function
mssql_error() when I should be getting the echo, "No results"

The snipet of my code that is throwing the error is:
if (!empty($tot_result)) {
$total_results = mssql_num_rows($tot_result) or die(mssql_error());
}

Should I not use (!empty()) when checking to see if a query did not return
any results?

MY CODE:
";
//echo "Total results: ".$total_results."\n ";
//echo "Total number of pages needed: ".$total_pages."\n ";
?>


[PHP] [Fwd: Attachment Size and Memory limit with php and FC6 System]

2007-09-26 Thread edwardspl
Dear All,

Would you mind to help ?

Thanks !

Edward.

 Original Message 
Subject:Attachment Size and Memory limit with php and FC6 System
Date:   Thu, 27 Sep 2007 00:28:03 +0800
From:   [EMAIL PROTECTED]
Reply-To:   For users of Fedora <[EMAIL PROTECTED]>
To: IMP <[EMAIL PROTECTED]>
CC: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
References: <[EMAIL PROTECTED]>
<[EMAIL PROTECTED]> <[EMAIL PROTECTED]>
<[EMAIL PROTECTED]> <[EMAIL PROTECTED]>
<[EMAIL PROTECTED]> <[EMAIL PROTECTED]>
<[EMAIL PROTECTED]> <[EMAIL PROTECTED]>
<[EMAIL PROTECTED]> <[EMAIL PROTECTED]>
<[EMAIL PROTECTED]> <[EMAIL PROTECTED]>
<[EMAIL PROTECTED]> <[EMAIL PROTECTED]>



Hello,

I just updated the php packages and restart the web server again...

Create a test web page with "phpinfo()" function as the following result :

post_max_size = 10M
max_execution_time = 3600 ; Maximum execution time of each script, in
seconds
max_input_time = 3600 ; Maximum amount of time each script may spend
parsing request data
memory_limit = 512M ; Maximum amount of memory a script may consume
file_uploads = On
upload_max_filesize = 8M

But For IMP Display result :

1, Maximum Attachment Size: 2,097,152 bytes ( only 2MB ??? )
2, Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to
allocate 1519127 bytes) in
/home/itawm/html/horde/lib/Horde/MIME/Part.php on line 1027 ( limit 8MB
??? )

Mine is Linux FC6 System...

Many thanks your help !

Edward.

-- 
fedora-list mailing list
[EMAIL PROTECTED]
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list

__ NOD32 2550 (20070925) Information __

This message was checked by NOD32 antivirus system.
http://www.nod32.com.hk






[PHP] Compile issue

2007-09-26 Thread Eric Butera
The last version of PHP I've been able to compile on my work machine
was 5.2.2.  It is a PowerPC OS X 10.4.10.  I'm curious if anyone else
has had this problem.  I'm sure it is something stupid I'm doing but I
can't seem to figure it out.  I can still compile 5.2.2 just fine so
nothing on that end has changed but 5.2.3 & 5.2.4 just crap out.

It always dies with this message:

/usr/bin/ld: warning multiple definitions of symbol _locale_charset
/sw/lib/libiconv.dylib(localcharset.o) definition of _locale_charset
/sw/lib/libintl.dylib(localcharset.lo) definition of _locale_charset
/usr/bin/ld: Undefined symbols:
_mysql_set_character_set
collect2: ld returned 1 exit status
make: *** [sapi/cgi/php-cgi] Error 1

Any ideas?

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



Re: [PHP] Re: Data request

2007-09-26 Thread David Robley
Paul Scott wrote:

> 
> On Tue, 2007-09-25 at 09:17 -0400, Robert Cummings wrote:
>> Oh sure, and now when I'm searching for "shit" I'll get all these
>> Henry's cat references *bleh*.
>> 
> Well then why not tie in "coprophilia" as well?
> 
> ugh.
> 
> --Paul

You gotta love that shit... oh wait, that's what you said :-)



Cheers
-- 
David Robley

A cat is a four footed allergen.
Today is Prickle-Prickle, the 50th day of Bureaucracy in the YOLD 3173. 
Celebrate Bureflux

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



Re: [PHP] SOAP in PHP on very restricted host?

2007-09-26 Thread David Christopher Zentgraf

On  26. Sep 2007, at 16:45, Nathan Nobbe wrote:


i hate to suggest it, but you might want to take a little time and
investigate what other restrictions you host has.  if the list is  
long you may want to consider a
move. it may seem arduous now, but the longer you wait the more  
arduous it will

become.


Oh, we know our host sucks major [primate] [primate][bodypart].
The plan is to eventually have our own servers in-house, but until  
then, there really isn't that much choice unfortunately. As far as we  
observed all of the major hosts in Tokyo (Hi from Japan!) are pretty  
much the same. And hosting abroad is out of the question, since  
latency goes right up and throughput down with every inch off the  
Japanese coast. Unless somebody has a good tip for a good host...



still on php4 (dont ask)


Ditto.

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



[PHP] Extract SOAP Request Data

2007-09-26 Thread Jeffery Fernandez
I have a SOAP request logger which logs all SOAP requests/responses being made 
on the system. What I want to do is extract the function name being called and 
the params passed to it. The following is an example XML Request:


http://www.w3.org/2003/05/soap-envelope";
xmlns:ns1="urn:Gateway_Proxy"
xmlns:xsd="http://www.w3.org/2001/XMLSchema";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xmlns:enc="http://www.w3.org/2003/05/soap-encoding";>

  http://www.w3.org/2003/05/soap-encoding";>
61ecc268-1cd0-f468
15495

&payment_id=61ecc268-1cd0-f468
Order from Student Library Fees with Payment Id: 
61ecc268-1cd0-f468
  

 

What I want to do is extract the function name and the parameter names and its 
values.

I have done the folloing so far:
$soap_request_string = <<
http://www.w3.org/2003/05/soap-envelope"; 
xmlns:ns1="urn:Gateway_Proxy" xmlns:xsd="http://www.w3.org/2001/XMLSchema"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xmlns:enc="http://www.w3.org/2003/05/soap-encoding";>

  http://www.w3.org/2003/05/soap-encoding";>
61ecc268-1cd0-f468
15495

&payment_id=61ecc268-1cd0-f468
Order from Student Library Fees with Payment Id: 
61ecc268-1cd0-f468
  


XML;


$xml = new SimpleXMLElement($soap_request_string, NULL, false);
print_r($xml);
$ns = $xml->getNamespaces(true);
print_r($ns);
foreach ($xml->xpath('//env:Body') as $body)
{
//print_r($body);
foreach ($body->children($ns['env'], true) as $child)
{
print_r($child);
}
} 

which does not return any SimpleXMLElements Objects. I can't figure out how to 
extract the values which are tied to the Name Space.

A description of the problem is in detail here: 
http://www.devnetwork.net/forums/viewtopic.php?t=74161

regards,
Jeffery
-- 
Internet Vision Technologies
Level 1, 520 Dorset Road
Croydon
Victoria - 3136
Australia


pgpBILHw2STMW.pgp
Description: PGP signature


Re: [PHP] SOAP in PHP on very restricted host?

2007-09-26 Thread Nathan Nobbe
as i said, its a relic.  i started using it where i work because we are
still on php4 (dont ask)
and was dismayed.  i looked around at some articles online and thats where i
got the impression
it was the defacto standard back in php4 when java already had a robust soap
api (and probly .net too).

im sure it was great in its hey-day.
the real problem using it anymore is, as you observed, you have to acquaint
yourself w/ a totally new (to use
SoapClient folks) API.  and at this point (w/ SoapClient out there) i beg
the question, why bother.

i hate to suggest it, but you might want to take a little time and
investigate what other
restrictions you host has.  if the list is long you may want to consider a
move.
it may seem arduous now, but the longer you wait the more arduous it will
become.

-nathan

On 9/26/07, David Christopher Zentgraf <[EMAIL PROTECTED]> wrote:
>
> On  26. Sep 2007, at 15:26, Nathan Nobbe wrote:
>
> > i just read the first message in this thread and NuSoap immediately
> > came to
> > mind. though it will solve your problem you may end up like me,
> > hating to use
> > NuSoap under duress.  i think it was really popular back in th php4
> > days when there
> > was nothing solid that could be built right into php.  anyway in my
> > experience
> > its a relic and i try to stay away from it if i can.
>
> I already see what you mean.
> A big bummer is that even though it uses the same class name as the
> default PHP SOAP module, it uses a totally different syntax/method
> calls etc, which all seem slightly queer to me. Which is terrible
> since the library the gateway provides wants to call (and extend)
> SoapClient() in very specific ways.
>
> I don't think I wanna go down this road very far...
>


Re: [PHP] SOAP in PHP on very restricted host?

2007-09-26 Thread David Christopher Zentgraf

On  26. Sep 2007, at 16:14, mike wrote:


On 9/25/07, Nathan Nobbe <[EMAIL PROTECTED]> wrote:

i try to stay away from it if i can.


i think the same of SOAP. in my opinion a shower is the only place  
for soap.


Well put. :-D
I, too, fail to see what's so terribly special about it.

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



Re: [PHP] SOAP in PHP on very restricted host?

2007-09-26 Thread David Christopher Zentgraf

On  26. Sep 2007, at 15:26, Nathan Nobbe wrote:

i just read the first message in this thread and NuSoap immediately  
came to
mind. though it will solve your problem you may end up like me,  
hating to use
NuSoap under duress.  i think it was really popular back in th php4  
days when there
was nothing solid that could be built right into php.  anyway in my  
experience

its a relic and i try to stay away from it if i can.


I already see what you mean.
A big bummer is that even though it uses the same class name as the  
default PHP SOAP module, it uses a totally different syntax/method  
calls etc, which all seem slightly queer to me. Which is terrible  
since the library the gateway provides wants to call (and extend)  
SoapClient() in very specific ways.


I don't think I wanna go down this road very far...

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



Re: [PHP] SOAP in PHP on very restricted host?

2007-09-26 Thread mike
On 9/25/07, Nathan Nobbe <[EMAIL PROTECTED]> wrote:
> i try to stay away from it if i can.

i think the same of SOAP. in my opinion a shower is the only place for soap.

simple XML, REST, JSON, lighter weight things are what i prefer. even
XML-RPC i can live without.

my $0.02

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