From dc3337d77386d28de1af1272c73891b3df788c8a Mon Sep 17 00:00:00 2001 From: mmaul Date: Fri, 20 Nov 2015 22:20:33 -0500 Subject: [PATCH 01/10] set *where-to-store-js-module-files* to system relative path --- ps-modules.lisp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ps-modules.lisp b/ps-modules.lisp index 2d409ae..8ef29be 100644 --- a/ps-modules.lisp +++ b/ps-modules.lisp @@ -183,7 +183,7 @@ ;;;; -(defparameter *where-to-store-js-module-files* "/Users/bhyde/w/plot-window/static/") +(defparameter *where-to-store-js-module-files* (namestring (asdf:system-relative-pathname 'plot-window "static/"))) (defgeneric update-js-module-file-if-necessary (m) (:documentation "Compile time hook which provides an oportunity to regenerate the javascript file.")) From 5cd8a20f8ed75a8b915624673a6e6fe2d3e23d2a Mon Sep 17 00:00:00 2001 From: mmaul Date: Fri, 20 Nov 2015 22:33:39 -0500 Subject: [PATCH 02/10] Moving initialize-application back into pw --- main.lisp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.lisp b/main.lisp index 51aa36e..6d0f9c5 100644 --- a/main.lisp +++ b/main.lisp @@ -2,7 +2,7 @@ ;;;; Starting our Servers -(defun cl-user::initialize-application (&key (port 8765)) +(defun initialize-application (&key (port 8765)) (start-web-server :port port) (start-clws-server) (start-and-register-json-rpc-resource)) From 15642579144a1e6b4ce9ff6ee3a65710704e4cf5 Mon Sep 17 00:00:00 2001 From: mmaul Date: Fri, 20 Nov 2015 22:37:11 -0500 Subject: [PATCH 03/10] Addint :initalize-application to pw exports --- packages.lisp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages.lisp b/packages.lisp index f7b666f..c3c8fd8 100644 --- a/packages.lisp +++ b/packages.lisp @@ -15,7 +15,7 @@ #:make-css-var #:pt #:px) (:nicknames "PW") (:export - ;; also cl-user:initalize-application + #:initialize-application #:plot)) (unless (named-readtables:find-readtable :cl-interpol) From 6a531215707cca703d39dd23fb368b4f2465741e Mon Sep 17 00:00:00 2001 From: mmaul Date: Fri, 20 Nov 2015 22:44:43 -0500 Subject: [PATCH 04/10] et values for defvars --- servers.lisp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/servers.lisp b/servers.lisp index dc365f8..ed78390 100644 --- a/servers.lisp +++ b/servers.lisp @@ -81,8 +81,8 @@ ;;;; JSON messaging over that web socket. -(defvar *current-websocket-client*) -(defvar *last-websocket-client*) +(defvar *current-websocket-client* nil) +(defvar *last-websocket-client* nil) (defvar *json-rcp-handlers* (make-hash-table :test #'equalp)) (defmacro define-json-message-handler (name (&rest parameters) &body body) From ac8a27c05595361059cad992f0776ca94864c9d6 Mon Sep 17 00:00:00 2001 From: mmaul Date: Fri, 20 Nov 2015 22:49:42 -0500 Subject: [PATCH 05/10] Updated README --- README.md | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 6e19d7a..836a628 100644 --- a/README.md +++ b/README.md @@ -11,19 +11,21 @@ then having assured that ASDF can find it (say by resetting ASDF's source respos (asdf:clear-source-registry)), and then load and run the application as so: ```common-lisp > (ql:quickload "plot-window") -> (cl-user:initialize-application) +> (in-package :pw) +> (pw:initialize-application) ``` Second: Visit http://localhost:8765/ in a quality web browser. I've only tried chrome. The resulting page becomes your REPL's display window. -Third: Load up an example, in this case a plot widget: `(ql:quickload "plot-window-flot")` - +Third: Load up an example, in this case a plot widget: ```common-lisp -> (pw:plot (loop for i below 50 collect (list i (random 20)))) +> (ql:quickload "plot-window-flot")` +> (flot-example-1) +> (plot (loop for i below 50 collect (list i (random 20)))) ``` -You can clear the window with `(ps:clear-display-window)`, and you can add single elements to the page using `(ps:add-element "

Hi there

")` +You can clear the window with `(clear-display-window)`, and you can add single elements to the page using `(pw:add-element "

Hi there

")` A number of examples are in the example's subdirectory. Each of these has it's on asd. You may load them all via `(ql:quickload "plot-window-examples")`. And once they are all loaded you can run a little demo: `(ql:demo t)` @@ -31,7 +33,7 @@ Magic ----- The chart is drawn by [flot](http://www.flotcharts.org/), a javascript -library. The page is rendered via Hunchentoot. The dynamic updating +library. The page is rendered via -Hunchentoot. The dynamic updating is done via websockets (with the help of [clws](http://www.cliki.net/clws)). A tangle of javascript glues it all together, and that's implemented using parenscript. Various From 2352f742c38d8e9fbca58ec831e2f85f29633187 Mon Sep 17 00:00:00 2001 From: mmaul Date: Sat, 21 Nov 2015 00:38:00 -0500 Subject: [PATCH 06/10] changed call to interpol-reader to pass recursive-p nil to patched cl-interpol --- ps-utilities.lisp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ps-utilities.lisp b/ps-utilities.lisp index 84702cb..a755bba 100644 --- a/ps-utilities.lisp +++ b/ps-utilities.lisp @@ -83,7 +83,7 @@ body after the given number of milliseconds." "Avoid the need to use a unique read table." (assert (stringp str)) (with-input-from-string (s str) - (cl-interpol::interpol-reader s #\? nil))) + (cl-interpol:interpol-reader s #\? nil :recursive-p nil))) (defmacro interpolate (str) (interp% str)) From e4fb3b57a2dafb2895850d8025273e65daa5c501 Mon Sep 17 00:00:00 2001 From: Mike Maul Date: Sat, 21 Nov 2015 22:43:39 -0500 Subject: [PATCH 07/10] Updated readme --- README.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 836a628..00ef921 100644 --- a/README.md +++ b/README.md @@ -7,8 +7,11 @@ lots of other things are possible; including maps, rich text editors, syntax highlighting, etc. etc. First: clone this repository (to ~/.quicklisp/local-projects for example), -then having assured that ASDF can find it (say by resetting ASDF's source respository -(asdf:clear-source-registry)), and then load and run the application as so: +then having assured that ASDF can find it (say by resetting ASDF's source respository `(asdf:clear-source-registry)`) + +This plot-window requires a patched version of cl-interpol (until changes are merged in cl-interpol). The patched cl-interpol can be found at https://github.com/mmaul/cl-interpol.git. + +The plot-window can be loaded and ran as so: ```common-lisp > (ql:quickload "plot-window") > (in-package :pw) From 378012dc47eaf916729a3c950db42844a240fc71 Mon Sep 17 00:00:00 2001 From: Mike Maul Date: Sat, 21 Nov 2015 23:26:38 -0500 Subject: [PATCH 08/10] Added instructions for obtaining modified cl-interpol --- README.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 00ef921..67ebf69 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,12 @@ syntax highlighting, etc. etc. First: clone this repository (to ~/.quicklisp/local-projects for example), then having assured that ASDF can find it (say by resetting ASDF's source respository `(asdf:clear-source-registry)`) -This plot-window requires a patched version of cl-interpol (until changes are merged in cl-interpol). The patched cl-interpol can be found at https://github.com/mmaul/cl-interpol.git. +This plot-window requires a modified version of cl-interpol (until changes are merged in cl-interpol). The patched cl-interpol can be found at https://github.com/mmaul/cl-interpol.git and the modified version can be found on the `use-interpol-reader-outside-of-reader` branch. +``` +git clone https://github.com/mmaul/cl-interpol.git +cd cl-interpol +git checkout use-interpol-reader-outside-of-reader +``` The plot-window can be loaded and ran as so: ```common-lisp From aa0ab31dc30fe0ddcf254a85e20f20340fd1c4cb Mon Sep 17 00:00:00 2001 From: Mike Maul Date: Sun, 22 Nov 2015 00:06:51 -0500 Subject: [PATCH 09/10] Tweaked README --- README.md | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 67ebf69..6d873a6 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,19 @@ -Need to plot some data from Common Lisp? This will solve your problem -by making a pretty plot in your web browser, effectively using that -browser as a display for your chart. It uses a cute Javascript -plotting widget known as flot. But it can do much more; you can push -arbitrary content to a webpage, and by using other Javascript widgets -lots of other things are possible; including maps, rich text editors, -syntax highlighting, etc. etc. +`plot-window` provides Javascript code and content push capability to a web browser using websockets. `plot-window` goes a step further by providing tooling for using and interacting with Javascript and Javascript libraries. Javscript interaction is done usin parenscript providing a holistic interaction between Lisp and the browser. + + Examples have been provided for working with the following libraries: + * flot - Plotting + * d3js - Plotting + * mapstraction - Openstreet Maps Mapping + * nice-edit - Rich text editor + * syntax-highlighter - Syntax highlighting + +Getting Started +--------------- First: clone this repository (to ~/.quicklisp/local-projects for example), then having assured that ASDF can find it (say by resetting ASDF's source respository `(asdf:clear-source-registry)`) -This plot-window requires a modified version of cl-interpol (until changes are merged in cl-interpol). The patched cl-interpol can be found at https://github.com/mmaul/cl-interpol.git and the modified version can be found on the `use-interpol-reader-outside-of-reader` branch. +`plot-window` requires a modified version of cl-interpol (until changes are merged in cl-interpol). The patched cl-interpol can be found at https://github.com/mmaul/cl-interpol.git and the modified version can be found on the `use-interpol-reader-outside-of-reader` branch. ``` git clone https://github.com/mmaul/cl-interpol.git cd cl-interpol @@ -37,6 +41,8 @@ You can clear the window with `(clear-display-window)`, and you can add single e A number of examples are in the example's subdirectory. Each of these has it's on asd. You may load them all via `(ql:quickload "plot-window-examples")`. And once they are all loaded you can run a little demo: `(ql:demo t)` +Generated Javascript modules are stored in the static directory this location set with the parameter `*where-to-store-js-module-files*`. It is set by default to the ASDF system relative path of `plot-window`. + Magic ----- From 0cfd1c2d50b505259c547f3683fa61e589f06bd1 Mon Sep 17 00:00:00 2001 From: mmaul Date: Mon, 23 Nov 2015 07:08:00 -0500 Subject: [PATCH 10/10] Updated readme --- README.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 6d873a6..ffe7d64 100644 --- a/README.md +++ b/README.md @@ -13,11 +13,9 @@ Getting Started First: clone this repository (to ~/.quicklisp/local-projects for example), then having assured that ASDF can find it (say by resetting ASDF's source respository `(asdf:clear-source-registry)`) -`plot-window` requires a modified version of cl-interpol (until changes are merged in cl-interpol). The patched cl-interpol can be found at https://github.com/mmaul/cl-interpol.git and the modified version can be found on the `use-interpol-reader-outside-of-reader` branch. +`plot-window` requires version 0.2.5 of cl-interpol. Until the Quicklisp pull from the cl-interpol upstream, you will need to clone cl-interpol from it's github repository https://github.com/edicl/cl-interpol.git. ``` -git clone https://github.com/mmaul/cl-interpol.git -cd cl-interpol -git checkout use-interpol-reader-outside-of-reader +git clone https://github.com/edicl/cl-interpol.git ``` The plot-window can be loaded and ran as so: