|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
php-general Digest 22 Nov 2006 05:21:50 -0000 Issue 4473
php-general-digest-help
lists.php.net
Date: Tue Nov 21 2006 - 23:21:50 CST
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
php-general Digest 22 Nov 2006 05:21:50 -0000 Issue 4473
Topics (messages 244967 through 245014):
Re: confirm unsubscribe from php-general
lists.php.net
244967 by: Google Kreme
Re: Programmer needed
244968 by: LuKreme
Re: Smart Quotes not so smart
244969 by: Richard Lynch
Re: Help with typecasting by default in the function parameter list
244970 by: Richard Lynch
245003 by: Richard Lynch
Re: multiple upload files?
244971 by: Richard Lynch
245014 by: Kevin Waterson
Re: Space in regex
244972 by: LuKreme
Re: XML parser error ..
244973 by: Richard Lynch
245013 by: onewaylife
Re: mime type
244974 by: Richard Lynch
245005 by: Chris
Re: confirm subscribe to php-general
lists.php.net
244975 by: LuKreme
Re: Useful function for file download (i.e. MP3)
244976 by: Richard Lynch
244983 by: Brad Fuller
244986 by: Richard Lynch
244993 by: Brad Fuller
244998 by: Richard Lynch
3d modeling-php
244977 by: blackwater dev
244980 by: Miles Thompson
244985 by: Rahul S. Johari
244988 by: Richard Lynch
244990 by: Rahul S. Johari
244992 by: LuKreme
244997 by: tedd
244999 by: Richard Lynch
245004 by: J R
245008 by: Miles Thompson
Re: CSS / PHP / Javascript
244978 by: Richard Lynch
Re: How to work with virtual (seo) URLs?
244979 by: testkonto
244987 by: Richard Lynch
Re: Regular expressions
244981 by: Richard Lynch
244995 by: Paul Novitski
245000 by: Jesse Castro
Re: __get() accessor question (a bug maybe?)
244982 by: Richard Lynch
Re: php cli and mysql
244984 by: Richard Lynch
Re: Coding Standards Document
244989 by: Richard Lynch
244994 by: tedd
245007 by: Robert Cummings
Re: Max File Upload Size
244991 by: Richard Lynch
Re: activation through email
244996 by: Richard Lynch
Powered by?
245001 by: pub
245002 by: Børge Holen
245006 by: Robert Cummings
problem using imagejpeg function all
245009 by: Tom
245010 by: Robert Cummings
245011 by: Tom
245012 by: Robert Cummings
Administrivia:
To subscribe to the digest, e-mail:
php-general-digest-subscribe
lists.php.net
To unsubscribe from the digest, e-mail:
php-general-digest-unsubscribe
lists.php.net
To post to the list, e-mail:
php-general
lists.php.net
----------------------------------------------------------------------
attached mail follows:
On 20-Nov-2006, at 21:21, php-general-help
lists.php.net wrote:
> Hi! This is the ezmlm program. I'm managing the
> php-general
lists.php.net mailing list.
>
> I'm working for my owner, who can be reached
> at php-general-owner
lists.php.net.
>
> To confirm that you would like
>
> gkreme
gmail.com
>
> removed from the php-general mailing list, please send an empty reply
> to this address:
>
> php-general-uc.1164082878.emeeacgbjehpnkjipkfp-
> gkreme=gmail.com
lists.php.net
>
> Usually, this happens when you just hit the "reply" button.
> If this does not work, simply copy the address and paste it into
> the "To:" field of a new message.
>
> or click here:
> mailto:php-general-uc.1164082878.emeeacgbjehpnkjipkfp-
> gkreme=gmail.com
lists.php.net
>
> PLEASE NOTE: I haven't checked whether your address is currently
> on the mailing list. To see what address you used to subscribe,
> look at the messages you are receiving from the mailing list. Each
> message has your address hidden inside its return path; for
> example, mary
xdd.ff.com receives messages with return path:
> <php-general-return-<number>-mary=xdd.ff.com
lists.php.net.
>
> Some mail programs are broken and cannot handle long addresses. If you
> cannot reply to this request, instead send a message to
> <php-general-request
lists.php.net> and put the entire address
> listed above
> into the "Subject:" line.
>
>
> --- Administrative commands for the php-general list ---
>
> I can handle administrative requests automatically. Please
> do not send them to the list address! Instead, send
> your message to the correct command address:
>
> For help and a description of available commands, send a message to:
> <php-general-help
lists.php.net>
>
> To subscribe to the list, send a message to:
> <php-general-subscribe
lists.php.net>
>
> To remove your address from the list, just send a message to
> the address in the ``List-Unsubscribe'' header of any list
> message. If you haven't changed addresses since subscribing,
> you can also send a message to:
> <php-general-unsubscribe
lists.php.net>
>
> or for the digest to:
> <php-general-digest-unsubscribe
lists.php.net>
>
> For addition or removal of addresses, I'll send a confirmation
> message to that address. When you receive it, simply reply to it
> to complete the transaction.
>
> If you need to get in touch with the human owner of this list,
> please send a message to:
>
> <php-general-owner
lists.php.net>
>
> Please include a FORWARDED list message with ALL HEADERS intact
> to make it easier to help you.
>
> --- Enclosed is a copy of the request I received.
>
> Return-Path: <gkreme
gmail.com>
> Received: (qmail 23744 invoked by uid 1010); 21 Nov 2006 04:21:18
> -0000
> Delivered-To: ezmlm-scan-php-general-unsubscribe
lists.php.net
> Delivered-To: ezmlm-php-general-unsubscribe
lists.php.net
> Received: (qmail 23729 invoked from network); 21 Nov 2006 04:21:18
> -0000
> Received: from unknown (HELO lists.php.net) (127.0.0.1)
> by localhost with SMTP; 21 Nov 2006 04:21:18 -0000
> Return-Path: <gkreme
gmail.com>
> Authentication-Results: pb1.pair.com header.from=gkreme
gmail.com;
> sender-id=unknown
> Authentication-Results: pb1.pair.com smtp.mail=gkreme
gmail.com;
> spf=unknown; sender-id=unknown
> Received-SPF: unknown (pb1.pair.com: domain gmail.com does not
> designate 64.140.43.68 as permitted sender)
> X-PHP-List-Original-Sender: gkreme
gmail.com
> X-Host-Fingerprint: 64.140.43.68 ns2.covisp.net NetCache 5.3-5.5
> Received: from [64.140.43.68] ([64.140.43.68:59896]
> helo=mail.covisp.net)
> by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP
> id 10/31-09994-EBE72654 for <php-general-
> unsubscribe
lists.php.net>; Mon, 20 Nov 2006 23:21:18 -0500
> Received: from [192.168.15.13]
> (c-71-196-162-152.hsd1.co.comcast.net [71.196.162.152])
> by mail.covisp.net (Postfix) with ESMTP id B329E118B3F5
> for <php-general-unsubscribe
lists.php.net>; Mon, 20 Nov 2006
> 21:21:15 -0700 (MST)
> Mime-Version: 1.0 (Apple Message framework v752.3)
> Content-Transfer-Encoding: 7bit
> Message-Id: <60AF993F-1FEA-43FB-BCE2-DCF4143946D4
gmail.com>
> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed
> To: php-general-unsubscribe
lists.php.net
> From: Google Kreme <gkreme
gmail.com>
> Subject:
> Date: Mon, 20 Nov 2006 21:21:02 -0700
> X-Mailer: Apple Mail (2.752.3)
>
>
> --
> Hey, baby, I've got just the cure for that penis envy back at my
> apartment...
--
I get the feeling that some people's idea of heaven is an "I told you
so" T-shirt - mmalc
attached mail follows:
On 20-Nov-2006, at 17:45, Richard Lynch wrote:
> Why not let *ME* tell you which of these features is more important?
Well, for the simple fact that most people do not, in fact, know what
they are looking for, which is why so many people end up in bad
relationships.
But this is OT :)
--
Use your key, unlock the door, see what fate might have in store.
Come explore your dreams and Creations, Enter the world of imagination.
attached mail follows:
On Tue, November 21, 2006 9:19 am, Larry Garfield wrote:
> On Monday 20 November 2006 18:19, Richard Lynch wrote:
> However, I discovered that at least part of the problem is at the HTTP
> level.
> It seems like the data was being corrupted before it even got to the
> server.
> Although we already had the Content type charset set to UTF-8 in the
> HTTP
> header, the browser (IE, Firefox, and Konqueror) was still defaulting
> to
> Latin1/Western, and I believe then *sending* data as that. When we
> set a
> <meta> tag to also set the content type and charset, however, the
> browser
> (all of them) switched into UTF-8 and submitted the data, and then
> displayed
> the smart quotes correctly (that is, without funky accented
> characters). It
> only seemed to work if the browser was set to UTF-8 both to submit the
> data
> and to read it. The existing pages remained borked.
Yes.
For some reason, IE, and now other browsers following suit, have
decided that Web Designers with their META tags are *much* more
reliable in their charset info than real HTTP headers from Web
Developers.
I do not claim to understand this rationale whatsoever, but there it is.
You still want the HTTP headers for older Firefox that actually
trusted them.
Without the META tag, IE actually uses a heuristic to "guess" at your
charset, rather than defaulting to Latin1.
I dunno what FF is thinking these days in regards to this...
> For the time being it seems the meta tag is working, but I'm quite
> curious as
> to why the browser would listen to that and NOT to the HTTP header.
> It also
> still doesn't explain why the string-replace method is still not
> working,
> even when everything is set to UTF-8.
>
> If anyone has an idea in that regard, please share. :-)
Once you have it as UTF-8, the "rules" for what is a character or
isn't may be too different for PHP 5 to handle?
That doesn't make sense, does it?...
I mean, it's still just one-byte characters at UTF-8, so you'd think
it would "just work"...
UTF-16, yeah, you'd have big problems, as they are 2-byte sequences to
define a char.
I barely understand this Unicode stuff, though, so maybe I'm missing
something...
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
attached mail follows:
On Tue, November 21, 2006 8:40 am, Jared Farrish wrote:
> Is this legal? Note where the typecasting occurs: In the function
> parameter
> list, before the variable.
>
> <code>
> function doSomething( (int) $int1, (int) $int2 ) {
> //blah blah
> }
> </code>
>
> This would take the place of:
>
> <code>
> function doSomething($int1, $int2) {
> $int1 = (int) $int1;
> $int2 = (int) $int2;
> }
> </code>
>
> Is this possible?
You could try it and see faster than posting...
It won't work, and if the syntax DID parse, it would probably be "type
hinting" rather than "type casting" which means it would possibly
throw an error/notice/warning/whatever if your data coming in was not
(int) type.
AFAIK, PHP does not support this for (int) in any current version, and
plans for the future are nebulous in this regard.
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
attached mail follows:
On Tue, November 21, 2006 12:11 pm, Jared Farrish wrote:
> On 11/21/06, Richard Lynch <ceo
l-i-e.com> wrote:
>>
>>
>> It won't work, and if the syntax DID parse, it would probably be
>> "type
>> hinting" rather than "type casting" which means it would possibly
>> throw an error/notice/warning/whatever if your data coming in was
>> not
>> (int) type.
>>
>
> I had thought about it "meaning" typehinting instead of typecasting to
With or without the () I'd expect 'int' in an arglist to be
type-hinting, not type-casting, as that's how most other languages
work...
Not saying it couldn't be done, just that it would require a mental
adjustment.
And, of course, for now:
function foo ($x, $y){
$x = (int) $x;
$y = (int) $y;
}
Not that big a deal, it seems to me, to get the type coercion.
Type-hinting is far more complex to achieve in UserLand code...
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
attached mail follows:
On Tue, November 21, 2006 6:49 am, testkonto wrote:
> I wonder if it's possible to load more than one file up to a web
> server - with
> a single form submision.
>
> Does anybody know if yes/no?
Just have two INPUT TYPE="FILE" tags.
This is not rocket science...
If you want them zipped up somehow, you're gonna have to train users
to zip them before uploading.
At which point, you might as well give them FTP access somewhere, as
it's probably no more difficult. YMMV
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
attached mail follows:
This one time, at band camp, Stut <stuttle
gmail.com> wrote:
> > Does anybody know if yes/no?
Quick example here...
http://phpro.org/examples/Mulitple-file-upload.html
Kevin
--
"Democracy is two wolves and a lamb voting on what to have for lunch.
Liberty is a well-armed lamb contesting the vote."
attached mail follows:
On 21-Nov-2006, at 04:25, Ford, Mike wrote:
> So the syntactically-correct simple version of this is '/[A_Z0-9
> \'.&_-]/i'.
Seems to ME that '/[:alnum:\'.&_-]/i' is more readable, and '/[\w
\'.&-]/i' is just all around better
And there's an error in what you posted anyway, A-Z, not A_Z
However, I think Paul's post does exactly what the OP wanted:
On 16-Nov-2006, at 15:26, Paul Novitski wrote:
> /\[([^\]|]+)\|([^\]]+)\]/
--
Do you believe that there's someone up above, and does he have a
timetable directing acts of love?
attached mail follows:
On Tue, November 21, 2006 2:30 am, onewaylife wrote:
> the file is : -
> <html>
> it give this output " XML parser error: Reserved XML Name"
One Possible Interpretation:
XML files start with:
<?xml
Your file does not start with:
<?xml
Your file is not XML.
Fix it.
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
attached mail follows:
dear Richard
I have written a PHP file in that with help of php document tags i have
created XML file in that PHP file and in xml file i have taken care of the
<?xml ?> tag.
with regards
rakesh
Richard Lynch wrote:
>
> On Tue, November 21, 2006 2:30 am, onewaylife wrote:
>> the file is : -
>> <html>
>
>> it give this output " XML parser error: Reserved XML Name"
>
> One Possible Interpretation:
>
> XML files start with:
> <?xml
>
> Your file does not start with:
> <?xml
>
> Your file is not XML.
>
> Fix it.
>
> --
> Some people have a "gift" link here.
> Know what I want?
> I want you to buy a CD from some starving artist.
> http://cdbaby.com/browse/from/lynch
> Yeah, I get a buck. So?
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
--
View this message in context: http://www.nabble.com/XML-parser-error-..-tf2677513.html#a7485238
Sent from the PHP - General mailing list archive at Nabble.com.
attached mail follows:
On Tue, November 21, 2006 2:22 am, Fernando Viadero wrote:
> is this code OK???
No!
> "fotos" is an array of uploaded files (images)..
>
> $tipo = $HTTP_POST_FILES["fotos"]["type"][$a];
The mime type sent by the browser is COMPLETELY unreliable and
unpredictable.
Evil people will send "image/png" for a nasty virus, for example.
Plus, IE will send some bogus made-up mime type whenever they feel
like it, while real browsers will attempt, and sometimes fail, to
guess the correct mime type to send for any given image.
You would be better off to use http://php.net/getimagesize on the file
to find out what is inside of it, at least for the first N bytes,
which is what the file is *claiming* to be.
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
attached mail follows:
Fernando Viadero wrote:
> hello
>
>
> is this code OK???
>
> "fotos" is an array of uploaded files (images)..
>
> i want to process them in case they are images...if not, don't process..
>
> is myme type case sensitive??
>
> some of our customers, have problems uploading images...
>
> thanks in advance..
>
>
>
>
> $tipo = $HTTP_POST_FILES["fotos"]["type"][$a];
> $tipo = ( strstr($tipo, '; name') ) ? str_replace(strstr($tipo, ';
> name'), '', $tipo) : $tipo; //some opera patch¿¿¿
If you're using php4.1 or above change that to:
$tipo = $_FILES['fotos']['type'][$a];
Read up on the "super globals":
http://www.php.net/manual/en/language.variables.predefined.php
--
Postgresql & php tutorials
http://www.designmagick.com/
attached mail follows:
On 21-Nov-2006, at 10:15, php-general-help
lists.php.net wrote:
> Hi! This is the ezmlm program. I'm managing the
> php-general
lists.php.net mailing list.
>
> I'm working for my owner, who can be reached
> at php-general-owner
lists.php.net.
>
> To confirm that you would like
>
> kremels
kreme.com
>
> added to the php-general mailing list, please send
> an empty reply to this address:
>
> php-general-sc.1164129356.gboodgkfacgbjpabnamk-
> kremels=kreme.com
lists.php.net
>
> Usually, this happens when you just hit the "reply" button.
> If this does not work, simply copy the address and paste it into
> the "To:" field of a new message.
>
> or click here:
> mailto:php-general-sc.1164129356.gboodgkfacgbjpabnamk-
> kremels=kreme.com
lists.php.net
>
> This confirmation serves two purposes. First, it verifies that I am
> able
> to get mail through to you. Second, it protects you in case someone
> forges a subscription request in your name.
>
> Some mail programs are broken and cannot handle long addresses. If you
> cannot reply to this request, instead send a message to
> <php-general-request
lists.php.net> and put the
> entire address listed above into the "Subject:" line.
>
>
> --- Administrative commands for the php-general list ---
>
> I can handle administrative requests automatically. Please
> do not send them to the list address! Instead, send
> your message to the correct command address:
>
> For help and a description of available commands, send a message to:
> <php-general-help
lists.php.net>
>
> To subscribe to the list, send a message to:
> <php-general-subscribe
lists.php.net>
>
> To remove your address from the list, just send a message to
> the address in the ``List-Unsubscribe'' header of any list
> message. If you haven't changed addresses since subscribing,
> you can also send a message to:
> <php-general-unsubscribe
lists.php.net>
>
> or for the digest to:
> <php-general-digest-unsubscribe
lists.php.net>
>
> For addition or removal of addresses, I'll send a confirmation
> message to that address. When you receive it, simply reply to it
> to complete the transaction.
>
> If you need to get in touch with the human owner of this list,
> please send a message to:
>
> <php-general-owner
lists.php.net>
>
> Please include a FORWARDED list message with ALL HEADERS intact
> to make it easier to help you.
>
> --- Enclosed is a copy of the request I received.
>
> Return-Path: <kremels
kreme.com>
> Received: (qmail 93516 invoked by uid 1010); 21 Nov 2006 17:15:56
> -0000
> Delivered-To: ezmlm-scan-php-general-subscribe
lists.php.net
> Delivered-To: ezmlm-php-general-subscribe
lists.php.net
> Received: (qmail 93475 invoked from network); 21 Nov 2006 17:15:56
> -0000
> Received: from unknown (HELO lists.php.net) (127.0.0.1)
> by localhost with SMTP; 21 Nov 2006 17:15:56 -0000
> Return-Path: <kremels
kreme.com>
> Received: from [127.0.0.1] ([127.0.0.1:24333])
> by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ECSTREAM
> id 18/4D-28693-A4433654 for <php-general-subscribe
lists.php.net>;
> Tue, 21 Nov 2006 12:15:54 -0500
> Return-Path: <kremels
kreme.com>
> Authentication-Results: pb1.pair.com header.from=kremels
kreme.com;
> sender-id=unknown
> Authentication-Results: pb1.pair.com smtp.mail=kremels
kreme.com;
> spf=permerror; sender-id=unknown
> Received-SPF: error (pb1.pair.com: domain kreme.com from
> 64.140.43.68 cause and error)
> X-PHP-List-Original-Sender: kremels
kreme.com
> X-Host-Fingerprint: 64.140.43.68 ns2.covisp.net NetCache 5.3-5.5
> Received: from [64.140.43.68] ([64.140.43.68:58332]
> helo=mail.covisp.net)
> by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP
> id CE/21-09994-0BE72654 for <php-general-subscribe
lists.php.net>;
> Mon, 20 Nov 2006 23:21:05 -0500
> Received: from [192.168.15.13]
> (c-71-196-162-152.hsd1.co.comcast.net [71.196.162.152])
> by mail.covisp.net (Postfix) with ESMTP id D5551118B3F5
> for <php-general-subscribe
lists.php.net>; Mon, 20 Nov 2006
> 21:21:01 -0700 (MST)
> Mime-Version: 1.0 (Apple Message framework v752.3)
> Content-Transfer-Encoding: 7bit
> Message-Id: <0459C9D0-C088-435B-9002-B0539E1CBCEF
kreme.com>
> Content-Type: text/plain; charset=US-ASCII; format=flowed
> To: php-general-subscribe
lists.php.net
> From: LuKreme <kremels
kreme.com>
> Subject:
> Date: Mon, 20 Nov 2006 21:20:56 -0700
> X-Mailer: Apple Mail (2.752.3)
>
>
> --
> Today the road all runners come/Shoulder high we bring you home.
> And set you at your threshold down/Townsman of a stiller town.
--
Behind every great man there's a woman with a vibrator -- Hawkeye Pierce
attached mail follows:
On Tue, November 21, 2006 8:33 am, Brad Fuller wrote:
> function will only use up 1K of memory no matter how big the file is.
I think it will use 1M...
> function readfile_chunked($filename,$retbytes=true) {
> $chunksize = 1*(1024*1024); // how many bytes per chunk
:-)
The multiple calls to ob_flush() within the body of the loop are
probably not a Good Idea, as a general rule...
flush() is also probably overkill, really, for any file big enough for
this function to be desirable in the first place...
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
attached mail follows:
> I think it will use 1M...
>
> > function readfile_chunked($filename,$retbytes=true) {
> > $chunksize = 1*(1024*1024); // how many bytes per chunk
>
> :-)
Yes 1M is what I meant, although you can set it to whatever you want.
> The multiple calls to ob_flush() within the body of the loop are
> probably not a Good Idea, as a general rule...
I think you missed the point of the function.
> flush() is also probably overkill, really, for any file big enough for
> this function to be desirable in the first place...
Php.net says "flush() has no effect on the buffering scheme of your
webserver or the browser on the client side. Thus you need to call both
ob_flush() and flush() to flush the output buffers. "
http://us3.php.net/flush
attached mail follows:
On Tue, November 21, 2006 1:26 pm, Brad Fuller wrote:
>> I think it will use 1M...
>>
>> > function readfile_chunked($filename,$retbytes=true) {
>> > $chunksize = 1*(1024*1024); // how many bytes per chunk
>>
>> :-)
>
> Yes 1M is what I meant, although you can set it to whatever you want.
>
>> The multiple calls to ob_flush() within the body of the loop are
>> probably not a Good Idea, as a general rule...
>
> I think you missed the point of the function.
I think not.
I think you'd want to call ob_flush() in a loop at the top until
ob_get_level() returned 0, rather than rely on the number of
ob_handlers stacked up being smaller than the number of Megabytes to
be pumped out.
That's assuming you would want to override any and all ob_start() in
the first place, which seems a decidedly odd way to structure a web
application to me.
I would expect that your MP3 output URL would have already turned OFF
output buffering in any php.ini type setting, and wouldn't have
started any output buffering up in the first place, since you
almost-for-sure knew from the very beginning of this request that you
were outputting an MP3 file, which, by its very nature, you would not
want to bufffer.
>> flush() is also probably overkill, really, for any file big enough
>> for
>> this function to be desirable in the first place...
>
> Php.net says "flush() has no effect on the buffering scheme of your
> webserver or the browser on the client side. Thus you need to call
> both
> ob_flush() and flush() to flush the output buffers. "
flush() is largely irrelevant to the HTTP interaction.
TCP/IP, HTTP, Apache, etc all add buffers and network lag that render
flush() meaningless in this context.
Later versions of PHP, I think, pushed the boundary of flush() up
to/through the Apache layer of buffering.
But they have zero effect on TCP/IP stack, much less any sort of other
client-server buffering.
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
attached mail follows:
You might be interested to read the thread that was posted here:
http://www.php.net/readfile
There's a bit of discussion as to why the ob_flush() and flush() are in
there.
It's not my function. I don't take any credit for it, and frankly I don't
care whether you think its useful or not, or whether you think parts of it
are redundant, or if it can be done better; I just thought someone on this
list who was working with file downloads might find it useful.
I must admit I am a bit bothered by the fact that I can't submit something
to this list without some smart ass know-it-all making some comments about
how they could do it better.
It almost makes me not want to contribute anything.
-B
> -----Original Message-----
> From: Richard Lynch [mailto:ceo
l-i-e.com]
> Sent: Tuesday, November 21, 2006 3:40 PM
> To: Brad Fuller
> Cc: php-general
lists.php.net
> Subject: RE: [PHP] Useful function for file download (i.e. MP3)
>
> On Tue, November 21, 2006 1:26 pm, Brad Fuller wrote:
> >> I think it will use 1M...
> >>
> >> > function readfile_chunked($filename,$retbytes=true) {
> >> > $chunksize = 1*(1024*1024); // how many bytes per chunk
> >>
> >> :-)
> >
> > Yes 1M is what I meant, although you can set it to whatever you want.
> >
> >> The multiple calls to ob_flush() within the body of the loop are
> >> probably not a Good Idea, as a general rule...
> >
> > I think you missed the point of the function.
>
> I think not.
>
> I think you'd want to call ob_flush() in a loop at the top until
> ob_get_level() returned 0, rather than rely on the number of
> ob_handlers stacked up being smaller than the number of Megabytes to
> be pumped out.
>
> That's assuming you would want to override any and all ob_start() in
> the first place, which seems a decidedly odd way to structure a web
> application to me.
>
> I would expect that your MP3 output URL would have already turned OFF
> output buffering in any php.ini type setting, and wouldn't have
> started any output buffering up in the first place, since you
> almost-for-sure knew from the very beginning of this request that you
> were outputting an MP3 file, which, by its very nature, you would not
> want to bufffer.
>
> >> flush() is also probably overkill, really, for any file big enough
> >> for
> >> this function to be desirable in the first place...
> >
> > Php.net says "flush() has no effect on the buffering scheme of your
> > webserver or the browser on the client side. Thus you need to call
> > both
> > ob_flush() and flush() to flush the output buffers. "
>
> flush() is largely irrelevant to the HTTP interaction.
>
> TCP/IP, HTTP, Apache, etc all add buffers and network lag that render
> flush() meaningless in this context.
>
> Later versions of PHP, I think, pushed the boundary of flush() up
> to/through the Apache layer of buffering.
>
> But they have zero effect on TCP/IP stack, much less any sort of other
> client-server buffering.
>
> --
> Some people have a "gift" link here.
> Know what I want?
> I want you to buy a CD from some starving artist.
> http://cdbaby.com/browse/from/lynch
> Yeah, I get a buck. So?
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
attached mail follows:
I don't know how to respond to this other than to apologize for
seeming like a smart-ass know-it-all.
I'm sorry.
On Tue, November 21, 2006 3:18 pm, Brad Fuller wrote:
>
> You might be interested to read the thread that was posted here:
>
> http://www.php.net/readfile
>
> There's a bit of discussion as to why the ob_flush() and flush() are
> in
> there.
>
> It's not my function. I don't take any credit for it, and frankly I
> don't
> care whether you think its useful or not, or whether you think parts
> of it
> are redundant, or if it can be done better; I just thought someone on
> this
> list who was working with file downloads might find it useful.
>
> I must admit I am a bit bothered by the fact that I can't submit
> something
> to this list without some smart ass know-it-all making some comments
> about
> how they could do it better.
>
> It almost makes me not want to contribute anything.
>
> -B
>
>> -----Original Message-----
>> From: Richard Lynch [mailto:ceo
l-i-e.com]
>> Sent: Tuesday, November 21, 2006 3:40 PM
>> To: Brad Fuller
>> Cc: php-general
lists.php.net
>> Subject: RE: [PHP] Useful function for file download (i.e. MP3)
>>
>> On Tue, November 21, 2006 1:26 pm, Brad Fuller wrote:
>> >> I think it will use 1M...
>> >>
>> >> > function readfile_chunked($filename,$retbytes=true) {
>> >> > $chunksize = 1*(1024*1024); // how many bytes per chunk
>> >>
>> >> :-)
>> >
>> > Yes 1M is what I meant, although you can set it to whatever you
>> want.
>> >
>> >> The multiple calls to ob_flush() within the body of the loop are
>> >> probably not a Good Idea, as a general rule...
>> >
>> > I think you missed the point of the function.
>>
>> I think not.
>>
>> I think you'd want to call ob_flush() in a loop at the top until
>> ob_get_level() returned 0, rather than rely on the number of
>> ob_handlers stacked up being smaller than the number of Megabytes to
>> be pumped out.
>>
>> That's assuming you would want to override any and all ob_start() in
>> the first place, which seems a decidedly odd way to structure a web
>> application to me.
>>
>> I would expect that your MP3 output URL would have already turned
>> OFF
>> output buffering in any php.ini type setting, and wouldn't have
>> started any output buffering up in the first place, since you
>> almost-for-sure knew from the very beginning of this request that
>> you
>> were outputting an MP3 file, which, by its very nature, you would
>> not
>> want to bufffer.
>>
>> >> flush() is also probably overkill, really, for any file big
>> enough
>> >> for
>> >> this function to be desirable in the first place...
>> >
>> > Php.net says "flush() has no effect on the buffering scheme of
>> your
>> > webserver or the browser on the client side. Thus you need to call
>> > both
>> > ob_flush() and flush() to flush the output buffers. "
>>
>> flush() is largely irrelevant to the HTTP interaction.
>>
>> TCP/IP, HTTP, Apache, etc all add buffers and network lag that
>> render
>> flush() meaningless in this context.
>>
>> Later versions of PHP, I think, pushed the boundary of flush() up
>> to/through the Apache layer of buffering.
>>
>> But they have zero effect on TCP/IP stack, much less any sort of
>> other
>> client-server buffering.
>>
>> --
>> Some people have a "gift" link here.
>> Know what I want?
>> I want you to buy a CD from some starving artist.
>> http://cdbaby.com/browse/from/lynch
>> Yeah, I get a buck. So?
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
attached mail follows:
Hello,
I want people to be able to put in some dimensions, like a lot size, and
then pick some other items (which will have their dimensions stored). The
user can then drag the other items onto their lot, move them, etc just to
see what fits and where. They could even view it in 3d. My current app is
all PHP so trying to find the best way to do this. Does anyone have any
ideas or of a site which does something similiar? Will I have to use
something like Flash?
Thanks!
attached mail follows:
At 02:44 PM 11/21/2006, blackwater dev wrote:
>Hello,
>
>I want people to be able to put in some dimensions, like a lot size, and
>then pick some other items (which will have their dimensions stored). The
>user can then drag the other items onto their lot, move them, etc just to
>see what fits and where. They could even view it in 3d. My current app is
>all PHP so trying to find the best way to do this. Does anyone have any
>ideas or of a site which does something similiar? Will I have to use
>something like Flash?
>
>Thanks!
Well, PHP is server side. Probably time to brush up on your Flash. <g>
M.
--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.409 / Virus Database: 268.14.11/543 - Release Date: 11/20/2006
attached mail follows:
I second that. I personally do not know if PHP is capable of such
production, but what you're talking about is certainly a breeze in Flash. At
Flashkit you'll find plenty of example of such applications.
Although if PHP 'is' capable of such, I would love to know more about it.
On 11/21/06 2:07 PM, "Miles Thompson" <miles
allnovascotia.com> wrote:
> At 02:44 PM 11/21/2006, blackwater dev wrote:
>
>> Hello,
>>
>> I want people to be able to put in some dimensions, like a lot size, and
>> then pick some other items (which will have their dimensions stored). The
>> user can then drag the other items onto their lot, move them, etc just to
>> see what fits and where. They could even view it in 3d. My current app is
>> all PHP so trying to find the best way to do this. Does anyone have any
>> ideas or of a site which does something similiar? Will I have to use
>> something like Flash?
>>
>> Thanks!
>
> Well, PHP is server side. Probably time to brush up on your Flash. <g>
> M.
>
Rahul S. Johari
Supervisor, Internet & Administration
Informed Marketing Services Inc.
500 Federal Street, Suite 201
Troy NY 12180
Tel: (518) 687-6700 x154
Fax: (518) 687-6799
Email: rahul
informed-sources.com
http://www.informed-sources.com
attached mail follows:
On Tue, November 21, 2006 12:44 pm, blackwater dev wrote:
> I want people to be able to put in some dimensions, like a lot size,
> and
> then pick some other items (which will have their dimensions stored).
> The
> user can then drag the other items onto their lot, move them, etc just
> to
> see what fits and where. They could even view it in 3d. My current
> app is
> all PHP so trying to find the best way to do this. Does anyone have
> any
> ideas or of a site which does something similiar? Will I have to use
> something like Flash?
Almost-for-sure you will want a client-side interactive scripting
language such as:
ActionScript in Flash
JavaScript in most user's browsers
Java applet/servelet
These all come with their own pros and cons.
PHP would be involved only if you have an AJAX-y JavaScript client
pounding back on to the server to calculate what fits where -- Which
will probably perform like a total dog compared to something all
client-side.
So the only way this belongs in PHP is if you can convince all the
users to install that nifty "PHPScript" thingie I saw in PECL or PEAR
the other week... Kinda like JavaScript, only PHP, for the browser.
I keep meaning to play with that...
PS This is really 2-D modeling, right?... Or are you actually going to
let them "stack" items in a 3-D world?
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
attached mail follows:
Richard, what "PHPScript" thingy are you talking about?
On 11/21/06 3:46 PM, "Richard Lynch" <ceo
l-i-e.com> wrote:
> PHPScript
Rahul S. Johari
Supervisor, Internet & Administration
Informed Marketing Services Inc.
500 Federal Street, Suite 201
Troy NY 12180
Tel: (518) 687-6700 x154
Fax: (518) 687-6799
Email: rahul
informed-sources.com
http://www.informed-sources.com
attached mail follows:
On 21-Nov-2006, at 14:04, Rahul S. Johari wrote:
> Richard, what "PHPScript" thingy are you talking about?
This one?
<http://pecl.php.net/package/PHPScript>
(nope, don't know anythign about it, just typed 'phpscript' into google)
--
Some books are undeservedly forgotten; none are undeservedly remembered
attached mail follows:
At 1:44 PM -0500 11/21/06, blackwater dev wrote:
>Hello,
>
>I want people to be able to put in some dimensions, like a lot size, and
>then pick some other items (which will have their dimensions stored). The
>user can then drag the other items onto their lot, move them, etc just to
>see what fits and where. They could even view it in 3d. My current app is
>all PHP so trying to find the best way to do this. Does anyone have any
>ideas or of a site which does something similiar? Will I have to use
>something like Flash?
>
>Thanks!
PHP is a server-side language and thus is not really suited for a
user drag and drop application. It doesn't have a good user
"real-time" interface unless you add js or flash.
As such, I think you'll have to look at javascript or flash. For example:
http://xn--ovg.com/dragdrop
and
http://www.tufat.com/s_3d_molecule_viewer.htm
hth's
tedd
--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
attached mail follows:
On Tue, November 21, 2006 3:17 pm, LuKreme wrote:
> On 21-Nov-2006, at 14:04, Rahul S. Johari wrote:
>> Richard, what "PHPScript" thingy are you talking about?
>
> This one?
>
> <http://pecl.php.net/package/PHPScript>
Yes.
If I'm reading that page correctly, it would make PHPScript be just
like JavaScript, for anybody silly enough to download/install it, and
have ActiveX turned on, or something along those lines...
If you get the idea that I really don't understand for 100% sure what
that page means, you are 100% correct. :-)
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
attached mail follows:
yes for this project i think you'll better off with flash and if you want to
interact with server side there's an open source project called amfPHP [1].
It is a flash remoting solution, using php on the server side. i'm not sure
of its current status.
hth,
john
[1] www.amfphp.org
On 11/22/06, Richard Lynch <ceo
l-i-e.com> wrote:
>
> On Tue, November 21, 2006 3:17 pm, LuKreme wrote:
> > On 21-Nov-2006, at 14:04, Rahul S. Johari wrote:
> >> Richard, what "PHPScript" thingy are you talking about?
> >
> > This one?
> >
> > <http://pecl.php.net/package/PHPScript>
>
> Yes.
>
> If I'm reading that page correctly, it would make PHPScript be just
> like JavaScript, for anybody silly enough to download/install it, and
> have ActiveX turned on, or something along those lines...
>
> If you get the idea that I really don't understand for 100% sure what
> that page means, you are 100% correct. :-)
>
> --
> Some people have a "gift" link here.
> Know what I want?
> I want you to buy a CD from some starving artist.
> http://cdbaby.com/browse/from/lynch
> Yeah, I get a buck. So?
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
GMail Rocks!!!
attached mail follows:
At 08:07 PM 11/21/2006, J R wrote:
>yes for this project i think you'll better off with flash and if you want to
>interact with server side there's an open source project called amfPHP [1].
>It is a flash remoting solution, using php on the server side. i'm not sure
>of its current status.
>
>hth,
>john
>
>[1] www.amfphp.org
<snip>
It's not a big deal from the Flash side, you use either sendAndLoad() or if
your data is more complex and structured, then XML() to call a PHP script.
A lot of Flash examples use files loaded from the file system.
I did not use amfPHP because when I needed to do this the first time work
on that library seemed to have halted. I think it's really provided so that
Flash designers / developers have an alternative to Flash Remoting which
can simply be "used".
Make certain your PHP script generates properly formed XML. As this was
text, with unpredictable content, I had to use CDATA[], otherwise parsing
the XML on the Flash side was very unpredictable. There are a couple
of libraries to parse XML on the Flash side which eases that part of the work.
Here's an example, using Actionscript to call a PHP script in Flash to
retrieve the news stories for a given day from the database. getNodes() and
displayContent() are custom functions, so don't look in the manual. Host is
set in an .as file.
This is Actionscript 2 (AS2); Flash is now up to Actionscript 3 I believe.
Caution: The format of some functions changed between AS1 and AS2 and the
Flash compiler DOES NOT TRAP THE DIFFERENCE. A good example is
sendAndLoad() which used to be SendAndLoad(). No complaint about an unknown
function, but suddenly the movie just-did-not-work. I've not worked with
AS3 so don't know about any of its quirks.
As for the formatting, the way the tabs blew out reinforces argument
someone made for spaces earlier today. I don't do that, I set a tab to be
equivalent to 3 spaces in all my editors. As for the style of braces, these
days I tend to put the left brace immediately following the function name.
Hope this will be helpful.
Regards - Miles
function getStories(dtChosen)
{
var xmlReceiver:XML = new XML();
xmlReceiver.ignoreWhite = true;
if( dtChsn == "" )
{
xmlReceiver.load( "http://" + host + "feedNewsXml.php");
}
else
{
xmlReceiver.load( "http://" + host +
"feedNewxXml.php?dtArticle="+ dtChsn);
}
xmlReceiver.onLoad = function( success:Boolean )
{
// If the vars loaded successfully...
if (success)
{
arrHeads = getNodes( this, "head");
arrShrtHeads = getNodes( this, "shrthead" );
arrStorys = getNodes( this, "story");
displayContent(arrShrtHeads);
txtNews.text = "<b>Click a headline on left to
read the news story.</b> <br><br>"
txtNews.text += "To scroll either headlines and
news story, use: <br>"
txtNews.text += " <i>Page Up and
Page Down keys</i>, or <br>"
txtNews.text += " <i>Mouse
wheel</i>. <br><br>"
txtNews.text += "Remember to click in the frame
you want to scroll."
txtNews.selectable = False;
newsPos.ChkPos();
} else
{
// Otherwise tell the user the vars couldn't be loaded.
txtNews.text = "GetStories: Loading of news storys failed.";
} // end if (succes ..
} // end varReceiver.onLoad
} //end function GetStories()
--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.409 / Virus Database: 268.14.11/543 - Release Date: 11/20/2006
attached mail follows:
On Tue, November 14, 2006 10:00 pm, Ed Lazor wrote:
> I'm reading a book on CSS and how you can define different style
> sheets for different visitors. I'm wondering how you guys do it.
> The book recommends using Javascript functions for identifying the
> user's browser and matching them with the corresponding style
> sheets. Anyone using PHP for this instead - specifically with
> defining style sheets for different target browsers and platforms?
Seems to me that if you have to define different CSS for different
browsers, and/or hack it up with weird bogus CSS declarations, then
you've kind of defeated the whole purpose of CSS in the first place...
YMMV
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
attached mail follows:
Hello Erik,
I just realized that I oversaw some things. Here they are:
Am Sonntag, 19. November 2006 00:05 schrieb Erik Gyepes:
> #check if file or directory real exists:
is_dir()
file_exists()
> #do the rule only if the address has no extension:
pathinfo()
> #replace /whatever to /whatever/, not apply to whatever/!
preg_replace()
regex: "/[^/]$/"
> #do the rule only if the address ends with trailing slash:
preg_match()
regex: "/\/$/"
> #if the rule ends with trailing slash then redirect to index.php..
s.o.
header("Location: http://path/to/index.php\r\n");
Regards,
Oliver
attached mail follows:
On Tue, November 21, 2006 12:59 pm, testkonto wrote:
> header("Location: http://path/to/index.php\r\n");
A) You probably don't want a newline nor carriage return as part of
your URL.
B) Rant #37, which I've posted twice in this very forum this week,
will not be repeated here.
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
attached mail follows:
On Tue, November 14, 2006 7:57 pm, John Meyer wrote:
> Is there a way to make a regular expression to match on a particular
> way
> the letters are arranged? For instance, if you had a word:
>
> THAT
>
>
> It could match on any word in the dictionary that had the form:
>
> 1231
I suspect if you worked hard enough at it you could get a regex to do
what you want...
But it might be a heck of a lot easier to just build a database like
this:
<?php
$path = "/usr/share/web2"; //Webster's 2nd ed. dictionary, public
domain, on some distros...
$file = fopen($path, 'r') or die("You may need to cp $path to your
own dir, as it is not readable here...");
while (!feof($file)){
$word = fgets($file, 1000000);
$code = wordcode($word);
//store $code | $word in some convenient way...
//perhaps a database
//perhaps each $code could be a file with all the $word[s] in it
//etc
}
function wordcode($word){
$code = array();
$result = '';
$len = strlen($word);
for ($i = 0; $i < $len; $i++){
$c = $word[$i]; //or use substr if you hate string as array syntax
if (!isset($code[$c])){
$code[$c] = count($code) + 1;
}
$d = $code[$c];
$result .= $d;
}
}
?>
NOTE:
For any word with more then 9 unique characters, you are going to have
SERIOUS problems...
Consider this:
supercalifragilisticexpialidocious
123456789105711989...
How can you tell that '11' for the 'g' isn't supposed to be '1'
followed by '1' for two 's' characters in a row?
supercalifrassilisticexpialidocious
123456789105711989...
You may need to represent your digits in, say, hex form, or even in
base 26 form, which gives you the full alphabet as unique digits.
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
attached mail follows:
>On Tue, November 14, 2006 7:57 pm, John Meyer wrote:
> > Is there a way to make a regular expression to match on a particular
> > way
> > the letters are arranged? For instance, if you had a word:
> > THAT
> > It could match on any word in the dictionary that had the form:
> > 1231
At 11/21/2006 11:07 AM, Richard Lynch wrote:
>For any word with more then 9 unique characters, you are going to have
>SERIOUS problems...
>
>Consider this:
>supercalifragilisticexpialidocious
>123456789105711989...
>
>How can you tell that '11' for the 'g' isn't supposed to be '1'
>followed by '1' for two 's' characters in a row?
>supercalifrassilisticexpialidocious
>123456789105711989...
>
>You may need to represent your digits in, say, hex form, or even in
>base 26 form, which gives you the full alphabet as unique digits.
I agree that, of the many ways to encode this, using single ASCII
digits would be one of the poorest.
One rather obvious cypher would be the alphabet itself -- a set of
one-character symbols of precisely the same number as the characters
you want to encode:
php
ABA
that
ABCA
whew
ABCA
supercalifragilisticexpialidocious
ABCDEFGHIJEGKIHIALIFDMCIGHINOFIOBA
Regards,
Abcd
attached mail follows:
Sorry, forgot to copy the group on my reply to Richard and John.
>On Tue, November 14, 2006 7:57 pm, John Meyer wrote:
>> Is there a way to make a regular expression to match on a particular
>> way the letters are arranged? For instance, if you had a word:
>>
>> THAT
>>
>>
>> It could match on any word in the dictionary that had the form:
>>
>> 1231
>
>I suspect if you worked hard enough at it you could get a regex to do
>what you want...
>
>But it might be a heck of a lot easier to just build a database like
>this:
>
><?php
> $path = "/usr/share/web2"; //Webster's 2nd ed. dictionary, public
>domain, on some distros...
> $file = fopen($path, 'r') or die("You may need to cp $path to your
>own dir, as it is not readable here...");
> while (!feof($file)){
> $word = fgets($file, 1000000);
> $code = wordcode($word);
> //store $code | $word in some convenient way...
> //perhaps a database
> //perhaps each $code could be a file with all the $word[s] in it
> //etc
> }
>
> function wordcode($word){
> $code = array();
> $result = '';
> $len = strlen($word);
> for ($i = 0; $i < $len; $i++){
> $c = $word[$i]; //or use substr if you hate string as array
syntax
> if (!isset($code[$c])){
> $code[$c] = count($code) + 1;
> }
> $d = $code[$c];
> $result .= $d;
> }
> }
>?>
>
>NOTE:
>For any word with more then 9 unique characters, you are going to have
>SERIOUS problems...
>
>Consider this:
>supercalifragilisticexpialidocious
>123456789105711989...
>
>
>How can you tell that '11' for the 'g' isn't supposed to be '1'
>followed by '1' for two 's' characters in a row?
>supercalifrassilisticexpialidocious
>123456789105711989...
>
>You may need to represent your digits in, say, hex form, or even in
>base 26 form, which gives you the full alphabet as unique digits.
>
>--
>Some people have a "gift" link here.
>Know what I want?
>I want you to buy a CD from some starving artist.
>http://cdbaby.com/browse/from/lynch
>Yeah, I get a buck. So?
Believe it or not I had to do something like this a while back. Here is
a function. I have tweaked it to fit your needs a bit, but the example
works. It seems to sort of follow what Lynch's psuedocode loosely.
<?php
/*
*function convertToPattern converts a string into a pattern based on
letter
*frequency and position
*
* ex: "that" would convert to abca
* "pretty" would convert to abcdde
*/
function convertToPattern($strCandidate){
//Set up the array that holds mapping of character to pattern character
$arrHolder = array(
"a"=>'',
"b"=>'',
"c"=>'',
"d"=>'',
"e"=>'',
"f"=>'',
"g"=>'',
"h"=>'',
"i"=>'',
"j"=>'',
"k"=>'',
"l"=>'',
"m"=>'',
"n"=>'',
"o"=>'',
"p"=>'',
"q"=>'',
"r"=>'',
"s"=>'',
"t"=>'',
"u"=>'',
"v"=>'',
"w"=>'',
"x"=>'',
"y"=>'',
"z"=>''
);
//Now create an array with all of the letters of the alphabet in
//it for reference
$arrAlpha = array();
$idxAlphCreate = 0;
foreach($arrHolder as $key => $data){
$arrAlpha[$idxAlphCreate] = $key;
$idxAlphCreate++;
}
//split the string into an array so we can walk it
$arrCandidate = str_split($strCandidate);
$cntCandidate = count($arrCandidate);
$idxCandidate = 0;
$idxHolder = 0;
//walk through the array made from the string
while($idxCandidate < $cntCandidate){
//get the current char
$charCandidate = $arrCandidate[$idxCandidate];
//if the char is already in the array it has been mapped
//if not, map it to the next available letter
if(!(in_array($charCandidate, $arrHolder))){
$arrHolder[$arrAlpha[$idxHolder]] =
$charCandidate;
$idxHolder++;
}
$idxCandidate++;
}
//initialize our converted string
$strConverted = "";
//loop through the array one more time to create our converted
string
foreach($arrCandidate as $char){
$arrKeyCheck=array_keys($arrHolder, $char);
$strConverted.=$arrKeyCheck[0];
}
return $strConverted;
}
//Example
$strA = "that";
$strB = "croc";
$patternA = convertToPattern($strA);
$patternB = convertToPattern($strB);
if($patternA == $patternB){
echo "Bingo!";
}else{
echo "Not so much...";
}
?>
HTH,
Jesse R. Castro
Applications Development
Pocket Communications
attached mail follows:
On Wed, November 15, 2006 10:44 am, TemuriI wrote:
> What I am trying to do is to write a set of classes that generate HTML
> code for HTML form elements (input type=text, textarea, hidden,
> buttons,
> etc).
Similar projects abound.
I generally find that by the time I'm done figuring out how it works,
and what it requires to type to get sort of what I want, but not
really, I'm better off just typing the dang HTML in the first place to
get exactly what I want, with less keystrokes than the OOP version.
YMMV
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
attached mail follows:
I'm behind on this list because we just finished up the 9th Annual
Jeff Buckley Tribute...
Anyway, wanted to clarify a mis-statement here, that nobody else
really seemed to clearly define...
On Tue, November 14, 2006 5:56 pm, Tom Ray [Lists] wrote:
> Roman Neuhauser wrote:
>> # cajbecu
gmail.com / 2006-11-14 20:17:16 +0200:
>>
>>> On 11/14/06, James Tu <jtu
esidesign.com> wrote:
>>>
>>>> I'm running a php script from the command line (I'm on OS X) and
>>>> I'm
>>>> getting ...
>>>>
>>>> Warning: mysql_connect(): Can't connect to local MySQL server
>>>> through
>>>> socket '/var/mysql/mysql.sock' (2)
>>>>
>>> touch /var/mysql/mysql.sock
>>> chmod 777 /var/mysql/mysql.sock
>>>
>>
>> How could that possibly help?
>>
> Because if the mysql.sock file is missing the mysql server won't
> start.
That is not correct.
When MySQL starts, it will create this file IF IT CAN.
If you have some user other than 'root' starting up mysql, and if that
user cannot create files in /var/mysql, then your "solution" would
kinda sorta "work" by root forcing a file to exist that MySQL had
tried, and failed, to create...
> If the mysql server isn't running the PHP script won't work. So I
> think
> it helps a lot.
Using 'touch' to create the file is almost-for-sure a Bad Idea.
Using chmod to be sure that both the user running the mysql process
the user running the web process can both read/write that file is
probably a correct solution for cases where the file creation was not
done correctly. Though I'm not sure 777 is the Best Answer... You'd
have to research that for yourself.
Of course, none of this applies at all to the situation of the OP, nor
of Apple's documented issue of having the mysql.sock file in the wrong
place.
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
attached mail follows:
On Tue, November 21, 2006 10:21 am, tedd wrote:
>>PS - we too have to live with your standards ;-)
>
> Nah, no one wants my code.
Not to be a jerk, but we still have to live with it.
For example, suppose, just for the sake of argument, that there was a
Security hole on your site that allowed your homepage to be replaced
by a malicious person.
That would imply that the malicious person could, had they so desired,
cause a great deal more damage not only to your site, but also to
everybody else's sites, simply by using your site as a new launch pad
for attacks.
:-) :-) :-) :-)
As you can see, to some degree, we are all reliant on each other, and
on the entire planet's goodwill and responsible coding.
This is a rather sobering idea, not just for you (and me) but for
anybody who gives this more than a few minutes of thought.
PS
I hope I put enough smilies in to make it clear I am not chastising
nor attacking you -- I merely want to point out that we are all
sharing the Internet, and all must be responsible for its upkeep, to
the best of our own abilities.
I know that's why we're all here on this list, and that everybody is
doing the best they can. I'm just saying that this is WHY it's
important to push ourselves for that "better"
understanding/solution/code.
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
attached mail follows:
At 2:53 PM -0600 11/21/06, Richard Lynch wrote:
>On Tue, November 21, 2006 10:21 am, tedd wrote:
>>>PS - we too have to live with your standards ;-)
>>
>> Nah, no one wants my code.
>
>Not to be a jerk, but we still have to live with it.
Alright already -- you're simply not going to allow me to get away
with my half-ass attempt at a joke. :-)
Your points are well taken.
>I know that's why we're all here on this list, and that everybody is
>doing the best they can. I'm just saying that this is WHY it's
>important to push ourselves for that "better"
>understanding/solution/code.
If you ever do see my code, you'll see it's very strict to following
my coding style (very similar style regardless of what language),
it's commented well, and I do have a good handle on security. It
seems that every time I ask a security question, I find that I'm
currently practicing the answers to avoid the pit-falls.
I know that clean code works better. With 30 years of pounding code,
this not my first time at the rodeo.
tedd
PS: No offense taken at all. :-)
--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
attached mail follows:
On Tue, 2006-11-21 at 16:19 -0500, tedd wrote:
> It seems that every time I ask a security question, I find that I'm
> currently practicing the answers to avoid the pit-falls.
Except that one time when his site got defaced... that was news ;) ;)
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. |
`------------------------------------------------------------'
attached mail follows:
On Sun, November 12, 2006 6:49 am, Tom Chubb wrote:
> This is a really stupid question, but I've not been able to find an
> answer for it.
> I have always thought that your max upload size is limited to the
> value in the php.ini file.
> However I recently changed a site to a new server which had problems
> with memory on one of the image resizing scripts.
> I managed to work around it by inserting one line at the start of the
> problem script:
>
> ini_set("memory_limit","32M");
>
> Can a similar thing be done with the upload_max_filesize?
>
> Assuming that it can't, what is a good workaround? Using FTP within a
> script?
> This is for uploading an audio file, typically 4MB.
> Thanks in advance,
As I recall, the upload_max_filesize was an "oddball" in that you
could never INCREASE it at any stage, but could only DECREASE it in
the following order:
php.ini
httpd.conf
.htaccess
That funky INPUT in the FORM that browsers ignore, but PHP uses.
So if your shared webhost set the limit to 2M in php.ini or
httpd.conf, and you only have .htaccess, you cannot crank up your
limit and over-ride your webhost quota/limit/cap.
At least, that was how it seemed to behave when I tested it rather
extensively back in PHP3.x days...
Hmmm, as I look at my list, I wonder if httpd.conf wouldn't kick in
before php.ini... Or maybe they "tie" and one can override the other
in httpd.conf at various nesting levels such as Directory and
VirtualHost. You're on your own for that level of detail in this
matter.
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
attached mail follows:
On Sat, November 11, 2006 3:26 pm, Google Kreme wrote:
> On 11 Nov 2006, at 12:38 , Ahmad Al-Twaijiry wrote:
>> I know that hotmail is filtering me as a possibly a spammer (because
>> I
>> use a shared mail server) and there is nothing I can do about this.
>
> Sure there is, move to a better neighborhood. And hotmail will not
> block you for being on a shared server unless the others on the
> shared server are spammers.
Correction:
...unless the others on the shared server are BELIEVED BY HOTMAIL TO
BE spammers.
Which, unfortunately, means that hotmail's stupid broken process for
identifying spammers blocks TONS of valid email.
I have given up on hotmail (and AOL, and Yahoo, and...) in this
regard. Anybody dumb enough to use such email vendor, deserves the
bad service they get, and can't use my site, if their activation email
doesn't get through. I'm tossing the problem right back on THEIR
vendor's desk where it belongs.
>> so I want to ask you if you have any solution for this ? how can I
>> (in
>> someway) make my scripts check if the email is valid and exists
>> email
>> before I register him without the need to send any password or
>> activation link to his email ?
>
> Well, you can do what some mail servers do, and try to connect to the
> MX for the domain and see if the username is accepted.
No.
Because of the spammers, some MX will lie, both ways, about whether
the email address is valid or not.
> Or, if this is a hotmail specific issue, you can not allow hotmail
> addresses.
No sense blocking them, as some users might actually get them to work.
You should focus on making your registration email LOOK less like spam.
No html-enhanced (cough, cough) email.
No "trigger" words that make it look like spam.
Valid subject.
Real name in the "From:"
etc.
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
attached mail follows:
Is it appropriate to ask your client to add "Powered by your company"
to the sites you design and maintain?
And when you see "Powered by" does it mean designed by or maintained
by or both?
On Nov 15, 2006, at 6:36 AM, Al wrote:
> Ed Lazor wrote:
>> I'm reading a book on CSS and how you can define different style
>> sheets for different visitors. I'm wondering how you guys do it.
>> The book recommends using Javascript functions for identifying the
>> user's browser and matching them with the corresponding style
>> sheets. Anyone using PHP for this instead - specifically with
>> defining style sheets for different target browsers and platforms?
>> -Ed
> I've found, that as a practical matter, the only browser these days
> that
> causes problems is IE6 because of it's non-compliance with some W3C
> standards.
>
> MS promises these are fixed in IE7.
>
> So I simply use $_SERVER['HTTP_USER_AGENT'] to determine if the
> client is IE6
> and either link in a special CSS file for it. Or if my styles are
> defined in
> the header, I replace the necessary selectors.
>
> There is no need to complicate things with JAVA script.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
attached mail follows:
On Wednesday 22 November 2006 00:02, pub wrote:
> Is it appropriate to ask your client to add "Powered by your company"
> to the sites you design and maintain?
> And when you see "Powered by" does it mean designed by or maintained
> by or both?
Leave them wondering ;)
>
> On Nov 15, 2006, at 6:36 AM, Al wrote:
> > Ed Lazor wrote:
> >> I'm reading a book on CSS and how you can define different style
> >> sheets for different visitors. I'm wondering how you guys do it.
> >> The book recommends using Javascript functions for identifying the
> >> user's browser and matching them with the corresponding style
> >> sheets. Anyone using PHP for this instead - specifically with
> >> defining style sheets for different target browsers and platforms?
> >> -Ed
> >
> > I've found, that as a practical matter, the only browser these days
> > that
> > causes problems is IE6 because of it's non-compliance with some W3C
> > standards.
> >
> > MS promises these are fixed in IE7.
> >
> > So I simply use $_SERVER['HTTP_USER_AGENT'] to determine if the
> > client is IE6
> > and either link in a special CSS file for it. Or if my styles are
> > defined in
> > the header, I replace the necessary selectors.
> >
> > There is no need to complicate things with JAVA script.
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
--
---
Børge
Kennel Arivene
http://www.arivene.net
---
attached mail follows:
On Tue, 2006-11-21 at 15:02 -0800, pub wrote:
> Is it appropriate to ask your client to add "Powered by your company"
> to the sites you design and maintain?
> And when you see "Powered by" does it mean designed by or maintained
> by or both?
That depends on what exactly you did. If you did a bunch of CSS I'd
hardly say that the site is "powered" by your work it may be more likely
that "designed by" works. Also if you are just maintaining someone
else's work then you might say "maintained by" or "managed by". If on
the other hand you wrote the Web server or the PHP lib that presents it
to the visitor then you might write "powered by". Moving along, if you
just glued together a bunch of API's not written by yourself, and you
didn't write the webserver either, you might just want to say "glued
together by". Finally, if you glued it together and your code sucks,
best just to go with "lesson learned by" -- unless of course you're an
idiot and you didn't learn anything by making a crappy site :B
Personally, if the customer pays me money to make a site, I don't put
dirty little ego fluffers on their pages... I put them in the HTML
comments or meta tags *heheh*.
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. |
`------------------------------------------------------------'
attached mail follows:
Hello,
I’m trying to use the imagejpeg function call in a php script and I
can’t quite seem to get it working properly.
Here is my gd dump.
'GD Version' => 'bundled (2.0.28 compatible)' (length=27)
'FreeType Support' => true
'FreeType Linkage' => 'with freetype' (length=13)
'T1Lib Support' => false
'GIF Read Support' => true
'GIF Create Support' => true
'JPG Support' => true
'PNG Support' => true
'WBMP Support' => true
'XPM Support' => false
'XBM Support' => true
'JIS-mapped J