[13687] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1097 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Oct 17 02:05:26 1999

Date: Sat, 16 Oct 1999 23:05:09 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <940140309-v9-i1097@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Sat, 16 Oct 1999     Volume: 9 Number: 1097

Today's topics:
    Re: [iterative] pattern matching <bwalton@rochester.rr.com>
    Re: ADO using AddNew from Perl <dochood@earthlink.net>
        building extensions on win32 tetragramaton@my-deja.com
        Can I get STDERR on an input pipe? <brianc@palaver.net>
    Re: Can I get STDERR on an input pipe? (Abigail)
    Re: can i make a cgi run it self (Brett W. McCoy)
        crypt() in current GS release on win32? <dtbaker_@busprod.com>
    Re: crypt() in current GS release on win32? (Larry Rosler)
    Re: crypt() in current GS release on win32? (Matthew Bafford)
        Data structure problem. Please help! <zzhang@bayou.uh.edu>
    Re: Determining the connection speed to the Internet <flavell@mail.cern.ch>
    Re: Difference between a string and an int (Philip 'Yes, that's my address' Newton)
    Re: Displaying 2 digits in time (Larry Rosler)
    Re: File Locking in Win32 PerlScript. <bwalton@rochester.rr.com>
    Re: GD-1.22 Windows build? (Steve Siegel)
    Re: Grabbing image size? (Martien Verbruggen)
    Re: Help with extracting a portion of a string (Sam Holden)
    Re: How to install GD.PM <bwalton@rochester.rr.com>
    Re: How to install GD.PM harris_m@my-deja.com
    Re: Need help with seek/sysseek (Kragen Sitaker)
        Perl script taking regex as argument? <gstoll@rice.edu>
    Re: Perl script taking regex as argument? (Abigail)
    Re: Random string (Peter J. Kernan)
    Re: Random string (Larry Rosler)
        REGEXP for SQL code replacement query. <webresearch@indy-soft.com>
    Re: retrieve url from hypertext (Kragen Sitaker)
    Re: retrieve url from hypertext <hxshxs@my-deja.com>
    Re: Server Push! (David Efflandt)
        Tape Retensioning Under Win32 (David Moore)
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Sat, 16 Oct 1999 23:32:30 -0400
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: [iterative] pattern matching
Message-Id: <3809434E.E7CCEBFB@rochester.rr.com>

berkan@my-deja.com wrote:
> 
> Hi,
> 
> Problem:
> 
> I have a string:  $string = "babbbab";
> 
> I want to find all possible ways of matching the pattern
> b+ab+ on $string, put brackets around the match (ie create
> a new string with s//g), and store all the new strings in
> an array so that my array at the end looks like this:
> 
> @array = ("[babbb]ab", "[babb][bab]", "[bab][bbab]");
> 
> Knowing that the perl engine uses an NFA to do pattern
> matching, is there a way to utilize it so that it returns
> all possible matches (maybe iteratively) until it runs
> out? (as opposed to running in one of the greedy or
> minimalist modes and returning just one match).
> 
> The problem above is just an example. I would like to have
> this functionality for any string and pattern. Any ideas?
 ...

Berkan, I'm not sure the following is getting at what you want,
but maybe it'll get you started:

$string = "babbbab";
$pat=qr(b+ab+);
while($string=~/(?=($pat))/g){$a[$i++]=$1}
for(@a){print "$_\n"}

That will show all the places a pattern $pat can match a string
$string.  For your example, it prints:

babbb
bbbab
bbab
bab

-- 
Bob Walton


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

Date: Sat, 16 Oct 1999 20:04:51 -0500
From: "Daniel 'Doc' Sewell" <dochood@earthlink.net>
Subject: Re: ADO using AddNew from Perl
Message-Id: <7ub6nh$t4d$1@birch.prod.itd.earthlink.net>

I answered my own question, thank you very much!

On this line:

>$rs->Open("Customers", $conn, adOpenKeyset, adLockOptimistic, adCmdTable)
||
>die "Opening Recordset $!";

I removed the "die" clause, and it worked!!!  I'm not exactly sure why it
didn't work, but it must have something to do with the return type of
$rs->Open not being compatible with a boolean.  I added code to check the
Win32::OLE::LastError instead, and it works like a charm!


Daniel "Doc" Sewell
dochood at earthlink dot net



Daniel 'Doc' Sewell wrote in message
<7u8e9o$gam$1@holly.prod.itd.earthlink.net>...
>Hello, All!
>
>    I've been trying (very unsuccessfully) to get a Perl Script to update
an
>Access 97 database using ADO and the AddNew method.  I need to use AddNew
>because Access 97 assigns a unique ID to the row, which I immediately need
>to grab.  My examples using an INSERT sql statement worked okay, but since
>I'm not inserting any data guaranteed to be unique, I can't lookup the ID
>subsequently.
>
>    The error I keep getting is when I do an Open on the recordset:
>
>
>#use Win32::ADO;
>#
># Database connectivity variables
>#
>
>my $conn;
>my $rs;
>my $sql;
>
>
>$conn = CreateObject OLE "ADODB.Connection" ||
>  die "CreateObject : $!";
>
>$conn->Open('SaleDB'); # DB is a System DSN... works when I do query on
same
>DB
>
>$rs = CreateObject OLE "ADODB.RecordSet" || die "Creating Recordset $!";
>
>#dies on the next line... Customers is the table in the SaleDB database
>$rs->Open("Customers", $conn, adOpenKeyset, adLockOptimistic, adCmdTable)
||
>die "Opening Recordset $!";
>
>
>$rs->AddNew;
>
>$rs->fields("EMail")->{value}     = $EMail_Address;
>
>$rs->Update;
>
>$rs->Close;
>$conn->Close;
>
>    I'd appreciate any help anyone can give.
>
>
>Thanks,
>
>Daniel "Doc" Sewell
>dochood at earthlink dot net
>
>P.S.  I've looked at about all of the examples on the Internet that I could
>find, and none of them were helpful.
>
>
>





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

Date: Sun, 17 Oct 1999 05:27:53 GMT
From: tetragramaton@my-deja.com
Subject: building extensions on win32
Message-Id: <7ubmok$bpr$1@nnrp1.deja.com>

Hi,
I'm not a perl hacker, but I'm trying to use swig to produce a perl
extension wrapper for a C library. This works on linux and other
versions of unix with no problem, but for some reason, I can't get it to
 compile correctly on windows. I can't afford MS VC++ so I'm using
cygwin and mingw32.

My question is: where can I get a set of perl header files that either
cygwin or mingw32 will accept?

Any ideas?
Thanks a lot,
Mike


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Sun, 17 Oct 1999 00:14:40 -0500
From: Brian Capouch <brianc@palaver.net>
Subject: Can I get STDERR on an input pipe?
Message-Id: <38095B40.E1E860E@palaver.net>

This seems like it should be so simple.  I'm giving up after about four
straight hours of misery.

I want to attach a filehandle to a pipe, but the program I am running is
sending its output down STDERR instead of STDOUT. I have no control of
the program that I'm trying to read from.

The stuff the program is writing to STDERR just comes crashing out on my
terminal.  Is there any way I can read this into variables in a
controlled manner?

Thanks in advance for any help with this mess.

B.


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

Date: 17 Oct 1999 00:41:43 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Can I get STDERR on an input pipe?
Message-Id: <slrn80ioc2.q8s.abigail@alexandra.delanet.com>

Brian Capouch (brianc@palaver.net) wrote on MMCCXXXVIII September
MCMXCIII in <URL:news:38095B40.E1E860E@palaver.net>:
;; This seems like it should be so simple.  I'm giving up after about four
;; straight hours of misery.
;; 
;; I want to attach a filehandle to a pipe, but the program I am running is
;; sending its output down STDERR instead of STDOUT. I have no control of
;; the program that I'm trying to read from.
;; 
;; The stuff the program is writing to STDERR just comes crashing out on my
;; terminal.  Is there any way I can read this into variables in a
;; controlled manner?


Did you read perlopentut?


Abigail
-- 
%0=map{reverse+chop,$_}ABC,ACB,BAC,BCA,CAB,CBA;$_=shift().AC;1while+s/(\d+)((.)
(.))/($0=$1-1)?"$0$3$0{$2}1$2$0$0{$2}$4":"$3 => $4\n"/xeg;print#Towers of Hanoi


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: Sun, 17 Oct 1999 02:30:51 GMT
From: bmccoy@foiservices.com (Brett W. McCoy)
Subject: Re: can i make a cgi run it self
Message-Id: <slrn80idf3.8df.bmccoy@moebius.foiservices.com>

Also Sprach Yuval Hamberg <yhm@inter.net.il>:

>Can I make a CGI script run let say at 11:55PM every night automatically?

Depends on whether or not your operating system will let you run regularly
scheduled processes.

-- 
Brett W. McCoy                             bmccoy@foiservices.com
Computer Operations Manager (Alpha Geek)   http://www.foiservices.com
FOI Services, Inc./DIOGENES                301-975-0110
---------------------------------------------------------------------------


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

Date: Sat, 16 Oct 1999 22:47:39 -0500
From: Dan Baker <dtbaker_@busprod.com>
Subject: crypt() in current GS release on win32?
Message-Id: <380946DB.14CEA033@busprod.com>



Matthew Bafford wrote:
> 
> On Sat, 16 Oct 1999 14:22:52 -0500, Dan Baker <dtbaker_@busprod.com>
> spewed forth:
> : Tom Phoenix wrote:
> : > If you get your Win32 Perl from ActiveState, I'm told that you get crypt
> : > with it automatically.
> :                                                              Does anyone
> : know if it is included in the current GS release for win32?
> 
> ActiveState's release is the current GS release for win32.
--------------

??? All I know is that it NOT in my 5.004_02
I realize this is not the *current* release, but was hoping not to have
to switch versions yet. I guess I will if I have to...

Could someone who HAS the current pre-compiled win32 perl post a
followup as whether crypt() is included for sure?

Dan


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

Date: Sat, 16 Oct 1999 22:20:38 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: crypt() in current GS release on win32?
Message-Id: <MPG.1272fc7c8499e73b98a0a8@nntp.hpl.hp.com>

In article <380946DB.14CEA033@busprod.com> on Sat, 16 Oct 1999 22:47:39 
-0500, Dan Baker <dtbaker_@busprod.com> says...

 ...

> Could someone who HAS the current pre-compiled win32 perl post a
> followup as whether crypt() is included for sure?

Yes, it is included.  For sure.

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Sun, 17 Oct 1999 05:41:56 GMT
From: *@dragons.duesouth.net (Matthew Bafford)
Subject: Re: crypt() in current GS release on win32?
Message-Id: <slrn80iniu.ps.*@dragons.duesouth.net>

On Sat, 16 Oct 1999 22:47:39 -0500, Dan Baker <dtbaker_@busprod.com> cut
a telephone line, and tapped the following to comp.lang.perl.misc using
only his tongue: 
: Matthew Bafford wrote:
: > On Sat, 16 Oct 1999 14:22:52 -0500, Dan Baker:
: > ActiveState's release is the current GS release for win32.
: ??? All I know is that it NOT in my 5.004_02

5.004_02 is not current.

ActiveState currently employs GS.

ActiveState's release is the current GS release.

:                                              but was hoping not to have
: to switch versions yet. I guess I will if I have to...

Why don't you want to switch versions?  Perl is Perl.  The two should be
(at least mostly) compatible.

HTH,

: Dan

--Matthew


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

Date: Sun, 17 Oct 1999 00:51:42 -0500
From: Zhengdong Zhang <zzhang@bayou.uh.edu>
Subject: Data structure problem. Please help!
Message-Id: <380963EE.3D27A67D@bayou.uh.edu>

The hash %selected_individuals has a even number of  key-value pairs.
The key is a common integer. The value is an array reference. Every
array element is a hash reference. This hash has one key-value pair.
I want to do a crossover on every pair of the arrays(cut each array into
two peices, stick two peices from difference arrays on different sides
together: a1b1 x a2b2 -> a1b2, a2b1). I used the following code:

    @k = keys %selected_individuals;
    $i = 0;
    for ($i = 0; $i < @k; $i+=2)
    {
         $cross_point = int(rand(2 * $num_oth)); ### randomly pick a
crossover point.

         for $j (0..$cross_point)
           {
                  %temp = %{$selected_individuals{$k[$i]}->[$j]};
### line 214
                  $selected_individuals{$k[$i]}->[$j]  =
$selected_individuals{$k[$i + 1]}->[$j];
                  $selected_individuals{$k[$i + 1]}->[$j]  = \%temp;
           }
    }

The function which has this code is called in a loop. Usually when it
was called the second or the third time I got an error message like
this:
Can't use an undefined value as a HASH reference at ./ep1 line 214,
<STDIN> chunk 1.

Your suggestion will be appreciated.

Thanks,

Zhengdong Zhang
zzhang@bayou.uh.edu



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

Date: Sun, 17 Oct 1999 03:28:19 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Determining the connection speed to the Internet
Message-Id: <Pine.HPP.3.95a.991017031647.776B-100000@hpplus01.cern.ch>

On 16 Oct 1999, Abigail wrote:

> && But if you want, for example, to advise your user how long their
> && download is going to take (30 seconds or 30 minutes can make a
> && significant difference!) you need to do it before they actually try it. 
> 
> Since you cannot know it, as you cannot even *know* the destination
> (sure you have heard of proxies? ;-)), this "timing information" is
> best left to the client.

That f'up of mine was rather a mess, I must admit.  I dealt with two
issues without making it clear that they were meant to be separate.

It had been claimed that by using ping you can't deduce anything about
the throughput.  In fact that isn't quite true: you can make some
estimates that often turn out to be fairly realistic.  OK, you're right
that networks are getting increasingly selective and can handle
different kinds of traffic in very different ways. 

However, I should have said outright that I really didn't think this was
an appropriate thing to do between a web server and some random client
user who is considering a download.  I _can_ think of situations where
it would be useful (alerting a mirror manager to the fact that the
network has deteriorated and the night's run is going to be a problem,
say). (Yeah, OK, there are cleverer ways to manage a mirror...) 

But I then stumbled on and addressed a quite different issue,
as you have quoted above.  It then looked as if I was advocating doing
this, which actually I hadn't intended to.

Sorry.  I think I'll shut up now - it's late.



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

Date: Sat, 16 Oct 1999 08:07:13 GMT
From: nospam.newton@gmx.net (Philip 'Yes, that's my address' Newton)
Subject: Re: Difference between a string and an int
Message-Id: <3808237e.571288204@news.nikoma.de>

On 14 Oct 1999 13:02:07 GMT, hymie@lactose.smart.net (hymie!) wrote:

>49 is unambiguously an integer less than 256.  But is '1' an integer less
>than 256, or is it a single character whose value is 49?

I think you've been programming too much C. '1' in Perl is either an
integer less than 256, or a string with one character. Perl doesn't
have characters the way C does -- "1" and '1' are the same in Perl
(two strings) but different in C (a string and a character,
respectively).

You can use ord('1') to get 49, but that also works on ord("1") or
ord(substr('1',0,1)) or similar.

5 < 256 but '5' gt '256'.

Cheers,
Philip
-- 
Philip Newton <nospam.newton@gmx.net>


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

Date: Sat, 16 Oct 1999 18:59:17 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Displaying 2 digits in time
Message-Id: <MPG.1272cd4d718e13f398a0a7@nntp.hpl.hp.com>

In article <slrn80i132.311.efflandt@efflandt.xnet.com> on 16 Oct 1999 
23:03:33 GMT, David Efflandt <efflandt@xnet.com> says...

 ...

> But on a Unix system it would be much easier to do this:
> 
> use POSIX qw(strftime);
> $ltime = strftime "%H:%M %A %d %b %G",localtime;
> $gtime = strftime "%H:%M %A %d %b %G",gmtime;
> print "Localtime: $ltime\nUTC time: $gtime\n";

Ahem.  Being on a Unix system has very little to do with it.  Here is 
the description of the POSIX module:

NAME
POSIX - Perl interface to IEEE Std 1003.1 

For reasons of commercial viability, most modern systems implement the 
POSIX standard.  The POSI part stands for Portable Operating System 
Interface.  uniX is there at the tail end.

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Sun, 17 Oct 1999 00:05:49 -0400
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: File Locking in Win32 PerlScript.
Message-Id: <38094B1D.D556E4@rochester.rr.com>

epan@my-deja.com wrote:
> 
> If I am to open a file for input in an ASP page
> 
> <%
> open(FILE, ">>test.txt");
> print FILE "Testing only.\n";
> close(FILE);
> %>
> 
> and there are a few users opening the page at the same time. Will the
> file be locked until a user has closed the FILEHANDLE? If yes, it will
> be a problem if 100 user open the page at the same time. Is there a
> solution if that's the case?
 ...
If you're running NT, see the "flock" function in perlfunc.  If you
are running other versions of Win32, you are probably out of luck,
as "flock" doesn't seem to work on Win9x.
-- 
Bob Walton


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

Date: Sun, 17 Oct 1999 01:00:10 GMT
From: stevesny@ibm.net (Steve Siegel)
Subject: Re: GD-1.22 Windows build?
Message-Id: <38091e98.723886@news1.ibm.net>

use GD;
        
Hi Randy,

Active state's 1.22 GD doesn't seem to -- or perhaps I have written the program wrong.
It's launched, BTW, with: perl filename.pl > temp.png. Works with a string, but not TTF.
The example was copied directly from the accompanying HTML file, then modified for
strings/ttf, if anyone cares to look at it.

Thanks, Steve





 # create a new image
    $im = new GD::Image(100,100);

    # allocate some colors
    $white = $im->colorAllocate(255,255,255);
    $black = $im->colorAllocate(0,0,0);       
    $red = $im->colorAllocate(255,0,0);      
    $blue = $im->colorAllocate(0,0,255);

    # make the background transparent and interlaced
    $im->transparent($white);
    $im->interlaced('true');

    #=========
    
    #$im->stringTTF(fgcolor,fontname,ptsize,angle,x,y,string) Object Method @bounds =
    #$im->stringTTF(fgcolor,fontname,ptsize,angle,x,y,string) Class Method 

    #This method uses TrueType to draw a scaled, antialiased string using the TrueType
vector font of your choice. It
    #requires that libgd to have been compiled with TrueType support, and for the
appropriate TrueType font to be
    #installed on your system. 

    #The arguments are as follows: 

     # fgcolor    Color index to draw the string in
      #fontname   An absolute or relative path to the TrueType (.ttf) font file
      #ptsize     The desired point size (may be fractional)
      #angle      The rotation angle, in radians
      #x,y        X and Y coordinates to start drawing the string
      #string     The string itself
    #========
    
    $im->stringTTF($black,"C:\Windows\Fonts\ARIAL.TTF",12,0,2,10,"test");
    #$im->string(gdSmallFont,2,10,"test",$black);

    # make sure we are writing to a binary stream
    binmode STDOUT;

    # Convert the image to PNG and print it on standard output
    print $im->png;


"Randy Kobes" <randy@theory.uwinnipeg.ca> wrote:

>
>Steve Siegel <stevesny@ibm.net> wrote in
>   message news:38081318.32698500@news1.ibm.net...
>> Does anyone know of a GD-1.22 (with True Type fonts) complete windows
>build?
>
>Hi,
>    If ActiveState's GD build doesn't include ttf support, search deja-news
>for a recent thread on trying to build your own under Windows.
>
>best regards,
>Randy Kobes
>
>
>



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

Date: 17 Oct 1999 02:42:33 GMT
From: mgjv@wobbie.heliotrope.home (Martien Verbruggen)
Subject: Re: Grabbing image size?
Message-Id: <slrn80idte.s7e.mgjv@wobbie.heliotrope.home>

On 16 Oct 1999 22:31:17 GMT,
	Stuart Yeates <syeates@manuka.cs.waikato.ac.nz> wrote:
> Tom Phoenix <rootbeer@redcat.com> wrote:
> : On Fri, 15 Oct 1999 fharris@xmission.com wrote:
> 
> :> I'm interested in being able to grab the image dimensions from a .GIF
> :> or .JPG picture using Perl.  Anyone know how to do this?
> 
> : If there's a module which does what you want, it should be listed in
> : the module list on CPAN. If you don't find one to your liking, you're
> : welcome and encouraged to submit one! :-)  Hope this helps!
> 
> :     http://www.cpan.org/
> 
> try the gimp package. it's an interface to the complete 
> functionality of the Gnu Image Manipulation Program. It
> can do almost anything with images

You just advised someone to install the complete GIMP and the perl
interface to it, just to get image sizes for GIF or JPEG images.

What about Image::Size?

Q: "I need to visit my aunt, who lives in the next block"

A: "Buy a bulldozer. Flatten the block on the other side. Buy a
concrete mixer. Create long narrow strips of concrete on that
flattened block. Wait for concrete to dry. Buy a plane, preferrably a
large and powerful one. Buy fuel. Load plane with fuel. Get pilot
licenses. Fly plane around the block three or four times. Land. Walk
two block up, past your house."

A2: "Walk"

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | Useful Statistic: 75% of the people make up
Commercial Dynamics Pty. Ltd.   | 3/4 of the population.
NSW, Australia                  | 


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

Date: 17 Oct 1999 01:50:40 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: Help with extracting a portion of a string
Message-Id: <slrn80iarg.96l.sholden@pgrad.cs.usyd.edu.au>

On Sat, 16 Oct 1999 09:00:57 GMT, Brandon <pooka@cygnus.ucdavis.edu> wrote:

<snip pointless 'proof' that HTML comments are regular>

Well that was completely usless.

An HTML comment is a regular language. That's good. If you ever get an HTML
file that consists entirely of comments then you will be able to extract
them. Congratulations. BFD.


-- 
Sam

Perl was designed to be a mess (though in the nicest of possible ways). 
	--Larry Wall


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

Date: Sat, 16 Oct 1999 22:35:02 -0400
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: How to install GD.PM
Message-Id: <380935D6.5E101BC7@rochester.rr.com>

"Graham W. Boyes" wrote:
> 
> Hello,
> I want to create a gif image from some other images.  These images will
> be bundled together side by side.  I have been trying to use the GD.PM
> module, but am having trouble installing it, even the demos won't
> work.  I am using Hypermart, if that is any help.
> Any help would be much appreciated,
> Graham W. Boyes
 ...
Graham, you'll have to be a lot more specific before anyone can
help you.  What is your OS?  Its version?  What trouble are you
having installing it?  Do you get an error message?  If so, what
does it say?  What version of Perl?  What version of GD?  The only
thing I can tell you is that if you are running Win32 and you want
to use GD to generate GIF's, you will (to the best of my knowledge)
need to get the Perl Resource Kit for Win32 in order to get a copy
of GD that includes GIF support.  The current ActiveState version
of GD doesn't seem to include GIF support.


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

Date: Sun, 17 Oct 1999 03:21:47 GMT
From: harris_m@my-deja.com
Subject: Re: How to install GD.PM
Message-Id: <7ubfc4$7e4$1@nnrp1.deja.com>

Be more specific, if you want helpful answer. Which platform you are
using? Win, Unix or something else? What is exactly error message when
you install the GD package?

I am been using GD on Win-NT and is working great.
Harris M.
--------------------
In article <7ub0jp$upd$1@nnrp1.deja.com>,
  Graham W. Boyes <me@toao.net> wrote:
> Hello,
> I want to create a gif image from some other images.  These images
will
> be bundled together side by side.  I have been trying to use the GD.PM
> module, but am having trouble installing it, even the demos won't
> work.  I am using Hypermart, if that is any help.
> Any help would be much appreciated,
> Graham W. Boyes
>
>


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Sun, 17 Oct 1999 00:12:58 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: Need help with seek/sysseek
Message-Id: <ew8O3.10809$E_1.543829@typ11.nn.bcandid.com>

In article <7u9t3a$90a$1@nnrp1.deja.com>,
Shawn Collenburg  <greynite@mindspring.com> wrote:
>Could anyone tell me why the following program does not work?

Rule 1 of asking for tech help: Never, ever, ever say "does not work".
Instead, say, "I was trying to do X by doing Y but instead of X I got
Z."

Rule 2: be very specific about Z, most particularly including error
messages character-for-character.

>if ( open(FILE,"|which perl.exe") ) {
>  while (<FILE>) {
>    print "$_$cgi";
>  }
>}

You're opening a pipe to feed input to a command that doesn't take
input, and sends its output to the same output that you're writing to,
and then you try to read from this filehandle you've opened for write.

>open FILE,"+>>seektest1.txt";

Bad syntax.

>print "Seek 1 rc=".seek(FILE, 0, 0)."\n$cgi";
>print FILE "12345\n\n";

You're seeking for write on a file open for append.

Beyond that, I got tired of reading.

-- 
<kragen@pobox.com>       Kragen Sitaker     <http://www.pobox.com/~kragen/>
Sat Oct 16 1999
24 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>


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

Date: Sat, 16 Oct 1999 22:47:08 -0500
From: Gregory Stoll <gstoll@rice.edu>
Subject: Perl script taking regex as argument?
Message-Id: <380946BC.2C06DD05@rice.edu>

Hi all!  I'm trying to write a little Perl script (haven't used Perl for
very long), and I'd like to have it take a filename and a regex as
arguments.  The problem is, perl tries to interpret the regex as a file
and complains when it can't find it.  Is there some way to take a regex?
(a reference to a perldoc is just fine - as a sidenote, is there any way
to view all the perldoc files available?)  I'm running perl 5.005 on a
Linux box...Thanks for your help!  :-)

-Greg

-----------------------
Gregory Stoll
gregstoll@earthling.net
"I know who I am."
Check out Greg's Bridge Page!
http://www.math.swt.edu/~gs39947/bridge.html




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

Date: 17 Oct 1999 00:43:45 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Perl script taking regex as argument?
Message-Id: <slrn80iofp.q8s.abigail@alexandra.delanet.com>

Gregory Stoll (gstoll@rice.edu) wrote on MMCCXXXVIII September MCMXCIII
in <URL:news:380946BC.2C06DD05@rice.edu>:
__ Hi all!  I'm trying to write a little Perl script (haven't used Perl for
__ very long), and I'd like to have it take a filename and a regex as
__ arguments.  The problem is, perl tries to interpret the regex as a file
__ and complains when it can't find it.  Is there some way to take a regex?

qr//

__ (a reference to a perldoc is just fine - as a sidenote, is there any way
__ to view all the perldoc files available?)

Of course. "man perl".



Abigail
-- 
perl -e 'for (s??4a75737420616e6f74686572205065726c204861636b65720as?;??;??) 
             {s?(..)s\??qq \?print chr 0x$1 and q ss\??excess}'


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: 17 Oct 1999 03:58:21 GMT
From: pete@theory2.phys.cwru.edu (Peter J. Kernan)
Subject: Re: Random string
Message-Id: <slrn80iiat.htm.pete@theory2.phys.cwru.edu>

On Fri, 15 Oct 1999 15:39:13 -0700, Larry Rosler <lr@hpl.hp.com> wrote:
 .=
 .=my $string = join "", map $chars[rand @chars], 1, 2;
 .=
thats a nice way to play the hole. In a practice round one might
  my $string = join "", map @$_[rand @$_],(\@chars)x2;
But in a match
  (my $string =aa)=~s/./$chars[rand @chars]/eg;
halves the hole.

-- 
  Pete


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

Date: Sat, 16 Oct 1999 22:45:04 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Random string
Message-Id: <MPG.1273023812c1b71898a0a9@nntp.hpl.hp.com>

In article <slrn80iiat.htm.pete@theory2.phys.cwru.edu> on 17 Oct 1999 
03:58:21 GMT, Peter J. Kernan <pete@theory2.phys.cwru.edu> says...
> On Fri, 15 Oct 1999 15:39:13 -0700, Larry Rosler <lr@hpl.hp.com> wrote:
> ..=
> ..=my $string = join "", map $chars[rand @chars], 1, 2;
> ..=
> thats a nice way to play the hole. In a practice round one might
>   my $string = join "", map @$_[rand @$_],(\@chars)x2;

     my $string = join "", map @$_[rand @$_], (\@chars) x 2;

Ugh.  Space it out right, and it loses big (by three :-).

> But in a match
>   (my $string =aa)=~s/./$chars[rand @chars]/eg;
> halves the hole.

Barewords are out of bounds.  Unfortunately, I can fix that.

Stripping the whitespace, you win by one.  :-(

my$string=join"",map$chars[rand@chars],1,2;

(my$string=10)=~s/./$chars[rand@chars]/eg;

But nicely spaced, you win by four.  :-(  :-(

my $string = join "", map $chars[rand @chars], 1, 2;

(my $string = 10) =~ s/./$chars[rand @chars]/eg;

Cheers!

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Sun, 17 Oct 1999 04:27:39 GMT
From: "Web Research" <webresearch@indy-soft.com>
Subject: REGEXP for SQL code replacement query.
Message-Id: <%ecO3.5364$PV2.67638@news.rdc1.tn.home.com>

I work as a webdesigner and beta tester in a software development company.
Today one of the Delphi programmers came across a problem too large and time
consuming for a manual cut & paste, but too difficult to write a text
parsing routine to handle either.

He knew I use Perl for web development and I asked to take an uneducated
shot at it. We got pretty close, but I came across a few quirky problems and
ultimately had to give it up as we were on time restraints. I'm still very
limited in the REGEXP area, just like anyone else.. I can't let go of not
being able to pull it off. I was wondering if anyone could offer insight
into making my first attempt a bit better.

The Problem...

Conversion to a new SQL database platform requires a special lock procedure
to be placed some 800 different times in a source file (comprising of text
only). The code uses ; just like Perl to declare an end of line.

Original line (these differ wildly!, but core structure exists in all)...

 wwqLOOKUP.SQL.Add('SELECT * FROM ' + DM1.TriDef1.sOwner +
         'GAGELEN WHERE  '  +  'GAGELEN1=''' + DM1.TriDef1.sUserName + ''''
+
         DM1.TriDef1.sIsolation);


must be converted to...

 wwqLOOKUP.SQL.Add('SELECT * FROM ' + DM1.TriDef1.sOwner +
         'GAGELEN ' + DM1.TriDef1.sNoLock + ' WHERE '  +  'GAGELEN1=''' +
DM1.TriDef1.sUserName + '''' +
         DM1.TriDef1.sIsolation);

where basically ...

s/WHERE/' + DM1.TriDef1.sNoLock + 'WHERE/

Key elements...

1) I decided to look between ; since that would pretty much give me a 'line
by line' look at the code.

2) The line always contains a SELECT statement

3) The line always contains a WHERE statement

4) The line always (unless the programmer goofed) contains sIsolation near
the end of the line.

Problems...

1) There is not always a space before 'THING WHERE' .. it can appear as
'WHERE (no space after single quote) or...
'(sp)WHERE' one space before quote.

My first pass...

#!/usr/bin/perl
use lib 'C:/perlscripts/lib/';
use File::Find;
use File::Slurp;

find &resort, 'c:/renametest/pas/';

sub resort {
  return sub {
    my $curr_file = '';
    my $pagelines = '';
 ($curr_file) = $_;

    return if (-z "$curr_file"); # fix for "." problem on Win32

 print "Opening " . $_ . "\n";

    $pagelines = read_file($curr_file);

 $pagelines =~ s/(\;.*?)(SELECT)(.*?)(\'||\s*)WHERE(.*?sIsolation.*?\;)/$1\'
\+ DM1\.TriDef1\.sNoLock \+ \'WHERE$2/sg;

 open (REBUILT_FILE, ">$curr_file");
    seek SESSIONFILE, 0, 2;
    print REBUILT_FILE $pagelines;
    close REBUILT_FILE;
  }
}

-----

This got alot of them.. however we really screwed up with the case of 'WHERE
verses ' WHERE (backups.. of course!) We should probably test for...

'WHERE  - quote no space
' WHERE - quote with space
 WHERE - just space

What might I do here to and an OR situation and conditional replacement on
that OR to get the overall code I am looking for?

Also.. how did I do for my first 'more difficult' regexp?

Rusman




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

Date: Sun, 17 Oct 1999 00:26:23 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: retrieve url from hypertext
Message-Id: <PI8O3.10820$E_1.560087@typ11.nn.bcandid.com>

In article <7u9cg3$vmm$1@nnrp1.deja.com>,
Howard Sun  <hxshxs@my-deja.com> wrote:
>just started learning Perl. not sure how to do the following,
>
>extract all URLs within the hypertext.
>
>if I use
>if(/<a href="?.*"?>/) {
>       $link = $&;
>}
>
>it can only display <a href="http://......"> part, not the real url.
>real URL maynot start with http or end with html.

You want /<a href="?(.*)"?>/, and $1 instead of $&.  Not perfect, but
it probably does an OK job on real-world HTML.

Oh, and you probably want while (/pat/g) { } instead of if (/pat/) { }.

You should probably pay attention to the people who were recommending
modules.


-- 
<kragen@pobox.com>       Kragen Sitaker     <http://www.pobox.com/~kragen/>
Sat Oct 16 1999
24 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>


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

Date: Sun, 17 Oct 1999 02:41:39 GMT
From: Howard Sun <hxshxs@my-deja.com>
Subject: Re: retrieve url from hypertext
Message-Id: <7ubd12$60f$1@nnrp1.deja.com>

In article <7u9cg3$vmm$1@nnrp1.deja.com>,
  Howard Sun <hxshxs@my-deja.com> wrote:
> just started learning Perl. not sure how to do the following,
>
> extract all URLs within the hypertext.
>
> if I use
> if(/<a href="?.*"?>/) {
>        $link = $&;
> }
>
> it can only display <a href="http://......"> part, not the real url.
> real URL maynot start with http or end with html.

now I can get first URL by
if($line=~/<a href=\"?(.*?)\"?>/i)
{
        push (@link, "$1");
        print @link, "\n";
}

But how do I get the second url on the same line $_ ? how to do the loop
here?

if you know how to do this by CGI::Parser module, please let me know.
thanks.
>
> also it stops at the first occurance.
>
> Thanks for your help.
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: 17 Oct 1999 00:27:22 GMT
From: efflandt@xnet.com (David Efflandt)
Subject: Re: Server Push!
Message-Id: <slrn80i606.311.efflandt@efflandt.xnet.com>

On Thu, 14 Oct 1999 19:38:37 +0200, Bruno Kovac <bkovac@gmx.net> wrote:
>Hi!
>
>I need push help... (auto refreshing of some pages. after some time...)
>
>I dont know why but this is not working..

Define "not working".  I copied it exactly and it works for me locally in
FreeBSD using Netscape 4.61 with Apache.  However, it apparently uses
non-parsed headers (unbuffered server output), so I had to put an 'nph-'
prefix on the script name (nph-pushtest.cgi).  This also means don't print
any other http headers before the push.  Note that server push is a
Netscape only thing, so don't expect it to work for any other browser.

Client pull (meta refresh tag) works for most browsers, even MSIE and the
discontinued Mosaic it was based on.

>-cut-
>use CGI::Push qw(:standard);
>    do_push(-next_page=>\&next_page,
>            -last_page=>\&last_page,
>            -delay=>0.5);
>    sub next_page {
>        my($q,$counter) = @_;
>        return undef if $counter >= 10;
>        return start_html('Test'),
>               h1('Visible'),"\n",
>               "This page has been called ", strong($counter)," times",
>               end_html();
>      }
>     sub last_page {
>         my($q,$counter) = @_;
>         return start_html('Done'),
>                h1('Finished'),
>                strong($counter),' iterations.',
>                end_html;
>     }
>-cut-
>
>Thanks..
>
>


-- 
David Efflandt  efflandt@xnet.com  http://www.xnet.com/~efflandt/
http://www.de-srv.com  http://cgi-help.virtualave.net/
http://thunder.prohosting.com/~cv-elgin/


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

Date: Sun, 17 Oct 1999 05:35:19 GMT
From: djmoore@uh.edu (David Moore)
Subject: Tape Retensioning Under Win32
Message-Id: <38095823.247241434@news.uh.edu>

I'm trying to to write a utility to be used in a WinNT batch
file that does basic QIC-157 tape operations: retension,
rewind, that sort of thing. No, I don't even need to read
any files (although that would be nice). Can somebody point
me to online documentation that describes how to do this?
(Or the appropriate wheel, if it's already been invented.
No, NTBACKUP apparently cannot do this from batch.)

Heck, I'll even buy a book, if necessary.

If the answer involves ioctl, then yes, I read the ioctl
entry in the Camel, and discovered I need to have
ioctl.ph. I can't find that either, or even ioctl.h so I can
use h2ph on it, so I'll need pointers to ioctl.ph and some
documentation on it as well.

Resources I've already checked: The Camel book; the Win32
Gecko; /Win32 Perl Programming: The Standard Extensions/,
D.Roth, MacMillan; /Windows NT Programming/, J. Templeman,
WROX; various DEJANEWS archives, and of course the online
docs that came with ActiveState Build 521. If I'm blind, can
you point me to the right page?

-- 
Dave Moore == DJMoore@UH.EDu == I Speak For Me.
"...what we have here is not merely a one-time
lapse but rather a chronic silliness...."
                            -- Edward R. Tufte


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

Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

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 V9 Issue 1097
**************************************


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