diff --git a/module2/exo4/example.md b/module2/exo4/example.md new file mode 100644 index 0000000000000000000000000000000000000000..c596d5188bb3279671e697423b8b2a06690d92be --- /dev/null +++ b/module2/exo4/example.md @@ -0,0 +1,27 @@ +# Example of Hydrogen Usage + +```kotlin +println("Hello World!") // I use the kotlin kernel +``` + +Kotlin allow to `html` outputs: +```kotlin +HTML("

This is the Header !

") +``` + +```python +print('Hello World!') # I use the python kernel +``` + +You can also use pyplot or graphical ouputs : +```python +import matplotlib.pyplot as plt + +%matplotlib inline +plt.plot([2, 3, 4, 5]) +plt.show() +``` + +```bash +hostname +``` diff --git a/module2/exo4/example.png b/module2/exo4/example.png new file mode 100644 index 0000000000000000000000000000000000000000..56fc3fec304fdbbd75bf7cc9dddbde57beb4f1ab Binary files /dev/null and b/module2/exo4/example.png differ diff --git a/module2/exo4/journal.md b/module2/exo4/journal.md new file mode 100644 index 0000000000000000000000000000000000000000..d17d0984004ba22fda96914962535f18b6b9ff6f --- /dev/null +++ b/module2/exo4/journal.md @@ -0,0 +1,62 @@ +# Hydrogen : An alternative to Jupyter + +## Installation + +[Hydrogen](https://nteract.io/) is an extension for [Atom](https://atom.io/) editor. It works with [Jupyter](https://jupyter.org/) and multiple languages. + +To install atom use the link above to download atom. I recommand to use conda to install python and jupyter. Install the last nodejs version from [here](https://nodejs.org/en/). + +Once you have installed Jupyter, Node and Atom you can install hydrogen : + +```bash +apm install hydrogen +``` + +## Usage + +For each language you have to install the grammar in Atom and the kernel in Jupyter. For the most common languages it's generally easy to find both. + +### Example + +To install allow Hydrogen to handle the Kotlin language, I search `language kotlin` in the package manager of atom (menu `Edit > Preferences > Install`). + +I found this one [atom-kotlin-language](https://github.com/alexmt/atom-kotlin-language). You must verify that the package contains the language grammar. If you know the package name you can install it with apm (Atom package manager) : + +```bash +apm install language-kotlin +``` + +After that I install the kotlin kernel available on [github](https://github.com/Kotlin/kotlin-jupyter): + +```bash +conda install kotlin-jupyter-kernel -c jetbrains +``` + +When the both tasks are done you can know execute the code in block comments by pressing `Ctrl + Enter` in the block section : + +```python +print("Hello World") +``` + +```markdown +​```kotlin +println("Hello World") +​``` +``` + +![Kotlin run example](run_kt.png) + +You can use multiple languages in the same document, as the kernel is choose by the language name, i.e. the code block : + +```markdown + This block will call python interpreter +​ ```python + print('ok') + ``` + This block will call kotlin interpreter + ```kotlin + println("Ok") + ``` +``` + +You can find an usage example at [usage](example.md) and view the [result in the IDE](example.png) diff --git a/module2/exo4/run_kt.png b/module2/exo4/run_kt.png new file mode 100644 index 0000000000000000000000000000000000000000..46e67ecb51302b165ec58d286bb1b5074ffaab6b Binary files /dev/null and b/module2/exo4/run_kt.png differ