Skip to content

Commit 6fb3221

Browse files
committed
update
1 parent af34ba3 commit 6fb3221

2 files changed

Lines changed: 136 additions & 18 deletions

File tree

‎v3/matrix.html‎

Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2+
<html xmlns="http://www.w3.org/1999/xhtml">
3+
4+
<!--
5+
6+
Online Python Tutor
7+
https://github.com/pgbovine/OnlinePythonTutor/
8+
9+
Copyright (C) 2010-2013 Philip J. Guo (philip@pgbovine.net)
10+
11+
Permission is hereby granted, free of charge, to any person obtaining a
12+
copy of this software and associated documentation files (the
13+
"Software"), to deal in the Software without restriction, including
14+
without limitation the rights to use, copy, modify, merge, publish,
15+
distribute, sublicense, and/or sell copies of the Software, and to
16+
permit persons to whom the Software is furnished to do so, subject to
17+
the following conditions:
18+
19+
The above copyright notice and this permission notice shall be included
20+
in all copies or substantial portions of the Software.
21+
22+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
23+
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
25+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
26+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
27+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
28+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29+
30+
-->
31+
32+
<head>
33+
<title>Coding The Matrix - Python Lab</title>
34+
35+
<meta http-equiv="Content-type" content="text/html; charset=UTF-8"/>
36+
37+
<!-- requirements for pytutor.js -->
38+
<script type="text/javascript" src="js/d3.v2.min.js"></script>
39+
<script type="text/javascript" src="js/jquery-1.8.2.min.js"></script>
40+
<script type="text/javascript" src="js/jquery.ba-bbq.min.js"></script> <!-- for handling back button and URL hashes -->
41+
<script type="text/javascript" src="js/jquery.jsPlumb-1.3.10-all-min.js "></script> <!-- for rendering SVG connectors
42+
DO NOT UPGRADE ABOVE 1.3.10 OR ELSE BREAKAGE WILL OCCUR -->
43+
<script type="text/javascript" src="js/jquery-ui-1.8.24.custom.min.js"></script> <!-- for sliders and other UI elements -->
44+
<link type="text/css" href="css/ui-lightness/jquery-ui-1.8.24.custom.css" rel="stylesheet" />
45+
46+
<!-- for annotation bubbles -->
47+
<script type="text/javascript" src="js/jquery.qtip.min.js"></script>
48+
<link type="text/css" href="css/jquery.qtip.css" rel="stylesheet" />
49+
50+
<script type="text/javascript" src="js/pytutor.js"></script>
51+
<link rel="stylesheet" href="css/pytutor.css"/>
52+
<link rel="stylesheet" href="css/matrixtutor.css"/> <!-- include AFTER pytutor.css -->
53+
54+
55+
<!-- requirements for opt-frontend.js -->
56+
57+
<!-- codemirror.net online code editor -->
58+
<script type="text/javascript" src="js/codemirror/codemirror.js"></script>
59+
<link type="text/css" href="css/codemirror.css" rel="stylesheet" />
60+
<script type="text/javascript" src="js/codemirror/python.js"></script>
61+
62+
<script type="text/javascript" src="js/opt-frontend-common.js"></script>
63+
<script type="text/javascript" src="js/matrixtutor.js"></script>
64+
<link rel="stylesheet" href="css/opt-frontend.css"/>
65+
66+
</head>
67+
68+
<body>
69+
70+
<div id="pyInputPane">
71+
72+
<h1 style="margin-bottom: 25px; font-size: 16pt;">List Comprehension Incrementer</h1>
73+
74+
Write your solution code here (will be submitted for grading):
75+
<br/>
76+
<div id="codeInputPane"></div> <!-- populate with a CodeMirror instance -->
77+
78+
<br/><br/>
79+
Write your test code here (will <b>not</b> be submitted for grading):
80+
<div id="testInputPane"></div> <!-- populate with a CodeMirror instance -->
81+
82+
<p>
83+
<button id="executeBtn" class="bigBtn" type="button">Run and Visualize Code</button>
84+
</p>
85+
86+
</div>
87+
88+
89+
<div id="pyOutputPane">
90+
</div>
91+
92+
<div id="gradingPane">
93+
94+
95+
<h1 style="margin-bottom: 15px; font-size: 14pt;">List Comprehension Incrementer</h1>
96+
97+
<p>
98+
<button id="submitGradeBtn" class="bigBtn" type="button">Submit for Grading</button>
99+
</p>
100+
101+
<p>
102+
Grader output:<br/>
103+
<textarea id="gradeStdout" cols="80" rows="8" wrap="off" readonly></textarea>
104+
</p>
105+
106+
<p>
107+
Grader errors:<br/>
108+
<textarea id="gradeStderr" cols="80" rows="4" wrap="off" readonly></textarea>
109+
</p>
110+
111+
</div>
112+
113+
<div id="footer">
114+
115+
This version of <a href="http://pythontutor.com/">Online Python Tutor</a> supports
116+
<a href="http://www.python.org/doc/3.3.0/">Python 3.3</a> with limited module
117+
imports and no file I/O.</p>
118+
119+
<p>Have a question? Maybe the <a
120+
href="https://github.com/pgbovine/OnlinePythonTutor/blob/master/v3/docs/user-FAQ.md">FAQ</a>
121+
or other <a
122+
href="https://github.com/pgbovine/OnlinePythonTutor/blob/master/v3/docs/">documentation</a>
123+
can help. Or check out its code at <a
124+
href="https://github.com/pgbovine/OnlinePythonTutor/">GitHub</a>.</p>
125+
126+
<p style="margin-top: 8px;">
127+
Copyright &copy; 2010-2013 <a href="http://www.pgbovine.net/">Philip Guo</a>. All rights reserved.
128+
</p>
129+
130+
</div>
131+
132+
</body>
133+
</html>
134+

‎v3/submit_matrix_problem.py‎

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9,26 +9,10 @@
99
form = cgi.FieldStorage()
1010
user_code = form['submitted_code'].value
1111
prob_name = form['problem_name'].value
12-
#assert type(prob_name) is str
13-
14-
# whitelist
15-
assert prob_name in ('python_comprehension-1',)
16-
17-
test_fn = 'matrix-demo/' + prob_name + '.test.py'
18-
test_cod = open(test_fn).read()
19-
20-
# concatenate!
21-
script = test_cod + '\n' + user_code + \
22-
'''
23-
import doctest
24-
(n_fail, n_tests) = doctest.testmod(verbose=False)
25-
if n_fail == 0:
26-
print("All %d tests passed!" % n_tests)
27-
'''
2812

2913
# run on the EC2 sandbox
30-
url = 'http://ec2-107-20-94-197.compute-1.amazonaws.com/cgi-bin/run_code.py'
31-
values = {'user_script' : script}
14+
url = 'http://ec2-107-20-94-197.compute-1.amazonaws.com/cgi-bin/test_matrix_code.py'
15+
values = {'user_script' : script, 'problem_name': prob_name}
3216

3317
data = urllib.urlencode(values)
3418
req = urllib2.Request(url, data)

0 commit comments

Comments
 (0)