Forums

Search results: 169

Installation -> Config. Apache? -> Re: Config. Apache?

by Hal Sadofsky -

This is indeed something you can do with an apache configuration.

Here is how we did it on our server (the relevant files may be someplace else on your server):



1) mv /usr/local/apache2/htdocs/index.html to index.html.dist or some such thing.

2) create a new /usr/local/apache2/htdocs/index.html

which contains only the following single line:



(obviously above you replace webwork.uoregon.edu/webwork2 with whatever the URL for webwork is on your server)

-Hal

WeBWorK Problems -> epsilon delta problem

by Darwyn Cook -
Brian asked me about some epsilon/delta problems that I had written. Since I have yet to get my problems up into the NPL I thought I would include the source code here for one of them.
This problem mimics a problem from the text where the student is given epsilon and has to get the graph to exit the corners of the graphing window to find delta. Unfortunately the real trouble with this problem for my students seems to be the decimal arithmetic, not the epsilon/delta concept.

##DESCRIPTION
#
# File Created: 7/10/2008
# Last Modified: 7/10/2008
# Problem Author: Darwyn Cook
# WeBWorK Entry:
# Location: Alfred University
#
##ENDDESCRIPTION

##KEYWORDS('limits' 'epsilon' 'delta' 'rigorous')
##

## DBsubject('Calculus')
## DBchapter('Limits and Derivatives')
## DBsection('Limits Rigorously')
## Date('7/10/2008')
## Author('Darwyn Cook')
## Institution('Alfred University')
## TitleText1('Calculus: with Early Transcendentals')
## EditionText1('8')
## AuthorText1('Anton')
## Section1('2.4')
## Problem1('')


DOCUMENT(); # This should be the first executable line in the problem.
loadMacros("PG.pl",
"PGbasicmacros.pl",
"PGchoicemacros.pl",
"PGanswermacros.pl",
"PGauxiliaryFunctions.pl",
"PGgraphmacros.pl",
"MathObjects.pl");

TEXT(beginproblem());
$showPartialCorrectAnswers = 0;

TEXT($BEGIN_ONE_COLUMN);
$refreshCashedImages= 1;

Context()->strings->are(blue=>{},red=>{},black=>{},green=>{});
Context()->{format}{number} = "%.8g";
$answertolerance = 0.000003;
$functioncolor = String(black);
$epsiloncolor = String(red);
$epsilon = random(.001, .01,.0001);
$a = random(-3,3,.01);

##############################################################
# Check for student input
if (defined $inputs_ref->{'xmin'} ) {
$xmin = $inputs_ref->{'xmin'};
}
elsif (defined $in{'xmin'} ) {
$xmin = $in{'xmin'};
}
else {
$xmin = $a-1;
}
# set increment value for y
if (defined $inputs_ref->{'xmax'} ) {
$xmax = $inputs_ref->{'xmax'};
}
elsif (defined $in{'xmax'} ) {
$xmax = $in{'xmax'};
}
else {
$xmax = $a+1;
}
if (defined $inputs_ref->{'ymin'} ) {
$ymin = $inputs_ref->{'ymin'};
}
elsif (defined $in{'ymin'} ) {
$ymin = $in{'ymin'};
}
else {
$ymin = -20;
}
# set increment value for y
if (defined $inputs_ref->{'ymax'} ) {
$ymax = $inputs_ref->{'ymax'};
}
elsif (defined $in{'ymax'} ) {
$ymax = $in{'ymax'};
}
else {
$ymax = 20;
}

#####################################################
## This code allows the student to input an arithmetic
## expression, which we reduce to a number. Otherwise
## the graph object will complain in an unfriendly way.
$xmin=Real("$xmin")->reduce;
$xmax=Real("$xmax")->reduce;
$ymin=Real("$ymin")->reduce;
$ymax=Real("$ymax")->reduce;
$xmin->with(
tolType=>'absolute', tolerance=>'.0000001');
$xmax->with(
tolType=>'absolute', tolerance=>'.0000001');
$ymin->with(
tolType=>'absolute', tolerance=>'.0000001');
$ymax->with(
tolType=>'absolute', tolerance=>'.0000001');

#####################################################
## Better check the student input, they won't like the
## result if they input the coordinates backwards
if ($xmin > $xmax){
$xmin = $xmax-1;
BEGIN_TEXT
$BBOLD XMIN MUST BE LESS THEN XMAX!$EBOLD
$BR
END_TEXT
}
if ($ymin >= $ymax){
$ymin = $ymin-1;
BEGIN_TEXT
$BBOLD YMIN MUST BE LESS THEN YMAX!$EBOLD
$BR
END_TEXT
}

#####################################################
## Define the functions

$f = Formula("sin(pi*(x^2))");
$dfdx = $f->D('x');
$m = $dfdx->eval(x=>$a)->with(
tolType=>'absolute', tolerance=>$answertolerance);
while ($m == 0){
$a = random(-3,3,.01);
$m = $dfdx->eval(x=>$a);}
$y = $f->eval(x=>$a)->with(
tolType=>'absolute', tolerance=>$answertolerance);
$fplusepsilon = Formula("$y+$epsilon");
$fminusepsilon = Formula("$y-$epsilon");


######################################################
## Now we are going to use the quadratic Taylor series approximation
## to f to estimate delta. Close enough for this application.
## First we define the coefficients $a0+$a1x+$a2x^2
$dfdxdx = $dfdx->D('x');
$c = $dfdxdx->eval(x=>$a);
#$a1 = Real("$m-$a*$c");
#$a2 = Real("$a^2*$c/2");
#$delta = Real("
#(-(2*$a2*$x+$a1)+sqrt((2*$a2*$x+$a2)^2+4*$a2*$epsilon))/(2*$a2)")->with(tolType=>'absolute', #tolerance=>'.00001');
######################################################
## This would be the tangent line approximation
$delta = Real(abs($epsilon/$m))->with(
tolType=>'absolute', tolerance=>'0.000003');;

######################################################
## Generate the graphs

$size = [200,250];
$tex_size = 350;

## initialize the graph and add the functions in
$gr = init_graph($xmin,$ymin,$xmax,$ymax,axes=>[$a,$y],size=>[400,400]);
add_functions($gr,
"$f for x in <$xmin,$xmax> using color:$functioncolor and weight:2");
add_functions($gr,
"$fplusepsilon for x in <$xmin,$xmax> using color:$epsiloncolor and weight:1");
add_functions($gr,
"$fminusepsilon for x in <$xmin,$xmax> using color:$epsiloncolor and weight:1");
$gr->stamps( closed_circle($a,$y,'black') );
$in=time();
$gr->gifName($gr->gifName()."$in");

#######################################################
## The code to generate student input boxes

$len = 1;
$INPUTSPACEXMIN = M3( qq! \\rule{${len}in}{.01in}!,
qq!\begin{rawhtml}<INPUT TYPE = "TEXT" NAME="xmin"
VALUE="$xmin">\end{rawhtml}!,
qq!<INPUT TYPE = "TEXT" NAME="xmin" VALUE="$xmin">!
);
$INPUTSPACEXMAX = M3( qq! \\rule{${len}in}{.01in}!,
qq!\begin{rawhtml}<INPUT TYPE = "TEXT" NAME="xmax"
VALUE="$xmax">\end{rawhtml}!,
qq!<INPUT TYPE = "TEXT" NAME="xmax" VALUE="$xmax">!
);
$INPUTSPACEYMIN = M3( qq! \\rule{${len}in}{.01in}!,
qq!\begin{rawhtml}<INPUT TYPE = "TEXT" NAME="ymin"
VALUE="$ymin">\end{rawhtml}!,
qq!<INPUT TYPE = "TEXT" NAME="ymin" VALUE="$ymin">!
);
$INPUTSPACEYMAX = M3( qq! \\rule{${len}in}{.01in}!,
qq!\begin{rawhtml}<INPUT TYPE = "TEXT" NAME="ymax"
VALUE="$ymax">\end{rawhtml}!,
qq!<INPUT TYPE = "TEXT" NAME="ymax" VALUE="$ymax">!
);

########################################################
## The problem
Context()->texStrings;
BEGIN_TEXT
\{ image( insertGraph($gr),, width=>400, height=>400,tex_size=>250) \}
$PAR
Use the graph of f to find \(\delta\) so that \(\vert f(x) - f(a)\vert <$epsilon\) when \(\vert x-a\vert < \delta\) if \(a = $a\) and \(f(a) = $y\).
$BR
\(\delta = \) \{ans_rule(20)\}
$BR
To change the graph enter values for
$PAR
x min = $INPUTSPACEXMIN x max= $INPUTSPACEXMAX
$PAR
y min = $INPUTSPACEYMIN y max= $INPUTSPACEYMAX
$BR and then press the Submit Answer button.
$PAR
$BBOLD Note: $EBOLD \(f(a) + \epsilon\) and \(f(a)-\epsilon\) are graphed in red to help you find \(\delta\). Mathematically speaking, once you have found \(\delta\) any smaller number will also work for \(\delta\). Since that would make the problem rather easy, you could just put in a very small number, for this problem you will need to find the largest delta that will work. Your answer must be within $answertolerance of the correct answer.
END_TEXT
BEGIN_HINT
$BR
$BR
$BBOLD HINT $EBOLD
$BR
\(\epsilon\) determines the vertical size of the window, you want it at \($y-\epsilon\) and \($y+\epsilon\). The horizontal spacing you will have to guess at, how will you know when you have it right.
END_HINT
BEGIN_SOLUTION
$BR
$BR
$BBOLD SOLUTION $EBOLD
$BR
You have the correct horizontal window when the graph exits the corners of the windows.
END_SOLUTION
Context()->normalStrings;
ANS($delta->cmp);
ENDDOCUMENT(); # This should be the last executable line in the problem.
The following message has started showing up in our error_log (a student brought the problem to my attention when he had trouble logging on, and this was the error message he forwarded):

Failed to initialize course environment: Could not evaluate global environment file /opt/webwork/webwork2/conf/global.conf: Can't locate object method "get" via package "APR::Table" at /opt/webwork/webwork2/lib/Apache/WeBWorK.pm line 74.

By the error_log entries (only 16 in the last 4 days -- not a lot, I know, but it would be nice to solve the problem rather than just live with it and perhaps find out later that it was a harbinger of worse to come. Also, it's the only error we're getting on the system.) it seems to have happened on login, logout, while an instructor was accessing setmaker, and just viewing problems. Redoing a request or refreshing clears the error, so the problem is still at the level of "user annoyance."

We are running RHEL 5 with RedHat's build of Apache 2.2.3. 1 GB RAM. Only serving 6 courses. perl-status shows ARP::Table is loaded.
APR::Table 0.009000 Fri Sep 19 04:30:28 2008 /usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi/APR/Table.pm

httpd.conf tweaks are
Timeout 300
KeepAlive On
MaxKeepAliveRequests 25
KeepAliveTimeout 5
StartServers 5
MaxSpareServers 10
MaxClients 8
MaxRequestsPerChild 100

Any ideas?
Sometimes, when trying to view problems, users get an error message like the following. If the user reloads the page, the problem is shown correctly. This happens inconsistently, can happen with any problem, including those that have been used for years and we know there is nothing wrong with them. Restarting the server solves the problem temporarily, but within a couple of days this starts happening again.

Any ideas why this could be happening?

Error messages

Can't locate object method "getCopy" via package "Parser::Context" at line 988 of [PG]/macros/PGnumericevaluators.pl Died within main::NUM_CMP called at line 411 of [PG]/macros/PGnumericevaluators.pl from within main::num_cmp called at line 45 of [TMPL]/Library/Rochester/setTrig09Laws/srw6_1_53.pg
Error details

Problem2
ERROR caught by Translator while processing problem file:Library/Rochester/setTrig09Laws/srw6_1_53.pg
****************
Can't locate object method "getCopy" via package "Parser::Context" at line 988 of [PG]/macros/PGnumericevaluators.pl
Died within main::NUM_CMP called at line 411 of [PG]/macros/PGnumericevaluators.pl
from within main::num_cmp called at line 45 of [TMPL]/Library/Rochester/setTrig09Laws/srw6_1_53.pg

Request information
Time Wed Jan 27 14:34:14 2010
Method GET
URI /webwork2/Math5-Nogin/set_01/2/
HTTP Headers
Keep-Alive 300
Accept-Charset ISO-8859-1,utf-8;q=0.7,*;q=0.7
User-Agent Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.11) Gecko/2009061613 CentOS/3.0.11-2.el5.centos Firefox/3.0.11
Accept text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Connection keep-alive
Referer http://webwork2.math.csufresno.edu/webwork2/Math5-Nogin/set_01/1/?effectiveUser=mnogin&displayMode=images&key=qHJmiTg2iVxdpFd9IJCyBWqYPGg9NHhZ&user=mnogin
Accept-Encoding gzip,deflate
Cookie __qca=P0-2132759669-1251736433489; __utma=110011415.2469005800571971600.1251736434.1264451351.1264612528.50; __utmz=110011415.1264612528.50.50.utmcsr=zimmer.csufresno.edu|utmccn=(referral)|utmcmd=referral|utmcct=/~mnogin/; __unam=69a926a-123727f0344-37280b6e-5; cssln116HFR1-84915=6Rv7Lv3J5GdmnQprTM9pqw1TBhzjtPcK!-484220617; csuf_info=Maria Nogin~mnogin@csufresno.edu; csuf_auth=facstaf; https%3a%2f%2fmy.csufresno.edu%2fpsp%2fmfs%2fcsu%2ffresno%2frefresh=list:||||||||||||||||||||||||||||||||||||||||||||||||; PS_TOKEN=AAAAogECAwQAAQAAAAACvAAAAAAAAAAsAARTaGRyAgBOcwgAOAAuADEAMBThC0wHImLFgiDSdcQtXTiY8ihm4gAAAGIABVNkYXRhVnicLYpJCoAwEAQrKh49+I9ITCTRu8tNgl/xez7ONjhD10xBA7ep6gaDpno+9ow4AjNejLLQsnFydGR2LkkW10kFV8q2XCtP/z8oUQyFS9mkeF5zrwtr; ExpirePage=https://my.csufresno.edu/psp/mfs/; __utmc=110011415; cssln113HFR1-84915=rv3dLd1QvBCf1Z7D9WJ7pFCHjzgc2tTn!-168500861; cssln114HFR1-84915=LpvLLg1BlyXTJ0nhn9PzrxQhhfm8KqLT!1321201705; cssln137FFR1-84816=25fQLg0Yy5Rnch3tbHnZbj2pyrhfWk8D!-1469688737; cssln139FFR1-84816=HHg1Ld1fR7g9l751CvgpCHvkGynzgT7s!547896607; cssln133FFR1-84816=hR1nLGgLFbSZPkZ5qQPGlh9s2K6dtsGD!-733685691; cssln111HFR1-84915=ByksLGgQhJ69nNJkvTxC5PKvJMJq2jwT!565465510; cssln110HFR1-84915=nvCNLh1Q3sgcyWR2WdTG9yZJGQpkBznf!782771185; cssln112HFR1-84915=LWMDLFLCLPV6YRhtBMm46RcCKYrpvslQ!-551190033; frspplwebn2-csufresno-edu-443-PORTAL-PSJSESSIONID=Lg0Jnby8rQ4ppCfXMMsVCSYydwgnwV12!-1508339898
Accept-Language en-us,en;q=0.8,ru;q=0.5,fr;q=0.3
Host webwork2.math.csufresno.edu

or

Error detected while loading [PG]/macros/extraAnswerEvaluators.pl: Error
detected while loading [PG]/macros/MathObjects.pl: Error detected while
loading [PG]/macros/Parser.pl:
************************************************************ * This problem
requires the Parser.pm package, which doesn't * seem to be installed.
Please contact your WeBWorK system * administrator and ask him or her to
install it first.
************************************************************ Died within
main::compile_file called at line 308 of (eval 996) from within
main::loadMacros called at line 13 of [TMPL]/HWI/hw02p2.pg


Hi Mike,

I think moodle doesn't refresh the perl code once it has shown it (that's why in compound problems it always shows the first part), I've tested an example to see if the 'score' changes when you submit the correct answer and it's always printing score 0.

Here the example:

$a1 = 10;


BEGIN_TEXT
Write $a1
$BR $BR \{ans_rule(10) \}
$BR
END_TEXT

$ans_eval1 = num_cmp($a1);
$score = $ans_eval1->evaluate()->{score};
BEGIN_TEXT
$score
END_TEXT

ANS($ans_eval1);


I attached the screenshot once I have submitted the correct answer.

Next week I will try the solution about the page break and let you know about it.

Thanks to all,

Angel
Attachment screenshot14.png
Brian,

There seems to be an issue with reseeding the problems with dynamically generated graphs. I've just run into the issue with some of my classes.

It looks like the name of the file name of the graph image is generated by the line
my $imageName = "$studentLogin-$main::problemSeed-set${setName}prob${main::probNum}";
in the init_graph(...) from the PGgraphmacros.pl

The $main::problemSeed seems to refer to the initial problem seed, not the re-randomized problem seed. If there is a way to change that, the problem we have should go away.

It looks like there is a way to prohibit the use of cached images by setting the
$refreshCachedImages=1;
since the insertGraph(...) checks that variable. The issue with this ``solution'' is that the problem would not use the image cache at all.
It's an "external link", with the URL like this one:
http://webwork2.math.csufresno.edu/webwork2/Math75B-Nogin/

Sometimes, same students are not able to get the login page to work at some place, but then, on the same computer but in a different location, it works.

The error message they get looks like this:

Warning messages

Error messages

Expected token not present

Call stack

The information below can help locate the source of the problem.

  • in Apache2::Cookie::fetch called at line 622 of /opt/webwork2/lib/WeBWorK/Authen.pm
  • in WeBWorK::Authen::fetchCookie called at line 277 of /opt/webwork2/lib/WeBWorK/Authen.pm
  • in WeBWorK::Authen::get_credentials called at line 219 of /opt/webwork2/lib/WeBWorK/Authen.pm
  • in WeBWorK::Authen::do_verify called at line 150 of /opt/webwork2/lib/WeBWorK/Authen.pm
  • in WeBWorK::Authen::verify called at line 290 of /opt/webwork2/lib/WeBWorK.pm

Request information

Method
GET
URI
/webwork2/Math76-Cusick/
HTTP Headers
User-Agent
Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; WOW64; SLCC1; .NET CLR 2.0.50727; .NET CLR 3.0.04506; Media Center PC 5.0)
Accept
*/*
Connection
Keep-Alive
UA-CPU
x86
Referer
Accept-Encoding
gzip, deflate
Cookie
frspplwebn2-csufresno-edu-443-PORTAL-PSJSESSIONID=KTM2ffqky1MyVqVL0kDhrD8BGJrdymvG!-755107663; https%3a%2f%2fmy.csufresno.edu%2fpsp%2fmfs%2fcsu%2ffresno%2frefresh=list:|; ExpirePage=https://my.csufresno.edu/psp/mfs/; PS_LOGINLIST=https://my.csufresno.edu/mfs; PS_TOKENEXPIRE=24_Aug_2009_21:56:32_GMT; PS_TOKEN=AAAApAECAwQAAQAAAAACvAAAAAAAAAAsAARTaGRyAgBOcwgAOAAuADEAMBR1+/L0d7ZgKOoiOZq/I2HVo06ZxgAAAGQABVNkYXRhWHicHYs5DoAwDAQnAVFS8A+iJOLsOTqE+Arf43FsbEvjtXcNvM5XNQ6V/wo7EpGJrJlNxYadi7Pl5uDRcovbYHZkpRcXMTOYngmMegx2CZYquaT+AXKYC1M=; SignOnDefault=; csuf_auth=student; csuf_info=Hilary Heinrich~hheinrich@csufresno.edu
Accept-Language
en-us
Host