[23083] in Perl-Users-Digest
Perl-Users Digest, Issue: 5304 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Aug 1 11:06:11 2003
Date: Fri, 1 Aug 2003 08:05:11 -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 Fri, 1 Aug 2003 Volume: 10 Number: 5304
Today's topics:
"web" vs. "traditional" development (was Re: Web develo (Tad McClellan)
Re: "web" vs. "traditional" development (was Re: Web de <flavell@mail.cern.ch>
Re: Emacs support for DB? <REMOVEsdnCAPS@comcast.net>
Re: error validation question <cwilbur@mithril.chromatico.net>
Re: File+Data from Java to Perl & back again. (SOAP?) <jon@joncruz.org>
Re: how to construct a variable, variable name ? <noreply@gunnar.cc>
Re: how to construct a variable, variable name ? (Greg Bacon)
Re: how to construct a variable, variable name ? <jurgenex@hotmail.com>
ip address to netbios name <noemail@noemail.com>
Re: ISO-Latin and UTF8 <twhu@lucent.com>
Making a daemon <xaonon@hotpop.com>
Re: Making a daemon (Greg Bacon)
Re: Making a daemon <xaonon@hotpop.com>
Re: Need help with Symbol::delete_package <newspost@coppit.org>
Re: Need help with Symbol::delete_package <uri@stemsystems.com>
Pb $SIG{CHLD}=sub{wait()}; in Perl 5.8.0 <spp@monaco377.com>
Re: Pb $SIG{CHLD}=sub{wait()}; in Perl 5.8.0 <someone@somewhere.nl>
Re: Perl Project Logic Question <REMOVEsdnCAPS@comcast.net>
Re: PERL: ISO-Latin and UTF8 <flavell@mail.cern.ch>
Re: PERL: ISO-Latin and UTF8 (Villy Kruse)
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 1 Aug 2003 08:23:11 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: "web" vs. "traditional" development (was Re: Web development and Perl 6)
Message-Id: <slrnbikqdv.3ru.tadmc@magna.augustmail.com>
Gunnar Hjalmarsson <noreply@gunnar.cc> wrote:
> Randal L. Schwartz wrote:
>> Gunnar Hjalmarsson wrote:
>>> Charlton Wilbur wrote:
[ we lost a level of attribution somewhere here...]
>>>>> New web developers are turning to PHP.
>>>> Let them!
>>>>
>>>> It does me more benefit if the novice web users all use PHP
>>> Benefit for you? Maybe. Benefit for Perl? Personally I'm not
>>> convinced.
>>
>> What an amazingly web-centric view of the world! I know many
>> seasoned Perl programmers who have never written a CGI script in
>> their lives.
>
> Hmm.. That comment does require an explanation, Randal.
The OP seemed to be claiming that Perl 6 will fail if it is
not adopted by web developers.
Many others seem to be claiming that Perl 6 can succeed even if
it is not adopted by web developers.
With a web-centric view, then the possibility of such a failure
seems a reasonable view.
But if the preliminary assumption is wrong, then the conclusion
drawn is likely suspect.
Randal and others, are pointing out that they think the assumption
is wrong, hence so is the conclusion.
> CGI scripting is (almost) all I'm using Perl for. But that is
> irrelevant for this discussion.
But it is *not* irrelevant.
The topic has drifted to "web vs. traditional" development.
In "1984" fashion, we are a product of our conditioning, we "know"
only those things that are in *our* experience.
To compare two things we need experience with each of the things.
You know only web uses for Perl.
I know only non-web uses for Perl.
So what are we doing speaking up? :-) ( rhetorical question )
Coincidentally, during a break in the middle of this thread, I
was reading the August 2003 issue of CACM [1], and found an article
related to the distinctions being drawn here:
"A Mugwump's-Eye View of Web Work" pp21-23 [2]
There's an interesting debate raging around the software
world: Is Web development the same as traditional software
project development?
with a discussion of each of the two points of view, which can
be summarized with these two quotes (I leave it to you to figure
out which quote is which side :-)
the principles are the same, but the processes are different
we've seen all of this before
> Personally I believe that any program needs a big user base, and
> through the web, you reach a big audience.
Consideration of quantity withour regard to quality is a
risky approach to take.
> I smell snobbery.
Me too.
If Perl 6 doesn't give me what _I_ need for web development,
then it will fail.
I expect you meant the _other_ snobbery present in this thread,
given our opposite conditionings. :-)
> Isn't CGI scripts on the web _one_ important application field for
> Perl?
Cannot answer the question, as phrased.
Important to what?
Important to the folks that need to get their web app deployed? Yes.
Important to the success or failure of Perl 6? Perhaps, but there
seems to be a significant number here who'd say "No".
-----
I think what has caused this thread's size is the way the OP
presented his position.
We saw it as:
Perl 6 will fail if it doesn't do what "web developers" need.
which prompted followups pointing out that that segment is not
as large a proportion as the OP seems to think.
There would have been much less contention if he'd instead
said something like:
I really need this in my work, can Perl 6 be made to give it to me?
The Perl developers are very interested in helping Perl6ers
"get their work done". That is what Perl is, and always has been,
all about.
An appeal to that interest would have a much better chance of
leading to action rather than merely discussion.
I'm sure folks would _like_ for Perl 6 to be a reasonable choice
of language for CGI programming.
But there is an important distinction between "it would be nice"
and "it is essential".
[1] "Communications of the ACM"
[2] mugwump: A person who acts independently or remains neutral
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Fri, 1 Aug 2003 15:36:55 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: "web" vs. "traditional" development (was Re: Web development and Perl 6)
Message-Id: <Pine.LNX.4.53.0308011534282.31734@lxplus081.cern.ch>
On Fri, Aug 1, Tad McClellan inscribed on the eternal scroll:
> [2] mugwump: A person who acts independently or remains neutral
OT, but see http://www.worldwidewords.org/weirdwords/ww-mug1.htm
cheers
------------------------------
Date: Fri, 01 Aug 2003 05:29:57 -0500
From: "Eric J. Roode" <REMOVEsdnCAPS@comcast.net>
Subject: Re: Emacs support for DB?
Message-Id: <Xns93CA4226A73B7sdn.comcast@206.127.4.25>
-----BEGIN xxx SIGNED MESSAGE-----
Hash: SHA1
Irving Kimura <irving_kimura@lycos.com> wrote in news:bgbb6j$d4o$1
@reader1.panix.com:
>
>
> The manpage for perldebtut says that "the command line interface
> is tightly integrated with an emacs extension", but it doesn't say
> what this emacs extension is, or where to find it. The manpage
> for perldebug also alludes to DB/Emacs integration, but is equally
> vague on the details. Where can I find more information on using
> Emacs as an IDE for Perl?
Start with M-x perldb. It's been a while since I've used it, so I can't
help you much more than that, sorry... but perhaps that'll get you started.
- --
Eric
$_ = reverse sort qw p ekca lre Js reh ts
p, $/.r, map $_.$", qw e p h tona e; print
-----BEGIN xxx SIGNATURE-----
Version: PGPfreeware 7.0.3 for non-commercial use <http://www.pgp.com>
iQA/AwUBPypBL2PeouIeTNHoEQKLaQCcDcMulNtdzyWCE5GMsSps2hIIo9wAnjlw
Ql+7MdjXjCAMRUY4K6VjOAaJ
=r6cO
-----END PGP SIGNATURE-----
------------------------------
Date: Fri, 01 Aug 2003 14:25:59 GMT
From: Charlton Wilbur <cwilbur@mithril.chromatico.net>
Subject: Re: error validation question
Message-Id: <87r845tqa0.fsf@mithril.chromatico.net>
"David K. Wall" <usenet@dwall.fastmail.fm> writes:
> The web hosting company I use won't even *allow* the execution of a CGI
> program named formmail.pl even if it's not Matt's program.
The company I work for used to run formmail.pl, because a wannabe
webmaster had installed it and every time we attempted to remove it or
replace it, there was screaming, because they knew formmail.
That ended when we sent out a couple thousand penis enlargement spams
because of a hole in formmail. And there hasn't been any screaming
since.
Charlton
------------------------------
Date: Fri, 01 Aug 2003 07:08:05 -0700
From: "Jon A. Cruz" <jon@joncruz.org>
Subject: Re: File+Data from Java to Perl & back again. (SOAP?)
Message-Id: <3F2A7445.4070509@joncruz.org>
Tim M wrote:
> I'm not sure what the best method would be to enable this
> communication. I'm leaning towards SOAP, but I'm sceptical due to my
> need to send large files. Everywhere I've read suggests SOAP is too
> bulky to transfer files efficiently.
> I believe straight XML is in the same boat too.
>
> What do you think? Is SOAP still a possibility, or do I need some
> other solution? Maybe SOAP for parameters & FTP for the file transfer?
>
> All ideas and feedback is welcome!
Well, you should probably turn your question around:
What would you gain from using SOAP?
------------------------------
Date: Fri, 01 Aug 2003 12:06:41 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: how to construct a variable, variable name ?
Message-Id: <bgdecj$nfj04$1@ID-184292.news.uni-berlin.de>
Alex Johnson wrote:
> hi, i'm trying to call a variable where the variables name is
> constructed using text and the value of another variable,
Are you? As far as I can understand from your example code, you are
trying to call a variable whose _value_ is constructed using the
values of other variables.
> the kind of
> code that i'm trying to write would be something like this:
>
> #!/usr/bin/perl -w
>
> my $var1 = "three";
> my $total = 1;
>
> $var2 = '$var' . $total;
----------^----^
Those quote characters makes it print literally '$var'.
> print "$var2";
--------^-----^
Those quote characters are redundant.
> but rather than printing literally '$var1' i want it to print the
> contents of the variable $var1, so it should print 'three',
Maybe this is what you mean:
#!/usr/bin/perl -w
use strict;
my $var1 = 'three';
my $total = 1;
my $var2 = $var1 . $total;
print $var2;
That prints 'three1'.
You may want to read about quoting in Perl at
http://www.perldoc.com/perl5.8.0/pod/perlintro.html
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Fri, 01 Aug 2003 10:56:49 -0000
From: gbacon@hiwaay.net (Greg Bacon)
Subject: Re: how to construct a variable, variable name ?
Message-Id: <vikhrhi3e2829e@corp.supernews.com>
Rather than be an enabler, I'll encourage you to read "Why it's stupid
to `use a variable as a variable name'" and siblings:
http://perl.plover.com/varvarname.html
http://perl.plover.com/varvarname2.html
http://perl.plover.com/varvarname3.html
Greg
--
The free market punishes irresponsibility. Government rewards it.
-- Harry Browne
------------------------------
Date: Fri, 01 Aug 2003 14:14:10 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: how to construct a variable, variable name ?
Message-Id: <SAuWa.2817$td7.959@nwrddc01.gnilink.net>
Alex Johnson wrote:
> hi, i'm trying to call a variable where the variables name is
> constructed using text and the value of another variable,
This is known as 'symbolic references' and the FAQ describes why that is a
bad idea as well as what to do instead. Please see PerlFAQ7: "How can I use
a variable as a variable name?"
> the kind of
> code that i'm trying to write would be something like this:
>
> #!/usr/bin/perl -w
>
> my $var1 = "three";
> my $total = 1;
>
> $var2 = '$var' . $total;
However this looks more like you are trying to combine the _value_ of $var1
with $total and assign it to $var2. Just loose those quotes and it will
work.
> print "$var2";
Useless use of quotes here, too. Just get rid of them (although they are not
causing any harm here).
> but rather than printing literally '$var1' i want it to print the
> contents of the variable $var1, so it should print 'three', i couldn't
No, you are looking for symbolic references, indeed. Don't do that. If you
really want to know why please check Google. This topic comes up at least
once or twice every week.
jue
------------------------------
Date: Fri, 1 Aug 2003 17:13:53 +0300
From: "Mike" <noemail@noemail.com>
Subject: ip address to netbios name
Message-Id: <bgdsl8$jsu$1@nic.grnet.gr>
Greetings, I was wondering if it were possible to resolve an ip address to a
netbios name. The perl script would be running on a unix machine.
Any help would be appreciated.
Thanks,
Mike
------------------------------
Date: Fri, 1 Aug 2003 09:31:09 -0400
From: "Tulan W. Hu" <twhu@lucent.com>
Subject: Re: ISO-Latin and UTF8
Message-Id: <bgdq34$56b@netnews.proxy.lucent.com>
"Philip M. Gollucci" <pgollucci@ejpress.com> wrote in...
> If I retreived a stored value from a database (MSSQL/Oralce),
> Is there any way in PERL to determine if it was encoded using UTF8 or
ISO-LATIN.
> If so, how ?
You might want to try the newer Encode in Perl 5.8.1.
my $utf8_line = Encode::decode("Guess",$line);
HTH
------------------------------
Date: Fri, 01 Aug 2003 10:25:27 GMT
From: Xaonon <xaonon@hotpop.com>
Subject: Making a daemon
Message-Id: <slrnbikqhv.5ej.xaonon@xaonon.local>
I have a signature generation program that I want to have become a daemon
and write to a named pipe. Currently, the section of code responsible for
daemonizing it looks something like this:
if ( my $pid = fork ) { print "$0: forked to PID $pid\n"; exit; }
elsif( not defined $pid ) { die "$0: fork failed: $!\n"; }
else { setsid; }
So far it works, but there's always the possibility that it could be screwed
up by something I haven't considered. This is the first Perl program I've
written as a daemon and I want to make sure that I've done it correctly. Is
there anything more that I need to have it do?
The entire program is available for consideration at:
http://xaonon.dyndns.org/about/randsig.pl
Please let me know if I've done anything stupid, as well. Thanks.
--
Xaonon, EAC Chief of Mad Scientists and informal BAAWA, aa #1821, Kibo #: 1
Visit The Nexus Of All Coolness (i.e. my site) at http://xaonon.dyndns.org/
"How benevolent of you! We will always be free to be stupid." "Cherish
that freedom, young master; it is basic to all others." -- The Golden Age
------------------------------
Date: Fri, 01 Aug 2003 10:59:45 -0000
From: gbacon@hiwaay.net (Greg Bacon)
Subject: Re: Making a daemon
Message-Id: <viki11j2nmtje2@corp.supernews.com>
In article <slrnbikqhv.5ej.xaonon@xaonon.local>,
Xaonon <xaonon@hotpop.com> wrote:
: I have a signature generation program that I want to have become a daemon
: and write to a named pipe. [...]
The FAQ covers this: "How do I fork a daemon process?" in Section 8.
Greg, uses a random signature generator too
--
Ah, women. They make the highs higher and the lows more frequent.
-- Nietzsche
------------------------------
Date: Fri, 01 Aug 2003 12:38:16 GMT
From: Xaonon <xaonon@hotpop.com>
Subject: Re: Making a daemon
Message-Id: <slrnbil2b0.6m1.xaonon@xaonon.local>
Ned i bach <viki11j2nmtje2@corp.supernews.com>, Greg Bacon
<gbacon@hiwaay.net> teithant i thiw hin:
> In article <slrnbikqhv.5ej.xaonon@xaonon.local>,
> Xaonon <xaonon@hotpop.com> wrote:
>
> : I have a signature generation program that I want to have become a daemon
> : and write to a named pipe. [...]
>
> The FAQ covers this: "How do I fork a daemon process?" in Section 8.
Whoops, must've missed that one. Proc::Daemon does just what I want.
Thanks for the pointer.
--
Xaonon, EAC Chief of Mad Scientists and informal BAAWA, aa #1821, Kibo #: 1
Visit The Nexus Of All Coolness (i.e. my site) at http://xaonon.dyndns.org/
"I'm going to start walking around in my underwear from now on so that I
don't become a lesbian!" -- James "Kibo" Parry, in alt.religion.kibology
------------------------------
Date: Fri, 01 Aug 2003 13:51:40 GMT
From: David Coppit <newspost@coppit.org>
Subject: Re: Need help with Symbol::delete_package
Message-Id: <Pine.BSF.4.56.0308010943060.70003@www.provisio.net>
On Fri, 1 Aug 2003, Uri Guttman wrote:
> DC> Symbol::delete_package('Storable');
>
> i doubt that is needed in general. successful loading of the module will
> just overwrite the subs.
Okay, I guess I can disable warnings to prevent warnings about redefining
the subroutines.
require Storable;
delete $INC{'Storable.pm'};
{
local $^W = 0;
require Storable;
}
my $s2 = Storable::freeze([1,2,3]);
This works, but it still looks like Symbol::delete_package doesn't work
right (see below).
> DC> # Re-require package
> DC> require Storable;
>
> require checks the %INC hash if it was loaded already. it won't reload
> if it has. you have to delete the module from that hash to force a reload.
Oops! I had that in my original code but forgot it in the test case.
Anyway, I still get the error after adding it:
use Symbol;
require Storable;
Symbol::delete_package('Storable');
delete $INC{'Storable.pm'};
# Don't need to disable warnings because we cleared the namespace above.
require Storable;
my $s2 = Storable::freeze([1,2,3]);
> was i too mean to you? :)
No... Rather polite and helpful. It's been a while since I read c.l.p.m
regularly... I hope your question doesn't mean that it has gotten worse.
;)
David
------------------------------
Date: Fri, 01 Aug 2003 14:59:15 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Need help with Symbol::delete_package
Message-Id: <x73cglwhj1.fsf@mail.sysarch.com>
>>>>> "DC" == David Coppit <newspost@coppit.org> writes:
DC> On Fri, 1 Aug 2003, Uri Guttman wrote:
DC> This works, but it still looks like Symbol::delete_package doesn't work
DC> right (see below).
doesn't work is not a good report. what do you expect to happen? what
did you observe happening?
>> require checks the %INC hash if it was loaded already. it won't reload
>> if it has. you have to delete the module from that hash to force a reload.
DC> Oops! I had that in my original code but forgot it in the test case.
DC> Anyway, I still get the error after adding it:
what error?
DC> use Symbol;
DC> require Storable;
DC> Symbol::delete_package('Storable');
DC> delete $INC{'Storable.pm'};
DC> # Don't need to disable warnings because we cleared the namespace above.
DC> require Storable;
when i did this:
perl -e 'print map "$_ => $INC{$_}\n", keys %INC'
i get no output.
but this:
perl -MStorable -e 'print map "$_ => $INC{$_}\n", keys %INC'
prints
/usr/lib/perl5/5.8.0/i386-linux-thread-multi/auto/Storable/autosplit.ix => /usr/lib/perl5/5.8.0/i386-linux-thread-multi/auto/Storable/autosplit.ix
AutoLoader.pm => /usr/lib/perl5/5.8.0/AutoLoader.pm
Carp.pm => /usr/lib/perl5/5.8.0/Carp.pm
Config.pm => /usr/lib/perl5/5.8.0/i386-linux-thread-multi/Config.pm
DynaLoader.pm => /usr/lib/perl5/5.8.0/i386-linux-thread-multi/DynaLoader.pm
Exporter.pm => /usr/lib/perl5/5.8.0/Exporter.pm
Exporter/Heavy.pm => /usr/lib/perl5/5.8.0/Exporter/Heavy.pm
Fcntl.pm => /usr/lib/perl5/5.8.0/i386-linux-thread-multi/Fcntl.pm
Storable.pm => /usr/lib/perl5/5.8.0/i386-linux-thread-multi/Storable.pm
XSLoader.pm => /usr/lib/perl5/5.8.0/i386-linux-thread-multi/XSLoader.pm
strict.pm => /usr/lib/perl5/5.8.0/strict.pm
vars.pm => /usr/lib/perl5/5.8.0/vars.pm
warnings.pm => /usr/lib/perl5/5.8.0/warnings.pm
warnings/register.pm => /usr/lib/perl5/5.8.0/warnings/register.pm
which means that all those other modules are loaded by Storable and all
need to be deleted from %INC and/or the symbol table if you don't want
warnings. so disabling warnings locally seems like the best bet.
>> was i too mean to you? :)
DC> No... Rather polite and helpful. It's been a while since I read c.l.p.m
DC> regularly... I hope your question doesn't mean that it has gotten worse.
DC> ;)
i was referring to a recent twit who called us all mean when we told her
not to use matt wright's scripts. i was so hurt and pained by this that
i wanted to make sure you were taken care of in a kind and considerate
way. :)
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
------------------------------
Date: Fri, 01 Aug 2003 16:15:51 +0200
From: =?ISO-8859-15?Q?S=E9bastien?= Cottalorda <spp@monaco377.com>
Subject: Pb $SIG{CHLD}=sub{wait()}; in Perl 5.8.0
Message-Id: <3f2a7617$0$19516$626a54ce@news.free.fr>
Hi all,
Since I migrate a Perl Socket application from perl 5.6.0 to 5.8.0, I
encoutered problem with the $SIG{CHLD} interrupt.
Here is sample of my code (server side):
use IO::Socket;
my $port_recep=12345;
my ($server, $client);
my ($port,$iaddr);
my $server= IO::Socket::INET->new(LocalPort=> $port_recep,
Type=> SOCK_STREAM,
Reuse=>1,
Listen=>10)
or die "Couln\'t be a tcp server on $port_recep $@\n";
$SIG{CHLD} = sub { wait () };
while ($client=$server->accept()) {
$pid = fork ();
unless (defined($pid)) {
print "Impossible to fork : $!";
exit 1;
}
if ($pid == 0){
$port = $client->peerport();
$iaddr= $client->peerhost();
print "Connexion accepted from $iaddr on port $port\n";
# do the treatment ....
print "Son has finished\n";
close($client);
exit;
}
}
print "Father has finished. It\'s not normal\n";
close($server);
exit 0;
When a connexion cames, it was taken by the son, and the father dies just
after the son has finished his job.
If someone has a clue.
Thanks in advance.
Sébastien
------------------------------
Date: Fri, 1 Aug 2003 16:54:14 +0200
From: "Stefan" <someone@somewhere.nl>
Subject: Re: Pb $SIG{CHLD}=sub{wait()}; in Perl 5.8.0
Message-Id: <3f2a7e76$0$26128$e4fe514c@dreader7.news.xs4all.nl>
"Sébastien Cottalorda" <spp@monaco377.com> schreef in bericht
news:3f2a7617$0$19516$626a54ce@news.free.fr...
> Hi all,
>
> Since I migrate a Perl Socket application from perl 5.6.0 to 5.8.0, I
> encoutered problem with the $SIG{CHLD} interrupt.
>
> Here is sample of my code (server side):
/--- snip code ---/
> When a connexion cames, it was taken by the son, and the father dies just
> after the son has finished his job.
>
> If someone has a clue.
>
> Thanks in advance.
>
> Sébastien
It might be related to the fact the different versions of Perl handle calls
differently. Don't ask me about the underlaying details - try a
Google/Groups search on "Perl EINTR" and/or "Perl EINTR accept".
In your code, you don't really check the status of the accept() call. If you
do, you'll probably see that accept() return status-code 4 (EINTR). In my
experience, that never happens the 1st time a connection is accepted. That
may explain that the father dies after the son has completed.
Try adding some accept() status handling - this is a piece of code I use;
use Errno 'EINTR'; # or use a constant value of 4
ClientAccept: {
$client = $server->accept();
if ($! == EINTR) {
if ($client) {
print "Non-fatal Interrupted system call in accept()\n";
} else {
print "Interrupted system call - redo accept()\n";
redo ClientAccept;
}
}
# --- rest of your server-code
}
Good luck,
Stefan
------------------------------
Date: Fri, 01 Aug 2003 05:33:58 -0500
From: "Eric J. Roode" <REMOVEsdnCAPS@comcast.net>
Subject: Re: Perl Project Logic Question
Message-Id: <Xns93CA42D4F4649sdn.comcast@206.127.4.25>
-----BEGIN xxx SIGNED MESSAGE-----
Hash: SHA1
"Tyler Cruz" <tylercruz@hotmail.com> wrote in
news:2RbWa.569437$3C2.14646011@news3.calgary.shaw.ca:
> Now, a little problem. I will be updating the film once a week, so
> once they get it, I have to temporarily suspend them from guessing
> again, or they can just rack up free points. Thus, I was thinking of
> adding a new colomn in my table in MySQL for 'namethatflickcorrect'
> and it woudl have a Y or N. Y if they answered it correctly, and N if
> not. And the form would not let them guess again if they have a Y.
>
> I keep the movie name and name for the image filename in flatfile
> databases.
>
> Then when the administrator (me) adds a new movie, it would reset all
> the members' namethatflickcorrect' to N. (loading/bandwidth issues?).
> I'm not sure if I will archive the old Name that Flick answers/photos,
> as I think it may be too much programming (not worth
> it/overcomplicated)
>
> Anyhow, please let me know if my logic is correct, thanks.
That sounds like a lot of work, resetting the flags. And the timing has
to be right, and you may have data sync issues.
Instead, how about creating a 'last_flick_guessed' column, which would
contain the name of the flick the user most recently guessed correctly.
When processing a guess, the user's score would not be incremented if
last_flick_guessed is the same as the name of the current flick quiz.
- --
Eric
$_ = reverse sort qw p ekca lre Js reh ts
p, $/.r, map $_.$", qw e p h tona e; print
-----BEGIN xxx SIGNATURE-----
Version: PGPfreeware 7.0.3 for non-commercial use <http://www.pgp.com>
iQA/AwUBPypCIWPeouIeTNHoEQJXbACfYLpwlOnHOgr8BSBVzllq17Cq8EwAoMaQ
0St4+auSHxQe4+VHv7svALs/
=E/4W
-----END PGP SIGNATURE-----
------------------------------
Date: Fri, 1 Aug 2003 12:32:49 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: PERL: ISO-Latin and UTF8
Message-Id: <Pine.LNX.4.53.0308011219281.31734@lxplus081.cern.ch>
On Fri, Aug 1, Abigail inscribed on the eternal scroll:
> Philip M. Gollucci (pgollucci@ejpress.com) wrote on MMMDCXXII
> September MCMXCIII in
> <URL:news:75e6245d.0307312121.68a2f7b3@posting.google.com>: -: If I
> retreived a stored value from a database (MSSQL/Oralce), -: Is
> there any way in PERL to determine if it was encoded using UTF8 or
> ISO-LATIN.
I'm assuming that "ISO-LATIN" is meant to refer to iso-8859-1, which
is one of the codings of the ISO-Latin-1 character repertoire (others
being CP850 aka MS-DOS Latin1, and CP1047 aka EBCDIC Latin-1).
> Other than heuristics? No.
Technically correct, of course, and if in fact the extract contains
only us-ascii characters the two would be identical.
> But that has to do with UTF-8 encoding itself, and not much with
> Perl.
True enough.
> Problem is that valid UTF-8 could also be
> valid ISO-LATIN, and the other way around.
However, if the content is realistic text which contains some
W.European language, then the probability of iso-8859-1 accidentally
matching some valid utf-8 sequence is rather small, and the larger the
sample, the lower the probability. Unless, as I say, the data happens
to be entirely us-ascii.
> Now, sometimes what is valid ISO-LATIN can't be valid UTF-8, and
> some UTF-8 strings might contain octets in the range 0x80 - 0x9F
> which some might consider to be invalid ISO-LATIN. So, you might be
> lucky and have a string that's only valid in one encoding. But in
> general, you can't determine it.
Starting the data with a BOM would rate to make it self-determining,
as long as the iso-8859-1 data didn't ever start with x'EFBBBF':
however, I think it would be unusual to do that with individual
database entries.
> Not in Perl, not in any other language.
Indeed. But since the question came up anyway: the FAQs
http://www.unicode.org/unicode/faq/utf_bom.html#22 ff. have some
insights.
cheers
------------------------------
Date: 01 Aug 2003 11:10:17 GMT
From: vek@station02.ohout.pharmapartners.nl (Villy Kruse)
Subject: Re: PERL: ISO-Latin and UTF8
Message-Id: <slrnbikiko.479.vek@station02.ohout.pharmapartners.nl>
On 01 Aug 2003 09:04:13 GMT,
Abigail <abigail@abigail.nl> wrote:
>Philip M. Gollucci (pgollucci@ejpress.com) wrote on MMMDCXXII September
>MCMXCIII in <URL:news:75e6245d.0307312121.68a2f7b3@posting.google.com>:
>-: If I retreived a stored value from a database (MSSQL/Oralce),
>-: Is there any way in PERL to determine if it was encoded using UTF8 or ISO-LATIN.
>-: If so, how ?
>
>
>Other than heuristics? No. But that has to do with UTF-8 encoding
>itself, and not much with Perl. Problem is that valid UTF-8 could also be
>valid ISO-LATIN, and the other way around. Now, sometimes what is valid
>ISO-LATIN can't be valid UTF-8, and some UTF-8 strings might contain
>octets in the range 0x80 - 0x9F which some might consider to be invalid
>ISO-LATIN. So, you might be lucky and have a string that's only valid
>in one encoding. But in general, you can't determine it.
>
There are enough invalid byte combinations to determine with high
probability if a byte stream is utf-8 or not. For example after a
byte in the range 0xc0 to 0xff you must always find one or more bytes
in the range 0x80 to 0xbf. Such a sequence is not likely to occur in a
latin-1 text and even less likely to occur consistently. It is quite a
bit harder to guess between the now 10 variants of the latin character
sets defined by iso-8859.
Villy
------------------------------
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 5304
***************************************