[23038] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 5258 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jul 22 18:05:51 2003

Date: Tue, 22 Jul 2003 15: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, 22 Jul 2003     Volume: 10 Number: 5258

Today's topics:
        Adding color to print to console? <yoy@comcast.net>
    Re: Adding color to print to console? <bigj@kamelfreund.de>
    Re: Anyone using Perl to develop and deploy MS Windows  (remove the obvious)
    Re: Anyone using Perl to develop and deploy MS Windows  <wsegrave@mindspring.com>
        display client ip address on web page (Joe)
    Re: display client ip address on web page <me@home.com>
    Re: display client ip address on web page <todd@tdegruyl.com>
    Re: display client ip address on web page <me@home.com>
    Re: display client ip address on web page <dwilga-MUNGE@mtholyoke.edu>
    Re: Get file extention from path <his_ron@yahoo.com>
        getting name of class and/or parent class that object b <coo_t2-NO-LIKE-SPAM@yahoo.com>
    Re: how to convert all invalid UTF-8 sequences to numer <flavell@mail.cern.ch>
    Re: New to cig question <flavell@mail.cern.ch>
    Re: One Off Script <skuo@mtwhitney.nsc.com>
    Re: OT: You should really use the ISO date format (YYYY <noreply@gunnar.cc>
    Re: OT: You should really use the ISO date format (YYYY <noreply@gunnar.cc>
    Re: pass all cgi parameters to an exe (Tad McClellan)
    Re: perlcc makes it big <tassilo.parseval@rwth-aachen.de>
    Re: Please critique my 2nd Perl program (generates an a <spamblock@junkmail.com>
    Re: Q- Empirical usable upper limit on hash array numbe ctcgag@hotmail.com
    Re: s there a module to acess Micorsoft Access datafile <wsegrave@mindspring.com>
    Re: s there a module to acess Micorsoft Access datafile <wsegrave@mindspring.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Tue, 22 Jul 2003 14:29:45 -0500
From: Buteo Lagopus <yoy@comcast.net>
Subject: Adding color to print to console?
Message-Id: <Xns93C09D80354F2yoycomcastnet@206.127.4.25>


I have my lotto ticket checker "PERLotto.pl" that prints to the console 
winning hits for games but it has no "glitz." I thought, could I hilight 
the color of the matching numbers in the print statement?

Currently a print line looks like this:

01 02 03 04 05  06  --5b  Hit: 01 02 03 04 05 06

I'd like to know how to hilight/color/invert the numbers so I can get rid 
of the "Hit..." information.

Can this be done and can someone steer me to some examples? Will this 
then be OS specific?

Thanks,

All the best,

Andy
print "What can possibly go wrong... go wrong... go wrong..."


------------------------------

Date: Tue, 22 Jul 2003 17:30:05 +0200
From: "Janek Schleicher" <bigj@kamelfreund.de>
Subject: Re: Adding color to print to console?
Message-Id: <pan.2003.07.22.15.30.03.316666@kamelfreund.de>

Buteo Lagopus wrote at Tue, 22 Jul 2003 14:29:45 -0500:
> I'd like to know how to hilight/color/invert the numbers so I can get rid 
> of the "Hit..." information.
> 
> Can this be done and can someone steer me to some examples? Will this 
> then be OS specific?

It's specific to your output method (terminal, html, tk, ...)

If you work with an ANSI terminal, have a look to the CPAN module
Term::ANSIColor


Greetings,
Janek


------------------------------

Date: Tue, 22 Jul 2003 20:02:49 GMT
From: "--Rick" <no_trick@my-de(remove the obvious)ja.com>
Subject: Re: Anyone using Perl to develop and deploy MS Windows apps?
Message-Id: <JLgTa.67955$0v4.4521896@bgtnsc04-news.ops.worldnet.att.net>


"Stefan Fischerländer" <fischerlaender@gmx.de> wrote in message
news:ff9bee6c.0307211324.1a7e5437@posting.google.com...
| I'm looking for some experiences or even some guidance ...
|
 ...<some content removed>...
|
| After some googling, I found several tools which together seem to
form
| a complete development environment to build (simple) Windows
| applications:
|
| Perl "Compilers":
| http://tinyperl.sourceforge.net/
| http://search.cpan.org/author/AUTRIJUS/PAR-0.69/
| http://www.indigostar.com/perl2exe.htm
|
 ...<some content removed>...
|
| Does anyone here has any experiences with what I intend to do?
| Is Perl with any of the perl-to-exe "compilers" a reasonable
solution
| to create and deploy Windows applications?
|

I have experimented with perl2exe with some success and it was pretty
inexpensive at the time.

I recently installed the PAR module (PPM is only up to version 0.67).
The limited experience I have with it has been good.  The Tk program I
tested with worked fine.  I'm still learning about it, but I did have
to include perl58.dll with the program on the Windows machines that
did not have Perl installed.

The tinyperl stuff looks interesting, but I haven't made time to play
with it.

--Rick




------------------------------

Date: Tue, 22 Jul 2003 15:34:37 -0500
From: "William Alexander Segraves" <wsegrave@mindspring.com>
Subject: Re: Anyone using Perl to develop and deploy MS Windows apps?
Message-Id: <bfk78u$86f$1@slb3.atl.mindspring.net>

"Stefan Fischerländer" <fischerlaender@gmx.de> wrote in message
news:ff9bee6c.0307211324.1a7e5437@posting.google.com...
> I'm looking for some experiences or even some guidance ...
<snip>
> Perl "Compilers":
> http://tinyperl.sourceforge.net/
> http://search.cpan.org/author/AUTRIJUS/PAR-0.69/
> http://www.indigostar.com/perl2exe.htm
<snip>
> Does anyone here has any experiences with what I intend to do?
> Is Perl with any of the perl-to-exe "compilers" a reasonable solution
> to create and deploy Windows applications?

TinyPerl works fine for me. With TinyPerl, it is possible to fit a TinyWeb
webserver and a TinyPerl executable file (with the required directories and
support files, as well as Shortcuts for launching programs), together with a
fillable Adobe Acrobat PDF form, all on a single 3.5 inch floppy. This has
also been done, with all of the files on a CompactFlash memory card.

I expect this could also be done with USB-type CompactFlash devices. It
should also be doable with CD-ROM (provided you put the tmp files and logs
on the host computer).

With bootable media, you should be able to set up a system that requires no
user installation at all.

Cheers.

Bill Segraves






------------------------------

Date: 22 Jul 2003 12:30:04 -0700
From: joe_stevensen@yahoo.com (Joe)
Subject: display client ip address on web page
Message-Id: <a911e5d5.0307221130.11f88871@posting.google.com>

I need help writing a script that will display a web client's ip
address on my web page.

I am running apache on linux. I have perl installed.


------------------------------

Date: Tue, 22 Jul 2003 16:03:41 -0700
From: Steve in NY <me@home.com>
Subject: Re: display client ip address on web page
Message-Id: <4igrhv87ki2v7shemql6bgdugi4skc5s7r@4ax.com>

On 22 Jul 2003 12:30:04 -0700, joe_stevensen@yahoo.com (Joe) wrote:

>I need help writing a script that will display a web client's ip
>address on my web page.
>
>I am running apache on linux. I have perl installed.

#!/usr/local/bin/perl
print "Content-type: text/plain","\n\n";

$remote_host = $ENV{'REMOTE_HOST'};
print "You are visiting from ", $remote_host, ". ";

I just copied and pasted the above from here:

http://www.oreilly.com/openbook/cgi/ch01_06.html

you can add any tags, like this:

print "<html><body>Hi there</body></html>";


------------------------------

Date: Tue, 22 Jul 2003 20:14:49 GMT
From: "Todd de Gruyl" <todd@tdegruyl.com>
Subject: Re: display client ip address on web page
Message-Id: <pan.2003.07.22.20.14.18.248493@tdegruyl.com>

On Tue, 22 Jul 2003 16:03:41 -0700, Steve in NY wrote:

> print "Content-type: text/plain","\n\n";
 ... 
> print "<html><body>Hi there</body></html>";

of course, if you want that to display as html, change the content-type to
text/html, instead of text/plain

-- 
Todd de Gruyl




------------------------------

Date: Tue, 22 Jul 2003 16:25:37 -0700
From: Steve in NY <me@home.com>
Subject: Re: display client ip address on web page
Message-Id: <kuhrhvo55c6mg0gu8623d2t8gl6unraj9e@4ax.com>

That will teach me to post before thinking...thanks Todd ;-)

On Tue, 22 Jul 2003 20:14:49 GMT, "Todd de Gruyl" <todd@tdegruyl.com> wrote:

>On Tue, 22 Jul 2003 16:03:41 -0700, Steve in NY wrote:
>
>> print "Content-type: text/plain","\n\n";
>... 
>> print "<html><body>Hi there</body></html>";
>
>of course, if you want that to display as html, change the content-type to
>text/html, instead of text/plain



------------------------------

Date: Tue, 22 Jul 2003 20:33:00 GMT
From: Dan Wilga <dwilga-MUNGE@mtholyoke.edu>
Subject: Re: display client ip address on web page
Message-Id: <dwilga-MUNGE-5B6070.16325922072003@nap.mtholyoke.edu>

In article <a911e5d5.0307221130.11f88871@posting.google.com>,
 joe_stevensen@yahoo.com (Joe) wrote:

> I need help writing a script that will display a web client's ip
> address on my web page.
> 
> I am running apache on linux. I have perl installed.

It doesn't even have to be a Perl script, if you have your HTML pages 
set up as server parsed (for server side includes). Just include this 
code:

<!--#echo var="REMOTE_ADDR"-->

See:  http://httpd.apache.org/docs/howto/ssi.html  for more info.

(Sorry for the off-topic answer, but in this case it's justified, IMHO, 
since the easiest answer is not to use Perl.)

-- 
Dan Wilga          dwilga-MUNGE@mtholyoke.edu
** Remove the -MUNGE in my address to reply **


------------------------------

Date: Tue, 22 Jul 2003 19:22:05 GMT
From: "Ron" <his_ron@yahoo.com>
Subject: Re: Get file extention from path
Message-Id: <x9gTa.99074$xg5.42068@twister.austin.rr.com>

"Shawn Corey" <shawn@magma.ca> wrote in message
news:fNucnRuHxqoZy4CiXTWJkg@magma.ca...
> Hi,
>
> perldoc File::Basename
>
> Read about fileparse.
>
> Ron wrote:
>
> > I need to get the file extension from a path(file location+file
> > name+extension)
> >
> > This code get's me to the file name + extension.
> >
> > My beginner question is.  How do I get just the extension?
> >
> >  my $filename1 = $FILE1;
> >       $filename1 =~ s/^.*(\\|\/)//;
> >              $filename1 =~ s/ +/\_/g;
> >
> > Thanks,
> > Ron
> >

Thanks I read the doc.  I hate to ask for more help but here goes.
From the doc I got;
Similarly, using VMS syntax:

($name,$dir,$type) = fileparse('Doc_Root:[Help]Rhetoric.Rnh',
				   '\..*');





When I run this code I get a server error?
I am trying to get the file extention from $FILE1.


fileparse($FILE1 ,'\..*');
My $MyExt1 eq $type

Any Suggestions or code I might use?

Thanks,
Ron






------------------------------

Date: Tue, 22 Jul 2003 21:42:29 GMT
From: ed <coo_t2-NO-LIKE-SPAM@yahoo.com>
Subject: getting name of class and/or parent class that object belongs to
Message-Id: <mkbrhv4an8baociturcdsjbqi58rn2784q@4ax.com>


Hey all.  I'd like to convert some PHP code to Perl, but I'm not sure
how 
to do it in Perl.
The PHP method takes an argument which might be an error object.

I have to figure the following about the argument:
1. If it's an object
2. If it's of class "apperror"
3. Alternatively if it's a subclass of "apperror"


The only part of the code below I know how to convert is the:
get_class($e)=='apperror'

In Perl I'd do:
(ref $e)=='apperror'  

Right?

I'm not sure how to check the other two conditions though.
1. Is $e an object?
   Although I don't see why I have to check this, if I can check the
other 
   two conditions I think this one becomes irrelevant.
2. Is $e an object that is derived from "apperror" ?


Here's the PHP code, it should be self explanatory.


function is_error($e){
    return
(bool)(is_object($e)&&(get_class($e)=='apperror'||is_subclass_of($e,'apperror')));
}


tia,
--ed


------------------------------

Date: Tue, 22 Jul 2003 19:43:35 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: how to convert all invalid UTF-8 sequences to numeric equivalent?
Message-Id: <Pine.LNX.4.53.0307221927270.16492@lxplus081.cern.ch>

On Mon, Jul 21, Shambo inscribed on the eternal scroll:

[various stuff about "letting Perl" decide on the input coding]

> One caveat, the above method converts the Euro symbol to &#128;.

This is a definite danger signal!

My hunch is that your input is coded in Windows-1252

My further hunch is that if you would tell Perl (5.8+) that your
input is coded in windows-1252 (i.e via the :encoding thingy on
open or binmode) then you'd find your Euro character turning up as
its proper Unicode self in the program.  And the same for any other
of the displayable characters in the range 128-159 decimal inclusive
in Windows-1252; but without seeing some of your input data in real
life, it's still as hard to advise as it's been from the start.

Basically, when you have text represented as a bunch of bytes, you
can't just throw it at an arbitrary piece of software (not even Perl
;-) and hope for it to make sense.  You really _do_ need to know what
encoding is in use, and tell the software about it.  There are some
relatively unusual exceptions to this general rule[1], but by and
large I do stand by my advice.

good luck

[1] In their respective ways, ISO-2022 and Unicode have ways of making
a data stream identify its encoding internally.  ISO-2022 never got
widely used, although it's used in some specific contexts (Korean,
Japanese...).  Unicode has an optional feature, the "Byte Order Mark"
(BOM) for having an encoding of Unicode to be self-identifying.  But
I'd rate these as exceptions which "prove" the general rule.


------------------------------

Date: Tue, 22 Jul 2003 20:40:50 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: New to cig question
Message-Id: <Pine.LNX.4.53.0307222037340.29981@lxplus081.cern.ch>

On Mon, Jul 21, Ron inscribed on the eternal scroll:

And top-posting with fullquotes.

> Could anyone let me know what I am doing wrong?

Failing to take care about your Subject: headers, for one thing

See for example
http://www.catb.org/~esr/faqs/smart-questions.html#bespecific



------------------------------

Date: Tue, 22 Jul 2003 14:41:54 -0700
From: Steven Kuo <skuo@mtwhitney.nsc.com>
Subject: Re: One Off Script
Message-Id: <Pine.GSO.4.21.0307221434360.12779-100000@mtwhitney.nsc.com>

On 22 Jul 2003, JP Ogden wrote:


> tadmc@augustmail.com (Tad McClellan) wrote in message news:<slrnbhovrd.esp.tadmc@magna.augustmail.com>...

> > JP Ogden <jp@in3corp.com> wrote:
> > 
> > > [(snipped]
> > > 
> > > I would like to isolate only the records where the records in "Field
> > > 1" are "one-off."  The results from the above sample would look like


[ snipped ]

> > 
> > You mean one character shorter, by either taking the first or
> > the last character off?
> > 
> > Or should  123  and  12X3  be "one off" too?
> > 


[ snipped and rearranged ]


> The characters in "Field 1" could be the same number -
> 
> Like 1234 and 1235
> 
> Or 234- and 334-
> 
> The characters in "Field 1" could be as Jeff put them -
> 
> abc1def and abc2def
> 
> Or 045D/123 and 055D/123
> 
> The characters in "Field 1" could also be as Tad put them -
> 
> 123 and 12X3
> 
> Or add-34 and add34
> 
> The list goes on...
> 
> 



Here's a subroutine to get you started -- I presume you don't
use wide-characters in fields:


if (off_by_one("add-34", "add34")) {
    print "Off by one\n";
}


sub off_by_one {
    # returns undef, 0, or 1
    # the latter indicates that the two arguments are "off-by-1"
    my ($length1,$length2) = map length, my ($field1, $field2) = @_;
    return if (abs($length1 - $length2) > 1);
    if ($length1 == $length2) {
	my $difference = grep $_ != 0 => unpack 'C*', $field1 ^ $field2;
	return ($difference == 1)? 1 : 0;
    } else {
	my @chars1 = unpack 'C*' => $field1;
	my @chars2 = unpack 'C*' => $field2;
	my $i = 0;
	while (defined  $chars1[$i]
	    and defined $chars2[$i]
	    and $chars1[$i] == $chars2[$i]) {  # compare unsigned int
	    ++$i;
	}
	substr(($length1 > $length2)? $field1 : $field2, $i, 1, '');
	return ($field1 eq $field2)? 1 : 0;
    }
}

P.S.  Please do not top-post.

-- 
Hope this helps,
Steven



------------------------------

Date: Tue, 22 Jul 2003 22:35:23 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: OT: You should really use the ISO date format (YYYY-MM-DD)
Message-Id: <bfk7tf$fdl2h$1@ID-184292.news.uni-berlin.de>

Julian Mehnle wrote:
> On an off-topic note:  you should really use the internationally 
> standardized ISO date format[1], which is YYYY-MM-DD.  Most other
> date formats, like MM-DD-YY, are either confusing or ambiguous, or
> both.
> 
> Even if you can't use the ISO format in your application
> immediately, you should plan using it in the future and advocate it
> towards friends, colleagues, and bosses. ;-)
> 
> [1] http://www.cl.cam.ac.uk/~mgk25/iso-time.html

That comment made me reconsider the way I have been dealing with dates 
in an internationalized program I'm maintaining. I concluded that 
there is no need to struggle with 'Jan' or 'January' etc., creating a 
need to translate the months.

I was able to reduce my need to three types of time representations:
1) A pure time stamp
2) Today's date
3) The date X days ago

So I wrote this code:

   our $time = time;

   sub timestamp	{
     my $fmt = (shift or '');
     my $days = (shift or 0);
     my @t = (gmtime($time - $days * 86400))[0..5];
     return (sprintf "%d-%02d-%02d", $t[5] += 1900, ++$t[4], $t[3])
     . ($fmt eq 'date' ? '' : sprintf "T%02d-%02d-%02dZ", @t[2,1,0]);
   }

   timestamp()           returns  2003-07-22T20-28-04Z
   timestamp('date')     returns  2003-07-22
   timestamp('date', 5)  returns  2003-07-17

That's all. Thanks for making me think, Julian. :)

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl



------------------------------

Date: Tue, 22 Jul 2003 22:49:03 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: OT: You should really use the ISO date format (YYYY-MM-DD)
Message-Id: <bfk8nb$fv3qp$1@ID-184292.news.uni-berlin.de>

Correction!!

Gunnar Hjalmarsson wrote:
>   sub timestamp    {
>     my $fmt = (shift or '');
>     my $days = (shift or 0);
>     my @t = (gmtime($time - $days * 86400))[0..5];
>     return (sprintf "%d-%02d-%02d", $t[5] += 1900, ++$t[4], $t[3])
>     . ($fmt eq 'date' ? '' : sprintf "T%02d-%02d-%02dZ", @t[2,1,0]);
---------------------------------------------^----^
>   }
> 
>   timestamp()           returns  2003-07-22T20-28-04Z
------------------------------------------------^--^

Should of course be colons.

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl



------------------------------

Date: Tue, 22 Jul 2003 15:51:47 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: pass all cgi parameters to an exe
Message-Id: <slrnbhr8v2.1lg.tadmc@magna.augustmail.com>

D <d@d.com> wrote:
> i want to pass all cgi parameters to an exe (cgi app) and run the executable
> and capture all of its output.


I think you are saying that you want to run a program (webapp.exe)
that was designed to run in the CGI environment from the command
line instead?

Why must you do that?

Why not access the designed-for-CGI program in the environment
it expects?


> i want to
> impersonate what IIS would have passed if i did something like
> http://site/scripts/webapp.exe


If you want to _impersonate_ what the web server does, then you'll
need to setup the input to webapp.exe whereever it expects it.

That is, you'll need to setup an env var or stdin depending on
whether it is a GET or POST request.


A much better solution would be to have the *real web server*
do it's thing. You can invoke webapp.exe via a web server if
you make the request using one of the LWP modules.


See the Perl FAQ:

   How do I fetch an HTML file?

   How do I automate an HTML form submission?


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


------------------------------

Date: 22 Jul 2003 20:03:05 GMT
From: "Tassilo v. Parseval" <tassilo.parseval@rwth-aachen.de>
Subject: Re: perlcc makes it big
Message-Id: <bfk59p$n9f$1@nets3.rz.RWTH-Aachen.DE>

Also sprach Matt H:

> In article <3F1C2B57.44D98CA9@ass.wipe.com>, butt-fuzz wrote:
>> I'm running perl 5.8.0 on linux.
>> 
>> I wrote a very simple program:
>> #!/usr/bin/perl
>> print "test";
>> 
>> that's it!
>> and ran perlcc.
>> it gave me an a.out 1MB in size!
>> yikes!
> 
> That's odd, I just ran perlcc on the same program and ended up with
> 37K (after stripping).

That would surprise me:
ethan@ethan:~$ perlcc -e 'print "hello world"'
ethan@ethan:~$ l a.out
-rwxr-xr-x    1 ethan    100        966048 Jul 22 21:59 a.out
ethan@ethan:~$ strip a.out
ethan@ethan:~$ l a.out
-rwxr-xr-x    1 ethan    100        891128 Jul 22 21:59 a.out

So even after stripping it's still 890K in size. Did you perhaps tell
perlcc to do dynamic instead of static linking? If so, how?

Tassilo
-- 
$_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?<=sub).+q#q!'"qq.\t$&."'!#+sexisexiixesixeseg;y~\n~~dddd;eval


------------------------------

Date: Tue, 22 Jul 2003 14:39:23 -0700
From: "David Oswald" <spamblock@junkmail.com>
Subject: Re: Please critique my 2nd Perl program (generates an auction description)
Message-Id: <vhrbq0i6v5o7e2@corp.supernews.com>

Thank-you everyone for your comments.  After reading the Llama book, the
Camel book, and the Owls book, the best way to refine and hone my skills
seems to be to try things, and then ask others, now how would YOU have done
it?

Thanks again...

Dave




------------------------------

Date: 22 Jul 2003 18:15:01 GMT
From: ctcgag@hotmail.com
Subject: Re: Q- Empirical usable upper limit on hash array number of elements
Message-Id: <20030722141501.775$Ta@newsreader.com>

carltonbrown@hotmail.com (Carlton Brown) wrote:
> I'm trying to work a simple union problem that will result in some
> extremely large hashes (minimum 2 million elements, possibly up to 100
> million at some point, no key or value will be larger than 64 bytes).
> So I'm wondering if anyone has had practical experience using hashes
> with extremely large numbers of elements, and if so, did you encounter
> any logical or practical limit?

Yes, I've used very large hashes, although not quite as large as you
discuss. The practical limit is about the size of physical memory, once
you've exceeded that, you can expect your program to thrash about uselessly
until you kill or it brings your machine down.

> Has anyone used hashes of up to 100
> million elements without experiencing unreasonable slowness or
> unpredictable behavior?

No!  I consider the slowness I've encountered to be perfectly reasonable,
considering what's going on behind the scenes; and the behavior under
testing to destruction, while undesirable, is fairly predictable.

