deletes token created in test-valid-fallback-service-resolution (#762)

--- waiter/integration/waiter/token_request_test.clj
+++ waiter/integration/waiter/token_request_test.clj
@@ -1477,29 +1477,32 @@
                                          :grace-period-secs 300
                                          :name (str service-name "-v3")
                                          :version "version-3"))]
-      (assert-response-status (post-token waiter-url token-description-1) 200)
-      (let [service-id-1 (retrieve-service-id waiter-url request-headers)]
-        (with-service-cleanup
-          service-id-1
-          (let [response-1 (make-request-with-debug-info request-headers #(make-request waiter-url "/hello" :headers %))]
-            (assert-response-status response-1 200)
-            (is (= service-id-1 (:service-id response-1))))
-          ;; allow every router to learn about the new instance
-          (let [{:keys [cookies]} (make-request waiter-url "/waiter-auth")]
-            (doseq [[_ router-url] (routers waiter-url)]
-              (is (wait-for
-                    (fn []
-                      (let [active-instances (-> (service-settings router-url service-id-1 :cookies cookies)
+      (try
+        (assert-response-status (post-token waiter-url token-description-1) 200)
+        (let [service-id-1 (retrieve-service-id waiter-url request-headers)]
+          (with-service-cleanup
+            service-id-1
+            (let [response-1 (make-request-with-debug-info request-headers #(make-request waiter-url "/hello" :headers %))]
+              (assert-response-status response-1 200)
+              (is (= service-id-1 (:service-id response-1))))
+            ;; allow every router to learn about the new instance
+            (let [{:keys [cookies]} (make-request waiter-url "/waiter-auth")]
+              (doseq [[_ router-url] (routers waiter-url)]
+                (is (wait-for
+                      (fn []
+                        (let [active-instances (-> (service-settings router-url service-id-1 :cookies cookies)
                                                  (get-in [:instances :active-instances]))]
-                        (and (seq active-instances)
-                             (some :healthy? active-instances))))))))
-          (assert-response-status (post-token waiter-url token-description-2) 200)
-          (assert-response-status (make-request waiter-url "/hello" :headers request-headers) 400)
-          (assert-response-status (post-token waiter-url token-description-3) 200)
-          (let [service-id-2 (retrieve-service-id waiter-url (assoc request-headers :x-waiter-fallback-period-secs 0))]
-            (is (not= service-id-1 service-id-2))
-            (with-service-cleanup
-              service-id-2
-              (let [response-2 (make-request-with-debug-info request-headers #(make-request waiter-url "/hello" :headers %))]
-                (assert-response-status response-2 200)
-                (is (= service-id-1 (:service-id response-2)))))))))))
+                          (and (seq active-instances)
+                               (some :healthy? active-instances))))))))
+            (assert-response-status (post-token waiter-url token-description-2) 200)
+            (assert-response-status (make-request waiter-url "/hello" :headers request-headers) 400)
+            (assert-response-status (post-token waiter-url token-description-3) 200)
+            (let [service-id-2 (retrieve-service-id waiter-url (assoc request-headers :x-waiter-fallback-period-secs 0))]
+              (is (not= service-id-1 service-id-2))
+              (with-service-cleanup
+                service-id-2
+                (let [response-2 (make-request-with-debug-info request-headers #(make-request waiter-url "/hello" :headers %))]
+                  (assert-response-status response-2 200)
+                  (is (= service-id-1 (:service-id response-2))))))))
+        (finally
+          (delete-token-and-assert waiter-url token))))))


Update library versions in generated project.clj

--- resources/leiningen/new/aws_lambda_serverless/project.clj
+++ resources/leiningen/new/aws_lambda_serverless/project.clj
@@ -2,13 +2,13 @@
   :description "AWS Lambda to do FIXME"
   :url "http://example.com/FIXME"

-  :dependencies [[org.clojure/clojure "1.10.0"]
+  :dependencies [[org.clojure/clojure "1.10.1"]

-                 [org.clojure/tools.logging "0.4.1"]
+                 [org.clojure/tools.logging "0.5.0"]
                  [ch.qos.logback/logback-classic "1.2.3"]
-                 [org.slf4j/slf4j-api "1.7.26"]
-                 [org.slf4j/log4j-over-slf4j "1.7.26"]
-                 [org.slf4j/jcl-over-slf4j "1.7.26"]
+                 [org.slf4j/slf4j-api "1.7.28"]
+                 [org.slf4j/log4j-over-slf4j "1.7.28"]
+                 [org.slf4j/jcl-over-slf4j "1.7.28"]
                  ]
   :jvm-opts ["-Dclojure.compiler.elide-meta=[:doc]"
              "-Dclojure.compiler.direct-linking=true"]


only do the absolute url thing in Firefox, causes other problems with Chrome

--- src-cljs/frontend/utils.cljs
+++ src-cljs/frontend/utils.cljs
@@ -14,7 +14,8 @@
             [goog.events :as ge]
             [goog.net.EventType :as gevt]
             [sablono.core :as html :include-macros true]
-            [frontend.utils.seq :as seq-util])
+            [frontend.utils.seq :as seq-util]
+            [goog.labs.userAgent.browser :as ua-browser])
   (:require-macros [frontend.utils :refer (inspect timing defrender go+)]
                    [cljs.core.async.macros :refer (go)])
   (:import [goog.format EmailAddress]))
@@ -291,4 +292,6 @@
   "Uses an absolute url to workaround an annoying bug in Firefox where
   the url(#hash) will break if the base url changes."
   [hash]
-  (str "url(" js/document.location.pathname "#" hash ")"))
+  (if (ua-browser/isFirefox)
+    (str "url(" js/document.location.pathname "#" hash ")")
+    (str "url(#" hash ")")))


docstring for cljs.stacktrace/parse-stacktrace

--- src/main/cljs/cljs/stacktrace.cljc
+++ src/main/cljs/cljs/stacktrace.cljc
@@ -14,7 +14,21 @@
   #?(:clj (:import [java.util.regex Pattern]
                    [java.io File])))

-(defmulti parse-stacktrace (fn [repl-env st err opts] (:ua-product err)))
+(defmulti parse-stacktrace
+  "Parse a JavaScript stacktrace string into a canonical data form. The
+  arguments:
+
+  repl-env - the repl environment, an optional map with :host and :port keys
+             if the stacktrace includes url, not file references
+  st       - the original stacktrace string to parse
+  err      - an error map. :ua-product key defines the type of stacktrace parser
+             to use, for example :chrome
+  opts     - additional options. :output-dir maybe given in this argument if
+             :host and :port do not apply, for example, a file path
+
+  The canonical stacktrace representation can easily be mapped to a
+  ClojureScript one see mapped-stacktrace and mapped-stacktrace-str"
+  (fn [repl-env st err opts] (:ua-product err)))

 (defn parse-int [s]
   #?(:clj  (Long/parseLong s)


[WM] add logback.xml to template renderer

--- src/leiningen/new/kraken_http_api.clj
+++ src/leiningen/new/kraken_http_api.clj
@@ -33,6 +33,7 @@
              ["script/build" (render "script/build" data)]

              ["resources/config.edn" (render "config.edn" data)]
+             ["resources/logback.xml" (render "logback.xml" data)]

              ["src/{{sanitized}}/server.clj" (render "server.clj" data)]
              ["src/{{sanitized}}/service.clj" (render "service.clj" data)]


Update project.clj

Update project.clj

--- src/leiningen/new/reagent/project.clj
+++ src/leiningen/new/reagent/project.clj
@@ -10,7 +10,7 @@
                  [ring-server "0.4.0"]
                  [cljsjs/react "0.13.1-0"]
                  [reagent "0.5.0"]
-                 [reagent-forms "0.5.0"]
+                 [reagent-forms "0.5.1"]
                  [reagent-utils "0.1.4"]
                  [ring "1.3.2"]
                  [ring/ring-defaults "0.1.4"]


Add methods to add a list of follow-ups and to mark complete a follow-up.

--- src/oc/storage/resources/entry.clj
+++ src/oc/storage/resources/entry.clj
@@ -265,7 +265,7 @@
   to the common/Entry schema.
   "
   [conn uuid :- lib-schema/UniqueID entry user :- lib-schema/User]
-  {:pre [(db-common/conn? conn)
+  {:pre [(db-common/conn? conn)
          (map? entry)]}
   (when-let [original-entry (get-entry conn uuid)]
     (let [ts (db-common/current-timestamp)
@@ -448,6 +448,28 @@
   {:pre [(db-common/conn? conn)]}
   (db-common/read-resources conn table-name :board-uuid [board-uuid] ["uuid" "status"]))

+(schema/defn ^:always-validate add-follow-ups! :- (schema/maybe common/Entry)
+  "Add a follow-up for the give entry uuid"
+  ([conn original-entry :- common/Entry follow-ups :- [common/FollowUp] user :- lib-schema/User]
+   {:pre [(db-common/conn? conn)]}
+   (let [old-follow-ups (:follow-ups original-entry)
+         all-follow-up-assignee (map #(-> % :assignee :user-id) follow-ups)
+         filtered-follow-ups (filterv #(not (#{(-> % :assignee :user-id)} (set all-follow-up-assignee))) old-follow-ups)
+         new-follow-ups (vec (concat filtered-follow-ups follow-ups))
+         final-entry (assoc original-entry :follow-ups new-follow-ups)]
+    (update-entry-no-version! conn (:uuid original-entry) final-entry user))))
+
+(schema/defn ^:always-validate complete-follow-up!
+  "Complete a follow-up item"
+  [conn original-entry :- common/Entry follow-up :- common/FollowUp user :- lib-schema/User]
+  {:pre [(db-common/conn? conn)]}
+  (let [completed-follow-up (merge follow-up {:completed? true
+                                              :completed-at (db-common/current-timestamp)})
+        other-follow-ups (filterv #(not= (:uuid %) (:uuid follow-up)) (:follow-ups original-entry))
+        final-follow-ups (vec (conj other-follow-ups completed-follow-up))
+        updated-entry (assoc original-entry :follow-ups final-follow-ups)]
+    (update-entry-no-version! conn entry-uuid updated-entry user)))
+
 ;; ----- Data about entries -----

 (schema/defn ^:always-validate entry-months-by-org


Sort address maps.

Sort address maps.

Make it easier to see gaps in DMX assignment.

--- src/afterglow/show.clj
+++ src/afterglow/show.clj
@@ -485,24 +485,25 @@
                                       :ending #{}}))

 (defn- address-map-internal
-  "Helper function which returns a map whose keys are all addresses in use in a given universe
-  within a fixture map, and whose values are the fixture key using that universe address."
+  "Helper function which returns a sorted map whose keys are all
+  addresses in use in a given universe within a fixture map, and whose
+  values are the fixture key using that universe address."
   [fixtures universe]
   (reduce (fn [addr-map [k v]] (if (= universe (:universe (first (:channels v))))
                                  (into addr-map (for [address (chan/all-addresses [v])]
                                                   [address (or (:key v) (:key (:fixture v)))]))
-                                 addr-map)) {} fixtures))
+                                 addr-map)) (sorted-map) fixtures))

 (defn address-map
-  "Returns a map whose keys are the IDs of the universes managed
-  by [[*show*]], and whose values are address maps for the
+  "Returns a sorted map whose keys are the IDs of the universes
+  managed by [[*show*]], and whose values are address maps for the
   corresponding universe. The address maps have keys for every channel
   in use by the show in that universe, and the value is the key of the
   fixture using that address."
   {:doc/format :markdown}
   []
   {:pre [(some? *show*)]}
-  (into {} (for [u (:universes *show*)]
+  (into (sorted-map) (for [u (:universes *show*)]
              [u (address-map-internal @(:fixtures *show*) u)])))

 (defn remove-fixture!


Clean up rejected handling

Clean up rejected handling

--- src/beehive/future.clj
+++ src/beehive/future.clj
@@ -90,8 +90,8 @@
     (fn (:status future) result)))

 (defn on-complete [f function]
-  (if (instance? BeehiveRejectedFuture f)
-    (function :rejected (.reason ^BeehiveRejectedFuture f))
+  (if (:rejected? f)
+    (function :rejected (:rejected-reason f))
     (let [^PrecipiceFuture java-f (.future ^BeehiveFuture f)
           cb (CLJCallback. f function)]
       (.onSuccess java-f cb)


Fixed issue where command line option for format would not be parsed as a keyword.

--- src/blutwurst/core.clj
+++ src/blutwurst/core.clj
@@ -16,6 +16,7 @@
    ["-c" "--connection-string CONNECTION" "Connection string to scan."
      :default "jdbc:h2:mem:"]
    ["-f" "--format FORMAT" "Format to which test data should be exported."
+    :parse-fn #(keyword %)
     :default :csv]
    ["-h" "--help"]])


Split long lines.

Split long lines.

--- src/cbfg/world/t2.cljs
+++ src/cbfg/world/t2.cljs
@@ -55,7 +55,9 @@
                                                    :ext-cb lane-state-cb)
                       lane-in-ch))
         conn-loop (fn [actx server-send-ch server-recv-ch close-server-recv-ch]
-                    (cbfg.world.net/server-conn-loop actx server-send-ch server-recv-ch
+                    (cbfg.world.net/server-conn-loop actx
+                                                     server-send-ch
+                                                     server-recv-ch
                                                      close-server-recv-ch
                                                      :make-lane-fn make-lane))]
     (doseq [port ports]


agnostic about https

agnostic about https

--- src/cljs/app/core.cljs
+++ src/cljs/app/core.cljs
@@ -11,7 +11,7 @@
 (enable-console-print!)

 (defn fetch-joke-async [cb]
-  (let [req (Jsonp. (Uri. "http://api.icndb.com/jokes/random"))]
+  (let [req (Jsonp. (Uri. "://api.icndb.com/jokes/random"))]
     (.send req nil
            (fn [res]
              (cb (get-in (js->clj res) ["value" "joke"]))))))


Add JDK 9+ module example.

Add JDK 9+ module example.

--- examples/hello-world/project.clj
+++ examples/hello-world/project.clj
@@ -4,4 +4,6 @@
   :dependencies [[org.clojure/clojure "1.10.0"]
                  [uncomplicate/neanderthal "0.23.1"]]
   :exclusions [[org.jcuda/jcuda-natives :classifier "apple-x86_64"]
-               [org.jcuda/jcublas-natives :classifier "apple-x86_64"]])
+               [org.jcuda/jcublas-natives :classifier "apple-x86_64"]]
+  :jvm-opts ^:replace ["-Dclojure.compiler.direct-linking=true"
+                       #_"--add-opens=java.base/jdk.internal.ref=ALL-UNNAMED"])


Made Find Pair problem use multiple outputs.

--- src/clojush/problems/software/benchmarks_v2/find_pair.clj
+++ src/clojush/problems/software/benchmarks_v2/find_pair.clj
@@ -8,6 +8,24 @@
         [clojush pushstate interpreter random util globals]
         clojush.instructions.tag)
   (:require [clojure.math.numeric-tower :as nt]))
+
+(define-registered
+  output_integer1
+  ^{:stack-types [:integer]}
+  (fn [state]
+    (if (empty? (:integer state))
+      state
+      (let [top-int (top-item :integer state)]
+        (stack-assoc top-int :output 0 state)))))
+
+(define-registered
+  output_integer2
+  ^{:stack-types [:integer]}
+  (fn [state]
+    (if (empty? (:integer state))
+      state
+      (let [top-int (top-item :integer state)]
+        (stack-assoc top-int :output 1 state)))))

 ; Atom generators
 (def atom-generators
@@ -98,9 +116,7 @@
   [inputs]
   (map (fn [[in1 in2]]
           (vector [in1 in2]
-                  (apply *
-                         (first
-                          (all-pairs-sum-to-target in1 in2)))))
+                  (first (all-pairs-sum-to-target in1 in2))))
        inputs))

 (defn make-error-function-from-cases
@@ -113,25 +129,35 @@
      (the-actual-error-function individual data-cases false))
     ([individual data-cases print-outputs]
       (let [behavior (atom '())
-            errors (doall
-                     (for [[[input1 input2] correct-output] (case data-cases
-                                                              :train train-cases
-                                                              :test test-cases
-                                                              [])]
+            errors (flatten
+                    (doall
+                     (for [[[input1 input2] [correct-output1 correct-output2]] (case data-cases
+                                                                                :train train-cases
+                                                                                :test test-cases
+                                                                                [])]
                        (let [final-state (run-push (:program individual)
                                                    (->> (make-push-state)
+                                                        (push-item :no-output :output)
+                                                        (push-item :no-output :output)
                                                         (push-item input2 :input)
                                                         (push-item input1 :input)))
-                             result (top-item :integer final-state)]
+                             result1 (stack-ref :output 0 final-state)
+                             result2 (stack-ref :output 1 final-state)]
                          (when print-outputs
-                           (println (format "Correct output: %9d | Program output: %s" correct-output (str result))))
+                           (println (format "Correct output: %s %s | Program output: %s %s"
+                                            (str correct-output1) (str correct-output2)
+                                            (str result1) (str result2))))
                          ; Record the behavior
-                         (swap! behavior conj result)
-                         ; Error is integer difference
-                         (if (number? result)
-                           (nt/abs (- result correct-output)) ; distance from correct integer
-                           max-number-magnitude) ; penalty for no return value
-                         )))]
+                         (swap! behavior conj result1 result2)
+                         ; Error is integer distance
+                         (vector
+                          (if (number? result1)
+                            (nt/abs (- result1 correct-output1)) ;distance from correct integer
+                            1000000) ;penalty for no return value
+                          (if (number? result2)
+                            (nt/abs (- result2 correct-output2)) ;distance from correct integer
+                            1000000) ;penalty for no return value
+                          )))))]
         (if (= data-cases :train)
           (assoc individual :behaviors @behavior :errors errors)
           (assoc individual :test-errors errors))))))
@@ -195,4 +221,4 @@
    :problem-specific-initial-report initial-report
    :report-simplifications 0
    :final-report-simplifications 5000
-   :max-error max-number-magnitude})
+   :max-error 1000000})


Changed nearly everything to make setWorldExtent work

but now it does! And there there have been several mistakes in the
code...

Signed-off-by: Daniel Borchmann <25857343a15bf1edafebc2912e82ecf775c585c1@mailbox.tu-dresden.de>

--- conexp/graphics/base.clj
+++ conexp/graphics/base.clj
@@ -6,6 +6,22 @@
 	   [no.geosoft.cc.graphics GWindow GScene GObject ZoomInteraction GSegment GStyle
 	                           GText GPosition GScene GInteraction]))

+;;; technical helpers
+
+(defn device-to-world [scn x y]
+  (let [trf (.getTransformer scn)
+	ptn (.deviceToWorld trf x y)]
+    [(aget ptn 0) (aget ptn 1)]))
+
+(defn world-to-device [scn x y]
+  (let [trf (.getTransformer scn)
+	ptn (.worldToDevice trf x y)]
+    [(aget ptn 0) (aget ptn 1)]))
+
+(defn origin [scn]
+  (world-to-device scn 0 0))
+
+
 ;;; nodes and connections

 (defn node? [thing]
@@ -19,47 +35,58 @@
 (defn position [node]
   (:position @(.getUserData node)))

-(defn upper-neighbors [node]
+(defn lower-node [conn]
+  (:lower @(.getUserData conn)))
+
+(defn upper-node [conn]
+  (:upper @(.getUserData conn)))
+
+(defn upper-connections [node]
   (:upper @(.getUserData node)))

-(defn lower-neighbors [node]
+(defn lower-connections [node]
   (:lower @(.getUserData node)))

-(defn start-of-connection [conn]
-  (let [segment (.getSegment conn)]
-    [(aget (.getX segment) 0) (aget (.getY segment) 0)]))
+(defn upper-neighbors [node]
+  (map upper-node (upper-connections node)))

-(defn end-of-connection [conn]
-  (let [segment (.getSegment conn)]
-    [(aget (.getX segment) 1) (aget (.getY segment) 1)]))
+(defn lower-neighbors [node]
+  (map lower-node (lower-connections node)))

 ;;; create and connect nodes

 (defn add-node [scn x y]
-  (let [object (GObject.)
-	segment (GSegment.)
+  (let [segment (GSegment.)
+	object (proxy [GObject] []
+		 (draw []
+		   (let [[x y] (position this)]
+		     (.setGeometryXy segment (Geometry/createCircle (double x) (double y) 10.0)))))
 	style (GStyle.)]
     (.addSegment object segment)
-    (.add scn object)
     (doto style
       (.setForegroundColor (Color.  6  6 86))
       (.setBackgroundColor (Color. 23 11 84)))
     (.setStyle segment style)
-    (.setGeometryXy segment (Geometry/createCircle (double x) (double y) 10.0))
-    (.setUserData object (ref {:type :node, :position [x y]}))
+    (.setUserData object (ref {:type :node,
+			       :position [x y]}))
+    (.setName object (str [x y]))
+    (.add scn object)
     object))

 (defn connect-nodes [scn x y]
-  (let [[x1 x2] (:position @(.getUserData x))
-	[y1 y2] (:position @(.getUserData y))
-	c (GObject.)
-	line (GSegment.)]
+  (let [line (GSegment.)
+	c       (proxy [GObject] []
+		  (draw []
+		    (let [[x1 y1] (position (lower-node this))
+			  [x2 y2] (position (upper-node this))]
+		      (.setGeometry line (double x1) (double y1) (double x2) (double y2)))))]
     (.add scn c)
     (.addSegment c line)
     (.toBack c)
-    (.setUserData c (ref {:type :connection}))
-    (.setGeometry line (double x1) (double x2) (double y1) (double y2))
+    (.setUserData c (ref {:type :connection,
+			  :lower x,
+			  :upper y}))
     (dosync
      (alter (.getUserData x) update-in [:upper] conj c)
      (alter (.getUserData y) update-in [:lower] conj c))))
@@ -69,41 +96,52 @@

 (defn height-of-lower-neighbors [node]
   (let [lowers (lower-neighbors node)]
-    (if (not lowers)
+    (if (empty? lowers)
       nil
-      (reduce min (map (fn [conn] ((start-of-connection conn) 1)) lowers)))))
+      (reduce min (map (fn [node]
+			 ((position node) 1))
+		       lowers)))))

 (defn height-of-upper-neighbors [node]
   (let [uppers (upper-neighbors node)]
-    (if (not uppers)
+    (if (empty? uppers)
       nil
-      (reduce max (map (fn [node] ((end-of-connection node) 1)) uppers)))))
+      (reduce max (map (fn [node]
+			 ((position node) 1))
+		       uppers)))))

 (defn move-node-by [node dx dy] ; race condition when move nodes too fast?
   (let [[x y] (position node)
-	max-y (height-of-lower-neighbors node)
-	min-y (height-of-upper-neighbors node)
+
+	; make sure nodes don't go too far
+	max-y (height-of-upper-neighbors node)
+	min-y (height-of-lower-neighbors node)
 	dy    (if max-y (min dy (- max-y y)) dy)
 	dy    (if min-y (max dy (- min-y y)) dy)
+
 	[new-x new-y] [(+ x dx) (+ y dy)]]
-    (doseq [segment (.getSegments node)]
-      (.translate segment dx dy))
-    (doseq [c (upper-neighbors node)]
-      (let [c (.getSegment c)
-	    c1 (aget (.getX c) 0)
-	    c2 (aget (.getY c) 0)
-	    d1 (aget (.getX c) 1)
-	    d2 (aget (.getY c) 1)]
-	(.setGeometry c (+ c1 dx) (+ c2 dy) d1 d2)))
-    (doseq [c (lower-neighbors node)]
-      (let [c (.getSegment c)
-	    c1 (aget (.getX c) 0)
-	    c2 (aget (.getY c) 0)
-	    d1 (aget (.getX c) 1)
-	    d2 (aget (.getY c) 1)]
-	(.setGeometry c c1 c2 (+ d1 dx) (+ d2 dy))))
+
+    ; move nodes on the device
+    (let [[dx-1 dy-1] (world-to-device scn dx dy)
+	  [zx zy]     (world-to-device scn 0 0)
+	  device-dx   (- dx-1 zx)
+	  device-dy   (- dy-1 zy)]
+      (doseq [segment (.getSegments node)]
+	(.translate segment device-dx device-dy)))
+
+    ; update self position
     (dosync
      (alter (.getUserData node) assoc :position [new-x new-y]))
+
+    ; update connections to upper neighbors
+    (doseq [c (upper-connections node)]
+      (.redraw c))
+
+    ; update connections to lower neighbors
+    (doseq [c (lower-connections node)]
+      (.redraw c))
+
+    ; done
     [new-x new-y]))

 (defn move-node-to [node x y]
@@ -119,8 +157,9 @@
 				   (when (node? thing)
 				     (reset! interaction-obj thing)))
 	   GWindow/BUTTON1_DRAG  (when @interaction-obj
-				   (move-node-to @interaction-obj x y)
-				   (.refresh scn))
+				   (let [[x y] (device-to-world scn x y)]
+				     (move-node-to @interaction-obj x y)
+				     (.refresh scn)))
 	   GWindow/BUTTON1_UP    (reset! interaction-obj nil)
 	   nil)))))

@@ -130,16 +169,22 @@
 (defn- show-some-picture []
   (let [wnd (GWindow.)
 	scn (GScene. wnd)
-	frm (JFrame.)]
-;    (.setWorldExtent scn 0.0 0.0 100.0 100.0)
-    (.startInteraction wnd (move-interaction))
-    (.setLayout frm (BorderLayout.))
-    (-> frm .getContentPane (.add (.getCanvas wnd) BorderLayout/CENTER))
-    (.setSize frm 300 300)
+	frm (JFrame. "Main Frame")]
+    (doto scn
+      (.setWorldExtent 0.0 0.0 100.0 100.0)
+      (.shouldZoomOnResize false)
+      (.shouldWorldExtentFitViewport false))
     (let [x (add-node scn 100 100)
 	  y (add-node scn 50 50)
-	  z (add-node scn 75 23)]
-      (connect-nodes scn x y)
-      (connect-nodes scn x z)
-      (connect-nodes scn y z))
-    (.setVisible frm true)))
+	  z (add-node scn 0 0)]
+      (connect-nodes scn z y)
+      (connect-nodes scn y x))
+    (doto frm
+      (.setLayout (BorderLayout.))
+      (.. getContentPane (add (.getCanvas wnd) BorderLayout/CENTER))
+      (.pack)
+      (.setSize (Dimension. 500 500))
+      (.setVisible true))
+    (doto wnd
+      (.startInteraction (move-interaction)))
+    scn))


Type hint next-eid and inline in clj

Type hint next-eid and inline in clj

--- src/datascript/db.cljc
+++ src/datascript/db.cljc
@@ -1042,8 +1042,10 @@
   ^long [report]
   (-> report :db-before :max-tx long inc))

-(defn- next-eid [db]
-  (inc (:max-eid db)))
+(defn- next-eid
+  #?(:clj {:inline (fn [db] `(inc (long (:max-eid ~db))))})
+  ^long [db]
+  (inc (long (:max-eid db))))

 (defn- #?@(:clj  [^Boolean tx-id?]
            :cljs [^boolean tx-id?])


Added source field back in, after inadvertently dropping it.

--- src/depends/reader.clj
+++ src/depends/reader.clj
@@ -95,7 +95,7 @@
                (rest remaining-targets))))))

 (defn- visit
-  [class-info version access-bitmask class-name signature super-name interfaces]
+  [class-info version access-bitmask class-name signature super-name interfaces source]
   (let [fixed-class-name      (fix-type-name class-name)
         fixed-super-name      (fix-type-name super-name)
         fixed-interface-names (map fix-type-name interfaces)
@@ -109,6 +109,7 @@
         :type              (typeof access-bitmask)
         :class-version     version
         :class-version-str (version-name-map version)
+        :source            source
       }
       (into dependencies (conj (create-dependencies fixed-class-name fixed-interface-names :implements)
                                (create-dependency fixed-class-name fixed-super-name :extends)))
@@ -229,7 +230,7 @@
          class-visitor      (proxy [org.objectweb.asm.ClassVisitor]
                                    [org.objectweb.asm.Opcodes/ASM4]
                                    (visit [version access-bitmask class-name signature super-name interfaces]
-                                     (swap! result visit version access-bitmask class-name signature super-name interfaces))
+                                     (swap! result visit version access-bitmask class-name signature super-name interfaces source))
                                    (visitField [access-bitmask field-name desc signature value]
                                      (swap! result visit-field access-bitmask field-name desc signature value)
                                      field-visitor)


Fixes bug, found by clj-kondo-linting.

Fixes bug, found by clj-kondo-linting.

--- src/active/clojure/match.clj
+++ src/active/clojure/match.clj
@@ -216,7 +216,7 @@
   optional-key-with-default-binding-clause?
   [key optional-key-with-default-binding-clause-key
    default-value optional-key-with-default-binding-clause-default-value
-   binding optional-key-with-default-binding-clause])
+   binding optional-key-with-default-binding-clause-binding])

 (defn optional-key-with-default-binding-clause
   "Returns an optional clause that matches a `key`, binding the
@@ -678,7 +678,7 @@
   [message clause]
   (let [key           (optional-key-with-default-binding-clause-key clause)
         default-value (optional-key-with-default-binding-clause-default-value clause)
-        binding       (optional-key-with-default-binding-clause clause)]
+        binding       (optional-key-with-default-binding-clause-binding clause)]
     `[~(symbol binding) (get-in ~message [~(convert-path-element key)] ~default-value)]))

 (defn path-matches-with-binding-clause->rhs-match


did some frontend logging

did some frontend logging

--- src/frontend/core.cljs
+++ src/frontend/core.cljs
@@ -52,7 +52,8 @@

   (let [stream (.createStream js/ss)
         blob-stream (.createBlobReadStream js/ss file)]
-    (println "File uploading!")
+    (println "File uploading: " (.-name file))
+    (println "File size: " (.-size file))

     (.emit (js/ss socket) "file-upload" stream
                                         (.-name file)
@@ -61,6 +62,7 @@

     (.on blob-stream "end"
       (fn []
+        (println "Upload complete: " (.-name file))
         (swap! app-state assoc :num-of-uploads (- (:num-of-uploads @app-state) 1))
         (if-not (empty? (:upload-queue @app-state))
           (let [next-file (last (:upload-queue @app-state))]
@@ -155,9 +157,11 @@

 (defn pause []
   (player/pause)
+  (println "Sending pause signal")
   (.emit socket "pause" (player/get-position)))

 (defn resume []
+  (println "Sending resume signal")
   (.emit socket "resume"))

 (defn get-current-track-num []
@@ -165,20 +169,30 @@
                   (:music-info @app-state))))

 (defn previous-track []
-  (let [track-num (- (get-current-track-num) 1)]
+  (let [track-num (- (get-current-track-num) 1)
+        sound-id (.v4 js/uuid)]
     (if (>= track-num 0)
-      (.emit socket "change-track" track-num (.v4 js/uuid)))))
+      (println "Sending change-track signal."
+               "Track num:" track-num
+               "Sound ID:"  sound-id)
+      (.emit socket "change-track" track-num sound-id))))

 (defn next-track []
-  (let [track-num (+ (get-current-track-num) 1)]
+  (let [track-num (+ (get-current-track-num) 1)
+        sound-id (.v4 js/uuid)]
     (if (< track-num (count (:music-info @app-state)))
-      (.emit socket "change-track" track-num (.v4 js/uuid)))))
+      (println "Sending change-track signal."
+               "Track num:" track-num
+               "Sound ID:"  sound-id)
+      (.emit socket "change-track" track-num sound-id))))

 (defn restart-track []
+  (println "Sending position change signal: " 0)
   (.emit socket "position-change" 0))

 (defn on-finish []
   (println "Song has finished!")
+  (println "Sending track-complete signal")
   (.emit socket "track-complete"))

 (.on socket "sign-in-success"
@@ -188,15 +202,19 @@

 (.on socket "chat-message"
   (fn [message]
+    (println "Received chat-message signal:" message)
     (swap! app-state assoc :messages (conj (:messages @app-state) message))
     (swap! app-state assoc :message-received? true)))

 (.on socket "users-list"
   (fn [users]
+    (println "Received users-list signal: " users)
     (swap! app-state assoc :users users)))

 (.on socket "file-upload-info"
   (fn [file-upload-info]
+    (println "Received file-upload-info signal: " file-upload-info)
+
     (if (= (.-totalsize file-upload-info) (.-bytesreceived file-upload-info))
       (swap! app-state assoc :current-uploads-info
         (dissoc (:current-uploads-info @app-state) (.-id file-upload-info)))
@@ -206,6 +224,9 @@

 (.on socket "upload-complete"
   (fn [music-info track-order]
+    (println "Received upload-complete signal:"
+             "music-info:" music-info
+             "track-order:" track-order)
     (swap! app-state assoc :music-info
       (conj (:music-info @app-state) music-info))

@@ -220,6 +241,9 @@

     (.on stream "data"
       (fn [data-chunk]
+        (println "Received data-chunk:"
+                 "track-id:" track-id
+                 "size:" (.-length data-chunk))
         (let [data-downloaded (+ (.-length data-chunk) (:data-downloaded
                                                          (get (:download-progress @app-state)
                                                               track-id)))]
@@ -234,7 +258,7 @@
                                #js {:type "audio/mpeg"})}))))
     (.on stream "end"
       (fn []
-        (println "Download complete!")
+        (println "Download of" track-id "complete!")
         (swap! app-state assoc :download-status (merge (:download-status @app-state)
                                                        {track-id :complete}))

@@ -245,11 +269,14 @@
           (request-new-track))

         (if (= (:current-track-id @app-state) track-id)
-          (.emit socket "ready-to-start" (:current-sound-id @app-state)))))))
+          (do
+            (println "Sending ready-to-start signal"
+                     "Sound-id:" (:current-sound-id @app-state))
+            (.emit socket "ready-to-start" (:current-sound-id @app-state))))))))

 (.on socket "start-track"
   (fn [position]
-    (println "STARTING TRACK")
+    (println "Starting current track at position: " position)
     (player/play-track (get (:music-files @app-state) (:current-track-id @app-state))
                        (:current-sound-id @app-state)
                        position
@@ -257,7 +284,9 @@

 (.on socket "track-change"
   (fn [track-id sound-id]
-    (println "CHANGING TO TRACK " track-id)
+    (println "Received track-change signal:"
+             "track-id:" track-id
+             "sound-id:" sound-id)
     (let [last-current-track-id (:current-track-id @app-state)
           last-current-sound-id (:current-sound-id @app-state)]
       (swap! app-state assoc :current-track-id track-id)
@@ -269,22 +298,34 @@
       (if-not (is-track-downloaded? track-id)
         (request-file-download track-id)
         (if-not (is-track-downloading? track-id)
-          (.emit socket "ready-to-start" sound-id)))))
+          (do
+            (println "Sending ready-to-start signal with sound-id:" sound-id)
+            (.emit socket "ready-to-start" sound-id))))))

 (.on socket "pause"
   (fn [position]
+    (println "Received pause signal with position:" position)
     (player/pause)
     (player/set-position position)))

-(.on socket "resume" #(player/resume))
+(.on socket "resume"
+  (fn []
+    (println "Received resume signal")
+    (player/resume)))

 (.on socket "position-change"
   (fn [position]
+    (println "Received position-change signal: " position)
     (player/set-position position)))

 (.on socket "hotjoin-music-info"
   (fn [room-music-info track-order current-track-id current-sound-id]
+    (println "Received room state:"
+             "room-music-info:" room-music-info
+             "track-order:" track-order
+             "current-track-id:" current-track-id
+             "current-sound-id:" current-sound-id)
     ; TODO: should probably convert room-music-info to clojure object before manipulating
     (let [track-order (js->clj track-order)
           sorted-music-info (.sort room-music-info (fn [a b]


some prep for sequential downloads

some prep for sequential downloads

--- src/frontend/core.cljs
+++ src/frontend/core.cljs
@@ -12,6 +12,7 @@
                           :music-files {}
                           :data-downloaded 0
                           :download-progress nil
+                          :is-file-downloading? false
                           :current-track-id nil
                           :current-sound nil
                           :ball-being-dragged? false}))
@@ -129,6 +130,7 @@
 (.on (new js/ss socket) "file-download"
   (fn [stream track-id file-size]
     (println "Download starting!")
+    (swap! app-state assoc :is-file-downloading? true)
     (.on stream "data"
       (fn [data-chunk]
         (let [size (+ (.-length data-chunk) (:data-downloaded @app-state))]
@@ -145,6 +147,7 @@
     (.on stream "end"
       (fn []
         (println "Download complete!")
+        (swap! app-state assoc :is-file-downloading? true)
         (swap! app-state assoc :download-progress nil)

         (if (= (:current-track-id @app-state) track-id)
@@ -155,7 +158,9 @@
 (.on socket "track-change"
   (fn [track-id]
     (swap! app-state assoc :current-track-id track-id)
-    (.emit socket "file-download-request" track-id)))
+    (if (nil? (get (:music-files @app-state) track-id))
+      (.emit socket "file-download-request" track-id)
+      (.emit socket "ready-to-start"))))

 (.on socket "pause"
   (fn [position]


Yeah I should take the time to write specs all the time...

--- lib/shin/cljs/cljs/core.cljs
+++ lib/shin/cljs/cljs/core.cljs
@@ -1001,7 +1001,7 @@
 (def fresh-sym-seed 0)
 (defn builtin-fresh-sym []
   (set! fresh-sym-seed (inc fresh-sym-seed))
-  (fresh-sym-seed))
+  fresh-sym-seed)

 (defn gensym [stem]
   (let [stem (if stem stem "G__")]


tweak IFn invoke hack

tweak IFn invoke hack

--- src/main/shadow/build/cljs_hacks.cljc
+++ src/main/shadow/build/cljs_hacks.cljc
@@ -753,7 +753,7 @@
                  ;; experiment with allowing not-native for ftag
                  ;; (^not-native thing 1 2 3) as a way to tell the compiler to use IFn invoke
                  ;; without checking. breaks if arity is not implemented, just like not-native for other protocols?
-                 (= 'not-native ftag)
+                 (and (not proto?) (= 'not-native ftag))
                  (let [f (ana/unwrap-quote f)]
                    (and (= (-> f :op) :const)
                         (keyword? (-> f :form)))))


Do atomic stuff in terms of # electrons, not # orbitals

--- test/com/nomistech/clojure_the_language/c_900_appy_stuff/s_100_science/ss_atomic_orbitals.clj
+++ test/com/nomistech/clojure_the_language/c_900_appy_stuff/s_100_science/ss_atomic_orbitals.clj
@@ -4,25 +4,25 @@
 (def +n-orbitals-extra-at-energy-level-diffs-incl-0+
   [0 1 3 0 5 0 7 0])

-(def +n-orbitals-extra-at-energy-level-incl-0+
-  (->> +n-orbitals-extra-at-energy-level-diffs-incl-0+
-       (reductions +)))
+(def +n-electrons-extra-at-energy-level-diffs-incl-0+
+  (map (partial * 2)
+       +n-orbitals-extra-at-energy-level-diffs-incl-0+))

-(def +n-orbitals-up-to-energy-level-incl-0+
-  (->> +n-orbitals-extra-at-energy-level-incl-0+
+(def +n-electrons-extra-at-energy-level-incl-0+
+  (->> +n-electrons-extra-at-energy-level-diffs-incl-0+
        (reductions +)))

 (def +noble-gases-atomic-numbers-incl-0+
-  (map (partial * 2)
-       +n-orbitals-up-to-energy-level-incl-0+))
+  (->> +n-electrons-extra-at-energy-level-incl-0+
+       (reductions +)))

 ;;;; ___________________________________________________________________________

-(fact +n-orbitals-extra-at-energy-level-incl-0+
-  => [0 1 4 4 9 9 16 16])
+(fact +n-electrons-extra-at-energy-level-diffs-incl-0+
+  => [0 2 6 0 10 0 14 0])

-(fact +n-orbitals-up-to-energy-level-incl-0+
-  => [0 1 5 9 18 27 43 59])
+(fact +n-electrons-extra-at-energy-level-incl-0+
+  => [0 2 8 8 18 18 32 32])

 (fact +noble-gases-atomic-numbers-incl-0+
   => [0 2 10 18 36 54 86 118])
@@ -49,13 +49,13 @@
 (fact (successive-funcalls [inc - /] 9)
   => [10 -10 -1/10])

-(fact (successive-funcalls [(fn [s] (map #(/ % 2)
-                                         s))
+(fact (successive-funcalls [successive-differences-incl-0
                             successive-differences-incl-0
-                            successive-differences-incl-0]
+                            (fn [s] (map #(/ % 2)
+                                         s))]
                            +noble-gases-atomic-numbers-incl-0+)
-  => [+n-orbitals-up-to-energy-level-incl-0+
-      +n-orbitals-extra-at-energy-level-incl-0+
+  => [+n-electrons-extra-at-energy-level-incl-0+
+      +n-electrons-extra-at-energy-level-diffs-incl-0+
       +n-orbitals-extra-at-energy-level-diffs-incl-0+])

 (fact (successive-funcalls [successive-differences-incl-0


s/"it"/"en"/

s/"it"/"en"/

--- src/babel/english/writer.clj
+++ src/babel/english/writer.clj
@@ -117,7 +117,7 @@
                 :spec spec
                 :model small
                 }}]
-             "it")
+             "en")
     (catch Exception e
       (cond


fix typo

fix typo

--- src/io/aviso/twixt.clj
+++ src/io/aviso/twixt.clj
@@ -1,7 +1,7 @@
 (ns io.aviso.twixt
   "Pipeline for accessing and transforming assets for streaming.

-   Twixt integrates with Ring, as a set of Ring rewquest filters.
+   Twixt integrates with Ring, as a set of Ring request filters.

    Twixt plugs into the Ring pipeline, but most of its work is done in terms of the asset pipeline.


Update core.clj

Update core.clj

--- src/iyye/bios/core.clj
+++ src/iyye/bios/core.clj
@@ -18,6 +18,7 @@
   (:require [iyye.bios.iolist :as iolist]
             [iyye.bios.resource :as resource]
             [iyye.bios.persistence :as persistence]
+            [iyye.bios.noun-words :as nouns]
             [clojure.tools.logging :as log]
             [clojure.tools.cli :refer [parse-opts]]
             [clojure.string :as str]))
@@ -26,6 +27,7 @@

 ; wake sleep state machine
 (defn main-loop []
+  (nouns/add-word "iyye.days" #(list @resource/num-days) nil)
   (while true
     (let [current-day (resource/create-day)]
       (resource/start-day current-day)
@@ -44,14 +46,13 @@

 (defn- load-state [name]
   (log/info "first day load")
-  (println "first day load !!")
   (persistence/load-current-iyye name)
+  (nouns/add-word "iyye.name" #(list name) nil)
   (resource/load-day!)
   (iolist/load-io-state))

 (defn- init-state [name]
   (log/info "first day")
-  (println "first day !!")
   (persistence/set-current-iyye name))

 (defn usage [options-summary]


Use `binding` instead of `set!` to ensure *assert* for db checks

--- src/braid/core/server/db.clj
+++ src/braid/core/server/db.clj
@@ -25,10 +25,7 @@
   (d/connect db-url))

 (defstate conn
-  :start (do
-           ;; txn checking uses assert, so we want to make sure they run
-           (set! *assert* true)
-           (connect config)))
+  :start (connect config))

 (defn db [] (d/db conn))

@@ -54,7 +51,7 @@
       (let [test-db (d/with (db) txns)]
         (try
           (doseq [check checks]
-            (check test-db))
+            (binding [*assert* true] (check test-db)))
           (catch AssertionError e
             (throw (ex-info "Transaction Failed"
                             {::error (.getMessage e)}))))))


fix the right click

fix the right click

--- src-cljs/minesweeper/core.cljs
+++ src-cljs/minesweeper/core.cljs
@@ -282,7 +282,7 @@
   (println "rending cell " x y)
   [:span.cell
    { :on-click #(click! x y)
-     :on-context-menu  #(do (mark! x y ) false)
+     :on-context-menu (fn [e] (do (mark! x y ) (.preventDefault e) nil))
      :on-double-click #(explore! x y)
      :class (class-of end? mine state surround)
       } (text-of end? mine state surround)])


(PDB-5216) query-eng: provide query-id, whether logging or not

Rework the code to always have query-id, whether or not log-queries is
true in preparation for adding the query origin and query-id the MDC
of all threads handling the query.

--- src/puppetlabs/puppetdb/query_eng.clj
+++ src/puppetlabs/puppetdb/query_eng.clj
@@ -145,7 +145,7 @@
   "Converts a vector-structured `query` to a corresponding SQL query which will
    return nodes matching the `query`."
   ([query entity version options]
-   (query->sql query entity version options {}))
+   (query->sql query entity version options nil))
   ([query entity version options context]
    {:pre  [((some-fn nil? sequential?) query)]
     :post [(map? %)
@@ -163,13 +163,14 @@
                   (events/legacy-query->sql false version query options)

                   :else (regular-query->sql query entity options))]
-     (when-let [log-id (:log-id context)]
+     (when (:log-queries context)
        (let [{[sql & params] :results-query} result]
          (log/infof "PDBQuery:%s:%s"
-                    log-id (-> (sorted-map :origin (:origin options)
-                                           :sql sql
-                                           :params (vec params))
-                               json/generate-string))))
+                    (:query-id context)
+                    (-> (sorted-map :origin (:origin options)
+                                    :sql sql
+                                    :params (vec params))
+                        json/generate-string))))
      result)))

 (defn get-munge-fn
@@ -194,7 +195,8 @@
    :add-agent-report-filter Boolean
    (s/optional-key :warn-experimental) Boolean
    (s/optional-key :pretty-print) (s/maybe Boolean)
-   (s/optional-key :log-queries) Boolean})
+   (s/optional-key :log-queries) Boolean
+   (s/optional-key :query-id) s/Str})

 (pls/defn-validated stream-query-result
   "Given a query, and database connection, return a Ring response with the query
@@ -207,26 +209,30 @@
     options
     context :- query-context-schema
     row-fn]
-   (let [{:keys [scf-read-db url-prefix warn-experimental pretty-print log-queries]
-          :or {warn-experimental true}} context
-         log-id (when log-queries (str (java.util.UUID/randomUUID)))
-         {:keys [remaining-query entity]} (eng/parse-query-context version query warn-experimental)
-         munge-fn (get-munge-fn entity version options url-prefix)]
-
-     (when log-queries
-       ;; Log origin and AST of incoming query
-       (log/infof "PDBQuery:%s:%s"
-                  log-id (-> (sorted-map :origin (:origin options) :ast query)
-                             json/generate-string)))
-
-     (let [f #(let [{:keys [results-query]}
-                    (query->sql remaining-query entity version
-                                options {:log-id log-id})]
-                (jdbc/call-with-array-converted-query-rows results-query
-                                                           (comp row-fn munge-fn)))]
-       (if use-preferred-streaming-method?
-         (jdbc/with-db-connection scf-read-db (jdbc/with-db-transaction [] (f)))
-         (jdbc/with-transacted-connection scf-read-db (f)))))))
+   ;; For now, generate the ids here; perhaps later, higher up
+   (assert (not (:query-id context)))
+   (let [query-id (str (java.util.UUID/randomUUID))
+         context (assoc context :query-id query-id)]
+     (let [{:keys [scf-read-db url-prefix warn-experimental pretty-print log-queries]
+            :or {warn-experimental true}} context
+           {:keys [remaining-query entity]} (eng/parse-query-context version query warn-experimental)
+           munge-fn (get-munge-fn entity version options url-prefix)]
+
+       (when log-queries
+         ;; Log origin and AST of incoming query
+         (log/infof "PDBQuery:%s:%s"
+                    query-id (-> (sorted-map :origin (:origin options) :ast query)
+                                 json/generate-string)))
+
+       (let [f #(let [{:keys [results-query]}
+                      (query->sql remaining-query entity version
+                                  options
+                                  (select-keys context [:log-queries :query-id]))]
+                  (jdbc/call-with-array-converted-query-rows results-query
+                                                             (comp row-fn munge-fn)))]
+         (if use-preferred-streaming-method?
+           (jdbc/with-db-connection scf-read-db (jdbc/with-db-transaction [] (f)))
+           (jdbc/with-transacted-connection scf-read-db (f))))))))

 ;; Do we still need this, i.e. do we need the pass-through, and the
 ;; strict selectivity in the caller below?
@@ -298,7 +304,8 @@
   if an exception happens before then.  An exception thrown by the
   future after that point will produce an exception from the next call
   to the InputStream read or close methods."
-  [db query entity version query-options log-id munge-fn pretty-print]
+  [db query entity version query-options munge-fn
+   {:keys [log-queries pretty-print query-id] :as context}]
   ;; Client disconnects present as generic IOExceptions from the
   ;; output writer (via stream-json), and we just log them at debug
   ;; level.  For now, after the first row, there's nothing we can do
@@ -323,8 +330,7 @@
                       (jdbc/with-db-connection db
                         (jdbc/with-db-transaction []
                           (let [{:keys [results-query count-query]}
-                                (query->sql query entity version query-options
-                                            {:log-id log-id})
+                                (query->sql query entity version query-options context)
                                 st (when count-query
                                      {:count (jdbc/get-result-count count-query)})
                                 stream-row (fn [row]
@@ -361,9 +367,9 @@

 (defn preferred-produce-streaming-body
   [version query-map context]
-  (let [{:keys [scf-read-db url-prefix warn-experimental pretty-print log-queries]
+  (let [{:keys [scf-read-db url-prefix warn-experimental pretty-print
+                log-queries query-id]
          :or {warn-experimental true}} context
-        log-id (when log-queries (str (java.util.UUID/randomUUID)))
         query-config (select-keys context [:node-purge-ttl :add-agent-report-filter])
         {:keys [query remaining-query entity query-options]}
         (user-query->engine-query version query-map query-config warn-experimental)]
@@ -372,31 +378,33 @@
       ;; Log origin and AST of incoming query
       (let [{:keys [origin query]} query-map]
         (log/infof "PDBQuery:%s:%s"
-                   log-id (-> (sorted-map :origin origin :ast query)
-                              json/generate-string))))
+                   query-id (-> (sorted-map :origin origin :ast query)
+                                json/generate-string))))

     (try
       (let [munge-fn (get-munge-fn entity version query-options url-prefix)
+            stream-ctx (select-keys context [:log-queries :pretty-print :query-id])
             {:keys [status stream]} (body-stream scf-read-db
                                                  (coerce-from-json remaining-query)
                                                  entity version query-options
-                                                 log-id munge-fn pretty-print)]
+                                                 munge-fn
+                                                 stream-ctx)]
         (let [{:keys [count error]} @status]
           (when error
             (throw error))
           (cond-> (http/json-response* stream)
             count (http/add-headers {:count count}))))
       (catch JsonParseException ex
-        (log/error ex (trs "Unparsable query: {0} {1} {2}" log-id query query-options))
+        (log/error ex (trs "Unparsable query: {0} {1} {2}" query-id query query-options))
         (http/error-response ex))
       (catch IllegalArgumentException ex ;; thrown by (at least) munge-fn
-        (log/error ex (trs "Invalid query: {0} {1} {2}" log-id query query-options))
+        (log/error ex (trs "Invalid query: {0} {1} {2}" query-id query query-options))
         (http/error-response ex))
       (catch PSQLException ex
         (when-not (= (.getSQLState ex) (jdbc/sql-state :invalid-regular-expression))
           (throw ex))
         (do
-          (log/debug ex (trs "Invalid query regex: {0} {1} {2}" log-id query query-options))
+          (log/debug ex (trs "Invalid query regex: {0} {1} {2}" query-id query query-options))
           (http/error-response ex))))))

 ;; for testing via with-redefs
@@ -404,9 +412,9 @@

 (defn- deprecated-produce-streaming-body
   [version query-map context]
-  (let [{:keys [scf-read-db url-prefix warn-experimental pretty-print log-queries]
+  (let [{:keys [scf-read-db url-prefix warn-experimental pretty-print
+                log-queries query-id]
          :or {warn-experimental true}} context
-        log-id (when log-queries (str (java.util.UUID/randomUUID)))
         query-config (select-keys context [:node-purge-ttl :add-agent-report-filter])
         {:keys [query remaining-query entity query-options]}
         (user-query->engine-query version query-map query-config warn-experimental)]
@@ -415,18 +423,17 @@
       ;; Log origin and AST of incoming query
       (let [{:keys [origin query]} query-map]
         (log/infof "PDBQuery:%s:%s"
-                   log-id (-> (sorted-map :origin origin :ast query)
-                              json/generate-string))))
+                   query-id (-> (sorted-map :origin origin :ast query)
+                                json/generate-string))))

     (try
       (jdbc/with-transacted-connection scf-read-db
         (let [munge-fn (get-munge-fn entity version query-options url-prefix)
-              {:keys [results-query count-query]} (-> remaining-query
-                                                      coerce-from-json
-                                                      (query->sql entity
-                                                                  version
-                                                                  query-options
-                                                                  {:log-id log-id}))
+              {:keys [results-query count-query]}
+              (-> remaining-query
+                  coerce-from-json
+                  (query->sql entity version query-options
+                              (select-keys context [:log-queries :query-id])))
               query-error (promise)
               resp (http/streamed-response
                     buffer
@@ -474,9 +481,12 @@
   [version :- s/Keyword
    query-map
    context :- query-context-schema]
-  (if use-preferred-streaming-method?
-    (preferred-produce-streaming-body version query-map context)
-    (deprecated-produce-streaming-body version query-map context)))
+  ;; For now, generate the ids here; perhaps later, higher up
+  (assert (not (:query-id context)))
+  (let [context (assoc context :query-id (str (java.util.UUID/randomUUID)))]
+    (if use-preferred-streaming-method?
+      (preferred-produce-streaming-body version query-map context)
+      (deprecated-produce-streaming-body version query-map context))))

 (pls/defn-validated object-exists? :- s/Bool
   "Returns true if an object exists."


Better progress reporting when adding and importing repos

--- src/leiningen/voom.clj
+++ src/leiningen/voom.clj
@@ -865,12 +865,17 @@
                                 (-> commit
                                     (assoc :merge true)
                                     (assoc :paths (merged-paths gitdir (-> commit :sha str))))
-                                commit))]
+                                commit))
+            t (new-throttle
+               (fn [i]
+                 (printf (str "\rCollecting commits %d ...") i)
+                 (flush)))]
         (with-open [rdr (-> out
                             java.io.ByteArrayInputStream.
                             (java.io.InputStreamReader. "ISO-8859-1")
                             java.io.BufferedReader.)]
           (loop [commits [], commit {}]
+            (throttled t (count commits))
             (if-let [line (.readLine rdr)]
               (if (empty? line)
                 (recur (conj commits commit) {})
@@ -971,8 +976,10 @@
             (update-in [:pldb] pldb/db-fact r-branch repo name sha))

           ;; Add commits
-          (->/for [commit (exported-commits
-                           gitdir (vals new-branches) (vals old-branches))]
+          (->/for [commit (report-progress
+                           (str "Indexing " repo " commits")
+                           (exported-commits
+                            gitdir (vals new-branches) (vals old-branches)))]
             (->/assoc :pldb (add-commit-facts gitdir commit)))

           (build-shabam (vals new-branches))


stack api requires

stack api requires

--- src/celestial/api/stacks.clj
+++ src/celestial/api/stacks.clj
@@ -12,6 +12,8 @@
 (ns celestial.api.stacks
   "Stacks api"
    (:require
+    [celestial.persistency.stacks :as s]
+    [celestial.common :refer (success wrap-errors conflict bad-req)]
     [taoensso.timbre :as timbre]
     [swag.model :refer (defmodel)]
     [swag.core :refer (GET- POST- PUT- DELETE- defroutes-)])
@@ -37,10 +39,8 @@
           (conflict {:message "Stack does not exists, use POST /stack first"})
           (wrap-errors
             (s/update-stack (Integer/valueOf id) stack)
-            (success {:message "stack updated" :id id}))))
-  )
+            (success {:message "stack updated" :id id})))))

 (defroutes- stacks-ro {:path "/stacks" :description "Read only stacks api"}
   (GET- "/stacks/:id" [^:int id] {:nickname "getStackById" :summary "Get stack by its id"}
-     (success (s/get-stack id)))
-  )
+     (success (s/get-stack id))))


App version and more detail in logs email

--- src/status_im/utils/logging/core.cljs
+++ src/status_im/utils/logging/core.cljs
@@ -7,7 +7,11 @@
             [status-im.utils.email :as mail]
             [taoensso.timbre :as log]
             [status-im.utils.config :as config]
-            [status-im.i18n :as i18n]))
+            [status-im.i18n :as i18n]
+            [status-im.utils.platform :as platform]
+            [status-im.utils.build :as build]
+            [status-im.transport.utils :as transport.utils]
+            [status-im.utils.datetime :as datetime]))

 (def report-email "error-reports@status.im")
 (def max-log-entries 1000)
@@ -83,16 +87,53 @@
   [{:keys [db]}]
   {:db (dissoc db :logging/dialog-shown?)})

+(defn email-body
+  [{:keys [:web3-node-version :mailserver/current-id
+           :node-info :peers-summary]
+    :as db}]
+  "logs attached"
+  (let [build-number  (if platform/desktop? build/version build/build-no)
+        build-version (str build/version " (" build-number ")")
+        separator (clojure.string/join (take 40 (repeat "-")))
+        [enode-id ip-address port]
+        (transport.utils/extract-url-components (:enode node-info))]
+    (clojure.string/join
+     "\n"
+     (concat [separator
+              (str "App version: " build-version)
+              (str "OS: " platform/os)
+              (str "Node version: " web3-node-version)
+              (str "Mailserver: " (name current-id))
+              separator
+              "Node Info"
+              (str "id: " enode-id)
+              (str "ip: " ip-address)
+              (str "port: " port)
+              separator
+              "Peers"]
+             (mapcat
+              (fn [{:keys [enode]}]
+                (let [[enode-id ip-address port]
+                      (transport.utils/extract-url-components enode)]
+                  [(str "id: " enode-id)
+                   (str "ip: " ip-address)
+                   (str "port: " port)
+                   "\n"]))
+              peers-summary)
+             [separator
+              (datetime/timestamp->long-date
+               (datetime/now))]))))
+
 (handlers/register-handler-fx
  ::send-email
- (fn [cofx [_ archive-path]]
+ (fn [{:keys [db] :as cofx} [_ archive-path]]
    (fx/merge
     cofx
     (dialog-closed)
     (mail/send-email
      {:subject    "Error report"
       :recipients [report-email]
-      :body       "logs attached"
+      :body       (email-body db)
       :attachment {:path archive-path
                    :type "zip"
                    :name "status_logs.zip"}}


Adding traces to stack.

Adding traces to stack.

--- src/clj/minijava/compile.clj
+++ src/clj/minijava/compile.clj
@@ -41,6 +41,7 @@
   (let [treemap   (apply-tree (parse program))
         canonmap  (map-method canon treemap)
         blocksmap (map-method basic-blocks canonmap)
+				tracemap (map-method trace canonmap)
         munchmap  (map-method (fn [blocks] (map select blocks))
                               blocksmap)]
     munchmap))


working on reagent baby steps

working on reagent baby steps

--- src/cljs/clj_money/core.cljs
+++ src/cljs/clj_money/core.cljs
@@ -1,7 +1,13 @@
 (ns clj-money.core
-  (:require [reagent.core :as reagent]
+  (:require [reagent.core :as r]
             [secretary.core :as secretary :include-macros true]
             [accountant.core :as accountant]))
+
+(def app-state (r/atom {}))
+
+(def entities
+  [{:id 1 :name "Personal"}
+   {:id 2 :name "Business"}])

 (defn nav []
   [:nav.navbar.navbar-inverse
@@ -21,11 +27,29 @@

     [:div#navbar.collapse.navbar-collapse
      [:ul.nav.navbar-nav
-      [:li {:class "active"}
-       [:a {:href "#"} "About"]]
-      [:li
-       [:a {:href "#contact"}
-        "Contact"]]]]]])
+      [:li.dropdown {:role "presentation"}
+       [:a.dropdown-toggle
+        {:href "#"
+         :data-toggle "dropdown"
+         :role "button"
+         :aria-haspopup true}
+        (-> @app-state :current-entity :name)
+        [:span.caret]]
+       [:ul.dropdown-menu
+        (concat
+          (for [entity entities]
+            ^{:key entity} [:li {:class (when (= (:id entity)
+                                                 (:id (:current-entity @app-state)))
+                                          "active")}
+                            [:a {:href "#"
+                                 :on-click (fn []
+                                             (.log js/console "selected entity")
+                                             (swap! app-state
+                                                    #(assoc % :currency-entity entity)))}
+                             (:name entity)]])
+          [[:li.divider {:role "separator"}]
+           [:li
+            [:a {:href "#"} "Manage Entities"]]])]]]]]])

 (defn home-page []
   [:div
@@ -37,7 +61,7 @@
   (.log js/console "exercise the root route"))

 (defn mount-root []
-  (reagent/render home-page (.getElementById js/document "app")))
+  (r/render home-page (.getElementById js/document "app")))

 (defn init! []
   (accountant/configure-navigation!
@@ -46,4 +70,6 @@
   (accountant/dispatch-current!)
   (mount-root))

+(swap! app-state #(assoc % :current-entity (first entities)))
+
 (init!)


An example

An example

--- src/cljs/uberblick/core.cljs
+++ src/cljs/uberblick/core.cljs
@@ -305,6 +305,7 @@
        [Examples current-profile [
                                   "(starts-with? :FirstName \"M\")"
                                   "(= :LaborRoleID \"APPLDEVL\")"
+                                  "(not (= :LaborCategoryID \"CREATIVE\"))"
                                   "(= :WorkTeamID $WorkTeamID) ; Klicksters in your team "
                                   "(substring? :Title \"Quality\") ; Klicksters that have 'Quality' in their title"
                                   "(> :UserID $UserID) ; Klicksters that got hired after you"


Print router trace when exceptions occur in node

--- src/cljs/zetawar/router.cljs
+++ src/cljs/zetawar/router.cljs
@@ -10,7 +10,9 @@
    [cljs.core.async.macros :refer [go go-loop]]))

 (when-not (exists? js/Raven)
-  (let [stub #js {"captureMessage" #() "captureException" #()}
+  (let [stub #js {"captureMessage" #()
+                  ;; TODO: something better than js/console.trace
+                  "captureException" #(js/console.trace)}
         global (if (exists? js/window) js/window js/global)]
     (gobj/set global "Raven" stub)))


Adding an on-complete callback to nil should call the callback immediately.

--- src/clojure/picard/netty.clj
+++ src/clojure/picard/netty.clj
@@ -49,6 +49,11 @@
                     (operationComplete [_ future]
                       (callback future))))
     future))
+
+(extend-type nil
+  NETTY-FUTURE
+  (on-complete [_ callback]
+    (callback nil)))

 (def close-channel-future-listener ChannelFutureListener/CLOSE)


Temporarily remove test pending on issue #91

--- src/test/clojure/clara/test_rules.clj
+++ src/test/clojure/clara/test_rules.clj
@@ -431,7 +431,7 @@
                        (let [results (query session colder-than-mci-query)]

                          (is (= 1 (count results)))
-
+
                          (is (= {:?mci-temp 15
                                  :?colder-temps #{(->Temperature 10 "ORD")
                                                   (->Temperature 5 "LGA")}}
@@ -504,29 +504,29 @@

         ;; Test assertion helper.
         assert-query-results (fn [test-name session & expected-results]
-
+
                                (is (= (count expected-results)
                                       (count (query session get-cold-temp)))
                                    (str test-name))
-
+
                                (is (= (set expected-results)
                                       (set (query session get-cold-temp)))
                                    (str test-name)))
-
+
         thresh-10 ^{:type :temp-threshold} {:temperature 10}
         thresh-20 ^{:type :temp-threshold} {:temperature 20}

         temp-5-mci (->Temperature 5 "MCI")
         temp-10-lax (->Temperature 10 "LAX")
         temp-20-mci (->Temperature 20 "MCI")
-
+
         session (mk-session [get-cold-temp get-min-temp-under-threshold])]

     ;; No temp tests - no firing

     (assert-query-results 'no-thresh-no-temps
                           session)
-
+
     (assert-query-results 'one-thresh-no-temps
                           (-> session
                               (insert thresh-10)
@@ -546,7 +546,7 @@
                               fire-rules))

     ;; With temps tests.
-
+
     (assert-query-results 'one-thresh-one-temp-no-match
                           (-> session
                               (insert thresh-10)
@@ -560,7 +560,7 @@
                               fire-rules
                               (retract temp-10-lax)
                               fire-rules))
-
+
     (assert-query-results 'two-thresh-one-temp-no-match
                           (-> session
                               (insert thresh-10)
@@ -593,7 +593,7 @@
                               fire-rules
                               (retract thresh-20)
                               fire-rules))
-
+
     (assert-query-results 'one-thresh-two-temp-one-match
                           (-> session
                               (insert thresh-20)
@@ -610,7 +610,7 @@
                               fire-rules
                               (retract temp-5-mci)
                               fire-rules))
-
+
     (assert-query-results 'one-thresh-two-temp-two-match
                           (-> session
                               (insert thresh-20)
@@ -620,19 +620,19 @@

                           {:?cold (->Cold 5)})))

-(deftest ^{:doc "A test to make sure the appropriate data is held in the memory
+(deftest ^{:doc "A test to make sure the appropriate data is held in the memory
                  of accumulate node with join filter is correct upon right-retract."}
   test-accumulator-with-test-join-retract-accumulated-use-new-result
   (let [coldest-temp (dsl/parse-rule [[?thresh <- :temp-threshold]
                                       [?temp <- (acc/max :temperature)
                                        :from [Temperature (< temperature (:temperature ?thresh))]]]
-
+
                                      (insert! (->Cold ?temp)))

         find-cold (dsl/parse-query [] [[?c <- Cold]])

         thresh-20 ^{:type :temp-threshold} {:temperature 20}
-
+
         temp-10-mci (->Temperature 10 "MCI")
         temp-15-lax (->Temperature 15 "LAX")

@@ -650,7 +650,7 @@
     (is (= [{:?c (->Cold 10)}]
            cold-results))))

-(deftest ^{:doc "A test that ensures that when candidate facts are grouped by bindings in a
+(deftest ^{:doc "A test that ensures that when candidate facts are grouped by bindings in a
                  join filter accumulator that has an initial-value to propagate, that the value
                  is propagated for empty groups."}
   test-accumulator-with-init-and-binding-groups
@@ -669,7 +669,7 @@
         temp-10-mci (->Temperature 10 "MCI")
         temp-15-lax (->Temperature 15 "LAX")
         temp-20-mci (->Temperature 20 "MCI")
-
+
         session (mk-session [get-temp-history get-temps-under-threshold])

         two-groups-one-init (-> session
@@ -694,17 +694,19 @@
                fire-rules
                (query get-temp-history))))

-    (is (= 2 (count two-groups-one-init)))
-    (is (= #{{:?his (->TemperatureHistory [])}
-             {:?his (->TemperatureHistory [temp-10-mci])}}
-
-           (set two-groups-one-init)))
-
-    (is (= 2 (count two-groups-no-init)))
-    (is (= #{{:?his (->TemperatureHistory [temp-15-lax])}
-             {:?his (->TemperatureHistory [temp-10-mci])}}
-
-           (set two-groups-no-init)))))
+    (comment
+      ;; Temporarily removed; see https://github.com/rbrush/clara-rules/issues/91
+      (is (= 2 (count two-groups-one-init)))
+      (is (= #{{:?his (->TemperatureHistory [])}
+               {:?his (->TemperatureHistory [temp-10-mci])}}
+
+             (set two-groups-one-init)))
+
+      (is (= 2 (count two-groups-no-init)))
+      (is (= #{{:?his (->TemperatureHistory [temp-15-lax])}
+               {:?his (->TemperatureHistory [temp-10-mci])}}
+
+             (set two-groups-no-init))))))

 (deftest test-simple-negation
   (let [not-cold-query (dsl/parse-query [] [[:not [Temperature (< temperature 20)]]])
@@ -831,7 +833,7 @@
         ;; Single blocked rule.
         blocked-first-to-fourth-third (dsl/parse-rule [[:not [Second]]
                                                        [First]]
-
+
                                                       (insert! (->Fourth)
                                                                (->Third)))

@@ -847,7 +849,7 @@
                                              :cache false)
                                  (insert (->Fourth))
                                  fire-rules)
-
+
         ;; Let the rules engine perform rule activations in any order.
         session-no-salience (-> (mk-session [first-to-second
                                              blocked-first-to-fourth-third
@@ -879,10 +881,10 @@

     (is (= #{{:?fourth (->Fourth)}}
            (set (query session-with-results double-blocked-fourth))))
-
+
     ;; All of these should return the same thing - :salience shouldn't
     ;; affect outcomes for logical inserts.
-
+
     (is (empty? (query session-no-salience double-blocked-fourth)))
     (is (empty? (query session-best-order-salience double-blocked-fourth)))
     (is (empty? (query session-worst-order-salience double-blocked-fourth)))))
@@ -962,14 +964,14 @@
             {:?c (->Cold 50)}
             {:?c (->Cold 50)}
             {:?c (->Cold 50)}]
-
+
            (query session-inserted find-cold)))
-
+
     (is (= 2 (count (query session-retracted find-cold))))

     (is (= [{:?c (->Cold 50)}
             {:?c (->Cold 50)}]
-
+
            (query session-retracted find-cold)))))

 (deftest test-simple-disjunction
@@ -2123,7 +2125,7 @@
                                               (contains? #{?loc} location)]]

                                             (insert! (->Cold ?temp)))
-
+
         find-cold (dsl/parse-query [] [[?c <- Cold]])

         session (-> (mk-session [temps-for-locations find-cold])


Adds docstrings.

Adds docstrings.

--- umm-spec-lib/src/cmr/umm_spec/xml_to_umm_mappings/iso19115_2/spatial.clj
+++ umm-spec-lib/src/cmr/umm_spec/xml_to_umm_mappings/iso19115_2/spatial.clj
@@ -62,6 +62,7 @@
     (parse-key-val-str (value-of extent-el "gmd:description/gco:CharacterString"))))

 (defn- shape-el?
+  "Returns true if XML element is (probably) a shape instead of other geographic information elements."
   [el]
   (not (seq (select el "gmd:EX_GeographicDescription"))))


Per product and per repos statistic is computed for given year

--- src/arachnida/db_interface.clj
+++ src/arachnida/db_interface.clj
@@ -110,7 +110,7 @@
                                  and author=?" author-name])))

 (defn read-statistic-for-product
-    [product-id]
+    [product-id from to]
     (first
     (jdbc/query db-spec/data-db
                                ["select count(*) as commits_count,
@@ -118,11 +118,11 @@
                                         sum(insertions) as insertions,
                                         sum(deletions) as deletions
                                  from commits
-                                 where date between '2015-01-01' and '2015-12-31'
-                                 and product=?" product-id])))
+                                 where date between ? and ?
+                                 and product=?" from to product-id])))

 (defn read-statistic-for-product-repo
-    [product-id]
+    [product-id from to]
     (jdbc/query db-spec/data-db
                                ["select count(*) as commits_count,
                                         (select name from repos where repos.id=commits.repo) as reponame,
@@ -130,9 +130,9 @@
                                         sum(insertions) as insertions,
                                         sum(deletions) as deletions
                                  from commits
-                                 where date between '2015-01-01' and '2015-12-31'
+                                 where date between ? and ?
                                  and product=?
-                                 group by reponame" product-id]))
+                                 group by reponame" from to product-id]))

 (defn read-stat-per-weeks-from-db
     [first-day last-day]


Fix atom-count failure

Fix atom-count failure

--- src/atom_finder/atom_stats.clj
+++ src/atom_finder/atom_stats.clj
@@ -7,15 +7,15 @@
    )
   )

-(defn atoms-ba
-  [srcs atom]
-  {:atoms-before (->> srcs :ast-before ((:finder atom)))
-   :atoms-after  (->> srcs :ast-after  ((:finder atom)))})
+;(defn atoms-ba
+;  [srcs atom]
+;  {:atoms-before (->> srcs :ast-before ((:finder atom)))
+;   :atoms-after  (->> srcs :ast-after  ((:finder atom)))})

 (defn ba-counts
   [srcs atom]
-  {:atom-count-before (->> srcs :atoms-before count)
-   :atom-count-after  (->> srcs :atoms-after  count)})
+  {:atom-count-before (->> srcs :ast-before ((:finder atom)) count)
+   :atom-count-after  (->> srcs :ast-after  ((:finder atom)) count)})

 (defn source-size-before-after [srcs atom]
   {:source-chars-before (-> srcs :source-before count)
@@ -26,7 +26,7 @@
    :comments-after  (->> srcs :ast-after all-comments)})

 (defn atom-stats [] {
-   :atoms-ba                 atoms-ba
+   ;:atoms-ba                 atoms-ba
    :atom-counts-before-after ba-counts
    :source-size-before-after source-size-before-after
    :comments-before-after    comments-ba


CMR-2812 Updates tests to use are3

CMR-2812 Updates tests to use are3

--- access-control-app/int_test/cmr/access_control/int_test/acl_crud_test.clj
+++ access-control-app/int_test/cmr/access_control/int_test/acl_crud_test.clj
@@ -8,7 +8,7 @@
             [cmr.transmit.access-control :as ac]
             [cmr.transmit.metadata-db2 :as mdb]
             [cheshire.core :as json]
-            [cmr.common.util :as util :refer [are2]]
+            [cmr.common.util :as util :refer [are3]]
             [cmr.transmit.config :as transmit-config]))

 (use-fixtures :each
@@ -44,8 +44,8 @@

 (deftest create-acl-errors-test
   (let [token (e/login (u/conn-context) "admin")]
-    (are2 [re acl]
-          (thrown-with-msg? Exception re (ac/create-acl (u/conn-context) acl {:token token}))
+    (are3 [re acl]
+          (is (thrown-with-msg? Exception re (ac/create-acl (u/conn-context) acl {:token token})))

           ;; Acceptance criteria: I receive an error if creating an ACL missing required fields.
           ;; Note: this tests a few fields, and is not exhaustive. The JSON schema handles this check.
@@ -93,7 +93,7 @@

 (deftest acl-catalog-item-identity-validation-test
   (let [token (e/login (u/conn-context) "admin")]
-    (are2 [errors acl] (= errors (:errors (u/create-acl token acl {:raw? true})))
+    (are3 [errors acl] (is (= errors (:errors (u/create-acl token acl {:raw? true}))))

           "An error is returned if creating a catalog item identity that does not grant permission
                to collections or granules. (It must grant to collections or granules or both.)"
@@ -233,8 +233,8 @@
 (deftest update-acl-errors-test
   (let [token (e/login (u/conn-context) "admin")
         {concept-id :concept_id} (ac/create-acl (u/conn-context) system-acl {:token token})]
-    (are2 [re acl]
-          (thrown-with-msg? Exception re (ac/update-acl (u/conn-context) concept-id acl {:token token}))
+    (are3 [re acl]
+          (is (thrown-with-msg? Exception re (ac/update-acl (u/conn-context) concept-id acl {:token token})))

           ;; Acceptance criteria: I receive an error if creating an ACL missing required fields.
           ;; Note: this tests a few fields, and is not exhaustive. The JSON schema handles this check.


adjust timeout

adjust timeout

--- src/babel/english/workbook.clj
+++ src/babel/english/workbook.clj
@@ -105,9 +105,7 @@
                         clojure.lang.Var clojure.lang.RT
                         ]))
    :refer-clojure false
-   ;; using 60000 for development: for production, use much smaller value.
-   :timeout 60000
-;   :timeout 15000
+   :timeout 3000
    :namespace 'babel.english.workbook))


Fix seed to not mix groups of thread

Fix seed to not mix groups of thread

--- src/braid/core/server/seed.clj
+++ src/braid/core/server/seed.clj
@@ -101,19 +101,20 @@
               (tag/user-subscribe-to-tag-txn (user-1 :id) (tag-3 :id))
               (tag/user-subscribe-to-tag-txn (user-2 :id) (tag-3 :id))))

+        new-thread-id (db/uuid)
         [msg5 msg6]
         (db/run-txns!
           (concat
             (message/create-message-txn {:id (db/uuid)
                                          :user-id (user-1 :id)
                                          :group-id (group-2 :id)
-                                         :thread-id (db/uuid)
+                                         :thread-id new-thread-id
                                          :created-at (java.util.Date.)
                                          :content "Hello?"
                                          :mentioned-tag-ids [(tag-3 :id)]})
             (message/create-message-txn {:id (db/uuid)
                                          :group-id (group-2 :id)
-                                         :thread-id (msg-1 :thread-id)
+                                         :thread-id new-thread-id
                                          :user-id (user-2 :id)
                                          :created-at (java.util.Date.)
                                          :content "Hi!"})))]))


Remove unused url->feed function

Remove unused url->feed function

--- src/clj/comic_reader/sites.clj
+++ src/clj/comic_reader/sites.clj
@@ -24,12 +24,7 @@
         {:url comic-url
          :selector [:div#chapters :ul.chlist
                     :li :div #{:h3 :h4} :a]
-         :normalize link->map})
-      :url->feed (fn [url]
-                   (some->> url
-                            (re-matches manga-pattern)
-                            second
-                            (format "%s/rss/%s.xml" canonical-url)))})
+         :normalize link->map})})

    (let [canonical-url "http://www.mangareader.net"
          link->map (gen-link->map s/trim


Updated docs for sparsify

Updated docs for sparsify

--- src/clj/forma/matrix/utils.clj
+++ src/clj/forma/matrix/utils.clj
@@ -166,7 +166,9 @@
 (defn sparsify
   "Wrapper for `sparse-expander` handles data coming in via a
    `defbufferop`. `sparse-expander` then makes a complete timeseries by
-   inserting a nodata value when a period is missing.
+   inserting a nodata value when a period is missing. `field-idx` is
+   used to choose the field in `sorted-tuples` that will be returned
+   sparsely expanded.

   Usage:
     (sparsify 1 -9999 [3 5] [[-9999 3 4 5] [-9999 5 5 6]])


Change layout/main to regular function

Change layout/main to regular function

--- src/clj/salava/core/layout.clj
+++ src/clj/salava/core/layout.clj
@@ -58,9 +58,9 @@

 (defn main [ctx path]
-  `(GET ~path []
+  (GET path []
          :no-doc true
          :summary "Main HTML layout"
-         (-> (main-view ~ctx)
+         (-> (main-view ctx)
              (ok)
              (content-type "text/html; charset=\"UTF-8\""))))


Disable direct processes

Disable direct processes

--- src/clojure/nightcode/lein.clj
+++ src/clojure/nightcode/lein.clj
@@ -319,9 +319,7 @@
   [process in-out path]
   (stop-process! process)
   (->> (do (println (utils/get-string :running))
-         (if (should-run-directly? path)
-           (start-process-directly! process path run-project-task)
-           (start-process-indirectly! process path class-name "run")))
+         (start-process-indirectly! process path class-name "run"))
        (start-thread! in-out)))

 (defn run-repl-project!


used heap is calculated free minus max

used heap is calculated free minus max

--- src/ontrail/system.clj
+++ src/ontrail/system.clj
@@ -7,7 +7,7 @@
   (format "%.0f min" (/ (.getUptime (ManagementFactory/getRuntimeMXBean)) 60000.0)))

 (defn get-used-heap[]
-  (format "%.0fM" (/ (.freeMemory (Runtime/getRuntime)) (* 1024 1024.0))))
+  (format "%.0fM" (/ (- (.maxMemory (Runtime/getRuntime)) (.freeMemory (Runtime/getRuntime))) (* 1024 1024.0))))

 (defn get-max-heap[]
   (format "%.0fM" (/ (.maxMemory (Runtime/getRuntime)) (* 1024 1024.0))))


Add error handling when no parent is available

--- src/discuss/integration.cljs
+++ src/discuss/integration.cljs
@@ -68,14 +68,14 @@
         ref-url   (:url ref)
         doms-raw  (.getElementsByTagName js/document "*")
         doms      (minify-doms doms-raw)
-        parent    (get-parent doms ref-text)
-        dom-parts (string/split (.-innerHTML parent) (re-pattern ref-text))]
+        parent    (get-parent doms ref-text)]
     (when parent
-      (om/root discuss.views/reference-view {:text     ref-text
-                                             :url      ref-url
-                                             :dom-pre  (first dom-parts)
-                                             :dom-post (last dom-parts)}
-               {:target parent}))))
+      (let [dom-parts (string/split (.-innerHTML parent) (re-pattern ref-text))]
+        (om/root discuss.views/reference-view {:text     ref-text
+                                               :url      ref-url
+                                               :dom-pre  (first dom-parts)
+                                               :dom-post (last dom-parts)}
+                 {:target parent})))))

 (defn process-references
   "Receives references through the API and prepares them for the next steps."
@@ -90,5 +90,4 @@
   [text url]
   (com/ajax-get url)
   (sidebar/show!)
-  (lib/update-state-item! :layout :reference (fn [_] text))
-  )+  (lib/update-state-item! :layout :reference (fn [_] text)))


Check if selection has changed before changing the atom

--- src/discuss/integration.cljs
+++ src/discuss/integration.cljs
@@ -5,16 +5,17 @@
             [discuss.lib :as lib]
             [discuss.extensions]))

-(defn selected-text []
-  (let [selection (str (.getSelection js/window))]
-    (when (> (count selection) 0)
-      (lib/update-state-item! :user :selection (fn [_] selection))
-      (lib/log selection))))
-
 (defn get-selection
   "Return the stored selection of the user."
   []
   (get-in @lib/app-state [:user :selection]))
+
+(defn selected-text []
+  (let [selection (str (.getSelection js/window))]
+    (when (and (> (count selection) 0)
+               (not= selection (get-selection)))
+      (lib/update-state-item! :user :selection (fn [_] selection))
+      (lib/log selection))))

 (defn listen [el type]
   (let [out (chan)]


Add support for Reply-To

Add support for Reply-To

--- src/postal/message.clj
+++ src/postal/message.clj
@@ -24,6 +24,11 @@
   ([addr name-str]
      (try (InternetAddress. addr name-str)
           (catch Exception _))))
+
+(defn make-addresses [addresses]
+  (if (string? addresses)
+    (recur [addresses])
+    (into-array InternetAddress (map make-address addresses))))

 (defn message->str [msg]
   (with-open [out (java.io.ByteArrayOutputStream.)]
@@ -97,7 +102,7 @@
                          (Session/getInstance props)))]
        (make-jmessage msg session)))
   ([msg session]
-     (let [standard [:from :to :cc :bcc :date :subject :body]
+     (let [standard [:from :reply-to :to :cc :bcc :date :subject :body]
            jmsg (MimeMessage. session)]
        (doto jmsg
          (add-recipients! Message$RecipientType/TO (:to msg))
@@ -106,6 +111,8 @@
          (.setFrom (if-let [sender (:sender msg)]
                      (make-address (:from msg) sender)
                      (make-address (:from msg))))
+         (.setReplyTo (when-let [reply-to (:reply-to msg)]
+                        (make-addresses reply-to)))
          (.setSubject (:subject msg))
          (.setSentDate (or (:date msg) (make-date)))
          (add-extra! (drop-keys msg standard))


model functions should not return responses - decouple this responsibility

--- src/granger/models/books.clj
+++ src/granger/models/books.clj
@@ -39,12 +39,12 @@
   "Returns book review for a given ISBN"
   [isbn]
   (mongo/with-mongo conn
-    (response (mongo/fetch-one :test
-                               :as :json
-                               :where {:isbn isbn}))))
+    (mongo/fetch-one :test
+                     :as :json
+                     :where {:isbn isbn})))

 (defn find-books
   "Returns a collection of book reviews"
   []
   (mongo/with-mongo conn
-    (response (mongo/fetch :test :as :json))))+    (mongo/fetch :test :as :json)))


