[24006] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 6204 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Mar 2 14:06:14 2004

Date: Tue, 2 Mar 2004 11:05:08 -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, 2 Mar 2004     Volume: 10 Number: 6204

Today's topics:
    Re: (newbie) How do I group a string for repetition cou ctcgag@hotmail.com
        /dev/pts/x, /proc/x/fd, reading stdout, writing stdin,  <nospam@nospam9.se>
        7-bit transmission via Net::SMTP? <Guru03@despammed.com>
    Re: File::Temp: opening the temp. file in "r+" mode? Al <usenet@morrow.me.uk>
    Re: how do I choose between an explicit file and standa ctcgag@hotmail.com
        How to grep hyphen ('-') in a string? (William Tang)
    Re: How to grep hyphen ('-') in a string? <Guru03@despammed.com>
    Re: How to grep hyphen ('-') in a string? <ittyspam@yahoo.com>
        if ($chunk == 0xffffffffffffffffffffffff) (A. Farber)
    Re: if ($chunk == 0xffffffffffffffffffffffff) (Walter Roberson)
    Re: if ($chunk == 0xffffffffffffffffffffffff) <usenet@morrow.me.uk>
    Re: if ($chunk == 0xffffffffffffffffffffffff) (Anno Siegel)
    Re: internationalization module (Anno Siegel)
    Re: internationalization module <usenet@morrow.me.uk>
    Re: internationalization module <noreply@gunnar.cc>
        Macros <chatiman@free.fr>
    Re: Macros <usenet@morrow.me.uk>
        Need to find a file on the execution PATH <me@privacy.net>
    Re: Need to find a file on the execution PATH <ittyspam@yahoo.com>
    Re: no history <jwillmore@remove.adelphia.net>
    Re: no history <tore@aursand.no>
    Re: Opening a unique dat file for each user <g_klinedinst@hotmail.com>
    Re: PLEASE HELP ABOUT HASH! ctcgag@hotmail.com
    Re: Problems with <kalinaubears@iinet.net.au>
    Re: Regex comparison <lpeters@aol.net>
    Re: split into array ctcgag@hotmail.com
        Suppress "mytime redefined" message from Benchmark? <jboes@nexcerpt.com>
    Re: Suppress "mytime redefined" message from Benchmark? (Malcolm Dew-Jones)
        WWW::Mechanize Form Name not found (Mikej)
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 02 Mar 2004 17:40:17 GMT
From: ctcgag@hotmail.com
Subject: Re: (newbie) How do I group a string for repetition count?  {m,n}
Message-Id: <20040302124017.537$iz@newsreader.com>

rayling@spiderchase.com (Ray) wrote:
> Hello,
>
> I'm trying the following to get the 2nd, and only the 2nd occurrence
> of the phrase "turkey shoot", in a string with a lot more than 2
> occurrences of the phrase:

What do you mean by "get"?  Since all occurences of the string
"turkey shoot" are indistinguishable, why do you care (and how would you
know) which one you get?

Xho

-- 
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service                        $9.95/Month 30GB


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

Date: Tue, 02 Mar 2004 18:52:29 GMT
From: Andreas Persson <nospam@nospam9.se>
Subject: /dev/pts/x, /proc/x/fd, reading stdout, writing stdin, not with open3
Message-Id: <pan.2004.03.02.18.52.45.792750@nospam9.se>

Hi

are there any perl gods out there that could help me. :)

is it possible to open(?) /dev/pts/x that another program
has created/using/virtual_console and read its stdout and let me write to
its stdin?

is it possible to use /proc/$pid/fd/x in some way?

the only way i've found to work is with open3 call, but this not
nice to the program that needs to be running 24/7. :)


any tips/hints are very welcome, both on a perl solution and general info
on /dev/pts/ and /proc/$pid/fd/.

/Andreas


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

Date: Tue, 2 Mar 2004 16:44:14 +0000 (UTC)
From: Guru03 <Guru03@despammed.com>
Subject: 7-bit transmission via Net::SMTP?
Message-Id: <Xns94A0B489655B3Guru03despammedcom@193.43.96.1>

Hi,

I must delivery an email message from a SMTP server to an another.

The transmission MUST be 7-bit coded (*NOT* 8BITMIME).

