WikiOctave Installation

From Projects

Revision as of 01:06, 14 March 2008 by 24.58.236.7 (Talk)
(diff) ←Older revision | Current revision (diff) | Newer revision→ (diff)
Jump to: navigation, search

Contents

  1. WikiOctave
  2. VERSION:
  3. TESTED ON
  4. INSTALLATION
  5. Code

[edit] 1 WikiOctave

  • Allow execution of Octave from MediaWiki. Note that for security reasons, you should edit wikioctave.cgi to restrict execution from a list of hostnames and IP's.
  • Author: Brian Curtis (bcurtis3@gmu.edu) and Bob Weigel (rweigel@gmu.edu)

[edit] 2 VERSION:

  • 0.1.0.0 - 07/05/2007
  • 0.1.1.0 - 08/06/2007 -included minor file changes for compatibility with 2.9.9
  • 0.1.2.0 - 08/15/2007 -edited code for file structure to work universally (was my personal file structure)
  • 0.1.2.1 - 08/28/2007 -edited the octave command to include '-q' which removes unnecessary information from the output
  • 0.5.0.0 - 11/09/2007 -edited to allow restrictions by IP address and fixed a bug that caused the '+' to be read incorrectly.

[edit] 3 TESTED ON

  • MediaWiki >1.10.0
  • Octave 2.9.9 & >2.9.12
  • PHP 5.2.3

[edit] 4 INSTALLATION

  1. Download the file WikiOctave-0.5.0.0.tar.gz.
  2. copy wikioctave.cgi to the cgi-bin folder on your web server
  3. chmod 755 wikioctave.cgi
  4. Edit the $temp variable in the wikioctave.cgi as well as change the allowed hosts and allowed IP addresses
  5. Install the "AddHTML" extensions to MediaWiki which can be found with instructions at http://bluecortex.com/index.php?title=Bluecortex:AddHtml.
  6. Create an Octave page in MediaWiki
  7. Log On to MediaWiki as WikiSysop and protect Octave page
  8. Copy and paste text in file "code.txt" (or section Code below) to the Octave wiki page

[edit] 5 Code

<addhtml>
<html>
<head>
<title>Simple Ajax Example</title>
<script language="Javascript">
function xmlhttpPost(strURL) {
    var xmlHttpReq = false;
    var self = this;
    // Mozilla/Safari
    if (window.XMLHttpRequest) {
        self.xmlHttpReq = new XMLHttpRequest();
    }
    // IE
    else if (window.ActiveXObject) {
        self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
    }
    self.xmlHttpReq.open('POST', strURL, true);
    self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    self.xmlHttpReq.onreadystatechange = function() {
        if (self.xmlHttpReq.readyState == 4) {
            updatepage(self.xmlHttpReq.responseText);
        }
    }
    self.xmlHttpReq.send(getquerystring());
} 

function getquerystring() {
    var form     = document.forms['f1'];
    var word = form.word.value;
    qstr = 'w=' + escape(word);  // NOTE: no '?' before querystring
    return qstr;
}

function updatepage(str){
    document.getElementById("result").innerHTML = str;
}
</script>
</head>
<body>
<form name="f1">
  <textarea name="word" rows="6" cols="74">
sombrero(32)
</textarea> 
  <input value="Go" type="button" onclick='JavaScript:xmlhttpPost("/cgi-bin/wikioctave.cgi")'></p>
  <div id="result"></div>
</form>
</body>
</html>
</addhtml>
 
Personal tools