Forums

Search results: 169

I mentioned that was the reason for wanting multiple lines - tell them to clear only cache and not history, etc.

I don't see another solution that can be implemented in a relatively short time. I'm coding these problems for other instructors and have limited time.

ProblemRandomize( when => $when, onlyAfterDue => 0, style => "Button",label => "Clear Cache by typing ctrl/shift/delete \n before clicking this button to \n Get a new version of the problem" )  didn't work.

You can add "\n" in the string where you want the line break.
For example, "Clear Cache typing ctrl/shift/delete before clicking\nthis button to Get a new version of the problem".

However, I should tell you that what you are doing is really bad practice.  Asking a user to clear the browser cache should only be done when there is something corrupted in the cache, or a one time occurrence to force a stale resource to be reloaded.  It shouldn't be used as a normal course of action.  If you are going to insist on this approach, then you should at least make sure to clarify to your students to only clear the browser cache and not all of the other things that can be cleared via ctrl-shift-delete like cookies, browsing history, passwords, etc.

That is very helpful. I'd still like the system to reset the seed for the problem graphs but I found a work around - I can change the text in the "get a new version" button to include instructions to tell the student to clear cache using ctrl/shift/delete

ProblemRandomize( when => $when, onlyAfterDue => 0, style => "Button",label => "Clear Cache typing ctrl/shift/delete before clicking this button to Get a new version of the problem" )
    if    not ($guest or $observe) ;

Is there a way to insert a line break to make the text multiple lines and thus a bigger button? I'd like to tell the student to clear only the cache and not the history, etc.

Is it possible for me to insert instructions in text around the button?

Thanks

The updated link to the problemRandomize.pl.html POD file is https://demo.webwork.rochester.edu/wwdocs/pg/macros/problemRandomize.pl.html.

The way that macro works is that is does not change the actual problem seed that is given to PG.  What it does is stores a new seed in a hidden input of the problem main form.  It retrieves the seed from there when problems are submitted.  Since the PGalias object is initialized (and determines unique file names for generated images using the PG problem seed and other factors) before the problemRandomize.pl macro is even loaded, the seed that the problemRandomize.pl macro is not used.

It is not that the images do not get the right name, it is that the name is not changed when problemRandomize.pl reseeds.

There certainly is not a way to force the browser to clear its cache from the page.  That would be a major security vulnerability, and browsers will not allow that.  There are ways to force the browser to not use its cache for the loading of a particular resources.  I am not certain how to make that work right off hand, but you could look into it.  This is usually done by adding an html url timestamp parameter.

Thanks - we're getting closer to speaking the same language. Your patience is appreciated.

I used the suggestion you made when coding several other problems in the same problem set, which was illustrating scaling and shifting of functions. Generate a collection of graphs and randomly choose a subset of them.

I really don't want recode this problem with that form with 30+ graphs. Neither do I want to get into the gory details of the code for ProblemRandomize. I have the description, but I don't know what actually happens when a student hits the "get a new version" button. I tried to find the details and found this link

https://webwork.math.ucdavis.edu/wiki/doku.php?id=how_to_allow_students_to_generate_new_versions_of_problems

which refers to another link

http://webwork.maa.org/pod/pg_TRUNK/macros/problemRandomize.pl.html contains extensive documentation on these options and how to change them.

but when I clicked on this link I got a 404 error. I found one more

http://webwork.maa.org/doc/cvs/pg_CURRENT/macros/problemRandomize.pl.html

but got the same result.

I'd like to have an idea of what happens. Does the problem restart execution with a new seed, or start from the middle, or restart with some modifications?

The problem I've coded works like I want EXCEPT for showing the new graphics. It generates the graphics but doesn't show them. From what you say, they don't get the right name.  Is there anything I can read on this that I might understand?

I can get the graphics to show by forcing the clearing of cache manually with ctrl/shift/delete. Is there anyway to execute this command from the *.pl file?

Thanks

The "built in" randomization that I meant is the "Enable periodic re-randomization of problems" option. With this the students are only allowed a limited number of attempts (the default is 5, but you can change that either course wide or per problem), and then the students are given a new version of the problem with a new seed. This eliminates guessing, as the student is given a new version of the problem with different random parameters after the limited number of attempts are used up.

The same as with the problemRandomization.pl macro. Your PGcourse.pl allows you to do this only after the set due date because it only activates the macro at that time. This is currently not an option with the built in randomization.

After doing some testing I see that the PGalias is initialized before the problem code is run. So my suggestion of adding $envir{problemSeed} = $main::problemSeed won't work. Unfortunately, that means there is no work around to the limitations of the problemRandomization.pl macro in this situation.

You could generate static images of all of the possible graphs (there are only 30 of them), and then just load those. That would work since each file would have its own file name.

I added  $envir{problemSeed} = $main::problemSeed  after the load macros - no change

I thought "Enable periodic re-randomization of problems"  rerandomized after a selected number of attempts determined by the next setting:

The default number of attempts between re-randomization of the problems ( 0 => never)

This was to prevent students from guessing and eliminating possible answers to initial parameters of the problem.

I don't understand what you mean with a "built in" randomization. I want a new random set of parameters only after the student has been graded on the problem, and every time s/he hits the get a new version.  Can you tell me  what code to insert? I've been coding Webwork problems for 7 years now, for 10 different ECE courses. And I'm really not understanding the solution that you propose.

If a phone call or a zoom session would be better, I'm fine with that.

I am not sure what you mean by being on different wavelengths. You are using many things here that are outdated, and I am just advising that you update some things.

I know what you are using problemRandomize.pl for.  The point is that most of what is offered by that macro is done better by the built in problem randomization.  This is available from the course configuration options.  Under "Optional Modules", set "Enable periodic re-randomization of problems" to be True.

In any case, the answer to my question as to whether or not you are using problemRandomization.pl is macro via PGcourse.pl is yes.

Did you try adding

$envir{problemSeed} = $main::problemSeed

to the beginning of your problem? Add that right after the loadMacros(...) call.

Wow! We're on different wavelengths. In order to allow the students to get a new version of the problem for practice after the problem set has closed, I use the PGcourse.pl, which I believed was standard. That produces a button on the problem page that says "Get a new version of this problem" I'm not testing my own code. I want to give the student a chance to work a different version of the same problem. In this case, the student should identify a simply sine wave from a collection of graphs.

I checked the PGcourse,pl macro that I have been using for a long time, but never looked at because it did what I wanted. I'm clearly out of my league on coding this myself, but it looks like it is supposed to do what I wanted. There are two calls to problemRandomize. The last appears to be what I've been getting and was happy with, except for the graphics. Any help is appreciated. Here is my PGcourse.pl

##  PGcourse.pl Dick Lane, mildly revised with Davide Cervone's help 2011-06-23

##  Put into templates/macros folder for a course (upload using File Manager).
##  Use by having last item of loadMacros be 'PGcourse.pl' (after a comma).

##  Note: usual path for loading macro files includes an identically-named file
##  which does nothing; problem files which explicitly load PGcourse.pl will be
##  usable by any course, independent of the course having its own version.

sub _PGcourse_init {};		####	Don't reload this file.

$guest   = ($effectivePermissionLevel == -5) ;	####	practice user

####	Presume that faculty observers are given TA status (permission 5).
$observe = ($effectivePermissionLevel >=  5) ;	## TA or Professor (perm = 10)

loadMacros( "problemRandomize.pl" ) ;

####	Allow a Guest or Observer to always get a new version of problem.
ProblemRandomize( when => "Always", onlyAfterDue => 0, style => "Button" )
	if	($guest or $observe) ;

##  Allow everybody else (e.g., a student) to get a new version after correct
##  answer(s) to first (scored) version OR after the assignment's due date
$when = (time >= $main::dueDate ? "Always" : "Correct");
ProblemRandomize( when => $when, onlyAfterDue => 0, style => "Button" )
	if	not ($guest or $observe) ;

####	Note: those two uses of ProblemRandomize reflect choices
####	which can be made independently, e.g., this file can be changed so that
####	a course invokes one while the other is commented-out (or zapped).

####	Always allow observer or teacher to View Source Code for problem.
####			loadMacros( "source.pl" )	if	$observe ;
####	commented-out because extra setup needed by an admin with shell access

####	Note: PREP-2011 participants have professor status for each PREP course
####	and can always read a problem's code by invoking Edit Source.

1;