Re: open source (Richard Gaskin)
| | As Scott said the MC IDE is now open source so you can continue to | | maintain | | an engine license and use the MC IDE instead of Rev. It's up to you if | | you | | want to switch or not but it seems that all development will go into | | the | | engine and the Rev IDE. Ok, this is the part I find confusing - people referring to these products as if they had 2 parts. IDE and engine. I propose it should be 3 or more parts. Take for example, data base calls. From the point of view of a developer, these fuctions are used in their code the same way they would use any fuunction from the core engine. Correct? Yet, apparently, they are not part of the core engine, but some kind of library layer on top of the engine. Is that true? How would a developer know they are not part of the core engine (without some kind of comparision, or technical diagram of the architecture, or ). These are some kind of core engine extensions, I suppose. I would not think of them as part of the IDE, they are not visual, and they are mixed in with the list of core engine functions. They seem more like core engine objects than IDE objects, to me anyway. So do we really have 3 parts as in 1. core MC engine not open source 2. engine extensionsnot open source 3. MC IDE open source 4. RR IDE not open source And how do you distinguish 1 from 2? ___ metacard mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/metacard
open source
| | As Scott said the MC IDE is now open source so you can continue to | maintain | an engine license and use the MC IDE instead of Rev. It's up to you if | you | want to switch or not but it seems that all development will go into | the | engine and the Rev IDE. Greetings, Sorry if I missed this (been too busy to read all the posts lately) but a quick 2 questions: 1) Will the MC and the RR engines become one and the same or will there continue to be a separate MC engine? 2) If separate, will the MC engine become open source? (which, IMHO, would go a long way to having more folks adopt it). Mahalo, Sadhu ___ metacard mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/metacard
Re: UNIX help?
|5. UNIX help? (Richard MacLemale) Perhaps it would be instructive to see a cgi script that is working? BTW, this is an old one, I now collect the post data in a loop, since we found we'd sometimes not get all the data. However, this should work for a form that is not too long. You will of course have to replace my qmail command with a sendmail equivalent. Sadhu #!/usr/local/bin/mc #* # #-= Web Stuff =- # # Program name: form.mt # Version number: 1.0 # Author: SN # Date: 10/9/01 # Description: Process web form messages # # # on startup -- collect the information from the form read from stdin until empty put it into url file:/tmp/itdata.txt put urlDecode (it) into formdata split formdata by and = -- email the form contents to the user put formdata into url file:/tmp/formdata.txt put /var/qmail/bin/qmail-inject '$EMAIL' /tmp/formdata.txt \ into command_string replace $EMAIL with formdata[email] in command_string set shellCommand to /bin/sh put shell(command_string) -- respond to the user put Content-Type: text/plain cr cr put Your information is below cr put command_string put keys(formdata) into keywords repeat for each line this_item in keywords put this_item = formdata[this_item] cr end repeat end startup ___ metacard mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/metacard
Re: How do you join lines in a container (CGUPE)
Greetings, Ok, many thanks to everyone who responded to my post. Taking various hints from here and there, Dar, Pierre, etc., I have refactored and shortened the code and it works without having to process the data in an external file now. Much cleaner! Again, thank you all. BTW, I asked the original question of how to join the lines so I could use split but again, taking the suggestion of splitting by LF worked. At least, it worked using the newer MC engine. Ok, actually, it didn't work, that term LF gave an execution error, maybe that is a transcript only reserved word, but linefeed worked. Strange that didn't work on my MC engine at home but that is another story. The other thing I had to do was capture the output of the shell command on the same line. Meaning, this did NOT work put shell(command) put it into sqlData the above kind of approach does work with http post though But this DID work put shell(command) into sqlData and the above is how the example is shown in the MC documentation. I don't suppose anyone is really interested in the code of the complete solution but, hey, I include it below just in case. What this is, is a utility program, a filter that takes a stream of input data from a front end data collection program, then looks up something in the data base which the data collection program is unable to do (without extensive re-engineering), inserts that value into the data stream, and passes it on to something else (a back end formatting program). So it is a pipe line like collect data | metacard filter | report formatter And writing this filter was a lot easier than re-engineering the collect data part. Sadhu ps, I'm sure the code could be improved further, for example, using a function call rather than globals, but it's good enough. #!/usr/local/bin/mc ### # #-= Payroll II =- # Copyright (c) Cast Crew Entertainment Services, Inc. 2003 # # Program name: sony_filter #File name: sony_filter.mt # Author: Sadhunathan Nadesan # Date started: 06/11/2003 # # Description: # Get Walker Numbers from Data Base and replace tselect field # ### global sqlData, keywords on startup global sqlData, keywords -- Grab the tselect output in preparation for translation read from stdin until empty put it into inputData -- Now get the translation table from the data base sqlFetch -- Put the real product number into the data stream repeat for each line thisLine in inputData put thisLine into dataArray split dataArray by | -- The set code is in the 5th field, space padded put dataArray[5] into setCode replace space with empty in setCode -- Input data has constant 'walker number' instead of product code replace WALKER_NUMBER with sqlData[setCode] in thisLine -- Send the data on to RPT put thisLine end repeat end startup -- on sqlFetch -- get the list of set codes and product numbers from the data base global sqlData, keywords -- build sql query put lines 0 cr into sqlQuery put select sub_code, string_value from proptl cr after sqlQuery put where option_code = 'SONYACCT' / cr after sqlQuery put sqlQuery into url file:/tmp/sonylist.sql -- run sql query and capture results put SQL /tmp/sonylist.sql into command_string set shellCommand to /bin/sh put shell(command_string) into sqlData -- prepare data to be placed in an associative array replace space with empty in sqlData split sqlData by linefeed and | put keys(sqlData) into keywords -- cleanup put rm -f /tmp/sonylist.sql into command_string put shell(command_string) end sqlFetch -- ___ metacard mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/metacard
Re: How do you join lines in a container
| | Allo Sadhu, | | set itemdel to | | tune your metatalk code Bonjour Pierre, Ok, I'm not sure exactly what that means but it looks like what it means from reading the Transcript dictionary is, change the default item delimter in a container from comma to pipe. Ah, well, ok, I will try that but it doesn't seem to address the question. Let me try again. What I have in the container is a bunch of lines. I want to join them into one long line. It doesn't matter if the items in each line are separated by | or not, or if there is only one item on each line. I just want to join the lines, or in other words, get rid of the end of line characters. How do I do that? Merci!! Sadhu ___ metacard mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/metacard
Re: How do you join lines in a container
| |repeat for each line x in keywords | put x :---: sqlData[x] cr |end repeat | | Wouldn't this just show you the last entry in the keywords? The keys Hi No, it works. As you surmise, the above snippet is not actually part of the intended solution, it's just debugging code to show what I got as keys in the keywords container, and as array values in the sqlData array. It works as intended, namely, it show every key and every value indexed by that key. | This little test worked as I expected: | | on mouseUp |put field Input into theArray |split theArray by LF and | |put keys(theArray) into theKeys |put theKeys LF into field Report |combine theArray by LF and | |put theArray after field Report | -- From Sadhu's code... |repeat for each line x in theKeys | put x :---: theArray[x] cr |end repeat | end mouseUp Ok, you are using LF and that is working for you, but not for me. Hmm... what platform are you on? Well, maybe its a problem unique to Linux? I tried about everything I could think of, LF, newline, numToChar(10), CR, etc, to try to split the array and it would not split right. Or maybe it is a bug in an older version of MC I'm using on my home box, I'll try it on a newer engine. ___ metacard mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/metacard
Re: How do you join lines in a container so it becomes one line, so
| Date: Wed, 11 Jun 2003 10:00:21 -0600 | Subject: Re: How do you join lines in a container so it becomes one line, so you can use split? | From: Dar Scott [EMAIL PROTECTED] | | | Could your fields have | or numToChar(10) in them? | Hi Valid question. Nope, they do not. Sadhu ___ metacard mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/metacard
Re: php wikis
| From: Alain Farmer [EMAIL PROTECTED] | Subject: Re: php wikis | | ... and will be releasing that open source | (most likely public domain) ... | | Public Domain, eh! Admit it, David : I have had a (+) | influence on you. ;-) | | ... as soon as it's all integrated | with the CVS servers. | | I am raptly interested, David. Please notify as soon | as it becomes available to the public. Count me among | the testers if indeed you need some testers. Yo! Another interested party here ... We're using a wiki to create a user extensible software manual (ah, you know me, love documentation), so end users can add their own note pages to the manual. It's an old wiki and infortunately, in-line images don't work. I've seen some newer ones where that does work (heh .. including the place where we got this one a couple years ago, It's Ward Cunningham's, is that the right spelling?) and I've looked at some newer ones like Swiki but this sounds very interesting. Hmmm... yes, it would be cool if I could give the users a nice MC tool for manual updates, searching etc. Anyway, just another 2 cents. Sadhu ___ metacard mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/metacard
Re: Installing MC at your ISP, a How-To
| Subject: Re: Installing MC at your ISP, a How-To | Reply-To: [EMAIL PROTECTED] | | I put the mc engine in /cgi-bin with the scripts and #!mc does it just | fine. Upload binary. | | Regards, Andu Novac | Thank you for the kind words on the how-to. Good answers Andu :-) On the gentleman's other question regarding if it works on RH at home should it work on RH at my ISP? Most likely but it could possibly fail depending on the respective versions of the operating system. There was something changed in how executables are built up, in earlier versus later versions of RH, and the shared libraries may be different as well. For example, MC 2.3 works fine on my (old) RH box at home running RH 6.2, but later versions .. maybe starting about 2.4.1 (not sure) do not work anymore. That is because Scott started compiling them on a newer version of RH (7.2 maybe?) and the binaries from the newer OS do not work on the older OS. But fortunately it seems this was not the case in this instance. Most ISP's would probably be 'up to date' along with Scott. One of these days I'll upgrade my home server - about the time I buy a new one. It's so much easier to install a fresh OS on a clean box than try to upgrade. Sadhu ___ metacard mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/metacard
Re: the read from standard in bug
| | Sadhu, | | This was a post from Scott about this back in October: | | -- | We've recently received several reports of short reads from stdin in CGI | (snip) ... | | We'll look into supporting a simpler way to do this for 2.5 (not sure | whether to fix it so read .. for $CONTENT_LENGTH works, or to support | read .. until eof on pipes), but in the mean time something like the | above should solve the problem. | Regards, | Scott | --- Ok, thanks Ken. I'll try read until eof and see if that works. In other words, put empty into buffer repeat until eof read from stdin until empty put it after buffer end repeat Sadhu ___ metacard mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/metacard
Re: the read from standard in bug
| | Today's Topics: | |1. the read from standard in bug (Sadhunathan Nadesan) Ok, thanks Ken. I'll try read until eof and see if that works. In other words, ... put empty into buffer repeat until eof read from stdin until empty put it after buffer end repeat ... Nope it doesn't work. I guess pipes don't support 'until eof'. Any other ideas? Sadhu ___ metacard mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/metacard
the read from standard in bug
Problem: read from stdin clips off input Scott, I request your help please. As you may recall I am running an older 2.4 version of the MC interpreter on my 2.2.16 (kernel) Linux machine and newer versions won't compile due to library incompatibilities. I think you said you were going to fix this bug after you got a faster machine and ran into it yourself, but I don't have that fix. So I am looking for a work around. In the case of cgi scripts, to replace the read from stdin until empty you suggested to check the content length and I currently use this, which works great: if ($REQUEST_METHOD = POST) then put empty into buffer repeat until (length(buffer) = $CONTENT_LENGTH) read from stdin until empty put it after buffer end repeat else read from stdin until empty put it into buffer end if Except, I am also running into the clipping problem on non cgi use, ie, when there is no content length variable to check. For example I have this script that I use as a replacement tool, and use it by piping text straight into it with cat or redirect #!/usr/local/bin/mc #* # # Program name: replace.mt # Version number: 1.0 # Author: SN # Date: 9/22/01 # Description: Replace argument one with argument two, a filter # # on startup read from stdin until empty replace $1 with $2 in it put it end startup What happens is that the output from this filter is chopped off, the trailing part of the file is missing .. but only sometimes. Of course I could rewrite this with sed and make it a shell script or use Perl or whatever but one cool thing about MC is that it is not line oriented like Unix filters so when I get those files from Mac guys that are just one huge line, everything still works. I am strongly resisting going to another language although that would be easy enough because I really want MC to be a useable scripting language for me. In any case, can you suggest a work around for the clipping problem that would work on 2.4 or even 2.3? ___ metacard mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/metacard
Re: that pesky post command - version problem
| | You don't need, Sadhu, to rebuild all the app if you stick the commun | part of it in a first stack and the issue-specific part of it in a | second stack. You can even set each one as the substack of the other and | get them working together in using the start using command or a simple | send message to an object set in the second or substack ;) | Hi Pierre, Good idea. I did eliminate the version dependencies in the code, the only one really was the 'split' command. Seems I have MC 2.3 on my wife's Linux box, and 2.4.3 on my PC, and in this case the path of least resistance was to just rebuild the application. As previously mentioned RH 6.2 does not support MC 2.4.3. I had this code in at first split this_line by | put this_line[1] into field title put this_line[2] into field contents I changed it to this so as to work with both versions put offset(|, this_line) into pipeOff put char 1 to pipeOff of this_line into field title put char pipeOff + 1 to length(this_line) of this_line into field contents So the majority of the common part is the main stack script file and that indeed is identical. But what I found is that even removing all the resources, putting a 2.4.3 stack file from Windows onto the Linux box and trying to run it under 2.3 or even 2.4 it would not run, and the problem was somewhere in the interpreter code. In other words, trying to run it under the IDE the exception handler I think it's called came up and showed me where the problem was, and it was not in my code, it was in the interpreter. So trying to figure out what was causing that could have been .. ah .. 'trying' .. wherease, just building up the one card UI was a snap, drag and drop a few fields, didn't take long! Anyway, the good news is the application works on both Linux and Windows now, no more problem with the post command. Pretty much any changes I make in the future will be in the main stack script and again, that is portable, so I can just copy it over to the Linux machine and save it under the IDE there. No problem. BTW, I have some documentation and sample stack to send you. I'd post to the list but I think mailman won't accept attachments. Sadhu ___ metacard mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/metacard
Re: No return from post on Linux? A bug?
| | Could it be the shell call waiting for an answer? | I know I have to wait for the info to return from the shell to be able to | continue using MC on NT... | | Suggestions: | - send the shell on idle or | - have an agent app detect a shellfile (file with shell commands to be sent | by the agent... Return the result to another file and have your app pick it | up... | | Xa (just suggesting!) Ok, thanks Xa, I'll try to figure out what you mean by - send the shell on idle - and try that. I'll think about how I might be able to test your theory of the shell call waiting .. thank you very much for the suggestion. ___ metacard mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/metacard
No return from post on Linux? A bug?
Greetings Scott, Not sure actually if this is a bug report, or I am doing something wrong, a library mismatch, or maybe, just a request for a 'how to do it the right way'?? In any case I would appreciate any advice. Context: I have a stack that does a post command to a cgi script on a remote server. The cgi runs some sql queries to standard out (it has of course first set the correct html content type so that apache likes the output). Problem: On Windows, the sql output is returned as it right after the post command in the calling stack. On Linux, this does not happen. Nothing is returned. More Details: I can confirm that the cgi is being called, that the sql is being invoked, and I can save the output in a temporary file from this cgi (which is an MC script) or even read this file back in to a buffer, but then when I do a 'put' of this buffer, it does not return to the calling stack on the remote client. Again, only if it is a Linux client. It does return just fine to a Windows client. The stack itself was created using MC 2.4.3 and the MC interpreter on the webhost is 2.4 if that could be the problem, but it seems like the post would not work at all to invoke the cgi if it were. Anyway, any thoughts? I can provide more details as needed. Code samples below. Gracias, Sadhu - code sample, the calling stack on AzzList AzzClear set the listBehavior of field contents to true put action=list into azzdata set httpheaders to Content-type: application/x-www-form-urlencoded return # the real name of the host has been replaced to protect the innocent post urlEncode(azzdata) to url (http://localhost.com/cgi-bin/azz.cgi;) put it into sqldata if (the number of characters in sqldata is zero) then answer Sorry, your data base is empty cr else put In the contents field below is a list of all the card titles into field title put sqldata into field contents end if end AzzList - code sample, the cgi stack #!/usr/local/bin/mc on startup put Content-Type: text/plain cr cr put emtpy into formdata if ($REQUEST_METHOD = POST) then put empty into buffer repeat until (length(buffer) = $CONTENT_LENGTH) read from stdin until empty put it after buffer end repeat else read from stdin until empty put it into buffer end if put urlDecode(buffer) into formdata split formdata by and = put keys(formdata) into keywords switch formdata[action] case list put select title from azz order by title; into the_query put the_query into url file:/tmp/azzlist.sql put psql azz -qt -f /tmp/azzlist.sql into command_string break end switch set shellCommand to /bin/sh put shell(command_string) end startup ___ metacard mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/metacard
couldn't create cards, fixed
| | Resource mover adds some stacks to your main stack and depending of what | resources you move (libURL) a little script. My impression is that when you | can create a new cd successfully you use the correct defaultStack(), | otherwise not. If the stack is locked then you get an error. | Copy your scripts to a fresh stack but without any other resources, see | if it helps. Or just remove whatever resources you may have moved to your | stack and give it a try. Don't forget to save... | Hi Andu, thanks. Yes I was able to get around the problem by going back to an earlier version of the stack with no resources, and then apply later changes. Scott mentioned that resources could be removed, that would have been easier. I upgraded all my copies of mc to 2.4.3 (still have to do the mac). ___ metacard mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/metacard
Re: newbie question, wrapping text
Hi Jose, Ok, many thanks. Sadhu | Hi Sadhu, | | I understand you want to pad the text to a fixed lenght (in fld 1 or in a | variable) to a fld 2. Try this: | | local thetext, counterr, tam | on mouseup | put 0 into counterr | put 80 into tam | | repeat for each char x in fld 1 | add 1 to counterr | if x=cr then ---you have to control if the char is a return | put cr after thetext | put 0 into counterr | else | put x after thetext | end if | | if counterr=tam then | put 0 into counterr | put cr after thetext | end if | end repeat | | put thetext into fld 2 | end mouseup | | Sure the script may be tunned, but even in this form it is very fast for | small texts (some thousands of chars). | | Regards, | | Jose L. Rodriguez ___ metacard mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/metacard
Re: dontWrap
| | | | Just set the dontWrap of the field to true. | | | Actually as it turns out, that works, but I did have to set it to false. Not sure what I did wrong before, possibly not saving the stack before testing. ___ metacard mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/metacard
ps to lesson 3
| After that you can do a \d within psql and see your table structure as | follows | | azz= \d | Database= azz | +--+--+--+ | | Owner | Relation | Type | | +--+--+--+ | | sadhu| azz | table| | | sadhu| azz_pkey | index| | | sadhu| azz_recordid_key | index| | | sadhu| azz_recordid_seq | sequence | | +--+--+--+ | Ooops, that's the data base info, forgot to show the table info. The command would be \d azz (because the table name is azz). Remember, we are in psql typing this command azz= \d azz Table= azz +--+--+---+ | Field | Type| Length| +--+--+---+ | title| text not null| var | | contents | text | var | | recordid | int4 not null default nextval(' | 4 | +--+--+---+ Indices: azz_pkey azz_recordid_key If your create table command was successful, you will get something like the above. ___ metacard mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/metacard
credits
| That is Pierre Shores, master MC craftsman, whose native | language seems to be French. Mine's English so I'm writing | docs. Speaking of credits .. I should also mention the invaluable help of Sanyassin Sivakatirswami, who has been my MC mentor. He is producing very professional MC real-world applications. For example, it was from him I learned the easy way to parse the data from an incoming post in 2 lines of code, split formdata by and = put keys(formdata) into keywords And of course, others too numerous to mention (Scott Raney et all..) ___ metacard mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/metacard
Re: sample db stack coming
| Perhaps if Pierre agrees I will post the actual stack on his ftp server, | similar to what he has put there. Pierre agreed. Merci! BTW, another thing I plan to do is make available a publically accessible postgres db for this stack, so you can actually try it, if you are unable to set up your own data base. I have a new server that just arrived at work recently still being which i'm sure you understand! ___ metacard mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/metacard
corrections to lesson 3
Corrections to lesson 3 1) the subject was lesson 1, should have been 3. 2) the following command is wrong grant all on azz to 'nobody'; Should be grant all on azz to nobody; ___ metacard mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/metacard
unable to create cards???
Strange, somewhere between a version of a stack I had yesterday, and today, I can't create new cards. But I don't know how/where this problem crept in?? If I go into the message box and say create card or say clone this card, and then ask put the number of cards or put the number of this card, it is always 1. If I go into the same stack, yesterdays version, it works properly. If I put in the message box next card or create card or clone this card, I get cards 2, 3, 4 ... etc. the can't modify property is not set, anyone have an idea how i might have caused this? mc version 2.4.3. Gosh, save your work often often under different names or use an rcs system i guess is the lesson! ___ metacard mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/metacard
Re: unable to create cards???
One thought occurs to me just now is, I notice I have 2.4.3 at home and 2.4.1 at work and I was passing the stack file back and forth to work on it. Using resource mover for example. Could this have messed up my stack? / FROM: Sadhunathan Nadesan [EMAIL PROTECTED], Jan 28 8:13 2003 | ABOUT: unable to create cards??? | | | Strange, somewhere between a version of a stack I had | yesterday, and today, I can't create new cards. But | I don't know how/where this problem crept in?? | | If I go into the message box and say create card or | say clone this card, and then ask put the number of | cards or put the number of this card, it is always 1. | | If I go into the same stack, yesterdays version, it | works properly. If I put in the message box next card | or create card or clone this card, I get cards 2, | 3, 4 ... etc. | | the can't modify property is not set, anyone have an | idea how i might have caused this? mc version 2.4.3. | | Gosh, save your work often often under different names | or use an rcs system i guess is the lesson! | \ END: Sadhunathan Nadesan ___ metacard mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/metacard
Re: MC front end to PostgreSQL, help!
| Allo Sadhu, | | Did you try in using the clone this card command instead of the | create card one ? | -- | Cordialement, Pierre Sahores Problem solved. Thank you Pierre! ___ metacard mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/metacard
newbie question
Yo, A newbie question: I want to wrap some single line text in a text box and not use a horizontal scroll bar. I have an algorithm that works. But it is horribly inefficient and I'm sure there must be a better way! Can you X-talk gurus help me out with this one? if (the length of this_line 80) then repeat with i = 1 to the length of this_line put char i of this_line after field contents if (i mod 80 = 0) then put return after field contents end repeat end if Mahalo! ___ metacard mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/metacard
Re: MC front end to PostgreSQL - lesson 1
Greetings all, Building on the work of Pierre, I would like to share with you another simple MC - web enabled - data base application. This is another example to show how it's done. Kindly pardon any over verbosity or belaboring the obious. It's hard to know who the audience might be, especially when emails are archived, and it might be a newbie at some future date. Perhaps if Pierre agrees I will post the actual stack on his ftp server, similar to what he has put there. I will take a slightly different tact in describing things for the list, although the applications are very similar. Pierre, Swami and I sort of agreed to that .. he would show us, we would write it up. Ok, here goes. 1) Infastructure You need a web server running Apache or some other http server, and a data base such as PostgreSQL, or similar. I'm using RH Linux and Postgres came installed so that was easy. You also need the MC engine installed on this server. You don't necessarily need your own server; for example, Sivakatirswami has MySQL installed on his Hawaii on Line ISP and also MC installed, and he can add cgi scripts. That's all you need. Obviously you need MC on the client side, and cgi enabled on the server side. 2) Architecture This is a 3 part architecture. The client side is an MC application, a form with fields basically. The fields obviously should correspond to the fields in your data base on the back end side. Ok, that is the front end and the back end, the middle piece is a CGI program that connects the two. So you need 3 pieces. I'm going to show you the middle piece first. 3) Knowledge required - If you are on this list you probably already know a lot more about MC than I do. That's one reason my app is simple. You would benefit from some experience with simple CGI programming. Basically, that just means intercepting a 'post' command from a web page (html form), gathering the data it sent, doing something with it, and usually, responding in html format. Knowing something about html is very helpful in CGI but not much required for this app. You would also benefit from experiences with data bases, especially, working with SQL, although, again, not too much knowledge is needed. SQL is a very easy language to learn, and you don't need to know very much for a simple app anyway. We wrote the CGI in MC so you don't need Perl, C, shell script, etc. However, one key to successful applications is data base design, so it is suggested you would put in some effort getting that right before building too much code for any real world application. 4) How it works Very simple. Your MC application sends a 'post' command a stream of data, in the form 'field_name=field_value', each such pair separated by the symbol with the requisite fields off your form to the middle layer cgi program. The cgi program invokes the shell to make SQL calls to your data base. The results of the SQL operations are automatically returned to your calling MC program as 'it'. Nuthin to it, once you've seen it done! Ok, that's enough for lesson 1. Stay tuned for lesson 2. Oh, also, disclaimer, this is a work in progress. Sadhu ___ metacard mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/metacard
Re: MC front end to PostgreSQL - lesson 2
| Greetings all, | | Building on the work of Pierre, I would like to share with you another That is Pierre Shores, master MC craftsman, whose native language seems to be French. Mine's English so I'm writing docs. | , the middle piece is a CGI program that | connects the two. So you need 3 pieces. I'm going to show you the | middle piece first. | As promised, here you go. On my system this MC shell script was installed in the global CGI directory, /home/http/cgi-bin in my case), and referred to by web pages as domain-name/cgi-bin. The web calling convention leaves out the full path name, it makes the root of the http system look like root to the world. Your next step is to read this code. -cut here --- #!/usr/local/bin/mc on startup put Content-Type: text/plain cr cr put emtpy into formdata if ($REQUEST_METHOD = POST) then put empty into buffer repeat until (length(buffer) = $CONTENT_LENGTH) read from stdin until empty put it after buffer end repeat else read from stdin until empty put it into buffer end if put urlDecode(buffer) into formdata split formdata by and = put keys(formdata) into keywords switch formdata[action] case add put insert into azz (title, contents) values ('$TITLE', '$CONTENTS'); \ into the_query replace $TITLE with formdata[title] in the_query replace $CONTENTS with formdata[contents] in the_query put the_query into url file:/tmp/azzadd.sql put psql azz -f /tmp/azzadd.sql into command_string break case search put select title, contents from azz where title ~* '$TITLE' or contents ~* '$TITLE'; into the_query replace $TITLE with formdata[title] in the_query put the_query into url file:/tmp/azzsearch.sql put psql azz -qt -f /tmp/azzsearch.sql into command_string break case modify put update azz set contents = '$CONTENTS' where title = '$TITLE'; into the_query replace $TITLE with formdata[title] in the_query replace $CONTENTS with formdata[contents] in the_query put the_query into url file:/tmp/azzmodify.sql put psql azz -f /tmp/azzmodify.sql into command_string break case delete put delete from azz where title = '$TITLE'; into the_query replace $TITLE with formdata[title] in the_query put the_query into url file:/tmp/azzdelete.sql put psql azz -f /tmp/azzdelete.sql into command_string break case list put select title from azz; into the_query put the_query into url file:/tmp/azzlist.sql put psql azz -qt -f /tmp/azzlist.sql into command_string break default put Unknown Action - call technical support end switch set shellCommand to /bin/sh put shell(command_string) end startup -cut here --- Ok, so what's it doing? First, the data transmission from your front end MC application is being read and decoded into the container 'formdata'. This in turn is being converted to an indexed array (using split) where the first element of the array is the action to perform, and subsequent elements are field-value pairs. My simple app has only 2 fields of interest, a title, and a contents. (There is a 3rd field, serial index, but it's for managing the data, ok to ignore it). Wow, that was easy, collecting all our info into an array, better than Perl! (which uses chomp) Next we have a case statement for each action. Amazing, we are supporting 5 different activities - inquire, list, add, modify, and delete - in only 67 lines of code. Ok, not too much error protection here but you can add your own. The actions are translated into SQL statements and written into files. Then SQL is invoked on the file. With PostgreSQL, you can call it's interactive SQL monitor, psql, from the command line with an argument of a file name.These two lines invoke the shell which in turn invokes SQL: set shellCommand to /bin/sh put shell(command_string) SQL sends it's output to standard out and beause of the statement at the top of the program which first tells Apache that it's legal HTML even though its plain text: put Content-Type: text/plain cr cr then this text (SQL output) is returned to the calling program, namely, your MC application. Once you get it back you can do whatever you want with it in your MC application. Easy, eh? Ok, that's lesson 2. The hard part is over. Sadhu ___ metacard mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/metacard
Re: MC front end to PostgreSQL
| | I didn't have time to play with Pierre's thing yet but I kept wondering | what's the benefit of padding each name with ___ to keep a fixed number of | chars in the column names? | | Regards, Andu Novac | Ah, hi I guess I should have posted one mail of 'gotchas' I found to the list, there is a separate group confering on this but I think it's list material. Anyway, I'm wondering the same thing but I found it easier to comply than switch. I first set up my postgres table without the extra underscores but then found .. oh darn, Pierre has done a lot of working coding SQL statements in his stack using those field names so if you change them, you have to change all his code .. and THEN when he releases a new version (3 already) you have to do it again. Darn! So it is easier to stick with his conventions. Another on the list of gotchas: His abookcgi.mc script assumes psql is in /bin at least in my environment. What I had to do was put the full path name to psql. In my case the change was to put /usr/local/pgsql-7.1.3/bin/psql -h sdwebdev.castandcrew.com abook -U sadhu into PgPath Sadhu ___ metacard mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/metacard
Re: MC front end to PostgreSQL
| Allo Sadhu, | | It's exactly the right way to use : i will update the install docs to | avoid possibles confusions ;) | -- Allo, Pierre, You have made a major contribution in figuring this out, IMHO. Thank you Pierre. Aloha, Sadhu ___ metacard mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/metacard
Re: MC front end to PostgreSQL
| Subject: Re: MC front end to PostgreSQL | Reply-To: [EMAIL PROTECTED] | | | | | Allo List, | | | | A build 3 issue of the MCSQL Address Book example app is available for | | download at : In an earlier post today I said I thought I should have posted to this list a few gotchas which I had sent to Pierre, so here they are: 1) Don't forget to chmod a+x abook.html in your cgi-directory, even though it is an html file it is being executed as a cgi script. (Perhaps Pierre will explain that little twist to us). That one got me. Changing it to have extension .cgi (because I thought I might have to register html as a valid cgi extension with Apache if I didn't do this) caused it to fail. ??? Well, anyway, it works the way Pierre designed it, so don't change the file name would be my humble advice. 2) The instructions say to change the http://localhost etc to be your real cgi-bin directory. I changed it and it didn't work. Hmmm.. Ok, then I went back and realized this pattern occurs 4 or 5 times in the stack main script and I only hit the first one. Gotta change them all. 3) I got the db connection working when I ran the ap under the IDE but not stand alone. Ah, gotta use the resource mover to put the url library in the stack. ___ metacard mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/metacard
Re: MC front end to PostgreSQL
| | Allo List, | | A build 3 issue of the MCSQL Address Book example app is available for | download at : | | ftp://crdp.intereduc.net/MCSQLABOOK/ | Merci, Pierre, I'm out of town on a business trip but will install and test as soon as I get a chance. Good show! Sadhu ___ metacard mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/metacard
Re: MC front end to PostgreSQL
| | See the installabook.txt for more, including explainations about the | need of a primary key to index the column name and the needed | add of a new serial-typed column to the abook pg table, used to add | to each row an unicity control key... | FYI, Pierre, this is what worked for me. First I just dropped the data base (from the shell) dropdb abook Then created a new one createdb abook Then entered the interactive sql with psql abook Then issued the create table command at the sql prompt. The syntax on mine, version 7.1.3, is slightly different than shown in the installbook.txt file. Here is what I used: create table abook ( name text primary key, company_ text, street__ text, city text, state___ text, zipcode_ text, telepho1 text, telepho2 text, mail text, web_ text, recordid serial not null ); this worked and gave NOTICE: CREATE TABLE will create implicit sequence 'abook_recordid_seq' for SERIAL column 'abook.recordid' NOTICE: CREATE TABLE/PRIMARY KEY will create implicit index 'abook_pkey' for table 'abook' NOTICE: CREATE TABLE/UNIQUE will create implicit index 'abook_recordid_key' for table 'abook' ___ metacard mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/metacard
Re: MC front end to PostgreSQL
| | An updated issue of the MCSQL Address Book example app is available for | download at : | | ftp://crdp.intereduc.net/MCSQLABOOK/ | | This issue provide a replacement version of the stack addressbook.mc, | including a new delete card handler, previously bugged. Greetings, all, I would like to report initial success .. I have Pierre's ap running and connecting to a PosgreSQL back end. Right now that is on a work internal network but at some future point I will put it on a public webserver. Pierre, deep bows. Aum Sadhu ___ metacard mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/metacard
darwin
| | Sorry. I'm on so many Mac mailing lists that I forget sometimes that | everyone else isn't the Mac addict that I am. | | OS X is not perfect, no OS is. But OS X is by far my favorite OS to work | on, and at my job I work on many (Win 98, Win 2K, Win XP, Win NT, Mac OS 9, | Mac OS X, Mac OS X Server, Red Hat Linux.) The Darwin mc engine has been | automating our network and providing all CGI scripts for 2 years now. If I | have to write a CGI or shell script that will be shared with other folks, I | try to write it in perl. But when I need to get a job done on our network, | I use mc. Ok, thank you. Understood. Yep, Unix guys were happy to see Apple adopt it under the hood, I had just never heard the term Darwin. Perhap MS Windows XP-2 will have Linux under the hood? (just kidding!). Yep, true multi-tasking. Thanks again. ___ metacard mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/metacard
Re: MC front end to PostgreSQL
| | The best, in my mind, would be to build a general purpose example app, | directly descibed and shared on the Metacard list, to let evryone become | able to understand how the purposed technology works and how to reuse it | to build, from scratch, | other kinds of dedicated apps. Agree! that would be great. | | If you are ok about this, i could contribute to this commun effort in | converting an existing AddressBook stack in a client-server | AdressBook stuff, in using, on the client-side, a standard desktop | dedicated AdressBook stack converted in a Metacard-based AdressBook | front-end and, on the server-side, a PostgeSQL-based AdressBook | back-end. An impressive spirit of volunteerism, for which we'd be very grateful, merci! | | I can't, for my how, open and share an access to the production servers | (including an access to PostgreSQL), because the servers i'm working on | are howned by private companies or administrations. | | What we need, at this point, is (1) to find a fine free and reusable | AddressBook stack on top of witch we could add the client-server layer | code Seems like someone out there would have something they could contribute? If not, we could do something very simple. I am thinking, for a beginning application, simpler the better. Such as a single record data base with just a few typical fields, name, address, phone, email etc. | and (2) a free hosted access to a PostgreSQL enabled server (including | the right to install mc as a cgi engine or, best, as a web application | server deamon (startable and rebootable trough SSH only, for security | reasons). Could you | find an host interested in supporting this part of the project ? | Well, that might be me. It would be ideal if I could get this going at work, but my home server may suffice for the time being (if we can live with MC 2.4 as the cgi engine). We could at least start there. MC is installed in /usr/local/bin, so what do you need, Pierre, just an ssh account? Sadhu ___ metacard mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/metacard
Re: MC front end to PostgreSQL
| Yes ! I'm building such Metacard based client apps and, with a back-end | database server available (PostgreSQL, for me), you can do same in using | (in addition to the server-side code we spoken about some weeks ago in | this thread) such kind of code to do this client speak with the back-end | server in using the POST method : | | put SQL= urlencode(fld Request) into larequete | put id1=data1id2=data2id3=data3 larequete into retour | set httpheaders to Content-type: application/x-www-form-urlencoded | return | post retour to url (fld csrecents of cd 2 wmc.xml) | | where id1, id2 and id3 are contextual parameters and the field Request | can hold a direct SQL query or client-side fields contents to be passed | to the database server trought the metacard server-side cgi or was. Bonjour Pierre, Awesome! I really want to try something like that. About a month ago (but I have been too busy to follow up) Swami sent us a message with a similar idea and we want to try it on a PostgreSQL data base I have running now (contents, url's of audio files on assorted topics) which has a query form but the only maintenance is by hand, SQL. Swami wants to build an MC client front end that combines search and play. I want to build an administrator's front end for add/inquire/modify/delete. It seems like this would be possible. The query page is at http://www.gurudeva.dynip.com/~htoday/talks/talksearch.html The CGI part does something similar to what your book app does, they are MC scripts composing SQL and calling as shell commands. So anywhoo, will probably take some of the discussion off list but we sure would appreciate any hints from you. I have an email at home from Swami that I will reply to later (be out of town tomorrow). Merci! Sadhu ___ metacard mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/metacard
Re: MC front end to PostgreSQL
| | I'm working on such a stack right now for a client. It posts queries to a | http server + mc cgi which in turn passes them to the database using | shell(), then replies the results back to the client. I can't make it | publicly available though, just a confirmation that it can be done without | much hustle and it works nicely. SQL must be used in communicating to the | database, no way around it but that's the easy part. That's two! Awesome. Yes I think the world needs this. Welp, I plan to work on something also and will keep the list posted from time to time. Thanks Andu. ___ metacard mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/metacard
Re: darwin mc?
| | It's the metacard engine for Darwin. You can slap it into your | CGI-EXECUTABLES folder and then write MetaTalk scripts to do cool CGI stuff. | Ok, I get it. Call me ignorant, but I had no idea what Darwin was. Your response gave me enough of a clue to do a search on the net and uncover the fact that it's probably a Mac operating system code name or component or something. I found this on an Apple site which makes it sound like Darwin is a code name for the Unix kernel. Mac OS X also marks the debut of true preemptive multitasking. Darwin, Mac OS X's underlying code, constantly analyzes your computer needs. It works on processing tasks on the background. But when you receive an e-mail or have an urgent need, Darwin will allocate processing power to your immediate tasks. As you can probably tell, I'm not too familiar with Mac's. Anyway, thank you! ___ metacard mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/metacard
Re: MC front end to PostgreSQL
| Alain Farmer | xCard fanatic | | PS: I should probably mention that in addition to all | of the above, the Java version of FreeCard will be | able to be embedded into web-pages in the same manner | that Java applets are. No separate program or plugin; | the stack in a portion of the web-page. Or vice-versa, | I am told, so that we will be able to browse the web | inside a widget of the stack's interface. Yup! the web | from *within* a stack. Hello Alain, Sorry I've been busy with year end at our company, busiest time, and just catching up on this thread which is of enormous interest to me too. So anyway, somewhere along the line I missed out .. What is FreeCard ?? Thanks Sadhu ___ metacard mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/metacard
Re: MC front end to PostgreSQL
| Just as you say, Alain and we, all, are going to open l'avenue des | Champs-Elysees to the web-dedicated metacard developments. | Because they did'nt know it was impossible,... ;-) | | Do you mean you will distribute MC | stacks and the user won't go through a browser? | | You certainly can. | | Let's conquer the Web with MetaCard, | | Alain Farmer Hi Guys, Again, pardon my late entry here, but I'm hoping to keep this topic alive. I had asked Pierre before about a working application to look at. It appeared that what he showed me (if I correctly understood) was all server based, with HTML, and MC as a background CGI language. Meaning, he had a cool site where you could look up authors and books and stuff (sorry, my French isn't really very good, so pardon the guesswork) which had browswer, maybe PHP forms - calling CGI scripts written in MC which in turn invoked shell commands to do SQL stuff with Postgres. Very nice. I was hoping to see something a bit different. A sort of real data base application. Across the net. In other words, something where the front end is running on the client (an MC app) and the back end is a data base across the web on the server. Something with rich a interactive nature, the kind of application you can build native with MC for strictly local use. Such as, you bring up the stack and it displays all the fields in the current record. You click next, next, next buttons and it is paging through .. not cards in your stack, but records in your data base on the back end. You want to change something, you just change it, press the update button, and the back end data base is updating. Without, hopefully, having to hand code a lot of SQL statements to make everything work, but if so, so be it. Anyone have anything like that happening? Mahalo Sadhu ___ metacard mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/metacard
darwin mc?
| won't know either. So I choose MetaTalk. :) | | It's too bad that more people don't take advantage of darwin mc. It's easy, | powerful, and free... | Richard, thanks for the perspective. What is darwin mc ?? Sadhu ___ metacard mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/metacard
Re: cgi mc/large data reads
| Date: Sat, 04 Jan 2003 07:37:12 -0800 | To: [EMAIL PROTECTED] | From: Sannyasin Sivakatirswami [EMAIL PROTECTED] (by way of Sadhunathan Nadesan |[EMAIL PROTECTED]) | Subject: Re: cgi mc/large data reads | | Om Sadhunathan: | | Wonderful! | | You might tell Scott that. I am sure he would appreciate feedback... | | And, can you send me a script with the patch installed? I want to convert | our guestbook over to MC, but have been very reluctant to do so because | of this problem. Even the PERL script was chopping an long comments sent | (though that might be a problem in the client browser and not necessarily | on formmail.pl) and we haven't been able to do anything else with in | coming guestbook sign ins because i don't know PERL. this weill be an | excellent area for Saravana to get hold of. | | Om Sivakatirswami Namaste, Swami, Sorry for the slow response. Ok, I will post this on the list, which I believe Scott reads. The context of the feedback you mention is that at work, I had to replace an MC cgi script with a Perl script because of erratic performance by MC - it did not always, but sometimes, would get nothing at all as input from an html form using the algorithm: read from stdin until empty which is seen in examples all over the place explaining how to do scripting on Unix. At first Scott was not able to duplicate this problem until he got a faster server and started noticing it himself, whereupon, he posted a work around. I tried the work around on our application program (which happened to be mission critical - it was used by customers to approve invoices, so having it sometimes fail was totally unacceptable!) and it fixed the problem. I mentioned to you this was a good thing because it would be sad if our IT staff could not trust MC, we'd never be able to use it for anything. The entrance barrier is hard enough due to the lack of documentation, plus general programmer arrogance. We can't buy books on MC, there is no manual, etc. But I want to be able to use it, despite the fact that my staff are expert C and Perl programmers and resist anything that takes the power of IT out of the hands of the few (them) and into the hands of the many (much easier to learn MC than C). So the fact that it didn't work made it instantly rejected. Anyway, here is an RCS diff .. I basically replaced the first part with the 2nd part below. I'm sort of ignoring the 'get' method from forms because the form behind this cgi doesn't use it, I more or less left that in as a comment to remind me of the old way whenever I see this code. I don't necessarily recommend copying what I did, but it will give you the idea. Was: read from stdin until empty put urlDecode(it) into formdata --- Now is: if ($REQUEST_METHOD = POST) then put empty into buffer repeat until length(buffer) = $CONTENT_LENGTH read from stdin until empty put it after buffer end repeat else read from stdin until empty put it into buffer end if put urlDecode(buffer) into formdata ___ metacard mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/metacard
postgres mc
| Hello Sadhu, | | Just have an eye at http://acacia93.dyndns.org/citalis.xml in using | visiteur as the login and visiteur (again) as the password. It's a | small tests purpose dedicated mc/pg web app. | | Have fun ;) Bonjour Pierre, Ok, I got on, it worked! What is pg? Is this a CGI script? Pierre, D‚sol‚, je ne parle pas vraiment fran‡ais. Mais je pouvais obtenir sur votre site Web et l'utiliser. J'ai recherch‚ quelques citations. Je ne suis pas s–r o— Metacard est employeed dans ce site Web? Est-il employ‚ comme un manuscrit de cgi aux questions du processus SQL … une base de donn‚es de PostgreSQL??? J'esp‚rais voir un certain genre d'UI ou les ‚crans faits avec MC pour l'enquˆte, s'ajoutent, modifient, effacement des donn‚es sur une base de donn‚es arriŠre d'extr‚mit‚, mais peut-ˆtre je mal comprenais. Merci! Sadhu ___ metacard mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/metacard
Re: MC front end to PostgreSQL
Fantastic, Pierre! Simple is beautiful. Do you happen to have any working examples, meaning, a front end to an existing site? Merci! Sadhu | | Allo Friends, | | For the ones using Oracle or PostgreSQL backend databases (unix hosted) | and wants to drive them from within mc apps, without to be sure about | the way to do it, just adapt the next script example to your needs | (replace psql with sqlplus to link an Oracle server). | |put into DbAuteurs |get shell(echo quote select distinct auteur__ from citations order by |auteur__ quote | psql -h localhost citalis) |repeat for each line l in line 3 to -3 of it | put word 1 to -1 of l return after DbAuteurs |end repeat | | It's probably the fastest and most secure way we can use to get the best | from both mc and postgres, without any supplementary middleware need, | alike dedicated c, php, perl and soo on libraries, nor odbc drivers or | expensive and slow marketing toys... | | Have fun ;-) | -- ___ metacard mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/metacard
Request for Proposal
Request for proposal: Hi I have a project which may be suitable for Metacard. This would be a budgeting system for Film, TV Commercial producers. We'd like to have a Mac, Windows, and Web version. The Web version would have a front end MC client and a back end PostgreSQL data base, while the Mac and Windows versions would be stand alone, with hopefully a single code base for all 3. For example, they might operate somthing like Quicken where you can synchronize your local data with the bank's central data base, or not, as you choose. Now, obviously, this is vague and I will be doing a more formal RFP but at this point I am interested in hearing from any consulting firms who would consider bidding on this. Many thanks, Sadhu Nadesan CIO Cast Crew Entertainment Services, Inc. ___ metacard mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/metacard
Re: MC on Apache and CGI
| Date: Sun, 08 Dec 2002 15:51:00 + | Subject: MC on Apache and CGI | | As I want to use MC for cgi in more and more projects, I'd | be very glad if someone could take a part of his time and explain | everything to me (or at least everything I need to know), on or | off list, it doesn't matter... Hi I posted a detailed message of how to install it if you want to search the archives. I didn't go for a cgi wrapper although that's not a bad idea. It was mainly for people who did not have direct access to their server (such as someone using an ISP that didn't provide shell access). If you do have access, its trivial - just get the right engine for your OS and put the file called 'mc' in a suitable directory (such as /usr/local/bin) and make it executable (chmod a+x mc). Sadhu ps, caveat the examples that are seen of read from stdin until empty lead to trouble when you get a large amount of data from an http post. Scott recently posted a way around this. If you don't use his new method, MC is unreliable as a cgi scripting language. ___ metacard mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/metacard
Re: Faceless CGI challenge/print incoming text-email files
| Message: 5 | Date: Sat, 7 Dec 2002 15:33:46 -1000 | Subject: Faceless CGI challenge/print incoming text-email files | Cc: [EMAIL PROTECTED] | To: [EMAIL PROTECTED] | From: Sannyasin Sivakatirswami [EMAIL PROTECTED] | Reply-To: [EMAIL PROTECTED] | | OK, well maybe it's not a challenge maybe it asking if someone has done | this already: | | Goal: have a faceless metacard/revolution process running on a OSX | server that will check a directory for files (deposited there by an | email server), on a timed interval, if files are found, format these | to letter size in a particular font and print to a specific networked | printer in another office on the LAN. | | I think i could set this up with an open stack in the GUI, but don't | know how to script to choose a specific printer without having | previously selected that printer as the default printer for the whole | server. Use of a page set up request... returns a system dialog | box... but this has to run without human interaction i.e. need to be | able to poke, by script, the values that are usually entered from the | system print set up dialog box. | | Can do? .. Hi Swami Can do? No sweat. This is the kind of thing we do ALL the time on Unix systems. I would tend to write it in Bourne shell script, happy to do it for you if you like. I know you like writing everything in MC, once you saw how easy it is you could convert it. You could set it up to run from cron on a timed interval (ie, put it in your cron table), or you could start it up as a deamon (good idea to put it in your .rc files, so it would start up at reboot) and then put a sleep command in it. in psuedo code, it would be something like this #!/bin/sh cd right-directory while (true) if [ email-file exists ]; then cat email-file | fmt | pr | lpr rm -f email-file endif sleep 300 end while Of course with specifics for your system, maybe strip out mail headers or other refinements, handle mutliple files, remove them, use the correct printer name and arguments, assuming you do have printer filters somewhere, some error checking, etc. Then again, I'm not sure how much Apple has messed up your BSD Unix? What I have heard is that Jaguar is just a wrapper and it's true BSD underneath. Aum Aum Sadhu ps: There's an easier way to do that, grin! ___ metacard mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/metacard
RE the large file challenge
| Maybe we need a new name for what Transcript does. | | Transcript pre-processes scripts into pointer-based bytecode, which | generally outperforms purely interpreted xTalk by anywhere from several | times to a few orders of magnitude. | Maybe? This is an excellent clarification. If MC is seen as trying to compete with Java and Sun has decided to redefine 'compiled' then, hey! Why not. Come to think of it they used to call UCSD Pascal compiled but it was p-code possibly similar?? There is an exception, that is, when MC is used as a scripting language such as cgi scripts, or such as the tests I have been running. In that case there is no preprocessing. In that case, I believe interpreted would be the correct description. The good news is, it _still_ compares in speed to the compiled languages. For an interesting read on security and high level languages, this is fun: http://m.bacarella.com/papers/secsoft/html Sadhu ___ metacard mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/metacard
RE: the large file challenge
| | Message: 1 | Date: Thu, 14 Nov 2002 10:39:01 -0700 | Subject: RE: the large file challenge | From: John Vokey [EMAIL PROTECTED] | To: [EMAIL PROTECTED] | Reply-To: [EMAIL PROTECTED] | | To be fair: most of metacard is coded in metatalk; it is a | boot-strapped language, much like many of the TILs (threaded | interpreted languages) of yesteryears (e.g., forth, apl). | John, I agree with you too. I take his point that a C program should not be slower than a bash script invoking 2 utilities written in C. If anyone cares to contribute a better C program, go for it! Right now I'm running Pierre's MC revision to see how it does. This has been fun but I think we've come to the end. I think it has come to light that MC holds it's own with compiled languages. That was where this whole thing began, I was explaining to Swami that MC is not a compiled language, then Scott kinda said, so what, there is not that much difference between compiled and interpreted languages these days. That would be supported by the results of the timing tests, so I'd have to agree with Scott. However, I'm still sticking to my guns - MC is not a compiled language. Swami apparently thought it was. So I was trying to clarify it for him. And that led to all this fun! :-) Sadhu ___ metacard mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/metacard
RE: the large file challenge
| Actually, this says more about your specific implementation of the algorithm | and/or the quality of your compiler than it does about the relative speed | merits of any given language. As in your bash example, the bash shell | actually calls functions from libraries of well written highly optimized C | code. So, all things being equal, straight C code could never be slower than | a bash shell script. | | MC, as well, is also coded in C, so in many interpreted languages (bash, | perl, MC) while the script itself is interpreted, much of the real work is | done by compiled code. Yes, I agree. ___ metacard mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/metacard
the large file challenge
| So ! MC as far so fast than Pascal ! Is'nt it great ? And, thanks again | to Scott, for that too ! | | It's enough to make a Java programmer cry. ;) | | Java ? Help me to remember... Are you speaking, Richard, in about this | dead marketed toy that crashes any time he search some more ram to eat ? | | If you're thinking of the one with the slow development cycle and the even | slower runtime speed, yep, that's the critter. | | Anyone care to write this challenge algorithm in Java for laughs? Or would | we need Raney to add a new time token in addition to seconds, ticks, and | milliseconds: eons. Someone mentioned about C vs Pascal too, can't find that at the moment but a couple of thoughts. It seems to me the main revelation of this excercise is that everything came out about the same. I think that defies the conventional thinking that interpreted languages are slower than compiled. Now, we could probably go back to the drawing board and eek a few less seconds out of each alrgorithm. For example Scott mentioned using binary read (then you have to put in the extra code he discussed) and we could probably improve the Pascal with a similar approach with block reads; however, leaving them all doing line reads makes them all fairly comparable and again, I think it's surprising they take about the same time. One point should be to try to write it in as few as lines as possible since that is generally an advantage of the 4GL's. I don't have a Java version yet but below is a C version. It's a bit longer than really need be because of copying a routine from our libraries at work rather than using a C intrinsic, and again, the result is, about the same time. Obviously harder to write. I'm guessing Perl and Java might be in the same ballpark too and maybe I will pursue that. As far as the pascal i'm using the free pascal compiler out of europe, no particular optimizations, compiled with just a pc386 command. The C is the gnu ansi c compiler invoked with a -o (optimize) command. Here's the latest round of times bash 1:44 pascal 2:04 C 2:28 MC 2:10 goodness, C is slowest of all?!? #include stdio.h #include string.h /**/ int fgetnline(FILE *, char *, unsigned int); /**/ int main( int argc, char*argv[] ) { char pattern[] = mystic_mouse; char buf[300]; intcount = 0; while (fgetnline(stdin, buf, sizeof(buf)) != EOF) { if (strstr(buf, pattern) != NULL) count++; } (void) fprintf(stdout, %d\n, count); return 0; } /* = */ int fgetnline( FILE*fp,/* IN: Stream to read from. */ char*buf, /* OUT: Buffer to fill. */ unsigned intbufsize /* IN: Size of buf. */ ) { intc; unsigned int count = 0; while ((c = fgetc(fp)) != EOF c != '\n') if (bufsize == 0 || ++count bufsize) *buf++ = (char) c; *buf = '\0'; return c; } /**/ ___ metacard mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/metacard
Re: the large file challenge
| I'm confused: if the point is to avoid reading the entire file into memory, | isn't what what line 8 does? And if it's already in memory, why is it read | again inside the loop? | | I think I missed something from the original post Hi Sorry, yes you missed something but not from the original post, the part you missed wasn't posted at all. It went like this 1. (not posted) - conversation in progress regarding the difference between compiled programs, like C, and interpreted programs, like Metacard. 2. (not posted) example sent of a shell script (bash or bourne shell) on Unix - interpreted of course - and Pascal program doing the same thing - compiled of course. Question asked: how would one do this in MC? I am not an experienced MC developer and I had no idea. 3. (not posted) a code snippet was sent to me as an example and I turned this into a working program. Yes it starts out by reading the whole file to count the lines which is not very efficient. In fact it failed when run on the large access file with an out of memory error. 4. (where you came in) - I sent a post inquiring, basically, isn't there a better way? I got a lot of good responses and it seems there are much better ways, so I am going to try them all. Clear it up for you? Sadhu ___ metacard mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/metacard
Re: the large file challenge
| If we're allowed to read the whole thing into RAM and the goal is the count | the occurences of the string mystic_mouse, then to optimize speed we can | just remove the redundant read commands and use offset to search for us: | | #!/usr/local/bin/mc | on startup | put /gig/tmp/log/xaa into the_file | put url (file:the_file) into the_text | put 0 into the_counter | put 1 into tPointer | -- | repeat for each line this_line in the_text | get offset(mystic_mouse, the_text, tPointer) | if it = 0 then exit repeat | add 1 to the_counter | add it to tPointer | end repeat | put the_counter | end startup | | This is off the top of my head. If it runs I'd be interested in how it | compares. Richard, Thanks much for the code and suggestions. We aren't allowed to read the whole thing into memory because the real access file is 300meg and my poor little Linux box has only 128meg RAM. One of the great things about Linux of course is that it will run fine on minimal hardware. Anyway, alas, the program failed with this message mc: out of memory 0 Ok, on to the next suggestion! Sadhu ___ metacard mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/metacard
Re: the large file challenge
| | I'm pretty sure the problem with speed here is from reading in the entire | file. | Unless of course you have enough free RAM- but that's hard to imagine when | the files are 300MB+. | | How about this, which you can adjust to read any given number of lines at a | time. | Try it with 10, 1000, 1, etc and see what gives you the best performance! | Hasn't been tested but hopefully it'll run with a tweak or less. | | #!/usr/local/bin/mc | on startup | ## initialize variables: try adjusting numLines | put /gig/tmp/log/xaa into the_file | put 1000 into numLines | put 0 into counter | | open file the_file | | repeat until (isEOF = TRUE) | ## read the specified number of lines, check if we are at the end of the | file | read from file the_file for numLines lines | put it into thisChunk | put (the result = eof) into isEOF | | ## count the number of matches in this chunk | put offset(mystic_mouse, thisChunk) into theOffset | repeat until (theOffset = 0) | add 1 to counter | put offset(mystic_mouse, thisChunk, theOffset) into tempOffset | if (tempOffset 0) then add tempOffset to theOffset | else put 0 into theOffset | end repeat | | end repeat | | close file the_file | | put counter | end startup | | HTH, | Brian --- Hey Brian, thanks, excellent. I tried it with 10, 1000, 1 and it got slightly faster (just a few seconds) with each increase so I'll leave it at 1 and compare against other suggested algorithms, and let everyone knkow results.. Sadhu ___ metacard mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/metacard
Re: the large file challenge
| | One last note: | | Be careful of using read from file xxx for yyy | | If you do not read for lines, you run the risk of cutting a line in half on | the spot where your magic string occurs. | | So always use read from file xxx for yyy LINES | | HTH. | Brian | Good point. For this particular use of the program a close count is ok - no problem if it's not perfect but clearly, that might matter in other instances. It is interesting that the different algorithms are varying slightly with the count, probaby for reasons like you mention. ___ metacard mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/metacard
Re: the large file challenge
| # repeat for each line this_line in the_text | # if (not eof) then | # if (this_line contains mystic_mouse) then | # put the_counter + 1 into the_counter | # end if | # end if | # end repeat | | close file the_file | Allo Sadhu, | | Perhaps is it way to speed up your script in using the lineoffset | statement, as the upon proposal ;) | -- Allo! I'll try that Merci! ___ metacard mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/metacard
Re: the large file challenge
| So that is 1:53 for bash, 2:04 for pascal, and 2:19 for MC. darn good! | | But golly, I thought an interpreted language like MetaTalk was supposed to | be slow, certainly much slower than compiled Pascal. | | :) | By golly, that would be I think the conventional wisdom alright! Another myth goes by the wayside? :-) Of course, now the C programmers will probably come out of the closet. (they might want to know, what compiler, what flags set, etc.) Point might be - that is a non issue with MC. Assembly language programmers need not apply. ___ metacard mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/metacard
Re: the large file challenge
I got this suggestion from Jeanne A. E. DeVoto ~ [EMAIL PROTECTED] repeat read from stdin until mystic_mouse if the result is not empty then add 1 to the_counter -- found it else exit repeat -- encountered end of file, no more occurrences end repeat put the_counter But I was not able to make it actually run. Any suggestions? ___ metacard mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/metacard
Re: the large file challenge
Ok, here are the results so far, bash Sun Nov 10 13:01:59 PST 2002 17333 Sun Nov 10 13:03:43 PST 2002 pascal Sun Nov 10 13:03:43 PST 2002 17333 Sun Nov 10 13:05:47 PST 2002 andu's metacard Sun Nov 10 13:05:47 PST 2002 29623 Sun Nov 10 13:08:10 PST 2002 pierre's metacard Sun Nov 10 13:08:10 PST 2002 17338 Sun Nov 10 13:10:21 PST 2002 bruce's metacard Sun Nov 10 13:10:21 PST 2002 33351 Sun Nov 10 13:14:59 PST 2002 That would be bash1:44 pascal 2:04 Andu2:23 Pierre 2:11 Bruce 4:38 Now, it is likely I have become confused and mixed up exactly what came from who, sorry about that! My apologies if your name is not associated with your contribution, or vice versa. Now, why did we get different counts? I believe the count of 17333 is correct. Maybe someone can debug that. Here's the code Andu --- #!/usr/local/bin/mc on startup put 0 into the_counter put 1 into the_offset put 333491183 into file_size put 3 into the_increment put /gig/tmp/log/access_log into the_file put mystic_mouse into pattern open file the_file for read repeat until (the_offset = file_size) read from file the_file at the_offset for the_increment put it into the_text repeat for each line this_line in the_text get offset(pattern, this_line) if (it is not 0) then add 1 to the_counter end repeat add the_increment to the_offset end repeat put the_counter end startup Pierre -- #!/usr/local/bin/mc on startup put 0 into the_counter put 1 into the_offset put 333491183 into file_size put 3 into the_increment put /gig/tmp/log/access_log into the_file put mystic_mouse into pattern open file the_file for read repeat until (the_offset = file_size) read from file the_file at the_offset for the_increment put it into the_text repeat until lineoffset(mystic_mouse, the_text) = 0 if (lineoffset(mystic_mouse, the_text) is not 0) then add 1 to the_counter delete line 1 to lineoffset(mystic_mouse, the_text) of the_text end if end repeat add the_increment to the_offset end repeat put the_counter end startup Bruce - #!/usr/local/bin/mc on startup ## initialize variables: try adjusting numLines put /gig/tmp/log/access_log into the_file put $1 into numLines -- called with 1 as parameter put 0 into counter open file the_file repeat until (isEOF = TRUE) ## read the specified number of lines, check if we are at the end of the file read from file the_file for numLines lines put it into thisChunk put (the result = eof) into isEOF ## count the number of matches in this chunk put offset(mystic_mouse, thisChunk) into theOffset repeat until (theOffset = 0) add 1 to counter put offset(mystic_mouse, thisChunk, theOffset) into tempOffset if (tempOffset 0) then add tempOffset to theOffset else put 0 into theOffset end repeat end repeat close file the_file put counter end startup ___ metacard mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/metacard
Re: the large file challenge
Wow, Just logged on to work and saw all the great responses. Thanks all, what fun. Anyway I will respond to each later and try your code too. I have to run right now, appointment. I did however have some code from Andu via Swami that I modifed somewhat and got enormous speed improvement. Here's the latest run (ran this several times so file would be in cache equally for all programs). . bash Sat Nov 9 16:48:12 PST 2002 17333 Sat Nov 9 16:50:05 PST 2002 pascal Sat Nov 9 16:50:05 PST 2002 17333 Sat Nov 9 16:52:09 PST 2002 metacard Sat Nov 9 16:52:09 PST 2002 17338 Sat Nov 9 16:54:28 PST 2002 . So that is 1:53 for bash, 2:04 for pascal, and 2:19 for MC. darn good! Here's the code, gott go... #!/usr/local/bin/mc on startup put 0 into the_counter put 1 into the_offset put 333491183 into file_size put 3 into the_increment put /gig/tmp/log/access_log into the_file open file the_file for read repeat until (the_offset = file_size) read from file the_file at the_offset for the_increment put it into the_text repeat for each line this_line in the_text get offset(mystic_mouse, this_line) if (it is not 0) then add 1 to the_counter end repeat add the_increment to the_offset end repeat put the_counter end startup ___ metacard mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/metacard
re, Giant files
| Try something alike : | | on mouseup | put 1 into startread | open file thefile for read | read from file thefile until eof | put the num of lines of it in endtoread | close file thefile | repeat while startread endtoread | open file thefile for read | read from file thefile at startread for 99 lines | ... | do what you need with it | ... | close file thefile | add 100 to startread | end repeat | end mouseup | | -- | Cordialement, Pierre Sahores Merci bocoup Pierre, I'll try it and let you know the speed. I have to guess it's going to be slow though. But at least it should run to completion. Perhaps this will inspire MC coders to optimize! Take the speed challenge! Put your MC script up against a compiled language! A prize for the fastest program. Aloha, Sadhu ___ metacard mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/metacard
the large file challenge
| Try something alike : | | on mouseup | put 1 into startread | open file thefile for read | read from file thefile until eof | put the num of lines of it in endtoread | close file thefile | repeat while startread endtoread | open file thefile for read | read from file thefile at startread for 99 lines | ... | do what you need with it | ... | close file thefile | add 100 to startread | end repeat | end mouseup Alors, Pierre, Many thanks. This turned out to be more efficient than I thought. I had to modify it slightly because the 'read from file at' command takes an offset in characters, not lines. (Code below). Anyway, on those 3 sample programs, here are the times on the last run, not my full access log, but a chopped (50,000 lines) snippet. Bash shell script (interpreted) 24 seconds Pascal (compiled) 7 seconds Metacard (interpreted) 2 minutes 50 seconds So, any takers on the speed challenge? Here's the code I used. #!/usr/local/bin/mc on startup put /gig/tmp/log/xaa into the_file put 1 into start_read put 0 into the_counter put 1 into the_offset open file the_file for read read from file the_file until eof put the num of lines of it into end_read close file the_file repeat while (start_read end_read) open file the_file for read read from file the_file at the_offset for 99 lines put it into the_text put the number of chars of it + the_offset into the_offset repeat for each line this_line in the_text if (not eof) then if (this_line contains mystic_mouse) then put the_counter + 1 into the_counter end if end if end repeat close file the_file add 100 to start_read end repeat put the_counter end startup Now, I feel sure we could improve this, fix my errors, etc anyone? Sadhu ___ metacard mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/metacard
Copy protecton
Aloha, Can anyone help me with some ideas for copy protection? I'm developing a small Windows application that I want to give for free to existing customers, but I don't want them able to use it after they are no longer customers, or, making copies for friends. I'd prefer something more robust than a license key or password because that can be shared too. One idea I have is make it web enabled .. it has to check back with our server and verify a valid customer record exists. Another idea - put a time bomb in it. When a certain date is reached, it expires. But if there is a simpler way, would love to hear it. Thanks all, Sadhu ___ metacard mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/metacard
Re: Web-PHP-Metacard Process FAQ
| 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: Bug? Intermittent situation with CGI program
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
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: cgi troubles
Bonjour Pierre, Ah, merci for the confirmation! Yes, good idea, just put something in front of MC to handle the sockets communication. That probably would have been faster than a complete rewrite in Perl. Did you ever hear anything from Scott or his team about fixing these bugs? Anyway, will look through the archives for your posts and again, thank you! Sadhu | | 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: Running CGI's locally on OSX
Well, Swami, I should probably remain silent on this, not having an OSX around - but the quick and fraught with peril answer may be - log in as root. (I would expect to hear back a few no, don't do it! responses from seasoned Unix veterans, because it lets you overcome all sorts of permission problems instantly without knowing what you are doing.) Again, I really don't know enough about your environment but I'd suggest you try it to see what happens. Sadhu | Message: 2 | Date: Wed, 03 Jul 2002 18:13:05 -1000 | Subject: Running CGI's locally on OSX | From: Sivakatirswami [EMAIL PROTECTED] | To: Metacard List [EMAIL PROTECTED], | [EMAIL PROTECTED] | Reply-To: [EMAIL PROTECTED] | | I have moved up to OSX (it's wonderful) and want to develop CGI's on my own | machine. The mail lists have snippets, but not enough to put it all | together. | | I put a copy of the darwin engine into | | /Library/WebServe/CGI-Executables/ | | But, that's as far as I can get, the terminal.app on -ls returns only my | user directory. / returns permission denied...so OSX won't let me deeper | than my own user directory to CHMOD 755 to make the engine executable. | | Anyone figure this out yet? If so, suggest you would help us all to write a | small FAQ on the subject. | | Now, I am wondering if we need to use that library at all, really, if one | just made a cgi-bin directory in one's own Sites folder, then one could | set permissions from the terminal.app. But, I don't want to re-invent the | wheel just now. This has got to be simple. | | Hinduism Today | | Sivakatirswami ___ metacard mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/metacard
cgi osx etc
Hi Just run the script directly from the command line and see what error message you are getting back from either Unix or MC. Premature end of headers means apache got something that was not prefixedwith the content type etc, ie, the script didn't run. Sadhu | Message: 1 | Date: Fri, 05 Jul 2002 14:40:03 -0400 | Subject: Re: Running CGI's locally on OSX | From: Richard MacLemale [EMAIL PROTECTED] | To: [EMAIL PROTECTED] | Reply-To: [EMAIL PROTECTED] | | On 7/5/02 12:02 PM, [EMAIL PROTECTED] | [EMAIL PROTECTED] wrote: | | Premature end of script headers error message in the error_log when trying | to call this script: | | ==test-mc.cgi | #!/mc | on startup | put Hello into buffer |put Content-Type: text/html cr |put Content-Length: the length of buffer cr cr |put buffer | end startup | = | | I don't know if this means that the MC Darwin engine is working or not... | | Anyone else have clues? Again, seems simple, but doesn't work. | | Couple of things to try. One, I use #!mc and not #!/mc, but that's probably | not your problem. However, make sure that the script file you wrote is | saved with UNIX line breaks! Not Mac line breaks. If you haven't already, | grab a copy of Bbedit lite, which is free, free, free and awesome. It can | easily save your script with UNIX line breaks. I'd guess that's the | problem. ___ metacard mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/metacard
Re: Sending an email message from within MetaCard
| | Has anyone implemented a system like this? Is there a better way? Can | anyone point me to a model I could follow? | Hi, Yes, we've implemented some things like this. Either custom cgi's or using the FormMail.pl script from Matt's perl archives. In other words, the problem is - trying to send emails directly off a personal computer of some kind means you have to deal with too many variations of how these machines are set up to use email. A nightmare. So instead, you use a 'post' command to send off your data to a webserver somewhere running a cgi like FormMail which in turn sends the email for you. If you have an ISP and they let you put cgi scripts in your home directory (generally ~/public_html/cgi-bin or something like that) you can use FormMail or your own variety of script. (It can be an MC script if you have the Metacard engine installed on the web server for example; I sent a post last year of how to do this.) Lately I have wanted to do this with the mail being in turn an html mail with a form on it with a submit button. At work we developed a perl script (mimemail.pl) for sending html mail that does a lot of the work of composing the right headers, and what my MC cgi's do is create the html file to be used as the attachment and then system off a command line to mimemail.pl. Make sense? Sadhu ___ metacard mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/metacard
GGI works and then doesn't work--global replace (Sivakatirswami)
| Today's Topics: | |1. GGI works and then doesn't work--global replace (Sivakatirswami) Swami, This doesn't solve the problem but may give you a clue? As you know, the premature end of headers message from apache occurs when the cgi script returns something that is not html. In your program it appears that the only way this could happen is if you got a fatal error prior to getting down to the lines of code that put the content type, etc. So my first suggestion is - put that stuff at the very beginning of your program then you might have a chance to see what is happening (ah, maybe depending on if when the mc interpreter fails it sends to standard out or standard error, and if stderr it would be picked up by apache, not sure.) Of course, if you only had a SHELL account then you could simply trap the raw input from the get into a file, then test by piping that input directly into your script and see what error message you are getting back and then track it down that way. Oh well. I suppose there are tedious ways around it using SSI. Anyway, I would ask myself the question - how could a fatal error possibly occur? Such as, what if variable y is empty? or .. etc. It is always a good practice, IMHO, to initialize variables even though MC doesn't require it. Also, I have some shell script code at home that would probably do your directory walk a lot faster, I'll dig it up and send it later. Aum Aum Sadhunathan | | --__--__-- | | Message: 1 | Date: Sun, 19 May 2002 08:04:36 -1000 | Subject: GGI works and then doesn't work--global replace | From: Sivakatirswami [EMAIL PROTECTED] | To: Metacard List [EMAIL PROTECTED] | Reply-To: [EMAIL PROTECTED] | | There's a mystery with the following CGI running on a SPARC-Solaris -- two | questions. | | FYI The intent is to have a global search and replace function for strings | in HTML files. | | 1-Mystery... I ran this script using GET and about 3 minutes later, after | processing 792 files it returned Done. and a manual check of files showed | that it had succeeded in processing the file. | | Then, a few minutes later I changed the text in the string to be replaced | and, inexplicably, the server returns a configuration error and the error | log indicates premature end of script headers which I know to be a generic | error message that tells one very little about what actually went wrong. | Any one have any ideas why it could work the first time and fail the next | time? | | 2) This script is a little slower than expected running on such a powerful | CPU... though perhaps my expectations are too high... but, is there a better | strategy, perhaps issuing shell command to get UNIX to do the work? Just | the directory walk itself to get a file list was fairly time consuming. | | #!/export/[snip]/www/public_html/cgi-bin/mc | | global gHierList,gMainFolder | | on startup | set the directory to ../ ## gets us up and out of /cgi-bin/ | put the directory into gMainFolder | directoryWalk gMainFolder | | repeat for each line y in gHierList | ## following line does the work. | Replace copyright (C) 2001 Himalayan Academy with \ | copyright (C) 2002 Himalayan Academy in URL (file:y) | end repeat | put done into buffer | put Content-Type: text/plain cr | put Content-Length: the length of buffer cr cr | put buffer | end startUp | | on directoryWalk whatFolder | | set the itemDel to / | set the directory to whatFolder | put the files into temp | filter temp with *.html | add the number of lines of temp to tCount | 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 | if (x = .. or x = webmaster) then next repeat |directoryWalk (whatFolder / x) | end repeat | | --__--__-- ___ metacard mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/metacard
Time Date Problem on Sun SPARC SOLARIS (Sivakatirswami)
| Date: Sat, 09 Mar 2002 08:37:38 -1000 | Subject: Time Date Problem on Sun SPARC SOLARIS | From: Sivakatirswami [EMAIL PROTECTED] | To: Metacard List [EMAIL PROTECTED] | Reply-To: [EMAIL PROTECTED] | | I am running a .mt script as a CGI on a Sun SPARC Solaris that hosts our web | site in Honolulu. | | Problem, my script depends on this function: | | put the date | | returns March 10, 2002 and Greenwich time (London) | | BUT | | A shell script on the same machine using UNIX to echo the date returns the | data in Honolulu March 9, 2002 | | So, the daily lesson that is built has tomorrow's date. | | The sys admin blames metacard...but obviously, the server must have *some* | setting that MC is accessing. thus: two questions: | | 1) how to get MC to return the same, local date and time, that a shell | script returns on the same UNIX machine. | 2) what setting on the Solaris is MC accessing that I need to tell the sys | admin to fix. (they are overloaded like everyone and didn't bother to | investigate further... so I need to take the initiative here. | | Any ideas? Swamaji: Unfortunately a lot of stuff obtains GMT by default (like RCS we use at work, harummph) and that can be confusing. But even if there were some environment variable you could set to obtain the time zone you want, how about a primative solution: A You normally run the create the daily lesson script at the same time, so the date offset will be the same every day, so you could subtract a day, perhaps in some way more efficient that this: put the date into foo convert foo to hours subtract 24*60*60 from foo convert foo to long date put foo B you could make a system call to the Unix date function instead of using MC, such as set the shellcommand to /bin/sh put date '+%B %d %Y' --date '1 days ago' | sed 's/ /_/g' | into command_string put shell(command_string) etc.. using whatever the correct date command on (is it Solaris? I thought it was Sun OS? ) - they could email you the man page. Aum Aum Sadhu ___ metacard mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/metacard
cgi question
| | OK, here's a question. When darwin mc is running, what is it running AS? | It can write to files with read/write (everyone), but cannot write to files | with read only (everyone.) If I knew what it was running AS, I could put | that into a group and simplify my life. When I use the shell command | whoami, it returns root. But that's what the shell commands are run as, | NOT what the metatalk scripts are run as. I can get around this by using | shell commands to write files instead of metatalk commands (open file, | etc.), but the question remains. Anyone have the answer? :) | | :) | Richard MacLemale What's darwin mc? Sorry if I missed an earlier thread here, but it sounds like you mean, what is the user id of the process when an MC script is executed as a CGI program?? Would this be on a Unix system I presume? Darn, I remember running into that too but I forget what I found out, it was maybe nobody or httpd or something like that. And as I vaguely recall, that was configurable in Apache maybe?I might be totally wrong here. However, I suspect there is an easy way to answer your own question (that's what you really wanted to know, right?). Can you have your mc cgi script create a new file somewhere that is read,writable by everyone (like /tmp) and then, just look at the file permissions? I did that just now and the answer I got I believe would be specific to the system where I ran it: I got 4 -rwxrwxrwx1 wwwrun nogroup 498 Mar 8 11:10 formdata.mc.txt Perhaps the tiny script I used to write this file would be of some help? Here it is. (I call it debug.mt). You have to drive it with an html form with a post command, such as: form methond=POST action=/cgi-bin/debug.mt and it will spit back your form fields plus save the raw data in a text file for examination. Cheers, Sadhu #!/usr/local/bin/mc on startup read from stdin until empty put it into inputdata put urlDecode (inputdata) into formdata put inputdata into url file:/tmp/formdata.mc.txt split formdata by and = put keys(formdata) into keywords put Content-Type: text/plain cr cr put I am an MT script - hello world repeat for each line this_item in keywords put this_item = formdata[this_item] cr end repeat end startup ___ metacard mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/metacard
failure of pipe in shell command, CGI scripting
This posting is for the benefit of the technical archives, regarding an apparent problem I ran into, and worked around. Not sure if this is something I am doing wrong, or a problem with MC, Linux, or what. Context --- Using MC as a cgi scripting language on RH Linux, to perform data base queries via shell commands, and return search results as web pages. The data base is PostgreSQL, and each individual component of a command is proven to work fine. This is Linux kernel 2.2.16, MC 2.4, PostgreSQL 6.5.3. Problem --- When components are combined in a pipe line and submitted as a shell command, it stops working. Same command run directly from the shell does work. Work around/Solution - Redirect SQL output to a file then cat the file into the RPT report formatter program rather than trying to pipe directly from SQL into RPT. Note: Both methods have identical results when done from the shell directly, but when submitted as MC shell commands, one method works, the other does not. See example script below (the line commented out is the one that fails). #!/usr/local/bin/mc on startup read from stdin until empty put urlDecode (it) into formdata split formdata by and = put url file:./by_date.sql into the_query replace $TALK_DATE with formdata[talk_date] in the_query put the_query into url file:/tmp/by_date.sql put psql cybertalks -qt -f /tmp/by_date.sql /tmp/date.dat; cat /tmp/date.dat| ./by_date.rpt into command_string #put psql cybertalks -qt -f /tmp/by_date.sql | ./by_date.rpt into command_string put Content-Type: text/html cr cr set shellCommand to /bin/sh put shell(command_string) end startup ___ metacard mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/metacard
POST not working in 2.4.1?
Hello, Has there been any response to Swami's query below? I am having a similar problem with Post. Worked on 2.3. Fails on 2.4 - IF - I build a standalone. I'm using a mail reflector (Matt's FormMail.pl), I have some code that: Hasn't changed Works from a Windows standalone that was built under 2.3 Works as an interpreted (.mc) file from within the 2.4 development environment Does Not Work when compiled into a 2.4 standalone for Windows. I would think this is either a bug, or some resource I'm missing? I moved all resources into the stack. I get the same behavior as SivaKatirswami, namely, the it returned by the post command is empty (and nothing happens). The code line is something like this (name of webserver changed to protect the innocent). Post tText to url http://www-sd.castandcrew.com/cgi-bin/FormMail.pl; Be happy to hear from anyone who has a work around before I send in a bug report. Thanks! Sadhu . | Message: 6 | Date: Tue, 01 Jan 2002 14:37:35 -1000 | Subject: POST not working in 2.4.1? | From: Sivakatirswami [EMAIL PROTECTED] | To: Metacard List [EMAIL PROTECTED] | Reply-To: [EMAIL PROTECTED] | | I have a script which works in 2.3.2 but not in 2.4.1 | | it posts a complete URI to a CGI on another server. The CGI check to see if | the file exists and returns true or false.. | | start using stack libURL | put tMonth / tFinalDateString/index.html after tPastFile | POST tPastFile to url www.ourOtherServer.com/cgi-bin/exists.cgi | delete line 2 of it | if it = true then | ## build html links to that day in the past | ## and post to today's page. | | anyway... it is empty now under 2.4.1 even when the file exists... proven, | because I can run the same procedure in the same stack under 2.3.2 and get | true back for the same request.. | | So, how to implement POST now? | | Hinduism Today ___ metacard mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/metacard
stack architecture
Aloha, Oh darn, getting frustrated with the stack architecture and know there must be a simple solution. The problem is hard to describe in detail since I have tried so many combinations of things all of which failed, but in a nutshell, I think it is the fact that substacks get saved in the same file as the main stack. How to turn this off? How to get rid of a stack that got saved in a file you don't want it in? Mmmm, if only we could just edit a stack file. So anyway, here is the scoop: I want basically 3 stacks. I think. Only because I think I have to. I'd happily change. 1) Stack one, gets compiled as the executable standalone. Has to be executable. But as a result, it cannot save data. Enter stack #2. 2) Stack two, this is for data. Each user of the program will have their own data set. Consequently, this should be a separate file, just for data. 3. Stack three, for algorithms. If I want to add new features, I will add them here and distribute this. I don't want stack 2 and 3 mixed together because then I would overwrite existing data if I distribute this. Problem is that 2 has to be a substack of 3 to inherit its algorithms and this causes the files to be saved as each other. I have them horribly mixed together and delete doesn't remove the algorithm code from the data file, or the data from the algorithm file. Help! Thanks Sadhu ___ metacard mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/metacard
Re: stack architecture
/ FROM: Robert Brenstein [EMAIL PROTECTED], Dec 12 1:30 2001 | ABOUT: Re: stack architecture | | Problem is that 2 has to be a substack of 3 to inherit its algorithms | and this causes the files to be saved as each other. I have them | horribly mixed together and delete doesn't remove the algorithm code | from the data file, or the data from the algorithm file. | | No, 2 does not have to be a substack. As a matter of fact, to achieve | the distribution goals, each of your stacks must be alone in its own | file. | | There are several different mechanisms that you can use to get your | data and algorithms together. A simple one is to use fixed names and | complete references to objects in other stacks. For example, | | get fld data1 of cd sampledata of stack sadjudata | | You just need to ensure that the shared items have unique names. | | Another mechanism is stacksInUse which allows you to make stack | scripts available to any other stack. | | Yet another mechanism is using frontscripts/backscripts feature of Metacard. | | Robert | \ END: Robert Brenstein Wow, Robert, I think you saved my sanity, thank you. Your email mentioning 'stacksInUse' led me to find the start using command which seems to solve my problem. I have now ended up with 2 stacks, a startup stack and a data stack. I hope when I compile the startup stack into a standalone the start using will still work. That will be a next test. Meanwhile, during the time I was struggling with the effort to keep the data and the algorithms in separate files, but thinking the only way I could share the algorithms was by making the algorithm stack the mainstack of the data stack .. I seem to have gotten my data stack to be a substack of itself. It's own name is listed as a substack in the components dialogue. I can't seem to get rid of it from there. Any ideas? Anyway, thank you very much and for such a quick response! Aloha, Sadhu ___ metacard mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/metacard
Re: Using a stack as a small data base
Kevin, you sent me this a while back: (on how to save data with standalones) | You need to place the stack that you want to save changes in an external | file, then reference this stack using the stackFiles property. When you | load your standalone, load this stack, make changes and save as normal. | Developers often place such stacks in a data folder. Distribution Builder | can do all of this automatically when you create a Distribution. | | Regards, | | Kevin I finally got around to this, also, to reading the article on stackfiles on the xworlds web site. Finally made it work. Wasn't easy for me, but, it does work, at last. So, a few notes for the list someone may someday find helpful, elaborating on a couple of minor points. One gotcha, and a reason I'm trying to post this to the mailing list, is that in the stackfiles property there cannot be a space after the comma after stack name and before the path/file name. That is unexpected (for Unix developers anyway) that white space matters, but I suppose the convention of allowing spaces in file names on other systems may be responsible? In any case, for others out there like me stuggling to save data in their stand alone applications, the basic idea is that you have your stand alone executable be a stack that opens another stack (or stacks). This other stack is NOT a substack of your main stack. It is located by the first stack using the fact that the stackfiles property can contain a stack name, comma, full or relative file path name. So if your primary stack (which is compiled as the executable) has a statement like go foostack and the stackfiles property contains a line like foostack,Data/foostack.mc Then it can find it, without it being a substack. Per earlier note, it wasn't working for me when I had it as foostack, Data/foostack.mc And that took a while to grasp what was wrong. But if this is correct, then the first stack can find the second stack, and this second stack is not compiled into your executable, it is a separate MC file for data (doesn't have to have an .mc extension). Then your 2nd or data stack has to have some save code which again is relative to the main executable, and has the file name, such as save this stack as Data/foostack.mc Those are the basic elements for saving data that are now working for me. Kevin, thank you for your help. Aloha, 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.
Re: Printing Field Text
Hi Geoff, I saw your post, looked at the scripts in the 'print field' stack. Wow, it seems so complicated. From what I could glean, it seems you cannot just print a field, you have to put the stuff into a card, and print the card. So anyway, my problem is, I have a scolling field that is larger than the visible portion of the card. Thus, when I print the card, only part of the field shows up. What I would like to do is something very simple like, repeat with line_count = 1 to the number of lines in field Results print line line_count in field Results end repeat But this is incorrect for the print command, it only seems to take a card as an argument. Would you have any suggestions for me? Perhaps I have something else in my (simplistic) print routine that is messing me up. This is the code: on mouseUp set the formatForPrinting of this stack to true set printScale to 0.75 set printMargins to 20,72,20,72 set printRotated to true answer printer print this card set the formatForPrinting of this stack to false set printRotated to false end mouseUp Thank you in advance for any suggestions. 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.
I call it a bug, do you agree?
This script courtesy of Rich Herz [EMAIL PROTECTED] Aloha, Scott: I call this a bug in the round function. I get the same results on a Windows PC. I believe some would disagree. What do you think? Whatever it is called, I find I have to compensate for it doing dollar arithmetic where one penny off is unacceptable. Thus, my request is either a bug fix, or a money-friendly rounding routine. Have anything handy? Thank you! Regards, Sadhu | A test of round() on Mac G3 with MC 2.3.2 | | on mouseUp | repeat with i = 0 to 9 | put 38.1 i 5 into tNum | put round(tNum, 2) into line i+1 of field 1 | end repeat | end mouseUp | | Results displayed in field: | | 38.1 - 38.105 should result in 38.11 | 38.12 | 38.13 | 38.14 | 38.15 | 38.16 | 38.17 | 38.17 - 38.175 should result in 38.18 | 38.19 | 38.2 | | Some other series show this behavior, though not always at the same | positions in the series; some others do not (put 100.1 i 5 into | tNum). | - 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.
Round function bug
Bug? The documentation for the round function states that .5 or larger rounds up. But apparently, it is not consistent, and sometimes rounding up occurs at 0.5, not = 0.5. round(1.335, 2) returns 1.34 but round(38.175, 2) returns 38.17 on my machine. I'm thinking as a work around, just add a small number like 0.0001 to every call to round. Comments? 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.
Rounding Bug, eeek!
| | From: Richard Herz [EMAIL PROTECTED] | | Subject: Re: Math errors, HELP! | | Date: Tue, 14 Aug 2001 14:15:45 -0700 | | | | | | The code you supplied and put into EXAMPLE 2 below works OK. EXAMPLE 1 | | below shows a similar rounding problem that can occur with the MC format | | function. The format function with a format of %6.2f rounds 1.3350 to 1.33, | | whereas round(1.3350, 2) returns 1.34. My summer students discovered this | | last week in homework 1 with similar behavior of MC format function and True | | Basic's PRINT USING instruction. None of this may have solved your problem, | | so good luck! . Oh dear, I am still having grief with the rounding function, and it seems like a bug to me. I put this into the message box put round(1 * 0.50 * 76.35, 2) Now, this should resolve to round(38.175, 2) = 38.18. But try it, it returns 38.17. EEK, a BUG! If someone can suggest a work around, I'd be very grateful. 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.
Re: OT: Page generation Do it locally
| --- 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.
Re: Installing MC at your ISP, a How-To
| | From: [EMAIL PROTECTED] | Subject: Re: Installing MC at your ISP, a How-To snip | | And | if you launched it as a user with admin privileges, cross your | fingers. Sir, Isn't this highly unlikely, that an ISP would grant regular users any kind of admin privileges? No wrapper is required to set the umask so that users can only modify things in their own home directory or below. See excerpt from a Unix man page on umask below. If ISP's don't take at least this extremely elementary precaution (which is probably the default installation for most Unix systems) they are asking for trouble from any kind of cgi activity. I think that admin privileges for regular users must be an extremely remote potential, although, yes, it could be possible. When so many people were all hyped up about potential disasters prior to Y2K I used to tell them .. yeah, its *possible* but its also *possible* the gasoline in your car's tank could explode. No one seems worried about that. I think the potential of dangerous activity here is being somewhat overhyped. Can't users who install MC on their ISP take simple precautions like, set permissions on the mc file so it is owned and can only be operated by themselves, check the referrer in their MC cgi scripts etc? Regards, Sadhu umask(1) umask(1) NAME umask - set or display the file mode creation mask SYNOPSIS Set Mask umask mask Display Mask umask [-S] DESCRIPTION The umask command sets the value of the file mode creation mask or displays the current one. The mask affects the initial value of the file mode (permission) bits for subsequently created files. 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.
flaming emails!
| | You make a point of telling people their car's gas tank may | explode while driving but that doesn't stop them from driving | anyway. Your point is based on what a driver knows about their | environment, to put it another way, what if a passenger came | along and placed a flaming rag into the gas nozzle and got into | the car with the driver without telling them. Two scenarios: | A) Tell the driver, who promptly freaks out B) Car may/may not | explode. | | As a server admin, I like it when my clients inform me of any | executable they install on the server. That's all I'm saying, | I'm sure the other admins would like to know also. | Yes, I'm sure they would. Sorry, didn't mean to come across in a derogatory way if I did. Email can be dangerous in that regard. Ok, me too. I would like that too if everyone using my servers told me everything they were doing. I would also like all my programmers to put enormous amounts of comments in their code. Oh well, dream on, I would be the first to advocate common courtesy but we have to be realistic. Some ISP's might panic and cancel your account if you said, I installed a new executable but don't worry. In the case of my programmers I review all the RCS logs every week so I know exactly what has changed. I would like it if the guy in front of me bothered to signal before making a turn also, but if he doesn't, I realize I have to have control of my own car and not be following too close. Same with a sys admin, I think one has to be proactive. But I apologize if my mail offended you. It would not be hard to write a script to locate all new executables on a server and check it once a week, right? My point was regarding, probabilities. I think the probability of danger is rather high if someone sticks a flaming rag in the gas nozzle. Say, more than 50%? I think the probability of having someone take control of an ISP's server and delete operating system files using root permission just because a regular user installs MC is rather low, say, less than 1%. Would you agree, those are fair assessements? Yes, there are plenty of hackers out there, but I would guess less than 1% of the web sites on the net (how many millions do we have now?) are hacked, what do you think? Of course almost anything is possible given time and extraordinary desire on the part of the hacker. 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.
Installing MC at your ISP, a How-To
CONTEXT: On UNIX, Metacard can be used as both a GUI development environment as well as a CGI scripting language. If you running your own UNIX machine, it's fairly trivial to set it up for either use, using the supplied install script and the instructions. If you are not using your own machine, but are hosted elsewhere, such as on an ISP over the Internet, its likely not appropriate to attempt X-Windows development, however, CGI scripting is very feasible. If you have access to a shell account with reasonable permissions (telnet or ssh), again, its a snap to install, or if not, and your ISP is willing to install it, they should have no trouble. They can just download the necessary files and run install.sh. PROBLEM: What if you have no shell account access, and your ISP says something like 'gosh, give us a few months to evaluate this, it is a possible security risk, and by the way, its going to COST you..'. Are you out of luck? Maybe not. If they allow you to install and run your own CGI programs using FTP, then, you can still use MC as a CGI scripting language and get it up and running without their help. You might need a bit of help from your friends though, depending on how much UNIX experience you have. The following describes how I got it working on our ISP. SOLUTION: The key fact is that, to use MC on your ISP's host, you only need one file: mc. The file mc is the Metacard engine, or interpreter. Writing an MC script is similar to writing a Borne shell or Perl script, where the first line indicates the location of the interpreter. Therefore, all you have to do is get the right interpreter for your ISP's host, put it in the right place, and correctly refer to this place in your metatalk scripts, and bingo, you are using MC on your web pages. As indicated on the www.metacard.com site, use of MetaCard as a script-only (non-graphical) language is FREE on all UNIX systems: no license is required. This in turn means that it is supplied as a binary file, not as source code. So, you don't have to compile it. All you have to do is get the right version, it is supplied pre-compiled. You may need a bit of help to determine this. In our case, our ISP was running Sun OS, and this operating system only runs on Sparc processors, so the file we needed to download was sparc.tar. This is an archive made using the ubiquitous Unix tar program, and here again, you may need some help from your friends to unpack it. In our case, I just ftp'd it to my Linux computer and ran the command tar xf sparc.tar This gave me several files, namely, mc.gz, xanim.gz, and gunzip. The gunzip was useless on my Linux (Intel) machine being compiled for Sparc, but in any case, the only file needed is the mc.gz file. This in turn is another compressed archive made with the GNU gzip program. So again, depending on your ability to uncompress standard Unix archives, you may need some help or have to acquire some tools. I simply ran the command gunzip mc.gz which produced the file I needed, mc. On the other hand, perhaps Kevin or Scott or some kind soul will put the uncompressed, ready to run versions of MC for all processors on their ftp site so that all the decompressing steps would be unnecessary. Next, ftp the mc file to the place your cgi scripts can run from, typically public_html/cgi-bin. Set the correct permissions to make it executable. For example, on our ISP it has to be chmod 700 or chmod 755. (chmod 777 is a security violation and programs with these permissions will not run on our site). You next have to determine what is the actual location, that is, the absolute path name, of your mc engine. In our case, our ISP supports SSI (server side includes) so the pathname was determined by building a test html page using pwd (print working directory) as an ssi command. More details on this below. In our case, the full path name turned out to be something like /export/vhost/org/g/ourhostname/www/public_html/cgi-bin and therefore, the first line of our mc scripts has to be: #!/export/vhost/org/g/ourhostname/www/public_html/cgi-bin/mc To summarize, get the right mc file, put it in the right place on your ISP, and set executable permissions. That is all there is to it!! Then, you can write any MC scripts using the right first line to point to the mc file, again, making them executable. Regards, Sadhunathan Nadesan CIO, Cast Crew PS, Some helpful files: This simple script can be installed as a cgi on your host to help find the correct pathname. For example, you could call it pwd.cgi. .cut here #!/bin/sh # write minimal set of HTTP headers to stdout echo Content-Type: text/plain echo pwd .cut here If your ISP supports SSI, then you can use a web page like this to find out the real path name of pwd.cgi. There are other ways, such as perhaps a POST command from an MC stack. Here's the page I used: .. cut here
Re: Installing MC at your ISP, a How-To
| | Play safe, we consider mchttpd experimental until it's *wrapped*. | Suppose one set the permission on the mc file to 700 permission owner group ... -rwx--sadhusadhu Would this accomplish the same thing, ie, no one else but the owner of the account could run the interpreter? 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: Digest metacard.v004.n325
Question from an Apple newbie, What should I do to prepare an MC MAC 'stand alone' for distribution? Does it need to be 'stuffit-ed' ? I built a stand alone on my mac laptop, put it on the web, but when I download it with IE to another mac, that mac thinks its a text file, not an executable. ??? The download is simply an http link (option click, and the file downloads). Obviously this is no problem on the PC, it recognizes the file types by their .exe extension, but on the MAC as I understand there is a separate file with this info? Do I somehow have to include this file in the distribution? Where is it? Thanks for any help, 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.
Re: Digest metacard.v004.n323
| So | a) trying to understand the outside referrer business for CGI's called from | distributed stacks and Swamaji, Everyone is a novice in some area! Let us not hesitate to speak here in the assembled of the learned even if we don't know what we are talking about. That said, I might be completely wrong, but I don't think HOL is paying any attention to referrers. EG, in that formmail.pl script we used - the widely known one from Matt's archive - there is code that checks the referrer. We just took it out. . I had people calling that script from all kinds of places, Calif to NY - no problemo. Since we will be the authors of the cgi programs, we don't have to put referrer checks in. HOL won't be paying attention to where our programs are being called from. That's my possibly undereducated view point. IE, nothing to worry about. Unless they have changed something. | b) still confused as to the extent that MC can be a threat to a mainstream | WEB hosting service in the hands of a CGI novice who also has equal access | to a PERL and PHP interpreters. I think Andu and I agree, there is no more threat. The issue is convincing HOL. It's possible when he is talking about bandwith he is referring to cpu cycles and indicating MC may take more of them to do its processing - I don't want to put words in his mouth though. I think that would be a moot point in your case, with such comparitively small scripts. If it actually did become an issue on HOL - meaning - if they notice our programs bogging their server down - we could consider rewriting the pig jobs (oops, no offense to pigs intended, just industry slang) in a compiled language. Now, compiled programs, there's where HOL should really be scared if they dont have their security down pat, but I think they do. However, there is nothing to stop us from writing C for Sun O/S, compiling and installing it on their server. They are not preventing this, so no reason they should worry about MC, IMHO. It's possible he means bandwidth in terms of number bytes uploaded per time frame - your site already gets a lot of traffic and I don't believe they are charging for useage, right? So that is a non issue too. 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.
Re: Digest metacard.v004.n322
| | I see this is turning nasty and for no good reason. | Simon's offering of free server space *and* Metacard engine for testing | cgi scripts should be appreciated. | Also, his security concerns should be taken as such, final testing and | fine tuning of scripts on a public server I think is fine but figuring | out what a cgi is and how it works could be dangerous. | Calling a cgi from a stack or a browser should make no difference to the | server, what the cgi script does is a another matter and could become a | security concern. | What I don't understand is why you don't do preliminary | testing/debugging on a local machine, which is much easier and if there | is a security issue you don't compromise a public server, but use a | machine on the other side of the world. | Aloha Andu, Please pardon my jumping in but perhaps you have mistook the intent - Swami is a very noble person and would *never* get involved in any nastiness. Trust me. I think we can do best on a list like this by offering everyone respect. Unfortunately, email is dangerous in this regard, ie, it's easy to read something into it was not intended. I'm sure you have seen it many times. His intentions are good. I believe he just wants to make sure that he can assure his ISP there is no security risk in installing MC. This same ISP already permits customers to install their own cgi programs . Obviously, these programs can ignore the referrer and do whatever the customer wants - within, of course, the O/S and file system constraints. So we should be able to tell them that installing MC is no more dangerous than them installing a Perl interpreter, or Borne shell. (Which they have). Right? Thanks for your help, 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.
Re: Digest metacard.v004.n309
| | OK, trying here to get this .mt thing going. Metacard is installed on our | San Diego Apache server... | | Using the survey.mt as a model I created this small script: | | #!/usr/local/bin/mc | on start up |if $REQUEST_METHOD is POST then |read from stdin until empty |put it into buffer |put Content-Type: text/plain cr |put Content-Length: the length of buffer cr cr |put buffer | end startup | | We installed it as test_forms.cgi Havent' checked to see if anyone else replied yet, but the script above was fixed to make the on and end tokens the same (startup) and added an end if also. It now works. BTW, before this MC was returning signal 11. Can anyone tell me how to find out the meaning of signal 11? Thanks 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.
Re: pdf
| | Do you want to replace the PDF forms with a Metacard version, or use | Metacard to manage and display the PDF forms? Hi Dave, thank you for responding. We don't intend to replace PDF forms with Metacard forms, but only because we think PDF makes things easy. We are talking about taking pre-printed paper forms from outside sources that have lots of fine print, a few fields to fill in, and need to look identical to the original preprinteds when delivered. An example would be a SAG contract for a performer on a commercial. With Adobe we just scan it in, and get an exact (or pretty darn close) computer replicate, which we can turn into a form. No programming required to print it. So it's more like : something to manage a collection of these forms. Be able to save and recall instances of filled out forms, or at least the data that was extracted from them, be able to pull up a blank one, fill it in, print, submit, save, that sort of thing. | | Replacing the PDF forms with Metacard should be fairly | straightforward. Basically collect the data you need from the | Metacard forms (one form per card), format it as required for your | CGIs, and use the "post" command to send the data to the server. The problem with using MC only is (or is it a non problem?) all the effort required to get the form to print out and look exactly like the original. Another example would be an I9 or a W4 from the IRS. | | The only problem I can see is if the CGIs are already made to deal | with PDF forms that are sent using Acrobat's FDF format. (I think | Acrobat can send form data in either HTML or FDF formats.) You'd have | to organise the data from the Metacard forms into the FDF style. | However, this isn't too difficult. You can find the structure of the | FDF format by saving out form data to a file in Acrobat (full version | only). No problem, we don't need to do that. Just as with MC you can send only the data entered by the user, you don't have to send the whole form. | | However, if printing the forms is of more importance than sending the | form data, it's probably hard to beat PDF for print quality. | | Cheers | Dave Cragg | Printing is crucial, yes. Does it sound like you are saying .. MC won't help me? Thanks again, 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.