[23755] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5959 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Dec 19 14:10:35 2003

Date: Fri, 19 Dec 2003 11:10:10 -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           Fri, 19 Dec 2003     Volume: 10 Number: 5959

Today's topics:
        regex formulator <vervoom@hotmail.com>
    Re: regex formulator <kurzhalsflasche@yahoo.co.uk>
    Re: regex formulator <vervoom@hotmail.com>
    Re: regex formulator <syscjm@gwu.edu>
    Re: regex formulator <krisajenkins@yahoo.co.uk>
    Re: Return all points with x km of y <ianp@pop3.myrealbox.com>
    Re: sum of numbers <uri@stemsystems.com>
    Re: sum of numbers <uri@stemsystems.com>
        SWIG  sample compile problem <NOaehlkeSPAM@greendragonsoftware.com>
    Re: SWIG  sample compile problem <peter@nospam.calweb.com>
    Re: Upload field passed through as hidden field not wor <mike@no_address.tld>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Fri, 19 Dec 2003 15:00:53 +0000
From: JS <vervoom@hotmail.com>
Subject: regex formulator
Message-Id: <brv3rm$1086$1@cspc1n11.baplc.com>

Does anyone know of a tool that can formulate regular expressions?

JS.



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

Date: Fri, 19 Dec 2003 16:22:05 +0100
From: Dominik Seelow <kurzhalsflasche@yahoo.co.uk>
Subject: Re: regex formulator
Message-Id: <brv4v4$2pab$1@gwdu112.gwdg.de>

JS wrote:

> Does anyone know of a tool that can formulate regular expressions?
> 
> JS.
> 
Yes. It's called 'brain'.

Since you'd need some kind of descriptive language anyhow to formulate
your problem in a way any software could understand, you could rather
try to understand the syntax for regular expressions.

HTH,
Dominik


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

Date: Fri, 19 Dec 2003 15:51:44 +0000
From: JS <vervoom@hotmail.com>
Subject: Re: regex formulator
Message-Id: <brv6r2$108i$1@cspc1n11.baplc.com>

Dominik Seelow wrote:
> JS wrote:
> 
> 
>>Does anyone know of a tool that can formulate regular expressions?
>>
>>JS.
>>
> 
> Yes. It's called 'brain'.
> 
> Since you'd need some kind of descriptive language anyhow to formulate
> your problem in a way any software could understand, you could rather
> try to understand the syntax for regular expressions.
> 
> HTH,
> Dominik

I thought computers were supposed to do the brainwork for us.
Anyway, I found a tool called 'The Regex Coach' which is very good at 
helping to build the expressions.




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

Date: Fri, 19 Dec 2003 11:34:42 -0500
From: Chris Mattern <syscjm@gwu.edu>
Subject: Re: regex formulator
Message-Id: <3FE328A2.4080702@gwu.edu>

JS wrote:
> Dominik Seelow wrote:
> 
>> JS wrote:
>>
>>
>>> Does anyone know of a tool that can formulate regular expressions?
>>>
>>> JS.
>>>
>>
>> Yes. It's called 'brain'.
>>
>> Since you'd need some kind of descriptive language anyhow to formulate
>> your problem in a way any software could understand, you could rather
>> try to understand the syntax for regular expressions.
>>
>> HTH,
>> Dominik
> 
> 
> I thought computers were supposed to do the brainwork for us.

No, computers do the repetitive scutwork clerical things for us.
Your computer does not think; you're going to have to do that.

             Chris Mattern

> Anyway, I found a tool called 'The Regex Coach' which is very good at 
> helping to build the expressions.
> 
> 




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

Date: Fri, 19 Dec 2003 16:55:18 +0000
From: Kris Jenkins <krisajenkins@yahoo.co.uk>
Subject: Re: regex formulator
Message-Id: <3fe32d63$0$25662$cc9e4d1f@news.dial.pipex.com>

Chris Mattern wrote:
> JS wrote:
> 
>> Dominik Seelow wrote:
>>
>>> JS wrote:
>>>
>>>
>>>> Does anyone know of a tool that can formulate regular expressions?
>>>>
>>>> JS.
>>>>
>>>
>>> Yes. It's called 'brain'.
>>>
>>> Since you'd need some kind of descriptive language anyhow to formulate
>>> your problem in a way any software could understand, you could rather
>>> try to understand the syntax for regular expressions.
>>>
>>> HTH,
>>> Dominik
>>
>>
>>
>> I thought computers were supposed to do the brainwork for us.
> 
> 
> No, computers do the repetitive scutwork clerical things for us.
> Your computer does not think; you're going to have to do that.
> 
>             Chris Mattern
> 
>> Anyway, I found a tool called 'The Regex Coach' which is very good at 
>> helping to build the expressions.
>>
>>
> 
> 
I'm looking for a tool that can formulate English expressions...then I'm 
going to catch some Zzz's.


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

Date: Fri, 19 Dec 2003 13:31:50 -0500
From: "Ian Pattison" <ianp@pop3.myrealbox.com>
Subject: Re: Return all points with x km of y
Message-Id: <brvg6r$81bpo$1@ID-200856.news.uni-berlin.de>


"Ian Pattison" <ianp@pop3.myrealbox.com> wrote in message
news:brofms$5qhfs$1@ID-200856.news.uni-berlin.de...
> Hi,
>
> I'm trying to put together what I think is a fairly complex database
query.
>
> I have a table of about 32,000 latitiude and longitude pairs and I need to
> be able to query for two different things:
>
> 1. All points that are within X kilometers (or miles for that matter) of
> coordinate Y (both are supplied from an HTML form).
> 2. The nearest X points to coordinate Y (again, supplied by a form).
>
> The first should be simple enough... I already know how to measure the
> distance between two points (once I translate all that trig into perl) so
> all I need to do is run the query and discard any result that's outside
the
> circle. The second is tougher. Does anyone know how to sort a list like
> that?
>

Hey everybody,

Thanks for all of your assistance on this one. Both for the programming
ideas as well as the geography/math lessons.

My final result: I found a module on CPAN that would do all the calculations
I needed. (Geo-Distance-0.05) and from there it was simple.

In response to Bob's question... I'm using Win32:ODBC to pull data from an
access database. Currently there are about 30 tables, each with around
32,000 rows but in essence I'm using it as a flat file. I'm still working
exactly how to get the nearest, say, 500 to a given point but finding all
the ones with X km is done.

Thanks,

Ian




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

Date: Fri, 19 Dec 2003 17:15:35 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: sum of numbers
Message-Id: <x7k74s4tl4.fsf@mail.sysarch.com>

>>>>> "T" == Tassos  <chatasos@yahoo.com> writes:

  > perl -pe 'while (<STDIN>) {$bytes += $_ }; print "$bytes\n";'
  > worked fine ;-)

why the -p which will print all the lines?

perl -lne '$sum += $_; END{ print $sum }'

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs  ----------------------------  http://jobs.perl.org


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

Date: Fri, 19 Dec 2003 17:17:31 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: sum of numbers
Message-Id: <x7hdzw4thw.fsf@mail.sysarch.com>

>>>>> "MDC" == Mike D Cross <news@cathars.plus.com> writes:

  > perl -e 'while(<>) { $a=$a+$_}; print "$a\n";exit' < list

$a += $_

and no need for exit

and -n will remove the need for the while

and no need for < before the filename as <> (or -n) will read file arg
data or stdin.

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs  ----------------------------  http://jobs.perl.org


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

Date: Fri, 19 Dec 2003 09:36:52 -0500
From: "Alex" <NOaehlkeSPAM@greendragonsoftware.com>
Subject: SWIG  sample compile problem
Message-Id: <3fe30d07$0$4736$61fed72c@news.rcn.com>

Hi,

