Re: MC CGI - What can't I do?

2002-08-27 Thread David Bovill

On Tue, 2002-08-27 at 05:31, andu wrote:
 
 
 --On Monday, August 26, 2002 21:21:49 -0700 Richard Gaskin 
 [EMAIL PROTECTED] wrote:
 
 
  - paint tools do not generate an error:
  choose brush tool
  set the brushcolor to blue
  drag from 60,60 to 80,80
  select img 1 of stack tmp/formdata.mc
  export png to file myimg.png
 

Have you tried accesing the image data directly using 2.4 features - my
guess is that would work?


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



Progress During Downloads

2002-08-27 Thread Ray Horsley

If I use put url myUrl into url myDiskPath for a lengthy download, does
anybody know of a way to receive information from MetaCard during the
download so a progress graph can be shown to the user?

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



Re: Demo stack not working in Linux

2002-08-27 Thread David Bovill

On Mon, 2002-08-26 at 17:42, Scott Raney wrote:

 No, it's apparently just a conflict in the way the KDE (didn't try
 Gnome) window manager stacks windows: it's putting the backdrop window
 on *top* of the other windows.  Worse, KDE at some point completely
 lost the ability to show a window with no title bar, ruining many of
 the other animation effects in the demo stack.
 

Don't get me wrong - I kind of like the minimal aesthetic of the new
Demo Stack :) I think I can dump KDE for now... it is pretty slow. Which
window managers work the best with mc? From reading the instal docs -
windowmaker seems preffered. 

Anyone use any others that work well for them... I'm looking for
something lean and fast that I can customize to make standalone machines
out of?

Thanks,

david


NB - I've also found that large stack won't display in the latest
version of KDE, they open but are not visible... works fine with
windowmaker.


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



Re: Demo stack not working in Linux

2002-08-27 Thread andu



--On Tuesday, August 27, 2002 17:07:14 + David Bovill 
[EMAIL PROTECTED] wrote:


 Anyone use any others that work well for them... I'm looking for
 something lean and fast that I can customize to make standalone machines
 out of?

I use Fluxbox as wm which is as lean and fast as it can get (makes you feel 
really sorry for kde users;-). The windows looks and behavior can also be 
customized easily. For desktop I use Rox which uses gtk (I stayed away from 
gtk 2.x since I got tired of updating zillions of libraries and it doesn't 
really bring something new). The combination of Fluxbox and Rox is as fast 
and small and stable as it can get and you get all the features you 
actually need plus more.


 Thanks,

 david


 NB - I've also found that large stack won't display in the latest
 version of KDE, they open but are not visible... works fine with
 windowmaker.


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




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



Filter help

2002-08-27 Thread FlexibleLearning
Okay, so one day I'll track down a list of Bourne Shell options as mentioned in the Help entry on Filters, but just for now...

[1] Using AND
How do we filter to extract both *.gif AND *.jpg from a list of file names?

[2] Using NOT
And how do we do the reverse, such as 'All files except *.txt' ?

Any pointers would be truly appreciated!

/H


RE: XP - window metrics

2002-08-27 Thread Chipp Walters

Ken,

