Fix method name in diff ns (diff* -> diff)

--- src/clj/seria/diff.cljc
+++ src/clj/seria/diff.cljc
@@ -32,32 +32,32 @@
     (custom? schema)   :custom
     :else              :non-diffable))

-(defmulti diff* diff-dispatch)
+(defmulti diff diff-dispatch)

-(defmethod diff* :vector [[_ _ inner-schema :as schema] value-1 value-2]
+(defmethod diff :vector [[_ _ inner-schema :as schema] value-1 value-2]
   (let [index         (gensym "index_")
         inner-value-1 (gensym "inner-value-1_")
         inner-value-2 (gensym "inner-value-2_")]
     (->> `(vec (map-indexed (fn [~index ~inner-value-2]
                               (if-let [~inner-value-1 (get ~value-1 ~index)]
-                                ~(diff* inner-schema inner-value-1 inner-value-2)
+                                ~(diff inner-schema inner-value-1 inner-value-2)
                                 ~inner-value-2))
                             ~value-2))
          (decorate-common schema value-1 value-2))))

-(defmethod diff* :map [[_ {:keys [sorted-by]} _ val-schema :as schema] value-1 value-2]
+(defmethod diff :map [[_ {:keys [sorted-by]} _ val-schema :as schema] value-1 value-2]
   (let [key    (gensym "key_")
         val-1  (gensym "val-1_")
         val-2  (gensym "val-2_")]
     (->> `(map (fn [[~key ~val-2]]
                  [~key (if-let [~val-1 (get ~value-1 ~key)]
-                         ~(diff* val-schema val-1 val-2)
+                         ~(diff val-schema val-1 val-2)
                          ~val-2)])
                ~value-2)
          (decorate-map sorted-by)
          (decorate-common schema value-1 value-2))))

-(defmethod diff* :tuple [[_ {:keys [diff]} :as schema] value-1 value-2]
+(defmethod diff :tuple [[_ {:keys [diff]} :as schema] value-1 value-2]
   (let [disjoined-2 (disj-indexed schema value-2)]
     (->> `(let [~@(mapcat (juxt :symbol :inner-value) disjoined-2)]
             ~(mapv (fn [{index :index inner-schema :inner-schema inner-value-2 :symbol}]
@@ -65,11 +65,11 @@
                        inner-value-2
                        (let [inner-value-1 (gensym "inner-value-1_")]
                          `(let [~inner-value-1 (get ~value-1 ~index)]
-                            ~(diff* inner-schema inner-value-1 inner-value-2)))))
+                            ~(diff inner-schema inner-value-1 inner-value-2)))))
                    disjoined-2))
          (decorate-common schema value-1 value-2))))

-(defmethod diff* :record [schema value-1 value-2]
+(defmethod diff :record [schema value-1 value-2]
   (let [[_ {:keys [constructor diff]} :as schema] (expand-record schema (:schemas *config*))
         disjoined-2 (disj-indexed schema value-2)]
     (->> `(let [~@(mapcat (juxt :symbol :inner-value) disjoined-2)]
@@ -79,17 +79,17 @@
                                   inner-value-2
                                   (let [inner-value-1 (gensym "inner-value-1_")]
                                     `(let [~inner-value-1 (get ~value-1 ~index)]
-                                       ~(diff* inner-schema inner-value-1 inner-value-2))))]))
+                                       ~(diff inner-schema inner-value-1 inner-value-2))))]))
                   (into {})))
          (decorate-constructor constructor)
          (decorate-common schema value-1 value-2))))

