[28298] in Perl-Users-Digest
Perl-Users Digest, Issue: 9662 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Aug 29 14:06:08 2006
Date: Tue, 29 Aug 2006 11: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 Tue, 29 Aug 2006 Volume: 10 Number: 9662
Today's topics:
Re: [multi-posted] please helpme: Net-SNMP-5.2.0 module <rvtol+news@isolution.nl>
Re: A Sort Optimization Technique: decorate-sort-dedeco xhoster@gmail.com
Cache mechanism for method lookup <ferry.bolhar@chello.at>
Re: DBI Performance Issues <hjp-usenet2@hjp.at>
Re: How to sort a date array? anno4000@radom.zrz.tu-berlin.de
Re: How to sort a date array? <bik.mido@tiscalinet.it>
Re: How to sort a date array? <SaltyBall@Hell.com>
Re: How to sort a date array? <David.Squire@no.spam.from.here.au>
imagemagick very slow - is there anything better? <andy@earthsong.null.free-online.co.uk>
Re: imagemagick very slow - is there anything better? <andy@earthsong.null.free-online.co.uk>
Re: imagemagick very slow - is there anything better? <veatchla@yahoo.com>
Re: integrate() <rvtol+news@isolution.nl>
Re: integrate() <bik.mido@tiscalinet.it>
Re: integrate() <nospam-abuse@ilyaz.org>
Re: Missing zeros in permutation. A perl bug or somethi anno4000@radom.zrz.tu-berlin.de
Re: Missing zeros in permutation. A perl bug or somethi <klaus03@gmail.com>
Re: Multiple interpreters and data atomicity <dbasch@yahoo.com>
Re: Perl's GUI <joe@inwap.com>
please helpme: Net-SNMP-5.2.0 module <milaus@tuxmobile.it>
Re: Problem handling a Unicode file <rvtol+news@isolution.nl>
Re: Problem handling a Unicode file <hjp-usenet2@hjp.at>
Serving a website based on internet source address ? <skybuck2000@hotmail.com>
Re: Serving a website based on internet source address <glex_no-spam@qwest-spam-no.invalid>
Re: Working with Source Code to Insert Copyright Statem <sgordon@egenera.com>
Re: Working with Source Code to Insert Copyright Statem <sgordon@egenera.com>
Re: Working with Source Code to Insert Copyright Statem <rvtol+news@isolution.nl>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 29 Aug 2006 19:25:39 +0200
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: Re: [multi-posted] please helpme: Net-SNMP-5.2.0 module
Message-Id: <ed24bn.178.1@news.isolution.nl>
milaus schreef:
> this is my first post to this ng, sorry if my question appears stupid
> or misplaced.
Don't multi-post.
Improve the quality of the Subject, maybe:
Net-SNMP, community !~ public
Your script doesn't have "use warnings, use strict;".
Have you read the Posting Guidelines? They are posted here twice a week.
--
Affijn, Ruud
"Gewoon is een tijger."
------------------------------
Date: 29 Aug 2006 14:38:05 GMT
From: xhoster@gmail.com
Subject: Re: A Sort Optimization Technique: decorate-sort-dedecorate
Message-Id: <20060829103844.416$HQ@newsreader.com>
Joachim Durchholz <jo@durchholz.org> wrote:
> Jim Gibson schrieb:
> >
> > The problem addressed by what is know in Perl as the 'Schwartzian
> > Transform' is that the compare operation can be an expensive one,
> > regardless of the whether the comparison uses multiple keys. Since in
> > comparison sorts, the compare operation will be executed N(logN) times,
> > it is more efficient to pre-compute a set of keys, one for each object
> > to be sorted. That need be done only N times.
>
> Wikipedia says it's going from 2NlogN to N. If a sort is massively
> dominated by the comparison, that could give a speedup of up to 100%
> (approximately - dropping the logN factor is almost irrelevant, what
> counts is losing that factor of 2).
It seems to me that ln 1,000,000 is 13.8, and that 13.8 is quite a bit
greater than 2.
Cheers,
Xho
--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service $9.95/Month 30GB
------------------------------
Date: Tue, 29 Aug 2006 18:03:25 +0200
From: "Ferry Bolhar" <ferry.bolhar@chello.at>
Subject: Cache mechanism for method lookup
Message-Id: <8b386$44f4654e$54718838$10629@news.chello.at>
Hi,
I've heard that Perl uses a cache when looking up for methods,
so when a method is called again, there is no longer need to
look again into @ISA.
Is this true? If so, how is it implemented? And what will happen
when @ISA gets modified later?
Thanks for your answers & greetings,
Ferry
------------------------------
Date: Tue, 29 Aug 2006 19:59:44 +0200
From: "Peter J. Holzer" <hjp-usenet2@hjp.at>
Subject: Re: DBI Performance Issues
Message-Id: <slrnef904j.924.hjp-usenet2@yoyo.hjp.at>
On 2006-08-28 19:47, Chris H. <chris@thezengarden.net> wrote:
> On Mon, 28 Aug 2006 16:27:31 +0000, xhoster wrote:
>
>> You are not making the important distiction between throughput and latency.
>> Your Perl script sends the sql command, then waits to get a response.
>> While waiting, it does nothing--it doesn't use CPU and/or bandwidth by
>> "sending ahead on prospect" more update statements. So you are limited by
>> latency, not by throughput. With an insert, you can circumvent this by
>> using the MySQL-specific multiple row insert statement to add many rows per
>> network round-trip.
DBI also has an execute_array method, but I don't know if this is
implemented by DBD::MySQL. If it is, it can improve performance quite
dramatically - I've measured a factor 50 in an (admittedly very simple)
benchmark with Oracle.
> i understand the differences in the setup, but i dont see latency playing
> that much of a role in this issue. ping response from solaris to windows
> on the lan (live setup) is 2.73ms.
This seems very slow for a 100Mbit network. 0.27ms is more what I would
expect.
> ping response from my home machine to my colo box is 17.5ms. my issue
> is that the two setups perform the same in regards to how slow they
> are getting the information to the server. i can understand it being
> slower, that's a given, but what im having an issue with is that it
> takes just as long to update 10 records remotely as 1,000 locally...
ping localhost reports an rtt of 0.05 ms on my (rather old) laptop. I
assume your server is at least as fast. So the latency of your broadband
connection is at least 350 times longer than that of the loopback
interface. So I don't find it very surprising that a mostly
latency-bound job takes 71 times as long. Assuming there are four round
trips per insert (don't know why there should be so many) and an acual
processing time of 0.8 ms we would arrive almost exactly at your
measurements:
broadband: 4 * 17.5ms + 0.8ms = 70.8ms
loopback: 4 * 0.05ms + 0.8ms = 1.0ms
If this theory is correct you should expect
4 * 2.73ms + 0.8ms = 11.72ms
per insert (or about 85 inserts/second) over the LAN.
hp
--
_ | Peter J. Holzer | > Wieso sollte man etwas erfinden was nicht
|_|_) | Sysadmin WSR | > ist?
| | | hjp@hjp.at | Was sonst wäre der Sinn des Erfindens?
__/ | http://www.hjp.at/ | -- P. Einstein u. V. Gringmuth in desd
------------------------------
Date: 29 Aug 2006 13:24:04 GMT
From: anno4000@radom.zrz.tu-berlin.de
Subject: Re: How to sort a date array?
Message-Id: <4litfkF25cobU1@news.dfncis.de>
Tad McClellan <tadmc@augustmail.com> wrote in comp.lang.perl.misc:
> anno4000@radom.zrz.tu-berlin.de <anno4000@radom.zrz.tu-berlin.de> wrote:
>
> >> @array=(2006-01-03, 2006-03-24, 2005-01-06);
> >
> > That looks a bit like Perl but it isn't.
>
>
> Sure it is.
>
> Perl has a subtraction operator.
Yes, I noticed and cancelled the posting but it looks like it escaped.
Propagation delays on Usenet aren't what they used to be...
Anno
------------------------------
Date: 29 Aug 2006 18:21:05 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: How to sort a date array?
Message-Id: <b9q8f2dgda76avk6v7n8rve2uvinhvtfnv@4ax.com>
On 29 Aug 2006 14:01:23 +0200, Michele Dondi <bik.mido@tiscalinet.it>
wrote:
>>@array=(2006-01-03, 2006-03-24, 2005-01-06);
^^^^^^^^^^ ^^^^^^^^^^ ^^^^^^^^^^
^^^^^^^^^^ ^^^^^^^^^^ ^^^^^^^^^^
[snip]
>Which is the month? I suppose the last two digits, for otherwise it
Oops, I hadn't even noticed. Fortunately others did.
Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
.'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
------------------------------
Date: Wed, 30 Aug 2006 00:29:30 +0800
From: SaltyBall <SaltyBall@Hell.com>
Subject: Re: How to sort a date array?
Message-Id: <44f46b63$1@127.0.0.1>
Thanks all of you helpful guys, It is my fault not to paste the code
clearly, after reading your code, I finally learn that sort(@array) will
not change the array, we should assign it to another array just like
your code "@sorted=sort @array;".
I am a newbie and I am too foo to be stuck with this simple error for hours.
Thanks all of you again
anno4000@radom.zrz.tu-berlin.de wrote:
> SaltyBall <SaltyBall@Hell.com> wrote in comp.lang.perl.misc:
>> Hi All,
>>
>> Here we have a date array like this
>> @array=(2006-01-03, 2006-03-24, 2005-01-06);
>
> That looks a bit like Perl but it isn't. Please post Perl, it makes
> it easier for us to help you.
>
>> when I use
>> sort(@array)
>> it did not sort correctly, the month and date was not sort, I think it
>> is the "-" make the sort fail, what is the correct way to sort this array?
>
> Instead of just claiming it doesn't sort correctly you should have
> provided a script that *shows* what it does. Like this
>
> my @array=qw( 2006-01-03 2006-03-24 2005-01-06);
> my @sorted = sort @array;
> print "(@array) -> (@sorted)\n";
>
> It is annoying that we have to write the code to check your claim. You
> should have provided it.
>
> For me the above code prints
>
> (2006-01-03 2006-03-24 2005-01-06) -> (2005-01-06 2006-01-03 2006-03-24)
>
> which looks fine to me.
>
> Anno
------------------------------
Date: Tue, 29 Aug 2006 17:37:29 +0100
From: David Squire <David.Squire@no.spam.from.here.au>
Subject: Re: How to sort a date array?
Message-Id: <ed1qg9$qef$1@gemini.csx.cam.ac.uk>
SaltyBall wrote:
[top-posting corrected. Please don't do that]
> anno4000@radom.zrz.tu-berlin.de wrote:
>> SaltyBall <SaltyBall@Hell.com> wrote in comp.lang.perl.misc:
>>> Hi All,
>>>
>>> Here we have a date array like this
>>> @array=(2006-01-03, 2006-03-24, 2005-01-06);
>>
>> That looks a bit like Perl but it isn't. Please post Perl, it makes
>> it easier for us to help you.
>>
>>> when I use
>>> sort(@array)
>>> it did not sort correctly, the month and date was not sort, I think
>>> it is the "-" make the sort fail, what is the correct way to sort
>>> this array?
>>
>> Instead of just claiming it doesn't sort correctly you should have
>> provided a script that *shows* what it does. Like this
>>
>> my @array=qw( 2006-01-03 2006-03-24 2005-01-06);
>> my @sorted = sort @array;
>> print "(@array) -> (@sorted)\n";
>>
>> It is annoying that we have to write the code to check your claim. You
>> should have provided it.
> Thanks all of you helpful guys, It is my fault not to paste the code
> clearly,
You should read the posting guidelines for the group before posting
here. That would have told you about not top-posting too. The posting
guidelines are posted here twice weekly.
> after reading your code, I finally learn that sort(@array) will
> not change the array, we should assign it to another array just like
> your code "@sorted=sort @array;".
You should have learnt that from reading the documentation for "sort",
not by posting here.
perldoc -f sort
Ask perl to help you before asking here.
DS
------------------------------
Date: Tue, 29 Aug 2006 17:26:18 +0100
From: andy baxter <andy@earthsong.null.free-online.co.uk>
Subject: imagemagick very slow - is there anything better?
Message-Id: <pan.2006.08.29.16.26.16.950825@earthsong.null.free-online.co.uk>
hello,
I'm writing a short perl program to split up a map image into tiles at
various zoom levels so I can use it in a 'google maps' style javascript
applet. I'm using PerlMagick to do the image manipulation, and it is
running /very/ slowly. The original image is quite big (4143 x 4728
pixels), so I would expect it to take a while, but not 20 minutes +
before it even finishes loading the image.
Is this a recognised problem with imagemagick, and are there any other
(linux based) perl libraries I can use to do simple image manipulation?
All I need is to resize and crop the image into tiles, then save the tiles
as jpegs.
I've pasted the (not yet finished) program and its output below. I'm
running ubuntu linux, with perlmagick and libmagick installed.
#!/usr/bin/perl
#
# cut-map.pl - cut the map image into tiles at various zoom levels.
#
use Image::Magick;
my $mapFile="map.png";
my $mapOutDir=".";
my $mapOutRootName="map";
my $mapOutType=".jpg";
CutTile(1,0,0,0,0);
sub CutTile {
# cut out a tile from the image with:
# $zoom= zoom level (zoom ratio=1/2^$zoom);
# $x,$y,$w,$h = x coord, y coord, width, height.
my ($zoom,$x,$y,$w,$h) = @_;
my $ratio=1/(2^$zoom);
$image=Image::Magick->new();
print "Ready to make tile with zoom=$zoom\n";
print " reading image ${mapFile}...\n";
$err=$image->Read($mapfile);
warn "$err" if $err;
($imWidth,$imHeight)=$image->Get("width","height");
print " resizing...\n";
$err=$image->Resize(width=>$imWidth*$zoom,height=>$imHeight*$zoom);
warn "$err" if $err;
$outFile="$mapOutDir/${mapOutRootName}-${zoom}${mapOutType}";
print " writing ${outFile}...\n";
$err=$image->Write($outFile);
warn "$err" if $err;
print " done\n";
}
--- end of script ---
output is:
andy@monkey:/local/www/lofty.dyndns.info/pano/working$ ./cut-map.pl
Ready to make tile with zoom=1
reading image map.png...
--- end of output ---
After this, nothing happens for up to 20 minutes (I killed the program at
that point).
--
remove 'n-u-l-l' to email me.
------------------------------
Date: Tue, 29 Aug 2006 17:31:26 +0100
From: andy baxter <andy@earthsong.null.free-online.co.uk>
Subject: Re: imagemagick very slow - is there anything better?
Message-Id: <pan.2006.08.29.16.31.26.917856@earthsong.null.free-online.co.uk>
On Tue, 29 Aug 2006 17:26:18 +0100, andy baxter wrote:
> hello,
>
> I'm writing a short perl program to split up a map image into tiles at
> various zoom levels so I can use it in a 'google maps' style javascript
> applet. I'm using PerlMagick to do the image manipulation, and it is
> running /very/ slowly. The original image is quite big (4143 x 4728
> pixels), so I would expect it to take a while, but not 20 minutes +
> before it even finishes loading the image.
Sorry - I posted before I checked cpan. I'm going to have a go with imlib2
and see if that's any better.
cheers,
andy.
--
remove 'n-u-l-l' to email me.
------------------------------
Date: Tue, 29 Aug 2006 12:16:40 -0500
From: l v <veatchla@yahoo.com>
Subject: Re: imagemagick very slow - is there anything better?
Message-Id: <1156871117_11283@sp6iad.superfeed.net>
andy baxter wrote:
> hello,
>
> I'm writing a short perl program to split up a map image into tiles at
> various zoom levels so I can use it in a 'google maps' style javascript
> applet. I'm using PerlMagick to do the image manipulation, and it is
> running /very/ slowly. The original image is quite big (4143 x 4728
> pixels), so I would expect it to take a while, but not 20 minutes +
> before it even finishes loading the image.
>
> Is this a recognised problem with imagemagick, and are there any other
> (linux based) perl libraries I can use to do simple image manipulation?
> All I need is to resize and crop the image into tiles, then save the tiles
> as jpegs.
>
> I've pasted the (not yet finished) program and its output below. I'm
> running ubuntu linux, with perlmagick and libmagick installed.
>
> #!/usr/bin/perl
> #
> # cut-map.pl - cut the map image into tiles at various zoom levels.
> #
>
> use Image::Magick;
> my $mapFile="map.png";
> my $mapOutDir=".";
> my $mapOutRootName="map";
> my $mapOutType=".jpg";
>
> CutTile(1,0,0,0,0);
>
> sub CutTile {
> # cut out a tile from the image with:
> # $zoom= zoom level (zoom ratio=1/2^$zoom);
> # $x,$y,$w,$h = x coord, y coord, width, height.
> my ($zoom,$x,$y,$w,$h) = @_;
> my $ratio=1/(2^$zoom);
> $image=Image::Magick->new();
> print "Ready to make tile with zoom=$zoom\n";
> print " reading image ${mapFile}...\n";
> $err=$image->Read($mapfile);
should be $mapFile not $mapfile
> warn "$err" if $err;
> ($imWidth,$imHeight)=$image->Get("width","height");
> print " resizing...\n";
> $err=$image->Resize(width=>$imWidth*$zoom,height=>$imHeight*$zoom);
> warn "$err" if $err;
> $outFile="$mapOutDir/${mapOutRootName}-${zoom}${mapOutType}";
> print " writing ${outFile}...\n";
> $err=$image->Write($outFile);
> warn "$err" if $err;
> print " done\n";
> }
>
> --- end of script ---
>
> output is:
>
> andy@monkey:/local/www/lofty.dyndns.info/pano/working$ ./cut-map.pl
> Ready to make tile with zoom=1
> reading image map.png...
>
> --- end of output ---
>
> After this, nothing happens for up to 20 minutes (I killed the program at
> that point).
>
>
Add use strict; use warnings; to better see information to better debug.
I've found imagemagick to be very quick. Make the above typo change
and rerun. Post back if needed.
--
Len
------------------------------
Date: Tue, 29 Aug 2006 15:01:45 +0200
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: Re: integrate()
Message-Id: <ed1l43.d4.1@news.isolution.nl>
[symbolic integration]
This is also interesting:
http://maxima.sourceforge.net/ (Lisp)
http://symaxx.sourceforge.net/ (Perl)
--
Affijn, Ruud
"Gewoon is een tijger."
------------------------------
Date: 29 Aug 2006 18:17:51 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: integrate()
Message-Id: <81q8f2pf3r0outtev8pr4sjrvg6jrnirqh@4ax.com>
On Tue, 29 Aug 2006 15:01:45 +0200, "Dr.Ruud"
<rvtol+news@isolution.nl> wrote:
> http://maxima.sourceforge.net/ (Lisp)
> http://symaxx.sourceforge.net/ (Perl)
Maxima I did know about, but Symaxx/2, as a frontend to it, I didn't.
Cool! And good to know...
Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
.'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
------------------------------
Date: Tue, 29 Aug 2006 17:55:14 +0000 (UTC)
From: Ilya Zakharevich <nospam-abuse@ilyaz.org>
Subject: Re: integrate()
Message-Id: <ed1v22$91j$1@agate.berkeley.edu>
[A complimentary Cc of this posting was NOT [per weedlist] sent to
Dr.Ruud
<rvtol+news@isolution.nl>], who wrote in article <ed1j32.1d4.1@news.isolution.nl>:
> > There's a huge family of modules Math::Symbolic::*. I'm sure there
> > is something...
>
> I searched again (like on "integration" and on "integral")
> and found only
> Math::Integral::Romberg - scalar numerical integration
> but that is a different area. <g>
perl -MMath::Pari=:all -wle "$x = PARIvar q(x); print $p = ($x**7 - 1)/($x - 1); print intformal $p"
x^6+x^5+x^4+x^3+x^2+x+1
1/7*x^7+1/6*x^6+1/5*x^5+1/4*x^4+1/3*x^3+1/2*x^2+x
Hope this helps,
Ilya
P.S. This is with PARI 2.3.0; older version might have this function
named differently; check the docs.
------------------------------
Date: 29 Aug 2006 13:41:11 GMT
From: anno4000@radom.zrz.tu-berlin.de
Subject: Re: Missing zeros in permutation. A perl bug or something else?
Message-Id: <4liufnF25cobU2@news.dfncis.de>
David Squire <David.Squire@no.spam.from.here.au> wrote in comp.lang.perl.misc:
> StuPedaso wrote:
>
> >
> > Can anyone tell me why the permutations that should end in zero are
> > missing that zero?
> >
> [snip]
>
> > sub process {
> > my $item = shift;
> > $item =~ /(.*):(.*)/;
> >
> > if ( $2 ) {
>
> I haven't done any analysis of your algorithm, but my hunch is that the
> line above is the cuiprit. It will evaluate as false if $2 == '0'. Try
> replacing it with
>
> if (defined $2) {
It should probably look for empty matches, not undefined ones
(untested)
if ( length $2 ) {
Anno
------------------------------
Date: 29 Aug 2006 07:37:04 -0700
From: "Klaus" <klaus03@gmail.com>
Subject: Re: Missing zeros in permutation. A perl bug or something else?
Message-Id: <1156862224.107450.240670@m79g2000cwm.googlegroups.com>
StuPedaso wrote:
> sub process {
> my $item = shift;
> $item =~ /(.*):(.*)/;
This has probably nothing to do with your problem, but I noticed that
you did not check whether the above match succeeded.
I would write the match as follows:
$item =~ /(.*):(.*)/ or die
qq{Error matching \$item = "$item" =~ /(.*):(.*)/,\n}.
qq{both \$1 and \$2 are invalid (they could contain anything: }.
qq{undef, "", "\\000", who knows?),\nso they can not be used }.
qq{in any way from this point onwards};
> if ( $2 ) {
> extend( $1, $2 );
> }
> else {
> $complete{$1} = 1;
> }
------------------------------
Date: 29 Aug 2006 10:32:33 -0700
From: "Derek Basch" <dbasch@yahoo.com>
Subject: Re: Multiple interpreters and data atomicity
Message-Id: <1156872753.348348.113250@74g2000cwt.googlegroups.com>
> No, you didn't. We have no idea what this "Data Store/Telnet" is, nor
> how you use Perl to access it. In fact, there was no Perl code at all.
I thought this paragraph covered everything:
I have several servers that share a perl script on a network file
share. This script accesses a telnet server and gets/sets various
attributes.
Apparently not. I apologize. I realize now I should have given more
detail about what the Data Store is. I thought I had explained enough
but I am not perfect and make mistakes.
> I help all kinds of people--ones who ask meaningful questions. I have
> little patience of people who act stupid, whether they *feel* stupid or
> not.
What I don't understand is if someones slightly less than complete
question bugs you why even bother responding in a negative fashion? Why
not just say "You didn't expand upon xyz enough for me to answer your
question. Could you please restate your question with more detail on
xyz?". How does mocking me help anyone?
> How can you claim to that you gave details in a Perl group when you gave
> no Perl code?
I didn't think it was necessary to show something as basic as how to
write to a Telnet socket in perl. Apparently not. I apologize.
> That is because you are barking up the wrong tree. Atomicity is primarily
> a property of the "Data Store" server, not the Perl (or Java, or Python,
> or C++, or Lisp, or Small Talk, or Ruby, or ...) client which talks to it.
> I thought that claiming the equivalence of your original diagram to my
> re-arranged one would have made this obvious.
I realize this now that you and others have explained it to me. Every
ones explanations of the difference between files and processes was
very helpful and answered my question.
I suppose I could not find any information on multiple processes
accessing the same code block because it really was a "stupid"
question. However, I don't understand how I would have ever learned any
of this if I had never asked my "stupid" question?
I REALLY am sorry to have wasted every ones time and will do my best to
explain myself in fuller detail from now on. I apologize for being
short but I guess I get easily angered by people who mock others who
make simple mistakes. Thank you for taking the time to answer my
question. I will move my query to a socket or telnet mailing list.
------------------------------
Date: Tue, 29 Aug 2006 08:40:56 -0700
From: Joe Smith <joe@inwap.com>
Subject: Re: Perl's GUI
Message-Id: <EdSdnYP477az_WnZnZ2dnUVZ_oKdnZ2d@comcast.com>
zentara wrote:
> Why does making a textbox with a black background, (which is easier on
> the eyes), make things hard for the user?
There are "high contrast" themes to make things easier on the
eyes of those who need it. Selecting such a theme makes all
textboxes "easier on the eyes", not just one or two.
-Joe
------------------------------
Date: Tue, 29 Aug 2006 17:48:48 +0200
From: milaus <milaus@tuxmobile.it>
Subject: please helpme: Net-SNMP-5.2.0 module
Message-Id: <pan.2006.08.29.15.48.48.354920@tuxmobile.it>
Hi all,
this is my first post to this ng, sorry if my question appears stupid or
misplaced.
I'm writing a perl script to monitor some JBOSS variables via SNMP, but
I've a problem passing a community string different from 'public'.
I'll try to explain, this is my environment:
- hostname: wi064111
- on port 11112 a snmp-agent listens with community 'public'
- on port 11212 a snmp-agent listens with community 'q3lrcdjb'
By using a snmp-get (from another host) everything works:
[root@cst003 ~]# snmpget -c public -v 1 wi064111:11112 1.2.3.4.1.2
iso.2.3.4.1.2 = Gauge32: 88502720
[root@cst003 ~]#
[root@cst003 ~]# snmpget -c q3lrcdjb -v 1 wi064111:11212 1.2.3.4.1.2
iso.2.3.4.1.2 = Gauge32: 92236344
By using this perl script, I got the problem:
##############################################
# Script-begin
#
#!/usr/bin/perl
use Net::SNMP;
# requires a hostname a community string and a port as its arguments
($session,$error) = Net::SNMP->session(Hostname => $ARGV[0],
Community => $ARGV[1],
Port => $ARGV[2]);
die "session error: $error" unless ($session);
printf("Port: %s Community: %s Hostname: %s\n", $ARGV[2], $ARGV[1],$ARGV[0]);
$result = $session->get_request("1.2.3.4.1.2");
die "request error:".$session->error unless (defined $result);
$session->close; print "Free Memory: ".$result->{"1.2.3.4.1.2"}."\n";
#
# Script-end
###########################
This are the output with the two different community strings:
[root@wi064111 ~]# ./myscript.pl wi064111 public 11112
Port: 11112 Community: public Hostname: wi064111
Free Memory: 87953768
[root@wi064111 ~]# ./myscript.pl wi064111 q3lrcdjb 11212
Port: 11212 Community: q3lrcdjb Hostname: wi064111
request error: Bad incoming community [public] at ./aaa.pl line 18.
It sounds like $session->get_request method doesn't care about the
community string I've set.
Is it possbile that a perl module at version 5.2 contains such a bug or am
I doing some mistakes?
Thanks to everyone that just read the wole post :-)
Many thanks to everyone that can help me :-))
Ing. Marco Betti
RHCE RHEL4 id 804006512121056
------------------------------
Date: Tue, 29 Aug 2006 15:40:12 +0200
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: Re: Problem handling a Unicode file
Message-Id: <ed1n5f.1cc.1@news.isolution.nl>
MoshiachNow schreef:
> The only thing that got me a valid output file was:
>
> open (FILE, ">:raw:encoding(UTF16-LE)", "Araxi.reg") || die "Could not
> open Araxi.reg: $!";
> print FILE "\x{FEFF}";
That lay-out really hurts my eyes. Next time, quote something of the
article that you reply on, or provide a "> [short summary]".
#!/usr/bin/perl
use warnings ;
use strict ;
use charnames ':short' ;
my ($fni, $ei) = ('Araxi.reg' , ':encoding(utf16)') ;
my ($fno, $eo) = ('Araxi1.reg', ':raw:encoding(utf16le)') ;
open my $fhi, "<$ei", $fni or die "open '$fni': $!" ;
open my $fho, ">$eo", $fno or die "open '$fno': $!" ;
print $fho "\N{BOM}" ;
print $fho "test\n" ;
# ... etc.
Your ":raw" is a good solution.
I tried "binmode $fho" instead, but got a "Wide character print"
warning. So I put a "use utf8" near the top, but then the BOM was output
as utf8, it looks like $fho's IO-layer was ignored. A "binmode $fho,
':encoding(utf16le)'" might work too, but I am converted to ":raw" now,
thanks.
--
Affijn, Ruud
"Gewoon is een tijger."
------------------------------
Date: Tue, 29 Aug 2006 19:13:54 +0200
From: "Peter J. Holzer" <hjp-usenet2@hjp.at>
Subject: Re: Problem handling a Unicode file
Message-Id: <slrnef8tel.924.hjp-usenet2@yoyo.hjp.at>
On 2006-08-29 11:40, Dr.Ruud <rvtol+news@isolution.nl> wrote:
> MoshiachNow schreef:
>> all bytes are interchanged within the words
>
> That
^^^^
Could you quote what you mean by "that"? It makes the your posting a
bit hard to understand.
> is the UTF16-LE order,
Nope. The sequence MoshiachNow called "bad" is UTF16-BE.
[...]
> You'll also find an Encoding "Unicode big-endian" there, that is
> UTF16-BE. But why would you want the bytes in a different order than
> the default for the platform?
He doesn't. He wants UTF16-LE (what he labeled "good input file") but
gets UTF16-BE instead.
hp
--
_ | Peter J. Holzer | > Wieso sollte man etwas erfinden was nicht
|_|_) | Sysadmin WSR | > ist?
| | | hjp@hjp.at | Was sonst wäre der Sinn des Erfindens?
__/ | http://www.hjp.at/ | -- P. Einstein u. V. Gringmuth in desd
------------------------------
Date: 29 Aug 2006 10:03:59 -0700
From: "Skybuck" <skybuck2000@hotmail.com>
Subject: Serving a website based on internet source address ?
Message-Id: <1156871039.023168.220250@h48g2000cwc.googlegroups.com>
Hello,
Based on the source internet address a different version of the website
should be presented/served to the user/browser.
For example in pseudo code:
if SourceAddress = '143.3.5.1' then
begin
ShowBlueWebsite; // Load/Show BlueIndex.htm
end else
if SourceAddress = '124.5.15.7' then
begin
ShowRedWebsite; // LoadShow RedIndex.htm
end;
Is this possible with perl ? is there any source code available to do
this trick ?
Bye,
Skybuck.
------------------------------
Date: Tue, 29 Aug 2006 12:32:04 -0500
From: "J. Gleixner" <glex_no-spam@qwest-spam-no.invalid>
Subject: Re: Serving a website based on internet source address ?
Message-Id: <44f478fa$0$25775$815e3792@news.qwest.net>
Skybuck wrote:
> Hello,
>
> Based on the source internet address a different version of the website
>
> should be presented/served to the user/browser.
>
> For example in pseudo code:
>
> if SourceAddress = '143.3.5.1' then
> begin
> ShowBlueWebsite; // Load/Show BlueIndex.htm
> end else
> if SourceAddress = '124.5.15.7' then
> begin
> ShowRedWebsite; // LoadShow RedIndex.htm
> end;
>
> Is this possible with perl ? is there any source code available to do
> this trick ?
It seems like a simple 'redirect', which would take only a few lines of
code, in any language.
Probably better to do this from your Web server, or via JavaScript, and
you may discuss that in a newsgroup for whatever server you're running
or one for JavaScript.
With a CGI processing the request, you could send a "redirect" header,
which would redirect the browser to a different URL, however that would
mean that the page is being generated by a CGI in the first place. If
that's the case, and you're using perl, look for 'redirect' and
'remote_host' in:
perldoc CGI
Otherwise, read the documentation for your Web server and get help in a
more appropriate newsgroup.
------------------------------
Date: 29 Aug 2006 08:00:04 -0700
From: "Perlgirl" <sgordon@egenera.com>
Subject: Re: Working with Source Code to Insert Copyright Statements as a Header
Message-Id: <1156863604.319930.157430@m73g2000cwd.googlegroups.com>
Thank you, Paul. You've been most helpful . I admit to being a newbie
and any help of any kind is appreciated. Perlgirl.
Paul Lalli wrote:
> Perlgirl wrote:
> > I was wondering if you could give me a hand.
> >
> > Where could I go to find some samples of PERL code that do the
> > following:
>
> What John's rather obnoxious remark meant was that the language is
> spelled "Perl" and the interpreter is spelled "perl". There is no
> "PERL".
>
> > 1. inserts a particular copyright statement
> > 2. checks the existing copyrights and updates it to include the current
> > year if it's not included
> > Or if the copyright has the wrong date, the script gives an error.
> > 3. It has to process particular file types (I have that info); a
> > listing of files to process (I have that info too), and cannot process
> > binary files (have that info too)
> >
> > Any help you can give me would be appreciated. Many thanks.
> > SRGordon
>
> This isn't really the proper forum for your request. Generally, this
> newsgroup helps people in writing and debugging their own code, not
> finding other people's code.
>
> Now, if you want some help actually *writing* the program you've
> described, you're going to need to be a lot more clear. What do you
> mean by "inserting a copyright statement"? Inserting it where? Into a
> string? Into a file that's already opened? Into a file that is lying
> on the disk somewhere?
>
> What is meant by an "existing copyright"? Do you have a particular
> pattern that represents a copyright notice?
>
> I don't know for certain, but you might find Tie::File helpful. It's a
> standard module as of Perl 5.8. If you have that version, you can type
> `perldoc Tie::File` at the command line to read its documentation. If
> not, you can search for it at http://search.cpan.org
>
> I basically recommend: Opening each file you want to process, reading
> it line-by-line and using pattern-matching to determine if the
> copyright exists, using Tie::File to insert it where you want if it
> doesn't, and using a search-and-replace if an incorrect one is found.
>
> You should read:
> perldoc perlre
> perldoc -f open
> perldoc -f readline
>
> You should also read the Posting Guidelines that are posted to this
> newsgroup twice a week. Following them maximizes your chances of
> getting good help from this group.
>
> Paul Lalli
------------------------------
Date: 29 Aug 2006 08:12:04 -0700
From: "Perlgirl" <sgordon@egenera.com>
Subject: Re: Working with Source Code to Insert Copyright Statements as a Header
Message-Id: <1156864324.858175.164910@m79g2000cwm.googlegroups.com>
Paul Lalli wrote:
> Perlgirl wrote:
> > I was wondering if you could give me a hand.
> >
> > Where could I go to find some samples of PERL code that do the
> > following:
>
> What John's rather obnoxious remark meant was that the language is
> spelled "Perl" and the interpreter is spelled "perl". There is no
> "PERL".
>
> > 1. inserts a particular copyright statement
> > 2. checks the existing copyrights and updates it to include the current
> > year if it's not included
> > Or if the copyright has the wrong date, the script gives an error.
> > 3. It has to process particular file types (I have that info); a
> > listing of files to process (I have that info too), and cannot process
> > binary files (have that info too)
> >
> > Any help you can give me would be appreciated. Many thanks.
> > SRGordon
>
> This isn't really the proper forum for your request. Generally, this
> newsgroup helps people in writing and debugging their own code, not
> finding other people's code.
>
> Now, if you want some help actually *writing* the program you've
> described, you're going to need to be a lot more clear. What do you
> mean by "inserting a copyright statement"? Inserting it where? Into a
> string? Into a file that's already opened? Into a file that is lying
> on the disk somewhere?
Answer: Insertion of a copyright statement needs to only search through
all text_files
(*.c, .doc, .java, .xml, .pl, .sh. assembler_source, .txt .vbs .any
ascii english text, etc etc etc) at the top of the file, from a string:
"Copyright %Y CompanyName, Inc. All Rights Reserved." These files are
from the cvsroot vault, when a developer checks in his code. Think of
it as a ClearCase Trigger, but as a PERL wrapper for CVS. This string
also needs to be able to add to a current copyright date IF that date
is out of date, as
" Copyright 1999-2006 CompanyName, Inc All Right Reserved"; as well as
NOT change the existing date if the string already has "2006" in it.
Concurrently this string needs to be able to give an error if the
copyright has the wrong date (ex. 2007).
Any suggestions for this? Thanks so much. Perlgirl
>
> What is meant by an "existing copyright"? Do you have a particular
> pattern that represents a copyright notice?
>
> I don't know for certain, but you might find Tie::File helpful. It's a
> standard module as of Perl 5.8. If you have that version, you can type
> `perldoc Tie::File` at the command line to read its documentation. If
> not, you can search for it at http://search.cpan.org
>
> I basically recommend: Opening each file you want to process, reading
> it line-by-line and using pattern-matching to determine if the
> copyright exists, using Tie::File to insert it where you want if it
> doesn't, and using a search-and-replace if an incorrect one is found.
>
> You should read:
> perldoc perlre
> perldoc -f open
> perldoc -f readline
>
> You should also read the Posting Guidelines that are posted to this
> newsgroup twice a week. Following them maximizes your chances of
> getting good help from this group.
>
> Paul Lalli
------------------------------
Date: Tue, 29 Aug 2006 18:10:20 +0200
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: Re: Working with Source Code to Insert Copyright Statements as a Header
Message-Id: <ed20cj.1l4.1@news.isolution.nl>
Perlgirl schreef:
> Insertion of a copyright statement needs to only search
> through all text_files
> (*.c, .doc, .java, .xml, .pl, .sh. assembler_source, .txt .vbs .any
> ascii english text, etc etc etc) at the top of the file
This can not be done without breaking many of those files. At the top of
the file there is often specific information about how the file should
be handled. But even if you would insert it at line 2 or below, the file
would often no longer be useful as a .c/java/xml/pl/etc. file. Is that
not a problem?
--
Affijn, Ruud
"Gewoon is een tijger."
------------------------------
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 9662
***************************************