"Save and Checkpoint": What notebook state info is "saved"? - jupyter-notebook

I am curious about exactly what notebook state information is saved whenever one clicks "save and checkpoint" in a Jupyter notebook. I know any python changes are saved, but I am wondering if the state of widgets/html that is "displayed" is also saved. For instance: Let's say I have button in the notebook that runs display(HTML(html)) when clicked. If I click that button, display the html, and then save my notebook, will the state of display be saved? Is the state of the notebooks "cells" saved, so that html that is displayed in a new cell is also saved?
Any direction to documentation about the "save and checkpoint" behavior is appreciated. Having trouble finding a detailed description in the Jupyter docs. Thanks!

"Save and checkpoint" is the same as using "Autosave" except that it makes a hidden backup copy on disk (in case you have a later autosave and want to revert). Some plugins can do more with save and checkpoint, like having many checkpoints, but that's not the default behavior.
As for whether it saves the widget state, the answer will sadly be: it depends. For simple, well-written widgets that for example just use #interact; it should. For more complex widgets, it may not because saving arbitrary state is not always feasible.
The best way to know is the following: Write your code in a notebook, save and refresh the page. If it's still there it was saved, otherwise it's not.

Related

Is there a keyboard shortcut in Jupyter Notebook to begin typing in newly created cell?

I assumed that there would be a keyboard shortcut to begin typing within a newly created Jupyter Notebook cell, but I titled my question asking if it even exists to not build any assumptions. If it does exist, please also include in your answer the shortcut to use.
I will try to provide as much relevant information as possible that will help in answering my question:
I installed Jupyter Notebook on my Windows 10 PC from their website (not using Anaconda). I view and edit Jupyter Notebook files in my Google Chrome browser. After running a cell with Ctrl+Enter, I press b to create a new cell below. I would like to immediately begin typing within that cell without having to click inside that cell with a mouse.
Thank you
There is a builtin-shortcut that does exactly what you want. Just enter a cell an press Alt + Enter. This will execute the current selected cell, insert a new cell below it and enter edit mode.
Notice, that this also works if you are not in edit mode.
My setup is a little bit different than yours. Here is a reference.

Leaving edit mode without any changes still leaves markdown text formatted as code

First time using Jupyter Notebook, and I'm following online tutorials to try to understand how they work.
One thing I don't understand is why, after double-clicking in a markdown cell and then pressing Esc to go from Edit Mode to Command Mode, the text is still displayed as if it were code, instead of (formatted) text:
Clicking outside of the cell doesn't change this either - only by running the cell does it turn back to formatted text. But this happens even when I've not made any changes to the cell's contents, and it seems strange to require that the cell be re-run just to exit edit Mode?!
I figured the answer is, simply, that even markdown cells that haven't been edited still need to be (re-)rendered, once one has activated edit mode for them.

Disappearance of all cell outputs of a jupyter notebook in Google Colab

I have a big problem. All cell outputs my Jupyter notebook in Google Colab are deleted. I do not know why, if I accidentally pressed "Restart and run all" or something similar.
Is there any way to restore the state of the notebook from this disappearance of the cell outputs?
Can someone help me? Many thanks for any help
Check the revision history using the File -> Revision history menu.
Slightly old, but adding an answer here anyway. If it doesn't appear in the revision history there you can refresh the page at which the notebooks are present, and the output should reappear even if you had previously cleared it.

How do I avoid losing my text area changes when using vimperator's external editor option with multiple tabs

I use vimperator's external editor functionality via ctrl -i to edit text area fields with gvim. This generally works, but I almost always use this with multiple tabs. I find that I start editing the field with gvim, use another tab (say, to do a google search), go back to my gvim session, modify things, and write and quit the gvim session. However, if I forget to open the original tab from which the gvim session was created before closing gvim, I lose my work. I then have to dig around in my temporary files to find the gvim file I lost.
Other than being careful to re-open the initial tab before closing the gvim session, is there a way to avoid this behavior? For instance, is there a way for the quit gvim instance to write the content to the correct tab even if I don't have it open?
My solution to this is to use drop-in replacement addon for this feature called It's All Text
It is basically standalone addon for this vimperator's feature that does this whole text-field tracking better in the background which allows you to use your browser while you have gvim or any other text editor open.
However it doesn't work for every field.

XCode: The document: "<document name>" could not be saved. The file has been changed by another application"

Since starting to use XCode 4.2 I've more-or-less routinely had the error:
with various substitutions for the filename. This is normally when Xcode is doing an autosave, so it happens seemingly at random. I generally click "Save Anyway" and my recent edits are then preserved, although there is a significant probability that Xcode will then hang. I don't typically lose much when it hangs, other than a minute to shoot it and get it to restart, but still...
I don't open any of these files in any application except XCode. I have not been able to figure out the pattern, although it may have to do with popping back and forth between files. The last time I noticed it, I also noticed that the previous round of edits to that file hadn't taken. So some other editor had not saved the file.
Enough preamble: here's the question:
Are others running into this? Has anyone narrowed down what causes it? Is there a setting I can change to prevent it? Is there something I can change in my behaviour?
You will get this happening when
1) There are locally unsaved modifications (the navigator icon will be shaded)
2) AND something else has changed the file outside of Xcode. For me this occurs when I do an external update from svn on the command line or via Versions
What do you have that is modifying and saving the file outside of Xcode? Anything?
Check your source control (if any) and figure out if something you are doing is causing the conditions to be met.
Well I had the same problem when I was trying to Localize my files. Then I noticed that every time the message was popping up was because the icon of the selected file in the Project Navigator was grey, which means that was not saved. So what I did was to save the file (Cmd+S) before doing the action that made the "changed by another application" message to appear, in my case the Localize button.

Resources