Functions to render help page, database stat page, and export DB page

--- src/hurvinek/html_renderer.clj
+++ src/hurvinek/html_renderer.clj
@@ -89,6 +89,57 @@
         ] ; </body>
     ))

+(defn render-help-page
+    "Render help page for this application."
+    [url-prefix title]
+    (page/xhtml
+        (render-html-header url-prefix title)
+        [:body
+            [:div {:class "container"}
+                (render-navigation-bar-section url-prefix title)
+                (render-breadcrumb url-prefix)
+                [:div {:class "container-fluid"}
+                    [:h2 "Help"]
+                ]
+                (render-html-footer)
+            ] ; </div class="container">
+        ] ; </body>
+    ))
+
+(defn render-database-statistic-page
+    "Render database statistic."
+    [url-prefix title]
+    (page/xhtml
+        (render-html-header url-prefix title)
+        [:body
+            [:div {:class "container"}
+                (render-navigation-bar-section url-prefix title)
+                (render-breadcrumb url-prefix)
+                [:div {:class "container-fluid"}
+                    [:h2 "Database statistic"]
+                ]
+                (render-html-footer)
+            ] ; </div class="container">
+        ] ; </body>
+    ))
+
+(defn render-export-database-page
+    "Render menu with database export options."
+    [url-prefix title]
+    (page/xhtml
+        (render-html-header url-prefix title)
+        [:body
+            [:div {:class "container"}
+                (render-navigation-bar-section url-prefix title)
+                (render-breadcrumb url-prefix)
+                [:div {:class "container-fluid"}
+                    [:h2 "Export database"]
+                ]
+                (render-html-footer)
+            ] ; </div class="container">
+        ] ; </body>
+    ))
+
 (defn render-product-list
     "Render product list."
     [url-prefix title product-list]


Use thi.ng color and svg.js to render identikons

--- src/identikon_cljs/core.cljs
+++ src/identikon_cljs/core.cljs
@@ -1,24 +1,14 @@
 (ns identikon-cljs.core
   (:require
    [cljs-hash.goog :as gh]
-   [cljsjs.snapsvg]
+   [thi.ng.color.core :as col]
    [cljsjs.svgjs]))

 (enable-console-print!)

-;; define your app data so that it doesn't get over-written on reload
-
-(defn on-js-reload []
-  ;; optionally touch your app-state to force rerendering depending on
-  ;; your application
-  ;; (swap! app-state update-in [:__figwheel_counter] inc)
-  )
-
 (defn log-str
   ([x]   (do (.log js/console (pr-str x)) x))
   ([m x] (do (log-str {:msg m :data x})   x)))
-
-(log-str "hi" js/SVG)

 (defn sha1 [str]
   (gh/sha1-hex str))
@@ -31,22 +21,23 @@

 (defn create-mirror [l]
   "Create a list of ints, break into chunks of 5 and convert those into mirrored chunks so that [0 1 2 3 4] becomes [0 1 2 1 0] and then flatten it all back out"
-  (let [h (take 15 l)
-        t (reverse (take 10 l))
-        f (partition 5 (flatten (cons h t)))
+  (let [t (reverse (take 5 l))
+        f (partition 5 (flatten (cons l t)))
         m (map #(flatten (cons (take 3 %) (reverse (take 2 %)))) f)]
     (flatten m)))

 (defn convert-string [s]
+  "Turn the hash string into a collections of integers (0-255)"
   (-> s
       sha1
       to-pairs
       to-ints))

 (defn get-svg [id]
+  "SVG.js converts an SVG to 100% x 100% on grabbing the DOM element so we force it back to its original dimensions and pass them back with the element"
   (let [d (.getElementById js/document id)
-        w (.getAttribute d "width")
-        h (.getAttribute d "height")
+        w (js/parseInt (.getAttribute d "width") 10)
+        h (js/parseInt (.getAttribute d "height") 10)
         p (js/SVG id)]
     (.spof p)
     (.attr p "width" w)
@@ -63,13 +54,15 @@
   (sort (mapv #(Math/floor (* 1.411 %)) l))) ;; convert 0-255 to 0-360

 (defn find-hues [ints]
-  (let [remains (drop 15 ints)]
-    (vector (first remains) (last remains))))
+  "Add up the first 3 and last 3 integers of the last 5 to generate a start and end range for the hues (0-255)"
+  (let [remains (drop 15 ints)
+        h (take 3 remains)
+        t (drop 2 remains)]
+    (vector (mod (apply + h) 255) (mod (apply + t) 255))))

 (defn get-svg-attrs [p]
-  "Extract a bunch of attributes from the SVG object and calculate the x,y positions
-for all the circles and their radii"
-  (let [{svg :svg rwidth :w rheight :h} p
+  "Use the width and height of the SVG object to calculate the x,y positions for all the circles and their radii"
+  (let [{svg :svg rwidth :width rheight :height} p
         attr (.attr svg)
         amt 5
         total (* amt amt)
@@ -78,7 +71,7 @@
         xoffset (/ (* rwidth .1) 2) ; amount to offset the dots on x/y
         roffset (/ (* width .1) 12)
         cwidth (Math/floor (/ width amt)) ; circle width
-        crad (- (/ cwidth 2) roffset) ; circle radius
+        crad (- (* cwidth .85) roffset) ; circle radius
         cxs (mapv #(* cwidth %)
                   (drop 1 (take (+ 1 amt) (range)))) ; vector of x coords
         ]
@@ -94,33 +87,39 @@
                   [y x])
      }))

+(defn make-hsla [hue]
+  "Create a string hex color from a hue, ex: #ff0000"
+  (let [hsla (clojure.string/replace "hsla(_,80%,50%,1)" #"_" (str hue))]
+    @(-> hsla col/css col/as-int24 col/as-css)))
+
 (defn make-circle-zero [p triple xoff roff cr]
   "Large solid circle"
   (let [[x y hue] triple
         c (.circle p (- cr roff))
-        hue (js/Snap.hsl hue 80 50)]
+        hsla (make-hsla hue)]
     (.attr c (clj->js {:cx (- (+ xoff x) cr)
                        :cy (- (+ xoff y) cr)
-                       :fill hue}))))
+                       :fill hsla}))))

 (defn make-circle-one [p triple xoff roff cr]
   "Ring"
   (let [[x y hue] triple
         c (.circle p (- (- cr (/ cr 4)) roff))
-        hue (js/Snap.hsl hue 80 50)]
-    (log-str #js [p c])
+        hsla (make-hsla hue)]
     (.attr c (clj->js {:cx (- (+ xoff x) cr)
                        :cy (- (+ xoff y) cr)
-                       :fill hue}))))
+                       :fill "#fff"
+                       :stroke-width (/ cr 4)
+                       :stroke hsla}))))

 (defn make-circle-two [p triple xoff roff cr]
   "Small solid circle"
   (let [[x y hue] triple
         c (.circle p (- (- cr (/ cr 3)) roff))
-        hue (js/Snap.hsl hue 80 50)]
+        hsla (make-hsla hue)]
     (.attr c (clj->js {:cx (- (+ xoff x) cr)
                        :cy (- (+ xoff y) cr)
-                       :fill hue}))))
+                       :fill hsla}))))

 (defn make-identikon [p ints hues]
   "Determine which circle to show by converting the int to mod 3"


Still trying to figure out how codex allows for code fragments in markdown docstrings

--- src/re_frame/core.cljc
+++ src/re_frame/core.cljc
@@ -93,7 +93,7 @@
   two are really just sugary variations.

   1. No input signals given:
-      ```clj
+     ```clj
      (reg-sub
        :query-id
        a-computation-fn)   ;; has signature:  (fn [db query-vec]  ... ret-value)
@@ -124,32 +124,33 @@
      the structure returned by the `signal-fn`).

      This example `signal-fn` returns a vector of input signals.
