Skip to content

Commit

Permalink
start documenting autotranslation
Browse files Browse the repository at this point in the history
  • Loading branch information
scottdraves committed Jun 26, 2018
1 parent 1ecc938 commit 848f1b4
Show file tree
Hide file tree
Showing 3 changed files with 141 additions and 3 deletions.
3 changes: 2 additions & 1 deletion StartHere.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
"[Properties, Heap Size, and other JVM Options](doc/groovy/JavaArgs.ipynb), [UI Options](doc/groovy/UIOptions.ipynb).\n",
"\n",
"## Autotranslation\n",
"[Python](doc/python/AutoTranslation.ipynb), [Groovy](doc/groovy/AutoTranslation.ipynb).\n",
"[Python to JS and D3](doc/python/AutoTranslation.ipynb), [Groovy to JS and D3](doc/groovy/AutoTranslation.ipynb),\n",
"[General Autotranslation](doc/groovy/GeneralAutotranslation.ipynb).\n",
"\n",
"## Groovy Plotting and Charting\n",
"[Example and Interaction](doc/groovy/Charting.ipynb), [Time Series and General APIs and Features](doc/groovy/PlotFeatures.ipynb), [Category Plots and Bar Charts](doc/groovy/CategoryPlot.ipynb), [Levels of Detail](doc/groovy/LevelsOfDetails.ipynb), [Histograms](doc/groovy/Histogram.ipynb), [Heatmaps](doc/groovy/Heatmap.ipynb), [Treemaps](doc/groovy/Treemap.ipynb), [Plot Actions](doc/groovy/PlotActions.ipynb), [Plot Seamless Updates](doc/groovy/PlotsPythonStyle.ipynb), [3D Visualization and Maps](doc/groovy/3D.ipynb).\n",
Expand Down
125 changes: 125 additions & 0 deletions doc/groovy/GeneralAutotranslation.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# General Autotranslation\n",
"\n",
"The `beakerx` object synchronizes values between languages, including JavaScript, Python, Groovy, and the other JVM languages. BeakerX's current implementation works with metaprogramming and serializing the objects to JSON, so it's not recommended for more than a few MB of data. Using [Arrow](https://arrow.apache.org/) and shared memory to remove that limitation is on the [agenda](https://github.com/twosigma/beakerx/issues/7577).\n",
"\n",
"Start in Groovy:"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"beakerx.foo = \"a groovy value\""
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Translate to JavaScript:"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"%%javascript\n",
"alert(beakerx.foo);\n",
"beakerx.bar = [23, 48, 7, \"from JS\"];"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"And back to Groovy:"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"beakerx.bar "
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Or Python:"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"%%python\n",
"beakerx.bar"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Or Scala:"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"%%scala\n",
"beakerx.bar"
]
}
],
"metadata": {
"beakerx_kernel_parameters": {},
"classpath": [],
"imports": [],
"kernelspec": {
"display_name": "Groovy",
"language": "groovy",
"name": "groovy"
},
"language_info": {
"codemirror_mode": "groovy",
"file_extension": ".groovy",
"mimetype": "",
"name": "Groovy",
"nbconverter_exporter": "",
"version": "2.4.3"
},
"toc": {
"base_numbering": 1,
"nav_menu": {},
"number_sections": false,
"sideBar": false,
"skip_h1_title": false,
"title_cell": "Table of Contents",
"title_sidebar": "Contents",
"toc_cell": false,
"toc_position": {},
"toc_section_display": false,
"toc_window_display": false
}
},
"nbformat": 4,
"nbformat_minor": 1
}
16 changes: 14 additions & 2 deletions doc/groovy/PolyglotMagic.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
"\n",
"There are also [Groovy Magics](../python/KernelMagics.ipynb) magics for accessing the JVM from Python.\n",
"\n",
"Fleshing out the polyglot support in BeakerX with communication between languages ([#5039](https://github.com/twosigma/beakerx/issues/5039)) is on the agenda.\n",
"\n",
"You can communicate between languages with [Autotranslation](GeneralAutotranslation.ipynb).\n",
"\n",
"\n",
"\n",
Expand Down Expand Up @@ -123,6 +122,19 @@
"name": "Groovy",
"nbconverter_exporter": "",
"version": "2.4.3"
},
"toc": {
"base_numbering": 1,
"nav_menu": {},
"number_sections": false,
"sideBar": false,
"skip_h1_title": false,
"title_cell": "Table of Contents",
"title_sidebar": "Contents",
"toc_cell": false,
"toc_position": {},
"toc_section_display": false,
"toc_window_display": false
}
},
"nbformat": 4,
Expand Down

0 comments on commit 848f1b4

Please sign in to comment.