Re: Help wanted with locations / configuration

2003-09-09 Thread Marc Slagle
On Tue, 2003-09-09 at 05:00, Steve Hay wrote:
 As in a PerlTransHandler, yes?

Yup.

 Is there a performance penalty with this?  You're using Perl code to 
 inspect the URI, and then handing control back to the Apache core if it 
 is a static file.  I wanted to avoid requests for static files wasting 
 time by going to a Perl handler only to be returned to the Apache core 
 to serve the file, hence my LocationMatch override that catches requests 
 for static files.

Static File:

Devel::Timer Report -- Total time: 0.0006 secs
Interval  TimePercent
--
00 - 01  0.0003  48.49%  INIT - Entering translation handler
01 - 02  0.0002  36.91%  Entering translation handler - Checking to
see if we are asking for a static file
02 - 03  0.0001  14.60%  Checking to see if we are asking for a static
file - This is a request for a static file, telling apache where it is

Request we want to pass on to our handler:

Devel::Timer Report -- Total time: 0.0005 secs
Interval  TimePercent
--
01 - 02  0.0002  40.90%  Entering translation handler - Checking to
see if we are asking for a static file
00 - 01  0.0001  31.48%  INIT - Entering translation handler
02 - 03  0.0001  27.62%  Checking to see if we are asking for a static
file - This is not a request for a static file, returning DENIED


We decided to do it this way because we are also doing some other things
in the translation handler that I didn't pass along in the snippet.
Since we were already putting a translation handler in place to do our
trickery there, it seemed to make the most sense to us to add the code
to handle static requests there.  By no means am I suggesting that this
is the best way, but we're pretty happy with it.

Marc Slagle



Re: Help wanted with locations / configuration

2003-09-08 Thread Marc Slagle
On Mon, 2003-09-08 at 11:51, Steve Hay wrote:
 
 It also needs to have access to various static resources (images, 
 stylesheets, JavaScript libraries etc.).
 
 Thus, I want to have something like this:
 
 /myproject [mp1]
 /myproject/component1   [mp1]
 /myproject/component2   [mp1]
 ...
 /myproject/images   [static]
 /myproject/javascript   [static]
 /myproject/stylesheets  [static]

You might want to look at having a translation handler.

We're doing something similar to this, where images and javascripts live
under the same directory structure as the handler is managing.  Instead
of trying to configure this via that httpd.conf file, we chose to have a
translation handler look at the incoming uri and determine whether the
request is for a static file or for the code.

Inside of our transhandler we're doing this:

sub handler
{
my $r=shift;
my $uri=$r-uri;
my $Tmplpath=/our/static/files/rootdir/;

if (($uri !~ /jpg$/)  ($uri !~ /css$/)  ($uri !~ /js$/))
{
$r-notes('host' = $Host);
$r-notes('olduri' = $uri);
$r-uri(/);
return DECLINED;
}
else
{
my $File=$Tmplpath . $uri;
$r-filename($File);
return OK;
}
}

If a request is made for anything ending in .jpg, .js or .css, we tell
apache where to find the file by appending the uri (/images/the.jpg for
example) to a path.  The handler then returns OK, which tells apache not
to try to figure out where the file lives on its own, and returns the
file to the browser.

Any other request is passed to the handler, along with a field in
notes() that shows what we were asking for in the first place.  Our
request handler uses this to dispatch the request to the correct object
needed to fulfill the request.  (Our handler is configured at /, so we
override the uri passed from the browser to /).

Any other types you want can be added to this, I just threw the ones
that seemed relevant to you.  I hope this helps.

Marc Slagle
Whapps LLC



RE: templating system opinions (axkit?)

2003-07-23 Thread Marc Slagle




What you have created for your own use is almost exactly what HTML::Template does. We have used it for a year without any major problems between us and the HTML designer. Its fast and supports loops and if statements. Its probably worth your while to check it out.

As far as XSLT goes, we're moving to it now (XML::LibXSLT) and its making our life much easier. Our designer doesnt mind learning it, esp. after showing him what it can do.

Marc Slagle
Whapps, LLC.

On Wed, 2003-07-23 at 10:27, Hauck, William B. wrote:

Hi,

I've been considering using a template system for an app that I'm working, but decided against it as the designers who would be putting the actual pages together (look n feel) use Adobe GoLive which does 'bad things' to non-html stuff (at least in my experience).

What i've done is just use completely external html files with html-compliant comments indicating the data field. (example !-- APPNAME_USER_FIRST_NAME --).  My application just reads in the html on startup and does a series of substition statements over the file as necessary to replace the comments with the actual data.  Thus, each type of page has one base html (or html file pieces) that are merged with each other and data as necessary allowing all logic to be kept in the program.






Reading XML input from flash

2002-12-09 Thread Marc Slagle



Has anyone had any luck reading in the XML sent by 
the flash XML.sendandload function? I've looked on Macromedias site, and 
all over the web, but cant seem to get it to work. I know that the flash 
code is supposed to be POSTing the data.

Ourflash app connects to the server and seems 
to be trying to send the data, but I cant capture it.

If there's any sites or code snippets anyone can 
provide it would help out a lot.

Thanks,

Marc Slagle
The Fulkert Consulting Group, Inc.
559 Liberty Hill 2W
Cincinnati, OH 45210


Re: How do I force a 'Save Window?'

2002-11-20 Thread Marc Slagle



This works for me:

I'm using pdf stuff here, but you can set the 
content type to whatever you want.

$r-content_type('application/pdf');$r-header_out("Content-Disposition" 
= "attachment; 
filename=order.pdf");$r-send_http_header();
Marc Slagle

- Original Message - 
From: "Dennis Daupert" [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, November 20, 2002 10:10 
AM
Subject: Re: How do I force a 'Save 
Window?'
  Thanks all for the great suggestions. This group is 
wonderfully helpful. I tried the quick route, setting MIME type to 
"application/octet-stream," and that works fine for xl spreadsheets, but 
I still get the same behavior as before with MS Project files (browser 
IE 5.00.3105.0106, which is one of the IE versions we have to support). 
I will need a bit more time to try some of the other more involved ideas 
, so that won't be for a few more days.  /dennis 
 
--- 
Office phone: 817-762-8304  
--- 
"Great leaders never tell people how to do their jobs. 
 Great leaders tell people what to do and establish a 
 framework within which it must 
be done.  Then 
they let people on the front lines,  
who know best, figure out how to get it done." 
 ~ General H. 
Norman Schwarzkopf 



Possible module

2002-06-10 Thread Marc Slagle



I have written a module for one of our clients, and 
want to know if I should make it available on CPAN. My hope is that others 
might find it useful.

The client had a system where he wanted all 
incoming requests for a site to have the exact same pages if you asked for 
anything except index.html. The index.html pages for each site were 
different, and were generated by him with names like index001.html for 
domain1.com, index002.html for domain2.com, etc. However, he had so many 
configured domains that his httpd.conf files were getting huge, and his httpd 
processes were getting bigger and bigger (this may not be a problem with apache 
2, I wouldn't know.) 

We replaced the default translation handler with a 
perl one that grabbed the domain and matched it against a tied DB file if 
index.html was asked for (or just /). If the index wasn't asked for, then 
we just told apache where the directory was to get the files from. 


After switching to this system, the httpd processes 
shrank to 2-3 MB, and the number of sites configured to use this system was 
something like 100,000 individual domains or so, each sharing every single file 
except the index files. The regular httpd.conf only handled about 2000 
before memory sizes became too big. The system also has handled 1.5 
million hits in a day.

The module addsa directive to the httpd.conf 
file: PerlIndexConfig, whichsets the directory the common files are 
located and the DB file to use for determining the index file 
locations.

All I want to know is: Does anybody think 
this kind of module is useful enough to be made public? Any feedback would 
be great. Thanks.

Marc Slagle


Re: Dynamically Changing the Document Root

2002-05-17 Thread Marc Slagle

 The 'staged' version of their site is stored in a different directory,
 and if i could just changed the document_root dynamically, most(?) of
 our issues would be over.

 Is there a way to do this? The documentation does not have any reference
 to be able to change the document root (just get it via
 $r-document_root).

You might want to use a translation handler (Chapter 7 of the Eagle book.)

We did something similar to this, where if a browser asks for an index page
it forces apache to use a db file to get its filename/path.  You could check
the incoming path for the Preview mode and set $r-filename.

Something like:

my $uri=$r-parsed_uri;
my $Path=$uri-path;

if ($Path =~ /Preview/)
{
$r-filename($Path_to_file_on_filesystem);
return OK;
}

return DECLINED;

The above might not exactly do it, but its just a rough example.  The return
OK will make apache skip its own URL to file translation stuff, where return
DECLINED should let apache continue as normal (reading httpd.conf for
finding paths, etc.)

Marc Slagle







Re: Throttling, once again

2002-04-19 Thread Marc Slagle

When this happened to our clients servers we ended up trying some of the
mod_perl based solutions.  We tried some of the modules that used shared
memory, but the traffic on our site quickly filled our shared memory and
made the module unuseable.  After that we tried blocking the agents
altogether, and there is example code in the Eagle book (Apache::BlockAgent)
that worked pretty well.

You might be able to place some of that code in your CGI, denying the search
engines agents/IPs from accessing it, while allowing real users in.  That
way the search engines can still get static pages.

We never tried mod_throttle, it might be the best solution.  Also, one thing
to keep in mind is that some search engines will come from multiple IP
addresses/user-agents at once, making them more difficult to stop.

 Hi,

 Wasn't there just a thread on throttling a few weeks ago?

 I had a machine hit hard yesterday with a spider that ignored robots.txt.

 Load average was over 90 on a dual CPU Enterprise 3500 running Solaris
2.6.
  It's a mod_perl server, but has a few CGI scripts that it handles, and
the
 spider was hitting one of the CGI scripts over and over.  They were valid
 requests, but coming in faster than they were going out.

 Under normal usage the CGI scripts are only accessed a few times a day, so
 it's not much of a problem have them served by mod_perl.  And under normal
 peak loads RAM is not a problem.

 The machine also has bandwidth limitation (packet shaper is used to share
 the bandwidth).  That combined with the spider didn't help things.
Luckily
 there's 4GB so even at a load average of 90 it wasn't really swapping
much.
  (Well not when I caught it, anyway).  This spider was using the same IP
 for all requests.

 Anyway, I remember Randal's Stonehenge::Throttle discussed not too long
 ago.  That seems to address this kind of problem.  Is there anything else
 to look into?  Since the front-end is mod_perl, it mean I can use mod_perl
 throttling solution, too, which is cool.

 I realize there's some fundamental hardware issues to solve, but if I can
 just keep the spiders from flooding the machine then the machine is
getting
 by ok.

 Also, does anyone have suggestions for testing once throttling is in
place?
  I don't want to start cutting off the good customers, but I do want to
get
 an idea how it acts under load.  ab to the rescue, I suppose.

 Thanks much,


 --
 Bill Moseley
 mailto:[EMAIL PROTECTED]





Re: Solaris 8 lockups

2002-04-18 Thread Marc Slagle

What version apache/mod_perl are you running?  Also, were these intel
solaris 7 servers or sparc?


 We've recently started trying to migrate a number of Solaris 7 machines to
 Solaris 8, and everything seemed fine for a while.

 We have each box running its own static, dynamic (mod_perl) and ssl
 servers, and everything runs fine for 3-7 hours after starting the server.
 Eventually, however, the mod_perl children just stop responding.   If you
 try to telnet into the port, the connection just hangs why trying to
 connect...we don't get a refused connection, and it doesn't let you
 connect to the point where you can issue an HTTP request.   It just seems
 to stop responding and get stuck.

 Has anyone else run into any of these problems?   So far we've had nothing
 like this happen with Solaris 7 and with Linux, but I can't even think
 where to start looking on Solaris 8.

 As a side note, this happened both on boxes that had been upgraded from 7
 to 8, as well as boxes that had fresh 8 installs.







Re: Solaris 8 lockups

2002-04-18 Thread Marc Slagle

We had problems with that combination of apache/mod_perl, on solaris 8 as
well.  We switched to mod_perl 1.25 and that fixed our problems.  Since then
we have also moved to newer versions of apache.  I would build a newer
version of apache/mod_perl on one of the systems and then leave the
configuration the same.  (Assuming you can do that, some work environments
are locked down to older versions of software.)

It would be interesting to see what truss reported when you hit the server
when it was not responding.

- Original Message -
From: Tom Servo [EMAIL PROTECTED]
To: Marc Slagle [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Thursday, April 18, 2002 2:14 PM
Subject: Re: Solaris 8 lockups


 Nevermind about mod_perl version number, looks like we're running 1.24

 
 Brian Nilsen
 [EMAIL PROTECTED]

 On Thu, 18 Apr 2002, Marc Slagle wrote:

  What version apache/mod_perl are you running?  Also, were these intel
  solaris 7 servers or sparc?
 
 
   We've recently started trying to migrate a number of Solaris 7
machines to
   Solaris 8, and everything seemed fine for a while.
  
   We have each box running its own static, dynamic (mod_perl) and ssl
   servers, and everything runs fine for 3-7 hours after starting the
server.
   Eventually, however, the mod_perl children just stop responding.   If
you
   try to telnet into the port, the connection just hangs why trying to
   connect...we don't get a refused connection, and it doesn't let you
   connect to the point where you can issue an HTTP request.   It just
seems
   to stop responding and get stuck.
  
   Has anyone else run into any of these problems?   So far we've had
nothing
   like this happen with Solaris 7 and with Linux, but I can't even think
   where to start looking on Solaris 8.
  
   As a side note, this happened both on boxes that had been upgraded
from 7
   to 8, as well as boxes that had fresh 8 installs.
 
 
 
 
 






Looking for more information...

2002-04-16 Thread Marc Slagle



In the next few weeks our radio show might be 
tackling mod_perl as a topic. I've read everything on the perl.apache.org 
site (and followed the links from there to take23.org, etc.) 
I'vereadthe mod_perl articles on perl.comas well. My 
question is, are there any other less-obvious places to look for information 
that I'm missing? We've usedmod_perl for our development for years, 
and are very familiar withit.Links to anyplace that 
might have good articles, etc. would be great.

Thanks,
Marc SlagleThe Fulkert Consulting 
Group, Inc.559 Liberty Hill, Suite 2 WestCincinnati, Ohio 
45210513.665.4931http://www.fulkertconsulting.com


Re: Looking for more information...

2002-04-16 Thread Marc Slagle

 What else do you need? There are two mod_perl books that you may wish to
 purchase and read, see the links on the site.

Got the books too.

I'm almost there, but could still use any nifty statistics, etc.  Most of
the stories I've seen are for defunct sites/companies.  I'm creating a site
to go along with the show, and would like for that episodes page to have
some links for the management types to see, since we usually find that
management is our main block in getting mod_perl in the door.  Thanks
again...




Re: modperl and SQL db select

2002-03-21 Thread Marc Slagle

 Is there any issue with using modperl with postgres vs mysql
 for a database driven website? Don't want to bark up the wrong
 tree in a mod_perl project only to discover I picked the wrong .db :-/

http://www.mysql.com/news/article-91.html

This was an interesting article, even though it didn't compare postgres to
the other databases being tested.  All of the mod_perl sites we have worked
on use MySQL, and we have never had any problems with it.  The newest
versions of MySQL (4.x) also add some functionality that might have made
MySQL look a bit less tempting for a developer to use in the past.

Marc Slagle
Secure Level
559 Liberty Hill, 2W
Cincinnati, Ohio, 45210
(513) 665 4931
http://www.securelevel.com




Re: Site Host Providers that Support mod_perl?

2002-03-07 Thread Marc Slagle

 Alright, I'm a total mod_perl newbie and would like to find a host for my
 personal site that allows me to develop mod_perl scripts. First off, I'm
 assuming that there is no way to install mod_perl on my current provider
due
 to (obvious) access privilige restrictions to Apache? Secondly, the
obvious
 question here, whom would you folks recommend for hosting services,
assuming
 the afforementioned?

Secure Level provides mod_perl hosting.  We have two packages.  The first is
$80/month, and you get 4gb throughput, your own httpd/IP address, no memory
limits (as long as you don't kill the server) and 25 Mb storage space.  Its
$65/month if you pre-pay one year.  The second package is $10 less a month
if you dont need your own IP address, and want to run on a non-standard
port.

Our facility is fed by 18 OC-192 connections, so heavy traffic isn't that
much of an issue.

http://www.securelevel.com

Marc Slagle




Re: how to disable mod_perl in a subdir?

2002-02-27 Thread Marc Slagle

Maybe you can try Apache::PerlRun instead of Apache::Registry for the
directories that you need to run those scripts.  The perldocs show how to
set it up.

Marc Slagle

- Original Message -
From: Dan Baker [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, February 27, 2002 11:14 PM
Subject: how to disable mod_perl in a subdir?


 I am working with a host that has everything under /cgi-bin running
 mod_perl by default, and well as using EmbPerl to run the dynamic pages.
 Unfortunately, I have a set of scripts that really need regular perl,
 and I can't seem to figure out the configuration to  disable mod_perl in
 a specific directory that needs
 regular perl. ;(

 I tried this in the httpd.conf file:
 Directory /home/mydomain/cgi-bin/webadmin/
   SetHandler default-handler
   AddHandler cgi-script .pl
   AllowOverride All
 /Directory

 and then ALSO editted a .htaccess file in
 /home/mydomain/cgi-bin/webadmin/ to include:
   options +ExecCGI
   RemoveHandler perl-script
   SetHandler cgi-script
   AddHandler cgi-script .pl

 and it still tries to use mod_perl?!

 SERVER_SOFTWARE = Apache/1.3.19 (Unix) (Red-Hat/Linux) mod_ssl/2.8.1
 OpenSSL/0.9.6 mod_perl/1.24_01

 PLEASE let me know if there is a way to configure so that a specific
 sub-dir uses regular perl.

 Dan