[Skip Navigation] [CSUSB] / [CNS] / [Comp Sci & Eng Dept] / [R J Botting] /[Samples of MATHS] / [maths] / T
[Index] [Contents] [Source Text] [About] [Notation] [Copyright] [Search ]
Sat Oct 18 11:49:50 PDT 2008

Contents


    Technologies and Techniques of maths project


      (Team): Just me [ ../../index.html ] at this time. Long term goal recruit volunteers and students to (1) develop intro, math, logic pages. (2) develop the notation (notn pages), (3) develop more tools and improve current tools.


      (KISS): The technology used must not be bleeding edge. This includes both generated pages and the technology used to create them. [ Q.html#Q2 ]


      (locost): It should be free or at least, very cheap.
      (PHP): PHP is a well tested preprocessor that fits well into web servers. Runs on CSE.CSUSB web servers.


      (unix): Used standard Unix tools like sed, awk, grep etc. to prototype tools for translating MATHS to HTML. The next small step would be to execute mht2html from PHP. [ Q.html#Q7a ]


      (ed): This old Unix editor is stable and unbreakable. It fits [ Q.html#Q1 ] and [ Q.html#Q2 ] well. For example:


         : fix extra slashes injected by PHP
         if [ $# -ne 1 -o "x$1" = x ]
         then
         	echo $0: Wrong number of arguments
         	exit 2
         fi
         if [ -r $1 ]
         then
         ed - $1 <<ENDIT
         g/\\\\'/s//'/g
         g/\\\\"/s//"/g
         g/\\\\\\\\/s//\\\\/g
         w
         q
         ENDIT
         else
         	echo $0: file $1 not readable
         	exit 1
         fi


      (PHP+unix): PHP on our server will execute commands in one of four directories.
      But

      1. PHP has been set up to not execute arbitrary scripts and programs.
      2. And PHP and Unix shells will not accept absolute paths.
        But
        1. Talked to systems adminstrator and did some experiments to find the working directory and the PATH used when PHP system() executes:
             <?php
             echo("Test<br>");
             system("pwd");
             echo("<br>");
             system("set");
             echo("<br>");
             system("echo PATH=\$PATH", $retval);
             echo("<br>$retval<br>");
             echo("<br>");
             system("ls /bin");
             echo("<br>");
             system("cat /usr/local/www/data-dist/faculty/dick/bin/cookie", $retval);
             echo("<br>");
             echo("$retval");
             echo("<br>");
             system("sh /usr/local/www/data-dist/faculty/dick/bin/cookie", $retval);
             echo("<br>");
             echo("$retval");
             echo("<br>");
             system("/usr/local/www/data-dist/faculty/dick/bin/cookie", $retval);
             echo("<br>");
             echo("$retval");
             echo("<br>");
             ?>


        (Close But )

      (Close But )


      (HTML_forms): For posting data to PHP.
      (AJAX): Asynchronous JavaScript and XML. See KISS above.


      (LAMP): the CSE.CSUSB web servers user the Linux+Apache+Preprocessor stack. Does it have MySQL?


      (ruby): is available on lab machines... is it available on the web server?


      (Gen): generate pages on demand from MATHS to HTML, or store HTML prepared when MATHS changes. First choice will reduce disk space [ Q.html#Q8 ] by about 60% [ R.html ] but increase the CPU load [ Q.html#Q9 ] for each request. A classic Quality tradeoff.


      (limit offsite links): -- plausible but feasible. To protect against evil users allow automatic posting of items with offiste links limitted to a few safe sites -- example ACM DL, Wikipedia, ...
      But

        See [ R.html#Number of external links ] which makes this an implausible technique.

      (Close But )


      (convert unix2dos): Available on the lab machine and the login server. Used in mth2html to create ".txt" files from".mth" files. Reinvented using sed for Web server:

       		sed 's/$/^M/'
      Note -- you must actually type "^V^M" = [CTRL v][CTRL M] to insert the "\r" character at the end of the line.

End