-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Naksha maintenance
- Loading branch information
Showing
4 changed files
with
219 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,154 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"source": [ | ||
"This is the initial draft of a Kotlin Notebook, basically the same as Jupyter notebooks, where code snippets can also be included in the markdown docs, and executed. This is more popular for workshops with smaller units of code needing execution, but theoretically there is a setting that allows new notebooks to import project dependencies, so doing something like ramping up Naksha locally should be achievable in a code block in notebooks. Furthermore the ability to render other formats like HTML webpage or LaTeX mathematical formulas directly inside one notebook file might be a good presentation for a product.\n", | ||
"\n", | ||
"Follow the guide at https://blog.jetbrains.com/kotlin/2023/07/introducing-kotlin-notebook/ to install the plugin for IntelliJ.\n", | ||
"\n", | ||
"Currently Jetbrains has [this notebook](https://datalore.jetbrains.com/report/static/sBgNeHxfaKG1tVRDWl3KqU/DMtWM05XWOT2Oi6yxZjVkJ) to showcase the capabilities of these Kotlin notebooks." | ||
], | ||
"metadata": { | ||
"collapsed": false | ||
} | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"source": [ | ||
"To setup a Naksha Hub server on your local machine, first define the main Postgres password:" | ||
], | ||
"metadata": { | ||
"collapsed": false | ||
} | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 3, | ||
"outputs": [], | ||
"source": [ | ||
"var password = \"postgres\"" | ||
], | ||
"metadata": { | ||
"collapsed": false, | ||
"ExecuteTime": { | ||
"end_time": "2023-07-28T12:10:48.605019065Z", | ||
"start_time": "2023-07-28T12:10:48.493613134Z" | ||
} | ||
} | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"source": [ | ||
"Then run the code block below to start the Hub:" | ||
], | ||
"metadata": { | ||
"collapsed": false | ||
} | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 4, | ||
"outputs": [ | ||
{ | ||
"name": "stderr", | ||
"output_type": "stream", | ||
"text": [ | ||
"java.lang.NoSuchMethodError: 'org.slf4j.spi.LoggingEventBuilder com.here.naksha.lib.core.NakshaLogger.atInfo()'\n", | ||
"com.here.naksha.lib.core.exceptions.UncheckedException: java.lang.NoSuchMethodError: 'org.slf4j.spi.LoggingEventBuilder com.here.naksha.lib.core.NakshaLogger.atInfo()'\n", | ||
"\tat com.here.naksha.lib.core.exceptions.UncheckedException.unchecked(UncheckedException.java:43)\n", | ||
"\tat com.here.naksha.lib.psql.PsqlStorage.init(PsqlStorage.java:195)\n", | ||
"\tat com.here.naksha.app.service.NakshaHub.<init>(NakshaHub.java:168)\n", | ||
"\tat com.here.naksha.app.service.NakshaHub.newHub(NakshaHub.java:130)\n", | ||
"\tat Line_3_jupyter.<init>(Line_3.jupyter.kts:4)\n", | ||
"\tat java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)\n", | ||
"\tat java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77)\n", | ||
"\tat java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)\n", | ||
"\tat java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499)\n", | ||
"\tat java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:480)\n", | ||
"\tat kotlin.script.experimental.jvm.BasicJvmScriptEvaluator.evalWithConfigAndOtherScriptsResults(BasicJvmScriptEvaluator.kt:105)\n", | ||
"\tat kotlin.script.experimental.jvm.BasicJvmScriptEvaluator.invoke$suspendImpl(BasicJvmScriptEvaluator.kt:47)\n", | ||
"\tat kotlin.script.experimental.jvm.BasicJvmScriptEvaluator.invoke(BasicJvmScriptEvaluator.kt)\n", | ||
"\tat kotlin.script.experimental.jvm.BasicJvmReplEvaluator.eval(BasicJvmReplEvaluator.kt:49)\n", | ||
"\tat org.jetbrains.kotlinx.jupyter.repl.impl.InternalEvaluatorImpl$eval$resultWithDiagnostics$1.invokeSuspend(InternalEvaluatorImpl.kt:103)\n", | ||
"\tat kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)\n", | ||
"\tat kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)\n", | ||
"\tat kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:284)\n", | ||
"\tat kotlinx.coroutines.BlockingCoroutine.joinBlocking(Builders.kt:85)\n", | ||
"\tat kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking(Builders.kt:59)\n", | ||
"\tat kotlinx.coroutines.BuildersKt.runBlocking(Unknown Source)\n", | ||
"\tat kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking$default(Builders.kt:38)\n", | ||
"\tat kotlinx.coroutines.BuildersKt.runBlocking$default(Unknown Source)\n", | ||
"\tat org.jetbrains.kotlinx.jupyter.repl.impl.InternalEvaluatorImpl.eval(InternalEvaluatorImpl.kt:103)\n", | ||
"\tat org.jetbrains.kotlinx.jupyter.repl.impl.CellExecutorImpl$execute$1$result$1.invoke(CellExecutorImpl.kt:75)\n", | ||
"\tat org.jetbrains.kotlinx.jupyter.repl.impl.CellExecutorImpl$execute$1$result$1.invoke(CellExecutorImpl.kt:73)\n", | ||
"\tat org.jetbrains.kotlinx.jupyter.ReplForJupyterImpl.withHost(repl.kt:666)\n", | ||
"\tat org.jetbrains.kotlinx.jupyter.repl.impl.CellExecutorImpl.execute(CellExecutorImpl.kt:73)\n", | ||
"\tat org.jetbrains.kotlinx.jupyter.repl.CellExecutor$DefaultImpls.execute$default(CellExecutor.kt:15)\n", | ||
"\tat org.jetbrains.kotlinx.jupyter.ReplForJupyterImpl$evalEx$1.invoke(repl.kt:479)\n", | ||
"\tat org.jetbrains.kotlinx.jupyter.ReplForJupyterImpl$evalEx$1.invoke(repl.kt:470)\n", | ||
"\tat org.jetbrains.kotlinx.jupyter.ReplForJupyterImpl.withEvalContext(repl.kt:433)\n", | ||
"\tat org.jetbrains.kotlinx.jupyter.ReplForJupyterImpl.evalEx(repl.kt:470)\n", | ||
"\tat org.jetbrains.kotlinx.jupyter.messaging.ProtocolKt$shellMessagesHandler$2$res$1.invoke(protocol.kt:318)\n", | ||
"\tat org.jetbrains.kotlinx.jupyter.messaging.ProtocolKt$shellMessagesHandler$2$res$1.invoke(protocol.kt:312)\n", | ||
"\tat org.jetbrains.kotlinx.jupyter.JupyterExecutorImpl$runExecution$execThread$1.invoke(execution.kt:37)\n", | ||
"\tat org.jetbrains.kotlinx.jupyter.JupyterExecutorImpl$runExecution$execThread$1.invoke(execution.kt:32)\n", | ||
"\tat kotlin.concurrent.ThreadsKt$thread$thread$1.run(Thread.kt:30)\n", | ||
"Caused by: java.lang.NoSuchMethodError: 'org.slf4j.spi.LoggingEventBuilder com.here.naksha.lib.core.NakshaLogger.atInfo()'\n", | ||
"\tat com.here.naksha.lib.core.NakshaLogger.atInfo(NakshaLogger.java:415)\n", | ||
"\tat com.here.naksha.lib.psql.PsqlStorage.init(PsqlStorage.java:173)\n", | ||
"\t... 36 more\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"import com.here.naksha.app.service.NakshaHub\n", | ||
"import java.util.concurrent.TimeUnit\n", | ||
"\n", | ||
"var hub: NakshaHub? = NakshaHub.newHub(\n", | ||
" \"jdbc:postgresql://localhost/postgres?user=postgres&password=$password\",\n", | ||
" \"local\"\n", | ||
")\n", | ||
"hub!!.start()\n", | ||
"hub!!.join(TimeUnit.SECONDS.toMillis(60))\n" | ||
], | ||
"metadata": { | ||
"collapsed": false, | ||
"ExecuteTime": { | ||
"end_time": "2023-07-28T12:12:46.202817846Z", | ||
"start_time": "2023-07-28T12:12:45.881557242Z" | ||
} | ||
} | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"outputs": [], | ||
"source": [], | ||
"metadata": { | ||
"collapsed": false | ||
} | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Kotlin", | ||
"language": "kotlin", | ||
"name": "kotlin" | ||
}, | ||
"language_info": { | ||
"name": "kotlin", | ||
"version": "1.8.20", | ||
"mimetype": "text/x-kotlin", | ||
"file_extension": ".kt", | ||
"pygments_lexer": "kotlin", | ||
"codemirror_mode": "text/x-kotlin", | ||
"nbconvert_exporter": "" | ||
}, | ||
"ktnbPluginMetadata": { | ||
"isBuildProject": true | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 0 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters