├── .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 | ![JVMoptions](doc/resources/img/JVMoptions.png) 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 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /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>() {\n", 14 | " def random = new Random()\n", 15 | " def index = 0\n", 16 | "\n", 17 | " @Override\n", 18 | " Map get() {\n", 19 | " return [\n", 20 | " str1: index++,\n", 21 | " str2: random.nextDouble(),\n", 22 | " str3: random.nextFloat()\n", 23 | " ]\n", 24 | " }\n", 25 | " })\n", 26 | "\n", 27 | "new TableDisplay(generate)" 28 | ] 29 | }, 30 | { 31 | "cell_type": "code", 32 | "execution_count": null, 33 | "metadata": {}, 34 | "outputs": [], 35 | "source": [ 36 | "import java.util.function.Supplier\n", 37 | "import java.util.stream.Stream\n", 38 | "TableDisplay.setLoadingMode(TableDisplayLoadingMode.ENDLESS)\n", 39 | "\n", 40 | "def generate = Stream.generate(new Supplier>() {\n", 41 | " def random = new Random()\n", 42 | " def index = 0\n", 43 | "\n", 44 | " @Override\n", 45 | " Map get() {\n", 46 | " return [\n", 47 | " str1: index++,\n", 48 | " str2: random.nextDouble(),\n", 49 | " str3: random.nextFloat()\n", 50 | " ]\n", 51 | " }\n", 52 | " })\n", 53 | "\n", 54 | "td4 = new TableDisplay(generate)\n", 55 | "td4.setFontColorProvider { row, col, td ->\n", 56 | " row = td.values[row]\n", 57 | " val = row[col]\n", 58 | " if (val % 10 == 0){\n", 59 | " return Color.GREEN\n", 60 | " }\n", 61 | " return Color.BLACK\n", 62 | "}\n", 63 | "\n", 64 | "td4" 65 | ] 66 | } 67 | ], 68 | "metadata": { 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.5.6" 81 | }, 82 | "toc": { 83 | "base_numbering": 1, 84 | "nav_menu": {}, 85 | "number_sections": false, 86 | "sideBar": false, 87 | "skip_h1_title": false, 88 | "title_cell": "Table of Contents", 89 | "title_sidebar": "Contents", 90 | "toc_cell": false, 91 | "toc_position": {}, 92 | "toc_section_display": false, 93 | "toc_window_display": false 94 | } 95 | }, 96 | "nbformat": 4, 97 | "nbformat_minor": 2 98 | } 99 | -------------------------------------------------------------------------------- /test/ipynb/groovy/TableDisplayWIthIndex.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": null, 6 | "metadata": {}, 7 | "outputs": [], 8 | "source": [ 9 | "new TableDisplay( new CSV().read(\"../resources/data/interest-rates-small-with_index.csv\"))" 10 | ] 11 | }, 12 | { 13 | "cell_type": "code", 14 | "execution_count": null, 15 | "metadata": {}, 16 | "outputs": [], 17 | "source": [ 18 | "new TableDisplay( new CSV().read(\"../resources/data/interest-rates-small-with_index.csv\"),0)" 19 | ] 20 | }, 21 | { 22 | "cell_type": "code", 23 | "execution_count": null, 24 | "metadata": {}, 25 | "outputs": [], 26 | "source": [ 27 | "new TableDisplay( new CSV().read(\"../resources/data/interest-rates-small-with_index.csv\"),8)" 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/accessible_URL_arguments.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "### http://{path}?bar=200&foo=300" 8 | ] 9 | }, 10 | { 11 | "cell_type": "code", 12 | "execution_count": null, 13 | "metadata": {}, 14 | "outputs": [], 15 | "source": [ 16 | "beakerx.urlArg(\"bar\")" 17 | ] 18 | }, 19 | { 20 | "cell_type": "code", 21 | "execution_count": null, 22 | "metadata": {}, 23 | "outputs": [], 24 | "source": [ 25 | "beakerx.urlArg(\"foo\")" 26 | ] 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/autotranslationPandas.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": null, 6 | "metadata": {}, 7 | "outputs": [], 8 | "source": [ 9 | "%%python\n", 10 | "import pandas as pd\n", 11 | "from beakerx.object import beakerx\n", 12 | "df = pd.read_csv('../resources/data/interest-rates.csv')\n", 13 | "df = df.set_index('time')\n", 14 | "beakerx.rates = df" 15 | ] 16 | }, 17 | { 18 | "cell_type": "markdown", 19 | "metadata": {}, 20 | "source": [ 21 | "### Display pandas in python:" 22 | ] 23 | }, 24 | { 25 | "cell_type": "code", 26 | "execution_count": null, 27 | "metadata": {}, 28 | "outputs": [], 29 | "source": [ 30 | "%%python\n", 31 | "beakerx.rates" 32 | ] 33 | }, 34 | { 35 | "cell_type": "markdown", 36 | "metadata": {}, 37 | "source": [ 38 | "### Display pandas in groovy:" 39 | ] 40 | }, 41 | { 42 | "cell_type": "code", 43 | "execution_count": null, 44 | "metadata": {}, 45 | "outputs": [], 46 | "source": [ 47 | "beakerx.rates" 48 | ] 49 | }, 50 | { 51 | "cell_type": "code", 52 | "execution_count": null, 53 | "metadata": {}, 54 | "outputs": [], 55 | "source": [ 56 | "%%python\n", 57 | "import pandas as pd\n", 58 | "import numpy as np\n", 59 | "from beakerx.object import beakerx\n", 60 | "a=pd.DataFrame(np.random.rand(10,5),columns=['c'+str(i) for i in range(5)])\n", 61 | "a = a.set_index('c0',append=True)\n", 62 | "beakerx.rates = a" 63 | ] 64 | }, 65 | { 66 | "cell_type": "markdown", 67 | "metadata": {}, 68 | "source": [ 69 | "### Display pandas in python:" 70 | ] 71 | }, 72 | { 73 | "cell_type": "code", 74 | "execution_count": null, 75 | "metadata": {}, 76 | "outputs": [], 77 | "source": [ 78 | "%%python\n", 79 | "beakerx.rates" 80 | ] 81 | }, 82 | { 83 | "cell_type": "markdown", 84 | "metadata": {}, 85 | "source": [ 86 | "### Display pandas in groovy:" 87 | ] 88 | }, 89 | { 90 | "cell_type": "code", 91 | "execution_count": null, 92 | "metadata": {}, 93 | "outputs": [], 94 | "source": [ 95 | "beakerx.rates" 96 | ] 97 | } 98 | ], 99 | "metadata": { 100 | "kernelspec": { 101 | "display_name": "Groovy", 102 | "language": "groovy", 103 | "name": "groovy" 104 | }, 105 | "language_info": { 106 | "codemirror_mode": "groovy", 107 | "file_extension": ".groovy", 108 | "mimetype": "", 109 | "name": "Groovy", 110 | "nbconverter_exporter": "", 111 | "version": "2.4.3" 112 | }, 113 | "toc": { 114 | "base_numbering": 1, 115 | "nav_menu": {}, 116 | "number_sections": false, 117 | "sideBar": false, 118 | "skip_h1_title": false, 119 | "title_cell": "Table of Contents", 120 | "title_sidebar": "Contents", 121 | "toc_cell": false, 122 | "toc_position": {}, 123 | "toc_section_display": false, 124 | "toc_window_display": false 125 | } 126 | }, 127 | "nbformat": 4, 128 | "nbformat_minor": 2 129 | } 130 | -------------------------------------------------------------------------------- /test/ipynb/groovy/codeAndMagicsTest.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": null, 6 | "metadata": { 7 | "scrolled": true 8 | }, 9 | "outputs": [], 10 | "source": [ 11 | "println('test1')\n", 12 | "%time println(221)\n", 13 | "println('test2')\n", 14 | " %time 1+2" 15 | ] 16 | }, 17 | { 18 | "cell_type": "code", 19 | "execution_count": null, 20 | "metadata": {}, 21 | "outputs": [], 22 | "source": [ 23 | "println('test1')\n", 24 | "if(true){\n", 25 | " %time println(221)\n", 26 | "}\n", 27 | "println('test2')\n", 28 | " %time 1+2" 29 | ] 30 | }, 31 | { 32 | "cell_type": "code", 33 | "execution_count": null, 34 | "metadata": {}, 35 | "outputs": [], 36 | "source": [ 37 | "%classpath add jar ../../resources/jar/testdemo.jar\n", 38 | "\n", 39 | "%import com.twosigma.beakerx.widget.IntSlider" 40 | ] 41 | }, 42 | { 43 | "cell_type": "code", 44 | "execution_count": null, 45 | "metadata": {}, 46 | "outputs": [], 47 | "source": [ 48 | "w = new IntSlider()\n", 49 | "w.value = 60\n", 50 | "w" 51 | ] 52 | }, 53 | { 54 | "cell_type": "code", 55 | "execution_count": null, 56 | "metadata": {}, 57 | "outputs": [], 58 | "source": [ 59 | "import com.example.TestDemo\n", 60 | "TestDemo testDemo = new TestDemo();\n", 61 | "println testDemo.getObjectTest()" 62 | ] 63 | }, 64 | { 65 | "cell_type": "code", 66 | "execution_count": null, 67 | "metadata": {}, 68 | "outputs": [], 69 | "source": [ 70 | "%time println(\"x y\")" 71 | ] 72 | }, 73 | { 74 | "cell_type": "code", 75 | "execution_count": null, 76 | "metadata": {}, 77 | "outputs": [], 78 | "source": [ 79 | "%classpath add jar \"../../resources/jar/ with space.jar\" " 80 | ] 81 | }, 82 | { 83 | "cell_type": "code", 84 | "execution_count": null, 85 | "metadata": {}, 86 | "outputs": [], 87 | "source": [] 88 | } 89 | ], 90 | "metadata": { 91 | "kernelspec": { 92 | "display_name": "Groovy", 93 | "language": "groovy", 94 | "name": "groovy" 95 | }, 96 | "language_info": { 97 | "codemirror_mode": "groovy", 98 | "file_extension": ".groovy", 99 | "mimetype": "", 100 | "name": "Groovy", 101 | "nbconverter_exporter": "", 102 | "version": "2.4.3" 103 | } 104 | }, 105 | "nbformat": 4, 106 | "nbformat_minor": 2 107 | } 108 | -------------------------------------------------------------------------------- /test/ipynb/groovy/setRowsToShow.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": null, 6 | "metadata": {}, 7 | "outputs": [], 8 | "source": [ 9 | "td = new TableDisplay( new CSV().read(\"../resources/data/interest-rates.csv\"))\n", 10 | "td.setRowsToShow(RowsToShow.SHOW_50);\n", 11 | "td" 12 | ] 13 | }, 14 | { 15 | "cell_type": "code", 16 | "execution_count": null, 17 | "metadata": {}, 18 | "outputs": [], 19 | "source": [ 20 | "td.setRowsToShow(RowsToShow.SHOW_10);" 21 | ] 22 | } 23 | ], 24 | "metadata": { 25 | "kernelspec": { 26 | "display_name": "Groovy", 27 | "language": "groovy", 28 | "name": "groovy" 29 | }, 30 | "language_info": { 31 | "codemirror_mode": "groovy", 32 | "file_extension": ".groovy", 33 | "mimetype": "", 34 | "name": "Groovy", 35 | "nbconverter_exporter": "", 36 | "version": "2.5.6" 37 | }, 38 | "toc": { 39 | "base_numbering": 1, 40 | "nav_menu": {}, 41 | "number_sections": false, 42 | "sideBar": false, 43 | "skip_h1_title": false, 44 | "title_cell": "Table of Contents", 45 | "title_sidebar": "Contents", 46 | "toc_cell": false, 47 | "toc_position": {}, 48 | "toc_section_display": false, 49 | "toc_window_display": false 50 | } 51 | }, 52 | "nbformat": 4, 53 | "nbformat_minor": 2 54 | } 55 | -------------------------------------------------------------------------------- /test/ipynb/groovy/slqDriver.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": null, 6 | "metadata": { 7 | "scrolled": true 8 | }, 9 | "outputs": [], 10 | "source": [ 11 | "%classpath add mvn org.xerial sqlite-jdbc 3.27.2.1" 12 | ] 13 | }, 14 | { 15 | "cell_type": "code", 16 | "execution_count": null, 17 | "metadata": {}, 18 | "outputs": [], 19 | "source": [ 20 | "conn = BxDriverManager.getConnection(\"jdbc:sqlite:sample.db\"); " 21 | ] 22 | }, 23 | { 24 | "cell_type": "code", 25 | "execution_count": null, 26 | "metadata": {}, 27 | "outputs": [], 28 | "source": [ 29 | " try{ \n", 30 | " sql = \"CREATE TABLE IF NOT EXISTS Person ( id integer PRIMARY KEY, name text NOT NULL);\"; \n", 31 | " stmt = conn.createStatement(); \n", 32 | " result = stmt.execute(sql); \n", 33 | " dbm = conn.getMetaData();\n", 34 | " tables = dbm.getTables(null, null, \"Person\", null);\n", 35 | " while (tables.next()) { \n", 36 | " tName = tables.getString(\"TABLE_NAME\");\n", 37 | " if (tName != null && tName.equals(\"Person\")) {\n", 38 | " println(\"table '\"+tName+\"' exists \"); \n", 39 | " tExists = true;\n", 40 | " break;\n", 41 | " }\n", 42 | " }\n", 43 | "} catch (Exception e) { \n", 44 | " println(e.getMessage()); \n", 45 | " } finally{\n", 46 | " conn.close()\n", 47 | " } " 48 | ] 49 | }, 50 | { 51 | "cell_type": "code", 52 | "execution_count": null, 53 | "metadata": { 54 | "scrolled": true 55 | }, 56 | "outputs": [], 57 | "source": [ 58 | "import java.sql.DriverManager\n", 59 | "java.sql.DriverManager.getConnection(\"jdbc:sqlite:sample.db\")" 60 | ] 61 | } 62 | ], 63 | "metadata": { 64 | "kernelspec": { 65 | "display_name": "Groovy", 66 | "language": "groovy", 67 | "name": "groovy" 68 | }, 69 | "language_info": { 70 | "codemirror_mode": "groovy", 71 | "file_extension": ".groovy", 72 | "mimetype": "", 73 | "name": "Groovy", 74 | "nbconverter_exporter": "", 75 | "version": "2.5.6" 76 | }, 77 | "toc": { 78 | "base_numbering": 1, 79 | "nav_menu": {}, 80 | "number_sections": false, 81 | "sideBar": false, 82 | "skip_h1_title": false, 83 | "title_cell": "Table of Contents", 84 | "title_sidebar": "Contents", 85 | "toc_cell": false, 86 | "toc_position": {}, 87 | "toc_section_display": false, 88 | "toc_window_display": false 89 | } 90 | }, 91 | "nbformat": 4, 92 | "nbformat_minor": 2 93 | } 94 | -------------------------------------------------------------------------------- /test/ipynb/java/InfiniteLoopJava.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": null, 6 | "metadata": {}, 7 | "outputs": [], 8 | "source": [ 9 | "var 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 | "2+2" 22 | ] 23 | } 24 | ], 25 | "metadata": { 26 | "kernelspec": { 27 | "display_name": "Java11", 28 | "language": "java", 29 | "name": "java" 30 | }, 31 | "language_info": { 32 | "codemirror_mode": "text/x-java", 33 | "file_extension": ".java", 34 | "mimetype": "", 35 | "name": "Java", 36 | "nbconverter_exporter": "", 37 | "version": "11.0.1-internal" 38 | }, 39 | "toc": { 40 | "base_numbering": 1, 41 | "nav_menu": {}, 42 | "number_sections": false, 43 | "sideBar": false, 44 | "skip_h1_title": false, 45 | "title_cell": "Table of Contents", 46 | "title_sidebar": "Contents", 47 | "toc_cell": false, 48 | "toc_position": {}, 49 | "toc_section_display": false, 50 | "toc_window_display": false 51 | } 52 | }, 53 | "nbformat": 4, 54 | "nbformat_minor": 4 55 | } 56 | -------------------------------------------------------------------------------- /test/ipynb/java/TableDisplayStream.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": null, 6 | "metadata": {}, 7 | "outputs": [], 8 | "source": [ 9 | "import java.util.LinkedHashMap;\n", 10 | "import java.util.List;\n", 11 | "import java.util.Map;\n", 12 | "import java.util.Random;\n", 13 | "import java.util.function.Supplier;\n", 14 | "import java.util.stream.Stream;\n", 15 | "\n", 16 | "TableDisplay.setLoadingMode(TableDisplayLoadingMode.ENDLESS);\n", 17 | "\n", 18 | "Stream> s1 = Stream.generate(new Supplier>() {\n", 19 | " Random random = new Random();\n", 20 | " int index = 0;\n", 21 | " @Override\n", 22 | " public Map get() {\n", 23 | " return new LinkedHashMap() {\n", 24 | " {\n", 25 | " put(\"str1\", index++);\n", 26 | " put(\"str2\", random.nextFloat());\n", 27 | " put(\"str3\", random.nextInt());\n", 28 | " }\n", 29 | " };\n", 30 | " }\n", 31 | " });\n", 32 | "new TableDisplay(s1);" 33 | ] 34 | } 35 | ], 36 | "metadata": { 37 | "kernelspec": { 38 | "display_name": "Java11", 39 | "language": "java", 40 | "name": "java11" 41 | }, 42 | "language_info": { 43 | "codemirror_mode": "text/x-java", 44 | "file_extension": ".java", 45 | "mimetype": "", 46 | "name": "Java11", 47 | "nbconverter_exporter": "", 48 | "version": "11.0.1-internal" 49 | }, 50 | "toc": { 51 | "base_numbering": 1, 52 | "nav_menu": {}, 53 | "number_sections": false, 54 | "sideBar": false, 55 | "skip_h1_title": false, 56 | "title_cell": "Table of Contents", 57 | "title_sidebar": "Contents", 58 | "toc_cell": false, 59 | "toc_position": {}, 60 | "toc_section_display": false, 61 | "toc_window_display": false 62 | } 63 | }, 64 | "nbformat": 4, 65 | "nbformat_minor": 2 66 | } 67 | -------------------------------------------------------------------------------- /test/ipynb/java/sqlDriver.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": null, 6 | "metadata": {}, 7 | "outputs": [], 8 | "source": [ 9 | "%classpath add mvn org.xerial sqlite-jdbc 3.27.2.1" 10 | ] 11 | }, 12 | { 13 | "cell_type": "code", 14 | "execution_count": null, 15 | "metadata": {}, 16 | "outputs": [], 17 | "source": [ 18 | "var conn = BxDriverManager.getConnection(\"jdbc:sqlite:sample.db\"); " 19 | ] 20 | }, 21 | { 22 | "cell_type": "code", 23 | "execution_count": null, 24 | "metadata": {}, 25 | "outputs": [], 26 | "source": [ 27 | "try{ \n", 28 | " var sql = \"CREATE TABLE IF NOT EXISTS Person ( id integer PRIMARY KEY, name text NOT NULL);\"; \n", 29 | " var stmt = conn.createStatement(); \n", 30 | " var result = stmt.execute(sql); \n", 31 | " var dbm = conn.getMetaData();\n", 32 | " var tables = dbm.getTables(null, null, \"Person\", null);\n", 33 | " while (tables.next()) { \n", 34 | " var tName = tables.getString(\"TABLE_NAME\");\n", 35 | " if (tName != null && tName.equals(\"Person\")) {\n", 36 | " System.out.println(\"table '\"+tName+\"' exists \"); \n", 37 | " break;\n", 38 | " }\n", 39 | " }\n", 40 | "} catch (Exception e) { \n", 41 | " System.out.println(e.getMessage()); \n", 42 | "} finally{\n", 43 | " conn.close();\n", 44 | "} " 45 | ] 46 | }, 47 | { 48 | "cell_type": "code", 49 | "execution_count": null, 50 | "metadata": {}, 51 | "outputs": [], 52 | "source": [ 53 | "import java.sql.DriverManager;\n", 54 | "var conn2 = java.sql.DriverManager.getConnection(\"jdbc:sqlite:sample.db\");" 55 | ] 56 | } 57 | ], 58 | "metadata": { 59 | "kernelspec": { 60 | "display_name": "Java11", 61 | "language": "java", 62 | "name": "java" 63 | }, 64 | "language_info": { 65 | "codemirror_mode": "text/x-java", 66 | "file_extension": ".java", 67 | "mimetype": "", 68 | "name": "Java", 69 | "nbconverter_exporter": "", 70 | "version": "11.0.1-internal" 71 | } 72 | }, 73 | "nbformat": 4, 74 | "nbformat_minor": 4 75 | } 76 | -------------------------------------------------------------------------------- /test/ipynb/java/stdin.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": null, 6 | "metadata": {}, 7 | "outputs": [], 8 | "source": [ 9 | "import java.util.Scanner;\n", 10 | "Scanner scanner = new Scanner(System.in); \n", 11 | "System.out.println(\"Enter your name: \");\n", 12 | "String name = scanner.nextLine();\n", 13 | "System.out.println(\"Hello: \"+name);\n", 14 | "\n", 15 | "System.out.println(\"Enter your number1: \");\n", 16 | "int number1 = scanner.nextInt();\n", 17 | "System.out.println(\"Enter your number2: \");\n", 18 | "int number2 = scanner.nextInt();\n", 19 | "\n", 20 | "System.out.println(\"number1 + number2 = \"+(number1+number2));\n", 21 | "number1+number2;" 22 | ] 23 | }, 24 | { 25 | "cell_type": "code", 26 | "execution_count": null, 27 | "metadata": {}, 28 | "outputs": [], 29 | "source": [] 30 | } 31 | ], 32 | "metadata": { 33 | "kernelspec": { 34 | "display_name": "Java11", 35 | "language": "java", 36 | "name": "java11" 37 | }, 38 | "language_info": { 39 | "codemirror_mode": "text/x-java", 40 | "file_extension": ".java", 41 | "mimetype": "", 42 | "name": "Java11", 43 | "nbconverter_exporter": "", 44 | "version": "11.0.1-internal" 45 | }, 46 | "toc": { 47 | "base_numbering": 1, 48 | "nav_menu": {}, 49 | "number_sections": false, 50 | "sideBar": false, 51 | "skip_h1_title": false, 52 | "title_cell": "Table of Contents", 53 | "title_sidebar": "Contents", 54 | "toc_cell": false, 55 | "toc_position": {}, 56 | "toc_section_display": false, 57 | "toc_window_display": false 58 | } 59 | }, 60 | "nbformat": 4, 61 | "nbformat_minor": 2 62 | } 63 | -------------------------------------------------------------------------------- /test/ipynb/kotlin/InfiniteLoopKotlinTest.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": null, 6 | "metadata": {}, 7 | "outputs": [], 8 | "source": [ 9 | "val i = 0;\n", 10 | "while(true) i + 1" 11 | ] 12 | }, 13 | { 14 | "cell_type": "code", 15 | "execution_count": null, 16 | "metadata": {}, 17 | "outputs": [], 18 | "source": [ 19 | "1+2" 20 | ] 21 | } 22 | ], 23 | "metadata": { 24 | "kernelspec": { 25 | "display_name": "Kotlin", 26 | "language": "kotlin", 27 | "name": "kotlin" 28 | }, 29 | "language_info": { 30 | "codemirror_mode": "kotlin", 31 | "file_extension": ".kt", 32 | "mimetype": "", 33 | "name": "Kotlin", 34 | "nbconverter_exporter": "", 35 | "version": "1.3.21" 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/kotlin/KotlinTest.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": null, 6 | "metadata": {}, 7 | "outputs": [], 8 | "source": [ 9 | "fun double(x: Int): Int {\n", 10 | " return 2*x\n", 11 | "}\n", 12 | "val x = 23" 13 | ] 14 | }, 15 | { 16 | "cell_type": "code", 17 | "execution_count": null, 18 | "metadata": {}, 19 | "outputs": [], 20 | "source": [ 21 | "\"hello, \" + double(3) + x" 22 | ] 23 | }, 24 | { 25 | "cell_type": "code", 26 | "execution_count": null, 27 | "metadata": {}, 28 | "outputs": [], 29 | "source": [ 30 | "val numbers: MutableList = mutableListOf(1, 4, 3)\n", 31 | "val line = Line()\n", 32 | "line.setY(numbers)\n", 33 | "val plot = Plot()\n", 34 | "plot.setTitle(\"Kotlin Plotting\")\n", 35 | "plot.add(line)\n", 36 | "plot" 37 | ] 38 | }, 39 | { 40 | "cell_type": "code", 41 | "execution_count": null, 42 | "metadata": {}, 43 | "outputs": [], 44 | "source": [ 45 | "%%python\n", 46 | "from beakerx import *\n", 47 | "pp = Plot(title=\"Title\", xLabel=\"Horizontal\", yLabel=\"Vertical\")\n", 48 | "pp.add(Line(displayName=\"Line\", x=[1, 4, 6, 8, 10],y=[3, 6, 4, 5, 9]))" 49 | ] 50 | }, 51 | { 52 | "cell_type": "markdown", 53 | "metadata": {}, 54 | "source": [ 55 | "press 'Shift' + 'Tab' for doc" 56 | ] 57 | }, 58 | { 59 | "cell_type": "code", 60 | "execution_count": null, 61 | "metadata": {}, 62 | "outputs": [], 63 | "source": [] 64 | }, 65 | { 66 | "cell_type": "code", 67 | "execution_count": null, 68 | "metadata": {}, 69 | "outputs": [], 70 | "source": [] 71 | } 72 | ], 73 | "metadata": { 74 | "kernelspec": { 75 | "display_name": "Kotlin", 76 | "language": "kotlin", 77 | "name": "kotlin" 78 | }, 79 | "language_info": { 80 | "codemirror_mode": "kt", 81 | "file_extension": ".kt", 82 | "mimetype": "", 83 | "name": "Kotlin", 84 | "nbconverter_exporter": "", 85 | "version": "1.2.21" 86 | } 87 | }, 88 | "nbformat": 4, 89 | "nbformat_minor": 2 90 | } 91 | -------------------------------------------------------------------------------- /test/ipynb/python/AutoTranslationPythonTest.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": null, 6 | "metadata": {}, 7 | "outputs": [], 8 | "source": [ 9 | "from beakerx.object import beakerx\n", 10 | "\n", 11 | "nodes = []\n", 12 | "\n", 13 | "for i in range(0, 10):\n", 14 | " nodes.append({\"radius\": int(i*5 + 5), \"colorB\": int(i*20)})\n", 15 | "\n", 16 | "beakerx.testData = {\"nodes\": nodes}\n" 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": "Python 3", 92 | "language": "python", 93 | "name": "python3" 94 | }, 95 | "language_info": { 96 | "codemirror_mode": { 97 | "name": "ipython", 98 | "version": 3 99 | }, 100 | "file_extension": ".py", 101 | "mimetype": "text/x-python", 102 | "name": "python", 103 | "nbconvert_exporter": "python", 104 | "pygments_lexer": "ipython3", 105 | "version": "3.6.6" 106 | }, 107 | "toc": { 108 | "base_numbering": 1, 109 | "nav_menu": {}, 110 | "number_sections": false, 111 | "sideBar": false, 112 | "skip_h1_title": false, 113 | "title_cell": "Table of Contents", 114 | "title_sidebar": "Contents", 115 | "toc_cell": false, 116 | "toc_position": {}, 117 | "toc_section_display": false, 118 | "toc_window_display": false 119 | } 120 | }, 121 | "nbformat": 4, 122 | "nbformat_minor": 2 123 | } 124 | -------------------------------------------------------------------------------- /test/ipynb/python/Better_handling_for_pandas_stacked_column_dataframe.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": null, 6 | "metadata": {}, 7 | "outputs": [], 8 | "source": [ 9 | "import pandas as pd\n", 10 | "mini_df = pd.read_csv('../../resources/data/beakerxdata.csv')\n", 11 | "mini_df['downloads'] = pd.to_numeric(mini_df['downloads'])\n", 12 | "mini_df['time'] = pd.DatetimeIndex(mini_df['time']).to_period('M').to_timestamp(how='end')\n", 13 | "s = mini_df.groupby([pd.Grouper(key='time',freq='M'), 'package']).sum().reset_index()\n", 14 | "n = s[['time','package','downloads']].set_index(['time','package']).unstack('time')\n", 15 | "n" 16 | ] 17 | }, 18 | { 19 | "cell_type": "code", 20 | "execution_count": null, 21 | "metadata": {}, 22 | "outputs": [], 23 | "source": [] 24 | } 25 | ], 26 | "metadata": { 27 | "kernelspec": { 28 | "display_name": "Python 3", 29 | "language": "python", 30 | "name": "python3" 31 | }, 32 | "language_info": { 33 | "codemirror_mode": { 34 | "name": "ipython", 35 | "version": 3 36 | }, 37 | "file_extension": ".py", 38 | "mimetype": "text/x-python", 39 | "name": "python", 40 | "nbconvert_exporter": "python", 41 | "pygments_lexer": "ipython3", 42 | "version": "3.6.6" 43 | }, 44 | "toc": { 45 | "base_numbering": 1, 46 | "nav_menu": {}, 47 | "number_sections": false, 48 | "sideBar": false, 49 | "skip_h1_title": false, 50 | "title_cell": "Table of Contents", 51 | "title_sidebar": "Contents", 52 | "toc_cell": false, 53 | "toc_position": {}, 54 | "toc_section_display": false, 55 | "toc_window_display": false 56 | } 57 | }, 58 | "nbformat": 4, 59 | "nbformat_minor": 2 60 | } 61 | -------------------------------------------------------------------------------- /test/ipynb/python/Data_Loading_Modes.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 | "TableDisplay.loadingMode =\"ENDLESS\"" 11 | ] 12 | }, 13 | { 14 | "cell_type": "code", 15 | "execution_count": null, 16 | "metadata": { 17 | "scrolled": true 18 | }, 19 | "outputs": [], 20 | "source": [ 21 | "rowList = []\n", 22 | "for row in range(10000):\n", 23 | " colMap = {}\n", 24 | " for col in range(10):\n", 25 | " key = \"a\" + str(col)\n", 26 | " colMap[key] = row * col\n", 27 | " rowList.append(colMap)\n", 28 | "\n", 29 | "TableDisplay(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 | "cell_type": "code", 43 | "execution_count": null, 44 | "metadata": {}, 45 | "outputs": [], 46 | "source": [ 47 | "from beakerx import *\n", 48 | "TableDisplay.loadingMode =\"ENDLESS\"\n", 49 | "rowList = []\n", 50 | "for row in range(10000):\n", 51 | " colMap = {}\n", 52 | " for col in range(2):\n", 53 | " index = col+1\n", 54 | " key = \"a\" + str(index)\n", 55 | " colMap[key] = row * index\n", 56 | " rowList.append(colMap)\n", 57 | "\n", 58 | "td = TableDisplay(rowList)\n", 59 | "\n", 60 | "def color_provider(r1, column, td):\n", 61 | " r2 = td.values[r1]\n", 62 | " val = r2[column]\n", 63 | " if val % 2 is 0:\n", 64 | " return Color.GREEN \n", 65 | " return Color.BLACK \n", 66 | "\n", 67 | "td.setFontColorProvider(color_provider)\n", 68 | "td" 69 | ] 70 | }, 71 | { 72 | "cell_type": "code", 73 | "execution_count": null, 74 | "metadata": {}, 75 | "outputs": [], 76 | "source": [] 77 | } 78 | ], 79 | "metadata": { 80 | "kernelspec": { 81 | "display_name": "Python 3", 82 | "language": "python", 83 | "name": "python3" 84 | }, 85 | "language_info": { 86 | "codemirror_mode": { 87 | "name": "ipython", 88 | "version": 3 89 | }, 90 | "file_extension": ".py", 91 | "mimetype": "text/x-python", 92 | "name": "python", 93 | "nbconvert_exporter": "python", 94 | "pygments_lexer": "ipython3", 95 | "version": "3.7.5" 96 | }, 97 | "toc": { 98 | "base_numbering": 1, 99 | "nav_menu": {}, 100 | "number_sections": false, 101 | "sideBar": false, 102 | "skip_h1_title": false, 103 | "title_cell": "Table of Contents", 104 | "title_sidebar": "Contents", 105 | "toc_cell": false, 106 | "toc_position": {}, 107 | "toc_section_display": false, 108 | "toc_window_display": false 109 | } 110 | }, 111 | "nbformat": 4, 112 | "nbformat_minor": 2 113 | } 114 | -------------------------------------------------------------------------------- /test/ipynb/python/InfiniteLoopPythonTest.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": null, 6 | "metadata": {}, 7 | "outputs": [], 8 | "source": [ 9 | "i = 0\n", 10 | "while True:\n", 11 | " i + 1" 12 | ] 13 | }, 14 | { 15 | "cell_type": "code", 16 | "execution_count": null, 17 | "metadata": {}, 18 | "outputs": [], 19 | "source": [] 20 | } 21 | ], 22 | "metadata": { 23 | "kernelspec": { 24 | "display_name": "Python 3", 25 | "language": "python", 26 | "name": "python3" 27 | }, 28 | "language_info": { 29 | "codemirror_mode": { 30 | "name": "ipython", 31 | "version": 3 32 | }, 33 | "file_extension": ".py", 34 | "mimetype": "text/x-python", 35 | "name": "python", 36 | "nbconvert_exporter": "python", 37 | "pygments_lexer": "ipython3", 38 | "version": "3.6.4" 39 | }, 40 | "toc": { 41 | "base_numbering": 1, 42 | "nav_menu": {}, 43 | "number_sections": false, 44 | "sideBar": false, 45 | "skip_h1_title": false, 46 | "title_cell": "Table of Contents", 47 | "title_sidebar": "Contents", 48 | "toc_cell": false, 49 | "toc_position": {}, 50 | "toc_section_display": false, 51 | "toc_window_display": false 52 | } 53 | }, 54 | "nbformat": 4, 55 | "nbformat_minor": 2 56 | } 57 | -------------------------------------------------------------------------------- /test/ipynb/python/InitCellsTest.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": null, 6 | "metadata": {}, 7 | "outputs": [], 8 | "source": [ 9 | "import time\n", 10 | "print(time.strftime(\"%a %b %d %Y\"))" 11 | ] 12 | }, 13 | { 14 | "cell_type": "markdown", 15 | "metadata": {}, 16 | "source": [ 17 | "press 'Tab' for autocomplete" 18 | ] 19 | }, 20 | { 21 | "cell_type": "code", 22 | "execution_count": null, 23 | "metadata": {}, 24 | "outputs": [], 25 | "source": [] 26 | }, 27 | { 28 | "cell_type": "markdown", 29 | "metadata": {}, 30 | "source": [ 31 | "press 'Shift' + 'Tab' for doc" 32 | ] 33 | }, 34 | { 35 | "cell_type": "code", 36 | "execution_count": null, 37 | "metadata": {}, 38 | "outputs": [], 39 | "source": [] 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": "Python 3", 52 | "language": "python", 53 | "name": "python3" 54 | }, 55 | "language_info": { 56 | "codemirror_mode": { 57 | "name": "ipython", 58 | "version": 3 59 | }, 60 | "file_extension": ".py", 61 | "mimetype": "text/x-python", 62 | "name": "python", 63 | "nbconvert_exporter": "python", 64 | "pygments_lexer": "ipython3", 65 | "version": "3.6.4" 66 | } 67 | }, 68 | "nbformat": 4, 69 | "nbformat_minor": 2 70 | } 71 | -------------------------------------------------------------------------------- /test/ipynb/python/PysparkExample.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": null, 6 | "metadata": {}, 7 | "outputs": [], 8 | "source": [ 9 | "%%spark\n", 10 | "from pyspark.sql import SparkSession\n", 11 | "SparkSession.builder \\\n", 12 | ".master(\"local[10]\") \\\n", 13 | ".config(\"spark.executor.memory\", \"4g\") \\\n", 14 | ".config(\"spark.executor.cores\", \"6\") \\\n", 15 | ".appName(\"SparkBeakerxSupport\") " 16 | ] 17 | }, 18 | { 19 | "cell_type": "code", 20 | "execution_count": null, 21 | "metadata": {}, 22 | "outputs": [], 23 | "source": [ 24 | "import random\n", 25 | "def inside(p):\n", 26 | " x, y = random.random(), random.random()\n", 27 | " return x*x + y*y < 1\n", 28 | "\n", 29 | "NUM_SAMPLES =100000000\n", 30 | "\n", 31 | "count = sc.parallelize(range(0, NUM_SAMPLES)).filter(inside).count()\n", 32 | "print(\"Pi is roughly %f\" % (4.0 * count / NUM_SAMPLES))" 33 | ] 34 | }, 35 | { 36 | "cell_type": "code", 37 | "execution_count": null, 38 | "metadata": {}, 39 | "outputs": [], 40 | "source": [ 41 | "%%spark --start\n", 42 | "from pyspark.sql import SparkSession\n", 43 | "SparkSession.builder.appName('abc')" 44 | ] 45 | }, 46 | { 47 | "cell_type": "code", 48 | "execution_count": null, 49 | "metadata": {}, 50 | "outputs": [], 51 | "source": [ 52 | "%%spark --noUI\n", 53 | "from pyspark.sql import SparkSession\n", 54 | "SparkSession.builder.appName('abc')" 55 | ] 56 | }, 57 | { 58 | "cell_type": "code", 59 | "execution_count": null, 60 | "metadata": {}, 61 | "outputs": [], 62 | "source": [ 63 | "spark.stop()" 64 | ] 65 | } 66 | ], 67 | "metadata": { 68 | "kernelspec": { 69 | "display_name": "Python 3", 70 | "language": "python", 71 | "name": "python3" 72 | }, 73 | "language_info": { 74 | "codemirror_mode": { 75 | "name": "ipython", 76 | "version": 3 77 | }, 78 | "file_extension": ".py", 79 | "mimetype": "text/x-python", 80 | "name": "python", 81 | "nbconvert_exporter": "python", 82 | "pygments_lexer": "ipython3", 83 | "version": "3.7.5" 84 | }, 85 | "toc": { 86 | "base_numbering": 1, 87 | "nav_menu": {}, 88 | "number_sections": false, 89 | "sideBar": false, 90 | "skip_h1_title": false, 91 | "title_cell": "Table of Contents", 92 | "title_sidebar": "Contents", 93 | "toc_cell": false, 94 | "toc_position": {}, 95 | "toc_section_display": false, 96 | "toc_window_display": false 97 | } 98 | }, 99 | "nbformat": 4, 100 | "nbformat_minor": 4 101 | } 102 | -------------------------------------------------------------------------------- /test/ipynb/python/Pyspark_yarn_example.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "### Run spark in yarn client mode" 8 | ] 9 | }, 10 | { 11 | "cell_type": "markdown", 12 | "metadata": {}, 13 | "source": [ 14 | "We run yarn by the following instruction https://hadoop.apache.org/docs/r3.1.2/hadoop-project-dist/hadoop-common/SingleCluster.html\n", 15 | "\n", 16 | "Additionally we have to add the following property to etc/hadoop/yarn-site.xml\n", 17 | "\n", 18 | "```\n", 19 | "\n", 20 | " yarn.nodemanager.vmem-pmem-ratio\n", 21 | " 5\n", 22 | "\n", 23 | "```\n", 24 | "\n", 25 | "or\n", 26 | "\n", 27 | "```\n", 28 | "\n", 29 | " yarn.nodemanager.pmem-check-enabled\n", 30 | " false\n", 31 | "\n", 32 | "\n", 33 | "\n", 34 | " yarn.nodemanager.vmem-check-enabled\n", 35 | " false\n", 36 | "\n", 37 | "```" 38 | ] 39 | }, 40 | { 41 | "cell_type": "code", 42 | "execution_count": null, 43 | "metadata": {}, 44 | "outputs": [], 45 | "source": [ 46 | "import os\n", 47 | "os.environ[\"HADOOP_CONF_DIR\"] = PATH_TO_HADOOP_CONF_DIR" 48 | ] 49 | }, 50 | { 51 | "cell_type": "code", 52 | "execution_count": null, 53 | "metadata": {}, 54 | "outputs": [], 55 | "source": [ 56 | "%%spark --yarn\n", 57 | "from pyspark.sql import SparkSession\n", 58 | "SparkSession.builder \\\n", 59 | ".appName(\"SparkYarnBeakerxSupport3\")" 60 | ] 61 | }, 62 | { 63 | "cell_type": "code", 64 | "execution_count": null, 65 | "metadata": {}, 66 | "outputs": [], 67 | "source": [ 68 | "import random\n", 69 | "def inside(p):\n", 70 | " x, y = random.random(), random.random()\n", 71 | " return x*x + y*y < 1\n", 72 | "\n", 73 | "NUM_SAMPLES =100000000\n", 74 | "\n", 75 | "count = sc.parallelize(range(0, NUM_SAMPLES)).filter(inside).count()\n", 76 | "print(\"Pi is roughly %f\" % (4.0 * count / NUM_SAMPLES))" 77 | ] 78 | }, 79 | { 80 | "cell_type": "code", 81 | "execution_count": null, 82 | "metadata": {}, 83 | "outputs": [], 84 | "source": [ 85 | "spark.stop()" 86 | ] 87 | }, 88 | { 89 | "cell_type": "code", 90 | "execution_count": null, 91 | "metadata": {}, 92 | "outputs": [], 93 | "source": [ 94 | "sc.stop()" 95 | ] 96 | } 97 | ], 98 | "metadata": { 99 | "kernelspec": { 100 | "display_name": "Python 3", 101 | "language": "python", 102 | "name": "python3" 103 | }, 104 | "language_info": { 105 | "codemirror_mode": { 106 | "name": "ipython", 107 | "version": 3 108 | }, 109 | "file_extension": ".py", 110 | "mimetype": "text/x-python", 111 | "name": "python", 112 | "nbconvert_exporter": "python", 113 | "pygments_lexer": "ipython3", 114 | "version": "3.7.5" 115 | }, 116 | "toc": { 117 | "base_numbering": 1, 118 | "nav_menu": {}, 119 | "number_sections": false, 120 | "sideBar": false, 121 | "skip_h1_title": false, 122 | "title_cell": "Table of Contents", 123 | "title_sidebar": "Contents", 124 | "toc_cell": false, 125 | "toc_position": {}, 126 | "toc_section_display": false, 127 | "toc_window_display": false 128 | } 129 | }, 130 | "nbformat": 4, 131 | "nbformat_minor": 4 132 | } 133 | -------------------------------------------------------------------------------- /test/ipynb/python/TableDisplayWIthIndex.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 | "from beakerx.object import beakerx\n", 11 | "\n", 12 | "import pandas as pd\n", 13 | "df = pd.read_csv('../resources/data/interest-rates-small-with_index.csv')\n", 14 | "df" 15 | ] 16 | }, 17 | { 18 | "cell_type": "code", 19 | "execution_count": null, 20 | "metadata": {}, 21 | "outputs": [], 22 | "source": [ 23 | "from beakerx import *\n", 24 | "from beakerx.object import beakerx\n", 25 | "\n", 26 | "import pandas as pd\n", 27 | "df = pd.read_csv('../resources/data/interest-rates-small-with_index.csv',index_col=0)\n", 28 | "df" 29 | ] 30 | }, 31 | { 32 | "cell_type": "code", 33 | "execution_count": null, 34 | "metadata": {}, 35 | "outputs": [], 36 | "source": [ 37 | "from beakerx import *\n", 38 | "from beakerx.object import beakerx\n", 39 | "\n", 40 | "import pandas as pd\n", 41 | "\n", 42 | "s1 = pd.Series([0, 1, 2], index=pd.date_range('2000', freq='D', periods=3))\n", 43 | "s2 = pd.Series([3, 4, 5], index=pd.date_range('2000', freq='D', periods=3))\n", 44 | "s3 = pd.Series([6, 7, 8], index=pd.date_range('2000', freq='D', periods=3))\n", 45 | "\n", 46 | "df = pd.concat([s1, s2, s3], axis=1)\n", 47 | "df" 48 | ] 49 | }, 50 | { 51 | "cell_type": "code", 52 | "execution_count": null, 53 | "metadata": {}, 54 | "outputs": [], 55 | "source": [ 56 | "from beakerx import *\n", 57 | "from beakerx.object import beakerx\n", 58 | "\n", 59 | "import pandas as pd\n", 60 | "\n", 61 | "s1 = pd.Series([0, 1, 2], index=pd.date_range('2000', freq='D', periods=3))\n", 62 | "s2 = pd.Series([3, 4, 5], index=pd.date_range('2000', freq='D', periods=3))\n", 63 | "s3 = pd.Series([6, 7, 8], index=pd.date_range('2000', freq='D', periods=3))\n", 64 | "\n", 65 | "df = pd.concat([s1, s2, s3], axis=1)\n", 66 | "\n", 67 | "def color_provider(row, column, table):\n", 68 | " row = table.values[row]\n", 69 | " val = row[column]\n", 70 | " if val == 4:\n", 71 | " return Color.GREEN\n", 72 | " return Color.BLACK\n", 73 | " \n", 74 | "table = TableDisplay(df)\n", 75 | "table.setStringFormatForTimes(TimeUnit.DAYS)\n", 76 | "table.setFontColorProvider(color_provider)\n", 77 | "\n", 78 | "table" 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": "Python 3", 92 | "language": "python", 93 | "name": "python3" 94 | }, 95 | "language_info": { 96 | "codemirror_mode": { 97 | "name": "ipython", 98 | "version": 3 99 | }, 100 | "file_extension": ".py", 101 | "mimetype": "text/x-python", 102 | "name": "python", 103 | "nbconvert_exporter": "python", 104 | "pygments_lexer": "ipython3", 105 | "version": "3.7.5" 106 | }, 107 | "toc": { 108 | "base_numbering": 1, 109 | "nav_menu": {}, 110 | "number_sections": false, 111 | "sideBar": false, 112 | "skip_h1_title": false, 113 | "title_cell": "Table of Contents", 114 | "title_sidebar": "Contents", 115 | "toc_cell": false, 116 | "toc_position": {}, 117 | "toc_section_display": false, 118 | "toc_window_display": false 119 | } 120 | }, 121 | "nbformat": 4, 122 | "nbformat_minor": 2 123 | } 124 | -------------------------------------------------------------------------------- /test/ipynb/python/accessible_URL_arguments.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "### http://{path}?bar=200&foo=300" 8 | ] 9 | }, 10 | { 11 | "cell_type": "code", 12 | "execution_count": null, 13 | "metadata": {}, 14 | "outputs": [], 15 | "source": [ 16 | "from beakerx import beakerx" 17 | ] 18 | }, 19 | { 20 | "cell_type": "code", 21 | "execution_count": null, 22 | "metadata": {}, 23 | "outputs": [], 24 | "source": [ 25 | "beakerx.urlArg(\"bar\")" 26 | ] 27 | }, 28 | { 29 | "cell_type": "code", 30 | "execution_count": null, 31 | "metadata": {}, 32 | "outputs": [], 33 | "source": [ 34 | "beakerx.urlArg(\"foo\")" 35 | ] 36 | } 37 | ], 38 | "metadata": { 39 | "kernelspec": { 40 | "display_name": "Python 3", 41 | "language": "python", 42 | "name": "python3" 43 | }, 44 | "language_info": { 45 | "codemirror_mode": { 46 | "name": "ipython", 47 | "version": 3 48 | }, 49 | "file_extension": ".py", 50 | "mimetype": "text/x-python", 51 | "name": "python", 52 | "nbconvert_exporter": "python", 53 | "pygments_lexer": "ipython3", 54 | "version": "3.6.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/python/autotranslationPandasPython.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": null, 6 | "metadata": { 7 | "scrolled": true 8 | }, 9 | "outputs": [], 10 | "source": [ 11 | "import pandas as pd\n", 12 | "from beakerx.object import beakerx\n", 13 | "df = pd.read_csv('../resources/data/interest-rates.csv')\n", 14 | "df.set_index('time')\n", 15 | "df" 16 | ] 17 | }, 18 | { 19 | "cell_type": "code", 20 | "execution_count": null, 21 | "metadata": {}, 22 | "outputs": [], 23 | "source": [ 24 | "import pandas as pd\n", 25 | "from beakerx.object import beakerx\n", 26 | "df = pd.read_csv('../resources/data/interest-rates.csv')\n", 27 | "df.set_index('time')" 28 | ] 29 | }, 30 | { 31 | "cell_type": "code", 32 | "execution_count": null, 33 | "metadata": {}, 34 | "outputs": [], 35 | "source": [ 36 | "import pandas as pd\n", 37 | "from beakerx.object import beakerx\n", 38 | "df = pd.read_csv('../resources/data/interest-rates.csv')\n", 39 | "df = df.set_index('time')\n", 40 | "beakerx.rates = df\n", 41 | "beakerx.rates" 42 | ] 43 | }, 44 | { 45 | "cell_type": "code", 46 | "execution_count": null, 47 | "metadata": { 48 | "scrolled": true 49 | }, 50 | "outputs": [], 51 | "source": [ 52 | "import pandas as pd\n", 53 | "import numpy as np\n", 54 | "from beakerx.object import beakerx\n", 55 | "a=pd.DataFrame(np.random.rand(10,5),columns=['c'+str(i) for i in range(5)])\n", 56 | "a = a.set_index('c0',append=True)\n", 57 | "beakerx.rates = a\n", 58 | "beakerx.rates" 59 | ] 60 | } 61 | ], 62 | "metadata": { 63 | "kernelspec": { 64 | "display_name": "Python 3", 65 | "language": "python", 66 | "name": "python3" 67 | }, 68 | "language_info": { 69 | "codemirror_mode": { 70 | "name": "ipython", 71 | "version": 3 72 | }, 73 | "file_extension": ".py", 74 | "mimetype": "text/x-python", 75 | "name": "python", 76 | "nbconvert_exporter": "python", 77 | "pygments_lexer": "ipython3", 78 | "version": "3.6.6" 79 | }, 80 | "toc": { 81 | "base_numbering": 1, 82 | "nav_menu": {}, 83 | "number_sections": false, 84 | "sideBar": false, 85 | "skip_h1_title": false, 86 | "title_cell": "Table of Contents", 87 | "title_sidebar": "Contents", 88 | "toc_cell": false, 89 | "toc_position": {}, 90 | "toc_section_display": false, 91 | "toc_window_display": false 92 | } 93 | }, 94 | "nbformat": 4, 95 | "nbformat_minor": 2 96 | } 97 | -------------------------------------------------------------------------------- /test/ipynb/python/polyglotKernel.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": null, 6 | "metadata": {}, 7 | "outputs": [], 8 | "source": [ 9 | "%%kernel groovy\n", 10 | "beakerx.x = 1 + 2" 11 | ] 12 | }, 13 | { 14 | "cell_type": "code", 15 | "execution_count": null, 16 | "metadata": {}, 17 | "outputs": [], 18 | "source": [ 19 | "%%groovy\n", 20 | "beakerx.x" 21 | ] 22 | }, 23 | { 24 | "cell_type": "code", 25 | "execution_count": null, 26 | "metadata": {}, 27 | "outputs": [], 28 | "source": [ 29 | "%%kotlin\n", 30 | "2 + 2" 31 | ] 32 | }, 33 | { 34 | "cell_type": "code", 35 | "execution_count": null, 36 | "metadata": {}, 37 | "outputs": [], 38 | "source": [ 39 | "%%kernel kotlin\n", 40 | "1 + 2" 41 | ] 42 | }, 43 | { 44 | "cell_type": "code", 45 | "execution_count": null, 46 | "metadata": {}, 47 | "outputs": [], 48 | "source": [ 49 | "%%kernel julia-0.4\n", 50 | "(1 + 1im) * (1 - 1im)" 51 | ] 52 | } 53 | ], 54 | "metadata": { 55 | "kernelspec": { 56 | "display_name": "Python 3", 57 | "language": "python", 58 | "name": "python3" 59 | }, 60 | "language_info": { 61 | "codemirror_mode": { 62 | "name": "ipython", 63 | "version": 3 64 | }, 65 | "file_extension": ".py", 66 | "mimetype": "text/x-python", 67 | "name": "python", 68 | "nbconvert_exporter": "python", 69 | "pygments_lexer": "ipython3", 70 | "version": "3.7.2" 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/python/set_font_color_provider.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": null, 6 | "metadata": {}, 7 | "outputs": [], 8 | "source": [ 9 | "TableDisplay.loadingMode = \"ALL\"" 10 | ] 11 | }, 12 | { 13 | "cell_type": "code", 14 | "execution_count": null, 15 | "metadata": {}, 16 | "outputs": [], 17 | "source": [ 18 | "from beakerx import *\n", 19 | "TableDisplay.loadingMode =\"ENDLESS\"\n", 20 | "rowList = []\n", 21 | "for row in range(10000):\n", 22 | " colMap = {}\n", 23 | " for col in range(2):\n", 24 | " index = col+1\n", 25 | " key = \"a\" + str(index)\n", 26 | " colMap[key] = row * index\n", 27 | " rowList.append(colMap)\n", 28 | "\n", 29 | "td = TableDisplay(rowList)\n", 30 | "\n", 31 | "def color_provider(r1, column, td):\n", 32 | " r2 = td.values[r1]\n", 33 | " val = r2[column]\n", 34 | " if val % 2 is 0:\n", 35 | " return Color.GREEN \n", 36 | " return Color.BLACK \n", 37 | "\n", 38 | "td.setFontColorProvider(color_provider)\n", 39 | "td" 40 | ] 41 | }, 42 | { 43 | "cell_type": "code", 44 | "execution_count": null, 45 | "metadata": {}, 46 | "outputs": [], 47 | "source": [ 48 | "from beakerx import *\n", 49 | "rowList = []\n", 50 | "for row in range(10000):\n", 51 | " colMap = {}\n", 52 | " for col in range(2):\n", 53 | " index = col+1\n", 54 | " key = \"a\" + str(index)\n", 55 | " colMap[key] = row * index\n", 56 | " rowList.append(colMap)\n", 57 | "\n", 58 | "td = TableDisplay(rowList)\n", 59 | "\n", 60 | "def color_provider(r1, column, td):\n", 61 | " r2 = td.values[r1]\n", 62 | " val = r2[column]\n", 63 | " if val % 2 is 0:\n", 64 | " return Color.GREEN \n", 65 | " return Color.BLACK \n", 66 | "\n", 67 | "td.setFontColorProvider(color_provider)\n", 68 | "td" 69 | ] 70 | }, 71 | { 72 | "cell_type": "code", 73 | "execution_count": null, 74 | "metadata": {}, 75 | "outputs": [], 76 | "source": [ 77 | "\n", 78 | "def color_provider(r1, column, td):\n", 79 | " r2 = td.values[r1]\n", 80 | " val = r2[column]\n", 81 | " if val % 3 is 0:\n", 82 | " return Color.GREEN \n", 83 | " return Color.BLACK \n", 84 | "\n", 85 | "td.setFontColorProvider(color_provider)" 86 | ] 87 | }, 88 | { 89 | "cell_type": "code", 90 | "execution_count": null, 91 | "metadata": {}, 92 | "outputs": [], 93 | "source": [] 94 | } 95 | ], 96 | "metadata": { 97 | "kernelspec": { 98 | "display_name": "Python 3", 99 | "language": "python", 100 | "name": "python3" 101 | }, 102 | "language_info": { 103 | "codemirror_mode": { 104 | "name": "ipython", 105 | "version": 3 106 | }, 107 | "file_extension": ".py", 108 | "mimetype": "text/x-python", 109 | "name": "python", 110 | "nbconvert_exporter": "python", 111 | "pygments_lexer": "ipython3", 112 | "version": "3.7.5" 113 | }, 114 | "toc": { 115 | "base_numbering": 1, 116 | "nav_menu": {}, 117 | "number_sections": false, 118 | "sideBar": false, 119 | "skip_h1_title": false, 120 | "title_cell": "Table of Contents", 121 | "title_sidebar": "Contents", 122 | "toc_cell": false, 123 | "toc_position": {}, 124 | "toc_section_display": false, 125 | "toc_window_display": false 126 | } 127 | }, 128 | "nbformat": 4, 129 | "nbformat_minor": 2 130 | } 131 | -------------------------------------------------------------------------------- /test/ipynb/resources/data/interest-rates-small-with_index.csv: -------------------------------------------------------------------------------- 1 | "index","m3","y30","y1","m6","y2","y10","y3","time","y5","y7","spread" 2 | "0","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 | "1","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 | "2","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 | "3","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 | "4","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 | "5","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 | "6","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 | "7","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 | "8","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 | "9","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 | "10","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 | "11","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 | "12","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 | "13","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 | -------------------------------------------------------------------------------- /test/ipynb/resources/data/people.json: -------------------------------------------------------------------------------- 1 | {"name":"Michael"} 2 | {"name":"Andy", "age":30} 3 | {"name":"Justin", "age":19} 4 | -------------------------------------------------------------------------------- /test/ipynb/scala/Executing_shell_commands_[Linux].ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": null, 6 | "metadata": {}, 7 | "outputs": [], 8 | "source": [ 9 | "import sys.process._" 10 | ] 11 | }, 12 | { 13 | "cell_type": "code", 14 | "execution_count": null, 15 | "metadata": {}, 16 | "outputs": [], 17 | "source": [ 18 | "\"pwd\" !" 19 | ] 20 | }, 21 | { 22 | "cell_type": "code", 23 | "execution_count": null, 24 | "metadata": {}, 25 | "outputs": [], 26 | "source": [ 27 | "\"ls -al\" !" 28 | ] 29 | }, 30 | { 31 | "cell_type": "code", 32 | "execution_count": null, 33 | "metadata": {}, 34 | "outputs": [], 35 | "source": [ 36 | "\"man mv\" !" 37 | ] 38 | } 39 | ], 40 | "metadata": { 41 | "kernelspec": { 42 | "display_name": "Scala", 43 | "language": "scala", 44 | "name": "scala" 45 | }, 46 | "language_info": { 47 | "codemirror_mode": "text/x-scala", 48 | "file_extension": ".scala", 49 | "mimetype": "", 50 | "name": "Scala", 51 | "nbconverter_exporter": "", 52 | "version": "2.12.8" 53 | }, 54 | "toc": { 55 | "base_numbering": 1, 56 | "nav_menu": {}, 57 | "number_sections": false, 58 | "sideBar": false, 59 | "skip_h1_title": false, 60 | "title_cell": "Table of Contents", 61 | "title_sidebar": "Contents", 62 | "toc_cell": false, 63 | "toc_position": {}, 64 | "toc_section_display": false, 65 | "toc_window_display": false 66 | } 67 | }, 68 | "nbformat": 4, 69 | "nbformat_minor": 2 70 | } 71 | -------------------------------------------------------------------------------- /test/ipynb/scala/HiveSupportExample.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": null, 6 | "metadata": {}, 7 | "outputs": [], 8 | "source": [ 9 | "%%classpath add mvn\n", 10 | "org.apache.spark spark-hive_2.11 2.4.0" 11 | ] 12 | }, 13 | { 14 | "cell_type": "code", 15 | "execution_count": null, 16 | "metadata": {}, 17 | "outputs": [], 18 | "source": [ 19 | "%%spark\n", 20 | "SparkSession\n", 21 | " .builder()\n", 22 | " .master(\"local[4]\")\n", 23 | " .appName(\"Spark Hive Example\")\n", 24 | "//.config(\"spark.sql.catalogImplementation\",\"hive\")\n", 25 | ".enableHiveSupport()" 26 | ] 27 | }, 28 | { 29 | "cell_type": "code", 30 | "execution_count": null, 31 | "metadata": {}, 32 | "outputs": [], 33 | "source": [ 34 | "import java.io.File\n", 35 | "\n", 36 | "import org.apache.spark.sql.{Row, SaveMode, SparkSession}\n", 37 | "\n", 38 | "case class Record(key: Int, value: String)\n", 39 | "\n", 40 | "import spark.implicits._\n", 41 | "import spark.sql\n", 42 | "\n", 43 | "val kv1File = new File(\"../resources/data/kv1.txt\").getCanonicalPath\n", 44 | "\n", 45 | "sql(\"CREATE TABLE IF NOT EXISTS src (key INT, value STRING) USING hive\")\n", 46 | "sql(\"LOAD DATA LOCAL INPATH '\"+kv1File+\"' INTO TABLE src\")\n", 47 | "\n", 48 | "// Queries are expressed in HiveQL\n", 49 | "sql(\"SELECT * FROM src\").show()" 50 | ] 51 | }, 52 | { 53 | "cell_type": "code", 54 | "execution_count": null, 55 | "metadata": {}, 56 | "outputs": [], 57 | "source": [] 58 | } 59 | ], 60 | "metadata": { 61 | "kernelspec": { 62 | "display_name": "Scala", 63 | "language": "scala", 64 | "name": "scala" 65 | }, 66 | "language_info": { 67 | "codemirror_mode": "text/x-scala", 68 | "file_extension": ".scala", 69 | "mimetype": "", 70 | "name": "Scala", 71 | "nbconverter_exporter": "", 72 | "version": "2.11.12" 73 | }, 74 | "toc": { 75 | "base_numbering": 1, 76 | "nav_menu": {}, 77 | "number_sections": false, 78 | "sideBar": false, 79 | "skip_h1_title": false, 80 | "title_cell": "Table of Contents", 81 | "title_sidebar": "Contents", 82 | "toc_cell": false, 83 | "toc_position": {}, 84 | "toc_section_display": false, 85 | "toc_window_display": false 86 | } 87 | }, 88 | "nbformat": 4, 89 | "nbformat_minor": 2 90 | } 91 | -------------------------------------------------------------------------------- /test/ipynb/scala/InfiniteLoopScala.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": null, 6 | "metadata": {}, 7 | "outputs": [], 8 | "source": [ 9 | "var 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 | "2+2" 22 | ] 23 | } 24 | ], 25 | "metadata": { 26 | "kernelspec": { 27 | "display_name": "Scala", 28 | "language": "scala", 29 | "name": "scala" 30 | }, 31 | "language_info": { 32 | "codemirror_mode": "text/x-scala", 33 | "file_extension": ".scala", 34 | "mimetype": "", 35 | "name": "Scala", 36 | "nbconverter_exporter": "", 37 | "version": "2.12.8" 38 | }, 39 | "toc": { 40 | "base_numbering": 1, 41 | "nav_menu": {}, 42 | "number_sections": false, 43 | "sideBar": false, 44 | "skip_h1_title": false, 45 | "title_cell": "Table of Contents", 46 | "title_sidebar": "Contents", 47 | "toc_cell": false, 48 | "toc_position": {}, 49 | "toc_section_display": false, 50 | "toc_window_display": false 51 | } 52 | }, 53 | "nbformat": 4, 54 | "nbformat_minor": 4 55 | } 56 | -------------------------------------------------------------------------------- /test/ipynb/scala/InfiniteLoopScalaTest.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": null, 6 | "metadata": {}, 7 | "outputs": [], 8 | "source": [ 9 | "val i = 0\n", 10 | "while (true)\n", 11 | " i + 1" 12 | ] 13 | }, 14 | { 15 | "cell_type": "code", 16 | "execution_count": null, 17 | "metadata": {}, 18 | "outputs": [], 19 | "source": [] 20 | } 21 | ], 22 | "metadata": { 23 | "kernelspec": { 24 | "display_name": "Scala", 25 | "language": "scala", 26 | "name": "scala" 27 | }, 28 | "language_info": { 29 | "codemirror_mode": "text/x-scala", 30 | "file_extension": ".scala", 31 | "mimetype": "", 32 | "name": "Scala", 33 | "nbconverter_exporter": "", 34 | "version": "2.11.12" 35 | }, 36 | "toc": { 37 | "base_numbering": 1, 38 | "nav_menu": {}, 39 | "number_sections": false, 40 | "sideBar": false, 41 | "skip_h1_title": false, 42 | "title_cell": "Table of Contents", 43 | "title_sidebar": "Contents", 44 | "toc_cell": false, 45 | "toc_position": {}, 46 | "toc_section_display": false, 47 | "toc_window_display": false 48 | } 49 | }, 50 | "nbformat": 4, 51 | "nbformat_minor": 2 52 | } 53 | -------------------------------------------------------------------------------- /test/ipynb/scala/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 | "import org.nd4j.linalg.factory.Nd4j\n", 47 | "Nd4j.getRandom()" 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": "Scala", 61 | "language": "scala", 62 | "name": "scala" 63 | }, 64 | "language_info": { 65 | "codemirror_mode": "text/x-scala", 66 | "file_extension": ".scala", 67 | "mimetype": "", 68 | "name": "Scala", 69 | "nbconverter_exporter": "", 70 | "version": "2.11.11" 71 | } 72 | }, 73 | "nbformat": 4, 74 | "nbformat_minor": 2 75 | } 76 | -------------------------------------------------------------------------------- /test/ipynb/scala/ScalaTest.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": null, 6 | "metadata": {}, 7 | "outputs": [], 8 | "source": [ 9 | "class Greeter(prefix: String, suffix: String) {\n", 10 | " def greet(name: String): Unit =\n", 11 | " println(prefix + name + suffix)\n", 12 | "}" 13 | ] 14 | }, 15 | { 16 | "cell_type": "code", 17 | "execution_count": null, 18 | "metadata": {}, 19 | "outputs": [], 20 | "source": [ 21 | "val greeter = new Greeter(\"Hello, \", \"!\")\n", 22 | "greeter.greet(\"Scala developer\") // Hello, Scala developer!" 23 | ] 24 | }, 25 | { 26 | "cell_type": "code", 27 | "execution_count": null, 28 | "metadata": {}, 29 | "outputs": [], 30 | "source": [ 31 | "%%python\n", 32 | "from beakerx import *\n", 33 | "pp = Plot(title=\"Title\", xLabel=\"Horizontal\", yLabel=\"Vertical\")\n", 34 | "pp.add(Line(displayName=\"Line\", x=[1, 4, 6, 8, 10],y=[3, 6, 4, 5, 9]))" 35 | ] 36 | }, 37 | { 38 | "cell_type": "markdown", 39 | "metadata": {}, 40 | "source": [ 41 | "press 'Tab' for autocomplete" 42 | ] 43 | }, 44 | { 45 | "cell_type": "code", 46 | "execution_count": null, 47 | "metadata": {}, 48 | "outputs": [], 49 | "source": [] 50 | }, 51 | { 52 | "cell_type": "markdown", 53 | "metadata": {}, 54 | "source": [ 55 | "press 'Shift' + 'Tab' for doc" 56 | ] 57 | }, 58 | { 59 | "cell_type": "code", 60 | "execution_count": null, 61 | "metadata": {}, 62 | "outputs": [], 63 | "source": [] 64 | }, 65 | { 66 | "cell_type": "code", 67 | "execution_count": null, 68 | "metadata": {}, 69 | "outputs": [], 70 | "source": [] 71 | } 72 | ], 73 | "metadata": { 74 | "kernelspec": { 75 | "display_name": "Scala", 76 | "language": "scala", 77 | "name": "scala" 78 | }, 79 | "language_info": { 80 | "codemirror_mode": "text/x-scala", 81 | "file_extension": ".scala", 82 | "mimetype": "", 83 | "name": "Scala", 84 | "nbconverter_exporter": "", 85 | "version": "2.11.12" 86 | } 87 | }, 88 | "nbformat": 4, 89 | "nbformat_minor": 2 90 | } 91 | -------------------------------------------------------------------------------- /test/ipynb/scala/SparkScalaTest.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": null, 6 | "metadata": {}, 7 | "outputs": [], 8 | "source": [ 9 | "%%classpath add mvn\n", 10 | "org.apache.spark spark-sql_2.12 2.4.4" 11 | ] 12 | }, 13 | { 14 | "cell_type": "code", 15 | "execution_count": null, 16 | "metadata": {}, 17 | "outputs": [], 18 | "source": [ 19 | "import org.apache.spark.sql.SparkSession\n", 20 | "\n", 21 | "val spark = SparkSession.builder()\n", 22 | " .appName(\"Simple Application\")\n", 23 | " .master(\"local[4]\")\n", 24 | " .config(\"spark.ui.enabled\", \"false\")\n", 25 | " .getOrCreate()" 26 | ] 27 | }, 28 | { 29 | "cell_type": "code", 30 | "execution_count": null, 31 | "metadata": {}, 32 | "outputs": [], 33 | "source": [ 34 | "import scala.math.random\n", 35 | "val NUM_SAMPLES = 10000000\n", 36 | "\n", 37 | "val count = spark.sparkContext.parallelize(1 to NUM_SAMPLES).map{i =>\n", 38 | " val x = random\n", 39 | " val y = random\n", 40 | " if (x*x + y*y < 1) 1 else 0\n", 41 | "}.reduce(_ + _)\n", 42 | "\n", 43 | "println(\"Pi is roughly \" + 4.0 * count / NUM_SAMPLES)" 44 | ] 45 | }, 46 | { 47 | "cell_type": "code", 48 | "execution_count": null, 49 | "metadata": {}, 50 | "outputs": [], 51 | "source": [ 52 | "spark.stop()" 53 | ] 54 | }, 55 | { 56 | "cell_type": "code", 57 | "execution_count": null, 58 | "metadata": {}, 59 | "outputs": [], 60 | "source": [] 61 | } 62 | ], 63 | "metadata": { 64 | "kernelspec": { 65 | "display_name": "Scala", 66 | "language": "scala", 67 | "name": "scala" 68 | }, 69 | "language_info": { 70 | "codemirror_mode": "text/x-scala", 71 | "file_extension": ".scala", 72 | "mimetype": "", 73 | "name": "Scala", 74 | "nbconverter_exporter": "", 75 | "version": "2.11.12" 76 | }, 77 | "toc": { 78 | "base_numbering": 1, 79 | "nav_menu": {}, 80 | "number_sections": false, 81 | "sideBar": false, 82 | "skip_h1_title": false, 83 | "title_cell": "Table of Contents", 84 | "title_sidebar": "Contents", 85 | "toc_cell": false, 86 | "toc_position": {}, 87 | "toc_section_display": false, 88 | "toc_window_display": false 89 | } 90 | }, 91 | "nbformat": 4, 92 | "nbformat_minor": 2 93 | } 94 | -------------------------------------------------------------------------------- /test/ipynb/scala/SparkUITest.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": null, 6 | "metadata": { 7 | "scrolled": false 8 | }, 9 | "outputs": [], 10 | "source": [ 11 | "%%classpath add mvn\n", 12 | "org.apache.spark spark-sql_2.12 2.4.4" 13 | ] 14 | }, 15 | { 16 | "cell_type": "code", 17 | "execution_count": null, 18 | "metadata": {}, 19 | "outputs": [], 20 | "source": [ 21 | "%%spark\n", 22 | "SparkSession.builder()\n", 23 | " .appName(\"Simple Application\")\n", 24 | " .master(\"local[4]\")" 25 | ] 26 | }, 27 | { 28 | "cell_type": "code", 29 | "execution_count": null, 30 | "metadata": {}, 31 | "outputs": [], 32 | "source": [ 33 | "import scala.math.random\n", 34 | "val NUM_SAMPLES = 10000000\n", 35 | "\n", 36 | "val count2 = spark.sparkContext.parallelize(1 to NUM_SAMPLES).map{i =>\n", 37 | " val x = random\n", 38 | " val y = random\n", 39 | " if (x*x + y*y < 1) 1 else 0\n", 40 | "}.reduce(_ + _)\n", 41 | "\n", 42 | "println(\"Pi is roughly \" + 4.0 * count2 / NUM_SAMPLES)" 43 | ] 44 | }, 45 | { 46 | "cell_type": "code", 47 | "execution_count": null, 48 | "metadata": {}, 49 | "outputs": [], 50 | "source": [ 51 | "val tornadoesPath = java.nio.file.Paths.get(\"../../resources/data/tornadoes_2014.csv\").toAbsolutePath()\n", 52 | "\n", 53 | "val ds = spark.read.format(\"csv\").option(\"header\", \"true\").load(tornadoesPath.toString())\n", 54 | "ds" 55 | ] 56 | }, 57 | { 58 | "cell_type": "code", 59 | "execution_count": null, 60 | "metadata": {}, 61 | "outputs": [], 62 | "source": [ 63 | "// cell 4 expected result\n", 64 | "Image(\"../../resources/img/scala/sparkgui/cell4_case1.png\")" 65 | ] 66 | }, 67 | { 68 | "cell_type": "code", 69 | "execution_count": null, 70 | "metadata": {}, 71 | "outputs": [], 72 | "source": [ 73 | "ds.display(1)" 74 | ] 75 | }, 76 | { 77 | "cell_type": "code", 78 | "execution_count": null, 79 | "metadata": {}, 80 | "outputs": [], 81 | "source": [ 82 | "// cell 5 expected result\n", 83 | "Image(\"../../resources/img/scala/sparkgui/cell5_case1.png\")" 84 | ] 85 | }, 86 | { 87 | "cell_type": "markdown", 88 | "metadata": {}, 89 | "source": [ 90 | "### AutoConnect: use --start or -s" 91 | ] 92 | }, 93 | { 94 | "cell_type": "code", 95 | "execution_count": null, 96 | "metadata": {}, 97 | "outputs": [], 98 | "source": [ 99 | "%%spark --start" 100 | ] 101 | } 102 | ], 103 | "metadata": { 104 | "kernelspec": { 105 | "display_name": "Scala", 106 | "language": "scala", 107 | "name": "scala" 108 | }, 109 | "language_info": { 110 | "codemirror_mode": "text/x-scala", 111 | "file_extension": ".scala", 112 | "mimetype": "", 113 | "name": "Scala", 114 | "nbconverter_exporter": "", 115 | "version": "2.11.12" 116 | }, 117 | "toc": { 118 | "base_numbering": 1, 119 | "nav_menu": {}, 120 | "number_sections": false, 121 | "sideBar": false, 122 | "skip_h1_title": false, 123 | "title_cell": "Table of Contents", 124 | "title_sidebar": "Contents", 125 | "toc_cell": false, 126 | "toc_position": {}, 127 | "toc_section_display": false, 128 | "toc_window_display": false 129 | } 130 | }, 131 | "nbformat": 4, 132 | "nbformat_minor": 2 133 | } 134 | -------------------------------------------------------------------------------- /test/ipynb/scala/SparkUI_example.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": null, 6 | "metadata": { 7 | "scrolled": false 8 | }, 9 | "outputs": [], 10 | "source": [ 11 | "%%classpath add mvn\n", 12 | "org.apache.spark spark-sql_2.12 2.4.4" 13 | ] 14 | }, 15 | { 16 | "cell_type": "code", 17 | "execution_count": null, 18 | "metadata": {}, 19 | "outputs": [], 20 | "source": [ 21 | "%%spark\n", 22 | "SparkSession.builder()\n", 23 | " .appName(\"Simple Application\")\n", 24 | " .master(\"local[4]\")" 25 | ] 26 | }, 27 | { 28 | "cell_type": "code", 29 | "execution_count": null, 30 | "metadata": {}, 31 | "outputs": [], 32 | "source": [ 33 | "import scala.math.random\n", 34 | "val NUM_SAMPLES = 10000000\n", 35 | "\n", 36 | "val count2 = spark.sparkContext.parallelize(1 to NUM_SAMPLES).map{i =>\n", 37 | " val x = random\n", 38 | " val y = random\n", 39 | " if (x*x + y*y < 1) 1 else 0\n", 40 | "}.reduce(_ + _)\n", 41 | "\n", 42 | "println(\"Pi is roughly \" + 4.0 * count2 / NUM_SAMPLES)" 43 | ] 44 | }, 45 | { 46 | "cell_type": "code", 47 | "execution_count": null, 48 | "metadata": {}, 49 | "outputs": [], 50 | "source": [ 51 | "val tornadoesPath = java.nio.file.Paths.get(\"../../resources/data/tornadoes_2014.csv\").toAbsolutePath()\n", 52 | "\n", 53 | "val ds = spark.read.format(\"csv\").option(\"header\", \"true\").load(tornadoesPath.toString())\n", 54 | "ds" 55 | ] 56 | }, 57 | { 58 | "cell_type": "code", 59 | "execution_count": null, 60 | "metadata": {}, 61 | "outputs": [], 62 | "source": [ 63 | "ds.display(1)" 64 | ] 65 | }, 66 | { 67 | "cell_type": "markdown", 68 | "metadata": {}, 69 | "source": [ 70 | "### AutoConnect: use --start or -s" 71 | ] 72 | }, 73 | { 74 | "cell_type": "code", 75 | "execution_count": null, 76 | "metadata": {}, 77 | "outputs": [], 78 | "source": [ 79 | "%%spark --start" 80 | ] 81 | }, 82 | { 83 | "cell_type": "markdown", 84 | "metadata": {}, 85 | "source": [ 86 | "### Autoload: use --version or -v " 87 | ] 88 | }, 89 | { 90 | "cell_type": "code", 91 | "execution_count": null, 92 | "metadata": {}, 93 | "outputs": [], 94 | "source": [ 95 | "%%spark -v 2.3.1 -s" 96 | ] 97 | } 98 | ], 99 | "metadata": { 100 | "kernelspec": { 101 | "display_name": "Scala", 102 | "language": "scala", 103 | "name": "scala" 104 | }, 105 | "language_info": { 106 | "codemirror_mode": "text/x-scala", 107 | "file_extension": ".scala", 108 | "mimetype": "", 109 | "name": "Scala", 110 | "nbconverter_exporter": "", 111 | "version": "2.11.12" 112 | }, 113 | "toc": { 114 | "base_numbering": 1, 115 | "nav_menu": {}, 116 | "number_sections": false, 117 | "sideBar": false, 118 | "skip_h1_title": false, 119 | "title_cell": "Table of Contents", 120 | "title_sidebar": "Contents", 121 | "toc_cell": false, 122 | "toc_position": {}, 123 | "toc_section_display": false, 124 | "toc_window_display": false 125 | } 126 | }, 127 | "nbformat": 4, 128 | "nbformat_minor": 2 129 | } 130 | -------------------------------------------------------------------------------- /test/ipynb/scala/Spark_no_UI_option.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": null, 6 | "metadata": {}, 7 | "outputs": [], 8 | "source": [ 9 | "%%classpath add mvn\n", 10 | "org.apache.spark spark-sql_2.12 2.4.4" 11 | ] 12 | }, 13 | { 14 | "cell_type": "code", 15 | "execution_count": null, 16 | "metadata": {}, 17 | "outputs": [], 18 | "source": [ 19 | "%%spark --noUI\n", 20 | "SparkSession.builder()\n", 21 | " .appName(\"Simple Application\")\n", 22 | " .master(\"local[4]\")" 23 | ] 24 | }, 25 | { 26 | "cell_type": "code", 27 | "execution_count": null, 28 | "metadata": {}, 29 | "outputs": [], 30 | "source": [ 31 | "import scala.math.random\n", 32 | "val NUM_SAMPLES = 10000000\n", 33 | "\n", 34 | "val count2 = spark.sparkContext.parallelize(1 to NUM_SAMPLES).map{i =>\n", 35 | " val x = random\n", 36 | " val y = random\n", 37 | " if (x*x + y*y < 1) 1 else 0\n", 38 | "}.reduce(_ + _)\n", 39 | "\n", 40 | "\"Pi is roughly \" + 4.0 * count2 / NUM_SAMPLES" 41 | ] 42 | }, 43 | { 44 | "cell_type": "code", 45 | "execution_count": null, 46 | "metadata": {}, 47 | "outputs": [], 48 | "source": [ 49 | "spark.sparkContext.stop()" 50 | ] 51 | } 52 | ], 53 | "metadata": { 54 | "kernelspec": { 55 | "display_name": "Scala", 56 | "language": "scala", 57 | "name": "scala" 58 | }, 59 | "language_info": { 60 | "codemirror_mode": "text/x-scala", 61 | "file_extension": ".scala", 62 | "mimetype": "", 63 | "name": "Scala", 64 | "nbconverter_exporter": "", 65 | "version": "2.12.8" 66 | }, 67 | "toc": { 68 | "base_numbering": 1, 69 | "nav_menu": {}, 70 | "number_sections": false, 71 | "sideBar": false, 72 | "skip_h1_title": false, 73 | "title_cell": "Table of Contents", 74 | "title_sidebar": "Contents", 75 | "toc_cell": false, 76 | "toc_position": {}, 77 | "toc_section_display": false, 78 | "toc_window_display": false 79 | } 80 | }, 81 | "nbformat": 4, 82 | "nbformat_minor": 2 83 | } 84 | -------------------------------------------------------------------------------- /test/ipynb/scala/SupportScalaObjectInAutotranslation.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": null, 6 | "metadata": {}, 7 | "outputs": [], 8 | "source": [ 9 | "%%javascript\n", 10 | "beakerx.bar = [23, 48, 55, 100];" 11 | ] 12 | }, 13 | { 14 | "cell_type": "code", 15 | "execution_count": null, 16 | "metadata": { 17 | "scrolled": true 18 | }, 19 | "outputs": [], 20 | "source": [ 21 | "%%scala\n", 22 | "beakerx.bar.as[List[Int]].head" 23 | ] 24 | }, 25 | { 26 | "cell_type": "code", 27 | "execution_count": null, 28 | "metadata": {}, 29 | "outputs": [], 30 | "source": [ 31 | "%%scala\n", 32 | "val list = beakerx.bar.as[List[Any]]\n", 33 | "list.head" 34 | ] 35 | }, 36 | { 37 | "cell_type": "code", 38 | "execution_count": null, 39 | "metadata": {}, 40 | "outputs": [], 41 | "source": [ 42 | "%%scala\n", 43 | "beakerx.bar.as[List[Any]](1)" 44 | ] 45 | }, 46 | { 47 | "cell_type": "code", 48 | "execution_count": null, 49 | "metadata": {}, 50 | "outputs": [], 51 | "source": [ 52 | "%%scala\n", 53 | "beakerx.bar.as[List[Any]].isEmpty" 54 | ] 55 | }, 56 | { 57 | "cell_type": "code", 58 | "execution_count": null, 59 | "metadata": {}, 60 | "outputs": [], 61 | "source": [ 62 | "%%scala\n", 63 | "1 :: beakerx.bar.as[List[Any]]" 64 | ] 65 | }, 66 | { 67 | "cell_type": "code", 68 | "execution_count": null, 69 | "metadata": {}, 70 | "outputs": [], 71 | "source": [ 72 | "%%scala\n", 73 | "beakerx.bar.asInstanceOf[List[Any]].head" 74 | ] 75 | }, 76 | { 77 | "cell_type": "code", 78 | "execution_count": null, 79 | "metadata": {}, 80 | "outputs": [], 81 | "source": [ 82 | "%%javascript\n", 83 | "beakerx.foo = 11;" 84 | ] 85 | }, 86 | { 87 | "cell_type": "code", 88 | "execution_count": null, 89 | "metadata": {}, 90 | "outputs": [], 91 | "source": [ 92 | "%%scala\n", 93 | "beakerx.foo.as[Int] + 1" 94 | ] 95 | }, 96 | { 97 | "cell_type": "code", 98 | "execution_count": null, 99 | "metadata": {}, 100 | "outputs": [], 101 | "source": [ 102 | "%%scala\n", 103 | "val cc = beakerx.foo.as[Int] \n", 104 | "cc + 1" 105 | ] 106 | }, 107 | { 108 | "cell_type": "code", 109 | "execution_count": null, 110 | "metadata": {}, 111 | "outputs": [], 112 | "source": [] 113 | } 114 | ], 115 | "metadata": { 116 | "kernelspec": { 117 | "display_name": "Groovy", 118 | "language": "groovy", 119 | "name": "groovy" 120 | }, 121 | "language_info": { 122 | "codemirror_mode": "groovy", 123 | "file_extension": ".groovy", 124 | "mimetype": "", 125 | "name": "Groovy", 126 | "nbconverter_exporter": "", 127 | "version": "2.4.3" 128 | }, 129 | "toc": { 130 | "base_numbering": 1, 131 | "nav_menu": {}, 132 | "number_sections": false, 133 | "sideBar": false, 134 | "skip_h1_title": false, 135 | "title_cell": "Table of Contents", 136 | "title_sidebar": "Contents", 137 | "toc_cell": false, 138 | "toc_position": {}, 139 | "toc_section_display": false, 140 | "toc_window_display": false 141 | } 142 | }, 143 | "nbformat": 4, 144 | "nbformat_minor": 2 145 | } 146 | -------------------------------------------------------------------------------- /test/ipynb/scala/TableDisplayStream.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": null, 6 | "metadata": {}, 7 | "outputs": [], 8 | "source": [ 9 | "import scala.util.Random\n", 10 | "\n", 11 | "TableDisplay.setLoadingMode(TableDisplayLoadingMode.ENDLESS)\n", 12 | "import scala.util.Random\n", 13 | "val random = new Random()\n", 14 | "var index = 0\n", 15 | "val s1: Stream[Map[String, Any]] = Stream.continually {\n", 16 | " index+=1\n", 17 | " Map(\n", 18 | " \"str1\" -> index,\n", 19 | " \"str2\" -> random.nextFloat(),\n", 20 | " \"str3\" -> random.nextDouble())\n", 21 | "}\n", 22 | "new TableDisplay(s1)" 23 | ] 24 | }, 25 | { 26 | "cell_type": "code", 27 | "execution_count": null, 28 | "metadata": {}, 29 | "outputs": [], 30 | "source": [] 31 | } 32 | ], 33 | "metadata": { 34 | "kernelspec": { 35 | "display_name": "Scala", 36 | "language": "scala", 37 | "name": "scala" 38 | }, 39 | "language_info": { 40 | "codemirror_mode": "text/x-scala", 41 | "file_extension": ".scala", 42 | "mimetype": "", 43 | "name": "Scala", 44 | "nbconverter_exporter": "", 45 | "version": "2.12.8" 46 | }, 47 | "toc": { 48 | "base_numbering": 1, 49 | "nav_menu": {}, 50 | "number_sections": false, 51 | "sideBar": false, 52 | "skip_h1_title": false, 53 | "title_cell": "Table of Contents", 54 | "title_sidebar": "Contents", 55 | "toc_cell": false, 56 | "toc_position": {}, 57 | "toc_section_display": false, 58 | "toc_window_display": false 59 | } 60 | }, 61 | "nbformat": 4, 62 | "nbformat_minor": 2 63 | } 64 | -------------------------------------------------------------------------------- /test/ipynb/scala/parquet.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "### example \n", 8 | "https://spark.apache.org/docs/latest/sql-data-sources-parquet.html" 9 | ] 10 | }, 11 | { 12 | "cell_type": "code", 13 | "execution_count": null, 14 | "metadata": {}, 15 | "outputs": [], 16 | "source": [ 17 | "%%classpath add mvn\n", 18 | "org.apache.spark spark-core_2.11 2.3.1\n", 19 | "org.apache.spark spark-sql_2.11 2.3.1\n", 20 | "org.apache.spark spark-hive_2.11 2.3.1" 21 | ] 22 | }, 23 | { 24 | "cell_type": "code", 25 | "execution_count": null, 26 | "metadata": {}, 27 | "outputs": [], 28 | "source": [ 29 | "import org.apache.spark.sql.SparkSession\n", 30 | "val spark = SparkSession.builder()\n", 31 | " .master(\"local\")\n", 32 | " .appName(\"parquet example\")\n", 33 | " .getOrCreate()\n", 34 | "spark" 35 | ] 36 | }, 37 | { 38 | "cell_type": "code", 39 | "execution_count": null, 40 | "metadata": {}, 41 | "outputs": [], 42 | "source": [ 43 | "val peopleDF = spark.read.json(\"../resources/data/people.json\")" 44 | ] 45 | }, 46 | { 47 | "cell_type": "code", 48 | "execution_count": null, 49 | "metadata": {}, 50 | "outputs": [], 51 | "source": [ 52 | "import spark.implicits._\n", 53 | "peopleDF.write.parquet(\"people.parquet\")" 54 | ] 55 | }, 56 | { 57 | "cell_type": "code", 58 | "execution_count": null, 59 | "metadata": {}, 60 | "outputs": [], 61 | "source": [ 62 | "import spark.implicits._\n", 63 | "val parquetFileDF = spark.read.parquet(\"people.parquet\")\n", 64 | "parquetFileDF.createOrReplaceTempView(\"parquetFile\")\n", 65 | "val namesDF = spark.sql(\"SELECT name FROM parquetFile WHERE age BETWEEN 13 AND 19\")\n", 66 | "namesDF.map(attributes => \"Name: \" + attributes(0)).show()" 67 | ] 68 | }, 69 | { 70 | "cell_type": "code", 71 | "execution_count": null, 72 | "metadata": {}, 73 | "outputs": [], 74 | "source": [ 75 | "peopleDF.count" 76 | ] 77 | }, 78 | { 79 | "cell_type": "code", 80 | "execution_count": null, 81 | "metadata": {}, 82 | "outputs": [], 83 | "source": [] 84 | } 85 | ], 86 | "metadata": { 87 | "kernelspec": { 88 | "display_name": "Scala", 89 | "language": "scala", 90 | "name": "scala" 91 | }, 92 | "language_info": { 93 | "codemirror_mode": "text/x-scala", 94 | "file_extension": ".scala", 95 | "mimetype": "", 96 | "name": "Scala", 97 | "nbconverter_exporter": "", 98 | "version": "2.11.12" 99 | }, 100 | "toc": { 101 | "base_numbering": 1, 102 | "nav_menu": {}, 103 | "number_sections": false, 104 | "sideBar": false, 105 | "skip_h1_title": false, 106 | "title_cell": "Table of Contents", 107 | "title_sidebar": "Contents", 108 | "toc_cell": false, 109 | "toc_position": {}, 110 | "toc_section_display": false, 111 | "toc_window_display": false 112 | } 113 | }, 114 | "nbformat": 4, 115 | "nbformat_minor": 2 116 | } 117 | -------------------------------------------------------------------------------- /test/ipynb/scala/spark_mesos.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "### instructions\n", 8 | "1. install and run mesos http://mesos.apache.org/documentation/latest/building/\n", 9 | "2. in CLI -> export MESOS_NATIVE_JAVA_LIBRARY=\"path to libmesos.so\"\n", 10 | "3. in the same CLI -> run jupyter notebook" 11 | ] 12 | }, 13 | { 14 | "cell_type": "code", 15 | "execution_count": null, 16 | "metadata": { 17 | "scrolled": false 18 | }, 19 | "outputs": [], 20 | "source": [ 21 | "%%classpath add mvn\n", 22 | "org.apache.spark spark-mesos_2.11 2.4.0" 23 | ] 24 | }, 25 | { 26 | "cell_type": "code", 27 | "execution_count": null, 28 | "metadata": {}, 29 | "outputs": [], 30 | "source": [ 31 | "%%spark \n", 32 | "SparkSession.builder()\n", 33 | " .appName(\"Simple Application\")\n", 34 | " .config(\"spark.executor.uri\", \"PATH_TO/spark-2.4.0-bin-hadoop2.7.tgz\")\n", 35 | "// or \n", 36 | "// .config(\"spark.mesos.executor.home\", \"SPARK_HOME\")\n", 37 | " .master(\"mesos://127.0.0.1:5050\")" 38 | ] 39 | }, 40 | { 41 | "cell_type": "code", 42 | "execution_count": null, 43 | "metadata": {}, 44 | "outputs": [], 45 | "source": [ 46 | "import scala.math.random\n", 47 | "val NUM_SAMPLES = 10000000\n", 48 | "\n", 49 | "val count2 = spark.sparkContext.parallelize(1 to NUM_SAMPLES).map{i =>\n", 50 | " val x = random\n", 51 | " val y = random\n", 52 | " if (x*x + y*y < 1) 1 else 0\n", 53 | "}.reduce(_ + _)\n", 54 | "\n", 55 | "println(\"Pi is roughly \" + 4.0 * count2 / NUM_SAMPLES)" 56 | ] 57 | } 58 | ], 59 | "metadata": { 60 | "kernelspec": { 61 | "display_name": "Scala", 62 | "language": "scala", 63 | "name": "scala" 64 | }, 65 | "language_info": { 66 | "codemirror_mode": "text/x-scala", 67 | "file_extension": ".scala", 68 | "mimetype": "", 69 | "name": "Scala", 70 | "nbconverter_exporter": "", 71 | "version": "2.11.12" 72 | }, 73 | "toc": { 74 | "base_numbering": 1, 75 | "nav_menu": {}, 76 | "number_sections": false, 77 | "sideBar": false, 78 | "skip_h1_title": false, 79 | "title_cell": "Table of Contents", 80 | "title_sidebar": "Contents", 81 | "toc_cell": false, 82 | "toc_position": {}, 83 | "toc_section_display": false, 84 | "toc_window_display": false 85 | } 86 | }, 87 | "nbformat": 4, 88 | "nbformat_minor": 2 89 | } 90 | -------------------------------------------------------------------------------- /test/ipynb/scala/sqlDriver.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": null, 6 | "metadata": {}, 7 | "outputs": [], 8 | "source": [ 9 | "%classpath add mvn org.xerial sqlite-jdbc 3.27.2.1" 10 | ] 11 | }, 12 | { 13 | "cell_type": "code", 14 | "execution_count": null, 15 | "metadata": {}, 16 | "outputs": [], 17 | "source": [ 18 | "val conn = BxDriverManager.getConnection(\"jdbc:sqlite:sample.db\"); " 19 | ] 20 | }, 21 | { 22 | "cell_type": "code", 23 | "execution_count": null, 24 | "metadata": {}, 25 | "outputs": [], 26 | "source": [ 27 | " try{ \n", 28 | " val sql = \"CREATE TABLE IF NOT EXISTS Person ( id integer PRIMARY KEY, name text NOT NULL);\"; \n", 29 | " val stmt = conn.createStatement(); \n", 30 | " val result = stmt.execute(sql); \n", 31 | " val dbm = conn.getMetaData();\n", 32 | " val tables = dbm.getTables(null, null, \"Person\", null);\n", 33 | " while (tables.next()) { \n", 34 | " val tName = tables.getString(\"TABLE_NAME\");\n", 35 | " if (tName != null && tName.equals(\"Person\")) {\n", 36 | " println(\"table '\"+tName+\"' exists \"); \n", 37 | " val tExists = true;\n", 38 | " }\n", 39 | " } \n", 40 | " } finally{\n", 41 | " conn.close()\n", 42 | " } " 43 | ] 44 | }, 45 | { 46 | "cell_type": "code", 47 | "execution_count": null, 48 | "metadata": {}, 49 | "outputs": [], 50 | "source": [ 51 | "import java.sql.DriverManager\n", 52 | "java.sql.DriverManager.getConnection(\"jdbc:sqlite:sample.db\")" 53 | ] 54 | }, 55 | { 56 | "cell_type": "code", 57 | "execution_count": null, 58 | "metadata": {}, 59 | "outputs": [], 60 | "source": [] 61 | } 62 | ], 63 | "metadata": { 64 | "kernelspec": { 65 | "display_name": "Scala", 66 | "language": "scala", 67 | "name": "scala" 68 | }, 69 | "language_info": { 70 | "codemirror_mode": "text/x-scala", 71 | "file_extension": ".scala", 72 | "mimetype": "", 73 | "name": "Scala", 74 | "nbconverter_exporter": "", 75 | "version": "2.11.12" 76 | }, 77 | "toc": { 78 | "base_numbering": 1, 79 | "nav_menu": {}, 80 | "number_sections": false, 81 | "sideBar": false, 82 | "skip_h1_title": false, 83 | "title_cell": "Table of Contents", 84 | "title_sidebar": "Contents", 85 | "toc_cell": false, 86 | "toc_position": {}, 87 | "toc_section_display": false, 88 | "toc_window_display": false 89 | } 90 | }, 91 | "nbformat": 4, 92 | "nbformat_minor": 2 93 | } 94 | -------------------------------------------------------------------------------- /test/ipynb/sql/SQLTest.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": null, 6 | "metadata": {}, 7 | "outputs": [], 8 | "source": [ 9 | "%defaultDatasource jdbc:h2:mem:db1\n", 10 | "%datasources chemistry=jdbc:h2:mem:chemistry" 11 | ] 12 | }, 13 | { 14 | "cell_type": "code", 15 | "execution_count": null, 16 | "metadata": {}, 17 | "outputs": [], 18 | "source": [ 19 | "drop table if exists color;\n", 20 | "CREATE TABLE color (\n", 21 | " id int(11) NOT NULL,\n", 22 | " name varchar(45) NOT NULL,\n", 23 | " code varchar(10),\n", 24 | " PRIMARY KEY (id)\n", 25 | ");\n", 26 | "\n", 27 | "INSERT INTO color (id, name, code) VALUES (1001,'AliceBlue','#F0F8FF');\n", 28 | "INSERT INTO color (id, name, code) VALUES (1002,'AntiqueWhite','#FAEBD7');\n", 29 | "INSERT INTO color (id, name, code) VALUES (1003,'Aqua','#00FFFF');\n", 30 | "INSERT INTO color (id, name, code) VALUES (1004,'Aquamarine','#7FFFD4');\n", 31 | "INSERT INTO color (id, name, code) VALUES (1005,'Azure','#F0FFFF');\n", 32 | "INSERT INTO color (id, name, code) VALUES (1006,'Beige','#F5F5DC');\n", 33 | "INSERT INTO color (id, name, code) VALUES (1007,'Bisque','#FFE4C4');\n", 34 | "INSERT INTO color (id, name, code) VALUES (1008,'Black','#000000');" 35 | ] 36 | }, 37 | { 38 | "cell_type": "code", 39 | "execution_count": null, 40 | "metadata": {}, 41 | "outputs": [], 42 | "source": [ 43 | "SELECT * FROM color WHERE name LIKE 'A%';" 44 | ] 45 | }, 46 | { 47 | "cell_type": "code", 48 | "execution_count": null, 49 | "metadata": {}, 50 | "outputs": [], 51 | "source": [ 52 | "%%python\n", 53 | "from beakerx import *\n", 54 | "pp = Plot(title=\"Title\", xLabel=\"Horizontal\", yLabel=\"Vertical\")\n", 55 | "pp.add(Line(displayName=\"Line\", x=[1, 4, 6, 8, 10],y=[3, 6, 4, 5, 9]))" 56 | ] 57 | }, 58 | { 59 | "cell_type": "code", 60 | "execution_count": null, 61 | "metadata": {}, 62 | "outputs": [], 63 | "source": [] 64 | }, 65 | { 66 | "cell_type": "markdown", 67 | "metadata": {}, 68 | "source": [ 69 | "press 'Shift' + 'Tab' for doc" 70 | ] 71 | }, 72 | { 73 | "cell_type": "code", 74 | "execution_count": null, 75 | "metadata": {}, 76 | "outputs": [], 77 | "source": [] 78 | }, 79 | { 80 | "cell_type": "code", 81 | "execution_count": null, 82 | "metadata": {}, 83 | "outputs": [], 84 | "source": [] 85 | } 86 | ], 87 | "metadata": { 88 | "kernelspec": { 89 | "display_name": "SQL", 90 | "language": "SQL", 91 | "name": "sql" 92 | }, 93 | "language_info": { 94 | "codemirror_mode": "sql", 95 | "file_extension": ".sql", 96 | "mimetype": "", 97 | "name": "SQL", 98 | "nbconverter_exporter": "", 99 | "version": "" 100 | } 101 | }, 102 | "nbformat": 4, 103 | "nbformat_minor": 2 104 | } 105 | --------------------------------------------------------------------------------