Re: Bug? Intermittent situation with CGI program

2002-07-15 Thread Sadhunathan Nadesan

Aloha,

We have identified an intermittent bug situation using MC as a CGI
language which I will submit to the bug list.  Personally I don't read
the bug list emails and I imagine there are others who don't either
but who might like to know of the existence of the situation.

In a nutshell it is that using MC as a CGI to collect data from a form
(which is in turn dynamically generated), it sometimes fails to
collect anything, on some large forms.  It is as if the form on the
web page did a transmit, but, the MC CGI did not do a receive.

I realize that itermittent bugs are very hard to track down.  We can
provide a test situation wherein, in one of our offices (NY) the cgi
always fails on a given form, for certain users running Outlook 2002
or Outlook 2000, and Windows 98, sometimes fails for other users in
this office (same set up), and never fails for other users in our San
Diego office with the same environment.  

This would seem to suggest the environment!  However, when we recode
the same CGI program in Perl, it always works for all users.  H!!
This might suggest something coded wrong or lacking in the MC program.

In other words, it might not really be a bug in MC.  I'm sending it in
anyway.

The basic scenario is like this:  a program on our main transaction
processing situation collects a series of invoice numbers from the
user.  It then generates an HTML form with a yes or no button for
approval of each invoice, and emails that to the person who is
supposed to approve it.

That person (a customer) insists they have to use Outlook, even if
this problem does not occur on other email clients (the customer is
always right).  They insist it has to work on their Win98 machine in
their NY office.  They are not willing to use a browser to submit the
same forms.

They fill in the yes/no buttons on this form and click submit and the
form calls the cgi back end in MC which in turn emails their response
to the right group and saves the emails in an archive so there is a
historical record of everything.

I am going to include in the next couple emails 3 things,
(since I have to conform to 15k or less per message).

1) a shell script for emailing an html form to someone, however, it
depends on other programs I am not supplying, so  you can basically
ignore this, send the form any way you like.

2) a form which is an example of the kind that are generated with a
list of invoice numbers - useful because it always fails for certain
users.  (other, shorter forms work for them).

3) the back end cgi in MC.

So, bottom line, if anyone has any suggestions to offer, please!

I'd hate to have to conclude that MC is unreliable and everything will
have to be coded in Perl.

Regards,
Sadhu
___
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard



Re: Bug? Intermittent situation with CGI program

2002-07-15 Thread Sadhunathan Nadesan

Promised 3rd mail follow up.


3. back end cgi


...cut here
#!/usr/local/bin/mc
#*
#
#-= Web Stuff =-
#
# Program name: test_approve.mt
# Version number:   1.0
# Author:   SN 
# Date: 04/09/02
# Description:  Process Foobar Invoice Approval form messages
#
#*

on startup
  global formdata, keywords, the_message

  put [EMAIL PROTECTED]  into recipient_string

  if ($REQUEST_METHOD = POST) then
read from stdin for $CONTENT_LENGTH
# Collect the information from the form
put it into url file:/tmp/it2.txt 
  else
put echo 'get'  into command_string
put | /usr/psl/bin/mimemail -s  after command_string
put 'Unhandled get in script' recipient_string after command_string
set shellCommand to /bin/sh
put shell(command_string)
  end if

  # Our user's Outlook sends extra null data, prevent acting on it
  if (length(it)  10) then
put echo 'got blank' into command_string
put | /usr/psl/bin/mimemail -s  after command_string
put 'Our user Blank' recipient_string  after command_string
set shellCommand to /bin/sh
put shell(command_string)
show_bad_get

  # if actual data is received, then act
  else
put urlDecode (it)  into formdata
put formdata into url file:/tmp/formdata2.txt 
put /usr/psl/bin/newcopy /tmp/formdata2.txt into command_string
set shellCommand to /bin/sh
put shell(command_string)
split formdata by  and =
put keys(formdata) into keywords
sort keywords

put formdata[email_address] after recipient_string 
# format the response as html
put empty into the_message
write_web_response
boiler
put the_message into url file:/tmp/commdata2.txt 
put /usr/psl/bin/newcopy /tmp/commdata2.txt into command_string
set shellCommand to /bin/sh
put shell(command_string)