Thanks!! I'll check it out.

 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED]]On Behalf Of Ken Ray
 Sent: Tuesday, August 27, 2002 12:06 AM
 To: [EMAIL PROTECTED]
 Subject: Re: XP - window metrics


 Chipp,

 I just discovered that Tuviah's External Collection 1.0 (the one with the
 Windows version included) has support for getting the rect of the TaskBar.
 It won't tell you if it's always on top, but at least you'll know where it
 is...

 Ken Ray
 Sons of Thunder Software
 Email: [EMAIL PROTECTED]
 Web Site: http://www.sonsothunder.com/

 - Original Message -
 From: Chipp Walters [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Sunday, August 25, 2002 1:03 AM
 Subject: RE: XP - window metrics


  Richard (or anyone else)..
 
  Do you know how to check (registry settings) for the taskbar
 height...and
 if
  it's set to 'always on top'? And..if it works on different Win32 OS'es.
  I'm building an app which toggles a control bar from the top of
 the screen
  to the bottom and need to know where to set it's loc at the bottom. Any
 help
  would be great!
 
  -Chipp Walters
 
  ___
  metacard mailing list
  [EMAIL PROTECTED]
  http://lists.runrev.com/mailman/listinfo/metacard
 


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

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



Re: MC CGI - What can't I do?

2002-08-27 Thread Richard Gaskin

David Bovill wrote:

 --On Monday, August 26, 2002 21:21:49 -0700 Richard Gaskin
 [EMAIL PROTECTED] wrote:
 
 - paint tools do not generate an error:
 choose brush tool
 set the brushcolor to blue
 drag from 60,60 to 80,80
 select img 1 of stack tmp/formdata.mc
 export png to file myimg.png
 
 Have you tried accesing the image data directly using 2.4 features - my
 guess is that would work?

I thought about it, but at that point I'd be recreating a combination of
MC's graphics routines and OS graphics routines in MetaTalk.  Likely slow,
and certainly more than I'd want to chew off:  who wants to calculate curves
in imagedata?

-- 
 Richard Gaskin 
 Fourth World Media Corporation
 Custom Software and Web Development for All Major Platforms
 Developer of WebMerge 2.0: Publish any Database on Any Site
 ___
 [EMAIL PROTECTED]   http://www.FourthWorld.com
 Tel: 323-225-3717   AIM: FourthWorldInc

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



Re: Filter help

2002-08-27 Thread Michael Kann

-- For simulating a logical AND --

on mouseUp
  put fld aFld into filesList
  replace .jpg with .jpg! in filesList
  replace .gif with .gif! in filesList
  filter filesList with *!*
  replace ! with empty in filesList
  put filesList into fld bFld
end mouseUp


--- [EMAIL PROTECTED] wrote:
 Okay, so one day I'll track down a list of Bourne
 Shell options as mentioned 
 in the Help entry on Filters, but just for now...
 
 [1] Using AND
 How do we filter to extract both *.gif AND *.jpg
 from a list of file names?
 
 [2] Using NOT
 And how do we do the reverse, such as 'All files
 except *.txt' ?

__
Do You Yahoo!?
Yahoo! Finance - Get real-time stock quotes
http://finance.yahoo.com
___
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard



Re: Filter help

2002-08-27 Thread Michael Kann

-- not using Filter, but does the same thing --

on mouseUp
  put fld aFld into filesList
  repeat for each line kLine in filesList
if .txt is not in kLine then
  put returnkLine after kHolder
end if
  end repeat
  put kHolder into fld bFld
end mouseUp


--- [EMAIL PROTECTED] wrote:
 Okay, so one day I'll track down a list of Bourne
 Shell options as mentioned 
 in the Help entry on Filters, but just for now...
 
 [1] Using AND
 How do we filter to extract both *.gif AND *.jpg
 from a list of file names?
 
 [2] Using NOT
 And how do we do the reverse, such as 'All files
 except *.txt' ?

__
Do You Yahoo!?
Yahoo! Finance - Get real-time stock quotes
http://finance.yahoo.com
___
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard



Re: Filter help

2002-08-27 Thread Michael Kann

-- The NOT filter

on mouseUp
  put fld aFld into filesList
  replace .txt with !txt in filesList
  filter filesList with *.*
  replace ! with . in filesList
  put filesList into fld bFld
end mouseUp


--- [EMAIL PROTECTED] wrote:
 Okay, so one day I'll track down a list of Bourne
 Shell options as mentioned 
 in the Help entry on Filters, but just for now...
 
 [1] Using AND
 How do we filter to extract both *.gif AND *.jpg
 from a list of file names?
 
 [2] Using NOT
 And how do we do the reverse, such as 'All files
 except *.txt' ?
 
 Any pointers would be truly appreciated!
 
 /H
 


__
Do You Yahoo!?
Yahoo! Finance - Get real-time stock quotes
http://finance.yahoo.com
___
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard



Get a List of Files

2002-08-27 Thread Scott Rossi

How might one get a list of all files from a folder which contains nested
folders and files several levels deep?

folder1
-- file1
-- file2
-- file3
-- folderA
-- file1
-- file2
-- folderX
-- file1
-- file2
-- file 3
-- file4

Thanks  Regards,

Scott Rossi
Creative Director
Tactile Media, Multimedia  Design
-
E: [EMAIL PROTECTED]
W: http://www.tactilemedia.com

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



Re: Get a List of Files

2002-08-27 Thread Ken Ray

I wrote a quick little directorywalker stack that does this, and reports
back whether it is a file (optionally along with its type) or a folder, and
(optionally) indents the hierarchy. It was for Windows files only (so
there's no Mac type/creator checking), but here's the script:

  -- Card controls: [X] Show Hierarchy, [X] Show Type, [popup menu
Delimiters - had Spaces (2), Spaces (4) or Tabs as choices
  -- Field 1 holds the result

global gHierList,gMainFolder,gBaseLevels

on mouseUp
  put  into gHierList
  answer folder Pick a folder you want to walk:
  if it =  then exit mouseUp
  set the itemDel to /
  put it into gMainFolder
  put the number of items of gMainFolder into gBaseLevels
  directoryWalk gMainFolder,(the hilite of btn ShowHierarchy),(the
selectedText of btn Delimiters),(the hilite of btn ShowType)
  put gHierList into field 1
end mouseUp

on directoryWalk whatFolder,showHier,pDel,showType
  set the itemDel to /
  if (2) is in pDel then put 2 into numSpcs
  else put 4 into numSpcs
  put  into spcPad
  set the directory to whatFolder
  if showHier then
put ((the number of items of whatFolder)) - gBaseLevels into numLevels
if pDel  tabs then
  do put format(  quote  %  (numLevels*numSpcs)  s  quote 
,  quote  quote  )  into tPad
else
  do put format(  quote  %  (numLevels)  s  quote  , 
quote  quote  )  into tPad
  replace   with numToChar(9) in tPad
end if
put last item of whatFolder into tFolderName
if showType then put numToChar(9)  folder after tFolderName
if numLevels  0 then
  put tPad  tFolderName into line (the number of lines of gHierList)+1
of gHierList
else
  put tFolderName into line (the number of lines of gHierList)+1 of
gHierList
end if
  end if
  put the files into temp
  sort temp
  repeat with x = 1 to the number of lines of temp
if not(showHier) then
  put whatFolder  /  (line x of temp) into line (the number of lines
of gHierList)+1 of gHierList
else
  put whatFolder  /  (line x of temp) into tPath
  put ((the number of items of tPath)) - gBaseLevels into numLevels
  if pDel  tabs then
do put format(  quote  %  (numLevels*numSpcs)  s  quote 
,  quote  quote  ) into tPad
  else
do put format(  quote  %  (numLevels)  s  quote  , 
quote  quote  ) into tPad
replace   with numToChar(9) in tPad
  end if
  put line x of temp into tFile
  if showType then put addFileType(tFile) into tFile
  if numLevels  0 then
put tPad  tFile into line (the number of lines of gHierList)+1 of
gHierList
  else
put tFile into line (the number of lines of gHierList)+1 of
gHierList
  end if
end if
  end repeat
  put the directories into tDirList
  sort tDirList
  repeat with x =  2 to the number of lines of tDirList
directoryWalk (whatFolder  /  (line x of
tDirList)),showHier,pDel,showType
  end repeat
end directoryWalk

function addFileType what
  put offset(.,what) into tChar
  if tChar  0 then
put char tChar to length(what) of what into tExt
put
queryRegistry(HKEY_CLASSES_ROOT\(queryregistry(HKEY_CLASSES_ROOT\tExt
\))  \) into tType
  else
put  into tType
put  into tExt
  end if
  if tType =  then
if tExt   then
  delete char 1 of tExt  -- remove .
  put toUpper(tExt)  File into tType
else
  put File into tType
end if
  end if
  return what  numToChar(9)  tType
end addFileType


Hope this helps,

Ken Ray
Sons of Thunder Software
Email: [EMAIL PROTECTED]
Web Site: http://www.sonsothunder.com/


- Original Message -
From: Scott Rossi [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, August 27, 2002 2:17 PM
Subject: Get a List of Files


 How might one get a list of all files from a folder which contains nested
 folders and files several levels deep?

 folder1
 -- file1
 -- file2
 -- file3
 -- folderA
 -- file1
 -- file2
 -- folderX
 -- file1
 -- file2
 -- file 3
 -- file4

 Thanks  Regards,

 Scott Rossi
 Creative Director
 Tactile Media, Multimedia  Design
 -
 E: [EMAIL PROTECTED]
 W: http://www.tactilemedia.com

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


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



Re: Get a List of Files

2002-08-27 Thread Ray Horsley

on 8/27/02 12:55 PM, Ken Ray at [EMAIL PROTECTED] wrote:

 I wrote a quick little directorywalker stack that does this, and reports
 back whether it is a file (optionally along with its type) or a folder, and
 (optionally) indents the hierarchy. It was for Windows files only (so
 there's no Mac type/creator checking), but here's the script:
 
 -- Card controls: [X] Show Hierarchy, [X] Show Type, [popup menu
 Delimiters - had Spaces (2), Spaces (4) or Tabs as choices
 -- Field 1 holds the result
 
 global gHierList,gMainFolder,gBaseLevels
 
 on mouseUp
 put  into gHierList
 answer folder Pick a folder you want to walk:
 if it =  then exit mouseUp
 set the itemDel to /
 put it into gMainFolder
 put the number of items of gMainFolder into gBaseLevels
 directoryWalk gMainFolder,(the hilite of btn ShowHierarchy),(the
 selectedText of btn Delimiters),(the hilite of btn ShowType)
 put gHierList into field 1
 end mouseUp
 
 on directoryWalk whatFolder,showHier,pDel,showType
 set the itemDel to /
 if (2) is in pDel then put 2 into numSpcs
 else put 4 into numSpcs
 put  into spcPad
 set the directory to whatFolder
 if showHier then
 put ((the number of items of whatFolder)) - gBaseLevels into numLevels
 if pDel  tabs then
 do put format(  quote  %  (numLevels*numSpcs)  s  quote 
 ,  quote  quote  )  into tPad
 else
 do put format(  quote  %  (numLevels)  s  quote  , 
 quote  quote  )  into tPad
 replace   with numToChar(9) in tPad
 end if
 put last item of whatFolder into tFolderName
 if showType then put numToChar(9)  folder after tFolderName
 if numLevels  0 then
 put tPad  tFolderName into line (the number of lines of gHierList)+1
 of gHierList
 else
 put tFolderName into line (the number of lines of gHierList)+1 of
 gHierList
 end if
 end if
 put the files into temp
 sort temp
 repeat with x = 1 to the number of lines of temp
 if not(showHier) then
 put whatFolder  /  (line x of temp) into line (the number of lines
 of gHierList)+1 of gHierList
 else
 put whatFolder  /  (line x of temp) into tPath
 put ((the number of items of tPath)) - gBaseLevels into numLevels
 if pDel  tabs then
 do put format(  quote  %  (numLevels*numSpcs)  s  quote 
 ,  quote  quote  ) into tPad
 else
 do put format(  quote  %  (numLevels)  s  quote  , 
 quote  quote  ) into tPad
 replace   with numToChar(9) in tPad
 end if
 put line x of temp into tFile
 if showType then put addFileType(tFile) into tFile
 if numLevels  0 then
 put tPad  tFile into line (the number of lines of gHierList)+1 of
 gHierList
 else
 put tFile into line (the number of lines of gHierList)+1 of
 gHierList
 end if
 end if
 end repeat
 put the directories into tDirList
 sort tDirList
 repeat with x =  2 to the number of lines of tDirList
 directoryWalk (whatFolder  /  (line x of
 tDirList)),showHier,pDel,showType
 end repeat
 end directoryWalk
 
 function addFileType what
 put offset(.,what) into tChar
 if tChar  0 then
 put char tChar to length(what) of what into tExt
 put
 queryRegistry(HKEY_CLASSES_ROOT\(queryregistry(HKEY_CLASSES_ROOT\tExt
 \))  \) into tType
 else
 put  into tType
 put  into tExt
 end if
 if tType =  then
 if tExt   then
 delete char 1 of tExt  -- remove .
 put toUpper(tExt)  File into tType
 else
 put File into tType
 end if
 end if
 return what  numToChar(9)  tType
 end addFileType
 
 
 Hope this helps,
 
 Ken Ray
 Sons of Thunder Software
 Email: [EMAIL PROTECTED]
 Web Site: http://www.sonsothunder.com/
 
 
 - Original Message -
 From: Scott Rossi [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Tuesday, August 27, 2002 2:17 PM
 Subject: Get a List of Files
 
 
 How might one get a list of all files from a folder which contains nested
 folders and files several levels deep?
 
 folder1
 -- file1
 -- file2
 -- file3
 -- folderA
 -- file1
 -- file2
 -- folderX
 -- file1
 -- file2
 -- file 3
 -- file4
 
 Thanks  Regards,
 
 Scott Rossi
 Creative Director
 Tactile Media, Multimedia  Design
 -
 E: [EMAIL PROTECTED]
 W: http://www.tactilemedia.com
 
 ___
 metacard mailing list
 [EMAIL PROTECTED]
 http://lists.runrev.com/mailman/listinfo/metacard
 
 
 ___
 metacard mailing list
 [EMAIL PROTECTED]
 http://lists.runrev.com/mailman/listinfo/metacard
 


Thanks Ken!!!   Real handy thing to have.



Ray Horsley
Developer, LinkIt! Software

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



Re: Get a List of Files

2002-08-27 Thread Scott Rossi

Recently, Scott Rossi  wrote:

 How might one get a list of all files from a folder which contains nested
 folders and files several levels deep?

In my ignorance, I forgot to check my archived mail files which contained
this modified code snippet from Geoff Canyon:


global gHierList,gMainFolder,gBaseLevels
local tCount

on mouseUp
  put  into gHierList
  put  into fld tresult
  answer folder Pick a folder you want to walk:
  put it into gMainFolder
  if gMainFolder =  then exit mouseUp
  set the itemDel to /
  put 0 into tCount
  put the number of items of gMainFolder into gBaseLevels
  directoryWalk gMainFolder
  put gHierList into fld tresult
end mouseUp

on directoryWalk whatFolder
  --put whatFolder
  --exit to top
  set the itemDel to /
  set the directory to whatFolder
  put the files into temp
  add the number of lines of temp to tCount
  # filter temp with *.html
  sort temp
  repeat for each line x in temp
put whatFolder  /  x  cr after gHierList
  end repeat
  put the folders into tDirList
  sort tDirList
  delete line 1 of tDirList
  repeat for each line x in tDirList
directoryWalk (whatFolder  /  x)
  end repeat
end directoryWalk


Thanks to Ken Ray as well for posting his modified modified version. :-)

(I'll probably make some modifications as well...)

Regards,

Scott Rossi
Creative Director
Tactile Media, Multimedia  Design
-
E: [EMAIL PROTECTED]
W: http://www.tactilemedia.com

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



Re: Demo stack not working in Linux

2002-08-27 Thread David Bovill

On Tue, 2002-08-27 at 16:30, andu wrote:
 
 I use Fluxbox as wm which is as lean and fast as it can get (makes you feel 
 really sorry for kde users;-). The windows looks and behavior can also be 
 customized easily. For desktop I use Rox which uses gtk (I stayed away from 
 gtk 2.x since I got tired of updating zillions of libraries and it doesn't 
 really bring something new). The combination of Fluxbox and Rox is as fast 
 and small and stable as it can get and you get all the features you 
 actually need plus more.

I've heard good things about Fluxbox - tried to install Fluxbox-AA the
other day and failed - but will give Fluxbox a try.
 
Thanks



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



Re: Linux and Video

2002-08-27 Thread David Bovill

What's the latest? What's the best format to use for xplatform video in
MC?

I thought that MPEG1 was the crossplatform format... looking at the man
pages for xanim... MPEG playback is incomplete, and the player choked on
a downloaded movie. Noatun plays it using Mpeglib...

Reference talks about the videoclipplayer property (well one sentence:).
Should I use this to change it to an mpegplayer?



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



Can I put Multiple handlers in a CGI script?

2002-08-27 Thread Rich Mooney

As I understand it, a CGI needs to be in the following format:

#! mc
on Startup
#script
end Startup

I also have the impression that any script in this CGI had to be between on
Startup and end Startup.
So does this mean that one CGI file is one handler and that I can't pass
arguments to it or can I do something like this:

#! mc
on Startup
on handler1 param1 param2
# do stuff
end handler1
function dosomething
# do stuff
end dosomething
end Startup

Rich Mooney
Payne Sparkman Mfg.
[EMAIL PROTECTED]

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



Re: Can I put Multiple handlers in a CGI script?

2002-08-27 Thread Phil Davis

- Original Message - 
From: Rich Mooney [EMAIL PROTECTED]
To: MetaCard Mail List [EMAIL PROTECTED]
Sent: Tuesday, August 27, 2002 3:35 PM
Subject: Can I put Multiple handlers in a CGI script?


 As I understand it, a CGI needs to be in the following format:
 
 #! mc
 on Startup
 #script
 end Startup
 
 I also have the impression that any script in this CGI had to be between on
 Startup and end Startup.

Nope. The 'startup' message is the only message MC sends/fires in a CGI script (I 
think), but it's just another Metatalk message and follows all the same rules as all 
the others (no nested handlers). From within the 'startup' handler, you can reference 
any number of other standard or custom handlers/functions/etc. Like this:

-- start of script --

on startup
  if firstchar(the platform) = char 1 of the systemVersion then
doDance Windows?
  else
doDance Mac?
  end if

  writeSomething
end startup

function firstChar pCharString
  return char 1 of pCharString
end firstChar

on doDance pDanceType
  tellSomeone Are you running  pDanceType
end doDance

on tellSomeone pMessage
  put Content Type: text/html  cr \
   Content Length:  length(pMessage)  cr  cr

  put pMessage
end tellSomeone

on writeSomething
  put Uh
end writeSomething

-- end of script --


 So does this mean that one CGI file is one handler and that I can't pass
 arguments to it or can I do something like this:


The 'startup' message has no params, but you can create other handlers in your CGI 
script that use'em (see above).

Phil

 
 #! mc
 on Startup
 on handler1 param1 param2
 # do stuff
 end handler1
 function dosomething
 # do stuff
 end dosomething
 end Startup
 
 Rich Mooney
 Payne Sparkman Mfg.
 [EMAIL PROTECTED]
 
 ___
 metacard mailing list
 [EMAIL PROTECTED]
 http://lists.runrev.com/mailman/listinfo/metacard

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



Re: Can I put Multiple handlers in a CGI script?

2002-08-27 Thread andu



--On Tuesday, August 27, 2002 18:35:01 -0400 Rich Mooney 
[EMAIL PROTECTED] wrote:

 As I understand it, a CGI needs to be in the following format:

# ! mc
 on Startup
 #script
 end Startup

 I also have the impression that any script in this CGI had to be between
 on Startup and end Startup.
 So does this mean that one CGI file is one handler and that I can't pass
 arguments to it or can I do something like this:

You can put as many handlers and/or functions in cgi scripts as you need.


# ! mc
 on Startup
 on handler1 param1 param2
 # do stuff
 end handler1
 function dosomething
 # do stuff
 end dosomething
 end Startup

 Rich Mooney
 Payne Sparkman Mfg.
 [EMAIL PROTECTED]

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




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



More CGI Stuff

2002-08-27 Thread Yennie
Hi guys,

With all of this CGI talk lately, I cooked something up.
I've been working with a server program based on the ol' mc httpd stack, since I make heavy use of Valentina. However, I've always wanted to break it down into separate cgi scripts. Among other things, that gives me multiple processes more easily.

So my question... is there *any* way to access externals (including the new Mach-o ones with 2.4.3) from a CGI script?

The best I can come up with is running a separate stack which houses the external, and communicating via sockets.

Any ideas?

In case anyone finds this script useful, this is what I'm using to talk to my mc httpd-inspired stack:

#!mc
on startup
  open socket to "127.0.0.1:8080"

  put $REQUEST_METHOD$REQUEST_URI"CGI"crLF into theRequest
  if ($HTTP_COOKIE is not empty) then
  put "Cookie: "$HTTP_COOKIEcrLF after theRequest
  end if
  if ($REMOTE_USER is not empty) then
  put "Remote-User:"$REMOTE_USERcrLF after theRequest
  end if

  if ($REQUEST_METHOD = "PUT") then
  read from stdin until empty
  put crLFit after theRequest
  end if

  write theRequestcrLFcrLF to socket "127.0.0.1:8080"

  read from socket "127.0.0.1:8080" until (crLFcrLF)
  put it into theHeaders
  put lineOffset(theHeaders, "Content-Length:") into theLine
  if (theLine  0) then
  set the itemDelimiter to ":"
  put item 2 of line theLine of theHeaders into theLength
  read from socket "127.0.0.1:8080" for theLength
  put it into theBody
  else
  read from socket "127.0.0.1:8080" until empty
  put it into theBody
  end if

  ## delete the status line
  delete line 1 of theHeaders
  put (theHeaderscrLFcrLFtheBody)
end startup

Best Regards,
Brian


Re: Can I put Multiple handlers in a CGI script?

2002-08-27 Thread Sivakatirswami

on 08-27-2002 12:35 PM, Rich Mooney at [EMAIL PROTECTED] wrote:

 As I understand it, a CGI needs to be in the following format:


Maybe this will help you get started... This CGI drives the shop site
dynamic order generation at

www.himalayanacademy.com/hawaii/iraivan/donate/

I am not an expert, so the code might be much more refined... But it works.
Credit for inspiration goes to Andu Novac

We can develop these things on my own machine now with MAX OSX... Which is
really great!
===

#!/mc  ## this path will vary  depending on your host...but you can install
MC on a virtual host without root access... No problem.

on startup
if $REQUEST_METHOD is POST then
  read from stdin until empty
 
  ## put the form data into an array, sort  save off
  put  urlDecode (it)  into tDataIn
  split tDataIn by  and =
  
  
  if quantity is among the lines of keys(tDataIn) then
   
## this is the initial selection of product/quantity choices
## so we process the quantity to build the order form.
   
 set the numberformat to #.00
  
  ## calculate price by product
  
 
  
   switch tDataIn[00_item_name]
   case 2003_calendar
   put calculateCalendar (tDataIn[quantity]) into tsubtotal
   put 2003 Calendar into  theItem
   break
   case box_5_rudrakshas
   put calculateRudraksha (tDataIn[quantity]) into tsubtotal
   put Boxes of Five Rudraksha Beads into  theItem
   break
   end switch
  
  ## coerce shipping integer to dollar format with fake calculation
 put 0 into tShipping
  put (0+tShipping) into tShipping
   
   put tsubtotal+tshipping into tTotal
   
   
   ## generate order form
  put url file:../hawaii/iraivan/donate/order_form_template.html into
tOrderForm

replace ###item###  with theItem in tOrderForm
 replace ###Quantity###  with tDataIn[quantity] in tOrderForm
replace ###item_name### with tDataIn[00_item_name] in tOrderForm

  replace ###Subtotal###  with tSubtotal in tOrderForm
  replace ###Shipping###  with tShipping in tOrderForm
 replace ###Total###  with tTotal  in tOrderForm
  
  put  tOrderForm into tResponse
 
  ## return online-invoice-order  to client to fill in and exit

  put Content-Type: text/html  cr
   put Content-Length:  the length of tResponse  cr  cr
   put tResponse
   exit startup
  end if
  
  
  # If this is not the entry page submission,
  # then it must be the actual order form submission.
  
  
  if 01_Quantity is among the lines of keys(tDataIn) then
  
  ##Yes, this is the actual order coming down the pipe
  ## Build the submission data first
  
  ## First get full product title out
  switch tDataIn[00_item_name]
 case 2003_calendar
   put 2003 Iraivan Temple Calendar into  tDataIn[00_item_name]
   break
 case box_5_rudrakshas
  put Boxes of Five Rudraksha Beads into  tDataIn[00_item_name]
  break
   end switch
 put keys(tDataIn) into tFields
  sort lines of tFields
 repeat for each line x in tFields
put (x  tab  tDataIn[x]  cr ) after tSubmit
 end repeat
 --delete last line of tSubmit
 # Now check for missing fields
 set the itemdel to tab
 put empty into missing_fields
 repeat for each line x in tSubmit
 if (item 1 of x is not among the words of 09_Phone 13_add2 14_add3
19_comments ) then
   if item 2 of x is empty then put item 1 of x  br after
missing_fields
  end if
 end repeat
 if missing_fields is not empty then
 sendUserFeedback (missing_fields)
 exit startup
 end if
 
 # Acknowledge the order to the user:
 
  put  tDataIn[10_First] tDataIn[11_Last] into vName
 put url file:../hawaii/iraivan/donate/order_confirmation.html into
tResponse
replace ###NAME### with vName in tResponse
replace ###item_name### with tDataIn[00_item_name] in tResponse

end if

  # save the order to file on server

put crcr==cr the date  the time  cr tSubmit after
url file:../formdata/temple_donations.txt

# return  order acknowledgement page to client

  put Content-Type: text/html  cr
   put Content-Length:  the length of tResponse  cr  cr
   put tResponse
   
   
# Now email the appropriate notices

put /usr/lib/sendmail -t into mprocess
 
  # Order alert notice to headquarters

put An order for   tDataIn[01_Quantity]   of   
tDataIn[00_item_name]  has arrived from   vName   of  
tDataIn[15_City]  . Who added this comment:tDataIn[19_comments]
 cr  cr  . Go get the CC#. into tMessage
 open process mprocess for write
 write From:  [EMAIL PROTECTED]  cr to process mprocess
 write To:  [EMAIL PROTECTED]  cr to process mprocess
 write Subject: tDataIn[00_item_name]Order  cr  cr to
process mprocess
write tMessage  cr to process mprocess

close process mprocess
   wait until the openprocesses is empty
   
# email Confirmation to the buyer
 open process mprocess for write
write From:  [EMAIL PROTECTED]  cr to process mprocess
 write To: