Re: [PHP] [RELEASE ANNOUNCEMENT] phpDocumentor 1.3.0RC6

2006-05-02 Thread Lester Caine

Greg Beaver wrote:


May 2, 2006
RELEASE ANNOUNCEMENT
phpDocumentor 1.3.0RC6
Download:
http://pear.php.net/PhpDocumentor
http://www.phpdoc.org

The phpDocumentor team would like to announce the release of version
1.3.0RC6.  This is the last release candidate of version 1.3.0, the
first stable version to be released since 2004.  The 1.3.0 series is a
milestone, and 1.3.0RC6 demonstrates that amply.


Nice to see progress on this - I still much prefer the output from it to 
that produced by doxygen when building developer documentation of a project.

Thanks for the good work!

--
Lester Caine - G8HFL
-
L.S.Caine Electronic Services - http://home.lsces.co.uk
Model Engineers Digital Workshop - 
http://home.lsces.co.uk/ModelEngineersDigitalWorkshop/

Treasurer - Firebird Foundation Inc. - 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] What means "Fatal error: pcntl_fork(): Error 11"?

2006-05-02 Thread Oz

Richard Lynch wrote:


On Tue, May 2, 2006 11:29 am, Oz wrote:
 


My script dies with the following line (after a few hours running
without other errors/warnings/notices):
Fatal error: pcntl_fork(): Error 11 in /home/foo/bar.php on line 297

Is there any documentation for "pcntl_fork(): Error 11"?
Does anybody know what causes "pcntl_fork(): Error 11"?

(It's PHP5 and the scripts source is top secret.)
   



I believe that if you installed my perror extension:
http://l-i-e.com/perror/
you would be able to easily print out the error message corresponding
to 11.

 


I can't it's cursed.


I suppose you could be old-school and just use a shell with:
perror 11
but that is not nearly as much fun.

 


That puts something out, but where is the realtion?
Doesn't help.


PS
"My amp goes to 11."

 



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



Re: [PHP] What means "Fatal error: pcntl_fork(): Error 11"?

2006-05-02 Thread Oz

Jay Blanchard wrote:


[snip]
My script dies with the following line (after a few hours running
without other errors/warnings/notices):
Fatal error: pcntl_fork(): Error 11 in /home/foo/bar.php on line 297

Is there any documentation for "pcntl_fork(): Error 11"?
Does anybody know what causes "pcntl_fork(): Error 11"?

(It's PHP5 and the scripts source is top secret.)
[/snip]

It means "Cut and paste this into Google and you will see entries
concerning this error".
 


No, nice try.


I could tell you the answer, but then I'd have to kill you.

 



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



[PHP] PHP-Jabber

2006-05-02 Thread Tony Aldrich

Hello,
Can somebody recommend clean php jabber library? I must send notifications
to some users.

Tony.


[PHP] List of sessions

2006-05-02 Thread Tony Aldrich

Good day,
Does anybody know how to get a list of current sessions?
I need to clear some database rows that where associated with some SID.
Can it be done without probing of maxlifetime?

Thanks in advance.
Tony.


Re: [PHP] secure upload file

2006-05-02 Thread Wolf
In Apache's Config:


 Options None
 AllowOverride Options
 Order allow,deny
 Allow from all
 RedirectPermanent * "somewhere else"


By using that and uploading to the upload_dir via another script, you
create a black hole.  Stuff comes in but can't be accessed from the
outside world afterwards.

Wolf


kristianto adi widiatmoko wrote:
> can any body help me  !!
>  
> how to secure folder upload file since the privilege of this folder is 777
> 
> is any method to create a secure upload file ??
> 
> Send instant messages to your online friends http://uk.messenger.yahoo.com 

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



Re: [PHP] javascript

2006-05-02 Thread John Hicks

darren wrote:
> I have a form that resides within a php function().  And, I would like
> to call a javascript function from an "onChange" event of a
>  tag (a drop down list box).
>

Your page's problem is entirely a Javascript problem. Has nothing to do 
with PHP:


Try moving the "onchange" from the  tag to the enclosing 
 tag. (It is the value of the  that changes when a 
different  is selected.)


Now for the lecture:

> Is there any problem with trying to call a javascript function from
> within a php function?

Yes, it's impossible. PHP is executed on the server. Javascript is 
executed in the browser. So Javascript cannot be called from PHP running 
on the server.


PHP is a document generator. You can use it to generate Javascript the 
exact same way you use it to generate HTML. But the resulting Javascript 
won't be executed till it gets to the browser.


The main problems you'll have generating Javascript from PHP are:
--keeping control of all the embedded quotes.
--keeping control of the embedded logic (and remembering to remember 
that the Javascript part isn't being executed just yet :)


Regards,

-J

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



Re: [PHP] Imagemagick Displaying Images

2006-05-02 Thread Ray Hauge
On Tuesday 02 May 2006 18:24, Ray Hauge wrote:
> On Tuesday 02 May 2006 18:19, Ray Hauge wrote:
> > I have an application that shows thumnails of PDF files in different
> > directories.  I have so far decided that I can use "convert" from
> > imagemagick to get a .jpg, .png, .gif, etc. to display as the image.  The
> > problem I'm running into is that I don't want to save these thumbnails.
> > Instead I just want to take the binary data and display an image with it.
> > I figure that it's possible since you can store binary data in a database
> > and display it that way.
> >
> > an example of what I'm doing is:
> >
> > convert -resize 800x600 AR-M455N_20060420_130446.pdf[0] -


For further clarification, here is how I got it to actually convert, but still 
display the output to standard out:

$img = shell_exec("convert -resize 800x600 /tmp/file.pdf[0] jpg:-");
header("Content-type: image/jpg");
print($img);

Now you can dream up any sort of ideas with GET variables to define which 
image you want.

Later,
Ray

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



Re: [PHP] Imagemagick Displaying Images

2006-05-02 Thread Ray Hauge
On Tuesday 02 May 2006 18:19, Ray Hauge wrote:
> I have an application that shows thumnails of PDF files in different
> directories.  I have so far decided that I can use "convert" from
> imagemagick to get a .jpg, .png, .gif, etc. to display as the image.  The
> problem I'm running into is that I don't want to save these thumbnails. 
> Instead I just want to take the binary data and display an image with it. 
> I figure that it's possible since you can store binary data in a database
> and display it that way.
>
> an example of what I'm doing is:
>
> convert -resize 800x600 AR-M455N_20060420_130446.pdf[0] -
>
> The '-' makes it display the contents of the image to stdout.  I want to
> caputre that binary data and somehow display the images inline with the
> website.  Is this possible, or am I living in a dream world ;)
>

Okay, I'll admit it.  I didn't STFW.  I believe that if I make a seperate 
script to just display the images, and then display them all with .  Of course this is just theory until I try it, 
but I'm pretty sure this is on the right path.

Thanks for listening anyway, and maybe this will help someone else ;)

-- 
Ray Hauge
Programmer/Systems Administrator
American Student Loan Services
www.americanstudentloan.com
1.800.575.1099

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



[PHP] Imagemagick Displaying Images

2006-05-02 Thread Ray Hauge
I have an application that shows thumnails of PDF files in different 
directories.  I have so far decided that I can use "convert" from imagemagick 
to get a .jpg, .png, .gif, etc. to display as the image.  The problem I'm 
running into is that I don't want to save these thumbnails.  Instead I just 
want to take the binary data and display an image with it.  I figure that 
it's possible since you can store binary data in a database and display it 
that way.

an example of what I'm doing is:

convert -resize 800x600 AR-M455N_20060420_130446.pdf[0] -

The '-' makes it display the contents of the image to stdout.  I want to 
caputre that binary data and somehow display the images inline with the 
website.  Is this possible, or am I living in a dream world ;)

Thanks,
-- 
Ray Hauge
Programmer/Systems Administrator
American Student Loan Services
www.americanstudentloan.com
1.800.575.1099

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



Re: [PHP] Slow mail()

2006-05-02 Thread Tony Aldrich

Thanks for all.

Hope host sysadmin will work on this.
I wondered if it's my problem but on my testing environment it is relatively
fast.

Again, thanks.


[PHP] secure upload file

2006-05-02 Thread kristianto adi widiatmoko
can any body help me  !!
 
how to secure folder upload file since the privilege of this folder is 777

is any method to create a secure upload file ??

Send instant messages to your online friends http://uk.messenger.yahoo.com 

[PHP] Sanity checker?

2006-05-02 Thread Ezra Nugroho

PHP experts everywhere,


Does anyone know of any tools to test the sanity of your php code?

If you were to check the sanity of your code, what would you look for?

Any pointers for other resources?

Thank you,
Ezra

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



RE: [PHP] ????,????????????

2006-05-02 Thread Chris W. Parker
Yeah it's Chinese. I can see the characters fine. The subject is just ? marks, 
though I'm not sure why.