# Email the form contents to the user
put /usr/psl/bin/mimemail  \  cr  into command_string
put -a /tmp/boiler2.txt   -t text/plain\  cr after command_string
put -a /tmp/commdata2.txt -t text/html \  cr after command_string
put -H -x  \  cr after command_string
put -r [EMAIL PROTECTED] \  cr after command_string
put -f [EMAIL PROTECTED]\  cr after command_string
put -s 'SUBJECT'   \  cr after command_string
put recipient_stringcr after command_string
replace SUBJECT with formdata[subject] in command_string
set shellCommand to /bin/sh
put shell(command_string)
put command_string into url file:/tmp/command2.txt 

# Playback form contents to the user
# Our user says, turn this off please
# sorry, no can do
show_response

  end if
end startup

on write_web_response
  global formdata, keywords, the_message

  put html  cr   into the_message
  put body bgcolor='white' text='black'  cr after the_message
  put center  crafter the_message
  put h2  crafter the_message
  put INVOICE APPROVAL CONFIRMATION  cr   after the_message
  put br  crafter the_message
  put Sent by Chloe Productions   cr  after the_message
  put br  crafter the_message
  put /h2  cr   after the_message

  put br  cr after the_message

  put /center  cr after the_message
  put br  cr  after the_message
  put br  cr  after the_message
  put h5  cr  after the_message

  put table BGCOLOR='#EFEDC5' BORDER=1 CELLPADDING=4 ALIGN=CENTER  cr after 
the_message

  put th align=center  cr after the_message
  put Approved?  cr after the_message
  put /th  cr after the_message

  put th align=center  cr after the_message
  put Inv #  cr after the_message
  put /th  cr after the_message

  put th align=center  cr after the_message
  put Inv Amount  crafter the_message
  put /th  cr after the_message

  put th align=center  cr after the_message
  put Paymaster  cr after the_message
  put /th  cr after the_message

  put th align=center  cr after the_message
  put Who Sends  cr after the_message
  put /th  cr after the_message

  put /h5  cr after the_message

  repeat for each line this_item in keywords
if (formdata[this_item] = Yes or formdata[this_item] = No) then

  put tr  cr after the_message

  # Need this false tag so program knows which invoices are approved.
  if (formdata[this_item] = Yes) then
   put approved_inv invoice= after the_message

Re: Bug? Intermittent situation with CGI program

2002-07-15 Thread Pierre Sahores

Sadhunathan Nadesan a écrit :
 
 Aloha,
 
 We have identified an intermittent bug situation using MC as a CGI
 language which I will submit to the bug list.  Personally I don't read
 the bug list emails and I imagine there are others who don't either
 but who might like to know of the existence of the situation.
 
 In a nutshell it is that using MC as a CGI to collect data from a form
 (which is in turn dynamically generated), it sometimes fails to
 collect anything, on some large forms.  It is as if the form on the
 web page did a transmit, but, the MC CGI did not do a receive.
 
 I realize that itermittent bugs are very hard to track down.  We can
 provide a test situation wherein, in one of our offices (NY) the cgi
 always fails on a given form, for certain users running Outlook 2002
 or Outlook 2000, and Windows 98, sometimes fails for other users in
 this office (same set up), and never fails for other users in our San
 Diego office with the same environment.
 
 This would seem to suggest the environment!  However, when we recode
 the same CGI program in Perl, it always works for all users.  H!!
 This might suggest something coded wrong or lacking in the MC program.
 
 In other words, it might not really be a bug in MC.  I'm sending it in
 anyway.
 
 The basic scenario is like this:  a program on our main transaction
 processing situation collects a series of invoice numbers from the
 user.  It then generates an HTML form with a yes or no button for
 approval of each invoice, and emails that to the person who is
 supposed to approve it.
 
 That person (a customer) insists they have to use Outlook, even if
 this problem does not occur on other email clients (the customer is
 always right).  They insist it has to work on their Win98 machine in
 their NY office.  They are not willing to use a browser to submit the
 same forms.
 
 They fill in the yes/no buttons on this form and click submit and the
 form calls the cgi back end in MC which in turn emails their response
 to the right group and saves the emails in an archive so there is a
 historical record of everything.
 
 I am going to include in the next couple emails 3 things,
 (since I have to conform to 15k or less per message).
 
 1) a shell script for emailing an html form to someone, however, it
 depends on other programs I am not supplying, so  you can basically
 ignore this, send the form any way you like.
 
 2) a form which is an example of the kind that are generated with a
 list of invoice numbers - useful because it always fails for certain
 users.  (other, shorter forms work for them).
 
 3) the back end cgi in MC.
 
 So, bottom line, if anyone has any suggestions to offer, please!
 
 I'd hate to have to conclude that MC is unreliable and everything will
 have to be coded in Perl.
 
 Regards,
 Sadhu
 ___
 metacard mailing list
 [EMAIL PROTECTED]
 http://lists.runrev.com/mailman/listinfo/metacard