It's ok to use Net::SMTP? The documentation about it don't tell me about 
the type of transmission. And the code isn't clear.

It must be able to delivery MIME 1.0 format emails with special characters 
(i.e. non US keyboard) coded in 8-bit format (with some attachments in UTF8 
code converted into BASE64 that already are in 7bit format).

Any idea?


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

Date: Tue, 2 Mar 2004 18:38:01 +0000 (UTC)
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: File::Temp: opening the temp. file in "r+" mode? Also "man in the middle"
Message-Id: <c22ka9$3en$2@wisteria.csv.warwick.ac.uk>


Alexander.Farber@t-online.de (A. Farber) wrote:
> 
> I'm working at a CGI-script which would receive a 20 MB
> big file via HTTP-upload, then change few bytes in it,
> then calculate an MD5 hash over a region of that file
> and save that value into the file as well.
> 
> At the moment I do the first task (change few bytes) like 
> this (the $flash is coming from the CGI.pm's filefield):
> 
>   my ($fh, $filename) = tempfile(DIR => UPLOADDIR);
> 
>   while (sysread $flash, $chunk, KEYSIZE) {
>           $both = $prev . $chunk;
>           if ($both =~ s/$SEARCH/$REPLACE/o) {
>                   print $fh $both;
>                   undef $prev;
>           } else {
>                   print $fh $prev;
>                   $prev = $chunk;
>           }
>   }
>   # don't forget to print the last line
>   print $fh $prev;
> 
> Now I need to calculate the MD5 value and store it
> in the file. Is there a safe way to reuse the $fh ?
> Maybe somehow by using:
> 
>   open(FILEHANDLE, "<&=$fh")
> 
> ? But how do I specify the mode above? I need "rb+"
> so that I can store the MD5 hash into the temp.file.

Why do you need to dup the filehandle at all? Why can't you just use
$fh?

Anyway, the answer is

open my $NEWFH, '+<&=', $fh;

or, pre-5.8,

open my $NEWFH, '+<&=' . fileno $fh;

> Also do I really need the new temp.file or is there
> a nice way to work with CGI.pm's temp files?

If the $SEARCH and $REPLACE are the same length then you can run through
the file and simply overwrite chunks that change with syswrite. If they
are not then you have to make a copy.

Ben

-- 
It will be seen that the Erwhonians are a meek and long-suffering people,
easily led by the nose, and quick to offer up common sense at the shrine of
logic, when a philosopher convinces them that their institutions are not based 
on the strictest morality.  [Samuel Butler, paraphrased]       ben@morrow.me.uk


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

Date: 02 Mar 2004 17:50:32 GMT
From: ctcgag@hotmail.com
Subject: Re: how do I choose between an explicit file and standard input
Message-Id: <20040302125032.290$wU@newsreader.com>

Lowell Kirsh <lkirsh@cs.ubc.ca> wrote:
> I want to write a script that will take an optional filename as a
> command line argument and will use stdin if no parameter is supplied.
> What the script does is count the number of unique lines in a file. For
> example I want 'theScript foo' to act like:
>
> system "uniq < foo | wc -l"
>
> but if no parameter is supplied it should act like:
>
> system "uniq < {standard input} | wc -l"
>
> Does this make sense?

You use the empty read operator, <>.

One caveat is that your program should not invoke <> after the first
time it returns undef (which if all you want is wc knock-off, should
not be a problem.)

Xho

-- 
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service                        $9.95/Month 30GB


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

Date: 2 Mar 2004 08:45:57 -0800
From: wmtang21@yahoo.com (William Tang)
Subject: How to grep hyphen ('-') in a string?
Message-Id: <c3078cce.0403020845.7131dc5b@posting.google.com>

I have a string such as:
XYZ-ABC.xml NEW 1.0 myfolder/mylocation wtang.001

I use the following grep function try to grep it:
grep(/^\s*\w+\.\w+\s+([0-9\.]+|New)\s+[0-9\.]+\s+[\w\\\/\.]+\s+\S+\s*$/,
<SCRFILE> );

where <SCRFILE> is the filename that store this string.

It seems that it can't read this '-'. If I change it into '_', it
works fine.

Did I missing something?

Thanks,
William


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

Date: Tue, 2 Mar 2004 16:52:55 +0000 (UTC)
From: Guru03 <Guru03@despammed.com>
Subject: Re: How to grep hyphen ('-') in a string?
Message-Id: <Xns94A0B602442E2Guru03despammedcom@193.43.96.1>

wmtang21@yahoo.com (William Tang) wrote in 
news:c3078cce.0403020845.7131dc5b@posting.google.com:

> I use the following grep function try to grep it:
> grep(/^\s*\w+\.\w+\s+([0-9\.]+|New)\s+[0-9\.]+\s+[\w\\\/\.]+\s+\S+\s*$/,
> <SCRFILE> );
> 
> where <SCRFILE> is the filename that store this string.
> 
> It seems that it can't read this '-'. If I change it into '_', it
> works fine.
> 
> Did I missing something?

use this:

grep(/^\s*[\w\-]+\.\w+



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

Date: Tue, 2 Mar 2004 11:56:18 -0500
From: Paul Lalli <ittyspam@yahoo.com>
Subject: Re: How to grep hyphen ('-') in a string?
Message-Id: <20040302115531.T27834@dishwasher.cs.rpi.edu>

On Tue, 2 Mar 2004, William Tang wrote:

> I have a string such as:
> XYZ-ABC.xml NEW 1.0 myfolder/mylocation wtang.001
>
> I use the following grep function try to grep it:
> grep(/^\s*\w+\.\w+\s+([0-9\.]+|New)\s+[0-9\.]+\s+[\w\\\/\.]+\s+\S+\s*$/,
> <SCRFILE> );
>
> where <SCRFILE> is the filename that store this string.
>
> It seems that it can't read this '-'. If I change it into '_', it
> works fine.
>
> Did I missing something?


Yes.  You missed the fact that \w does not match a hyphen.  \w matches
letters, numbers, and the underscore.

Paul Lalli


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

Date: 2 Mar 2004 10:20:59 -0800
From: Alexander.Farber@t-online.de (A. Farber)
Subject: if ($chunk == 0xffffffffffffffffffffffff)
Message-Id: <c9ccaf83.0403021020.633a82b4@posting.google.com>

Hi,

I'm trying to verify that a file (uploaded via HTTP)
has 24 bytes with the value 0xff at some offset:

    die "sysseek to $place failed: $!"
        unless sysseek $fh, $place, SEEK_SET;
    die "sysread failed: $!"
        unless 24 == sysread $fh, $check, 24;
    unless (0xffffffffffffffffffffffff == $check) {
        printf "Checksum storage area at 0x%X is not empty", $place;
        exit;
    }

However the condition above is never true on 
RedHat 9 with Perl 5.6.1. Any suggestions please?

Regards
Alex


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

Date: 2 Mar 2004 18:29:58 GMT
From: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)
Subject: Re: if ($chunk == 0xffffffffffffffffffffffff)
Message-Id: <c22jr6$duo$1@canopus.cc.umanitoba.ca>

In article <c9ccaf83.0403021020.633a82b4@posting.google.com>,
A. Farber <Alexander.Farber@t-online.de> wrote:
:I'm trying to verify that a file (uploaded via HTTP)
:has 24 bytes with the value 0xff at some offset:

:        unless 24 == sysread $fh, $check, 24;
:    unless (0xffffffffffffffffffffffff == $check) {

:However the condition above is never true on 
:RedHat 9 with Perl 5.6.1. Any suggestions please?

0xffffffffffffffffffffffff is a number that is overflowing
the maximum integer available.

Try   unless (("\xff" x 24) == $check)
-- 
   "[...] it's all part of one's right to be publicly stupid." -- Dave Smey


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

Date: Tue, 2 Mar 2004 18:51:41 +0000 (UTC)
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: if ($chunk == 0xffffffffffffffffffffffff)
Message-Id: <c22l3t$3en$5@wisteria.csv.warwick.ac.uk>


roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson) wrote:
> In article <c9ccaf83.0403021020.633a82b4@posting.google.com>,
> A. Farber <Alexander.Farber@t-online.de> wrote:
> :I'm trying to verify that a file (uploaded via HTTP)
> :has 24 bytes with the value 0xff at some offset:
> 
> :        unless 24 == sysread $fh, $check, 24;
> :    unless (0xffffffffffffffffffffffff == $check) {
> 
> :However the condition above is never true on 
> :RedHat 9 with Perl 5.6.1. Any suggestions please?
> 
> 0xffffffffffffffffffffffff is a number that is overflowing
> the maximum integer available.
> 
> Try   unless (("\xff" x 24) == $check)
                              ^^
                              eq
Ben

-- 
   If you put all the prophets,   |   You'd have so much more reason
   Mystics and saints             |   Than ever was born
   In one room together,          |   Out of all of the conflicts of time.
ben@morrow.me.uk                                    The Levellers, 'Believers'


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

Date: 2 Mar 2004 18:59:31 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: if ($chunk == 0xffffffffffffffffffffffff)
Message-Id: <c22lij$l2$1@mamenchi.zrz.TU-Berlin.DE>

A. Farber <Alexander.Farber@t-online.de> wrote in comp.lang.perl.misc:
> Hi,
> 
> I'm trying to verify that a file (uploaded via HTTP)
> has 24 bytes with the value 0xff at some offset:

"24 bytes with value 0xff" can mean a few different things.  Do you mean,
each of the 24 bytes has value 0xff (255)?

>     die "sysseek to $place failed: $!"
>         unless sysseek $fh, $place, SEEK_SET;
>     die "sysread failed: $!"
>         unless 24 == sysread $fh, $check, 24;

Why are you using sysseek(), sysread(), etc?  What is your reason for not
using standard IO functions?

>     unless (0xffffffffffffffffffffffff == $check) {

That is a 12 byte number.  Perl doesn't deal natively with numbers that
wide (nor does anything else).  But it still is only half the length of
your 24 bytes.

But your code wouldn't work even if you only had 4 bytes (which fit into
a native integer on most machines).  Perl reads strings from files, not
numbers.  So, if you read 24 bytes of one-bits, a string of 24 bytes of
one-bits is what you get.  Try string comparison with that value:

    $check eq "\xff" x 24;

Anno

>         printf "Checksum storage area at 0x%X is not empty", $place;
>         exit;
>     }
> 
> However the condition above is never true on 
> RedHat 9 with Perl 5.6.1. Any suggestions please?
> 
> Regards
> Alex




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

Date: 2 Mar 2004 18:28:13 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: internationalization module
Message-Id: <c22jnt$sl6$1@mamenchi.zrz.TU-Berlin.DE>

chatiman <chatiman@free.fr> wrote in comp.lang.perl.misc:
> 
> "Anno Siegel" <anno4000@lublin.zrz.tu-berlin.de> a écrit dans le message de
> news: c229lp$mi0$1@mamenchi.zrz.TU-Berlin.DE...
> > Write it!
> >
> Can "gettext" do that (variable evaluation) ?

What is "gettext"?  What is "variable evaluation"?

You haven't made very clear yet what you actually want to do.

Anno


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

Date: Tue, 2 Mar 2004 18:41:52 +0000 (UTC)
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: internationalization module
Message-Id: <c22khg$3en$3@wisteria.csv.warwick.ac.uk>


anno4000@lublin.zrz.tu-berlin.de (Anno Siegel) wrote:
> chatiman <chatiman@free.fr> wrote in comp.lang.perl.misc:
> > 
> > "Anno Siegel" <anno4000@lublin.zrz.tu-berlin.de> a écrit dans le message de
> > news: c229lp$mi0$1@mamenchi.zrz.TU-Berlin.DE...
> > > Write it!
> > >
> > Can "gettext" do that (variable evaluation) ?
> 
> What is "gettext"?

'gettext' is a standard i18n/l10n library.

> You haven't made very clear yet what you actually want to do.

I think he wants to localise his app... to the OP: look at
Locale::Maketext.

Ben

-- 
don't get my sympathy hanging out the 15th floor. you've changed the locks 3
times, he still comes reeling though the door, and soon he'll get to you, teach
you how to get to purest hell. you do it to yourself and that's what really
hurts is you do it to yourself just you, you and noone else ** ben@morrow.me.uk


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

Date: Tue, 02 Mar 2004 19:42:19 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: internationalization module
Message-Id: <c22l4c$1mrv3v$1@ID-184292.news.uni-berlin.de>

chatiman wrote:
> I'm searching a module to translate my scripts into different
> languages. Idealy this module will have the following features :
> - Easy to use and install (part of the standard perl packages
>   idealy)
> - Can translate text with perl variables
>     eg: "Word $word"
> - Would take a text identifier and returns the translated
>   version with variables evaluated
> 
> Does this exists or do I have to write it ?

I'm sure there are quite a few tools to help you with
internationalization, so you don't need to re-invent that wheel.
Personally I'm applying a GNU gettext approach for i18n of a Perl
program, and I'm quite happy with it.

As you may know, the gettext language files consist of both the
English text strings and the strings of respective language, and I'm
creating those without Perl, i.e. using the GNU gettext program.

To incorporate them into my program I'm using this simple CPAN module:
http://search.cpan.org/perldoc?Locale%3A%3APGetText

By help of that module, DBM files are created out from the language
files. There is also a gettext() function (of course), and all the
output strings in the program are passed to that function, which picks
the strings from the selected DBM database.

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



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

Date: Tue, 2 Mar 2004 18:06:38 +0100
From: "chatiman" <chatiman@free.fr>
Subject: Macros
Message-Id: <4044bf14$0$28424$636a15ce@news.free.fr>

Hello,

Is it possible to define macros in perl without using the C preprocessor ?

Or is there a way to access the caller's function local variables ?

Thanks





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

Date: Tue, 2 Mar 2004 18:46:58 +0000 (UTC)
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: Macros
Message-Id: <c22kr2$3en$4@wisteria.csv.warwick.ac.uk>


"chatiman" <chatiman@free.fr> wrote:
> Hello,
> 
> Is it possible to define macros in perl without using the C preprocessor ?

Filter::Simple

> Or is there a way to access the caller's function local variables ?

Why do you want to do this? There is almost certainly a better way.

However, if you must: PadWalker.

Ben

-- 
For the last month, a large number of PSNs in the Arpa[Inter-]net have been
reporting symptoms of congestion ... These reports have been accompanied by an
increasing number of user complaints ... As of June,... the Arpanet contained
47 nodes and 63 links. [ftp://rtfm.mit.edu/pub/arpaprob.txt] * ben@morrow.me.uk


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

Date: Tue, 02 Mar 2004 08:39:35 -0800
From: "davido@codethought.nospamforme.com" <me@privacy.net>
Subject: Need to find a file on the execution PATH
Message-Id: <6td940ludtqavcj7109ja8aun24rr331fi@4ax.com>

Hey there...

Does anyone know of a (cross platform - works in Win32 /or/ *nix) way
to figure out of a executable program is on a search path?  For
example, to find if foobar.exe is in the Win32 PATH?

Googling didn't turn up suitable results (but I might have not not
used the right search criteria).

TIA.

DavidO


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

Date: Tue, 2 Mar 2004 11:54:29 -0500
From: Paul Lalli <ittyspam@yahoo.com>
Subject: Re: Need to find a file on the execution PATH
Message-Id: <20040302115333.M27834@dishwasher.cs.rpi.edu>

On Tue, 2 Mar 2004, davido@codethought.nospamforme.com wrote:

> Hey there...
>
> Does anyone know of a (cross platform - works in Win32 /or/ *nix) way
> to figure out of a executable program is on a search path?  For
> example, to find if foobar.exe is in the Win32 PATH?
>
> Googling didn't turn up suitable results (but I might have not not
> used the right search criteria).


Take a look at the modules File::Find and File::Spec (specifially, the
File::Spec->path() function).  Both are in the standard distribution.

Paul Lalli


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

Date: Tue, 02 Mar 2004 11:07:28 -0500
From: James Willmore <jwillmore@remove.adelphia.net>
Subject: Re: no history
Message-Id: <pan.2004.03.02.16.07.27.66682@remove.adelphia.net>

On Tue, 02 Mar 2004 14:11:02 +0100, Christian Schmidt wrote:

> I'm writing a perl script for editing a (very) simple database. And I 
> want to prevent that the user can recall pages with earlier entries he 
> made using the Browsers "Back"-function. Is it possible to generate 
> HTML-pages that will not be pushed into the browsers history?

I'm thinking this is a question more properly addressed in
comp.infosystems.www.authoring.cgi

There are a few methods that you could use, but the most obvious to me
does not involve Perl :-)

-- 
Jim

Copyright notice: all code written by the author in this post is
 released under the GPL. http://www.gnu.org/licenses/gpl.txt 
for more information.

a fortune quote ...
The problem with people who have no vices is that generally you
<can be pretty sure they're going to have some pretty annoying
virtues.   -- Elizabeth Taylor 


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

Date: Tue, 02 Mar 2004 17:53:20 +0100
From: Tore Aursand <tore@aursand.no>
Subject: Re: no history
Message-Id: <pan.2004.03.02.14.34.04.794164@aursand.no>

On Tue, 02 Mar 2004 14:11:02 +0100, Christian Schmidt wrote:
> I'm writing a perl script for editing a (very) simple database. And I
> want to prevent that the user can recall pages with earlier entries he
> made using the Browsers "Back"-function. Is it possible to generate
> HTML-pages that will not be pushed into the browsers history?

This has nothing to do with Perl.  Try one of the CGI-related newsgroups.
I know they're out there.


-- 
Tore Aursand <tore@aursand.no>
"First, God created idiots. That was just for practice. Then He created
 school boards." -- Mark Twain


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

Date: Tue, 02 Mar 2004 09:44:25 -0800
From: Greg Klinedinst <g_klinedinst@hotmail.com>
Subject: Re: Opening a unique dat file for each user
Message-Id: <r6h94010dgbpmt3jet8dpeesirgdhjgcff@4ax.com>

On Tue, 02 Mar 2004 11:14:01 +0800, Regent <arthur0421@163.com> wrote:

>I mean this: in the same script, $uid firstly goes through -T check, and 
>then compared with the array of authenticated user names in a database. 
>After all these have been done, what are other problems may the script have?

That sounds more than sufficient to me so long as you are actually
testing for something in your taint check.

>Thanks really. In fact before being used as part of the filename, $uid 
>is validated beforehand. So
>
>         $uid = $1 if $uid =~ /(.*)/;
>
>should be no problem.

In other words don't use this. This isn't really doing anything but
bypassing the -T flag, something like Ben or gnari suggested is
probably a good place to start and then you can tailor it to your own
needs. Good luck with your project.

-Greg




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

Date: 02 Mar 2004 18:08:18 GMT
From: ctcgag@hotmail.com
Subject: Re: PLEASE HELP ABOUT HASH!
Message-Id: <20040302130818.169$Pm@newsreader.com>

"news.hinet.net" <luke@program.com.tw> wrote:
> I have the vast data in mysql about (1.5G)
> I got some data from machine and want to search some field
> that does not exist in mysql.

I think you mean that the field exists, and you wish to identify values for
that field which do not exist.

> i just want to insert these data that
> does not exist in mysql before.

Is the "insert ignore..." MySQL-specific extension to sql what you want?

> I use hash to handle these data.
>
> First i load data into hash from mysql and search  data if it is exist.
> but i use the vast memory at the same time
>
> how to solve this program??

Huge hashes take huge amounts of memory.  There is no ready solution to
that problem.

>
> if i insert all data by setup db field data is unique. this will spend a
> lot of time.

Please explain in code what you mean by this, and specify in numbers the
amount of time it would take (and in what an acceptable time would be).

> give me some suggest!!
> ps:the data is more than 500M one time insert process