-       ```clj
+     ```clj
        (fn [query-vec dynamic-vec]
          [(subscribe [:a-sub])
           (subscribe [:b-sub])])
-       ```
+      ```
+
      The associated computation function must be written
      to expect a vector of values for its first argument:
-       ```clj
-       (fn [[a b] query-vec]     ;; 1st argument is a seq of two values
-         ....)
-        ```
+     ```clj
+     (fn [[a b] query-vec]     ;; 1st argument is a seq of two values
+       ....)
+     ```

      If, on the other hand, the signal function was simpler and returned a singleton, like this:
-        ```clj
-        (fn [query-vec dynamic-vec]
-          (subscribe [:a-sub]))
-        ```
+     ```clj
+     (fn [query-vec dynamic-vec]
+       (subscribe [:a-sub]))
+     ```
      then the associated computation function must be written to expect a single value
      as the 1st argument:
-        ```clj
-        (fn [a query-vec]       ;; 1st argument is a single value
-          ...)
-        ```
+     ```clj
+       (fn [a query-vec]       ;; 1st argument is a single value
+         ...)
+      ```

      Further Note: variation #1 above, in which an `input-fn` was not supplied, like this:
-       ```clj
+     ```clj
      (reg-sub
        :query-id
        a-computation-fn)   ;; has signature:  (fn [db query-vec]  ... ret-value)
@@ -164,7 +165,6 @@
      ```

   3. Syntax Sugar
-
      ```clj
      (reg-sub
        :a-b-sub
@@ -188,8 +188,8 @@
          ...))
      ```

-  For further understanding, read `/docs`, and look at the detailed comments in
-  /examples/todomvc/src/subs.cljs
+    For further understanding, read the tutorials, and look at the detailed comments in
+    /examples/todomvc/src/subs.cljs
   "
   [query-id & args]
   (apply subs/reg-sub (into [query-id] args)))
@@ -341,8 +341,8 @@

    This `coeffect handler` is expected to modify and return its first, `coeffects` argument.

-   Example Of how `inject-cofx` and `reg-cofx` work together
-   ---------------------------------------------------------
+   ## Example of `inject-cofx` and `reg-cofx` working together
+

    1. Early in app startup, you register a `coeffect handler` for `:datetime`:

@@ -361,8 +361,7 @@
            [coeffect event]
            ... in here can access (:now coeffect) to obtain current datetime ... )))

-   Background
-   ----------
+   ## Background

    `coeffects` are the input resources required by an event handler
    to perform its job. The two most obvious ones are `db` and `event`.
@@ -450,13 +449,12 @@

 ;; -- interceptors ------------------------------------------------------------

-;; Standard interceptors.
-;; Detailed docs on each in std-interceptors.cljs
 (def debug
   "An interceptor which logs/instruments an event handler's actions to
   `js/console.debug`. See examples/todomvc/src/events.cljs for use.

   Output includes:
+
   1. the event vector
   2. a `clojure.data/diff` of db, before vs after, which shows
      the changes caused by the event handler. To understand the output,
@@ -567,7 +565,7 @@
         [... trim-v ...]
         (fn [db [x y z]]    ;; <-- instead of [_ x y z]
           ...)
-     ```
+
     "
   std-interceptors/trim-v)

@@ -623,12 +621,12 @@

 (defn reg-global-interceptor
-  "Registers `interceptor` as a global interceptor. Global interceptors are
-   included in the processing of every event.
+  "Registers the given `interceptor` as a global interceptor. Global interceptors are
+   included in the processing chain of every event.

    When you register an event handler you have the option of supplying an
    interceptor chain. Any global interceptors you register are effectively
-   prepending to this chain.
+   prepending to this chain.

    Global interceptors are run in the order that they are registered."
   [interceptor]
@@ -657,6 +655,7 @@

    Example use:

+   ```clj
    (def my-interceptor
      (->interceptor
        :id     :my-interceptor
@@ -666,6 +665,7 @@
        :after  (fn [context]                         ;; you normally want to change :effects
                  (let [db (get-effect context :db)]  ;; (get-in context [:effects :db])
                    (assoc-effect context :http-ajax {...}])))))
+   ```

    "
   [& {:as m :keys [id before after]}]