[13668] in Perl-Users-Digest
Perl-Users Digest, Issue: 1078 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Oct 15 15:57:42 1999
Date: Fri, 15 Oct 1999 12:57:26 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <940017446-v9-i1078@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Fri, 15 Oct 1999 Volume: 9 Number: 1078
Today's topics:
Re: SGML documentation (Tad McClellan)
Re: SGML documentation (Brett W. McCoy)
Re: SGML documentation (Tad McClellan)
Re: SGML documentation (Randal L. Schwartz)
Re: SGML documentation (Brett W. McCoy)
SIMPLE: counter question, SSI, please help (Max S.)
Re: SIMPLE: counter question, SSI, please help <amonotod@netscape.net>
Re: SIMPLE: counter question, SSI, please help (Abigail)
Size Does Matter? [*not* porn spam!] <jon@midnightbeach.com>
Re: Size Does Matter? [*not* porn spam!] <jeffp@crusoe.net>
Re: Size Does Matter? [*not* porn spam!] <jon@midnightbeach.com>
Re: Slideshow script <dwoods@ucalgary.ca>
Re: Slideshow script <shades__@mitec.net>
Re: Slideshow script jongunn@my-deja.com
Re: Slideshow script jongunn@my-deja.com
Sorting values of hash <reactive@my-deja.com>
Re: Sorting values of hash <laurensmith@sprynet.com>
Re: Sorting values of hash <amonotod@netscape.net>
Re: Sorting values of hash <sariq@texas.net>
Re: Sorting values of hash <reactive@my-deja.com>
Re: Sorting values of hash <sariq@texas.net>
Re: Sorting values of hash <gellyfish@gellyfish.com>
Re: Sorting values of hash <amonotod@netscape.net>
Re: Sorting values of hash <reactive@my-deja.com>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 13 Oct 1999 04:14:53 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: SGML documentation
Message-Id: <t1f1u7.nc.ln@magna.metronet.com>
Brett W. McCoy (bmccoy@news.i95.net) wrote:
: Is there any documentation for any of the SGML modules? The ones I have
: installed, such SGML::Parser and SGML::DTD, seem to have no documentation
: associated with them.
You can find a bit of docs in the comments in the module code itself.
Find out where they got installed, and do:
grep ^## DTD.pm | more
Parser.pm is not "-w clean".
So I don't trust it.
So I'll never use it.
I recommend using SGMLS.pm instead. It requires the 'nsgmls'
SGML parser (http://www.jclark.com).
SGMLS.pm and nsgmls do a "real" SGML parse.
Parser.pm scans for SGML-looking things, not a real parse (it
does not blow up if there is no DTD for example).
: My problem is this:
: I have a bunch of drug reaction data that has been provided to me as ASCII
: text with '$' used as a column delimiter, and as SGML that complies with a
: DTD standard developed by the International Conference for Harmonisation
: (the specs for which I do have available). I've never done much with
: SGML, so my dilemma is which will be the easier to program and ultimately
^^^^^^^^^^
: get into my database server (getting it *into* the database is easy -- I'm
: using PostgreSQL via Pg.pm--
So if your _ultimate_ goal is to get it into your DB, and that
is easy, then why are you posting?
:-)
: it's getting the data extracted and
: organized)?
Looks like your real ultimate goal is to be able to "do stuff"
with the data once loaded?
: I have done lots of stuff with delimited files, so that's easy
: enough to do.
For "getting it into the DB" I would use the dollar-sign
separated data (if I trusted the data).
: I just don't know how well parsing the SGML will make my
: life easier,
A discussion of "what's SGML good for" is off-topic in a
Perl newsgroup. You should ask that question in:
comp.text.sgml
But, since we are already here...
It can provide some automated checking of constraints.
If the data might have mistakes in it (such as missing a
required element), then parsing will reveal the error.
If the data has been parsed, then you can leave out a bunch
of error checking in the code that "does stuff" with the data.
: since the data definition is built into the document
: specification.
I don't know what you mean by that.
What do you mean by that? :-)
: Here's a sample of the SGML:
[snip instance]
That is not SGML.
SGML *requires* a DTD.
So what you have there is an SGML-looking fragment of something.
I don't say that to be pedantic.
I say it because understanding the importance of the DTD is
central to "getting it" in SGML.
The DTD is the model for your SGML data.
The more complex the data, the more helpful it is to have a
rigorous model for the data, along with an automated way to
check that data actually conforms to the model.
: Any recommendations here?
use SGMLS;
: Are any of the SGML modules capable of dealing
: with something like this?
SGMLS.pm
:-)
Anyway, here is a crude SGML-pretty-printer that uses
SGML::Parser to get you started:
----------------------------
#!/usr/bin/perl
# an SGML pretty-printer
use strict;
package MyParser;
use SGML::Parser;
@MyParser::ISA = ('SGML::Parser'); # MyParser is a subclass of SGML::Parser
my $parser = new MyParser;
my $depth = 0; # how many levels of indent (a "stack")
#open(DATA, 'file.sgml') || die "could not open 'file.sgml' $!";
$parser->parse_data(\*DATA);
#close(DATA);
### start_tag ###
sub start_tag {
my $this = shift;
my($gi, $attr_spec) = @_;
print ' ' x $depth, "<$gi$attr_spec>\n";
$depth++;
}
### end tag ###
sub end_tag {
my $this = shift;
my($gi, $attr_spec) = @_;
$depth--;
print ' ' x $depth, "</$gi>\n";
}
### PCDATA ###
sub cdata {
my $this = shift;
my($cdata) = @_;
return if $cdata =~ /^\s*$/; # ignore blank lines
chomp $cdata;
print ' ' x $depth, "$cdata\n";
}
__DATA__
<ichicsr lang="en">
<ichicsrmessageheader>
<messagetype>ICSR</messagetype>
<messageformatversion>2.0</messageformatversion>
<messageformatrelease>1.0</messageformatrelease>
<messagenumb>1997-11</messagenumb>
<messagesenderidentifier>FDA CDER OPDRA</messagesenderidentifier>
<messagereceiveridentifier>Public Use</messagereceiveridentifier>
<messagedateformat>204</messagedateformat>
<messagedate>199905199:56:00</messagedate>
</ichicsrmessageheader>
<safetyreport>
<safetyreportid>1988338-9</safetyreportid>
<transmissiondateformat>102</transmissiondateformat>
<transmissiondate>19990519</transmissiondate>
<receivedateformat>102</receivedateformat>
<receivedate>19971118</receivedate>
<receiptdateformat>102</receiptdateformat>
<receiptdate>19961107</receiptdate>
<companynumb>96110279</companynumb>
<primarysource>
</primarysource>
<sender>
</sender>
.
.
.
<drug>
<drugcharacterization>2</drugcharacterization>
<medicinalproduct>Captopril(Capoten)</medicinalproduct>
<drugstartdateformat>102</drugstartdateformat>
<drugstartdate>19970430</drugstartdate>
</drug>
</safetyreport>
</ichicsr>
----------------------------
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Wed, 13 Oct 1999 13:36:53 GMT
From: bmccoy@foiservices.com (Brett W. McCoy)
Subject: Re: SGML documentation
Message-Id: <slrn8092vj.su9.bmccoy@moebius.foiservices.com>
Also Sprach Tad McClellan <tadmc@metronet.com>:
>: get into my database server (getting it *into* the database is easy -- I'm
>: using PostgreSQL via Pg.pm--
>
> So if your _ultimate_ goal is to get it into your DB, and that
> is easy, then why are you posting?
I was seeking advice on whether the SGML parsing would be feasible --
something new and fun to use Perl for!
>
>: I have done lots of stuff with delimited files, so that's easy
>: enough to do.
>
> For "getting it into the DB" I would use the dollar-sign
> separated data (if I trusted the data).
:-\ It's from the government (FDA) -- it never comes in the same format
twice, from my experience. The SGML files look at the first attempt at
getting it standardized...
>: I just don't know how well parsing the SGML will make my
>: life easier,
>
> A discussion of "what's SGML good for" is off-topic in a
> Perl newsgroup. You should ask that question in:
>
> comp.text.sgml
Well, not really what is SGML good for, but rather, will using the
SGML::Parser module be more streamlined and consistent than having to hard
code a file format by hand? That was my question really.
>: since the data definition is built into the document
>: specification.
>
> I don't know what you mean by that.
>
> What do you mean by that? :-)
It seems to me that each 'column' is defined by SGML tags, and the record
structure as well, in a hierarchical fashion. (If it seems apparent I'm
rather dim about SGML, well, it's because I am).
>: Here's a sample of the SGML:
>[snip instance]
>
> That is not SGML.
>
> SGML *requires* a DTD.
>
> So what you have there is an SGML-looking fragment of something.
I looked at the ICH (E2b/M2 or something or other) standard that developed
this. Ugh. I'd rather try to teach myself ADA.
> The more complex the data, the more helpful it is to have a
> rigorous model for the data, along with an automated way to
> check that data actually conforms to the model.
'Kay. Guess I'll look into more info on SGML elsewhere. Of course, in
the time I'd spend trying to work that out, I could code the $ format and
have it all loaded. *sigh*
> Anyway, here is a crude SGML-pretty-printer that uses
> SGML::Parser to get you started:
Cool. Thanks for your suggestions.
--
Brett W. McCoy bmccoy@foiservices.com
Computer Operations Manager (Alpha Geek) http://www.foiservices.com
FOI Services, Inc./DIOGENES 301-975-0110
---------------------------------------------------------------------------
------------------------------
Date: Wed, 13 Oct 1999 13:32:20 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: SGML documentation
Message-Id: <4nf2u7.gn1.ln@magna.metronet.com>
Brett W. McCoy (bmccoy@foiservices.com) wrote:
: Also Sprach Tad McClellan <tadmc@metronet.com>:
: >: get into my database server (getting it *into* the database is easy -- I'm
: >: using PostgreSQL via Pg.pm--
: >
: > So if your _ultimate_ goal is to get it into your DB, and that
: > is easy, then why are you posting?
: I was seeking advice on whether the SGML parsing would be feasible --
Yes.
: something new and fun to use Perl for!
Yes. :-)
: >
: >: I have done lots of stuff with delimited files, so that's easy
: >: enough to do.
: >
: > For "getting it into the DB" I would use the dollar-sign
: > separated data (if I trusted the data).
: :-\ It's from the government (FDA) -- it never comes in the same format
: twice, from my experience.
I did government-related work for 16 years (Navy and DoD contractor).
I know what you're talking about :-(
: The SGML files look at the first attempt at
: getting it standardized...
I would tough it out to learn an SGML approach then.
It can find errors in the data for you.
And, since it is standard in your industry, you can expect to
have to learn it eventually anyway.
: >: I just don't know how well parsing the SGML will make my
: >: life easier,
: >
: > A discussion of "what's SGML good for" is off-topic in a
: > Perl newsgroup. You should ask that question in:
: >
: > comp.text.sgml
: Well, not really what is SGML good for, but rather, will using the
: SGML::Parser module be more streamlined and consistent than having to hard
: code a file format by hand? That was my question really.
I will not consider, or even discuss using a module that
is not -w clean.
So SGML::Parser does not exist in my world.
I think "using the SGML::Parser module" is Not A Good Idea.
So let me rephrase the question into something that exists
in my world
:-)
Is parsing SGML more streamlined and consistent than having
to hard code a file format by hand?
You have to hard code a file format by hand either way,
they are just _different_ file formats.
With SGML you have a rigorous definition of what the file
format _is_, so you only have to hard code it once. It
cannot change (without a corresponding change in the
model (DTD)).
character-separated formats tend to morph too easily
in ways that break code...
: >: since the data definition is built into the document
: >: specification.
: >
: > I don't know what you mean by that.
: >
: > What do you mean by that? :-)
: It seems to me that each 'column' is defined by SGML tags, and the record
^^^^^^^^^
: structure as well, in a hierarchical fashion.
I think you have made a terminology mistake that is both
disastrous and common to SGML neophytes.
[ "tags" are stuff between angle brackets.
"elements" are stuff between (and including) a start-tag
and an end-tag.
<messagetype>ICSR</messagetype> has 2 "tags" and 1 "element".
]
"Tags" are simply delimiters.
"elements" are the important concept.
Tags just show you the beginning and end of the element.
Talking about "tags" in SGML is kinda like talking about the
commas in a comma-separated-file.
It tends to be a very short discussion :-)
Talking about "elements" in SGML is like talking about "fields"
in a CSV file.
: (If it seems apparent I'm
: rather dim about SGML, well, it's because I am).
That's OK.
Actually, that is *wonderful*.
I would have no client base if there weren't folks who didn't
know about SGML.
(Ack! a triple-negative!)
:-) :-)
: >: Here's a sample of the SGML:
: >[snip instance]
: >
: > That is not SGML.
: >
: > SGML *requires* a DTD.
: >
: > So what you have there is an SGML-looking fragment of something.
: I looked at the ICH (E2b/M2 or something or other) standard that developed
: this. Ugh. I'd rather try to teach myself ADA.
Did you look at the standard, or at the DTD?
DTDs aren't all that hard to understand (though they tend to
be rather large for "industry standard" models).
They are roughly just a BNF grammar.
: > The more complex the data, the more helpful it is to have a
: > rigorous model for the data, along with an automated way to
: > check that data actually conforms to the model.
: 'Kay. Guess I'll look into more info on SGML elsewhere.
That would be:
http://www.oasis-open.org/cover/
Be prepared for information overload. There is a whole lot
of stuff there...
: Of course, in
: the time I'd spend trying to work that out, I could code the $ format and
: have it all loaded. *sigh*
As I already said, if *all* (which is what you implied by saying
"ultimate") you want to do is get it loaded into the DB, go
with the $-separated format.
(if this is a one-shot deal. If you expect to get on-going
deliveries that need to be loaded, then I would go with SGML
so I can get some automated sanity checking done for me
)
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: 13 Oct 1999 16:34:05 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: SGML documentation
Message-Id: <m11zayn8cy.fsf@halfdome.holdit.com>
>>>>> "Brett" == Brett W McCoy <bmccoy@news.i95.net> writes:
Brett> Is there any documentation for any of the SGML modules? The
Brett> ones I have installed, such SGML::Parser and SGML::DTD, seem to
Brett> have no documentation associated with them.
If it's narrow enough SGML to also fit XML, you can use the XML::*
tools for it. Those are actively supported, and sprouting wings, as
far as I can see.
print "Just another Perl hacker,"
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
------------------------------
Date: Thu, 14 Oct 1999 01:06:53 GMT
From: bmccoy@news.lan2wan.com (Brett W. McCoy)
Subject: Re: SGML documentation
Message-Id: <slrn80abbq.4hk.bmccoy@dragosani.lan2wan.com>
On Wed, 13 Oct 1999 13:32:20 -0400, Tad McClellan <tadmc@metronet.com> wrote:
>: > I don't know what you mean by that.
>: >
>: > What do you mean by that? :-)
>
>: It seems to me that each 'column' is defined by SGML tags, and the record
> ^^^^^^^^^
>: structure as well, in a hierarchical fashion.
>
> I think you have made a terminology mistake that is both
> disastrous and common to SGML neophytes.
Actually, the wrong word I used was 'defined' -- I should have said
'delimited'.
> "Tags" are simply delimiters.
>
> "elements" are the important concept.
>
> Tags just show you the beginning and end of the element.
That's what I meant to say, yeah, that's it...
>: I looked at the ICH (E2b/M2 or something or other) standard that developed
>: this. Ugh. I'd rather try to teach myself ADA.
>
>
> Did you look at the standard, or at the DTD?
>
> DTDs aren't all that hard to understand (though they tend to
> be rather large for "industry standard" models).
>
> They are roughly just a BNF grammar.
I didn't quite get far enough into it. to make that determination.
> As I already said, if *all* (which is what you implied by saying
> "ultimate") you want to do is get it loaded into the DB, go
> with the $-separated format.
>
> (if this is a one-shot deal. If you expect to get on-going
> deliveries that need to be loaded, then I would go with SGML
> so I can get some automated sanity checking done for me
> )
You hit the head right on the nail. It is data that will be regularly
coming in from NTIS (or maybe not -- they might be shutting down), and
this will ultimately be an 'installation program' that anyone can use, not
just me. That means, of course, it's also gonna have to be somewhat user
friendly -- a discussion for a different day. :-P
Thanks for your advice.
--
Brett W. McCoy
http://www.lan2wan.com/~bmccoy/
-----------------------------------------------------------------------
Dull women have immaculate homes.
------------------------------
Date: 14 Oct 1999 03:10:08 GMT
From: intbyte@aol.com (Max S.)
Subject: SIMPLE: counter question, SSI, please help
Message-Id: <19991013231008.01014.00001271@ng-cg1.aol.com>
Hey, I really need help, I just started fooling around with ready made scripts
a while ago...but I dont know cgi, actually I just ordered matt writtes book.
anyway, I was wondering if someone could give me a simple code I could learn
from that is a counter for a single page. Just a text counter, like a script
that just adds 1 to a number in a txt file and displays it on the page. Thanks
alot, if its not to much trouble reply to my e-mail address, intbyte@aol.com.
thanks
Max S.
intbyte@aol.com
http://realestateclosings.net/zd
------------------------------
Date: Thu, 14 Oct 1999 15:00:33 GMT
From: amonotod <amonotod@netscape.net>
Subject: Re: SIMPLE: counter question, SSI, please help
Message-Id: <7u4r69$n5q$1@nnrp1.deja.com>
intbyte@aol.com (Max S.) wrote:
> from that is a counter for a single page. Just a text counter, like a
> script
> that just adds 1 to a number in a txt file and displays it on the
> page. Thanks
http://www.geocities.com/amonotod/
> alot, if its not to much trouble reply to my e-mail address,
> intbyte@aol.com.
Noone else does this, so...
> thanks
Sure
HTH,
amonotod
--
`\|||/ amonotod@
(@@) netscape.net
ooO_(_)_Ooo________________________________
_____|_____|_____|_____|_____|_____|_____|_____|
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 14 Oct 1999 23:05:04 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: SIMPLE: counter question, SSI, please help
Message-Id: <slrn80d9uu.q8s.abigail@alexandra.delanet.com>
Max S. (intbyte@aol.com) wrote on MMCCXXXV September MCMXCIII in
<URL:news:19991013231008.01014.00001271@ng-cg1.aol.com>:
~~ Hey, I really need help, I just started fooling around with ready made scripts
~~ a while ago...but I dont know cgi, actually I just ordered matt writtes book.
~~ anyway, I was wondering if someone could give me a simple code I could learn
~~ from that is a counter for a single page. Just a text counter, like a script
~~ that just adds 1 to a number in a txt file and displays it on the page. Thank
I would do it like this:
#!/opt/perl/bin/perl -wT
# Nifty, high performace, thread-safe counter.
use strict;
lock ($,); # Make the thread safe!
my $counter = time; # Initialize with a high number.
# People don't care about the number anyway,
# and high numbers look better than 17 hits
# since the birth of Christ.
$counter ++; # It's a counter, so add something to it.
print $counter or die $counter, "\n";
# Print it, and if that fails, print it on
# STDERR, so we're sure the calling program
# gets is.
exit $counter; # Well, just to be sure.
__END__
Abigail
--
package Z;use overload'""'=>sub{$b++?Hacker:Another};
sub TIESCALAR{bless\my$y=>Z}sub FETCH{$a++?Perl:Just}
$,=$";my$x=tie+my$y=>Z;print$y,$x,$y,$x,"\n";#Abigail
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: Thu, 14 Oct 1999 11:11:29 -0700
From: Jon Shemitz <jon@midnightbeach.com>
Subject: Size Does Matter? [*not* porn spam!]
Message-Id: <38061CD1.F1D3B7C7@midnightbeach.com>
My 3rd ever Perl script spiders (my local copy of) my web site, using
HTML::Entities, and builds a hash by word of hashes by file names of
word locations, to use as a concordance. It then writes the concordance
in Perl source format to a file, for use in the search script I'll write
next. (PLEASE! I'm know I'm reinventing the wheel, here - it's an
exercise. Perl practice. Deal.)
When I write the concordance as:
%Concordance::Words = (
q(bridges) =>
{
q(Talk.mail.html) => [335],
},
q(features) =>
{
q(Talk.mail.html) => [799],
},
);
it's fine, up to the number of unique words in my limited sample. (My
first-pass concordance generator has nasty uniquewords * totalwords
runtime.) My question is that my first, perhaps rather stupid version of
the above was:
%Concordance::Words = (
q(bridges) =>
{
q(Talk.mail.html) => \ (335),
},
);
which only worked for some small number of keys in %Concordance::Words.
(That is, the parser complained about an odd number of terms in the hash
when I tried to parse the whole file, but was happy when I pruned it
radically.)
Why? I thought [335] and \ (335) were identical?
--
http://www.midnightbeach.com - Me, my work, my writing, and
http://www.midnightbeach.com/hs - my homeschool resource pages
------------------------------
Date: Thu, 14 Oct 1999 14:29:10 -0400
From: Jeff Pinyan <jeffp@crusoe.net>
Subject: Re: Size Does Matter? [*not* porn spam!]
Message-Id: <Pine.GSO.4.10.9910141426580.14462-100000@crusoe.crusoe.net>
[posted & mailed]
On Oct 14, Jon Shemitz blah blah blah:
> Why? I thought [335] and \ (335) were identical?
[1,2,3]
is not the same as
\(1,2,3)
\(1,2,3)
is the same as
(\1,\2,\3)
so if you say:
%foo = (
'bar' => [ 123 ],
'blat' => \ (123)
);
Then $foo{bar} is an array reference with one element, 123.
$foo{blat} is a reference to the constant number 123.
--
jeff pinyan japhy@pobox.com
perl stuff japhy+perl@pobox.com
CPAN ID: PINYAN http://www.perl.com/CPAN/authors/id/P/PI/PINYAN
------------------------------
Date: Thu, 14 Oct 1999 11:48:16 -0700
From: Jon Shemitz <jon@midnightbeach.com>
Subject: Re: Size Does Matter? [*not* porn spam!]
Message-Id: <38062570.385AE6B5@midnightbeach.com>
[posted & mailed]
Jeff Pinyan wrote:
> > Why? I thought [335] and \ (335) were identical?
>
> [1,2,3]
> is not the same as
> \(1,2,3)
>
> \(1,2,3)
> is the same as
> (\1,\2,\3)
Thank you. Armed with this, I went back and found that it's NOT the size
of the %Concordance::Words constant that matters, it's the presense of
anything but a single element in the \ (775,797) lists.
So, then {q(Talk.mail.html) => \ (775,797)} is actually something like
{q(Talk.mail.html), \ 775, \ 797), which is why I was getting messages
about an odd number of terms in my hash constant?
--
http://www.midnightbeach.com - Me, my work, my writing, and
http://www.midnightbeach.com/hs - my homeschool resource pages
------------------------------
Date: Wed, 13 Oct 1999 13:59:07 -0700
From: Dan Woods <dwoods@ucalgary.ca>
Subject: Re: Slideshow script
Message-Id: <7u2ogr$k6e@ds2.acs.ucalgary.ca>
> Hi, I want to make a script that displays text/images slideshow in
> netscape (text and images links come from database quary).
> How can I make Netscape(NS) show one page at a time of the slideshow.
> How can I clear the first page so I can write next page In netscape
Use a Java applet.
Thanks...Dan.
http://www.4loops.com
------------------------------
Date: Wed, 13 Oct 1999 16:09:21 -0700
From: "Daniel Ulrich" <shades__@mitec.net>
Subject: Re: Slideshow script
Message-Id: <3804f605_8@news.newsfeeds.com>
Use the Meta-Refresh tag.
Have Fun,
Daniel Ulrich
Dan Woods <dwoods@ucalgary.ca> wrote in message
news:7u2ogr$k6e@ds2.acs.ucalgary.ca...
> > Hi, I want to make a script that displays text/images slideshow in
> > netscape (text and images links come from database quary).
> > How can I make Netscape(NS) show one page at a time of the slideshow.
> > How can I clear the first page so I can write next page In netscape
>
> Use a Java applet.
>
> Thanks...Dan.
> http://www.4loops.com
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: Fri, 15 Oct 1999 08:31:39 GMT
From: jongunn@my-deja.com
Subject: Re: Slideshow script
Message-Id: <7u6opb$50q$1@nnrp1.deja.com>
In article <7u2ogr$k6e@ds2.acs.ucalgary.ca>,
Dan Woods <dwoods@ucalgary.ca> wrote:
> > Hi, I want to make a script that displays text/images slideshow in
> > netscape (text and images links come from database quary).
> > How can I make Netscape(NS) show one page at a time of the
slideshow.
> > How can I clear the first page so I can write next page In netscape
>
> Use a Java applet.
>
> Thanks...Dan.
> http://www.4loops.com
I can do it with perl:
#!/usr/local/bin/perl
use CGI qw/:push -nph/;
#use strict;
$| = 1;
print multipart_init(-boundary=>'----------------here we go!');
while (1) {
print multipart_start(-type=>'text/plain'),
"The current time is ",scalar(localtime),"\n",
multipart_end;
sleep(1);
}
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Fri, 15 Oct 1999 08:59:39 GMT
From: jongunn@my-deja.com
Subject: Re: Slideshow script
Message-Id: <7u6qdn$637$1@nnrp1.deja.com>
I got the following script from http://www.xnet.com/~efflandt/push.html
>#!/usr/local/bin/perl
> use CGI qw/:push -nph/;
> #use strict;
> $| = 1;
> print multipart_init(-boundary=>'----------------here we go!');
> while (1) {
> print multipart_start(-type=>'text/plain'),
> "The current time is ",scalar(localtime),"\n",
> multipart_end;
> sleep(1);
> }
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 13 Oct 1999 17:48:14 GMT
From: Ollie <reactive@my-deja.com>
Subject: Sorting values of hash
Message-Id: <7u2gkp$1vd$1@nnrp1.deja.com>
Hi everyone,
I am having a problem with something that probably has an easy answer. I
am creating stats from a server logfile. The hash consists of
filename->hitcount, very basic. What I can't figure out is how to
display the pairs in descending order (most hits first). If I figure
this out, then it'd be easy to limit it to the top 10, 25, whatever
files hit as well.
Thanks in advance!!
-Ollie
p.s. - cc your reply to me via email if possible, tha
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 13 Oct 1999 11:16:54 -0700
From: "Lauren Smith" <laurensmith@sprynet.com>
Subject: Re: Sorting values of hash
Message-Id: <7u2iat$spo$1@brokaw.wa.com>
Ollie wrote in message <7u2gkp$1vd$1@nnrp1.deja.com>...
>What I can't figure out is how to
>display the pairs in descending order (most hits first).
perlfaq4:"How do I sort a hash (optionally by value instead of key)?"
Lauren
------------------------------
Date: Wed, 13 Oct 1999 18:16:12 GMT
From: amonotod <amonotod@netscape.net>
Subject: Re: Sorting values of hash
Message-Id: <7u2i8u$3eo$1@nnrp1.deja.com>
In article <7u2gkp$1vd$1@nnrp1.deja.com>,
Ollie <reactive@my-deja.com> wrote:
> Hi everyone,
>
> I am having a problem with something that probably has an easy answer.
I
> am creating stats from a server logfile. The hash consists of
> filename->hitcount, very basic. What I can't figure out is how to
> display the pairs in descending order (most hits first). If I figure
> this out, then it'd be easy to limit it to the top 10, 25, whatever
> files hit as well.
>
> Thanks in advance!!
>
> -Ollie
>
> p.s. - cc your reply to me via email if possible, tha
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>
From perlfaq4(Data Manipulation)....
How do I sort a hash (optionally by value instead of key)?
Internally, hashes are stored in a way that prevents you from imposing
an order on key-value pairs. Instead,
you have to sort a list of the keys or values:
@keys = sort keys %hash; # sorted by key
@keys = sort {
$hash{$a} cmp $hash{$b}
} keys %hash; # and by value
Here we'll do a reverse numeric sort by value, and if two keys are
identical, sort by length of key, and if that
fails, by straight ASCII comparison of the keys (well, possibly modified
by your locale -- see perllocale).
@keys = sort {
$hash{$b} <=> $hash{$a}
||
length($b) <=> length($a)
||
$a cmp $b
} keys %hash;
HTH,
amonotod
--
`\|||/ amonotod@
(@@) netscape.net
ooO_(_)_Ooo________________________________
_____|_____|_____|_____|_____|_____|_____|_____|
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 13 Oct 1999 13:39:07 -0500
From: Tom Briles <sariq@texas.net>
Subject: Re: Sorting values of hash
Message-Id: <3804D1CB.B662E8D0@texas.net>
Ollie wrote:
>
> Hi everyone,
>
> I am having a problem with something that probably has an easy answer. I
> am creating stats from a server logfile. The hash consists of
> filename->hitcount, very basic. What I can't figure out is how to
> display the pairs in descending order (most hits first).
perlfaq4: How do I sort a hash (optionally by value instead of key)?
> p.s. - cc your reply to me via email if possible, tha
Nope. Post here, read here. That way, if I give you an incorrect
solution, you'll see the post that (hopefully) corrects it.
- Tom
------------------------------
Date: Wed, 13 Oct 1999 18:52:49 GMT
From: Ollie <reactive@my-deja.com>
Subject: Re: Sorting values of hash
Message-Id: <7u2kdp$574$1@nnrp1.deja.com>
In article <7u2i8u$3eo$1@nnrp1.deja.com>,
amonotod <amonotod@netscape.net> wrote:
> Here we'll do a reverse numeric sort by value, and if two keys are
> identical, sort by length of key, and if that
> fails, by straight ASCII comparison of the keys (well, possibly
modified
> by your locale -- see perllocale).
>
> @keys = sort {
> $hash{$b} <=> $hash{$a}
> ||
> length($b) <=> length($a)
> ||
> $a cmp $b
> } keys %hash;
Thanks, that does help a bit, but I forgot to mention one of the other
problems to this. Many times, the value is going to be the same across
multiple keys (many of the files get only 1 or 2 hits per day).
-Ollie
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 13 Oct 1999 15:56:46 -0500
From: Tom Briles <sariq@texas.net>
Subject: Re: Sorting values of hash
Message-Id: <3804F20E.C8DD1B13@texas.net>
Ollie wrote:
>
> In article <7u2i8u$3eo$1@nnrp1.deja.com>,
> amonotod <amonotod@netscape.net> wrote:
>
<perlfaq for sorting hashes quote snipped>
> Many times, the value is going to be the same across
> multiple keys (many of the files get only 1 or 2 hits per day).
So what?
The FAQ solution will still work. Did you bother to try it?
- Tom
------------------------------
Date: 13 Oct 1999 21:31:22 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Sorting values of hash
Message-Id: <7u2tna$e1$1@gellyfish.btinternet.com>
On Wed, 13 Oct 1999 18:52:49 GMT Ollie wrote:
> In article <7u2i8u$3eo$1@nnrp1.deja.com>,
> amonotod <amonotod@netscape.net> wrote:
>
<snip perlfaq4 solution>
>
> Thanks, that does help a bit, but I forgot to mention one of the other
> problems to this. Many times, the value is going to be the same across
> multiple keys (many of the files get only 1 or 2 hits per day).
>
The solutions from perlfaq4 demonstrate how to deal with situtations
where the values are the same - of course you may have to make up your
own mind as to what to do in these situations.
/J\
--
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: Wed, 13 Oct 1999 21:51:43 GMT
From: amonotod <amonotod@netscape.net>
Subject: Re: Sorting values of hash
Message-Id: <7u2ut9$d54$1@nnrp1.deja.com>
Tom Briles <sariq@texas.net> wrote:
> The FAQ solution will still work. Did you bother to try it?
> - Tom
That is what I was thinking, but I wasn't sure so I kept my mouth
shut... However, it would just give you several entries whose value is
the same, right? Such as:
index.html 4002
html\faq.html 3
html\help.html 3
images\box.gif 3
Something like that?
amonotod
--
`\|||/ amonotod@
(@@) netscape.net
ooO_(_)_Ooo________________________________
_____|_____|_____|_____|_____|_____|_____|_____|
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Thu, 14 Oct 1999 23:46:14 GMT
From: Ollie <reactive@my-deja.com>
Subject: Re: Sorting values of hash
Message-Id: <7u5q02$fc2$1@nnrp1.deja.com>
My apologies for being dense before. I implemented the suggested code
and it works beautifully. I wasn't aware of the perlfaq docs, but I am
now! Thanks to everyone (except that snippy guy ;) ).
-Ollie
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
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 V9 Issue 1078
**************************************