## PREP 2015 Question Authoring - Archived

### Best Practices for saving and storing definition and .pg files

by tim Payer -
Number of replies: 11
Hello!

I have a general question about what is considered the best practice for what directory one saves and or stores a courses definition and pg files.

I am assuming that the definition files are stored in one's templates directory and the *.pg files are stored in the local directory. But I have not seen this spelled out in the MAA website.

Why can't one store both sets of files in the template directory?
If so then what is the point of the local directory?
Is this a common practice?
I understand that neither definition nor pg files should be placed in folders as this makes their contents invisible when transferring the folders to another webwork site (such as to another instructor, or an updated version of webwork).

So given that i will have perhaps 300 plus files that must be kept track of within the template directory all without the use of folders, i am envisioning a rigid naming convention to help keep the multitude of files straight.

For Example: like so, but at perhaps at 10 times the size of this example:

M105_HW_1_prb1.pg
M105_HW_1_prb2.pg
M105_HW_1_prb3.pg
M105_HW_1_prb4.pg
M105_HW_1_prb5.pg
M105_HW_1_prb6.pg
M105_HW_1_prb7.pg
M105_HW_2_prb1.pg
M105_HW_2_prb2.pg
M105_HW_2_prb3.pg
M105_HW_3_prb1.pg
M105_HW_3_prb2.pg
M105_HW_3_prb3.pg
setM105_HW_1.def
setM105_HW_2.def
setM105_HW_3.def
setM105_HW_4.def
setM105_HW_5.def

Does this seem acceptable? I can work with this, but would like to know if there is perhaps a best practices method that is preferred for handling hundreds of file without the use of folders?

Thank you!

### Re: Best Practices for saving and storing definition and .pg files

by Daniele Arcara -
Interesting question, and I am very interested in finding out how people deal with this. If I could figure out now how to best do it, I am sure that it would save a lot of time in the long run.

For now, I have actually decided to use directories, and I am staying away from the local files, because I do not quite understand how they work. This is mainly due to the fact that I am using a WebWork course created by another instructor that still has all of her homework assignments from the last time she taught the course.

So, I created a directory called 'ArcaraFall2015', and within that directory, I am creating a directory for each homework assignment: 'GeometricSeries', 'DivergenceTest', 'TelescopingSeries', …

All .pg files for the homework assignment are inside the corresponding directory. I decided not to number the directories and the problems, so that I do not have to worry about changing the numbers around next year. I did however number the homework sets, so that the students see their homework sets names '01 Geometric Series', '02 Divergence Test', '03 Telescoping Series', and so on.

When I am done with a homework set, and I am satisfied with it, I go to 'File Manager', click on the directory, and then 'Make Archive'. Then, I download it to my Google Drive, so that I can easily move it around to another course, or email it to someone else who wants to use it.

Any thoughts on how to improve my approach?

### Re: Best Practices for saving and storing definition and .pg files

by tim Payer -

So here is a couple of key questions for you.

1.) If you have created a directory for each homework assignment (I too followed this path but have since changed my mind about it) didn't you also have to change the file path to these HW set problems within the HW sets Editor?

I too did this and liked the organization of the file structure, that is until i tried moving the course to another webwork site....

2.) Have you tried moving the course you have created (just to practice) to another webwork site?

I was working with webwork version 2.9 and just for practice I tried moving a few of those sub-directories (using the same format you just described) over to our PREP 2015 course version 2.10. Loading the *.tgz  of these sub-directories over to the 2.10 File manager they unzipped without any problem. The problem was that when I went to the HW Editor to import one or two of the HW sets into our PREP 2015 course, the files were not visible.

To make the loading of the HW set work I had to go back to the file manager, and unload the contents of the sub-directory by affixing a  "../" to rename of each definition file. And then re-attempt to import the HW sets using the Homework set editor. This worked, but it is too laborious.

According to Davide Cervone's reply on my failed attempt he wrote that the sub-directories holding HW set files wont be visible to HW set Editor. Each HW set definition file must be stored as is in the templates directory in order for the HW sets Editor to "see" them and allow us to import them to a new webwork site.

Because of this I have elected to use a rigid naming convention and let the alphabetical ordering of the files within the templates directory help keep the files straight for me.

But I am far from certain that this is the "Best Practice"...

And would like to hear of a better way if possible.

Tim

### Re: Best Practices for saving and storing definition and .pg files

by Daniele Arcara -
I have never tried to move the homework sets to another course. I just gave the following a try:
- Make a .tar copy of my 'GeometricSeries' directory.
- Go to the PREP 2015 WebWork course.
- Go to the File Manager.
- Go to the directory Homework/Workshop3/Arcara.
- It automatically created the directory 'GeometricSeries' with all of my problems inside of it.
- I went to the Library Browser to create a new homework set.
- I selected 'Local Problems'.
- I found the directory 'Homework/Workshop3/Arcara/GeometricSeries'.
- I clicked on 'View Problems'.
- I can now see all of my problems, and I could add them to any homework set.

I am not sure as to what WebWork version our system has, and whether it makes a difference, but everything seemed to go smoothly.

### Re: Best Practices for saving and storing definition and .pg files

by tim Payer -
Thanks Daniele,

You have described an alternate path for loading homework sets in a course through the Local problem tab of the Library browser. I was using the HW Sets Editor directly and meeting with some problems.

I will resurrect my folder organizations and try again. Thanks for the path.

tim

### Re: Best Practices for saving and storing definition and .pg files

by tim Payer -
Hi Daniele,

okay one more time with this approach if you would not mind.
I just want to clarify one point.
When you archived your "Geometric Series" directory did you select the directory called Geometric series and then clicked on archive?
Or did you open the "Geometric Series" directory first and then while viewing its contents only then click on the Archive button?

I think this is the difference.

My problem is that if I select a directory for archiving and it contains a set definition file, the definition file will not be accessible through either the Library browser nor the Homework editor when it unzipped to another webwork site. This would mean going back to file manager and pulling it out of the directory for it to be view-able to the library browser, which would defeat the point of storing the definition file within a directory.

Thanks for any help with this.

### Re: Best Practices for saving and storing definition and .pg files

by Daniele Arcara -
I archived the "Geometric Series" directory by selecting the directory and then clicking on "Make Archive". That said, my directory only contains the *.pg files of the problems, and it does not contain the definition file.

So, I guess that I was only transferring all of the homework problems I made, and I would still have to recreate the homework set in the new course manually…

### Re: Best Practices for saving and storing definition and .pg files

by Davide Cervone -
If you have created a directory for each homework assignment (I too followed this path but have since changed my mind about it) didn't you also have to change the file path to these HW set problems within the HW sets Editor?

Not if your set definition file points to the subdirectories that you are using. As Daniele points out, if you create the set using the Library Browser, your set will have files that point to the subdirectories you created. Then if you save the set definition file using the HW set editor, it will contain references to the subdirectories. If you mob the set definition files and the subdirectories using an archive file, you will be able to move the sets from machine to machine without having to change anything (provided you keep the directory structure exactly the same in the new course templates directory).

the sub-directories holding HW set files wont be visible to HW set Editor. Each HW set definition file must be stored as is in the templates directory in order for the HW sets Editor to "see" them

This is correct. But if your directories are storing a complete homework, I would still move a copy of the set definition file into that directory so that you have all the needed pieces in one location. When you move the directory to the new machine, you would unpack the directory and move a copy of the set definition file to the top of the templates directory. It's an extra step, but it makes it more likely that you won't forget the .def file later on when you move the directory.

Because of this I have elected to use a rigid naming convention and let the alphabetical ordering of the files within the templates directory help keep the files straight for me

I think you will find that to be harder in the long run.

### Re: Best Practices for saving and storing definition and .pg files

by tim Payer -
Thank you Davide!

But I have three follow up questions.

I have stored all the set definition files of my course in the template directory and all the HW problem files in the local directory as you have recommended.

1.) When Archiving and moving to a new site is the standard practice to archive from two directories (the template and the local) ?
That is one will archive the selected sets from from the template directory of site A and then archive a second file for the selected HW problems in the local directory of site A. Then once site B is accessible open the respective directories and upload their respective files. (That is the saved template files of Site A will be uploaded into the new template directory of site B, and the saved local files from site A will be uploaded into the local directory of site B).

2.)  Is there a similar process when one uses the "Archive this Course" option?
That is if I archive the course from the template directory will that necessarily include an archive the local directory that the template directory holds? Or would I have to archive the local directory and then upload it in the new site separately?

3.)  Does it matter that a course created from our recently uploaded version of webwork 2.10 do not have any default local directories?  To accommodate this I simply created a new folder from within the template directory called "local" and then the uploading of the archived files and then course files loaded just fine. But should we be concerned that the created courses do not come with a default local? And does creating a new folder called "local" really behave the same way that a default directory of the same name?

Thank you so much for your detailed responses.

Tim

### Re: Best Practices for saving and storing definition and .pg files

by tim Payer -
Hello Again.

One more follow up question regarding the "Archive this Course" button.

When I experiment with uploading a *.tgz file of an Archived course to the template directory of a new course I am getting a folder for my entire course in the template directory rather than having the contents of the old template directory empty into the new template directory of the new course. So the problem is that the template directory of the new course will have a course folder of my previous course and within this folder will be another template directory and within this template directory will be a local directory. I am fairly certain that this was not the intention of the "Archive this Course" process of saving to a new site.

I am using the "Archive this Course" button when this occurs.

Can you tell what my problem is with this approach?

If I instead save individual files of the old template directory and then upload them to the new template directory and then repeat the process with the old local directory uploaded into the new local directory. Then this process works fine. With this process though, I have to create a local folder to act as a local directory.

Thank you!

Tim

### Re: Best Practices for saving and storing definition and .pg files

by Arnold Pizer -
Hi Tim,

A regular instructor (professor) can archive their own course, but they can not unarchive a course which is equivalent to creating a new course.  After archiving a course, the instructor can download the archive to their own computer and transfer it to someone who has permission to create new courses, e.g. a professor in the admin course.  That person should put the archive in the courses directory (usually /opt/webwork/courses) and then use the Unarchive function of the admin course.

Arnie

### Re: Best Practices for saving and storing definition and .pg files

by Danny Glin -
As Arnie said, archiving a course is something that an instructor can do, but restoring from one of these archives can only be done by the system administrator.

This type of course archive is a snapshot of the entire course.  It will include all of the homework sets, the students, and the students' progress.

As an instructor, the most efficient way to back up your pg files and assignments is probably the following.  Note that this procedure will not include any student data.
1. If you want to include homework sets, make sure that they are exported via the Homework Sets Editor
2. Go to the file manager, and highlight everything you want to back up/migrate (all pg files, def files and subdirectories).  You can highlight multiple files by holding down control in windows or command on a mac while you click.  Once everything you want is selected, click the "Make Archive" button.  This will create a [yourcoursename].tgz file, which you can download to your computer.
3. This tgz file is an archive of all the files you selected.  In mac or linux, you can browse it natively.  On a pc you will need some sort of zip software (I think 7zip handles tar, gzipped files).  Alternatively, if you just want to move things to another WeBWorK course, you can upload the .tgz file to the new course, and the File Manager will automatically expand the archive and put things in the right place.
Hope this helps.

Danny