Running IPython Notebook viewer locally - ipython

Im trying to introduce IPython notebook in my work. One of the ways I want to do that is by sharing my own work as notebooks with my colleagues so they would be able to see how easy it is to create sophisticated reports and share them.
I obviously can't use Notebook viewer since most of our work is confidential. I'm trying to set up notebook viewer locally. I read this question and followed the instructions there, but now that nbconvert is part of IPython the instructions are no longer valid.
Can anybody help with that?

You have a couple of options:
As described above convert to HTML and then serve them using a Simple server e.g python -m "SimpleHTTPServer" You can even set up a little python script that would "listen" in one directory. If changes or new notebooks is added to the directory the script will run nbconvert and move the HTML file to the folder you are serving from. To navigate to the server you are running go to yourip:port e.g. 10.0.0.2:8888 (see the IPython output when you run the IPython notebook command) (If you can serve over the network you might just as wel look into point 2 below)
If your computers are networked you can serve your work over the lan by sharing your IP address and port with your colleagues. This will however give them editing access but should not be a problem? This means that they will navigate to your ipython server and see the ipython notebook and be able to run your files.
Host your notebooks on an online server like Linode etc... entry level servers cheap. Some work is needed to add a password though.
Convert to PDF and mail it to them.
Convert to a slideshow (now possible in Version 1.00) and serve via option 1,2 or just share the HTML file with them.
Let them all run ipython notebook and check your files into a private repo at bitbucket (its free private git repo). They can then get your files there and run it themselves on their own machines.Or just mail it to them. Better yet if they wont make changes share a dropbox folder with everyone. If they run ipython notebook in that folder they will see your files (DANGEROUS though)
Get them in a boardroom and show them. :)

Related

Jupyter dashboard freezes when opening path which contains many files

I'm using jupyter dashboard to browse files in remote linux server. But it often become slow or even frozen when opening directory containing many files (maybe thousands). I wonder is my problem common? Is there any extensions to solve this, maybe allowing user to browse by switching pages?
Thank you for answering my question.

How can you sync/share files from one computer to another in VS Code?

I am using 2 computers to code in VS Code, but I want to sync a specific file when I edit it in both computers. Do you have any extensions, or servers that allows it to sync?
I tried looking in Google, some said try FTP, and some said use "Settings Sync". (I installed Settings Sync, but I don't really know if it can sync my files.)
Option 1
Use vscode remote development.
Select main machine which would host all the files and use SSH to access the files from the other machine.
Option 2
Rsync is a standard linux tool which can be used.
Use can use vscode rsync extension for syncing the files from one machine into the other.
I think that the closest experience to what you have in mind that you can get currently on VSCode is Visual Studio Live Share. This is an official extensions suite that lets you share your screen with multiple hosts, it also shares most of your current VSCode editor features (like intellisense) and can be enabled with voice and text chats. I would also suggest to set up a git repository for the files you are going to work with, so that hard copies of all your files will be avaialble to all your users.

Host reveal.js slides (.html) [Jupyter notebook export] as webpage on non local server

I am currently working on a Jupyter Notebook.
I managed to export it as reveal.js slides (.html) and host it on my local server. I used the following command line in the terminal:
jupyter nbconvert <mynotebookname>.ipynb --to slides --post serve
It generates a <mynotebookname>.slides.html file and opens it in my browser, where I can navigate properly through the slides (as seen in this example on https://revealjs.com).
However, if I upload this file to my 'web' folder at my University's server (where I usually upload any html files that I want to see as a webpage) I get a single scrollable page with the content of my notebook. It doesn't present the same slide perspective as on the local server.
I would like to make it available as a webpage so that I can share it with other people.
What am I missing?
I finally managed to find the solution by using the command below:
jupyter nbconvert <mynotebookname>.ipynb --to slides --reveal-prefix "https://cdn.jsdelivr.net/npm/reveal.js#3.6.0 "
This way the generated slides.html file will render the slides correctly in your browser, whether the file is on your local machine as a standalone file or at a webserver/github/bitbucket being displayed as a webpage.
I wasn't aware that when not using --post serve it is necessary to point the reveal-prefix to some reveal.js library available at a CDN (content delivery network). Apparently --post serve does that for you. As an alternative it is also possible to point to a local reveal.js library.
Here are some links that helped me reach this solution. They contain some additional commands that may be useful while converting your notebook to slides.
https://github.com/jupyter/nbconvert/issues/157
https://medium.com/learning-machine-learning/present-your-data-science-projects-with-jupyter-slides-75f20735eb0f
https://github.com/jupyter/nbconvert/blob/master/docs/source/usage.rst
http://www.damian.oquanta.info/posts/using-a-local-revealjs-library-with-your-ipython-slides.html

How to deploy my project to localhost?

I'm working on a website and right now I am using FileZilla to make changes to it. Every time I make a change, I have to re-upload the file to the website through FTP and then wait for it to update online. I want to just deploy my project to localhost so I can get instant results and then just upload the whole project when it's finished. How do I do this? All I have is a set of directories with the files in them.
You really need to use a web/application server such as IIS/Apache.
For PHP projects go for WampServer/XAMPP.Easy to setup and works very well.
(maybe too obvious)
If you are working only static content based on html/css/js you can just edit and view changes directly by opening the local file in your browser and refresh each time.
Furthermore for css and html you can edit your code "live", directly into browser and see changes immidiately.
Another option is to edit files with an editor that supports ftp like notepad++, you can connect via ftp, open and edit files directly from server (like php,html,css,js) because once you save the editor will automatically upload your changes.
Heres a good explanation about notepad++ and ftp plugin.
Localserver
If you work with php (and even only with html/css) the best choise is to run a local server that rappresents a real environment in which your code will run. As said by others XAMPP is a good choise for begginers because of simple installation and management.
XAMPP download
XAMPP tutorial
Once installed put your folder inside C:/xampp/htdocs/yourCodeFolder
Run the xampp control panel and start the Apache server.
Finally navigate with your browser to: http://localhost/yourCodeFolder/

options "--read-only" Ipython Notebook

I can't run my ipython notebook with the --read-only option.
It says :
[NotebookApp] CRITICAL | Unrecognized flag: '--read-only'
It's weird because I've seen several blog mentionning it.
I'm running with the 1.1 version of ipython.
Do you know if this option was removed or moved elsewhere?
There is a super easy way to do what you're trying to do I think though--simply use OS security.
Do this:
When you're ready to deploy to read only, make a special folder
for your read-only work, and copy your *.ipynb files into that.
Make the *.ipynb files read-only at the Linux level: chmod 444
*.ipynb.
Run iPython Notebook from that directory. Use a different port
so that it won't conflict.
Send the URL to everyone using the URL that has the read-only
port.
They can then read it all, even run code, but they will not be
able to save changes.
They cannot navigate anywhere outside that directory. E.g. the
little home icon only brings them to the folder with your read-only
content.
Thus they have full access to the page and its functionality, but
cannot mess it up on anyone else. And all you need is a cp and a
chmod. Profit!
At least this solved my need. I have my regular port with write authority for all my development, then I copy it over, chmod it, and let people at it. Works just fine for me.
Hope this helps others!
Yes the option was removed, it might be re-introduced in another form later when nbconvert/nbviewer is refined, but you better run your own local instance of nbviewer to this effect.