-Original Message-
From: Rory Browne [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, May 02, 2006 4:45 PM
To: Chris W. Parker
Cc: php-general@lists.php.net
Subject: Re: [PHP] ,


It's probably some unrenderable character set - like chinese or 
something like that.



On 5/3/06, Chris W. Parker < [EMAIL PROTECTED]  > wrote: 

Yes definitely. I totally agree. Please send me more on the 
product/service you're giving away/trying to sell to me/us. I'd really like to 
see/hear/experience more. 

Thanks/Regards/Sincerely!
Chris.

-Original Message-
From: abzgjisf5 [mailto:[EMAIL PROTECTED]
Sent: Tuesday, May 02, 2006 3:23 PM
To: php-general@lists.php.net
Subject: [PHP] ,


华明集团有限公司

与多家省市公司合作,现有部份余额发票可对外代开,收取费用低,可提供给贵公司作帐及(进项)抵扣用,降低成本、提高效率。
收费如下:

普通商品销售发票及建筑安装专用发票,加工修理等普通发票按金额大小算:5万以下收2个点,5万以上收1.5,50万以上收1个点;(金额越大价钱越优惠) 
代开范围:商品销售、运输物流、广告、服务、建筑安装等, 
本公司郑重承诺所用票据均为各单位在税务局所申领,可上网查询或到税务局抵扣验证。(国内各大城市均有我们的合作公司) 

(金额越大、价钱越优惠,以上价钱仍有商量)
本公司开出的发票绝对正规,均可先验票后收钱。

   联系人:吕先生

联系电话:13620912191

E-MAIL:[EMAIL PROTECTED]

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






Re: [PHP] ????,????????????

2006-05-02 Thread Rory Browne

It's probably some unrenderable character set - like chinese or something
like that.


On 5/3/06, Chris W. Parker <[EMAIL PROTECTED]> wrote:


Yes definitely. I totally agree. Please send me more on the
product/service you're giving away/trying to sell to me/us. I'd really like
to see/hear/experience more.

Thanks/Regards/Sincerely!
Chris.

-Original Message-
From: abzgjisf5 [mailto:[EMAIL PROTECTED]
Sent: Tuesday, May 02, 2006 3:23 PM
To: php-general@lists.php.net
Subject: [PHP] ,


华明集团有限公司

与多家省市公司合作,现有部份余额发票可对外代开,收取费用低,可提供给贵公司作帐及(进项)抵扣用,降低成本、提高效率。
收费如下:
普通商品销售发票及建筑安装专用发票,加工修理等普通发票按金额大小算:5万以下收2个点,5万以上收1.5,50万以上收1个点;(金额越大价钱越优惠)
代开范围:商品销售、运输物流、广告、服务、建筑安装等,
本公司郑重承诺所用票据均为各单位在税务局所申领,可上网查询或到税务局抵扣验证。(国内各大城市均有我们的合作公司)

(金额越大、价钱越优惠,以上价钱仍有商量)
本公司开出的发票绝对正规,均可先验票后收钱。

   联系人:吕先生

联系电话:13620912191

E-MAIL:[EMAIL PROTECTED]

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




RE: [PHP] ????,????????????

2006-05-02 Thread Chris W. Parker
Yes definitely. I totally agree. Please send me more on the product/service 
you're giving away/trying to sell to me/us. I'd really like to 
see/hear/experience more.

Thanks/Regards/Sincerely!
Chris.

-Original Message-
From: abzgjisf5 [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, May 02, 2006 3:23 PM
To: php-general@lists.php.net
Subject: [PHP] ,


华明集团有限公司

与多家省市公司合作,现有部份余额发票可对外代开,收取费用低,可提供给贵公司作帐及(进项)抵扣用,降低成本、提高效率。
 收费如下:
 普通商品销售发票及建筑安装专用发票,加工修理等普通发票按金额大小算:5万以下收2个点,5万以上收1.5,50万以上收1个点;(金额越大价钱越优惠)
代开范围:商品销售、运输物流、广告、服务、建筑安装等, 
本公司郑重承诺所用票据均为各单位在税务局所申领,可上网查询或到税务局抵扣验证。(国内各大城市均有我们的合作公司) 

(金额越大、价钱越优惠,以上价钱仍有商量)
 本公司开出的发票绝对正规,均可先验票后收钱。

   联系人:吕先生

联系电话:13620912191

E-MAIL:[EMAIL PROTECTED]

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



[PHP] 发票代开,可上网查询或到税务局验证

2006-05-02 Thread abzgjisf5
华明集团有限公司

与多家省市公司合作,现有部份余额发票可对外代开,收取费用低,可提供给贵公司作帐及(进项)抵扣用,降低成本、提高效率。
 收费如下:
 普通商品销售发票及建筑安装专用发票,加工修理等普通发票按金额大小算:5万以下收2个点,5万以上收1.5,50万以上收1个点;(金额越大价钱越优惠)
代开范围:商品销售、运输物流、广告、服务、建筑安装等, 
本公司郑重承诺所用票据均为各单位在税务局所申领,可上网查询或到税务局抵扣验证。(国内各大城市均有我们的合作公司) 

(金额越大、价钱越优惠,以上价钱仍有商量)
 本公司开出的发票绝对正规,均可先验票后收钱。

   联系人:吕先生

联系电话:13620912191

E-MAIL:[EMAIL PROTECTED]


[PHP] [RELEASE ANNOUNCEMENT] phpDocumentor 1.3.0RC6

2006-05-02 Thread Greg Beaver
May 2, 2006
RELEASE ANNOUNCEMENT
phpDocumentor 1.3.0RC6
Download:
http://pear.php.net/PhpDocumentor
http://www.phpdoc.org

The phpDocumentor team would like to announce the release of version
1.3.0RC6.  This is the last release candidate of version 1.3.0, the
first stable version to be released since 2004.  The 1.3.0 series is a
milestone, and 1.3.0RC6 demonstrates that amply.

phpDocumentor is written by Gregory Beaver, Joshua Eichorn and others in
PHP, and works by parsing PHP source code, and generating customizable
documentation in HTML, PDF or windows help file formats.  phpDocumentor
is the premiere auto-documenting application for PHP.  Used by giants of
the industry such as Zend, ez Systems, and the standard auto-documentor
of PEAR, the program is also bundled in popular IDEs such as Zend
Development Environment, PHPEdit, and nuSphere phpEd.

In version 1.3.0RC6, not only is stability at its highest level yet, but
full support for PHP5 features has been implemented, including:

 - documenting classes that extend internal classes (like Exception) or
implement internal interfaces using the Reflection extension.
 - userspace interfaces, abstract classes
 - access control (private/protected/public)
 - access modifiers (final/abstract/static)
 - class and array type hints

To acquire phpDocumentor, either run:

pear upgrade PhpDocumentor-beta

or download your copy from www.phpdoc.org and extract, following
instructions in the INSTALL file.

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



RE: [PHP] What means "Fatal error: pcntl_fork(): Error 11"?

2006-05-02 Thread Jay Blanchard
[snip]
My script dies with the following line (after a few hours running
without other errors/warnings/notices):
Fatal error: pcntl_fork(): Error 11 in /home/foo/bar.php on line 297

Is there any documentation for "pcntl_fork(): Error 11"?
Does anybody know what causes "pcntl_fork(): Error 11"?

(It's PHP5 and the scripts source is top secret.)
[/snip]

It means "Cut and paste this into Google and you will see entries
concerning this error".

I could tell you the answer, but then I'd have to kill you.

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



Re: [PHP] What means "Fatal error: pcntl_fork(): Error 11"?

2006-05-02 Thread Jochem Maas

Richard Lynch wrote:

On Tue, May 2, 2006 11:29 am, Oz wrote:


My script dies with the following line (after a few hours running
without other errors/warnings/notices):
Fatal error: pcntl_fork(): Error 11 in /home/foo/bar.php on line 297

Is there any documentation for "pcntl_fork(): Error 11"?
Does anybody know what causes "pcntl_fork(): Error 11"?

(It's PHP5 and the scripts source is top secret.)



I believe that if you installed my perror extension:
http://l-i-e.com/perror/


heh cool - I saw your posts to internals regarding trying to write
an extension, seems you got a result :-)


you would be able to easily print out the error message corresponding
to 11.

I suppose you could be old-school and just use a shell with:
perror 11
but that is not nearly as much fun.


ah but you just did teach *me* something new :-)



PS
"My amp goes to 11."



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



Re: [PHP] Question regarding apc

2006-05-02 Thread Jochem Maas

Dave Goodchild wrote:
Oooo you have so much power..must be amazing to be so 
knowlgeable...oh my god, are you really considering witholding that 
information from me...what on earth am I goimng to dohow can I 
cope...uh...uh...


oh shit! I worked it out myself. No need to wade through snide and 
sarcastic responses from undersexed and insecure f**kwits like you then eh?


http://iamjochem.com/baby/

but you got the sarcastic bit right.



On 02/05/06, * Jochem Maas* <[EMAIL PROTECTED] 
> wrote:


Dave Goodchild wrote:
 > Hi all. I have heard that functions like apc_define_constants and
 > apc_load-constants are useful in speeding up mass definition of
constants
 > but could someone tell me how many constants you would have to
have before
 > this became appropriate. I am writing an app that loads a number of
 > constants into the main config file and estimate that there may
be 200+
 > values. Is it worth using the library for this many values?

I could answer that for you, but I'm prat, isn't that right Dave?




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

dynamic web programming from Reigate, Surrey UK (php, mysql, xhtml, css)

look out for project karma, our new venture, coming soon!


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



Re: [PHP] php mysql problem

2006-05-02 Thread Richard Lynch
On Tue, May 2, 2006 5:00 am, Ross wrote:
> CREATE TABLE `mytable` (
>   `id` int(4) NOT NULL auto_increment,
> `fileName` varchar(50) NOT NULL default '',
>   PRIMARY KEY  (`id`)
> ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=7 ;
>
>
> when I add items they go id 1,2,3 etc. Whn I delete them gaps appear.
> 1, 3,
> 7. I need to know
>
> (a) when items are removed how can I sort the database to all the gaps
> are
> take out 1, 3, 7 becomes 1,2,3

You do *NOT* want to do this on an auto_increment field in a
relational database.

It's just a Bad Idea in so many ways...

For starters, you're going to need that 'id' field in a bunch of other
tables to relate the two tables -- That's kinda why they call it a
RELATIONAL database.

So if you re-number this table, you have to go through all the other
tables related to this table and update them as well.

You're looking at a cascading nightmare of updates.

> (b) allow the ids to be changed so the items can change position in
> the
> list. If I change id 3 to id 1 then everything else shifts down.
>
> If anyone has seen the amazon dvd rental list where you can swap dvd
> to the
> top of the list and delete this is what I am trying to achive with
> php/mysql.

THAT is another kettle of fish entirely.

You pretty much just need to manage the numbering on a different
column "by hand"

create table mytable(id int(11) auto_increment, rank int(4));

Queries you will find useful:

//The rank for the new item added to end of list:
select max(rank) + 1 from mytable;

//Queries to move to top of list:
$id = /* get ID of row here */
$rank = /* get current $rank of that row here */
update mytable set rank = rank + 1 where rank < $rank
update mytable set rank = 1 where id = $id

It's easy to mess up and get everything "off by one" but this is not
rocket science to figure out and debug.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Tiny mass mail (Kinda 0T)

2006-05-02 Thread John Nichel

Richard Lynch wrote:

On Tue, May 2, 2006 6:16 am, Ryan A wrote:

The problem is the host is limiting the amount of
emails that can go from the site per minute, and we
need to email all the members (a modest 700 or so) a
newsletter/update...any suggestions on how to do that?


The main problem with using mail() for mass emails is that every call
to mail() fires up sendmail, and you can easily swamp your machine.



Okay, this is not what I understand of mail() if the path to sendmail 
(or sendmail wrapper) is given (vs a smtp server).  I might be wrong, 
and I hope I'm not, but if the path is set, doesn't it just inject the 
message into the queue?


--
John C. Nichel IV
Programmer/System Admin (ÜberGeek)
Dot Com Holdings of Buffalo
716.856.9675
[EMAIL PROTECTED]

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



Re: [PHP] chop x amount of characters from the begining of a string

2006-05-02 Thread Wolf
Someone has way too much time on his hands...  :)

Rory Browne wrote:
> function chop_two_or_3_characters_from_front_of_string($str){
>  $cut = rand(2, 3);
>  return substr($str, $cut);
> }
> 
> On 5/2/06, Jochem Maas <[EMAIL PROTECTED]> wrote:
>>
>> Brad Bonkoski wrote:
>> > Perhaps this will work..
>> > http://www.php.net/manual/en/function.substr.php
>>
>> it's a long shot brad ;-)
>>
>> >
>> >
>> > Ross wrote:
>> >
>> >> I have a word say 'example' I want to chop of two or 3 chacters from
>> >> the front to leave 'ample' or 'mple'. Is there a php function to do
>> this?
>> >>
>> >>
>> >> Ross
>> >>
>> >>
>> >
>>
>> -- 
>> 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] Tiny mass mail (Kinda 0T)

2006-05-02 Thread Richard Lynch
On Tue, May 2, 2006 6:16 am, Ryan A wrote:
> The problem is the host is limiting the amount of
> emails that can go from the site per minute, and we
> need to email all the members (a modest 700 or so) a
> newsletter/update...any suggestions on how to do that?

The main problem with using mail() for mass emails is that every call
to mail() fires up sendmail, and you can easily swamp your machine.

If the host won't let you do more than X per minute, and you write a
loop to stay within that limit (http://php.net/sleep) then you should
probably be okay.

I wouldn't want to do it for THOUSANDS of emails, but you're probably
going to run into time-delay problems of the mail not being relevant
because of the server-enforced limits before anything else.

I had to do this once for a client, and I'll just paste my code here.

It's crude in many ways, as I don't really know ADOdb well enough to
remember the darn function names, but didn't want to write a second
'connect' script, so I sort of use ADO to connect, and then ignore
ADO.


getAdoDbConnection();
  $dbconn = $init->getAdoDbConnection();
  require 'email_message.php';
  $message_object = new email_message_class();
  $query = "select mail_id, subject, plain, html from mail ";
  $query .= " where autosend ";
  $query .= "   and send_date <= now() ";
  $query .= "   and sent_date is null ";
  $result = mysql_query($query) or die("Error in query: $query. " .
mysql_error());

  $errors = '';
  $from = '"Example" <[EMAIL PROTECTED]>';
  #$errors .= $message_object->SetHeader('Return-Path', $from);
  $errors .= $message_object->SetHeader('From', $from);
  $errors .= $message_object->SetHeader('Reply-to', $from);

  $query = "select email from user where newsletter order by
reverse(email) ";
  $victims = mysql_query($query) or die("Error in query: $query. " .
mysql_error());


  //Policies dictate no more than 50 messages per minute, nor 500 per
hour
  $start = time();
  $counter = 0;
  while (list($mail_id, $subject, $plain, $html) =
mysql_fetch_row($result)){
$errors .= $message_object->AddPlainTextPart($plain);
$errors .= $message_object->AddHTMLPart($html);
$errors .= $message_object->SetHeader('Subject', $subject);
mysql_data_seek($victims, 0);
while (list($victim) = mysql_fetch_row($victims)){
  $errors .= $message_object->SetHeader('To', $victim);
  if (1){
$errors .= $message_object->Send();
  }
  else{
echo "";
ob_start();
var_dump($message_object);
$data = ob_get_contents();
ob_end_clean();
echo htmlentities($data);
error_log(htmlentities($data));
echo "";
  }
  echo $errors;
  $counter++;
  //So sleep a minute every 50 messages, or for an hour after 500
  if (($counter % 50) === 0) sleep(60);
  if (($counter % 500) === 0) sleep(60*60);
}
$query = "update mail set sent_date = now() where mail_id =
$mail_id";
mysql_query($query) or die("$query\n" . mysql_error());
  }
?>

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Problem with ftp_rmdir

2006-05-02 Thread Richard Lynch
On Tue, May 2, 2006 8:06 am, PJ wrote:
> I'm using function ftp_rmdir to create some aplication and for testing
> I've used following sample from php.net
>
> if (ftp_rmdir($conn_id, $dir)) {
> echo "Successfully deleted $dir\n";
> } else {
> echo "There was a problem while deleting $dir\n";
> }
>
> Command really removed specified directory, but stopped script as
> well.
> So there is no more output about "Successfully deleting" of this file
> after line with ftp_rmdir
>
> When I tried this:
> $x=ftp_rmdir($conn_id, $dir);
> echo "start $x end";
>
> the second line with echo wasn't put to output... It seems like there
> is
> exit function after ftp_rmdir...
>
> Does anybody knows, what goes wrong??

No idea what's wrong, but check your Apache error logs (if you run
Apache) to see if you have a child segfaulting at that point.

If so, you can find out more about how to debug here:
http://bugs.php.net/
Search for the "backtrace" link and info on that page.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] What means "Fatal error: pcntl_fork(): Error 11"?

2006-05-02 Thread Richard Lynch
On Tue, May 2, 2006 11:29 am, Oz wrote:
> My script dies with the following line (after a few hours running
> without other errors/warnings/notices):
> Fatal error: pcntl_fork(): Error 11 in /home/foo/bar.php on line 297
>
> Is there any documentation for "pcntl_fork(): Error 11"?
> Does anybody know what causes "pcntl_fork(): Error 11"?
>
> (It's PHP5 and the scripts source is top secret.)

I believe that if you installed my perror extension:
http://l-i-e.com/perror/
you would be able to easily print out the error message corresponding
to 11.

I suppose you could be old-school and just use a shell with:
perror 11
but that is not nearly as much fun.

PS
"My amp goes to 11."

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] I need to Index and to research files PDF

2006-05-02 Thread Richard Lynch
On Tue, May 2, 2006 11:36 am, Carlos Augusto Falcão da Silva wrote:

You may want to re-post in your native language...

The translation suffered quite a bit...

These may also help:
http://www.google.com/search?q=PHP+PDF2text
http://www.google.com/search?q=gocr
http://php.net/libpdf

> I am developing a system of content management through intranet,
> for us to manage our documents involved in the system of
> administration of
> the
> quality and also the norms of the assemblers etc. I Possess, today,
> some
> 500
> norms, being about 85% in paper. I already come scanning some and
> allowing
> I access, controlled, through links in the intranet. It is what want
> to do
> with all
> them. In other words, scanned in PDF, copy for a paste in the net, I
> distribute the
> accesses and in a page an index is presented with all of the files.
> There
> is everything calm. The one that I want do now it is to generate an
> indexation form and
> he/she researches of those norms, through search fields in that
> you/they are
> researched
> the occurrences inside of the files PDF. I want to do something (if it
> is
> possible)
> similar to the that Coppernic Desktop Search or Google Desktop Search
> they do. If you make a search for the software, he gives you all of
> the
> occurrences,
> in all of the defined files in the research. For me, it would be a
> hand-na-wheel
> absurd. I tried to research in the manual, but I didn't get to arrive
> in a
> point
> common. I think I didn't get to seek right! : - (
>
> Ah, in time, I am using PHP+MySQL in that content manager. ;) And
> all generate my documents in PDF, with recognition of characters (OCR)
> of good quality (for Acrobat I make the researches usually!), besides
> to define several "metadados" (tag's) in the properties of the
> generated
> documents.
>
>
> A great hug and I hope to count with his/her help.
>
>
> Ps.: My English is very poor, therefore, I apologize! I used an
> electronic
> translator as aid. :(
>
> Thank's...
>
> --
> Guto. <[EMAIL PROTECTED]>
>
> "Vai imprimir este email? Pense antes em sua responsabilidade com a
> preservação do meio-ambiente e com a redução de seus custos."
>


-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] display_errors off and custom error pages

2006-05-02 Thread Richard Lynch
On Tue, May 2, 2006 11:50 am, IG wrote:
> So to use a custom error handler do I HAVE to have display_errors set
> to
> 1 in my php.ini file? This would of course mean I would have to use
> custom error handling across all my scripts.

I'm not gonna answer this again.

We've told you "No, you don't need display_errors = 1" about four
times on this list now, and I've said it off-list twice.

If you STILL don't believe us, there is nothing more to be said.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Question regarding apc

2006-05-02 Thread Jochem Maas

Dave Goodchild wrote:

Hi all. I have heard that functions like apc_define_constants and
apc_load-constants are useful in speeding up mass definition of constants
but could someone tell me how many constants you would have to have before
this became appropriate. I am writing an app that loads a number of
constants into the main config file and estimate that there may be 200+
values. Is it worth using the library for this many values?


I could answer that for you, but I'm prat, isn't that right Dave?

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



Re: [PHP] Syntax Oddity

2006-05-02 Thread Dave Goodchild

Hmmm. The only time I ever use anything remotely like that is in a loop or
other code are where I don't want anything to happen ie

for ($foo=0;$foo<=10;$foo++) {


On 02/05/06, Martin Alterisio <[EMAIL PROTECTED]> wrote:


2006/5/2, Richard Lynch <[EMAIL PROTECTED]>:
>
> Does anybody have a rational explanation for what purpose in life the
> following syntax is considered acceptable?
>
>$query = "UPDATE whatever SET x = 1";
>   $query;
> ?>
>
> Note that the line with just $query; on it doesn't, like, "do" anything.
>
> I suppose in a Zen-like sort of way, it "exists" and all, but, really,
> what's the point?
>
> Is there some subtle reason for this not being some kind of syntax
> error that's way over my head or something?
>
> This is not just philosophical minutiae -- Real-world beginners, with
> no programming experience, actually type the above (albeit with a lot
> more logic and whatnot in between) and then wonder why the query
> didn't execute.
>
> It even makes a wild sort of sense to type that, if you presume that a
> beginner might not grasp the distinctions between PHP and MySQL and
> the relationship yet.
>
> Does anybody actually USE this idiom in any meaningful way?
>"string";
> ?>
>
> --
> Like Music?
> http://l-i-e.com/artists.htm
>
> --
> PHP General Mailing List (http://www.php.net/ )
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
I believe this is just C syntax legacy, although I think you can pass an
argument to a C compiler to raise a warning when this kind of statements
are
found, that can't be done in PHP. Anyway, is just the way
compiler/interpreters are made when a language has a C syntax style, it's
just more efficient for the compiler to do what you're told and don't ask
too many questions (if you mess up and your program is slow or buggy is
your
fault not the compiler's).





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

dynamic web programming from Reigate, Surrey UK (php, mysql, xhtml, css)

look out for project karma, our new venture, coming soon!


Re: [PHP] Syntax Oddity

2006-05-02 Thread Martin Alterisio

2006/5/2, Richard Lynch <[EMAIL PROTECTED]>:


Does anybody have a rational explanation for what purpose in life the
following syntax is considered acceptable?



Note that the line with just $query; on it doesn't, like, "do" anything.

I suppose in a Zen-like sort of way, it "exists" and all, but, really,
what's the point?

Is there some subtle reason for this not being some kind of syntax
error that's way over my head or something?

This is not just philosophical minutiae -- Real-world beginners, with
no programming experience, actually type the above (albeit with a lot
more logic and whatnot in between) and then wonder why the query
didn't execute.

It even makes a wild sort of sense to type that, if you presume that a
beginner might not grasp the distinctions between PHP and MySQL and
the relationship yet.

Does anybody actually USE this idiom in any meaningful way?


--
Like Music?
http://l-i-e.com/artists.htm

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



I believe this is just C syntax legacy, although I think you can pass an
argument to a C compiler to raise a warning when this kind of statements are
found, that can't be done in PHP. Anyway, is just the way
compiler/interpreters are made when a language has a C syntax style, it's
just more efficient for the compiler to do what you're told and don't ask
too many questions (if you mess up and your program is slow or buggy is your
fault not the compiler's).


Re: [PHP] chop x amount of characters from the begining of a string

2006-05-02 Thread Jochem Maas

Rory Browne wrote:

function chop_two_or_3_characters_from_front_of_string($str){
 $cut = rand(2, 3);
 return substr($str, $cut);
}


dang! if I hadn't seen it with my own eyes I wouldn't have
believed it :->



On 5/2/06, Jochem Maas <[EMAIL PROTECTED]> wrote:



Brad Bonkoski wrote:
> Perhaps this will work..
> http://www.php.net/manual/en/function.substr.php

it's a long shot brad ;-)

>
>
> Ross wrote:
>
>> I have a word say 'example' I want to chop of two or 3 chacters from
>> the front to leave 'ample' or 'mple'. Is there a php function to do
this?
>>
>>
>> Ross
>>
>>
>

--
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] I need to Index and to research files PDF

2006-05-02 Thread Jochem Maas

Carlos Augusto Falcão da Silva wrote:

Good afternoon!!!


please don't post your question more than once - if anyone can help you
you will get an answer.

2 things I would suggest you look at:

1. http://php.net/manual/es/ref.mnogosearch.php - mnogosearch is capable of
indexing PDF content - I have never used it but others on this list are, if you
get stuck with something specific just come back :-)

2. your company might consider the following as a worthwhile investment
(given that implementing a custom solution is not without cost:

http://www.google.com/enterprise/

I have never used the device but a nice blue 1U server with a big Google logo
on it looks pretty cool if nothing else ;-)







Ps.: My English is very poor, therefore, I apologize! I used an electronic
translator as aid. :(


well looks like you made a big effort - that's always welcome around here :-)

you might also try looking for a spanish speaking mailing list - but I have no
idea if there even is one :-/

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



Re: [PHP] chop x amount of characters from the begining of a string

2006-05-02 Thread Rory Browne

function chop_two_or_3_characters_from_front_of_string($str){
 $cut = rand(2, 3);
 return substr($str, $cut);
}

On 5/2/06, Jochem Maas <[EMAIL PROTECTED]> wrote:


Brad Bonkoski wrote:
> Perhaps this will work..
> http://www.php.net/manual/en/function.substr.php

it's a long shot brad ;-)

>
>
> Ross wrote:
>
>> I have a word say 'example' I want to chop of two or 3 chacters from
>> the front to leave 'ample' or 'mple'. Is there a php function to do
this?
>>
>>
>> Ross
>>
>>
>

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




Re: [PHP] chop x amount of characters from the begining of a string

2006-05-02 Thread Jochem Maas

Brad Bonkoski wrote:

Perhaps this will work..
http://www.php.net/manual/en/function.substr.php


it's a long shot brad ;-)




Ross wrote:

I have a word say 'example' I want to chop of two or 3 chacters from 
the front to leave 'ample' or 'mple'. Is there a php function to do this?



Ross
 





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



Re: [PHP] php mysql problem

2006-05-02 Thread John

Ross wrote:
This is my database now...I will use the item_id for the order but what if I 
want to change item_id 3 to item id 1? How can I push all the items down one 
place? How can I delete any gaps when items are deleted.



CREATE TABLE `board_papers` (
  `id` int(4) NOT NULL auto_increment,
  `doc_date` varchar(10) NOT NULL default '-00-00',
  `article_type` enum('agenda','minutes','paper') NOT NULL default 'agenda',
  `fileName` varchar(50) NOT NULL default '',
  `fileSize` int(4) NOT NULL default '0',
  `fileType` varchar(50) NOT NULL default '',
  `content` blob NOT NULL,
  `item_id` int(10) default NULL,
  PRIMARY KEY  (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=8 ;



-- snip --
Hi Ross,

You can reuse item_id after they have been deleted. So when you delete
item_id = 1, then next time you perform an insert, lookup the lowest
free item_id number and give it as the item_id. That's one small solution.

If you actually want to rank your records by more than just the item_id,
then define a field for each kind of rank you want, or better, add it as
a separate table, like:

board_papers -< rank
* id
* board_papers_fk <-- id from board_papers
* rank_type (example: readability, technicality...)
* rank_no (rank within the rank type)

Then you can order the board_papers after rank as you like!

Just an idea :)

Enjoy,
   John

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



Re: [PHP] PHP Standard style of writing your code

2006-05-02 Thread Robert Cummings
On Tue, 2006-05-02 at 13:18, John Meyer wrote:
> Should we really have this arguement about a "standard" way of writing 
> the code?  This is PHP, an open-source project.  Isn't that like asking 
> existentialists to adopt a uniform code of conduct?

Yes but what would that code of conduct look like? Would it have
vertically aligned braces or not? ;)

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

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



Re: [PHP] php mysql problem

2006-05-02 Thread John

Ross wrote:
This is my database now...I will use the item_id for the order but what if I 
want to change item_id 3 to item id 1? How can I push all the items down one 
place? How can I delete any gaps when items are deleted.



CREATE TABLE `board_papers` (
  `id` int(4) NOT NULL auto_increment,
  `doc_date` varchar(10) NOT NULL default '-00-00',
  `article_type` enum('agenda','minutes','paper') NOT NULL default 'agenda',
  `fileName` varchar(50) NOT NULL default '',
  `fileSize` int(4) NOT NULL default '0',
  `fileType` varchar(50) NOT NULL default '',
  `content` blob NOT NULL,
  `item_id` int(10) default NULL,
  PRIMARY KEY  (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=8 ;



-- snip --
Hi Ross,

You can reuse item_id after they have been deleted. So when you delete
item_id = 1, then next time you perform an insert, lookup the lowest
free item_id number and give it as the item_id. That's one small solution.

If you actually want to rank your records by more than just the item_id,
then define a field for each kind of rank you want, or better, add it as
a separate table, like:

board_papers -< rank
* id
* board_papers_fk <-- id from board_papers
* rank_type (example: readability, technicality...)
* rank_no (rank within the rank type)

Then you can order the board_papers after rank as you like!

Just an idea :)

Enjoy,
   John

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



Re: [PHP] PHP Standard style of writing your code

2006-05-02 Thread John Meyer
Should we really have this arguement about a "standard" way of writing 
the code?  This is PHP, an open-source project.  Isn't that like asking 
existentialists to adopt a uniform code of conduct?


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



Re: [PHP] What means "Fatal error: pcntl_fork(): Error 11"?

2006-05-02 Thread Robin Vickery

On 02/05/06, Oz <[EMAIL PROTECTED]> wrote:

Hi,

My script dies with the following line (after a few hours running without other 
errors/warnings/notices):
Fatal error: pcntl_fork(): Error 11 in /home/foo/bar.php on line 297

Is there any documentation for "pcntl_fork(): Error 11"?
Does anybody know what causes "pcntl_fork(): Error 11"?

(It's PHP5 and the scripts source is top secret.)


The 11 is from errno.h and it corresponds to EAGAIN.


From the docs for fork()

The fork() function shall fail if:

[EAGAIN]
The system lacked the necessary resources to create another process, or
 the system-imposed limit on the total number of processes under execution
 system-wide or by a single user {CHILD_MAX} would be exceeded.


Does that help?

-robin

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



Re: [PHP] we are looking for experienced php programmers full time freelance...

2006-05-02 Thread Robert Cummings
On Thu, 2006-04-27 at 23:15, Robert Cummings wrote:
> On Thu, 2006-04-27 at 22:47, Sumeet wrote:
> > we are looking for experienced php/mysql programmers full time freelance...
> > 
> > should be at least 1 year experienced, knowing pear libraries and having 
> > worked on several projects.
> > 
> > please contact me at [EMAIL PROTECTED]
> > 
> > quote your charges and the time that you will be available. also mention 
> > msn or yahoo ids. skype id is more welcome.
> 
> What about a MUD? I'm usually logged into a mud. It's a great place for
> my clients to come chat with me about projects. There's nothing like
> talking about deploying some web project when suddenly a brawl breaks
> out between the trolls and gnomes. Seriously though :)
> 
> telnet wocmud.org 4000

I'd like to say thanks to everyone who stopped by to say hello.
Unfortunately I was probably in another workspace hacking away at some
code and just noticed the reference log today :)

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

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



Re: [PHP] PHP Standard style of writing your code

2006-05-02 Thread Robert Cummings
On Tue, 2006-05-02 at 11:06, tedd wrote:
> Barry:
> 
> >>PS: Barry, you and I use the exact same style -- you must be very 
> >>intelligent. ;-)
> >Or very stupid, depends on who looks at us ^_^"
> 
> 
> To paraphrase Will Rogers, "We're all stupid, only in different subjects."

Speak for yourself dum dum ;)  (double entendre intended).

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

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



RE: [PHP] PHP Standard style of writing your code

2006-05-02 Thread Robert Cummings
On Tue, 2006-05-02 at 09:03, Ford, Mike wrote:
>
> As you might have guessed, I *HATE* curly brackets with a vengeance, which is 
> why I eschew both those styles and use PHP's alternative syntax:
> 
>   if (...):
>  if (...):
>// mmh
>  else:
>// oh
>  endif;
>  while (...):
>if (...):
>  // oh
>else:
>  if (...):
>// where am i?
>  else:
>// huh!?
>  endif;
>  // hmm
>endif;
>  if (...):
>if (...):
>  // blah
>endif;
>  // blah
>  endif;
>   // blah
>   endif;
> 
> Just beeeautiful!  And, oh look, all the end tags tell me which kind of start 
> tag they should match.  And the compiler.  Which leads to much more focussed 
> error messages when you cock your structure up.  I can't remeber the last 
> time PHP told me I had a syntax arror at the end of the file -- if I've got 
> unbalanced start/end tags, the error message usually points to a line in the 
> middle of the file, slap bang in the target area.

Dearh Mike,

You appear to have found a PHP mailing list when in fact your code
appears to be VB. Please search the net for a more appropriate mailing
list.

*hahahah -- runns away cackling*

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

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



Re: [PHP] PHP Standard style of writing your code

2006-05-02 Thread Robert Cummings
On Tue, 2006-05-02 at 04:02, Barry wrote:
> > - I try not to let lines grow larger than about 100 cols (cannot
> >   be really done with strings and other thingies, and maybe that
> >   should remain in the old 80 cols, but it's too litle space), and
> Never possible if you write web-applications.
> CLI might be possible for that but for web it's a no-go.

I think you're kidding. I write web applications all the time and
constrain my line width's to 80 columns. If you are speaking to embedded
HTML code then I can see your problem.. but I use a good templating
system which keeps most html out of my code... and I never use what I
consider to be the ugliest style of all... switching back and forth
between PHP and HTML mode.

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

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



Re: [PHP] display_errors off and custom error pages

2006-05-02 Thread IG
So to use a custom error handler do I HAVE to have display_errors set to 
1 in my php.ini file? This would of course mean I would have to use 
custom error handling across all my scripts.


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



[PHP] What means "Fatal error: pcntl_fork(): Error 11"?

2006-05-02 Thread Oz

Hi,

My script dies with the following line (after a few hours running without other 
errors/warnings/notices):
Fatal error: pcntl_fork(): Error 11 in /home/foo/bar.php on line 297

Is there any documentation for "pcntl_fork(): Error 11"?
Does anybody know what causes "pcntl_fork(): Error 11"?

(It's PHP5 and the scripts source is top secret.)

Thanks for your time,
 - Oz

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



Re: [PHP] chop x amount of characters from the begining of a string

2006-05-02 Thread Brad Bonkoski

Perhaps this will work..
http://www.php.net/manual/en/function.substr.php


Ross wrote:

I have a word say 'example' I want to chop of two or 3 chacters from the 
front to leave 'ample' or 'mple'. Is there a php function to do this?



Ross 

 



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



[PHP] chop x amount of characters from the begining of a string

2006-05-02 Thread Ross

I have a word say 'example' I want to chop of two or 3 chacters from the 
front to leave 'ample' or 'mple'. Is there a php function to do this?


Ross 

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



[PHP] I need to Index and to research files PDF

2006-05-02 Thread Carlos Augusto Falcão da Silva

Good afternoon!!!

I am developing a system of content management through intranet,
for us to manage our documents involved in the system of administration of
the
quality and also the norms of the assemblers etc. I Possess, today, some
500
norms, being about 85% in paper. I already come scanning some and allowing
I access, controlled, through links in the intranet. It is what want to do
with all
them. In other words, scanned in PDF, copy for a paste in the net, I
distribute the
accesses and in a page an index is presented with all of the files. There
is everything calm. The one that I want do now it is to generate an
indexation form and
he/she researches of those norms, through search fields in that you/they are
researched
the occurrences inside of the files PDF. I want to do something (if it is
possible)
similar to the that Coppernic Desktop Search or Google Desktop Search
they do. If you make a search for the software, he gives you all of the
occurrences,
in all of the defined files in the research. For me, it would be a
hand-na-wheel
absurd. I tried to research in the manual, but I didn't get to arrive in a
point
common. I think I didn't get to seek right! : - (

Ah, in time, I am using PHP+MySQL in that content manager. ;) And
all generate my documents in PDF, with recognition of characters (OCR)
of good quality (for Acrobat I make the researches usually!), besides
to define several "metadados" (tag's) in the properties of the generated
documents.


A great hug and I hope to count with his/her help.


Ps.: My English is very poor, therefore, I apologize! I used an electronic
translator as aid. :(

Thank's...

--
Guto. <[EMAIL PROTECTED]>

"Vai imprimir este email? Pense antes em sua responsabilidade com a
preservação do meio-ambiente e com a redução de seus custos."


[PHP] Question regarding apc

2006-05-02 Thread Dave Goodchild

Hi all. I have heard that functions like apc_define_constants and
apc_load-constants are useful in speeding up mass definition of constants
but could someone tell me how many constants you would have to have before
this became appropriate. I am writing an app that loads a number of
constants into the main config file and estimate that there may be 200+
values. Is it worth using the library for this many values?

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

dynamic web programming from Reigate, Surrey UK (php, mysql, xhtml, css)

look out for project karma, our new venture, coming soon!


Re: [PHP] XML-RPC set XML encoding?

2006-05-02 Thread D. Dante Lorenso

D. Dante Lorenso wrote:

Does anyhow know how to set the character encoding for XML-RPC?


Ok, after digging through the sources, I figured this one out.  There's 
a 4th parameter to the method:


   xmlrpc_server_call_method

And, the options are all explained on this page:

   http://xmlrpc-epi.sourceforge.net/main.php?t=php_api#output_options

Not only can you set the encoding to UTF-8, but you can also and and 
remove the whitespace which was also nagging me.


Dante

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



Re: [PHP] PHP Standard style of writing your code

2006-05-02 Thread tedd

Barry:

PS: Barry, you and I use the exact same style -- you must be very 
intelligent. ;-)

Or very stupid, depends on who looks at us ^_^"



To paraphrase Will Rogers, "We're all stupid, only in different subjects."

tedd

--

http://sperling.com

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



Re: [PHP] PHP Standard style of writing your code

2006-05-02 Thread Barry

tedd schrieb:
As you might have guessed, I *HATE* curly brackets with a vengeance, 
which is why I eschew both those styles and use PHP's alternative syntax:


And, I *LOVE* curly brackets -- before them we had repeat the opening 
statement statement in some fashion, such as FOR/NEXT, WHILE/WEND, 
IF/END IF. Curly brackets allow us to shorten the code and it looks a 
lot better to me.


At any rate. Brackets do really fast show where the beginning and the 
end is.

"IF" the brackets are set up in a logial order.

Besides any standards:
if (...) {
}
elseif (...)
{
} else {
}

This is actually we will see probably someday if noone gets a good 
standard up :P


Ahaha:
For I = 0 STEP 5;
NEXT I;

i love that XD

C64 rulez :P



PS: Barry, you and I use the exact same style -- you must be very 
intelligent. ;-)

Or very stupid, depends on who looks at us ^_^"

--
Smileys rule (cX.x)C --o(^_^o)
Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o)

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



Re: [PHP] PHP Standard style of writing your code

2006-05-02 Thread Barry

Ford, Mike schrieb:

On 02 May 2006 14:19, Barry wrote:


Oh my god -- curly brackets and excessive indentation --

and curly brackets.  Just a mo, where did I put my
curly-brackets-and-whitespace-glasses?  Aaaahhh, that's better!!

As you might have guessed, I *HATE* curly brackets with a

vengeance, which is why I eschew both those styles and use
PHP's alternative syntax:

  if (...):
 if (...):
   // mmh
 else:
   // oh
 endif;
 while (...):
   if (...):
 // oh
   else:
 if (...):
   // where am i?
 else:
   // huh!?
 endif;
 // hmm
   endif;
 if (...):
   if (...):
 // blah
   endif;
   // blah
 endif;
  // blah
  endif;

Replacing { with : and } with endif doesn't make it more
readable at all.


Sez you. To me, it totally does, and by quite a large factor.

For you. Probably. But we are talking about "standards"



Just beeeautiful!

Still extreme compacted code.
I just see codesalad on first look, nothing else.


Fair enough.  Whereas to me, in any of the curly-brace styles, all I see on a 
first look is all those curly braces leaping up and trying to scratch my eyes 
with their sharp little pointy bits.  Each to his own preference.
Well i'd like to comment that sentence but something in me is telling me 
i should not.


We should all just say thank goodness PHP lets us each do it to our own 
preference -- I would daily curse the curly brackets if I had to use your 
style, and you would long to expand my compact code if you had to use mine.  
And at least we can all agree (we can, right?) that almost *any* kind of decent 
layout is better than:

  if (...): if (...): // mmh
  else: /* oh */ endif; while (...):
  if (...): /* oh */ else: if (...): // where am i?
  else: /* huh!? */ endif; /* hmm */ endif; if
   (...): if (...): /* blah */ endif;
  /* blah */ endwhile; /* blah */
  endif;

Now that's extreme compaction -- and, yes, I have seen code written like that!! 
;(

OMG. worst case scenario


--
Smileys rule (cX.x)C --o(^_^o)
Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o)

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



Re: [PHP] Slow mail()

2006-05-02 Thread tedd

At 4:24 PM +0800 5/2/06, Tony Aldrich wrote:

Hello!
What are the reasons of slow mail() (about 30-40 seconds)?

Thanks,
Tony.


Hmmm rain(), snow(), sleet()?

tedd
--

http://sperling.com

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



RE: [PHP] PHP Standard style of writing your code

2006-05-02 Thread tedd
As you might have guessed, I *HATE* curly brackets with a vengeance, 
which is why I eschew both those styles and use PHP's alternative 
syntax:


And, I *LOVE* curly brackets -- before them we had repeat the opening 
statement statement in some fashion, such as FOR/NEXT, WHILE/WEND, 
IF/END IF. Curly brackets allow us to shorten the code and it looks a 
lot better to me.


tedd

PS: Barry, you and I use the exact same style -- you must be very 
intelligent. ;-)

--

http://sperling.com

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



RE: [PHP] PHP Standard style of writing your code

2006-05-02 Thread Ford, Mike
On 02 May 2006 14:19, Barry wrote:

> > Oh my god -- curly brackets and excessive indentation --
> and curly brackets.  Just a mo, where did I put my
> curly-brackets-and-whitespace-glasses?  Aaaahhh, that's better!!
> > 
> > As you might have guessed, I *HATE* curly brackets with a
> vengeance, which is why I eschew both those styles and use
> PHP's alternative syntax:
> > 
> >   if (...):
> >  if (...):
> >// mmh
> >  else:
> >// oh
> >  endif;
> >  while (...):
> >if (...):
> >  // oh
> >else:
> >  if (...):
> >// where am i?
> >  else:
> >// huh!?
> >  endif;
> >  // hmm
> >endif;
> >  if (...):
> >if (...):
> >  // blah
> >endif;
> >// blah
> >  endif;
> >   // blah
> >   endif;
> 
> Replacing { with : and } with endif doesn't make it more
> readable at all.

Sez you. To me, it totally does, and by quite a large factor.

> > Just beeeautiful!
> 
> Still extreme compacted code.
> I just see codesalad on first look, nothing else.

Fair enough.  Whereas to me, in any of the curly-brace styles, all I see on a 
first look is all those curly braces leaping up and trying to scratch my eyes 
with their sharp little pointy bits.  Each to his own preference.

We should all just say thank goodness PHP lets us each do it to our own 
preference -- I would daily curse the curly brackets if I had to use your 
style, and you would long to expand my compact code if you had to use mine.  
And at least we can all agree (we can, right?) that almost *any* kind of decent 
layout is better than:

  if (...): if (...): // mmh
  else: /* oh */ endif; while (...):
  if (...): /* oh */ else: if (...): // where am i?
  else: /* huh!? */ endif; /* hmm */ endif; if
   (...): if (...): /* blah */ endif;
  /* blah */ endwhile; /* blah */
  endif;

Now that's extreme compaction -- and, yes, I have seen code written like that!! 
;(

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 



To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm

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



Re: [PHP] php mysql problem

2006-05-02 Thread Wolf
Depending on your needs, here is another tack to think about (I know,
everyone else will be gasping and running for air...)

A few years ago I had to make a shopping cart.  I had an archaic system
that would not share information with my web/db server, so I had to
write a query to dump the products, quantity, price levels, etc out of
it to a CSV file.  I then used perl to get the file, reformat it into
SQL files, then run an empty of the table and recreate with all the data
that I just got off the server.

To get past the naming conventions and such and NOT lose any linked
tables, I did my joins and such off the product ID.  The Caveat to this
was that the products (even those we no longer sold) stayed in the
system for about 6 months, and by the time we were ready to purge those,
the orders were saved and could not be deleted (PDF and as saved data)
so that was never a problem.

That solved the product counts for me (since the bosses were a bit anal
about having accurate product counts and such) and kept that table tidy.

Customers was not so tidy, nor wore the other tables.  But you can only
work with what you can do.

In short, unless you have a very good reason and safety checks to keep
your data from getting lost from other tables, you might need to rethink
why you want that.

If you want to chew the fat and talk design, shoot me a message off-list
and I'll be glad to help.

Wolf

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



Re: [PHP] PHP Standard style of writing your code

2006-05-02 Thread tedd

 > And for your problem with viewing. probably try to get a 19" monitor.

 They are not that expencive anymore.(The CRT ones)
 Even on 1024x768 you see LOTSA code.


I frequently code on smaller monitors -- laptop, ancient desktop,
stripped-down flat-panel monitor that fits inside a rack-mount 2-RU
shelf in my sound booth...

I can't really lug a 19" monitor all over, and there's no room in my
sound booth for it, what with the amps, sound boards, computer, CD
duplicator, etc.


If cost is not an object, consider a MacBook Pro -- it runs windozes 
and has a 17 inch monitor, which provides 1680 x 1050 resolution. 
Nice monitor for a laptop.


tedd
--

http://sperling.com

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



Re: [PHP] php mysql problem

2006-05-02 Thread tedd

At 11:00 AM +0100 5/2/06, Ross wrote:

Just say I have a db

CREATE TABLE `mytable` (
  `id` int(4) NOT NULL auto_increment,
`fileName` varchar(50) NOT NULL default '',
  PRIMARY KEY  (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=7 ;


when I add items they go id 1,2,3 etc. Whn I delete them gaps appear. 1, 3,
7. I need to know

(a) when items are removed how can I sort the database to all the gaps are
take out 1, 3, 7 becomes 1,2,3


Ross:

I am sure that the advice of everyone here and on any mysql list will 
be NOT to do what you are asking. You're looking at the ID as if the 
order of that field means something, it shouldn't.


However, to provide you with what you asked for, please review:

/* Renumber the Existing Sequence
alter table mytable
drop id,
add id int unsigned not null auto_increment,
auto_increment = 1;

Keep in mind that by doing this, your dB should remain flat -- you 
cannot successfully renumber a relational dB without also considering 
all the dependant tables, which is not trivial.


HTH's more than it hurts.

tedd

--

http://sperling.com

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



Re: [PHP] Re: php mysql problem

2006-05-02 Thread Dave Goodchild

Exactly - I don't think you really understand how a relational database
works. The ids are retained as they may relate to records in another table.
Internal sorting order is of no relevance at the application level. I think
you need to rethink your design a little.

On 02/05/06, T.Lensselink <[EMAIL PROTECTED]> wrote:


> This is my database now...I will use the item_id for the order but what
if
> I
> want to change item_id 3 to item id 1? How can I push all the items down
> one
> place? How can I delete any gaps when items are deleted.
>
>
> CREATE TABLE `board_papers` (
>   `id` int(4) NOT NULL auto_increment,
>   `doc_date` varchar(10) NOT NULL default '-00-00',
>   `article_type` enum('agenda','minutes','paper') NOT NULL default
> 'agenda',
>   `fileName` varchar(50) NOT NULL default '',
>   `fileSize` int(4) NOT NULL default '0',
>   `fileType` varchar(50) NOT NULL default '',
>   `content` blob NOT NULL,
>   `item_id` int(10) default NULL,
>   PRIMARY KEY  (`id`)
> ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=8 ;
>
>
>
>
>
> ""Ross"" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
>>
>> Just say I have a db
>>
>> CREATE TABLE `mytable` (
>>  `id` int(4) NOT NULL auto_increment,
>> `fileName` varchar(50) NOT NULL default '',
>>  PRIMARY KEY  (`id`)
>> ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=7 ;
>>
>>
>> when I add items they go id 1,2,3 etc. Whn I delete them gaps appear.
1,
>> 3, 7. I need to know
>>
>> (a) when items are removed how can I sort the database to all the gaps
>> are
>> take out 1, 3, 7 becomes 1,2,3
>>
>> (b) allow the ids to be changed so the items can change position in the
>> list. If I change id 3 to id 1 then everything else shifts down.
>>
>> If anyone has seen the amazon dvd rental list where you can swap dvd to
>> the top of the list and delete this is what I am trying to achive with
>> php/mysql.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

Really can't imagine why you wanna do something like this. What's the use
in reordering a database. It's just a database. you can sort it in any way
you like.. gaps or not.. Sounds to me the sorting is only done on screen.

This is pretty easy done with PHP not in the database itself.

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





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

dynamic web programming from Reigate, Surrey UK (php, mysql, xhtml, css)

look out for project karma, our new venture, coming soon!


Re: [PHP] PHP Standard style of writing your code

2006-05-02 Thread Barry



Oh my god -- curly brackets and excessive indentation -- and curly brackets.  
Just a mo, where did I put my curly-brackets-and-whitespace-glasses?  Aaaahhh, 
that's better!!

As you might have guessed, I *HATE* curly brackets with a vengeance, which is 
why I eschew both those styles and use PHP's alternative syntax:

  if (...):
 if (...):
   // mmh
 else:
   // oh
 endif;
 while (...):
   if (...):
 // oh
   else:
 if (...):
   // where am i?
 else:
   // huh!?
 endif;
 // hmm
   endif;
 if (...):
   if (...):
 // blah
   endif;
 // blah
 endif;
  // blah
  endif;


Replacing { with : and } with endif doesn't make it more readable at all.



Just beeeautiful!


Still extreme compacted code.
I just see codesalad on first look, nothing else.


 And, oh look, all the end tags tell me which kind of start tag they should 
match.  And the compiler.  Which leads to much more focussed error messages 
when you cock your structure up.  I can't remeber the last time PHP told me I 
had a syntax arror at the end of the file -- if I've got unbalanced start/end 
tags, the error message usually points to a line in the middle of the file, 
slap bang in the target area.

Yeah true. : and endif is nicer.
But it's a bit more about the formatting.

Barry
--
Smileys rule (cX.x)C --o(^_^o)
Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o)

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



Re: [PHP] Re: php mysql problem

2006-05-02 Thread T.Lensselink
> This is my database now...I will use the item_id for the order but what if
> I
> want to change item_id 3 to item id 1? How can I push all the items down
> one
> place? How can I delete any gaps when items are deleted.
>
>
> CREATE TABLE `board_papers` (
>   `id` int(4) NOT NULL auto_increment,
>   `doc_date` varchar(10) NOT NULL default '-00-00',
>   `article_type` enum('agenda','minutes','paper') NOT NULL default
> 'agenda',
>   `fileName` varchar(50) NOT NULL default '',
>   `fileSize` int(4) NOT NULL default '0',
>   `fileType` varchar(50) NOT NULL default '',
>   `content` blob NOT NULL,
>   `item_id` int(10) default NULL,
>   PRIMARY KEY  (`id`)
> ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=8 ;
>
>
>
>
>
> ""Ross"" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
>>
>> Just say I have a db
>>
>> CREATE TABLE `mytable` (
>>  `id` int(4) NOT NULL auto_increment,
>> `fileName` varchar(50) NOT NULL default '',
>>  PRIMARY KEY  (`id`)
>> ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=7 ;
>>
>>
>> when I add items they go id 1,2,3 etc. Whn I delete them gaps appear. 1,
>> 3, 7. I need to know
>>
>> (a) when items are removed how can I sort the database to all the gaps
>> are
>> take out 1, 3, 7 becomes 1,2,3
>>
>> (b) allow the ids to be changed so the items can change position in the
>> list. If I change id 3 to id 1 then everything else shifts down.
>>
>> If anyone has seen the amazon dvd rental list where you can swap dvd to
>> the top of the list and delete this is what I am trying to achive with
>> php/mysql.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

Really can't imagine why you wanna do something like this. What's the use
in reordering a database. It's just a database. you can sort it in any way
you like.. gaps or not.. Sounds to me the sorting is only done on screen.

This is pretty easy done with PHP not in the database itself.

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



[PHP] Problem with ftp_rmdir

2006-05-02 Thread PJ

Hello everybody,

I'm using function ftp_rmdir to create some aplication and for testing 
I've used following sample from php.net


if (ftp_rmdir($conn_id, $dir)) {
   echo "Successfully deleted $dir\n";
} else {
   echo "There was a problem while deleting $dir\n";
}

Command really removed specified directory, but stopped script as well. 
So there is no more output about "Successfully deleting" of this file 
after line with ftp_rmdir


When I tried this:
$x=ftp_rmdir($conn_id, $dir);
echo "start $x end";

the second line with echo wasn't put to output... It seems like there is 
exit function after ftp_rmdir...


Does anybody knows, what goes wrong??
Thanx

Pavel

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



RE: [PHP] PHP Standard style of writing your code

2006-05-02 Thread Ford, Mike
On 02 May 2006 10:07, Barry wrote:

> Richard Lynch schrieb:
> > On Tue, May 2, 2006 3:02 am, Barry wrote:
> > > Rafael schrieb:
> > > > IMHO, vertical aligned brackets can be messy when nesting
> > > > relatively-small blocks (and seems to me like a lot of
> wasted space)
> > > Huh?!
> > > Show an example. I don't think you will be able to show one.
> > > But this wasted space gives you a lot more insight into the code
> > > when looking for loops,whiles,functions and such.
> > 
> > if (...)
> > {
> >   if (...)
> >   {
> > if (...)
> > {
> >   //blah
> > }
> > //blah
> >   }
> >   //blah
> > }
> > 
> Sorry, where is this here better?
> if (...) {
>if (...) {
>  if (...) {
>// blah
>  }
>//blah
>}
> //blah
> }

Very nice. Lovely, readable, compact code. (Apart form all those horrible curly 
brackets.)

> And then it goes like:
> if (...) {
>if (...) {
>  // mmh
>} else {
>  // oh
>}
>while (...) {
>  if(...) {
>// oh
>  } else {
>if (...) {
>  // where am i?
>  } else {
>// huh!?
>  }
>// hmm
>  }
>if (...) {
>  if (...) {
>// blah
>  }
>// blah
>}
> // blah
> }

Yes - still lovely, readable, compact code.  And dead simple to spot you've 
failed to indent the "else" section after "// where am i?". (Apart from all 
those horrible curly brackets.)

> The same as above in the other style:
> if (...)
> {
>if (...)
>{
>  //mmh
>}
>else
>{
>  //oh
>}
>while (...)
>{
>  if (...)
>  {
>//oh
>  }
>  else
>  {
>if (...)
>{
>  //where am i?
>}
>else
>{
>  //huh!?
>}
>// hmm
>  }
>if (...)
>{
>  if (...)
>  {
>// blah
>  }
>  // blah
>}
>// blah
> }

Uurgh -- curly  brackets -- I see curly brackets -- and, aargh, horrible curly 
brackets -- eeew, and I think some code, maybe -- but definitely curly brackets.

> Your style:
> function findetag() {
>   $wochentag = func_get_arg (0);
>   if (func_num_args() >= 2) {
>   $letztezeit = func_get_arg (1);
>   } else {
>   $letztezeit = time();
>   }
>   $count=0;
>   $taggefunden = false;
>   while (!$taggefunden) {
>   $count++;
>   $tagarray = getdate($letztezeit);
>   if (strtolower($wochentag) ==
> strtolower($tagarray["weekday"])) {
>   $taggefunden = true;
>   } else {
>   // tag drauf
>   $letztezeit = $letztezeit+86400;
>   }
>   //endlosschleife abbrechen
>   if ($count > 20) {
>   $taggefunden = true;
>   $letztezeit = false;
>   }
>   }
>   return $letztezeit;
> }

Yep, nice -- still too many curly brackets, but readable.

> My style:
> function findetag()
>   {
>   $wochentag = func_get_arg (0);
>   if (func_num_args() >= 2)
>   {
>   $letztezeit = func_get_arg (1);
>   }
>   else
>   {
>   $letztezeit = time();
>   }
>   $count=0;
>   $taggefunden = false;
>   while (!$taggefunden)
>   {
>   $count++;
>   $tagarray = getdate($letztezeit);
>   if (strtolower($wochentag) ==
> strtolower($tagarray["weekday"]))
>   {
>   $taggefunden = true;
>   }
>   else
>   {
>   // tag drauf
>   $letztezeit =
> $letztezeit+86400;
>   }
>   //endlosschleife abbrechen
>   if ($count > 20)
>   {
>   $taggefunden = true;
>   $letztezeit = false;
>   }
>   }
>   return $letztezeit;
>   }

Oh my god -- curly brackets and excessive indentation -- and curly brackets.  
Just a mo, where did I put my curly-brackets-and-whitespace-glasses?  Aaaahhh, 
that's better!!

As you might have guessed, I *HATE* curly brackets with a vengeance, which is 
why I eschew both those styles and use PHP's alternative syntax:

  if (...):
 if (...):
   // mmh
 else:
   // oh
 endif;
 while (...):
   if (...):
 // oh
   e

Re: [PHP] Re: php mysql problem

2006-05-02 Thread chris smith

On 5/2/06, Ross <[EMAIL PROTECTED]> wrote:

This is my database now...I will use the item_id for the order but what if I
want to change item_id 3 to item id 1? How can I push all the items down one
place? How can I delete any gaps when items are deleted.


Why do you want to do that? There's no benefit in doing this..
actually it becomes a pain.

You'd need to update not only this table but any field in other tables
that references this one as well (and if you miss one, you have a
completely useless database).

--
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] instantiate derived class objects from within base class?

2006-05-02 Thread Jochem Maas

D. Dante Lorenso wrote:

Jochem Maas wrote:


php will not have late (runtime) static binding until at least version 6.
this sucks, it has sucked since 2003, welcome to the club of people 
who think

it sucks :-)



Oh cool there's a club, lol!?  Why, thanks for having me!  I'm a 
card-carrying member.  Let me just add this to my wish list which now 
includes:


  1. Namespaces


jury is out opn this one - possibly php6, don't hold your breath.


  2. Native Unicode
  3. Late Static Binding


coming to php near you in the foreseeable future.


  4. Threads


when hell freezes over.


  5. Upload Progress Callback


someone is currently taking another look at a possible patch for this - you
may get lucky.



You've given me better vocabulary.  I didn't realize the term was 'late 
(runtime) static binding'.  That sounds so cool.  I'm gonna try to work 
that into my everyday conversations ;-).


dunno how correct the term is but that's what's been bandied about on the
internals mailing list - I figure those froods know better than I do ;-)



Damnit, I need PHP 8 already, lol ;-)


help write it maybe :-P



Dante



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



[PHP] Re: php mysql problem

2006-05-02 Thread Ross
This is my database now...I will use the item_id for the order but what if I 
want to change item_id 3 to item id 1? How can I push all the items down one 
place? How can I delete any gaps when items are deleted.


CREATE TABLE `board_papers` (
  `id` int(4) NOT NULL auto_increment,
  `doc_date` varchar(10) NOT NULL default '-00-00',
  `article_type` enum('agenda','minutes','paper') NOT NULL default 'agenda',
  `fileName` varchar(50) NOT NULL default '',
  `fileSize` int(4) NOT NULL default '0',
  `fileType` varchar(50) NOT NULL default '',
  `content` blob NOT NULL,
  `item_id` int(10) default NULL,
  PRIMARY KEY  (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=8 ;





""Ross"" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
>
> Just say I have a db
>
> CREATE TABLE `mytable` (
>  `id` int(4) NOT NULL auto_increment,
> `fileName` varchar(50) NOT NULL default '',
>  PRIMARY KEY  (`id`)
> ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=7 ;
>
>
> when I add items they go id 1,2,3 etc. Whn I delete them gaps appear. 1, 
> 3, 7. I need to know
>
> (a) when items are removed how can I sort the database to all the gaps are 
> take out 1, 3, 7 becomes 1,2,3
>
> (b) allow the ids to be changed so the items can change position in the 
> list. If I change id 3 to id 1 then everything else shifts down.
>
> If anyone has seen the amazon dvd rental list where you can swap dvd to 
> the top of the list and delete this is what I am trying to achive with 
> php/mysql. 

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



Re: [PHP] Tiny mass mail (Kinda 0T)

2006-05-02 Thread chris smith

On 5/2/06, Ryan A <[EMAIL PROTECTED]> wrote:

Hey,

One of the sites I moderate has fudforum installed on
it, really good forum if you have not heard of it,
tiny and fast.

The problem is the host is limiting the amount of
emails that can go from the site per minute, and we
need to email all the members (a modest 700 or so) a
newsletter/update...any suggestions on how to do that?

I mean i can write a query to get all the email
addresses then write a script to mail() them from a
different server (or my localhost/local machine) but I
was wondering if any of you could recommend a mailing
program to do this or should i just go ahead and write
the script to read the addresses and run a for() loop
to send them the newsletter? Reason I ask is because I
read some time back that using php's mail() for
sending bulk email is not really recommended, not sure
if 700 is really "bulk" but for the site owner it
is...and she is really excited  for her first
newsletter :-)


There are probably some on sourceforge.net or freshmeat.net.. but I've
heard reasonable things about phplist: http://tincan.co.uk/?lid=453

Not sure whether it supports throttling or not...

Pretty much any package you find, you'll have to export the
subscribers then import them into the other program before sending..
bit of a pain but *shrug*.

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

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



[PHP] Tiny mass mail (Kinda 0T)

2006-05-02 Thread Ryan A
Hey,

One of the sites I moderate has fudforum installed on
it, really good forum if you have not heard of it,
tiny and fast.

The problem is the host is limiting the amount of
emails that can go from the site per minute, and we
need to email all the members (a modest 700 or so) a
newsletter/update...any suggestions on how to do that?

I mean i can write a query to get all the email
addresses then write a script to mail() them from a
different server (or my localhost/local machine) but I
was wondering if any of you could recommend a mailing
program to do this or should i just go ahead and write
the script to read the addresses and run a for() loop
to send them the newsletter? Reason I ask is because I
read some time back that using php's mail() for
sending bulk email is not really recommended, not sure
if 700 is really "bulk" but for the site owner it
is...and she is really excited  for her first
newsletter :-)

Thanks!
Ryan

--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)
-
Fight back spam! Download the Blue Frog.
http://www.bluesecurity.com/register/s?user=bXVzaWNndTc%3D

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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



Re: [PHP] Re: Totally 0T - Spam

2006-05-02 Thread Ryan A


> > Hey all,
> > 
> > I get a crapload of spam and I am pretty sure most
> of
> > you too as we work so much online, for the past
> few
> > months I joined a site called bluesecurity.com and
> > installed their "blue frog" client and now my spam
> has
> > dropped by over 70% 
> 
> Lol sorry these first few lines just sounded like
> one :D
> 
> > I suggest you check it out and join yourself (its
> > free!) as the bigger the community grows the
> harder we
> > can fight back to get our mailboxes with only the
> mail
> > we wantand not with mail we didnt ask for,
> dont
> > want, didnt request etc.
> 
> My Mail will be sad because it wins 15 million bucks
> a week.
> (Your email just won 15 million bucks!)
> Too bad it's not me winning that money.
> Probably my mail itself started to register
> everywhere because it wanted 
>   to win more money lol ;P
> 
> > I cant speak more highly of its service and will
> try
> > to answer any questions you may have about my
> > experience with it (offlist so as not to irritate
> > other list members)
> > 
> > Please note:
> > I dont get ANYTHING by you joining that site,
> except
> > probably less spam in my mailbox, no money, no
> > credit...nothing.
> 
> *wipes a tear off* my brave soldier :)
> 
>   __
> > Do You Yahoo!?
> No, not really...






Ummm  what was the above about?
Either I lost my sense of humour or its because I just
got up but dont really find the above humourous, or is
it supposed to be sarcastic?

-Ryan

--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)
-
Fight back spam! Download the Blue Frog.
http://www.bluesecurity.com/register/s?user=bXVzaWNndTc%3D

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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



Fw: [PHP] php mysql problem

2006-05-02 Thread Satyam


- Original Message - 
From: "Ross" <[EMAIL PROTECTED]>

To: 
Sent: Tuesday, May 02, 2006 12:00 PM
Subject: [PHP] php mysql problem




Just say I have a db

CREATE TABLE `mytable` (
 `id` int(4) NOT NULL auto_increment,
`fileName` varchar(50) NOT NULL default '',
 PRIMARY KEY  (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=7 ;


when I add items they go id 1,2,3 etc. Whn I delete them gaps appear. 1, 
3, 7. I need to know


(a) when items are removed how can I sort the database to all the gaps are 
take out 1, 3, 7 becomes 1,2,3


(b) allow the ids to be changed so the items can change position in the 
list. If I change id 3 to id 1 then everything else shifts down.


If anyone has seen the amazon dvd rental list where you can swap dvd to 
the top of the list and delete this is what I am trying to achive with 
php/mysql.


You are mixing up concepts here.  An ID is that, an identifier, and it goes 
with the record from its creation to its deletion.  That's what an ID is for 
(which in most Anglo legal systems is something people is not used to, an 
anthropological curiosity if you wish).  What you are looking for is an 
Order field (which, of course, you can name as you wish, since order is a 
reserved SQL word, I just give the concept of it), which is also numerical 
and that, if you put in your select  like Select * from mytalbe order by 
`order`, id will be used to order records and, if missing, will default to 
id.


Satyam

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



[PHP] Re: php mysql problem

2006-05-02 Thread Barry

Ross schrieb:

Just say I have a db

CREATE TABLE `mytable` (
  `id` int(4) NOT NULL auto_increment,
`fileName` varchar(50) NOT NULL default '',
  PRIMARY KEY  (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=7 ;


when I add items they go id 1,2,3 etc. Whn I delete them gaps appear. 1, 3, 
7. I need to know


(a) when items are removed how can I sort the database to all the gaps are 
take out 1, 3, 7 becomes 1,2,3


Why do you auto_increment them then?

Normally it's very wrong to set back autoincremented values because you 
don't have any reference anymore.


So if ID X is causing an error it could be Article X or Article Y or 
article Z. You don't know because the database is shifting it around.
Add a second field called "sort" or something similiar and let it sort 
on that.

Or give it Article Numbers or whatever.


(b) allow the ids to be changed so the items can change position in the 
list. If I change id 3 to id 1 then everything else shifts down.

update id = id +1 WHERE id > X

Barry

--
Smileys rule (cX.x)C --o(^_^o)
Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o)

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



[PHP] php mysql problem

2006-05-02 Thread Ross

Just say I have a db

CREATE TABLE `mytable` (
  `id` int(4) NOT NULL auto_increment,
`fileName` varchar(50) NOT NULL default '',
  PRIMARY KEY  (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=7 ;


when I add items they go id 1,2,3 etc. Whn I delete them gaps appear. 1, 3, 
7. I need to know

(a) when items are removed how can I sort the database to all the gaps are 
take out 1, 3, 7 becomes 1,2,3

(b) allow the ids to be changed so the items can change position in the 
list. If I change id 3 to id 1 then everything else shifts down.

If anyone has seen the amazon dvd rental list where you can swap dvd to the 
top of the list and delete this is what I am trying to achive with 
php/mysql. 

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



Re: [PHP] Slow mail()

2006-05-02 Thread chris smith

On 5/2/06, Tony Aldrich <[EMAIL PROTECTED]> wrote:

Hello!
What are the reasons of slow mail() (about 30-40 seconds)?


Yeh.. expanding on what the others said, you'll have to get your
host/isp/sysadmin to help you with this one..

on a linux box, it should be pretty instant (uses a "socket" type
connection), check logs and anything like spamassassin or other
filters that are being run.

on a windows box, could be anything from dns, network, firewalls...

--
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] PHP Standard style of writing your code

2006-05-02 Thread Barry

Richard Lynch schrieb:

On Tue, May 2, 2006 3:02 am, Barry wrote:

Rafael schrieb:

IMHO, vertical aligned brackets can be messy when nesting
relatively-small blocks (and seems to me like a lot of wasted space)

Huh?!
Show an example. I don't think you will be able to show one.
But this wasted space gives you a lot more insight into the code when
looking for loops,whiles,functions and such.


if (...)
{
  if (...)
  {
if (...)
{
  //blah
}
//blah
  }
  //blah
}


Sorry, where is this here better?
if (...) {
  if (...) {
if (...) {
  // blah
}
  //blah
  }
//blah
}

And then it goes like:
if (...) {
  if (...) {
// mmh
  } else {
// oh
  }
  while (...) {
if(...) {
  // oh
} else {
  if (...) {
// where am i?
} else {
  // huh!?
}
  // hmm
}
  if (...) {
if (...) {
  // blah
}
  // blah
  }
// blah
}
The same as above in the other style:
if (...)
{
  if (...)
  {
//mmh
  }
  else
  {
//oh
  }
  while (...)
  {
if (...)
{
  //oh
}
else
{
  if (...)
  {
//where am i?
  }
  else
  {
//huh!?
  }
  // hmm
}
  if (...)
  {
if (...)
{
  // blah
}
// blah
  }
  // blah
}

I know you could use elseif, but it's okay like this for presentation.

I bet you would have problems coding so much nested IFs or such, i did 
had them writing that first style above.



Bt.

Without indentation, it's just garbage.


I've seen ppl coding like that.
And using that inline bracket method just makes it so hard to read.



If you indent, you see it as you scroll through without actually
"reading" it no matter where you put the braces.


I give an example.
Probably you see for yourself what of those would be rad better and 
"faster" (^_^)


Your style:
function findetag() {
$wochentag = func_get_arg (0);
if (func_num_args() >= 2) {
$letztezeit = func_get_arg (1);
} else {
$letztezeit = time();
}
$count=0;
$taggefunden = false;
while (!$taggefunden) {
$count++;
$tagarray = getdate($letztezeit);
if (strtolower($wochentag) == strtolower($tagarray["weekday"])) 
{
$taggefunden = true;
} else {
// tag drauf
$letztezeit = $letztezeit+86400;
}
//endlosschleife abbrechen
if ($count > 20) {
$taggefunden = true;
$letztezeit = false;
}
}
return $letztezeit;
}

My style:
function findetag()
{
$wochentag = func_get_arg (0);
if (func_num_args() >= 2)
{
$letztezeit = func_get_arg (1);
}
else
{
$letztezeit = time();
}
$count=0;
$taggefunden = false;
while (!$taggefunden)
{
$count++;
$tagarray = getdate($letztezeit);
if (strtolower($wochentag) == 
strtolower($tagarray["weekday"]))
{
$taggefunden = true;
}
else
{
// tag drauf
$letztezeit = $letztezeit+86400;
}
//endlosschleife abbrechen
if ($count > 20)
{
$taggefunden = true;
$letztezeit = false;
}
}
return $letztezeit;
}

On "first" view i can clearly see what is happening without going 
"through" the code.




I frequently code on smaller monitors -- laptop, ancient desktop,
stripped-down flat-panel monitor that fits inside a rack-mount 2-RU
shelf in my sound booth...
Yes, and some people actually code on PALM handhelds and i have seeing 
ppl coding on mobile phones.
There won't fit your 80 chars per line style. Are you going to strip it 
down to 13 per line now because of that?


Yes you can actually code it that it fits in any small space so that you 
might even see it on a digital watch.


But that fact shouldn't be affecting coding style at all.


I can't really lug a 19" monitor all over, and there's no room in my
sound booth for it, what with the amps, sound boa

Re: [PHP] Slow mail()

2006-05-02 Thread Richard Lynch
On Tue, May 2, 2006 3:24 am, Tony Aldrich wrote:
> What are the reasons of slow mail() (about 30-40 seconds)?

Well, first it has to fire up sendmail...

Then sendmail has to accept the email for delivery.

But that should not be 30 seconds...

30 seconds sounds like a network domain-name lookup timeout issue.

Perhaps your sendmail.cnf is not quite right...

What happens if you login as the PHP user and send email from the
command line?

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] instantiate derived class objects from within base class?

2006-05-02 Thread D. Dante Lorenso

Jochem Maas wrote:

php will not have late (runtime) static binding until at least version 6.
this sucks, it has sucked since 2003, welcome to the club of people 
who think

it sucks :-)


Oh cool there's a club, lol!?  Why, thanks for having me!  I'm a 
card-carrying member.  Let me just add this to my wish list which now 
includes:


  1. Namespaces
  2. Native Unicode
  3. Late Static Binding
  4. Threads
  5. Upload Progress Callback

You've given me better vocabulary.  I didn't realize the term was 'late 
(runtime) static binding'.  That sounds so cool.  I'm gonna try to work 
that into my everyday conversations ;-).


Damnit, I need PHP 8 already, lol ;-)

Dante

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



Re: [PHP] display_errors off and custom error pages

2006-05-02 Thread Richard Lynch
On Tue, May 2, 2006 1:59 am, IG wrote:
>> You do not need, nor even want probably, ob_start() just to be able
>> to
>> use a custom error handler.
>>
>
> I thought I needed ob_start(), why don't I? If part of a page is
> outputted then it would be impossible to output an error page as html
> has already been sent out.

Here's the thing.

You want your error message to not reveal your internal workings of
your web application to the Bad Guys.

You want your web site to look "pretty".

No matter how good you are, nor how perfect a coder you are, there is
always room for SOME way for an error to manage to not happen until
after some HTML has gone "out"

So would it not make more sense to set up your error messages, and
your custom error handler, so that the basic paradigm is to:

  log the "real" error message with internal details for debugging
  print a "nice" error message for the user
  FINISH off any open tags, for a pretty error page
  end the script
> The other question is do custom error handlers
> work
> for parse errors?

No.

You should run every script through php -l before it ever gets near a
production server.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] PHP Standard style of writing your code

2006-05-02 Thread Richard Lynch
On Tue, May 2, 2006 3:02 am, Barry wrote:
> Rafael schrieb:
>> IMHO, vertical aligned brackets can be messy when nesting
>> relatively-small blocks (and seems to me like a lot of wasted space)
> Huh?!
> Show an example. I don't think you will be able to show one.
> But this wasted space gives you a lot more insight into the code when
> looking for loops,whiles,functions and such.

if (...)
{
  if (...)
  {
if (...)
{
  //blah
}
//blah
  }
  //blah
}

>> A couple of facts of my codding style:
>> - I tend to always use brakets, so I ignore the fact that single
>>   lines/actions can be written without brackets,
> This is "your" coding style.
> But if you work in a team, and somone does use that because it
> actually
> is a neater way of programming.
> What do you intend to do?

Grin and bear it.

>> - I use a 4 space indentation, and that alone suffices for making
>>   a block stand clear enough
> It's not just about one block.
> I've seen stuff like:
> if (blah blah) {
> do my code!
> } else {
> oh my god!
> }
>
> Well, without indentation it just looks like a bunch of chars.

YES!!!

Without indentation you are SCREWED.

Nobody is arguing against that!

> if (blah blah)
> {
> do my code!
> }
> else
> {
> oh my god!
> }
>
> Even without intendations, you can clearly see that it's an if and an
> else here.

Bt.

Without indentation, it's just garbage.

> The best part here is that you see it when you scroll through your
> code.
> without actually "reading" it.

If you indent, you see it as you scroll through without actually
"reading" it no matter where you put the braces.

>> So, in my case, the code would be something like
>>   function foo( $x ) {
>>   // body...
>>   }
>>   ···
>>   $a = foo($b);
> Even this is far too blocky to read.
> If you have 4000 rows of code and looking for some if or switch (you
> are
> not sure) it would save you a lot of time searching for it though.
>
> And for your problem with viewing. probably try to get a 19" monitor.
> They are not that expencive anymore.(The CRT ones)
> Even on 1024x768 you see LOTSA code.

I frequently code on smaller monitors -- laptop, ancient desktop,
stripped-down flat-panel monitor that fits inside a rack-mount 2-RU
shelf in my sound booth...

I can't really lug a 19" monitor all over, and there's no room in my
sound booth for it, what with the amps, sound boards, computer, CD
duplicator, etc.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Slow mail()

2006-05-02 Thread Chris



What are the reasons of slow mail() (about 30-40 seconds)?


If it takes mail() that long to send the email, it's taking your mail 
server that long to accept the email.


Check your mail server logs.

--
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] Slow mail()

2006-05-02 Thread nicolas figaro

Tony Aldrich a écrit :

Hello!
What are the reasons of slow mail() (about 30-40 seconds)?


Hi,

many reasons, but nothing related to php IMHO.
mail relay load, slow reverse dns interrogations for spam, etc.

If your mail runs only on a local or corporate network, ask the mail admin,
otherwise, you have to contact the receiver and ask him the question.

N F

Thanks,
Tony.


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



[PHP] Re: Syntax Oddity

2006-05-02 Thread Barry

Richard Lynch schrieb:

Does anybody have a rational explanation for what purpose in life the
following syntax is considered acceptable?




Well from PHPs point of view this is not a syntax error.


Note that the line with just $query; on it doesn't, like, "do" anything.

I suppose in a Zen-like sort of way, it "exists" and all, but, really,
what's the point?


There is none :)


Is there some subtle reason for this not being some kind of syntax
error that's way over my head or something?


Why should it be a syntax error?
You can do the same stuff in nearly every programming language besides PHP.
It's just useless.
The languages doesn't decide between usless and not useless.
Just between syntax okay and not okay.



This is not just philosophical minutiae -- Real-world beginners, with
no programming experience, actually type the above (albeit with a lot
more logic and whatnot in between) and then wonder why the query
didn't execute.

It even makes a wild sort of sense to type that, if you presume that a
beginner might not grasp the distinctions between PHP and MySQL and
the relationship yet.

Does anybody actually USE this idiom in any meaningful way?


Well i don't ;P

--
Smileys rule (cX.x)C --o(^_^o)
Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o)

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



[PHP] Slow mail()

2006-05-02 Thread Tony Aldrich

Hello!
What are the reasons of slow mail() (about 30-40 seconds)?

Thanks,
Tony.


[PHP] Syntax Oddity

2006-05-02 Thread Richard Lynch
Does anybody have a rational explanation for what purpose in life the
following syntax is considered acceptable?



Note that the line with just $query; on it doesn't, like, "do" anything.

I suppose in a Zen-like sort of way, it "exists" and all, but, really,
what's the point?

Is there some subtle reason for this not being some kind of syntax
error that's way over my head or something?

This is not just philosophical minutiae -- Real-world beginners, with
no programming experience, actually type the above (albeit with a lot
more logic and whatnot in between) and then wonder why the query
didn't execute.

It even makes a wild sort of sense to type that, if you presume that a
beginner might not grasp the distinctions between PHP and MySQL and
the relationship yet.

Does anybody actually USE this idiom in any meaningful way?


-- 
Like Music?
http://l-i-e.com/artists.htm

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



[PHP] Re: Totally 0T - Spam

2006-05-02 Thread Barry

Ryan A schrieb:

Hey all,

I get a crapload of spam and I am pretty sure most of
you too as we work so much online, for the past few
months I joined a site called bluesecurity.com and
installed their "blue frog" client and now my spam has
dropped by over 70% 


Lol sorry these first few lines just sounded like one :D


I suggest you check it out and join yourself (its
free!) as the bigger the community grows the harder we
can fight back to get our mailboxes with only the mail
we wantand not with mail we didnt ask for, dont
want, didnt request etc.


My Mail will be sad because it wins 15 million bucks a week.
(Your email just won 15 million bucks!)
Too bad it's not me winning that money.
Probably my mail itself started to register everywhere because it wanted 
 to win more money lol ;P



I cant speak more highly of its service and will try
to answer any questions you may have about my
experience with it (offlist so as not to irritate
other list members)

Please note:
I dont get ANYTHING by you joining that site, except
probably less spam in my mailbox, no money, no
credit...nothing.


*wipes a tear off* my brave soldier :)

 __

Do You Yahoo!?

No, not really...

--
Smileys rule (cX.x)C --o(^_^o)
Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o)

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



Re: [PHP] display_errors off and custom error pages

2006-05-02 Thread Jochem Maas

IG wrote:

Thanks, Chris.



..



Do I have to have display_errors set to 1 if I want to display a custom 
error page? I'd rather have display errors set to 0 but have a custom 
error page displayed when an error is triggered. Is this possible? 


yes. display_errors merely determines whether php spits out errors
direct to std. out or not (i.e. the browser in this case)

your error handler can do whatever it likes including [conditionally]
outputing a user friendly page.


Perhaps I have misunderstood how errors work in php.




--
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] PHP Standard style of writing your code

2006-05-02 Thread Barry

Rafael schrieb:

IMHO, vertical aligned brackets can be messy when nesting
relatively-small blocks (and seems to me like a lot of wasted space)

Huh?!
Show an example. I don't think you will be able to show one.
But this wasted space gives you a lot more insight into the code when 
looking for loops,whiles,functions and such.



A couple of facts of my codding style:
- I tend to always use brakets, so I ignore the fact that single
  lines/actions can be written without brackets,

This is "your" coding style.
But if you work in a team, and somone does use that because it actually 
is a neater way of programming.

What do you intend to do?

- I try not to let lines grow larger than about 100 cols (cannot
  be really done with strings and other thingies, and maybe that
  should remain in the old 80 cols, but it's too litle space), and

Never possible if you write web-applications.
CLI might be possible for that but for web it's a no-go.


- I use a 4 space indentation, and that alone suffices for making
  a block stand clear enough

It's not just about one block.
I've seen stuff like:
if (blah blah) {
do my code!
} else {
oh my god!
}

Well, without indentation it just looks like a bunch of chars.

if (blah blah)
{
do my code!
}
else
{
oh my god!
}

Even without intendations, you can clearly see that it's an if and an 
else here.

The best part here is that you see it when you scroll through your code.
without actually "reading" it.


So, in my case, the code would be something like
  function foo( $x ) {
  // body...
  }
  ···
  $a = foo($b);

Even this is far too blocky to read.
If you have 4000 rows of code and looking for some if or switch (you are 
not sure) it would save you a lot of time searching for it though.


And for your problem with viewing. probably try to get a 19" monitor.
They are not that expencive anymore.(The CRT ones)
Even on 1024x768 you see LOTSA code.

--
Smileys rule (cX.x)C --o(^_^o)
Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o)

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



Re: [PHP] instantiate derived class objects from within base class?

2006-05-02 Thread Jochem Maas

php will not have late (runtime) static binding until at least version 6.
this sucks, it has sucked since 2003, welcome to the club of people who think
it sucks :-)

how to hack around this issue:

abstract class A {
protected abstract function foo();
public static function bar($c = null) {
$x = new $c();
if ($x instanceof self) {
$x->foo();
}
}
}

class B extends A {
public static function bar($c = null) {
return parent::bar(__CLASS__);
}
protected function foo() {
echo "hello world";
}
}

...and any number of variations of that hack - all of which are horrid.

D. Dante Lorenso wrote:

Chris wrote:


This gives the problem away..
http://www.php.net/manual/en/language.oop5.abstract.php
Any class that contains at least one abstract method must also be 
abstract.

Make 'A' abstract:
abstract class A

Sorry for the poor example.  I did catch that after submitting my post, 
but it didn't really matter.  Adding abstract to the class doesn't solve 
the problem.  Here I do as you say and still get the error:


-- 8<  8<  8< --
foo();
   }
}
// defines foo() as it should, but base class doesn't know foo exists
// when it references self()
class B extends A {
   protected function foo() {
   echo "hello world";
   }
}

// show how broken things are
B :: bar();
?>
-- 8<  8<  8< --

Output:
A
*Fatal error*: Cannot instantiate abstract class A in *.../demo.php* on 
line *11


The problem is that when method bar() is invoked on class B statically, 
class B is complete ignored.  Since bar() is only defined inside class 
A, the B :: bar() call seems to be translated into a call of A::bar() 
and class B is no longer addressable.


My expectation is that when I call an object, the search for a method or 
property should start at the bottom-most derived object and work it's 
way up the dependency tree.  This doesn't happen, though.  It appears 
that any class can only reference base class and inherited methods and 
never derived methods.  Perhaps this is only symptomatic when referenced 
statically?


Dante
*



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



Re: [PHP] display_errors off and custom error pages

2006-05-02 Thread IG

Thanks, Jochem.

Jochem Maas wrote:



IG wrote:

I've spent the last couple of hours trying to work this out to no avail.

I have recently moved over to a managed dedi server and no can ask my 
host to change my php.ini.


I have found out that the 'display_errors' in the php.ini is set to 
off and error file logging is off.


I would like to be able log to file which is easy to do from the ini 
file but also to show a custom error page if there is an error on one 
of the pages.


I thought I would be able to use a custom error handler such as -

ob_start();
// custom error handler
function e($type, $msg, $file, $line) {
blah blah
ob_end_clean();


while (@ob_end_clean());

// and

header('Status: 500 Internal Server Error');

are things you should look at.


Good idea...




also the check the ini setting auto_prepend_file, which can be
set in your apache config so that all vhosts share a common
include file which defines and sets the errorhandler.



Wow- didn't know about auto_prepend_file. That is a great setting- 
thanks for letting me know about it.




also apache has the ability to set a custom handler for 'real'
500 errors. the apache directive is something like:

ErrorDocument 500 /path/to/my/500.php

where the path is a url (or a local path - I think)



   // display error page
exit();
}

set_error_handler("e");



But all I get is a blank page. Does having display_errors off mean 
that I can't use a custom error handler? I have also tried adding 
*set_ini*('*display_errors*','1') but this keeps giving me a blank page.


Can someone tell me the best (and most secure way) of having custom 
error pages in php. Ideally I would like it all set from a central 
place so that i only need to change one file for all the websites on 
our server. I didn't really want to change display_errors to on as I 
was told this wasn't very secure- i don't want error messages on any 
of my pages, I just want a simple error 500 server error page.


Many thanks,

Ian






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



Re: [PHP] display_errors off and custom error pages

2006-05-02 Thread IG

Thanks, Chris.

chris smith wrote:

On 4/29/06, IG <[EMAIL PROTECTED]> wrote:

I've spent the last couple of hours trying to work this out to no avail.

I have recently moved over to a managed dedi server and no can ask my
host to change my php.ini.

I have found out that the 'display_errors' in the php.ini is set to off
and error file logging is off.

I would like to be able log to file which is easy to do from the ini
file but also to show a custom error page if there is an error on one of
the pages.

I thought I would be able to use a custom error handler such as -

ob_start();
// custom error handler
function e($type, $msg, $file, $line) {
blah blah
ob_end_clean();

// display error page
exit();
}

set_error_handler("e");



But all I get is a blank page. Does having display_errors off mean that
I can't use a custom error handler? I have also tried adding
*set_ini*('*display_errors*','1') but this keeps giving me a blank page.




The *s got into the email for some weird reason- they aren't in the 
original code. I would like an error page to be displayed for all errors 
including parse ones. Blank pages aren't that helpful for the user.



Sounds like a parse error (using the code above will give you that).

Try it in a htaccess file:

php_flag display_errors 1

(I think).

You can't use ini_set because a parse error breaks the whole script
and it's not executed, so you need to change this value before the
script.


Do I have to have display_errors set to 1 if I want to display a custom 
error page? I'd rather have display errors set to 0 but have a custom 
error page displayed when an error is triggered. Is this possible? 
Perhaps I have misunderstood how errors work in php.





--
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] display_errors off and custom error pages

2006-05-02 Thread Chris



I've spent the last couple of hours trying to work this out to no avail.

I have recently moved over to a managed dedi server and no can ask my
host to change my php.ini.

I have found out that the 'display_errors' in the php.ini is set to off
and error file logging is off.

I would like to be able log to file which is easy to do from the ini
file but also to show a custom error page if there is an error on one of
the pages.

I thought I would be able to use a custom error handler such as -

ob_start();
// custom error handler
function e($type, $msg, $file, $line) {
blah blah
ob_end_clean();

// display error page
exit();
}

set_error_handler("e");



But all I get is a blank page. Does having display_errors off mean that
I can't use a custom error handler? I have also tried adding
*set_ini*('*display_errors*','1') but this keeps giving me a blank page.





The *s got into the email for some weird reason- they aren't in the 
original code. I would like an error page to be displayed for all errors 
including parse ones. Blank pages aren't that helpful for the user.



Sounds like a parse error (using the code above will give you that).

Try it in a htaccess file:

php_flag display_errors 1

(I think).

You can't use ini_set because a parse error breaks the whole script
and it's not executed, so you need to change this value before the
script.



Do I have to have display_errors set to 1 if I want to display a custom 
error page? I'd rather have display errors set to 0 but have a custom 
error page displayed when an error is triggered. Is this possible? 
Perhaps I have misunderstood how errors work in php.


You need to set this flag in a htaccess file because that gets processed 
before a php script does.


If you are getting a parse error on this script, setting this flag in 
the script won't do anything - the script won't execute at all.


By setting this particular option in a htaccess file, that gets 
processed before the php file does, so if you have a parse error, it 
will say "parse error in file X on line Y" or something to that affect - 
so you can move forward. You can test this manually yourself:


php -l /path/to/file.php

so you could download it to your test server, run that - see what's 
going on.


You could also be triggering a php or apache segfault (in which case 
none of this matters) - are you able to check apache error logs to see 
what's going on from that side of things?



If you take out your custom error handler, do you still get a blank 
page? That will tell us something at least..


--
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] display_errors off and custom error pages

2006-05-02 Thread IG

Richard Lynch wrote:

On Fri, April 28, 2006 11:55 am, IG wrote:

I have recently moved over to a managed dedi server and no can ask my
host to change my php.ini.

I have found out that the 'display_errors' in the php.ini is set to
off
and error file logging is off.


Do they have .htaccess turned on?



I've checked and it isn't I have asked my host to do this now. However 
I'd ideally like everything sorted from the Apache config file.





Because you can set all this stuff in an .htaccess file...


I would like to be able log to file which is easy to do from the ini
file but also to show a custom error page if there is an error on one
of
the pages.

I thought I would be able to use a custom error handler such as -

ob_start();


You do not need, nor even want probably, ob_start() just to be able to
use a custom error handler.



I thought I needed ob_start(), why don't I? If part of a page is 
outputted then it would be impossible to output an error page as html 
has already been sent out.




It doesn't HURT, mind you, but it's not needed at all.


// custom error handler
function e($type, $msg, $file, $line) {
blah blah
ob_end_clean();

// display error page
exit();
}

set_error_handler("e");

But all I get is a blank page.


Well, unless your "blah blah" section outputs something, all you COULD
get is a blank page.



Yes- blah, blah was just a nicely formatted and helpful error page that 
won't scare off customers.




Does having display_errors off mean
that
I can't use a custom error handler?


No, not at all.



At the moment I have display_errors off and the above script does not 
work for some reason. I have tried to put errors into scripts but all I 
get is a blank page. The other question is do custom error handlers work 
for parse errors? Again I would ideally like a custom error page to be 
displayed for all errors including parse errors just in case I make a 
mistake- I'm always forgetting those ';'s!




I have also tried adding
*set_ini*('*display_errors*','1') but this keeps giving me a blank
page.


I don't know where the *s got in in this email- I didn't type them! 
Anyway it is still giving me a blank page





What are all those * characters in there?  Get rid of them.


Can someone tell me the best (and most secure way) of having custom
error pages in php. Ideally I would like it all set from a central
place
so that i only need to change one file for all the websites on our
server.


.htaccess, if it is on, will do this, and not require you to remember
to 'include' the error_handler on every script.


I didn't really want to change display_errors to on as I was
told this wasn't very secure-


That is correct.

It is too likely to expose too much information to Bad Guys.


i don't want error messages on any of my
pages, I just want a simple error 500 server error page.




I thought I might be able to do this by setting an error 500 header with 
 php using the header() command.




Whoa.

Okay, now we are in a different kettle of fish...

I dunno that you CAN force a "500 server error" from within PHP...

I guess there ought to be a function for that somewhere, but I've
never noticed it...

It would probably be documented or linked from or discussed in the
User Contributed notes at http://php.net/header though, if it does
exist.

Would you settle for a nice HTML output like:

An error has occurred. Please try again later.

Because that's pretty much a no-brainer with the error handler -- But
you have to actually output that.

I think your basic problem right now is the assumption that PHP exit()
with no content output would somehow constitute a 500 server error.

It doesn't.
[shrug]

There's nothing inherently "wrong" with the webserver returning a
totally blank document, really.  Well, okay, by strict definitions of
HTML w3c standards, it's not valid HTML.



Good point- web standards are the way forward!



But it's also not a 500 error either.

As far as Apache is concerned, the document is "fine" and returns a
200.  It just happens to be an empty/blank document is all.



Blank pages aren't that helpful to a user though.

Many thanks for your help.

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