I'm using Cygwin and ActiveState perl to try to compile a sample
application using SWIG. I'm using the short tutorial from
http://www.swig.org/tutorial.html (the perl part of it), but with a
simplified version of their example (just a void hello()
{printf("Hello, world!\n");} and corresponding .i interface file,
%module hello \ extern void hello();).

I first do swig -perl5 hello.i which works fine.
Then I do:
bash-2.05b$ gcc -c hello.c hello_wrap.c -I/cygdrive/c/perl/lib/core

Which results in (because of hello_wrap.c, created by swig):
In file included from /cygdrive/c/perl/lib/core/sys/socket.h:18,
                 from /cygdrive/c/perl/lib/core/perl.h:722,
                 from hello_wrap.c:291:
/usr/include/w32api/winsock.h:81:2: warning: #warning "fd_set and
associated mac
ros have been defined in sys/types.      This can cause runtime
problems with W3
2 sockets"
In file included from /cygdrive/c/perl/lib/core/sys/socket.h:20,
                 from /cygdrive/c/perl/lib/core/perl.h:722,
                 from hello_wrap.c:291:
/cygdrive/c/perl/lib/core/win32.h:74:20: direct.h: No such file or
directory
In file included from /cygdrive/c/perl/lib/core/sys/socket.h:20,
                 from /cygdrive/c/perl/lib/core/perl.h:722,
                 from hello_wrap.c:291:
/cygdrive/c/perl/lib/core/win32.h:361: warning: redefinition of
`caddr_t'
/usr/include/sys/types.h:112: warning: `caddr_t' previously declared
here
In file included from /cygdrive/c/perl/lib/core/win32.h:547,
                 from /cygdrive/c/perl/lib/core/sys/socket.h:20,
                 from /cygdrive/c/perl/lib/core/perl.h:722,
                 from hello_wrap.c:291:
/cygdrive/c/perl/lib/core/win32iop.h:217:1: warning: "clearerr"
redefined
In file included from /cygdrive/c/perl/lib/core/win32.h:73,
                 from /cygdrive/c/perl/lib/core/sys/socket.h:20,
                 from /cygdrive/c/perl/lib/core/perl.h:722,
                 from hello_wrap.c:291:
/usr/include/stdio.h:414:1: warning: this is the location of the
previous defini
tion
In file included from /cygdrive/c/perl/lib/core/perl.h:722,
                 from hello_wrap.c:291:
/cygdrive/c/perl/lib/core/sys/socket.h:22:1: warning: "ENOTSOCK"
redefined
In file included from /usr/include/errno.h:9,
                 from /cygdrive/c/perl/lib/core/perl.h:715,
                 from hello_wrap.c:291:
/usr/include/sys/errno.h:119:1: warning: this is the location of the
previous de
finition



I've got the latest cygwin, perl v5.6.1 built for
MSWin32-x86-multi-thread build 633 from activestate, and the latest
swigwin (swig for windows). I'm on WinXP.

Anyone have any idea what's going on? I've read lots of documentation
and searched google to no avail. Any help would be greatly
appreciated!

Thanks,
Alex




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

Date: Fri, 19 Dec 2003 10:05:34 -0800
From: Penguinista <peter@nospam.calweb.com>
Subject: Re: SWIG  sample compile problem
Message-Id: <3fe33ce7$0$7518$d368eab@news.calweb.com>

Alex wrote:
> Hi,
> 
> I'm using Cygwin and ActiveState perl to try to compile a sample
> application using SWIG. I'm using the short tutorial from
> http://www.swig.org/tutorial.html (the perl part of it), but with a
> simplified version of their example (just a void hello()
> {printf("Hello, world!\n");} and corresponding .i interface file,
> %module hello \ extern void hello();).
> 
> I first do swig -perl5 hello.i which works fine.
> Then I do:
> bash-2.05b$ gcc -c hello.c hello_wrap.c -I/cygdrive/c/perl/lib/core
> 
> Which results in (because of hello_wrap.c, created by swig):
> In file included from /cygdrive/c/perl/lib/core/sys/socket.h:18,
>                  from /cygdrive/c/perl/lib/core/perl.h:722,
>                  from hello_wrap.c:291:
> /usr/include/w32api/winsock.h:81:2: warning: #warning "fd_set and
> associated mac
> ros have been defined in sys/types.      This can cause runtime
> problems with W3
> 2 sockets"

