Re: [OT] flock under win32

2000-09-24 Thread Rodney Broom

Hi all,

Here's my two cents worth (or less):

Teijo Aulin> I got the following error message: "flock() unimplemented on this
platform...
Teijo Aulin> I see that flock() is not implemented under win 98, so how can I
fix this?


Matt Sergeant> It can't ever be locked under Win9x because it doesn't support
the notion of file locking.

Hmm, that can't be altogether true. Haven't we all seen messages from WinDOS
about "cannot access... resource in use"? Although I'd bet that one would have
to use something from the Windoz API to get this functionality. I don't know of
how to do it myself, but maybe something from Dave Roth (www.roth.net).

Matt Sergeant> The only thing you can hope to do is implement some sort of flock
based on writing a temporary file or something.

That's what I'd do. If you were so inclined, you go crazy and write a common
file that kept interesting locking information. Then have your flock() check
that file. The file could even include fancy (unnecessary) stuff like what
process had the resource locked, the lock time, etc. You could go even more nuts
and implement something that watched for shutdown failures to intelligently
removing the locking data file after reboots.


Rodney Broom





Re: mm-1.0.12

2000-09-24 Thread jeff

Thanks for the help Armand, I really appreciate the effort.  Unfortunately,
I've seen Ray's faq before, it does have quite a few wholes in it.  I still
have the problem mentioned before.
Jeff
- Original Message -
From: Armand <[EMAIL PROTECTED]>
To: jeff <[EMAIL PROTECTED]>
Sent: Sunday, September 24, 2000 9:04 PM
Subject: Re: mm-1.0.12


> According to
> http://www.ssc.com/mirrors/LDP/HOWTO/mini/Apache-mods-3.html#ss3.1
> a Mini How To from the Linux Documentation Project:
>
> "This should build your mm libraries. As above, reference this path when
> needed. You're on your own if you want to install this library
> to the system."
>
> I've used this technique with success.
>
> Armand
>
> PS Oh, and it's probably a good idea to post in plain text here.
>
> > jeff wrote:
> >
> > ok, I know I am off the subject here, and I apologize, I am hoping
> > somebody can help for I think I have exhausted all possible resources
> > for help without actually asking a question here.  I've been working
> > on this issue for over a week.
> >
> > I'm trying to install apache with mod_ssl and mm-1.0.12
> [snip]
>




mm-1.0.12

2000-09-24 Thread jeff



ok, I know I am off the subject here, and I 
apologize, I am hoping somebody can help for I think I have exhausted all 
possible resources for help without actually asking a question here.  I've 
been working on this issue for over a week.  
 
I'm trying to install apache with mod_ssl and 
mm-1.0.12 
 
here is what i've done so far:
 # tar –zxf 
open_ssl.0.9.5.tar.gz  # 
./config # make # make 
test # make install
 # tar –zxvf /path/to/rsaref-2.0.tar.gz 
 # cp -rp install/unix 
local # cd local # make # mv rsaref.a librsaref.a 
(just renameing it)
 # cd mm-1.0.12 # 
./configure --disable-shared # 
make
(I've tried 
the newer version of mm with no luck 1.1.3 and I've tried actually make install 
on both of them as well, which I shouldn't have to if I reference them like i do 
below)
 
created this config script and ran it for 
mod_ssl: #!/bin/sh 
./configure --with-apache=/usr/src/apache/apache_1.3.12 \  --with-ssl \ 
--with-rsa=../depend/rsaref-2.0/local 
\  
--with-mm=../depend/mm-1.0.12 
\  
--enable-shared=ssl
 
