I think something like this happened to me; I ended up reassigning the problem so that the images get refreshed.
Perhaps it matters if you are editing via an assigned homework problem as opposed to editing via the library browser.
Cached images for assigned problems may need to be "flushed".
hp
Forums
Search results: 169
Arnie and Jason,
When I take out the refresh cache line in the problem's code and change the graph, it will not update the image--the file for the graph in the var/www/wwtmp/gif folder is not updated. I tried it in IE and Chrome. I edited the file from IE and looked at the problem in Chrome--it was the first time I'd logged into the course using Chrome.
--rac
Hi Robin,
This is strange. Looking at the code, setting $refreshCachedImages = 1; in the problem code or just editing the problem (which changes its creation date) should both force the images to be recreated. It strange that setting $refreshCachedImages = 1; in the problem code worked but just editing the problem didn't.
Could it be possible that this is a caching issue? If you have time, could you try this by viewing the problem in one browser, editing the problem and then viewing it an another (or some other procedure to be sure that your browser it not caching the old image).
Arnie
Hi Robin,
This may be a bug. Does your problem use insertGraph? That's defined in PGcore.pm and contains the code
if( not -e $filePath # does it exist?
or ((stat "$templateDirectory"."$main::envir{fileName}")[9] > (stat $filePath)[9]) # source has changed
or $graph->imageName =~ /Undefined_Set/ # problems from SetMaker and its ilk should always be redone
or $refreshCachedImages
which "should" refresh the image in your case.
Arnie
Thanks, Dick,
I added the refresh cache line you mentioned to the problem's code and now it is refreshing the image. It's odd that I didn't need to do this before??
--rac
I added the refresh cache line you mentioned to the problem's code and now it is refreshing the image. It's odd that I didn't need to do this before??
--rac
Is this behavior happening even if
$refreshCachedImages = 1;
is used in the problem's code?
$refreshCachedImages = 1;
is used in the problem's code?
Hi everyone,
It seems that working in the library browser for extended periods of time causes the library browser to slow down. Initially, as I build a set, the browser refreshes quickly as I change between libraries and add problems to a set. But after having added problems from several locations and refreshed several times, the library browser begins to slow down dramatically, and eventually becomes very slow, taking several minutes to refresh a small page.
What causes this behavior, and is there any remedy?
Thanks,
Lars.
I am using WeBWorK version 2.5 on Ubuntu 10.04.3. I have a problem that asks students to find the derivative of a straight line from a graph with units, the code is below. I used this problem last semester without issue.
The problem has two answer blanks, both of which use the same answer.
A student complained to me that his first answer was being marked incorrect. I looked at his problem and WeBWorK is reporting the correct answer to the first question as -1/30 ft/min, and to the second answer as -4 ft/min (which is correct). Since both blanks use the same answer, something is amiss.
I tried giving him a new seed, but we get the same problem, just different numbers. I looked at many of the other students in the class, and he is the only one with this problem that I can find.
CODE:
loadMacros(
"PGstandard.pl",
"PGunion.pl",
"Parser.pl",
"PGcourse.pl",
"PGgraphmacros.pl",
"parserNumberWithUnits.pl",
);
TEXT(beginproblem());
BEGIN_PROBLEM();
##############################################
# Setup
$refreshCachedImages=1;
Context("Numeric");
Context()->variables->add(t=>'Real');
#
# The function to plot
#
$m = Compute(non_zero_random(-4,4));
$b = Compute(non_zero_random(-4,4));
$munits = NumberWithUnits("$m","ft/min");
$s = Formula("$m*t+$b")->reduce;
$sgraph = Formula("$m*x+$b");
#
# Graph size
#
($tm,$tM) = (-2,2);
$extreme1 = abs($s->eval(t=>"$tm"));
$extreme2 = abs($s->eval(t=>"$tM"));
if($extreme1 > $extreme2){$sM = $extreme1;}
else {$sM = $extreme2;};
$sm=-$sM;
$size = [450,450];
##############################################
#
# The plot defaults
#
@Goptions = (
$tm,$sm,$tM,$sM, # dimensions of graph
axes => [0,0], grid => [$tM-$tm,$sM-$sm], # number of grid lines
size => $size # pixel dimension
);
$plotdomain = "x in <$tm,$tM>";
$plotoptions = "using color:red and weight=2";
$graph = init_graph(@Goptions);
plot_functions($graph,"$sgraph for $plotdomain $plotoptions");
##############################################
# Main text
Context()->texStrings;
BEGIN_TEXT
$BBOLD Note: $EBOLD Your answers must include \{ helpLink('units') \}.
$BR
$BR
The position \(x\) of a car at time t is graphed below.
$BCENTER
\{ image( insertGraph($graph),width=>450, height=>450 ) \}
$ECENTER
If the position of the car is given in feet and time is measured in minutes then
\(x^\prime (t) = \) \{ans_rule\}
$BR
The velocity of the car is \{ans_rule\}
$BR
END_TEXT
Context()->normalStrings;
##################################################
# Answers
##################################################
ANS($munits->cmp() );
ANS($munits->cmp() );
END_PROBLEM();
ENDDOCUMENT(); # This should be the last executable line in the problem.
The problem has two answer blanks, both of which use the same answer.
A student complained to me that his first answer was being marked incorrect. I looked at his problem and WeBWorK is reporting the correct answer to the first question as -1/30 ft/min, and to the second answer as -4 ft/min (which is correct). Since both blanks use the same answer, something is amiss.
I tried giving him a new seed, but we get the same problem, just different numbers. I looked at many of the other students in the class, and he is the only one with this problem that I can find.
CODE:
loadMacros(
"PGstandard.pl",
"PGunion.pl",
"Parser.pl",
"PGcourse.pl",
"PGgraphmacros.pl",
"parserNumberWithUnits.pl",
);
TEXT(beginproblem());
BEGIN_PROBLEM();
##############################################
# Setup
$refreshCachedImages=1;
Context("Numeric");
Context()->variables->add(t=>'Real');
#
# The function to plot
#
$m = Compute(non_zero_random(-4,4));
$b = Compute(non_zero_random(-4,4));
$munits = NumberWithUnits("$m","ft/min");
$s = Formula("$m*t+$b")->reduce;
$sgraph = Formula("$m*x+$b");
#
# Graph size
#
($tm,$tM) = (-2,2);
$extreme1 = abs($s->eval(t=>"$tm"));
$extreme2 = abs($s->eval(t=>"$tM"));
if($extreme1 > $extreme2){$sM = $extreme1;}
else {$sM = $extreme2;};
$sm=-$sM;
$size = [450,450];
##############################################
#
# The plot defaults
#
@Goptions = (
$tm,$sm,$tM,$sM, # dimensions of graph
axes => [0,0], grid => [$tM-$tm,$sM-$sm], # number of grid lines
size => $size # pixel dimension
);
$plotdomain = "x in <$tm,$tM>";
$plotoptions = "using color:red and weight=2";
$graph = init_graph(@Goptions);
plot_functions($graph,"$sgraph for $plotdomain $plotoptions");
##############################################
# Main text
Context()->texStrings;
BEGIN_TEXT
$BBOLD Note: $EBOLD Your answers must include \{ helpLink('units') \}.
$BR
$BR
The position \(x\) of a car at time t is graphed below.
$BCENTER
\{ image( insertGraph($graph),width=>450, height=>450 ) \}
$ECENTER
If the position of the car is given in feet and time is measured in minutes then
\(x^\prime (t) = \) \{ans_rule\}
$BR
The velocity of the car is \{ans_rule\}
$BR
END_TEXT
Context()->normalStrings;
##################################################
# Answers
##################################################
ANS($munits->cmp() );
ANS($munits->cmp() );
END_PROBLEM();
ENDDOCUMENT(); # This should be the last executable line in the problem.
Dear Webwork,
In the process of bringing up our new Webwork server, we're trying to create a new theme. We've installed the directory, templates, and css files in the appropriate places and with the appropriate permissions. However, the drop-down list on the course configuration page doesn't give our new theme as an option, even after refreshing the page as suggested. What should we try next?
Thanks!
Randy Cone
In the process of bringing up our new Webwork server, we're trying to create a new theme. We've installed the directory, templates, and css files in the appropriate places and with the appropriate permissions. However, the drop-down list on the course configuration page doesn't give our new theme as an option, even after refreshing the page as suggested. What should we try next?
Thanks!
Randy Cone
I have created a few macros that make customization of TeX display a bit easier. It would be nice to simplify it more.
First -- to have equations display vectors in a particular style place this
in your PGcourse.pl file (and place "PGcourse.pl" in the loadMacros() queueue).
addToTeXPreamble("\\newcommand{\\myVec}[1]{\\vec{#1}} ");
If you were to place this command in a single question (a .pg file) then you use single
backslashes instead of double backslashes. You should place the command towards the beginning of the question before any equations are rendered.
This affects only image ("dvipng") mode. It does not affect jsMath or MathJax
mode -- that will have to come later.
You can now modify this preamble command in PGcourse.pl to obtain different styles for denoting vectors.
To make sure that you can see the changes (equation images are cached!)
place
refreshEquations(1);
in a given question or in the PGcourse.pl file while testing. This forces equation images to be recreated every time.
To set the style for the hardcopy for a given homework set, place the command
\newcommand{\myVec}[1]{\vec{#1}}
in the header file used for the homework set in the section which is
read when creating hardcopy. (Or if you use separate header files for
screen display and for image display place it in the hardcopy header file.
There are ways to change the TexPreamble for an entire site --
see the WeBWorK/Constants.pm file for images TexPreamble and
the webwork2/conf/snippets directory for the locations of the files to change the hardcopy version.
jsMath and MathJax headers are defined in the webwork2/html/ directory.
It would be nice to be able to change all of the different presentation modes simultaneously with one command -- but that is not possible yet.
-- Mike