php-general Digest 7 May 2005 13:18:21 -0000 Issue 3440
Topics (messages 214657 through 214670):
Re: Reducing size of htm output
214657 by: Marek Kilimajer
214659 by: Rory Browne
214661 by: M. Sokolewicz
214664 by: Dotan Cohen
214666 by: Dotan Cohen
buffering headers before send
214658 by: Claudio
214660 by: M. Sokolewicz
214665 by: Claudio
Re: compiling dynamic extensions without root access
214662 by: Dan Rossi
expression between vertical bars
214663 by: Jan
214667 by: Matthew Weier O'Phinney
Java in PHP5
214668 by: Dan Rossi
Re: PHP 5, mySQL and Win XP. I NEED HELP
214669 by: Deep
Random but ordered..
214670 by: Ryan A
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 ---
Kirsten wrote:
preg_replace('/s+/', ' ', $html);
but watch out, this js code will work:
var v
alert(v)
this one will not:
var v alert(v)
Sure....
but now: how do I access the htm output of the current executing script
before it is send to the user?
output buffering
--- End Message ---
--- Begin Message ---
First of all as Rasmus said, this 'compression' is barely(if at all)
going to make a difference, after your pages have been compressed wth
gzip,
There are two reasons for this:
1 compression techniques detect repeated strings(such as spaces or
newlines), and replaces them with one instance of that string, and a
record of how many times it appears.
2 Because Rasmus said so, and considering his long-time involvement
with the php project(as founder), he probably knows what he'e talking
about.
What might be more useful is stripping out comments, If you don't use
javascript it is simply a case of replacing all <!-- anything --> with
a blank space. If you do though it's more complicated since it is
considered good practice to place js inside <!-- .. //--> blocks, and
you have the additional talk of replacing out // and /* .. */
comments.
but if you really want to do it then:
function ob_whitespace_removal($str){
// would need to dbl_check regex/modifiers
return ob_gzhandler(preg_replace("/\s+/m", " ", $str));
}
should work, Although for purists/modularity output buffer stacking
may be a cleaner technique
Re: Internet Explorer Problems:
if you check the ob_start or ob_gzhandler pages on the php
manual(online version) then you'll find a user-submitted comment
saying that MSIE doesn't cache compressed stuff. This doesn't matter
for a dynamic website. Try googling, but don't say ob_gzhandler, since
this is (allegedly) a problem with IE/gzip compatability, and not the
ob_gzhandler implemention(ie search for gzip and not ob_gzhandler).
On 5/7/05, Kirsten <[EMAIL PROTECTED]> wrote:
> >preg_replace('/s+/', ' ', $html);
> >
> > but watch out, this js code will work:
> >
> > var v
> > alert(v)
> >
> > this one will not:
> >
> > var v alert(v)
>
> Sure....
> but now: how do I access the htm output of the current executing script
> before it is send to the user?
>
> Thanks again
>
> >
> > >
> > > 1) Is there any function to do this (I'm using PHP 4.2) ? Or maybe some
> user
> > > has already done it?
> > > 2) Is it true that ob_start("ob_gzhandler") can cause problems on IE
> 5.5+?
> >
> > don't know. but you can detect these browsers and turn compression off
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--- End Message ---
--- Begin Message ---
Rory Browne wrote:
First of all as Rasmus said, this 'compression' is barely(if at all)
going to make a difference, after your pages have been compressed wth
gzip,
There are two reasons for this:
1 compression techniques detect repeated strings(such as spaces or
newlines), and replaces them with one instance of that string, and a
record of how many times it appears.
2 Because Rasmus said so, and considering his long-time involvement
with the php project(as founder), he probably knows what he'e talking
about.
What might be more useful is stripping out comments, If you don't use
javascript it is simply a case of replacing all <!-- anything --> with
a blank space. If you do though it's more complicated since it is
considered good practice to place js inside <!-- .. //--> blocks,
excuse me? since when is this considered /good/ practice???
It's one of those things that are concidered /bad/ practice according to
w3...
and
you have the additional talk of replacing out // and /* .. */
comments.
but if you really want to do it then:
function ob_whitespace_removal($str){
// would need to dbl_check regex/modifiers
return ob_gzhandler(preg_replace("/\s+/m", " ", $str));
}
should work, Although for purists/modularity output buffer stacking
may be a cleaner technique
Re: Internet Explorer Problems:
if you check the ob_start or ob_gzhandler pages on the php
manual(online version) then you'll find a user-submitted comment
saying that MSIE doesn't cache compressed stuff. This doesn't matter
for a dynamic website. Try googling, but don't say ob_gzhandler, since
this is (allegedly) a problem with IE/gzip compatability, and not the
ob_gzhandler implemention(ie search for gzip and not ob_gzhandler).
On 5/7/05, Kirsten <[EMAIL PROTECTED]> wrote:
preg_replace('/s+/', ' ', $html);
but watch out, this js code will work:
var v
alert(v)
this one will not:
var v alert(v)
Sure....
but now: how do I access the htm output of the current executing script
before it is send to the user?
Thanks again
1) Is there any function to do this (I'm using PHP 4.2) ? Or maybe some
user
has already done it?
2) Is it true that ob_start("ob_gzhandler") can cause problems on IE
5.5+?
don't know. but you can detect these browsers and turn compression off
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
On 5/7/05, M. Sokolewicz <[EMAIL PROTECTED]> wrote:
> Rory Browne wrote:
>
> > First of all as Rasmus said, this 'compression' is barely(if at all)
> > going to make a difference, after your pages have been compressed wth
> > gzip,
> >
> > There are two reasons for this:
> > 1 compression techniques detect repeated strings(such as spaces or
> > newlines), and replaces them with one instance of that string, and a
> > record of how many times it appears.
> > 2 Because Rasmus said so, and considering his long-time involvement
> > with the php project(as founder), he probably knows what he'e talking
> > about.
> >
> > What might be more useful is stripping out comments, If you don't use
> > javascript it is simply a case of replacing all <!-- anything --> with
> > a blank space. If you do though it's more complicated since it is
> > considered good practice to place js inside <!-- .. //--> blocks,
> excuse me? since when is this considered /good/ practice???
> It's one of those things that are concidered /bad/ practice according to
> w3...
>
> and
> > you have the additional talk of replacing out // and /* .. */
> > comments.
> >
> > but if you really want to do it then:
> >
> > function ob_whitespace_removal($str){
> > // would need to dbl_check regex/modifiers
> > return ob_gzhandler(preg_replace("/\s+/m", " ", $str));
> > }
> >
> > should work, Although for purists/modularity output buffer stacking
> > may be a cleaner technique
> >
> > Re: Internet Explorer Problems:
> > if you check the ob_start or ob_gzhandler pages on the php
> > manual(online version) then you'll find a user-submitted comment
> > saying that MSIE doesn't cache compressed stuff. This doesn't matter
> > for a dynamic website. Try googling, but don't say ob_gzhandler, since
> > this is (allegedly) a problem with IE/gzip compatability, and not the
> > ob_gzhandler implemention(ie search for gzip and not ob_gzhandler).
> >
> >
> > On 5/7/05, Kirsten <[EMAIL PROTECTED]> wrote:
> >
> >>>preg_replace('/s+/', ' ', $html);
> >>>
> >>>but watch out, this js code will work:
> >>>
> >>>var v
> >>>alert(v)
> >>>
> >>>this one will not:
> >>>
> >>>var v alert(v)
> >>
> >>Sure....
> >>but now: how do I access the htm output of the current executing script
> >>before it is send to the user?
> >>
> >>Thanks again
> >>
> >>
> >>>>1) Is there any function to do this (I'm using PHP 4.2) ? Or maybe some
> >>
> >>user
> >>
> >>>>has already done it?
> >>>>2) Is it true that ob_start("ob_gzhandler") can cause problems on IE
> >>
> >>5.5+?
> >>
> >>>don't know. but you can detect these browsers and turn compression off
> >>
> >>--
> >>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
>
>
Dotan Cohen
http://LyricsList.com/
http://Music-Liriks.com/
--- End Message ---
--- Begin Message ---
On 5/7/05, M. Sokolewicz <[EMAIL PROTECTED]> wrote:
> Rory Browne wrote:
>
> > First of all as Rasmus said, this 'compression' is barely(if at all)
> > going to make a difference, after your pages have been compressed wth
> > gzip,
> >
> > There are two reasons for this:
> > 1 compression techniques detect repeated strings(such as spaces or
> > newlines), and replaces them with one instance of that string, and a
> > record of how many times it appears.
> > 2 Because Rasmus said so, and considering his long-time involvement
> > with the php project(as founder), he probably knows what he'e talking
> > about.
> >
> > What might be more useful is stripping out comments, If you don't use
> > javascript it is simply a case of replacing all <!-- anything --> with
> > a blank space. If you do though it's more complicated since it is
> > considered good practice to place js inside <!-- .. //--> blocks,
>
> excuse me? since when is this considered /good/ practice???
> It's one of those things that are concidered /bad/ practice according to
> w3...
Stripping out the comments from the source (file.php) is bad. But I
see no reason why not to strip them out from the output to the user.
Most users would never see them. And those that would- are probably
trying to reverse-engineer your site anyway.
For debugging, you could simply comment out the comment-parser.
Dotan Cohen
http://LyricsList.com/
http://Music-Liriks.com/
--- End Message ---
--- Begin Message ---
Hi,
is there a way to buffering headers before sending like "ob_start()" ?
Thanks,
Claudio
--- End Message ---
--- Begin Message ---
Claudio wrote:
Hi,
is there a way to buffering headers before sending like "ob_start()" ?
Thanks,
Claudio
ob_start buffers both `normal` output AND headers.
--- End Message ---
--- Begin Message ---
"M. Sokolewicz" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
> ob_start buffers both `normal` output AND headers.
Humm, now it works...
Is there something else that must be set, so that ob_start() works or not?
Something like an php.ini entry?
Here is the listing of ob_start.php5
<?php
ob_start();
echo "hallo first<BR>";
$x = ob_get_clean();
ob_start();
header("X-Sample-Test: foo");
$h[0] = headers_sent();
$h[1] = headers_list();
echo "hallo second<BR>";
echo $x;
$x = ob_get_clean();
ob_start();
echo "hallo third<BR>";
echo $x;
header("X-Sample-Test: foo2");
$h[2] = headers_sent();
$h[3] = headers_list();
ob_end_flush();
echo "<PRE>";
var_dump($h);
echo "</PRE>";
?>
--- End Message ---
--- Begin Message ---
On 07/05/2005, at 3:16 AM, Rory Browne wrote:
It depends:
What webserver are you using?
PHP/Apache will let you load extensions using .htaccess, which can be
your own extensions, located in a directory that you have write access
to. I've never tried it but something like
php_extension_dir /home/yourname/php_extensions
php_extension your_php_extension.so
should do the trick.
If you don't mind modding your php code, to take account of the fact
that these extensions aren't available by default, you can create a
function to load dynamic modules, using the extension_loaded() and
dl() functions (see the examples on www.php.net/dl ). Bare in mind
that this will not run in certain webservers, noteably Zeus, and IIS.
Its apache 1.3, 2.0 is not a goer until threading support is available
unless it is already ? What I was asking is, are we able to run say
phpize as a non root user and build a module that can be dynamically
loaded ? I wouldnt mind checking out the PHP5 soap extension , but
getting an admin to install it will take forever. Lemme know thanks.
--- End Message ---
--- Begin Message ---
Hello,
Could someone explain to me the use of the vertical bar in
expressions like "|<[^>]+>(.*)</[^>]+>|U". I understand that the
vertical bars are used to separate the expression from the modifier,
but can't find any documentation about the reasons and rules to do
this.
Thanks, Jan
--- End Message ---
--- Begin Message ---
* Jan <[EMAIL PROTECTED]>:
> Could someone explain to me the use of the vertical bar in
> expressions like "|<[^>]+>(.*)</[^>]+>|U". I understand that the
> vertical bars are used to separate the expression from the modifier,
> but can't find any documentation about the reasons and rules to do
> this.
This works in the PCRE functions, and has to do with the P in PCRE --
Perl. In perl, when performing a regexp, you can use whatever character
you desire to act as 'quotes' surrounding it. The typical one is a
forward slash, but when you are going to be matching forward slashes,
this can be inconvenient (the following examples are all perl, with a
PHP version follwing):
if ( /http:\/\/www.php.net\// ) # perl
if (preg_match('/http:\/\/www.php.net\//', $url)) # PHP
You get what's called 'leaning toothpick' syndrome. So, to make things
easier, you can specifiy a different regex delimiter:
if ( m|http://www.php.net| ) # perl
if (preg_match('|http://www.php.net|', $url) # PHP
(In perl, the 'm' indicates you're doing a match operation, and needs to
be present if you're using a delimiter other than a slash; it's not
necessary in PHP as it's implied.)
The modifier occurs after the delimiters -- and this can happen
regardless of delimiter:
if ( m|http://www.php.net|U ) # perl
if (preg_match('|http://www.php.net|U', $url) # PHP
if ( /http:\/\/www.php.net\//U ) # perl
if (preg_match('/http:\/\/www.php.net\//U', $url) # PHP
If you want more information on this, pick up a copy of "Mastering
Regular Expressions" or "Programming Perl", both from O'Reilly Press.
--
Matthew Weier O'Phinney | WEBSITES:
Webmaster and IT Specialist | http://www.garden.org
National Gardening Association | http://www.kidsgardening.com
802-863-5251 x156 | http://nationalgardenmonth.org
mailto:[EMAIL PROTECTED] | http://vermontbotanical.org
--- End Message ---
--- Begin Message ---
Ok So I am looking at two possibilities of java integration, one via
command line and one using the extension. I dont particularly want the
experimental pecl extensions in my php therefore I want it dynamically
loaded. I cant for the life of me find the Java extension, would anyone
know where to find it ? Its not on the pecl site ? Let me know thanks.
--- End Message ---
--- Begin Message ---
Hi,
If you are using localhost, i dont think u need to
specify the port number. Localhost would be enough.
Also pls check the user privileges and all in the
database.
..Deep..
--- Oscar Andersson <[EMAIL PROTECTED]>
wrote:
> I have made a instal of the latest mySQL and PHP 5
> on my computer.
> I have made the following changes to my php.ini file
>
> extension=php_mysql.dll
> extension_dir = "c:\php\"
>
> and i have put the php_mysql. and libmysql.dll in
> c:\php\ and in c:\windows
> to
>
> Now i try this in my php-file
> $con = mysql_connect("localhost:3306", "buddy",
> "bestbuddy");
>
> I cant connect to mySQL. I dont know what is wrong.
> mySQL listen to port
> 3306. I have tried with my IP to. I get this warning
> Warning: mysql_connect() [function.mysql-connect]:
> Too many open links (0)
> in myfilename.php.
>
>
> I hope for help
> Oscar Andersson
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
________________________________________________________________________
Yahoo! India Matrimony: Find your life partner online
Go to: http://yahoo.shaadi.com/india-matrimony
--- End Message ---
--- Begin Message ---
Hey,
I have been screwing around with this code for around a day and am hitting a
wall, any
help would be appreciated.
Basically, I am working on a site that queries the DB for companies and the
plans the company
is offering, the DB is quite big (a few thousand records in each of the 20
tables)
The parameters are taken from the client in the form of a search box and
usually gives around 1000 results per query, they results are then displayed
like this:
company 1
[] plan
[] plan
[] plan
[] plan
company 2
[] plan
[] plan
[] plan
company 3
[] plan
company 4
[] plan
[] plan
So far, no problems (even though the code and the design are mixed together
in the page)
but so far the code is getting the results grouping via $cno, which results
in the lowest being displayed first which gives the first companies who
joined an edge as they are always getting displayed.
Heres the kicker, he wants to have the same display as above....but randomly
from the DB *while still* having pagination.. so new joined companies too
get displayed and not shoved at the end of the results.
To see the code used presently (stripped down to a few lines) :
http://jappz.com/testing.phpp
To see the output from the above :
http://jappz.com/testing.html
Any suggestions, classes, code, links or general help would be appreciated.
Thanks,
Ryan
--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.11.6 - Release Date: 5/6/2005
--- End Message ---