[30745] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1990 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Nov 18 21:10:02 2008

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

Perl-Users Digest           Tue, 18 Nov 2008     Volume: 11 Number: 1990

Today's topics:
        Can regular expressions be used to choose among several <r.ted.byers@gmail.com>
    Re: Can regular expressions be used to choose among sev xhoster@gmail.com
        Connect to multiple unix servers <preynol@twmi.rr.com>
    Re: Connect to multiple unix servers <dirk.heinrichs@online.de>
    Re: Connect to multiple unix servers <preynol@twmi.rr.com>
    Re: Connect to multiple unix servers xhoster@gmail.com
        Create a record with fixed length <yvon.cadieux@gmail.com>
    Re: Create a record with fixed length <jurgenex@hotmail.com>
        how to know that the process is idle ? <nishant.031@gmail.com>
    Re: how to know that the process is idle ? <peter@makholm.net>
    Re: how to know that the process is idle ? <tadmc@seesig.invalid>
    Re: how to know that the process is idle ? <jurgenex@hotmail.com>
    Re: how to know that the process is idle ? (fidokomik\)
    Re: OpenOffice Spreadsheet <chaff@t-online.de>
        perl rsh problem <rafiamar@gmail.com>
    Re: perl rsh problem <tadmc@seesig.invalid>
        sleep(30) hangs marathoner@sina.com
        Strawberry perl: use Win32::Process ; ? <bernie@fantasyfarm.com>
    Re: Strawberry perl: use Win32::Process ; ? <1usa@llenroc.ude.invalid>
    Re: Strawberry perl: use Win32::Process ; ? <1usa@llenroc.ude.invalid>
    Re: Subroutine on Mutation of Codons <fawaka@gmail.com>
        Win32:OLE Communicator <slick.users@gmail.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Tue, 18 Nov 2008 12:15:21 -0800 (PST)
From: Ted Byers <r.ted.byers@gmail.com>
Subject: Can regular expressions be used to choose among several imperfect  matches?
Message-Id: <9f93e559-23d3-4773-b7f9-0f0bde70862a@a26g2000prf.googlegroups.com>

What I mean is this:

Imagine I have two hashes, one with a name as the key and an integer
ID as the value.  The names are guaranteed to be unique and correct.
The second hash also has names as the key (and the value in this one
doesn't matter), but being manually typed they are not guaranteed to
be correct.  They may even have multiple values that correspond to the
a given key in the first hash.  This potential of many to one arises
due to the different ways typos (and different abbreviations) can
alter a given string.

A major complication is that, because the data in the second hash
comes from a different feed using a different protocol, it is
guaranteed that there will never be a perfect match between any key in
the first hash and any key in the second hash.  The only guarantee,
regarding the data in the second hash, is that there is only one key
in the first that corresponds to the key in the second.  One pattern
we see a lot is that in some cases, the name string includes
whitespace between the names provided, while in others there is no
whitespace: so FredEdwardSmith would need to be recognized as the same
as Fred Edward Smith.  Another pattern includes an arbitrary number of
digits before the name, after or both.  And then there issues with
different spelling conventions (e.g. color vs colour) and regular
typos (e.g. FredEdwardSmyth).

The problem is to create a hash that maps all keys in the second hash
to the ID used as the value in the first hash.  This is in a context
where nothing is known until run time: at run time, both sets of data
have been loaded into a DB, and our script retreives the data from
there.  This data is dynamic so there is little chance of seeing the
same data twice (but the second data feed changes much more frequently
than the first).

Now, when we actually look at the data ourselves, it is obvious which
correct name applies to the names from the second feed.  Our problem
is how to make a script that is as good at seeing correct matches
between the first and second sets of data as the human eye is.

My first thought was to use regular expressions for this, but nothing
I have read so far sheds light on how to use them on imperfect data.
Are regular expressions able to deal with this, or is there a perl
package that is better suited to this problem?

Thanks

Ted


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

Date: 18 Nov 2008 20:27:06 GMT
From: xhoster@gmail.com
Subject: Re: Can regular expressions be used to choose among several imperfect matches?
Message-Id: <20081118152745.695$qK@newsreader.com>

Ted Byers <r.ted.byers@gmail.com> wrote:

> One pattern
> we see a lot is that in some cases, the name string includes
> whitespace between the names provided, while in others there is no
> whitespace: so FredEdwardSmith would need to be recognized as the same
> as Fred Edward Smith.  Another pattern includes an arbitrary number of
> digits before the name, after or both.

Canonicalize the data by eliminating all whitespace and leading/following
digits.

> And then there issues with
> different spelling conventions (e.g. color vs colour) and regular
> typos (e.g. FredEdwardSmyth).

For this, maybe String::Approx or the other modules discussed in the
perldoc for String::Approx.

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: Tue, 18 Nov 2008 09:56:25 -0800 (PST)
From: darkknight56 <preynol@twmi.rr.com>
Subject: Connect to multiple unix servers
Message-Id: <357386a8-f383-496c-8ae2-4d7529aa38ea@v13g2000pro.googlegroups.com>

Hello.  I'm new at perl and am faced with a  problem.  I work with
multiple unix servers and I need to execute the same commands on each
of them.  I'd like to automate this with perl so I was hoping someone
could point me in the right direction as to what package to use or
where there may be some code snippets I could learn from and modify.
I know there is the telnet module but if I fail to connect on one
server, I still need to proceed onto the next one.

Any help would be appreciated.

darkknight56


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

Date: Tue, 18 Nov 2008 19:50:24 +0100
From: Dirk Heinrichs <dirk.heinrichs@online.de>
Subject: Re: Connect to multiple unix servers
Message-Id: <gfv2pg$q78$1@online.de>

darkknight56 wrote:

> Hello.  I'm new at perl and am faced with a  problem.  I work with
> multiple unix servers and I need to execute the same commands on each
> of them.

Debian distributed shell is your friend.

HTH...

	Dirk


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

Date: Tue, 18 Nov 2008 11:52:40 -0800 (PST)
From: darkknight56 <preynol@twmi.rr.com>
Subject: Re: Connect to multiple unix servers
Message-Id: <2572824d-d947-488b-aaac-838e47a3df94@i20g2000prf.googlegroups.com>

On Nov 18, 1:50=A0pm, Dirk Heinrichs <dirk.heinri...@online.de> wrote:
> darkknight56 wrote:
> > Hello. =A0I'm new at perl and am faced with a =A0problem. =A0I work wit=
h
> > multiple unix servers and I need to execute the same commands on each
> > of them.
>
> Debian distributed shell is your friend.
>
> HTH...
>
> =A0 =A0 =A0 =A0 Dirk

Sorry but I'm running a recent Activestate release of perl from a
Windows server to the various unix servers.  From windows, I need to
connect to one unix server, execute some commands, logout from that
box then move onto the next box and repeat the process all over again.

Darkknight56


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

Date: 18 Nov 2008 20:05:12 GMT
From: xhoster@gmail.com
Subject: Re: Connect to multiple unix servers
Message-Id: <20081118150551.910$NG@newsreader.com>

darkknight56 <preynol@twmi.rr.com> wrote:
> On Nov 18, 1:50=A0pm, Dirk Heinrichs <dirk.heinri...@online.de> wrote:
> > darkknight56 wrote:
> > > Hello. =A0I'm new at perl and am faced with a =A0problem. =A0I work
> > > wit=
> h
> > > multiple unix servers and I need to execute the same commands on each
> > > of them.
> >
> > Debian distributed shell is your friend.
> >
> > HTH...
> >
> > =A0 =A0 =A0 =A0 Dirk
>
> Sorry but I'm running a recent Activestate release of perl from a
> Windows server to the various unix servers.  From windows, I need to
> connect to one unix server, execute some commands, logout from that
> box then move onto the next box and repeat the process all over again.

Net::Telnet?

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: Tue, 18 Nov 2008 16:53:05 -0800 (PST)
From: matou <yvon.cadieux@gmail.com>
Subject: Create a record with fixed length
Message-Id: <d897e014-8267-4c18-90a1-84c7e8254cc6@1g2000prd.googlegroups.com>

I have a file where the record that I read is over 2341 char and I
have to split to a fixed length to an another file ,

Please Help


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

Date: Tue, 18 Nov 2008 17:41:58 -0800
From: Jürgen Exner <jurgenex@hotmail.com>
Subject: Re: Create a record with fixed length
Message-Id: <jmr6i4lsdgms3v4hps75q5olqq7bj8mhp2@4ax.com>

matou <yvon.cadieux@gmail.com> wrote:
>I have a file where the record that I read is over 2341 char and I
>have to split to a fixed length to an another file ,

Maybe "perldoc -f substr"?

jue


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

Date: Tue, 18 Nov 2008 03:28:58 -0800 (PST)
From: Nishant <nishant.031@gmail.com>
Subject: how to know that the process is idle ?
Message-Id: <46d25dbe-6dcc-40e6-b6e7-2715252f26c3@v22g2000pro.googlegroups.com>

Hello All ,
I have a Perl/Tk application. If the process is idle for say 10
minutes (i.e, someone does not do anything to the application), the
application should perform some action.
Pls suggest how can this be done  ?

Best Regards
Nishant Sharma


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

Date: Tue, 18 Nov 2008 13:46:38 +0100
From: Peter Makholm <peter@makholm.net>
Subject: Re: how to know that the process is idle ?
Message-Id: <874p256w29.fsf@vps1.hacking.dk>

Nishant <nishant.031@gmail.com> writes:

> I have a Perl/Tk application. If the process is idle for say 10
> minutes (i.e, someone does not do anything to the application), the
> application should perform some action.
> Pls suggest how can this be done  ?

By setting an alarm with the alarm function (perldoc -f
alarm). Remember to reset the alarm at the start of the event handler
for each event.

//Makholm


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

Date: Tue, 18 Nov 2008 06:48:09 -0600
From: Tad J McClellan <tadmc@seesig.invalid>
Subject: Re: how to know that the process is idle ?
Message-Id: <slrngi5ec9.3ai.tadmc@tadmc30.sbcglobal.net>

Nishant <nishant.031@gmail.com> wrote:

[ the same question as posted elsewhere ]


Please do not multipost.

Crosspost instead.


-- 
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"


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

Date: Tue, 18 Nov 2008 06:11:37 -0800
From: Jürgen Exner <jurgenex@hotmail.com>
Subject: Re: how to know that the process is idle ?
Message-Id: <07j5i4ldu2k2jpq1bas7d07mm3ld5of6ob@4ax.com>

Nishant <nishant.031@gmail.com> wrote:
>I have a Perl/Tk application. If the process is idle for say 10
>minutes (i.e, someone does not do anything to the application), the
>application should perform some action.
>Pls suggest how can this be done  ?

perldoc -q timeout

The slow event in this case is the user input.

jue


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

Date: Tue, 18 Nov 2008 15:20:27 +0100
From: "Petr Vileta \(fidokomik\)" <stoupa@practisoft.cz>
Subject: Re: how to know that the process is idle ?
Message-Id: <gfuj5u$2ht1$1@ns.felk.cvut.cz>

Nishant wrote:
> Hello All ,
> I have a Perl/Tk application. If the process is idle for say 10
> minutes (i.e, someone does not do anything to the application), the
> application should perform some action.
> Pls suggest how can this be done  ?
>
The timer function is what you are looking for. Look for Tk::after or 
Tk::repeat.
-- 
Petr Vileta, Czech republic
(My server rejects all messages from Yahoo and Hotmail.
Send me your mail from another non-spammer site please.)
Please reply to <petr AT practisoft DOT cz>



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

Date: Tue, 18 Nov 2008 12:41:52 +0100
From: Chris Haffenstedt <chaff@t-online.de>
Subject: Re: OpenOffice Spreadsheet
Message-Id: <gfu9lv$ob2$1@newsreader2.netcologne.de>

Grehom schrieb:
> I'm just trying to read a column in a spreadsheet and create a new
> value in a new column to right of the others.
> I tried with the following, but it doesn't create the new column, any
> hints please
> 
> use OpenOffice::OODoc;
> my $doc = odfDocument(file => 'iwm.ods');
> 
> $row = 3;
> while ( my $cli = $doc->cellValue(0, "D$row") ) {
>     my $username = get_customer_account( $dbh, $cli );
>     print "$cli => $username\n";
>     $doc->cellValue(0, "E$row", $username);
>     $row++;
> }
> 
> $doc->save();
> 
> 
> It's reading the spreadsheet fine, but it's not inserting the new
> value into 'E' column

Try
$doc->updateCell(0, "E$row", $username);


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

Date: Tue, 18 Nov 2008 03:10:03 -0800 (PST)
From: Rafael The Angel <rafiamar@gmail.com>
Subject: perl rsh problem
Message-Id: <f47e2b2f-bb13-49b6-8873-02c05b141eb1@u18g2000pro.googlegroups.com>

Hi,
I'll be more then happy if anyone could help me:

$SMS_TEXT="\<";
system("/usr/kerberos/bin/rsh [hostname] -l [user] -n \" echo
$SMS_TEXT > $SMS_MESSAGE
\"");

/usr/bin/perl -X test.pl
ksh: syntax error at line 1 : `>' unexpected

i tried - $SMS_TEXT="<";

thank's
Rafael


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

Date: Tue, 18 Nov 2008 06:56:39 -0600
From: Tad J McClellan <tadmc@seesig.invalid>
Subject: Re: perl rsh problem
Message-Id: <slrngi5es7.3ai.tadmc@tadmc30.sbcglobal.net>

Rafael The Angel <rafiamar@gmail.com> wrote:

> I'll be more then happy if anyone could help me:
>
> $SMS_TEXT="\<";


    $SMS_TEXT = '\<';


-- 
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"


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

Date: Tue, 18 Nov 2008 08:01:00 -0800 (PST)
From: marathoner@sina.com
Subject: sleep(30) hangs
Message-Id: <f7aaa70c-7fc0-41a5-b9ee-add26a51345f@z28g2000prd.googlegroups.com>

Hi,

I have a programs that checks emails via IMAP and then sleeps for 30
seconds. Occasionally, it hangs on the line where it calls sleep(30).

I use Perl 5.8.8 (ActivePerl Build 820) running on Windows 2000 SP4.

A simplified version of the code looks like this:


use Mail::IMAPClient;

$host = 'localhost';
$id = 'user';
$pass = 'pass';
$inbox = 'inbox';

while(1)
{
	print scalar localtime, "\n";
	$imap = Mail::IMAPClient->new(
			Server => $host,
			User    => $id,
			Password=> $pass,
			Clear   => 5,
			Debug => 0,
			Timeout => 30,
			Uid => 0,

	)       or die "Cannot connect to $host as $id: $@";
	print "Checking for new messages...\n";
	$imap->select($inbox);

	$m = $imap->message_count();
	for $n (1..$m)
	{
		print $imap->get_header($n, 'To');

		# more processing here
		# .......

		$imap->delete_message($n);
	}

	$imap->expunge();
	$imap->disconnect();
	print scalar localtime, "\n";
	print "Done. See you in 30 seconds.\n\n\n";
	sleep(30); # <-- this is where it hangs sometimes
	print "waking up...\n\n";
}


Any input would be much appreciated.

Thank you.

Lei


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

Date: Tue, 18 Nov 2008 17:50:22 -0500
From: Bernie Cosell <bernie@fantasyfarm.com>
Subject: Strawberry perl: use Win32::Process ; ?
Message-Id: <qdh6i45oajcu2gj1n34a000op374g6vl4v@library.airnews.net>

I have an app that uses use Win32::Process [and ::Info].  I've installed
strawberry perl on my laptop and it is working great... except: I can't
find that module.  I followed the path from the strawberry site to the
win32.perl.org site, but their "A list of "all" Win32 specific modules."
didn't include the two ::Process ones I was looking for.  Is there some new
win32 module(s) that replaces it?  THANKS!!

  /Bernie\
-- 
Bernie Cosell                     Fantasy Farm Fibers
bernie@fantasyfarm.com            Pearisburg, VA
    -->  Too many people, too few sheep  <--          


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

Date: Wed, 19 Nov 2008 00:08:34 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: Strawberry perl: use Win32::Process ; ?
Message-Id: <Xns9B5AC2B84A218asu1cornelledu@127.0.0.1>

Bernie Cosell <bernie@fantasyfarm.com> wrote in
news:qdh6i45oajcu2gj1n34a000op374g6vl4v@library.airnews.net: 

> I have an app that uses use Win32::Process [and ::Info].  I've
> installed strawberry perl on my laptop and it is working great...
> except: I can't find that module.  I followed the path from the
> strawberry site to the win32.perl.org site, but their "A list of "all"
> Win32 specific modules." didn't include the two ::Process ones I was
> looking for.  Is there some new win32 module(s) that replaces it? 
> THANKS!! 

You should be able to install it using cpan because Strawberry Perl comes 
with its own compiler.

Sinan

-- 
A. Sinan Unur <1usa@llenroc.ude.invalid>
(remove .invalid and reverse each component for email address)

comp.lang.perl.misc guidelines on the WWW:
http://www.rehabitation.com/clpmisc/


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

Date: Wed, 19 Nov 2008 00:24:00 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: Strawberry perl: use Win32::Process ; ?
Message-Id: <Xns9B5AC55617E2Basu1cornelledu@127.0.0.1>

"A. Sinan Unur" <1usa@llenroc.ude.invalid> wrote in
news:Xns9B5AC2B84A218asu1cornelledu@127.0.0.1: 

> Bernie Cosell <bernie@fantasyfarm.com> wrote in
> news:qdh6i45oajcu2gj1n34a000op374g6vl4v@library.airnews.net: 
> 
>> I have an app that uses use Win32::Process [and ::Info].  I've
>> installed strawberry perl on my laptop and it is working great...
>> except: I can't find that module.  I followed the path from the
>> strawberry site to the win32.perl.org site, but their "A list of
>> "all" Win32 specific modules." didn't include the two ::Process ones
>> I was looking for.  Is there some new win32 module(s) that replaces
>> it? THANKS!! 
> 
> You should be able to install it using cpan because Strawberry Perl
> comes with its own compiler.

Here is confirmation that Win32::Process builds and passes all tests 
using Strawberry Perl:

Running make test
C:\strawberry\perl\bin\perl.exe "-Iblib\lib" "-Iblib\arch" test.pl
1..4
ok 1
ok 2
ok 3
ok 4
  JDB/Win32-Process-0.14.tar.gz
  C:\strawberry\c\bin\dmake.EXE test -- OK
Running make install

Sinan

-- 
A. Sinan Unur <1usa@llenroc.ude.invalid>
(remove .invalid and reverse each component for email address)

comp.lang.perl.misc guidelines on the WWW:
http://www.rehabitation.com/clpmisc/


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

Date: 18 Nov 2008 17:30:14 GMT
From: Leon Timmermans <fawaka@gmail.com>
Subject: Re: Subroutine on Mutation of Codons
Message-Id: <4922fba6$0$200$e4fe514c@news.xs4all.nl>

On Mon, 17 Nov 2008 13:22:45 -0800, John W. Krahn wrote:
> 
> Your comment says remove whitespace but your code says remove
> non-whitespace.
> 

Oops! I made a typo, you're right! That should have been \s

Thanks,

Leon


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

Date: Tue, 18 Nov 2008 09:49:31 -0800 (PST)
From: Slickuser <slick.users@gmail.com>
Subject: Win32:OLE Communicator
Message-Id: <3caa8935-234e-4fce-a78b-51fbda7e22d3@a26g2000prf.googlegroups.com>

Have any one work on Win32:OLE with Microsoft Office Communicator
2007, like Win32:OLE Excel?

Thanks.


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

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


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