[23636] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5843 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Nov 21 18:05:45 2003

Date: Fri, 21 Nov 2003 15:05: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           Fri, 21 Nov 2003     Volume: 10 Number: 5843

Today's topics:
        ANNOUNCE: DBIx::XMLServer 0.01 <martin@boojum.org.uk>
        ANNOUNCE: Statistics::LineFit 0.02 (Richard Anderson)
    Re: DES has no destroy.al <ggershSNACK@CAKEctc.net>
    Re: DES has no destroy.al (Anno Siegel)
        Executing Perl from PHP <dan@mathjunkies.com>
    Re: first line in each file in a dir <xx087@freenet.carleton.ca>
    Re: first line in each file in a dir <krahnj@acm.org>
    Re: first line in each file in a dir <me@privacy.net>
        Killing child processes on W2K <asdf@asdf.com>
        Need a simple script that deletes files older than 30 d (Chris Gregory)
    Re: Need a simple script that deletes files older than  (Sam Holden)
    Re: Need strong Perl developer <dha@panix.com>
    Re: Need strong Perl developer <Paul@Hovnanian.com>
        Newbie Problem/Question: LWP and SSLEAY (Andrew)
        Newbie Question: Best way to Extract Post Hashes? (Andrew)
    Re: perldoc installation <me@privacy.net>
    Re: Protecting Source code of a perl script ctcgag@hotmail.com
    Re: Protecting Source code of a perl script ctcgag@hotmail.com
    Re: Protecting Source code of a perl script (Sam Holden)
        read matrix file into 2d array <zhong.huang@jefferson.edu>
    Re: read matrix file into 2d array <trammell+usenet@hypersloth.invalid>
    Re: read matrix file into 2d array <uri@stemsystems.com>
    Re: read matrix file into 2d array <krahnj@acm.org>
        Resizing a NTFS partition for a Linux Install <dan@mathjunkies.com>
    Re: Resizing a NTFS partition for a Linux Install <dan@mathjunkies.com>
    Re: What is a tied hash? <mgjv@tradingpost.com.au>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Tue, 18 Nov 2003 14:26:20 GMT
From: Martin Bright <martin@boojum.org.uk>
Subject: ANNOUNCE: DBIx::XMLServer 0.01
Message-Id: <HopuxG.1tv8@zorch.sf-bay.org>


DBIx::XMLServer version 0.01 has been released, and is available in
  http://www.cpan.org/modules/by-authors/id/M/MJ/MJBRIGHT .

>From the README:

DBIx/XMLServer version 0.01
===========================

This module implements the whole process of generating an XML document
from a database query, in response to an HTTP request.  The mapping
from the DBI database to an XML structure is defined in a template
file, also in XML; this template is used not only to turn the data
into XML, but also to parse the query string.  To the user, the format
of the query string is very natural in relation to the XML data which
they will receive.

DEPENDENCIES

This module requires these other modules and libraries:

  XML::LibXML version 1.54 or later
  XML::LibXSLT version 1.53 or later
  Parse::RecDescent version 1.90 or later

If you wish to use the built-in date or date-and-time field types, you
will also need Date::Manip.

COPYRIGHT AND LICENCE

Copyright (C) 2003 Martin Bright

This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself. 




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

Date: Wed, 19 Nov 2003 02:07:08 GMT
From: gg.2.starfire@spamgourmet.com (Richard Anderson)
Subject: ANNOUNCE: Statistics::LineFit 0.02
Message-Id: <Hopuww.Gzr@zorch.sf-bay.org>

Available on CPAN at http://search.cpan.org/~randerson/Statistics-LineFit-0.02/

    The Statistics::LineFit module does weighted or unweighted
    least-squares line fitting to two-dimensional data (y = a + b
    * x). (This is also called linear regression.) In addition to
    the slope and y-intercept, the module can return the
    Durbin-Watson statistic, the mean squared error, sigma, t
    statistics, the predicted y values and the residuals of the y
    values. See the METHODS section for a description of these
    statistics. See the SEE ALSO section for a comparison of this
    module to Statistics::OLS.

    The module accepts input in separate x and y arrays or a
    single 2-D array (an array of arrayrefs). The optional
    weights are input in a separate array. The module can
    optionally verify that the input data and weights are valid
    numbers. If weights are input, the returned statistics all
    reflect the effect of the weights. For example, meanSqError()
    returns the weighted mean squared error and rSquared()
    returns the weighted correlation coefficient.

    The module is state-oriented and caches its results. Once you
    call the setData() method, you can call the other methods in
    any order or call a method several times without invoking
    redundant calculations.

Richard Anderson




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

Date: Fri, 21 Nov 2003 14:51:36 -0500
From: Greg G <ggershSNACK@CAKEctc.net>
Subject: Re: DES has no destroy.al
Message-Id: <B9ydndyI1LhD8SOiRVn-vg@ctc.net>



Anno Siegel wrote:
> Greg G  <ggershSNACK@CAKEctc.net> wrote in comp.lang.perl.misc:
> 
>>I've got some perl code that's using Crypt::CBC in which I'm generating 
>>a DES key like so:
>>my $cipher = Crypt::CBC->new( {'key'             => '12345678',
>>                             'cipher'          => 'DES',
>>			    'iv'              => '87654321',
>>			    'regenerate_key'  => 0,   # default true
>>			    'padding'         => 'space',
>>			    'prepend_iv'      => 0
>>	 		    });
>>
>>Well, at some point, the process falls down.
> 
> In what way?  Is there no error message?

    Nope.  Nothing.  Just some unusual behavior.  I'm doing this with 
some DBD::Oracle stuff and I'm losing all of my open connections to 
everything.

> Your code works for me.  Perl 5.8.1, Crypt::CBC 2.08.

   Yeah.  That's the funny part.  This is working about 90% of the time 
for me.  I'm having trouble isolating the code fragment that's causing 
this to happen.

> 
>>                                             I'm not sure exactly where 
>>in the perl code this is happening, but truss tells me this:
>>
>>stat("/usr/local/lib/perl5/site_perl/5.005/sun4-solaris/auto/Crypt/DES/DESTROY.al", 
>>0x000C1434) Err#2 ENOENT
>>open("/usr/local/lib/perl5/5.00503/sun4-solaris/auto/Crypt/DES/DESTROY.al", 
>>  O_RDONLY) Err#2 ENOENT
>>open("/usr/local/lib/perl5/5.00503/auto/Crypt/DES/DESTROY.al", O_RDONLY) 
>>Err#2 ENOENT
>>open("/usr/local/lib/perl5/site_perl/5.005/sun4-solaris/auto/Crypt/DES/DESTROY.al", 
>>O_RDONLY) Err#2 ENOENT
>>open("/usr/local/lib/perl5/site_perl/5.005/auto/Crypt/DES/DESTROY.al", 
>>O_RDONLY) Err#2 ENOENT
>>open("./auto/Crypt/DES/DESTROY.al", O_RDONLY)   Err#2 ENOENT
>>
>>As far as I can tell DES doesn't *have* a DESTROY.al.  What does this 
> 
> That doesn't mean perl can't look for one.

    It doesn't?  Shoot. :)  Well, I figured that might be the case.  I 
guess I'm asking what would make perl look for it.

> 
>>mean, and how can I fix it?  (Yes, it's an old version of perl, I 
>>realize that.  I'd prefer not to upgrade it at this point if I don't 
>>have to.)
> 
> 
> There must be tens or hundreds of failed open()s in the truss trace.
> This could be the fatal one, but nothing you have reported backs that
> up.  What makes you think it is?

    In code that functions, I never see the above entries.  I really 
don't have that many failed open() calls.  There's nothing above this 
set of entries that looks unusual (which I realize doesn't really mean 
anything).

-Greg G



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

Date: 21 Nov 2003 21:53:05 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: DES has no destroy.al
Message-Id: <bpm1g1$fi7$1@mamenchi.zrz.TU-Berlin.DE>

Greg G  <ggershSNACK@CAKEctc.net> wrote in comp.lang.perl.misc:
> 
> 
> Anno Siegel wrote:
> > Greg G  <ggershSNACK@CAKEctc.net> wrote in comp.lang.perl.misc:
> > 
> >>I've got some perl code that's using Crypt::CBC in which I'm generating 
> >>a DES key like so:
> >>my $cipher = Crypt::CBC->new( {'key'             => '12345678',
> >>                             'cipher'          => 'DES',
> >>			    'iv'              => '87654321',
> >>			    'regenerate_key'  => 0,   # default true
> >>			    'padding'         => 'space',
> >>			    'prepend_iv'      => 0
> >>	 		    });
> >>
> >>Well, at some point, the process falls down.
> > 
> > In what way?  Is there no error message?
> 
>     Nope.  Nothing.  Just some unusual behavior.  I'm doing this with 
> some DBD::Oracle stuff and I'm losing all of my open connections to 
> everything.
>
> > Your code works for me.  Perl 5.8.1, Crypt::CBC 2.08.
> 
>    Yeah.  That's the funny part.  This is working about 90% of the time 
> for me.  I'm having trouble isolating the code fragment that's causing 
> this to happen.

