[30872] in Perl-Users-Digest
Perl-Users Digest, Issue: 2117 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jan 12 14:09:45 2009
Date: Mon, 12 Jan 2009 11: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 Mon, 12 Jan 2009 Volume: 11 Number: 2117
Today's topics:
A screen like utility? <jimktrains@gmail.com>
Re: A screen like utility? <smallpond@juno.com>
Re: A screen like utility? <jimktrains@gmail.com>
Arrays instead of files into hashes <massion@gmx.de>
Re: Circular lists <gamo@telecable.es>
Re: Circular lists <jurgenex@hotmail.com>
Re: Circular lists xhoster@gmail.com
handling hypens(-) in word boundary matching <urgearun@gmail.com>
Re: handling hypens(-) in word boundary matching <tadmc@seesig.invalid>
Re: Help: Cannot acquire data by split <tadmc@seesig.invalid>
Re: Help: Cannot acquire data by split <josef.moellers@fujitsu-siemens.com>
Re: How can I access file on machine by address like \\ <jurgenex@hotmail.com>
how to encrypt password stored in ftp script <woland99@gmail.com>
Re: how to encrypt password stored in ftp script <zen13097@zen.co.uk>
Re: how to encrypt password stored in ftp script <woland99@gmail.com>
Re: how to encrypt password stored in ftp script <josef.moellers@fujitsu-siemens.com>
Re: how to encrypt password stored in ftp script <cartercc@gmail.com>
Re: how to encrypt password stored in ftp script <jurgenex@hotmail.com>
Re: how to make exe app with Linux perl? <ryan.mccoskrie@gmail.com>
Re: opening a file <hjp-usenet2@hjp.at>
passing value <greymausg@mail.com>
Re: passing value <josef.moellers@fujitsu-siemens.com>
Re: passing value <greymausg@mail.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 12 Jan 2009 08:51:21 -0800 (PST)
From: jk <jimktrains@gmail.com>
Subject: A screen like utility?
Message-Id: <193a0f6b-d706-4ca9-aa3e-7a8ef38a9bf9@k19g2000yqg.googlegroups.com>
I have an application that receives output from multiple hosts and
would like some sane way to organize the outputs. I was thinking that
some sort of "tabbing" system akin to screen would work, but am not
sure an easy way to implement that. There is Term::Screen and I could
do it by hand, but i don't want to recreate the wheel, if possible.
Any other ideas are also welcome.
Thanks,
Jim
------------------------------
Date: Mon, 12 Jan 2009 09:57:05 -0800 (PST)
From: smallpond <smallpond@juno.com>
Subject: Re: A screen like utility?
Message-Id: <ea02d572-0be9-438e-add4-66bdd77fd3cb@v42g2000yqv.googlegroups.com>
On Jan 12, 11:51 am, jk <jimktra...@gmail.com> wrote:
> I have an application that receives output from multiple hosts and
> would like some sane way to organize the outputs. I was thinking that
> some sort of "tabbing" system akin to screen would work, but am not
> sure an easy way to implement that. There is Term::Screen and I could
> do it by hand, but i don't want to recreate the wheel, if possible.
> Any other ideas are also welcome.
>
> Thanks,
> Jim
If you use Tk, you can have a tabbed Notebook. Each page can have
a Text box in which you would display the output for one host.
It wouldn't give you any terminal emulation, but would be ok for
simple
character output.
------------------------------
Date: Mon, 12 Jan 2009 10:09:10 -0800 (PST)
From: jk <jimktrains@gmail.com>
Subject: Re: A screen like utility?
Message-Id: <97c91822-e25f-419b-a56c-974f29aa2197@v38g2000yqb.googlegroups.com>
> If you use Tk, you can have a tabbed Notebook. =A0Each page can have
> a Text box in which you would display the output for one host.
> It wouldn't give you any terminal emulation, but would be ok for
> simple character output.
Sorry, I forgot to mention, it's command line only.
Jim
------------------------------
Date: Mon, 12 Jan 2009 10:53:23 -0800 (PST)
From: Francois Massion <massion@gmx.de>
Subject: Arrays instead of files into hashes
Message-Id: <4c60d573-d493-4c7f-8756-4ed856db6fe5@d36g2000prf.googlegroups.com>
I have code which compares 2 lists of words and churns out the
difference. So far I have done this by reading the content of files
into a hash, but I would like to use 2 arrays, says @array1 and
@array2 instead of files a.txt and b.txt.
I haven't managed to do this successfuly. Any suggestions? Her the
functioning code with the files:
#!/usr/bin/perl -w
use warnings; use strict;
use utf8; #
binmode STDIN, ":utf8"; # input
binmode STDOUT, ":utf8"; # output
my %list2;
open(WORDLIST2,'C:\temp\b.txt') or
die("cannot open 'C:\temp\b.txt' because $! !\n");
while (<WORDLIST2>) {
$list2{$_}=1; #or any other value
}
open(WORDLIST1,'C:\temp\a.txt') or
die("cannot open file1 because $! !\n");
while (<WORDLIST1>){
print unless exists($list2{$_});
}
------------------------------
Date: Mon, 12 Jan 2009 14:08:16 +0100
From: gamo <gamo@telecable.es>
Subject: Re: Circular lists
Message-Id: <alpine.LNX.2.00.0901121338370.3788@jvz.es>
This message is in MIME format. The first part should be readable text,
while the remaining parts are likely unreadable without MIME-aware tools.
--8323328-383651580-1231765697=:3788
Content-Type: TEXT/PLAIN; charset=ISO-8859-1
Content-Transfer-Encoding: QUOTED-PRINTABLE
On Mon, 12 Jan 2009, xhoster@gmail.com wrote:
> > On Fri, 9 Jan 2009, gamo wrote:
> >
>=20
> > for $j (1..$precounter){
> > if ($s eq $p[$j]){
> > $ok=3D0;
> > last;
> > }
> > };
>=20
> This would be better written as a hash look up. To do so, the easiest wa=
y
> is move it above the hash population, and do away with @p altogether,
> giving:
>=20
> for (1..10_000_000){
> my @set =3D shuffle(@a);
> my $s =3D join '',@set;
> my $two =3D $s . $s;
> next if ($two =3D~ /gg/);
> unless (exists $hash{$s}){
> $exito++;
> print "$0 $exito\n";
> }
> for my $i (0..9){
> my $r =3D substr $two,$i,10;
> $hash{$r}++;
> }
> }
>=20
> This should be a lot faster. (In addition to other things mentioned
> previously, the hard-coding of 9 and 10 in the above is not a good idea)
>=20
> If RAM becomes a premium, you could put only one canonical sequence
> in the hash, rather than every rotation:
>=20
> for (1..10_000_000){
> my @set =3D shuffle(@a);
> my $s =3D join '',@set;
> my $two =3D $s . $s;
> next if ($two =3D~ /gg/);
> my ($canon) =3D sort map {substr $two,$_,length $s} 0..length($s) -1;
> unless (exists $hash{$canon}){
> $hash{$canon}++;
> $exito++;
> print "$0 $exito\n";
> }
> }
> print "El n=FAmero de permutaciones circulares es $exito\n";
>=20
I don't agree with your simplifications. It needs two hashes:
one for the objective, the circular unique lists, and another
for all the rotations. Each candidate must be checked against=20
both.=20
Anyway the problem with lenght 20,
(a a b b b c c c c d d d d d e e e e e e)
is intractable in terms of memory to store the results (using=20
a 16GB RAM computer). I halt the program with 15,4 GB consumed.
The counter of circular lists marks 5,3 millons and running up
at devils speed.
I run your fast routine dpermute to figure out the dimension=20
of the problem, but the program consume many time in the calculation. =20
Still waiting for coment it.
I am hopeless about tryng a real problem of this kind.
Thanks for your efforts, best regards
>=20
> Xho
>=20
> --=20
> -------------------- 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 indicat=
e
> this fact.
>=20
--=20
http://www.telecable.es/personales/gamo/
"Was it a car or a cat I saw?"
perl -E 'say 111_111_111**2;'
--8323328-383651580-1231765697=:3788--
------------------------------
Date: Mon, 12 Jan 2009 08:55:30 -0800
From: Jürgen Exner <jurgenex@hotmail.com>
Subject: Re: Circular lists
Message-Id: <qnsmm450p3u4ogja7d1b9j1qp3eu2e3t6r@4ax.com>
gamo <gamo@telecable.es> wrote:
>Anyway the problem with lenght 20,
>(a a b b b c c c c d d d d d e e e e e e)
>is intractable in terms of memory to store the results (using
>a 16GB RAM computer). I halt the program with 15,4 GB consumed.
Now wait a second. While I agree with xhoster that my count of n rotated
lists for an original list with n elements is not correct in the general
case it is surely an upper bound, because according to xhoster (and I
agree) some generated lists may be identical and thus collapse.
>The counter of circular lists marks 5,3 millons and running up
>at devils speed.
Therefore there are only a max of 20 rotated lists for the example
above:
aabbbccccdddddeeeeee
abbbccccdddddeeeeeea
bbbccccdddddeeeeeeaa
bbccccdddddeeeeeeaab
bccccdddddeeeeeeaabb
ccccdddddeeeeeeaabbb
cccdddddeeeeeeaabbbc
ccdddddeeeeeeaabbbcc
cdddddeeeeeeaabbbccc
dddddeeeeeeaabbbcccc
ddddeeeeeeaabbbccccd
dddeeeeeeaabbbccccdd
ddeeeeeeaabbbccccddd
deeeeeeaabbbccccdddd
eeeeeeaabbbccccddddd
eeeeeaabbbccccddddde
eeeeaabbbccccdddddee
eeeaabbbccccdddddeee
eeaabbbccccdddddeeee
eaabbbccccdddddeeeee
Some of these may be identical and thus reduce the number of results
(which they are not in this example), but how did you get 5.3 million
candidates?
jue
------------------------------
Date: 12 Jan 2009 17:07:31 GMT
From: xhoster@gmail.com
Subject: Re: Circular lists
Message-Id: <20090112120950.344$hR@newsreader.com>
gamo <gamo@telecable.es> wrote:
> > If RAM becomes a premium, you could put only one canonical sequence
> > in the hash, rather than every rotation:
> >
> > for (1..10_000_000){
> > my @set =3D shuffle(@a);
> > my $s =3D join '',@set;
> > my $two =3D $s . $s;
> > next if ($two =3D~ /gg/);
> > my ($canon) =3D sort map {substr $two,$_,length $s} 0..length($s)
> > -1; unless (exists $hash{$canon}){
> > $hash{$canon}++;
> > $exito++;
> > print "$0 $exito\n";
> > }
> > }
> > print "El n=FAmero de permutaciones circulares es $exito\n";
> >=20
>
> I don't agree with your simplifications. It needs two hashes:
> one for the objective, the circular unique lists,
Why store those in memory? Print them to stdout as you find them (assuming
the first implementation) and read them from disk later. (But in the 2nd
implementation, you naturally save one and only one representation in
memory for each.)
> and another
> for all the rotations.
If you canonicalize every circular list to have a single canonical
representation, then you only need to test the canonical representation for
one circular-list against all previous canonical representations, not all
the previous rotations. That is what the second one does.
>
> Anyway the problem with lenght 20,
> (a a b b b c c c c d d d d d e e e e e e)
> is intractable in terms of memory to store the results (using=20
> a 16GB RAM computer). I halt the program with 15,4 GB consumed.
> The counter of circular lists marks 5,3 millons and running up
> at devils speed.
>
> I run your fast routine dpermute to figure out the dimension=20
> of the problem, but the program consume many time in the calculation.
> =20 Still waiting for coment it.
No need to run it to discover the size. The number of distinct
permutations is 20!/2!/3!/4!/5!/6! which is 97,772,875,200. I don't think
your circular lists can have any internal circular symmetry, so each
underlying circular list should have exactly 20 representatives present,
giving 4,888,643,760 circular lists. (Without any filtering, like your /gg/
example previously.)
If you force one of the 'a's to be in the first slot, then you only need
to generate 9,777,287,520 permutations, getting each circular list twice.
Find the other 'a', and rotate the string to put that 'a' in the first
slot. If the original string is "lt" the new rotated one, print the
original. Otherwise, print nothing as the rotated string either already has
or will later come up in its own right, and get printed at that point.
Nothing needs to be stored in RAM. For speed, I might do it in C, not
Perl.
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.
------------------------------
Date: Mon, 12 Jan 2009 04:50:15 -0800 (PST)
From: arun <urgearun@gmail.com>
Subject: handling hypens(-) in word boundary matching
Message-Id: <d9c75d56-72f9-4332-a992-103fc2ca09c4@s9g2000prm.googlegroups.com>
Hi Perl gurus,
Iam trying to replace the sub string "feat-ha" with 1 in a string but
it's failing because of hypen (-) please
help me how to handle it. I have pasted my code snippet below.
#!c:\Perl\site\bin
use strict;
my $string = qq((feat-bgp-mpls-vpn AND feat-ha-sso AND span));
my $pattern = qq(feat-ha);
$string=~s/\b$pattern\b/1/g;
print $string;
output : (feat-bgp-mpls-vpn AND 1-sso AND span)
In the above programme iam trying to replace the word "feat-ha" with 1
if it matches the exact word in the string "(feat-bgp-mpls-vpn AND
feat-ha-sso AND span)" but it's replacing feat-ha-sso as 1-sso which
shouldn't happen please help me.
Thanks in Advance..
Regards
-Arun
------------------------------
Date: Mon, 12 Jan 2009 08:39:37 -0600
From: Tad J McClellan <tadmc@seesig.invalid>
Subject: Re: handling hypens(-) in word boundary matching
Message-Id: <slrngmmlh9.v0l.tadmc@tadmc30.sbcglobal.net>
arun <urgearun@gmail.com> wrote:
> Hi Perl gurus,
>
> Iam trying to replace the sub string "feat-ha" with 1 in a string but
> it's failing because of hypen (-) please
> help me how to handle it. I have pasted my code snippet below.
>
>
> #!c:\Perl\site\bin
>
> use strict;
>
> my $string = qq((feat-bgp-mpls-vpn AND feat-ha-sso AND span));
>
> my $pattern = qq(feat-ha);
>
> $string=~s/\b$pattern\b/1/g;
>
> print $string;
>
> output : (feat-bgp-mpls-vpn AND 1-sso AND span)
>
>
> In the above programme iam trying to replace the word "feat-ha" with 1
> if it matches the exact word in the string "(feat-bgp-mpls-vpn AND
> feat-ha-sso AND span)" but it's replacing feat-ha-sso as 1-sso which
> shouldn't happen please help me.
Use a negative lookahead assertion with a positive char class:
$string =~ s/\b$pattern(?![\w-])/1/g;
or use a positive lookahead assertion with a negated char class:
$string =~ s/\b$pattern(?=[^\w-])/1/g;
If $pattern might occur at the end of the string, then you'll need
to account for that as well:
$string =~ s/\b$pattern(?!([\w-]|$))/1/g;
You will likely need to do something similar to the beginning of your pattern.
--
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"
------------------------------
Date: Mon, 12 Jan 2009 08:48:48 -0600
From: Tad J McClellan <tadmc@seesig.invalid>
Subject: Re: Help: Cannot acquire data by split
Message-Id: <slrngmmm2g.v0l.tadmc@tadmc30.sbcglobal.net>
Amy Lee <openlinuxsource@gmail.com> wrote:
> Here's the data I use.
>
> ath-MIR166f Marcal1-PA 100.00 18 0 0 58 75 2226 2243 0.008 36.2
> dme-mir-278 GABA-B-R3-PA 100.00 18 0 0 64 81 282 265 0.007 36.2
> And at every line the contents are separated by tab, and I used following
> syntax to get the first, second columns.
>
> my $query_seq = (split /\t/)[0];
> my $sub_seq = (split /\t/)[1];
You can do it all at once:
my($query_seq, $sub_seq) = (split /\t/)[0, 1];
> But the output
The code you have shown does not make any output!
I expect that you have made an error in the code that you have not shown us.
Show us your output statement.
Please post a short and complete program *that we can run* that
demonstrates your problem.
Have you seen the Posting Guidelines that are posted here frequently?
--
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"
------------------------------
Date: Mon, 12 Jan 2009 16:06:32 +0100
From: Josef Moellers <josef.moellers@fujitsu-siemens.com>
Subject: Re: Help: Cannot acquire data by split
Message-Id: <gkfm9m$hao$1@nntp.fujitsu-siemens.com>
Amy Lee wrote:
> Hello,
>
> Here's the data I use.
>
> ath-MIR166f Marcal1-PA 100.00 18 0 0 58 75 2226 2243 0.008 36.2
> dme-mir-278 GABA-B-R3-PA 100.00 18 0 0 64 81 282 265 0.007 36.2
> dme-mir-100 CG6630-PA 100.00 19 0 0 28 46 5108 5126 0.002 38.2
> cbr-mir-268 nop5-PA 95.65 23 1 0 57 79 1428 1406 0.001 38.2
> mmu-mir-199a-2 CG7806-PA 100.00 18 0 0 8 25 107 124 0.008 36.2
> rno-mir-320 CG15161-PA 100.00 18 0 0 2 19 265 248 0.006 36.2
>
> And at every line the contents are separated by tab, and I used following
> syntax to get the first, second columns.
>
> my $query_seq = (split /\t/)[0];
> my $sub_seq = (split /\t/)[1];
>
> But the output is quite odd. The output is
>
> Marcal1-PA Marcal1-PA
> GABA-B-R3-PA GABA-B-R3-PA
> CG6630-PA CG6630-PA
> nop5-PA nop5-PA
> CG7806-PA CG7806-PA
> CG15161-PA CG15161-PA
>
> So could tell me how to fix that? Thanks very much.
Are you absolutely sure it's TAB delimited? It looks more like the first
delimiter is replaced by a blank.
It looks as if there is no white space in your fields, so maybe you can
get away with using "\s+" as the splitting pattern.
Josef
--
These are my personal views and not those of Fujitsu Siemens Computers!
Josef Möllers (Pinguinpfleger bei FSC)
If failure had no penalty success would not be a prize (T. Pratchett)
Company Details: http://www.fujitsu-siemens.com/imprint.html
------------------------------
Date: Mon, 12 Jan 2009 00:15:57 -0800
From: Jürgen Exner <jurgenex@hotmail.com>
Subject: Re: How can I access file on machine by address like \\a_machine\pub\list
Message-Id: <kiulm4p656lhmc0tkgc0cimuj2cutd74ef@4ax.com>
Water Lin <WaterLin1999@gmail.com> wrote:
>I need to access file under Windows XP. The path on the network is
>something like \\a_machine\pub\list
>
>I don't know what kind of this protocol is.
SMB, see http://en.wikipedia.org/wiki/Server_Message_Block
>And I don't know how I can access this folder by Perl.
The easiest way is to assign a drive letter to the SMB share and then
use standard Drive:/Path/Filename.ext notation. See "net help use" for
details.
jue
------------------------------
Date: Mon, 12 Jan 2009 00:10:41 -0800 (PST)
From: Woland99 <woland99@gmail.com>
Subject: how to encrypt password stored in ftp script
Message-Id: <828ac721-0393-4d7a-9c97-717b9eb17058@t11g2000yqg.googlegroups.com>
Howdy - I want my script to make connection to FTP server and get some
files. I need that script to run everyday automatically on machine
that many people
have access to - but I do not want them to know the username or
password for that
FTP server. Is there a way to save encrypted password with the script
but prevent
people form modifying script to access the FTP server for different
purposes?
JT
------------------------------
Date: 12 Jan 2009 09:13:48 GMT
From: Dave Weaver <zen13097@zen.co.uk>
Subject: Re: how to encrypt password stored in ftp script
Message-Id: <496b09cc$0$30293$da0feed9@news.zen.co.uk>
On Mon, 12 Jan 2009 00:10:41 -0800 (PST), Woland99 <woland99@gmail.com> wrote:
> Howdy - I want my script to make connection to FTP server and get some
> files. I need that script to run everyday automatically on machine
> that many people
> have access to - but I do not want them to know the username or
> password for that
> FTP server. Is there a way to save encrypted password with the script
> but prevent
> people form modifying script to access the FTP server for different
> purposes?
The FTP protocol uses a plaintext password, so if you encrypt it and
store it somewhere, you still need the decryption code in the script
so that you can use it. And if people can read the script they can
read (and copy) the decryption code (and thus get at the password
anyway), so it gains you nothing.
You don't say what operating system this is running on, but assuming
some sort of *nix system, you can put the password in the script, but
set file permissions to ensure the script is readable only by the user
that runs it, not anyone else.
------------------------------
Date: Mon, 12 Jan 2009 01:47:08 -0800 (PST)
From: Woland99 <woland99@gmail.com>
Subject: Re: how to encrypt password stored in ftp script
Message-Id: <3c72068f-2205-489b-979a-a62c40e89070@m16g2000vbp.googlegroups.com>
On Jan 12, 3:13=A0am, Dave Weaver <zen13...@zen.co.uk> wrote:
> On Mon, 12 Jan 2009 00:10:41 -0800 (PST), Woland99 <wolan...@gmail.com> w=
rote:
> > =A0Howdy - I want my script to make connection to FTP server and get so=
me
> > =A0files. I need that script to run everyday automatically on machine
> > =A0that many people
> > =A0have access to - but I do not want them to know the username or
> > =A0password for that
> > =A0FTP server. Is there a way to save encrypted password with the scrip=
t
> > =A0but prevent
> > =A0people form modifying script to access the FTP server for different
> > =A0purposes?
>
> The FTP protocol uses a plaintext password, so if you encrypt it and
> store it somewhere, you still need the decryption code in the script
> so that you can use it. =A0And if people can read the script they can
> read (and copy) the decryption code (and thus get at the password
> anyway), so it gains you nothing.
>
> You don't say what operating system this is running on, but assuming
> some sort of *nix system, you can put the password in the script, but
> set file permissions to ensure the script is readable only by the user
> that runs it, not anyone else.
Thanks - I just read about Net::Netrc but that is not really a
solution since it is Windows environment. Is there a way to encrypt
the entire script?
------------------------------
Date: Mon, 12 Jan 2009 12:35:11 +0100
From: Josef Moellers <josef.moellers@fujitsu-siemens.com>
Subject: Re: how to encrypt password stored in ftp script
Message-Id: <gkf9td$47t$1@nntp.fujitsu-siemens.com>
Woland99 wrote:
> Howdy - I want my script to make connection to FTP server and get some
> files. I need that script to run everyday automatically on machine
> that many people
> have access to - but I do not want them to know the username or
> password for that
> FTP server. Is there a way to save encrypted password with the script
> but prevent
> people form modifying script to access the FTP server for different
> purposes?
I usually write those kinds of scripts such that they access a file
which is in my home directory and readable only be me. Maybe using a
file that already has the username and password may be a good idea, I
usually take my ~/.muttrc for that purpose.
Then write a short code sequence which opens, reads and parses, and
closes that file and extracts the username and password.
Then use that information for authentication.
------
my $muttrc = $ENV{HOME} . '/.muttrc';
open(my $rc, '<', $muttrc) or die "$0: Cannot open $muttrc: $!\n";
my %info;
while (<$rc>) {
if (/^\s*set\s+imap_user\s*=\s*(\S+)/) {
$info{imap_user} = $1;
next;
}
if (/^\s*set\s+imap_pass\s*=\s*(\S+)/) {
$info{imap_pass} = $1;
next;
}
}
close $rc;
------
This has the added advantage that you have one place less where your
password ist stored and might need to be updated and also that you can
give this program to others that can use it without having to modify it.
Josef
--
These are my personal views and not those of Fujitsu Siemens Computers!
Josef Möllers (Pinguinpfleger bei FSC)
If failure had no penalty success would not be a prize (T. Pratchett)
Company Details: http://www.fujitsu-siemens.com/imprint.html
------------------------------
Date: Mon, 12 Jan 2009 05:45:06 -0800 (PST)
From: cartercc <cartercc@gmail.com>
Subject: Re: how to encrypt password stored in ftp script
Message-Id: <1d39f9f6-6e79-4c69-a624-8b918739fb35@40g2000prx.googlegroups.com>
On Jan 12, 3:10=A0am, Woland99 <wolan...@gmail.com> wrote:
> Howdy - I want my script to make connection to FTP server and get some
> files. I need that script to run everyday automatically on machine
> that many people
> have access to - but I do not want them to know the username or
> password for that
> FTP server. Is there a way to save encrypted password with the script
> but prevent
> people form modifying script to access the FTP server for different
> purposes?
Hiding your username and password in this circumstance is impossible
-- the remote server needs both the username and password in order to
authenticate the connection, and any automated solution will have to
include this in a form that can be read by the remote server.
My solution is to 'hide' the username and password in a separate
configuration file that only the script can open and read, but of
course if it's in any kind of file it can be hacked.
If you have access to the remote server, you could write a script to
push your data from the server to your local machine, that is, FTP
into your machine from the remote server.
You can also enable accounting on the remote machine to log FTP
sessions so as to detect unauthorized access. This may or may not meet
your needs.
The bottom line is that if you really need to secure your username and
password, don't store them in any file on your machine. Manually
FTPing to the remote server is the price you pay for security.
CC
------------------------------
Date: Mon, 12 Jan 2009 09:02:59 -0800
From: Jürgen Exner <jurgenex@hotmail.com>
Subject: Re: how to encrypt password stored in ftp script
Message-Id: <lktmm4hd9sbd60kdikakhvv4cpunuc7obc@4ax.com>
Woland99 <woland99@gmail.com> wrote:
>Howdy - I want my script to make connection to FTP server and get some
>files. I need that script to run everyday automatically on machine
>that many people
>have access to - but I do not want them to know the username or
>password for that
>FTP server.
Why not just read-protect the script or UID/password, such that it can
only be accessed by you? Depending on your system this still may not
stop the admin.
If that is a concern then you need to encrypt either. And don't store
the key on the same system or it's an open barn door for the admin
again.
jue
------------------------------
Date: Mon, 12 Jan 2009 21:45:43 +1300
From: Ryan McCoskrie <ryan.mccoskrie@gmail.com>
Subject: Re: how to make exe app with Linux perl?
Message-Id: <gkf00e$p05$1@news.albasani.net>
Pero wrote:
> how to make exe app with Linux perl?
How long have you been on Windows and how
recently have you switched to Linux?
You sound like my old self ;- D
Any way from now on your two best friends are the
search engine of your choice and the command
"man -k searchTerm".
--
Computers are unreliable, but humans are even more unreliable.
Any system which depends on human reliability is unreliable.
-- Gilb
------------------------------
Date: Mon, 12 Jan 2009 10:38:35 +0100
From: "Peter J. Holzer" <hjp-usenet2@hjp.at>
Subject: Re: opening a file
Message-Id: <slrngmm3ss.kir.hjp-usenet2@hrunkner.hjp.at>
On 2009-01-12 03:17, George <george@example.invalid> wrote:
> On Mon, 12 Jan 2009 00:04:41 +0100, Peter J. Holzer wrote:
>> On 2009-01-11 21:20, George <george@example.invalid> wrote:
>>> What joke? Mirco made the perl syntax match my previous notions,
>>
>> This is the joke. He wrote completely unidiomatic (and quite horrible)
>> Perl which looks almost like Fortran, alluding to the well-known joke
>> that "real programmers can write Fortran programs in any language"[1]
>> (which you cited yourself earlier in the thread).
>
> Real programmers, like clf's Catherine Zeta Lay, express what I precisely
> meant in german:
>
> Wir meinen damit daß das abwertend ist, fortran sonstwo zu üben.
>
> This translates as:
>
> We mean that the pejorative is fortran elsewhere to practice.
Your translation isn't correct, but it's quite good at a meta level: It
sounds about as wrong in English as the original sounds wrong in German.
I don't know Catherine, much less how how good her German is, but I see
two possibilities:
1) Her German isn't very good.
2) Her German is very good and she made errors on purpose to make the
point: To me as a German speaker the sentence sounds about as wrong
as Mirco's script looks wrong to me as a Perl programmer. No German
speaker would say this sentence (except as a parody on non-native
Speakers) and no Perl programmer would write a script like Mirco's
(except as a parody on Fortran). Just like you can't translate
literally from one natural language to another word by word, you
can't translate literally from one programming language to another.
The result may "work", but it isn't pretty.
hp
------------------------------
Date: 12 Jan 2009 10:37:59 GMT
From: greymaus <greymausg@mail.com>
Subject: passing value
Message-Id: <slrngmm4j5.t2f.greymausg@mausland.org>
I am trying to find out what I am doing wrong with this test program,
when I hit return, the print in the sub getword outouts
Tk::Entry=HASH(0x8467234). using $word as a global gives the correct
answer, but is obviously unsatisfactory. Debian etch. Perl 5.8.8.
#!/usr/bin/perl -w
use Tk;
my $word='word';
$mw=MainWindow->new();
$mf0=$mw->Frame->grid();
$me=$mf0->Entry(-textvariable=>\$word);
$me->bind('<Key-Return>'=>[\&getword,$word]);
$ml=$mf0->Label(-text=>'Enter Word');
$mgo=$mf0->Button(-text=>'Go',-command=>[\&getword,$word])->grid($me,$ml);
$mf1=$mw->Frame->grid();
$mll=$mf1->Scrolled("Listbox",-width=>25,-height=>15)->grid();
$mf2=$mw->Frame->grid();
$mee=$mf2->Button(-text=>'Exit',-command=>sub{exit})->grid();
MainLoop;
sub getword(){
$d=shift;
print "$d\n";
}
--
greymaus
.
.
...
------------------------------
Date: Mon, 12 Jan 2009 12:38:44 +0100
From: Josef Moellers <josef.moellers@fujitsu-siemens.com>
Subject: Re: passing value
Message-Id: <gkfa41$47t$2@nntp.fujitsu-siemens.com>
greymaus wrote:
> I am trying to find out what I am doing wrong with this test program,
> when I hit return, the print in the sub getword outouts
> Tk::Entry=HASH(0x8467234). using $word as a global gives the correct
> answer, but is obviously unsatisfactory. Debian etch. Perl 5.8.8.
>
>
> #!/usr/bin/perl -w
> use Tk;
> my $word='word';
> $mw=MainWindow->new();
> $mf0=$mw->Frame->grid();
> $me=$mf0->Entry(-textvariable=>\$word);
> $me->bind('<Key-Return>'=>[\&getword,$word]);
> $ml=$mf0->Label(-text=>'Enter Word');
> $mgo=$mf0->Button(-text=>'Go',-command=>[\&getword,$word])->grid($me,$ml);
>
> $mf1=$mw->Frame->grid();
> $mll=$mf1->Scrolled("Listbox",-width=>25,-height=>15)->grid();
>
> $mf2=$mw->Frame->grid();
> $mee=$mf2->Button(-text=>'Exit',-command=>sub{exit})->grid();
>
> MainLoop;
>
> sub getword(){
> $d=shift;
> print "$d\n";
> }
>
>
Every callback is called with the object (the button in this case) as
the first argument, then all additional arguments are attached.
try
sub getword {
print join(',', @_), "\n";
}
and you'll find your variable in the second location.
so, better write that as
sub getword {
my ($button, $d) = @_;
print "$d\n";
}
Josef
--
These are my personal views and not those of Fujitsu Siemens Computers!
Josef Möllers (Pinguinpfleger bei FSC)
If failure had no penalty success would not be a prize (T. Pratchett)
Company Details: http://www.fujitsu-siemens.com/imprint.html
------------------------------
Date: 12 Jan 2009 13:37:59 GMT
From: greymaus <greymausg@mail.com>
Subject: Re: passing value
Message-Id: <slrngmmhv6.t7v.greymausg@mausland.org>
On 2009-01-12, Josef Moellers <josef.moellers@fujitsu-siemens.com> wrote:
> greymaus wrote:
>> I am trying to find out what I am doing wrong with this test program,
>> when I hit return, the print in the sub getword outouts
>> Tk::Entry=HASH(0x8467234). using $word as a global gives the correct
>> answer, but is obviously unsatisfactory. Debian etch. Perl 5.8.8.
>>
>>
>> #!/usr/bin/perl -w
>> use Tk;
>> my $word='word';
>> $mw=MainWindow->new();
>> $mf0=$mw->Frame->grid();
>> $me=$mf0->Entry(-textvariable=>\$word);
>> $me->bind('<Key-Return>'=>[\&getword,$word]);
>> $ml=$mf0->Label(-text=>'Enter Word');
>> $mgo=$mf0->Button(-text=>'Go',-command=>[\&getword,$word])->grid($me,$ml);
>>
>> $mf1=$mw->Frame->grid();
>> $mll=$mf1->Scrolled("Listbox",-width=>25,-height=>15)->grid();
>>
>> $mf2=$mw->Frame->grid();
>> $mee=$mf2->Button(-text=>'Exit',-command=>sub{exit})->grid();
>>
>> MainLoop;
>>
>> sub getword(){
>> $d=shift;
>> print "$d\n";
>> }
>>
>>
>
> Every callback is called with the object (the button in this case) as
> the first argument, then all additional arguments are attached.
>
> try
>
> sub getword {
> print join(',', @_), "\n";
> }
>
> and you'll find your variable in the second location.
>
> so, better write that as
>
> sub getword {
> my ($button, $d) = @_;
> print "$d\n";
> }
>
> Josef
Thanks
--
greymaus
.
.
...
------------------------------
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 2117
***************************************