[24728] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 6883 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Aug 19 11:10:56 2004

Date: Thu, 19 Aug 2004 08:10:11 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Thu, 19 Aug 2004     Volume: 10 Number: 6883

Today's topics:
    Re: Help: joining 5 LARGE text files <matrix_calling@yahoo.dot.com>
    Re: Help: joining 5 LARGE text files <ithinkiam@gmail.com>
    Re: Help: joining 5 LARGE text files <richard@zync.co.uk>
    Re: Help: joining 5 LARGE text files <matternc@comcast.net>
        how to serialze in soap::lite (Rushikesh Joshi)
    Re: joining 5 LARGE text files <gnari@simnet.is>
        little antivirus network filter (Joseph)
    Re: My own handy Pocket Reference notes (Charles DeRykus)
    Re: Mysql->Connect and Ports (Todd Hlavacek)
    Re: Mysql->Connect and Ports <mritty@gmail.com>
    Re: Net::SFTP ssh_args => [ ] syntax question... <dwall@fastmail.fm>
    Re: Non match word list with Regular Expressions <ec_au_ravi2000@yahoo.com>
    Re: Non match word list with Regular Expressions <gnari@simnet.is>
    Re: trim code for mimic ls -tr <noemail@#$&&!.net>
        what's the best environment to exercise Perl? <end@dream.life>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Thu, 19 Aug 2004 15:51:43 +0530
From: Abhinav <matrix_calling@yahoo.dot.com>
Subject: Re: Help: joining 5 LARGE text files
Message-Id: <Mh%Uc.26$rM6.115@news.oracle.com>

Stuart wrote:
> Hi,
> 
> Please can anyone help me join 5 large (1.8gb) text files togeather
> to create 1 very large file.
> 
> I have some code in PHP but it bombs out at 2gb (seems there is a limit
> and php needs re compiling, something thats not an option for me)
> 

I am not sure whether there is a limit or not, but our db listener log 
files max out at 2 GB (on Linux RHEL with ext2fs ). The listener goes down, 
and we delete the log files before proceeding.

Using a different file system might help .

[SNIP]

--

abhinav


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

Date: Thu, 19 Aug 2004 11:23:23 +0100
From: Chris Cole <ithinkiam@gmail.com>
Subject: Re: Help: joining 5 LARGE text files
Message-Id: <pan.2004.08.19.10.23.20.824883@gmail.com>

On Thu, 19 Aug 2004 03:05:01 -0700, Stuart wrote:

[snipped non-perl stuff]

I don't understand why you've posted this here as this isn't a perl problem!

Having said that you need read up on the 2Gb file size limit on 32-bit
systems (hint: google).


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

Date: Thu, 19 Aug 2004 11:45:18 +0100
From: "Richard Gration" <richard@zync.co.uk>
Subject: Re: Help: joining 5 LARGE text files
Message-Id: <cg20e4$8ob$1@news.freedom2surf.net>

In article <763485f6.0408190205.4606675c@posting.google.com>, "Stuart"
<stuayre@hotmail.com> wrote:


> Hi,
> Please can anyone help me join 5 large (1.8gb) text files togeather to
> create 1 very large file.

There is a limit of 2Gb per file in many Linux kernels / GNU utilities.
This is to do with a pointer being 32bit somewhere deep in the guts of
ANSI C. If you really feel you need to know the details ...

http://www.uwsg.iu.edu/hypermail/linux/kernel/9912.3/0009.html

Or, for more general discussions:

http://www.google.com/search?q=ext2+2Gb

HTH
Rich


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

Date: Thu, 19 Aug 2004 09:42:03 -0400
From: Chris Mattern <matternc@comcast.net>
Subject: Re: Help: joining 5 LARGE text files
Message-Id: <Z6-dnTkw5p2xM7ncRVn-gg@comcast.com>

Stuart wrote:

> Hi,
> 
> Please can anyone help me join 5 large (1.8gb) text files togeather
> to create 1 very large file.

man cat

-- 
             Christopher Mattern

"Which one you figure tracked us?"
"The ugly one, sir."
"...Could you be more specific?"


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

Date: 19 Aug 2004 06:47:32 -0700
From: rushi_asi@yahoo.com (Rushikesh Joshi)
Subject: how to serialze in soap::lite
Message-Id: <a2d4901c.0408190547.5f9d7946@posting.google.com>

Problem:
Whenever i have called your stringArray method with argument of Array
for different style. It work like below...
 
#Pass XML without XML Serialiser & Vector by value
#Pass XML with XML Serialiser & Vector by value
#No any difference in both case
<namesp1:stringArrTest
xmlns:namesp1="com.logicboxes.foundation.sfnb.user.Test">
<stringArrParam xmlns:ns="com.logicboxes.foundation.sfnb.user.Test"
xsi:type="ns:ArrayOf_xsd_string">A</stringArrParam>
<c-gensym4 xsi:type="xsd:string">B</c-gensym4>
<c-gensym6 xsi:type="xsd:string">C</c-gensym6>
</namesp1:stringArrTest>
 
Error String
<faultstring>
org.xml.sax.SAXException: Deserializing parameter
&apos;stringArrParam&apos;:  could not find deserializer for type
{com.logicboxes.foundation.sfnb.user.Test}ArrayOf_xsd_string
</faultstring>
-------------------------------------------------------------------------------------------------------------
 
 
#Pass XML with XML Serialiser & Vector by Reference
<namesp1:stringArrTest
xmlns:namesp1="com.logicboxes.foundation.sfnb.user.Test">
<stringArrParam xmlns:ns="com.logicboxes.foundation.sfnb.user.Test"
xsi:type="ns:ArrayOf_xsd_string">
&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;Vector xmlns="http://localhost/Schemas/VectorSchema.xsd"&gt;
&lt;item&gt;A&lt;/item&gt;
&lt;item&gt;B&lt;/item&gt;
&lt;item&gt;C&lt;/item&gt;
&lt;/Vector&gt;
</stringArrParam>
</namesp1:stringArrTest>
 
Error String
<faultcode>soapenv:Server.userException</faultcode>
<faultstring>
org.xml.sax.SAXException: Deserializing parameter
&apos;stringArrParam&apos;:  could not find deserializer for type
{com.logicboxes.foundation.sfnb.user.Test}ArrayOf_xsd_string
</faultstring>
-------------------------------------------------------------------------------------------------------------
 
 
#Pass XML without XML Serialiser & Vector by Reference
<namesp1:stringArrTest
xmlns:namesp1="com.logicboxes.foundation.sfnb.user.Test">
<stringArrParam SOAP-ENC:arrayType="xsd:string[3]"
xmlns:ns="com.logicboxes.foundation.sfnb.user.Test"
xsi:type="ns:ArrayOf_xsd_string">
<item xsi:type="xsd:string">A</item>
<item xsi:type="xsd:string">B</item>
<item xsi:type="xsd:string">C</item>
</stringArrParam>
</namesp1:stringArrTest>
 
Error String
<faultcode>soapenv:Server.userException</faultcode>
<faultstring>org.xml.sax.SAXException: No deserializer defined for
array type {http://www.w3.org/1999/XMLSchema}string</faultstring>
-------------------------------------------------------------------------------------------------------------
 
Problem
Now whenever i have called your IntArray method withour any arguments
it returns below error.

<faultcode>soapenv:Server.generalException</faultcode>
<faultstring>Method &apos;intArrTest&apos; does not match any of the
valid signatures for message-style service methods
</faultstring>
-------------------------------------------------------------------------------------------------------------
 
Problem
Now my question is how can i serialize this inputs actually the same
XML for PHP/JAVA & .NET works fine.
Once look at below input that works fine.

For PHP/JAVA
<stringArrParam xsi:type="SOAP-ENC:Array"
SOAP-ENC:arrayType="xsd:string[3]">
<item xsi:type="xsd:string">A</item>
<item xsi:type="xsd:string">B</item>
<item xsi:type="xsd:string">C</item>
</stringArrParam>

For .NET
<stringArrParam href="#id1" />
<soapenc:Array id="id1" soapenc:arrayType="xsd:string[3]">
<item xsi:type="xsd:string">A</item>
<item xsi:type="xsd:string">B</item>
<item xsi:type="xsd:string">C</item>
</soapenc:Array>

Thanks & Regards,
Rushikesh Joshi
Mega E-Services Pvt. Ltd.
AIM:MESRushikesh
rushikesh@megaeservices.com
Tel:  +91 (22) 22023015/5837
Fax: +91 (22) 22843963
Cell: +91-98195-93095


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

Date: Thu, 19 Aug 2004 10:45:15 -0000
From: "gnari" <gnari@simnet.is>
Subject: Re: joining 5 LARGE text files
Message-Id: <cg207v$hpr$1@news.simnet.is>

"Stuart" <stuayre@hotmail.com> wrote in message
news:763485f6.0408190205.4606675c@posting.google.com...
> Hi,
>
> Please can anyone help me join 5 large (1.8gb) text files togeather
> to create 1 very large file.

if your filesystem supports such large files, use cat

cat file[12345].txt > bigfile.txt

gnari






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

Date: 19 Aug 2004 07:50:08 -0700
From: jcharth@hotmail.com (Joseph)
Subject: little antivirus network filter
Message-Id: <2f2b8b0b.0408190650.6aa23c41@posting.google.com>

Hello I wrote a little script that scans packets for virus, so far it
has detected a few virus in my network. i would like to rewrite it to
append packets that belong to the same connection but so far it has
detected a few virus. here is the code i am sure it would be more
usefull if i write it so it blocks trafic with iptables but maybe
someone else would like to play with it, here is the code
#!/usr/local/bin/perl5.6.1
use CGI;
use Socket;
use Time::gmtime;
my $traffic="traffic";
use strict;
use Mail::ClamAV;


my $tcpdump = "";
my $cou = 0;
my $firstchar ="";
my $destring;
my $buffer="";
my $status; 

my $c = new Mail::ClamAV("/usr/local/share/clamav")
            or die "Failed to load db: $Mail::ClamAV::Error";

$c->buildtrie;



 open(NET, "ngrep |")    || die "can't fun netstat: $!";

 while (<NET>) { 

$tcpdump = $_;

$firstchar  = substr($tcpdump,0,1);

if ( $firstchar eq "T"){
$destring = $tcpdump;
#print "$tcpdump here \n" ;
#print "$firstchar here \n" ;
}else {

if ( $firstchar eq "#"){
$status = $c->scanbuff($buffer);
if ($status->virus) {
print "virus -> $destring";
}
$buffer = ""; 

}else {
$tcpdump = substr($tcpdump,2,length($tcpdump)-3);
$buffer = $buffer.$tcpdump;




}

} 



}
 close(NET)                      || die "can't close netstat: $!";


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

Date: Thu, 19 Aug 2004 13:04:02 GMT
From: ced@bcstec.ca.boeing.com (Charles DeRykus)
Subject: Re: My own handy Pocket Reference notes
Message-Id: <I2p2yq.Dwr@news.boeing.com>

In article <86brh9xvt6.fsf@blue.stonehenge.com>,
Randal L. Schwartz <merlyn@stonehenge.com> wrote:
>>>>>> "Jeff" == Jeff 'japhy' Pinyan <pinyaj@rpi.edu> writes:
>
>Jeff> On 17 Aug 2004, Randal L. Schwartz wrote:
>>> Please shoot the person who came up with that cute hack.  That's
>>> just as cutesey (and dangerous) as rename $x => $y.  Ugh.
>
>Jeff> What, specifically, is dangerous about
>
>Jeff>   rename $x => $y;
>
>Jeff> Apart from a lack of error-checking, I mean.  I thought that was 
>Jeff> a rather clever use of the => comma to signify a "becoming" 
>Jeff> relationship.
>
>Because it breaks as a general pattern.  Witness:
>
>    use constant INCOMING => "/tmp/incoming.file.txt";
>    ...
>    rename INCOMING => $new or die "Cannot rename ... ";
>
>The problem is that once you start showing the pattern, the newbies
>will combine it, not realizing that a fat arrow autoquotes the left
>arg.  Ooops.  Cargoculting breaking things again.
>

Maybe suprising but true ...

use B::Deparse;
use constant FOO => "foo";
use strict;
use warnings;
print B::Deparse->new->coderef2text( sub {rename FOO => "bar"} );

output:

{
    rename 'FOO', 'bar';
}


--
Charles DeRykus


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

Date: 19 Aug 2004 05:57:29 -0700
From: toddh@lucent.com (Todd Hlavacek)
Subject: Re: Mysql->Connect and Ports
Message-Id: <8abf1b57.0408190457.2083c0cf@posting.google.com>

Hi Matthew,

Interesting because my version of perldoc does not pull up that info. 
Here's the first part of that mysql as shown by perldoc:

NAME
    Msql / Mysql - Perl interfaces to the mSQL and mysql databases

SYNOPSIS
      use Msql;

      $dbh = Msql->connect($host);
      $dbh = Msql->connect($host, $database);

          or

      use Mysql;

      $dbh = Mysql->connect(undef, $database, $user, $password);
      $dbh = Mysql->connect($host, $database, $user, $password);

          or

      $dbh = Msql1->connect($host);
      $dbh = Msql1->connect($host, $database);

      $dbh->selectdb($database);

      @arr = $dbh->listdbs;

I'm using activeperl 5.6.1 (no, we can't upgrade...yet).  In that
version, there's no mention of ports.

Thanks to all!  I'll try that.
Todd

Matthew Braid <mb@uq.net.au.invalid> wrote in message news:<cg19t8$28n$1@bunyip.cc.uq.edu.au>...
> Todd Hlavacek wrote:
> > Hello all,
> > 
> > A quick question to the community.  I'm trying to figure out how to
> > use the Mysql->connect with multiple databases.  Somewhere in Google,
> > some guy said "RTFM perldoc DBD/mysql".  I did and that documentation
> > does not have info on accessing multiple mysql databases on different
> > ports.
> > 
> > I was wondering that since there is no mention of support for multiple
> > mysql database instances in the Mysql module, I wonder if we fall back
> > to DBI->connect... with the port in the arguments passed to the
> > connect parameter?
> > 
> > Just wondering...
> > Thanks,
> > Todd
> 
> The person who told you to RTFM was right - these are the first 7 lines of 
> perldoc DBD::mysql:
> 
> NAME
>         DBD::mysql - MySQL driver for the Perl5 Database Interface (DBI)
> 
> SYNOPSIS
>             use DBI;
> 
>             $dsn = "DBI:mysql:database=$database;host=$hostname;port=$port";
>                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> 
> What are you missing here?
> 
> To spell it out for you:
> 
> my $one_db =
>    DBI->connect("DBI:mysql:database=FirstDB;host=FirstHost;port=3306");
> my $two_db =
>    DBI->connect("DBI:mysql:database=SecondDB;host=SecondHost;port=9999");
> 
> Don't forget your usernames and passwords and you're set.


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

Date: Thu, 19 Aug 2004 09:02:53 -0400
From: Paul Lalli <mritty@gmail.com>
Subject: Re: Mysql->Connect and Ports
Message-Id: <20040819085945.N2996@barbara.cs.rpi.edu>

On Thu, 19 Aug 2004, Todd Hlavacek wrote:

> Matthew Braid <mb@uq.net.au.invalid> wrote in message news:<cg19t8$28n$1@bunyip.cc.uq.edu.au>...
> > The person who told you to RTFM was right - these are the first 7 lines of
> > perldoc DBD::mysql:
> >
> > NAME
> >         DBD::mysql - MySQL driver for the Perl5 Database Interface (DBI)
> >
> > SYNOPSIS
> >             use DBI;
> >
> >             $dsn = "DBI:mysql:database=$database;host=$hostname;port=$port";
> >                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> >
> > What are you missing here?
> >
> > To spell it out for you:
> >
> > my $one_db =
> >    DBI->connect("DBI:mysql:database=FirstDB;host=FirstHost;port=3306");
> > my $two_db =
> >    DBI->connect("DBI:mysql:database=SecondDB;host=SecondHost;port=9999");
> >
> > Don't forget your usernames and passwords and you're set.
>
> Hi Matthew,
>
> Interesting because my version of perldoc does not pull up that info.
> Here's the first part of that mysql as shown by perldoc:
>
> NAME
>     Msql / Mysql - Perl interfaces to the mSQL and mysql databases
>
> SYNOPSIS
>       use Msql;
>

<snip>

> I'm using activeperl 5.6.1 (no, we can't upgrade...yet).  In that
> version, there's no mention of ports.

Please don't top post.  That means please don't post your reply above what
you're replying to.  Thank you.

You're talking about two different modules.  You're using the MySql
module, whereas Matthew is telling you to use the DBI and DBD::mysql
modules.  Their syntaxes are not the same, as they are different modules.
I believe most people prefer the DBI module because you can very easily
swap out the current DBD::xxx module and replace it with another if/when
you change Database systems.  The DBI syntax will remain the same no
matter what database you use.

Paul Lalli


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

Date: Thu, 19 Aug 2004 14:20:09 -0000
From: "David K. Wall" <dwall@fastmail.fm>
Subject: Re: Net::SFTP ssh_args => [ ] syntax question...
Message-Id: <Xns954A6923E8A64dkwwashere@216.168.3.30>

Icari <icari.eccles@gmail.com> wrote in message
<news:e0097116.0408181057.2c042d65@posting.google.com>: 

> There's an example psftp script in the Net::SFTP module directory
> which defines the following argument hash to pass into sftp:
> 
> my %args = (ssh_args => []);  # from the perl man pages, it looks
> like 
>                               # ssh_args can be any arguments
>                               # accepted by Net::SSH, so I guess
>                               # I can put a hash list within
>                               # a hash?

I'm not sure I understand the question, plus you mention Net::SSH 
when Net::SFTP uses Net::SSH::Perl instead of Net::SSH. But, yes, you 
can put a hash inside the anonymous array following 'ssh_args', e.g.;

my %params = ( port => 22 );
my %args = (ssh_args => [%params]);

But that's a rather long-winded way of doing it, and in my opinion 
it's a bit obfuscated. More plainly: yecch! :-)

> I wasn't able to run that script cleanly to test if my Net::SFTP
> module was installed correctly so I wrote a smaller script to
> test: 
> 
> #!/usr/local/bin/perl
> use strict;
> 
> use Net::SFTP;
> 
><$host, $user and $pass definined here>
> my %args = (user => "$user", password => "$pass");
> my $sftp = Net::SFTP->new($host, %args);
> $sftp->put("testfile", "/var/tmp/remotetest");
> 
> When I ran my transfer program, it exits with a complaint that it
> does not know what port 'ssh' is and made reference to the
> Net::SSH::Perl pm file...

The docs for Net::SFTP also refer you to Net::SSH::Perl....

> I added ssh port 22 in my /etc/services file to temporarily fix
> this, but I am really curious as to how I can define the ssh port
> within my argument hash?

It seems you read the docs for Net::SFTP and Net::SSH::Perl, because 
the code below defines the ssh port just as the docs recommend. But 
ssh_args is not really associated with a hash, but a scalar: a 
reference to an anonymous array. You might benefit from reading 
perlreftut and perlref. In particular, see "Make Rule 2" in 
perlreftut.

> my %args = (user => "$user", password => "$pass", ssh_args =>
> [port => 22]);

$user and $pass don't need to have quotes around them, though. See 
'perldoc -q quoting' for why this is generally a bad idea.
 
> Is the above right?  I don't see the [ ] signs used too often
> outside of pattern class definitions, the only time I saw this was
> with slices so I'm not sure what the correct way to input
> additional ssh arguments into the ssh_args option.

The docs call for a reference to a list of named arguments; [] is the 
most convenient way to write this. If you also wanted to turn on 
compression, here's one way to write it:

my $sftp = Net::SFTP->new( $host,     
    user     => $user, 
    password => $pass, 
    ssh_args => [port => 22, compression => 1]
);

Caveat: I've never used Net::SFTP, the above code is untested and 
based purely on a quick reading of the docs.

-- 
David Wall


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

Date: 19 Aug 2004 03:12:07 -0700
From: "ravi" <ec_au_ravi2000@yahoo.com>
Subject: Re: Non match word list with Regular Expressions
Message-Id: <cg1udn$v2b@odak26.prod.google.com>

If you mean, the line should not match the above regex, you can use
$line !~ /</?(table|tbody|thead|tr|td).*?>/

Chris Chandler wrote:
> Hello
>
> Is it possible to include a list of words NOT to match in a regular
> expression?
>
> I have used a simple expression such as:
>
> </?(table|tbody|thead|tr|td).*?>
>
> to match any of these html tags (or closing tags).
>
> Is it possible to do the reverse and specify a list of terms NOT to
be
> matched, ie. Don't match <b> or <ul> tags but match all others?
> 
> Regards
> Chris Chandler



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

Date: Thu, 19 Aug 2004 10:41:54 -0000
From: "gnari" <gnari@simnet.is>
Subject: Re: Non match word list with Regular Expressions
Message-Id: <cg201m$hpm$1@news.simnet.is>

"ravi" <ec_au_ravi2000@yahoo.com> wrote in message
news:cg1udn$v2b@odak26.prod.google.com...

[top posting fixed and trimmed]

> Chris Chandler wrote:
> > Is it possible to include a list of words NOT to match in a regular
> > expression?
> >
> > I have used a simple expression such as:
> >
> > </?(table|tbody|thead|tr|td).*?>
> >
> > to match any of these html tags (or closing tags).
> >
> > Is it possible to do the reverse and specify a list of terms NOT to
> be
> > matched, ie. Don't match <b> or <ul> tags but match all others?
>
> If you mean, the line should not match the above regex, you can use
> $line !~ /</?(table|tbody|thead|tr|td).*?>/

he did not mean that.
the correct answer is that you should use a HTML parser to parse HTML,
but the regex answer is to use a zero-width negative look-ahead assertion.

see perldoc perlre

gnari





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

Date: Thu, 19 Aug 2004 06:47:50 -0500
From: Fred <noemail@#$&&!.net>
Subject: Re: trim code for mimic ls -tr
Message-Id: <pan.2004.08.19.11.47.50.205487@#$&&!.net>

Many thanks to all who replied, you've given me a lot to chew on. I never
fail to learn a lot when I come here.
FSD


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

Date: Thu, 19 Aug 2004 23:03:50 +0800
From: Alont <end@dream.life>
Subject: what's the best environment to exercise Perl?
Message-Id: <4124c04b.120789937@130.133.1.4>

what's the best convenient environment to exercise Perl?
I'm new in perl, I'll make many syntax or other error in perl, so I
want a good environment to write->execute...
my platform is windows xp

      Your fault as a Government is My failure as a citizen


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

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 V10 Issue 6883
***************************************


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