Permalink
Browse files

Updating readme to point to Bridgewater user

  • Loading branch information...
KenCoder committed Mar 13, 2013
1 parent 7087dfa commit 4d1dd4f90e88f2fdf4091632f8209c7a789c23cc
Showing with 1 addition and 17,269 deletions.
  1. +0 −21 LICENSE
  2. +0 −85 LICENSE.ipython
  3. +1 −94 README.md
  4. +0 −17 client/build.sbt
  5. +0 −12 client/src/main/resources/application.conf
  6. +0 −46 client/src/main/scala/NotebookClient.scala
  7. +0 −66 client/src/main/scala/NotebookKernel.scala
  8. +0 −91 pinhole.py
  9. +0 −37 project/build.scala
  10. +0 −22 server/build.sbt
  11. BIN server/lib/akka-actor-2.0.2.jar
  12. BIN server/lib/akka-remote-2.0.2.jar
  13. +0 −17 server/src/main/resources/application.conf
  14. +0 −24 server/src/main/resources/avsl.conf
  15. +0 −305 server/src/main/resources/from_ipython/static/IPy_Notebook_logo.svg
  16. +0 −23 server/src/main/resources/from_ipython/static/codemirror/LICENSE
  17. +0 −33 server/src/main/resources/from_ipython/static/codemirror/README-IPython.rst
  18. +0 −6 server/src/main/resources/from_ipython/static/codemirror/README.md
  19. +0 −107 server/src/main/resources/from_ipython/static/codemirror/lib/codemirror.css
  20. +0 −2,817 server/src/main/resources/from_ipython/static/codemirror/lib/codemirror.js
  21. +0 −23 server/src/main/resources/from_ipython/static/codemirror/lib/util/dialog.css
  22. +0 −63 server/src/main/resources/from_ipython/static/codemirror/lib/util/dialog.js
  23. +0 −173 server/src/main/resources/from_ipython/static/codemirror/lib/util/foldcode.js
  24. +0 −291 server/src/main/resources/from_ipython/static/codemirror/lib/util/formatting.js
  25. +0 −83 server/src/main/resources/from_ipython/static/codemirror/lib/util/javascript-hint.js
  26. +0 −51 server/src/main/resources/from_ipython/static/codemirror/lib/util/overlay.js
  27. +0 −27 server/src/main/resources/from_ipython/static/codemirror/lib/util/runmode.js
  28. +0 −114 server/src/main/resources/from_ipython/static/codemirror/lib/util/search.js
  29. +0 −117 server/src/main/resources/from_ipython/static/codemirror/lib/util/searchcursor.js
  30. +0 −16 server/src/main/resources/from_ipython/static/codemirror/lib/util/simple-hint.css
  31. +0 −66 server/src/main/resources/from_ipython/static/codemirror/lib/util/simple-hint.js
  32. +0 −124 server/src/main/resources/from_ipython/static/codemirror/mode/css/css.js
  33. +0 −55 server/src/main/resources/from_ipython/static/codemirror/mode/css/index.html
  34. +0 −83 server/src/main/resources/from_ipython/static/codemirror/mode/htmlmixed/htmlmixed.js
  35. +0 −51 server/src/main/resources/from_ipython/static/codemirror/mode/htmlmixed/index.html
  36. +0 −77 server/src/main/resources/from_ipython/static/codemirror/mode/javascript/index.html
  37. +0 −360 server/src/main/resources/from_ipython/static/codemirror/mode/javascript/javascript.js
  38. +0 −339 server/src/main/resources/from_ipython/static/codemirror/mode/markdown/index.html
  39. +0 −246 server/src/main/resources/from_ipython/static/codemirror/mode/markdown/markdown.js
  40. +0 −21 server/src/main/resources/from_ipython/static/codemirror/mode/python/LICENSE.txt
  41. +0 −122 server/src/main/resources/from_ipython/static/codemirror/mode/python/index.html
  42. +0 −340 server/src/main/resources/from_ipython/static/codemirror/mode/python/python.js
  43. +0 −525 server/src/main/resources/from_ipython/static/codemirror/mode/rst/index.html
  44. +0 −326 server/src/main/resources/from_ipython/static/codemirror/mode/rst/rst.js
  45. +0 −44 server/src/main/resources/from_ipython/static/codemirror/mode/xml/index.html
  46. +0 −260 server/src/main/resources/from_ipython/static/codemirror/mode/xml/xml.js
  47. +0 −18 server/src/main/resources/from_ipython/static/codemirror/theme/cobalt.css
  48. +0 −25 server/src/main/resources/from_ipython/static/codemirror/theme/eclipse.css
  49. +0 −10 server/src/main/resources/from_ipython/static/codemirror/theme/elegant.css
  50. +0 −40 server/src/main/resources/from_ipython/static/codemirror/theme/ipython.css
  51. +0 −28 server/src/main/resources/from_ipython/static/codemirror/theme/monokai.css
  52. +0 −9 server/src/main/resources/from_ipython/static/codemirror/theme/neat.css
  53. +0 −21 server/src/main/resources/from_ipython/static/codemirror/theme/night.css
  54. +0 −21 server/src/main/resources/from_ipython/static/codemirror/theme/rubyblue.css
  55. +0 −73 server/src/main/resources/from_ipython/static/css/boilerplate.css
  56. +0 −97 server/src/main/resources/from_ipython/static/css/fbm.css
  57. +0 −6 server/src/main/resources/from_ipython/static/css/login.css
  58. +0 −7 server/src/main/resources/from_ipython/static/css/logout.css
  59. +0 −372 server/src/main/resources/from_ipython/static/css/notebook.css
  60. +0 −77 server/src/main/resources/from_ipython/static/css/page.css
  61. +0 −5 server/src/main/resources/from_ipython/static/css/printnotebook.css
  62. +0 −84 server/src/main/resources/from_ipython/static/css/projectdashboard.css
  63. +0 −63 server/src/main/resources/from_ipython/static/css/renderedhtml.css
  64. +0 −125 server/src/main/resources/from_ipython/static/dateformat/date.format.js
  65. BIN server/src/main/resources/from_ipython/static/favicon.ico
  66. BIN server/src/main/resources/from_ipython/static/ipynblogo.png
  67. BIN ...c/main/resources/from_ipython/static/jquery/css/themes/base/images/ui-bg_flat_0_aaaaaa_40x100.png
  68. BIN .../main/resources/from_ipython/static/jquery/css/themes/base/images/ui-bg_flat_75_ffffff_40x100.png
  69. BIN .../main/resources/from_ipython/static/jquery/css/themes/base/images/ui-bg_glass_55_fbf9ee_1x400.png
  70. BIN .../main/resources/from_ipython/static/jquery/css/themes/base/images/ui-bg_glass_65_ffffff_1x400.png
  71. BIN .../main/resources/from_ipython/static/jquery/css/themes/base/images/ui-bg_glass_75_dadada_1x400.png
  72. BIN .../main/resources/from_ipython/static/jquery/css/themes/base/images/ui-bg_glass_75_e6e6e6_1x400.png
  73. BIN .../main/resources/from_ipython/static/jquery/css/themes/base/images/ui-bg_glass_95_fef1ec_1x400.png
  74. BIN ...ources/from_ipython/static/jquery/css/themes/base/images/ui-bg_highlight-soft_75_cccccc_1x100.png
  75. BIN .../src/main/resources/from_ipython/static/jquery/css/themes/base/images/ui-icons_222222_256x240.png
  76. BIN .../src/main/resources/from_ipython/static/jquery/css/themes/base/images/ui-icons_2e83ff_256x240.png
  77. BIN .../src/main/resources/from_ipython/static/jquery/css/themes/base/images/ui-icons_454545_256x240.png
  78. BIN .../src/main/resources/from_ipython/static/jquery/css/themes/base/images/ui-icons_888888_256x240.png
  79. BIN .../src/main/resources/from_ipython/static/jquery/css/themes/base/images/ui-icons_cd0a0a_256x240.png
  80. +0 −1 server/src/main/resources/from_ipython/static/jquery/css/themes/base/jquery-ui.min.css
  81. +0 −4 server/src/main/resources/from_ipython/static/jquery/js/jquery-1.7.1.min.js
  82. +0 −16 server/src/main/resources/from_ipython/static/jquery/js/jquery-ui.min.js
  83. +0 −42 server/src/main/resources/from_ipython/static/jquery/js/jquery.autogrow.js
  84. +0 −160 server/src/main/resources/from_ipython/static/js/cell.js
  85. +0 −180 server/src/main/resources/from_ipython/static/js/clusterlist.js
  86. +0 −927 server/src/main/resources/from_ipython/static/js/codecell.js
  87. +0 −31 server/src/main/resources/from_ipython/static/js/events.js
  88. +0 −83 server/src/main/resources/from_ipython/static/js/initmathjax.js
  89. +0 −237 server/src/main/resources/from_ipython/static/js/kernel.js
  90. +0 −59 server/src/main/resources/from_ipython/static/js/layoutmanager.js
  91. +0 −22 server/src/main/resources/from_ipython/static/js/loginmain.js
  92. +0 −44 server/src/main/resources/from_ipython/static/js/loginwidget.js
  93. +0 −20 server/src/main/resources/from_ipython/static/js/logoutmain.js
  94. +0 −178 server/src/main/resources/from_ipython/static/js/menubar.js
  95. +0 −30 server/src/main/resources/from_ipython/static/js/namespace.js
  96. +0 −1,351 server/src/main/resources/from_ipython/static/js/notebook.js
  97. +0 −267 server/src/main/resources/from_ipython/static/js/notebooklist.js
  98. +0 −56 server/src/main/resources/from_ipython/static/js/notebookmain.js
  99. +0 −102 server/src/main/resources/from_ipython/static/js/notificationwidget.js
  100. +0 −59 server/src/main/resources/from_ipython/static/js/page.js
  101. +0 −19 server/src/main/resources/from_ipython/static/js/pagemain.js
  102. +0 −102 server/src/main/resources/from_ipython/static/js/pager.js
  103. +0 −30 server/src/main/resources/from_ipython/static/js/printnotebookmain.js
  104. +0 −39 server/src/main/resources/from_ipython/static/js/projectdashboardmain.js
  105. +0 −70 server/src/main/resources/from_ipython/static/js/quickhelp.js
  106. +0 −139 server/src/main/resources/from_ipython/static/js/savewidget.js
  107. +0 −363 server/src/main/resources/from_ipython/static/js/textcell.js
  108. +0 −152 server/src/main/resources/from_ipython/static/js/toolbar.js
  109. +0 −102 server/src/main/resources/from_ipython/static/js/utils.js
  110. +0 −32 server/src/main/resources/from_ipython/static/pagedown/LICENSE.txt
  111. +0 −1,318 server/src/main/resources/from_ipython/static/pagedown/Markdown.Converter.js
  112. +0 −202 server/src/main/resources/from_ipython/static/prettify/COPYING
  113. +0 −48 server/src/main/resources/from_ipython/static/prettify/prettify.css
  114. +0 −28 server/src/main/resources/from_ipython/static/prettify/prettify.js
  115. +0 −14 server/src/main/resources/from_ipython/static/unminified/README
  116. +0 −42 server/src/main/resources/from_ipython/templates/login.html
  117. +0 −40 server/src/main/resources/from_ipython/templates/logout.html
  118. +0 −233 server/src/main/resources/from_ipython/templates/notebook.html
  119. +0 −58 server/src/main/resources/from_ipython/templates/page.html
  120. +0 −80 server/src/main/resources/from_ipython/templates/printnotebook.html
  121. +0 −77 server/src/main/resources/from_ipython/templates/projectdashboard.html
  122. +0 −55 server/src/main/resources/templates/default.ssp
  123. +0 −237 server/src/main/resources/templates/notebook.ssp
  124. +0 −21 server/src/main/resources/templates/palindrome.mustache
  125. +0 −78 server/src/main/resources/templates/projectdashboard.ssp
  126. +0 −13 server/src/main/resources/www/css/app.css
  127. +0 −168 server/src/main/scala/App.scala
  128. +0 −41 server/src/main/scala/KernelManager.scala
  129. +0 −33 server/src/main/scala/LayoutTools.scala
  130. +0 −123 server/src/main/scala/NBSerializer.scala
  131. +0 −87 server/src/main/scala/NotebookManager.scala
  132. +0 −41 server/src/main/scala/ReqLogger.scala
  133. +0 −72 server/src/main/scala/Scalate.scala
  134. +0 −61 server/src/main/scala/Server.scala
  135. +0 −89 server/src/main/scala/Session.scala
  136. +0 −54 server/src/main/scala/WebSockWrapper.scala
  137. +0 −53 server/src/test/scala/NBSerializerTests.scala
  138. +0 −85 testws.html