Does that mean the program runs for a while and then spontaneously stops
working?  Or does it not work from the start on a bad day?

What are the running conditions?  If the error is indeed a failed search
by AutoLoader (see below), there should be a Perl error message.

> >>                                             I'm not sure exactly where 
> >>in the perl code this is happening, but truss tells me this:
> >>
> >>stat("/usr/local/lib/perl5/site_perl/5.005/sun4-solaris/auto/Crypt/DES/DESTROY.al", 
> >>0x000C1434) Err#2 ENOENT

[more similar trace lines snipped]

> >>As far as I can tell DES doesn't *have* a DESTROY.al.  What does this 
> > 
> > That doesn't mean perl can't look for one.
> 
>     It doesn't?  Shoot. :)  Well, I figured that might be the case.  I 
> guess I'm asking what would make perl look for it.

Apparently the Crypt::DES package has an AUTOLOADER() sub from the
standard AutoLoader module when one of its objects is destroyed.  
That would be consistent with the search through .../auto/ directories.
(The call to AUTOLOAD happens *because* Crypt::DES doesn't have a
DESTROY method.)

Just how the AUTOLOAD() gets into Crypt::DES I don't know.  I don't
see anything like it in Crypt/DES.pm, but other files can write to the
Crypt::DES namespace too.

Anno


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

Date: Fri, 21 Nov 2003 20:51:37 GMT
From: Dan Anderson <dan@mathjunkies.com>
Subject: Executing Perl from PHP
Message-Id: <m23cchzbqe.fsf@syr-24-59-76-83.twcny.rr.com>


        I have  a PHP  frontend to a  Perl script.  Currently  the PHP
script opens  up the Perl  script and posts  what to do, and  the Perl
script outputs the  results, and that's how they  communicate.  I find
it very inefficient though, and was curious, does anyone know of a way
to run Perl from inside of PHP? 

        I know that  PHP has a system call -- sort  of like back ticks
in perl -- but it can be  disabled depending on the way PHP is set up.
Anyone know another way? 

Thanks in advance,

Dan


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

Date: 21 Nov 2003 20:33:24 GMT
From: Glenn Jackman <xx087@freenet.carleton.ca>
Subject: Re: first line in each file in a dir
Message-Id: <slrnbrstlv.cjj.xx087@smeagol.ncf.ca>

Edo <eddhig22@yahoo.com> wrote:
>  opendir(DIR, "/.../");
>  my @files = readdir(DIR);
>  closedir(DIR);
>  foreach my $file (@files) {
>  open FL, $file or die $!;
>  print <FL>, "\n";
>  }

readdir does not prepend the directory name onto the filename.  Try:
    my $dir = '/...';
    opendir DIR, $dir or die "can't opendir $dir: $!\n";
    my @files = map "$dir/$_", readdir DIR;
    closedir DIR;

-- 
Glenn Jackman
NCF Sysadmin
glennj@ncf.ca


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

Date: Fri, 21 Nov 2003 20:36:08 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: first line in each file in a dir
Message-Id: <3FBE7734.C9E8A0D8@acm.org>

Edo wrote:
> 
> I need to do somthing with the first line in each file in a given dir,
> this is not working.
> 
> thanks
> 
> #!/usr/local/bin/perl
> use strict;
> use warnings;
> use Data::Dumper;
> 
> opendir(DIR, "/.../");

You should _ALWAYS_ verify that opendir was successful.

opendir DIR, '/.../' or die "Cannot open directory '/.../' $!";

> my @files = readdir(DIR);

You are putting all entries from the directory into @files, not just
files.

> closedir(DIR);
> 
> foreach my $file (@files) {
> open FL, $file or die $!;

You are trying to open $file in the current directory but it is in
"/.../$file" instead.

> print <FL>, "\n";

print() forces list context so you are printing out the entire contents
from FL.

print scalar <FL>, "\n";

Or:

print <FL> . "\n";

> }



John
-- 
use Perl;
program
fulfillment


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

Date: Sat, 22 Nov 2003 11:37:57 +1300
From: "Tintin" <me@privacy.net>
Subject: Re: first line in each file in a dir
Message-Id: <bpm45o$1qh2ai$1@ID-172104.news.uni-berlin.de>


"Edo" <eddhig22@yahoo.com> wrote in message
news:3FBE61F0.6000100@yahoo.com...
> Hello
>
> I need to do somthing with the first line in each file in a given dir,
> this is not working.
>
> thanks
>
> #!/usr/local/bin/perl
> use strict;
> use warnings;
> use Data::Dumper;
>
> opendir(DIR, "/.../");
> my @files = readdir(DIR);
> closedir(DIR);
>
> foreach my $file (@files) {
> open FL, $file or die $!;
> print <FL>, "\n";
> }

