[21934] in Perl-Users-Digest
Perl-Users Digest, Issue: 4156 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Nov 21 14:11:03 2002
Date: Thu, 21 Nov 2002 11:10:10 -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 Thu, 21 Nov 2002 Volume: 10 Number: 4156
Today's topics:
PERL based bulletin board functionality. (Steve Jenkins)
Re: PERL based bulletin board functionality. <ian@WINDOZEdigiserv.net>
Re: reg exp problem (Tad McClellan)
Re: reg exp problem (jaya prakash)
Re: semantics of nested backreferences in regular expre (Peter Scott)
top-posting (was Re: help this Newbie in Distress) (Tad McClellan)
Web Graphs (haniz)
Re: Web Graphs <simon.oliver@umist.ac.uk>
Re: Web Graphs (Helgi Briem)
writing image to Word document (sean)
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 21 Nov 2002 08:37:17 -0800
From: stevejenkins444@hotmail.com (Steve Jenkins)
Subject: PERL based bulletin board functionality.
Message-Id: <9c8b3a8.0211210837.5c1d0738@posting.google.com>
Hi,
Does anyone know of some fairly powerful bulletin board
functionality, e.g. functionality where moderators can move peoples'
postings around from one forum to another; and, would like to be able to
search said forums/posts, and .... ideally also combine such searches with
queries with database queries. Has anyone had experience of any such PERL (and
ideally Oracle) bulletin board functionality? Or heard of any quality PERL
bulletin board fnality?
Many thanks,
Steve.
------------------------------
Date: Thu, 21 Nov 2002 16:42:20 +0000
From: Ian.H <ian@WINDOZEdigiserv.net>
Subject: Re: PERL based bulletin board functionality.
Message-Id: <453qtukv554t4cfob0jnn1mga8p5tievdo@4ax.com>
Keywords: Remove WINDOZE to reply
-----BEGIN xxx SIGNED MESSAGE-----
Hash: SHA1
In a fit of excitement on 21 Nov 2002 08:37:17 -0800,
stevejenkins444@hotmail.com (Steve Jenkins) managed to scribble:
> Hi,
>
> Does anyone know of some fairly powerful bulletin board
> functionality, e.g. functionality where moderators can move peoples'
> postings around from one forum to another; and, would like to be able
> to search said forums/posts, and .... ideally also combine such
> searches with queries with database queries. Has anyone had
> experience of any such PERL (and ideally Oracle) bulletin board
> functionality? Or heard of any quality PERL bulletin board fnality?
>
> Many thanks,
> Steve.
I think the most common/popular Perl based BB was UBB (Ultimate
Bulletin Board), but I'm not sure if this has been migrated to phpBB,
but it might be worth having a look for.
Other option, to try a site such as hotscripts.com and search their
rather large databases for what you're looking for.
HTH.
Regards,
Ian
-----BEGIN xxx SIGNATURE-----
Version: PGP Personal Privacy 6.5.3
iQA/AwUBPd0M62fqtj251CDhEQIv1QCdGEFzO90THo6ZiXtcDw/lGP04HpkAniXp
1Ye3No4sF5SIn04MWpO5hfPu
=1lw0
-----END PGP SIGNATURE-----
--
Ian.H (Design & Development)
digiServ Network - Web solutions
www.digiserv.net | irc.digiserv.net | forum.digiserv.net
Scripting, Web design, development & hosting.
------------------------------
Date: Thu, 21 Nov 2002 08:49:23 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: reg exp problem
Message-Id: <slrnatpsjj.2ns.tadmc@magna.augustmail.com>
Tad McClellan <tadmc@augustmail.com> wrote:
> jaya prakash <prakashrj@hotmail.com> wrote:
>>
>> The following code snippet which was part my program was giving the
>> same output for Diffrent Data Inputs.
>
>
> What were you expecting it to do that it is not doing?
>
> It looks straightforward to me, so I can't help explain why
> it doesn't do what you expected, because you have neglected
> to say what it is that you expected. :-)
>
>
>> I am not able to comprehend the
>> reason behind it and any help will be greatly appreciated.
>
>
> Your pattern will match when there are 24 consectutive "t"s
> in the string.
>
> There are 24 consecutive "t"s in both strings, so they
> both match. What's the problem?
>
> You would need 27 "t"s to get another \1 match, 25 is not enough,
> since \1 contains 3 characters.
On rereading this, I think I see what it was that you might
have been expecting...
Your pattern was:
m/(.{1,3})\1{7,}/
Were you expecting that the regex engine would backtrack to
choose the 1 in {1,3}, and hence match any char series of
8 or more characters?
That does not happen because perl will only backtrack when
its earlier decision causes the overall match to fail.
With your original data, perl greedily chooses the 3 in {1,3}
and does not reconsider that decision because the overall
match can succeed with that decision as it is.
With data like:
my $sequence = 'tttttttxyzttttttttabctttttttttdef'; # 7,8,9 "t" chars
It _will_ backtrack to choose the 1 in {1,3} for the 2nd two
runs of "t" characters, because the match will fail if it
doesn't backtrack.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: 21 Nov 2002 10:09:19 -0800
From: prakashrj@hotmail.com (jaya prakash)
Subject: Re: reg exp problem
Message-Id: <ee5d9.0211211009.58fd9364@posting.google.com>
prakashrj@hotmail.com (jaya prakash) wrote in message news:<ee5d9.0211201418.4874c0a0@posting.google.com>...
> Hi,
>
> The following code snippet which was part my program was giving the
> same output for Diffrent Data Inputs. I am not able to comprehend the
> reason behind it and any help will be greatly appreciated.
>
> #!/usr/bin/perl -w
>
> my($strict, $sequence, $regexp) = ();
>
> while(<DATA>) {
> chomp;
> $sequence .= $_;
> }
> $sequence =~ s/\s*//g;
> $sequence =~ tr/A-Z/a-z/;
>
> $strict = 8;
> $regexp = '(.{1,3})\1{' . ($strict - 1) . ',}';
>
> while($sequence =~ /$regexp/g) {
> print "length: " . length($&) . "\t$&\n";
> }
>
>
> __DATA__
>
> tattcaacctgtcgctgcTAGCGGACATGTAGGCTGCttccttttttttttttttttttt
> ttttttgctactgcctatgatgcttcagtgagctgccccacaccacgcgtatatcttggc
> aggaagagctacgggataaaggcttagaagttaaattactgggccaaagagtatgtatgt
>
> tattcaacctgtcgctgcTAGCGGACATGTAGGCTGCttccttttttttttttttttttt
> tttttgctactgcctatgatgcttcagtgagctgccccacaccacgcgtatatcttggc
> aggaagagctacgggataaaggcttagaagttaaattactgggccaaagagtatgtatgt
>
>
> Notice that first 3 lines contain 25 continous 't's
> and second line contains 24 continous 't's
>
> The following is the output from that program
>
> length: 24 tttttttttttttttttttttttt
> length: 24 tttttttttttttttttttttttt
Thanks tad for your explanation of the reg exp. I was actually
intending to get the following output
length: 25 ttttttttttttttttttttttttt
length: 24 tttttttttttttttttttttttt
Since I understood that problem from your explanation of regular
expression, I will try modifying it.
Also, I couldn't respond back to your reply as I am posting this from
google. All my posting previoiusly from this email
address(prakash@ece.arizona.edu) stopped appearing on this group. I
actually used to post before but my behaviour previously might have
made some of you block my email address.
------------------------------
Date: Thu, 21 Nov 2002 18:55:07 GMT
From: peter@PSDT.com (Peter Scott)
Subject: Re: semantics of nested backreferences in regular expressions
Message-Id: <f_9D9.854921$v53.31929657@news3.calgary.shaw.ca>
[Posted and mailed]
In article <87smxxq6ly.fsf@bird.agharta.de>,
Edi Weitz <edi@agharta.de> writes:
>With 5.6.1 and 5.8.0 I see this behaviour
>
> edi@bird:~ > perl -le 'use Data::Dumper; $_="a"; /((a)*)*/; print Dumper $1, $2'
> $VAR1 = '';
> $VAR2 = undef;
>
> edi@bird:~ > perl -le 'use Data::Dumper; $_="ab"; /((a)|(b))*/; print Dumper $1, $2, $3'
> $VAR1 = 'b';
> $VAR2 = 'a';
> $VAR3 = 'b';
>
>which confuses me.
Me too. Since no one followed up, I took this to Jeff Pinyan, and he supplied
the answer below, which I am posting at his request:
---------- begin forwarded material ----------
((a)*)* matches the "a", and puts it in $1 and
$2, but then the outermost * causes ((a)*) to try again! The (a)* matches
zero times (and /(x)?/ sets $1 to undef if the 'x' can't match), and we
can match the empty string zero or more times.
It's confusing, I admit, but I understand it. Use (?{ ... }) to help get
it:
"a" =~ m{
(?:
( (a)* )
(?{
printf "1=%s; 2=%s\n",
defined($1) ? "'$1'" : "undef",
defined($2) ? "'$2'" : "undef"
})
)*
}x;
The output is:
1='a'; 2='a'
1=''; 2=undef
>> edi@bird:~ > perl -le 'use Data::Dumper; $_="ab"; /((a)|(b))*/; print Dumper $1, $2, $3'
>> $VAR1 = 'b';
>> $VAR2 = 'a';
>> $VAR3 = 'b';
Ok, I think I know why this result (above) differs from this result
(below):
> edi@bird:~ > perl -le 'use Data::Dumper; $_="ab"; print Dumper $1, $2, $3 while /((a)|(b))/g'
> $VAR1 = 'a';
> $VAR2 = 'a';
> $VAR3 = undef;
>
> $VAR1 = 'b';
> $VAR2 = undef;
> $VAR3 = 'b';
The second approach uses more than one regex; so ALL the $DIGIT vars are
"reset". The first approach shows a behavior of regexes I hadn't
previously paid attention to:
"XY" =~ m{ (?: (X) | (Y) ){2} }x
stores X in $1, and store Y in $2 without undef'ing $1.
------ end forwarded material -----------
--
Peter Scott
http://www.perldebugged.com
------------------------------
Date: Thu, 21 Nov 2002 10:44:28 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: top-posting (was Re: help this Newbie in Distress)
Message-Id: <slrnatq3bc.2q2.tadmc@magna.augustmail.com>
[ de-Jeopardized this one last time.
please restrict your line lengths to the conventional 70-72
characters, else they get hard to read after a few generations
of quoting marks have been added.
]
D <doris@chris.com> wrote:
> Jay Tilton wrote:
>
>> [ Please do not top-post replies. Please trim reply-quoted text to the
>> minimum necessary to establish context. Please read the posting
>> guidelines at http://mail.augustmail.com/~tadmc/clpmisc.shtml . Posting
>> chronology restored. ]
> What I liked about it
What "it"?
You snipped too much.
If you had quoted the p.s. and then said "it", we would
know what you were referring to.
Putting your comment following the object of your comment,
makes it clear what it is that you are referring to.
> was the "colons" to the left of the quoted mail. The
> colons are what looks cool rather than those arrows.
>
> By the way, regarding, "top-posting"...... how can ANYONE
> think "bottom posting"
> is a good thing!?!
Let's leave aside whether or not it is "right" or "wrong"
for the moment.
There is a more pragmatic reason for not top-posting in
this newsgroup.
Most folks here _like_ it that way.
They will be more receptive to volunteering to help you if
you respect their wishes.
ie. persistant top-posting can get you killfiled.[1]
> Nothing is more annoying than having to scroll
> down.
We now revisit the "right" vs. "wrong" aspect. :-)
You are confusing "top-posting" with "full-quoting", which
is understandable since folks often do both in combination.[2]
The proper way of quoting includes trimming what you quote, as
well as interleaving your comments near where they apply.
So there is no need to "scroll down" for _properly_ quoted articles.
> Why not
> see the answer right away?
^^^
That would be fine for people following only that one thread,
they will probably remember what the question was.
But what about all of the _other_ people? ie. the ones who
read lots and lots of questions here?[3]
That would also be fine for people who read the earlier article
a few minutes or hours earlier, they will probably remember
what the question was too.
But what about all of the _other_ people? ie. the ones who
don't check news often where there may be days between
seeing the articles?
They have to scroll down to see the question, then scroll
back up yet again to see the answer.
For these reasons, folks that persist in using a TOFU style
of quoting are seen as being rude and/or inconsiderate of others.
(perhaps accompanied by social sanctions.)
> but I seriously think I comprize at LEAST 60% of the
> population!
The (general) population does not matter, they are not here.
What matters in this newsgroup is the population of this newsgroup,
and they clearly do not have your opinion in the majority.
> However, let's all not start a "top post" vs "bottom post" thread here.....
Too late.
> Anyway... you did NOT answer my question.
You win some, you lose some.
There is no obligation for anyone to answer your question.
> I never post questions that
> are stupid.
But if you did, that would be OK.
It is the "already answered in the docs" questions that are
objectionable, not merely "stupid" ones.
> But thank you for your opinions.
Despite the fact that you will persist in ignoring them?
That detracts some from the strength of your proclaimed gratitude. :-)
[1] I had in fact scored your articles -1000 even before quoting
style was mentioned in the thread.[4]
[2] known as "TOFU":
http://www.tuxedo.org/~esr/jargon/html/entry/TOFU.html
[3] These are exactly the people you want to target, those who
have demonstrated a willingness to answer lots of questions.
Annoying them may reduce that willingness...
[4] but your articles have since been "upgraded" to -9998 as
your latest followup seems to imply that you refuse to quote in
the style your audience prefers.[5]
[5] which seems harsh, but I get the feeling that you did not
bother to follow the references given, as the "why"s that
you ask seem to be addressed there already.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: 21 Nov 2002 06:59:44 -0800
From: haniz@uol.com.br (haniz)
Subject: Web Graphs
Message-Id: <671dd633.0211210659.51470ff0@posting.google.com>
This could sound a ridiculous issue... but I'd like to confirm if I'm
on the right way to solve my problem.
If I want to use Perl to create a graph to be published on a dynamic
web page, I have to follow these steps:
1. Download and install the packages GD and GDGraph;
2. Code a mygraph.pl file using these packages' functions;
3. Insert a <img src=.../mygraph.pl?args> on my html page.
I appreciate a simple "yes" or "no" response. Any complements will be
welcome.
Henry.
------------------------------
Date: Thu, 21 Nov 2002 15:18:41 +0000
From: Simon Oliver <simon.oliver@umist.ac.uk>
To: haniz <haniz@uol.com.br>
Subject: Re: Web Graphs
Message-Id: <3DDCF951.6080802@umist.ac.uk>
haniz wrote:
> This could sound a ridiculous issue... but I'd like to confirm if I'm
> on the right way to solve my problem.
>
> If I want to use Perl to create a graph to be published on a dynamic
> web page, I have to follow these steps:
>
> 1. Download and install the packages GD and GDGraph;
> 2. Code a mygraph.pl file using these packages' functions;
> 3. Insert a <img src=.../mygraph.pl?args> on my html page.
>
> I appreciate a simple "yes" or "no" response. Any complements will be
> welcome.
yes
Don't forget to send a content type header with the image. Here's an example
script:
#!perl -w
use strict;
use GD::Graph::bars;
my @data = ( [qw(a b c d e f g)], [1,2,3,4,5,6,7] );
my $graph = GD::Graph::bars->new(200, 200);
my $gd = $graph->plot(\@data);
binmode STDOUT;
print "Content-type: image/png\n\n";
print $gd->png();
------------------------------
Date: Thu, 21 Nov 2002 15:47:23 GMT
From: helgi@decode.is (Helgi Briem)
Subject: Re: Web Graphs
Message-Id: <3ddcfffa.3155925561@news.cis.dfn.de>
On 21 Nov 2002 06:59:44 -0800, haniz@uol.com.br (haniz)
wrote:
>This could sound a ridiculous issue... but I'd like to confirm if I'm
>on the right way to solve my problem.
>
>If I want to use Perl to create a graph to be published on a dynamic
>web page, I have to follow these steps:
>
>1. Download and install the packages GD and GDGraph;
>2. Code a mygraph.pl file using these packages' functions;
>3. Insert a <img src=.../mygraph.pl?args> on my html page.
Yes.
--
Regards, Helgi Briem
helgi AT decode DOT is
A: Top posting
Q: What is the most irritating thing on Usenet?
- "Gordon" on apihna
------------------------------
Date: 21 Nov 2002 07:37:56 -0800
From: sendmerubbish2002@yahoo.com (sean)
Subject: writing image to Word document
Message-Id: <e0ea24ce.0211210737.2e187a72@posting.google.com>
i am working with a dynamic html page generated by a perl script that
contains images within tables. As well as displaying the html page in
the browser window, i want to write it to a Word document. I do this
by building the html within a variable like below
$outputstream .= "<TABLE>";
$outputstream .= "<TR>";
$outputstream .= "<TD>";
$outputstream .= "<IMG SRC=\"eircom_net_logo.gif\" WIDTH=150
HEIGHT=35>";
$outputstream .= "<TD>";
................................
and then writing $outputstream to Web Browser and also to the Word
Document file. The image does not appear in the Word document but does
appear in the browser. Has anyone any suggestions how i might use perl
to write an image to a word document?
thanks Sean
------------------------------
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 4156
***************************************