Host reveal.js slides (.html) [Jupyter notebook export] as webpage on non local server - 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

Related

Why are my Altair Data Visualizations not showing up in Github?

https://github.com/rcokeley/data_visualization/blob/main/README.ipynb
I am really new to using Github. I created a Readme file and downloaded it as a .ipynb extension. The visuals are not showing up in Github.
Github's notebook viewer does not execute any embedded Javascript code, presumably for security reasons. Altair charts are rendered via javascript, so they do not appear in Github notebook views.
One way to address this is to embed a static PNG version of the chart in the notebook; this cannot be done without a notebook frontend extension. PNG embedding is done automatically if you render charts using Jupyter's frontend extensions: use alt.renderers.enable('jupyterlab') if using JupyterLab, or alt.renderers.enable('notebook') if using Jupyter Notebook. Note that both these approaches require correctly-configured Jupyter frontend extensions to be installed; see https://altair-viz.github.io/user_guide/display_frontends.html for details.

Download Github public assets from CLI and Dockerfile

I'm trying to download the networks models of a Neural Network project used to detect NSFW images. The packed models are available in the assets section of a release at this URL: https://github.com/notAI-tech/NudeNet/releases
I would like to create a DOCKERFILE which download these assets when built. I started using the ADD command, but the files didn't get downloaded entirely (only few kB over the 120 MB of some files). So, I tried in my Linux CLI using wget and curl... But nothing worked as expected. For example the command :
curl -OJL https://github.com/notAI-tech/NudeNet/releases/download/v0/classifier_model.onnx
Starts the download but only download an HTML file instead of the actual ONNX file... It seems Github is doing some kind of redirection and I don't know how I can handle it with curl/wget and finally with the ADD command of a DOCKERFILE ?
I did visit
https://github.com/notAI-tech/NudeNet/releases/download/v0/classifier_model.onnx
in my browser and I did get login page, so apparently it is not publicly available. That would explain why you did get small HTML file (file with login form).
Github is doing some kind of redirection and I don't know how I can
handle it with(...)wget
You need to provide authentication data, I do not know how it is exactly done in this case, but I suspect they might use one of popular methods: basic authentication (see wget options --http-user=user and --http-password=pass) or cookies based solution (see wget options --load-cookies file and --save-cookies file and --keep-session-cookies).
Mentonied options are described in wget man page, which you might access by click link or doing man wget in terminal.

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/

Running IPython Notebook viewer locally

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. :)

Unable to attach certain file types to MoinMoin page?

I configured a a local MoinMoin server and am trying to attach an excel file to a page. Upload for cpp, ods and txt files works fine but pdf, exe, doc, xls and xlsx files DON'T get attached. Once I click the 'upload' button, I get redirected back to the wiki page. When I go back to the Attachments sections I don't see the file attached to the page.
(Running MoinMoin 1.9.3 + Apache2.2 on Windows XP.)
Workaround:
It seems to be an issue only when moin python scripts are called as CGI scripts. I switched to using WSGI in Apache (following instructions from http://code.google.com/p/modwsgi/wiki/IntegrationWithMoinMoin) and am able to upload any file.