[31553] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2812 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Feb 10 06:09:20 2010

Date: Wed, 10 Feb 2010 03:09:06 -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           Wed, 10 Feb 2010     Volume: 11 Number: 2812

Today's topics:
    Re: can I get a new httpd.conf file <john@castleamber.com>
    Re: can I get a new httpd.conf file <tadmc@seesig.invalid>
    Re: can I get a new httpd.conf file <tadmc@seesig.invalid>
    Re: can I get a new httpd.conf file <john@castleamber.com>
    Re: can I get a new httpd.conf file <tadmc@seesig.invalid>
    Re: can I get a new httpd.conf file <john@castleamber.com>
    Re: can I get a new httpd.conf file <RedGrittyBrick@spamweary.invalid>
        How to do variable-width look-behind? <jl_post@hotmail.com>
        look up very large table <ela@yantai.org>
    Re: Math not working <nospam-abuse@ilyaz.org>
    Re: Reading binary file created a C++ program inside a  <freesoft12@gmail.com>
    Re: Reading binary file created a C++ program inside a  sln@netherlands.com
    Re: Reading binary file created a C++ program inside a  <peter@makholm.net>
    Re: shebang and ubuntu <kst-u@mib.org>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Tue, 09 Feb 2010 15:25:59 -0600
From: John Bokma <john@castleamber.com>
Subject: Re: can I get a new httpd.conf file
Message-Id: <87d40e14pk.fsf@castleamber.com>

ccc31807 <cartercc@gmail.com> writes:

> On Feb 9, 3:33 pm, Myron <delcofiftyf...@gmail.com> wrote:
>> I am writing this in an effort to keep this group healthy so it don't
>> go down in flames like many others.  I haven't participated in
>> newsgroups for about 10 years.  I am using a Perl scrpt and will edit
>> it in the future, and it would be nice to have someplace I could go
>> for help.
>
> Develop a thick skin and pay no attention to the insulting jerks (of
> which I have been one and probably will be one again.)

I for sure have been one, but I try to avoid being one.

> Sometimes, the insults have a point, and wittingly or not you deserve
> to be the target of the insults. I have been such a target and
> probably will be again.

It's a sad world where it's ok to be a target of insults.

Anyway, to the OP: you may try your luck next time at sites like
stackoverflow. So far I haven't seen what some call Usenet attitude. And
let's hope, when this group dries up (in give or take a year or so),
this attitude will not move to those sites.

-- 
John Bokma                                                               j3b

Hacking & Hiking in Mexico -  http://johnbokma.com/
http://castleamber.com/ - Perl & Python Development


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

Date: Tue, 09 Feb 2010 16:20:54 -0600
From: Tad McClellan <tadmc@seesig.invalid>
Subject: Re: can I get a new httpd.conf file
Message-Id: <slrnhn3nne.6g3.tadmc@tadbox.sbcglobal.net>

Myron <delcofiftyfive@gmail.com> wrote:

> Also I would like an appoligy from Tad McClellan for
> asserting that I was rude by asking a question in ignorance, and
> replying to his question.


Here is everything I said in my 2 followups to you:

    How does your question relate to the Perl programming language?

    It is bad manners to quote .sigs.

    Your question does NOT relate to the Perl programming language.

    The steps for configuring Apache/CGI would be the same if you were
    using any other programming language.

along with a link to where you could find help with your problem.

Where is the assertion of rudeness that you accuse me of?

(that is not a rhetorical question, I truly don't see the
 claimed assertion there.)


I did not call you rude in any of my followups.

I would like an apology from Myron for making a false accusation.


> I am using a Perl scrpt and will edit
> it in the future, and it would be nice to have someplace I could go
> for help.


If you have a question related to Perl programming, then post it
here. There was a good chance that I would have answered it, but
there are plenty of other folks here that can likely answer it.


-- 
Tad McClellan
email: perl -le "print scalar reverse qq/moc.liamg\100cm.j.dat/"


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

Date: Tue, 09 Feb 2010 16:27:31 -0600
From: Tad McClellan <tadmc@seesig.invalid>
Subject: Re: can I get a new httpd.conf file
Message-Id: <slrnhn3o3r.6g3.tadmc@tadbox.sbcglobal.net>

John Bokma <john@castleamber.com> wrote:

> It's a sad world where it's ok to be a target of insults.


I cannot find a single insult in this thread that was directed at the OP.

Could you please point one out?


-- 
Tad McClellan
email: perl -le "print scalar reverse qq/moc.liamg\100cm.j.dat/"


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

Date: Tue, 09 Feb 2010 18:09:51 -0600
From: John Bokma <john@castleamber.com>
Subject: Re: can I get a new httpd.conf file
Message-Id: <8763660x4g.fsf@castleamber.com>

Tad McClellan <tadmc@seesig.invalid> writes:

> John Bokma <john@castleamber.com> wrote:
>
>> It's a sad world where it's ok to be a target of insults.

My reply was directed at what ccc31807 wrote.

> I cannot find a single insult in this thread that was directed at the OP.

Yeah, maybe /that/'s where the problem resides.

> Could you please point one out?

Funny you should ask. You consider hiding a URL behind tinyurl.com not
an insult? I also notice that you've been selectively quoting yourself
in your reply to the OP leaving that part out...

Since you wrote earlier:

> I will not be honoring your request.
>
> Best to filter out my posts.

I have more the feeling that you're trolling than anything else.

-- 
John Bokma                                                               j3b

Hacking & Hiking in Mexico -  http://johnbokma.com/
http://castleamber.com/ - Perl & Python Development


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

Date: Tue, 09 Feb 2010 18:37:18 -0600
From: Tad McClellan <tadmc@seesig.invalid>
Subject: Re: can I get a new httpd.conf file
Message-Id: <slrnhn3vn6.6qb.tadmc@tadbox.sbcglobal.net>

John Bokma <john@castleamber.com> wrote:
> Tad McClellan <tadmc@seesig.invalid> writes:
>
>> John Bokma <john@castleamber.com> wrote:
>>
>>> It's a sad world where it's ok to be a target of insults.
>
> My reply was directed at what ccc31807 wrote.
>
>> I cannot find a single insult in this thread that was directed at the OP.
>
> Yeah, maybe /that/'s where the problem resides.


It is a problem that nobody insulted the OP?


>> Could you please point one out?
>
> Funny you should ask. You consider hiding a URL behind tinyurl.com not
> an insult? I also notice that you've been selectively quoting yourself
> in your reply to the OP leaving that part out...


I left that part out because you asked me to.

_That_ request seemed a reasonable one to me.


-- 
Tad McClellan
email: perl -le "print scalar reverse qq/moc.liamg\100cm.j.dat/"


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

Date: Tue, 09 Feb 2010 19:55:06 -0600
From: John Bokma <john@castleamber.com>
Subject: Re: can I get a new httpd.conf file
Message-Id: <87r5ot97np.fsf@castleamber.com>

Tad McClellan <tadmc@seesig.invalid> writes:

[ tinyurl ]
> I left that part out because you asked me to.
>
> _That_ request seemed a reasonable one to me.

Clear Tad, and thank you very much.

You probably also understand that kill filing regulars is not an option
;-) So I was somewhat hoping that my request, to not post immediately a
reply when a question is clearly a violation of the posting guidelines,
would also make sense.

To be honest, I try to avoid answering the simple questions as much as
possible so that I a) have more time to read the answers to harder
questions and b) if possible contribute to those. It's not that simple
questions are below me, I mean I love to answer them, but I don't
consider it productive if 7 people all post nearly the same answer over
an hour.

Anyway, thanks for reading my replies, who knows :-)

-- 
John Bokma                                                               j3b

Hacking & Hiking in Mexico -  http://johnbokma.com/
http://castleamber.com/ - Perl & Python Development


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

Date: Wed, 10 Feb 2010 10:09:57 +0000
From: RedGrittyBrick <RedGrittyBrick@spamweary.invalid>
Subject: Re: can I get a new httpd.conf file
Message-Id: <4b7285f5$0$2477$db0fefd9@news.zen.co.uk>

On 09/02/2010 16:41, John Bokma wrote:
>
> *But* 5+ regulars posting all the same knee jerking message is also
> annoying.

John, I do think you're over-reacting in this instance. I only count 
four responses to the OP, maybe the fifth didn't reach my news server. 
I'm sure you are aware of the propagation delays that can cause several 
people to respond before other responses become visible to them.

I was one of those four responders - I directed Myron to an appropriate 
newsgroup, he followed up there and was provided with some help there. 
Even though the subject was off-topic here I also provided some specific 
suggestions that I thought might help in future.

Now you seem to be labelling me as a knee jerking reprobate!

Your own knees look a little twitchy to me ;-)





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

Date: Tue, 9 Feb 2010 15:23:34 -0800 (PST)
From: "jl_post@hotmail.com" <jl_post@hotmail.com>
Subject: How to do variable-width look-behind?
Message-Id: <c701a48f-019d-4f19-8581-b366d68ab28a@u5g2000prd.googlegroups.com>

Hi,

   I have a Perl script that processes multi-line input.  The problem
is, sometimes this input has newlines stuck in arbitrary places (such
as right in the middle of a valid token).  This makes the input out-of-
spec, but I have no control over this, so I want to correct it if I
can.  What's more is, sometimes this newline breaks a token in two,
where the first half still looks like a valid token while the other
does not, and vice-versa.

   I'm trying to modify my Perl script so that it reviews every
newline and see if it should be discarded.  The logic I want to use is
to throw out every newline UNLESS it is flanked (on both sides) by
valid tokens.  I would like to be able to do something like this:

   # Create a regular expression that matches tokens
   # like "N50E40", "N50 E40", "N5000 E4000",
   # "50N40E", "50N 40E", and "5000N4000E":
   my $tokenRegExp = qr/\b(?:[NS]\d+\s*[EW]\d+|\d+[NS]\s*\d+[EW])\b/;

   # Remove newlines that are not surrounded by valid tokens:
   $input =~ s/(?<!$tokenRegExp)\n(?=$tokenRegExp)//g;  # no token
before
   $input =~ s/(?<=$tokenRegExp)\n(?!$tokenRegExp)//g;  # no token
after
   $input =~ s/(?<!$tokenRegExp)\n(?!$tokenRegExp)//g;  # no tokens

   The problem is is that the look-behind assertions (both positive
and negative) only work for fixed-width expressions, according to
"perldoc perlre".  Unfortunately, it would be so useful for me to be
able to match a string with a variable look-behind, that I'm hoping
there's a logical work-around to this limitation.

   Is there any way for me to work around this limitation?

   Thanks.

   -- Jean-Luc


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

Date: Wed, 10 Feb 2010 18:57:02 +0800
From: "ela" <ela@yantai.org>
Subject: look up very large table
Message-Id: <hku3e0$3fs$1@ijustice.itsc.cuhk.edu.hk>

I have some large data in pieces, e.g.

asia.gz.tar 300M

or

roads1.gz.tar 100M
roads2.gz.tar 100M
roads3.gz.tar 100M
roads4.gz.tar 100M

I wonder whether I should concatenate them all into a single ultra large 
file and then perform parsing them into a large table (I don't know whether 
perl can handle that...).

The final table should look like this:

ID1  ID2  INFO
X1   Y9     san diego; california; West Coast; America; North Ameria; Earth
X2.3   H9     Beijing; China; Asia
 ....

each row may come from a big file of >100M (as aforementioned):

CITY    Beijing
NOTE    Capital
RACE    Chinese
 ...

And then I have another much smaller table which contains all the ID's 
(either ID1 or ID2, maybe 100,000 records, <20M). and I just need to make 
this 20M file annotated with the INFO. Hashing seems not to be a solution 
for my 32G, 8-core machine...

