Jupyter opens .ipynb as plain text instead of showing interactive cells - json

My laptop was shut down when it ran out of battery while I was editing the ipnyb file in the Jupyter notebook, now when I am trying to open my ipnyb file in jupyter notebook (anaconda setup), the file is shown as plain text instead of interactive cells.
The file content as shown below: { "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "### This is a file python file'\n", "\n", .................
Is there any way to open the ipnyb file back in the interactive cell mode?

Related

Angular8 How to load resource inside a sub project assets folder in a good practice way?

I'm working with angular 8, I created a sub-project inside the main project. The folder structure looks like the screenshot:
Now I'm working on my sub-proj01, and I want to use an "img" tag to import an xxx.svg file inside the sub-proj01's assets folder.
I tried
<img src="assets/xxx.svg">
, but I got 404 after I run ng serve in the aggregator folder.
and I tried
<img src="projects/sub-proj01/src/assets/xxx.svg">
but I got 404 as well.
So could anybody give me some suggestion that how can I get this? Many thanks!
Go do angular.json file and in the array called "assets" you will put a object with "glob" that define what you wend copy, "input" that define the path of your subproject assets, and output" that is the final destine to copy everting.
"assets": [
"src/favicon.ico",
"src/favicon.png",
"src/assets",
{
"glob": "**/*", //COPY ALL THINGS
"input": "projects/subproject-name/src/assets", //OF THIS DIRECTORY
"output": "/assets/" //TO THIS DIRECTORE ROOT
}
],

Upload linked Revit models for Forge Viewer

How can I upload a Revit model that contains multiple Revit files, where one of them is a main file and the remaining are linked files into Forge Viewer?
I've uploaded separately and they show as different files in the bucket and the viewer. Can we have one combined file to be viewed in the Forge Viewer?
A ZIP file can help you do such thing. You can pack them in a single .zip file, then upload it to Forge Data Management Service.
While submitting a translation job to the Forge Model Derivative Service, your job configs should contain two extra parameters compressedUrn and rootFilename, for example:
{
"input": {
"urn": "dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6bW9kZWxkZXJpdmF0aXZlL0E1LnppcA",
"compressedUrn": true,
"rootFilename": "myAwesomeHostFile.rvt"
},
"output": {
"formats": [
{
"type": "svf",
"views": [
"2d",
"3d"
]
}
]
}
}
Afterward, those RVT files will be translated into a single derivative, you can see all linked file contents in the viewer via a single URN.

Convert .json to ipynb

I am taking a course that uses ipython notebook. When I try to download the notebook (through File -> Download as -> ipython notebook), I get a file that ends with ".ipynb.json". It doesn't open as an ipython notebook but as a .json file so something like this:
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"---\n",
"\n",
"_You are currently looking at **version 1.1** of this notebook. To download notebooks and datafiles, as well as get help on Jupyter notebooks in the Coursera platform, visit the [Jupyter Notebook FAQ](https://www.coursera.org/learn/python-data-analysis/resources/0dhYG) course resource._\n",
"\n",
"---"
]
},
...
}
I've tried deleting the ".json" in the file name and it doesn't work. How can I convert this file back to something that can be opened and run as an ipython notebook? Thank you very much!
My Solution: just remove the filename extension .json. for example, change myfile.ipynb.json to myfile.ipynb. Then, you can open it by a click in jupyter notebook !
I have encounter the same problem as you did. I found a link that describe what ipynb exactly is. see here http://ipython.org/ipython-doc/rel-1.0.0/interactive/nbconvert.html. It says ipynb file is actually json file. Hope this
On the Mac you could go and
Right click on the filename.ipynb.json
Click on Get Info from the list.
From the Get Info window, find the section Name&Extension remove the extension/suffix .json from the file name.
Hope that helps!
Are you trying download this from Github? Especially on Google Chrome browsers, I've had issues download .ipynb files using right click > Save link as... I'm not sure if other browsers have this issue (Microsoft Edge, Mozilla Firefox, Safari, etc.).
This causes issues since when downloading, it doesn't completely download the file usually and it becomes corrupted so you can't download an IPython notebook that may run properly. One trick when trying to download .ipynb files on Github is to click it, click Raw, then copy everything (Ctrl + A) and paste it into a blank file (using text editors such as Notepad, Notepad++, Vim, etc.) and save it as "whatever_file_name_you_choose.ipynb". Then you should be able to properly run this file, assuming a non-corrupted file was uploaded to Github.
A lot of people with very large, complicated IPython notebooks on Github will inevitably run into this issue when simply trying to download with Save link as.... Hopefully this helps!
I opened it as/with nbviewer and then selected it all and saved it as a "txt" file that I then opened in Notepad++. I then resaved it as a file with the extension ipynb and opened it in my jupyter notebook ok.
The easy thing to do is to copy the JSON contents into a notepad and save it again with .ipynb extension
Just remove the .json file extension leaving the .ipynb one, as pointed out by the following related post: https://superuser.com/questions/1497243/why-cant-i-save-a-jupyter-notebook-as-a-ipynb. As #jackie already said, you should consider them as .json files meant only to be edited by the IPython Notebook app itself, not for hand-editing.
Use a simple trick. Let that file get downloaded automatically. Re-download it again then it will prompt you to download and replace that file. At that time, you save that by replacing .json to .ipynb
After downloading the file with ipynb.json, Take the following steps:
Go your terminal/command line window
Navigate to the directory where your file is
Type:
windows OS: rename yourfile.ipynb.json to yourfile.ipynb
Unix/Linux: mv yourfile.ipynb.json to yourfile.ipynb
This work perfectly for me.
i tried this method and it worked. Just copy, paste it in notepad and save as "file_name.ipynb". hope this works for you too.

Hide files with certain extension from specific folder in Sublime Text Editor?

Is it possible to hide all the files with certain extension from some specific folder in your project directory in sublime text editor 3.
I have found another related stackover-flow-question
It's not clear from the documentation, but you can specify folders in the file_exclude_patterns setting in your project file.
Example:
{
"folders":
[
{
"path": "some_folder_path",
"file_exclude_patterns": ["messages/*.md"]
}
]
}
would exclude all files with a markdown extension (.md) from the messages folder, leaving all other .md files to be included in the project, for example some_folder_path/readme.md.
Note that the above could exclude files in a descendant of the project root, so you may want to prefix the project root dir in your setting:
{
"folders":
[
{
"path": "some_folder_path",
"file_exclude_patterns": ["some_folder_path/messages/*.md"]
}
]
}
otherwise, some_folder_path/some_other_folder/messages/*.md would also be affected, because Sublime Text doesn't constrain the patterns to the project root automatically.

Cannot display JSON file created and saved in Visual Studio Code

When I create a file in Visual Studio Code (on a Windows 7 box), add some content, then save it, the content is replaced with the following message:
The file cannot be displayed in the editor because it is either binary
or uses an unsupported text encoding.
My workaround is to create and save the file in Sublime Text, then I can open it, edit it, and save it in VS Code.
What do I need to do to get the file to save with the proper encoding?
Here are the steps I'm taking:
Create a new file in VS Code
Set the language of the file to JSON (bottom-right of editor)
Enter the following
{"menu": {
"id": "file",
"value": "File",
"popup": {
"menuitem": [
{"value": "New", "onclick": "CreateNewDoc()"},
{"value": "Open", "onclick": "OpenDoc()"},
{"value": "Close", "onclick": "CloseDoc()"}
]
}
}}
Save the file as test.json
This is a bug in VS Code that has been fixed and will be available in the next update. Sorry for that! It does not happen for all file types, but for JSON unfortunately.
Update
Meanwhile new versions have been released that fix the issue.
This is a bug in VS Code. If you are running into it, rather than setting the language of the file, save the file with the .json extension, and VS Code will detect the language and correctly display the file.
I've submitted the bug here:
https://code.visualstudio.com/issues/detail/16781