Re: OT: Page generation Do it locally or put the burden on the Web

2001-08-16 Thread Nelson Zink

Sivakatirswami ,

 I can move the source text and templates to the web server and convert my
 local metacard button script to a .mt script and then let the web server
 build the page each time someone hits on it.

I did much the same thing at http://www.navaching.com to serve up new daily
Haiku and proverbs. The page is built just ONCE a day, automatically at the
site. Every time someone hits on the page cgi checks the date (compares it
with a text file) and if it's tomorrow rebuilds, if it's today then just
sends the page.

The trick was (is) two fold:
1) generating a new page
2) and the Status: 204 No Content  cr business below. This was the
hardest part until I found 204. Without 204 you'll get an error, as the web
is set up on a call/response basis. What you want to do is send nothing back
and that's what 204 does. So the guts of the script below only kicks in once
a day, otherwise the page is sent. 204 is what made the whole thing
possible.

You can make it work without 204 but the FIRST hit tomorrow (the rebuilding
hit) gets today's page.  If your traffic is heavy and/or you aren't to
concerned about that first soul who shows up tomorrow then you can drop 204.

#!mc
--- update.mtupdate html pages
on startup
 -checkdate
  put url file:seconds.mt into it
  if the secondsit then
put the short date into temp
convert temp to seconds
put (temp+86400) into temp  --the daily seconds
open file seconds.mt for write
write temp to file seconds.mt at 0
close file seconds.mt
-- generate data for new pages
--update pages You have dummy pages with variables in the html and just
search for and replace with the data generated
-- send 'Update' page
put url file:../update.html into buffer
put Content-Type: text/html  cr
put Content-Length:  the length of buffer  cr  cr
put buffer
  else put Status: 204 No Content  cr  --a non response
end startup

There is a slightly better explanation in Section 8 of
http://www.navaching.com/pagem.html.

This deal has been running for a couple years without a hitch.

Nelson Zink


Archives: http://www.mail-archive.com/metacard@lists.runrev.com/
Info: http://www.xworlds.com/metacard/mailinglist.htm
Please send bug reports to [EMAIL PROTECTED], not this list.




Re: OT: Page generation Do it locally

2001-08-15 Thread Sadhunathan Nadesan

| --- MESSAGE metacard.v004.n426.3 ---
| 
| From: Scott Raney [EMAIL PROTECTED]
| Subject: Re: OT: Page generation Do it locally or ...
| Date: Tue, 14 Aug 2001 15:16:51 -0600 (MDT)
| 
| OR
| 
| 3) have the server generate it, but only once per day.  There are
|several ways to do this.  Probably easiest would be as a batch file
|run from the UNIX crontab file or with an at command.  You could
|also set up single long-running MetaCard process that uses wait
|or send .. in to just do the work every 24 hours.  I'd recommend
|the crontab file option for maximum reliability (no need to worry
|about restarting if the server goes down or if you get logged off),
|but it does require the assistance of the sysadmin.  Also note that
|in all versions of this you'll have to write the script as a .mt
|file rather than putting it in a stack, though of course you can
|access data and run handlers in other stacks from the .mt script.
| 
|   Regards,
| Scott
...

Swami, this is kind of a 'specific to your situation' response.

Yeah, easy to do this sort of thing with cron if you have shell
access, alas, you don't.  You can get HOL help to make cron entries
but harder to test your programs without shell access.  Also they
might say ...what's this? 

However, you could do it from the gurudeva server.  Set up all your
raw materials and your .mt script there.  Have the daily page
generation run there (triggered by a cron entry) and then deliver the
lesson file to its destination on mahiai using wget.

Or, do it on your Mac server, that is running Unix.

Aum Aum
Sadhu

Archives: http://www.mail-archive.com/metacard@lists.runrev.com/
Info: http://www.xworlds.com/metacard/mailinglist.htm
Please send bug reports to [EMAIL PROTECTED], not this list.




OT: Page generation Do it locally

2001-08-15 Thread Sivakatirswami

on 8/14/01 11:09 PM, [EMAIL PROTECTED] at
[EMAIL PROTECTED] wrote:

Scott said: use a crontab to  build the lesson once a day, for that day
(wish I could, but have no access to that level of the server and sysadmin
help is not part of the hosting package) or use  wait or send in...sounds
doable, (but...easily breakable)  I would also have to stay up till midnite
to start it ?? to generate tomorrow's lesson at the right time and then
initiate a send in 24 hours sounds tricky and I am not sure I understand
it well enough to implement in a stable way.

Andu said:

 Another option would be to have all lessons and the html templates as custom
 properties
 of a stack in /cgi-bin. When the script is called it formats the page from the
 custom
 properties of the stack. Or something...

Intriguing...never thought of accessing stacks on a server from the .mt
script... so, does accessing custom properties of a single stack represent
less of a hit on the CPU processor than reading and parsing lesson chunks
from large text files? But, this option is kind what I thought of last
night: put all the body contents of the lessons into 365 files (build them
at home from the different text books) then put the header and footer on
site and each time the cgi is hit it only has to read and concatenate three
small files. That¹s really no more of a processor hit than your standard
persistent include (s) for any .shtml file...  and is probably about the
same hit in the CPU as reading the custom properties of stack? Or am I wrong
there?  The stack option would be easily implemented, if it were
substantially faster...it would only have seven custom properties totally
about 2.5 meg of data that would have to parsed out and put together to
generate one lesson each time the cgi was hit. I guess one could test the
speed at home and bench mark it against the open/read/parse files option to
determine the relative difference

Hinduism Today

Sivakatirswami
Editor's Assistant/Production Manager
[EMAIL PROTECTED] 
www.HinduismToday.com, www.HimalayanAcademy.com,
www.Gurudeva.org, www.hindu.org



Archives: http://www.mail-archive.com/metacard@lists.runrev.com/
Info: http://www.xworlds.com/metacard/mailinglist.htm
Please send bug reports to [EMAIL PROTECTED], not this list.




OT: Page generation Do it locally or put the burden on the WebServer?

2001-08-14 Thread Sivakatirswami

I am at a cross roads with a rather large project to put a course of lessons
on the web where extracts from four text books are compiled to create a
Lesson of the Day which is determined by the ordinal day of the
astronomical year which begins on April 13.

Now Metacard was a God send in getting this job done...but now I am at a
cross roads on the final leg with two options:

1) Page generation locally, mc.cgi will simply pull a page:

I can run a script at home which loads  html page header, body and footer
templates, then extracts the lessons 1-365 from raws text source files and
generate 365 lessons totally about 7 megs of data and then FTP this to the
site and create a CGI in Metacard that simply calculates the integer for the
day of the year and serves up the corresponding file from a directory

OR

2)  Have MC Generate the pages on the server

I can move the source text and templates to the web server and convert my
local metacard button script to a .mt script and then let the web server
build the page each time someone hits on it.

The latter has lots of administrative advantages even though #1 is a
relatively simply operation should changes be required...

But the second option forces the web server to
   i) load three variables with small templates of html chunks
ii) load four variables with a total of about 2.5, meg of data from the
books, parse out the lessons for the day, make the necessary
insertions/concatenations into the templates and serve up the page.

Now, the latter obviously puts a heavier burden on the web server CPU. The
question which is beyond me is...for Apache running on a Sun Sparc Solaris,
is option 2 a trivial task? or given that at any point in time, 5-10 people
could be hitting on the link that invokes the CGI...would using option two
constitute an undue burden on the CPU of the web server? I know from running
it at home that the script to read in the data and create a single lesson is
almost instantaneous on a G4.  Any thoughts from the experiences ones?

this decision not only affects this project, but the whole direction for
page deployment to the web in the future.


thanks

Hinduism Today

Sivakatirswami
Editor's Assistant/Production Manager
[EMAIL PROTECTED] 
www.HinduismToday.com, www.HimalayanAcademy.com,
www.Gurudeva.org, www.hindu.org



Archives: http://www.mail-archive.com/metacard@lists.runrev.com/
Info: http://www.xworlds.com/metacard/mailinglist.htm
Please send bug reports to [EMAIL PROTECTED], not this list.




Re: OT: Page generation Do it locally or ...

2001-08-14 Thread Scott Raney