It is unlikely that the programming, debugging, and run-time of a
sophisticated one-time only solution will be less than the run-time of the
naive "insert ignore..." solution.



Xho

-- 
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service                        $9.95/Month 30GB


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

Date: Wed, 03 Mar 2004 05:05:22 +1100
From: Sisyphus <kalinaubears@iinet.net.au>
Subject: Re: Problems with
Message-Id: <4044cdef$0$22525$5a62ac22@freenews.iinet.net.au>

TLOlczyk wrote:

> 
> Line 313 of win32.h is
> extern int		my_fstat(int fd, Stat_t *sbufptr);
> 

I have an ActiveState build of perl with that same line in it. It also 
produces the error you reported, along with a number of other errors.

I also have some perl installations I built myself with MSVC++ 6 and
another perl installation built with MSVC++ 7 (.NET). There is no 
problem at all with the Win32.h files in those builds.
In them, line 313 appears as:
extern int		my_fstat(int fd, struct stat *sbufptr);

I have no idea what causes the difference in the header files between 
the ActiveState builds and the perls that I built with MSVC++. Afaik 
they should all be the same.

I think you'll find that the problem disappears for you if you build 
perl yourself from source - and that's probably the quickest solution.

I could send you my win32.h, perlio.h, and win32iop.h if you think that 
would work - but I wouldn't be surprised if the problem runs deeper than 
that.

Cheers,
Rob

-- 
To reply by email u have to take out the u in kalinaubears.



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

Date: Tue, 02 Mar 2004 13:08:05 -0500
From: Les Peters <lpeters@aol.net>
Subject: Re: Regex comparison
Message-Id: <4044CD85.5070601@aol.net>

Ben Morrow wrote:

> 
> I realise this. What you are attempting to do is make the choice of
> pattern for a given string independant of the order of patterns in the
> file, right? 

Right.

> Consider the two patterns I gave you, and the string "c".
> It matches both. Which should be chosen in this case?

I would probably say that /[abc]/ can match more things, and therefore is
more general than /[cd]/, so the order would be /[cd]/, /[abc]/.
I had misread your previous post, and was thinking of /abc/ and /de/.

>>    $s1 =~ s/^\^//;                       # replace ^
> 
> 
> ^ does not necessarily have to occur at the beginning of a pattern.
> Consider /a|^b/.

This pattern would have to be dealt with, obviously, as an alternation.

> 
> This is wrong. /\d/ is more specific than /\d+/ is more specific than
> /\d*/, by any reasonable definition of 'specific'.

I agree.  The same would apply to \D, \s, \S, etc.

> These are also wrong: you need to replace all \X with X unless \X is
> significant in regexen. Note also that < and > are not special in a
> regex[1], so there's no need to write them as \< and \>.

I agree with you here as well, but I am working from an existing set
of patterns, and this unnecessary backslashing occurs there, so I am
managing it in this way.

> I think, as I said before, that your problem is either unsolvable or
> *extremely* difficult. I would go with a heuristic approach: first,
> split your pattern into its top-level alternatives: you will be best off
> using Text::Balanced for this. Then split each alternative into atoms,
> an atom being

I am getting a better understanding of the scope of the problem: it's
huge!  I am effectively reverse-engineering the regex engine, and only
an approach that takes that into consideration will have any chance of
a moderate level of success.

Thank you for your assistance,
Les



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

Date: 02 Mar 2004 18:21:22 GMT
From: ctcgag@hotmail.com
Subject: Re: split into array
Message-Id: <20040302132122.886$q2@newsreader.com>

Greg Klinedinst <g_klinedinst@hotmail.com> wrote:
> On Mon, 1 Mar 2004 19:51:06 -0000, "gnari" <gnari@simnet.is> wrote:
>
> >I do not agree. I think the docs are quite clear, and your version
> >is more confusing. the split() function is amazingly complicated,
> >with lots of special cases. the docs do an admirable job of
> >describing each effect separately in a clear way.
>
> Hmm, perhaps I wasn't clear myself, or at least I used the wrong word.
> The clarity is fine, what is lacking is the completeness. For example
> it is clear that if LIMIT is unspecified or null split will strip null
> fields. However logically we cannot assume that if LIMIT is specified
> the opposite will happen. The only two other relevant statements say
> that we can set a maximum using a positive integer(though it may split
> into fewer, but how many is "fewer" referring to?), and that a
> negative integer acts as a VERY large positve int. Neither of them
> covers when it will not strip null fields. I forget the formal logic
> syntax but it goes something like this:
>
> A  ->  B    !=     !A  ->  !B

I think that if one wants something spelled out in exhaustive detail
equivalent to symbolic logic, one would read the source code rather than
the documentation.

I thought the documentation was pretty effective at conveying the meaning
when I first read it.

Xho

-- 
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service                        $9.95/Month 30GB


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

Date: Tue, 02 Mar 2004 15:54:15 GMT
From: Jeff Boes <jboes@nexcerpt.com>
Subject: Suppress "mytime redefined" message from Benchmark?
Message-Id: <9e867911848b48d995e08ebfc463371e@news.teranews.com>

Hmm ... this one's got me puzzled:

$ perl -v
 

This is perl, v5.8.3 built for i686-linux

 ...

$ perl -w -e 'no warnings; use Benchmark qw(:hireswallclock)'
Subroutine Benchmark::mytime redefined at 
/usr/local/lib/perl5/5.8.3/Benchmark.pm line 456.

$ perl -w -e 'no warnings qw(redefine); use Benchmark qw(:hireswallclock)'
Subroutine Benchmark::mytime redefined at 
/usr/local/lib/perl5/5.8.3/Benchmark.pm line 456.


Does anyone know of a way to completely suppress this warning? It's 
irritating, because I have a script running in cron that reports this 
message, over and over. (I don't want to suppress or redirect STDERR, 
because there may be other legitimate errors.)



-- 
Jeff Boes                                      vox 269.226.9550 ext 24
Database Engineer                                     fax 269.349.9076
Nexcerpt, Inc.                                 http://www.nexcerpt.com
            ...Nexcerpt... Extend your Expertise


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

Date: 2 Mar 2004 08:42:56 -0800
From: yf110@vtn1.victoria.tc.ca (Malcolm Dew-Jones)
Subject: Re: Suppress "mytime redefined" message from Benchmark?
Message-Id: <4044b990@news.victoria.tc.ca>

Jeff Boes (jboes@nexcerpt.com) wrote:
: Hmm ... this one's got me puzzled:

: $ perl -v
:  

: This is perl, v5.8.3 built for i686-linux

: ...

: $ perl -w -e 'no warnings; use Benchmark qw(:hireswallclock)'
: Subroutine Benchmark::mytime redefined at 
: /usr/local/lib/perl5/5.8.3/Benchmark.pm line 456.

: $ perl -w -e 'no warnings qw(redefine); use Benchmark qw(:hireswallclock)'
: Subroutine Benchmark::mytime redefined at 
: /usr/local/lib/perl5/5.8.3/Benchmark.pm line 456.


: Does anyone know of a way to completely suppress this warning? It's 
: irritating, because I have a script running in cron that reports this 
: message, over and over. (I don't want to suppress or redirect STDERR, 
: because there may be other legitimate errors.)


$SIG{__WARN__}

Examine the warnings and skip the one you don't want.



--
Web Work Wanted, Perl Projects Programmed, Database Development Done.

I'm looking for telecommute projects. (Paying that is, various
arrangements possible.)


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

Date: 2 Mar 2004 10:10:54 -0800
From: mjoffe@star.net.uk (Mikej)
Subject: WWW::Mechanize Form Name not found
Message-Id: <ffa80ad6.0403021010.7cf372d0@posting.google.com>

Hi,

Total Perl/Mechanize beginner so please bear with me:

I Have a very simple htm password page that I want my mechanize script
to fill in but when I try and run it from the cmd line I get an error:

There is no form named form1 at test2.pl line 18
Can't call method "inputs" on an undefined value at
C:/Perl/site/lib/WWW/Mechanize/FormFiller.pm line 115.

I thought perhaps my html form name was wrong so I changed it to
Name="1" but this didn't work. Then I tried changing the method I was
calling to form_name and form_number but this didn't work either.I can
telnet to the localhost and display the site so no probs with
retrieving the website. If I try debugging i.e.
print $agent;

After $url is assigned I just get the WWW::Mechanize object returned.
 

This is my perl script:

use strict;
use warnings;

my $username = 'jeff';
my $password = 'smith';


use WWW::Mechanize;
use WWW::Mechanize::FormFiller;

my $url = "http://test2/password.htm";

my $agent = WWW::Mechanize->new();
my $formfiller = WWW::Mechanize::FormFiller->new();

$agent->get($url);

$agent->form('form1');

$formfiller->add_filler("username" => Fixed => $username);
$formfiller->add_filler("password" => Fixed => $password);
$formfiller->fill_form($agent->current_form);

$agent->click("Submit");

The web pag is simply:
<HTML>
 ..
     <FORM ACTION="process.asp" NAME="form1" METHOD="post">
          User Name: <INPUT TYPE="text" SIZE=30 NAME="username">
          <P>
          Password: <INPUT TYPE="password" SIZE=30 NAME="password">
          <P>
          <INPUT TYPE="submit" VALUE="Login">
     </FORM>
 ..
</HTML>

So where am I going wrong?

Regards,

Mike.


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

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


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