To this point I get no 
errors.
Here is the configure script I run 
to get apache configured:  
#!/bin/sh 
SSL_BASE=../modules/mod_ssl/depend/openssl-0.9.5 \ 
RSA_BASE=../modules/mod_ssl/depend/rsaref-2.0/local 
\ 
EAPI_MM=/usr/src/apache/modules/mod_ssl/depend/mm-1.0.12 
\ ./configure \  
--enable-module=ssl \  
--enable-module=proxy 
\  
--enable-shared=proxy 
\  
--enable-module=rewrite 
\  
--enable-shared=rewrite 
\  
--prefix=/usr/local/apache-1.3.12 
\  --enable-shared=ssl 
\  
--enable-rule=EAPI \  
--enable-rule=SHARED_CORE \  
--enable-rule=SHARED_CHAIN 
\  --enable-module=so 
\  
--activate-module=src/modules/frontpage/mod_frontpage.o 
\  
--fpexec-caller=nobody 
\  --fpexec-uidmin=99 
\  --fpexec-gidmin=99 
\  --fpexec-fpuser=bin 
\  --fpexec-fpgroup=bin 
\  --server-uid=nobody 
\  --server-gid=nobodyHere is 
my output:Configuring for Apache, Version 1.3.12 + using 
installation path layout: Apache (config.layout) + activated frontpage 
module (modules/frontpage/mod_frontpage.o)Creating MakefileCreating 
Configuration.apaci in srcfgrep: 
/usr/src/apache/modules/mod_ssl/depend/mm-1.0.12/.libs: Is a directoryfgrep: 
: No such file or directoryfgrep: 
/usr/src/apache/modules/mod_ssl/depend/mm-1.0.12/.libs: Is a 
directoryCreating Makefile in src + configured for Linux 
platform + setting C compiler to gcc + setting C pre-processor 
to gcc -E + checking for system header files + adding selected 
modules    o rewrite_module uses ConfigStart/End + 
using -lndbm for DBM support  enabling DBM 
support for mod_rewrite    o ssl_module uses 
ConfigStart/End  + SSL interface: 
mod_ssl/2.6.6  + SSL interface build type: 
DSO  + SSL interface compatibility: 
enabled  + SSL interface experimental code: 
disabled  + SSL interface conservative code: 
disabled  + SSL interface vendor extensions: 
disabled  + SSL interface plugin: Built-in 
SDBM  + SSL library path: 
/usr/src/apache/modules/mod_ssl/depend/openssl-0.9.5  
+ SSL library version: OpenSSL 0.9.5 28 Feb 
2000  + SSL library type: source tree only 
(stand-alone)  + SSL library plugin mode: 
RSAref (explicitly configured)  + SSL library 
plugin path: 
/usr/src/apache/modules/mod_ssl/depend/rsaref-2.0/local/librsaref.a + 
enabling Extended API (EAPI)   using MM library: 
/usr/src/apache/modules/mod_ssl/depend/mm-1.0.12 (source-tree only) + 
enabling DSO files to be linked against others + enabling generation of 
Apache core as DSO + using -ldl for vendor DSO support + 
checking sizeof various data types + doing sanity check on compiler and 
optionsCreating Makefile in src/supportCreating Makefile in 
src/regexCreating Makefile in src/os/unixCreating Makefile in 
src/apCreating Makefile in src/mainCreating Makefile in 
src/lib/expat-liteCreating Makefile in src/modules/standardCreating 
Makefile in src/modules/proxyCreating Makefile in 
src/modules/sslCreating Makefile in 
src/modules/frontpage
Notice the fgrep errors (three of them) talking 
about mm?
Why is this 
happening?
TRUST ME, that is the directory to mm!
Everything goes on to compile and it seems to 
work.  However, I don't know how to test if mm is working or 
not.
 
Anyhelp would be most appreciated.  In 
fact if you could even point me to where I may get some help on mm that would be 
great too.  I have not found anyplace.  Thankyou for taking the time 
to help me, I appreciate it.  
 
Regards,
Jeff


Re: flock under win32

2000-09-24 Thread Matthew Byng-Maddick

On Sun, 24 Sep 2000, Jim Winstead wrote:
> On Sep 24, Gunther Birznieks wrote:
> > The PerlCookbook seemed to indicate that mkdir is an atomic operation (both 
> > checks if the directory exists and creates it if it does not), so a locking 
> > mechanism based on mkdir would take care of this issue 
> > presumably.  Removing the lock is a matter of removing the directory.
> be careful, mkdir isn't really atomic under nfs.

But NFS is Not a File System, so this doesn't matter :)

The other possible atomic operation that things use for locking
(emacs/netsacpe etc) is symlink() but you don't get that on win32, so not
a great suggestion here, but you don't get NFS on win32 either.

MBM (wittering before disappearing off to YAPC)

-- 
I'm not even going to *bother* comparing C to BASIC or FORTRAN.
-- L. Zolman, creator of BDS C




Gzip compression and caching directives

2000-09-24 Thread Christian Jaeger

Hello

I'm experimenting with gzip compression. I'm working on my own fastcgi
based framework, and as far as I've seen I'm doing exactly (except the 'if
0' stuff from which Matt suffered :-) the same as Apache::GzipChain (hmm,
I've just realized that there are also two other Apache:: compression
modules). What I've found to be strange is, that at least Netscape browsers
(version 4.6 linux and 4.51 macos) change their caching strategy when being
sent gzipped content: I'm sending a "Last-modified: Sat, 15 Jul 2000
19:13:32 GMT" header, which is really sent by apache as you can see in the
tcpdump output below, but if using gzip compression, netscape requests the
page each time again.

I'm wondering whether the gzip part itself carries a modification date?:
>From Compress/Zlib.pm:

sub MAGIC1() { 0x1f }
sub MAGIC2() { 0x8b }
sub OSCODE() { 3}
...
  # write a minimal gzip header
  my(@m);
  push @m, pack("c10", MAGIC1, MAGIC2, Z_DEFLATED(), 0,0,0,0,0,0, OSCODE) ;