On Tue, 14 Aug 2001 Sivakatirswami [EMAIL PROTECTED] wrote:

 1) Page generation locally, mc.cgi will simply pull a page:
 
 OR
 
 2)  Have MC Generate the pages on the server
 
 I can move the source text and templates to the web server and convert my
 local metacard button script to a .mt script and then let the web server
 build the page each time someone hits on it.

OR

3) have the server generate it, but only once per day.  There are
   several ways to do this.  Probably easiest would be as a batch file
   run from the UNIX crontab file or with an at command.  You could
   also set up single long-running MetaCard process that uses wait
   or send .. in to just do the work every 24 hours.  I'd recommend
   the crontab file option for maximum reliability (no need to worry
   about restarting if the server goes down or if you get logged off),
   but it does require the assistance of the sysadmin.  Also note that
   in all versions of this you'll have to write the script as a .mt
   file rather than putting it in a stack, though of course you can
   access data and run handlers in other stacks from the .mt script.

  Regards,
Scott

 Hinduism Today
 
 Sivakatirswami
 Editor's Assistant/Production Manager
 [EMAIL PROTECTED] 
 www.HinduismToday.com, www.HimalayanAcademy.com,
 www.Gurudeva.org, www.hindu.org


Scott Raney  [EMAIL PROTECTED]  http://www.metacard.com
MetaCard: You know, there's an easier way to do that...


Archives: http://www.mail-archive.com/metacard@lists.runrev.com/
Info: http://www.xworlds.com/metacard/mailinglist.htm
Please send bug reports to [EMAIL PROTECTED], not this list.




Re: OT: Page generation Do it locally

2001-08-14 Thread Andu


I am at a cross roads with a rather large project to put a course of lessons
on the web where extracts from four text books are compiled to create a
Lesson of the Day which is determined by the ordinal day of the
astronomical year which begins on April 13.

Now Metacard was a God send in getting this job done...but now I am at a
cross roads on the final leg with two options:

1) Page generation locally, mc.cgi will simply pull a page:

I can run a script at home which loads  html page header, body and footer
templates, then extracts the lessons 1-365 from raws text source files and
generate 365 lessons totally about 7 megs of data and then FTP this to the
site and create a CGI in Metacard that simply calculates the integer for the
day of the year and serves up the corresponding file from a directory

OR

2)  Have MC Generate the pages on the server

I can move the source text and templates to the web server and convert my
local metacard button script to a .mt script and then let the web server
build the page each time someone hits on it.

The latter has lots of administrative advantages even though #1 is a
relatively simply operation should changes be required...

But the second option forces the web server to
   i) load three variables with small templates of html chunks
ii) load four variables with a total of about 2.5, meg of data from the
books, parse out the lessons for the day, make the necessary
insertions/concatenations into the templates and serve up the page.

Now, the latter obviously puts a heavier burden on the web server CPU. The
question which is beyond me is...for Apache running on a Sun Sparc Solaris,
is option 2 a trivial task? or given that at any point in time, 5-10 people
could be hitting on the link that invokes the CGI...would using option two
constitute an undue burden on the CPU of the web server? I know from running
it at home that the script to read in the data and create a single lesson is
almost instantaneous on a G4.  Any thoughts from the experiences ones?

this decision not only affects this project, but the whole direction for
page deployment to the web in the future.

Another option would be to have all lessons and the html templates as custom properties
of a stack in /cgi-bin. When the script is called it formats the page from the custom
properties of the stack. Or something...



thanks

Hinduism Today

Sivakatirswami
Editor's Assistant/Production Manager
[EMAIL PROTECTED] 
www.HinduismToday.com, www.HimalayanAcademy.com,
www.Gurudeva.org, www.hindu.org



Archives: http://www.mail-archive.com/metacard@lists.runrev.com/
Info: http://www.xworlds.com/metacard/mailinglist.htm
Please send bug reports to [EMAIL PROTECTED], not this list.

.


Regards, Andu
__
[EMAIL PROTECTED]

Archives: http://www.mail-archive.com/metacard@lists.runrev.com/
Info: http://www.xworlds.com/metacard/mailinglist.htm
Please send bug reports to [EMAIL PROTECTED], not this list.