Archive for February, 2002

mn8 cgi’s and design

Somehow I remembered today about the old cgi days and how arguments where passed to cgi's as environment variables. Now I already knew how to make under bash an mn8 script to be executable, as simple as having an #!/usr/bin/env mn8 as the first line of the script and making the script executable. BTW another very simple trick which improves life a great deal is to make a simple symbolic link from your mn8.sh somewhere in your path like:ln -s /dev/spacemapper/mn8/mn8.sh /usr/local/bin/mn8 that way from anywhere you can say mn8 xxxx and voila mn8 works as any executable.

So, back to our track, this week I was playing with Vanilla and noticed that Vanila is in fact written in Rebol. That gave me the idea that if I can write bash cgi's and rebol cgi's why wouldn't I be able to write mn8 cgi's. Quickly I made a small script, throw-ed it into my cgi-bin directory and pointed my browser to it. Worked, the first time! Isn't life wonderfull ?

Cool I could write mn8 cgi's and use any kind of GET posts. But what about the POST posts? In the case of GET name/value pairs are sent as url parameters, but in the case of a POST method the name/value pairs are sent through the default input stream. But I remembered that in order to make pipes work with mn8 I check the default input stream at start-up and if I find something on it I give it as parameter to the script

Exactly! That meant that I can use POST and I will have the parameters in the argument of the main method. Quickly another script and test. Yep it worked like magic.

The morale of the story? Good design and model always pays off ;)

There is only one small issue. Every time a script is invoked the Java machine is started from scratch which is very slow. How could I keep an instance of an Java VM in memory and convince Apache to use that one to run my scripts?

BTW, Here it is the test script:

#!/usr/bin/env mn8
$pathInfo from "env:/system/properties/PATH_INFO"
$scriptName from "env:/system/properties/SCRIPT_NAME"
$queryString from "env:/system/properties/QUERY_STRING"
$remoteHost from "env:/system/properties/REMOTE_HOST"
$osName from "env:/system/properties/os.name"
$javaHome from "env:/system/properties/JAVA_HOME"

print "Content-type: text/html\n"
print "<html><title>mn8 CGI Script</title><body bgcolor="#fefefe">"

if $pathInfo != "" then [
print "<form action='" + $scriptName + "' method='post'>"
print "<textarea name='text' cols='65' rows='15'></textarea><br>"
print "<input type='submit' name='submit' value='submit'>"
print "</form>"
] else [
print "<b>Os Name</b>: " + $osName + "<br>"
print "<b>Java Home</b>: " + $javaHome + "<br>"
print "<b>Path Info</b>: " + $pathInfo + "<br>"
print "<b>Script Name</b>: " + $scriptName + "<br>"
print "<b>Query String</b>: " + $queryString + "<br>"
print "<b>numarul de argumete</b>:" + $args@length + "</br>"
if $args@length > 0 then [
each $i in $args do [
print "<p>" + $i + "</p>"
]
]
]
print "</body></html>"

February 15th, 2002

XML, oh XML

All supports XML! KWord, AbiWord, OpenOffice all stores it’s documents as XML documents, even if some of the solutions are nicer than others what matters is that it is XML. Now you will say that I am a stupid ass hole in hype over XML. Hype is not the point, hype doesn’t matter. What matters is that I can write nicely a document in any of the above applications and then take a command line utility written in whatever I like (mn8, Java, Perl, Python,….) and extract the information and do whatewer I want with it, like posting it on my site with the proper style and format.

Heck I can even make scripts which will allow me to display information as KWord,AbiWord, OpenOffice, KSpread, … documents. Isn’t that nice ?

February 15th, 2002

Romania

Dave, Romania is everything but brutal. I'm a Romanian and I must admit I'm not too proud about my country during these days but even if life is particularly harsh during the actual transition period I am proud about two things: nature and people. We have great nature, magnific, and we have great people. You won't experience the kind of hospitality, open hearted, honest and tolerant people like my nation is many places.

But don't believe me, read what others (westerners have said about it).

Another issues, Bucharest was (and maybe is) considered "Little Paris of the East" and Romania is the biggest country in Eastern Europe.

For more informations see this link. For pictures try this one.

BTW, doing a search on Google on "brutal Romania" resulted in 13,300 links and one on "kind romania" resulted 240,000 which I guess proves something.

P.S. I'm from Transylvania so please don't mess with us :)

February 14th, 2002


So, who is Remus?

Remus Pereni is a 32 years old free thinker, IT addict, who lives, works, and wonders about the meaning of life, relations, human nature, IT, technologies, clients, value and business from Satu Mare, Romania. More

Calendar

February 2002
M T W T F S S
« Jan   Mar »
 123
45678910
11121314151617
18192021222324
25262728  

Categories

Posts by Month

Feeds