FAQ, Tips and Tricks¶
In this section we will present some CoCalc features and useful tricks that will make the management of your project easier and answer some common questions.
- Text fields generally support Markdown and LaTeX
- Making multiple assignment folders quickly
- Starting up everyone’s project before class
- Restarting a project
- Using Git
- Time Travel Diffs
- Run Terminal command in all student projects
- How exactly are Assignments copied to students?
- Invite Students Without Having Their Email Addresses
- Verifing Student Activity
CoCalc not only facilitates the creation of LaTeX documents, but most input areas in CoCalc support and render LaTeX and markdown (specifically GitHub Flavored Markdown).
For example, you can use LaTeX math formulas in the chat rooms:
which renders as
However, such a method could be quite time consuming when you need to create multiple folders, subfolders, and documents. If you are a terminal fan you could create a shell script in your preferred programming language and run it from the terminal.
Alternatively, in the files menu of your project, you can enter paths such as assignments/assignment1/directions.md then hit enter or ctrl+enter to create directions.md inside the folder assignment1 within assignments. Hitting enter will open up the new file while ctrl+enter will silently create the necessary files and folders in the path.
You can also create folders here just by ending with a /
By default, projects have an idle time of 24 hours before they spin down and need to be restarted. However, it may be handy to start everyone’s project before a class or presentation so that they are all “hot loaded”.
You can easily do this from your course manager: first, open the course configuration tab:
Then scroll down to find and click on the Start all… button
Every time you open a Jupyter notebook or a Sage Worksheet, its state is stored in memory. This can become quite costly if you open multiple files one after the other (e.g. when you are marking your students’ work).
To solve this, you can stop every instance using the stop button (for both Jupyter notebooks and Sage worksheets) once you are done with your marking.
Alternatively, you can restart the entire project, which will clean everything. You just need to go to your project settings and click on Restart project.
CoCalc support for the terminal enables students (and instructors) to collaborate using Git within a course-affiliated project.
If you already have a project or some files allocated in GitHub you can add them to your project. Click on the New button and add/paste the link to your repository in the appropriate text box. Click on the Download from Internet button.
Also you can use the terminal to commit and push changes to your repository in GitHub. (see howto: Git Version Control)
You need to have internet access enabled in your project.
The editor based documents (e.g. Python code, LaTeX documents, markdown files, etc.) as well as Jupyter notebooks and Sage worksheets are Time Travel Diffs supported. The Time Travel Diffs feature allows you to see what happened with a file within a certain time interval.
Open up Time travel from any document:
then click on changes and drag the sliders to see the document in a given time interval.
If you need to revert the document to a previous state, drag the slider to the desired revision and click on Revert live version to this. Doing so reverts the document contents to that specific version. If you have checked the Changes box to compare two revisions and click on Revert live version to this, contents are reverted to the latter of the two revisions being compared. Note that reverting a file simply creates a new version of the file equal to the old file at that point in time; in particular, no work is lost!
If you are managing a course, there may be a time when you want to run a shell command in every student project. The following feature allows you to do that, if you are using a .course file for the course.
Configuration tab of the course there is a
Run Terminal command in all student projects. You
can use it to run a command (e.g., to create a file or whatever) in
all projects in a course… It’s a single arbitrary bash command.
When you assign an assignment to your students, it is copied from your project to your students’ projects.
What happens when you assign again.
- For files that have a newer timestamp than the corresponding file in the target directory, the target file is copied to a backup and the new source is copied over.
- For files that have an old timestamp and you’ve already assigned the assignment (and students may have worked on it), nothing at all will happen on copy.
Adding a new file to an assignment.
If you just want to add a new file to an assignment, you could ensure that all the other files are very old, e.g., by using the touch command in a Linux Terminal. E.g.,
touch -d 'Jan 1' *
would make it so that everything appears to be from January 1.
Alternatively, you could just remove the files from the assignment folder, then move them back later.
Behind the scenes.
Assignments are copied with the command:
rsync -zaxs --update --backup [...] source/ dest/
There are two important options here:
--update: do not copy over a file if a NEWER file (by timestamp) exists in the destination
--backup: if the source file `foo` (say) is NEWER than the destination file `foo` (e.g., you edit your homework assignment after students have worked on it), then `dest/foo` is moved to `dest/foo~` and `foo` is copied to the destination.
Assigning an assignment never deletes missing files in the target,
unless you explicitly clicked and confirmed the
Replace student files! button.
This button adds an additional flag:
--delete This tells rsync to delete extraneous files from the receiving side (ones that aren’t on the sending side), but only for the directories that are being synchronized.
Some tests below illustrate how rsync works:
$ mkdir tmp2 ~$ cd tmp2 ~/tmp2$ mkdir a b ~/tmp2$ echo "0" > a/x ~/tmp2$ rsync -zaxs --update --backup a/ b/ ~/tmp2$ ls a x ~/tmp2$ ls b x ~/tmp2$ rsync -zaxs --update --backup a/ b/ ~/tmp2$ vi b/x ~/tmp2$ rsync -zaxs --update --backup a/ b/ ~/tmp2$ ls -lht b total 1.5K -rw------- 1 user user 4 Oct 13 16:27 x ~/tmp2$ more b/x 0 1 ~/tmp2$ touch a/x ~/tmp2$ rsync -zaxs --update --backup a/ b/ ~/tmp2$ ls b x x~ ~/tmp2$
We would like to add a new 3-way merge option, which would be more clever and instead of making a backup file of students modified work, would merge your changes into their file. This is not done yet.
Question: The course management software at my university makes it hard to get a list of student emails. Is there a way I can send them a generic invitation link that they can click to join the course?
Answer: We don’t support sending generic invitations yet (see CoCalc issue #886). However, you can use the following workaround:
Assign fake email addresses to all students in your class, e.g.:: c
Then tell the students to sign up for CoCalc using that “fake” email address. This assumes you have some way to communicate with your students, perhaps in class.
Once students sign up, they will be added as collaborators to their project for the course. At that point, they can change their email address to anything they want, in order to ensure they get @mention notifications, can do password reset, etc.
If student_id’s are secret/sensitive, you could use something derived from them, e.g., the last two digits.
In some situations it may be useful to confirm when work was done in a student project.
- If you open the activity log for a student project, you can see who opened any file and when.
- With any file open in a student project, you can see exactly what was done with it and when by clicking the TimeTravel button, including the total number of edits made to the file (as recorded by TimeTravel) and time and date of the last change. You can click the “Changes” checkbox and see what happened for any range of dates.
- It’s impossible for users to delete or change something once it is recorded in TimeTravel (except by explicitly requesting deletion via a support request). However, it’s conceivable maybe something got lost, since no software is perfect.
- Folders under Backups are snapshots of the exact state of the filesystem, which are independent of TimeTravel, but provide a good double check.