[26861] in Perl-Users-Digest
Perl-Users Digest, Issue: 8875 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Jan 21 21:05:25 2006
Date: Sat, 21 Jan 2006 18:05:04 -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 Sat, 21 Jan 2006 Volume: 10 Number: 8875
Today's topics:
Re: Cleaning HTML ;-) axel@white-eagle.invalid.uk
Re: getpwent performance (Chris Richmond - MD6-FDC ~)
How to determine memory usage? <socyl@987jk.com.invalid>
Re: Matching subsets of two strings <jweeb2342@hotmail.com>
Re: Matching subsets of two strings robic0
Re: Matching subsets of two strings <devnull@remailer.org.uk>
Re: My SAX Parser, regexp style. Cut & paste version .9 robic0
Re: private cash job offer for sombody who is good with robic0
Re: private cash job offer for sombody who is good with <sbryce@scottbryce.com>
Re: randomly choose some uniq elements of an array <news@chaos-net.de>
Re: randomly choose some uniq elements of an array robic0
When does a bug turn into a design feature? Or, what is robic0
Re: When does a bug turn into a design feature? Or, wha <1usa@llenroc.ude.invalid>
Re: When does a bug turn into a design feature? Or, wha robic0
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sat, 21 Jan 2006 23:32:39 GMT
From: axel@white-eagle.invalid.uk
Subject: Re: Cleaning HTML ;-)
Message-Id: <rwzAf.5400$wl.4375@text.news.blueyonder.co.uk>
A. Sinan Unur <1usa@llenroc.ude.invalid> wrote:
> "Reinhard Glauber" <kigar@gmx.net> wrote in
> news:43d1fcbf$0$20788$9b4e6d93@newsread4.arcor-online.net:
>> I need to clean a HTML file, so that I get plain text.
> Use a parser to parse HTML, as the answer to the FAQ recommends:
> How do I remove HTML from a string?
> The most correct way (albeit not the fastest) is to use HTML::Parser
> from CPAN.
I find the most efficient way to get plain text from an HTML
file is to use 'lynx -dump'.
Axel
------------------------------
Date: Sun, 22 Jan 2006 01:54:08 +0000 (UTC)
From: crichmon@filc8046.fm.intel.com (Chris Richmond - MD6-FDC ~)
Subject: Re: getpwent performance
Message-Id: <dquok0$gq8$1@news01.intel.com>
This isn't especially slow on about the same number of users in NIS.
This an finding ~400 users in a particular group takes ~3 seconds.
Chris
%NIS = ();
$dn = "";
while( ($n,$pw,$uid,$grp,$dn,$cmt,$gcos,$home,$shell) = getpwent ) {
$NIS{$n} = {
'pw' => "$pw",
'uid' => "$uid",
'grp' => "$grp",
'cmt' => "$cmt",
'gcos' => "$gcos",
'home' => "$home",
'shell' => "$shell",
};
}
endpwent;
--
Chris Richmond | I don't speak for Intel & vise versa
------------------------------
Date: Sun, 22 Jan 2006 00:03:27 +0000 (UTC)
From: kj <socyl@987jk.com.invalid>
Subject: How to determine memory usage?
Message-Id: <dqui4f$j16$1@reader2.panix.com>
I want to determine how much memory my Perl program is using. If
possible, I'd like to measure the memory "high water mark", i.e.
the most memory used by the program at any point during its run.
If this is not possible, I'd settle for some instant memory read
that I can call periodically from within the program.
How should I do this?
Thanks!
kj
--
NOTE: In my address everything before the first period is backwards;
and the last period, and everything after it, should be discarded.
------------------------------
Date: 22 Jan 2006 00:31:30 -0000
From: Jim Weeb <jweeb2342@hotmail.com>
Subject: Re: Matching subsets of two strings
Message-Id: <HM8RYQEF38739.3552083333@reece.net.au>
In article <XCsAf.2734$jd5.848@trnddc02>
"Jürgen Exner" <jurgenex@hotmail.com> wrote:
> > Unfortunately after plumbing in that code it appears not to work
> > for me.
>
> Unfortunately "does not work" is completely useless as a description of what
> is happening.
>
> > Obviously a problem somewhere, perhaps I failed to
> > declare one of the variables (use strict) - do I have to declare
> > both %count and $count?
>
> The actual error message should tell you what is wrong.
> If you don't understand the message then just post it here and ask.
> Of course with the relevant snippet of the code.
When I say I'm a complete newcomer, I really mean it. The code
runs on a debian box that is not attached to a keyboard/screen,
but I can SSH into it. The only reason I know that my
alterations to the code don't work is because the desired
outcome isn't achieved (the mail2news gateway bounces instead of
processes the email)! I wasn't quite sure where the error
message would be, never mind what it says, but I have gone on a
hunting spree and here it is (in Exim4's main log, as the script
is called as an Exim4 transport):
R=mail2news_router T=mail2news_transport: Child process of
mail2news_transport transport returned 255 (could mean shell
command ended by signal 127 (Unknown signal 127)) from command:
/usr/local/bin/mail2news.pl
> Or rather post a minimal, self-contained sample script, that other people
> can just copy and paste and run themself.
The entire script is quite small. If I remove anything from it I
might just bugger it up entirely.
------------------------------
Date: Sat, 21 Jan 2006 16:40:58 -0800
From: robic0
Subject: Re: Matching subsets of two strings
Message-Id: <92l5t11pc95mp943vhdopevsm3l56aq157@4ax.com>
On 22 Jan 2006 00:31:30 -0000, Jim Weeb <jweeb2342@hotmail.com> wrote:
>In article <XCsAf.2734$jd5.848@trnddc02>
>"Jürgen Exner" <jurgenex@hotmail.com> wrote:
>
>> > Unfortunately after plumbing in that code it appears not to work
>> > for me.
>>
>> Unfortunately "does not work" is completely useless as a description of what
>> is happening.
>>
>> > Obviously a problem somewhere, perhaps I failed to
>> > declare one of the variables (use strict) - do I have to declare
>> > both %count and $count?
>>
>> The actual error message should tell you what is wrong.
>> If you don't understand the message then just post it here and ask.
>> Of course with the relevant snippet of the code.
>
>When I say I'm a complete newcomer, I really mean it. The code
>runs on a debian box that is not attached to a keyboard/screen,
>but I can SSH into it. The only reason I know that my
>alterations to the code don't work is because the desired
>outcome isn't achieved (the mail2news gateway bounces instead of
>processes the email)! I wasn't quite sure where the error
>message would be, never mind what it says, but I have gone on a
>hunting spree and here it is (in Exim4's main log, as the script
>is called as an Exim4 transport):
>
>R=mail2news_router T=mail2news_transport: Child process of
>mail2news_transport transport returned 255 (could mean shell
>command ended by signal 127 (Unknown signal 127)) from command:
>/usr/local/bin/mail2news.pl
>
>> Or rather post a minimal, self-contained sample script, that other people
>> can just copy and paste and run themself.
>
>The entire script is quite small. If I remove anything from it I
>might just bugger it up entirely.
>
Jesus Christ, whats a nubian box? I hope its not what I think it is.
if it is I can programm that baby in 1 minute......
------------------------------
Date: Sun, 22 Jan 2006 00:41:04 +0000
From: Anonymous <devnull@remailer.org.uk>
Subject: Re: Matching subsets of two strings
Message-Id: <ea56fd8df1beeca41d321ff5277433be@remailer.org.uk>
In article <Xns97526CA26E5D1asu1cornelledu@127.0.0.1>
"A. Sinan Unur" <1usa@llenroc.ude.invalid> wrote:
>
> Jim Weeb <jweeb2342@hotmail.com> wrote in news:64NQ053Y38738.9812037037
> @reece.net.au:
>
> > In article <I7fAf.213$jO3.168@trnddc07>
> > "Jürgen Exner" <jurgenex@hotmail.com> wrote:
> >>
> >> Jim Weeb wrote:
> >> > In article <dqqcdq$i40$1@mamenchi.zrz.TU-Berlin.DE>
> >> > anno4000@lublin.zrz.tu-berlin.de (Anno Siegel) wrote:
> >> >> See the faq "How do I compute the difference of two arrays? ..."
> >> >> (perldoc -q difference).
> >> >
> >> > Thanks, that appears to tell me the differences
>
> ...
>
> >> did you actually _read_ even just the full title of that FAQ?
>
> ...
>
> > Unfortunately after plumbing in that code it appears not to work
> > for me. Obviously a problem somewhere
>
> Obviously.
>
> > I will keep plodding along, then ask again if I can't make it
> > work.
>
> Or, as the guidelines suggest, you can post a short, self-contained
> script that we can run, and which demonstrates the problem you are
> having, so others can help you.
Yeah, if I have to ask again, it would involve me posting my
code.
> PS: Why do you have X-No-Archive set?
Paranoia that Google are up to no good.
------------------------------
Date: Sat, 21 Jan 2006 17:58:19 -0800
From: robic0
Subject: Re: My SAX Parser, regexp style. Cut & paste version .901
Message-Id: <9eo5t1lk6ljoua1i6b9qi6m0amhkbjk3di@4ax.com>
I'm about to finish this thing. Its mostly modeled after Expat.
Its all perl, mine is faster parsing about 1 meg a second.
Its also complient will current xml standards on w3c.org.
There's so much to it, I don't think I want to post it here.
I would like to make it into a "free" module on cpan or Active States
release version.
I think its commercial level. The fact is I can "interject" special
searches and handling if I want to. It is designed using the specs
from here:
http://www.w3.org/TR/xml11/#NT-AttValue
Its version 1.1 If I'm using the wron specs, please let me know.
Its awsome, tremendously fast.
I am going to also write a full featured "schema checker" using this
base parser. I've never seen something so easy as schema checking.
Thinking beyond I will move into modification tools. Even style sheet
mods (i think, its all too easy now). I will do it all in markup.
The code is about 600 lines now. I could plop it down here. I have
all constructs covered in the above 1.1 specs. I'm worried a little
about encoding and unicode. By an large, I've never seen anything
so easy in my life. I fear that my code is approacing a proffessional
level and I may "not" want to just plop it down here.
I may want to contact AS or Cpan to post the module so its not ripped
off. However, I know I could do a schema checker in a week. Since its
all so easy now, I'm wondering if I can make any money at this or is it
all just a give-away...
Oh well, from a homeless man to a middle class man, I know it won't be
that much. However, I have developed tools that could do conversions.
Yea sure I want to put my stuff in the public domain, but the internals
I do with them could do fast custom conversions.
What do you think? Say it now, if it ends up in AS or Cpan you won't have
the option to reccommend. It will arrive there, but whats the money behind
hard core conversions, style, schema, filters, anything?
------------------------------
Date: Sat, 21 Jan 2006 16:19:14 -0800
From: robic0
Subject: Re: private cash job offer for sombody who is good with perl .pl script
Message-Id: <umj5t1t4t4gobv9rbhvm5oudl3gksoirll@4ax.com>
On Sat, 21 Jan 2006 22:35:01 -0000, "Darren & Linda Ingall" <darren_linda@ingall.me.uk> wrote:
>for somebody who knows what they are doing I'm sure it could be done in 1/2 hour.
>
>I have a website mainly run from a .pl script. Its a classified advertisement script ---Works Well
>It is possible for a user (with their password) to edit their adverts --- Works Well
>if the password is incorrect it bounces the edit process --- Works Well
>
>I want to add this and have no idea how
>ip = ip address of user
>
>On edit request
>open file of ip's to block and search for this users ip
>if this users ip in file with todays date on one line bounce edit request with
>' sorry you have been using bad password's you are now blocked please try again tomorrow bla bla bla'
>
>
>in the event of an incorrect password being attempted to edit an advert
>Sorry wrong password . As a security measure you will not be able to edit your advert today.
>open file of ip's to block, write new line to file with this users ip and todays date.
>
>
> this would then give me a text file of incorrect password attempts and ip's of users.
> I know most isp's don't use static ip's but this. Would provide more security to adverts and would show an attack.
>
>if anybody out their wants to quote a cheap price pls reply
>
>darren@ingall.me.uk
>
>vb i could do it perl i have no idea
Its easy to do. I could do it for 5-10, is that ok with you? I don't work by the half,
but by the amount of percieved importance the client exhibits.
robic0@yahoo.com
------------------------------
Date: Sat, 21 Jan 2006 15:55:19 -0700
From: Scott Bryce <sbryce@scottbryce.com>
Subject: Re: private cash job offer for sombody who is good with perl .pl script
Message-Id: <0pOdnSUy8OpJJk_eRVn-pQ@comcast.com>
Darren & Linda Ingall wrote:
> for somebody who knows what they are doing I'm sure it could be done
> in 1/2 hour.
This newsgroup is not for job postings. Try posting your request at
alt.comp.perlcgi.freelance
------------------------------
Date: Sun, 22 Jan 2006 02:12:36 +0100
From: Martin Kissner <news@chaos-net.de>
Subject: Re: randomly choose some uniq elements of an array
Message-Id: <slrndt5n04.42r.news@maki.homeunix.net>
John W. Krahn wrote :
> Martin Kissner wrote:
>> my $dir = "/path/to/folder";
>> opendir DH, $dir || die "can not open $dir: $!";
>
> The precedence of '||' is too high for that to work correctly (it will never
> die.) You have to either use parentheses:
>
> opendir( DH, $dir ) || die "can not open $dir: $!";
>
> Or use the lower precedence 'or' operator:
>
> opendir DH, $dir or die "can not open $dir: $!";
Thanks for pointing that out. I once knew this, but I forgot.
>> my @files = grep !/^\.\.?$|/ ,readdir DH;
> ^
> Your regular expression says to match the pattern '^\.\.?$' or alternatively
> to match nothing and since the expression is negated that means that @files
> will receive nothing!
Actually its grep "!/^\.\.?$|\.DS_Store/" to match the .DS_Store files
used by Mac OS X. I deleted this in the post for the sake of simplicity
- not carefully enough as I must see now ;).
Thanks for your feedback
Regards
Martin
--
perl -e '$S=[[73,116,114,115,31,96],[108,109,114,102,99,112],
[29,77,98,111,105,29],[100,93,95,103,97,110]];
for(0..3){for$s(0..5){print(chr($S->[$_]->[$s]+$_+1))}}'
------------------------------
Date: Sat, 21 Jan 2006 17:32:51 -0800
From: robic0
Subject: Re: randomly choose some uniq elements of an array
Message-Id: <iin5t15vq4e14949riutff67ouhs08fl22@4ax.com>
On Sun, 22 Jan 2006 02:12:36 +0100, Martin Kissner <news@chaos-net.de> wrote:
>John W. Krahn wrote :
>> Martin Kissner wrote:
>
>>> my $dir = "/path/to/folder";
>>> opendir DH, $dir || die "can not open $dir: $!";
>>
>> The precedence of '||' is too high for that to work correctly (it will never
>> die.) You have to either use parentheses:
>>
>> opendir( DH, $dir ) || die "can not open $dir: $!";
>>
>> Or use the lower precedence 'or' operator:
>>
>> opendir DH, $dir or die "can not open $dir: $!";
>
>Thanks for pointing that out. I once knew this, but I forgot.
>
>>> my @files = grep !/^\.\.?$|/ ,readdir DH;
>> ^
>> Your regular expression says to match the pattern '^\.\.?$' or alternatively
>> to match nothing and since the expression is negated that means that @files
>> will receive nothing!
>Actually its grep "!/^\.\.?$|\.DS_Store/" to match the .DS_Store files
>used by Mac OS X. I deleted this in the post for the sake of simplicity
>- not carefully enough as I must see now ;).
>
>Thanks for your feedback
>Regards
>Martin
Not sure where this follow will follow but..
I want to remind the OP that opendir will actually "change directory" on the OS
level so that a subsiquent glob will read from that directory.
The "opendir" is only meant to facillitate not having to parse a directory from
the filename. I strongly suggest to the OP to NOT use opendir at all, ever,
and to stay in the current directory and call glob with a path, then parse out
the filename.
I consider "opendir" and company one of Perls worst alloweces, without allowances
for an immediate "pop" to the last directory when "glob"'ing. Its a "fopa", period!
A simple regex can separate the filename. How can you call another function after
changing dir's, and expect them to know where you are? And don't make a overrideing
class function out of it, Jesus!
"Opendir" is Perls fopa....
------------------------------
Date: Sat, 21 Jan 2006 15:50:07 -0800
From: robic0
Subject: When does a bug turn into a design feature? Or, what is a "bug"?
Message-Id: <1rf5t1tm7n7qcipuit5b4vfjohknmplruh@4ax.com>
Not to be outdone by Xah's rants, I introduce this perilous symantec
paradox.
I come from an engineering background with little help from English classes.
I found out early that English and logic don't mix:
i = i + 1 is surely not a Engineering concept! The biggest fopa in engineering
is a "conceptual error". Its akin to touching "the third rail" in a subway transit system.
I think that before programming accumen there were "only" engineers. In fact it was invented
by engineers. But i = i + 1 to an engineer, is a "fopa", an indication of an idiot.
How does that resolve when the monicker "software 'engineer'" is bestowed upon graduates of
computer science. There is no such thing as computer "science"! Computers aren't a science!
Electronic "test tube" gating is a "science", jk-flip flop, what ever you want to call it...
transistors, semi-conductors. The ability of an object ot hold a state open under voltage and
release it when removed. A binary machine. That is science. Programming languages emulate a model
of gating science. But its not a science. How insulting! Boolean logic? Gating?
Formal logic? Yes, formal logic would seem to be the underlying foundation for all modern software.
Because, we think in language and "formal logic" is the "science" of thinking, ergo language it is
and will always control provisions of programming. Which is NOT a formal "science", and never will
be! That is a paradox.
To engineers, f=ma, and e=mc**2 (means the same thing, with a unit conversion) cannot be eclipsed!
As long as the binary (electronics) cannot either, there is nothing that will ever change the state
of a "old" binary based technology. In order for binary to be supplanted, the binary has to be removed!
A new model, one that has a newer complex state as a minimul of the electronic foundary, has to be
devised. One NOT based on binary. A basis of electronics based on a new model of abstraction has to
be devised. More susinctly, an abstraction "unit" has to be the new binary/electronic model.
Multiple state electronic gating, not simple binary. Not anything related to binary at all.
Up/down, left/right, back/forward has just got to leave human thinking as a base unit of measurement!
Think about it.
------------------------------
Date: Sat, 21 Jan 2006 23:56:46 +0000 (UTC)
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: When does a bug turn into a design feature? Or, what is a "bug"?
Message-Id: <Xns9752C206B130asu1cornelledu@132.236.56.8>
robic0 wrote in news:1rf5t1tm7n7qcipuit5b4vfjohknmplruh@4ax.com:
> symantec paradox.
ITYM 'semantic'.
> I come from an engineering background with little help from English
> classes.
While the latter is obvious, I would consider the first statement an insult
to engineers everywhere.
> fopa
ITYM 'faux pas' (see http://www.google.com/search?q=define%3A+faux+pas)
> Think about it.
You will have to try a few bazillion more times to get to the point where
you can begin to imagine that you may one day be able to write as well as
Xah Lee.
Plonking you on this computer as well. Thanks for the entertainment.
Sinan
------------------------------
Date: Sat, 21 Jan 2006 16:10:50 -0800
From: robic0
Subject: Re: When does a bug turn into a design feature? Or, what is a "bug"?
Message-Id: <bni5t11j5p3q4fpio3ff7b3dt4j8sr0bkp@4ax.com>
On Sat, 21 Jan 2006 23:56:46 +0000 (UTC), "A. Sinan Unur" <1usa@llenroc.ude.invalid> wrote:
>robic0 wrote in news:1rf5t1tm7n7qcipuit5b4vfjohknmplruh@4ax.com:
>
>> symantec paradox.
>
>ITYM 'semantic'.
>
>> I come from an engineering background with little help from English
>> classes.
>
>While the latter is obvious, I would consider the first statement an insult
>to engineers everywhere.
>
>> fopa
>
>ITYM 'faux pas' (see http://www.google.com/search?q=define%3A+faux+pas)
>
>> Think about it.
>
>You will have to try a few bazillion more times to get to the point where
>you can begin to imagine that you may one day be able to write as well as
>Xah Lee.
>
>Plonking you on this computer as well. Thanks for the entertainment.
>
>Sinan
Thanks Sinan!
I don't read Xah. I'm very dyslexic so I avoid reading entirely.
My last grade school was the 8th grade. 15 years later got a BSME
in 2 years. I think my inherint power is logic. Something "rings" in my
ear when its not right, always did since I was born.
I've suggested a problem and a possible solution. You should take
or smoke some halucinigens and re-read the post. Maybe your, er ahh,
"mind" will be able to think "outside the box"...
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc. For subscription or unsubscription requests, send
#the single line:
#
# subscribe perl-users
#or:
# unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.
NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.
#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V10 Issue 8875
***************************************