php-general Digest 11 Dec 2006 11:54:25 -0000 Issue 4508

Topics (messages 245692 through 245706):

Re: How to compile Delphi SC ?
        245692 by: Stut
        245693 by: Stut
        245694 by: Børge Holen

Re: fopen failed to open pipe file in Linux+Apache environment
        245695 by: Chris

Re: PHP Installation question
        245696 by: Chris

Re: news.php.net times out - unreachable for days
        245697 by: Chuck Anderson
        245698 by: Chuck Anderson
        245699 by: João Cândido de Souza Neto
        245700 by: Lester Caine

Need help with RegEx
        245701 by: Anthony Papillion
        245702 by: Børge Holen
        245703 by: T.Lensselink
        245704 by: Roman Neuhauser
        245706 by: Michael

PHP - grabbing a thumb from FLV's (function)
        245705 by: Jason Paschal

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:
        php-general@lists.php.net


----------------------------------------------------------------------
--- Begin Message ---
eqla3.com eqla3.com wrote:
I know these is PHP mail list but also most active group i know is these :)

the Q is How to compile Delphi from source code in bothe linux or windows ?

Speechless.

-Stut

--- End Message ---
--- Begin Message --- OK, I guess I should apologise to the OP in advance, but I just had to share this response...

eqla3.com eqla3.com wrote:
thanks but i have googled for it but there is no compiler called Speechless

-Stut

--- End Message ---
--- Begin Message ---
On Sunday 10 December 2006 23:02, Stut wrote:
> OK, I guess I should apologise to the OP in advance, but I just had to
> share this response...
>
> eqla3.com eqla3.com wrote:
> > thanks but i have googled for it but there is no compiler called
> > Speechless
>
> -Stut

loved it.!. ;)

-- 
---
Børge
Kennel Arivene 
http://www.arivene.net
---

--- End Message ---
--- Begin Message ---
mike xu wrote:
Its so strange, when I runing /etc/rc.d/rc3.d/S85httpd restart, the php
script couldn't fopen pipe file.
But if I copy /etc/rc.d/rc3.d/S85httpd to some other place (for example
/root), and execute `/root/S85httpd restart`, the php script could fopen
file successfully!

Its so confusing ...

As Ryan suggested, it sounds like a SELinux issue. Try disabling SeLinux temporarily to see if that fixes the problem. If it does, you'll need to look at the policy and fix it (we won't be able to help much with that part of the process though).

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

--- End Message ---
--- Begin Message ---
Roman Neuhauser wrote:
# [EMAIL PROTECTED] / 2006-12-08 12:21:16 +1100:
Beauford wrote:
I'm thinking though that this isn't really the problem. When I install
Slackware, I install everything (except for games). On my older PC I
installed version 8.1 and had no problems, but now with version 10 I have
problems. I'm pretty sure that zlib-dev or zlib-devel has never been
included in either version of Slack. So I think I'm just going around in
circles with this.
locate zlib.h

if that returns nothing, then the problem is still that you need the zlib-dev package installed.

or that his locate database hasn't been rebuilt since he installed
the file. please give better advice.

Sorrrrryy :P Didn't see anyone else trying to help what-so-ever.

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

--- End Message ---
--- Begin Message ---
Chuck Anderson wrote:
It's actually been well over a week or even two. I can no longer connect to php.net with Thunderbird (as I have been doing daily for many months - news.php.net - port 119). It always times out. I'll be lucky if this post even makes it. I got connected briefly yesterday and saw some other posts indicating that I am not alone.

Something NEEDS to be fixed.

I'll just have to keep trying to connect every day and hope something changes.
As of now, das ist kaput!


So, is no one else having this problem? This newsgroup has gone from being a very useful, daily activity for me to one that I usually can not even connect to. I use Thunderbird via Comcast to get to news.php.net - and it always takes a minute or more to connect to the server, if at all.

In the time it takes to write a message, I lose my connection and often cannot even connect to send it.

I'm hurrying this time, so I hope it works.

--
*****************************
Chuck Anderson • Boulder, CO
http://www.CycleTourist.com
*****************************

--- End Message ---
--- Begin Message ---
Chuck Anderson wrote:
It's actually been well over a week or even two. I can no longer connect to php.net with Thunderbird (as I have been doing daily for many months - news.php.net - port 119). It always times out. I'll be lucky if this post even makes it. I got connected briefly yesterday and saw some other posts indicating that I am not alone.

Something NEEDS to be fixed.

I'll just have to keep trying to connect every day and hope something changes.
As of now, das ist kaput!


So, is no one else having this problem? This newsgroup has gone from being a very useful, daily activity for me to one that I usually can not even connect to. I use Thunderbird via Comcast to get to news.php.net - and it always takes a minute or more to connect to the server, if at all.

In the time it takes to write a message, I lose my connection and often cannot even connect to send it.

I'm hurrying this time, so I hope it works.

(.... not that time ..... timed out ..... I'll try Sending again)

--
*****************************
Chuck Anderson • Boulder, CO
http://www.CycleTourist.com
*****************************

--- End Message ---
--- Begin Message ---
I´m facing this trouble for a log time as well and it´s growing each day.

"Chuck Anderson" <[EMAIL PROTECTED]> escreveu na mensagem 
news:[EMAIL PROTECTED]
> Chuck Anderson wrote:
>> It's actually been well over a week or even two.  I can no longer connect 
>> to php.net with Thunderbird (as I have been doing daily for many months - 
>> news.php.net - port 119).  It always times out.  I'll be lucky if this 
>> post even makes it.  I got connected briefly yesterday and saw some other 
>> posts indicating that I am not alone.
>>
>> Something NEEDS to be fixed.
>>
>> I'll just have to keep trying to connect every day and hope something 
>> changes.
>> As of now, das ist kaput!
>>
>>
>
> So, is no one else having this problem?  This newsgroup has gone from 
> being a very useful, daily activity for me to one that I usually can not 
> even connect to.  I use Thunderbird via Comcast to get to news.php.net - 
> and it always takes a minute or more to connect to the server, if at all.
>
> In the time it takes to write a message, I lose my connection and often 
> cannot even connect to send it.
>
> I'm hurrying this time, so I hope it works.
>
> (.... not that time ..... timed out ..... I'll try Sending again)
>
> -- 
> *****************************
> Chuck Anderson . Boulder, CO
> http://www.CycleTourist.com
> ***************************** 

--- End Message ---
--- Begin Message ---
Chuck Anderson wrote:
In the time it takes to write a message, I lose my connection and often cannot even connect to send it.

I'm hurrying this time, so I hope it works.

(.... not that time ..... timed out ..... I'll try Sending again)

When I was forced to use the newsgroup interface I often had that problem, and I was complaining that I could not get eMails working :(

I've been running on emails for a while now after some kind fairy lifted the blocking of my email addresses, but I'm still using the newsgroup interface for a couple of php.net lists and nothing has changed there.

--
Lester Caine - G8HFL
-----------------------------
L.S.Caine Electronic Services - http://home.lsces.co.uk
Model Engineers Digital Workshop - http://home.lsces.co.uk/ModelEngineersDigitalWorkshop/
Treasurer - Firebird Foundation Inc. - http://www.firebirdsql.org/index.php

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

I am having a bit of problems wrapping my head around regular expressions. I 
thought I had a good grip on them but, for some reason, the expression I've 
created below simply doesn't work! Basically, I need to retreive all of the 
text between two unique and specific tags but I don't need the tag text. So 
let's say that the tag is

<tag lang='ttt'>THIS IS A TEST</tag>

I would need to retreive THIS IS A TEST only and nothing else.

Now, a bit more information: I am using cURL to retreive the entire contents 
of a webpage into a variable. I am then trying to perform the following 
regular expression on the retreived text:

$trans_text = preg_match("\/<div id=result_box dir=ltr>(.+?)<\/div>/");

The problem is that when I echo the value of $trans_text variable, I end up 
with the entire HTML of the page.

Can anyone clue me in to what I am doing wrong?

Thanks,
Anthony 

--- End Message ---
--- Begin Message ---
explode it

I'm having quite the difficulty to comprehend the regexp myself, but as a 
training, go ahead.

On Monday 11 December 2006 09:02, Anthony Papillion wrote:
> Hello Everyone,
>
> I am having a bit of problems wrapping my head around regular expressions.
> I thought I had a good grip on them but, for some reason, the expression
> I've created below simply doesn't work! Basically, I need to retreive all
> of the text between two unique and specific tags but I don't need the tag
> text. So let's say that the tag is
>
> <tag lang='ttt'>THIS IS A TEST</tag>
>
> I would need to retreive THIS IS A TEST only and nothing else.
>
> Now, a bit more information: I am using cURL to retreive the entire
> contents of a webpage into a variable. I am then trying to perform the
> following regular expression on the retreived text:
>
> $trans_text = preg_match("\/<div id=result_box dir=ltr>(.+?)<\/div>/");
>
> The problem is that when I echo the value of $trans_text variable, I end up
> with the entire HTML of the page.
>
> Can anyone clue me in to what I am doing wrong?
>
> Thanks,
> Anthony

-- 
---
Børge
Kennel Arivene 
http://www.arivene.net
---

--- End Message ---
--- Begin Message ---
I'm no regex guru but something goes wrong here.

First of you miss the second parameter in preg_match

int preg_match ( string pattern, string subject [, array &matches [, int flags 
[, int offset]]] )

If you need the text from two unique tags it should not be to hard:

$test = "<tag lang='ttt'>THIS IS A TEST</tag>";
preg_match("/<tag lang='ttt'>(.+?)<\/tag>/", $test, $matches);
print_r($matches);

Thijs

On Mon, 11 Dec 2006 02:02:46 -0600, "Anthony Papillion" <[EMAIL PROTECTED]> 
wrote:
> Hello Everyone,
> 
> I am having a bit of problems wrapping my head around regular expressions.
> I
> thought I had a good grip on them but, for some reason, the expression
> I've
> created below simply doesn't work! Basically, I need to retreive all of
> the
> text between two unique and specific tags but I don't need the tag text.
> So
> let's say that the tag is
> 
> <tag lang='ttt'>THIS IS A TEST</tag>
> 
> I would need to retreive THIS IS A TEST only and nothing else.
> 
> Now, a bit more information: I am using cURL to retreive the entire
> contents
> of a webpage into a variable. I am then trying to perform the following
> regular expression on the retreived text:
> 
> $trans_text = preg_match("\/<div id=result_box dir=ltr>(.+?)<\/div>/");
> 
> The problem is that when I echo the value of $trans_text variable, I end
> up
> with the entire HTML of the page.
> 
> Can anyone clue me in to what I am doing wrong?
> 
> Thanks,
> Anthony
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

--- End Message ---
--- Begin Message ---
# [EMAIL PROTECTED] / 2006-12-11 02:02:46 -0600:
> I am having a bit of problems wrapping my head around regular expressions. I 
> thought I had a good grip on them but, for some reason, the expression I've 
> created below simply doesn't work! Basically, I need to retreive all of the 
> text between two unique and specific tags but I don't need the tag text. So 
> let's say that the tag is
> 
> <tag lang='ttt'>THIS IS A TEST</tag>
> 
> I would need to retreive THIS IS A TEST only and nothing else.
> 
> Now, a bit more information: I am using cURL to retreive the entire contents 
> of a webpage into a variable. I am then trying to perform the following 
> regular expression on the retreived text:
> 
> $trans_text = preg_match("\/<div id=result_box dir=ltr>(.+?)<\/div>/");
> 
> The problem is that when I echo the value of $trans_text variable, I end up 
> with the entire HTML of the page.

    This is hardly the code you're actually using[1], can you please
    provide a piece of real code?

    [1] int preg_match ( string pattern, string subject [, array &matches [, 
int flags [, int offset]]] )

-- 
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man.  You don't KNOW.
Cause you weren't THERE.             http://bash.org/?255991

--- End Message ---
--- Begin Message ---
At 01:02 AM 12/11/2006 , Anthony Papillion wrote:
>Hello Everyone,
>
>I am having a bit of problems wrapping my head around regular expressions. I 
>thought I had a good grip on them but, for some reason, the expression I've 
>created below simply doesn't work! Basically, I need to retreive all of the 
>text between two unique and specific tags but I don't need the tag text. So 
>let's say that the tag is
>
><tag lang='ttt'>THIS IS A TEST</tag>
>
>I would need to retreive THIS IS A TEST only and nothing else.
>
>Now, a bit more information: I am using cURL to retreive the entire contents 
>of a webpage into a variable. I am then trying to perform the following 
>regular expression on the retreived text:
>
>$trans_text = preg_match("\/<div id=result_box dir=ltr>(.+?)<\/div>/");

Using the tags you describe here, and assuming the source html is in the
variable $source_html, try this:

$trans_text = preg_replace("/(.*?)(<div id=result_box
dir=ltr>)(.*?)(<\/div>)(.*?)^/s","$3",$source_html);

how this breaks down is:
 
opening quote for first parameter (your MATCH pattern).

open regex match pattern= /

first atom (.*?) = any or no leading text before <div id=result_box dir=ltr>,
the ? makes it non-greedy so that it stops after finding the first match.

second atom (<div id=result_box dir=ltr>) = the opening tag you are looking for.

third atom (.*?) = the text you want to strip out, all text even if nothing is
there, between the 2nd and
4th atoms.

fourth atom (<\/div>) = the closing tag of the div tag pair.

fifth atom (.*?) = all of the rest of the source html after the closing tag up
to the end of the line ^,even if there is nothing there.

close regex match pattern= /s

in order for this to work on html that may contain newlines, you must specify
that the . can represent newline characters, this is done by adding the letter
's' after your regex closing /, so the last thing in your regex match pattern
would be /s.

end of string ^ (this matches the end of the string you are matching/replacing
, $source_html)

closing quote for first parameter.

The second parameter of the preg_replace is the atom # which contains the text
you want to replace the text matched by the regex match pattern in the first
parameter, in this case the text we want is in the third atom so this parameter
would be $3 (this is the PHP way of back-referencing, if we wanted the text
before the tag we would use atom 1, or $1, if we want the tag itself we use $2,
etc basically a $ followed by the atom # that holds what we want to replace the
$source_html into $trans_text).

The third parameter of the preg_replace is the source you wish to match and
replace from, in this case your source html in $source_html.

after this executes, $trans_text should contain the innerText of the <div
id=result_box dir=ltr></div> tag pair from $source_html, if there is nothing
between the opening and closing tags, $trans_text will == "", if there is only
a newline between the tags, $trans_text will == "\n". IMPORTANT: if the text
between the tags contains a newline, $trans_text will also contain that newline
character because we told . to match newlines.

I am no regex expert by far, but this worked for me (assuming I copied it
correctly here heh)
There are doubtless many other ways to do this, and I am sure others on the
list here will correct me if my way is wrong or inefficient.

I hope this works for you and that I haven't horribly embarassed myself here.
Good luck :)

>
>The problem is that when I echo the value of $trans_text variable, I end up 
>with the entire HTML of the page.
>
>Can anyone clue me in to what I am doing wrong?
>
>Thanks,
>Anthony 
>
>-- 
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php
>  

--- End Message ---
--- Begin Message ---
i wanted to get my server to grab a thumbnail (video capture) of an FLV
using PHP, and ffmpeg-php is not an option (at the moment, can't spare the
possible downtime, many money-making sites involved).

i installed ffmpeg.  Fedora Core 4 users try this:

yum install ffmpeg

I went a more circuitous route and installed Subversion (SVN) (google it),
THEN installed ffmpeg using the link on their download page.  (get it,
configure it, make it)

Then, like i do with imageMagick, i use a system() call to ffmpeg.

NOTE: (i had to put the full path to ffmpeg (usr/local/bin/ffmpeg) in my
system call, this messed me up for a bit)

here's my impromptu function (have to pass the FLV file, width, height,
hour, min, sec, append (any value you want to put on the end of the
resulting jpg's filename)):

function
flvThumb($file,$width=50,$height=50,$hour=00,$min=00,$sec=01,$append) {
if ($append == "") {
 $append = time();
}

if ($file == "" or !is_file($file)) {
 return false;
}

$width = eregi_replace("[^0-9]","",$width);
$height = eregi_replace("[^0-9]","",$height);

if ($width == "") {
 $width = 50;
}
if ($height == "") {
 $height = 50;
}

$hour = eregi_replace("[^0-9]","",$hour);
$min = eregi_replace("[^0-9]","",$min);
$sec = eregi_replace("[^0-9]","",$sec);

if (strlen($hour) == 1) {
 $hour = "0" . $hour;
}
if (strlen($min) == 1) {
 $min = "0" . $min;
}
if (strlen($sec) == 1) {
 $sec = "0" . $sec;
}

$try = explode(".",$file);
$ext = array_pop($try);
$desig = implode(".",$try);
$thumbname = $desig . "_" . $append . "." . "jpg";

$varmake = @system("/usr/local/bin/ffmpeg -i $file -vcodec png -vframes 1
-an -f rawvideo -s " . $width . "x" . $height . " -ss " . "$hour" . ":" .
"$min" . ":" . "$sec" . " -y " . "$thumbname",$retval);
$tmp = @stat($thumbname);
if ($tmp['size'] == 0) {
 @unlink($thumbname);
 return false;
}
if ($retval != 0) {
 return false;
} else {
 return $thumbname;
}

}
if it returns anything but false, you may have a problem.  of course, the
problem may be with the function and application.

i know that improvements can be made, but i wish i had seen this before i
started trying to figure everything out.  i like having a starting point.
(i'm sending this to my gmail for my 'reference archive')

HOPE THIS HELPS SOMEONE
(plz don't burn me)

1337 c0d1ng 2 a11, & 2 a11 @ g00d n173,
mellomutt

p.s. it only just now strikes me that many other video formats can be
thumbnailed.  mpg, wmv, mov, avi, etc....   this really changes the way i'm
thinking about my sites.  i was using a desktop client to make thumbnails,
and it's a good one, but to have ur server do it for you...that just makes
it that much easier to add content, and thusly, that much more likely for me
to add content because i'm a lazy wanker.

--- End Message ---

Reply via email to