Re: Web-PHP-Metacard Process FAQ

2002-07-16 Thread Pierre Sahores

Sivakatirswami wrote:
 
 Pierre:
 
 Your praises of Metacard as a long running process on a web server linked to
 a PHP front end etc. are very intriguing. Unfortunately for the untutored it
 is bit of a mystery... I looked at the archives of Metacard but they only go
 back to Nov 2001 and so your Posts with samples scripts and more thorough
 explanations... I can't find them. Do you have a FAQ on this somewhere with
 examples, diagram and a few scripts, sample HTML pages?
 
 Hinduism Today
 
 Sivakatirswami
 Editor's Assistant/Production Manager
 [EMAIL PROTECTED]
 www.HinduismToday.com, www.HimalayanAcademy.com,
 www.Gurudeva.org, www.hindu.org
 
 ___
 metacard mailing list
 [EMAIL PROTECTED]
 http://lists.runrev.com/mailman/listinfo/metacard

First : Do you have a linux box with apache, php and mc installed on it
? (If yes, it will be a piece of cake to explain how to run MC as a
WAS).

Second : How to get MC running in a long process mode, even in console
mode (without XWindows)

 Pierre Sahores wrote:
  
  Just alike you start other console apps from the bash prompt. To test
  this, just launch, from the shell, a new test.mc stack that only
  contains :
  
  on openstack
  put Hello World
  end openstack
  
  in typing /home/pierre/startcmc  at the prompt where startmc, set
  with an executable permission, contains :
  
  #!/home/pierre/mc
  on startup
   open stack /home/pierre/test.mc
  end startup
  
  If all is right done, you will see the Hello World ansered at
  prompt... and, in opening KSysGuard, you will see the startmc line
  entry, as a still running process...
  
   doesn't it need X?
  
  No. You need just an rc.d (level 3) bash starter script pointing to the
  stack you want to launch in the background (see the list archives). The
  only metatalk feature unavailable in console mode is the idle
  function. Is'n it great (Thanks again and again, Scott...) ?
  
 This is really nice, thanks for the tip.
  
  Have fun, Pierre Sahores
  
  WEB  VPN applications  databases servers
  Inspection académique de Seine-Saint-Denis
  Qualifier  produire l'avantage compétitif
 Andu
 

Tree : Put this in the stack script of your first MC-based WAS

 on newconnect s # reading  the request from a new socket
   read from socket s for 1 line with message serverread
 end newconnect
 
 on serverread x,y # processing the request
   global PostIn,Retour,Debut,Lepath
   put urldecode(y) into PostIn # données POST reçues de wmc.xml
   put cr into char (length(PostIn))-1 to (length(PostIn)) of PostIn
   put empty into Retour
   set itemdelimiter to 
   doswitcher
write Retour to socket x
   close socket x # x = adresse IP  |  n° d'ordre du socket fils reçu de wmc.xml
   repeat
 if the num of lines in (opensockets())  1 then close socket line 2 of 
(opensockets()) else exit repeat
   end repeat
 end serverread
 
 on socketTimout
 end socketTimout
 
 on doswitcher
   global PostIn,Retour
   set itemDelimiter to 
   if char 1 to 6 of item 1 of PostIn is TEST=1
   then Comtest1
   else if char 1 to 6 of item 1 of PostIn is TEST=2
   then Comtest2
 end doswitcher
 
 on PreOpenStack
   if the short name of this stack is not WMCEC then pass PreOpenStack
   put  Please, wait. WMC-3 server loading...
   set twelveHourTime to false
   put WMC-3 TCP/IP SEARCH/DB/APP'S server up since  the short date  ,  the 
short time
   set the socketTimeoutInterval to 10
   if the windows is WMCEC
   then accept connections on port 732 with message newconnect
   else accept connections on port 7321 with message newconnect
   open file Lepath  LOGia931.txt for append
   openstack
 end PreOpenStack
 
 on openstack
if the windows is not WMCEC then
 set the rect of window message box to 504,60,936,87
 set the rect of window WMCEC to 504,113,936,237
 if home is in the windows
 then hide window home
   end if
   if the windows contains Atelier then close stack Atelier
 end openstack

 on Comtest1
   global Retour
   put Hello Metacardians ! into Retour
 end Comtest1

 on Comtest2
   global PostIn,Retour
   put PostIn into Retour
 end Comtest2


