├── .gitignore
├── .jscsrc
├── DEVELOPERS.md
├── FAQ.md
├── LICENSE
├── NOTICE
├── README.md
├── StartHere.ipynb
├── beakerx-dist
├── MANIFEST.in
├── beakerx_all
│ ├── __init__.py
│ └── _version.py
├── conda_recipe
│ └── meta.yaml
├── configuration.yml
├── requirements.txt
├── setup.cfg
├── setup.py
└── setupbase.py
├── binder
├── environment.yml
└── postBuild
├── doc
├── Cheatsheet.pdf
├── README.md
├── clojure
│ ├── Clojure.ipynb
│ └── NativeLib.ipynb
├── groovy
│ ├── 3D.ipynb
│ ├── AutoTranslation.ipynb
│ ├── BigInts.ipynb
│ ├── BigTable.ipynb
│ ├── CategoryPlot.ipynb
│ ├── Charting.ipynb
│ ├── ClasspathMagicCommands.ipynb
│ ├── CodeCell.ipynb
│ ├── DataVec.ipynb
│ ├── EasyForm.ipynb
│ ├── GeneralAutotranslation.ipynb
│ ├── GeneralDisplay.ipynb
│ ├── Groovy.ipynb
│ ├── Heatmap.ipynb
│ ├── Histogram.ipynb
│ ├── Interactive.ipynb
│ ├── JavaArgs.ipynb
│ ├── JavaWidgets.ipynb
│ ├── JvmRepr.ipynb
│ ├── LevelsOfDetails.ipynb
│ ├── LoadMagicCommand.ipynb
│ ├── MapLikeTable.ipynb
│ ├── Mime.ipynb
│ ├── NativeLib.ipynb
│ ├── OutputContainers.ipynb
│ ├── OutputWidget.ipynb
│ ├── PlotActions.ipynb
│ ├── PlotFeatures.ipynb
│ ├── PlotsPythonStyle.ipynb
│ ├── PolyglotMagic.ipynb
│ ├── ProgressUpdateReporting.ipynb
│ ├── RunCells.ipynb
│ ├── STIL.ipynb
│ ├── SetDomClasses.ipynb
│ ├── ShowNullExecutionResult.ipynb
│ ├── TableAPI.ipynb
│ ├── Tablesaw.ipynb
│ ├── TimingMagicCommands.ipynb
│ ├── Treemap.ipynb
│ └── UIOptions.ipynb
├── java
│ ├── Java.ipynb
│ ├── NativeLib.ipynb
│ └── classpath_add_dynamic_magic_command.ipynb
├── javascript
│ └── usingExternalLibs.ipynb
├── kotlin
│ ├── Kotlin.ipynb
│ └── NativeLib.ipynb
├── nbviewer
│ ├── CategoryPlot.ipynb
│ ├── Heatmap.ipynb
│ ├── Histogram.ipynb
│ ├── JavaWidgets.ipynb
│ ├── TableApi.ipynb
│ └── Treemap.ipynb
├── old
│ ├── DisplayCollection.ipynb
│ ├── DisplayVegaInJupyterLab.ipynb
│ ├── GrapeExample.ipynb
│ ├── GroovyAutocomplete.ipynb
│ ├── MapLikeTable_PythonExample.ipynb
│ ├── OutputCell.HIDDEN.ipynb
│ ├── classpath_add_jar_by_mvn.ipynb
│ ├── map_shortestpath.ipynb
│ ├── parent_message_groovy.ipynb
│ └── parent_message_python.ipynb
├── python
│ ├── AutoTranslation.ipynb
│ ├── CategoryPlot.ipynb
│ ├── ChartingAPI.ipynb
│ ├── EasyForm.ipynb
│ ├── Heatmap.ipynb
│ ├── Histogram.ipynb
│ ├── InitCells.ipynb
│ ├── KernelMagics.ipynb
│ ├── OutputContainers.ipynb
│ ├── PlotActions.ipynb
│ ├── PlotJSAPI.ipynb
│ ├── ScrollZoom.ipynb
│ ├── TableAPI.ipynb
│ └── Treemap.ipynb
├── resources
│ ├── bar-chart.vg.json
│ ├── data
│ │ ├── UScity.csv
│ │ ├── baseball.csv
│ │ ├── flint-demo.csv
│ │ ├── interest-rates-small.csv
│ │ ├── interest-rates.csv
│ │ ├── linear_data_eval.csv
│ │ ├── linear_data_train.csv
│ │ ├── long_lines.csv
│ │ ├── tornadoes_2014.csv
│ │ └── whiskey.csv
│ ├── img
│ │ ├── JVMoptions.png
│ │ ├── USmapbg.png
│ │ ├── atom.svg
│ │ ├── butterfly1.jpg
│ │ ├── butterfly2.jpg
│ │ ├── butterfly3.jpg
│ │ └── widgetArch.png
│ └── jar
│ │ ├── BeakerXClasspathTest.jar
│ │ ├── demo.jar
│ │ └── loadMagicJarDemo.jar
├── scala
│ ├── EasyForm.ipynb
│ ├── Flint.ipynb
│ ├── Histogram.ipynb
│ ├── Plot.ipynb
│ ├── Scala.ipynb
│ ├── Spark.ipynb
│ ├── SparkUI.ipynb
│ └── TableAPI.ipynb
└── sql
│ └── Sql.ipynb
├── docker
├── Dockerfile
├── jupyter_notebook_config.py
├── setup.sh
├── start-notebook.sh
├── start-singleuser.sh
└── start.sh
├── jitpack.yml
└── test
└── ipynb
├── clojure
├── ClojureTest.ipynb
├── EasyFormTest.ipynb
├── InfiniteLoopClojureTest.ipynb
├── XChartingTest.ipynb
├── autotranslation_between_kernels.ipynb
└── autotranslation_for_clojure.ipynb
├── groovy
├── 2ndYaxisTest.ipynb
├── AsyncMagicCommand.ipynb
├── AutoTranslationGroovyTest.ipynb
├── AutotranslationBetweenKernels.ipynb
├── AutotranslationPandasTest.ipynb
├── BigIntsTest.ipynb
├── CategoryPlotTest.ipynb
├── Classpath_magic_autocoplete.ipynb
├── Data_Loading_Modes.ipynb
├── DomClassesSupport.ipynb
├── EasyFormTest.ipynb
├── GeneralAutotranslationTest.ipynb
├── GeneralDisplayMethod.ipynb
├── GroovyTest.ipynb
├── InfiniteLoopGroovyTest.ipynb
├── JavaArgsTest.ipynb
├── JavaWidgets2Test.ipynb
├── JavaWidgets3Test.ipynb
├── JavaWidgets4Test.ipynb
├── JavaWidgetsTest.ipynb
├── KernelAPITest.ipynb
├── MapLikeTableTest.ipynb
├── MavenLogger.ipynb
├── MimeTest.ipynb
├── OutputContainersTest.ipynb
├── PlotGroovyTest.ipynb
├── SupportEnum.ipynb
├── TableAPITest.ipynb
├── TableActionsTest.ipynb
├── TableDisplayStream.ipynb
├── TableDisplayWIthIndex.ipynb
├── TableMenuTest.ipynb
├── TablesawTest.ipynb
├── XChartingTest.ipynb
├── accessible_URL_arguments.ipynb
├── autotranslationPandas.ipynb
├── codeAndMagicsTest.ipynb
├── setRowsToShow.ipynb
└── slqDriver.ipynb
├── java
├── ChartingTest.ipynb
├── EasyFormTest.ipynb
├── HelloWorld.ipynb
├── InfiniteLoopJava.ipynb
├── JavaTest.ipynb
├── TableDisplayStream.ipynb
├── sqlDriver.ipynb
└── stdin.ipynb
├── kotlin
├── ChartingTest.ipynb
├── EasyFormTest.ipynb
├── InfiniteLoopKotlinTest.ipynb
└── KotlinTest.ipynb
├── nbviewer
└── PlotNbviewerTest.ipynb
├── python
├── AutoTranslationPythonTest.ipynb
├── Better_handling_for_pandas_stacked_column_dataframe.ipynb
├── CategoryPlotTest.ipynb
├── ChartingTest.ipynb
├── Data_Loading_Modes.ipynb
├── EasyFormPythonTest.ipynb
├── InfiniteLoopPythonTest.ipynb
├── InitCellsTest.ipynb
├── KernelMagicsTest.ipynb
├── OutputContainersTest.ipynb
├── PlotJSAPITest.ipynb
├── PlotPythonTest.ipynb
├── PysparkExample.ipynb
├── Pyspark_yarn_example.ipynb
├── TableAPIPythonTest.ipynb
├── TableActionsTest.ipynb
├── TableDisplayWIthIndex.ipynb
├── accessible_URL_arguments.ipynb
├── autotranslationPandasPython.ipynb
├── polyglotKernel.ipynb
└── set_font_color_provider.ipynb
├── resources
└── data
│ ├── interest-rates-small-with_index.csv
│ ├── interest-rates.csv
│ ├── kv1.txt
│ └── people.json
├── scala
├── ChartingTest.ipynb
├── EasyFormTest.ipynb
├── Executing_shell_commands_[Linux].ipynb
├── HiveSupportExample.ipynb
├── InfiniteLoopScala.ipynb
├── InfiniteLoopScalaTest.ipynb
├── NativeLib.ipynb
├── PlotScalaTest.ipynb
├── ScalaTest.ipynb
├── SparkScalaTest.ipynb
├── SparkUITest.ipynb
├── SparkUI_example.ipynb
├── SparkYarn.ipynb
├── Spark_no_UI_option.ipynb
├── SupportScalaObjectInAutotranslation.ipynb
├── TableAPITest.ipynb
├── TableDisplayStream.ipynb
├── autotranslation_scala_structured_data.ipynb
├── parquet.ipynb
├── scala_input_output_problem.ipynb
├── spark_mesos.ipynb
└── sqlDriver.ipynb
└── sql
├── SQLTest.ipynb
└── SQL_user_password_Test.ipynb
/.gitignore:
--------------------------------------------------------------------------------
1 | # IntelliJ
2 | .idea/
3 | .iml
4 |
5 | # Jupyter
6 | .ipynb_checkpoints/
7 |
8 | # Gradle
9 | .gradle/
10 | /build/
11 | */build/
12 | gradle*
13 |
14 | # Python
15 | *.py[cod]
16 | __pycache__/
17 | *.egg-info/
18 |
19 | beakerx-dist/dist
20 |
21 | # Eclipse
22 | .metadata/
23 | .settings/
24 | .recommenders/
25 | RemoteSystemsTempFiles/
26 |
--------------------------------------------------------------------------------
/.jscsrc:
--------------------------------------------------------------------------------
1 | {
2 | "preset": "google",
3 | "maximumLineLength": 120
4 | }
5 |
--------------------------------------------------------------------------------
/DEVELOPERS.md:
--------------------------------------------------------------------------------
1 |
16 |
17 | ### Dependencies:
18 |
19 | * [conda](https://www.anaconda.com/download/)
20 | * [yarn](https://yarnpkg.com/lang/en/docs/install/)
21 |
22 | ### Related repositories for JVM kernel development
23 |
24 | * [beakerx_kernel base](https://github.com/twosigma/beakerx_kernel_base)
25 | * [beakerx_clojure kernel](https://github.com/twosigma/beakerx_kernel_clojure)
26 | * [beakerx_groovy kernel](https://github.com/twosigma/beakerx_kernel_groovy)
27 | * [beakerx_java kernel](https://github.com/twosigma/beakerx_kernel_java)
28 | * [beakerx_kotlin kernel](https://github.com/twosigma/beakerx_kernel_kotlin)
29 | * [beakerx_kernel_scala](https://github.com/twosigma/beakerx_kernel_scala)
30 | * [beakerx_kernel_sql](https://github.com/twosigma/beakerx_kernel_sql)
31 |
32 | ### Related repositories for autotranslation development
33 |
34 | * [beakerx_kernel_autotranslation](https://github.com/twosigma/beakerx_kernel_autotranslation)
35 |
36 | ### Related repositories for front-end components
37 |
38 | * [beakerx_base base](https://github.com/twosigma/beakerx_base)
39 | * [beakerx_tabledisplay](https://github.com/twosigma/beakerx_tabledisplay)
40 | * [beakerx_widgets](https://github.com/twosigma/beakerx_widgets)
41 |
42 | ### Related repositories for general development
43 |
44 | * [beakerx_tests](https://github.com/twosigma/beakerx_tests)
45 |
46 | ### Setup your development environment (linux and mac)
47 |
48 | ```
49 | mkdir beakerx-devel
50 | cd beakerx-devel
51 | git clone https://github.com/twosigma/beakerx
52 | git clone https://github.com/twosigma/beakerx_kernel_base
53 | git clone https://github.com/twosigma/beakerx_kernel_kotlin
54 | git clone https://github.com/twosigma/beakerx_kernel_clojure
55 | git clone https://github.com/twosigma/beakerx_kernel_scala
56 | git clone https://github.com/twosigma/beakerx_kernel_groovy
57 | git clone https://github.com/twosigma/beakerx_kernel_sql
58 | git clone https://github.com/twosigma/beakerx_kernel_autotranslation
59 | git clone https://github.com/twosigma/beakerx_kernel_java
60 | git clone https://github.com/twosigma/beakerx_tests
61 | git clone https://github.com/twosigma/beakerx_base
62 | git clone https://github.com/twosigma/beakerx_widgets
63 | git clone https://github.com/twosigma/beakerx_tabledisplay
64 | cd beakerx_tests/dev_scripts/
65 | conda env create -n beakerx-devel -f configuration-lab.yml
66 | conda activate beakerx-devel
67 | ./install_kernels_lab.sh
68 | ./install_lab_local_extensions.sh
69 | cd ..
70 | cd ..
71 | ```
72 |
73 | See [beakerx_tests](https://github.com/twosigma/beakerx_tests) for more details.
--------------------------------------------------------------------------------
/FAQ.md:
--------------------------------------------------------------------------------
1 |
16 |
17 | # FAQs
18 |
19 |
20 | #### JVM fails with not enough memory?
21 |
22 | You may try setting JVM properties. Java allows you to configure the maximum heap size and various other settings with command line parameters when the JVM is started. BeakerX allows you to add parameters to the JVM with a control panel added to Jupyter's tree view.
23 |
24 | 
25 |
26 | Related issues: [#7666](https://github.com/twosigma/beakerx/issues/7666).
--------------------------------------------------------------------------------
/NOTICE:
--------------------------------------------------------------------------------
1 | BeakerX: Beaker Extensions for Jupyter
2 | Copyright 2014-2020 Two Sigma Open Source, LLC
3 |
4 | This product includes software developed at
5 | Two Sigma Open Source, LLC (http://opensource.twosigma.com/).
6 |
--------------------------------------------------------------------------------
/beakerx-dist/MANIFEST.in:
--------------------------------------------------------------------------------
1 | include setupbase.py
2 |
3 |
--------------------------------------------------------------------------------
/beakerx-dist/beakerx_all/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright 2020 TWO SIGMA OPEN SOURCE, LLC
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 |
--------------------------------------------------------------------------------
/beakerx-dist/beakerx_all/_version.py:
--------------------------------------------------------------------------------
1 | version_info = (2, 1, 0)
2 | __version__ = '.'.join(map(str, version_info))
3 |
--------------------------------------------------------------------------------
/beakerx-dist/conda_recipe/meta.yaml:
--------------------------------------------------------------------------------
1 | {% set name = "beakerx_all" %}
2 | {% set version = "2.1.0" %}
3 | {% set kversion = "2.0.0" %}
4 |
5 | package:
6 | name: "{{ name|lower }}"
7 | version: "{{ version }}"
8 |
9 | source:
10 | git_url: https://github.com/twosigma/beakerx.git
11 | git_tag: master
12 |
13 | source:
14 | #url: https://files.pythonhosted.org/packages/source/b/beakerx/{{ name }}-{{ version }}.tar.gz
15 | url: file:///Users/ildipo/src/beakerx/beakerx-dist/dist/{{ name }}-{{ version }}.tar.gz
16 |
17 | requirements:
18 | build:
19 | - python
20 | - pip
21 | run:
22 | - beakerx_base>={{ version }}
23 | - beakerx_kernel_groovy>={{ kversion }}
24 | - beakerx_kernel_java>={{ kversion }}
25 | - beakerx_kernel_scala>={{ kversion }}
26 | - beakerx_kernel_sql>={{ kversion }}
27 | - beakerx_kernel_clojure>={{ kversion }}
28 | - beakerx_kernel_kotlin>={{ kversion }}
29 | - beakerx_kernel_autotranslation>={{ kversion }}
30 | - beakerx_tabledisplay>={{ version }}
31 | - beakerx_widgets>={{ version }}
32 | - python >=3
33 | - notebook >=5.7.4
34 |
--------------------------------------------------------------------------------
/beakerx-dist/configuration.yml:
--------------------------------------------------------------------------------
1 | name: beakerx_all
2 | channels:
3 | - conda-forge
4 | dependencies:
5 | - python =3.7.5
6 | - openjdk=11.0.1
7 | - notebook>=5.7.6
8 | - tornado>6
9 | - ipywidgets>=7.5.1
10 | - nodejs
11 | - pandas
12 | - maven
13 | - py4j
14 | - requests
15 | - pyspark
16 | - bottle
17 | - jupyterlab=1
18 |
--------------------------------------------------------------------------------
/beakerx-dist/requirements.txt:
--------------------------------------------------------------------------------
1 | -e .
--------------------------------------------------------------------------------
/beakerx-dist/setup.cfg:
--------------------------------------------------------------------------------
1 | [bdist_wheel]
2 | universal=1
3 |
--------------------------------------------------------------------------------
/beakerx-dist/setup.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | # coding: utf-8
3 |
4 | # Copyright 2020 TWO SIGMA OPEN SOURCE, LLC
5 | #
6 | # Licensed under the Apache License, Version 2.0 (the "License");
7 | # you may not use this file except in compliance with the License.
8 | # You may obtain a copy of the License at
9 | #
10 | # http://www.apache.org/licenses/LICENSE-2.0
11 | #
12 | # Unless required by applicable law or agreed to in writing, software
13 | # distributed under the License is distributed on an "AS IS" BASIS,
14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | # See the License for the specific language governing permissions and
16 | # limitations under the License.
17 |
18 | import os
19 | from setuptools import setup, find_packages
20 |
21 | from setupbase import (
22 | get_version
23 | )
24 |
25 | setup_args = dict(
26 | name='beakerx_all',
27 | description='BeakerX: Beaker Extensions for Jupyter Notebook',
28 | long_description='BeakerX: Beaker Extensions for Jupyter Notebook',
29 | version=get_version(os.path.join('beakerx_all', '_version.py')),
30 | author='Two Sigma Open Source, LLC',
31 | author_email='beakerx-feedback@twosigma.com',
32 | url='http://beakerx.com',
33 | keywords=[
34 | 'ipython',
35 | 'jupyter',
36 | 'widgets',
37 | 'java',
38 | 'clojure',
39 | 'groovy',
40 | 'scala',
41 | 'kotlin',
42 | 'sql',
43 | ],
44 | classifiers=[
45 | 'Development Status :: 5 - Production/Stable',
46 | 'Framework :: IPython',
47 | 'Intended Audience :: Developers',
48 | 'Intended Audience :: Science/Research',
49 | 'Topic :: Multimedia :: Graphics',
50 | 'Programming Language :: Python :: 3',
51 | 'Programming Language :: Python :: 3.3',
52 | 'Programming Language :: Python :: 3.4',
53 | 'Programming Language :: Python :: 3.5',
54 | 'Programming Language :: Python :: 3.6',
55 | ],
56 | install_requires=[
57 | 'beakerx_base>=2.0.1',
58 | 'beakerx_kernel_groovy>=2.0.0',
59 | 'beakerx_kernel_java>=2.0.0',
60 | 'beakerx_kernel_scala>=2.0.0',
61 | 'beakerx_kernel_sql>=2.0.0',
62 | 'beakerx_kernel_clojure>=2.0.0',
63 | 'beakerx_kernel_kotlin>=2.0.0',
64 | 'beakerx_kernel_autotranslation>=2.0.0',
65 | 'beakerx_tabledisplay>=2.0.1',
66 | 'beakerx_widgets>=2.0.1',
67 | ],
68 | python_requires='>=3',
69 | zip_safe=False,
70 | include_package_data=True,
71 | packages=find_packages()
72 | )
73 |
74 | if __name__ == '__main__':
75 | setup(**setup_args)
76 |
--------------------------------------------------------------------------------
/beakerx-dist/setupbase.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | # coding: utf-8
3 |
4 | # Copyright 2020 TWO SIGMA OPEN SOURCE, LLC
5 | #
6 | # Licensed under the Apache License, Version 2.0 (the "License");
7 | # you may not use this file except in compliance with the License.
8 | # You may obtain a copy of the License at
9 | #
10 | # http://www.apache.org/licenses/LICENSE-2.0
11 | #
12 | # Unless required by applicable law or agreed to in writing, software
13 | # distributed under the License is distributed on an "AS IS" BASIS,
14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | # See the License for the specific language governing permissions and
16 | # limitations under the License.
17 |
18 | """
19 | This file originates from the 'jupyter-packaging' package, and
20 | contains a set of useful utilities for installing node modules
21 | within a Python package.
22 | """
23 | import os
24 | import pipes
25 | import sys
26 | from setuptools.command.bdist_egg import bdist_egg
27 |
28 | try:
29 | from wheel.bdist_wheel import bdist_wheel
30 | except ImportError:
31 | bdist_wheel = None
32 |
33 | if sys.platform == 'win32':
34 | pass
35 | else:
36 | def list2cmdline(cmd_list):
37 | return ' '.join(map(pipes.quote, cmd_list))
38 |
39 | # ---------------------------------------------------------------------------
40 | # Top Level Variables
41 | # ---------------------------------------------------------------------------
42 |
43 |
44 | here = os.path.abspath(os.path.dirname(sys.argv[0]))
45 | root = os.path.abspath(os.path.join(here, os.pardir))
46 | kernel_path = os.path.join(root, './')
47 |
48 |
49 | # ---------------------------------------------------------------------------
50 | # Public Functions
51 | # ---------------------------------------------------------------------------
52 | def get_version(path):
53 | version = {}
54 | with open(os.path.join(here, path)) as f:
55 | exec(f.read(), {}, version)
56 | return version['__version__']
57 |
58 |
59 | class bdist_egg_disabled(bdist_egg):
60 | """Disabled version of bdist_egg
61 | Prevents setup.py install performing setuptools' default easy_install,
62 | which it should never ever do.
63 | """
64 |
65 | def run(self):
66 | sys.exit("Aborting implicit building of eggs. Use `pip install .` " +
67 | " to install from source.")
68 |
--------------------------------------------------------------------------------
/binder/environment.yml:
--------------------------------------------------------------------------------
1 | name: beakerx
2 | channels:
3 | - conda-forge
4 | dependencies:
5 | - numpy
6 |
--------------------------------------------------------------------------------
/binder/postBuild:
--------------------------------------------------------------------------------
1 | conda install beakerx
--------------------------------------------------------------------------------
/doc/Cheatsheet.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twosigma/beakerx/b9c301e37a8b17827f384ee4af83a1e4b4528b43/doc/Cheatsheet.pdf
--------------------------------------------------------------------------------
/doc/README.md:
--------------------------------------------------------------------------------
1 |
16 |
17 | # Documentation
18 |
19 | [Start Here](../StartHere.ipynb)
20 |
--------------------------------------------------------------------------------
/doc/clojure/NativeLib.ipynb:
--------------------------------------------------------------------------------
1 | {
2 | "cells": [
3 | {
4 | "cell_type": "code",
5 | "execution_count": null,
6 | "metadata": {},
7 | "outputs": [],
8 | "source": [
9 | "%classpath add mvn org.nd4j nd4j-native-platform 0.9.1"
10 | ]
11 | },
12 | {
13 | "cell_type": "code",
14 | "execution_count": null,
15 | "metadata": {},
16 | "outputs": [],
17 | "source": [
18 | "(import org.nd4j.linalg.factory.Nd4j)\n",
19 | "( . Nd4j getRandom)"
20 | ]
21 | },
22 | {
23 | "cell_type": "code",
24 | "execution_count": null,
25 | "metadata": {},
26 | "outputs": [],
27 | "source": [
28 | "%classpath add mvn com.github.fommil.netlib core 1.1.2"
29 | ]
30 | },
31 | {
32 | "cell_type": "code",
33 | "execution_count": null,
34 | "metadata": {},
35 | "outputs": [],
36 | "source": [
37 | "(new org.netlib.blas.Daxpy)"
38 | ]
39 | },
40 | {
41 | "cell_type": "code",
42 | "execution_count": null,
43 | "metadata": {},
44 | "outputs": [],
45 | "source": []
46 | }
47 | ],
48 | "metadata": {
49 | "kernelspec": {
50 | "display_name": "Clojure",
51 | "language": "clojure",
52 | "name": "clojure"
53 | },
54 | "language_info": {
55 | "codemirror_mode": "Clojure",
56 | "file_extension": ".clj",
57 | "mimetype": "text/x-clojure",
58 | "name": "Clojure",
59 | "nbconverter_exporter": "",
60 | "version": "1.7"
61 | }
62 | },
63 | "nbformat": 4,
64 | "nbformat_minor": 2
65 | }
66 |
--------------------------------------------------------------------------------
/doc/groovy/BigInts.ipynb:
--------------------------------------------------------------------------------
1 | {
2 | "cells": [
3 | {
4 | "cell_type": "markdown",
5 | "metadata": {},
6 | "source": [
7 | "# Large Integers in Tables and Autotranslation"
8 | ]
9 | },
10 | {
11 | "cell_type": "markdown",
12 | "metadata": {},
13 | "source": [
14 | "JSON has a problem when integers get larger than 1016\n",
15 | "because JavaScript uses floating point for all its numbers.\n",
16 | "Most languages, including Python, R, and the JVM languages like Groovy can easily handle integers up to 1019,\n",
17 | "and sometimes larger.\n",
18 | "\n",
19 | "Numbers this large are useful for measuring time in nanoseconds, for example.\n",
20 | "\n",
21 | "BeakerX table and plot widgets have special support 64-bit and arbitrary precision values. Run these cells, then hover over the columns to see their types."
22 | ]
23 | },
24 | {
25 | "cell_type": "markdown",
26 | "metadata": {},
27 | "source": [
28 | "## 64-bit Longs"
29 | ]
30 | },
31 | {
32 | "cell_type": "code",
33 | "execution_count": null,
34 | "metadata": {},
35 | "outputs": [],
36 | "source": [
37 | "def millis = new Date().time\n",
38 | "def nanos = millis * 1000 * 1000L\n",
39 | "\n",
40 | "[[time: nanos + 7 * 1, next_time:(nanos + 77) * 1, temp:14.6],\n",
41 | " [time: nanos + 7 * 2, next_time:(nanos + 88) * 2, temp:18.1],\n",
42 | " [time: nanos + 7 * 3, next_time:(nanos + 99) * 3, temp:23.6]]"
43 | ]
44 | },
45 | {
46 | "cell_type": "markdown",
47 | "metadata": {},
48 | "source": [
49 | "## BigNums (arbitrary precision)"
50 | ]
51 | },
52 | {
53 | "cell_type": "code",
54 | "execution_count": null,
55 | "metadata": {},
56 | "outputs": [],
57 | "source": [
58 | "def today = new Date()\n",
59 | "def millis = today.time\n",
60 | "// the \"g\" makes this a bignum, with as many bits as needed\n",
61 | "def nanos = millis * 1000 * 1000g\n",
62 | "\n",
63 | "[[time: nanos + 7 * 1, next_time:(nanos + 77) * 777, temp:3.351],\n",
64 | " [time: nanos + 7 * 2, next_time:(nanos + 88) * 888, temp:2.355],\n",
65 | " [time: nanos + 7 * 3, next_time:(nanos + 99) * 999, temp:2.728]]"
66 | ]
67 | }
68 | ],
69 | "metadata": {
70 | "kernelspec": {
71 | "display_name": "Groovy",
72 | "language": "groovy",
73 | "name": "groovy"
74 | },
75 | "language_info": {
76 | "codemirror_mode": "groovy",
77 | "file_extension": ".groovy",
78 | "mimetype": "",
79 | "name": "Groovy",
80 | "nbconverter_exporter": "",
81 | "version": "2.4.3"
82 | }
83 | },
84 | "nbformat": 4,
85 | "nbformat_minor": 2
86 | }
87 |
--------------------------------------------------------------------------------
/doc/groovy/CodeCell.ipynb:
--------------------------------------------------------------------------------
1 | {
2 | "cells": [
3 | {
4 | "cell_type": "markdown",
5 | "metadata": {},
6 | "source": [
7 | "# Get Source Code and Metadata\n",
8 | "\n",
9 | "This API fetches the source code and metadata of cells identified by tag.\n",
10 | "In Jupyter Lab, open the Cell Tools side bar and then click on a cell to see and edit its metadata."
11 | ]
12 | },
13 | {
14 | "cell_type": "code",
15 | "execution_count": null,
16 | "metadata": {
17 | "tags": [
18 | "mytag"
19 | ]
20 | },
21 | "outputs": [],
22 | "source": [
23 | "//This is comment\n",
24 | "b=2+2"
25 | ]
26 | },
27 | {
28 | "cell_type": "code",
29 | "execution_count": null,
30 | "metadata": {},
31 | "outputs": [],
32 | "source": [
33 | "beakerx.getCodeCells('mytag')[0]"
34 | ]
35 | }
36 | ],
37 | "metadata": {
38 | "celltoolbar": "Tags",
39 | "kernelspec": {
40 | "display_name": "Groovy",
41 | "language": "groovy",
42 | "name": "groovy"
43 | },
44 | "language_info": {
45 | "codemirror_mode": "groovy",
46 | "file_extension": ".groovy",
47 | "mimetype": "",
48 | "name": "Groovy",
49 | "nbconverter_exporter": "",
50 | "version": "2.4.3"
51 | }
52 | },
53 | "nbformat": 4,
54 | "nbformat_minor": 2
55 | }
56 |
--------------------------------------------------------------------------------
/doc/groovy/Groovy.ipynb:
--------------------------------------------------------------------------------
1 | {
2 | "cells": [
3 | {
4 | "cell_type": "markdown",
5 | "metadata": {},
6 | "source": [
7 | "# Groovy Examples\n",
8 | "\n",
9 | "[Apache Groovy](http://groovy-lang.org/) is the language that should have been called JavaScript because it is a scripting version of Java."
10 | ]
11 | },
12 | {
13 | "cell_type": "code",
14 | "execution_count": null,
15 | "metadata": {
16 | "collapsed": true
17 | },
18 | "outputs": [],
19 | "source": [
20 | "def a = 1 //local variable\n",
21 | "b = 2 //global variable"
22 | ]
23 | },
24 | {
25 | "cell_type": "code",
26 | "execution_count": null,
27 | "metadata": {
28 | "collapsed": true
29 | },
30 | "outputs": [],
31 | "source": [
32 | "a //error"
33 | ]
34 | },
35 | {
36 | "cell_type": "code",
37 | "execution_count": null,
38 | "metadata": {
39 | "collapsed": true
40 | },
41 | "outputs": [],
42 | "source": [
43 | "b //this works"
44 | ]
45 | },
46 | {
47 | "cell_type": "code",
48 | "execution_count": null,
49 | "metadata": {
50 | "collapsed": true
51 | },
52 | "outputs": [],
53 | "source": [
54 | "//closure example\n",
55 | "timesTwo = {x -> x*2}"
56 | ]
57 | },
58 | {
59 | "cell_type": "code",
60 | "execution_count": null,
61 | "metadata": {
62 | "collapsed": true
63 | },
64 | "outputs": [],
65 | "source": [
66 | "timesTwo(4)"
67 | ]
68 | },
69 | {
70 | "cell_type": "code",
71 | "execution_count": null,
72 | "metadata": {
73 | "collapsed": true
74 | },
75 | "outputs": [],
76 | "source": [
77 | "timesTwo(\"Multiplying Strings!\")"
78 | ]
79 | },
80 | {
81 | "cell_type": "code",
82 | "execution_count": null,
83 | "metadata": {
84 | "collapsed": true
85 | },
86 | "outputs": [],
87 | "source": [
88 | "sin(3.1415)"
89 | ]
90 | }
91 | ],
92 | "metadata": {
93 | "kernelspec": {
94 | "display_name": "Groovy",
95 | "language": "groovy",
96 | "name": "groovy"
97 | },
98 | "language_info": {
99 | "codemirror_mode": "groovy",
100 | "file_extension": ".groovy",
101 | "mimetype": "",
102 | "name": "Groovy",
103 | "nbconverter_exporter": "",
104 | "version": "2.4.3"
105 | }
106 | },
107 | "nbformat": 4,
108 | "nbformat_minor": 2
109 | }
110 |
--------------------------------------------------------------------------------
/doc/groovy/Interactive.ipynb:
--------------------------------------------------------------------------------
1 | {
2 | "cells": [
3 | {
4 | "cell_type": "markdown",
5 | "metadata": {},
6 | "source": [
7 | "# Interactive Recomputation\n",
8 | "\n",
9 | "The widgets work with the [interact API](http://ipywidgets.readthedocs.io/en/latest/examples/Using%20Interact.html), so that a cell can be recomputed as the widgets change value. This API is slated for improvement see [#5867](https://github.com/twosigma/beakerx/issues/5867)."
10 | ]
11 | },
12 | {
13 | "cell_type": "code",
14 | "execution_count": null,
15 | "metadata": {},
16 | "outputs": [],
17 | "source": [
18 | "import static com.twosigma.beakerx.groovy.widgets.Interactive.interact\n",
19 | "\n",
20 | "class DataHolder{\n",
21 | " static Plot plot = null;\n",
22 | "}\n",
23 | "\n",
24 | "public static Object f(a,b){\n",
25 | " if (DataHolder.plot == null){\n",
26 | " DataHolder.plot = new Plot(title: \"Lissajous Curves\")\n",
27 | " }\n",
28 | "\n",
29 | " List t = (1..1000)\n",
30 | " List x = t.collect { it -> sin(it*a/100)}\n",
31 | " List y = t.collect { it -> cos(it*b/100)}\n",
32 | " \n",
33 | " DataHolder.plot.getGraphics().clear()\n",
34 | " DataHolder.plot.add(new Line(x: x, y: y))\n",
35 | " return DataHolder.plot \n",
36 | "}\n",
37 | "\n",
38 | "interact(this.&f, 3d, -3d);"
39 | ]
40 | }
41 | ],
42 | "metadata": {
43 | "beakerx_kernel_parameters": {},
44 | "kernelspec": {
45 | "display_name": "Groovy",
46 | "language": "groovy",
47 | "name": "groovy"
48 | },
49 | "language_info": {
50 | "codemirror_mode": "groovy",
51 | "file_extension": ".groovy",
52 | "mimetype": "",
53 | "name": "Groovy",
54 | "nbconverter_exporter": "",
55 | "version": "2.4.3"
56 | },
57 | "widgets": {
58 | "state": {
59 | "8e031bec-8956-4228-9da0-77339eee6003": {
60 | "views": [
61 | {
62 | "cell_index": 0
63 | }
64 | ]
65 | }
66 | },
67 | "version": "1.2.0"
68 | }
69 | },
70 | "nbformat": 4,
71 | "nbformat_minor": 2
72 | }
73 |
--------------------------------------------------------------------------------
/doc/groovy/JvmRepr.ipynb:
--------------------------------------------------------------------------------
1 | {
2 | "cells": [
3 | {
4 | "cell_type": "markdown",
5 | "metadata": {},
6 | "source": [
7 | "# Custom Displayers and `jvm-repr`\n",
8 | "\n",
9 | "You can control the representation of a class using the Jupyter standard [`jvm-repr`](https://github.com/jupyter/jvm-repr) API.\n",
10 | "For example below we configure integers to be displayed with large heading text.\n",
11 | "See the [Tablesaw tutorial](Tablesaw.ipynb) and its [source code](https://github.com/jtablesaw/tablesaw/blob/master/beakerx/src/main/java/tech/tablesaw/beakerx/TablesawDisplayer.java) for a more substantial example that creates an interactive widget, not just HTML.\n"
12 | ]
13 | },
14 | {
15 | "cell_type": "code",
16 | "execution_count": null,
17 | "metadata": {},
18 | "outputs": [],
19 | "source": [
20 | "import jupyter.Displayer;\n",
21 | "import jupyter.Displayers;\n",
22 | "Displayers.register(Integer.class, new Displayer() {\n",
23 | " @Override\n",
24 | " public Map display(Integer value) {\n",
25 | " return new HashMap() {{\n",
26 | " put(MIMEContainer.MIME.TEXT_HTML, \"\" + value + \"
\");\n",
27 | " \n",
28 | " }};\n",
29 | " }\n",
30 | " });"
31 | ]
32 | },
33 | {
34 | "cell_type": "code",
35 | "execution_count": null,
36 | "metadata": {},
37 | "outputs": [],
38 | "source": [
39 | "1+1"
40 | ]
41 | }
42 | ],
43 | "metadata": {
44 | "kernelspec": {
45 | "display_name": "Groovy",
46 | "language": "groovy",
47 | "name": "groovy"
48 | },
49 | "language_info": {
50 | "codemirror_mode": "groovy",
51 | "file_extension": ".groovy",
52 | "mimetype": "",
53 | "name": "Groovy",
54 | "nbconverter_exporter": "",
55 | "version": "2.4.3"
56 | }
57 | },
58 | "nbformat": 4,
59 | "nbformat_minor": 2
60 | }
61 |
--------------------------------------------------------------------------------
/doc/groovy/LevelsOfDetails.ipynb:
--------------------------------------------------------------------------------
1 | {
2 | "cells": [
3 | {
4 | "cell_type": "markdown",
5 | "metadata": {},
6 | "source": [
7 | "# Levels Of Detail\n",
8 | "\n",
9 | "Although the interactivity and high resolution you get from BeakerX’s charting library are a feature, creating DOM elements for every single data point is memory and CPU intensive. If implemented simply, your web browser would become sluggish or freeze if you tried to chart too much data. Fortunately, Beaker recognizes this situation and has a solution: Levels of Detail. If there are more than 1500 points, then instead of drawing them all, Beaker combines points into groups, and represents each group with its average, a box, or a river (min, max, and average).\n",
10 | "\n",
11 | "And then, as you zoom into the data, it is resampled as appropriate for the current view, so the closer you look, the more there is to see, but you can still pull out and get the big picture while keeping the frame rate high.\n",
12 | "\n",
13 | "Note that BeakerX’s Level of Detail feature can’t protect you if your dataset set itself is too large to fit in your web browser (see [#6197](https://github.com/twosigma/beakerx/issues/6197)). In that case, you should use a plotting library that renders to a PNG image like matplotlib in Python, or do the resampling on the server manually."
14 | ]
15 | },
16 | {
17 | "cell_type": "code",
18 | "execution_count": null,
19 | "metadata": {},
20 | "outputs": [],
21 | "source": [
22 | "// generate a random walk\n",
23 | "steps = 10000\n",
24 | "random = new Random()\n",
25 | "def walk(ssize) {\n",
26 | " def cur = 0.0\n",
27 | " def x = []\n",
28 | " def y = []\n",
29 | " for (i in 0..steps) {\n",
30 | " y[i] = cur\n",
31 | " x[i] = i\n",
32 | " cur += random.nextGaussian() * ssize\n",
33 | " }\n",
34 | " return [x:x, y:y]\n",
35 | "}\n",
36 | "// now x is time for the x-axis, and y is the random variable\n",
37 | "beer = walk(10)\n",
38 | "whiskey = walk(100)\n",
39 | "OutputCell.HIDDEN"
40 | ]
41 | },
42 | {
43 | "cell_type": "code",
44 | "execution_count": null,
45 | "metadata": {},
46 | "outputs": [],
47 | "source": [
48 | "p = new TimePlot(title: \"Drunken Sailor Walks\", showLegend: true, lodThreshold: 2000)\n",
49 | "p << new Line(x:beer.x, y:beer.y, displayName:\"Beer Walk\")\n",
50 | "p << new Line(x:whiskey.x, y:whiskey.y, displayName:\"Whiskey Walk\")"
51 | ]
52 | }
53 | ],
54 | "metadata": {
55 | "anaconda-cloud": {},
56 | "beakerx_kernel_parameters": {},
57 | "kernelspec": {
58 | "display_name": "Groovy",
59 | "language": "groovy",
60 | "name": "groovy"
61 | },
62 | "language_info": {
63 | "codemirror_mode": "groovy",
64 | "file_extension": ".groovy",
65 | "mimetype": "",
66 | "name": "Groovy",
67 | "nbconverter_exporter": "",
68 | "version": "2.4.3"
69 | }
70 | },
71 | "nbformat": 4,
72 | "nbformat_minor": 1
73 | }
74 |
--------------------------------------------------------------------------------
/doc/groovy/LoadMagicCommand.ipynb:
--------------------------------------------------------------------------------
1 | {
2 | "cells": [
3 | {
4 | "cell_type": "markdown",
5 | "metadata": {},
6 | "source": [
7 | "# Define New Magics\n",
8 | "\n",
9 | "There is an API to define your own magics. See the source code for the jar: [ShowEnvsCustomMagicCommand.java](https://github.com/twosigma/beakerx/blob/master/kernel/demoProjects/loadMagicJarDemo/src/main/java/com/twosigma/beakerx/custom/magic/command/ShowEnvsCustomMagicCommand.java)."
10 | ]
11 | },
12 | {
13 | "cell_type": "code",
14 | "execution_count": null,
15 | "metadata": {},
16 | "outputs": [],
17 | "source": [
18 | "%classpath add jar ../resources/jar/loadMagicJarDemo.jar"
19 | ]
20 | },
21 | {
22 | "cell_type": "code",
23 | "execution_count": null,
24 | "metadata": {},
25 | "outputs": [],
26 | "source": [
27 | "%load_magic com.twosigma.beakerx.custom.magic.command.ShowEnvsCustomMagicCommand"
28 | ]
29 | },
30 | {
31 | "cell_type": "code",
32 | "execution_count": null,
33 | "metadata": {},
34 | "outputs": [],
35 | "source": [
36 | "%showEnvs"
37 | ]
38 | }
39 | ],
40 | "metadata": {
41 | "kernelspec": {
42 | "display_name": "Groovy",
43 | "language": "groovy",
44 | "name": "groovy"
45 | },
46 | "language_info": {
47 | "codemirror_mode": "groovy",
48 | "file_extension": ".groovy",
49 | "mimetype": "",
50 | "name": "Groovy",
51 | "nbconverter_exporter": "",
52 | "version": "2.4.3"
53 | },
54 | "widgets": {
55 | "application/vnd.jupyter.widget-state+json": {
56 | "state": {},
57 | "version_major": 2,
58 | "version_minor": 0
59 | }
60 | }
61 | },
62 | "nbformat": 4,
63 | "nbformat_minor": 2
64 | }
65 |
--------------------------------------------------------------------------------
/doc/groovy/MapLikeTable.ipynb:
--------------------------------------------------------------------------------
1 | {
2 | "cells": [
3 | {
4 | "cell_type": "markdown",
5 | "metadata": {},
6 | "source": [
7 | "# Automatic Table Display of Simple Data Structures\n",
8 | "\n",
9 | "BeakerX automatically displays Maps and Lists as Tables completely automatically in many circumstances."
10 | ]
11 | },
12 | {
13 | "cell_type": "code",
14 | "execution_count": null,
15 | "metadata": {},
16 | "outputs": [],
17 | "source": [
18 | "[\"x\" : 0, \"y\" : 1]"
19 | ]
20 | },
21 | {
22 | "cell_type": "code",
23 | "execution_count": null,
24 | "metadata": {},
25 | "outputs": [],
26 | "source": [
27 | "List list = new ArrayList();\n",
28 | "list.add([\"x\" : 2, \"y\" : 3]);\n",
29 | "list.add([\"x\" : 5, \"y\" : 8]);\n",
30 | "list"
31 | ]
32 | },
33 | {
34 | "cell_type": "code",
35 | "execution_count": null,
36 | "metadata": {},
37 | "outputs": [],
38 | "source": [
39 | "Map[] map = new Map[2];\n",
40 | "map[0] = [\"x\" : 1.414, \"y\" : 2.718]\n",
41 | "map[1] = [\"x\" : 3.141, \"y\" : 4.669]\n",
42 | "map"
43 | ]
44 | },
45 | {
46 | "cell_type": "code",
47 | "execution_count": null,
48 | "metadata": {},
49 | "outputs": [],
50 | "source": [
51 | "def listOfMap = []\n",
52 | "0.upto(10){\n",
53 | " listOfMap += [\"exp2\": 2**it, \"exp3\": 3**it]\n",
54 | "}\n",
55 | "listOfMap"
56 | ]
57 | },
58 | {
59 | "cell_type": "code",
60 | "execution_count": null,
61 | "metadata": {},
62 | "outputs": [],
63 | "source": [
64 | "def myMap = [:]\n",
65 | "def myList = []\n",
66 | "myList << [1, 2, 3]\n",
67 | "myList << [2, 3, 4]\n",
68 | "myMap.put(1, myList)\n",
69 | "myMap"
70 | ]
71 | },
72 | {
73 | "cell_type": "code",
74 | "execution_count": null,
75 | "metadata": {},
76 | "outputs": [],
77 | "source": [
78 | "def myMap = [:]\n",
79 | "def myList = [width:1, height:2]\n",
80 | "myMap.put(1, myList)\n",
81 | "myMap"
82 | ]
83 | }
84 | ],
85 | "metadata": {
86 | "beakerx_kernel_parameters": {
87 | "classpath": [],
88 | "imports": []
89 | },
90 | "kernelspec": {
91 | "display_name": "Groovy",
92 | "language": "groovy",
93 | "name": "groovy"
94 | },
95 | "language_info": {
96 | "codemirror_mode": "groovy",
97 | "file_extension": ".groovy",
98 | "mimetype": "",
99 | "name": "Groovy",
100 | "nbconverter_exporter": "",
101 | "version": "2.4.3"
102 | }
103 | },
104 | "nbformat": 4,
105 | "nbformat_minor": 2
106 | }
107 |
--------------------------------------------------------------------------------
/doc/groovy/NativeLib.ipynb:
--------------------------------------------------------------------------------
1 | {
2 | "cells": [
3 | {
4 | "cell_type": "code",
5 | "execution_count": null,
6 | "metadata": {},
7 | "outputs": [],
8 | "source": [
9 | "%classpath add mvn org.nd4j nd4j-native-platform 0.9.1"
10 | ]
11 | },
12 | {
13 | "cell_type": "code",
14 | "execution_count": null,
15 | "metadata": {},
16 | "outputs": [],
17 | "source": [
18 | "import org.nd4j.linalg.factory.Nd4j\n",
19 | "Nd4j.getRandom()"
20 | ]
21 | },
22 | {
23 | "cell_type": "code",
24 | "execution_count": null,
25 | "metadata": {},
26 | "outputs": [],
27 | "source": [
28 | "%classpath add mvn com.github.fommil.netlib core 1.1.2"
29 | ]
30 | },
31 | {
32 | "cell_type": "code",
33 | "execution_count": null,
34 | "metadata": {},
35 | "outputs": [],
36 | "source": [
37 | "new org.netlib.blas.Daxpy()"
38 | ]
39 | },
40 | {
41 | "cell_type": "code",
42 | "execution_count": null,
43 | "metadata": {},
44 | "outputs": [],
45 | "source": [
46 | ""
47 | ]
48 | }
49 | ],
50 | "metadata": {
51 | "kernelspec": {
52 | "display_name": "Groovy",
53 | "language": "groovy",
54 | "name": "groovy"
55 | },
56 | "language_info": {
57 | "codemirror_mode": "groovy",
58 | "file_extension": ".groovy",
59 | "mimetype": "",
60 | "name": "Groovy",
61 | "nbconverter_exporter": "",
62 | "version": "2.4.3"
63 | }
64 | },
65 | "nbformat": 4,
66 | "nbformat_minor": 0
67 | }
--------------------------------------------------------------------------------
/doc/groovy/PlotsPythonStyle.ipynb:
--------------------------------------------------------------------------------
1 | {
2 | "cells": [
3 | {
4 | "cell_type": "markdown",
5 | "metadata": {},
6 | "source": [
7 | "# Plots Update Seamlessly\n",
8 | "\n",
9 | "After a BeakerX Plot has been displayed, you can interact with it with the mouse. You can also interact with it by API, and the plot will update seamlessly in its previously displayed location."
10 | ]
11 | },
12 | {
13 | "cell_type": "code",
14 | "execution_count": null,
15 | "metadata": {},
16 | "outputs": [],
17 | "source": [
18 | "plot = new Plot(title: \"Setting line properties\", initHeight: 150)\n",
19 | "def ys = [0, 1, 6, 5, 2, 8]\n",
20 | "def ys2 = [0, 2, 7, 6, 3, 8]\n",
21 | "plot << new Line(y: ys, width: 10, color: Color.red)\n",
22 | "plot << new Line(y: ys, width: 3, color: Color.yellow)"
23 | ]
24 | },
25 | {
26 | "cell_type": "code",
27 | "execution_count": null,
28 | "metadata": {},
29 | "outputs": [],
30 | "source": [
31 | "plot.setTitle(\"Changed Title\");\n",
32 | "OutputCell.HIDDEN"
33 | ]
34 | },
35 | {
36 | "cell_type": "code",
37 | "execution_count": null,
38 | "metadata": {},
39 | "outputs": [],
40 | "source": [
41 | "plot.setInitWidth(500)\n",
42 | "OutputCell.HIDDEN"
43 | ]
44 | },
45 | {
46 | "cell_type": "code",
47 | "execution_count": null,
48 | "metadata": {},
49 | "outputs": [],
50 | "source": [
51 | "plot << new Line(y: [5, 0], x: [0, 5], style: StrokeType.LONGDASH)\n",
52 | "OutputCell.HIDDEN"
53 | ]
54 | },
55 | {
56 | "cell_type": "code",
57 | "execution_count": null,
58 | "metadata": {},
59 | "outputs": [],
60 | "source": [
61 | "ch = new Crosshair(color: new Color(255, 128, 5), width: 2, style: StrokeType.DOT)\n",
62 | "plot.setCrosshair(ch)\n",
63 | "OutputCell.HIDDEN"
64 | ]
65 | }
66 | ],
67 | "metadata": {
68 | "beakerx_kernel_parameters": {},
69 | "kernelspec": {
70 | "display_name": "Groovy",
71 | "language": "groovy",
72 | "name": "groovy"
73 | },
74 | "language_info": {
75 | "codemirror_mode": "groovy",
76 | "file_extension": ".groovy",
77 | "mimetype": "",
78 | "name": "Groovy",
79 | "nbconverter_exporter": "",
80 | "version": "2.4.3"
81 | }
82 | },
83 | "nbformat": 4,
84 | "nbformat_minor": 2
85 | }
86 |
--------------------------------------------------------------------------------
/doc/groovy/ProgressUpdateReporting.ipynb:
--------------------------------------------------------------------------------
1 | {
2 | "cells": [
3 | {
4 | "cell_type": "markdown",
5 | "metadata": {},
6 | "source": [
7 | "# Progress Reporting"
8 | ]
9 | },
10 | {
11 | "cell_type": "code",
12 | "execution_count": null,
13 | "metadata": {},
14 | "outputs": [],
15 | "source": [
16 | "for ( int i = 0 ; i<100; i++) {\n",
17 | " beakerx.showProgressUpdate(\"\", i)\n",
18 | " sleep(100)\n",
19 | "}\n",
20 | "\"finished\""
21 | ]
22 | },
23 | {
24 | "cell_type": "code",
25 | "execution_count": null,
26 | "metadata": {},
27 | "outputs": [],
28 | "source": [
29 | "def messages = [\"starting\",\n",
30 | " \"started\",\n",
31 | " \"begin\",\n",
32 | " \"middle\",\n",
33 | " \"ending\"];\n",
34 | "\n",
35 | "for ( int i = 0 ; i<5; i++) {\n",
36 | " beakerx.showProgressUpdate(messages[i], i*20)\n",
37 | " sleep(1000)\n",
38 | "}\n",
39 | "sleep(1000)\n",
40 | "\"finished\""
41 | ]
42 | }
43 | ],
44 | "metadata": {
45 | "anaconda-cloud": {},
46 | "beakerx_kernel_parameters": {},
47 | "kernelspec": {
48 | "display_name": "Groovy",
49 | "language": "groovy",
50 | "name": "groovy"
51 | },
52 | "language_info": {
53 | "codemirror_mode": "groovy",
54 | "file_extension": ".groovy",
55 | "mimetype": "",
56 | "name": "Groovy",
57 | "nbconverter_exporter": "",
58 | "version": "2.4.3"
59 | }
60 | },
61 | "nbformat": 4,
62 | "nbformat_minor": 1
63 | }
64 |
--------------------------------------------------------------------------------
/doc/groovy/RunCells.ipynb:
--------------------------------------------------------------------------------
1 | {
2 | "cells": [
3 | {
4 | "cell_type": "markdown",
5 | "metadata": {},
6 | "source": [
7 | "# Run Another Cell\n",
8 | "One cell can trigger the execution of other cells."
9 | ]
10 | },
11 | {
12 | "cell_type": "code",
13 | "execution_count": null,
14 | "metadata": {},
15 | "outputs": [],
16 | "source": [
17 | "beakerx.runByTag(\"mytag\")"
18 | ]
19 | },
20 | {
21 | "cell_type": "code",
22 | "execution_count": null,
23 | "metadata": {
24 | "tags": [
25 | "mytag"
26 | ]
27 | },
28 | "outputs": [],
29 | "source": [
30 | "println(\"ran\")"
31 | ]
32 | }
33 | ],
34 | "metadata": {
35 | "celltoolbar": "Tags",
36 | "kernelspec": {
37 | "display_name": "Groovy",
38 | "language": "groovy",
39 | "name": "groovy"
40 | },
41 | "language_info": {
42 | "codemirror_mode": "groovy",
43 | "file_extension": ".groovy",
44 | "mimetype": "",
45 | "name": "Groovy",
46 | "nbconverter_exporter": "",
47 | "version": "2.4.3"
48 | }
49 | },
50 | "nbformat": 4,
51 | "nbformat_minor": 2
52 | }
53 |
--------------------------------------------------------------------------------
/doc/groovy/ShowNullExecutionResult.ipynb:
--------------------------------------------------------------------------------
1 | {
2 | "cells": [
3 | {
4 | "cell_type": "markdown",
5 | "metadata": {},
6 | "source": [
7 | "# Configure Display of `null`\n",
8 | "\n",
9 | "The `null` object in the JVM is by default displayed as `null`. But if you prefer to show no result at all, you can configure that as follows:"
10 | ]
11 | },
12 | {
13 | "cell_type": "code",
14 | "execution_count": 1,
15 | "metadata": {},
16 | "outputs": [
17 | {
18 | "data": {
19 | "text/plain": [
20 | "true"
21 | ]
22 | },
23 | "execution_count": 1,
24 | "metadata": {},
25 | "output_type": "execute_result"
26 | }
27 | ],
28 | "source": [
29 | "com.twosigma.beakerx.kernel.Kernel.showNullExecutionResult"
30 | ]
31 | },
32 | {
33 | "cell_type": "code",
34 | "execution_count": 9,
35 | "metadata": {},
36 | "outputs": [
37 | {
38 | "data": {
39 | "text/plain": [
40 | "null"
41 | ]
42 | },
43 | "execution_count": 9,
44 | "metadata": {},
45 | "output_type": "execute_result"
46 | }
47 | ],
48 | "source": [
49 | "com.twosigma.beakerx.kernel.Kernel.showNullExecutionResult = true;\n",
50 | "String seeNullString = null;\n",
51 | "seeNullString"
52 | ]
53 | },
54 | {
55 | "cell_type": "code",
56 | "execution_count": 6,
57 | "metadata": {
58 | "collapsed": true
59 | },
60 | "outputs": [],
61 | "source": [
62 | "com.twosigma.beakerx.kernel.Kernel.showNullExecutionResult = false;\n",
63 | "String noNullString = null;\n",
64 | "noNullString"
65 | ]
66 | },
67 | {
68 | "cell_type": "code",
69 | "execution_count": null,
70 | "metadata": {
71 | "collapsed": true
72 | },
73 | "outputs": [],
74 | "source": []
75 | }
76 | ],
77 | "metadata": {
78 | "kernelspec": {
79 | "display_name": "Groovy",
80 | "language": "groovy",
81 | "name": "groovy"
82 | },
83 | "language_info": {
84 | "codemirror_mode": "groovy",
85 | "file_extension": ".groovy",
86 | "mimetype": "",
87 | "name": "Groovy",
88 | "nbconverter_exporter": "",
89 | "version": "2.4.3"
90 | }
91 | },
92 | "nbformat": 4,
93 | "nbformat_minor": 2
94 | }
95 |
--------------------------------------------------------------------------------
/doc/groovy/TimingMagicCommands.ipynb:
--------------------------------------------------------------------------------
1 | {
2 | "cells": [
3 | {
4 | "cell_type": "markdown",
5 | "metadata": {},
6 | "source": [
7 | "# Time Magics\n",
8 | "\n",
9 | "There are magics for timing execution of code with a similar syntax to the standard ones in Python."
10 | ]
11 | },
12 | {
13 | "cell_type": "code",
14 | "execution_count": null,
15 | "metadata": {},
16 | "outputs": [],
17 | "source": [
18 | "%time 2**128"
19 | ]
20 | },
21 | {
22 | "cell_type": "markdown",
23 | "metadata": {},
24 | "source": [
25 | "You are able to execute few statements in single line."
26 | ]
27 | },
28 | {
29 | "cell_type": "code",
30 | "execution_count": null,
31 | "metadata": {},
32 | "outputs": [],
33 | "source": [
34 | "%time a = [10,20,30,40,50]; a= a.sum(); a*10;"
35 | ]
36 | },
37 | {
38 | "cell_type": "markdown",
39 | "metadata": {},
40 | "source": [
41 | "Time measurement in cell mode"
42 | ]
43 | },
44 | {
45 | "cell_type": "code",
46 | "execution_count": null,
47 | "metadata": {},
48 | "outputs": [],
49 | "source": [
50 | "%%time \n",
51 | "a = [10,20,30,40,50]; \n",
52 | "a= a.sum(); \n",
53 | "a*10;"
54 | ]
55 | },
56 | {
57 | "cell_type": "markdown",
58 | "metadata": {},
59 | "source": [
60 | "Function `%time` provides very basic timing functionality. \n",
61 | "Use the timeit magic for more control over the measurement. \n",
62 | "Time execution of a Python statement or expression \n",
63 | "\n",
64 | "Usage, in line mode:\n",
65 | "\n",
66 | "```%timeit [-n -r -q] statement```\n",
67 | "\n",
68 | "or in cell mode:\n",
69 | "\n",
70 | "```%%timeit [-n -r -q] \n",
71 | "code \n",
72 | "code...```\n",
73 | "\n",
74 | "Options: \n",
75 | "-n: execute the given statement times in a loop. If this value is not given, a fitting value is chosen. \n",
76 | "-r: repeat the loop iteration times and take the best result. Default: 3 \n",
77 | "-q: Quiet, do not print result.\n"
78 | ]
79 | },
80 | {
81 | "cell_type": "code",
82 | "execution_count": null,
83 | "metadata": {},
84 | "outputs": [],
85 | "source": [
86 | "%timeit -n10 -r3 sin(100)*cos(123)"
87 | ]
88 | },
89 | {
90 | "cell_type": "code",
91 | "execution_count": null,
92 | "metadata": {},
93 | "outputs": [],
94 | "source": [
95 | "%timeit -r3 sin(100)*cos(123)"
96 | ]
97 | },
98 | {
99 | "cell_type": "code",
100 | "execution_count": null,
101 | "metadata": {},
102 | "outputs": [],
103 | "source": [
104 | "%timeit -r3 -n1 sleep(1000)"
105 | ]
106 | },
107 | {
108 | "cell_type": "code",
109 | "execution_count": null,
110 | "metadata": {},
111 | "outputs": [],
112 | "source": [
113 | "%%timeit -r3 -n10\n",
114 | "a = 15;\n",
115 | "b = 111;\n",
116 | "a * b;"
117 | ]
118 | }
119 | ],
120 | "metadata": {
121 | "kernelspec": {
122 | "display_name": "Groovy",
123 | "language": "groovy",
124 | "name": "groovy"
125 | },
126 | "language_info": {
127 | "codemirror_mode": "groovy",
128 | "file_extension": ".groovy",
129 | "mimetype": "",
130 | "name": "Groovy",
131 | "nbconverter_exporter": "",
132 | "version": "2.4.3"
133 | }
134 | },
135 | "nbformat": 4,
136 | "nbformat_minor": 2
137 | }
138 |
--------------------------------------------------------------------------------
/doc/groovy/UIOptions.ipynb:
--------------------------------------------------------------------------------
1 | {
2 | "cells": [
3 | {
4 | "cell_type": "markdown",
5 | "metadata": {},
6 | "source": [
7 | "# UI Options\n",
8 | "\n",
9 | "BeakerX has a control panel for customizing the Jupyter UI. It's located in the BeakerX tab added to the tree view.\n",
10 | "\n",
11 | "The settings are stored in your `~/.jupyter/beakerx.json` file.\n",
12 | "\n",
13 | "Note that if you change the values in the UI, already open notebooks are not effected, only new ones. You can save and then reload an old window to update it with your new settings.\n",
14 | "\n",
15 | "The settings are:\n",
16 | "* **Autoclose brackets** by default Jupyter code editor automatically closes brackets. Uncheck to disable.\n",
17 | "* **Wide code cells** by default Jupyter cell widths are limited. BeakerX makes cells as wide as the browser window. Uncheck to return to Jupyter's style.\n",
18 | "* **Customize fonts** replace the default fonts with Roboto Mono (for code) and Lato (for markdown).\n",
19 | "* **Show publication button and menu item** Uncheck this to hide the UI that posts to GitHub, disabling the publication feature.\n",
20 | "* **Show catalog button** Check this to show the data catalog sidebar and enable dragging of examples into the notebook.\n",
21 | "* **Autosave notebooks** by default Jupyter autosaves notebooks every minute. Uncheck to only save on demand."
22 | ]
23 | }
24 | ],
25 | "metadata": {
26 | "kernelspec": {
27 | "display_name": "Python 3",
28 | "language": "python",
29 | "name": "python3"
30 | },
31 | "language_info": {
32 | "codemirror_mode": {
33 | "name": "ipython",
34 | "version": 3
35 | },
36 | "file_extension": ".py",
37 | "mimetype": "text/x-python",
38 | "name": "python",
39 | "nbconvert_exporter": "python",
40 | "pygments_lexer": "ipython3",
41 | "version": "3.6.5"
42 | }
43 | },
44 | "nbformat": 4,
45 | "nbformat_minor": 2
46 | }
47 |
--------------------------------------------------------------------------------
/doc/java/classpath_add_dynamic_magic_command.ipynb:
--------------------------------------------------------------------------------
1 | {
2 | "cells": [
3 | {
4 | "cell_type": "markdown",
5 | "metadata": {},
6 | "source": [
7 | "### first solution using static field in class"
8 | ]
9 | },
10 | {
11 | "cell_type": "code",
12 | "execution_count": null,
13 | "metadata": {},
14 | "outputs": [],
15 | "source": [
16 | "package test.beaker;\n",
17 | "public class BeakerTest {\n",
18 | " public static String location ; \n",
19 | "}"
20 | ]
21 | },
22 | {
23 | "cell_type": "code",
24 | "execution_count": null,
25 | "metadata": {},
26 | "outputs": [],
27 | "source": [
28 | "test.beaker.BeakerTest.location = \"../resources/jar/\";"
29 | ]
30 | },
31 | {
32 | "cell_type": "code",
33 | "execution_count": null,
34 | "metadata": {},
35 | "outputs": [],
36 | "source": [
37 | "%classpath add dynamic return test.beaker.BeakerTest.location + \"demo.jar\";"
38 | ]
39 | },
40 | {
41 | "cell_type": "code",
42 | "execution_count": null,
43 | "metadata": {},
44 | "outputs": [],
45 | "source": [
46 | "import com.example.Demo;\n",
47 | "Demo demo = new Demo();\n",
48 | "return demo.getObjectTest();"
49 | ]
50 | },
51 | {
52 | "cell_type": "markdown",
53 | "metadata": {},
54 | "source": [
55 | "### second solution using autotranslation "
56 | ]
57 | },
58 | {
59 | "cell_type": "code",
60 | "execution_count": null,
61 | "metadata": {},
62 | "outputs": [],
63 | "source": [
64 | "NamespaceClient.getBeakerX().set(\"location\",\"../resources/jar/\");"
65 | ]
66 | },
67 | {
68 | "cell_type": "code",
69 | "execution_count": null,
70 | "metadata": {},
71 | "outputs": [],
72 | "source": [
73 | "%classpath add dynamic return NamespaceClient.getBeakerX().get(\"location\")+ \"demo.jar\";"
74 | ]
75 | },
76 | {
77 | "cell_type": "code",
78 | "execution_count": null,
79 | "metadata": {},
80 | "outputs": [],
81 | "source": [
82 | "import com.example.Demo;\n",
83 | "Demo demo = new Demo();\n",
84 | "return demo.getObjectTest();"
85 | ]
86 | }
87 | ],
88 | "metadata": {
89 | "kernelspec": {
90 | "display_name": "Java",
91 | "language": "java",
92 | "name": "java"
93 | },
94 | "language_info": {
95 | "codemirror_mode": "text/x-java",
96 | "file_extension": ".java",
97 | "mimetype": "",
98 | "name": "Java",
99 | "nbconverter_exporter": "",
100 | "version": "1.8.0_121"
101 | },
102 | "toc": {
103 | "base_numbering": 1,
104 | "nav_menu": {},
105 | "number_sections": false,
106 | "sideBar": false,
107 | "skip_h1_title": false,
108 | "title_cell": "Table of Contents",
109 | "title_sidebar": "Contents",
110 | "toc_cell": false,
111 | "toc_position": {},
112 | "toc_section_display": false,
113 | "toc_window_display": false
114 | }
115 | },
116 | "nbformat": 4,
117 | "nbformat_minor": 2
118 | }
119 |
--------------------------------------------------------------------------------
/doc/javascript/usingExternalLibs.ipynb:
--------------------------------------------------------------------------------
1 | {
2 | "cells": [
3 | {
4 | "cell_type": "markdown",
5 | "metadata": {},
6 | "source": [
7 | "# Using external javascript libraries"
8 | ]
9 | },
10 | {
11 | "cell_type": "markdown",
12 | "metadata": {},
13 | "source": [
14 | "If you need to use some 3rd party lib you can use folowing technique."
15 | ]
16 | },
17 | {
18 | "cell_type": "markdown",
19 | "metadata": {},
20 | "source": [
21 | "Define map of js paths. You can use for example path of libraries provided [here](https://cdnjs.com/libraries). Remove `.js` from path it will be added automaticaly."
22 | ]
23 | },
24 | {
25 | "cell_type": "code",
26 | "execution_count": null,
27 | "metadata": {},
28 | "outputs": [],
29 | "source": [
30 | "%%javascript\n",
31 | "require.config({\n",
32 | " paths: {\n",
33 | " 'big': '//cdnjs.cloudflare.com/ajax/libs/big.js/5.2.2/big' \n",
34 | " }\n",
35 | "});"
36 | ]
37 | },
38 | {
39 | "cell_type": "code",
40 | "execution_count": null,
41 | "metadata": {},
42 | "outputs": [],
43 | "source": [
44 | "%%javascript\n",
45 | "require(['big'], function(Big) {\n",
46 | " window.Big = Big;\n",
47 | "});"
48 | ]
49 | },
50 | {
51 | "cell_type": "code",
52 | "execution_count": null,
53 | "metadata": {},
54 | "outputs": [],
55 | "source": [
56 | "%%javascript\n",
57 | "var a = 0.3;\n",
58 | "var b = 0.1;\n",
59 | "var c = new Big(a);\n",
60 | "\n",
61 | "beakerx.displayHTML(this, `\n",
62 | "using floats: ${a-b}
\n",
63 | "using big.js: ${c.minus(b)}\n",
64 | "`);"
65 | ]
66 | }
67 | ],
68 | "metadata": {
69 | "kernelspec": {
70 | "display_name": "Python 3",
71 | "language": "python",
72 | "name": "python3"
73 | },
74 | "language_info": {
75 | "codemirror_mode": {
76 | "name": "ipython",
77 | "version": 3
78 | },
79 | "file_extension": ".py",
80 | "mimetype": "text/x-python",
81 | "name": "python",
82 | "nbconvert_exporter": "python",
83 | "pygments_lexer": "ipython3",
84 | "version": "3.7.2"
85 | }
86 | },
87 | "nbformat": 4,
88 | "nbformat_minor": 2
89 | }
90 |
--------------------------------------------------------------------------------
/doc/kotlin/Kotlin.ipynb:
--------------------------------------------------------------------------------
1 | {
2 | "cells": [
3 | {
4 | "cell_type": "markdown",
5 | "metadata": {},
6 | "source": [
7 | "# Kotlin\n",
8 | "\n",
9 | "[Kotlin](https://kotlinlang.org/) is a relative newcomer from [JetBrains](https://www.jetbrains.com/) and [Android](https://developer.android.com/kotlin/get-started.html). It's intended to be an improved version of Java, including [Null Safety](https://kotlinlang.org/docs/reference/null-safety.html)."
10 | ]
11 | },
12 | {
13 | "cell_type": "code",
14 | "execution_count": null,
15 | "metadata": {},
16 | "outputs": [],
17 | "source": [
18 | "fun double(x: Int): Int {\n",
19 | " return 2*x\n",
20 | "}\n",
21 | "val x = 23"
22 | ]
23 | },
24 | {
25 | "cell_type": "code",
26 | "execution_count": null,
27 | "metadata": {},
28 | "outputs": [],
29 | "source": [
30 | "\"hello, \" + double(3) + x"
31 | ]
32 | },
33 | {
34 | "cell_type": "code",
35 | "execution_count": null,
36 | "metadata": {},
37 | "outputs": [],
38 | "source": [
39 | "val numbers: MutableList = mutableListOf(1, 4, 3)\n",
40 | "val line = Line()\n",
41 | "line.setY(numbers)\n",
42 | "val plot = Plot()\n",
43 | "plot.setTitle(\"Kotlin Plotting\")\n",
44 | "plot.add(line)\n",
45 | "plot"
46 | ]
47 | }
48 | ],
49 | "metadata": {
50 | "kernelspec": {
51 | "display_name": "Kotlin",
52 | "language": "kotlin",
53 | "name": "kotlin"
54 | },
55 | "language_info": {
56 | "codemirror_mode": "kt",
57 | "file_extension": ".kt",
58 | "mimetype": "",
59 | "name": "Kotlin",
60 | "nbconverter_exporter": "",
61 | "version": "1.2.21"
62 | }
63 | },
64 | "nbformat": 4,
65 | "nbformat_minor": 2
66 | }
67 |
--------------------------------------------------------------------------------
/doc/kotlin/NativeLib.ipynb:
--------------------------------------------------------------------------------
1 | {
2 | "cells": [
3 | {
4 | "cell_type": "code",
5 | "execution_count": null,
6 | "metadata": {},
7 | "outputs": [],
8 | "source": [
9 | "%classpath add mvn org.nd4j nd4j-native-platform 0.9.1"
10 | ]
11 | },
12 | {
13 | "cell_type": "code",
14 | "execution_count": null,
15 | "metadata": {},
16 | "outputs": [],
17 | "source": [
18 | "import org.nd4j.linalg.factory.Nd4j\n",
19 | "Nd4j.getRandom()"
20 | ]
21 | },
22 | {
23 | "cell_type": "code",
24 | "execution_count": null,
25 | "metadata": {},
26 | "outputs": [],
27 | "source": [
28 | "%classpath add mvn com.github.fommil.netlib core 1.1.2"
29 | ]
30 | },
31 | {
32 | "cell_type": "code",
33 | "execution_count": null,
34 | "metadata": {},
35 | "outputs": [],
36 | "source": [
37 | "org.netlib.blas.Daxpy()"
38 | ]
39 | },
40 | {
41 | "cell_type": "code",
42 | "execution_count": null,
43 | "metadata": {},
44 | "outputs": [],
45 | "source": [
46 | ""
47 | ]
48 | }
49 | ],
50 | "metadata": {
51 | "kernelspec": {
52 | "display_name": "Kotlin",
53 | "language": "kotlin",
54 | "name": "kotlin"
55 | },
56 | "language_info": {
57 | "codemirror_mode": "kt",
58 | "file_extension": ".kt",
59 | "mimetype": "",
60 | "name": "Kotlin",
61 | "nbconverter_exporter": "",
62 | "version": "1.1.3"
63 | }
64 | },
65 | "nbformat": 4,
66 | "nbformat_minor": 0
67 | }
--------------------------------------------------------------------------------
/doc/old/DisplayVegaInJupyterLab.ipynb:
--------------------------------------------------------------------------------
1 | {
2 | "cells": [
3 | {
4 | "cell_type": "code",
5 | "execution_count": null,
6 | "metadata": {},
7 | "outputs": [],
8 | "source": [
9 | "// bar-chart.vg.json from https://gist.github.com/hadim/629b8fde56eac74c587136139a0dd5c2#file-bar-chart-vg-json\n",
10 | "\n",
11 | "import com.twosigma.beakerx.mimetype.MIMEContainer\n",
12 | "import groovy.json.JsonSlurper\n",
13 | " \n",
14 | "fname = \"../resources/bar-chart.vg.json\"\n",
15 | "fileContents = new File(fname).text\n",
16 | "def jsonSlurper = new JsonSlurper()\n",
17 | "def json = jsonSlurper.parseText(fileContents)\n",
18 | "new MIMEContainer(\"application/vnd.vega.v2+json\", json)"
19 | ]
20 | }
21 | ],
22 | "metadata": {
23 | "kernelspec": {
24 | "display_name": "Groovy",
25 | "language": "groovy",
26 | "name": "groovy"
27 | },
28 | "language_info": {
29 | "codemirror_mode": "groovy",
30 | "file_extension": ".groovy",
31 | "mimetype": "",
32 | "name": "Groovy",
33 | "nbconverter_exporter": "",
34 | "version": "2.4.3"
35 | }
36 | },
37 | "nbformat": 4,
38 | "nbformat_minor": 2
39 | }
40 |
--------------------------------------------------------------------------------
/doc/old/GrapeExample.ipynb:
--------------------------------------------------------------------------------
1 | {
2 | "cells": [
3 | {
4 | "cell_type": "code",
5 | "execution_count": null,
6 | "metadata": {},
7 | "outputs": [],
8 | "source": [
9 | "import org.apache.commons.io.Charsets\n",
10 | "println Charsets.US_ASCII "
11 | ]
12 | },
13 | {
14 | "cell_type": "code",
15 | "execution_count": null,
16 | "metadata": {},
17 | "outputs": [],
18 | "source": [
19 | "// https://mvnrepository.com/artifact/commons-io/commons-io\n",
20 | "@Grapes(\n",
21 | " @Grab(group='commons-io', module='commons-io', version='2.5')\n",
22 | ")\n",
23 | "import org.apache.commons.io.Charsets\n",
24 | "println Charsets.US_ASCII "
25 | ]
26 | },
27 | {
28 | "cell_type": "code",
29 | "execution_count": null,
30 | "metadata": {
31 | "collapsed": true
32 | },
33 | "outputs": [],
34 | "source": []
35 | }
36 | ],
37 | "metadata": {
38 | "kernelspec": {
39 | "display_name": "Groovy",
40 | "language": "groovy",
41 | "name": "groovy"
42 | },
43 | "language_info": {
44 | "codemirror_mode": "groovy",
45 | "file_extension": ".groovy",
46 | "mimetype": "",
47 | "name": "Groovy",
48 | "nbconverter_exporter": "",
49 | "version": "2.4.3"
50 | }
51 | },
52 | "nbformat": 4,
53 | "nbformat_minor": 2
54 | }
55 |
--------------------------------------------------------------------------------
/doc/old/MapLikeTable_PythonExample.ipynb:
--------------------------------------------------------------------------------
1 | {
2 | "cells": [
3 | {
4 | "cell_type": "code",
5 | "execution_count": null,
6 | "metadata": {},
7 | "outputs": [],
8 | "source": [
9 | "from beakerx import *\n",
10 | "\n",
11 | "TableDisplay([{'y1':4, 'm3':2, 'z2':1}, {'m3':4, 'z2':2}])"
12 | ]
13 | },
14 | {
15 | "cell_type": "code",
16 | "execution_count": null,
17 | "metadata": {},
18 | "outputs": [],
19 | "source": [
20 | "TableDisplay({\"x\" : 1, \"y\" : 2})"
21 | ]
22 | },
23 | {
24 | "cell_type": "code",
25 | "execution_count": null,
26 | "metadata": {},
27 | "outputs": [],
28 | "source": [
29 | "list = list();\n",
30 | "list.append({\"x\" : 1, \"y\" : 2});\n",
31 | "list.append({\"x\" : 3, \"y\" : 4});\n",
32 | "TableDisplay(list)"
33 | ]
34 | },
35 | {
36 | "cell_type": "code",
37 | "execution_count": null,
38 | "metadata": {},
39 | "outputs": [],
40 | "source": [
41 | "map = [None] * 2\n",
42 | "map[0] = {\"x\" : 1, \"y\" : 2}\n",
43 | "map[1] = {\"x\" : 3, \"y\" : 4}\n",
44 | "TableDisplay(map)"
45 | ]
46 | },
47 | {
48 | "cell_type": "code",
49 | "execution_count": null,
50 | "metadata": {},
51 | "outputs": [],
52 | "source": [
53 | "listOfMap = []\n",
54 | "for idx in range(1, 11):\n",
55 | " listOfMap.append({\"test\": idx})\n",
56 | "TableDisplay(listOfMap)"
57 | ]
58 | },
59 | {
60 | "cell_type": "code",
61 | "execution_count": null,
62 | "metadata": {},
63 | "outputs": [],
64 | "source": [
65 | "myMap = {}\n",
66 | "myList = []\n",
67 | "myList.append([1, 2, 3])\n",
68 | "myList.append([2, 3, 4])\n",
69 | "myMap[1] = myList\n",
70 | "TableDisplay(myMap)"
71 | ]
72 | },
73 | {
74 | "cell_type": "code",
75 | "execution_count": null,
76 | "metadata": {},
77 | "outputs": [],
78 | "source": [
79 | "myMap = {}\n",
80 | "myList = {\"num1\":1, \"num2\":2}\n",
81 | "myMap[0] = myList\n",
82 | "myMap\n",
83 | "TableDisplay(myMap)"
84 | ]
85 | }
86 | ],
87 | "metadata": {
88 | "kernelspec": {
89 | "display_name": "Python 3",
90 | "language": "python",
91 | "name": "python3"
92 | },
93 | "language_info": {
94 | "codemirror_mode": {
95 | "name": "ipython",
96 | "version": 3
97 | },
98 | "file_extension": ".py",
99 | "mimetype": "text/x-python",
100 | "name": "python",
101 | "nbconvert_exporter": "python",
102 | "pygments_lexer": "ipython3",
103 | "version": "3.5.4"
104 | }
105 | },
106 | "nbformat": 4,
107 | "nbformat_minor": 2
108 | }
109 |
--------------------------------------------------------------------------------
/doc/old/OutputCell.HIDDEN.ipynb:
--------------------------------------------------------------------------------
1 | {
2 | "cells": [
3 | {
4 | "cell_type": "code",
5 | "execution_count": null,
6 | "metadata": {},
7 | "outputs": [],
8 | "source": [
9 | "import com.twosigma.beakerx.jvm.object.OutputCell\n",
10 | "\n",
11 | "new Plot().add(new Line(x: [0, 1, 2, 3, 4, 5], y: [0, 1, 6, 5, 2, 8]))\n",
12 | "new Plot().add(new Line(x: (0..5), y: [0, 1, 6, 5, 2, 8]))\n",
13 | "new Plot() << new Line(x: (0..5), y: [0, 1, 6, 5, 2, 8])\n",
14 | "OutputCell.HIDDEN"
15 | ]
16 | },
17 | {
18 | "cell_type": "code",
19 | "execution_count": null,
20 | "metadata": {},
21 | "outputs": [],
22 | "source": [
23 | "import com.twosigma.beakerx.jvm.object.OutputCell\n",
24 | "\n",
25 | "x =10\n",
26 | "OutputCell.HIDDEN"
27 | ]
28 | },
29 | {
30 | "cell_type": "code",
31 | "execution_count": null,
32 | "metadata": {
33 | "collapsed": true
34 | },
35 | "outputs": [],
36 | "source": []
37 | }
38 | ],
39 | "metadata": {
40 | "beakerx_kernel_parameters": {},
41 | "kernelspec": {
42 | "display_name": "Groovy",
43 | "language": "groovy",
44 | "name": "groovy"
45 | },
46 | "language_info": {
47 | "codemirror_mode": "groovy",
48 | "file_extension": ".groovy",
49 | "mimetype": "",
50 | "name": "Groovy",
51 | "nbconverter_exporter": "",
52 | "version": "2.4.3"
53 | }
54 | },
55 | "nbformat": 4,
56 | "nbformat_minor": 1
57 | }
58 |
--------------------------------------------------------------------------------
/doc/old/classpath_add_jar_by_mvn.ipynb:
--------------------------------------------------------------------------------
1 | {
2 | "cells": [
3 | {
4 | "cell_type": "markdown",
5 | "metadata": {},
6 | "source": [
7 | "# %classpath add mvn group name version"
8 | ]
9 | },
10 | {
11 | "cell_type": "code",
12 | "execution_count": null,
13 | "metadata": {},
14 | "outputs": [],
15 | "source": [
16 | "%classpath add mvn com.fasterxml.jackson.core jackson-databind 2.6.5"
17 | ]
18 | },
19 | {
20 | "cell_type": "markdown",
21 | "metadata": {},
22 | "source": [
23 | "# Gson exmaple"
24 | ]
25 | },
26 | {
27 | "cell_type": "code",
28 | "execution_count": null,
29 | "metadata": {},
30 | "outputs": [],
31 | "source": [
32 | "import com.google.gson.Gson;"
33 | ]
34 | },
35 | {
36 | "cell_type": "code",
37 | "execution_count": null,
38 | "metadata": {},
39 | "outputs": [],
40 | "source": [
41 | "%classpath add mvn com.google.code.gson gson 2.2.4"
42 | ]
43 | },
44 | {
45 | "cell_type": "code",
46 | "execution_count": null,
47 | "metadata": {},
48 | "outputs": [],
49 | "source": [
50 | "import com.google.gson.Gson;"
51 | ]
52 | },
53 | {
54 | "cell_type": "code",
55 | "execution_count": null,
56 | "metadata": {},
57 | "outputs": [],
58 | "source": [
59 | "%classpath add mvn com.google.code.gson gson 2.2.4\n",
60 | "\n",
61 | "import com.google.gson.Gson;\n",
62 | "import com.google.gson.GsonBuilder;\n",
63 | "\n",
64 | "Gson gson = new GsonBuilder().create();\n",
65 | "gson.toJson(\"Hello\", System.out);"
66 | ]
67 | },
68 | {
69 | "cell_type": "markdown",
70 | "metadata": {},
71 | "source": [
72 | "# Error handling"
73 | ]
74 | },
75 | {
76 | "cell_type": "code",
77 | "execution_count": null,
78 | "metadata": {},
79 | "outputs": [],
80 | "source": [
81 | "%classpath add mvn com.fasterxml.jackson.XXXXXXX jackson-databind 2.6.5"
82 | ]
83 | },
84 | {
85 | "cell_type": "code",
86 | "execution_count": null,
87 | "metadata": {},
88 | "outputs": [],
89 | "source": [
90 | "%classpath add mvn com.fasterxml.jackson.XXXXXXX jackson-databind"
91 | ]
92 | },
93 | {
94 | "cell_type": "markdown",
95 | "metadata": {},
96 | "source": [
97 | "# Clojars repository\n",
98 | "https://mvnrepository.com/artifact/goog-jar/goog-jar/1.0.0"
99 | ]
100 | },
101 | {
102 | "cell_type": "code",
103 | "execution_count": null,
104 | "metadata": {},
105 | "outputs": [],
106 | "source": [
107 | "%classpath add mvn goog-jar goog-jar 1.0.0"
108 | ]
109 | },
110 | {
111 | "cell_type": "code",
112 | "execution_count": null,
113 | "metadata": {
114 | "collapsed": true
115 | },
116 | "outputs": [],
117 | "source": []
118 | }
119 | ],
120 | "metadata": {
121 | "kernelspec": {
122 | "display_name": "Groovy",
123 | "language": "groovy",
124 | "name": "groovy"
125 | },
126 | "language_info": {
127 | "codemirror_mode": "groovy",
128 | "file_extension": ".groovy",
129 | "mimetype": "",
130 | "name": "Groovy",
131 | "nbconverter_exporter": "",
132 | "version": "2.4.3"
133 | }
134 | },
135 | "nbformat": 4,
136 | "nbformat_minor": 2
137 | }
138 |
--------------------------------------------------------------------------------
/doc/python/InitCells.ipynb:
--------------------------------------------------------------------------------
1 | {
2 | "cells": [
3 | {
4 | "cell_type": "markdown",
5 | "metadata": {},
6 | "source": [
7 | "# Initialization Cells\n",
8 | "\n",
9 | "BeakerX supports them by including the [already existing contributed extension](https://github.com/ipython-contrib/jupyter_contrib_nbextensions/blob/master/src/jupyter_contrib_nbextensions/nbextensions/init_cell/main.js). The View -> Cell Toolbar -> Initialization Cell menu item makes the UI visible. It also adds a calculator button icon to the toolbar to run the init cells.\n",
10 | "\n",
11 | "Initialization cells are not run unless a notebook is trusted. Click on the trust button to enable this feature on a given notebook."
12 | ]
13 | },
14 | {
15 | "cell_type": "code",
16 | "execution_count": 1,
17 | "metadata": {
18 | "init_cell": true
19 | },
20 | "outputs": [
21 | {
22 | "name": "stdout",
23 | "output_type": "stream",
24 | "text": [
25 | "2017-07-16 22:37\n"
26 | ]
27 | }
28 | ],
29 | "source": [
30 | "import time\n",
31 | "print(time.strftime(\"%Y-%m-%d %H:%M\"))"
32 | ]
33 | }
34 | ],
35 | "metadata": {
36 | "beakerx_kernel_parameters": {},
37 | "celltoolbar": "Initialization Cell",
38 | "kernelspec": {
39 | "display_name": "Python 3",
40 | "language": "python",
41 | "name": "python3"
42 | },
43 | "language_info": {
44 | "codemirror_mode": {
45 | "name": "ipython",
46 | "version": 3
47 | },
48 | "file_extension": ".py",
49 | "mimetype": "text/x-python",
50 | "name": "python",
51 | "nbconvert_exporter": "python",
52 | "pygments_lexer": "ipython3",
53 | "version": "3.5.3"
54 | }
55 | },
56 | "nbformat": 4,
57 | "nbformat_minor": 2
58 | }
59 |
--------------------------------------------------------------------------------
/doc/python/ScrollZoom.ipynb:
--------------------------------------------------------------------------------
1 | {
2 | "cells": [
3 | {
4 | "cell_type": "markdown",
5 | "metadata": {},
6 | "source": [
7 | "# Scroll and Zoom\n",
8 | "\n",
9 | "BeakerX's table and plot widgets both support the scroll wheel.\n",
10 | "For tables, the scroll wheel scrolls vertically.\n",
11 | "For plots, the scroll wheel zooms.\n",
12 | "However, for the notebook as a whole, the scroll wheel also has a meaning, to scroll the notebook.\n",
13 | "So there's an ambiguity, and the UI needs a way to resolve it and decide where the scroll events go.\n",
14 | "\n",
15 | "BeakerX's approach starts with idea of *focus*, a widget that would be the target of any user commands.\n",
16 | "And indeed, in BeakerX when you click on a table or a plot, it gets the focus.\n",
17 | "This is represented by a green outline around the widget.\n",
18 | "The outline is styled to match the blue one that Jupyter uses to indicate the current cell.\n",
19 | "\n",
20 | "The widget will keep the focus as long as the mouse remains over it. Feel free to interact with the widget, clicking, scrolling, and zooming away. When you are done and move the mouse elsewhere, the green outline will vanish. Focus is returned to the notebook, and the next scroll event will go to the page, and not to a widget.\n",
21 | "\n",
22 | "This **keyless blur** is a BeakerX innovation.\n",
23 | "\n",
24 | "Try it with the widgets below:"
25 | ]
26 | },
27 | {
28 | "cell_type": "code",
29 | "execution_count": null,
30 | "metadata": {},
31 | "outputs": [],
32 | "source": [
33 | "import pandas as pd\n",
34 | "from beakerx import *"
35 | ]
36 | },
37 | {
38 | "cell_type": "code",
39 | "execution_count": null,
40 | "metadata": {},
41 | "outputs": [],
42 | "source": [
43 | "TableDisplay([{'y1':4, 'm3':2, 'z2':1}, {'m3':4, 'z2':2}])"
44 | ]
45 | },
46 | {
47 | "cell_type": "code",
48 | "execution_count": null,
49 | "metadata": {},
50 | "outputs": [],
51 | "source": [
52 | "pd.read_csv('../resources/data/interest-rates.csv')"
53 | ]
54 | },
55 | {
56 | "cell_type": "code",
57 | "execution_count": null,
58 | "metadata": {},
59 | "outputs": [],
60 | "source": [
61 | "rng = pd.date_range('1/1/2011', periods=1000, freq='H')\n",
62 | "ts = pd.Series(np.random.randn(len(rng)), index=rng)\n",
63 | "df = pd.DataFrame(ts, columns=['mV'])\n",
64 | "SimpleTimePlot(df, ['mV'])"
65 | ]
66 | }
67 | ],
68 | "metadata": {
69 | "kernelspec": {
70 | "display_name": "Python 3",
71 | "language": "python",
72 | "name": "python3"
73 | },
74 | "language_info": {
75 | "codemirror_mode": {
76 | "name": "ipython",
77 | "version": 3
78 | },
79 | "file_extension": ".py",
80 | "mimetype": "text/x-python",
81 | "name": "python",
82 | "nbconvert_exporter": "python",
83 | "pygments_lexer": "ipython3",
84 | "version": "3.6.5"
85 | },
86 | "toc": {
87 | "base_numbering": 1,
88 | "nav_menu": {},
89 | "number_sections": false,
90 | "sideBar": false,
91 | "skip_h1_title": false,
92 | "title_cell": "Table of Contents",
93 | "title_sidebar": "Contents",
94 | "toc_cell": false,
95 | "toc_position": {},
96 | "toc_section_display": false,
97 | "toc_window_display": false
98 | }
99 | },
100 | "nbformat": 4,
101 | "nbformat_minor": 2
102 | }
103 |
--------------------------------------------------------------------------------
/doc/resources/bar-chart.vg.json:
--------------------------------------------------------------------------------
1 | {
2 | "width": 400,
3 | "height": 200,
4 | "padding": {
5 | "top": 10,
6 | "left": 30,
7 | "bottom": 30,
8 | "right": 10
9 | },
10 | "data": [
11 | {
12 | "name": "table",
13 | "values": [
14 | {
15 | "x": 1,
16 | "y": 28
17 | },
18 | {
19 | "x": 2,
20 | "y": 55
21 | },
22 | {
23 | "x": 3,
24 | "y": 43
25 | },
26 | {
27 | "x": 4,
28 | "y": 91
29 | },
30 | {
31 | "x": 5,
32 | "y": 81
33 | },
34 | {
35 | "x": 6,
36 | "y": 53
37 | },
38 | {
39 | "x": 7,
40 | "y": 19
41 | },
42 | {
43 | "x": 8,
44 | "y": 87
45 | },
46 | {
47 | "x": 9,
48 | "y": 52
49 | },
50 | {
51 | "x": 10,
52 | "y": 48
53 | },
54 | {
55 | "x": 11,
56 | "y": 24
57 | },
58 | {
59 | "x": 12,
60 | "y": 49
61 | },
62 | {
63 | "x": 13,
64 | "y": 87
65 | },
66 | {
67 | "x": 14,
68 | "y": 66
69 | },
70 | {
71 | "x": 15,
72 | "y": 17
73 | },
74 | {
75 | "x": 16,
76 | "y": 27
77 | },
78 | {
79 | "x": 17,
80 | "y": 68
81 | },
82 | {
83 | "x": 18,
84 | "y": 16
85 | },
86 | {
87 | "x": 19,
88 | "y": 49
89 | },
90 | {
91 | "x": 20,
92 | "y": 15
93 | }
94 | ]
95 | }
96 | ],
97 | "scales": [
98 | {
99 | "name": "x",
100 | "type": "ordinal",
101 | "range": "width",
102 | "domain": {
103 | "data": "table",
104 | "field": "x"
105 | }
106 | },
107 | {
108 | "name": "y",
109 | "type": "linear",
110 | "range": "height",
111 | "domain": {
112 | "data": "table",
113 | "field": "y"
114 | },
115 | "nice": true
116 | }
117 | ],
118 | "axes": [
119 | {
120 | "type": "x",
121 | "scale": "x"
122 | },
123 | {
124 | "type": "y",
125 | "scale": "y"
126 | }
127 | ],
128 | "marks": [
129 | {
130 | "type": "rect",
131 | "from": {
132 | "data": "table"
133 | },
134 | "properties": {
135 | "enter": {
136 | "x": {
137 | "scale": "x",
138 | "field": "x"
139 | },
140 | "width": {
141 | "scale": "x",
142 | "band": true,
143 | "offset": -1
144 | },
145 | "y": {
146 | "scale": "y",
147 | "field": "y"
148 | },
149 | "y2": {
150 | "scale": "y",
151 | "value": 0
152 | }
153 | },
154 | "update": {
155 | "fill": {
156 | "value": "steelblue"
157 | }
158 | },
159 | "hover": {
160 | "fill": {
161 | "value": "red"
162 | }
163 | }
164 | }
165 | }
166 | ]
167 | }
--------------------------------------------------------------------------------
/doc/resources/data/flint-demo.csv:
--------------------------------------------------------------------------------
1 | time,id,price,info
2 | 1000,7,0.5,test
3 | 1000,3,1,test
4 | 1050,3,1.5,test
5 | 1050,7,2,test
6 | 1100,3,2.5,test
7 | 1100,7,3,test
8 | 1150,3,3.5,test
9 | 1150,7,4,test
10 | 1200,3,4.5,test
11 | 1200,7,5,test
12 | 1250,3,5.5,test
13 | 1250,7,6,test
--------------------------------------------------------------------------------
/doc/resources/data/interest-rates-small.csv:
--------------------------------------------------------------------------------
1 | "m3","y30","y1","m6","y2","y10","y3","time","y5","y7","spread"
2 | "8.1700","8.5632","8.3500","8.2800","8.6268","8.5886","8.6273","1990-03-30 19:00:00.000 -0500","8.6005","8.6482","0.4186"
3 | "7.2905","8.5405","7.3135","7.3850","7.5995","8.3920","7.7370","1990-11-29 19:00:00.000 -0500","8.0225","8.2765","1.1015"
4 | "6.1163","8.0342","6.2668","6.1947","6.8668","7.8547","7.0774","1991-02-27 19:00:00.000 -0500","7.4726","7.7326","1.7384"
5 | "6.0935","8.2880","6.3960","6.1985","7.1030","8.1100","7.3535","1991-03-30 19:00:00.000 -0500","7.7720","8.0025","2.0165"
6 | "5.8255","8.2095","6.2359","5.9768","6.9482","8.0391","7.2318","1991-04-29 20:00:00.000 -0400","7.7009","7.9227","2.2136"
7 | "3.9062","7.5819","4.1510","4.0100","4.9581","7.0324","5.3957","1992-01-30 19:00:00.000 -0500","6.2429","6.7048","3.1262"
8 | "4.1386","7.9695","4.6345","4.3309","5.6850","7.5423","6.1832","1992-03-30 19:00:00.000 -0500","6.9455","7.2573","3.4036"
9 | "3.8390","7.9624","4.2990","4.0029","5.3443","7.4805","5.9252","1992-04-29 20:00:00.000 -0400","6.7843","7.1529","3.6414"
10 | "1.7136","NaN","1.9609","1.7364","2.5568","4.6532","3.0109","2002-07-30 20:00:00.000 -0400","3.8073","4.3041","2.9395"
11 | "0.9552","NaN","1.2376","1.0290","1.7062","4.2743","2.2333","2003-09-29 20:00:00.000 -0400","3.1848","3.7443","3.3190"
12 | "0.9418","NaN","1.2541","1.0195","1.7477","4.2905","2.2636","2003-10-30 19:00:00.000 -0500","3.1859","3.7514","3.3486"
13 | "2.5795","NaN","3.0295","2.8458","3.3847","4.1653","3.5353","2005-02-27 19:00:00.000 -0500","3.7663","3.9658","1.5858"
14 | "4.9177","5.1541","5.1550","5.1727","5.1218","5.1064","5.0882","2006-06-29 20:00:00.000 -0400","5.0673","5.0755","0.1886"
15 | "0.1576","3.9943","0.2914","0.2005","0.6167","3.0114","0.9786","2010-07-30 20:00:00.000 -0400","1.7629","2.4343","2.8538"
16 |
17 |
--------------------------------------------------------------------------------
/doc/resources/data/long_lines.csv:
--------------------------------------------------------------------------------
1 | col_1,col_2,col_3
2 | "this is a huge column. this is a huge column. this is a huge column. this is a huge column. this is a huge column. this is a huge column. this is a huge column. this is a huge column. this is a huge column. this is a huge column. this is a huge column. this is a huge column. this is a huge column. this is a huge column. this is a huge column. this is a huge column. this is a huge column. this is a huge column. this is a huge column. this is a huge column. this is a huge column. this is a huge column. this is a huge column. this is a huge column. this is a huge column. this is a huge column. this is a huge column. this is a huge column. this is a huge column. this is a huge column. this is a huge column. this is a huge column. this is a huge column. this is a huge column. this is a huge column. this is a huge column. this is a huge column. this is a huge column. this is a huge column. this is a huge column. this is a huge column. this is a huge column. this is a huge column. this is a huge column. this is a huge column. this is a huge column.", foo, bar
3 |
--------------------------------------------------------------------------------
/doc/resources/img/JVMoptions.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twosigma/beakerx/b9c301e37a8b17827f384ee4af83a1e4b4528b43/doc/resources/img/JVMoptions.png
--------------------------------------------------------------------------------
/doc/resources/img/USmapbg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twosigma/beakerx/b9c301e37a8b17827f384ee4af83a1e4b4528b43/doc/resources/img/USmapbg.png
--------------------------------------------------------------------------------
/doc/resources/img/atom.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/doc/resources/img/butterfly1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twosigma/beakerx/b9c301e37a8b17827f384ee4af83a1e4b4528b43/doc/resources/img/butterfly1.jpg
--------------------------------------------------------------------------------
/doc/resources/img/butterfly2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twosigma/beakerx/b9c301e37a8b17827f384ee4af83a1e4b4528b43/doc/resources/img/butterfly2.jpg
--------------------------------------------------------------------------------
/doc/resources/img/butterfly3.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twosigma/beakerx/b9c301e37a8b17827f384ee4af83a1e4b4528b43/doc/resources/img/butterfly3.jpg
--------------------------------------------------------------------------------
/doc/resources/img/widgetArch.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twosigma/beakerx/b9c301e37a8b17827f384ee4af83a1e4b4528b43/doc/resources/img/widgetArch.png
--------------------------------------------------------------------------------
/doc/resources/jar/BeakerXClasspathTest.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twosigma/beakerx/b9c301e37a8b17827f384ee4af83a1e4b4528b43/doc/resources/jar/BeakerXClasspathTest.jar
--------------------------------------------------------------------------------
/doc/resources/jar/demo.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twosigma/beakerx/b9c301e37a8b17827f384ee4af83a1e4b4528b43/doc/resources/jar/demo.jar
--------------------------------------------------------------------------------
/doc/resources/jar/loadMagicJarDemo.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twosigma/beakerx/b9c301e37a8b17827f384ee4af83a1e4b4528b43/doc/resources/jar/loadMagicJarDemo.jar
--------------------------------------------------------------------------------
/doc/scala/Scala.ipynb:
--------------------------------------------------------------------------------
1 | {
2 | "cells": [
3 | {
4 | "cell_type": "markdown",
5 | "metadata": {},
6 | "source": [
7 | "# Scala\n",
8 | "\n",
9 | "[Scala](https://www.scala-lang.org/) combines the functional/type-inference paradigm and the object-oriented paradigm, and is also meant to be an improved version of Java. Scala is the native language of [Apache Spark](Spark.ipynb).\n",
10 | "\n",
11 | "BeakerX has Scala APIs for [EasyForm](EasyForm.ipynb), [Tables](TableAPI.ipynb), and [Plotting](Plot.ipynb)."
12 | ]
13 | },
14 | {
15 | "cell_type": "code",
16 | "execution_count": null,
17 | "metadata": {},
18 | "outputs": [],
19 | "source": [
20 | "class Greeter(prefix: String, suffix: String) {\n",
21 | " def greet(name: String): Unit =\n",
22 | " println(prefix + name + suffix)\n",
23 | "}"
24 | ]
25 | },
26 | {
27 | "cell_type": "code",
28 | "execution_count": null,
29 | "metadata": {},
30 | "outputs": [],
31 | "source": [
32 | "val greeter = new Greeter(\"Hello, \", \"!\")\n",
33 | "greeter.greet(\"Scala developer\") // Hello, Scala developer!"
34 | ]
35 | },
36 | {
37 | "cell_type": "code",
38 | "execution_count": null,
39 | "metadata": {},
40 | "outputs": [],
41 | "source": [
42 | "new Plot { title = \"Interactive Plots in Scala\"}.add(new Bars { y = Seq(3, 5, 2, 3, 7)})"
43 | ]
44 | }
45 | ],
46 | "metadata": {
47 | "beakerx_kernel_parameters": {},
48 | "kernelspec": {
49 | "display_name": "Scala",
50 | "language": "scala",
51 | "name": "scala"
52 | },
53 | "language_info": {
54 | "codemirror_mode": "text/x-scala",
55 | "file_extension": ".scala",
56 | "mimetype": "",
57 | "name": "Scala",
58 | "nbconverter_exporter": "",
59 | "version": "2.11.12"
60 | }
61 | },
62 | "nbformat": 4,
63 | "nbformat_minor": 1
64 | }
65 |
--------------------------------------------------------------------------------
/doc/scala/Spark.ipynb:
--------------------------------------------------------------------------------
1 | {
2 | "cells": [
3 | {
4 | "cell_type": "markdown",
5 | "metadata": {},
6 | "source": [
7 | "# Spark\n",
8 | "\n",
9 | "[Apache Spark](https://spark.apache.org/) is a lightning-fast cluster computing API based on Scala.\n",
10 | "This notebook shows how you can load and use Spark just like any other library.\n",
11 | "There is also a [Spark Magic](SparkUI.ipynb) that enables deeper integration."
12 | ]
13 | },
14 | {
15 | "cell_type": "code",
16 | "execution_count": null,
17 | "metadata": {
18 | "scrolled": false
19 | },
20 | "outputs": [],
21 | "source": [
22 | "%classpath add mvn org.apache.spark spark-sql_2.12 2.4.4\n",
23 | "org.apache.log4j.Logger.getRootLogger().setLevel(org.apache.log4j.Level.ERROR);"
24 | ]
25 | },
26 | {
27 | "cell_type": "code",
28 | "execution_count": null,
29 | "metadata": {},
30 | "outputs": [],
31 | "source": [
32 | "import org.apache.spark.sql.SparkSession\n",
33 | "\n",
34 | "val spark = SparkSession.builder()\n",
35 | " .appName(\"Simple Application\")\n",
36 | " .master(\"local[4]\")\n",
37 | " .config(\"spark.ui.enabled\", \"false\")\n",
38 | " .getOrCreate()"
39 | ]
40 | },
41 | {
42 | "cell_type": "code",
43 | "execution_count": null,
44 | "metadata": {},
45 | "outputs": [],
46 | "source": [
47 | "val NUM_SAMPLES = 10000000\n",
48 | "val count = spark.sparkContext.parallelize(1 to NUM_SAMPLES).map{i =>\n",
49 | " val x = math.random\n",
50 | " val y = math.random\n",
51 | " if (x*x + y*y < 1) 1 else 0\n",
52 | "}.reduce(_ + _)\n",
53 | "\n",
54 | "println(\"Pi is roughly \" + 4.0 * count / NUM_SAMPLES)"
55 | ]
56 | },
57 | {
58 | "cell_type": "code",
59 | "execution_count": null,
60 | "metadata": {},
61 | "outputs": [],
62 | "source": [
63 | "spark.stop()"
64 | ]
65 | },
66 | {
67 | "cell_type": "code",
68 | "execution_count": null,
69 | "metadata": {},
70 | "outputs": [],
71 | "source": []
72 | }
73 | ],
74 | "metadata": {
75 | "kernelspec": {
76 | "display_name": "Scala",
77 | "language": "scala",
78 | "name": "scala"
79 | },
80 | "language_info": {
81 | "codemirror_mode": "text/x-scala",
82 | "file_extension": ".scala",
83 | "mimetype": "",
84 | "name": "Scala",
85 | "nbconverter_exporter": "",
86 | "version": "2.12.8"
87 | },
88 | "toc": {
89 | "base_numbering": 1,
90 | "nav_menu": {},
91 | "number_sections": false,
92 | "sideBar": false,
93 | "skip_h1_title": false,
94 | "title_cell": "Table of Contents",
95 | "title_sidebar": "Contents",
96 | "toc_cell": false,
97 | "toc_position": {},
98 | "toc_section_display": false,
99 | "toc_window_display": false
100 | }
101 | },
102 | "nbformat": 4,
103 | "nbformat_minor": 2
104 | }
105 |
--------------------------------------------------------------------------------
/docker/jupyter_notebook_config.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) Jupyter Development Team.
2 | # Distributed under the terms of the Modified BSD License.
3 |
4 | import errno
5 | import os
6 | import stat
7 | import subprocess
8 | from jupyter_core.paths import jupyter_data_dir
9 |
10 | c = get_config()
11 | c.NotebookApp.ip = '0.0.0.0'
12 | c.NotebookApp.port = 8888
13 | c.NotebookApp.open_browser = False
14 |
15 | # Generate a self-signed certificate
16 | if 'GEN_CERT' in os.environ:
17 | dir_name = jupyter_data_dir()
18 | pem_file = os.path.join(dir_name, 'notebook.pem')
19 | try:
20 | os.makedirs(dir_name)
21 | except OSError as exc: # Python >2.5
22 | if exc.errno == errno.EEXIST and os.path.isdir(dir_name):
23 | pass
24 | else:
25 | raise
26 | # Generate a certificate if one doesn't exist on disk
27 | subprocess.check_call(['openssl', 'req', '-new',
28 | '-newkey', 'rsa:2048',
29 | '-days', '365',
30 | '-nodes', '-x509',
31 | '-subj', '/C=XX/ST=XX/L=XX/O=generated/CN=generated',
32 | '-keyout', pem_file,
33 | '-out', pem_file])
34 | # Restrict access to the file
35 | os.chmod(pem_file, stat.S_IRUSR | stat.S_IWUSR)
36 | c.NotebookApp.certfile = pem_file
37 |
--------------------------------------------------------------------------------
/docker/setup.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # Copyright 2017 TWO SIGMA OPEN SOURCE, LLC
3 | #
4 | # Licensed under the Apache License, Version 2.0 (the "License");
5 | # you may not use this file except in compliance with the License.
6 | # You may obtain a copy of the License at
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS,
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | # See the License for the specific language governing permissions and
14 | # limitations under the License.
15 |
16 | set -ex
17 | source activate beakerx
18 |
19 | (cd beakerx_kernel_base; ./gradlew clean install)
20 | (cd beakerx_kernel_groovy/groovy-dist; pip install -r requirements.txt --verbose; beakerx_kernel_groovy install)
21 | (cd beakerx_kernel_java/java-dist; pip install -r requirements.txt --verbose; beakerx_kernel_java install)
22 | (cd beakerx_kernel_scala/scala-dist; pip install -r requirements.txt --verbose; beakerx_kernel_scala install)
23 | (cd beakerx_kernel_kotlin/kotlin-dist; pip install -r requirements.txt --verbose; beakerx_kernel_kotlin install)
24 | (cd beakerx_kernel_sql/sql-dist; pip install -r requirements.txt --verbose; beakerx_kernel_sql install)
25 | (cd beakerx_kernel_clojure/clojure-dist; pip install -r requirements.txt --verbose; beakerx_kernel_clojure install)
26 | (cd beakerx_kernel_autotranslation; pip install -r requirements.txt --verbose; beakerx_kernel_autotranslation install)
27 | (cd beakerx_base; pip install -r requirements.txt --verbose)
28 | (cd beakerx_tabledisplay/beakerx_tabledisplay; pip install -r requirements.txt --verbose; beakerx_tabledisplay install)
29 | (cd beakerx_widgets/beakerx; pip install -r requirements.txt --verbose; beakerx install)
30 |
31 | #jupyter labextension install @jupyter-widgets/jupyterlab-manager --no-build
32 | #(cd js/lab; jupyter labextension install . --no-build)
33 | #(cd js/lab-theme-dark; jupyter labextension install . --no-build)
34 | #(cd js/lab-theme-light; jupyter labextension install . --no-build)
35 | #jupyter lab build
36 |
37 | rm -rf docker .DS_Store .git .gradle .idea jitpack.yml kernel RELEASE.md test .cache .yarn .local logs .ipynb_checkpoints
38 |
--------------------------------------------------------------------------------
/docker/start-notebook.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # Copyright (c) Jupyter Development Team.
3 | # Distributed under the terms of the Modified BSD License.
4 |
5 | set -e
6 |
7 | if [[ ! -z "${JUPYTERHUB_API_TOKEN}" ]]; then
8 | # launched by JupyterHub, use single-user entrypoint
9 | exec /usr/local/bin/start-singleuser.sh $*
10 | else
11 | . /usr/local/bin/start.sh jupyter notebook $*
12 | fi
13 |
--------------------------------------------------------------------------------
/docker/start-singleuser.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # Copyright (c) Jupyter Development Team.
3 | # Distributed under the terms of the Modified BSD License.
4 |
5 | set -e
6 |
7 | notebook_arg=""
8 | if [ -n "${NOTEBOOK_DIR:+x}" ]
9 | then
10 | notebook_arg="--notebook-dir=${NOTEBOOK_DIR}"
11 | fi
12 |
13 | . /usr/local/bin/start.sh jupyterhub-singleuser \
14 | --port=${JPY_PORT:-8888} \
15 | --ip=0.0.0.0 \
16 | --user=$JPY_USER \
17 | --cookie-name=$JPY_COOKIE_NAME \
18 | --base-url=$JPY_BASE_URL \
19 | --hub-prefix=$JPY_HUB_PREFIX \
20 | --hub-api-url=$JPY_HUB_API_URL \
21 | ${notebook_arg} \
22 | $@
23 |
--------------------------------------------------------------------------------
/docker/start.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # Copyright (c) Jupyter Development Team.
3 | # Distributed under the terms of the Modified BSD License.
4 |
5 | source activate beakerx
6 | set -e
7 |
8 | # Handle special flags if we're root
9 | if [ $UID == 0 ] ; then
10 | # Change UID of NB_USER to NB_UID if it does not match
11 | if [ "$NB_UID" != $(id -u $NB_USER) ] ; then
12 | echo "Set user UID to: $NB_UID"
13 | usermod -u $NB_UID $NB_USER
14 | # Careful: $HOME might resolve to /root depending on how the
15 | # container is started. Use the $NB_USER home path explicitly.
16 | for d in "$CONDA_DIR" "$JULIA_PKGDIR" "/home/$NB_USER"; do
17 | if [[ ! -z "$d" && -d "$d" ]]; then
18 | echo "Set ownership to uid $NB_UID: $d"
19 | chown -R $NB_UID "$d"
20 | fi
21 | done
22 | fi
23 |
24 | # Change GID of NB_USER to NB_GID if NB_GID is passed as a parameter
25 | if [ "$NB_GID" ] ; then
26 | echo "Change GID to $NB_GID"
27 | groupmod -g $NB_GID -o $(id -g -n $NB_USER)
28 | fi
29 |
30 | # Enable sudo if requested
31 | if [ ! -z "$GRANT_SUDO" ]; then
32 | # Ensure includedir sudoers.d is not commented
33 | sed -i -E 's|^#(includedir /etc/sudoers.d.*)|\1|g' /etc/sudoers
34 | echo "$NB_USER ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/notebook
35 | fi
36 |
37 | # Exec the command as NB_USER
38 | echo "Execute the command as $NB_USER"
39 | exec su $NB_USER -c "env PATH=$PATH $*"
40 | else
41 | # Exec the command
42 | echo "Execute the command"
43 | exec $*
44 | fi
45 |
--------------------------------------------------------------------------------
/jitpack.yml:
--------------------------------------------------------------------------------
1 | jdk:
2 | - oraclejdk8
3 |
4 | install:
5 | - ./kernel/gradlew -p kernel/base publishToMavenLocal
6 | - ./kernel/gradlew -p kernel/clojure publishToMavenLocal
7 | - ./kernel/gradlew -p kernel/groovy publishToMavenLocal
8 | - ./kernel/gradlew -p kernel/java publishToMavenLocal
9 | - ./kernel/gradlew -p kernel/scala publishToMavenLocal
10 |
11 |
--------------------------------------------------------------------------------
/test/ipynb/clojure/InfiniteLoopClojureTest.ipynb:
--------------------------------------------------------------------------------
1 | {
2 | "cells": [
3 | {
4 | "cell_type": "code",
5 | "execution_count": null,
6 | "metadata": {},
7 | "outputs": [],
8 | "source": [
9 | "(loop [] ( ) (recur))"
10 | ]
11 | },
12 | {
13 | "cell_type": "code",
14 | "execution_count": null,
15 | "metadata": {},
16 | "outputs": [],
17 | "source": []
18 | }
19 | ],
20 | "metadata": {
21 | "kernelspec": {
22 | "display_name": "Clojure",
23 | "language": "clojure",
24 | "name": "clojure"
25 | },
26 | "language_info": {
27 | "codemirror_mode": "Clojure",
28 | "file_extension": ".clj",
29 | "mimetype": "text/x-clojure",
30 | "name": "Clojure",
31 | "nbconverter_exporter": "",
32 | "version": "1.9.0"
33 | },
34 | "toc": {
35 | "base_numbering": 1,
36 | "nav_menu": {},
37 | "number_sections": false,
38 | "sideBar": false,
39 | "skip_h1_title": false,
40 | "title_cell": "Table of Contents",
41 | "title_sidebar": "Contents",
42 | "toc_cell": false,
43 | "toc_position": {},
44 | "toc_section_display": false,
45 | "toc_window_display": false
46 | }
47 | },
48 | "nbformat": 4,
49 | "nbformat_minor": 2
50 | }
51 |
--------------------------------------------------------------------------------
/test/ipynb/clojure/autotranslation_between_kernels.ipynb:
--------------------------------------------------------------------------------
1 | {
2 | "cells": [
3 | {
4 | "cell_type": "code",
5 | "execution_count": null,
6 | "metadata": {},
7 | "outputs": [],
8 | "source": [
9 | "%%clojure\n",
10 | "(beakerx :set \"foo\" 1)"
11 | ]
12 | },
13 | {
14 | "cell_type": "code",
15 | "execution_count": null,
16 | "metadata": {},
17 | "outputs": [],
18 | "source": [
19 | "%%clojure\n",
20 | "(beakerx :get \"foo\")"
21 | ]
22 | },
23 | {
24 | "cell_type": "code",
25 | "execution_count": null,
26 | "metadata": {},
27 | "outputs": [],
28 | "source": [
29 | "%%javascript\n",
30 | "beakerx.person = [{firstName:\"John\", lastName:\"Doe\", age:26}, {firstName:\"Amanda\", lastName:\"Smith\", age:33}]"
31 | ]
32 | },
33 | {
34 | "cell_type": "code",
35 | "execution_count": null,
36 | "metadata": {},
37 | "outputs": [],
38 | "source": [
39 | "%%clojure\n",
40 | "(((beakerx :get \"person\") 1) \"firstName\")"
41 | ]
42 | },
43 | {
44 | "cell_type": "code",
45 | "execution_count": null,
46 | "metadata": {},
47 | "outputs": [],
48 | "source": []
49 | }
50 | ],
51 | "metadata": {
52 | "kernelspec": {
53 | "display_name": "Groovy",
54 | "language": "groovy",
55 | "name": "groovy"
56 | },
57 | "language_info": {
58 | "codemirror_mode": "groovy",
59 | "file_extension": ".groovy",
60 | "mimetype": "",
61 | "name": "Groovy",
62 | "nbconverter_exporter": "",
63 | "version": "2.4.3"
64 | },
65 | "toc": {
66 | "base_numbering": 1,
67 | "nav_menu": {},
68 | "number_sections": false,
69 | "sideBar": false,
70 | "skip_h1_title": false,
71 | "title_cell": "Table of Contents",
72 | "title_sidebar": "Contents",
73 | "toc_cell": false,
74 | "toc_position": {},
75 | "toc_section_display": false,
76 | "toc_window_display": false
77 | }
78 | },
79 | "nbformat": 4,
80 | "nbformat_minor": 2
81 | }
82 |
--------------------------------------------------------------------------------
/test/ipynb/clojure/autotranslation_for_clojure.ipynb:
--------------------------------------------------------------------------------
1 | {
2 | "cells": [
3 | {
4 | "cell_type": "code",
5 | "execution_count": null,
6 | "metadata": {},
7 | "outputs": [],
8 | "source": [
9 | "(beakerx :set \"foo\" 1)"
10 | ]
11 | },
12 | {
13 | "cell_type": "code",
14 | "execution_count": null,
15 | "metadata": {},
16 | "outputs": [],
17 | "source": [
18 | "(beakerx :get \"foo\")"
19 | ]
20 | },
21 | {
22 | "cell_type": "code",
23 | "execution_count": null,
24 | "metadata": {},
25 | "outputs": [],
26 | "source": [
27 | "%%javascript\n",
28 | "console.log(beakerx.foo)"
29 | ]
30 | },
31 | {
32 | "cell_type": "code",
33 | "execution_count": null,
34 | "metadata": {},
35 | "outputs": [],
36 | "source": [
37 | "%%javascript\n",
38 | "beakerx.foo = 2"
39 | ]
40 | },
41 | {
42 | "cell_type": "code",
43 | "execution_count": null,
44 | "metadata": {},
45 | "outputs": [],
46 | "source": [
47 | "(beakerx :get \"foo\")"
48 | ]
49 | },
50 | {
51 | "cell_type": "code",
52 | "execution_count": null,
53 | "metadata": {},
54 | "outputs": [],
55 | "source": []
56 | }
57 | ],
58 | "metadata": {
59 | "kernelspec": {
60 | "display_name": "Clojure",
61 | "language": "clojure",
62 | "name": "clojure"
63 | },
64 | "language_info": {
65 | "codemirror_mode": "Clojure",
66 | "file_extension": ".clj",
67 | "mimetype": "text/x-clojure",
68 | "name": "Clojure",
69 | "nbconverter_exporter": "",
70 | "version": "1.9.0"
71 | },
72 | "toc": {
73 | "base_numbering": 1,
74 | "nav_menu": {},
75 | "number_sections": false,
76 | "sideBar": false,
77 | "skip_h1_title": false,
78 | "title_cell": "Table of Contents",
79 | "title_sidebar": "Contents",
80 | "toc_cell": false,
81 | "toc_position": {},
82 | "toc_section_display": false,
83 | "toc_window_display": false
84 | }
85 | },
86 | "nbformat": 4,
87 | "nbformat_minor": 2
88 | }
89 |
--------------------------------------------------------------------------------
/test/ipynb/groovy/AsyncMagicCommand.ipynb:
--------------------------------------------------------------------------------
1 | {
2 | "cells": [
3 | {
4 | "cell_type": "code",
5 | "execution_count": null,
6 | "metadata": {
7 | "tags": [
8 | "tag1"
9 | ]
10 | },
11 | "outputs": [],
12 | "source": [
13 | "System.out.println(\"Hello tag\")\n",
14 | "\"ok\""
15 | ]
16 | },
17 | {
18 | "cell_type": "code",
19 | "execution_count": null,
20 | "metadata": {},
21 | "outputs": [],
22 | "source": [
23 | "%%async --then tag1\n",
24 | "Thread.sleep(4000)\n",
25 | "System.out.println(\"Async 1\")\n",
26 | "1+1"
27 | ]
28 | },
29 | {
30 | "cell_type": "code",
31 | "execution_count": null,
32 | "metadata": {},
33 | "outputs": [],
34 | "source": [
35 | "%%async\n",
36 | "println(\"background thread start7\")\n",
37 | "indextasync7 = 0\n",
38 | "while(indextasync7<10){\n",
39 | " Thread.sleep(1000)\n",
40 | " println(\"tick7 \" + indextasync7) \n",
41 | " indextasync7++\n",
42 | "};\n",
43 | "1+3"
44 | ]
45 | },
46 | {
47 | "cell_type": "code",
48 | "execution_count": null,
49 | "metadata": {},
50 | "outputs": [],
51 | "source": []
52 | }
53 | ],
54 | "metadata": {
55 | "celltoolbar": "Tags",
56 | "kernelspec": {
57 | "display_name": "Groovy",
58 | "language": "groovy",
59 | "name": "groovy"
60 | },
61 | "language_info": {
62 | "codemirror_mode": "groovy",
63 | "file_extension": ".groovy",
64 | "mimetype": "",
65 | "name": "Groovy",
66 | "nbconverter_exporter": "",
67 | "version": "2.4.3"
68 | },
69 | "toc": {
70 | "base_numbering": 1,
71 | "nav_menu": {},
72 | "number_sections": false,
73 | "sideBar": false,
74 | "skip_h1_title": false,
75 | "title_cell": "Table of Contents",
76 | "title_sidebar": "Contents",
77 | "toc_cell": false,
78 | "toc_position": {},
79 | "toc_section_display": false,
80 | "toc_window_display": false
81 | }
82 | },
83 | "nbformat": 4,
84 | "nbformat_minor": 2
85 | }
86 |
--------------------------------------------------------------------------------
/test/ipynb/groovy/AutoTranslationGroovyTest.ipynb:
--------------------------------------------------------------------------------
1 | {
2 | "cells": [
3 | {
4 | "cell_type": "code",
5 | "execution_count": null,
6 | "metadata": {},
7 | "outputs": [],
8 | "source": [
9 | "def nodes = []\n",
10 | "\n",
11 | "for (x in (0..10)){\n",
12 | " nodes.add(radius: x*5 + 5, colorB:(x*20))\n",
13 | "}\n",
14 | "\n",
15 | "beakerx.testData = [nodes: nodes]\n",
16 | "OutputCell.HIDDEN"
17 | ]
18 | },
19 | {
20 | "cell_type": "code",
21 | "execution_count": null,
22 | "metadata": {},
23 | "outputs": [],
24 | "source": [
25 | "%%javascript\n",
26 | "require.config({\n",
27 | " paths: {\n",
28 | " d3: '//cdnjs.cloudflare.com/ajax/libs/d3/4.9.1/d3.min'\n",
29 | " }});"
30 | ]
31 | },
32 | {
33 | "cell_type": "code",
34 | "execution_count": null,
35 | "metadata": {},
36 | "outputs": [],
37 | "source": [
38 | "%%html\n",
39 | ""
45 | ]
46 | },
47 | {
48 | "cell_type": "code",
49 | "execution_count": null,
50 | "metadata": {},
51 | "outputs": [],
52 | "source": [
53 | "%%javascript\n",
54 | "\n",
55 | "beakerx.displayHTML(this, '');\n",
56 | "\n",
57 | "var testData = beakerx.testData\n",
58 | "\n",
59 | "var d3 = require(['d3'], function (d3) {\n",
60 | " \n",
61 | " var width = 600,\n",
62 | " height = 200;\n",
63 | "\n",
64 | " var svg = d3.select(\"#bkrx\")\n",
65 | " .append(\"svg\")\n",
66 | " .attr(\"width\", width)\n",
67 | " .attr(\"height\", height)\n",
68 | " .attr(\"transform\", \"translate(\"+[100, 0]+\")\");\n",
69 | "\n",
70 | " var node = svg.selectAll()\n",
71 | " .data(testData.nodes)\n",
72 | " .enter().append(\"circle\")\n",
73 | " .attr(\"class\", \"moon\")\n",
74 | " .attr(\"r\", function(d) { return d.radius; })\n",
75 | " .attr(\"cx\", function(d, i) { return i*40 + d.radius; })\n",
76 | " .attr(\"cy\", function(d, i) { return 50 + d.radius; })\n",
77 | " .style(\"fill\", function(d) { return d3.rgb(100, 100 , d.colorB); }); \n",
78 | "});"
79 | ]
80 | },
81 | {
82 | "cell_type": "code",
83 | "execution_count": null,
84 | "metadata": {},
85 | "outputs": [],
86 | "source": []
87 | }
88 | ],
89 | "metadata": {
90 | "kernelspec": {
91 | "display_name": "Groovy",
92 | "language": "groovy",
93 | "name": "groovy"
94 | },
95 | "language_info": {
96 | "codemirror_mode": "groovy",
97 | "file_extension": ".groovy",
98 | "mimetype": "",
99 | "name": "Groovy",
100 | "nbconverter_exporter": "",
101 | "version": "2.4.3"
102 | }
103 | },
104 | "nbformat": 4,
105 | "nbformat_minor": 2
106 | }
107 |
--------------------------------------------------------------------------------
/test/ipynb/groovy/AutotranslationBetweenKernels.ipynb:
--------------------------------------------------------------------------------
1 | {
2 | "cells": [
3 | {
4 | "cell_type": "code",
5 | "execution_count": null,
6 | "metadata": {},
7 | "outputs": [],
8 | "source": [
9 | "beakerx.x =1"
10 | ]
11 | },
12 | {
13 | "cell_type": "code",
14 | "execution_count": null,
15 | "metadata": {},
16 | "outputs": [],
17 | "source": [
18 | "%%javascript\n",
19 | "console.log(beakerx.x)\n",
20 | "beakerx.x =2"
21 | ]
22 | },
23 | {
24 | "cell_type": "code",
25 | "execution_count": null,
26 | "metadata": {},
27 | "outputs": [],
28 | "source": [
29 | "beakerx.x"
30 | ]
31 | },
32 | {
33 | "cell_type": "code",
34 | "execution_count": null,
35 | "metadata": {},
36 | "outputs": [],
37 | "source": [
38 | "%%scala\n",
39 | "beakerx.x"
40 | ]
41 | },
42 | {
43 | "cell_type": "code",
44 | "execution_count": null,
45 | "metadata": {},
46 | "outputs": [],
47 | "source": [
48 | "%%scala\n",
49 | "beakerx.x = 3"
50 | ]
51 | },
52 | {
53 | "cell_type": "code",
54 | "execution_count": null,
55 | "metadata": {},
56 | "outputs": [],
57 | "source": [
58 | "beakerx.x"
59 | ]
60 | },
61 | {
62 | "cell_type": "code",
63 | "execution_count": null,
64 | "metadata": {},
65 | "outputs": [],
66 | "source": [
67 | "%%java\n",
68 | "beakerx.get(\"x\")"
69 | ]
70 | }
71 | ],
72 | "metadata": {
73 | "kernelspec": {
74 | "display_name": "Groovy",
75 | "language": "groovy",
76 | "name": "groovy"
77 | },
78 | "language_info": {
79 | "codemirror_mode": "groovy",
80 | "file_extension": ".groovy",
81 | "mimetype": "",
82 | "name": "Groovy",
83 | "nbconverter_exporter": "",
84 | "version": "2.5.6"
85 | },
86 | "toc": {
87 | "base_numbering": 1,
88 | "nav_menu": {},
89 | "number_sections": false,
90 | "sideBar": false,
91 | "skip_h1_title": false,
92 | "title_cell": "Table of Contents",
93 | "title_sidebar": "Contents",
94 | "toc_cell": false,
95 | "toc_position": {},
96 | "toc_section_display": false,
97 | "toc_window_display": false
98 | }
99 | },
100 | "nbformat": 4,
101 | "nbformat_minor": 2
102 | }
103 |
--------------------------------------------------------------------------------
/test/ipynb/groovy/BigIntsTest.ipynb:
--------------------------------------------------------------------------------
1 | {
2 | "cells": [
3 | {
4 | "cell_type": "markdown",
5 | "metadata": {},
6 | "source": [
7 | "# Large Integers in Tables and Autotranslation"
8 | ]
9 | },
10 | {
11 | "cell_type": "markdown",
12 | "metadata": {},
13 | "source": [
14 | "JSON has a problem when integers get larger than 1016\n",
15 | "because JavaScript uses floating point for all its numbers.\n",
16 | "Most languages, including Python, R, and the JVM languages like Groovy can easily handle integers up to 1019,\n",
17 | "and sometimes larger.\n",
18 | "\n",
19 | "Numbers this large are useful for measuring time in nanoseconds, for example.\n",
20 | "\n",
21 | "BeakerX table and plot widgets have special support 64-bit and arbitrary precision values. Run these cells, then over over the columns to see their types."
22 | ]
23 | },
24 | {
25 | "cell_type": "markdown",
26 | "metadata": {},
27 | "source": [
28 | "## 64-bit Longs"
29 | ]
30 | },
31 | {
32 | "cell_type": "code",
33 | "execution_count": null,
34 | "metadata": {},
35 | "outputs": [],
36 | "source": [
37 | "def millis = 1234567890L\n",
38 | "def nanos = millis * 1000 * 1000L\n",
39 | "\n",
40 | "table = [[time: nanos + 7 * 1, next_time:(nanos + 77) * 1, temp:14.6],\n",
41 | " [time: nanos + 7 * 2, next_time:(nanos + 88) * 2, temp:18.1],\n",
42 | " [time: nanos + 7 * 3, next_time:(nanos + 99) * 3, temp:23.6]]\n",
43 | "\n",
44 | "beakerx.table_with_longs = table\n",
45 | "table"
46 | ]
47 | },
48 | {
49 | "cell_type": "code",
50 | "execution_count": null,
51 | "metadata": {},
52 | "outputs": [],
53 | "source": [
54 | "// expected result\n",
55 | "Image(\"../../resources/img/groovy/bigInts/cell1_case1.png\")"
56 | ]
57 | },
58 | {
59 | "cell_type": "markdown",
60 | "metadata": {},
61 | "source": [
62 | "## BigNums (arbitrary precision)"
63 | ]
64 | },
65 | {
66 | "cell_type": "code",
67 | "execution_count": null,
68 | "metadata": {},
69 | "outputs": [],
70 | "source": [
71 | "def millis = 1987654321g\n",
72 | "// the \"g\" makes this a bignum, with as many bits as needed\n",
73 | "def nanos = millis * 1000 * 1000g\n",
74 | "\n",
75 | "table = [[time: nanos + 7 * 1, next_time:(nanos + 77) * 777, temp:3.351],\n",
76 | " [time: nanos + 7 * 2, next_time:(nanos + 88) * 888, temp:2.355],\n",
77 | " [time: nanos + 7 * 3, next_time:(nanos + 99) * 999, temp:2.728]]\n",
78 | "\n",
79 | "beakerx.table_with_big_integers = table\n",
80 | "table"
81 | ]
82 | },
83 | {
84 | "cell_type": "code",
85 | "execution_count": null,
86 | "metadata": {},
87 | "outputs": [],
88 | "source": [
89 | "// expected result\n",
90 | "Image(\"../../resources/img/groovy/bigInts/cell2_case1.png\")"
91 | ]
92 | },
93 | {
94 | "cell_type": "code",
95 | "execution_count": null,
96 | "metadata": {},
97 | "outputs": [],
98 | "source": []
99 | }
100 | ],
101 | "metadata": {
102 | "kernelspec": {
103 | "display_name": "Groovy",
104 | "language": "groovy",
105 | "name": "groovy"
106 | },
107 | "language_info": {
108 | "codemirror_mode": "groovy",
109 | "file_extension": ".groovy",
110 | "mimetype": "",
111 | "name": "Groovy",
112 | "nbconverter_exporter": "",
113 | "version": "2.4.3"
114 | }
115 | },
116 | "nbformat": 4,
117 | "nbformat_minor": 2
118 | }
119 |
--------------------------------------------------------------------------------
/test/ipynb/groovy/Classpath_magic_autocoplete.ipynb:
--------------------------------------------------------------------------------
1 | {
2 | "cells": [
3 | {
4 | "cell_type": "code",
5 | "execution_count": null,
6 | "metadata": {},
7 | "outputs": [],
8 | "source": [
9 | "%classpath add jar ../../resources/jar/testdemo.jar"
10 | ]
11 | },
12 | {
13 | "cell_type": "code",
14 | "execution_count": null,
15 | "metadata": {},
16 | "outputs": [],
17 | "source": [
18 | "%classpath add mvn org.apache.spark spark-sql_2.11"
19 | ]
20 | },
21 | {
22 | "cell_type": "code",
23 | "execution_count": null,
24 | "metadata": {},
25 | "outputs": [],
26 | "source": []
27 | }
28 | ],
29 | "metadata": {
30 | "kernelspec": {
31 | "display_name": "Groovy",
32 | "language": "groovy",
33 | "name": "groovy"
34 | },
35 | "language_info": {
36 | "codemirror_mode": "groovy",
37 | "file_extension": ".groovy",
38 | "mimetype": "",
39 | "name": "Groovy",
40 | "nbconverter_exporter": "",
41 | "version": "2.4.3"
42 | },
43 | "toc": {
44 | "base_numbering": 1,
45 | "nav_menu": {},
46 | "number_sections": false,
47 | "sideBar": false,
48 | "skip_h1_title": false,
49 | "title_cell": "Table of Contents",
50 | "title_sidebar": "Contents",
51 | "toc_cell": false,
52 | "toc_position": {},
53 | "toc_section_display": false,
54 | "toc_window_display": false
55 | }
56 | },
57 | "nbformat": 4,
58 | "nbformat_minor": 2
59 | }
60 |
--------------------------------------------------------------------------------
/test/ipynb/groovy/Data_Loading_Modes.ipynb:
--------------------------------------------------------------------------------
1 | {
2 | "cells": [
3 | {
4 | "cell_type": "code",
5 | "execution_count": null,
6 | "metadata": {},
7 | "outputs": [],
8 | "source": [
9 | "TableDisplay.loadingMode = \"ENDLESS\""
10 | ]
11 | },
12 | {
13 | "cell_type": "code",
14 | "execution_count": null,
15 | "metadata": {
16 | "scrolled": false
17 | },
18 | "outputs": [],
19 | "source": [
20 | "rowList = []\n",
21 | "for (row = 0; row < 1000000; row++) {\n",
22 | " colMap = new LinkedHashMap();\n",
23 | " for (col = 0 ; col < 10; col++) {\n",
24 | " colMap.put('a' + col, row * col)\n",
25 | " }\n",
26 | " rowList << colMap\n",
27 | "}\n",
28 | "\n",
29 | "rowList"
30 | ]
31 | },
32 | {
33 | "cell_type": "code",
34 | "execution_count": null,
35 | "metadata": {},
36 | "outputs": [],
37 | "source": [
38 | "TableDisplay.loadingMode = \"ALL\""
39 | ]
40 | }
41 | ],
42 | "metadata": {
43 | "kernelspec": {
44 | "display_name": "Groovy",
45 | "language": "groovy",
46 | "name": "groovy"
47 | },
48 | "language_info": {
49 | "codemirror_mode": "groovy",
50 | "file_extension": ".groovy",
51 | "mimetype": "",
52 | "name": "Groovy",
53 | "nbconverter_exporter": "",
54 | "version": "2.5.6"
55 | },
56 | "toc": {
57 | "base_numbering": 1,
58 | "nav_menu": {},
59 | "number_sections": false,
60 | "sideBar": false,
61 | "skip_h1_title": false,
62 | "title_cell": "Table of Contents",
63 | "title_sidebar": "Contents",
64 | "toc_cell": false,
65 | "toc_position": {},
66 | "toc_section_display": false,
67 | "toc_window_display": false
68 | }
69 | },
70 | "nbformat": 4,
71 | "nbformat_minor": 2
72 | }
73 |
--------------------------------------------------------------------------------
/test/ipynb/groovy/DomClassesSupport.ipynb:
--------------------------------------------------------------------------------
1 | {
2 | "cells": [
3 | {
4 | "cell_type": "code",
5 | "execution_count": null,
6 | "metadata": {},
7 | "outputs": [],
8 | "source": [
9 | "import com.twosigma.beakerx.widget.Button\n",
10 | "bt = new Button()"
11 | ]
12 | },
13 | {
14 | "cell_type": "code",
15 | "execution_count": null,
16 | "metadata": {},
17 | "outputs": [],
18 | "source": [
19 | "bt.domClasses = [\"bx-button\", \"icon-close\"]"
20 | ]
21 | }
22 | ],
23 | "metadata": {
24 | "kernelspec": {
25 | "display_name": "Groovy",
26 | "language": "groovy",
27 | "name": "groovy"
28 | },
29 | "language_info": {
30 | "codemirror_mode": "groovy",
31 | "file_extension": ".groovy",
32 | "mimetype": "",
33 | "name": "Groovy",
34 | "nbconverter_exporter": "",
35 | "version": "2.4.3"
36 | }
37 | },
38 | "nbformat": 4,
39 | "nbformat_minor": 2
40 | }
41 |
--------------------------------------------------------------------------------
/test/ipynb/groovy/GeneralDisplayMethod.ipynb:
--------------------------------------------------------------------------------
1 | {
2 | "cells": [
3 | {
4 | "cell_type": "code",
5 | "execution_count": null,
6 | "metadata": {},
7 | "outputs": [],
8 | "source": [
9 | "import com.twosigma.beakerx.widget.IntSlider\n",
10 | "import com.twosigma.beakerx.widget.IntProgress\n",
11 | "\n",
12 | "slider = new IntSlider()\n",
13 | "progress = new IntProgress()\n",
14 | "progress.value = 10\n",
15 | "\n",
16 | "def mapList = [\n",
17 | " [a:1, b:2, c:3],\n",
18 | " [a:4, b:5, c:6],\n",
19 | " [a:7, b:8, c:5]\n",
20 | "]\n",
21 | "table1 = new TableDisplay(mapList)\n",
22 | "OutputCell.HIDDEN"
23 | ]
24 | },
25 | {
26 | "cell_type": "code",
27 | "execution_count": null,
28 | "metadata": {},
29 | "outputs": [],
30 | "source": [
31 | "display(\"Hello1\")\n",
32 | "display(slider)\n",
33 | "display(Latex('$\\\\alpha^2 + \\\\eta$'))\n",
34 | "display(progress)\n",
35 | "display(YoutubeVideo(\"gSVvxOchT8Y\"))\n",
36 | "display(table1)\n",
37 | "display(\"Hello3\")\n",
38 | "\"done\""
39 | ]
40 | },
41 | {
42 | "cell_type": "code",
43 | "execution_count": null,
44 | "metadata": {},
45 | "outputs": [],
46 | "source": []
47 | }
48 | ],
49 | "metadata": {
50 | "kernelspec": {
51 | "display_name": "Groovy",
52 | "language": "groovy",
53 | "name": "groovy"
54 | },
55 | "language_info": {
56 | "codemirror_mode": "groovy",
57 | "file_extension": ".groovy",
58 | "mimetype": "",
59 | "name": "Groovy",
60 | "nbconverter_exporter": "",
61 | "version": "2.4.3"
62 | }
63 | },
64 | "nbformat": 4,
65 | "nbformat_minor": 2
66 | }
67 |
--------------------------------------------------------------------------------
/test/ipynb/groovy/InfiniteLoopGroovyTest.ipynb:
--------------------------------------------------------------------------------
1 | {
2 | "cells": [
3 | {
4 | "cell_type": "code",
5 | "execution_count": null,
6 | "metadata": {},
7 | "outputs": [],
8 | "source": [
9 | "long i = 0;\n",
10 | "while (true) {\n",
11 | " i += 1;\n",
12 | "}"
13 | ]
14 | },
15 | {
16 | "cell_type": "code",
17 | "execution_count": null,
18 | "metadata": {},
19 | "outputs": [],
20 | "source": []
21 | }
22 | ],
23 | "metadata": {
24 | "kernelspec": {
25 | "display_name": "Groovy",
26 | "language": "groovy",
27 | "name": "groovy"
28 | },
29 | "language_info": {
30 | "codemirror_mode": "groovy",
31 | "file_extension": ".groovy",
32 | "mimetype": "",
33 | "name": "Groovy",
34 | "nbconverter_exporter": "",
35 | "version": "2.4.3"
36 | },
37 | "toc": {
38 | "base_numbering": 1,
39 | "nav_menu": {},
40 | "number_sections": false,
41 | "sideBar": false,
42 | "skip_h1_title": false,
43 | "title_cell": "Table of Contents",
44 | "title_sidebar": "Contents",
45 | "toc_cell": false,
46 | "toc_position": {},
47 | "toc_section_display": false,
48 | "toc_window_display": false
49 | }
50 | },
51 | "nbformat": 4,
52 | "nbformat_minor": 2
53 | }
54 |
--------------------------------------------------------------------------------
/test/ipynb/groovy/JavaArgsTest.ipynb:
--------------------------------------------------------------------------------
1 | {
2 | "cells": [
3 | {
4 | "cell_type": "code",
5 | "execution_count": null,
6 | "metadata": {},
7 | "outputs": [],
8 | "source": [
9 | " Runtime.getRuntime().maxMemory()/1e9"
10 | ]
11 | },
12 | {
13 | "cell_type": "code",
14 | "execution_count": null,
15 | "metadata": {},
16 | "outputs": [],
17 | "source": [
18 | "System.getProperty(\"myproperty\")"
19 | ]
20 | },
21 | {
22 | "cell_type": "code",
23 | "execution_count": null,
24 | "metadata": {},
25 | "outputs": [],
26 | "source": []
27 | }
28 | ],
29 | "metadata": {
30 | "kernelspec": {
31 | "display_name": "Groovy",
32 | "language": "groovy",
33 | "name": "groovy"
34 | },
35 | "language_info": {
36 | "codemirror_mode": "groovy",
37 | "file_extension": ".groovy",
38 | "mimetype": "",
39 | "name": "Groovy",
40 | "nbconverter_exporter": "",
41 | "version": "2.5.6"
42 | },
43 | "toc": {
44 | "base_numbering": 1,
45 | "nav_menu": {},
46 | "number_sections": false,
47 | "sideBar": false,
48 | "skip_h1_title": false,
49 | "title_cell": "Table of Contents",
50 | "title_sidebar": "Contents",
51 | "toc_cell": false,
52 | "toc_position": {},
53 | "toc_section_display": false,
54 | "toc_window_display": false
55 | }
56 | },
57 | "nbformat": 4,
58 | "nbformat_minor": 2
59 | }
60 |
--------------------------------------------------------------------------------
/test/ipynb/groovy/KernelAPITest.ipynb:
--------------------------------------------------------------------------------
1 | {
2 | "cells": [
3 | {
4 | "cell_type": "markdown",
5 | "metadata": {},
6 | "source": [
7 | "# Load Magic Command"
8 | ]
9 | },
10 | {
11 | "cell_type": "code",
12 | "execution_count": null,
13 | "metadata": {},
14 | "outputs": [],
15 | "source": [
16 | "%classpath add jar ../../../doc/resources/jar/loadMagicJarDemo.jar"
17 | ]
18 | },
19 | {
20 | "cell_type": "code",
21 | "execution_count": null,
22 | "metadata": {},
23 | "outputs": [],
24 | "source": [
25 | "%load_magic com.twosigma.beakerx.custom.magic.command.ShowEnvsCustomMagicCommand"
26 | ]
27 | },
28 | {
29 | "cell_type": "code",
30 | "execution_count": null,
31 | "metadata": {},
32 | "outputs": [],
33 | "source": [
34 | "%showEnvs"
35 | ]
36 | },
37 | {
38 | "cell_type": "markdown",
39 | "metadata": {},
40 | "source": [
41 | "# Show Null Execution Result"
42 | ]
43 | },
44 | {
45 | "cell_type": "code",
46 | "execution_count": null,
47 | "metadata": {},
48 | "outputs": [],
49 | "source": [
50 | "com.twosigma.beakerx.kernel.Kernel.showNullExecutionResult"
51 | ]
52 | },
53 | {
54 | "cell_type": "code",
55 | "execution_count": null,
56 | "metadata": {},
57 | "outputs": [],
58 | "source": [
59 | "com.twosigma.beakerx.kernel.Kernel.showNullExecutionResult = true;\n",
60 | "String seeNullString = null;\n",
61 | "seeNullString"
62 | ]
63 | },
64 | {
65 | "cell_type": "code",
66 | "execution_count": null,
67 | "metadata": {},
68 | "outputs": [],
69 | "source": [
70 | "com.twosigma.beakerx.kernel.Kernel.showNullExecutionResult = false;\n",
71 | "String noNullString = null;\n",
72 | "noNullString"
73 | ]
74 | },
75 | {
76 | "cell_type": "markdown",
77 | "metadata": {},
78 | "source": [
79 | "# JVM Repr"
80 | ]
81 | },
82 | {
83 | "cell_type": "code",
84 | "execution_count": null,
85 | "metadata": {},
86 | "outputs": [],
87 | "source": [
88 | "import jupyter.Displayer;\n",
89 | "import jupyter.Displayers;\n",
90 | "Displayers.register(Integer.class, new Displayer() {\n",
91 | " @Override\n",
92 | " public Map display(Integer value) {\n",
93 | " return new HashMap() {{\n",
94 | " put(MIMEContainer.MIME.TEXT_HTML, \"\" + value + \"
\");\n",
95 | "\n",
96 | " }};\n",
97 | " }\n",
98 | "});"
99 | ]
100 | },
101 | {
102 | "cell_type": "code",
103 | "execution_count": null,
104 | "metadata": {},
105 | "outputs": [],
106 | "source": [
107 | "1+1"
108 | ]
109 | },
110 | {
111 | "cell_type": "code",
112 | "execution_count": null,
113 | "metadata": {},
114 | "outputs": [],
115 | "source": []
116 | }
117 | ],
118 | "metadata": {
119 | "kernelspec": {
120 | "display_name": "Groovy",
121 | "language": "groovy",
122 | "name": "groovy"
123 | },
124 | "language_info": {
125 | "codemirror_mode": "groovy",
126 | "file_extension": ".groovy",
127 | "mimetype": "",
128 | "name": "Groovy",
129 | "nbconverter_exporter": "",
130 | "version": "2.4.3"
131 | }
132 | },
133 | "nbformat": 4,
134 | "nbformat_minor": 2
135 | }
136 |
--------------------------------------------------------------------------------
/test/ipynb/groovy/MavenLogger.ipynb:
--------------------------------------------------------------------------------
1 | {
2 | "cells": [
3 | {
4 | "cell_type": "code",
5 | "execution_count": null,
6 | "metadata": {},
7 | "outputs": [],
8 | "source": [
9 | "BxMavenManager.logsOn()"
10 | ]
11 | },
12 | {
13 | "cell_type": "code",
14 | "execution_count": null,
15 | "metadata": {},
16 | "outputs": [],
17 | "source": [
18 | "%classpath add mvn com.google.code.gson gson 2.2.4"
19 | ]
20 | },
21 | {
22 | "cell_type": "code",
23 | "execution_count": null,
24 | "metadata": {},
25 | "outputs": [],
26 | "source": [
27 | "BxMavenManager.logsOff()"
28 | ]
29 | }
30 | ],
31 | "metadata": {
32 | "kernelspec": {
33 | "display_name": "Groovy",
34 | "language": "groovy",
35 | "name": "groovy"
36 | },
37 | "language_info": {
38 | "codemirror_mode": "groovy",
39 | "file_extension": ".groovy",
40 | "mimetype": "",
41 | "name": "Groovy",
42 | "nbconverter_exporter": "",
43 | "version": "2.5.6"
44 | },
45 | "toc": {
46 | "base_numbering": 1,
47 | "nav_menu": {},
48 | "number_sections": false,
49 | "sideBar": false,
50 | "skip_h1_title": false,
51 | "title_cell": "Table of Contents",
52 | "title_sidebar": "Contents",
53 | "toc_cell": false,
54 | "toc_position": {},
55 | "toc_section_display": false,
56 | "toc_window_display": false
57 | }
58 | },
59 | "nbformat": 4,
60 | "nbformat_minor": 2
61 | }
62 |
--------------------------------------------------------------------------------
/test/ipynb/groovy/SupportEnum.ipynb:
--------------------------------------------------------------------------------
1 | {
2 | "cells": [
3 | {
4 | "cell_type": "code",
5 | "execution_count": null,
6 | "metadata": {},
7 | "outputs": [],
8 | "source": [
9 | "enum MyColors{\n",
10 | " BLUE, RED, WHITE\n",
11 | "}"
12 | ]
13 | },
14 | {
15 | "cell_type": "code",
16 | "execution_count": null,
17 | "metadata": {},
18 | "outputs": [],
19 | "source": [
20 | "MyColors.values()"
21 | ]
22 | },
23 | {
24 | "cell_type": "code",
25 | "execution_count": null,
26 | "metadata": {},
27 | "outputs": [],
28 | "source": [
29 | "class Car{\n",
30 | " MyColors color = MyColors.RED;\n",
31 | "}"
32 | ]
33 | },
34 | {
35 | "cell_type": "code",
36 | "execution_count": null,
37 | "metadata": {},
38 | "outputs": [],
39 | "source": [
40 | "Car car = new Car()\n",
41 | "car.color"
42 | ]
43 | },
44 | {
45 | "cell_type": "code",
46 | "execution_count": null,
47 | "metadata": {},
48 | "outputs": [],
49 | "source": []
50 | }
51 | ],
52 | "metadata": {
53 | "kernelspec": {
54 | "display_name": "Groovy",
55 | "language": "groovy",
56 | "name": "groovy"
57 | },
58 | "language_info": {
59 | "codemirror_mode": "groovy",
60 | "file_extension": ".groovy",
61 | "mimetype": "",
62 | "name": "Groovy",
63 | "nbconverter_exporter": "",
64 | "version": "2.4.3"
65 | }
66 | },
67 | "nbformat": 4,
68 | "nbformat_minor": 2
69 | }
70 |
--------------------------------------------------------------------------------
/test/ipynb/groovy/TableDisplayStream.ipynb:
--------------------------------------------------------------------------------
1 | {
2 | "cells": [
3 | {
4 | "cell_type": "code",
5 | "execution_count": null,
6 | "metadata": {},
7 | "outputs": [],
8 | "source": [
9 | "import java.util.function.Supplier\n",
10 | "import java.util.stream.Stream\n",
11 | "TableDisplay.setLoadingMode(TableDisplayLoadingMode.ENDLESS)\n",
12 | "\n",
13 | "def generate = Stream.generate(new Supplier