...

Maybe the zero's should really be a timestamp?


The output from tcpdump:

19:47:21.00 testwww.ethz.ch.www > testwww.ethz.ch.1759: P 1:2079(2078)
ack 4
07 win 31072  (DF)

E..RC%@.@.l.  : 4500 0852 4325 4000 4006 6c2e c0a8 0101
.P...Hp.  : c0a8 0101 0050 06df 1848 f9d3 181c 70a1
..y`!p.=  : 8018 7960 2170  0101 080a 0086 853d
...EHTTP/1.1 200  : 0086 8445 4854 5450 2f31 2e31 2032 3030
 OK..Date: Sun,   : 204f 4b0d 0a44 6174 653a 2053 756e 2c20
24 Sep 2000 17:4  : 3234 2053 6570 2032 3030 3020 3137 3a34
7:18 GMT..Server  : 373a 3138 2047 4d54 0d0a 5365 7276 6572
: Apache/1.3.9 (  : 3a20 4170 6163 6865 2f31 2e33 2e39 2028
Unix) mod_perl/1  : 556e 6978 2920 6d6f 645f 7065 726c 2f31
.24 mod_fastcgi/  : 2e32 3420 6d6f 645f 6661 7374 6367 692f
2.2.2 mod_ssl/2.  : 322e 322e 3220 6d6f 645f 7373 6c2f 322e
4.9 OpenSSL/0.9.  : 342e 3920 4f70 656e 5353 4c2f 302e 392e
4..Last-modified  : 340d 0a4c 6173 742d 6d6f 6469 6669 6564
: Sat, 15 Jul 20  : 3a20 5361 742c 2031 3520 4a75 6c20 3230
00 19:13:32 GMT.  : 3030 2031 393a 3133 3a33 3220 474d 540d
.Content-encodin  : 0a43 6f6e 7465 6e74 2d65 6e63 6f64 696e
g: gzip..Content  : 673a 2067 7a69 700d 0a43 6f6e 7465 6e74
-length: 1760..K  : 2d6c 656e 6774 683a 2031 3736 300d 0a4b
eep-Alive: timeo  : 6565 702d 416c 6976 653a 2074 696d 656f
ut=15, max=99..C  : 7574 3d31 352c 206d 6178 3d39 390d 0a43
onnection: Keep-  : 6f6e 6e65 6374 696f 6e3a 204b 6565 702d
Alive..Content-T  : 416c 6976 650d 0a43 6f6e 7465 6e74 2d54
ype: text/html..  : 7970 653a 2074 6578 742f 6874 6d6c 0d0a
...r  : 0d0a 1f8b 0800   0003 ed9b cd72
.6..ej..  : e336 12c7 cfa3 a7e8 656a b397 d197 bfe2
q$MI&e).l...7.Ab  : 7124 4d49 2665 29b6 6caf c5b1 37b9 4162
...


BTW can anyone give me a link to documentation about all the possible
caching/expires/modification directives? A particular problem I have is
with MSIE 3 (Mac): unlike Netscape this browser doesn't request pages again
if I enter the same page again and I didn't send any modification
date/caching pragma. So I have to send an 'expires: now' because of this
browser, but this makes Netscape request pages again even if just going
BACK in history. This is a pitty, since I liked Netscapes behaviour not to
request pages again when going back, but requesting them again if entered
them again by following a link ('forwardly').

Thanks,
Christian.





Re: OT: flock under win32

2000-09-24 Thread Gunther Birznieks

At 12:46 AM 9/24/2000 -0400, Jim Winstead wrote:
>On Sep 24, Gunther Birznieks wrote:
> > The PerlCookbook seemed to indicate that mkdir is an atomic operation 
> (both
> > checks if the directory exists and creates it if it does not), so a 
> locking
> > mechanism based on mkdir would take care of this issue
> > presumably.  Removing the lock is a matter of removing the directory.
> >
> > However, (maybe this is right ... i dont have it here with me), the
> > PerlCookbook was saying this within the context of an NFS locking 
> mechanism
> > I think. So, if mkdir is not truly atomic under Perl's implementation for
> > Win32 then that would screw that over. Would anyone here know off the top
> > of their head?
>
>be careful, mkdir isn't really atomic under nfs.

OK. In going back to look up Perl Cookbook, it does say it's dependent on 
the client and server implementation of NFS... Although it doesn't name any 
system as having an atomic client or server implementation of mkdir. I 
imagine both are needed.

Of course, then the question is... is mkdir() atomic on Win32 Perl..

Thanks,
 Gunther

PS I've added OT to this thread.




Apache::DB in emacs

2000-09-24 Thread rwk

Can anyone tell me if there is a way to run mod_perl's Apache::DB under
emacs?

That is, with the "gdb" (or "perldb") keystrokes and source code
steping etc..., rather than from a shell command line.

Thanks,
Dick






Re: running maintenance tasks on DB

2000-09-24 Thread Louis-David Mitterrand

On Sun, Sep 24, 2000 at 08:00:40AM +0800, Gunther Birznieks wrote:
> I usually write such things in Java. That's how I do it. :)
> 
> Just kidding.

Me too I used to program in java. But it brought me only
frustration. After that experience I pledged to only use "free"
languages and now I feel much better ;)

> Anyway, there are several ways:
> 
> 1) Have the auction script do the cleanup every so often itself
> 
> The problem with this method is that it is non-deterministic and it can be 
> more resource intensive if the script is used a lot.
> 
> If the script is not used a lot, it really doesn't matter and it can be 
> nice not having to worry about a cron job -- however you script seems to 
> want to do a LOT not just a few things in maintenance so I wouldn't 
> recommend this method anyway.

You mean write a DB trigger function that would be called after a SELECT
on the (say) auction table and only perform its stuff if it has not been
called in the last X minutes?

That could an interesting strategy: the function would exit immediately
upon checking a time condition and not be a burden on the system.

> 2) Write a separate mod_perl handler yourself.
> 
> Why mod_perl? If it's an admin script you can just simply whip it up and 
> use it. However, I will say that I am always wary of admin web pages as it 
> exposes your system to the outside world and potential hackers.
> 
> This model is useful if your maintenance is so infrequent you don't need to 
> run the admin more than once a day or once a week on your own schedule.

I was thinking of a PerlRestartHandler for certain daily tasks (as
Apache is restarted each night after log rotation, right?) combined with
a ChildInitHandler for more frequent tasks. Of course that last handler
would check a time condition before doing its stuff so as not to be
activated more than every X minutes (same as the trigger function).

The drawback is if the site has such low traffic that Apache children
are not spawned often enough for the system's proper maintenance. But
the in that case I have other worries, right? ;-)

> 3) CRON Job
> 
> Do this if you want the job timed to a low granularity. eg once a day.

Yes, this is the standard solution I am trying to avoid in name of
better "integration". But I'll probably have to use it at some point.

> 4) Perl Daemon that sleeps and then wakes up to try maintenance tasks.
> 
> Do this if you want the job timed to a low granularity. eg once every 5 
> minutes. It sucks to have CRON load up your system with calls to load Perl 
> every 5 minutes after putting in so much effort to make things faster with 
> mod_perl.

Hmm, I hadn't thought about the inefficiency of loading a perl
interpreter, especially in relation with the otherwise efficient
mod_perl. If I run the maintenance script from cron it will probably
take the form of a simple shell command to launch a DB backend function
(in pl/sql or C) that would take care of everything (I wrote DB
functions that can send mail to users using their respective locale).

Thanks for your input, cheers,

> At 05:27 PM 9/23/00 +0200, Louis-David Mitterrand wrote:
> >Hello,
> >
> >Approaching completion of an online auction system based on Postgres and
> >mod_perl/Apache I yet have to devise a good way of running certain
> >maintenance tasks on the DB like closing auctions, notifying winners,
> >transferring old records to archive tables, etc.
> >
> >What is the usual way of programming such tasks? Write a backend
> >function (in pl/sql or C) and call it from a cron job? From a mod_perl
> >handler?
> >
> >Thanks in advance for any insight, cheers,
> >
> >--
> >Louis-David Mitterrand - [EMAIL PROTECTED] - http://www.apartia.org
> 

-- 
Louis-David Mitterrand - [EMAIL PROTECTED] - http://www.apartia.org

  **  Hello and Welcome to the Psychiatric Hotline **
 If you are paranoid-delusional, we know who you are and what you want
   - just stay on the line so we can trace the call.



Re: indexing and searching documents on your web server

2000-09-24 Thread Matt Sergeant

On Sat, 23 Sep 2000, Tarak Parekh wrote:

> Hello All, 
> 
> I am thinking that this might not be the right place for this
> question, so forgive me for the naiveness.
> 
> I am trying to look into tools/modules which could help me
> index/search the documents on my website and provide just a search box
> for the documents. I have tried webglimpse, but had a couple of
> problems with it. Could someone give me some pointers for that ?

If you want something controllable via mod_perl then there are a couple of
things in the CPAN, under the DBIx hierarchy. If you're not bothered about
direct control, then you should check out htDig.

-- 


Fastnet Software Ltd. High Performance Web Specialists
Providing mod_perl, XML, Sybase and Oracle solutions
Email for training and consultancy availability.
http://sergeant.org | AxKit: http://axkit.org