> All the docs (that I've read) say that there is no limit on the size
> of a hash in PERL.   But in my experience, when documentation says "no
> limit" on a spec, it means the limit lies outside the boundaries of
> what anyone has tested.

Or that the limits are so system dependent that trying to specify the
boundaries is an exercise in futility.


> A quick "Fermi problem" review of the expected orders of magnitude
> shows that these data structures shouldn't consume more than 12GB of
> memory (unless of course there exists some non-trivial overhead that I
> don't know about).

There is non-trivial overhead.  For flat hashes, I usually figure
about 25 bytes per pair (plus the length of the key) if only floats are
stored as hash values,or about 60 bytes per pair (plus lengths of both key
and value) if strings are stored as values.  YMMV.

> This will be run on a machine with 24GB of
> physical RAM and 24GB of virtual memory, so memory should not be a
> problem.

Man, I'm jealous.  How many processors is that on?


> The essence of the problem is to take extremely large list A, compare
> it to slightly smaller list B, and identify the elements from list A
> that are not found in list B.

What fraction of list A do you expect to be found in list B?

For jobs of this scope, I'd tend to write perl scripts that just marshall
the input files through the appropriate system "sort" and "join" and/or
"uniq" commands.

Xho

-- 
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service              New Rate! $9.95/Month 50GB


------------------------------

Date: Tue, 22 Jul 2003 13:27:28 -0500
From: "William Alexander Segraves" <wsegrave@mindspring.com>
Subject: Re: s there a module to acess Micorsoft Access datafiles?
Message-Id: <bfjvtp$57i$1@slb6.atl.mindspring.net>

"Stan Brown" <stanb@panix.com> wrote in message
news:bfjpm1$irp$1@reader1.panix.com...
> In <bfjgsm$6ir$1@slb2.atl.mindspring.net> "William Alexander Segraves"
<wsegrave@mindspring.com> writes:
<snip>
> >The OP has indicated in a private communication that he has enough
> >information to get started; so I think we can give this thread a decent
> >burial now. ;-)
>

Stan, you *are* allowed, no encouraged, to snip info that is not relevant to
your questions. ;-)

>
> Mmm, as teh OP, I'm still trying to get a handle on this.
>

O.K. Did you have a Perl question?

> It _appears to me_ that what has been done hser, will still use teh
> "provate knowledge" that the Win32 perl ODBC module has about the Access
> database.

Well, yes. OTOH, in the example I posted, DBI and DBD::ODBC have no "private
knowledge" about an Access database. It is Win32 that has the "private
knowledge" that is provided via the DSN to which we connected.

>  Am I missing something here? If so then how would you specify
> the DSb on the clinet side for a remote windows amchien?

"Start + Settings + Control Panel + ODBC Data Sources (32bit) + ..."

>You would have to
> be able to resolve both machine IP address, and the DSN on that machine,
> right?
>

No. In the example, there was no DSN set up on the remote Win32 computer.
The DSN was set up on the Client Win32 computer, i.e., the one on which the
script was run from the command line.

On the target Win32 computer, we established just a share of the directory
in which the MS Access target files reside.

> Or does the *NIX version of the ODBC perl module also have knowledge of
the
> format of Access files? Which seems to be the way that this assumes things
> will work (based upon needing mountung the filesystem with the Access
> files).
>

No. I think you're missing the whole point of ODBC.

>
> >    perl dbi_odbc_test_v2.pl dsn=contacts_nettie table=register
>
> How would this be specifed for a remote machien?
>

See above. The dsn=contacts_nettie refers to a DSN on the client computer
that describes the network connection to, well, "nettie", which is the name
of the other Win32 computer, i.e., the one with the *.mdb file that has a
table named "register". BTW, "nettie" does not have MS Access installed on
it, so no "private knowledge" about MS Access exists there.

Seriously, if you'll set up the example I crafted for you, you'll be able to
answer a lot of your own questions.

There are no Perl issues here, which probably explains why you have not
brought into play the expertise of many of the experts that frequent this
newsgroup.

Cheers.

Bill Segraves




------------------------------

Date: Tue, 22 Jul 2003 13:43:55 -0500
From: "William Alexander Segraves" <wsegrave@mindspring.com>
Subject: Re: s there a module to acess Micorsoft Access datafiles?
Message-Id: <bfk0p5$u2d$1@slb9.atl.mindspring.net>

"William Alexander Segraves" <wsegrave@mindspring.com> wrote in message
news:bfjvtp$57i$1@slb6.atl.mindspring.net...
<snip>
> See above. The dsn=contacts_nettie refers to a DSN on the client computer
> that describes the network connection to, well, "nettie", which is the
name
> of the other Win32 computer, i.e., the one with the *.mdb file that has a
> table named "register". BTW, "nettie" does not have MS Access installed on
> it, so no "private knowledge" about MS Access exists there.
>

BTW, I should have written, "so no "private knowledge" about MS Access
exists there, other than what is built into the Windows operating system.
IMO, on the target file's side of the transaction, I am pursuaded that none
of this comes into play, as the DSN on the client side points only to a
shared file on the target computer."

CHeers.

Bill Segraves




------------------------------

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 5258
***************************************


home help back first fref pref prev next nref lref last post