-(defmethod diff* :optional [[_ _ inner-schema] value-1 value-2]
+(defmethod diff :optional [[_ _ inner-schema] value-1 value-2]
   `(if (and ~value-1 ~value-2)
-     ~(diff* inner-schema value-1 value-2)
+     ~(diff inner-schema value-1 value-2)
      ~value-2))

-(defmethod diff* :multi [[_ {:keys [diff]} selector multi-cases] value-1 value-2]
+(defmethod diff :multi [[_ {:keys [diff]} selector multi-cases] value-1 value-2]
   (let [selector-fn (gensym "selector-fn_")
         case-1      (gensym "case-1_")
         case-2      (gensym "case-2_")]
@@ -102,20 +102,20 @@
            ~@(mapcat (fn [[multi-case schema]]
                        [multi-case (if-not (traceable-index? multi-case diff)
                                      value-2
-                                     (diff* schema value-1 value-2))])
+                                     (diff schema value-1 value-2))])
                      multi-cases))))))

-(defmethod diff* :custom [schema value-1 value-2]
+(defmethod diff :custom [schema value-1 value-2]
   `(~(runtime-processor schema *direction*) ~value-1 ~value-2 ~'config))

-(defmethod diff* :non-diffable [schema value-1 value-2]
+(defmethod diff :non-diffable [schema value-1 value-2]
   (decorate-common schema value-1 value-2 value-2))

 (defn make-common [schema config direction]
   (binding [*config*    config
             *direction* direction]
     `(fn [~'value-1 ~'value-2 ~'config]
-       ~(diff* schema 'value-1 'value-2))))
+       ~(diff schema 'value-1 'value-2))))

 (defn make-differ [schema config]
   (make-common schema config :differ))


Added rand and rand-int.

Added rand and rand-int.

--- src/cljs/cljs/core.cljs
+++ src/cljs/cljs/core.cljs
@@ -800,19 +800,34 @@

 (defn- fix [q]
   (if (>= q 0)
-    (js* "(Math.floor(~{q}))")
-    (js* "(Math.ceil(~{q}))")))
-
-(defn mod [n d]
+    (Math/floor q)
+    (Math/ceil q)))
+
+(defn mod
+  "Modulus of num and div. Truncates toward negative infinity."
+  [n d]
   (js* "(~{n} % ~{d})"))

-(defn quot [n d]
+(defn quot
+  "quot[ient] of dividing numerator by denominator."
+  [n d]
   (let [rem (mod n d)]
     (fix (js* "((~{n} - ~{rem}) / ~{d})"))))

-(defn rem [n d]
+(defn rem
+  "remainder of dividing numerator by denominator."
+  [n d]
   (let [q (quot n d)]
     (js* "(~{n} - (~{d} * ~{q}))")))
+
+(defn rand
+  "Returns a random floating point number between 0 (inclusive) and n (default 1) (exclusive)."
+  ([]  (Math/random))
+  ([n] (* n (rand))))
+
+(defn rand-int
+  "Returns a random integer between 0 (inclusive) and n (exclusive)."
+  [n] (fix (rand n)))

 (defn bit-xor
   "Bitwise exclusive or"


Removing extra div's from login page

Removing extra div's from login page

--- src/cljs/ohds/core.cljs
+++ src/cljs/ohds/core.cljs
@@ -42,19 +42,17 @@
         password (atom "Password")]
     (swap! app-state assoc :fieldworker-id nil :location-id nil :individual-id nil)
     (fn []
-      [:div
-       [:div
-        [:div
-         [:h2 {:class "form-signin-heading"} "Please log in"]
-         [:div
-          [:label {:for "username"} "Username"] [atom-input username "username"]]
-         [:div
-          [:label {:for "password"} "Password"] [atom-input-password password "password"]]
-         [:div {:class "checkbox"}]
-         [:div
-          [:button {:class "btn btn-lg btn-primary btn-block" :type "submit"
-                    :on-click (fn [] (do-login username password))}
-           "Login"]]]]])))
+      [:div {:class "form-signin"}
+       [:h2 {:class "form-signin-heading"} "Please log in"]
+       [:div
+        [:label {:for "username"} "Username"] [c/atom-input username "username"]]
+       [:div
+        [:label {:for "password"} "Password"] [c/atom-input-password password "password"]]
+       [:div {:class "checkbox"}]
+       [:div
+        [:button {:class "btn btn-lg btn-primary btn-block" :type "submit"
+                  :on-click (fn [] (do-login username password))}
+         "Login"]]])))

 (defn location-page []
   [:div "locations"])


Add support of Calculation functions.

Add support of Calculation functions.

--- src/cljx/quil/core.cljx
+++ src/cljx/quil/core.cljx
@@ -200,7 +200,7 @@
   [n]
   (PApplet/abs (float n)))

-#+clj
+
 (defn
   ^{:requires-bindings false
     :processing-name "abs()"
@@ -212,9 +212,12 @@
   absolute value of a number is always positive. Dynamically casts to
   an int or float appropriately"
     [n]
+    #+clj
     (if (int-like? n)
       (abs-int n)
-      (abs-float n)))
+      (abs-float n))
+    #+cljs
+    (.abs (current-applet) n))

 #+clj
 (defn
@@ -891,7 +894,6 @@
               (float centerX) (float centerY) (float centerZ)
               (float upX) (float upY) (float upZ))))

-#+clj
 (defn
   ^{:requires-bindings false
     :processing-name "ceil()"
@@ -903,7 +905,8 @@
   the value of the parameter. For example, (ceil 9.03) returns the
   value 10."
   [n]
-  (PApplet/ceil (float n)))
+  #+clj (PApplet/ceil (float n))
+  #+cljs (.ceil (current-applet) n))

 (defn
   ^{:requires-bindings true
@@ -982,7 +985,7 @@
   [amt low high]
   (PApplet/constrain (int amt) (int low) (int high)))

-#+clj
+
 (defn
   ^{:requires-bindings false
     :processing-name "constrain()"
@@ -992,9 +995,11 @@
   constrain
   "Constrains a value to not exceed a maximum and minimum value."
   [amt low high]
+  #+clj
   (if (int-like? amt)
     (constrain-int amt low high)
-    (constrain-float amt low high)))
+    (constrain-float amt low high))
+  #+cljs (.constrain (current-applet) amt low high))

 #+clj
 (defn
@@ -1383,7 +1388,6 @@
   (.directionalLight (current-graphics) (float r) (float g) (float b)
                      (float nx) (float ny) (float nz)))

-#+clj
 (defn
   ^{:requires-bindings false
     :processing-name "dist()"
@@ -1392,9 +1396,12 @@
     :added "1.0"}
   dist
   "Calculates the distance between two points"
-  ([x1 y1 x2 y2] (PApplet/dist (float x1) (float y1) (float x2) (float y2)))
-  ([x1 y1 z1 x2 y2 z2] (PApplet/dist (float x1) (float y1) (float z1)
-                               (float x2) (float y2) (float z2))))
+  ([x1 y1 x2 y2]
+    #+clj (PApplet/dist (float x1) (float y1) (float x2) (float y2))
+    #+cljs (.dist (current-applet) x1 y1 x2 y2))
+  ([x1 y1 z1 x2 y2 z2]
+    #+clj (PApplet/dist (float x1) (float y1) (float z1) (float x2) (float y2) (float z2))
+    #+cljs (.dist (current-applet) x1 y1 z1 x2 y2 z2)))

 (defn
   ^{:requires-bindings true
@@ -1552,7 +1559,6 @@
   #+clj (applet-close (current-applet))
   #+cljs (.exit (current-applet)))

-#+clj
 (defn
   ^{:requires-bindings false
     :processing-name "exp()"
@@ -1563,7 +1569,8 @@
   "Returns Euler's number e (2.71828...) raised to the power of the
   value parameter."
   [val]
-  (PApplet/exp (float val)))
+  #+clj (PApplet/exp (float val))
+  #+cljs (.exp (current-applet) val))

 (defn
   ^{:requires-bindings true
@@ -1660,7 +1667,6 @@
   Filters the display window with given shader (only in :p2d and :p3d modes)."
   [^PShader shader-obj] (.filter (current-graphics) shader-obj))

-#+clj
 (defn
   ^{:requires-bindings false
     :processing-name "floor()"
@@ -1671,7 +1677,8 @@
   "Calculates the closest int value that is less than or equal to the valu  e of the parameter. For example, (floor 9.03) returns the
   value 9."
   [n]
-  (PApplet/floor (float n)))
+  #+clj (PApplet/floor (float n))
+  #+cljs (.floor (current-applet) n))

 #+clj
 (defn
@@ -2072,7 +2079,6 @@
   [c1 c2 amt]
   (.lerpColor (current-graphics) (int c1) (int c2) (float amt)))

-#+clj
 (defn
   ^{:requires-bindings false
     :processing-name "lerp()"
@@ -2087,7 +2093,8 @@
   is convenient for creating motion along a straight path and for
   drawing dotted lines."
   [start stop amt]
-  (PApplet/lerp (float start) (float stop) (float amt)))
+  #+clj (PApplet/lerp (float start) (float stop) (float amt))
+  #+cljs (.lerp (current-applet) start stop amt))

 (defn
   ^{:requires-bindings true
@@ -2233,7 +2240,6 @@
   [filename]
   (.loadShape (current-applet) filename))

-#+clj
 (defn
   ^{:requires-bindings false
     :processing-name "log()"
@@ -2244,9 +2250,9 @@
   "Calculates the natural logarithm (the base-e logarithm) of a
   number. This function expects the values greater than 0.0."
   [val]
-  (PApplet/log (float val)))
-
-#+clj
+  #+clj (PApplet/log (float val))
+  #+cljs (.log (current-applet) val))
+
 (defn
   ^{:requires-bindings false
     :processing-name "mag()"
@@ -2259,10 +2265,13 @@
   algebra. Because it has no start position, the magnitude of a vector
   can be thought of as the distance from coordinate (0,0) to its (x,y)
   value. Therefore, mag is a shortcut for writing (dist 0 0 x y)."
-  ([a b] (PApplet/mag (float a) (float b)))
-  ([a b c] (PApplet/mag (float a) (float b) (float c))))
-
-#+clj
+  ([a b]
+    #+clj (PApplet/mag (float a) (float b))
+    #+cljs (.mag (current-applet) a b))
+  ([a b c]
+    #+clj (PApplet/mag (float a) (float b) (float c))
+    #+cljs (.mag (current-applet) a b c)))
+
 (defn
   ^{:requires-bindings false
     :processing-name "map()"
@@ -2275,7 +2284,8 @@
   Numbers outside the range are not clamped to 0 and 1, because
   out-of-range values are often intentional and useful."
   [val low1 high1 low2 high2]
-  (PApplet/map (float val) (float low1) (float high1) (float low2) (float high2)))
+  #+clj (PApplet/map (float val) (float low1) (float high1) (float low2) (float high2))
+  #+cljs (.map (current-applet) val low1 high1 low2 high2))

 #+clj
 (defn
@@ -2586,7 +2596,6 @@
   []
   (.noLoop (current-applet)))

-#+clj
 (defn
   ^{:requires-bindings true
     :processing-name "norm()"
@@ -2596,7 +2605,8 @@
   norm
   "Normalize a value to exist between 0 and 1 (inclusive)."
   [val start stop]
-  (PApplet/norm (float val) (float start) (float stop)))
+  #+clj (PApplet/norm (float val) (float start) (float stop))
+  #+cljs (.norm (current-applet) val start stop))

 (defn
   ^{:requires-bindings true
@@ -2798,7 +2808,6 @@
   []
   (.popStyle (current-graphics)))

-#+clj
 (defn
   ^{:requires-bindings false
     :processing-name "pow()"
@@ -2812,7 +2821,8 @@
   equivalent to the expression (* 3 3 3 3 3) and (pow 3 -5) is
   equivalent to (/ 1 (* 3 3 3 3 3))."
   [num exponent]
-  (PApplet/pow (float num) (float exponent)))
+  #+clj (PApplet/pow (float num) (float exponent))
+  #+cljs (.pow (current-applet) num exponent))

 (defn
   ^{:requires-bindings true
@@ -3244,7 +3254,6 @@
   [angle]
   (.rotateZ (current-graphics) (float angle)))

-#+clj
 (defn
   ^{:requires-bindings false
     :processing-name "round()"
@@ -3255,7 +3264,8 @@
   "Calculates the integer closest to the value parameter. For example,
   (round 9.2) returns the value 9."
   [val]
-  (PApplet/round (float val)))
+  #+clj (PApplet/round (float val))
+  #+cljs (.round (current-applet) val))

 (defn
   ^{:requires-bindings true
@@ -3699,7 +3709,6 @@
   ([[r g b] [x y z] [nx ny nz] angle concentration]
      (.spotLight (current-graphics) r g b x y z nx ny nz angle concentration)))

-#+clj
 (defn
   ^{:requires-bindings false
     :processing-name "sq()"
@@ -3711,9 +3720,9 @@
   always a positive number, as multiplying two negative numbers always
   yields a positive result. For example, -1 * -1 = 1."
   [a]
-  (PApplet/sq (float a)))
-
-#+clj
+  #+clj (PApplet/sq (float a))
+  #+cljs (.sq (current-applet) a))
+
 (defn
   ^{:requires-bindings false
     :processing-name "sqrt()"
@@ -3726,7 +3735,8 @@
   root. The square root s of number a is such that (= a (* s s)) . It
   is the opposite of squaring."
   [a]
-  (PApplet/sqrt (float a)))
+  #+clj (PApplet/sqrt (float a))
+  #+cljs (.sqrt (current-applet) a))

 (defn
   ^{:requires-bindings true


edit curve-vertex doc-string

edit curve-vertex doc-string

--- src/cljx/quil/core.cljx
+++ src/cljx/quil/core.cljx
@@ -1371,12 +1371,12 @@
   curve-vertex
   "Specifies vertex coordinates for curves. This function may only be
   used between begin-shape and end-shape and only when there is no
-  mode keyword specified to begin-hape. The first and last points in a
+  mode keyword specified to begin-shape. The first and last points in a
   series of curve-vertex lines will be used to guide the beginning and
   end of a the curve. A minimum of four points is required to draw a
   tiny curve between the second and third points. Adding a fifth point
-  with curveVertex will draw the curve between the second, third, and
-  fourth points. The curveVertex function is an implementation of
+  with curve-vertex will draw the curve between the second, third, and
+  fourth points. The curve-vertex function is an implementation of
   Catmull-Rom splines."
   ([x y] (.curveVertex (current-graphics) (float x) (float y)))
   ([x y z] (.curveVertex (current-graphics) (float x) (float y) (float z))))


Test for null before calling the doc function

--- src/clojurebot/core.clj
+++ src/clojurebot/core.clj
@@ -85,10 +85,12 @@
 (reg-command
  "doc"
  (fn [sym-name]
-   (->> (symbol sym-name)
+   (if (nil? sym-name)
+    (println "ERROR: Unrecognised command")
+    (->> (symbol sym-name)
         (resolve)
         (meta)
-        (:doc))))
+        (:doc)))))

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; Entry point


Test conform instruction

Test conform instruction

Fixes #1310

--- assignments/clojure/rna-transcription/rna_transcription_test.clj
+++ assignments/clojure/rna-transcription/rna_transcription_test.clj
@@ -2,19 +2,19 @@
 (load-file "dna.clj")

 (deftest transcribes-cytidine-unchanged
-  (is (= "C" (dna/to-rna "C"))))
+  (is (= "G" (dna/to-rna "C"))))

 (deftest transcribes-guanosine-unchanged
-  (is (= "G" (dna/to-rna "G"))))
+  (is (= "C" (dna/to-rna "G"))))

 (deftest transcribes-adenosine-unchanged
-  (is (= "A" (dna/to-rna "A"))))
+  (is (= "U" (dna/to-rna "A"))))

 (deftest it-transcribes-thymidine-to-uracil
-  (is (= "U" (dna/to-rna "T"))))
+  (is (= "A" (dna/to-rna "T"))))

 (deftest it-transcribes-all-occurrences-of-thymidine-to-uracil
-  (is (= "ACGUGGUCUUAA" (dna/to-rna "ACGTGGTCTTAA"))))
+  (is (= "UGCACCAGAAUU" (dna/to-rna "ACGTGGTCTTAA"))))

 (deftest it-validates-dna-strands
   (is (thrown? AssertionError (dna/to-rna "XCGFGGTDTTAA"))))


Remove reference to dead namespace.

Remove reference to dead namespace.

--- src/kolmogorov_music/coding.clj
+++ src/kolmogorov_music/coding.clj
@@ -3,8 +3,7 @@
             [leipzig.scale :as scale]
             [leipzig.live :as live]
             [leipzig.chord :as chord]
-            [leipzig.temperament :as temperament]
-            [kolmogorov-music.instrument :as instrument]))
+            [leipzig.temperament :as temperament]))

 (defn least [[x & xs :as v]]
   (if (= x (apply min v))


Theme checkbox and panel components

Theme checkbox and panel components

--- src/zaffre/components/ui.cljc
+++ src/zaffre/components/ui.cljc
@@ -132,7 +132,8 @@
                 cursor-char-off
                 cursor-fg
                 cursor-bg]} (get props :style)
-        cursor (if (and focused show-cursor) cursor-char-on (if selected "x" " "))]
+        cursor (if (and focused show-cursor) (str cursor-char-on) (if selected :ref/checkbox-checked :ref/checkbox-unchecked))
+        color (if selected :ref/secondary :ref/on-surface)]
      (g/use-effect (fn []
        (go-loop []
          (<! (timeout 400))
@@ -140,7 +141,13 @@
          (recur))) [])

     [:view props
-      (cons [:text {:key "Checkbox-text"} (str "[" cursor "]")]
+      (concat
+        [[:text {:key "checkbox-left" :style {:content :ref/checkbox-left
+                                           :color :ref/on-surface}} ""]
+         [:text {:key "checkbox-check" :style {:content cursor
+                                           :color color}} ""]
+         [:text {:key "checkbox-right" :style {:content :ref/checkbox-right
+                                           :color :ref/on-surface}} ""]]
         children)]))

 (g/defcomponent Radio
@@ -175,7 +182,8 @@
                 cursor-char-off
                 cursor-fg
                 cursor-bg]} (get props :style)
-        cursor (if (and focused show-cursor) (str cursor-char-on) (if selected :ref/radio-checked :ref/radio-unchecked))]
+        cursor (if (and focused show-cursor) (str cursor-char-on) (if selected :ref/radio-checked :ref/radio-unchecked))
+        color (if selected :ref/secondary :ref/on-surface)]
      (g/use-effect (fn []
        (go-loop []
          (<! (timeout 400))
@@ -187,7 +195,7 @@
         [[:text {:key "radio-left" :style {:content :ref/radio-left
                                            :color :ref/on-surface}} ""]
          [:text {:key "radio-check" :style {:content cursor
-                                           :color :ref/on-surface}} ""]
+                                           :color color}} ""]
          [:text {:key "radio-right" :style {:content :ref/radio-right
                                            :color :ref/on-surface}} ""]]
         children)]))
@@ -421,7 +429,8 @@
   (let [{:keys [title border children]} props]
     (log/info "Panel props" props)
     (log/info "Panel children" children)
-    [:view {:style {:border (or border 1)}}
+    [:view {:style {:border (or border 1)
+                    :background-color :ref/surface}}
       (cons [:text {:key "panel-title"
                     :style {:position :absolute
                             :height 1 :width (+ 2 (count title))


moving to proving groung

moving to proving groung

--- src/clj/morpheus/integration/sources/wikidata.clj
+++ src/clj/morpheus/integration/sources/wikidata.clj
@@ -229,8 +229,8 @@
   (start-server* {:server-name :morpheus
                   :port 5124
                   :zk  "10.0.1.104:2181"
-                  :trunks-size "16gb"
-                  :memory-size "16gb"
+                  :trunks-size "50gb"
+                  :memory-size "50gb"
                   ;:schema-file "configures/neb-schemas.edn"
                   :data-path   "wikidata"
                   :durability true


make supervisor log when a worker fails to start within the start timeout

--- src/clj/backtype/storm/daemon/supervisor.clj
+++ src/clj/backtype/storm/daemon/supervisor.clj
@@ -123,7 +123,9 @@
           (log-message id " still hasn't started")
           (Time/sleep 500)
           (recur)
-          ))
+          )))
+    (when-not (.get state LS-WORKER-HEARTBEAT)
+      (log-message "Worker " id " failed to start")
       )))

 (defn- wait-for-workers-launch [conf ids]


Fix some indentions

Fix some indentions

--- src/clj/collect_earth_online/db/projects.clj
+++ src/clj/collect_earth_online/db/projects.clj
@@ -183,8 +183,8 @@
                     :flaggedPlots  (:flagged_plots stats)
                     :analyzedPlots (:analyzed_plots stats)
                     :userStats     (-> (:user_stats stats)
-                                         (tc/jsonb->clj)
-                                         (set/rename-keys {:timed_plots :timedPlots}))})))
+                                       (tc/jsonb->clj)
+                                       (set/rename-keys {:timed_plots :timedPlots}))})))

 ;;;
 ;;; Create project helper functions
@@ -824,7 +824,7 @@
                                   (str/join ","
                                             (concat (map->csv (merge (-> row
                                                                          (assoc  :sample_points
-                                                                                (count samples))
+                                                                                (count samples))
                                                                          (update :collection_time format-time)
                                                                          (update :analysis_duration #(when % (str % " secs"))))
                                                                      (prefix-keys "pl_" extra-plot-info))


Trying to fix issue with block

Trying to fix issue with block

--- src/clj/jest/compiler/NativeJestCompiler.clj
+++ src/clj/jest/compiler/NativeJestCompiler.clj
@@ -67,15 +67,6 @@
     :else [obj]))

-(defn- wrap-in-do
-  [expressions]
-  (cond
-    (not (instance? List expressions)) expressions
-    (= 0 (count expressions)) (throw (new NotImplementedException))
-    (= 1 (count expressions)) (first expressions)
-    :else `(do ~@expressions)))
-
-
 ;; HELPER
 (defn merge-items
   "Takes two items and joins them as a single sequence."
@@ -114,6 +105,7 @@
 (defn -visitStatementTerm
   [this ^JestParser$StatementTermContext ctx]

+  ;; Should this always return a list?
   (cond
     (. ctx statement)   (self-visit this ctx statement)
     (. ctx functionDef) (self-visit this ctx functionDef)
@@ -350,12 +342,23 @@
   `(defn
      ~(get-symbol ctx name)
      [~@(self-visit this ctx functionDefParams)]
-     ~@(self-visit this ctx block)))
+     ~(self-visit this ctx block)))

 (defn -visitMethodDef
   [this ^JestParser$MethodDefContext ctx]
-  (throw (new NotImplementedException)))
+
+  ;
+  ;if (ctx.typeAnnotation() != null) {
+  ;                                   annotation = String.format("(t/ann %s [%s ->%s])\n",
+  ;                                                               ctx.name.getText(),
+  ;                                                               this.visitFuncTypeAnnotation(ctx.a).getSingleLine(),
+  ;                                                               this.visitTypeAnnotation(ctx.c).getSingleLine());
+  ;                                   }
+
+
+  `(~(symbol (.. ctx name getText)) [~@(self-visit this ctx functionDefParams)]
+     ~(self-visit this ctx block)))

 (defn -visitFunctionDefParams
@@ -406,20 +409,41 @@
       `(doall (map ~func ~@iterator)))))

+(defn- wrap-in-do
+  [expressions]
+  (cond
+    (not (instance? List expressions)) expressions
+    (= 0 (count expressions)) (throw (new NotImplementedException))
+    (= 1 (count expressions)) (first expressions)
+    :else `(do ~@expressions)))
+
+
 (defn -visitBlock
+  "A block doesn't return a list, it only returns a single expression.
+  However, if there are multiple expressions coming from that block,
+  it wraps them in a do expression"
   [this ^JestParser$BlockContext ctx]

-  (wrap-in-do
-    (cond
-      (. ctx expression) (self-visit this ctx expression)
-
-      ;;(. ctx term) (into [] (map #(.. this (visitStatementTerm %)) (. ctx term)))
-
-      (. ctx term) (map #(.. this (visitStatementTerm %)) (. ctx term))
-
-      (. ctx scope) (map #(.. this (visitVarScope %)) (. ctx scope))
-
-      :else (throw (new ClojureSourceGenerator$BadSource ctx)))))
+  (cond
+    (. ctx expression) (self-visit this ctx expression)
+
+    ;;(. ctx term) (into [] (map #(.. this (visitStatementTerm %)) (. ctx term)))
+
+    (. ctx term) (let [num-terms (.. (. ctx term) size)]
+                   (cond
+                     (= 0 num-terms) (throw (new NotImplementedException))
+                     (= 1 num-terms) (.. this (visitStatementTerm (.. (. ctx term) (get 0))))
+                     :else `(do ~@(into [] (map #(.. this (visitStatementTerm %)) (. ctx term))))))
+
+    ;;(. ctx scope) (into [] (map #(.. this (visitVarScope %)) (. ctx scope)))
+
+    (. ctx scope) (let [num-scopes (.. (. ctx scope) size)]
+                    (cond
+                      (= 0 num-scopes) (throw NotImplementedException)
+                      (= 1 num-scopes) (.. this (visitVarScope (.. (. ctx scope) (get 0))))
+                      :else `(do ~@(into [] (map #(.. this (visitVarScope %)) (. ctx scope))))))
+
+    :else (throw (new ClojureSourceGenerator$BadSource ctx))))

 (defn -visitVarScope
@@ -441,7 +465,7 @@
         single-if (= (. conditions size) 1)]

     (cond
-      (and single-if else) `(if ~(. conditions (get 0)) ~(. results (get 0)) ~else)
+      (and single-if (not (nil? else))) `(if ~(. conditions (get 0)) ~(. results (get 0)) ~else)
       single-if `(if ~(. conditions (get 0)) ~(. results (get 0)))
       (not else) `(cond ~@(alternate conditions results))
       :else `(cond ~@(alternate conditions results) :else ~else))))


Added logging of the url of the front page when the application has been started.

--- src/clj_formal_specifications_app/server.clj
+++ src/clj_formal_specifications_app/server.clj
@@ -1,8 +1,11 @@
 (ns clj-formal-specifications-app.server
   (:gen-class)
   (:require [clj-formal-specifications-app.routes :as routes]
+            [clojure.tools.logging :as log]
             [org.httpkit.server :as httpkit]))

 (defn -main
   []
-  (httpkit/run-server routes/app {:port 5000}))
+  (let [port 5000]
+    (httpkit/run-server routes/app {:port port})
+    (log/info (str "Application started at http://localhost:" port))))


Fix navigating back to main screen from config

--- src/cljs/my_money/app/controller/config.cljs
+++ src/cljs/my_money/app/controller/config.cljs
@@ -2,7 +2,8 @@
   (:require [ajax.core :refer [POST]]
             [my-money.ajax :as ajax]
             [tuck.core :as tuck]
-            [my-money.app.controller.navigation :as nc]))
+            [my-money.app.controller.navigation :as nc]
+            [my-money.routes :as routes]))

 (defrecord SaveConfig [config])
 (defrecord ConfigSaved [])
@@ -25,7 +26,8 @@
   ConfigSaved
   (process-event [_ app]
     (tuck/action! (fn [e!]
-                    (e! (->RetrieveConfig))))
+                    (e! (->RetrieveConfig))
+                    (routes/navigate! :home)))
     (-> app
         (nc/set-in-progress false)
         (dissoc :modal)))


Fix detection on non-empty evaluation graph

--- src/matchmaker_sparql/evaluation/setup.clj
+++ src/matchmaker_sparql/evaluation/setup.clj
@@ -133,9 +133,8 @@
 (defn- evaluation-data-empty?
   "Test if the evaluation graph is empty before loading it."
   [{:keys [evaluation-graph]}]
-  (assert-query "evaluation_data_empty"
-                {:type ::util/evaluation-data-empty}
-                :data {:evaluation-graph evaluation-graph}))
+  (let [query (setup-template "evaluation_data_empty" {:evaluation-graph evaluation-graph})]
+    (not (sparql/ask-query endpoint query))))

 (defn- has-duplicate-tenders?
   "Test if there are duplicate tenders in the evaluated data."


Running clock.

Running clock.

--- ui/src/ui/core.cljs
+++ ui/src/ui/core.cljs
@@ -1,8 +1,10 @@
 (ns ui.core
-  (:require [om.core :refer [IRender root]]
-            [om.dom :refer [circle polygon svg text]]
+  (:require-macros [cljs.core.async.macros :refer [go-loop]])
+  (:require [om.core :refer [IRenderState IInitState IWillMount root transact!]]
+            [om.dom :refer [circle line polygon svg text]]
             [cljs-time.coerce :refer [to-date to-long to-string]]
-            [cljs-time.core :refer [now interval in-seconds]]
+            [cljs-time.core :refer [now interval in-millis]]
+            [cljs.core.async :refer [timeout]]
             [clojure.string :refer [join]]
             [goog.math :refer [angleDx angleDy]]))

@@ -12,23 +14,43 @@

 ;; define your app data so that it doesn't get over-written on reload

-(defonce app-state (atom{:Owner "josephburnett79"
-                         :State "anon-running"
-                         :Start (to-string (now))
-                         :Stop "0001-01-01T00:00:00Z"
-                         :TimerID ""}))
+(defonce app-state (atom {:timer {:Owner "josephburnett79"
+                                  :State "anon-running"
+                                  :Start (to-string (now))
+                                  :Stop "0001-01-01T00:00:00Z"
+                                  :TimerID ""}
+                          :elapsed-seconds 0
+                          :elapsed-minutes 0
+                          :elapsed-hours 0}))
+
+(defn pie [x y r fill tenth-degrees]
+  (let [points (map #(str (+ x (angleDx (/ % 10) r)) "," (+ y (angleDy (/ % 10) r)))
+                    (range 0 tenth-degrees))
+        points-string (join " " (cons (str x "," y) points))]
+    (polygon #js {:points points-string
+                  :transform (str "rotate(-90," x "," y ")")
+                  :fill fill})))

 (defn timer-view [data owner]
-  (let [r 200
-        x 250
-        y 250
-        interval-seconds (in-seconds (interval (to-date (:Start data)) (now)))
-        elapsed-minutes (mod (int (/ interval-seconds 60)) 60)
-        elapsed-hours (int (/ interval-seconds 60 60))
-        elapsed-seconds (mod interval-seconds 60)]
-    (reify
-      IRender
-      (render [_]
+  (reify
+    IWillMount
+    (will-mount [_]
+      (go-loop []
+        (let [interval-seconds (/ (in-millis (interval (to-date (get-in data [:timer :Start])) (now))) 1000)]
+          (transact! data :elapsed-seconds #(mod interval-seconds 60))
+          (transact! data :elapsed-minutes #(mod (/ interval-seconds 60) 60))
+          (transact! data :elapsed-hours #(mod (/ interval-seconds 60 60) 24))
+          (<! (timeout 30))
+          (recur))))
+    IRenderState
+    (render-state [_ _]
+      (let [r 200
+            x 250
+            y 250
+                                        ;interval-seconds (in-seconds (interval (to-date (:Start data)) (now)))
+            elapsed-minutes (:elapsed-minutes data) ;(mod (int (/ interval-seconds 60)) 60)
+            elapsed-hours (:elapsed-hours data) ; (int (/ interval-seconds 60 60))
+            elapsed-seconds (:elapsed-seconds data)] ; (mod interval-seconds 60)]
         (svg #js {:width "500"
                   :height "500"}
              (circle #js {:r (+ 20 r)
@@ -40,21 +62,26 @@
                           :cy y
                           :fill "white"})
              (when-not (= 0 elapsed-minutes)
-               (let [minute-points (map #(str (+ x (angleDx % r)) "," (+ y (angleDy % r)))
-                                        (range 0 (* 6 elapsed-minutes) 6))
-                     points-string (join " " (cons (str x "," y) minute-points))]
-                 (polygon #js {:points points-string
-                               :transform (str "rotate(-90," x "," y ")")
-                               :fill "#d9d9d9"})))
-             (text #js {:x "120"
-                        :y "300"
+               (pie x y r "#d9d9d9" (* 6 10 elapsed-minutes)))
+             (pie x y (/ r 1.5) "#cccccc" (* 30 10 elapsed-hours))
+             (line #js {:x1 x
+                        :y1 y
+                        :x2 (+ x (angleDx (* 6 elapsed-seconds) r))
+                        :y2 (+ y (angleDy (* 6 elapsed-seconds) r))
+                        :style #js {:stroke "#737373"
+                                    :stroke-width "1px"}
+                        :transform (str "rotate(-90," x "," y")")})
+             (text #js {:x "190"
+                        :y "280"
                         :fill "blue"
-                        :style #js {:font-size "170px"}}
-                   elapsed-minutes)
+                        :style #js {:font-size "90px"}}
+                   (if (= 0 (int elapsed-hours))
+                     (str (int elapsed-minutes) "m")
+                     (str (int elapsed-hours) "h " (int elapsed-minutes) "m")))
              (text #js {:x "350"
-                        :y "300"
+                        :y "310"
                         :fill "blue"}
-                   elapsed-seconds))))))
+                   (int elapsed-seconds)))))))

 (root timer-view app-state
       {:target (. js/document (getElementById "timer"))})


Sharpened a bass note.

Sharpened a bass note.

--- src/overtunes/songs/canone_alla_quarta.clj
+++ src/overtunes/songs/canone_alla_quarta.clj
@@ -29,6 +29,15 @@
                  (repeat 12 1/4) [1/2 1 1/2]
                  (repeat 12 1/4) [1]))

+(defn update-all [m [& ks] f]
+  (if ks
+    (update-in
+      (update-all m (rest ks) f)
+      [(first ks)]
+      f)
+    m))
+(defn sharpen [notes] #(update-all % notes inc))
+
 (def pitches (concat
                [0] (run -1 3) (run 2 0)
                [4] (run 1 8) (run 7 -1)
@@ -36,7 +45,10 @@
                [-1 1] (run 4 6)
                [1 1 1 2 -1 -2 0 1 -1 -2] (run 5 0)))

-(def bass (map #(- % 7) (flatten (map #(repeat 3 %) (concat (run 0 -3) (run -5 -3) [-7])))))
+(def lower #(- % 7))
+(def bass ((sharpen [8]) (vec (map
+            lower
+            (flatten (map #(repeat 3 %) (concat (run 0 -3) (run -5 -3) [-7])))))))

 (defn melody# [timing notes]
   (let [note# #(at (timing %1) (piano (g-major %2)))]


fix get capacity unit from env var

fix get capacity unit from env var

--- src/promdash_annotation_server/handler.clj
+++ src/promdash_annotation_server/handler.clj
@@ -10,13 +10,19 @@
    :endpoint (get (System/getenv) "AWS_DYNAMODB_ENDPOINT" "http://localhost:8000")
    :table-name "promdash-annotations"})

+(defn assert-valid-number [val]
+  (if-not (number? val) (throw (Exception. (str "This is not a valid number: " val))) val))
+
+(defn get-number-from-env-var [name default]
+  (assert-valid-number (read-string (get (System/getenv) name default))))
+
 (defn ensure-annotations-table-exists []
   (far/ensure-table client-opts
                     (:table-name client-opts)
                     [:tag :s]
                     {:range-keydef [:timestamp :n]
-                     :throughput {:read (get (System/getenv) "DYNAMODB_READ_CAPACITY_UNITS" 1)
-                                  :write (get (System/getenv) "DYNAMODB_WRITE_CAPACITY_UNITS" 1)}
+                     :throughput {:read (get-number-from-env-var "DYNAMODB_READ_CAPACITY_UNITS" "1")
+                                  :write (get-number-from-env-var "DYNAMODB_WRITE_CAPACITY_UNITS" "1")}
                      :block? true}))

 (defn delete-annotation [tag timestamp]


Unbreak hazelcast more

Unbreak hazelcast more

--- src/puppetlabs/cthun/meshing/hazelcast.clj
+++ src/puppetlabs/cthun/meshing/hazelcast.clj
@@ -39,7 +39,8 @@
   [location-map endpoint]
   ;; This is not terribly efficient as we flatten the entire map
   (:broker (first (filter (fn [record]
-                              (= endpoint (:endpoint record)))))))
+                              (= endpoint (:endpoint record)))
+                          (flatten-location-map location-map)))))

 (defn deliver-to-client
   [service client message]
@@ -47,9 +48,9 @@
     (log/info "queueing for " client)
     (if-let [broker (broker-for-endpoint location-map client)]
       (let [topic (.getTopic hazelcast broker-id)]
-        (log/info "publishing on" topic)
+        (log/info "publishing to broker" broker-id)
         (.publish topic (cheshire/generate-string message)))
-      (log/warn "didn't find broker for " client))))
+      (log/warn "didn't find broker for" client))))

 (defn register-local-delivery
   [service callback]


made the segment hosted url https so it doesnt get blocked in dev

--- src/frontend/stefon.clj
+++ src/frontend/stefon.clj
@@ -7,7 +7,7 @@
                      {:path "js/hosted/elevio.js"
                       :url "https://static.elev.io/js/v3.js"}
                      {:path "js/hosted/segment.js"
-                      :url "http://cdn.segment.com/analytics.js/v1/AbgkrgN4cbRhAVEwlzMkHbwvrXnxHh35/analytics.min.js"}])
+                      :url "https://cdn.segment.com/analytics.js/v1/AbgkrgN4cbRhAVEwlzMkHbwvrXnxHh35/analytics.min.js"}])

 (def asset-roots ["resources/assets"])


Upgrade pg-types to 2.2.0

Upgrade pg-types to 2.2.0

--- dependencies.clj
+++ dependencies.clj
@@ -1,7 +1,7 @@
 [
  [drtom/honeysql "2.0.0-ALPHA+1"]
  [logbug "4.0.0"]
- [pg-types "2.1.2"]
+ [pg-types "2.2.0"]
  [cider-ci/open-session "1.2.0"]

  [cheshire "5.5.0"]


integrate ':mirrors' with 'deftask'. (fixes #49)

--- src/leiningen/ancient/utils.clj
+++ src/leiningen/ancient/utils.clj
@@ -89,13 +89,16 @@
 (defn parse
   "Create a map of `:artifact-opts`, `:opts` and `:args` from the given
    project and arguments."
-  [{:keys [repositories] :as project} args & {:keys [change-defaults exclude fixed]}]
+  [{:keys [repositories mirrors] :as project} args
+   & {:keys [change-defaults exclude fixed]}]
   (try
     (let [[opts' rst] (cli/parse args
                                  :change-defaults change-defaults
                                  :exclude exclude)
           opts (merge opts' fixed)
-          artifact-opts (-> (assoc opts :repositories repositories)
+          artifact-opts (-> (assoc opts
+                                   :repositories repositories
+                                   :mirrors mirrors)
                             (o/options))]
       {:artifact-opts artifact-opts
        :opts opts


Tags on info card should not be hover-able

they don't react to clicks

--- frontend/styles/faceboard/css/people.clj
+++ frontend/styles/faceboard/css/people.clj
@@ -314,6 +314,4 @@
           :margin-right (px 3)
           :white-space :nowrap
           :border-radius (px 2)
-          :background-color social-badge-background-color]
-         (>> &:hover
-           [:background-color social-badge-background-hovered-color]))))])+          :background-color social-badge-background-color])))])


Rename Show to Toggle to be correct regardless of doc state

Close #1757

--- src/lt/plugins/doc.cljs
+++ src/lt/plugins/doc.cljs
@@ -43,7 +43,7 @@
           :triggers #{:menu+}
           :reaction (fn [this items]
                       (conj items
-                            {:label "Show docs"
+                            {:label "Toggle docs"
                              :order 0.1
                              :enabled (not (editor/selection? this))
                              :click (fn []


Add multihash deftype for cljs.

Add multihash deftype for cljs.

--- src/multihash/core.cljc
+++ src/multihash/core.cljc
@@ -63,65 +63,137 @@
 ;; - `_digest` is a string holding the hex-encoded algorithm output.
 ;;
 ;; Digest values also support metadata.
-(deftype Multihash
-  [^long _code ^String _digest _meta]
-
-  ; Ref: https://github.com/clojure/clojurescript/blob/master/src/main/cljs/cljs/core.cljs#L430
-
-  Object
-
-  (toString [this]
-    (str "hash:" (name (:name (get-algorithm _code))) \: _digest))
-
-  ; IEquiv (-equiv [this other])
-  (equals [this that]
-    (cond
-      (identical? this that) true
-      (instance? Multihash that)
-        (and (= _code   (._code   ^Multihash that))
-             (= _digest (._digest ^Multihash that)))
-      :else false))
-
-  ; IHash (-hash [this])
-  (hashCode [this]
-    (hash-combine _code _digest))
-
-
-  ; IComparable (-compare [x y])
-  Comparable
-
-  (compareTo [this that]
-    (cond
-      (= this that) 0
-      (< _code (._code ^Multihash that)) -1
-      (> _code (._code ^Multihash that)) 1
-      :else (compare _digest (._digest ^Multihash that))))
-
-
-  ; ILookup (-lookup [this k] [this k not-found])
-  clojure.lang.ILookup
-
-  (valAt [this k not-found]
-    (case k
-      :code _code
-      :algorithm (:name (get-algorithm _code))
-      :length (/ (count _digest) 2)
-      :digest (hex/decode _digest)
-      :hex-digest _digest
-      not-found))
-
-  (valAt [this k]
-    (.valAt this k nil))
-
-
-  clojure.lang.IObj
-
-  ; IMeta (-meta [this])
-  (meta [_] _meta)
-
-  ; IWithMeta (-with-meta [this meta])
-  (withMeta [_ meta-map]
-    (Multihash. _code _digest meta-map)))
+#?(:clj
+    (deftype Multihash
+      [^long _code ^String _digest _meta]
+
+      Object
+
+      (toString
+        [this]
+        (str "hash:" (name (:name (get-algorithm _code))) \: _digest))
+
+      (equals
+        [this that]
+        (cond
+          (identical? this that) true
+          (instance? Multihash that)
+            (and (= _code   (._code   ^Multihash that))
+                 (= _digest (._digest ^Multihash that)))
+          :else false))
+
+      (hashCode
+        [this]
+        (hash-combine _code _digest))
+
+
+      Comparable
+
+      (compareTo
+        [this that]
+        (cond
+          (= this that) 0
+          (< _code (._code ^Multihash that)) -1
+          (> _code (._code ^Multihash that)) 1
+          :else (compare _digest (._digest ^Multihash that))))
+
+
+      clojure.lang.ILookup
+
+      (valAt
+        [this k]
+        (.valAt this k nil))
+
+      (valAt
+        [this k not-found]
+        (case k
+          :code _code
+          :algorithm (:name (get-algorithm _code))
+          :length (/ (count _digest) 2)
+          :digest (hex/decode _digest)
+          :hex-digest _digest
+          not-found))
+
+
+      clojure.lang.IObj
+
+      (meta [_] _meta)
+
+      (withMeta
+        [_ meta-map]
+        (Multihash. _code _digest meta-map)))
+
+
+   :cljs
+    (deftype Multihash
+      [_code _digest _meta]
+
+      ; Ref: https://github.com/clojure/clojurescript/blob/master/src/main/cljs/cljs/core.cljs#L430
+
+      Object
+
+      (toString
+        [this]
+        (str "hash:" (name (:name (get-algorithm _code))) \: _digest))
+
+
+      IEquiv
+
+      (-equiv
+        [this that]
+        (cond
+          (identical? this that) true
+          (instance? Multihash that)
+            (and (= _code   (:code that))
+                 (= _digest (:hex-digest that)))
+          :else false))
+
+
+      IHash
+
+      (-hash
+        [this]
+        (hash-combine _code _digest))
+
+
+      IComparable
+
+      (-compare
+        [this that]
+        (cond
+          (= this that) 0
+          (< _code (:code that)) -1
+          (> _code (:code that)) 1
+          :else (compare _digest (:hex-digest that))))
+
+
+      ILookup
+
+      (-lookup
+        [this k]
+        (-lookup this k nil))
+
+      (-lookup
+        [this k not-found]
+        (case k
+          :code _code
+          :algorithm (:name (get-algorithm _code))
+          :length (/ (count _digest) 2)
+          :digest (hex/decode _digest)
+          :hex-digest _digest
+          not-found))
+
+
+      IMeta
+
+      (-meta [_] _meta)
+
+
+      IWithMeta
+
+      (-with-meta
+        [_ meta-map]
+        (Multihash. _code _digest meta-map))))

 ;; Remove automatic constructor function.


Clean.

Clean.

--- src/ombs/view/event.clj
+++ src/ombs/view/event.clj
@@ -14,13 +14,8 @@
 (h/defsnippet event-elem "../resources/public/event.html" event-sel [{:keys [name price date author status parts] :as event}]
   [:.name]   (h/content (str author "'s " name))
   [:.date]   (h/content (str date))
-  [:.author] (h/content (str "Author: " author))
   [:.money]  (h/content (str (get-money event)))
   [:.action] (get-action event)
-  ;[:.price] (h/content (str price))
-  ;[:#parts-row]
-  ;[:.action.participate]
-  ;[:.action.start]
   )

 (def parts-row-sel [:#parts-row]) ;tag in parts.html


Update for l-ext api.

Update for l-ext api.

--- src/onyx/plugin/sql.clj
+++ src/onyx/plugin/sql.clj
@@ -1,7 +1,7 @@
 (ns onyx.plugin.sql
   (:require [honeysql.core :as sql]
             [clojure.java.jdbc :as jdbc]
-            [onyx.peer.pipeline-extensions :as p-ext])
+            [onyx.peer.task-lifecycle-extensions :as l-ext])
   (:import [com.mchange.v2.c3p0 ComboPooledDataSource]))

 (defn create-pool [spec]
@@ -22,12 +22,12 @@
                  :password (:sql/password task-map)}]
     (create-pool db-spec)))

-(defmethod p-ext/inject-pipeline-resources
+(defmethod l-ext/inject-lifecycle-resources
   :sql/load-rows
   [_ {:keys [task-map] :as pipeline}]
   {:params [(task->pool task-map)]})

-(defmethod p-ext/apply-fn [:input :sql]
+(defmethod l-ext/apply-fn [:input :sql]
   [{:keys [task-map] :as pipeline}]
   (let [pool (task->pool task-map)
         sql-map {:select [:%count.*] :from [(:sql/table task-map)]}


remove other test approach

remove other test approach

--- test/block_chain/message_handlers_test.clj
+++ test/block_chain/message_handlers_test.clj
@@ -299,47 +299,6 @@
 (defn timed-out? [start duration]
   (> (- (current-time-millis) start) duration))

-#_(deftest test-receiving-outside-block-stops-miner
-  (let [alt-block (miner/mine (miner/next-block @db/db))
-        mining-future (atom nil)]
-
-    (println "future: " @mining-future)
-
-    #_[target/default target/hard]
-    (reset! mining-future
-            (future
-              (println "FUTURE...")
-              (with-bindings {#'target/default target/hard}
-                (println "Target in thread: " target/default)
-                (miner/mine-and-commit-db! db/db))))
-
-    (println "Target in main: " target/default)
-    (println "future: " @mining-future)
-    (is (= {:message "block-accepted" :payload alt-block}
-           (handler {:message "submit_block" :payload alt-block}
-                    sock-info)))
-
-    (is (= :finished
-           (loop [start-time (current-time-millis)]
-             (cond
-               (timed-out? start-time 500) :timeout-elapsed
-               (future-done? @mining-future) :finished
-               :else (recur start-time))
-             )))
-    (miner/interrupt-miner!))
-  ;; make 1 block and mine it
-  ;; redef target hard
-  ;; start mine-and-commit-db! in future
-  ;; submit the mined block to db
-
-  ;; set a timestamp and start looping
-  ;; each loop check if future is done
-  ;; if so: pass
-  ;; if time diff is past threshold
-  ;; miner interrupt
-  )
-
-
 (deftest test-receiving-outside-block-stops-miner
   (let [alt-block (miner/mine (miner/next-block @db/db))
         pending (-> (miner/next-block @db/db)


state-machines: more cleaning [CI SKIP]

state-machines: more cleaning [CI SKIP]

--- internal/machina/src/samsara/machina/core.clj
+++ internal/machina/src/samsara/machina/core.clj
@@ -24,7 +24,14 @@
 ;;

-(defn log-state-change
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;                                                                            ;;
+;;            ---==| M I D D L E W A R E   W R A P P E R S |==----            ;;
+;;                                                                            ;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+
+(defn wrapper-log-state-change
   "This wrapper logs the state machine transitions to the configured
   logger. The default log level is :debug, but you can specify a
   different level."
@@ -37,7 +44,8 @@
        sm2))))

-(defn epoch-counter
+
+(defn wrapper-epoch-counter
   "This wrapper increments a counter on every transition.
   Useful to determine whether the state machine is progressing."
   [handler]
@@ -46,40 +54,86 @@

+(defn wrapper-error-handler
+  "This wrapper traps exceptions from the underlying handler
+   and setup the error information under the `:latest-errors`
+   key and make a transition to the `:machina/error` state"
+  [handler]
+  (fn [{:keys [state epoch] :as sm}]
+    (try
+      (-> (handler sm)
+          ;; clear error flag
+          (update :latest-errors dissoc state));; TODO: dissoc-in
+      (catch Throwable x
+        (-> sm
+            (assoc-in  [:latest-errors :from-state] state)
+            (update-in [:latest-errors state :repeated] (fnil inc 0))
+            (update-in [:latest-errors state]
+                       #(merge % {:error-epoch epoch
+                                  :error       x}))
+            (assoc :state :machina/error))))))
+
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;                                                                            ;;
+;;      ---==| D E F A U L T   S T A T E   T R A N S I T I O N S |==----      ;;
+;;                                                                            ;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+
+;;
+;;{:state   :machina/sleep
+;; :machina/sleepe {:nap (safely/sleeper :random 3000 :+/- 0.35) ;; or a number of millis 1000
+;;           :return-state :foo}}
+;; TODO: better description
+(defn sleep-state
+  "When the machine is a `:machina/sleep` state then this transition
+   will sleep for a while and the go the return state."
+  [{{:keys [nap return-state]} :machina/sleep :as sm}]
+  (when-not (and (or (fn? nap) (vector? nap) (number? nap)) return-state)
+    ;; TODO: halted or exception?
+    (throw (ex-info "invalid sleep state." sm)))
+
+  ;; nap a little bit
+  (cond
+    (fn?     nap) (nap)
+    (number? nap) (safely/sleep nap)
+    (vector? nap) (apply safely/sleep nap))
+
+  (-> sm
+      (assoc  :state  return-state)
+      (dissoc :sleeper)))
+
+
+
+
+;; TODO: more info
+(defn error-dispatch
+  "Make the transition from `:machina/error` to the managed target state
+  it uses the defined `:error-policies` and the data from `:last-errors`
+  "
+  [{{:keys [from-state]} :latest-errors
+    error-policies :error-policies :as sm}]
+  (if-let [policy (or (get error-policies from-state) (get error-policies :machina/default))]
+    ;; TODO: multimethod dispatch by type?
+    (let [{:keys [retry-delay]} policy
+          nap (or (get-in sm [:latest-errors from-state :sleeper]) (apply safely/sleeper retry-delay))]
+      (-> sm
+          (assoc-in [:latest-errors from-state :sleeper] nap)
+          (assoc :sleeper {:nap nap :return-state from-state})
+          (assoc :state :machina/sleep))
+
+      )
+    ;; TODO: exception or halted state?
+    (throw (ex-info "no default error policy" sm)))
+  )
+
+
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
 (comment

-  (defn error-state
-    [handler]
-    (fn [{:keys [state epoch] :as sm}]
-      (try
-        (-> (handler sm)
-            ;; clear error flag
-            (update :latest-errors dissoc state));; TODO: dissoc-in
-        (catch Throwable x
-          (-> sm
-              (assoc-in  [:latest-errors :from-state] state)
-              (update-in [:latest-errors state :repeated] (fnil inc 0))
-              (update-in [:latest-errors state]
-                         #(merge % {:error-epoch epoch
-                                    :error       x}))
-              (assoc :state :machina/error))))))
-
-
-  (defn error-dispatch
-    [{{:keys [from-state]} :latest-errors
-      error-policies :error-policies :as sm}]
-    (if-let [policy (or (get error-policies from-state) (get error-policies :machina/default))]
-      ;; TODO: multimethod dispatch by type?
-      (let [{:keys [retry-delay]} policy
-            nap (or (get-in sm [:latest-errors from-state :sleeper]) (apply safely/sleeper retry-delay))]
-        (-> sm
-            (assoc-in [:latest-errors from-state :sleeper] nap)
-            (assoc :sleeper {:nap nap :return-state from-state})
-            (assoc :state :machina/sleep))
-
-        )
-      (throw (ex-info "no default error policy" sm)))
-    )

   (comment
@@ -96,24 +150,6 @@
         :wrappers
         [#'epoch-counter #'log-state-change #'error-state]}))))

-  ;;
-  ;;{:state   :machina/sleep
-  ;; :sleeper {:nap (safely/sleeper :random 3000 :+/- 0.35) ;; or a number of millis 1000
-  ;;           :return-state :foo}}
-  ;;
-  (defn sleep-state [{{:keys [nap return-state]} :sleeper :as sm}]
-    (when-not (and (or (fn? nap) (number? nap)) return-state)
-      (throw (ex-info "invalid sleep state." sm)))
-
-    ;; nap a little bit
-    (if (number? nap)
-      (safely/sleep nap)
-      (nap))
-
-    (-> sm
-        (assoc  :state  return-state)
-        (dissoc :sleeper)))
-

   (defn- wrapper
     ([] identity)


Test emulation of logistic function using function module

--- test/cortex/function_test.clj
+++ test/cortex/function_test.clj
@@ -28,6 +28,18 @@
         (let [bm (backward fm input [10 10 -10])]
           (is (m/equals [0 2.5 0] (input-gradient bm))))))))

+(deftest test-function
+  (testing "emulated logistic function"
+    (let [m (layers/logistic [3])
+          m2 (layers/function m/logistic (fn [input output] (m/mul output (m/sub 1.0 output))))]
+      (let [v [-10 1 10]]
+        (is (m/equals (calc-output m v) (calc-output m2 v))))
+      (let [input [-10 1 10]
+            target [0.1 0.5 0.6]
+            m (train m input target)
+            m2 (train m2 input target)]
+        (is (m/equals (input-gradient m) (input-gradient m2)))))))
+
 (deftest test-linear-module
   (testing "Parameters"
     (let [wm (layers/linear [[1 2] [3 4]] [0 10])


Improve wording

Improve wording

--- src/re_com/buttons.cljs
+++ src/re_com/buttons.cljs
@@ -127,7 +127,7 @@
 ;;--------------------------------------------------------------------------------------------------

 (def md-icon-button-args-desc
-  [{:name :md-icon-name     :required true  :default "md-add"        :type "string"     :description [:span "the name of the icon." ]}
+  [{:name :md-icon-name     :required true  :default "md-add"        :type "string"     :description [:span "the name of the icon."]}
    {:name :on-click         :required false                          :type "() -> nil"  :description "function to call when the button is clicked"}
    {:name :size             :required false :default "nil"           :type "keyword"    :description "set size of button (nil = regular, or :smaller or :larger."}
    {:name :tooltip          :required false                          :type "string"     :description "show a popover-tooltip using this text."}
@@ -232,9 +232,9 @@
 ;;--------------------------------------------------------------------------------------------------

 (def row-button-args-desc
-  [{:name :md-icon-name     :required true  :default "md-add"        :type "string"     :description "the name of the icon. See http://zavoloklom.github.io/material-design-iconic-font/icons.html"}
+  [{:name :md-icon-name     :required true  :default "md-add"        :type "string"     :description "the name of the icon."}
    {:name :on-click         :required false                          :type "() -> nil"  :description "function to call when the button is clicked."}
-   {:name :mouse-over-row?  :required false :default false           :type "boolean"    :description "true if the mouse is hovering over the row this button is in."}
+   {:name :mouse-over-row?  :required false :default false           :type "boolean"    :description "true if the mouse is hovering over the row."}
    {:name :tooltip          :required false                          :type "string"     :description "show a popover-tooltip using this text."}
    {:name :tooltip-position :required false :default ":below-center" :type "keyword"    :description "position of the popover-tooltip. e.g. :right-below."}
    {:name :disabled?        :required false :default false           :type "boolean"    :description "if true, the user can't click the button."}


Remove debug logging :bug:

Remove debug logging :bug:

--- src/metabase/models/setting.clj
+++ src/metabase/models/setting.clj
@@ -85,8 +85,7 @@

 (defn- restore-cache-if-needed! []
   (when-not @cache
-    (reset! cache (u/prog1 (db/select-field->field :key :value Setting)
-                    (println "Restored cache:\n" (u/pprint-to-str 'green <>))))))
+    (reset! cache (db/select-field->field :key :value Setting))))

 ;;; ------------------------------------------------------------ get ------------------------------------------------------------
@@ -111,7 +110,7 @@
     (when (seq v)
       v)))

-(defn- get-from-db
+(defn- db-value
   "Get the value, if any, of SETTING-OR-NAME from the DB (using / restoring the cache as needed)."
   ^String [setting-or-name]
   (restore-cache-if-needed!)
@@ -128,12 +127,9 @@
    If the fetched value is an empty string it is considered to be unset and this function returns `nil`."
   ^String [setting-or-name]
   (let [setting (resolve-setting setting-or-name)
-        v       (or (u/prog1 (get-from-db setting)
-                      (when <> (println "get-from-db" <>)))
-                    (u/prog1 (env-var-value setting)
-                      (when <> (println "env-var-value" <>))) ; NOCOMMIT
-                    (u/prog1 (:default setting)
-                      (when <> (println ":default" <>))))]
+        v       (or (db-value setting)
+                    (env-var-value setting)
+                    (:default setting))]
     (when (seq v)
       v)))

@@ -162,7 +158,6 @@
   "Fetch the value of SETTING-OR-NAME. What this means depends on the Setting's `:getter`; by default, this looks for first for a corresponding env var,
    then checks the cache, then returns the default value of the Setting, if any."
   [setting-or-name]
-  (println "get" (u/format-color 'blue (setting-name setting-or-name))) ; NOCOMMIT
   ((:getter (resolve-setting setting-or-name))))

@@ -215,7 +210,6 @@

      (mandrill-api-key \"xyz123\")"
   [setting-or-name new-value]
-  (println (u/format-color 'magenta "%s -> %s" (setting-name (resolve-setting setting-or-name)) new-value)) ; NOCOMMIT
   ((:setter (resolve-setting setting-or-name)) new-value))

@@ -236,8 +230,7 @@
                      :internal?    false}
                     (dissoc setting :name :type :default)))
     (s/validate SettingDefinition <>)
-    (swap! registered-settings assoc setting-name <>)
-    (println "Registered Setting" setting-name))) ; NOCOMMIT
+    (swap! registered-settings assoc setting-name <>)))


more throughout eip testing

more throughout eip testing

--- test/celestial/integration/workflows/ec2.clj
+++ test/celestial/integration/workflows/ec2.clj
@@ -30,8 +30,15 @@
         ; will be run only if EIP is defined
         (when-let [eip (System/getenv "EIP")]
           (wf/create (spec {:machine {:ip eip}})) => nil
+          (:machine (spec)) => (contains {:ip eip})
+          (wf/reload (spec)) => nil
+          (:machine (spec)) => (contains {:ip eip})
+          (wf/stop (spec)) => nil
+          (wf/start (spec)) => nil
+          (:machine (spec)) => (contains {:ip eip})
           (wf/reload (spec {:machine {:ip eip}})) => nil
-          (wf/destroy (spec {:machine {:ip eip}})) => nil))
+          (:machine (spec)) => (contains {:ip eip})
+          (wf/destroy (spec)) => nil))

       (fact "aws with volumes" :integration :ec2 :workflow
         (let [with-vol {:aws {:volumes [{:device "/dev/sdn" :size 10 :clear true}]}}]


Fix spelling

Fix spelling

--- src/overtone/sc/ugen/envgen.clj
+++ src/overtone/sc/ugen/envgen.clj
@@ -11,7 +11,7 @@
       {:name "FreeSelf",
        :args [{:name "in"}],
        :rates #{:kr}
-       :doc "Pree the enclosing synth when triggered"}
+       :doc "Free the enclosing synth when triggered"}

       {:name "PauseSelf",
        :args [{:name "in"}],


add todo ticket

add todo ticket

--- src/cljs/wombats_web_client/components/arena.cljs
+++ src/cljs/wombats_web_client/components/arena.cljs
@@ -163,6 +163,7 @@
 (defn- draw-fog
   [canvas-element contents meta x y width height]
   (draw-image canvas-element
+              ;; TODO Get official image for fog. issue #211
               "fog.png"
               x y width height)
   (draw-meta canvas-element contents meta x y width height))


Tweak sample show API doc.

Tweak sample show API doc.

--- src/afterglow/examples.clj
+++ src/afterglow/examples.clj
@@ -223,7 +223,8 @@
 (defn add-osc-var-binding
   "Arrange to send an OSC message whenever the value of a show
   variable changes, and record that we did that so it can be cleaned
-  up later. The set up so incoming OSC messages update the value of that variable.
+  up later. Then set things up so incoming OSC messages update the
+  value of that variable.

   If you need to do anything more complicated than send a message with
   the raw value of the variable, or update the variable with the raw
@@ -268,7 +269,12 @@
   it will create the show to use universe 1, but if you want to use a
   different universe (for example, a dummy universe on ID 0, because
   your DMX interface isn't handy right now), you can override that by
-  supplying a different ID after :universe.
+  supplying a different ID after `:universe`.
+
+  Usually we run our shows on a single universe, but sometimes we
+  connect the Weather System fixtures to an extra universe, and wire
+  them separately from the main lighting rig. When we do that, we can
+  pass the extra universe ID in after `:extra-universe`.

   If you have an instance of Pangolin Beyond running a laser show that
   you want to control as well, pass a true value with `:add-beyond?`."


Unoptimize component...

Unoptimize component...

Remove "optimizations" that didn't doo much good.

--- src/reagent/impl/component.cljs
+++ src/reagent/impl/component.cljs
@@ -13,12 +13,11 @@
 (defn shallow-obj-to-map [o]
   (let [ks (js-keys o)
         len (alength ks)]
-    (persistent!
-     (loop [m (transient {}) i 0]
-       (if (< i len)
-         (let [k (aget ks i)]
-           (recur (assoc! m (keyword k) (aget o k)) (inc i)))
-         m)))))
+    (loop [m {} i 0]
+      (if (< i len)
+        (let [k (aget ks i)]
+          (recur (assoc m (keyword k) (aget o k)) (inc i)))
+        m))))

 (defn extract-props [v]
   (let [p (nth v 1 nil)]
@@ -84,7 +83,6 @@

 ;;; Rendering
-

 (defn wrap-render [c]
   (let [f (.' c :reagentRender)
@@ -132,11 +130,6 @@

 (def rat-opts {:no-cache true})

-(defn get-render [c]
-  (if-some [f (.' c :cljsBoundRender)]
-    f
-    (.! c :cljsBoundRender #(do-render c))))
-
 (def static-fns
   {:render
    (fn render []
@@ -145,7 +138,7 @@
                   (let [rat (.' c :cljsRatom)]
                     (batch/mark-rendered c)
                     (if (nil? rat)
-                      (ratom/run-in-reaction (get-render c) c "cljsRatom"
+                      (ratom/run-in-reaction #(do-render c) c "cljsRatom"
                                              batch/queue-render rat-opts)
                       (._run rat))))))})


fix retry cache not deleting bug

fix retry cache not deleting bug

--- kafka-clj/src/kafka_clj/msg_persist.clj
+++ kafka-clj/src/kafka_clj/msg_persist.clj
@@ -22,7 +22,16 @@
     (map format-val (vals (:cache retry-cache))))

 (defn delete-from-retry-cache [{:keys [retry-cache]} key-val]
-  (.remove ^Map (:cache retry-cache) key-val))
+  (prn "delete-from-retry-cache " key-val)
+  (let [^DB db (:db retry-cache)
+         ^Map m (:cache retry-cache)]
+    ;delete whole map
+    (.remove m key-val);remove key
+    (.commit db)
+    (.compact db)))
+
+
+

 (defn write-to-retry-cache [{:keys [retry-cache]} topic v]
   ;here v can be a function, that when called should return the msg sent, or a sequence of messages
@@ -32,11 +41,7 @@
          msg-val {:topic topic :v v}
          key-val (hash msg-val)]
      (.put map key-val (assoc msg-val :key-val key-val))
-     (.commit db)
-     ;for now on each write we compact the db, this is a retry cache so the performance
-     ;hit should not matter to much
-     (.compact db)
-     ))
+     (.commit db)))

 (defn _create-retry-cache [{:keys [retry-cache-file retry-cache-delete-on-exit] :or {retry-cache-delete-on-exit false retry-cache-file "/tmp/kafka-retry-cache"}}]
@@ -106,7 +111,6 @@
      {:db db :cache cache}))

 (defn close-send-cache [{:keys [send-cache]}]
-  (prn "calling close send-cache")
   (try
     (if send-cache
 		    (.close ^DB (:db send-cache)))


Finished updating varibale rename.

Finished updating varibale rename.

Also: updated docstrings.

--- src/simulacrum/math.clj
+++ src/simulacrum/math.clj
@@ -1,4 +1,4 @@
-(ns simulacrum.bigfive
+(ns simulacrum.math
   (:require [clojure.core.matrix :as matrix]
             [clojure.core.matrix.operators]
             [clojure.math.numeric-tower :refer [abs]])
@@ -41,8 +41,15 @@
          pers-matrix-2)))

 (defn normalize-matrix
+  "Given a matrix, normalize it either by its dimension or by the largest
+  element.
+
+  'normal-mode' is the method used to select the normalization value. If the
+  value of 'normal-mode' is :rank, the matrix rank is used to normalize the
+  values in the matrix. If it is :largest, the largest value of the matrix is
+  given as the rank."
   ([matrix-data]
-   (normalize-matrix matrix :dimension))
+   (normalize-matrix matrix-data :dimension))
   ([matrix-data normal-mode]
     (cond
       (= normal-mode :dimension)
@@ -51,7 +58,12 @@
         (div matrix-data (apply max (flatten matrix-data))))))

 (defn get-normalized-matrix
-  ""
+  "Given two matrices, multiply them and normaize the result.
+
+  'normal-mode' is the method used to select the normalization value. If the
+  value of 'normal-mode' is :rank, the matrix rank is used to normalize the
+  values in the matrix. If it is :largest, the largest value of the matrix is
+  given as the rank."
   ([matrix-1 matrix-2]
    (get-normalized-matrix matrix-1 matrix-2 :dimension))
   ([matrix-1 matrix-2 normal-mode]


Rename types constructor functions.

Rename types constructor functions.

--- src/suricatta/types.clj
+++ src/suricatta/types.clj
@@ -29,14 +29,9 @@
            org.jooq.Configuration
            org.jooq.ConnectionProvider
            org.jooq.SQLDialect
-           java.sql.Connection
-           clojure.lang.Agent))
+           java.sql.Connection))

-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; Context
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
-(deftype Context [^Configuration conf ^Agent act]
+(deftype Context [^Configuration conf]
   proto/IContextHolder
   (-get-context [_] (DSL/using conf))
   (-get-config [_] conf)
@@ -48,12 +43,10 @@
       (.close connection)
       (.set conf (org.jooq.impl.NoConnectionProvider.)))))

-(defn ->context
+(defn context
   "Context instance constructor."
-  ([^Configuration conf]
-   (Context. conf (agent 0)))
-  ([^Configuration conf act]
-   (Context. conf act)))
+  [^Configuration conf]
+  (Context. conf))

 (defn context?
   [ctx]
@@ -89,6 +82,6 @@
   (-get-context [_] (DSL/using conf))
   (-get-config [_] conf))

-(defn ->query
+(defn query
   [query conf]
   (Query. query conf))


check :mikron/dnil with keyword-identical?

--- src/main/cljc/mikron/compiler/processor/pack.cljc
+++ src/main/cljc/mikron/compiler/processor/pack.cljc
@@ -19,7 +19,7 @@
     (macrowbar/with-syms {:gen [value-dnil?]}
       (if-not diffed?
         (pack schema value global-options)
-        `(let [~value-dnil? (identical? :mikron/nil ~value)]
+        `(let [~value-dnil? (runtime.processor.common/keyword-identical? :mikron/nil ~value)]
            ~(pack [:boolean] value-dnil? global-options)
            (when-not ~value-dnil?
              ~(pack schema value global-options))))))


c.t.n.repl: make repl state public

c.t.n.repl: make repl state public

'refresh-tracker' and 'refresh-dirs' may be useful for for inspection at
the REPL.

--- src/main/clojure/clojure/tools/namespace/repl.clj
+++ src/main/clojure/clojure/tools/namespace/repl.clj
@@ -14,9 +14,9 @@
             [clojure.tools.namespace.find :as find]
             [clojure.tools.namespace.reload :as reload]))

-(defonce ^:private refresh-tracker (track/tracker))
+(defonce refresh-tracker (track/tracker))

-(defonce ^:private refresh-dirs [])
+(defonce refresh-dirs [])

 (defn- print-and-return [tracker]
   (if-let [e (::reload/error tracker)]


Update to ClojureScript 1.9.89

Update to ClojureScript 1.9.89

--- planck-cljs/project.clj
+++ planck-cljs/project.clj
@@ -1,11 +1,11 @@
 (defproject planck "0.1.0"
   :profiles {:dev
-             {:dependencies [[org.clojure/clojurescript "1.9.88"]
+             {:dependencies [[org.clojure/clojurescript "1.9.89"]
                              [tubular "1.0.0"]]
               :source-paths ["dev"]}
              :build {}}
   :dependencies [[org.clojure/clojure "1.8.0"]
-                 [org.clojure/clojurescript "1.9.88"]       ; comment if building own, and revise planck-cljs/script/build
+                 [org.clojure/clojurescript "1.9.89"]       ; comment if building own, and revise planck-cljs/script/build
                  [org.clojure/tools.reader "1.0.0-beta1"]
                  [tailrecursion/cljson "1.0.7"]
                  [com.cognitect/transit-clj "0.8.285"]


fix problem checkmate success detection

fix problem checkmate success detection

--- cljs/problem/src/problem.cljs
+++ cljs/problem/src/problem.cljs
@@ -44,7 +44,7 @@
   (go (loop [progress [] fen initial-fen]
         (let [[orig, target] (async/<! drop-chan) move (str orig target)]
           (if-let [[new-progress new-lines] (try-move progress move)]
-            (if (= new-progress "end")
+            (if (= new-lines "end")
               (end! "success")
               (let [ai-move (ai-play! new-lines)]
                 (if (= (get new-lines ai-move) "end")


Speed up product-join-prop

Speed up product-join-prop

--- src/aurora/join.cljs
+++ src/aurora/join.cljs
@@ -369,9 +369,10 @@
 (defn magic-run-product-join-prop [min-keys key-len actions]
   (let [tree (apply-to-tree (tree min-keys key-len) actions)
         itr1 (iterator->keys (iterator tree))
-        iterator-results (for [i1 itr1
-                               i2 itr1]
-                           (vec (concat i1 i2)))
+        iterator-results #js []
+        _ (dotimes [i (alength itr1)]
+            (dotimes [j (alength itr1)]
+              (.push iterator-results (.concat (aget itr1 i) (aget itr1 j)))))
         iterator-a (js/aurora.join.magic-iterator tree (let [arr (array)]
                                                          (dotimes [x key-len]
                                                            (.push arr x))
@@ -388,7 +389,7 @@
                                                          ))
         join-itr (js/aurora.join.join-iterator #js [iterator-a iterator-b])
         join-results (js/aurora.join.all-join-results join-itr)]
-    (= iterator-results (map vec join-results))))
+    (= (map vec iterator-results) (map vec join-results))))

 (defn magic-product-join-prop [key-len]
   (prop/for-all [min-keys gen/s-pos-int


hotfix

hotfix

--- src/butler/core.cljs
+++ src/butler/core.cljs
@@ -21,7 +21,7 @@
     (.addEventListener w event-message
                        (fn [e]
                          (let [o (deserialize (.-data e))]
-                           (when-let [handler (get handlers (:name o) nil)]
+                           (when-let [handler (get handlers (keyword (:name o)) nil)]
                              (handler (:data o))))))
     {:worker w}))

@@ -42,7 +42,7 @@
   (.addEventListener js/self event-message
                      (fn [e]
                        (let [o (deserialize (.-data e))]
-                         (when-let [handler (get handlers (:name o) nil)]
+                         (when-let [handler (get handlers (keyword (:name o)) nil)]
                            (handler (:data o)))))))

 (defn bring!


Fixed a bug which caused :version :git to append information to the last tag

--- src/cake/project.clj
+++ src/cake/project.clj
@@ -130,7 +130,7 @@
 (defmulti get-version identity)

 (defmethod get-version :git [_]
-  (:out (sh "git" "describe" "--tags")))
+  (:out (sh "git" "describe" "--tags" "--abbrev=0")))

 (defmethod get-version :hg [_]
   (-> ".hgtags" reader line-seq last (.split " ") last))


solve-tile now works for last tile in row

--- src/tile_game/board.clj
+++ src/tile_game/board.clj
@@ -138,26 +138,24 @@

 (defn move-sequence [board [tile goal solved] & more]
   (let [path (move-to board tile goal solved)]
-    (if (nil? more)
+    (if (empty? more)
       path
-      (concat path
-              (apply move-sequence (reduce slide board path) more)))))
+      (concat path (apply move-sequence (reduce slide board path) more)))))

 (defn solve-tile [board tile]
-  (let [solved (solved-tiles board)
-        goal (goal-coord board tile)]
-    (if ((set solved) tile)
+  (let [solved (set (solved-tiles board))
+        [x y :as goal] (goal-coord board tile)]
+    (if (solved tile)
       '()
       (if (last-on-row? board goal)
-        (let [[x y] goal]
+        (let [row-min (coords->tile board [0 y])]
           (move-sequence board
                          [tile [x (+ y 1)] solved]
-                         [1 [0 1] #{2 3 4}]
-                         [0 [0 0] #{}]
-                         [2 [0 0] #{1 3}]
-                         [3 [1 0] #{1 2}]
-                         [4 [3 0] #{1 2 3}]
-                         [0 [2 0] #{1 2 3 4}]
+                         [0 [0 y] (conj (disj solved row-min) tile)]
+                         [0 [x y] #{}]
+                         [tile [x y] solved]
+                         [0 [(- x 1) y] #{tile}]
+                         [row-min [0 y] #{tile}]
                          ))
         (move-to board tile goal solved)))))


Added move-branch function to clj-git.repo

--- src/clj_git/repo.clj
+++ src/clj_git/repo.clj
@@ -1,8 +1,11 @@
 (ns clj-git.repo
+  (:use clojure.java.io)
+  (:use clj-git.util)
   (:gen-class))

 (defn git-root [] "./.git/")

+; TODO: Read this properly..
 (defn get-author [] "j <jamie.williams89@gmail.com>")
 (def  get-committer get-author)

@@ -10,9 +13,16 @@
   (let [filepath (str (git-root) "refs/heads/" b)]
     (clojure.string/replace (slurp filepath) #"\n" "")))

-(defn head []
+(defn head-name []
   (let [filepath (str (git-root) "HEAD")
         full-branch (clojure.string/replace (slurp filepath) #"\n" "")
         branch-name (-> full-branch (clojure.string/split #"\/") (last))]
-    (branch branch-name)))
+  branch-name))

+(defn head []
+  (branch (head-name)))
+
+(defn move-branch [branch-name full-hash]
+  (let [filepath (str (git-root) "refs/heads/" branch-name)]
+    (assert (.exists (as-file filepath)))
+    (spit filepath full-hash)))


[frontend]: Performance improvement

[frontend]: Performance improvement

- initial rendering: ~200ms on 10 000 components

--- frontend/src/warehouse/views.cljs
+++ frontend/src/warehouse/views.cljs
@@ -133,11 +133,10 @@
                   (range (count change-set-data) 0 -1))])

 (defn export []
-  (let [state-data-uri (subscribe [:state-data-uri])]
-    (fn []
-      [:a {:href @state-data-uri
-           :download "warehouse_components.json"}
-       [:button "Export"]])))
+  [:a {:download "warehouse_components.json"
+       :on-click (m/handler-fn
+                  (set! (.-currentTarget.href e) @(subscribe [:state-data-uri])))}
+   [:button "Export"]])

 (defn selected-components [components]
   [:ul {:class "components-list"}


remove experiments we're note using anymore


clean up compile task

clean up compile task

--- src/cake/tasks/compile.clj
+++ src/cake/tasks/compile.clj
@@ -39,20 +39,10 @@
           (when (and (compile? namespace) (stale? sourcefile classfile))
             namespace))))))

-(defn old-compile-clojure [project]
-  (ant Java {:classname   "clojure.lang.Compile"
-             :classpath   (classpath project)
-             :fork        true
-             :failonerror true}
-       (sys {:clojure.compile.path (file "classes")})
-       (args (map name (stale-namespaces project)))))
-
 (defn compile-clojure [project]
-  (bake [namespaces   (stale-namespaces project)
-         compile-path (file-name "classes")]
-     (binding [*compile-path* compile-path]
-       (doseq [lib namespaces]
-         (compile lib)))))
+  (bake [namespaces (stale-namespaces project)]
+    (doseq [lib namespaces]
+      (compile lib))))

 (deftask compile
   (compile-java project)


Do not use symbol font for list bullet

Do not use symbol font for list bullet

--- src/catalog/layout/fop.clj
+++ src/catalog/layout/fop.clj
@@ -110,7 +110,7 @@
   [:fo:list-item
    [:fo:list-item-label
     {:end-indent "label-end()"}
-    [:fo:block (inline {:font-family "Symbol"} "•")]]
+    [:fo:block (inline "•")]]
    [:fo:list-item-body
     {:start-indent "body-start()"}
     (block body)]])


Make admin a bit cleaner

Make admin a bit cleaner

Formatting changes

--- src/webapp/framework/client/components/admin.cljs
+++ src/webapp/framework/client/components/admin.cljs
@@ -66,21 +66,18 @@

 (c/defn-ui-component
+
   admin-view-show-data-source-data   [table-name]
+
   (let [table             table-name
-        table-data       (keys @(get @(get @client-record-cache table) :values) )
-                            ]
+        table-data       (keys @(get @(get @client-record-cache table) :values) )  ]
+
     (c/container
       nil

-
       (c/div {:style {:color  "blue"}}
-             (c/container
-               (c/inline "50%" (c/text (str "count" )))
-               (c/inline "50%" (c/text (count table-data)))
-               )
-      (c/div nil (str "table-data: " table-data))
-             ))))
+             (c/div  nil  (str "Count: " (count table-data)))
+             (c/div nil (str "Table data: " table-data))))))


Set the running header for recommendations

--- src/catalog/layout/fop.clj
+++ src/catalog/layout/fop.clj
@@ -480,6 +480,7 @@
                  (genre-sexp (get subitems genre) fmt genre 2 (add-number [2] number)))]
          (apply concat (map-indexed #(numbered-genre %1 %2) (order (keys subitems)))))
        (heading :h1 [:recommendations] [3])
+       (set-marker (layout/translations :recommendations))
        (md-to-fop recommendations)])]])

 (defmethod document-sexp :all-formats


Do not dotify producer when followed by Rucksackbuch

--- src/catalog/layout/fop.clj
+++ src/catalog/layout/fop.clj
@@ -269,9 +269,10 @@
     (when show-genre?
       (block (wrap genre-text "Genre: ")))
     (block (wrap description))
-    (block (wrap producer-brief "" (if rucksackbuch?
-                                     (str ", Rucksackbuch Nr. " rucksackbuch-number)
-                                     "")))
+    (block
+     (if rucksackbuch?
+       (wrap producer-brief "" (str ", Rucksackbuch Nr. " rucksackbuch-number) false)
+       (wrap producer-brief)))
     (ausleihe-multi library-signature)
     (verkauf product-number price))))


Remove trailing blank lines

Remove trailing blank lines

--- src/braid/client/gateway/forms/join_group/events.cljs
+++ src/braid/client/gateway/forms/join_group/events.cljs
@@ -57,5 +57,3 @@
                (fn [error]
                  (when-let [k (get-in error [:response :error])]
                    (dispatch [::handle-error k])))}}))
-
-


slightly improve output if unification fails


Add only-if to delete statement

Add only-if to delete statement

--- src/clojure/clojurewerkz/cassaforte/new_query_api.clj
+++ src/clojure/clojurewerkz/cassaforte/new_query_api.clj
@@ -498,7 +498,10 @@
 (let [order {:what-columns 1
              :from         2
              :where        3
-             :using        4}
+             :if-exists    4
+             :only-if      5
+             :using        6
+             }
       renderers
       {:where        (fn where-query [query-builder m]
                        (let [[first-clause & more-clauses] (to-clauses m)
@@ -519,13 +522,20 @@
                                query-builder
                                columns))

-       :using         (fn using-query [query-builder m]
-                        (doseq [[key value] m]
-                          (.using query-builder ((get with-values key) value)))
-                        query-builder)
+       :only-if      (fn only-if-query [query-builder m]
+                       (let [[first & more] (to-clauses m)
+                             query-builder  (.onlyIf query-builder first)]
+                         (doseq [current more]
+                           (.and query-builder current))
+                         query-builder))
+
        :if-exists    (fn value-query [query-builder _]
                        (.ifExists query-builder))

+       :using        (fn using-query [query-builder m]
+                       (doseq [[key value] m]
+                         (.using query-builder ((get with-values key) value)))
+                       query-builder)
        }]

   (defn delete


(PE-4709) Fix another occurrence of 'jvm-puppet'

--- src/clj/puppetlabs/services/config/puppet_server_config_core.clj
+++ src/clj/puppetlabs/services/config/puppet_server_config_core.clj
@@ -1,5 +1,5 @@
 (ns ^{:doc
-       "Core logic for the implementation of the JvmPuppetConfigService in
+       "Core logic for the implementation of the PuppetServerConfigService in
         puppetlabs.services.config.puppet-server-config-service."}
     puppetlabs.services.config.puppet-server-config-core
   (:import (com.puppetlabs.puppetserver JRubyPuppet))


Load schema.core early, to ensure that class EnumSchema exists

--- dev-resources/user.clj
+++ dev-resources/user.clj
@@ -2,7 +2,11 @@
   (:use
     clojure.repl
     io.aviso.repl
-    speclj.config))
+    speclj.config)
+  (:require
+    ;; If not present, then test suite fails loading schema-validation with a ClassNotFound on EnumSchema
+    ;; Leaky abstractions ...
+    schema.core))

 (install-pretty-exceptions)


Add debug logging

Add debug logging

--- src/zap_router/core.clj
+++ src/zap_router/core.clj
@@ -9,6 +9,7 @@
   (println "Registering player" player "with stream" stream)
   (let [{:keys [players]} (swap! config #(update-in % [:players] assoc player stream))]
     (when (= 2 (count players))
+      (println "Players registered")
       (s/put! main-stream (.getBytes "player1:START:player2" "UTF-8"))
       (s/put! main-stream (.getBytes "player2:START:player1" "UTF-8")))))

@@ -29,6 +30,7 @@
           (println "Got input" target cmd params)
           (doseq [[player output-stream] (:players @config)]
             (when (= (name player) target)
+              (println "Sending to" target)
               @(s/put! output-stream (str cmd ":" params)))))
         (catch Exception e
           (println "Exception" e)))


Fix Swarm

Fix Swarm

It should give you Bad Publicity when rezzed

--- src/clj/game/cards-ice.clj
+++ src/clj/game/cards-ice.clj
@@ -539,7 +539,8 @@
                                                :server [:archives])))}]}

    "Swarm"
-   {:advanceable :always
+   {:effect (effect (gain :bad-publicity 1))
+    :advanceable :always
     :abilities [trash-program]}

    "Swordsman"
@@ -657,6 +658,6 @@
                  :optional {:prompt (msg "Add " (:title (first (:deck corp))) " to bottom of R&D?")
                             :msg "add the top card of R&D to the bottom"
                             :effect (effect (move (first (:deck corp)) :deck))}}]}
-
+
    "Zed 1.0"
    {:abilities [{:msg "do 1 brain damage" :effect (effect (damage :brain 1 {:card card}))}]}})


Implement run-constantly given max number of requests

--- src/clj_tutorials/core.clj
+++ src/clj_tutorials/core.clj
@@ -1,6 +1,6 @@
 (ns clj-tutorials.core
   (:require [org.httpkit.client :as http]
-            [clojure.core.async :as async :refer [go <! >!]]))
+            [clojure.core.async :as async :refer [go go-loop <!! <! >!]]))

@@ -70,7 +70,8 @@
 ; (STEP 6 "With timeout")

 (defn chan-http-get-with-timeout [url timeout result-channel]
-  (let [now     #(System/currentTimeMillis)
+  (let [
+          now     #(System/currentTimeMillis)
         start   (now)
         response (async/chan)]
     (go
@@ -87,28 +88,17 @@
     (repeatedly number-of-users #(collect-result cs))))

-; (STEP 7 "Constantly for given Duration")
+; (STEP 7 "Constantly")

-(defn now [] (System/currentTimeMillis))
-
-(defn chan-http-get-with-timeout [url timeout result-channel]
-  (let [start   (now)
-        response (async/chan)]
-    (go
-      (http/get url {} #(async/put! response [(- (now) start) (= 200 (:status %))]))
-      (let [[result c] (async/alts! [response (async/timeout timeout)])]
-        (if (= c response)
-          (>! result-channel result)
-          (>! result-channel [timeout false]))))))
-
-(defn- collect-result-and-launch-new [cs timeout url]
-  (let [[result c] (async/alts!! cs)]
-    (chan-http-get-with-timeout url timeout c)
-    result))
-
-(defn run-constantly [number-of-users timeout duration url]
-  (let [cs (repeatedly number-of-users async/chan)
-        stop? (fn [_] (< (now) (+ (now) duration)))]
+(defn run-constantly [number-of-users number-of-requests timeout url]
+  (let [cs       (repeatedly number-of-users async/chan)
+        results  (async/chan)]
     (doseq [c cs]
-        (go (chan-http-get-with-timeout url timeout c)))
-    (take-while stop? (map (fn [_] (collect-result-and-launch-new cs timeout url)) (range)))))
+        (chan-http-get-with-timeout url timeout c))
+    (go-loop [i 0]
+      (let [[result c] (async/alts! cs)]
+        (>! results result)
+        (chan-http-get-with-timeout url timeout c)
+        (when (<= i number-of-requests)
+          (recur (inc i)))))
+    (repeatedly number-of-requests #(<!! results))))


fix scaling of histogram

fix scaling of histogram

--- src/cljs/tictag/views.cljs
+++ src/cljs/tictag/views.cljs
@@ -89,13 +89,15 @@
      (doall
       (for [[d freq] @day-totals]
         ^{:key d}
-        [:rect
-         {:x      (xscale d)
-          :y      (- (density-yscale freq) margin)
-          :height (- height (density-yscale freq))
-          :style  {:opacity "0.2"}
-          :fill   "#0000cc"
-          :width  5}]))]))
+        (let [hours  (* freq 0.75)
+              scaled (density-yscale hours)]
+          [:rect
+           {:x      (xscale d)
+            :y      scaled
+            :height (- height scaled margin)
+            :style  {:opacity "0.2"}
+            :fill   "#0000cc"
+            :width  5}])))]))

 (defn matrix [xscale yscale]
   (let [pings (subscribe [:pings])]


Call handler with one worker

Call handler with one worker

--- src/cljs_workers/core.cljs
+++ src/cljs_workers/core.cljs
@@ -46,3 +46,16 @@
   (-> (.-data event)
       (js->clj :keywordize-keys true)))

+(defn do-with-worker!
+  ([worker request]
+   (do-with-worker! worker request nil))
+
+  ([worker {:keys [handler arguments transfer] :as request} fun]
+   (when fun
+     (->> (comp fun handle-response!)
+          (aset worker "onmessage")))
+   (try
+     (do-request! worker request)
+     (catch js/Object e
+       (when fun
+         (fun {:state :error, :error e}))))))


not miner

not miner

--- src/clojure/nossal/app.clj
+++ src/clojure/nossal/app.clj
@@ -61,8 +61,8 @@
   (GET "/breakout" request
     (breakout request))

-  (GET "/miner" request
-    (miner request))
+  ; (GET "/miner" request
+  ;   (miner request))

   (GET "/_ah/health" request
     (str "👌"))
@@ -105,7 +105,7 @@

 (def app
   (-> app-routes
-      (wrap-defaults (site-defaults-options site-defaults) )
+      (wrap-defaults (site-defaults-options site-defaults))
       (wrap-json-body {:keywords? true :bigdecimals? true})
       (ignore-trailing-slash)))


Use parkour default Configuration in fs functions.

--- src/clojure/parkour/fs.clj
+++ src/clojure/parkour/fs.clj
@@ -1,8 +1,8 @@
 (ns parkour.fs
-  (:require [clojure.java.io :as io])
+  (:require [clojure.java.io :as io]
+            [parkour (conf :as conf)])
   (:import [java.net URI URL]
            [java.io File]
-           [org.apache.hadoop.conf Configuration]
            [org.apache.hadoop.fs FileStatus FileSystem Path]))

 (defprotocol Coercions
@@ -30,8 +30,8 @@
 (defn path-fs
   "Hadoop filesystem for the path `p`."
   {:tag `FileSystem}
-  ([p] (path-fs (Configuration.) p))
-  ([conf p] (.getFileSystem (path p) ^Configuration conf)))
+  ([p] (path-fs (conf/ig) p))
+  ([conf p] (.getFileSystem (path p) (conf/ig conf))))

 (extend-protocol Coercions
   String


Add padding to top of chart because it was getting cut off


Use ring-name of modules in deployment/undeployment logging

--- src/containium/modules.clj
+++ src/containium/modules.clj
@@ -134,9 +134,9 @@
 (defn- update-status
   ([module manager command-logger success-state]
      (update-status module manager command-logger success-state nil))
-  ([{:keys [name error] :as module} manager command-logger success-state error-state]
+  ([{:keys [name ring-name error] :as module} manager command-logger success-state error-state]
      (let [status (if error error-state success-state)]
-       (info-all command-logger "Module" name "status has changed to" (clojure.core/name status))
+       (info-all command-logger "Module" ring-name "status has changed to" (clojure.core/name status))
        (fire-event manager :status name status)
        (assoc module :status status))))

@@ -154,24 +154,24 @@
    new-descriptor]
   (if-not error
     (if-let [descriptor (or new-descriptor descriptor)]
-      (try
-        (let [{:keys [containium profiles] :as descriptor} (clean-descriptor descriptor name)
-              boxure-config (-> (get-config (-> manager :systems :config) :modules)
-                                (assoc :profiles profiles))]
-          ;; Try to start the box.
-          (if-let [box (start-box descriptor boxure-config (:systems manager) command-logger)]
-            (let [box (assoc-in box [:project :containium] (-> box :descriptor :containium))
-                  ring-name (gensym name)]
-              ;; Register it with ring, if applicable.
-              (when (-> box :project :containium :ring)
-                (upstart-box (-> manager :systems :ring) ring-name box command-logger))
-              (info-all command-logger "Module" name "successfully deployed.")
-              (assoc module :box box :descriptor descriptor :ring-name ring-name))
-            ;; else if box failed to start.
-            (throw (Exception. (str "Box " name " failed to start.")))))
-        (catch Throwable ex
-          (error-all command-logger "Module" name "failed to deploy:" (.getMessage ex))
-          (assoc module :error true :descriptor descriptor)))
+      (let [ring-name (str (gensym (str name " (")) ")")]
+        (try
+          (let [{:keys [containium profiles] :as descriptor} (clean-descriptor descriptor name)
+                boxure-config (-> (get-config (-> manager :systems :config) :modules)
+                                  (assoc :profiles profiles))]
+            ;; Try to start the box.
+            (if-let [box (start-box descriptor boxure-config (:systems manager) command-logger)]
+              (let [box (assoc-in box [:project :containium] (-> box :descriptor :containium))]
+                ;; Register it with ring, if applicable.
+                (when (-> box :project :containium :ring)
+                  (upstart-box (-> manager :systems :ring) ring-name box command-logger))
+                (info-all command-logger "Module" ring-name "successfully deployed.")
+                (assoc module :box box :descriptor descriptor :ring-name ring-name))
+              ;; else if box failed to start.
+              (throw (Exception. (str "Box " ring-name " failed to start.")))))
+          (catch Throwable ex
+            (error-all command-logger "Module" ring-name "failed to deploy:" (.getMessage ex))
+            (assoc module :error true :descriptor descriptor))))
       (do (error-command command-logger "Module" name
                          "is new to containium, initial descriptor required.")
           (assoc module :error true)))
@@ -187,9 +187,9 @@
                  (remove-box (-> manager :systems :ring) (or (:ring-name old) ring-name)
                              command-logger))
                (stop-box name (or (:box old) box) command-logger (:systems manager)))
-         (do (info-all command-logger "Module" name "successfully undeployed.")
+         (do (info-all command-logger "Module" ring-name "successfully undeployed.")
              (if old module (dissoc module :box)))
-         (do (error-all command-logger "Module" name "failed to undeploy.")
+         (do (error-all command-logger "Module" ring-name "failed to undeploy.")
              (-> (if old module (dissoc module :box)) (assoc :error true))))
        module)))


whitespace cleanup

whitespace cleanup

--- test/block_chain/transaction_validations_test.clj
+++ test/block_chain/transaction_validations_test.clj
@@ -87,5 +87,4 @@
   (is (not (valid-address? @db
                            (assoc-in (txn/payment key-a addr-b 15 @db)
                                      [:outputs 0 :address]
-                                     "pizza"))))
-  )
+                                     "pizza")))))


CMR-1199: Changed to use format->mime-type

--- ingest-app/src/cmr/ingest/api/routes.clj
+++ ingest-app/src/cmr/ingest/api/routes.clj
@@ -304,9 +304,7 @@
   key set on the ExceptionInfo object passed in as parameter e. Defaults to json if
   the default format has not been set to :xml."
   [_request e]
-  (if (= :xml (:default-format (ex-data e)))
-    "application/xml"
-    "application/json"))
+  (mt/format->mime-type (:default-format (ex-data e))))

 (defn make-api [system]
   (-> (build-routes system)


Fix pattern-for-premise when premise is empty

--- src/main/clojure/conexp/fca/applications/wikidata.clj
+++ src/main/clojure/conexp/fca/applications/wikidata.clj
@@ -163,11 +163,13 @@
                     (str "wdt:"
                          property
                          " []"))]
-    (str "?entity "
-         (str/join
-          ";\n    "
-          (map to-clause premise))
-         " .")))
+    (if premise
+      (str "?entity "
+           (str/join
+            ";\n    "
+            (map to-clause premise))
+           " .")
+      "?entity ?someProperty [] \n [] wikibase:directClaim ?someProperty")))

 (defn- pattern-for-conclusion
   "generate a graph pattern not matching the given conclusion"


added pow function

added pow function

--- src/complex/number.cljc
+++ src/complex/number.cljc
@@ -175,6 +175,15 @@
         n-pos-sqrt (Math/sqrt n-pos)]
     (c [0 n-pos-sqrt])))

+(defn pow
+  "raise complex number z to the nth power
+  where n is given ineger"
+  [z n]
+  (assert (integer? n) "n must be an integer")
+  (loop [w z n n]
+    (cond (zero? n) one
+          (= 1 n) w
+          :else (recur (mult w z) (dec n)))))
 (comment
   ;; from the clojure repl
   (require '[complex.number] :reload)


Goofy transforms.

Goofy transforms.


Minor

Minor

--- web/src/immutant/web.clj
+++ web/src/immutant/web.clj
@@ -21,9 +21,7 @@
                                              validate-options enum->set mapply]]
             [immutant.web.middleware :refer [add-middleware]])
   (:import org.projectodd.wunderboss.WunderBoss
-           org.projectodd.wunderboss.web.Web
-           org.projectodd.wunderboss.web.Web$CreateOption
-           org.projectodd.wunderboss.web.Web$RegisterOption))
+           [org.projectodd.wunderboss.web Web Web$CreateOption Web$RegisterOption]))

 (defn ^{:valid-options (conj (enum->set Web$CreateOption) :name)}
   server
@@ -50,16 +48,17 @@
 (defn unmount
   "Unmount handler at context path"
   ([] (unmount "/"))
-  ([context-path] (unmount (server) context-path))
-  ([server context-path]
+  ([context-path] (unmount context-path (server)))
+  ([context-path server]
      (.unregister server context-path)))

-(defn mount-servlet
+(defn ^{:valid-options #{:context-path}}
+  mount-servlet
   "Mount a servlet on a server"
   [server servlet & {:as opts}]
   (let [opts (->> opts
                (merge {:context-path "/"})
-               (validate-options mount))]
+               (validate-options mount-servlet))]
     (.registerServlet server servlet
       (extract-options opts Web$RegisterOption))))


make the gc key optional in waiter metrics assertion (#76)

--- waiter/integration/waiter/metrics_output_test.clj
+++ waiter/integration/waiter/metrics_output_test.clj
@@ -84,7 +84,7 @@
 (def waiter-metrics-schema
   {(s/required-key "autoscaler") s/Any
    (s/required-key "core") s/Any
-   (s/required-key "gc") s/Any
+   (s/optional-key "gc") s/Any
    (s/required-key "requests") s/Any
    (s/required-key "state") s/Any
    s/Str s/Any})