Cgi stuff...

Richard MacLemale rmaclema at tampabay.rr.com
Fri Jun 28 17:33:01 EDT 2002


Gang,
I am in the process of writing a "mutual calendar" darwin.mc based cgi set
of scripts that run on OS X.  I've got a piece of info to share, and a
question to ask (so I guess I'm breaking even...)

The script I've got stores calendar info separate for each day.  When a
monthly calendar is called for, the script reads all 31 days and places the
data into a template web page and then sends that to the user's web browser
in html table-calendar form.

I wanted to see if it was faster to work with stacks or individual text
files, so I tried two approaches - in one case, I made a stack with 12 cards
(one for each month) and 31 fields on each card (one field for each day.)
In the second approach, I used folders and text files... Twelve folders,
with 31 text files in each.  (Yeah, I know there aren't 31 days in EVERY
month.  This is just a test.  Bear with me.)

I wrote a script that put a 100 character string of text into every day of
every month, and timed it with the ticks.

On average, the script took 20 ticks to write the data to the stack.
On average, the script took 40 ticks to write the data to separate text
files.

Then I wrote a script that read the info from every day of every month and
timed it.

On average, the script took 19 ticks to read the data from the stack.
On average, the script took 21 ticks to read the data from the text files.

It was interesting that writing to a bunch of separate text files took twice
as long as writing to a stack, but reading was almost the same speed on
both.  It does show the advantage of reading and writing to stacks over text
files when using darwin.mc.  BUT... Can a stack be corrupted if two or more
users are simultaneously writing to it?  Actually, that's the first
question.

Now the second question.  Does anyone have any experience using shared
calendar software, and if so, how does it work?  Meaning, if I am modifying
info for Monday the 3rd, is that day locked out for others so they can't
change it while I'm changing it (ala database rules,) and if so, does that
"time out", or leave the record "locked" like a database does?  Can two
people modify the same day at the same time?  If so, is it because each
"event" for each day is a separate piece of info?  I could do that with mc,
but the amount of time that mc will take to process each request will be too
high.  Right now I have 31 text files in 12 different folders (each file
representing a day) and mc can process requests in about 2 ticks - pretty
fast.  BUT, if two people are working on the same record at the same time,
then the last one to hit the Submit button wins, and that's no good.  Nor do
I want to resort to "locking" a day, because our users will pull up a day to
modify and then forget it and no one else will be able to get in unless I
rig up some type of "timeout" scheme.

Any ideas or insight that anyone has would be appreciated.  I am willing to
share these scripts when they're finished...


-- 
:)
Richard MacLemale
Network Administrator
J. W. Mitchell High School


















More information about the metacard mailing list