<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<meta name="author" content="Ricardo Gamba" />
<script language="javascript" src="jquery.js"></script>
<title>Matrix Console</title>
<script language="javascript">
function send_cmd(){
document.getElementById("console").innerHTML="Procesando...";
$.ajax({
type: "post",
url: "cmd.php",
data: {
'cmd': document.getElementById("txt_cmd").value
},
cache: false,
success: function(res){
document.getElementById("console").value=res;
}
});
}
function example_code(){
var codigo="// Indice de comandos\n"
codigo+="help;\n";
codigo+="// Matrix creation\n";
codigo+="$a = mat.create('[1 4 2;6 5 9;4 1 7]');\n";
codigo+="$b = mat.create('[12 3 78;8 5 45;0 9 45]');\n\n";
codigo+="// Basic operations\n";
codigo+="$suma = mat.sum($a,2);\n";
codigo+="mat.sum($a,$b);\n";
codigo+="mat.dmult($b,0.5);\n";
codigo+="mat.mult($a,$b);\n\n";
codigo+="// Functions\n";
codigo+="print 'Determinant of a:' . mat.det($a);\n\n";
codigo+="// See help for more functions...\n";
document.getElementById("txt_cmd").value=codigo;
}
</script>
<style>
body{
font-family: arial, tahoma, sans-serif;
background: #e6e6e6;
font-size: 12px;
}
</style>
</head>
<body>
<div>
<h3>Matrix Console</h1>
<div><b>Instructions:</b> type the command sequence on the left box (PHP) and click the 'Execute' button. For help, type <i>help;</i></div><br />
<table style="width: 100%; table-layout: fixed">
<tr>
<td>
<div>Command line:</div>
<div><textarea id="txt_cmd" name="cmd" style="width: 100%; height: 500px;background: #000; color: green"></textarea></div>
<div style="float: left"><input type="button" onclick="send_cmd()" value="Execute" /></div>
<div style="float: right"><input type="button" onclick="example_code()" value="Example code" />
</div>
</td>
<td style="width: 10px"></td>
<td style="vertical-align: top">
<div>Result:</div>
<div><textarea id="console" style="width: 100%; height: 500px;" readonly></textarea></div>
</div>
</td>
</tr>
</table>
</body>
</html>
|