Hello Sadhu,

I got the same kind of troubble, tree yahrs ago, before avoiding to use
MC as a direct CGI engine. By starting to use it, in both console and
graphical modes (under linux), as a Web application long running process
server (linked, one side, to the Apache cgi gateway trough a php cgi
script, acting as the MC sockets listener and, second side, to both a
PostgreSQL and a MySQL-Max servers, trough a second php script, directly
builded by a Metatalk script), i never got any bug in using this dual
config and the 10 lines of php are for me the best way to have more than
15.000 lines of great metatalk handling some fine web apps servers 24/24
hours, 7/7 days.

About Apache/PHP/Metacard, all you need is to read back my previous
wrotes in the archives. If needed, i can write about the way i use to
link together Metacard/PHP/PostgreSQL and Metacard/PHP/MySQL. In this
way, MC challengers are no more tools like PHP, Python or Perl but
stuffs like ColdFusion, OmnisStudio or the J2EE Web Apps Servers (alike
WebSphere or WebObjects) and MC is, clearly, the very best of them !!!

(working in production mode under Suse-Linux Intel 6.3/PHP 3.0.15/MC
2.32 to Suse-Linux Intel 8.0/PHP 4.0.6/MC 2.32 and, probably, soon under
MacOSX 1.0.15. - In between, while i'm running Suse-PPC 7.3 under a new
2002 IBook II Combo/DVD, i'm trying to install unsuccessfully yaboot,
nor lilo from within Yast2. Any idea on how to cleanly install the
boot-loader would be greatly apprecied ;-))

Regards, Pierre Sahores

WEB  VPN applications  databases servers
Inspection académique de Seine-Saint-Denis
Qualifier  produire l'avantage compétitif
___
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard



Re: Bug? Intermittent situation with CGI program

2002-07-15 Thread andu



--On Monday, July 15, 2002 13:54:28 -0700 Sadhunathan Nadesan 
[EMAIL PROTECTED] wrote:

 Aloha,

 We have identified an intermittent bug situation using MC as a CGI
 language which I will submit to the bug list.  Personally I don't read
 the bug list emails and I imagine there are others who don't either
 but who might like to know of the existence of the situation.

 In a nutshell it is that using MC as a CGI to collect data from a form
 (which is in turn dynamically generated), it sometimes fails to
 collect anything, on some large forms.  It is as if the form on the
 web page did a transmit, but, the MC CGI did not do a receive.

 I realize that itermittent bugs are very hard to track down.  We can
 provide a test situation wherein, in one of our offices (NY) the cgi
 always fails on a given form, for certain users running Outlook 2002
 or Outlook 2000, and Windows 98, sometimes fails for other users in
 this office (same set up), and never fails for other users in our San
 Diego office with the same environment.

 This would seem to suggest the environment!  However, when we recode
 the same CGI program in Perl, it always works for all users.  H!!
 This might suggest something coded wrong or lacking in the MC program.

 In other words, it might not really be a bug in MC.  I'm sending it in
 anyway.


snip

Two things I noticed in the last mail which may or may not have anything to 
do with your problem: when the script puts the reply I usually give 
Content_Length=length_of_reply  crlf also and use crlf for the header 
part instead of cr, the other thing

put /html  cr
put /body  cr

should actually be reversed though I don't think this is the problem.
Also might help to read from stdin until eof or empty rather then for 
$CONTENT_LENGTH. Also note that the shellCommand defaults to bash so you 
don't have to set it all the time, just do shell().

In any case I doubt there is a bug with MC, most likely the script 
somewhere.

Regards, Andu Novac
___
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard