[21715] in Perl-Users-Digest
Perl-Users Digest, Issue: 3919 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Oct 5 14:06:27 2002
Date: Sat, 5 Oct 2002 11:05:12 -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 Sat, 5 Oct 2002 Volume: 10 Number: 3919
Today's topics:
ANNOUNCE: Parse::PlainConfig v1.6 (Arthur Corliss)
date regex problem <dgardiner@houston.rr.com>
Re: date regex problem <krahnj@acm.org>
Re: date regex problem <dgardiner@houston.rr.com>
Re: date regex problem <REMOVEsdnCAPS@comcast.net>
Re: date regex problem (Tad McClellan)
Re: Help please extracting data from a word document (pierrot)
Re: how to read the image content. <flying_dragon@china.com>
Re: ithreads, perl 5.8 and shared objects <derek@wedgetail.com>
Re: ithreads, perl 5.8 and shared objects <uri@stemsystems.com>
merging 2 strings (Ken)
newbie question - perl vs ? <tim@ironwork.com>
Re: newbie question - perl vs ? (Mark Jason Dominus)
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 04 Oct 2002 23:22:36 -0000
From: corliss@freya.gallanttech.lan (Arthur Corliss)
Subject: ANNOUNCE: Parse::PlainConfig v1.6
Message-Id: <3d9ee952_3@news.teranews.com>
Greetings:
Parse::PlainConfig is now available on CPAN and on the project site
http://www.digitalmages.com.
Current Version: v1.6 (Oct. 4, 2002)
Parse::PlainConfig provides OO objects which can parse and generate
human-readable configuration files. The parser allows for all major data types
to be represented in the rc file, supporting scalars, arrays, and hashes.
Users shouldn't have to be programmers to configure their software conf files.
I know of too many packages that are all too sensitive to syntactical errors,
causing part or all of a configuration to not be retrieved. This module
attempts to rectify that situation.
This module uses a very simple syntax that should be easy for non-programmers
to use, while being somewhat forgiving of common syntactical errors. This
module also generates configuration files from the configuration stored in
memory.
New in this version:
--Fixed bug in test (root can still read/delete files with no r bit set)
--Comments are now preserved when loading conf files
--Describe method added to allow new comments for directives
--
--Arthur Corliss
Bolverk's Lair -- http://arthur.corlissfamily.org/
Digital Mages -- http://www.digitalmages.com/
"Live Free or Die, the Only Way to Live" -- NH State Motto
------------------------------
Date: Sat, 05 Oct 2002 13:18:23 GMT
From: "Doug" <dgardiner@houston.rr.com>
Subject: date regex problem
Message-Id: <zEBn9.72022$Fw2.2109300@twister.austin.rr.com>
I have a field of text that displays a line starting with a date and a time
stamp, but cannot successful strip the timestamp out of it.
A sample line 2002-08-14 00:00:00 has me stumped.
Here are some of the ways I've tried unsucessfully.
$foo=~s/^\d+-\d+-\d /$1/;
$foo=~s/^\w+ /$1/;
$foo=~s/\d+:\d+:\d+$//;
$foo=~s/(\d+):(\d+):(\d+)$//;
Does anyone have any ideas. My result is that it is either totally
unchanged or it is empty.
------------------------------
Date: Sat, 05 Oct 2002 14:26:50 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: date regex problem
Message-Id: <3D9EF69E.3201BA83@acm.org>
Doug wrote:
>
> I have a field of text that displays a line starting with a date and a time
> stamp, but cannot successful strip the timestamp out of it.
>
> A sample line 2002-08-14 00:00:00 has me stumped.
>
> Here are some of the ways I've tried unsucessfully.
>
> $foo=~s/^\d+-\d+-\d /$1/;
> $foo=~s/^\w+ /$1/;
> $foo=~s/\d+:\d+:\d+$//;
> $foo=~s/(\d+):(\d+):(\d+)$//;
>
> Does anyone have any ideas. My result is that it is either totally
> unchanged or it is empty.
$ perl -le'
$_ = "A sample line 2002-08-14 00:00:00 has me stumped.";
print;
s/([\d-]{10})\s+[\d:]{8}/$1/;
print;
'
A sample line 2002-08-14 00:00:00 has me stumped.
A sample line 2002-08-14 has me stumped.
John
--
use Perl;
program
fulfillment
------------------------------
Date: Sat, 05 Oct 2002 14:54:11 GMT
From: "Doug" <dgardiner@houston.rr.com>
Subject: Re: date regex problem
Message-Id: <n2Dn9.72403$Fw2.2122062@twister.austin.rr.com>
"John W. Krahn" <krahnj@acm.org> wrote in message
news:3D9EF69E.3201BA83@acm.org...
> Doug wrote:
> >
> > I have a field of text that displays a line starting with a date and a
time
> > stamp, but cannot successful strip the timestamp out of it.
> >
> > A sample line 2002-08-14 00:00:00 has me stumped.
> >
> > Here are some of the ways I've tried unsucessfully.
> >
> > $foo=~s/^\d+-\d+-\d /$1/;
> > $foo=~s/^\w+ /$1/;
> > $foo=~s/\d+:\d+:\d+$//;
> > $foo=~s/(\d+):(\d+):(\d+)$//;
> >
> > Does anyone have any ideas. My result is that it is either totally
> > unchanged or it is empty.
>
>
> $ perl -le'
> $_ = "A sample line 2002-08-14 00:00:00 has me stumped.";
> print;
> s/([\d-]{10})\s+[\d:]{8}/$1/;
> print;
> '
> A sample line 2002-08-14 00:00:00 has me stumped.
> A sample line 2002-08-14 has me stumped.
>
>
>
> John
> --
> use Perl;
> program
> fulfillment
Thanks, just before this reply I finally found a way but it involved using 2
lines $foo=~/((\d|-){8,10}) /
$foo=$1;
But your way works better and only 1 line. Thanks again
------------------------------
Date: Sun, 06 Oct 2002 05:13:16 CDT
From: "Eric J. Roode" <REMOVEsdnCAPS@comcast.net>
Subject: Re: date regex problem
Message-Id: <Xns929E70FE739CDsdn.comcast@216.166.71.239>
-----BEGIN xxx SIGNED MESSAGE-----
Hash: SHA1
"Doug" <dgardiner@houston.rr.com> wrote in
news:zEBn9.72022$Fw2.2109300@twister.austin.rr.com:
> I have a field of text that displays a line starting with a date and a
^^^^^^^^^^^^^
> time stamp, but cannot successful strip the timestamp out of it.
...
> Here are some of the ways I've tried unsucessfully.
>
> $foo=~s/^\d+-\d+-\d /$1/;
No colons in your pattern here.
> $foo=~s/^\w+ /$1/;
\w does not include colons.
> $foo=~s/\d+:\d+:\d+$//;
Why the $ there? That matches only at the end of a string.
> $foo=~s/(\d+):(\d+):(\d+)$//;
Ditto -- you said that the date and time was at the *start* of your string.
- --
Eric
print scalar reverse sort qw p ekca lre reh
ts uJ p, $/.r, map $_.$", qw e p h tona e;
-----BEGIN xxx SIGNATURE-----
Version: PGPfreeware 7.0.3 for non-commercial use <http://www.pgp.com>
iQA/AwUBPZ7/8mPeouIeTNHoEQJ2gACePiswt7zHzkqam5zM6183ZejpdR8AoNNh
AcaszjFsU7smyxe+8l4hyV7c
=sbJ9
-----END PGP SIGNATURE-----
------------------------------
Date: Sat, 5 Oct 2002 12:10:29 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: date regex problem
Message-Id: <slrnapu785.20d.tadmc@magna.augustmail.com>
Doug <dgardiner@houston.rr.com> wrote:
> I have a field of text that displays a line starting with a date and a time
> stamp, but cannot successful strip the timestamp out of it.
>
> A sample line 2002-08-14 00:00:00 has me stumped.
>
> Here are some of the ways I've tried unsucessfully.
>
> $foo=~s/^\d+-\d+-\d /$1/;
^^
Pattern demands only one digit character, string has 2 digit characters.
Why are you trying to match the date? I thought you wanted to
match (and remove) the time?
$1 will be undef if the pattern ever did match, you do not have
any parenthesis in your pattern.
> $foo=~s/^\w+ /$1/;
Pattern demands word characters, hyphen is not a word character.
> $foo=~s/\d+:\d+:\d+$//;
^
> $foo=~s/(\d+):(\d+):(\d+)$//;
^
Either of those will work if you remove the anchor.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: 5 Oct 2002 10:48:28 -0700
From: foutuguy@yahoo.fr (pierrot)
Subject: Re: Help please extracting data from a word document
Message-Id: <e6da095c.0210050948.3d305f0c@posting.google.com>
"Tan Nguyen" <nospam@nospam.com> wrote in message news:<3d9e5cb9$1_2@nopics.sjc>...
> "pierrot" <foutuguy@yahoo.fr> wrote in message
> > Hello,
> >
> > I have several big word documents i need to extract data from. First i
> > just want to try something simple and after, it should be easy to add
> > more stuff. In the word document, regularly, there is this string :
> > "Display Coordinate System Name:"
> > and then a certain amount of spaces, then a string i want to extract
> > that can be a mix of letters and numbers. Everything is in the same
> > line and the string to extract has something like 10 characters.
> >
> > I almost do not know anything about perl. What should i put in my
> > extract.pl file?
> > then to execute the file, i am not sure at 100%.
> > Is that : extract.pl -o input.doc output.txt ????
> >
> > Thanks a lot for your help
> >
> > Pierrot
>
> Do you have Perl installed on your system? What is the OS running on your
> system? etc.
>
> The untested stuff below assumes that you are running Li/Unix with Perl
> executable in /usr/bin/perl
>
> extract.pl:
>
> #!/usr/bin/perl -w
> use strict;
>
> open(FH, $ARGV[0]) or die "cannot open $ARGV[0]: $!\n";
> while (<FH>) {
> chomp;
> if (/Display Coordinate System Name:\s+(.*)/) {
> print "Extracted string: $1\n";
> }
> }
> close FH;
>
> On *nices, you can kick this script: at command prompt:
> $ ./extract.pl input.doc
>
> This will print extracted strings to your screen. To redirect it to a file,
> enter following:
> $ ./extract.pl input.doc > output.txt
>
> On Windows, you do something similarly
> C:/>perl extract.pl input.doc
> or
> C:/>perl extract.pl input.doc > output.txt
>
> PS: Pick up a Perl book.
In fact, I am running Win XP and ActiveState Active Perl5.6.1
ok, Thanks for your help, i will try to make that working. I have also
downloaded the tutorials from Ron so i should be able to do it!
Thanks very much
Pierrot
------------------------------
Date: Sat, 05 Oct 2002 10:41:33 GMT
From: "James Q.L" <flying_dragon@china.com>
Subject: Re: how to read the image content.
Message-Id: <xlzn9.186501$8b1.130562@news01.bloor.is.net.cable.rogers.com>
"Tan Nguyen" <nospam@nospam.com> wrote in message
news:3d9e5feb$1_6@nopics.sjc...
>
> "James Q.L" <flying_dragon@china.com> wrote
>
> > Sometimes i need to automate form submission. but few forms have
> > confirmation code that is composed into image(gif / png etc) . althought
> it
> > doesn't hurt much and i can manually submit or just give it up, I am
> > wondering if there is a way to do this ( i.e analyse the image and grab
> the
> > number out of it ) imagemagick ?
>
> Generally, it's a big "No". Search engines have been using this to
eliminate
> spam submission, and so far, they have been successful (ie. no one has
been
> able to crack it). The way it works is similar. Once a person wants to
> submit an URL to the search engine, he's given a sequence of numbers which
> are put in an image file. He has to punch these numbers along with his URL
> for submisson.
yeah. i was expecting to hear negative answer for this. :(
thx.
------------------------------
Date: Sun, 06 Oct 2002 00:19:58 +1000
From: Derek Thomson <derek@wedgetail.com>
Subject: Re: ithreads, perl 5.8 and shared objects
Message-Id: <3d9ef529$0$22175$afc38c87@news.optusnet.com.au>
Hi Uri,
Uri Guttman wrote:
>>>>>>"DT" == Derek Thomson <derek@wedgetail.com> writes:
>>>>>
>
> DT> The only way to achieve this that I'm aware of is to hook the DB into
> DT> your event loop. This is too much effort for most people and it means
> DT> that you need to do it not just for databases, but for everything you
> DT> could potentially block on. File I/O, GUI events, anything. Whereas
> DT> with threads, the thread scheduler gives you all that.
>
> nope. you can use proxy processes to handle blocking events. gui events
> are not blocking and already have event loops. POE has the ability to
> use any of them and stem will too (when i steal the poe code :).
I can use proxy processes to handle blocking events? The problem here is
that now I'm corrupting the user's design with infrastructure details.
What if they don't *want* yet another object in yet another process with
methods that deal with this? I think this can and should be handled
cleanly and invisibly.
(BTW it doesn't matter if GUI events are blocking or not, you need a
hook in your event loop so that "select" returns when a GUI event
*happens*!)
>
> >> and what do you mean by the server calling itself directly or
> >> indirectly?
>
> DT> Let's say a client calls method 'foo' on object 'A' in one
> DT> process. Method 'foo' now calls method 'bar' on object 'B' in another
> DT> process. As part of the execution of method 'bar', method A.fubar is
> DT> called. As A.foo is already being handled in A's process, we have a
> DT> deadlock situation.
>
> not with message passing since all remote calls are asynchronous. no
> deadlocks are possible unless you try hard. timeouts can always be used
> to get out of them too.
I'm not really interested in asynchronous message passing, for various
reasons. Most systems I've designed need RPC of some kind, which you
*can* build on top of your system by returning a "completed" message
which contains any results, or errors. Even if you don't have any
results to return, you need to at least know that the operation
completed, otherwise your system is unreliable ie you can never really
know if anything is actually happening, or not.
Once you add that "completed" message, you have the deadlock situation I
described, and there's no way to avoid it, without threads or a
"reactive" event handler that allows other events to be processed while
waiting for others (I assume stem does this?)
>
> DT> The trivial (direct) case is when A.foo calls A.fubar directly, but
> DT> that can be avoided by having the ORB (or whatever infrastructure)
> DT> skip the message dispatch by detecting that it's a local call. That's
> DT> impossible, however, in the indirect case described above.
>
> again with good message passing that is trivial.
Unless you're waiting for the response message, and then it isn't.
>
> DT> I don't really understand most of that, as I'm not familiar with this
> DT> project the you're talking about. Speaky generically, you have two
> DT> choices if you want to get useful work done while blocking on I/O 1)
> DT> You use threading, or 2) You make the I/O handler part of the event
> DT> loop.
>
> nope. multiple processes and IPC is another solution. stem does all the
> work for that already. since you don't know about it, take a gander at
> stemsystems.com
I'll take a look, but I think this is a bit further up the protocol
stack than an ORB ie. you could implement something like this to work
around the lack of threads in Perl on top of the Perl ORB, but once
again, that's not within the scope of my project. I can't ask people to
add lots of methods to their objects to give them what they get in Java
for free!
>
> DT> 2) Is harder to get right, and has it's own inherent problems, as it
> DT> will require tweaking as you've described to take advantage of
> DT> multiple CPUs. Not saying that threading is not without problems,
> DT> but I think the Perl threading model, with it's "everything is
> DT> separate by default" model, sheds the first new light on the
> DT> problem in a long time! I'm very interested in applying it and
> DT> seeing how it works.
>
> if you need blocking either use threads (events and threads can
> coexist and i have done that), or multiple processes. the key is a good
> IPC that makes life easy.
A good IPC mechanism? I already have that, don't need another one ;)
> stem has that built in. sending a message to a
> local object or a remote one is the same call.
Yes, but in CORBA, every RPC call looks like a "normal" method call, so
I don't even have to worry about "messaging". This may or may not be a
feature, but it seems to work with OO practices pretty well. Messaging
will always have the "result" message problem that is encapsulated by
RPC, unless you don't care if no-one actually receives these messages,
but I can't imagine a robust design that wouldn't want an acknowledgement.
>
> DT> However, I can't see how you avoid locking - with events you just
> DT> force everything to be serialized, therefore you've lost any
> DT> potential parallelism. And if you do hook your I/O events into the
> DT> event loop, you're back to worrying about race conditions again
> DT> (although DB transactions might deal with some of that for you,
> DT> but what about files?).
>
> you keep thinking in the single process model. think multiprocess and
> proxies for that. stem already has a DBI proxy which can be run in
> multiple processes which fixes the single queue issue. and a remote file
> module is under development (i hope one of the stem apprentices will do
> it).
No, that's not true. If two *processes*, or threads, are writing to a
file (for example), there must be some form of locking to avoid race
conditions. You can't avoid it.
Imagine one process is adding a record to a file. Halfway through,
another process is scheduled, which starts writing to that same file.
That process completes writing its record, then the first process gets
to complete its write. Now you've got half a message, then a complete
message, then the rest of the message ie a complete mess. You need locks
to ensure mutual exclusion.
Your remote file module will inevitable have to add a lock, or
transactions, of *some* kind.
>
> >> i get that and i can't answer it. i have been doing event loop
> >> designs for 20 years and i just stay away from threads if i can (i
> >> have worked with them). life is simpler with a single global data
> >> space which needs no locks or sharing and with real parallel
> >> scalability. :)
>
> DT> I respectfully question this "real parallel scalability" assertion. I
> DT> think you're being just a teensy bit zealot-ish here. I'm sure I can
> DT> do just as well with a threaded server, and you can't *really* avoid
> DT> race conditions (and locking) unless you throw parallelism out.
>
> did you know that there
> are several commercial message passing systems out there including
> mqseries (ibm), tibco, sonic (progress) and of course our favorite
> msmq from redmond.
I'll put this as gently as I can - why would I want any of that, when I
*already* have CORBA/J2EE? What problem does all this stuff solve,
except the vendor's need for customer lock-in on their ill-conceived
proprietary junk written by god-knows who?
I already have perfectly good messaging services that are well-defined,
and designed by sensible people via a public process, that run on top of
CORBA/J2EE, if messaging is *really* what I want (ie my problem is
inherently so loosely coupled that I don't need to know if anyone
actually receives any of these messages. I'm not sure what that would
be, though. MP3 swapping?)
> it can
> be easier as you lose the mutex and lock problems and can scale as
> needed.
Again, I don't see how you magically make the need to avoid race
conditions on shared resources just go away, and I think this "scale as
needed" statement is a non-sequitor once again, as it implies that other
designs don't, which is not true.
--
Derek Thomson.
------------------------------
Date: Sat, 05 Oct 2002 16:18:23 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: ithreads, perl 5.8 and shared objects
Message-Id: <x7bs687tbl.fsf@mail.sysarch.com>
>>>>> "DT" == Derek Thomson <derek@wedgetail.com> writes:
>> nope. you can use proxy processes to handle blocking events. gui
>> events are not blocking and already have event loops. POE has the
>> ability to use any of them and stem will too (when i steal the poe
>> code :).
DT> I can use proxy processes to handle blocking events? The problem
DT> here is that now I'm corrupting the user's design with
DT> infrastructure details. What if they don't *want* yet another
DT> object in yet another process with methods that deal with this? I
DT> think this can and should be handled cleanly and invisibly.
but the coder never sees the difference. and he has to write NO new code
to support this. in stem it is purely done via configuration files which
are not coding. you really should play with stem's demos to see how
simple this is. splitting an application from 1 into 2 processes
requires ZERO new code, and only minor changes to the config files.
DT> (BTW it doesn't matter if GUI events are blocking or not, you need
DT> a hook in your event loop so that "select" returns when a GUI
DT> event *happens*!)
nope. you USE the event loop of the gui itself. this is simple to
do. then it handles all of the GUI events as well as your own.
DT> I'm not really interested in asynchronous message passing, for
DT> various reasons. Most systems I've designed need RPC of some kind,
DT> which you *can* build on top of your system by returning a
DT> "completed" message which contains any results, or errors. Even if
DT> you don't have any results to return, you need to at least know
DT> that the operation completed, otherwise your system is unreliable
DT> ie you can never really know if anything is actually happening, or
DT> not.
you can trivially emulate RPC with message passing. the opposite is not
true. any object that sends a message can easily timeout while waiting
for a response message. no issues with remote 'completion'.
DT> Once you add that "completed" message, you have the deadlock
DT> situation I described, and there's no way to avoid it, without
DT> threads or a "reactive" event handler that allows other events to
DT> be processed while waiting for others (I assume stem does this?)
nope. because the objects are not blocked, they can handle a local
timeout or any incoming message. you can't have the classic deadlock
without all sides being blocked.
DT> The trivial (direct) case is when A.foo calls A.fubar
>> directly, but
DT> that can be avoided by having the ORB (or whatever infrastructure)
DT> skip the message dispatch by detecting that it's a local
DT> call. That's impossible, however, in the indirect case described
DT> above.
>> again with good message passing that is trivial.
DT> Unless you're waiting for the response message, and then it isn't.
timeouts again to the rescue. it is trivial. you just don't fully grok message
passing, events and async behavior. you are bringing up all the issues
that you think are real but they are not.
DT> I'll take a look, but I think this is a bit further up the
DT> protocol stack than an ORB ie. you could implement something like
DT> this to work around the lack of threads in Perl on top of the Perl
DT> ORB, but once again, that's not within the scope of my project. I
DT> can't ask people to add lots of methods to their objects to give
DT> them what they get in Java for free!
nope. this is so simple that you can't see it. take a look at some of
the demos. remote objects interact in the exact same way as do local
ones. the message passing paradigm is the key to it. no need to
predeclare RPC params and methods, no need to know if some object is
local or remote. you just use it the same way and send the exact same
message.
>> if you need blocking either use threads (events and threads can
>> coexist and i have done that), or multiple processes. the key is a
>> good IPC that makes life easy.
DT> A good IPC mechanism? I already have that, don't need another one
DT> ;)
rpc is not as powerful as message passing. as i said before, you can
easily emulate rpc with message passing. not the other way around.
DT> Yes, but in CORBA, every RPC call looks like a "normal" method
DT> call, so I don't even have to worry about "messaging". This may or
DT> may not be a feature, but it seems to work with OO practices
DT> pretty well. Messaging will always have the "result" message
DT> problem that is encapsulated by RPC, unless you don't care if
DT> no-one actually receives these messages, but I can't imagine a
DT> robust design that wouldn't want an acknowledgement.
oh, plenty of robust designs don't need ack on every message. you can
always deal with that using stem's gather module which is used to track
async responses and effectively synchronize them for you. gather also
has a timeout option. this is used internally and in many
applications. no problem at all.
DT> No, that's not true. If two *processes*, or threads, are writing
DT> to a file (for example), there must be some form of locking to
DT> avoid race conditions. You can't avoid it.
nope. if they share a file object (in a remote proxy process) then file
access could be single threaded. also several OS's have true async file
I/O and they can be wrapped in XS/SWIG/Inline to provide an event loop
API.
DT> Imagine one process is adding a record to a file. Halfway through,
DT> another process is scheduled, which starts writing to that same
DT> file. That process completes writing its record, then the first
DT> process gets to complete its write. Now you've got half a message,
DT> then a complete message, then the rest of the message ie a
DT> complete mess. You need locks to ensure mutual exclusion.
nope. you just deal with file proxies to serialize access.
DT> Your remote file module will inevitable have to add a lock, or
DT> transactions, of *some* kind.
nope.
DT> I'll put this as gently as I can - why would I want any of that,
DT> when I *already* have CORBA/J2EE? What problem does all this stuff
DT> solve, except the vendor's need for customer lock-in on their
DT> ill-conceived proprietary junk written by god-knows who?
it is much faster to develop message passing systems than comparable rpc
based ones. check out all the MOM systems out there. also stem is open
source, pure perl and aimed at the admin and network developer
markets. i doubt any of those will ever use corba/j2ee in their lives.
DT> I already have perfectly good messaging services that are
DT> well-defined, and designed by sensible people via a public
DT> process, that run on top of CORBA/J2EE, if messaging is *really*
DT> what I want (ie my problem is inherently so loosely coupled that I
DT> don't need to know if anyone actually receives any of these
DT> messages. I'm not sure what that would be, though. MP3 swapping?)
rpc can't do true message passing. tell me how you do this:
take a single complex user request, break it up into multiple parallel
requests to the same DB (and even other servers) and wait until all of
them are completed, then send the combined results back to the
user. with threads you are forced to serialize all the requests or spend
half your code synchronizing them. with stem this is trivial as parallel
access is built in to message passing and the gather module will
synchronize the results coming back.
DT> Again, I don't see how you magically make the need to avoid race
DT> conditions on shared resources just go away, and I think this
DT> "scale as needed" statement is a non-sequitor once again, as it
DT> implies that other designs don't, which is not true.
tell me how to run threads on a farm of boxes. it just can't be done. so
if you have more work to do than your single multiprocessor box can
handle, your threaded application is maxed out. you then have to create
an RPC layer which is new code. and you have to synchronize with other
threads. and then local access to threads is different code than remote
access to other processes. and again, there are no race conditions as
long as you isolate blocking operations in their own process.
look, this is getting nowhere. i done many years of work in events and
message passing have never had a race condition or blocking problems. i
have also used threads. you are and always will be a thread person. you
are the type i mentioned who (at the moment) can't understand how to
architect a message passing system so it doesn't have race conditions
and blocking problems. i know how to do that so it is second nature to
me. after you have downloaded stem and explored it for a little while,
then come back and ask concrete questions and you can learn how message
passing really works. your grasp of it is filtered through your
threading prejudices. threads have their place as i said but in complex
distributed applications they fall down IMNSHO.
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.stemsystems.com
----- Stem and Perl Development, Systems Architecture, Design and Coding ----
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
------------------------------
Date: 5 Oct 2002 10:13:54 -0700
From: angel@xev.net (Ken)
Subject: merging 2 strings
Message-Id: <fafcc419.0210050913.7c97d6b6@posting.google.com>
I am currently encrypting user data using encryption that uses a key.
However, I would like to use a unique key for each user's data. This
is so the encrypted strings will be different for each user even if
said user's have identical data. I have decided I can do this by using
one static string as the key and then merging it with something unique
to each user, such as the username or user number. My problem is I
have no idea how I can do this. I can't just use the dot operator to
combine them. I need to sort of mix them together. Am I making any
sense? If so, please help :)
------------------------------
Date: Sat, 05 Oct 2002 14:25:13 GMT
From: Tim B. <tim@ironwork.com>
Subject: newbie question - perl vs ?
Message-Id: <omttpu46q8fto14mml32e7qnqtf8cg1j46@4ax.com>
Having read and reread "Learning Perl", I'm starting to get into the
book, "Programming Perl" and am having a tough time of it. Perl is so
idiomatic that learning it is like learning English as an adult. One
is faced with mountains of context issues, stylistic variations, all
of which can be used to do the same thing, and a plethora of symbols,
many of which are to be understood differently when used in different
ways. Although similar variations exist in other languages, the
extent of this situation is much greater in Perl than in any other
language I have ever seen.
On the other hand, I am commited to working in a Linux/Open source
environment and need the extensive capabilities that I have been told
Perl offers. I'm just afraid I'll be old and crippled (mentally), by
the time I get proficient enough with Perl to use it productively. I
want to have as broad a base of understanding in working in the Linux
environment as possible, including networking, website development,
routine maintenance of a desktop and application programming.
Are there any viable language options to Perl? I know that I could go
to PHP for website/database development, but I've heard that PHP is
only a subset of Perl, and I will ultimately miss out on a lot and
have to learn Perl in the long run, anyway. C/C++ can do anything,
but it takes about 10 times as long to program in those languages.
On the other hand, maybe I need a good online couse in Perl. Does
anyone know where I can fine a good course that will take me from Perl
A to Perl Z??
ANY HELP WILL BE GREATLY APPRECIATED!!!
Tim B.
------------------------------
Date: Sat, 5 Oct 2002 15:06:08 +0000 (UTC)
From: mjd@plover.com (Mark Jason Dominus)
Subject: Re: newbie question - perl vs ?
Message-Id: <anmv50$bsn$1@plover.com>
In article <omttpu46q8fto14mml32e7qnqtf8cg1j46@4ax.com>,
Tim B. <tim@ironwork.com> wrote:
>Having read and reread "Learning Perl", I'm starting to get into the
>book, "Programming Perl" and am having a tough time of it. Perl is so
>idiomatic that learning it is like learning English as an adult. One
>is faced with mountains of context issues, stylistic variations, all
>of which can be used to do the same thing, and a plethora of symbols,
>many of which are to be understood differently when used in different
>ways. Although similar variations exist in other languages, the
>extent of this situation is much greater in Perl than in any other
>language I have ever seen.
>
>On the other hand, I am commited to working in a Linux/Open source
>environment and need the extensive capabilities that I have been told
>Perl offers. I'm just afraid I'll be old and crippled (mentally), by
>the time I get proficient enough with Perl to use it productively.
That's probably not the case. Perl is a big language with a lot of
stuff, contextual effects, stylistic variations, and so on. But you
don't need to be familiar with all of these variations to use Perl
productively. Find a subset you like and stay in it, expanding your
knowledge gradually. One of the benefits of Perl's eclectic syntax,
which borrows from a lot of other languages, is that you can probably
find a comfortable, familiar subset. If you're familiar with Unix
utilities, you can program Perl as if it were the shell, and stay away
from the more C-like parts until you're ready to deal with them; and
vice-versa.
Nobody is expected to absorb the whole camel book right off---or ever.
Almost everyone who uses Perl uses some subset or other. Of course,
some of those subsets are bigger than others, but none of the big ones
started off that way; they started small and grew over the years. If
you're reading the book, and it presents four ways to do something,
you should feel to ignore the last three, or the three you like least.
I don't know if you read the preface of your camel book, but there's a
paragraph I especially like on pages xvii-xviii:
Most important, you don't have to know everything there is to
know about Perl before yu can write useful programs. You can
learn Perl "small end first". You can program in Perl
Baby-Talk, and we promise not to laugh....Any level of
language proficiency is acceptable in Perl culture. We won't
send the language police after you. A Perl script is
"correct" if it gets the job done before your boss fires you.
>Are there any viable language options to Perl?
In my honest opinion, no. I was a professional unix system
administrator at the time Perl was rising to prominence, and before
Perl I did most of my work in a combination of Bourne shell, awk, and
C. I switched to Perl for a reason: It was a vastly superior
solution.
>I know that I could go to PHP for website/database development, but
>I've heard that PHP is only a subset of Perl,
Regardless, you aren't going to be using PHP to do routine system
administration tasks, data file format conversion, report generation,
etc. It only works for web sites.
The puzzle I have is that you say you have read and reread "Learning
Perl". If that's true, I don't understand why you feel your Perl
knowledge is lacking. LP would seem to have enough information in it
to get you well started writing almost anything; then you would need
to turn to the camel book only ocasionally, for reference, and to pick
up new features as needed. But it almost sounds as if you are trying
to swallow the camel whole before you ever write any programs. Is
that true? Did you try doing the exerises in LP?
------------------------------
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 3919
***************************************