php-general Digest 15 Oct 2007 06:31:34 -0000 Issue 5073

Topics (messages 263195 through 263205):

Re: Timeout for fopen ?
        263195 by: Gal

gd with php 5.2.4
        263196 by: xx
        263200 by: zerof

Re: Fast prefix search?
        263197 by: tedd
        263202 by: Nathan Nobbe

strtolower doesn't work for character "Ô"
        263198 by: debussy007
        263199 by: debussy007
        263201 by: debussy007

HTML Parse Issue
        263203 by: admin.buskirkgraphics.com
        263204 by: Tom Ray [Lists]

please advise
        263205 by: Louise Sanders

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 ---
You can use the CURL module, which has support for timeout.
http://www.php.net/manual/en/ref.curl.php

debussy007 wrote:
> Hello,
> 
> I want to use "fopen" to open an URL, but is it possible to add a timeout ? 
> This to avoid that fopen slows down my script ?
> Because if site I access takes 10 secs to respond, 
> I suppose my script will just wait fopen returns something.
> 
> Thank you.

--- End Message ---
--- Begin Message ---
Help!
I'm using php version 5.2.4 and I'm not able to even get a pointer to a jpg
image (ImageCreateFromJPEG(filename)).
When I do so the program exits ...
Can anybody help me, please?

--- End Message ---
--- Begin Message ---
xx escreveu:
Help!
I'm using php version 5.2.4 and I'm not able to even get a pointer to a jpg
image (ImageCreateFromJPEG(filename)).
When I do so the program exits ...
Can anybody help me, please?
-------------
http://www.educar.pro.br/en/a/gdlib/index.php?pn=15&tr=97

--
zerof
http://www.educar.pro.br/
Apache - PHP - MySQL - Boolean Logics - Project Management
----------------------------------------------------------
Você deve, sempre, consultar uma segunda opinião!
----------------------------------------------------------
Deixe todos saberem se esta informação foi-lhe útil.
----------------------------------------------------------      
You must hear, always, one second opinion! In all cases.
----------------------------------------------------------
Let the people know if this info was useful for you!
----------------------------------------------------------

--- End Message ---
--- Begin Message ---
At 11:32 AM +0900 10/14/07, js wrote:
Threre seems no easy solution for this job.
The best bet could be to write up do-it-your-self B-tree
implementation in PHP...

I have not been following this thread, so please excuse my post if this has been covered or if I'm off-base, but why not just use MySQL?

While I have not written a B-Tree, I have written a binary tree -- if you have a Mac you can review the demo and documentation here:

http://sperling.com/freeware.php

-- and that was not a small task, at least for me. I used a splay to keep in balanced and current.

So before I would venture out and rewrite that for php, I would exhaust all possibilities of using MySQL first.

Cheers,

tedd

--
-------
http://sperling.com  http://ancientstones.com  http://earthstones.com

--- End Message ---
--- Begin Message ---
On 10/13/07, js <[EMAIL PROTECTED]> wrote:
>
> On 10/14/07, Nathan Nobbe <[EMAIL PROTECTED]> wrote:
> > how big is your dataset; have you tested against a potential data set
> and
> > gotten
> > long execution times?
>
> The dataset consists of about several million lines
> and I've tested script like above against the dataset.
> it took almost a hour.
> (perl script that uses set_range finished the job within 2 minutes)
>
> > notice how i used strpos rather than strstr, because i got this tip from
> the
> > docs
> > Note: If you only want to determine if a particular needle occurs within
> > haystack,
> > use the faster and less memory intensive function strpos() instead.
>
> On 10/14/07, Robert Cummings <[EMAIL PROTECTED]> wrote:
> > So don't use strstr() use strpos(). Specifically use it like follows:
> >
> >     if( strpos( $haystack, $prefix ) === 0 )
> >     {
> >         // it's a prefix.
> >     }
> >
>
> Great tip. Thank you!
>
> > there are some optimization points as well.  if you use a for loop, i
> think
> > it
> > will run a hair faster than the foreach, just make sure to store the
> length
> > of the
> > dictionary in an variable and use that as the sentinel control variable.
> > also, if
> > your search can be case insensitive you can use stripos instead of
> strpos,
> > that will
> > probly get you a little speed bump as well.
>
> I'll try.
>
> > if the string methods in a loop are too doggy due to the size of your
> > datasets,
> > you might write a program that uses berkdb and call it using the shell
> from
> > within php.
>
> that seems a shellscript...
>

yes, you could write a program in c and call it via the shell from within
php.
say you had a program findPrefixes, and it takes as an argument a file
containing the
dictionary to search and it spits out a filename of the matches (which it
creates).
 there would be several optionsto call it from within php.
i would use the backticks; something like this:

$matchFile = `findPrefixes $dictionaryFile`;
$matches = file($matchFlie);

if you write it in c the chances of beating out the perl script are good.

also, if youre considering a database solution (rdbms), i recommend
sqlite3.  its not
nearly as heavy as a server based solution.

-nathan

--- End Message ---
--- Begin Message ---
Hello,

strtolower(...) returns a weird character when i try to convert upper case Ô
to ô,

can anyone help ?

Thank you !
-- 
View this message in context: 
http://www.nabble.com/strtolower-doesn%27t-work-for-character-%22%C3%94%22-tf4621862.html#a13199296
Sent from the PHP - General mailing list archive at Nabble.com.

--- End Message ---
--- Begin Message ---

I have also tried to enable Multibyte string feature,
and tried the following :
echo mb_strtolower ( 'Ô' ) . '<br>';
But it still gives me a weird character.
My page is also UTF-8 encoded.


debussy007 wrote:
> 
> Hello,
> 
> strtolower(...) returns a weird character when i try to convert upper case
> Ô to ô,
> 
> can anyone help ?
> 
> Thank you !
> 

-- 
View this message in context: 
http://www.nabble.com/strtolower-doesn%27t-work-for-character-%22%C3%94%22-tf4621862.html#a13199478
Sent from the PHP - General mailing list archive at Nabble.com.

--- End Message ---
--- Begin Message ---
Nevermind, didn't see second param of mb_strtolower function which let you
specify encoding type.


debussy007 wrote:
> 
> 
> I have also tried to enable Multibyte string feature,
> and tried the following :
> echo mb_strtolower ( 'Ô' ) . '<br>';
> But it still gives me a weird character.
> My page is also UTF-8 encoded.
> 
> 
> debussy007 wrote:
>> 
>> Hello,
>> 
>> strtolower(...) returns a weird character when i try to convert upper
>> case Ô to ô,
>> 
>> can anyone help ?
>> 
>> Thank you !
>> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/strtolower-doesn%27t-work-for-character-%22%C3%94%22-tf4621862.html#a13200077
Sent from the PHP - General mailing list archive at Nabble.com.

--- End Message ---
--- Begin Message ---
I am having a issue parsing an html file. 

I want to pull all the data between two html tags.

 

Problem I am having is that no matter what I try  I can pull either tag or
both but not the data in between.

<div class="record" id="one">

                <div class="rideon">

                                <h2>

                                                <span>Welcome to
Rideon</span>

                                </h2>

                </div>

</div>

</div class="record" id="one">

 

function datamatch($document)

{

                preg_match_all('/<div class="record" [^<>]*>(.*)/<\/div
class="record" [^<>]*>/i',$document,$elements);

$match = implode("\r\n",$elements[0]);

return $match;

}

 

This should return the following

<div class="record" id="one">

                <div class="rideon">

                                <h2>

                                                <span>Welcome to
Rideon</span>

                                </h2>

                </div>

</div>

</div class="record" id="one">

 

 


--- End Message ---
--- Begin Message ---
[EMAIL PROTECTED] wrote:
I am having a issue parsing an html file.
I want to pull all the data between two html tags.

Problem I am having is that no matter what I try  I can pull either tag or
both but not the data in between.

<div class="record" id="one">

                <div class="rideon">

                                <h2>

                                                <span>Welcome to
Rideon</span>

                                </h2>

                </div>

</div>

</div class="record" id="one">

function datamatch($document)

{

                preg_match_all('/<div class="record" [^<>]*>(.*)/<\/div
class="record" [^<>]*>/i',$document,$elements);

$match = implode("\r\n",$elements[0]);

return $match;

}

This should return the following

<div class="record" id="one">

                <div class="rideon">

                                <h2>

                                                <span>Welcome to
Rideon</span>

                                </h2>

                </div>

</div>

</div class="record" id="one">


You may want to try escaping your quotations. That could cause some issues.

--- End Message ---
--- Begin Message ---
Hi There

 

 

I am totally new to PHP and have just tried installing it on my machine
according to instructions on the php.net manual installation instructions
page - http://www.php.net/manual/en/install.windows.manual.php 

 

I think I managed to do most steps but I have a few questions:

 

Under the PHP file, I have icons for php, php-win and php-cgi.   If I double
click on any one of them, it says - "Are you sure you want to run this
software?"  I have Windows Vista - 32 bit operating system and have
installed IIS7.  Which one would you recommend that I run? Then, how do I
know that everything is installed properly?

 

Under optional steps:

 

How do I change the doc_root to point to the web servers document_root??
This was an optional step but not sure how to do this? (sorry basic
question!) and what extensions would you recommend that I install?

 

I look forward to any advice!

 

Many Thanks

Louise

 

(South Africa)

 

 


--- End Message ---

Reply via email to