what happens if you comment out the '#include <sys/types.h>' ?

> In file included from /cygdrive/c/perl/lib/core/sys/socket.h:20,
>                  from /cygdrive/c/perl/lib/core/perl.h:722,
>                  from hello_wrap.c:291:
> /cygdrive/c/perl/lib/core/win32.h:74:20: direct.h: No such file or
> directory

direct.h, I believe, is a windows specific include file.  I suggest 
using the find utility and add the path to the includepaths.

> In file included from /cygdrive/c/perl/lib/core/sys/socket.h:20,
>                  from /cygdrive/c/perl/lib/core/perl.h:722,
>                  from hello_wrap.c:291:
> /cygdrive/c/perl/lib/core/win32.h:361: warning: redefinition of
> `caddr_t'
> /usr/include/sys/types.h:112: warning: `caddr_t' previously declared
> here
> In file included from /cygdrive/c/perl/lib/core/win32.h:547,
>                  from /cygdrive/c/perl/lib/core/sys/socket.h:20,
>                  from /cygdrive/c/perl/lib/core/perl.h:722,
>                  from hello_wrap.c:291:
> /cygdrive/c/perl/lib/core/win32iop.h:217:1: warning: "clearerr"
> redefined
> In file included from /cygdrive/c/perl/lib/core/win32.h:73,
>                  from /cygdrive/c/perl/lib/core/sys/socket.h:20,
>                  from /cygdrive/c/perl/lib/core/perl.h:722,
>                  from hello_wrap.c:291:
> /usr/include/stdio.h:414:1: warning: this is the location of the
> previous defini
> tion

Another case of redundent includes.  perl defines alot of stuff for 
itself rather than depending on system include files.

> In file included from /cygdrive/c/perl/lib/core/perl.h:722,
>                  from hello_wrap.c:291:
> /cygdrive/c/perl/lib/core/sys/socket.h:22:1: warning: "ENOTSOCK"
> redefined
> In file included from /usr/include/errno.h:9,
>                  from /cygdrive/c/perl/lib/core/perl.h:715,
>                  from hello_wrap.c:291:
> /usr/include/sys/errno.h:119:1: warning: this is the location of the
> previous de
> finition
> 
> 
> 
> I've got the latest cygwin, perl v5.6.1 built for
> MSWin32-x86-multi-thread build 633 from activestate, and the latest
> swigwin (swig for windows). I'm on WinXP.
> 
> Anyone have any idea what's going on? I've read lots of documentation
> and searched google to no avail. Any help would be greatly
> appreciated!
> 
> Thanks,
> Alex
> 
> 



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

Date: Fri, 19 Dec 2003 16:33:40 GMT
From: "M" <mike@no_address.tld>
Subject: Re: Upload field passed through as hidden field not working
Message-Id: <ELFEb.401625$Dw6.1249677@attbi_s02>


"Julia deSilva" <jds@nospantrumpetweb.co.uk> wrote in message
news:jBCEb.4812$C71.4122@news-binary.blueyonder.co.uk...
> Hi there all,
>
> Perl cgi.pm file upload
>
> Got 1 and 2 above working but when I try to pass through
> print"<input type='hidden' name='file' value='$file'>\n";
>
> Is there a way around this or am I doing something wrong?
>

this is an html issue, not a perl issue.
that said, to upload a file as a form field, you need:
enctype="multipart/form-data" on your form,
input type=file
and you can't hide it or prepopulate the file field.





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

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


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