Any advice? or should i resort to some other languages?









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

Date: Wed, 10 Feb 2010 04:17:17 +0000 (UTC)
From: Ilya Zakharevich <nospam-abuse@ilyaz.org>
Subject: Re: Math not working
Message-Id: <slrnhn4cqd.3h0.nospam-abuse@powdermilk.math.berkeley.edu>

On 2010-02-09, Ben Morrow <ben@morrow.me.uk> wrote:
>> > Would you agree with me that new overload types
>> > *must* default to falling back

>> How would "new" types be different from the "old" ones?  The problem
>> existed back then; what changed?

> What changed is that there are now published classes that use some
> overloading, don't specify fallback, and don't overload the new type.
> Take for example the new "qr" overload. Under 5.10 and earlier, treating
> an object as a regex would invoke the stringify overload, so 5.12 must
> continue to do so for objects that don't have a qr overload *even* if
> fallback was not requested.

Hmm, I deduce that under "overload types" you meant "overloaded
operation"?  If, yes, of course...

Ilya


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

Date: Tue, 9 Feb 2010 17:10:38 -0800 (PST)
From: "freesoft12@gmail.com" <freesoft12@gmail.com>
Subject: Re: Reading binary file created a C++ program inside a Perl prog
Message-Id: <b831b880-bc27-454d-901b-bfcf8cf2f0bb@b18g2000vba.googlegroups.com>

Sorry about that, I posted the Perl program that I was playing with.
Here is the orig Perl program:

while (<IN>) {
  my $size = 0;
  read(IN,$size,1);
  my $string = undef;
  read(IN,$string,$size);
  print "$string\n";
}
close(IN);



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

Date: Tue, 09 Feb 2010 17:29:27 -0800
From: sln@netherlands.com
Subject: Re: Reading binary file created a C++ program inside a Perl prog
Message-Id: <2l24n51rc7hcgjbej4eqp2kgts91t6ea00@4ax.com>

On Tue, 9 Feb 2010 11:16:30 -0800 (PST), "freesoft12@gmail.com" <freesoft12@gmail.com> wrote:

>Hi,
>
>I have a written a C++ program that writes a set of paths into a
>binary file. In the program, the 'write_binary()', writes to the
>binary file and the 'read_binary()' opens the binary file, reads the
>data and prints it out.
>
[your code snipped]

It looks like you are dealing with strings and is a simple case of
writing the length and string combo's.

If thats all your doing, the solution is to mitigate machine dependencies.
There's really no need to travel down the *binary* highway unless you have to.
The Perl itself couldn't be simpler, its almost a one liner.

-sln

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

// JBin.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <string>
#include <vector>

using namespace std;

void write_binary();
void read_binary();

int _tmain(int argc, _TCHAR* argv[])
{
    write_binary();
    read_binary();
    system("perl ../jbin.pl");
    return 0;
}

//
void write_binary()
{
    vector<string> v;
    v.push_back( "/a/b/c/d");
    v.push_back( "/e/f");
    v.push_back( "../h");

    FILE *fp = fopen( "rw_binary.dat", "w");  // wb ??
    if (!fp)
    {
        printf( "Error: Unable to open ./rw_binary.dat for write\n");
        exit(1);
    }
    char buf[100];
    for( vector<string>::const_iterator it(v.begin()),itEnd(v.end()); it!=itEnd; it++)
    {
        strcat( itoa( it->size(), buf, 10), "\n");
        fputs( buf, fp);
        fputs( it->c_str(), fp);
    }
    fclose(fp);
}

//
void read_binary()
{
    FILE *fp = fopen( "rw_binary.dat", "r");  // rb ??
    if (!fp)
    {
        printf( "Error: Unable to open ./rw_binary.dat for read\n");
        exit(1);
    }
    printf( "\nFrom C++ ...\n");
    char buf[100];
    while (!feof(fp) && fgets( buf, 100, fp))
    {
        size_t count = atoi( buf);
        char *sdata = (char *)malloc( count+1);
        memset( sdata, 0, count+1);
        fread( sdata, count, 1, fp);
        printf( "'%s'\n", sdata);
        free( sdata);
    }
    fclose(fp);
}

/*
# Jbin.pl
use strict;
use warnings;

open (my $fh, '<', 'rw_binary.dat') or die "Cannot open 'rw_binary.dat' for read: $!";
print "\nFrom perl ...\n";

my $buf;
while (<$fh>) {
    read ($fh, $buf, $_);
    print "'$buf'\n";
}
close($fh);
__END__
*/

/* Console output:

From C++ ...
'/a/b/c/d'
'/e/f'
'../h'

From perl ...
'/a/b/c/d'
'/e/f'
'../h'
Press any key to continue . . .
*/




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

Date: Wed, 10 Feb 2010 08:03:42 +0100
From: Peter Makholm <peter@makholm.net>
Subject: Re: Reading binary file created a C++ program inside a Perl prog
Message-Id: <87bpfxd12p.fsf@vps1.hacking.dk>

"freesoft12@gmail.com" <freesoft12@gmail.com> writes:

> Sorry about that, I posted the Perl program that I was playing with.
> Here is the orig Perl program:

Many of the comments made by Peter J. Holzer and me still apply. 

//Makholm


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

Date: Tue, 09 Feb 2010 14:09:13 -0800
From: Keith Thompson <kst-u@mib.org>
Subject: Re: shebang and ubuntu
Message-Id: <lnbpfyhxiu.fsf@nuthaus.mib.org>

Phred Phungus <Phred@example.invalid> writes:
[...]
> dan@dan-desktop:~/source42$ chmod u + x t1.pl
> chmod: invalid mode: `u'
> Try `chmod --help' for more information.
> dan@dan-desktop:~/source42$ chmod u+x t1.pl
> dan@dan-desktop:~/source42$ ls -l
> total 32
> -rw-r--r-- 1 dan dan  2556 2010-02-07 18:46 b1.c
> -rw-r--r-- 1 dan dan  2555 2010-02-07 18:46 b1.c~
> -rwxr-xr-x 1 dan dan 13344 2010-02-07 18:47 out
> -rwxr--r-- 1 dan dan   138 2010-02-08 01:34 t1.pl
> -rw-r--r-- 1 dan dan    31 2010-02-08 01:30 t1.pl~
[...]

Personally, I find the repeated occurrences of your rather long
shell prompt districting.  They make it more difficult to read the
actual information.  I'm sure I'm not the only one who thinks so.

I suggest shortening your prompt to something like "$ ".  You can
do this by (carefully!) editing the output after you copy-and-paste
it, but that risks losing information.  It's probably safer to
change your prompt, run the commands, copy-and-paste the output,
and then change it back.  (I'm not suggesting you should change the
prompt for your own use, only for what you post here.)

For example, the above would be:

$ chmod u + x t1.pl
chmod: invalid mode: `u'
Try `chmod --help' for more information.
$ chmod u+x t1.pl
$ ls -l
total 32
-rw-r--r-- 1 dan dan  2556 2010-02-07 18:46 b1.c
-rw-r--r-- 1 dan dan  2555 2010-02-07 18:46 b1.c~
-rwxr-xr-x 1 dan dan 13344 2010-02-07 18:47 out
-rwxr--r-- 1 dan dan   138 2010-02-08 01:34 t1.pl
-rw-r--r-- 1 dan dan    31 2010-02-08 01:30 t1.pl~

which I find much easier to read.

The only useful part of the prompt is the current directory, but
you could achieve that by using an explicit "cd" command.  (It's not
really necessary here, since knowing that you're in ~/source42
doesn't help us.)

-- 
Keith Thompson (The_Other_Keith) kst-u@mib.org  <http://www.ghoti.net/~kst>
Nokia
"We must do something.  This is something.  Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"


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

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:

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

Back issues are available via anonymous ftp from
ftp://cil-www.oce.orst.edu/pub/perl/old-digests. 

#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 2812
***************************************


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