php-general Digest 6 Apr 2008 15:02:15 -0000 Issue 5389
Topics (messages 272577 through 272588):
Re: How to jump to line number in large file
272577 by: Robert Cummings
Re: PostTrack Updates
272578 by: Robert Cummings
272580 by: bddarwin.gmail.com
272581 by: Robert Cummings
272583 by: Zoltán Németh
272584 by: Zoltán Németh
272585 by: Daniel Brown
Re: APC & FastCGI != upload progress ?
272579 by: Manuel Lemos
Re: Posting Summary for Week Ending 4 April, 2008: [EMAIL PROTECTED]
272582 by: Zoltán Németh
272587 by: Daniel Brown
Re: Dynamic dropdown lists (select)
272586 by: tedd
objects stored in sessions
272588 by: Mark Weaver
Administrivia:
To subscribe to the digest, e-mail:
[EMAIL PROTECTED]
To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]
To post to the list, e-mail:
[EMAIL PROTECTED]
----------------------------------------------------------------------
--- Begin Message ---
On Sat, 2008-04-05 at 16:19 -0700, Jim Lucas wrote:
> Robert Cummings wrote:
> >>
> >> - Taking away the unnecessary fseek() made the script execute in 63 seconds
> >> - Using a buffer system, (reading in 1Mb of the text file at a time and
> >> then
> >> looping through the string in memory) made the script execute in 36
> >> seconds.
> >> Huge improvement, but...
> >> - Porting the code to C++, doing a shell_exec and reading the results back
> >> in to PHP, took less than 2 seconds.
> >>
> >> As fgetc() etc are all effectively C wrappers I was quite surprised at the
> >> speed increase....
> >
> > It really depends on how you write your code... I ran the following
> > script on a 150 meg text log file containing 1905883 lines in 4 seconds
> > (note that it performs caching). Here's the script:
> >
> > <?php
> >
> > $path = $argv[1];
> >
> > if( ($fPtr = fopen( $path, 'r' )) === false )
> > {
> > echo "Couldn't open for reading: $path\n";
> > exit();
> > }
> >
> > $line = 1;
> > $lines[$line] = 0;
> >
> > while( fgets( $fPtr ) !== false )
> > {
> > $lines[++$line] = ftell( $fPtr );
> > }
>
> couldn't you get away from incrementing a counter variable by simply
> starting the array at index #1 ??
>
> $lines[1] = 0;
>
> while( fgets( $fPtr ) !== false )
> {
> $lines[] = ftell( $fPtr );
> }
>
> Wouldn't this make it faster?
Good catch. I drop about .2 seconds on my previous tests when I do that.
Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP
--- End Message ---
--- Begin Message ---
On Sat, 2008-04-05 at 21:54 -0400, Daniel Brown wrote:
> <?php
> $enough = 'enough';
> ?>
Hmmm...
<?php
!$bloodyLikely
?>
Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP
--- End Message ---
--- Begin Message ---
<?php
$stfu = true;
if($stfu == true) {
stop_posting( );
}else{
post( );
}
?>
Original Message:
-----------------
From: Robert Cummings [EMAIL PROTECTED]
Date: Sat, 05 Apr 2008 22:14:44 -0400
To: [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED],
[EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED]
Subject: Re: [PHP] PostTrack Updates
On Sat, 2008-04-05 at 21:54 -0400, Daniel Brown wrote:
> <?php
> $enough = 'enough';
> ?>
Hmmm...
<?php
!$bloodyLikely
?>
Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--------------------------------------------------------------------
mail2web - Check your email from the web at
http://link.mail2web.com/mail2web
--- End Message ---
--- Begin Message ---
On Sat, 2008-04-05 at 22:54 -0400, [EMAIL PROTECTED] wrote:
> <?php
> $stfu = true;
> if($stfu == true) {
> stop_posting( );
> }else{
> post( );
> }
> ?>
Please don't top-post. It makes it hard to follow the discussion :B
Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP
--- End Message ---
--- Begin Message ---
Daniel Brown írta:
Some changes take effect with the PostTrack metrics system with
this week (will show up in next week's report). There's one bug fix
and a new feature added, in which some of you may be really
interested.
CHANGELOG
Fixed a bug that would (seemingly random) split a user's post
recording over multiple entries. (See this week's report: Zoltan
Nemeth for example)
oh I see. ignore my previous error report ;)
Added a new CodeCount feature. Explained below.
The CodeCount feature will, from now on, track the amount of
[pseudo]code everyone posts to the list. However, for a variety of
reasons (including enforcing Good Coding Practices[tm], there will be
some rules:
* short_open_tags code will not be counted. It must begin
with <?php, not <?, and <?=$variable;?> things won't count.
* All code must be properly closed as well as opened. Thus,
<?php must be followed by ?>.
* You can include multiple blocks of code, and all will be tallied. So:
<?php
// Block one
?>
.... and ....
<?php
// Block two
?>
.... will both be counted.
Some notes that should be obvious:
* HTML won't be counted unless included in an echo/print
construct or a HEREDOC/NOWDOC (when used). Only the code between the
<?php and ?> tags will be counted.
* The CodeCount procedure *does* count comments as code. This
can be changed if there's enough desire.
* CodeCount *will not* differentiate between "Good" and "Bad"
code. If you forget a semicolon, it'll still count.
that's a cool feature!
greets,
Zoltán Németh
--- End Message ---
--- Begin Message ---
Jason Pruim írta:
On Apr 5, 2008, at 1:48 AM, Robert Cummings wrote:
On Fri, 2008-04-04 at 22:39 -0700, Jim Lucas wrote:
Robert Cummings wrote:
<?php echo "On Fri, 2008-04-04 at 17:23 -0400, Daniel Brown
wrote:\n" ?>
<?php echo "> Some changes take effect with the PostTrack metrics\n" ?>
<?php echo "> system with this week (will show up in next week's\n" ?>
<?php echo "> report). There's one bug fix and a new feature added,
\n" ?>
<?php echo "> in which some of you may be really interested.\n" ?>
<?php echo ">\n" ?>
<?php echo "> CHANGELOG\n" ?>
<?php echo "\n" ?>
<?php echo "> Fixed a bug that would (seemingly random)\n" ?>
<?php echo "> split a user's post recording over multiple
entries.\n" ?>
<?php echo "> (See this week's report: Zoltan Nemeth for example)\n" ?>
<?php echo "> Added a new CodeCount feature. Explained\n" ?>
<?php echo "> below.\n" ?>
<?php echo ">\n" ?>
<?php echo "> The CodeCount feature will, from now on, track\n" ?>
<?php echo "> the amount of [pseudo]code everyone posts to the\n" ?>
<?php echo "> list. However, for a variety of reasons (including\n" ?>
<?php echo "> enforcing Good Coding Practices[tm], there will be\n" ?>
<?php echo "> some rules:\n" ?>
<?php echo ">\n" ?>
<?php echo "> * short_open_tags code will not be counted.\n" ?>
<?php echo "> It must begin with <?php, not <?, and\n" ?>
<?php echo "> <?=\$variable;?> things won't count.\n" ?>
<?php echo "> * All code must be properly closed as well as
\n" ?>
<?php echo "> opened. Thus, <?php must be followed
by ?>.\n" ?>
<?php echo "> * You can include multiple blocks of code,\n" ?>
<?php echo "> and all will be tallied. So:\n" ?>
<?php echo "> <?php\n" ?>
<?php echo "> // Block one\n" ?>
<?php echo "> ?>\n" ?>
<?php echo "> .... and ....\n" ?>
<?php echo "> <?php\n" ?>
<?php echo "> // Block two\n" ?>
<?php echo "> ?>\n" ?>
<?php echo "> .... will both be counted.\n" ?>
<?php echo ">\n" ?>
<?php echo "> Some notes that should be obvious:\n" ?>
<?php echo "> * HTML won't be counted unless included in an
\n" ?>
<?php echo "> echo/print construct or a HEREDOC/NOWDOC\n" ?>
<?php echo "> (when used). Only the code between the\n" ?>
<?php echo "> <?php and ?> tags will be counted.\n" ?>
<?php echo "> * The CodeCount procedure *does* count\n" ?>
<?php echo "> comments as code. This can be changed if\n" ?>
<?php echo "> there's enough desire.\n" ?>
<?php echo "> * CodeCount *will not* differentiate
between\n" ?>
<?php echo "> \"Good\" and \"Bad\" code. If you forget
a\n" ?>
<?php echo "> semicolon, it'll still count.\n" ?>
<?php echo ">\n" ?>
<?php echo "> --\n" ?>
<?php echo "> </Daniel P. Brown>\n" ?>
<?php echo "> Ask me about:\n" ?>
<?php echo "> Dedicated servers starting @ \$59.99/mo., VPS\n" ?>
<?php echo "> starting @ \$19.99/mo., and shared hosting starting @
\n" ?>
<?php echo "> \$2.50/mo. Unmanaged, managed, and fully-managed!\n" ?>
I don't know about anyone else, but I am absolutely stoked about this
development!
Cheers,
Rob.
wait you forgot the semi-colon... ah, that's right, he said grammar
mistakes were not counted...
Perfectly valid to omit the last semi-colon when closing a PHP block.
<?PHP echo 'So does the new code count all quoted code as well? :)';?>
<?PHP echo 'If so... Then we are going to have a ton of code to start
with!';?>
<?php echo "Just continue answering to this topic.\n"; ?>
<?php echo "The last answer wins the weeks 'most code' award :)";?>
greets,
Zoltán Németh
:)
;)
Cheers,
Rob.
--http://www.interjinn.com
Application and Templating Framework for PHP
--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
--- End Message ---
--- Begin Message ---
On Sat, Apr 5, 2008 at 10:54 PM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> <?php
> $stfu = true;
> if($stfu == true) {
> stop_posting( );
> }else{
> post( );
> }
> ?>
Fatal Error: Undefined function stop_posting().
--
</Daniel P. Brown>
Ask me about:
Dedicated servers starting @ $59.99/mo., VPS starting @ $19.99/mo.,
and shared hosting starting @ $2.50/mo.
Unmanaged, managed, and fully-managed!
--- End Message ---
--- Begin Message ---
Hello,
on 04/04/2008 03:16 AM steve said the following:
> FastCGI is *the* way to run PHP, but I think Apache is not the
> platform for it anymore.
If need more than one server, Apache pre-forked model may limited.
Otherwise it is just fine. Other than that, I think there are some
features that only work with Apache SAPI.
> Is the COMMET implementation on the client side long polling
> (reconnect) or does it stream using script tags? What goes on in the
> server? Does it push the buffer of blank data that WebKit requires? Is
> it a PHP daemon process running as a simple HTTP server?
Actually it is just an hidden iframe that loads an HTML page with small
Javascript chunks that flush each COMET AJAX server response. This is a
regular HTTP request performed to the same script that serves that form.
The form AJAX plug-in can detect the AJAX request and respond
adequately. So it works equally well in all browsers including Webkit.
> On Wed, Apr 2, 2008 at 12:09 AM, Manuel Lemos <[EMAIL PROTECTED]> wrote:
>> Hello,
>>
>> on 03/30/2008 02:52 PM steve said the following:
>>
>>> Hmmm... I am working on a PHP daemon for comet style connections...
>> > I'll keep that idea in mind. I guess that using Flash is best solution
>> > at the moment.. at least the only one I have working...
>>
>> I implement COMET connections with plain HTML with an hidden iframe.
>> Actually I have been using that for a upload progress meter among other
>> AJAX uses. Actually it is an AJAX plug-in of this forms class:
>>
>> http://www.phpclasses.org/formsgeneration
>>
>> Here is an example of a form upload progress done all in PHP and plain HTML:
>>
>>
>> http://www.meta-language.net/forms-examples.html?example=test_upload_progress
>>
>> Here you can watch a tutorial video that explains the COMET AJAX
>> implementation:
>>
>> http://www.phpclasses.org/browse/video/1/package/1/section/plugin-ajax.html
--
Regards,
Manuel Lemos
PHP professionals looking for PHP jobs
http://www.phpclasses.org/professionals/
PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/
--- End Message ---
--- Begin Message ---
PostTrack [Dan Brown] írta:
> 10 (3.4%) 33529 (8.5%) Zoltán Németh <znemeth at
alterationx dot hu>
> 1 (0.3%) 2502 (0.6%) Zoltán Németh <znemeth at
alterationx dot hu>
what's the difference? they should be added up, no?
greets,
Zoltán Németh
--- End Message ---
--- Begin Message ---
On Sun, Apr 6, 2008 at 7:31 AM, Zoltán Németh <[EMAIL PROTECTED]> wrote:
> PostTrack [Dan Brown] írta:
> > 10 (3.4%) 33529 (8.5%) Zoltán Németh <znemeth at
> alterationx dot hu>
> > 1 (0.3%) 2502 (0.6%) Zoltán Németh <znemeth at
> alterationx dot hu>
>
>
> what's the difference? they should be added up, no?
Yes. Next week's report (and from there-on) should resolve that
once and for all.
By the way, I don't remember seeing you report that issue before.
Just the character problems.
--
</Daniel P. Brown>
Ask me about:
Dedicated servers starting @ $59.99/mo., VPS starting @ $19.99/mo.,
and shared hosting starting @ $2.50/mo.
Unmanaged, managed, and fully-managed!
--- End Message ---
--- Begin Message ---
At 12:51 PM +0200 4/4/08, Angelo Zanetti wrote:
Hi all,
I am looking at options for creating a dynamic dropdown list.
Angelo
Try this:
http://webbytedd.com/cc/dynamic-option/index.php
The javascript is there:
http://webbytedd.com/cc/dynamic-option/a.js
Cheers,
tedd
--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
--- End Message ---
--- Begin Message ---
Hi All,
I've got something on my little mind, and please keep in mind I'm still
somewhat new to PHP Oop, so please excuse my silly ass if I ask
something that should be obvious.
I've got an application that I'm re-writing from PERL to PHP Oop. At the
beginning of the application, at log in, a session is created for this
user. What I would like to do is create a user object and store object
properties in that session.
So, if I create a user object, set the properties of said user object
and store that object in the user session will that object be available
throughout the application from the session?
thanks,
--
Mark
-------------------------
the rule of law is good, however the rule of tyrants just plain sucks!
Real Tax Reform begins with getting rid of the IRS.
==============================================
Powered by CentOS5 (RHEL5)
--- End Message ---