Four : the PHP sockets-listener cgi-script (webmc.php)

 ?
 
 if ($REQUEST_METHOD == POST) {
 
   $headers = $HTTP_POST_VARS;
   while (list($header, $value) = each($headers)) $exAE .= $header=$value;
   $exAE = urlencode($exAE);
   $activapp = substr($exAE,0,5);
   
   if ($activapp == TEST=) {
 
   $connection = fsockopen(localhost, 765,  $error_number, 
$error_description, 30); 
   if ($connection) {
   set_socket_blocking($connection, true);
   fputs($connection,);
   fputs($connection,$exAE.\r\n);
   fpassthru($connection);
   }
   else{
   $connection = fsockopen(localhost, 7654,  $error_number, 
$error_description, 30);
 

Re: Web-PHP-Metacard Process FAQ - with some corrections !

2002-07-16 Thread Pierre Sahores

Sivakatirswami wrote:
 
 Pierre:
 
 Your praises of Metacard as a long running process on a web server linked to
 a PHP front end etc. are very intriguing. Unfortunately for the untutored it
 is bit of a mystery... I looked at the archives of Metacard but they only go
 back to Nov 2001 and so your Posts with samples scripts and more thorough
 explanations... I can't find them. Do you have a FAQ on this somewhere with
 examples, diagram and a few scripts, sample HTML pages?
 
 Hinduism Today
 
 Sivakatirswami
 Editor's Assistant/Production Manager
 [EMAIL PROTECTED]
 www.HinduismToday.com, www.HimalayanAcademy.com,
 www.Gurudeva.org, www.hindu.org
 
 ___
 metacard mailing list
 [EMAIL PROTECTED]
 http://lists.runrev.com/mailman/listinfo/metacard

First : Do you have a linux box with apache, php and mc installed on it
? (If yes, it will be a piece of cake to explain how to run MC as a
WAS).

Second : How to get MC running in a long process mode, even in console
mode (without XWindows)

 Pierre Sahores wrote:
  
  Just alike you start other console apps from the bash prompt. To test
  this, just launch, from the shell, a new test.mc stack that only
  contains :
  
  on openstack
  put Hello World
  end openstack
  
  in typing /home/pierre/startcmc  at the prompt where startmc, set
  with an executable permission, contains :
  
  #!/home/pierre/mc
  on startup
   open stack /home/pierre/test.mc
  end startup
  
  If all is right done, you will see the Hello World ansered at
  prompt... and, in opening KSysGuard, you will see the startmc line
  entry, as a still running process...
  
   doesn't it need X?
  
  No. You need just an rc.d (level 3) bash starter script pointing to the
  stack you want to launch in the background (see the list archives). The
  only metatalk feature unavailable in console mode is the idle
  function. Is'n it great (Thanks again and again, Scott...) ?
  
 This is really nice, thanks for the tip.
  
  Have fun, Pierre Sahores
  
  WEB  VPN applications  databases servers
  Inspection académique de Seine-Saint-Denis
  Qualifier  produire l'avantage compétitif
 Andu
 

Tree : Put this in the stack script of your first MC-based WAS

 on newconnect s # reading  the request from a new socket
   read from socket s for 1 line with message serverread
 end newconnect
 
 on serverread x,y # processing the request
   global PostIn,Retour,Debut,Lepath
   put urldecode(y) into PostIn # données POST reçues de wmc.xml
   put cr into char (length(PostIn))-1 to (length(PostIn)) of PostIn
   put empty into Retour
   set itemdelimiter to 
   doswitcher
write Retour to socket x
   close socket x # x = adresse IP  |  n° d'ordre du socket fils reçu de wmc.xml
   repeat
 if the num of lines in (opensockets())  1 then close socket line 2 of 
(opensockets()) else exit repeat
   end repeat
 end serverread
 
 on socketTimout
 end socketTimout
 
 on doswitcher
   global PostIn,Retour
   set itemDelimiter to 
   if char 1 to 6 of item 1 of PostIn is TEST=1
   then Comtest1
   else if char 1 to 6 of item 1 of PostIn is TEST=2
   then Comtest2
 end doswitcher
 
 on PreOpenStack
   if the short name of this stack is not WMCEC then pass PreOpenStack
   put  Please, wait. WMC-3 server loading...
   set twelveHourTime to false
   put WMC-3 TCP/IP SEARCH/DB/APP'S server up since  the short date  ,  the 
short time
   set the socketTimeoutInterval to 10
   if the windows is WMCEC
   then accept connections on port 732 with message newconnect
   else accept connections on port 7321 with message newconnect
   open file Lepath  LOGia931.txt for append
   openstack
 end PreOpenStack
 
 on openstack
if the windows is not WMCEC then
 set the rect of window message box to 504,60,936,87
 set the rect of window WMCEC to 504,113,936,237
 if home is in the windows
 then hide window home
   end if
   if the windows contains Atelier then close stack Atelier
 end openstack

 on Comtest1
   global Retour
   put Hello Metacardians ! into Retour
 end Comtest1

 on Comtest2
   global PostIn,Retour
   put PostIn into Retour
 end Comtest2


Four : the PHP sockets-listener cgi-script (wmc.php)

 ?
 
 if ($REQUEST_METHOD == POST) {
 
   $headers = $HTTP_POST_VARS;
   while (list($header, $value) = each($headers)) $exAE .= $header=$value;
   $exAE = urlencode($exAE);
   $activapp = substr($exAE,0,5);
   
   if ($activapp == TEST=) {
 
   $connection = fsockopen(localhost, 765,  $error_number, 
$error_description, 30); 
   if ($connection) {
   set_socket_blocking($connection, true);
   fputs($connection,);
   fputs($connection,$exAE.\r\n);
   fpassthru($connection);
   }
   else{
   $connection = fsockopen(localhost, 7654,  $error_number, 
$error_description, 30);
   

Re: Web-PHP-Metacard Process FAQ

2002-07-16 Thread Sadhunathan Nadesan

| Subject: Re: Web-PHP-Metacard Process FAQ

Pierre, excuse me for butting in here ..

| 
| First : Do you have a linux box with apache, php and mc installed on it
| ? (If yes, it will be a piece of cake to explain how to run MC as a
| WAS).

Swami has for deployment a Sun OS box with apache, php, and mc
installed.  Yes.  So as long as Linux is not part of the
required equation, ok.  Should be the latest of everything.

Or, I have a Linux box with apache, mc, but i can't quite
remember if php is linked into the apache, might be.  all are
slightly older versions of everything, however.


| 
| Second : How to get MC running in a long process mode, even in console
| mode (without XWindows)
| 

Not sure what you mean by running in a long process mode?  We simply
installed the (pre-compiled) interpreter  (the file mc) and are
running scripts using that.  Can you explain long process mode?
Sorry, never heard of it.

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



Re: Web-PHP-Metacard Process FAQ

2002-07-16 Thread Pierre Sahores

Sadhunathan Nadesan a écrit :
 
 | Subject: Re: Web-PHP-Metacard Process FAQ
 
 Pierre, excuse me for butting in here ..
 
 |
 | First : Do you have a linux box with apache, php and mc installed on it
 | ? (If yes, it will be a piece of cake to explain how to run MC as a
 | WAS).
 
 Swami has for deployment a Sun OS box with apache, php, and mc
 installed.  Yes.  So as long as Linux is not part of the
 required equation, ok.  Should be the latest of everything.
 
 Or, I have a Linux box with apache, mc, but i can't quite
 remember if php is linked into the apache, might be.  all are
 slightly older versions of everything, however.

It must be ok too under Solaris but as far as i have never tested the mc
Solaris engine before, you will have to verify this by your self. If all
the mc unixes engines are builded in the same way, this will probably be
ok. Perhaps will you have to ask some help about that to Scott to avoid
to have to use your old Linux box.

 |
 | Second : How to get MC running in a long process mode, even in console
 | mode (without XWindows)
 |
 
 Not sure what you mean by running in a long process mode?  We simply
 installed the (pre-compiled) interpreter  (the file mc) and are
 running scripts using that.  Can you explain long process mode?
 Sorry, never heard of it.

Your mc config is ok too if the permissions are set as needed. What i
meen in speaking about an mc long running process is the way to have
mc running in the background (even in console mode) as any other server
with the key ability to wait for the requests coming from Apache trough
the wmc.php (or wmc.xml, it's the same file in my previous post) without
to have to quit after each request as the simple .mt cgi scripts does.
Because this long running process mode, the mc-based web applications
server is able to handle persistant global variables alike flatfiles
databases, alike persistant sessions to the clients and so on. Is that
more clear, yet ?

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

Best 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