Commit 8d0abcb9 by Jay Zoldak

Merge branch 'feature/cale/cms-master' into feature/jzoldak/common-jasmine-tests

parents ea4c0ed8 0fff578e
...@@ -9,8 +9,6 @@ ...@@ -9,8 +9,6 @@
.AppleDouble .AppleDouble
database.sqlite database.sqlite
courseware/static/js/mathjax/* courseware/static/js/mathjax/*
db.newaskbot
db.oldaskbot
flushdb.sh flushdb.sh
build build
.coverage .coverage
......
syntax: glob
*.pyc
*~
*.scssc
*.swp
*.orig
*.DS_Store
database.sqlite
courseware/static/js/mathjax/*
db.newaskbot
db.oldaskbot
flushdb.sh
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
{{uploadDate}} {{uploadDate}}
</td> </td>
<td class="embed-col"> <td class="embed-col">
<input type="text" class="embeddable-xml-input" value='<img src="{{url}}"/>'> <input type="text" class="embeddable-xml-input" value='{{url}}'>
</td> </td>
</tr> </tr>
</script> </script>
...@@ -47,7 +47,7 @@ ...@@ -47,7 +47,7 @@
<th class="thumb-col"></th> <th class="thumb-col"></th>
<th class="name-col">Name</th> <th class="name-col">Name</th>
<th class="date-col">Date Added</th> <th class="date-col">Date Added</th>
<th class="embed-col">Embed</th> <th class="embed-col">URL</th>
</tr> </tr>
</thead> </thead>
<tbody id="asset_table_body"> <tbody id="asset_table_body">
...@@ -68,7 +68,7 @@ ...@@ -68,7 +68,7 @@
${asset['uploadDate']} ${asset['uploadDate']}
</td> </td>
<td class="embed-col"> <td class="embed-col">
<input type="text" class="embeddable-xml-input" value='<img src="${asset['url']}"/>'> <input type="text" class="embeddable-xml-input" value='${asset['url']}'>
</td> </td>
</tr> </tr>
% endfor % endfor
......
...@@ -3,6 +3,8 @@ Models for Student Information ...@@ -3,6 +3,8 @@ Models for Student Information
Replication Notes Replication Notes
TODO: Update this to be consistent with reality (no portal servers, no more askbot)
In our live deployment, we intend to run in a scenario where there is a pool of In our live deployment, we intend to run in a scenario where there is a pool of
Portal servers that hold the canoncial user information and that user Portal servers that hold the canoncial user information and that user
information is replicated to slave Course server pools. Each Course has a set of information is replicated to slave Course server pools. Each Course has a set of
......
...@@ -98,6 +98,19 @@ def course_from_id(course_id): ...@@ -98,6 +98,19 @@ def course_from_id(course_id):
course_loc = CourseDescriptor.id_to_location(course_id) course_loc = CourseDescriptor.id_to_location(course_id)
return modulestore().get_instance(course_id, course_loc) return modulestore().get_instance(course_id, course_loc)
import re
day_pattern = re.compile('\s\d+,\s')
multimonth_pattern = re.compile('\s?\-\s?\S+\s')
def get_date_for_press(publish_date):
import datetime
# strip off extra months, and just use the first:
date = re.sub(multimonth_pattern, ", ", publish_date)
if re.search(day_pattern, date):
date = datetime.datetime.strptime(date, "%B %d, %Y")
else:
date = datetime.datetime.strptime(date, "%B, %Y")
return date
def press(request): def press(request):
json_articles = cache.get("student_press_json_articles") json_articles = cache.get("student_press_json_articles")
...@@ -110,6 +123,7 @@ def press(request): ...@@ -110,6 +123,7 @@ def press(request):
json_articles = json.loads(content) json_articles = json.loads(content)
cache.set("student_press_json_articles", json_articles) cache.set("student_press_json_articles", json_articles)
articles = [Article(**article) for article in json_articles] articles = [Article(**article) for article in json_articles]
articles.sort(key=lambda item: get_date_for_press(item.publish_date), reverse=True)
return render_to_response('static_templates/press.html', {'articles': articles}) return render_to_response('static_templates/press.html', {'articles': articles})
......
...@@ -378,7 +378,7 @@ class XModuleDescriptor(Plugin, HTMLSnippet, ResourceTemplates): ...@@ -378,7 +378,7 @@ class XModuleDescriptor(Plugin, HTMLSnippet, ResourceTemplates):
entry_point = "xmodule.v1" entry_point = "xmodule.v1"
module_class = XModule module_class = XModule
# Attributes for inpsection of the descriptor # Attributes for inspection of the descriptor
stores_state = False # Indicates whether the xmodule state should be stores_state = False # Indicates whether the xmodule state should be
# stored in a database (independent of shared state) # stored in a database (independent of shared state)
has_score = False # This indicates whether the xmodule is a problem-type. has_score = False # This indicates whether the xmodule is a problem-type.
......
<problem display_name="S3E2: Lorentz Force">
<startouttext/>
<p>Consider a hypothetical magnetic field pointing out of your computer screen. Now imagine an electron traveling from right to leftin the plane of your screen. A diagram of this situation is show below.</p>
<center><img width="400" src="/static/images/LSQimages/LSQ_W01_8.png"/></center>
<p>a. The magnitude of the force experienced by the electron is proportional the product of which of the following? (Select all that apply.)</p>
<endouttext/>
<choiceresponse>
<checkboxgroup>
<choice correct="true"><text>Magnetic field strength</text></choice>
<choice correct="false"><text>Electric field strength</text></choice>
<choice correct="true"><text>Electric charge of the electron</text></choice>
<choice correct="false"><text>Radius of the electron</text></choice>
<choice correct="false"><text>Mass of the electron</text></choice>
<choice correct="true"><text>Velocity of the electron</text></choice>
</checkboxgroup>
</choiceresponse>
<startouttext/>
<p>b. The direction of the force experienced by the electron is _______.</p>
<endouttext/>
<choiceresponse>
<checkboxgroup>
<choice correct="false"><text>up, in the plane of the screen.</text></choice>
<choice correct="true"><text>down, in the plane of the screen.</text></choice>
<choice correct="false"><text>into the plane of the screen.</text></choice>
<choice correct="false"><text>out of the plane of the screen.</text></choice>
<choice correct="false"><text>towards the right, in the plane of the screen.</text></choice>
<choice correct="false"><text>towards the left, in the plane of the screen.</text></choice>
</checkboxgroup>
</choiceresponse>
</problem>
<?xml version="1.0"?>
<problem display_name="L4 Problem 1">
<text>
<p>
<b class="bfseries">Part 1: Function Types</b>
</p>
<p>
For each of the following functions, specify the type of its <b class="bfseries">output</b>. You can assume each function is called with an appropriate argument, as specified by its docstring. </p>
<p>
If the output can be either an int or a float, select num, which isn't a real Python type, but which we'll use to indicate that either basic numeric type is legal. </p>
<p>
In fact, in Python, booleans True and False can be operated on as if they were the integers 1 and 0; but it is ugly and confusing to take advantage of this fact, and we will resolutely pretend that it isn't true. </p> <!-- so why even mention it? -->
<p>
<section class="hints">
<div class="collapsible">
<header>
<a href="#" id="id41">What are those lines under the function definitions?</a>
</header>
<section id="id41">
<p>
In this and future problems, you'll see function definitions that look like this: </p>
<pre>
def a(x):
'''
x: int or float.
'''
return x + 1
</pre>
<p>
What are those three lines between <code>def a(x):</code> and <code>return x + 1</code>? These lines are called the <i class="it">docstring</i> of the function. A docstring is a special type of comment that is used to document what your function is doing. Typically, docstrings will explain what the function expects the type(s) of the argument(s) to be, and what the function is returning. </p>
<p>
In Python, docstrings appear immediately after the <code>def</code> line of a function, before the body. Docstrings start and end with triple quotes - this can be triple single quotes or triple double quotes, it doesn't matter as long as they match. To sum up this general form: </p>
<pre>
def myFunction(argument):
"""
Docstring goes here. Explain what type argument(s) should have, and what your function
is going to return.
"""
&lt; Code for your function (the body of the function) goes here &gt;
</pre>
<p>
As you begin coding your own functions, we strongly encourage you to document all your functions by using properly-formatted docstrings! </p>
</section>
</div>
</section>
</p>
<ol class="enumerate">
<li>
<pre>
def a(x):
'''
x: int or float.
'''
return x + 1
</pre>
<p>
Indicate the type of the output that the function <code>a</code> will yield. <optionresponse><optioninput options="('NoneType','num','int','float','boolean')" correct="num"/></optionresponse> </p>
</li>
<li>
<pre>
def b(x):
'''
x: int or float.
'''
return x + 1.0
</pre>
<p>
Indicate the type of the output that the function <code>b</code> will yield. <optionresponse><optioninput options="('NoneType','num','int','float','boolean')" correct="float"/></optionresponse> </p>
</li>
<li>
<pre>
def c(x, y):
'''
x: int or float.
y: int or float.
'''
return x + y
</pre>
<p>
Indicate the type of the output that the function <code>c</code> will yield. <optionresponse><optioninput options="('NoneType','num','int','float','boolean')" correct="num"/></optionresponse> </p>
</li>
<li>
<pre>
def d(x, y):
'''
x: Can be of any type.
y: Can be of any type.
'''
return x &gt; y
</pre>
<p>
Indicate the type of the output that the function <code>d</code> will yield. <optionresponse><optioninput options="('NoneType','num','int','float','boolean')" correct="boolean"/></optionresponse> </p>
</li>
<li>
<pre>
def e(x, y, z):
'''
x: Can be of any type.
y: Can be of any type.
z: Can be of any type.
'''
return x &gt;= y and x &lt;= z
</pre>
<p>
Indicate the type of the output that the function <code>e</code> will yield. <optionresponse><optioninput options="('NoneType','num','int','float','boolean')" correct="boolean"/></optionresponse> </p>
</li>
<li>
<pre>
def f(x, y):
'''
x: int or float.
y: int or float
'''
x + y - 2
</pre>
<p>
Indicate the type of the output that the function <code>f</code> will yield. <optionresponse><optioninput options="('NoneType','num','int','float','boolean')" correct="NoneType"/></optionresponse> </p>
</li>
</ol>
<p>
<b class="bfseries">Part 2: Transcript</b>
</p>
<p>
Below is a transcript of a session with the Python shell. Assume the functions from Part 1 (above) have been defined. Provide the type and value of the expressions being evaluated. If evaluating an expression would cause an error, select NoneType and write 'error' in the box. If the value of an expression is a function, select function as the type and write 'function' in the box. </p>
<ol class="enumerate">
<li>
<p>
<code>a(6)</code>
<optionresponse>
<optioninput options="('NoneType','num','int','float','boolean','function')" correct="int"/>
</optionresponse>
<stringresponse answer="7">
<textline size="50"/>
</stringresponse>
</p>
</li>
<li>
<p>
<code>a(-5.3)</code>
<optionresponse>
<optioninput options="('NoneType','num','int','float','boolean','function')" correct="float"/>
</optionresponse>
<stringresponse answer="-4.3">
<textline size="50"/>
</stringresponse>
</p>
</li>
<li>
<p>
<code>a(a(a(6)))</code>
<optionresponse>
<optioninput options="('NoneType','num','int','float','boolean','function')" correct="int"/>
</optionresponse>
<stringresponse answer="9">
<textline size="50"/>
</stringresponse>
</p>
</li>
<li>
<p>
<code>c(a(1), b(1))</code>
<optionresponse>
<optioninput options="('NoneType','num','int','float','boolean','function')" correct="float"/>
</optionresponse>
<stringresponse answer="4.0">
<textline size="50"/>
</stringresponse>
</p>
</li>
<li>
<p>
<code>d('apple', 11.1)</code>
<optionresponse>
<optioninput options="('NoneType','num','int','float','boolean','function')" correct="boolean"/>
</optionresponse>
<stringresponse answer="True">
<textline size="50"/>
</stringresponse>
</p>
</li>
<li>
<p>
<code>e(a(3), b(4), c(3, 4))</code>
<optionresponse>
<optioninput options="('NoneType','num','int','float','boolean','function')" correct="boolean"/>
</optionresponse>
<stringresponse answer="False">
<textline size="50"/>
</stringresponse>
</p>
</li>
<li>
<p>
<code>f</code>
<optionresponse>
<optioninput options="('NoneType','num','int','float','boolean','function')" correct="function"/>
</optionresponse>
<stringresponse answer="function">
<textline size="50"/>
</stringresponse>
</p>
</li>
</ol>
</text>
</problem>
<problem display_name="S3E3: Deflection of a Proton">
<startouttext/>
<p>Suppose you were to pass a hydroge ion (H+) through an electric field and measure the deflection of the ion. How would its deflection compare to the deflection of an electron passed through the same electric field? </p>
<endouttext/>
<multiplechoiceresponse direction="vertical" randomize="yes">
<choicegroup type="MultipleChoice">
<choice location="random" correct="false" name="1"><text>The ion would deflect identically as both species have the same charge.</text></choice>
<choice location="random" correct="false" name="2"><text>The ion would deflect by an amount identical in magnitude but opposite in direction because the charges are of opposite sign but equal in magnitude.</text></choice>
<choice location="random" correct="false" name="3"><text>The deflection will be in the same direction but smaller in magnitude due to the larger mass of the ion.</text></choice>
<choice location="random" correct="true" name="4"><text>The deflection will be smaller in magnitude due to the increased mass of the ion, as well as in the opposite direction due to the opposite sign of the charge.</text></choice>
</choicegroup>
</multiplechoiceresponse>
</problem>
\ No newline at end of file
<problem display_name="S2E2: Hydrogen Combustion">
<text>
<p>Gaseous hydrogen can be reacted with gaseous oxygen in the presence of a flame to produce water vapor according to the following reaction:</p>
[mathjax] \text{ a } \text{H}_{2 } + \text{ b }\text{O}_{2 } = \text{ c }\text{H}_{2 }\text{O }[/mathjax]
<p>Balance the equation i.e., specify the values of <i> a, b, </i> and <i>c</i>. Use the lowest whole number coefficients.</p>
<p>a =</p>
<numericalresponse answer="2">
<responseparam type="tolerance" default="1%" name="tol" description="Numerical Tolerance" />
<textline correct_answer="2" math="1" />
</numericalresponse>
<p>b =
<numericalresponse answer="1">
<responseparam type="tolerance" default="1%" name="tol" description="Numerical Tolerance" />
<textline math="1" />
</numericalresponse> </p>
<p>c =
<numericalresponse answer="2">
<responseparam type="tolerance" default="1%" name="tol" description="Numerical Tolerance" />
<textline math="1" />
</numericalresponse> </p>
</text>
</problem>
<problem>
<text>
<p>Metallothermic production of zirconium (Zr) would involve the reaction of sodium (Na) with zirconium tetrachloride (ZrCl<sub>4</sub>).</p>
<p><b>(a)</b> Write a balanced chemical equation.</p>
<!-- chemformularesponse
[mathjax] \text{a ZrCl}_{4 } + \text{ b }\text{Na} -> \text{ c }\text{NaCl } + \text{ d } \text{Zr} [/mathjax]
ratio of (a, b, c, d) = (1, 4, 4, 1)
-->
<customresponse>
<chemicalequationinput size="50"/>
<answer type="loncapa/python">
if chemcalc.chemical_equations_equal(submission[0], 'ZrCl4 + 4 Na -&gt; 4 NaCl + Zr'):
correct = ['correct']
else:
correct = ['incorrect']
</answer>
</customresponse>
<p><b>(b)</b> Write the balanced chemical equation using lowest whole numbers.</p>
<!-- chemformularesponse
as above, with (a, b, c, d) = (1, 4, 4, 1)
-->
<customresponse>
<chemicalequationinput size="50"/>
<answer type="loncapa/python">
if chemcalc.chemical_equations_equal(submission[0], 'ZrCl4 + 4 Na -&gt; 4 NaCl + Zr', exact=True):
correct = ['correct']
else:
correct = ['incorrect']
</answer>
</customresponse>
<p><b>(c)</b> Calculate the amount of zirconium produced (in kg) if a reactor were charged with 111 kg [mathjaxinline]\text{ZrCl}_4[/mathjaxinline] and 11.1 kg [mathjaxinline]\text{Na}[/mathjaxinline].
<numericalresponse answer="11.0">
<responseparam type="tolerance" default="5%" name="tol" description="Numerical Tolerance" />
<textline math="1" />
</numericalresponse> </p>
<br/>
<solution>
<p><b>SOLUTION:</b></p>
<p><b>(b)</b>[mathjax] \text{ZrCl}_{4 } + \mathbf{4 }\text{Na} = \mathbf{4 }\text{NaCl } + \mathbf{1 } \text{Zr} [/mathjax] </p>
<p><b>(c)</b></p>
<p>[mathjaxinline]111\text{kg ZrCl}_4 = 111000/[91.22 + (4 \times 35.45)] = 476 \text{ moles ZrCl}_4[/mathjaxinline] </p>
<p>[mathjaxinline]11.1\text{ kg Na} = 11100/22.99 = 483\text{ moles C}[/mathjaxinline]</p>
<p>stoichiometry of reaction further dictates that on a molar basis there needs to be 4 x amount of [mathjaxinline]\text{Na}[/mathjaxinline] as there is [mathjaxinline]\text{ZrCl}_4[/mathjaxinline], but calculations show there to be a shortfall of [mathjaxinline]\text{Na}[/mathjaxinline] </p>
<p>[mathjaxinline]\therefore[/mathjaxinline] reaction yield is contrained by [mathjaxinline]\text{Na}[/mathjaxinline] present </p>
<p>stoichiometry of reaction further dictates that if [mathjaxinline]\text{Na}[/mathjaxinline] controls the yield, then the amount of [mathjaxinline]\text{Zr}[/mathjaxinline] produced = 1/4 x molar quantity of [mathjaxinline]\text{Na}[/mathjaxinline] = 1/4 x 483 moles = 121 </p>
[mathjaxinline]121 \text{ moles Zr} \times 91.22\text{ g / mol } \mathbf{= 11.0 \text{ kg Zr} }[/mathjaxinline]<br/>
</solution>
</text>
</problem>
<problem>
<choiceresponse>
<checkboxgroup>
<choice correct="false">
<startouttext />This is foil One.<endouttext />
</choice>
<choice correct="false">
<startouttext />This is foil Two.<endouttext />
</choice>
<choice correct="true">
<startouttext />This is foil Three.<endouttext />
</choice>
<choice correct="false">
<startouttext />This is foil Four.<endouttext />
</choice>
<choice correct="false">
<startouttext />This is foil Five.<endouttext />
</choice>
</checkboxgroup>
</choiceresponse>
<choiceresponse>
<checkboxgroup>
<choice correct="false">
<startouttext />This is foil One.<endouttext />
</choice>
<choice correct="false">
<startouttext />This is foil Two.<endouttext />
</choice>
<choice correct="true">
<startouttext />This is foil Three.<endouttext />
</choice>
<choice correct="true">
<startouttext />This is foil Four.<endouttext />
</choice>
<choice correct="false">
<startouttext />This is foil Five.<endouttext />
</choice>
</checkboxgroup>
</choiceresponse>
<choiceresponse>
<checkboxgroup>
<choice correct="false">
<startouttext />This is foil One.<endouttext />
</choice>
<choice correct="false">
<startouttext />This is foil Two.<endouttext />
</choice>
<choice correct="true">
<startouttext />This is foil Three.<endouttext />
</choice>
<choice correct="true">
<startouttext />This is foil Four.<endouttext />
</choice>
<choice correct="false">
<startouttext />This is foil Five.<endouttext />
</choice>
</checkboxgroup>
</choiceresponse>
</problem>
<problem>
<choiceresponse>
<radiogroup>
<choice correct="false">
<startouttext />This is foil One.<endouttext />
</choice>
<choice correct="false">
<startouttext />This is foil Two.<endouttext />
</choice>
<choice correct="true">
<startouttext />This is foil Three.<endouttext />
</choice>
<choice correct="false">
<startouttext />This is foil Four.<endouttext />
</choice>
<choice correct="false">
<startouttext />This is foil Five.<endouttext />
</choice>
</radiogroup>
</choiceresponse>
<choiceresponse>
<radiogroup>
<choice correct="false">
<startouttext />This is foil One.<endouttext />
</choice>
<choice correct="false">
<startouttext />This is foil Two.<endouttext />
</choice>
<choice correct="true">
<startouttext />This is foil Three.<endouttext />
</choice>
<choice correct="true">
<startouttext />This is foil Four.<endouttext />
</choice>
<choice correct="false">
<startouttext />This is foil Five.<endouttext />
</choice>
</radiogroup>
</choiceresponse>
</problem>
<problem>
<text>
<h2>Code response</h2>
<p>
</p>
<text>
Write a program to compute the square of a number
<coderesponse tests="repeat:2,generate">
<textbox rows="10" cols="70" mode="python"/>
<codeparam>
<initial_display>def square(x):</initial_display>
<answer_display>answer</answer_display>
<grader_payload>grader stuff</grader_payload>
</codeparam>
</coderesponse>
</text>
<text>
Write a program to compute the square of a number
<coderesponse tests="repeat:2,generate">
<textbox rows="10" cols="70" mode="python"/>
<codeparam>
<initial_display>def square(x):</initial_display>
<answer_display>answer</answer_display>
<grader_payload>grader stuff</grader_payload>
</codeparam>
</coderesponse>
</text>
</text>
</problem>
<problem>
<text>
<h2>Code response</h2>
<p>
</p>
<text>
Write a program to compute the square of a number
<coderesponse tests="repeat:2,generate">
<textbox rows="10" cols="70" mode="python"/>
<answer><![CDATA[
initial_display = """
def square(n):
"""
answer = """
def square(n):
return n**2
"""
preamble = """
import sys, time
"""
test_program = """
import random
import operator
def testSquare(n = None):
if n is None:
n = random.randint(2, 20)
print 'Test is: square(%d)'%n
return str(square(n))
def main():
f = os.fdopen(3,'w')
test = int(sys.argv[1])
rndlist = map(int,os.getenv('rndlist').split(','))
random.seed(rndlist[0])
if test == 1: f.write(testSquare(0))
elif test == 2: f.write(testSquare(1))
else: f.write(testSquare())
f.close()
main()
sys.exit(0)
"""
]]>
</answer>
</coderesponse>
</text>
<text>
Write a program to compute the cube of a number
<coderesponse tests="repeat:2,generate">
<textbox rows="10" cols="70" mode="python"/>
<answer><![CDATA[
initial_display = """
def cube(n):
"""
answer = """
def cube(n):
return n**3
"""
preamble = """
import sys, time
"""
test_program = """
import random
import operator
def testCube(n = None):
if n is None:
n = random.randint(2, 20)
print 'Test is: cube(%d)'%n
return str(cube(n))
def main():
f = os.fdopen(3,'w')
test = int(sys.argv[1])
rndlist = map(int,os.getenv('rndlist').split(','))
random.seed(rndlist[0])
if test == 1: f.write(testCube(0))
elif test == 2: f.write(testCube(1))
else: f.write(testCube())
f.close()
main()
sys.exit(0)
"""
]]>
</answer>
</coderesponse>
</text>
</text>
</problem>
<problem>
<script type="loncapa/python">
# from loncapa import *
x1 = 4 # lc_random(2,4,1)
y1 = 5 # lc_random(3,7,1)
x2 = 10 # lc_random(x1+1,9,1)
y2 = 20 # lc_random(y1+1,15,1)
m = (y2-y1)/(x2-x1)
b = y1 - m*x1
answer = "%s*x+%s" % (m,b)
answer = answer.replace('+-','-')
inverted_m = (x2-x1)/(y2-y1)
inverted_b = b
wrongans = "%s*x+%s" % (inverted_m,inverted_b)
wrongans = wrongans.replace('+-','-')
</script>
<text>
<p>Hints can be provided to students, based on the last response given, as well as the history of responses given. Here is an example of a hint produced by a Formula Response problem.</p>
<p>
What is the equation of the line which passess through ($x1,$y1) and
($x2,$y2)?</p>
<p>The correct answer is <tt>$answer</tt>. A common error is to invert the equation for the slope. Enter <tt>
$wrongans</tt> to see a hint.</p>
</text>
<formularesponse samples="x@-5:5#11" id="11" answer="$answer">
<responseparam description="Numerical Tolerance" type="tolerance" default="0.001" name="tol" />
<text>y = <textline size="25" /></text>
<hintgroup>
<formulahint samples="x@-5:5#11" answer="$wrongans" name="inversegrad">
</formulahint>
<hintpart on="inversegrad">
<text>You have inverted the slope in the question.</text>
</hintpart>
</hintgroup>
</formularesponse>
</problem>
<problem>
<text><p>
Two skiers are on frictionless black diamond ski slopes.
Hello</p></text>
<imageresponse max="1" loncapaid="11">
<imageinput src="/static/Physics801/Figures/Skier-conservation of energy.jpg" width="560" height="388" rectangle="(490,11)-(556,98)"/>
<text>Click on the image where the top skier will stop momentarily if the top skier starts from rest.</text>
<imageinput src="/static/Physics801/Figures/Skier-conservation of energy.jpg" width="560" height="388" rectangle="(242,202)-(296,276)"/>
<text>Click on the image where the lower skier will stop momentarily if the lower skier starts from rest.</text>
<imageinput src="/static/Physics801/Figures/Skier-conservation of energy.jpg" width="560" height="388" rectangle="(490,11)-(556,98);(242,202)-(296,276)"/>
<text>Click on either of the two positions as discussed previously.</text>
<imageinput src="/static/Physics801/Figures/Skier-conservation of energy.jpg" width="560" height="388" rectangle="(490,11)-(556,98);(242,202)-(296,276)"/>
<text>Click on either of the two positions as discussed previously.</text>
<imageinput src="/static/Physics801/Figures/Skier-conservation of energy.jpg" width="560" height="388" rectangle="(490,11)-(556,98);(242,202)-(296,276)"/>
<text>Click on either of the two positions as discussed previously.</text>
<hintgroup showoncorrect="no">
<text><p>Use conservation of energy.</p></text>
</hintgroup>
</imageresponse>
</problem>
<problem>
<javascriptresponse>
<generator src="test_problem_generator.js"/>
<grader src="test_problem_grader.js"/>
<display class="TestProblemDisplay" src="test_problem_display.js"/>
<responseparam name="value" value="4"/>
<javascriptinput>
</javascriptinput>
</javascriptresponse>
</problem>
<problem>
<multiplechoiceresponse>
<choicegroup>
<choice correct="false" >
<startouttext />This is foil One.<endouttext />
</choice>
<choice correct="false" >
<startouttext />This is foil Two.<endouttext />
</choice>
<choice correct="true" >
<startouttext />This is foil Three.<endouttext />
</choice>
<choice correct="false">
<startouttext />This is foil Four.<endouttext />
</choice>
<choice correct="false">
<startouttext />This is foil Five.<endouttext />
</choice>
</choicegroup>
</multiplechoiceresponse>
</problem>
<problem>
<multiplechoiceresponse>
<choicegroup>
<choice correct="false" name="foil1">
<startouttext />This is foil One.<endouttext />
</choice>
<choice correct="false" name="foil2">
<startouttext />This is foil Two.<endouttext />
</choice>
<choice correct="true" name="foil3">
<startouttext />This is foil Three.<endouttext />
</choice>
<choice correct="false" name="foil4">
<startouttext />This is foil Four.<endouttext />
</choice>
<choice correct="false" name="foil5">
<startouttext />This is foil Five.<endouttext />
</choice>
</choicegroup>
</multiplechoiceresponse>
</problem>
<problem display_name="S3E3: Deflection of a Proton">
<startouttext/>
<p>Suppose you were to pass a hydroge ion (H+) through an electric field and measure the deflection of the ion. How would its deflection compare to the deflection of an electron passed through the same electric field? </p>
<endouttext/>
<multiplechoiceresponse direction="vertical" randomize="yes">
<choicegroup type="MultipleChoice">
<choice location="random" correct="false" name="1"><text>The ion would deflect identically as both species have the same charge.</text></choice>
<choice location="random" correct="false" name="2"><text>The ion would deflect by an amount identical in magnitude but opposite in direction because the charges are of opposite sign but equal in magnitude.</text></choice>
<choice location="random" correct="false" name="3"><text>The deflection will be in the same direction but smaller in magnitude due to the larger mass of the ion.</text></choice>
<choice location="random" correct="true" name="4"><text>The deflection will be smaller in magnitude due to the increased mass of the ion, as well as in the opposite direction due to the opposite sign of the charge.</text></choice>
</choicegroup>
</multiplechoiceresponse>
</problem>
\ No newline at end of file
<problem display_name="S2E2: Hydrogen Combustion">
<text>
<p>Gaseous hydrogen can be reacted with gaseous oxygen in the presence of a flame to produce water vapor according to the following reaction:</p>
[mathjax] \text{ a } \text{H}_{2 } + \text{ b }\text{O}_{2 } = \text{ c }\text{H}_{2 }\text{O }[/mathjax]
<p>Balance the equation i.e., specify the values of <i> a, b, </i> and <i>c</i>. Use the lowest whole number coefficients.</p>
<p>a =</p>
<numericalresponse answer="2">
<responseparam type="tolerance" default="1%" name="tol" description="Numerical Tolerance" />
<textline correct_answer="2" math="1" />
</numericalresponse>
<p>b =
<numericalresponse answer="1">
<responseparam type="tolerance" default="1%" name="tol" description="Numerical Tolerance" />
<textline math="1" />
</numericalresponse> </p>
<p>c =
<numericalresponse answer="2">
<responseparam type="tolerance" default="1%" name="tol" description="Numerical Tolerance" />
<textline math="1" />
</numericalresponse> </p>
</text>
</problem>
<problem>
<text>
<p>
Why do bicycles benefit from having larger wheels when going up a bump as shown in the picture? <br/>
Assume that for both bicycles:<br/>
1.) The tires have equal air pressure.<br/>
2.) The bicycles never leave the contact with the bump.<br/>
3.) The bicycles have the same mass. The bicycle tires (regardless of size) have the same mass.<br/>
</p>
</text>
<optionresponse texlayout="horizontal" max="10" randomize="yes">
<ul>
<li>
<text>
<p>The bicycles with larger wheels have more time to go over the bump. This decreases the magnitude of the force needed to lift the bicycle.</p>
</text>
<optioninput name="Foil1" location="random" options="('True','False')" correct="True">
</optioninput>
</li>
<li>
<text>
<p>The bicycles with larger wheels always have a smaller vertical displacement regardless of speed.</p>
</text>
<optioninput name="Foil2" location="random" options="('True','False')" correct="False">
</optioninput>
</li>
<li>
<text>
<p>The bicycles with larger wheels experience a force backward with less magnitude for the same amount of time.</p>
</text>
<optioninput name="Foil3" location="random" options="('True','False')" correct="False">
</optioninput>
</li>
<li>
<text>
<p>The bicycles with larger wheels experience a force backward with less magnitude for a greater amount of time.</p>
</text>
<optioninput name="Foil4" location="random" options="('True','False')" correct="True">
</optioninput>
</li>
<li>
<text>
<p>The bicycles with larger wheels have more kinetic energy turned into gravitational potential energy.</p>
</text>
<optioninput name="Foil5" location="random" options="('True','False')" correct="False">
</optioninput>
</li>
<li>
<text>
<p>The bicycles with larger wheels have more rotational kinetic energy, so the horizontal velocity of the biker changes less.</p>
</text>
<optioninput name="Foil6" location="random" options="('True','False')" correct="False">
</optioninput>
</li>
</ul>
<hintgroup showoncorrect="no">
<text>
<br/>
<br/>
</text>
</hintgroup>
</optionresponse>
</problem>
<problem >
<text><h2>Example: String Response Problem</h2>
<br/>
</text>
<text>Which US state has Lansing as its capital?</text>
<stringresponse answer="Michigan" type="ci">
<textline size="20" />
<hintgroup>
<stringhint answer="wisconsin" type="cs" name="wisc">
</stringhint>
<stringhint answer="minnesota" type="cs" name="minn">
</stringhint>
<hintpart on="wisc">
<text>The state capital of Wisconsin is Madison.</text>
</hintpart>
<hintpart on="minn">
<text>The state capital of Minnesota is St. Paul.</text>
</hintpart>
<hintpart on="default">
<text>The state you are looking for is also known as the 'Great Lakes State'</text>
</hintpart>
</hintgroup>
</stringresponse>
</problem>
<problem>
<text>
<h2>Example: Symbolic Math Response Problem</h2>
<p>
A symbolic math response problem presents one or more symbolic math
input fields for input. Correctness of input is evaluated based on
the symbolic properties of the expression entered. The student enters
text, but sees a proper symbolic rendition of the entered formula, in
real time, next to the input box.
</p>
<p>This is a correct answer which may be entered below: </p>
<p><tt>cos(theta)*[[1,0],[0,1]] + i*sin(theta)*[[0,1],[1,0]]</tt></p>
<script>
from symmath import *
</script>
<text>Compute [mathjax] U = \exp\left( i \theta \left[ \begin{matrix} 0 &amp; 1 \\ 1 &amp; 0 \end{matrix} \right] \right) [/mathjax]
and give the resulting \(2 \times 2\) matrix. <br/>
Your input should be typed in as a list of lists, eg <tt>[[1,2],[3,4]]</tt>. <br/>
[mathjax]U=[/mathjax] <symbolicresponse cfn="symmath_check" answer="[[cos(theta),I*sin(theta)],[I*sin(theta),cos(theta)]]" options="matrix,imaginaryi" id="filenamedogi0VpEBOWedxsymmathresponse_1" state="unsubmitted">
<textline size="80" math="1" response_id="2" answer_id="1" id="filenamedogi0VpEBOWedxsymmathresponse_2_1"/>
</symbolicresponse>
<br/>
</text>
</text>
</problem>
<problem>
<truefalseresponse max="10" randomize="yes">
<choicegroup>
<choice location="random" correct="true" name="foil1">
<startouttext />This is foil One.<endouttext />
</choice>
<choice location="random" correct="true" name="foil2">
<startouttext />This is foil Two.<endouttext />
</choice>
<choice location="random" correct="false" name="foil3">
<startouttext />This is foil Three.<endouttext />
</choice>
<choice location="random" correct="false" name="foil4">
<startouttext />This is foil Four.<endouttext />
</choice>
<choice location="random" correct="false" name="foil5">
<startouttext />This is foil Five.<endouttext />
</choice>
</choicegroup>
</truefalseresponse>
</problem>
<vertical display_name="Test problems">
<problem url_name="test_files:numericalresponse_demo"/>
<problem url_name="test_files:choiceresponse_checkbox"/>
<problem url_name="test_files:choiceresponse_radio"/>
<problem url_name="test_files:coderesponse"/>
<problem url_name="test_files:coderesponse_externalresponseformat"/>
<problem url_name="test_files:formularesponse_with_hint"/>
<problem url_name="test_files:imageresponse"/>
<problem url_name="test_files:javascriptresponse"/>
<problem url_name="test_files:multi_bare"/>
<problem url_name="test_files:multichoice"/>
<problem url_name="test_files:multiplechoicelresponse_demo"/>
<problem url_name="test_files:numericalresponse_demo"/>
<problem url_name="test_files:optionresponse"/>
<problem url_name="test_files:stringresponse_with_hint"/>
<problem url_name="test_files:symbolicresponse"/>
<problem url_name="test_files:truefalse"/>
<problem url_name="test_files:chemicalequationresponse"/>
<problem url_name="test_files:filesubmission"/>
</vertical>
\ No newline at end of file
...@@ -72,12 +72,6 @@ clone_repos() { ...@@ -72,12 +72,6 @@ clone_repos() {
git clone git@github.com:MITx/mitx.git git clone git@github.com:MITx/mitx.git
fi fi
if [[ ! -d "$BASE/mitx/askbot/.git" ]]; then
output "Cloning askbot as a submodule of mitx"
cd "$BASE/mitx"
git submodule update --init
fi
# By default, dev environments start with a copy of 6.002x # By default, dev environments start with a copy of 6.002x
cd "$BASE" cd "$BASE"
mkdir -p "$BASE/data" mkdir -p "$BASE/data"
...@@ -334,9 +328,6 @@ pip install -r mitx/pre-requirements.txt ...@@ -334,9 +328,6 @@ pip install -r mitx/pre-requirements.txt
output "Installing MITx requirements" output "Installing MITx requirements"
cd mitx cd mitx
pip install -r requirements.txt pip install -r requirements.txt
output "Installing askbot requirements"
pip install -r askbot/askbot_requirements.txt
pip install -r askbot/askbot_requirements_dev.txt
mkdir "$BASE/log" || true mkdir "$BASE/log" || true
mkdir "$BASE/db" || true mkdir "$BASE/db" || true
......
...@@ -27,7 +27,7 @@ You should be familiar with the following. If you're not, go read some docs... ...@@ -27,7 +27,7 @@ You should be familiar with the following. If you're not, go read some docs...
- CMS -- Course Management System. The instructor-facing parts of the system. Allows instructors to see and modify their course, add lectures, problems, reorder things, etc. - CMS -- Course Management System. The instructor-facing parts of the system. Allows instructors to see and modify their course, add lectures, problems, reorder things, etc.
- Askbot -- the discussion forums. We have a custom fork of this project. We're also hoping to replace it with something better later. (e.g. need support for multiple classes, etc) - Forums -- this is a ruby on rails service that runs on Heroku. Contributed by berkeley folks. The LMS has a wrapper lib that talks to it.
- Data. In the data/ dir. There is currently a single `course.xml` file that describes an entire course. Speaking of which... - Data. In the data/ dir. There is currently a single `course.xml` file that describes an entire course. Speaking of which...
......
...@@ -9,7 +9,6 @@ There is also a script "create-dev-env.sh" that automates these steps. ...@@ -9,7 +9,6 @@ There is also a script "create-dev-env.sh" that automates these steps.
mkdir ~/mitx_all mkdir ~/mitx_all
cd ~/mitx_all cd ~/mitx_all
git clone git@github.com:MITx/mitx.git git clone git@github.com:MITx/mitx.git
git clone git@github.com:MITx/askbot-devel
hg clone ssh://hg-content@gp.mitx.mit.edu/data hg clone ssh://hg-content@gp.mitx.mit.edu/data
2) Install OSX dependencies (Mac users only) 2) Install OSX dependencies (Mac users only)
...@@ -49,8 +48,6 @@ There is also a script "create-dev-env.sh" that automates these steps. ...@@ -49,8 +48,6 @@ There is also a script "create-dev-env.sh" that automates these steps.
source ~/mitx_all/python/bin/activate source ~/mitx_all/python/bin/activate
cd ~/mitx_all cd ~/mitx_all
pip install -r askbot-devel/askbot_requirements.txt
pip install -r askbot-devel/askbot_requirements_dev.txt
pip install -r mitx/pre-requirements.txt pip install -r mitx/pre-requirements.txt
pip install -r mitx/requirements.txt pip install -r mitx/requirements.txt
......
=============================
Customization of Askbot skins
=============================
The default skin at the moment is in the development, however
it is already possible to start customizing your site without
incurring much maintenance overhead.
Current status of templates
===========================
The two busiest templates are - the "main" page and the "question" page,
the main page is more or less complete. "Question" page will be significantly
refactored in the near future.
How skins work in Askbot
========================
The skins reside in up to two directories:
* `askbot/skins` in the source code (contains any stock skins)
* directory pointed to by a ASKBOT_EXTRA_SKINS_DIR in your settings.py
with any other skins
Currently, the skin is selected by the site administrator in the live settings.
Also, at the moment skin default is special - it serves any resources
absent in other skins. In a way - all other skins inherit from the "default".
Templates and media are resolved in the following way:
* check in skin named as in settings.ASKBOT_DEFAULT_SKIN
* then skin named 'default'
How to customize a skin
=======================
There are three options:
* edit custom css via the settings interface - good for small tweaks
(no need to directly log in to the server)
* create a new skin in separate files (need direct access to the server
files, more maintenance overhead)
* directly modify the "default" skin (as in the previous option - need
direct access to the server, less maintenance overhead, some
knowledge of git system is required)
The first option only allows to modify css and add custom javascript.
The latter two options allow changing the templates as well.
If you wish to follow the second option, create a directory named the same
way as the skin you are building and start adding files with the same names
and relative locations as those in the "default" skin.
NO NEED TO CREATE ALL TEMPLATES/MEDIA FILES AT ONCE as your skin will inherit
pieces from the "default".
The disadvantage of thil second approach is that you will be on your own maintaining
the synchrony of your template, stylesheet and the core code.
Third approach is the best, but it requires (the most basic) use of
git source code management software. With git you will easily merge the updates
from the development repository.
Structure of the skin directories
=================================
Todo.
To simplify maintenance of the css as the skin is being developed,
populate css file `media/style/extra.css` with any rules that will
override those in the `media/style/style.css` file. If you do that
media does not have to be composed of files named the same way as in default skin
whatever media you link to from your templates - will be in operation
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment