When I open a saved IPython Notebook, I need to evaluate all the cells with imports, function definitions etc. to continue working on the session. It is convenient to click Cell > Run All to do this. But what If I do not want to re-evaluate all calculations? Do I need to pick the cells to evaluate by hand each time?
For this problem, Mathematica has the concept of "initialization cells". You can mark some cells in the notebook as initialization cell, and then perform "evaluate initialization cells" after opening the notebook.
Does the IPython Notebook have a similar solution?
First, when you open an IPython notebook, this does not mean the state of the kernel is lost,
unless you restarted the server or explicitly stop the kernel.
Otherwise, there are no marked cell, but there is a "run until here" on dev version.
Also if you are using dev version, using Cell Toolbar /metadata and I would say ~30 line of javascript it should be doable.
I suggest you open an enhancement request on main issue tracker. This could typically be made as an extension during a sprint and/or a blog post to explain internal of notebook.
If you're using the latest and greatest of the notebooks (mine is > 4.1), the feature you requested is available through an extension.
The extensions, as well as an interface that can be conveniently used to enable/disable each individual extension, can be installed as follows
$ git clone https://github.com/ipython-contrib/IPython-notebook-extensions.git
$ cd IPython-notebook-extensions
$ ./setup.py
When you have installed the extension, start the notebook server
$ cd ; jupyter-notebook < /dev/null > .jupyter.log 2>&1 &
and go to the extension management page
$ xdg-open http://localhost:8888/nbextensions
In the recently opened browser window, enable the "Initialization cells" extension.
If you open now a notebook of yours, in the toolbar you will see a new icon, similar to a hand-held calculator and in the View/Cell Toolbar a new entry, Initialisation Cell.
Enable this menu entry and click on the cells' toolbar which ones you want to mark as an initialization cell (possibly remove the cells' toolbar) and click on the icon previously described...
When you load a notebook, the initialization cells are automatically run, so that if you want you can place them in a convenient place, say the end of the notebook if you're like me...
Related
I know this will sound remedial, but I'm following the instructions on the iTerm site as best I can, but I think they're too outdated.
From the example scripts I'm testing the install of a JSON pretty print script, which links to this page for how to install.
After starting this script, navigate to Preferences > Profiles > Session. Turn on Status Bar Enabled and select Configure Status Bar. Drag the Status Bar Demo component into the bottom section. Select it and then click Configure Component
Now, the "Status Bar Demo component" component no longer exists. The script and action components that are in the current build (3.x) do not have an obvious way to specify the script.
When I do specify it the path where I downloaded it, it fails — which I presume is because the .its is a binary. Double-clicking the binary brings up some Finder(?) Security install dialog. When I read through the binary file I see strings about apple certificates and such, so I assume this binary is a signed zip file/package that includes the py script that does jsonpretty.
I do the security install, and then the unpacked .py file is at a file path I can target. I make that the target of a Status Bar component (script button), again following how to install. Clicking the component button in the status bar still fails, though. Selecting JSON text in the iTerm console, or selecting no text, doesn't have how it fails.
Where do I go from here to do an installation of the script?
I can't find an answer to this anywhere on the web.
In Notepad++ the copy/paste functions do not work NOW! They did before (until now).
The keyboard shortcuts do not work, but here is part of the issue.
On the menu at the top the cut and paste items are grayed out (so do not function there either).
At the shortcut mapper there are no entries for cut and paste (supposed to be at the top but are not anywhere).
These functions work OK in Windows so it is not a Microsoft problem but a Notepad++ problem exclusively.
Tried the following:
Closed all files and the program.
Restarted the program and tried again.
Downloaded the latest version and installed it. Tried again.
Help
Not sure what the real problem is, so bare with me,
First I'd check your bindings are set.
Open Notepad++,
Select "Macro" drop down menu, and click "Modify Shortcut/Delete Macro..."
Navigate to the "Scintilla commands" tab,
Here you can use the filter at the bottom of the window to find specifics,
e.g, "Copy" or "paste" and set your key-bindings.
My Copy is "Ctrl+C or Ctrl+INS" and Paste is "Ctrl+V or Shift+INS" by default.
It's not uncommon for third-party applications/processes to block certain features, also check the directory you installed it to, as sometimes permissions may block features, too.
Hope this helps.
I don't know why this ticket is still open but this was first on my Google list.
My issue was that I had "Set Read-Only" enabled on the "Edit" menu.
I've lost a day's work in Jupyter Notebook because it didn't autosave. As I was working, I would click on File > Save and Checkpoint to be safe. I closed the notebook when I finished working and when I tried reopening it, I see that essentially all my work is gone and it says Last Checkpoint: a day ago (autosaved) next to the filename. I now realize that I had been working for a long time on the notebook with an orange box with some kind of error message. I'm sorry that I can't remember the specific message right now, but I think it was something involving POS or POST or POSIT ...?. I saw Trusted next to the error message, so I must've thought things were OK.
I tried opening the filename-checkpoint.ipynb file within the .ipynb_checkpoints folder but it's blank. I looked up a possible solution on Recovering from a Jupyter Disaster, but it requires SQL, which I don't know. Is there any hope for recovering my work? I realize that this is probably a rookie mistake, but I'm pretty new at this.
Thanks
PS: I'm running Python3 on MacOS
Hope you've already found how to recover lost work from Jupyter notebook work. If not, try the following:
Go to Anaconda Navigator (the green circle!)
Launch a Jupyter Lab
In Jupyter Lab, open a Terminal window
Launch iPython in the terminal by typing ipython and hitting enter
Hit Up arrow
All your code are stored in history and each cell compilation that you would've done in the past shows up there.
Copy+Paste it back to a new Jupyter notebook and you are ready to go again!
If you want to copy/paste.
After running terminal and ipython, page_up yo code you want. Click right button on a mouse, then Watch the elements code. Now you can select code, copy and paste it.
If you don't have Anaconda Navigator you can do access the same data the manual way:
open a new ipython terminal
type %history -g -f history.txt
This will output the entire history of edits which are saved in history.sqlite in your IPython profile folder. You can scroll down to the bottom to find your most recent edits.
You can also just explore the history.sqlite directly, which is located in your IPython profile. The profile should be inside .ipython in your user directory (windows and linux).
Thanks to Christian Long's answer on another question for providing this info.
In Jupyter Notebook, when I highlight text either from within a cell in the notebook or from outside the notebook, Middle-Button click doesn't paste anything as it is supposed to do in many other applications in linux. Is there any setting that would allow one to be able to paste with a Middle-Button click into an Ipython or Jupyter Notebook?
I'm using the notebook in firefox if that matters.
The fact that you're using Firefox definitely matters. See this issue on CodeMirror (CodeMirror is the text editor that Juypter uses): Issue #931
In that thread, it references this Firefox issue: https://bugzilla.mozilla.org/show_bug.cgi?id=846674
It seems as though the issue has only recently been fixed, so it may take a little bit to trickle into CodeMirror. You may want to comment on the issue in CodeMirror to inform them that the issue has been fixed on FF and it might prompt them to investigate.
However, Jupyter doesn't automatically use the most recent version of CodeMirror so again you may have to wait a while. If this issue is truly critical then I suggest switching to another browser.
I am using Zenity 3.10.2 and any time I use Zenity, regardless of dialog type, the dialog it brings up has focus. i.e. I can straight away press "Enter" straight away and proceed. (I need this ability for automation)
However, there is one exception and it is very difficult to test. It occurs during the KIWI installation of a custom Linux distro and involved a question dialog being created with no focus. Neither enter nor tab have any effect.
There is a bash script which creates this dialog. When I run this in all other contexts, It has focus, but in this install it does not, the cursor appears in random places all around the place. However, from what I can see, the whole point of Zenity is on-top, already focused dialogs.
The actual call to create the dialog is the result of sourcing a file that has the bash script in it i.e. ". ~/.bashrc". Even this approach, always works when I test it manually.
Any ideas as to what could cause a Zenity dialog to be created without focus? Or any way using just Zenity to reclaim / change the focus?
I am aware you can use a window manager such as wmctrl to bring the Dialog to the focus. However this currently not a used package and shouldn't have to do anything else as this is just a simple dialog.
WINDOWMANAGER=/usr/bin/gnome-session
Any guidance would be much appreciated!