Difference between revisions of "CAPA Physics Problems"

From WeBWorK_wiki
Jump to navigation Jump to search
Line 11: Line 11:
 
===Installing the CAPA physics problem collection===
 
===Installing the CAPA physics problem collection===
   
To download your own copy pf the physics collection
 
  +
This step installs and sets up [[CAPA Physics Problems|the CAPA Library]], which is a library of physics problems.
transfer to the directory where you would
 
like the physics problem library to reside
 
(e.g. /opt/webwork/libraries/ )
 
   
and type
 
  +
First we download the CAPA Library including required macros, e.g. to your downloads directory
   
cvs -d :pserver:anoncvs@cvs.webwork.rochester.edu:/webwork/cvs/rochester checkout rochester_physics_problib
 
  +
$ cd
  +
$ cd downloads
  +
$ cvs -d :pserver:anoncvs@cvs.webwork.rochester.edu:/webwork/cvs/rochester checkout rochester_physics_problib
   
In what follows I'll assume the physics problem library has been created at
 
  +
I'll assume you have a standard setup, i.e. an <code>/opt/webwork</code> directory, an <code>/opt/webwork/libraries</code> directory and webwork2 is installed in <code>/opt/webwork/webwork2</code> and further, all these directories are owned by <code>root</code>. Then do the following.
   
.../webwork/libraries/rochester_physics_problib
 
  +
As <code>root</code> create a <code>CAPA</code> directory under <code>/opt/webwork</code> and move the CAPA macros there. Then move the CAPA graphics and library files to the required locations.
   
you will need to adjust several lines in <code>global.conf</code>
 
  +
$ su
so that the macros associated with the CAPA library can be found.
 
  +
<root password>
The original snippet reads:
 
  +
# mkdir /opt/webwork/CAPA
  +
# cd rochester_physics_problib/macros/
  +
# mv CAPA_Tools /opt/webwork/CAPA/
  +
# mv CAPA_MCTools /opt/webwork/CAPA/
  +
# cd ..
  +
# mv CAPA_Graphics /opt/webwork/webwork2/htdocs/
  +
# cd ..
  +
# mv rochester_physics_problib /opt/webwork/libraries/
   
 
  +
We need to edit <code>global.conf</code> again
   
# Locations of CAPA resources. (Only necessary if you need to use converted CAPA
 
  +
# cd /opt/webwork/webwork2/conf
# problems.)
 
  +
# gedit global.conf
  +
  +
Search for <code>courseFiles{problibs}</code> and scroll down several lines to the line
  +
# capaLibrary => "CAPA",
  +
Uncomment this line (i.e. remove the <code>#</code>) so it becomes
  +
capaLibrary => "CAPA",
  +
  +
Next search for the lines
 
$pg{specialPGEnvironmentVars}{CAPA_Tools} = "$courseDirs{macros}/CAPA_Tools/",
 
$pg{specialPGEnvironmentVars}{CAPA_Tools} = "$courseDirs{macros}/CAPA_Tools/",
 
$pg{specialPGEnvironmentVars}{CAPA_MCTools} = "$courseDirs{macros}/CAPA_MCTools/",
 
$pg{specialPGEnvironmentVars}{CAPA_MCTools} = "$courseDirs{macros}/CAPA_MCTools/",
 
$pg{specialPGEnvironmentVars}{CAPA_GraphicsDirectory} = "$courseDirs{html}/CAPA_Graphics/",
 
$pg{specialPGEnvironmentVars}{CAPA_GraphicsDirectory} = "$courseDirs{html}/CAPA_Graphics/",
 
$pg{specialPGEnvironmentVars}{CAPA_Graphics_URL} = "$courseURLs{html}/CAPA_Graphics/",
 
$pg{specialPGEnvironmentVars}{CAPA_Graphics_URL} = "$courseURLs{html}/CAPA_Graphics/",
  +
and edit them so that they read as follows (cut and paste is the best way to do this)
   
If you only need to use these physics problems in one course (say physics_course) you can leave these lines as they are and create links in the <code>.../physics_course/templates/macros</code> directory
 
  +
$pg{specialPGEnvironmentVars}{CAPA_Tools} = "/opt/webwork/CAPA/CAPA_Tools/",
 
  +
$pg{specialPGEnvironmentVars}{CAPA_MCTools} = "/opt/webwork/CAPA/CAPA_MCTools/",
 
  +
$pg{specialPGEnvironmentVars}{CAPA_GraphicsDirectory} = "$webworkDirs{htdocs}/CAPA_Graphics/",
 
  +
$pg{specialPGEnvironmentVars}{CAPA_Graphics_URL} = "$webworkURLs{htdocs}/CAPA_Graphics/",
ln -s ...webwork/libraries/rochester_physics_problib/macros/CAPA_Tools CAPA_Tools
 
ln -s ...webwork/libraries/rochester_physics_problib/macros/CAPA_MCTools CAPA_MCTools
 
 
and in the <code>.../physics_course/html</code> directory
 
   
 
  +
Then save the file and quit. Note that we are setting up the CAPA macros and graphics so that they can be used by any WeBWorK course on the server.
   
ln -s ...webwork/libraries/rochester_physics_problib/CAPA_Graphics CAPA_Graphics
 
  +
There is one final step that is needed. We have to put a link in the templates directory of every course that needs access to the CAPA Library. If you want to have every course you create have access to the CAPA Library (unlikely unless you are in a physics department) put the link in the <code>modelCourse</code>
   
If you want to make these problems usable by all courses then just change the lines in <code>global.conf</code> described above so that they point to the addresses where the CAPA macros and graphics can be found.
 
  +
$ cd /opt/webwork/courses/modelCourse/templates/
  +
sudo ln -s /opt/webwork/libraries/rochester_physics_problib/ capaLibrary
  +
password: <your password>
   
Most of the problems work, but not all, so check things out before you assign them.
 
  +
More likely you just want to do this for individual courses. For example to set up access to the CAPA Library from <code>myTestCourse</code>, do the following
  +
cd /opt/webwork/courses/myTestCourse/templates/
  +
sudo ln -s /opt/webwork/libraries/rochester_physics_problib/ capaLibrary
  +
and do the analogous thing for every course that needs access to the CAPA Library.
  +
Then to gain access to the CAPA Library from the course, simply go to the <code>Library Browser</code> and click on the <code>CAPA</code> button.
   
 
[[Category:Instructors]]
 
[[Category:Instructors]]

Revision as of 12:23, 21 October 2009

Browsing the CAPA physics problem collection

Rochester has a collection of problems used in physics. These problems were originally CAPA problems and were converted some years ago, so the code isn't pretty, but for the most part they work.

The problems have been collected into a

physics "course"

so that you can browse through them and see what is already available.

Installing the CAPA physics problem collection

This step installs and sets up the CAPA Library, which is a library of physics problems.

First we download the CAPA Library including required macros, e.g. to your downloads directory

$ cd
$ cd downloads
$ cvs -d :pserver:anoncvs@cvs.webwork.rochester.edu:/webwork/cvs/rochester checkout rochester_physics_problib

I'll assume you have a standard setup, i.e. an /opt/webwork directory, an /opt/webwork/libraries directory and webwork2 is installed in /opt/webwork/webwork2 and further, all these directories are owned by root. Then do the following.

As root create a CAPA directory under /opt/webwork and move the CAPA macros there. Then move the CAPA graphics and library files to the required locations.

$ su
<root password>
# mkdir /opt/webwork/CAPA
# cd rochester_physics_problib/macros/                   
# mv CAPA_Tools /opt/webwork/CAPA/                       
# mv CAPA_MCTools /opt/webwork/CAPA/                     
# cd ..                                                                          
# mv CAPA_Graphics /opt/webwork/webwork2/htdocs/         
# cd ..                                                  
# mv rochester_physics_problib /opt/webwork/libraries/   

We need to edit global.conf again

# cd /opt/webwork/webwork2/conf
# gedit global.conf

Search for courseFiles{problibs} and scroll down several lines to the line

#      capaLibrary      => "CAPA",

Uncomment this line (i.e. remove the #) so it becomes

      capaLibrary      => "CAPA",

Next search for the lines

$pg{specialPGEnvironmentVars}{CAPA_Tools}             = "$courseDirs{macros}/CAPA_Tools/", 
$pg{specialPGEnvironmentVars}{CAPA_MCTools}           = "$courseDirs{macros}/CAPA_MCTools/",  
$pg{specialPGEnvironmentVars}{CAPA_GraphicsDirectory} = "$courseDirs{html}/CAPA_Graphics/", 
$pg{specialPGEnvironmentVars}{CAPA_Graphics_URL}      = "$courseURLs{html}/CAPA_Graphics/",   

and edit them so that they read as follows (cut and paste is the best way to do this)

$pg{specialPGEnvironmentVars}{CAPA_Tools}             = "/opt/webwork/CAPA/CAPA_Tools/",        
$pg{specialPGEnvironmentVars}{CAPA_MCTools}           = "/opt/webwork/CAPA/CAPA_MCTools/",      
$pg{specialPGEnvironmentVars}{CAPA_GraphicsDirectory} = "$webworkDirs{htdocs}/CAPA_Graphics/",  
$pg{specialPGEnvironmentVars}{CAPA_Graphics_URL}      = "$webworkURLs{htdocs}/CAPA_Graphics/",  

Then save the file and quit. Note that we are setting up the CAPA macros and graphics so that they can be used by any WeBWorK course on the server.

There is one final step that is needed. We have to put a link in the templates directory of every course that needs access to the CAPA Library. If you want to have every course you create have access to the CAPA Library (unlikely unless you are in a physics department) put the link in the modelCourse

$ cd /opt/webwork/courses/modelCourse/templates/
sudo ln -s /opt/webwork/libraries/rochester_physics_problib/ capaLibrary
password: <your password>

More likely you just want to do this for individual courses. For example to set up access to the CAPA Library from myTestCourse, do the following

cd /opt/webwork/courses/myTestCourse/templates/
sudo ln -s /opt/webwork/libraries/rochester_physics_problib/ capaLibrary

and do the analogous thing for every course that needs access to the CAPA Library. Then to gain access to the CAPA Library from the course, simply go to the Library Browser and click on the CAPA button.