[29956] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 1199 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jan 15 18:09:45 2008

Date: Tue, 15 Jan 2008 15:09:09 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Tue, 15 Jan 2008     Volume: 11 Number: 1199

Today's topics:
        Anyone using Mason for standalone scripts <SteveSpamTrap@yahoo.com>
    Re: Anyone using Mason for standalone scripts <joost@zeekat.nl>
    Re: Anyone using Mason for standalone scripts <SteveSpamTrap@yahoo.com>
        Comparing two files clearguy02@yahoo.com
    Re: Comparing two files <m@rtij.nl.invlalid>
    Re: Comparing two files <jurgenex@hotmail.com>
    Re: Comparing two files <someone@example.com>
    Re: Comparing two files clearguy02@yahoo.com
    Re: Converting milliseconds to seconds <tzz@lifelogs.com>
    Re: Converting milliseconds to seconds <hjp-usenet2@hjp.at>
    Re: Converting milliseconds to seconds <abigail@abigail.be>
    Re: Converting milliseconds to seconds <joost@zeekat.nl>
    Re: How to detect text charset (UTF-8 or Latin-1) <joe@inwap.com>
    Re: How to detect text charset (UTF-8 or Latin-1) <jurgenex@hotmail.com>
    Re: How to detect text charset (UTF-8 or Latin-1) <joost@zeekat.nl>
        HOW TO MAKE $1000+ IN 5 MINUTES andrewladams@gmail.com
    Re: Shebang line management <1usa@llenroc.ude.invalid>
    Re: Shebang line management <1usa@llenroc.ude.invalid>
    Re: USEFUL perl SCRIPT: NTP verifier <john@castleamber.com>
    Re: USEFUL perl SCRIPT: NTP verifier <k.nuyt@nospam.demon.nl>
    Re: USEFUL perl SCRIPT: NTP verifier <bik.mido@tiscalinet.it>
    Re: USEFUL perl SCRIPT: NTP verifier <hjp-usenet2@hjp.at>
    Re: USEFUL perl SCRIPT: NTP verifier (Robert Melson)
    Re: Wait for background processes to complete <pgodfrin@gmail.com>
    Re: Wait for background processes to complete <glex_no-spam@qwest-spam-no.invalid>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Tue, 15 Jan 2008 14:25:43 -0500
From: Steve <SteveSpamTrap@yahoo.com>
Subject: Anyone using Mason for standalone scripts
Message-Id: <5v4floF1k0mtiU1@mid.individual.net>

	I'm playing around with Mason as a template-parser for standalone 
scripts outside of a web environment.  If it works well enough, I might 
apply the approach toward writing a Mason wrapper so I can use Mason in 
shared-hosting environments where I don't have access to Apache httpd.conf.

	Anyway, I'm following the example provided in Mason's admin guide, and 
have a small standalone script like this:


#!c:/Perl/bin/perl.exe
use HTML::Mason;
use strict;

my $outbuf;
my $interp = HTML::Mason::Interp->new(
	comp_root  => 'c:/workspace/MyMasonTemplates',
	data_dir   => 'c:/workspace/MyMasonData',
	out_method => \$outbuf
);
$interp->exec( 'test.html' );


	However, when I run this script I get the following error:


Component path given to Interp->load must be absolute (was given test.html)


	I'm using a relative path in the example above because that's what the 
Mason admin manual calls for (that's the whole point of specifying a 
"comp_root" value).  However, the interesting thing is that the error 
message is exactly the same even when I change the parameter to 
$interp->exect() to be the absolute path of this filename.  Can anyone 
who's used Mason in a standalone script environment spot what I might be 
missing here?





------------------------------

Date: Tue, 15 Jan 2008 20:33:29 +0100
From: Joost Diepenmaat <joost@zeekat.nl>
Subject: Re: Anyone using Mason for standalone scripts
Message-Id: <87fxwyg9yu.fsf@zeekat.nl>

Steve <SteveSpamTrap@yahoo.com> writes:
(cut back)
> my $interp = HTML::Mason::Interp->new(
> 	comp_root  => 'c:/workspace/MyMasonTemplates',
> 	data_dir   => 'c:/workspace/MyMasonData',
> 	out_method => \$outbuf
> );
> $interp->exec( 'test.html' );
>

> Component path given to Interp->load must be absolute (was given
> test.html)

> specifying a "comp_root" value).  However, the interesting thing is
> that the error message is exactly the same even when I change the
> parameter to $interp->exect() to be the absolute path of this
> filename.  Can anyone who's used Mason in a standalone script
> environment spot what I might be missing here?

If the path is relative to comp_root, 

$interp->exec( '/test.html' );

might work.

/untested, it's been years since I've used Mason/

Joost.


------------------------------

Date: Tue, 15 Jan 2008 14:44:43 -0500
From: Steve <SteveSpamTrap@yahoo.com>
Subject: Re: Anyone using Mason for standalone scripts
Message-Id: <5v4gpbF1k7k17U1@mid.individual.net>

> $interp->exec( '/test.html' );


	What do you know... it really was that simple.  Thanks!


------------------------------

Date: Tue, 15 Jan 2008 12:55:56 -0800 (PST)
From: clearguy02@yahoo.com
Subject: Comparing two files
Message-Id: <e35a873c-683c-4020-92cf-c39c1b58d36d@e32g2000prn.googlegroups.com>

Hi folks,

I have two files, one with 1000 lines and another with 600 lines and
both files have the user login ID's and the first file has an extra of
400 user id's that I need to find.

Here is the script I have written:
------------------------------------
open (INPUT1,"fullFile.txt") or die "Cannot open the file: $!";
open (INPUT2,"comapreFile.txt") or die "Cannot open the file: $!";

@array1 = <INPUT1>;
@array2 = <INPUT2>;

foreach $word (@array2)
 {
   if(!grep /$word/i, @array1)
     {
       print "$_\n";
     }
 }
----------------------------------------

I am not able to see the output on the screen. Any one sees where I am
doing wrong?

Thanks
J


------------------------------

Date: Tue, 15 Jan 2008 22:03:37 +0100
From: Martijn Lievaart <m@rtij.nl.invlalid>
Subject: Re: Comparing two files
Message-Id: <pan.2008.01.15.21.03.37@rtij.nl.invlalid>

On Tue, 15 Jan 2008 12:55:56 -0800, clearguy02 wrote:

> Hi folks,
> 
> I have two files, one with 1000 lines and another with 600 lines and
> both files have the user login ID's and the first file has an extra of
> 400 user id's that I need to find.
> 
> Here is the script I have written:
> ------------------------------------
> open (INPUT1,"fullFile.txt") or die "Cannot open the file: $!"; open
> (INPUT2,"comapreFile.txt") or die "Cannot open the file: $!";
> 
> @array1 = <INPUT1>;
> @array2 = <INPUT2>;
> 
> foreach $word (@array2)
>  {
>    if(!grep /$word/i, @array1)
>      {
>        print "$_\n";

What value is $_ here? Where is it set?

>      }
>  }
> ----------------------------------------
> 
> I am not able to see the output on the screen. Any one sees where I am
> doing wrong?

You could have found this yourself if you added
  use strict;
  use warnings;
on the top of your script!

HTH,
M4


------------------------------

Date: Tue, 15 Jan 2008 21:09:35 GMT
From: Jürgen Exner <jurgenex@hotmail.com>
Subject: Re: Comparing two files
Message-Id: <l58qo3dfqg7j4to6dcan3seu3l3knep6co@4ax.com>

clearguy02@yahoo.com wrote:
>I have two files, one with 1000 lines and another with 600 lines and
>both files have the user login ID's and the first file has an extra of
>400 user id's that I need to find.

That's not too large to slurp into an array.
And then you can simply apply the FAQ " How do I compute the difference of
two arrays?"

jue


------------------------------

Date: Tue, 15 Jan 2008 21:19:04 GMT
From: "John W. Krahn" <someone@example.com>
Subject: Re: Comparing two files
Message-Id: <cr9jj.4909$yQ1.3685@edtnps89>

clearguy02@yahoo.com wrote:
> 
> I have two files, one with 1000 lines and another with 600 lines and
> both files have the user login ID's and the first file has an extra of
> 400 user id's that I need to find.
> 
> Here is the script I have written:
> ------------------------------------
> open (INPUT1,"fullFile.txt") or die "Cannot open the file: $!";
> open (INPUT2,"comapreFile.txt") or die "Cannot open the file: $!";
> 
> @array1 = <INPUT1>;
> @array2 = <INPUT2>;
> 
> foreach $word (@array2)
>  {
>    if(!grep /$word/i, @array1)
>      {
>        print "$_\n";
>      }
>  }
> ----------------------------------------
> 
> I am not able to see the output on the screen. Any one sees where I am
> doing wrong?

You probably want to do it like this:

open INPUT2, '<', 'comapreFile.txt'
     or die "Cannot open 'comapreFile.txt' $!";

my %compare;
while ( <INPUT2> ) {
     chomp;
     $compare{ lc() } = ();
     }
close INPUT2;


open INPUT1, '<', 'fullFile.txt'
     or die "Cannot open 'fullFile.txt' $!";

while ( <INPUT1> ) {
     chomp;
     print "$_\n" unless exists $compare{ lc() };
     }
close INPUT2;



John
-- 
Perl isn't a toolbox, but a small machine shop where you
can special-order certain sorts of tools at low cost and
in short order.                            -- Larry Wall


------------------------------

Date: Tue, 15 Jan 2008 13:51:38 -0800 (PST)
From: clearguy02@yahoo.com
Subject: Re: Comparing two files
Message-Id: <c504adc6-8d4a-4908-b735-a2182e395457@s27g2000prg.googlegroups.com>

On Jan 15, 1:19=A0pm, "John W. Krahn" <some...@example.com> wrote:
> cleargu...@yahoo.com wrote:
>
> > I have two files, one with 1000 lines and another with 600 lines and
> > both files have the user login ID's and the first file has an extra of
> > 400 user id's that I need to find.
>
> > Here is the script I have written:
> > ------------------------------------
> > open (INPUT1,"fullFile.txt") or die "Cannot open the file: $!";
> > open (INPUT2,"comapreFile.txt") or die "Cannot open the file: $!";
>
> > @array1 =3D <INPUT1>;
> > @array2 =3D <INPUT2>;
>
> > foreach $word (@array2)
> > =A0{
> > =A0 =A0if(!grep /$word/i, @array1)
> > =A0 =A0 =A0{
> > =A0 =A0 =A0 =A0print "$_\n";
> > =A0 =A0 =A0}
> > =A0}
> > ----------------------------------------
>
> > I am not able to see the output on the screen. Any one sees where I am
> > doing wrong?
>
> You probably want to do it like this:
>
> open INPUT2, '<', 'comapreFile.txt'
> =A0 =A0 =A0or die "Cannot open 'comapreFile.txt' $!";
>
> my %compare;
> while ( <INPUT2> ) {
> =A0 =A0 =A0chomp;
> =A0 =A0 =A0$compare{ lc() } =3D ();
> =A0 =A0 =A0}
> close INPUT2;
>
> open INPUT1, '<', 'fullFile.txt'
> =A0 =A0 =A0or die "Cannot open 'fullFile.txt' $!";
>
> while ( <INPUT1> ) {
> =A0 =A0 =A0chomp;
> =A0 =A0 =A0print "$_\n" unless exists $compare{ lc() };
> =A0 =A0 =A0}
> close INPUT2;
>
> John
> --
> Perl isn't a toolbox, but a small machine shop where you
> can special-order certain sorts of tools at low cost and
> in short order. =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0-- =
Larry Wall- Hide quoted text -
>
> - Show quoted text -

Thanks to all... I forgot to replace $_ with $word in the snippet.

J


------------------------------

Date: Tue, 15 Jan 2008 13:16:50 -0600
From: Ted Zlatanov <tzz@lifelogs.com>
Subject: Re: Converting milliseconds to seconds
Message-Id: <86d4s25271.fsf@lifelogs.com>

On 15 Jan 2008 14:56:17 GMT Abigail <abigail@abigail.be> wrote: 

A>    int:      round to 0.
A>    floor:    round to -inf.
A>    ceil:     round to +inf.
A>    sprintf:  round to nearest.


A>                       +-------------------------+
A>                       |           $x            |
A>                       +-----+------+-----+------+
A>                       | 1.2 | -1.2 | 1.7 | -1.7 |
A>    +------------------+-----+------+-----+------+
A>    | int $x           | 1   | -1   | 1   | -1   |
A>    +------------------+-----+------+-----+------+
A>    | floor $x         | 1   | -2   | 1   | -2   |
A>    +------------------+-----+------+-----+------+
A>    | ceil $x          | 2   | -1   | 2   | -1   |
A>    +------------------+-----+------+-----+------+
A>    | sprintf "%d", $x | 1   | -1   | 2   | -2   |
A>    +------------------+-----+------+-----+------+

This should be in the `perldoc -f sprintf' page.

Ted


------------------------------

Date: Tue, 15 Jan 2008 21:07:03 +0100
From: "Peter J. Holzer" <hjp-usenet2@hjp.at>
Subject: Re: Converting milliseconds to seconds
Message-Id: <slrnfoq4j7.r2b.hjp-usenet2@hrunkner.hjp.at>

On 2008-01-15 18:16, Jim Gibson <jimsgibson@gmail.com> wrote:
> In article <slrnfopicg.e71.abigail@alexandra.abigail.be>, Abigail
><abigail@abigail.be> wrote:
>> Peter J. Holzer (hjp-usenet2@hjp.at) wrote on VCCL September MCMXCIII in
>> <URL:news:slrnfoph3u.mma.hjp-usenet2@hrunkner.hjp.at>:
>> }}  
>> }}  Of course there is no other way to round-to-0, but the manual is talking
>> }}  about "rounding" here: And "rounding" without any qualifiers usually
>> }}  means "round to nearest", not "round to 0".
>> }}  
>> }}  The entry is still confusing: The hint to use sprintf instead is ok, but
>> }}  in what way are floor and ceil supposed to be better than int? And the
>> }}  caveat about decimal/binary confusions isn't really a reason for "don't
>> }}  use int for rounding" - any rounding method has the same problem.
>> 
>> 
>> Neither floor, nor ceil does the same as int.
>> 
>> 
>>    int:      round to 0.
>>    floor:    round to -inf.
>>    ceil:     round to +inf.
>>    sprintf:  round to nearest.
>
>
> What would be a good round() function that "rounds-to-nearest-even"?
> Would using sprintf in this function slow it down?

sprintf is surprisingly fast. I wrote a little benchmark program (see
below) with a mathetically correct (round to nearest, round to even on
tie), two "naive" implementations and sprintf (which is also correct on
my machine). As expected, the correct version is the slowest. But
sprintf is not only the fastest, it is almost twice as fast as the next
one:

nearest_even: 47.640588
naive_floor: 27.722728
naive_int: 34.791525
sprintf: 18.669429



> Is there any chance such a function could be included as a built-in
> function in a future Perl?

A round() function written C (or assembler) could be quite a bit faster
than sprintf. But whether that makes a real difference depends on the
time your program spends rounding.


#!/usr/bin/perl
use warnings;
use strict;
use Time::HiRes qw(time);
use POSIX qw(floor);

{
    sub nearest_even {
	my $x = $_[0];
	my $f = floor($x);
	return $x - $f < 0.5 ? $f     :
	       $x - $f > 0.5 ? $f + 1 :
	       $f % 2 == 0   ? $f     :
	                       $f + 1 ;
    }

    my $t0 = time;

    for (my $x = -1_000_000; $x <= 1_000_000; $x += 0.0625) {
	my $y = nearest_even($x);
	# print "$x -> $y\n";
    }

    printf "nearest_even: %f\n", time - $t0;
}

{
    sub naive_floor {
	return  floor($_[0] + 0.5);
    }

    my $t0 = time;

    for (my $x = -1_000_000; $x <= 1_000_000; $x += 0.0625) {
	my $y = naive_floor($x);
	# print "$x -> $y\n";
    }

    printf "naive_floor: %f\n", time - $t0;
}

{
    sub naive_int {
	my $x = shift;
	return $x >= 0 ? int($x + 0.5) : int($x - 0.5);
    }

    my $t0 = time;

    for (my $x = -1_000_000; $x <= 1_000_000; $x += 0.0625) {
	my $y = naive_int($x);
	# print "$x -> $y\n";
    }

    printf "naive_int: %f\n", time - $t0;
}

{
    my $t0 = time;

    for (my $x = -1_000_000; $x <= 1_000_000; $x += 0.0625) {
	my $y = sprintf("%.0f", $x);
	# print "$x -> $y\n";
    }

    printf "sprintf: %f\n", time - $t0;
}
__END__

	hp


------------------------------

Date: 15 Jan 2008 22:42:25 GMT
From: Abigail <abigail@abigail.be>
Subject: Re: Converting milliseconds to seconds
Message-Id: <slrnfoqdmh.t74.abigail@alexandra.abigail.be>

                                            _
Joost Diepenmaat (joost@zeekat.nl) wrote on VCCL September MCMXCIII in
<URL:news:87k5mbexy5.fsf@zeekat.nl>:
??  Jim Gibson <jimsgibson@gmail.com> writes:
??  
?? > What would be a good round() function that "rounds-to-nearest-even"?
??  
??  sprintf would work, but I'm not 100% sure it rounds to even on every
??  platform (it uses C's sprintf()). It works on my debian/x86 system though.

It doesn't, unless you have a really, really old perl. Modern Perls
only use the systems sprintf for floating numbers, when using standard
modifiers.  But in this case, we're using "%d".

?? > Would using sprintf in this function slow it down?

Of course. But then, you're taking a huge speed penalty by your decision
to write your program in Perl in the first place, so I doubt this difference
will really matter.

?? > Is there any chance
?? > such a function could be included as a built-in function in a future
?? > Perl?

Almost zero, I'd say. Even if there was a real need for a fast function,
there would be no need to do this as a build-in. You can do all the logic
in an XS or Inline::C module. 

Feel free to write one and upload in on CPAN.



Abigail
-- 
BEGIN {print "Just "   }
CHECK {print "another "}
END   {print "Hacker\n"}
INIT  {print "Perl "   }


------------------------------

Date: Tue, 15 Jan 2008 23:52:51 +0100
From: Joost Diepenmaat <joost@zeekat.nl>
Subject: Re: Converting milliseconds to seconds
Message-Id: <87r6giem64.fsf@zeekat.nl>

Abigail <abigail@abigail.be> writes:

>                                             _
> Joost Diepenmaat (joost@zeekat.nl) wrote on VCCL September MCMXCIII in
> <URL:news:87k5mbexy5.fsf@zeekat.nl>:
> ??  Jim Gibson <jimsgibson@gmail.com> writes:
> ??  
> ?? > What would be a good round() function that "rounds-to-nearest-even"?
> ??  
> ??  sprintf would work, but I'm not 100% sure it rounds to even on every
> ??  platform (it uses C's sprintf()). It works on my debian/x86 system though.
>
> It doesn't, unless you have a really, really old perl. Modern Perls
> only use the systems sprintf for floating numbers, when using standard
> modifiers.  But in this case, we're using "%d".

Heh. I always use %1.0f :-)

Joost.


------------------------------

Date: Tue, 15 Jan 2008 11:16:02 -0800
From: Joe Smith <joe@inwap.com>
Subject: Re: How to detect text charset (UTF-8 or Latin-1)
Message-Id: <3L6dnYCVYZDsmxDanZ2dnUVZ_gydnZ2d@comcast.com>

Thomas Armstrong wrote:

> I'm creating a Perl script extracting text from a webpage using LWP,
> and want to check if text is UTF-8 or Latin-1 encoded?
> 
> I don't know if "use utf8;" is enough

It is not appropriate.

The pragma "use utf8" tells the Perl interpreter that your program file
contains strings encoded in UTF-8 format.  It does *not* affect how
Perl handles data from external sources.

	-Joe


------------------------------

Date: Tue, 15 Jan 2008 20:53:30 GMT
From: Jürgen Exner <jurgenex@hotmail.com>
Subject: Re: How to detect text charset (UTF-8 or Latin-1)
Message-Id: <187qo39riat4t75cdoqrrjor0vsk4q4uld@4ax.com>

>Thomas Armstrong wrote:
>> I'm creating a Perl script extracting text from a webpage using LWP,
>> and want to check if text is UTF-8 or Latin-1 encoded?

Check the <META Charset='...'>  tag.

jue


------------------------------

Date: Tue, 15 Jan 2008 23:11:23 +0100
From: Joost Diepenmaat <joost@zeekat.nl>
Subject: Re: How to detect text charset (UTF-8 or Latin-1)
Message-Id: <87bq7mg2no.fsf@zeekat.nl>

Jürgen Exner <jurgenex@hotmail.com> writes:

>>Thomas Armstrong wrote:
>>> I'm creating a Perl script extracting text from a webpage using LWP,
>>> and want to check if text is UTF-8 or Latin-1 encoded?
>
> Check the <META Charset='...'>  tag.
>
> jue

or the xml prolog (if there is one)

Joost.


------------------------------

Date: Tue, 15 Jan 2008 13:29:20 -0800 (PST)
From: andrewladams@gmail.com
Subject: HOW TO MAKE $1000+ IN 5 MINUTES
Message-Id: <c34064fe-ee6e-4fb1-b9a5-1412921c9d74@h11g2000prf.googlegroups.com>

A little while back, I was browsing these newsgroups, just like you

 are now, and came across an article similar to this that said you

 could make thousands of dollars within weeks with only an initial

 investment of $5.00 !  So I thought, "Yeah, right, this must be a

 scam", like most of us, but I was curious, like most of us, so I kept

 reading. Anyway, it said that you send $1.00 to each of the 5 names

 and address stated in the article. You then place your own name and

 address in the bottom of the list of #5, and post the article in at

 least 200 newsgroups.(There are thousands) No catch, that was it.



So after thinking it over, and talking to a few people first, I

thought about trying it. I figured what I have got to lose except 5

stamps and $5.00, right?



Like most of us I was a little skeptical and a little worried about

the legal aspects of it all. So I checked it out with U.S. Post

Office(1-800-725-2161) and they confirmed that it is indeed lega!

Then I invested the measly $5.00................

\\

\Well GUESS WHAT! !..... With in 7 days, I started getting money in

the mail! I was shocked! I still figured it end soon, and didn't give

it another thought. But the money just coming in. In my first week, I

made about $20.00 to $30.00 dollars. By the end of the second week I

had made total of over $1,000.00!!!!!!  In the third week I had over

$10,000.00 and it's still growing. This is now my fourth week and I

have made a total of just over $42,000.00 and it's still comming in

 .......  It's certainly worth $5.00, and 5 stamps, I spent more than

that on the lottery!!



Let me tell you how this works and most importantly, Why it works....

also, make sure you print a copy of this article NOW, so you can get

the information of it as you need it. The process is very simple and

consists of 3 easy steps :



STEP 1 : Get 5 separate pieces of paper and write the following on

each piece of paper "PLEASE PUT ME ON YOUR MAILING LIST." now get 5

$1.00 bills and place ONE inside EACH of the 5 pieces of paper so the

bill will not be seen through the envelopes to prevent thievery. Next,


place on paper in each of the 5 envelopes and seal them. You should

now have 5 sealed envelopes, each with a piece of paper stating the

above phrase and a $1.00 bill. What you are doing is creating a

service by this. THIS IS PERFECTLY LEGAL!



Mail the 5 envelopes to the following addresses :


#1  Occupant
      P.O. Box 54230
      Houston, Tx.
      77272-1193
      U.S.A.


#2 Kevin Michael
      1006 Abercorn Place
      Sherwood, AR 72120
      U.S.A.


#3   Chang
       P.O.Box 502651
       San Diego CA 92150-2651
       U.S.A.


#4   Belchior Mira
      R. Jose Dias Coelho, 7, 1 DT
      Bom-Sucesso, ALVERCA
      2615
      PORTUGAL
#5    Andrew
	801 West 24th Street Rm. 803
	Austin, TX 78705
	U.S.A.


STEP 2 : Now take the #1 name off the list that you see above, move

the other names up ( 5 becomes 4, 4 becomes 3, etc...) and add YOUR

Name as number 5 on the list.



STEP 3 : Change anything you need to, but try to keep this article as

close to original as possible. Now, post your mended article to at

least 200 newsgroups. (I think there are close to 18,000 groups) All

you need is 200, but remember, the more you post, the more money you

make! Don't know How post in the newsgroups? Well do exactly the

following :



FOR NETSCAPE USERS,


     1) Click on any newsgroups, like normal. Then click on "To News",


which is in the top left corner of the newsgroups page. This will

bring up a message box.


     2) Fill in the SUBJECT with a flashy title, like the one I used,

something to catch the eye!!!


     3) Now go to the message part of the box and retype this letter

exactly as it tis here, with exception of your few changes. (remember

to add your name to number 5 and move the rest up)


     4) When you're done typing in the WHOLE letter, click on 'FILE'

above the send button. Then, 'SAVE AS..' DO NOT SEND YOUR ARTICLE

UNTIL YOU SAVE IT. (so you don't have to type this 200 times :-)


     5) Now that you have saved the letter, go ahead and send your

first copy! (Click the 'SEND' button in the top left corner)


     6) This is where you post all 200! OK, go to ANY newsgroup

article and click the 'TO NEWS' button again. Type in your flashy

subject in the 'SUBJECT BOX', then go to the message and place your

cursor here. Now click on 'ATTACHMENT' which is right below the

'SUBJECT BOX'. Click on attach file then find your letter wherever you


saved it. Click once on your file then click 'OPEN' then click 'OK'.

If you did this right, you should see your filename in the 'ATTACHMENT


BOX' and it will be shaded.

 NOW POST AWAY!!




IF YOU'RE USING INTERNET EXPLORER :


     It's just as easy, holding down the left mouse button, highlight

this entire article, then press the 'CTRL' key and 'C' key at the same


time to copy this article. Then print the article for your records to

have the names of those you will be sending $1.00 to.


     Next, go to the newsgroups and press 'POST AN ARTICLE' type in

your flashy subject and click the large window below. Press 'CTRL' and


'V' and the article will appear in the message window. **BE SURE TO

MAKE YOUR ADDRESS CHANGES TO THE 5 NAMES.**. Now re-highlight the

article andre-copy it so you have the changes..... then all you have

to do for each newsgroups is 'CTRL' and 'V' and press 'POST'. It's

that easy!!!



THAT'S IT! ALL you have to do is jump to different newsgroups and post


away, after you get the hang of it, it will take about 30 seconds for

each newsgroup!  **REMEMBER, THE MORE NEWSGROUPS YOU POST IN, THE MORE


MONEY YOU WILL MAKE!! BUT YOU HAVE TO POST A MINIMUM OF 200 **



That's it! you will begin receiving money from around the world within


day's! You may eventually want to rent a P.O.Box due to the large

amount of mail you receive. If you wish to stay anonymous, you can

invent a name to use, as long as the postman will deliver it.  ** JUST


MAKE SURE ALL THE ADDRESS ARE CORRECT. **



Now the WHY part :

     Out of 200 postings, say I receive only 5 replies (a very low

example). So then I made $5.00 with my name at #5 on the letter. Now,

each of the 5 persons who just sent me $1.00 make the MINIMUM 200

postings, each with my name at #4 and only 5 persons respond to each

of the original 5, that is another $25.00 for me, now those 25 each

make 200 MINIMUM postings with my name at #3 and only 5 replies each,

I will bring in an additional $125.00! Now, those 125 persons turn

around and post the MINIMUM 200 with my name at #2 and only receive 5

replies each, I will make an additional $625.00! OK, now here is the

fun part, each of those 625 persons post a MINIMUM 200 letters with my


name #1 and the each only receive 5 replies, that just made me

$3,125.00!!! With a original investment of only $5.00! AMAZING! And as


I said 5 respones is actually VERY LOW! Average is probable 20 to 30!

So lets put those figures at just 15 responses per person. Here is

what you will make :


     at #5  $15.00

     at #4  $225.00

     at #3  $3,375.00

     at #2  $50,625.00

     at #1  $759,375.00



When your name is no longer on the list, you just take the latest

posting in the newsgroups, and send out another $5.00 to names on the

list, putting your name at number 5 again. And start posting again.

the thing to remember is, do you realize that thousands of people all

over the world are joining the internet and reading these articles

everyday, JUST LIKE YOU are now!! So can you afford $5.00 and see if

it really works?? I think so...  People have said, "What if the plan

is played out and no one sends you the money? So what! What are the

chances of that happening when there are tons of new honest users and

new honest people who are joining the internet and newsgroups everyday


and are willing to give it a try? Estimates are at 20,000 to 50,000

new users, every day, with thousands of those joining the actual

internet. Remember, play FAIRLY and HONESTLY and this will work. You

just have to be honest. Make sure you print this article out RIGHT

NOW, also. Try to keep a list of everyone that sends you money and

always keep an eye on the newsgroups to make sure everyone is playing

fairly. Remember, HONESTY IS THE BEST POLICY. You don't need to cheat

the basic idea to make the money!!



GOOD LUCK to all and please play fairly and reap the huge rewards from


this, which is tons of extra CASH.  ** By the way, if you try to

deceive people by posting the message with your name in the list and

not sending the money to the rest of the people already on the list,

you will NOT get as much. Someone I talked to knew someone who did

that and he only made about $150.00, and that's after seven or eight

weeks! Then he sent the 5 $1.00 bills, people added him to their

lists, and in 4-5 weeks he had over $10k. This is the fairest and most


honest way I have ever seen to share the wealth of the world with

costing anything but our time!!! You also may want to but mailing and

e-mail lists for future dollars.



Please remember to declare your extra income. Thanks once again....



------------------------------

Date: Tue, 15 Jan 2008 19:55:22 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: Shebang line management
Message-Id: <Xns9A2697CD9CAD4asu1cornelledu@127.0.0.1>

Ben Morrow <ben@morrow.me.uk> wrote in
news:akju55-s1k2.ln1@osiris.mauzo.dyndns.org: 

> 
> Quoth "A. Sinan Unur" <1usa@llenroc.ude.invalid>:

>> ... it has worked for my purposes.
> 
> Fair enough. The question is more general than just Apache-under-
> Windows, though.

I agree

>> My CGI scripts are usually very short, only five or six lines. The 
>> scripts instantiate the handler object and call its handle_request 
>> method. I have not felt it necessary to use MakeMaker for the scripts
>> (although the libraries are indeed packaged properly).
> 
> You can include a script (or scripts) in the module distribution, and
> it will be installed at the same time. If you can work out where to
> install them to in your Makefile.PL, you get 'one-click' CGI
> installation :). 

That makes it easier obviously. I'll follow your advice.

Sinan

-- 
A. Sinan Unur <1usa@llenroc.ude.invalid>
(remove .invalid and reverse each component for email address)
clpmisc guidelines: <URL:http://www.augustmail.com/~tadmc/clpmisc.shtml>



------------------------------

Date: Tue, 15 Jan 2008 19:57:03 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: Shebang line management
Message-Id: <Xns9A2698168BC45asu1cornelledu@127.0.0.1>

Jürgen Exner <jurgenex@hotmail.com> wrote in
news:21gpo314dqv6016j2teeq5ktrjhkuksla0@4ax.com: 

> Steve <SteveSpamTrap@yahoo.com> wrote:
>>     Are there any clever ways of dealing with portability of the
>>     "shebang" 
>>line... when moving Perl scripts across machines (and across operating
>>systems), where the path to Perl may be different?
>>
>>     For instance, I'm stuck doing initial development of some CGI
>>     scripts 
>>on a Windows machine, but then deploying them to a *nix Apache server.
>>For each script, I'm manually cut-n-pasting to replace the:
>>
>>#!"c:/perl/bin/perl.exe"
>>
>>     ... with:
>>
>>#!/usr/bin/perl
> 
> Windows doesn't care about the shebang line, therefore you can use the
> Unix version even on Windows.

Windows shell does not but Apache under Windows does unless the 
ScriptInterpreterSource directive is specified in httpd.conf.

Sinan


-- 
A. Sinan Unur <1usa@llenroc.ude.invalid>
(remove .invalid and reverse each component for email address)
clpmisc guidelines: <URL:http://www.augustmail.com/~tadmc/clpmisc.shtml>



------------------------------

Date: 15 Jan 2008 19:21:52 GMT
From: John Bokma <john@castleamber.com>
Subject: Re: USEFUL perl SCRIPT: NTP verifier
Message-Id: <Xns9A2687F359E83castleamber@130.133.1.4>

Ignoramus25819 <ignoramus25819@NOSPAM.25819.invalid> wrote:

[ my $bad = undef;
 
> Yep. This also means "no, I did not forget to assign its value".

Like I already wrote YMMV, but IMO using mixed "boolean" states (undef/1) 
is not done, and hence I would have avoided the whole issue by using:

   my $bad = 0;

(and probably would have picked a better variable name as well: what is 
bad?)


-- 
John

http://johnbokma.com/mexit/


------------------------------

Date: Tue, 15 Jan 2008 20:57:37 +0100
From: Kees Nuyt <k.nuyt@nospam.demon.nl>
Subject: Re: USEFUL perl SCRIPT: NTP verifier
Message-Id: <ou3qo3l4lrpdnrnljqg1qou7pg77itobfl@dim53.demon.nl>

On Tue, 15 Jan 2008 18:39:28 +0100, "Peter J. Holzer"
<hjp-usenet2@hjp.at> wrote:

>Oh, and BTW, the formula is wrong: It must be 
>
>     	my $roundtrip_delay = ($T4 - $T1) - ($T2 - $T2);

So:    	my $roundtrip_delay = ($T4 - $T1) - 0;
        	my $roundtrip_delay = ($T4 - $T1)

?
Interesting.
-- 
 (  Kees
  )
c[_] Humans believe they are devils pretending to be
     angels when, in fact, the reverse is true.  (#323)


------------------------------

Date: Tue, 15 Jan 2008 21:51:31 +0100
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: USEFUL perl SCRIPT: NTP verifier
Message-Id: <h57qo39bsfosl0i7n120na7h12vd1c7mif@4ax.com>

On Tue, 15 Jan 2008 18:39:28 +0100, "Peter J. Holzer"
<hjp-usenet2@hjp.at> wrote:

>(Oh, and BTW, the formula is wrong: It must be 
>
>     	my $roundtrip_delay = ($T4 - $T1) - ($T2 - $T2);

I didn't read all the rest, but $T2 - $T2 is generally spelt... zero!


Michele
-- 
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
 .'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,


------------------------------

Date: Tue, 15 Jan 2008 22:39:00 +0100
From: "Peter J. Holzer" <hjp-usenet2@hjp.at>
Subject: Re: USEFUL perl SCRIPT: NTP verifier
Message-Id: <slrnfoq9vk.s31.hjp-usenet2@hrunkner.hjp.at>

On 2008-01-15 18:55, John Bokma <john@castleamber.com> wrote:
> "Peter J. Holzer" <hjp-usenet2@hjp.at> wrote:
>
>> (Oh, and BTW, the formula is wrong: It must be 
>> 
>>           my $roundtrip_delay = ($T4 - $T1) - ($T2 - $T2);
>                                                    ^     ^
>
> Heh, I rest my case >:-D
>

I blame my keyboard.

Should have been 

           my $roundtrip_delay = ($T4 - $T1) - ($T3 - $T2);

of course. 

But even the version above reduced the error by 50 % :-).

	hp



------------------------------

Date: Tue, 15 Jan 2008 22:25:02 -0000
From: melsonr@aragorn.rgmhome.net (Robert Melson)
Subject: Re: USEFUL perl SCRIPT: NTP verifier
Message-Id: <13oqclup6pvcue1@corp.supernews.com>

In article <slrnfoprv7.mma.hjp-usenet2@hrunkner.hjp.at>,
	"Peter J. Holzer" <hjp-usenet2@hjp.at> writes:
> ["Followup-To:" header set to comp.lang.perl.misc.]
> On 2008-01-14 18:10, John Bokma <john@castleamber.com> wrote:
>> Ignoramus5390 <ignoramus5390@NOSPAM.5390.invalid> wrote:
>>> On 2008-01-14, John Bokma <john@castleamber.com> wrote:
>>>> undef is the default value, I wouldn't assign it explicitly.
>>> 
>>> I like this style. Makes it very explicit. 
>>
>> IMO Perl programmers should know that the default is undef, and hence no 
>> need to assign undef.
> 
> Explicitely assigning undef does tell the reader something, though:
> It means that from this point on the variable *needs* to have this value
> - it isn't just undef because nobody assigned anything to it yet, it is
> undef because the programmer wants it to be undef.
> 
> 
>>>> Also, I recommend to support at least -h / --help.
>>> 
>>> Is there some standard way of doing it?
>>
>> Perl Best Practices (recommended) recommends:
>>
>> --usage  - one line
>> --help   - --usage line followed by one-line
>>            summary of each option (in my experience
>>            the one-line is to strict)
>> --version
>> --man    - complete documentation of the program
> 
> The Pod::Usage module makes implementing that very simple.
> 
> 
>>>> If you need to explain what IDs mean it clearly shows that the names
>>>> of your variables are not chosen well.
>>> 
>>> They come from NTP specification.
>>
>> OK, clear. That's something you've read to write this, but someone who 
>> reads your program does not always have to be familiar with this 
>> documentation, nor has to read it first IMO.
> 
> The whole comment is copied verbatim from the specs. That's something I
> do, too.
> 
> 
>>     	my $roundtrip_delay = ($T4 - $T1) - ($T2 - $T3);
>>
>> v.s.
>>
>>     	my $roundtrip_delay = ( $destination_ts - $originate_ts )
>>                            - ( $receive_ts     - $transmit_ts  );
>>
>> which is more readable?
> 
> The first, by far. $T1 to $T4 form a logical sequence. It is completely
> clear what they are. I have no idea what the second version means:
> Originated by whom? Received and transmitted by whom? And why is
> "destination" a noun when all others are verbs? Does that mean something
> special?
> 
> (Oh, and BTW, the formula is wrong: It must be 
> 
>      	my $roundtrip_delay = ($T4 - $T1) - ($T2 - $T2);
> 
> RFC 2030 contains the same error - its corrected in 4330)
> 
> 	hp
> 

And, yet, it's a PERL mantra that TMTOWTDI (There's More
Than One Way To Do It).  I think the question to ask is
whether the script/program does what it's intended to do,
not whether its style meets somebody else's idea of what
looks good or has better variable names or ...

-- 
Robert G. Melson | Rio Grande MicroSolutions | El Paso, Texas
-----
Thinking is the hardest work there is, which is the probable
reason so few engage in it.  -- Henry Ford



------------------------------

Date: Tue, 15 Jan 2008 14:04:56 -0800 (PST)
From: pgodfrin <pgodfrin@gmail.com>
Subject: Re: Wait for background processes to complete
Message-Id: <c32b784a-ecd8-46e8-9ddf-4f52c6e2691a@l1g2000hsa.googlegroups.com>

On Jan 14, 2:48 pm, xhos...@gmail.com wrote:
> pgodfrin <pgodf...@gmail.com> wrote:
> > On Jan 14, 11:11 am, xhos...@gmail.com wrote:
>
> > > The fork returns (to the parent) the pid of the process forked off.
> > > (but you don't actually need to know the pid if you merely want to
> > > wait, rather than waitpid.)  If that forked-off process then itself
> > > starts the cp in the background, of course you are no better off.  But
> > > if the forked-off process either becomes cp (using exec) or it starts
> > > up cp in the foreground (using system without a "&"), then you now have
> > > something to wait for.  In the first case, you wait for cp itself.  In
> > > the second case, you wait for the forked-off perl process which is
> > > itself waiting for the cp.
>
> > > $ perl -wle 'use strict; fork or exec "sleep " . $_*3 foreach 1..3 ; \
> > >               my $x; do {$x=wait; print $x} until $x==-1'
> > > 438
> > > 439
> > > 440
> > > -1
>
> > Hi Xho,
> > Well - your code and concepts work fine when you want to wait
> > sequentially.
>
> Is there an alternative to waiting sequentially?  Waiting sequentially
> is what the shell does, too, behind the scenes.
>
> > My goal here is to fire off x number of process and then
> > wait for ALL of them to complete
>
> That is what my code does.
>
> > (this is basically rudimentary job
> > control, trying to use the shell concepts and maximize parallelism).
> > So, that requires the use of the & to send a process to the
> > background.
>
> No, that is not required.  Since Perl is not a shell, there really
> isn't such a thing as the "background" in a Perl context.  However,
> fork will launch another process which runs without blocking the original
> process (well, at least not until the original process asks to be blocked)
> or blocking sibling processes.  That is what you want, no?
>
> > It looks like exec doesn't recognize the &, which leaves
> > the system() command - which leaves us back at square one. The shell
> > completes and the program has nothing to wait for.
>
> Yes, so don't do that.  "&" basically means "Fork and then don't wait".
> Since that isn't what you want to do, then don't do that.  Do your own
> fork, and then do your own wait.
>
> Xho
>
> --
> --------------------http://NewsReader.Com/--------------------
> The costs of publication of this article were defrayed in part by the
> payment of page charges. This article must therefore be hereby marked
> advertisement in accordance with 18 U.S.C. Section 1734 solely to indicate
> this fact.

Hi Xho,
It seems to me that firing off say 5 processes with the '&' character
to send them to the background is 5 parallel processes, while
executing them off one at a time is sequential. Your code (fork or
exec "sleep" ... ) waits for each sleep process to complete - so that
is what I meant by "waiting sequentially". Technically speaking you're
right - but the idea is to have tasks run in parallel versus
sequentially, which is ostensibly faster.

Insofar as using fork() - your original observation still stands -
system() runs a shell command and then terminates after sending the
command within to run (I watched two different PIDs - the long running
command within the system() statement continued while the shell became
<defunct>)

To make a long story short, this is how I solved the problem. It seems
that the PIDs of the commands run via system() and the '&' background
thing end up belonging to the same Process Group - seen in the ps
command, plus a little extra:

ps -C cp -o pid,pgid,command
  PID  PGID COMMAND
29068 29063 cp example01.txt example01.txt.old
29070 29063 cp example02.txt example02.txt.old
29072 29063 cp example03.txt example03.txt.old
29074 29063 cp example04.txt example04.txt.old
29076 29063 cp example05.txt example05.txt.old
29078 29063 cp example06.txt example06.txt.old

So I wrap the ps command and do some looping:

for (;;)
{
   open PGRP, "ps -C cp h |"   ;
   @pidlist=<PGRP> ;
   if ($#pidlist<0) {die "\nNo more processes\n" ;}
}

It's not pretty but it works...

But, I believe this is an architectural FLAW with Perl.

regards,
pg








------------------------------

Date: Tue, 15 Jan 2008 16:16:03 -0600
From: "J. Gleixner" <glex_no-spam@qwest-spam-no.invalid>
Subject: Re: Wait for background processes to complete
Message-Id: <478d30a4$0$10298$815e3792@news.qwest.net>

pgodfrin wrote:
[...]
> So I wrap the ps command and do some looping:
> 
> for (;;)
> {
>    open PGRP, "ps -C cp h |"   ;
>    @pidlist=<PGRP> ;
>    if ($#pidlist<0) {die "\nNo more processes\n" ;}
> }
> 
> It's not pretty but it works...

Why not use Parallel::ForkManager?  It IS pretty and will
use much less system resources, compared to running many
'ps' commands.


> But, I believe this is an architectural FLAW with Perl.

Everyone else believes it's due to your level of knowledge.


------------------------------

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>


Administrivia:

#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc.  For subscription or unsubscription requests, send
#the single line:
#
#	subscribe perl-users
#or:
#	unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.  

NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.

#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V11 Issue 1199
***************************************


home help back first fref pref prev next nref lref last post