View
21 LICENSE
@@ -1,21 +0,0 @@
-Copyright (c) 2012 Kenneth Vogel
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
View
@@ -1,85 +0,0 @@
-=============================
- The IPython licensing terms
-=============================
-
-IPython is licensed under the terms of the Modified BSD License (also known as
-New or Revised BSD), as follows:
-
-Copyright (c) 2008-2010, IPython Development Team
-Copyright (c) 2001-2007, Fernando Perez. <fernando.perez@colorado.edu>
-Copyright (c) 2001, Janko Hauser <jhauser@zscout.de>
-Copyright (c) 2001, Nathaniel Gray <n8gray@caltech.edu>
-
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
-Redistributions of source code must retain the above copyright notice, this
-list of conditions and the following disclaimer.
-
-Redistributions in binary form must reproduce the above copyright notice, this
-list of conditions and the following disclaimer in the documentation and/or
-other materials provided with the distribution.
-
-Neither the name of the IPython Development Team nor the names of its
-contributors may be used to endorse or promote products derived from this
-software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
-FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-About the IPython Development Team
-----------------------------------
-
-Fernando Perez began IPython in 2001 based on code from Janko Hauser
-<jhauser@zscout.de> and Nathaniel Gray <n8gray@caltech.edu>. Fernando is still
-the project lead.
-
-The IPython Development Team is the set of all contributors to the IPython
-project. This includes all of the IPython subprojects. A full list with
-details is kept in the documentation directory, in the file
-``about/credits.txt``.
-
-The core team that coordinates development on GitHub can be found here:
-http://github.com/ipython. As of late 2010, it consists of:
-
-* Brian E. Granger
-* Jonathan March
-* Evan Patterson
-* Fernando Perez
-* Min Ragan-Kelley
-* Robert Kern
-
-
-Our Copyright Policy
---------------------
-
-IPython uses a shared copyright model. Each contributor maintains copyright
-over their contributions to IPython. But, it is important to note that these
-contributions are typically only changes to the repositories. Thus, the IPython
-source code, in its entirety is not the copyright of any single person or
-institution. Instead, it is the collective copyright of the entire IPython
-Development Team. If individual contributors want to maintain a record of what
-changes/contributions they have specific copyright on, they should indicate
-their copyright in the commit message of the change, when they commit the
-change to one of the IPython repositories.
-
-With this in mind, the following banner should be used in any source code file
-to indicate the copyright and license terms:
-
-#-----------------------------------------------------------------------------
-# Copyright (c) 2010, IPython Development Team.
-#
-# Distributed under the terms of the Modified BSD License.
-#
-# The full license is in the file COPYING.txt, distributed with this software.
-#-----------------------------------------------------------------------------
View
@@ -1,98 +1,5 @@
scala-notebook
==============
-If you are looking here because you saw my talk proposal at nescala,
-know that I am working to publish the actual, working Scala Notebook
-from inside my company, where we've been developing it for the last
-six months. Star the project for updates!
+Scala notebook is hosted at https://github.com/Bridgewater/scala-notebook
-
-
-A more friendly, browser-based interactive Scala prompt (REPL).
-
-Based on the IPython notebook project, this project will let you interact with Scala in a browser window,
-which has the following advantages over the standard REPL:
-
-* Easy to view and edit past commands
-* Commands can return HTML or images, allowing richer interactivity (charts, for example)
-* Notebooks can be saved and loaded, providing a bridge between interactive REPL and classes in a project
-* Supports mixing Scala expressions and markdown, letting you create rich, interactive documents similar to Mathematica
-
-While I think this tool will be helpful for everyone using Scala, I expect it to be particularly valuable for the
-scientific and analytics community.
-
-Technically, my vision is as follows:
-
-First, leverage the work of the IPython project by pretty much using their front-end as-is, at least as a starting point.
-If you're going to work on this, you should clone IPython as a reference. This worked for me in Windows:
-* Install Python and setuptools
-
-* Install the ipython runtime (to easily get the dependencies)
- easy_install ipython
- easy_install ipython[zmq]
- easy_install tornado
-
-Now, you can run "python ipython.py notebook" from the ipython git folder.
-
-This project is based on the IPython master branch as of around May 2012, which has a very different look from the released version at that time.
-
-A little about how IPython works:
-
-* Uses tornado templates to serve up the content. I chose Scalata/ssp as this is most similar to tornado
-* Uses JQuery and JSon for things like loading & saving notebooks
-* Uses Websockets for two-way asynchronous communication with the python kernel; which is essentially a running JVM.
-
-Having the web server process separate from the process doing the evaluation is also important in Scala; we want to separate
-the user's actions from the web server, allowing a restart of the client process.
-
-To that end, the project is organized as follows:
-* *server* is the web server
-* *client* is the shim for the client process (linked into whatever client classes are available to the user)
-* *common* are the classes shared by both
-
-
-Okay, You're Going To Need Some Stuff
--------------------------------
-
-* Checkout this project
-* You're going to need sbt. These instructions are for Mac because I'm on a Mac.
- * Install homebrew (its website is prettier than macports)
-
- https://github.com/mxcl/homebrew/wiki/installation
-
- * Install sbt. At Terminal, type:
-
- `brew install sbt`
-
- * You'll need the gen-idea plugin for SBT. It creates IntelliJ project files that go along with the SBT project automatically.
-
- * Create the file: `~/.sbt/plugins/build.sbt`
- * Add this line into it:
-
- `addSbtPlugin("com.github.mpeltonen" % "sbt-idea" % "1.0.0")`
-
- * Go to the root of where you checked it out and type:
-
- `sbt gen-idea`
- * Now you can open the project in IntelliJ
-
-To run this bad boy:
-
-1. Go to root folder
-2. Fire up sbt
- `sbt`
-3. Once sbt sarts:
-
- `> projects`
-
- will list all the projects (you should see client, server, etc.)
-4. Start the server. Select the server project:
-
- `> project server`
-
- and run:
-
- `> run`
-
- The notebook management page should pop up. You can create a new notebook and start playing!
-
View
@@ -1,17 +0,0 @@
-organization := "com.k2sw"
-
-name := "client"
-
-version := "0.1.0-SNAPSHOT"
-
-libraryDependencies ++= Seq(
- "net.liftweb" %% "lift-json" % "2.4",
- "net.databinder" %% "unfiltered-json" % "0.6.2",
- "commons-io" % "commons-io" % "1.3.2",
- "org.scalatest" %% "scalatest" % "1.8" % "test"
-)
-
-resolvers ++= Seq(
- "java m2" at "http://download.java.net/maven/2"
-)
-
@@ -1,12 +0,0 @@
-akka {
- actor {
- provider = "akka.remote.RemoteActorRefProvider"
- }
- remote {
- transport = "akka.remote.netty.NettyRemoteTransport"
- netty {
- hostname = "127.0.0.1"
- port = 12400
- }
- }
-}
@@ -1,46 +0,0 @@
-/*
-Copyright (c) 2012 Kenneth Vogel
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-package com.k2sw.scalanb
-package client
-
-import akka.actor.{Actor, Props, ActorSystem}
-
-
-/**
- * Author: Ken
- */
-
-object NotebookClient {
- lazy val system = ActorSystem("ScalaNotebookClient")
- def main(args: Array[String]) {
- system.actorOf(Props[NotebookClient], name = "primer")
- println("Client is running - press Enter to quit")
- Console.readLine()
- system.shutdown()
- }
-}
-
-class NotebookClient extends Actor {
- def receive = {
- case _ => println("received")
- }
-}
@@ -1,66 +0,0 @@
-/*
-Copyright (c) 2012 Kenneth Vogel
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-package com.k2sw.scalanb.client
-
-import akka.actor.Actor
-import tools.nsc.Settings
-import tools.nsc.interpreter.IMain
-import java.io.{PrintWriter, ByteArrayOutputStream}
-import tools.nsc.interpreter.Results.Success
-
-/**
- * Author: Ken
- */
-
-
-case class ExecuteRequest(code: String)
-
-case class ExecuteResponse(stdout: String)
-
-case class ErrorResponse(message: String)
-
-case object InterruptRequest
-
-
-class NotebookKernel extends Actor {
- lazy val stdoutBytes = new ByteArrayOutputStream()
- lazy val stdout = new PrintWriter(stdoutBytes)
-
- lazy val interp = {
- val settings = new Settings
- settings.embeddedDefaults[NotebookKernel]
- val i = new IMain(settings, stdout)
- i.initializeSynchronous()
- i
- }
- def receive = {
- case ExecuteRequest(code) =>
- stdout.flush()
- stdoutBytes.reset()
- val res = interp.interpret(code)
- stdout.flush()
- if (res == Success)
- sender ! ExecuteResponse(stdoutBytes.toString)
- else
- sender ! ErrorResponse(stdoutBytes.toString)
- }
-}
Oops, something went wrong.

0 comments on commit 4d1dd4f

Please sign in to comment.