#!/usr/local/bin/perl
use strict;
use warnings;
use Data::Dumper;

 foreach my $file (</some/sensible/path/*>) {
  open FL, $file or die "Can not open $file $!\n";
  print <FL>;
  close FL;
 }




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

Date: Fri, 21 Nov 2003 13:34:10 -0800
From: Tyaan <asdf@asdf.com>
Subject: Killing child processes on W2K
Message-Id: <nk0trv8abqccbjpbh8ek64vkrb8h9nfrf5@4ax.com>

I have to run a command that normally hangs on the first attempt. The
second and subsequent attempts are successful.  I'm trying to write a
script that will spawn a child processes to execute the command (I'm
expecting them to hang) then have the parent come back and kill all
the child processes to free up resources.  The script I've writtten
works, but the child processes do not get killed and use up a lot of
pids and memory.  Is there any way I can fix this so I don't have a
ton of zombies left over?  (Platform is W2K btw).

# Main
for($i=$low;$i<=$high;$i++)
{	
	$kidpid=fork();
	
	if($kidpid==0)
	{	$host=$hostprefix.`printf $format $i`;
		print "Prepping $host\n";
		`psexec \\\\\\\\$host -u $userid -p $passwd -s
ipconfig`;   # This command will usually hang on the first attempt.
		exit;
	}
	if($kidpid!=0)
	{
		@kidpids[$i-$low]=$kidpid;
	}
}

sleep 5; # Give the processes a chance to finish or hang.

foreach(@kidpids)  # Kill the child processes
{	print "Killing job $_\n";
	kill(9,$_);		
}



 ................................................................
       Posted via TITANnews - Uncensored Newsgroups Access
             >>>> at http://www.TitanNews.com <<<<
-=Every Newsgroup - Anonymous, UNCENSORED, BROADBAND Downloads=-



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

Date: 21 Nov 2003 14:23:08 -0800
From: christian_gregory2002@yahoo.com (Chris Gregory)
Subject: Need a simple script that deletes files older than 30 days
Message-Id: <1695e556.0311211423.3544ce8c@posting.google.com>

I'm running Windows 2000 and have ActivePerl.  

Is there a script that deletes files older than 30 days

thanks, Chris


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

Date: 21 Nov 2003 22:57:04 GMT
From: sholden@flexal.cs.usyd.edu.au (Sam Holden)
Subject: Re: Need a simple script that deletes files older than 30 days
Message-Id: <slrnbrt620.n1n.sholden@flexal.cs.usyd.edu.au>

On 21 Nov 2003 14:23:08 -0800,
	Chris Gregory <christian_gregory2002@yahoo.com> wrote:
> I'm running Windows 2000 and have ActivePerl.  
> 
> Is there a script that deletes files older than 30 days

This a forum for discussing perl and Perl. It is not a find your code for
free service.

Post an ad in an appropriate place (a newsgroup with jobs in the title for
example) if you want to pay someone to provide the code, or search the
various software archives if you want an existing solution.

Or write it yourself, in which case if you get stuck feel free to post
your problems, with the code you have written and an explanation of
what you expect it to do and what it actually does. Trim the code to
be the smallest valid perl snippet that exhibits the problem.

A good start would be the File::Find module, the stat function, and the
unlink function.

The documentation comes with ActivePerl (I believe an HTML formatted
version is accessable from the "start" menu).

-- 
Sam Holden


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

Date: Fri, 21 Nov 2003 20:53:36 +0000 (UTC)
From: "David H. Adler" <dha@panix.com>
Subject: Re: Need strong Perl developer
Message-Id: <slrnbrsuqg.l52.dha@panix2.panix.com>

In article <bplbcg$nlh$1@bob.news.rcn.net>, Bandwidth, Inc. wrote:
> We are looking for a strong Perl developer with a telecom industry
> background for a Contract 

You have posted a job posting or a resume in a technical group.

Longstanding Usenet tradition dictates that such postings go into
groups with names that contain "jobs", like "misc.jobs.offered", not
technical discussion groups like the ones to which you posted.

Had you read and understood the Usenet user manual posted frequently to
"news.announce.newusers", you might have already known this. :)  (If
n.a.n is quieter than it should be, the relevent FAQs are available at
http://www.faqs.org/faqs/by-newsgroup/news/news.announce.newusers.html)
Another good source of information on how Usenet functions is
news.newusers.questions (information from which is also available at
http://www.geocities.com/nnqweb/).

Please do not explain your posting by saying "but I saw other job
postings here".  Just because one person jumps off a bridge, doesn't
mean everyone does.  Those postings are also in error, and I've
probably already notified them as well.

If you have questions about this policy, take it up with the news
administrators in the newsgroup news.admin.misc.

http://jobs.perl.org may be of more use to you

Yours for a better usenet,

dha

-- 
David H. Adler - <dha@panix.com> - http://www.panix.com/~dha/
"Dir-ty deeds...DONE TO SHEEP!"
Heh heh...AC/DC, eat yer heart out.
    - Mary Roth


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

Date: Fri, 21 Nov 2003 14:06:22 -0800
From: "Paul Hovnanian P.E." <Paul@Hovnanian.com>
Subject: Re: Need strong Perl developer
Message-Id: <3FBE8C5E.791B1EEC@Hovnanian.com>

Brian Wakem wrote:
> 
> "Bandwidth, Inc." <info@bandwidth-usa.com> wrote in message
> news:bplbcg$nlh$1@bob.news.rcn.net...
> > We are looking for a strong Perl developer
> 
> I go to the gym twice a week - am I eligible?

Maybe they meant odor. What level of hobo power are they looking for?

-- 
Paul Hovnanian     mailto:Paul@Hovnanian.com
note to spammers:  a Washington State resident
------------------------------------------------------------------
Matter cannot be created or destroyed, nor can it be returned without a
receipt.


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

Date: 21 Nov 2003 14:23:36 -0800
From: awilhite@cableone.net (Andrew)
Subject: Newbie Problem/Question: LWP and SSLEAY
Message-Id: <9b7dcecd.0311211423.c2da19b@posting.google.com>

Hello,

I am learning Perl and I have come across something I dont understand.
 I have put together some code from examples and I see something
strange between data returned from HTTP and HTTPS sites.  When I run
my script on a non secured site (http://www.yahoo.com for example) I
get connection info and page source.  When I run the same script on a
HTTPS site (https://www.helsinki.fi/)  I get the connection info, but
it returns an empty <HTML></HTML> bracket.  Can anyone explain to me
why this is occuring in this script?

#!/usr/bin/perl
use warnings;
use strict;
use LWP;
use HTTP::Cookies;
use HTML::Parser ();

my $browser = LWP::UserAgent->new();
my $cj = HTTP::Cookies->new(file
=>"/home/awilhite/perl/cookies.lwp",autosave => 1,);
$browser->proxy(['http','https'],'Edited_ContainsMyProxyInfo');
$browser->cookie_jar($cj);
my $req = HTTP::Request->new(GET => "$ARGV[0]");
my $res = $browser->request($req);
if ($res->is_success) {
print $res->as_string;
#print $res->content;
} else {
print "Failed: ", $res->status_line, "\n";
}


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

Date: 21 Nov 2003 14:29:46 -0800
From: awilhite@cableone.net (Andrew)
Subject: Newbie Question: Best way to Extract Post Hashes?
Message-Id: <9b7dcecd.0311211429.3c7a7735@posting.google.com>

Hello,

I am a Perl newbie and I was wondering if anyone could tell me the
best way to extract expected post keys and values from websites?  is
there an easy way to extract the expected post/value from a web site
with the intention of using the information to write an agent or
spider script for?  Does anyone know of way to automatically gather it
and post dynamically?


Thanks!


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

Date: Sat, 22 Nov 2003 11:39:33 +1300
From: "Tintin" <me@privacy.net>
Subject: Re: perldoc installation
Message-Id: <bpm48o$1pg3m0$1@ID-172104.news.uni-berlin.de>


"Calle Dybedahl" <calle@cyberpomo.com> wrote in message
news:863cciqkzb.fsf@ulthar.bisexualmenace.org...
> >>>>> "Tintin" == Tintin  <me@privacy.net> writes:
>
> > Well, that maybe one interpretation, but keep in mind that Perl as
included
> > on later releases of Solaris doesn't include the Perl documentation.
This
> > may well also apply for other similar OS's.
>
> Could you be a lot more precise about what "later releases" you're
> talking about? All the documentation is certainly there on my machines
> running Solaris 9, and /usr/perl5/bin/perldoc works entirely as it should.

On my Solaris 9 installations, perldoc is under /usr/perl5/5.6.1/bin/perldoc

Apologies for not doing a find before making the statement.  However, I
don't know why Sun don't have a link to /usr/bin like they do for perl.




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

Date: 21 Nov 2003 21:49:06 GMT
From: ctcgag@hotmail.com
Subject: Re: Protecting Source code of a perl script
Message-Id: <20031121164906.264$tF@newsreader.com>

"Jürgen Exner" <jurgenex@hotmail.com> wrote:
> ctcgag@hotmail.com wrote:
> > Is the administrator of the application also the administrator of the
> > machine on which the application runs?  How can an application be
> > considered secure if you don't trust the person who is in charge of
> > it?
>
> Actually this is a very frequent scenario.
> Or would you trust your personal medical files to the admin of the
> hospital computer?

Well, I'm pretty sure I'm already doing that, for some level of admin
(if not the OS admin, then the DBMS admin or the app admin).

Xho

-- 
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service              New Rate! $9.95/Month 50GB


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

Date: 21 Nov 2003 22:00:00 GMT
From: ctcgag@hotmail.com
Subject: Re: Protecting Source code of a perl script
Message-Id: <20031121170000.469$FF@newsreader.com>

"Eric J. Roode" <REMOVEsdnCAPS@comcast.net> wrote:
> Hash: SHA1
>
> ctcgag@hotmail.com wrote in news:20031120131044.987$Ih@newsreader.com:
>
> > rgarciasuarez@free.fr (Rafael Garcia-Suarez) wrote:
> >> Forget about it.
> >>
> >> Moreover, security through obscurity just does not work.
> >
> > I think security by obscurity is about the only thing that does
> > work.  The obscurity of the private key is how public/private key
> > systems work.  The obscurity of the password is how most log-on
> > authentication systems work.
>
> That is not what is meant by "security by obscurity".

I just think it's kind of cheating to coerce the language into making
your argument for you.  When something you think should be open is not,
that is labelled obscurity, while when something you think should not be
open is not, that is labelled security.   So then when you say not to do
security by obscurity, it's really just saying "don't do that which you
shouldn't do."


Xho

-- 
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service              New Rate! $9.95/Month 50GB


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

Date: 21 Nov 2003 22:34:48 GMT
From: sholden@flexal.cs.usyd.edu.au (Sam Holden)
Subject: Re: Protecting Source code of a perl script
Message-Id: <slrnbrt4o8.mq4.sholden@flexal.cs.usyd.edu.au>

On 21 Nov 2003 22:00:00 GMT, ctcgag@hotmail.com <ctcgag@hotmail.com> wrote:
> "Eric J. Roode" <REMOVEsdnCAPS@comcast.net> wrote:
>> Hash: SHA1
>>
>> ctcgag@hotmail.com wrote in news:20031120131044.987$Ih@newsreader.com:
>>
>> > rgarciasuarez@free.fr (Rafael Garcia-Suarez) wrote:
>> >> Forget about it.
>> >>
>> >> Moreover, security through obscurity just does not work.
>> >
>> > I think security by obscurity is about the only thing that does
>> > work.  The obscurity of the private key is how public/private key
>> > systems work.  The obscurity of the password is how most log-on
>> > authentication systems work.
>>
>> That is not what is meant by "security by obscurity".
> 
> I just think it's kind of cheating to coerce the language into making
> your argument for you.  When something you think should be open is not,
> that is labelled obscurity, while when something you think should not be
> open is not, that is labelled security.   So then when you say not to do
> security by obscurity, it's really just saying "don't do that which you
> shouldn't do."

"Security by obscurity" is a well defined term. It covers security
mechanisms where the algorithm/technique isn't disclosed, and hence can
not be analysed by cryptography or security experts.

All security systems have something that isn't disclosed to the bad
guys, whether it be a password, an "RSA SecurID" style token, a
fingerprint, a private key, a swipe card, or whatever. The job is to
tell apart authorised people and unathorised people, that requires that
authorised have or know (or are - but that hopefully is only part of a
system) something that authorised people do not.

However, the security system can be analysed without that information.

-- 
Sam Holden


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

Date: Fri, 21 Nov 2003 12:56:06 -0500
From: "zhong huang" <zhong.huang@jefferson.edu>
Subject: read matrix file into 2d array
Message-Id: <pan.2003.11.21.17.55.56.136548@jefferson.edu>

Could anyone help me?

I have a matrix file (matrix.dat) which looks like this:

0.97    0.97    0.97    0.81    0.8     0.53    0.54    0.54    0.36    0.41    0.5     0.46    0.61    0.86
0.95    0.7     0.86    0.81    0.57    0.55    0.55    0.46    0.46    0.47    0.63    0.7     0.9     1.05
0.98    0.88    0.86    0.89    0.85    0.57    0.6     0.49    0.46    0.37    0.53    0.43    0.79    1.06
0.87    0.67    1       0.71    0.79    0.5     0.51    0.69    0.45    0.63    0.61    0.58    0.78    1.06
1.14    0.69    1.23    0.63    0.92    0.6     0.46    0.55    0.32    0.38    0.46    0.47    0.68    0.82
1.16    0.77    1.02    0.8     0.85    0.47    0.54    0.55    0.37    0.43    0.57    0.53    0.64    0.87
1.15    0.81    0.89    0.67    0.77    0.48    0.59    0.48    0.4     0.34    0.51    0.5     0.59    0.91

I want to open the file and put each element in a 2d array. My code is
like this:

==code start==
$file = "matrix.dat";
open(FILE,$file);
@data = <FILE>;

#each line is an element of the @data, loop through and separate each row in a bigger 2d array

for ($m=0;$m<scalar(@data)-1;++$m){  
	while($data[$m]){	
		for $j(0..13){ #there are 14 elements in each row
   			$td_array[$m][$j] = [split('\t',$data[$m]);
		}
	}

print "@td_array;
==code end==

It doesn't work. A working script is much appreciated. 


Zhong



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

Date: Fri, 21 Nov 2003 20:03:05 +0000 (UTC)
From: "John J. Trammell" <trammell+usenet@hypersloth.invalid>
Subject: Re: read matrix file into 2d array
Message-Id: <slrnbrsrrp.rbv.trammell+usenet@hypersloth.el-swifto.com.invalid>

On Fri, 21 Nov 2003 12:56:06 -0500, zhong huang
<zhong.huang@jefferson.edu> wrote:
> I have a matrix file (matrix.dat) which looks like this:
> 
[snip]
> 
> I want to open the file and put each element in a 2d array. My code is
> like this:
> 
>==code start==
> $file = "matrix.dat";
> open(FILE,$file);
> @data = <FILE>;
> 
> #each line is an element of the @data, loop through and separate each
> row in a bigger 2d array
> 
> for ($m=0;$m<scalar(@data)-1;++$m){  
> 	while($data[$m]){	
> 		for $j(0..13){ #there are 14 elements in each row
>    			$td_array[$m][$j] = [split('\t',$data[$m]);
> 		}
> 	}
> 
> print "@td_array;
>==code end==
> 
> It doesn't work. A working script is much appreciated. 
> 

How about (untested):

  my $file = "matrix.dat";
  open(FILE,$file) or die "can't open $file: $!";
  my @data;
  while (<FILE>) {
	  my @row = split ' ', $_;
	  push @data, \@row;
  }
  use Data::Dumper;
  print Dumper(\@row);

Ain't Perl great?



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

Date: Fri, 21 Nov 2003 20:13:15 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: read matrix file into 2d array
Message-Id: <x78ym97a5g.fsf@mail.sysarch.com>

>>>>> "JJT" == John J Trammell <trammell+usenet@hypersloth.invalid> writes:

  JJT> How about (untested):

  JJT>   my $file = "matrix.dat";
  JJT>   open(FILE,$file) or die "can't open $file: $!";
  JJT>   my @data;
  JJT>   while (<FILE>) {
  JJT> 	  my @row = split ' ', $_;
  JJT> 	  push @data, \@row;
  JJT>   }
  JJT>   use Data::Dumper;
  JJT>   print Dumper(\@row);

that should be \@data i think.

but to show perl's power look at this:

	my @data = map [ split ], <FILE> ;

and if you use the module file::slurp (soon to be a major upgrade) then
you can remove the open too:

	use File::Slurp ;
	my @data = map [ split ], read_file( $file ) ;

makes loading data like this a snap.

if the file was passed in on the command line you can even go with:

	my @data = map [ split ], <> ;

perl has such good default behavior for common and simple stuff like this.

  JJT> Ain't Perl great?

yeah :)

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs  ----------------------------  http://jobs.perl.org


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

Date: Fri, 21 Nov 2003 20:45:37 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: read matrix file into 2d array
Message-Id: <3FBE796E.B78CC1E5@acm.org>

zhong huang wrote:
> 
> Could anyone help me?
> 
> I have a matrix file (matrix.dat) which looks like this:
> 
> 0.97    0.97    0.97    0.81    0.8     0.53    0.54    0.54    0.36    0.41    0.5     0.46    0.61    0.86
> 0.95    0.7     0.86    0.81    0.57    0.55    0.55    0.46    0.46    0.47    0.63    0.7     0.9     1.05
> 0.98    0.88    0.86    0.89    0.85    0.57    0.6     0.49    0.46    0.37    0.53    0.43    0.79    1.06
> 0.87    0.67    1       0.71    0.79    0.5     0.51    0.69    0.45    0.63    0.61    0.58    0.78    1.06
> 1.14    0.69    1.23    0.63    0.92    0.6     0.46    0.55    0.32    0.38    0.46    0.47    0.68    0.82
> 1.16    0.77    1.02    0.8     0.85    0.47    0.54    0.55    0.37    0.43    0.57    0.53    0.64    0.87
> 1.15    0.81    0.89    0.67    0.77    0.48    0.59    0.48    0.4     0.34    0.51    0.5     0.59    0.91
> 
> I want to open the file and put each element in a 2d array. My code is
> like this:
> 
> ==code start==
> $file = "matrix.dat";
> open(FILE,$file);
> @data = <FILE>;
> 
> #each line is an element of the @data, loop through and separate each row in a bigger 2d array
> 
> for ($m=0;$m<scalar(@data)-1;++$m){
>         while($data[$m]){
>                 for $j(0..13){ #there are 14 elements in each row
>                         $td_array[$m][$j] = [split('\t',$data[$m]);
>                 }
>         }
> 
> print "@td_array;
> ==code end==
> 
> It doesn't work. A working script is much appreciated.

This is probably what you want:

use warnings;
use strict;
use Data::Dumper;

my $file = 'matrix.dat';
open FILE, $file or die "Cannot open $file: $!";
my @td_array = map [ split ], <FILE>;

print Dumper( \@td_array );

__END__



John
-- 
use Perl;
program
fulfillment


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

Date: Fri, 21 Nov 2003 20:46:26 GMT
From: Dan Anderson <dan@mathjunkies.com>
Subject: Resizing a NTFS partition for a Linux Install
Message-Id: <m27k1tzbz1.fsf@syr-24-59-76-83.twcny.rr.com>


        I am trying  to resize an NTFS partition  to install Linux.  I
don't  want to pay  any money  to do  it (i.e.  for SuSe  or Partition
Magic).  Does anyone know of:

  1. A way to use SuSe's  NTFS partitioning tool without buying a copy
     of SuSe. 
  2. The  open source  tool they  based it  off of  or a  similar open
     source tool that's not going to lose the data. 
  3. Another viable solution that doesn't involve shelling out money. 

Thanks in advance,

Dan


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

Date: Fri, 21 Nov 2003 21:41:19 GMT
From: Dan Anderson <dan@mathjunkies.com>
Subject: Re: Resizing a NTFS partition for a Linux Install
Message-Id: <m2y8u9xuv4.fsf@syr-24-59-76-83.twcny.rr.com>

Dan Anderson <dan@mathjunkies.com> writes:

My apologies.  That was supposed to go to the linux group.  I guess I
need to do some more configuration of Gnus.

-Dan

>         I am trying  to resize an NTFS partition  to install Linux.  I
> don't  want to pay  any money  to do  it (i.e.  for SuSe  or Partition
> Magic).  Does anyone know of:
> 
>   1. A way to use SuSe's  NTFS partitioning tool without buying a copy
>      of SuSe. 
>   2. The  open source  tool they  based it  off of  or a  similar open
>      source tool that's not going to lose the data. 
>   3. Another viable solution that doesn't involve shelling out money. 
> 
> Thanks in advance,
> 
> Dan


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

Date: Sat, 22 Nov 2003 08:30:16 +1100
From: Martien Verbruggen <mgjv@tradingpost.com.au>
Subject: Re: What is a tied hash?
Message-Id: <slrnbrt0v8.rk8.mgjv@martien.heliotrope.home>

On Sat, 22 Nov 2003 06:06:43 +1100,
	Edo <eddhig22@yahoo.com> wrote:
> Dan Anderson wrote:
>>         I'm just curious,  what is the difference between  a tied hash
>> and regular  hash?  I've seen the  term come up quite  often but never
>> quite knew what  it meant.  Does it have something  to do with whether
>> you use a {}  to create a reference to a hash or  a list to create it,
>> and whether or not you need to use a ->? 
>> 
>> Thanks in advance,
>> 
>> Dan
> 
> perldoc -f tie
> 
> has to do with keeping the hash sorted

Euhmm... Not really.

That could be one of its applications, but the tie mechanism in general
has nothing to do with sorting at all.

Martien
-- 
                        | 
Martien Verbruggen      | I used to have a Heisenbergmobile. Every time
                        | I looked at the speedometer, I got lost.
                        | 


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

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.  

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 5843
***************************************


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