use non -int -float version of fns to dynamically call the correct version. Use -int or -float if you want a faster path.

--- src/processing/core.clj
+++ src/processing/core.clj
@@ -18,6 +18,12 @@
 (def ^{:dynamic true} ^PApplet *applet*)
 (def ^{:dynamic true} *state*)

+(defn- int-like?
+  [val]
+  (let [t (type val)]
+    (or (= java.lang.Long t)
+        (= java.lang.Integer t))))
+
 (defn state
   "Retrieve canvas-specific state by key. Must initially call
   set-state! to store state.
@@ -56,22 +62,27 @@
   [n]
   (PApplet/abs (float n)))

-(def ^{:arglists (:arglists (meta #'abs-float))
-       :doc (:doc (meta #'abs-float))}
-  abs abs-float)
+(defn abs
+  "Calculates the absolute value (magnitude) of a number. The
+  absolute value of a number is always positive. Dynamically casts to
+  an int or float appropriately"
+    [n]
+    (if (int-like? n)
+      (abs-int n)
+      (abs-float n)))

 (defn acos
   "The inverse of cos, returns the arc cosine of a value. This
   function expects the values in the range of -1 to 1 and values are
   returned in the range 0 to Math/PI (3.1415927)."
   [n]
-  (PApplet/acos n))
+  (PApplet/acos (float n)))

 (defn alpha
   "Extracts the alpha value from a color."
   [color] (.alpha *applet* (int color)))

-(defn ambient
+(defn ambient-float
   "Sets the ambient reflectance for shapes drawn to the screen. This
   is combined with the ambient light component of environment. The
   color components set through the parameters define the
@@ -91,6 +102,17 @@
   [rgb]
   (.ambient
    *applet* (int rgb)))
+
+(defn ambient
+  "Sets the ambient reflectance for shapes drawn to the screen. This
+  is combined with the ambient light component of environment. The
+  color components set through the parameters define the
+  reflectance. For example in the default color mode, setting x=255,
+  y=126, z=0, would cause all the red light to reflect and half of the
+  green light to reflect. Used in combination with emissive, specular,
+  and shininess in setting the material properties of shapes."
+  ([rgb] (if (int-like? rgb) (ambient-int rgb) (ambient-float rgb)))
+  ([x y z] (ambient-float x y z)))

 (defn ambient-light
   "Adds an ambient light. Ambient light doesn't come from a specific direction,
@@ -168,7 +190,7 @@

   It is not possible to use transparency (alpha) in background colors
   with the main drawing surface, however they will work properly with
-  create-graphics."
+  create-graphics. Converts args to floats."
   ([gray] (.background *applet* (float gray)))
   ([gray alpha] (.background *applet* (float gray) (float alpha)))
   ([r g b] (.background *applet* (float r) (float g) (float b)))
@@ -182,13 +204,23 @@

   It is not possible to use transparency (alpha) in background colors
   with the main drawing surface, however they will work properly with
-  create-graphics."
+  create-graphics. Converts rgb to an int and alpha to a float."
   ([rgb] (.background *applet* (int rgb)))
   ([rgb alpha] (.background *applet* (int rgb) (float alpha))))

-(def ^{:arglists (:arglists (meta #'background-float))
-       :doc (:doc (meta #'background-float))}
-  background background-float)
+(defn background
+  "Sets the color used for the background of the Processing
+  window. The default background is light gray. In the draw function,
+  the background color is used to clear the display window at the
+  beginning of each frame.
+
+  It is not possible to use transparency (alpha) in background colors
+  with the main drawing surface, however they will work properly with
+  create-graphics. Converts args to floats."
+  ([rgb] (if (int-like? rgb) (background-int rgb) (background-float rgb)))
+  ([rgb alpha] (if (int-like? rgb) (background-int rgb alpha) (background-float rgb alpha)))
+  ([r g b] (background-float r g b))
+  ([r g b a] (background-float r g b a)))

 (defn background-image
   "Specify an image to be used as the background for a sketch. Its
@@ -528,7 +560,7 @@
   [n]
   (PApplet/ceil (float n)))

-(defn color-float
+(defn color
   "Creates an integer representation of a color The parameters are
   interpreted as RGB or HSB values depending on the current
   color-mode. The default mode is RGB values from 0 to 255 and
@@ -543,26 +575,6 @@
   ([gray alpha] (.color *applet* (float gray) (float alpha)))
   ([r g b] (.color *applet* (float r) (float g) (float b)))
   ([r g b a] (.color *applet* (float r) (float g) (float b) (float a))))
-
-(defn color-int
-    "Creates an integer representation of a color The parameters are
-  interpreted as RGB or HSB values depending on the current
-  color-mode. The default mode is RGB values from 0 to 255 and
-  therefore, the function call (color 255 204 0) will return a bright
-  yellow. Args are cast to ints.
-
-  r - red or hue value
-  g - green or saturation value
-  b - blue or brightness value
-  a - alpha value"
-  ([gray] (.color *applet* (int gray)))
-  ([gray alpha] (.color *applet* (int gray) (float alpha)))
-  ([r g b] (.color *applet* (int r) (int g) (int b)))
-  ([r g b a] (.color *applet* (int r) (int g) (int b) (int a))))
-
-(def ^{:arglists (:arglists (meta #'color-float))
-       :doc (:doc (meta #'color-float))}
-  color color-float)

 (defn ^{:private true}
   color-modes {:rgb RGB
@@ -609,9 +621,12 @@
   [amt low high]
   (PApplet/constrain (int amt) (int low) (int high)))

-(def ^{:arglists (:arglists (meta #'constrain-float))
-       :doc (:doc (meta #'constrain-float))}
-  constrain constrain-float)
+(defn constrain
+  "Constrains a value to not exceed a maximum and minimum value."
+  [amt low high]
+  (if (int-like? amt)
+    (constrain-int amt low high)
+    (constrain-float amt low high)))

 (defn copy
   "Copies a region of pixels from the display window to another area
@@ -873,8 +888,7 @@
   drawn to the screen. Used in combination with ambient, specular, and
   shininess in setting the material properties of shapes. Converts all
   args to ints"
-  ([int-val] (.emissive *applet* (int int-val)))
-  ([r g b] (.emissive *applet* (int r) (int g) (int b))))
+  [int-val] (.emissive *applet* (int int-val)))

 (defn emissive
   "Sets the emissive color of the material used for drawing shapes
@@ -883,10 +897,14 @@

   If passed one arg - it is assumed to be an int (i.e. a color),
    multiple args are converted to floats."
-  ([col-int] (.emissive *applet* (int col-int)))
-  ([r g b] (.emissive *applet* (float r) (float g) (float b))))
-
-(defn end-raw [] (.endRaw *applet*))
+  ([c] (if (int-like? c) (emissive-int c) (emissive-float c)))
+  ([r g b] (emissive-float r g b)))
+
+(defn end-raw
+  "Complement to begin-raw; they must always be used together. See
+  the begin-raw docstring for details."
+  []
+  (.endRaw *applet*))

 (defn end-shape
   "May only be called after begin-shape. When end-shape is called,
@@ -918,17 +936,20 @@
   will specify that all subsequent shapes will be filled with orange."
   ([gray] (.fill *applet* (float gray)))
   ([gray alpha] (.fill *applet* (float gray) (float alpha)))
-  ([x y z] (.fill *applet* (float x) (float y) (float z)))
-  ([x y z alpha] (.fill *applet* (float x) (float y) (float z) (float alpha))))
+  ([r g b] (.fill *applet* (float r) (float g) (float b)))
+  ([r g b alpha] (.fill *applet* (float r) (float g) (float b) (float alpha))))

 (defn fill-int
   "Sets the color used to fill shapes."
   ([rgb] (.fill *applet* (int rgb)))
   ([rgb alpha] (.fill *applet* (int rgb) (float alpha))))

-(def ^{:arglists (:arglists (meta #'fill-float))
-       :doc (:doc (meta #'fill-float))}
-  fill fill-float)
+(defn fill
+  "Sets the color used to fill shapes."
+  ([rgb] (if (int-like? rgb) (fill-int rgb) (fill-float rgb)))
+  ([rgb alpha] (if (int-like? rgb) (fill-int rgb alpha) (fill-float rgb alpha)))
+  ([r g b] (fill-float r g b))
+  ([r g b a] (fill-float r g b a)))

 (def ^{:private true}
   filter-map {:threshold THRESHOLD
@@ -1736,20 +1757,24 @@
     mode))

 (defn stroke-float
-  "Sets the color used to draw lines and borders around shapes."
+  "Sets the color used to draw lines and borders around
+  shapes. Converts all args to floats"
   ([gray] (.stroke *applet* (float gray)))
   ([gray alpha] (.stroke *applet* (float gray) (float alpha)))
   ([x y z] (.stroke *applet* (float x) (float y) (float z)))
   ([x y z a] (.stroke *applet* (float x) (float y) (float z) (float a))))

 (defn stroke-int
-  "Sets the color used to draw lines and borders around shapes."
+  "Sets the color used to draw lines and borders around
+  shapes. Converts rgb to int and alpha to a float."
   ([rgb] (.stroke *applet* (int rgb)))
   ([rgb alpha] (.stroke *applet* (int rgb) (float alpha))))

-(def ^{:arglists (:arglists (meta #'stroke-float))
-       :doc (:doc (meta #'stroke-float))}
-  stroke stroke-float)
+(defn stroke
+  ([rgb] (if (int-like? rgb) (stroke-int rgb) (stroke-float rgb)))
+  ([rgb alpha] (if (int-like? rgb) (stroke-int rgb alpha) (stroke-float rgb alpha)))
+  ([x y z] (stroke-float x y z))
+  ([x y z a] (stroke-float x y z a)))

 (defn stroke-cap
   "Sets the style for rendering line endings. These ends are either
@@ -1759,7 +1784,29 @@
   (let [cap-mode (resolve-stroke-cap-mode cap-mode)]
     (.strokeCap *applet* (int cap-mode))))

-(defn stroke-join [jn] (.strokeJoin *applet* (int jn)))
+(def ^{:private true}
+  stroke-join-modes {:miter PConstants/MITER
+                     :bevel PConstants/BEVEL
+                     :round PConstants/ROUND})
+
+(defn- resolve-stroke-join-mode
+  [mode]
+  (if (keyword? mode)
+    (get stroke-join-modes mode)
+    mode))
+
+(defn stroke-join
+  "Sets the style of the joints which connect line
+  segments. These joints are either mitered, beveled, or rounded and
+  specified with the corresponding parameters :miter, :bevel, and
+  :round. The default joint is :miter.
+
+  This function is not available with the P2D, P3D, or OPENGL
+  renderers (see bug report). More information about the renderers can
+  be found in the size reference."
+  [join-mode]
+  (let [join-mode (resolve-stroke-join-mode join-mode)]
+    (.strokeJoin *applet* (int join-mode))))

 (defn stroke-weight
   "Sets the width of the stroke used for lines, points, and the border
@@ -1767,7 +1814,13 @@
   [weight]
   (.strokeWeight *applet* (float weight)))

-(defn tan [angle] (PApplet/tan (float angle)))
+(defn tan
+  "Calculates the ratio of the sine and cosine of an angle. This
+  function expects the values of the angle parameter to be provided in
+  radians (values from 0 to PI*2). Values are returned in the range
+  infinity to -infinity."
+  [angle]
+  (PApplet/tan (float angle)))

 (defn char->text
   ([c] (.text *applet* (char c)))
@@ -1820,16 +1873,59 @@
   [^String s] (.textWidth *applet* s))

 (defn tint-float
+  "Sets the fill value for displaying images. Images can be tinted to
+  specified colors or made transparent by setting the alpha.
+
+  To make an image transparent, but not change it's color, use white
+  as the tint color and specify an alpha value. For instance,
+  tint(255, 128) will make an image 50% transparent (unless
+  colorMode() has been used).
+
+  The value for the parameter gray must be less than or equal to the
+  current maximum value as specified by colorMode(). The default
+  maximum value is 255.
+
+  Also used to control the coloring of textures in 3D."
   ([gray] (.tint *applet* (float gray)))
   ([gray alpha] (.tint *applet* (float gray) (float alpha)))
-  ([x y z] (.tint *applet* (float x)(float y) (float z)))
-  ([x y z a] (.tint *applet* (float x)(float y) (float z) (float a))))
+  ([r g b] (.tint *applet* (float r)(float g) (float b)))
+  ([r g b a] (.tint *applet* (float g) (float g) (float b) (float a))))

 (defn tint-int
+  "Sets the fill value for displaying images. Images can be tinted to
+  specified colors or made transparent by setting the alpha.
+
+  To make an image transparent, but not change it's color, use white
+  as the tint color and specify an alpha value. For instance,
+  tint(255, 128) will make an image 50% transparent (unless
+  colorMode() has been used).
+
+  The value for the parameter gray must be less than or equal to the
+  current maximum value as specified by colorMode(). The default
+  maximum value is 255.
+
+  Also used to control the coloring of textures in 3D."
   ([rgb] (.tint *applet* (int rgb)))
   ([rgb alpha] (.tint *applet* (int rgb) (float alpha))))

-(def tint tint-float)
+(defn tint
+  "Sets the fill value for displaying images. Images can be tinted to
+  specified colors or made transparent by setting the alpha.
+
+  To make an image transparent, but not change it's color, use white
+  as the tint color and specify an alpha value. For instance,
+  tint(255, 128) will make an image 50% transparent (unless
+  colorMode() has been used).
+
+  The value for the parameter gray must be less than or equal to the
+  current maximum value as specified by colorMode(). The default
+  maximum value is 255.
+
+  Also used to control the coloring of textures in 3D."
+  ([rgb] (if (int-like? rgb) (tint-int rgb) (tint-float rgb)))
+  ([rgb alpha] (if (int-like? rgb) (tint-int rgb alpha) (tint-float rgb alpha)))
+  ([r g b] (tint-float r g b))
+  ([r g b a] (tint-float r g b a)))

 (defn translate
   "Specifies an amount to displace objects within the display


Multiple changes: 1. request-summary is far more useful than request-duration-counter in prometheus so we can remove the counter 2. path labels on busy RESTful apps seem to overload prometheus with metrics so we should remove these

--- src/prometheus/core.clj
+++ src/prometheus/core.clj
@@ -8,7 +8,6 @@
     (java.io StringWriter ByteArrayOutputStream ByteArrayInputStream)))

 (def request-counter (atom nil))
-(def request-duration-counter (atom nil))
 (def request-summary (atom nil))

 (defn- make-request-counter [namespace]
@@ -17,14 +16,6 @@
       (.name "http_requests_total")
       (.labelNames (into-array String ["method" "status" "path"]))
       (.documentation "A counter of the total number of HTTP requests processed.")
-      (.build)))
-
-(defn- make-request-duration-counter [namespace]
-  (-> (Counter/newBuilder)
-      (.namespace namespace)
-      (.name "http_request_durations_milliseconds_total")
-      (.labelNames (into-array String ["method" "status" "path"]))
-      (.documentation "The total amount of time Ring has spent answering HTTP requests (in milliseconds).")
       (.build)))

 (defn- make-request-summary [namespace]
@@ -36,39 +27,30 @@
       (.purgeInterval 2 TimeUnit/MINUTES)
       (.build)))

-(defn- record-request-metric [request-method request-path response-status request-time]
+(defn- record-request-metric [request-method response-status request-time]
   (let [status-label (str (int (/ response-status 100)) "XX")
         method-label (.toUpperCase (name request-method))]
     (-> (.newPartial @request-counter)
         (.labelPair "method" method-label)
         (.labelPair "status" status-label)
-        (.labelPair "path" request-path)
         (.apply)
         (.increment))
-    (-> (.newPartial @request-duration-counter)
-        (.labelPair "method" method-label)
-        (.labelPair "status" status-label)
-        (.labelPair "path" request-path)
-        (.apply)
-        (.increment (double request-time)))
     (-> (.newPartial @request-summary)
         (.labelPair "method" method-label)
         (.labelPair "status" status-label)
-        (.labelPair "path" request-path)
         (.apply)
         (.observe (double request-time)))))

 (defn instrument-handler [handler]
   "Ring middleware to record request metrics"
   (fn [request]
-    (let [request-path (:uri request)
-          request-method (:request-method request)
+    (let [request-method (:request-method request)
           start-time (System/currentTimeMillis)
           response (handler request)
           finish-time (System/currentTimeMillis)
           response-status (or (:status response) 404)
           request-time (- finish-time start-time)]
-      (record-request-metric request-method request-path response-status request-time)
+      (record-request-metric request-method response-status request-time)
       response)))

 (defn metrics-json []
@@ -100,5 +82,4 @@
   (Prometheus/defaultInitialize)
   (Prometheus/defaultAddPreexpositionHook (Hotspot.))
   (reset! request-counter (make-request-counter namespace))
-  (reset! request-duration-counter (make-request-duration-counter namespace))
   (reset! request-summary (make-request-summary namespace)))


nothing

nothing

--- src/Miscellaneous/agentReview.clj
+++ src/Miscellaneous/agentReview.clj
@@ -1,132 +1,132 @@
-(ns Miscellaneous.agentReview)
-
-(require '[clojure.java.io :as javaio]
-         '[clojure.data.csv :as csv]
-         '[incanter.io :as io]
-         '[incanter.core :as incanter])
-
-(def data-file "D:/data/all_160_in_51.P35.csv")
-
-
-(defn lazy-read-csv
-  [csv-file]
-  (let [in-file (javaio/reader csv-file)
-        csv-seq (csv/read-csv in-file)
-        lazy (fn lazy [wrapped]
-               (lazy-seq
-                (if-let [s (seq wrapped)]
-                  (cons (first s) (lazy (rest s)))
-                  (.close in-file))))]
-    (lazy csv-seq)))
-
-
-(defn with-header [coll]
-  (let [headers (map keyword (first coll))]
-    (map (partial zipmap headers) (next coll))))
-
-(defn ->int ([i] (Integer. i)))
-
-(defn sum-item
-  ([fields] (partial sum-item fields))
-  ([fields accum item]
-   (mapv + accum (map ->int (map item fields)))))
-
-(defn sum-items
-  [accum fields coll]
-  (reduce (sum-item fields) accum coll))
-
-(defn accum-sums [a b] (mapv + a b))
-
-(defn div-vec [[a b]] (float (/ a b)))
-
-(defn force-value [a]
-  (await a)
-  @a)
-
-(defn main
-  ([data-file] (main data-file [:P035001 :HU100] 5 5))
-  ([data-file fields agent-count chunk-count]
-   (let [mzero (mapv (constantly 0) fields)
-         agents (map agent
-                     (take agent-count
-                           (repeat mzero)))]
-     (dorun
-      (->>
-       (lazy-read-csv data-file)
-       with-header
-       (partition-all chunk-count)
-       (map #(send %1 sum-items fields %2)
-            (cycle agents))))
-     (->> agents
-          (map force-value)
-          (reduce accum-sums mzero)
-          div-vec))))
-
-
-(main data-file)
-
-
-;;;;;;;;;;;;;;;;;;;;tips;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
-;The little difference between mapv and map
-
-(map + [1 2 3] [4 5 6] [5 8])
-
-(mapv + [1 2 3] [4 5 6] [5 8])
-
-
-;compare atom and agent,  synchonicity and asynchronicity
-;agent is asynchronous, so it returns right after you send it an action, no matter how long the action will actually take.
-;in contrast, atom only returns after the callings finally returns.
-;however, agent can block like atom by using function: await.
-
-(def c (agent 20000))
-(def b (atom 20000))
-(send c #(Thread/sleep %))
-(swap! b #(Thread/sleep %))
-@c
-@b
-(future (swap! b #(Thread/sleep %)))
-@b
-(await c)
-
-
-;ns-unmap do works, sometimes you may need it!
-
-(ns-unmap *ns* 'data-file)
-
-
-
-;;;;;;;;;;;;;;;not that smart;;;;;;;;;;;;;;;;;;;;;;;
-
-;maybe one day you would figure out what the following code means:
-
-(defn relay [x i]
-  (when (:next x)
-    (send (:next x) relay i))
-  (when (and (zero? i) (:report-queue x))
-    (.put (:report-queue x) i))
-  x)
-
-(defn run [m n]
-  (let [q (new java.util.concurrent.SynchronousQueue)
-        hd (reduce (fn [next _] (agent {:next next}))
-                   (agent {:report-queue q}) (range (dec m)))]
-    (doseq [i (reverse (range n))]
-      (send hd relay i))
-    (.take q)))
-
-;(time (run 1000 1000))
-
-
-
-
-
-
-
-
-
-
-
-
-
+(ns Miscellaneous.agentReview)
+
+(require '[clojure.java.io :as javaio]
+         '[clojure.data.csv :as csv]
+         '[incanter.io :as io]
+         '[incanter.core :as incanter])
+
+(def data-file "D:/data/all_160_in_51.P35.csv")
+
+
+(defn lazy-read-csv
+  [csv-file]
+  (let [in-file (javaio/reader csv-file)
+        csv-seq (csv/read-csv in-file)
+        lazy (fn lazy [wrapped]
+               (lazy-seq
+                (if-let [s (seq wrapped)]
+                  (cons (first s) (lazy (rest s)))
+                  (.close in-file))))]
+    (lazy csv-seq)))
+
+
+(defn with-header [coll]
+  (let [headers (map keyword (first coll))]
+    (map (partial zipmap headers) (next coll))))
+
+(defn ->int ([i] (Integer. i)))
+
+(defn sum-item
+  ([fields] (partial sum-item fields))
+  ([fields accum item]
+   (mapv + accum (map ->int (map item fields)))))
+
+(defn sum-items
+  [accum fields coll]
+  (reduce (sum-item fields) accum coll))
+
+(defn accum-sums [a b] (mapv + a b))
+
+(defn div-vec [[a b]] (float (/ a b)))
+
+(defn force-value [a]
+  (await a)
+  @a)
+
+(defn main
+  ([data-file] (main data-file [:P035001 :HU100] 5 5))
+  ([data-file fields agent-count chunk-count]
+   (let [mzero (mapv (constantly 0) fields)
+         agents (map agent
+                     (take agent-count
+                           (repeat mzero)))]
+     (dorun
+      (->>
+       (lazy-read-csv data-file)
+       with-header
+       (partition-all chunk-count)
+       (map #(send %1 sum-items fields %2)
+            (cycle agents))))
+     (->> agents
+          (map force-value)
+          (reduce accum-sums mzero)
+          div-vec))))
+
+
+(main data-file)
+
+
+;;;;;;;;;;;;;;;;;;;;tips;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+;The little difference between mapv and map
+
+(map + [1 2 3] [4 5 6] [5 8])
+
+(mapv + [1 2 3] [4 5 6] [5 8])
+
+
+;compare atom and agent,  synchonicity and asynchronicity
+;agent is asynchronous, so it returns right after you send it an action, no matter how long the action will actually take.
+;in contrast, atom only returns after the callings finally returns.
+;however, agent can block like atom by using function: await.
+
+(def c (agent 20000))
+(def b (atom 20000))
+(send c #(Thread/sleep %))
+(swap! b #(Thread/sleep %))
+@c
+@b
+(future (swap! b #(Thread/sleep %)))
+@b
+(await c)
+
+
+;ns-unmap do works, sometimes you may need it!
+
+(ns-unmap *ns* 'data-file)
+
+
+
+;;;;;;;;;;;;;;;not that smart;;;;;;;;;;;;;;;;;;;;;;;
+
+;maybe one day you would figure out what the following code means:
+
+(defn relay [x i]
+  (when (:next x)
+    (send (:next x) relay i))
+  (when (and (zero? i) (:report-queue x))
+    (.put (:report-queue x) i))
+  x)
+
+(defn run [m n]
+  (let [q (new java.util.concurrent.SynchronousQueue)
+        hd (reduce (fn [next _] (agent {:next next}))
+                   (agent {:report-queue q}) (range (dec m)))]
+    (doseq [i (reverse (range n))]
+      (send hd relay i))
+    (.take q)))
+
+;(time (run 1000 1000))
+
+
+
+
+
+
+
+
+
+
+
+
+


Load vault configs as clojure, not EDN.

Load vault configs as clojure, not EDN.

--- tool/vault/tool/config.clj
+++ tool/vault/tool/config.clj
@@ -1,11 +1,7 @@
 (ns vault.tool.config
   (:require
-    [clojure.edn :as edn]
     [clojure.java.io :as io]
-    [puget.printer :refer [cprint]]
-    (vault.blob.store
-      [file :refer [file-store]]
-      [memory :refer [memory-store]])))
+    [puget.printer :refer [cprint]]))

 ;; CONFIGURATION FILE LOADING
@@ -15,19 +11,13 @@
   (str (get (System/getenv) "HOME") "/.config/vault"))

-(def ^:private config-readers
-  "Map of EDN readers for supported types in config files."
-  {'vault/file-store file-store
-   'vault/memory-store (fn [_] (memory-store))})
-
-
 (defn- find-configs
   "Locates a sequence of configuration files with a particular name pattern.
   For example, if `dir` is '/foo/bar/' and `k` is :baz, then file
-  '/foo/bar/baz.edn' comes first (if it exists), followed by the files in
+  '/foo/bar/baz.clj' comes first (if it exists), followed by the files in
   '/foo/bar/baz/' (if it exists) in lexical order."
   [dir k]
-  (let [config-file (io/file dir (str (name k) ".edn"))
+  (let [config-file (io/file dir (str (name k) ".clj"))
         config-dir  (io/file dir (str (name k)))]
     (filter
       identity
@@ -36,12 +26,17 @@

 (defn- read-config
-  "Reads an EDN configuration file."
+  "Reads a Clojure configuration file."
   [path]
   (try
-    (edn/read-string
-      {:readers config-readers}
-      (slurp path))
+    (binding [*ns* *ns*]
+      (in-ns 'vault.tool.config.blob-stores)
+      (refer-clojure)
+      (require
+        '(vault.blob.store
+           [file :refer [file-store]]
+           [memory :refer [memory-store]]))
+      (load-string (slurp path)))
     (catch Exception e
       (println "Error loading config file" (str path))
       (.printStackTrace e)
@@ -56,9 +51,8 @@
   [dir opts k]
   (let [config (->> (find-configs dir k)
                     (map read-config)
-                    (apply merge))
-        config (merge config (opts k))]
-    (assoc opts k config)))
+                    (apply merge))]
+    (assoc opts k (merge config (opts k)))))

 (defn initialize
@@ -76,7 +70,7 @@
 ;{:default :local, :local #vault/file-store (:sha256 "/home/$USER/var/vault")}

-(defn- select-blob-store
+(defn select-blob-store
   "Recursively selects a blob store in a config map."
   [stores selection]
   (->> (or selection :default)


(SERVER-1079) Add init function to check for code-id-command

If code-id-command is not set in the config, code id will always be nil.
This seems like useful information for an end user, so this commit adds
an init function that checks the config for the setting, and logs a
message if it is not set.

--- src/clj/puppetlabs/services/versioned_code_service/versioned_code_service.clj
+++ src/clj/puppetlabs/services/versioned_code_service/versioned_code_service.clj
@@ -12,6 +12,12 @@
 (trapperkeeper/defservice versioned-code-service
                           vc/VersionedCodeService
                           [[:ConfigService get-in-config]]
+
+  (init
+   [this context]
+   (if (nil? (get-in-config [:versioned-code :code-id-command]))
+     (log/info "No code-id-command set for versioned-code-service. Code-id will be nil."))
+   context)

   (current-code-id
    [this environment]


remove old require

remove old require

--- src/babel/italiano/benchmark.cljc
+++ src/babel/italiano/benchmark.cljc
@@ -1,7 +1,6 @@
 (ns babel.italiano.benchmark
   (:refer-clojure :exclude [get-in])
-  (:require [babel.engine :refer [generate-all]]
-            [babel.italiano :refer [analyze generate parse]]
+  (:require [babel.italiano :refer [analyze generate parse]]
             [babel.italiano.grammar :refer [small medium np-grammar]]
             [babel.italiano.lexicon :refer [lexicon]]
             [babel.italiano.morphology :as morph :refer [analyze-regular fo replace-patterns]]


finish implementation of #117

finish implementation of #117

--- src/clj/com/rpl/specter/navs.cljc
+++ src/clj/com/rpl/specter/navs.cljc
@@ -72,6 +72,17 @@
     empty-map
     structure))

+(defn not-NONE? [v]
+  (-> v (identical? i/NONE) not))
+
+
+(defn- all-transform-list [structure next-fn]
+  ;; this is done to maintain order, otherwise lists get reversed
+  (->> structure
+       (into '()
+             (comp (map next-fn) (filter not-NONE?)))
+       reverse
+       ))

 (extend-protocol AllTransformProtocol
   nil
@@ -92,7 +103,7 @@
   (all-transform [structure next-fn]
     (into []
       (comp (map next-fn)
-            (filter #(-> % (identical? i/NONE) not)))
+            (filter not-NONE?))
       structure))

   #?(:clj clojure.lang.PersistentArrayMap)
@@ -158,9 +169,7 @@
      (all-transform [structure next-fn]
        (let [empty-structure (empty structure)]
          (cond (and (list? empty-structure) (not (queue? empty-structure)))
-            ;; this is done to maintain order, otherwise lists get reversed
-               ;;TODO: need to handle NONE here
-               (doall (map next-fn structure))
+               (all-transform-list structure next-fn)

                (map? structure)
                ;; reduce-kv is much faster than doing r/map through call to (into ...)
@@ -178,19 +187,19 @@
                :else
                (->> structure
                     (r/map next-fn)
-                    (r/filter #(-> % (identical? i/NONE) not))
+                    (r/filter not-NONE?)
                     (into empty-structure))))))

   #?(:cljs default)
   #?(:cljs
      (all-transform [structure next-fn]
-       ;;TODO: need to handle NONE here
        (let [empty-structure (empty structure)]
          (if (and (list? empty-structure) (not (queue? empty-structure)))
-        ;; this is done to maintain order, otherwise lists get reversed
-           (doall (map next-fn structure))
-           (into empty-structure (map #(next-fn %)) structure))))))
+           (all-transform-list structure next-fn)
+           (into empty-structure
+                 (comp (map next-fn) (filter not-NONE?))
+                 structure))))))


Ensure there are no duplicate records in CDM output

--- src/clj/forma/hadoop/jobs/cdm.clj
+++ src/clj/forma/hadoop/jobs/cdm.clj
@@ -82,7 +82,7 @@
   [src gadm-src nodata zoom tres tres-out start thresh]
   (let [epoch (date/datetime->period tres-out "2000-01-01")
         start-period (date/datetime->period tres start)]
-    (<- [?x ?y ?z ?p ?iso ?lat ?lon]
+    (<- [?x ?y ?z ?p ?iso]
         (src ?sres ?modh ?modv ?s ?l ?prob-series)
         (gadm-src _ ?modh ?modv ?s ?l ?gadm)
         (gadm->iso ?gadm :> ?iso)
@@ -94,4 +94,5 @@
         (min-period ?rp :> ?p)
         (r/modis->latlon ?sres ?modh ?modv ?s ?l :> ?lat ?lon)
         (latlon-valid? ?lat ?lon)
-        (latlon->tile ?lat ?lon zoom :> ?x ?y ?z))))
+        (latlon->tile ?lat ?lon zoom :> ?x ?y ?z)
+        (:distinct true))))


Move query into new function.

Move query into new function.

--- src/clj/forma/hadoop/jobs/cdm.clj
+++ src/clj/forma/hadoop/jobs/cdm.clj
@@ -63,10 +63,13 @@
         (identity z :> ?z))))

-(let [source-tap (hfs-seqfile "s3n://formaresults/finaloutput")
-      sink-tap (hfs-delimited
-                "s3n://formaresults/analysis/cdm-map-tile-coordinates.csv"
-                :delimiter ","
-                :outfields ["?x" "?y" "?z" "?p"])]
-  (?- sink-tap
-      (convert-for-vizz {:est-start "2005-12-31"} source-tap 50 "16" "32")))
+(defn forma->cdm
+  "Query that builds up the FORMA data for GFW."
+  []
+  (let [source-tap (hfs-seqfile "s3n://formaresults/finaloutput")
+        sink-tap (hfs-delimited
+                  "s3n://formaresults/analysis/cdm-map-tile-coordinates.csv"
+                  :delimiter ","
+                  :outfields ["?x" "?y" "?z" "?p"])]
+    (?- sink-tap
+        (convert-for-vizz {:est-start "2005-12-31"} source-tap 50 "16" "32"))))


removed extra todo comment.

removed extra todo comment.

--- src/clj/forma/source/tilesets.clj
+++ src/clj/forma/source/tilesets.clj
@@ -17,8 +17,6 @@
    :THA #{[27 6] [27 7] [28 7] [27 8] [28 8]}
    :VNM #{[27 6] [27 7] [28 7] [28 8]}})

-;; TODO: If we get vectors, do something. if we get a keywork, look it
-;; up in the map.
 (defn tile-set
   "set of unique MODIS tiles for the specified
   countries (union). Example usage:


Add link to general tutorial for people new to Clojure. Fix https://github.com/quil/quil-site/issues/15.

--- src/clj/quil_site/views/about.clj
+++ src/clj/quil_site/views/about.clj
@@ -74,10 +74,10 @@
             [:li "Build the project: "[:code "lein cljsbuild once"]]
             [:li "Open " [:code "index.html"]]]]]

-         [:p "Check out tutorials for using Quil in "
+         [:p "If you're new to Clojure check out "
+          (link-to "https://github.com/quil/quil/wiki/Installing" "this tutorial")
+          " or tutorial for "
           (link-to "https://github.com/quil/quil/wiki/Dynamic-Workflow-%28for-LightTable%29" "Light Table")
-          " and general "
-          (link-to "https://github.com/quil/quil/wiki/Dynamic-Workflow-%28for-REPL%29" "REPL")
           "."]]

         [:div.section


Load preferences from server when after user logged in.

--- src/cljs/nonojure/puzzleview.cljs
+++ src/cljs/nonojure/puzzleview.cljs
@@ -180,6 +180,10 @@
   (stg/save-preferences storage style nil)
   (pw/change-style! widget style)
   state)
+
+(defn reload-style-from-storage [storage widget]
+  (stg/load-preferences storage
+                        #(pw/change-style! widget (or % {}))))

 (defn load-progress [id storage event-chan]
   (stg/load-progress storage [id]
@@ -226,6 +230,7 @@
                        :storage-changed (do (when-let [id (get-in state [:puzzle :id])]
                                               (load-progress id @stg/storage event-chan))
                                             (pw/clear-puzzle! (:widget state))
+                                            (reload-style-from-storage @stg/storage (:widget state))
                                             (-> state
                                                 clear-state
                                                 (assoc :storage @stg/storage)))
@@ -251,6 +256,5 @@

 (defn ^:export init [view]
   (pw/init! view)
-  (stg/load-preferences @stg/storage
-                        #(pw/change-style! view (or % {})))
+  (reload-style-from-storage @stg/storage view)
   (start-async-loop view))


payment spec

payment spec

--- src/clojure/nossal/shop/spec.cljc
+++ src/clojure/nossal/shop/spec.cljc
@@ -31,6 +31,8 @@
                                ::available?
                                ::images]))
 (s/def ::variants (s/coll-of ::variant :kind vector? :distinct true :into []))
+(s/def ::product-condition #{:used :brand-new :almost-new})
+(s/def ::stock-location #{:brazil :china :usa :sweden :switzerland :local})

 (s/def ::product (s/keys :req-un [::id
                                   ::market-price
@@ -41,6 +43,8 @@
                                   ::images
                                   ::category
                                   ::stock-count
+                                  ::product-condition
+                                  ::stock-location
                                   ::available?]
                          :opt-un [::variants]))
 (s/def ::products (s/and
@@ -53,8 +57,7 @@

 (s/def ::cep (s/def (s/and string? #(re-matches cep-regex %))))
 (s/def ::street-address (s/keys :req [::street ::number]
-                                :opt [::building ::apt]))
-
+                                :opt [::complement]))
 (s/def ::country #{:brazil})
 (s/def ::address (s/keys :req [::cep
                                ::country
@@ -62,22 +65,39 @@
                                ::city
                                ::street-address]))

-(s/def ::shipping-tracker string?)
+
+(s/def ::shipping-tracking string?)

 (s/def ::order (s/keys :req-un [::id
                                 ::basket
-                                ::costumer
+                                ::customer
                                 ::status
                                 ::payment
-                                ::shipping-tracker
+                                ::shipping-tracking
                                 ::address
                                 ::creation-time]))
+(s/def ::creadit-card (s/keys :req [::card-number
+                                    ::holder
+                                    ::expiration-date
+                                    ::security-code
+                                    ::brand
+                                    ::save-card]))
+
+(s/def ::payment-type #{:creadit-card :debit-card :boleto})
+(s/def ::payment (s/keys :req-un [::payment-type
+                                  ::amount
+                                  ::installments
+                                  ::soft-descriptor]))
+
+
 (s/def ::name (s/keys :req [::first-name ::last-name]))
-(s/def ::costumer (s/keys :req [::id
+(s/def ::customer (s/keys :req [::id
                                 ::name
                                 ::email
                                 ::address]
                           :opt [::phone
+                                ::birthdate
                                 ::cpf]))

 (s/def ::db (s/keys :req-un [::products ::basket]))
+


writing to jobs dir in tmp19

writing to jobs dir in tmp19

--- src/clueweb_disqus/read_stats.clj
+++ src/clueweb_disqus/read_stats.clj
@@ -3,7 +3,8 @@
   (:gen-class :main true)
   (:require [clj-time.core :as t]
             [clj-time.coerce :as c]
-            [clojure.java.io :as io])
+            [clojure.java.io :as io]
+            [clueweb-disqus.core :as core])
   (:use [clojure.pprint :only [pprint]]
         [incanter core stats charts io]))

@@ -12,7 +13,7 @@
   (let [stats-files (filter
                      (fn [f]
                        (re-find #".stats$" (.getAbsolutePath f)))
-                     (file-seq (java.io.File. ".")))]
+                     (file-seq (java.io.File. core/disqus-jobs-dir)))]
     (reduce
      (fn [acc s]
        (+ acc (read-string (slurp s))))
@@ -24,7 +25,7 @@
   (let [data-files (filter
                      (fn [f]
                        (re-find #".*-disqus-threads-.*.clj$" (.getAbsolutePath f)))
-                     (file-seq (java.io.File. ".")))]
+                     (file-seq (java.io.File. core/disqus-jobs-dir)))]
     (str
      "<html>"
      "<body>"


Fixed race-condition in make-generator

Fixed race-condition in make-generator

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

--- src/conexp/contrib/generators.clj
+++ src/conexp/contrib/generators.clj
@@ -36,21 +36,30 @@
 ;;                100)
 ;;   -> (0 1 2 3 ...)

+(set! *warn-on-reflection* true)
+
 (defmacro make-generator
   ""
   [function]
-  `(let [#^SynchronousQueue queue# (SynchronousQueue.),
-	 end# (atom false)]
-     (letfn [(~(symbol "yield") [x#] (.put queue# x#))]
-       (fn [& args#]
+  `(fn [& args#]
+     (let [#^SynchronousQueue queue# (SynchronousQueue.),
+	   end# (atom false),
+	   eos# (Object.)]
+       (letfn [(~(symbol "yield") [x#] (.put queue# x#))]
 	 (.start (Thread. (fn []
 			    (apply ~function args#)
-			    (swap! end# (constantly true)))))
+			    (.put queue# eos#))))
 	 (fn []
-	   (if @end# ; -> race condition! (if we are faster than our thread we may halt here)
-	     (throw
-	      (java.util.NoSuchElementException. "No more elements to generate."))
-	     (.take queue#)))))))
+	   (let [next# (if @end#
+			 eos#
+			 (let [new# (.take queue#)]
+			   (if (= new# eos#)
+			     (reset! end# true))
+			   new#))]
+	     (if @end#
+	       (throw
+		(java.util.NoSuchElementException. "No more elements to generate."))
+	       next#)))))))

 (defmacro defg
   ""


Optimize proc fn creation.

Optimize proc fn creation.

--- src/dsbdp/data_processing_dsl.clj
+++ src/dsbdp/data_processing_dsl.clj
@@ -112,14 +112,13 @@
   [dsl-expression]
 ;  (println "Got DSL expression:" dsl-expression)
   (let [input-sym 'input
-        output-sym 'output
         output-type (name (:output-type dsl-expression))
         rules (:rules dsl-expression)
-        fn-body-vec (condp = output-type
-                      "java-map" (create-proc-fn-body-java-map-out input-sym rules nil)
-                      "java-map-inc" (create-proc-fn-body-java-map-out input-sym rules output-sym)
-                      "clj-map" (create-proc-fn-body-clj-map-out input-sym rules nil)
-                      "clj-map-inc" (create-proc-fn-body-clj-map-out input-sym rules output-sym)
+        output-sym (if (.endsWith output-type "-inc")
+                     'output)
+        fn-body-vec (condp (fn [v s] (.startsWith s v)) output-type
+                      "java-map" (create-proc-fn-body-java-map-out input-sym rules output-sym)
+                      "clj-map" (create-proc-fn-body-clj-map-out input-sym rules output-sym)
                       "csv-str" (create-proc-fn-body-csv-str-out input-sym rules)
                       "json-str" (create-proc-fn-body-json-str-out input-sym rules)
                       (do
@@ -129,7 +128,7 @@
 ;        _ (println "Created data processing function vector from DSL:" fn-body-vec)
         fn-body (reverse (into '() fn-body-vec))
 ;        _ (println "Created data processing function body:" fn-body)
-        data-processing-fn (if (.endsWith output-type "-inc")
+        data-processing-fn (if (not (nil? output-sym))
                              (eval `(fn [~input-sym ~output-sym] ~fn-body))
                              (eval `(fn [~input-sym] ~fn-body)))]
     data-processing-fn))


Adds basic tab bar along bottom

Adds basic tab bar along bottom

--- src/hundred_pushups/ios/core.cljs
+++ src/hundred_pushups/ios/core.cljs
@@ -15,6 +15,8 @@
 (def image (r/adapt-react-class (.-Image ReactNative)))
 (def scroll-view (r/adapt-react-class ReactNative.ScrollView))
 (def touchable-highlight (r/adapt-react-class (.-TouchableHighlight ReactNative)))
+(def tab-bar (r/adapt-react-class ReactNative.TabBarIOS))
+(def tab-bar-item (r/adapt-react-class ReactNative.TabBarIOS.Item))

 (def pushup-form-url "http://www.100pushups.com/perfect-pushups-posture/")

@@ -32,7 +34,7 @@
   [view {}
    [text {:style {:text-align "center"}} "Before you start doing pushups, learn optimal pushup technique"]
    [touchable-highlight {:style {:background-color "#999" :padding 10 :border-radius 5}
-                        :on-press #(.openURL linking pushup-form-url)}
+                         :on-press #(.openURL linking pushup-form-url)}
     [text {:style {:color "white" :text-align "center" :font-weight "bold"}} "Read article about form"]
     ]
    [touchable-highlight {:style {:background-color "#999" :padding 10 :border-radius 5 :margin 10}
@@ -135,27 +137,44 @@
        [text {:style {:color "white" :text-align "center" :font-weight "bold"}} "Done!"]]]
      )])

+(def base64-icon "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEsAAABLCAQAAACSR7JhAAADtUlEQVR4Ac3YA2Bj6QLH0XPT1Fzbtm29tW3btm3bfLZtv7e2ObZnms7d8Uw098tuetPzrxv8wiISrtVudrG2JXQZ4VOv+qUfmqCGGl1mqLhoA52oZlb0mrjsnhKpgeUNEs91Z0pd1kvihA3ULGVHiQO2narKSHKkEMulm9VgUyE60s1aWoMQUbpZOWE+kaqs4eLEjdIlZTcFZB0ndc1+lhB1lZrIuk5P2aib1NBpZaL+JaOGIt0ls47SKzLC7CqrlGF6RZ09HGoNy1lYl2aRSWL5GuzqWU1KafRdoRp0iOQEiDzgZPnG6DbldcomadViflnl/cL93tOoVbsOLVM2jylvdWjXolWX1hmfZbGR/wjypDjFLSZIRov09BgYmtUqPQPlQrPapecLgTIy0jMgPKtTeob2zWtrGH3xvjUkPCtNg/tm1rjwrMa+mdUkPd3hWbH0jArPGiU9ufCsNNWFZ40wpwn+62/66R2RUtoso1OB34tnLOcy7YB1fUdc9e0q3yru8PGM773vXsuZ5YIZX+5xmHwHGVvlrGPN6ZSiP1smOsMMde40wKv2VmwPPVXNut4sVpUreZiLBHi0qln/VQeI/LTMYXpsJtFiclUN+5HVZazim+Ky+7sAvxWnvjXrJFneVtLWLyPJu9K3cXLWeOlbMTlrIelbMDlrLenrjEQOtIF+fuI9xRp9ZBFp6+b6WT8RrxEpdK64BuvHgDk+vUy+b5hYk6zfyfs051gRoNO1usU12WWRWL73/MMEy9pMi9qIrR4ZpV16Rrvduxazmy1FSvuFXRkqTnE7m2kdb5U8xGjLw/spRr1uTov4uOgQE+0N/DvFrG/Jt7i/FzwxbA9kDanhf2w+t4V97G8lrT7wc08aA2QNUkuTfW/KimT01wdlfK4yEw030VfT0RtZbzjeMprNq8m8tnSTASrTLti64oBNdpmMQm0eEwvfPwRbUBywG5TzjPCsdwk3IeAXjQblLCoXnDVeoAz6SfJNk5TTzytCNZk/POtTSV40NwOFWzw86wNJRpubpXsn60NJFlHeqlYRbslqZm2jnEZ3qcSKgm0kTli3zZVS7y/iivZTweYXJ26Y+RTbV1zh3hYkgyFGSTKPfRVbRqWWVReaxYeSLarYv1Qqsmh1s95S7G+eEWK0f3jYKTbV6bOwepjfhtafsvUsqrQvrGC8YhmnO9cSCk3yuY984F1vesdHYhWJ5FvASlacshUsajFt2mUM9pqzvKGcyNJW0arTKN1GGGzQlH0tXwLDgQTurS8eIQAAAABJRU5ErkJggg==")
+
 (defn app-root []
   (let [stage (subscribe [:stage])]
     (fn []
-      [view {:style {:flex-direction "column" :margin 40 :align-items "center"}}
-       [text {:style {:font-size 40 :font-weight "100" :margin-bottom 10 :text-align "center"}} "100 Pushup Challenge"]
-       [text {:style {:font-size 20 :font-weight "100" :margin-bottom 20 :text-align "center"}} "Become a pushup master"]
-       (case @stage
-         :get-started [get-started]
-         :learn-pushup-form [learn-pushup-form]
-         :do-pushup-test [do-pushup-test]
-         :do-plank-test [do-plank-test]
-         :show-day (let [day @(subscribe [:days-exercise])]
-                     (if (= day :exr/do-test)
-                       [do-pushup-test]
-                       [show-day day]))
-         [invalid-stage])
-       [touchable-highlight {:style {:background-color "#999" :padding 10 :border-radius 5 :margin-top 20}
-                             :on-press #(do
-                                          (dispatch [:db/reset])
-                                          (dispatch [:db/save]))}
-        [text {:style {:color "white" :text-align "center" :font-weight "bold"}} "Reset"]]])))
+      [tab-bar {}
+       [tab-bar-item {:title "work out"
+                      :selected true
+                      :icon {:uri base64-icon :scale 3}}
+        [view {:style {:flex-direction "column" :margin 40 :align-items "center"}}
+         [text {:style {:font-size 40 :font-weight "100" :margin-bottom 10 :text-align "center"}} "100 Pushup Challenge"]
+         [text {:style {:font-size 20 :font-weight "100" :margin-bottom 20 :text-align "center"}} "Become a pushup master"]
+         (case @stage
+           :get-started [get-started]
+           :learn-pushup-form [learn-pushup-form]
+           :do-pushup-test [do-pushup-test]
+           :do-plank-test [do-plank-test]
+           :show-day (let [day @(subscribe [:days-exercise])]
+                       (if (= day :exr/do-test)
+                         [do-pushup-test]
+                         [show-day day]))
+           [invalid-stage])
+         [touchable-highlight {:style {:background-color "#999" :padding 10 :border-radius 5 :margin-top 20}
+                               :on-press #(do
+                                            (dispatch [:db/reset])
+                                            (dispatch [:db/save]))}
+          [text {:style {:color "white" :text-align "center" :font-weight "bold"}} "Reset"]]
+         ]
+        ]
+       [tab-bar-item {:title "schedule"
+                      :selected false
+                      :icon {:uri base64-icon :scale 3}}
+        [text {} "schedule stuff here"]
+        ]
+       [tab-bar-item {:title "dev tools"
+                      :selected false
+                      :icon {:uri base64-icon :scale 3}}
+        [text {} "devtools"]]])))

 (defn init []
   (dispatch-sync [:boot/init])


removed unnecessary 'require' statements and redundancy.

--- src/leiningen/ancient/upgrade.clj
+++ src/leiningen/ancient/upgrade.clj
@@ -7,9 +7,7 @@
             [leiningen.ancient.utils.cli :refer :all]
             [leiningen.ancient.utils.io :refer :all]
             [leiningen.core.project :as prj]
-            [leiningen.core.main :as main]
             [ancient-clj.verbose :refer :all]
-            [ancient-clj.core :as anc]
             [rewrite-clj.zip :as z]
             [clojure.java.io :as io :only [file writer]])
   (:import java.io.File))
@@ -27,12 +25,10 @@
   "If the `:interactive` flag in the given settings map is set, this function will ask the
    user (on stdout/stdin) whether he wants to upgrade the given artifact and return a boolean
    value indicating the user's choice."
-  [settings {:keys [group-id artifact-id latest version]}]
-  (when latest
+  [settings artifact]
+  (when (:latest artifact)
     (when (:interactive settings) (println))
-    (println (artifact-string group-id artifact-id latest)
-             "is available but we use"
-             (yellow (version-string version)))
+    (c/print-outdated-message artifact)
     (or (not (:interactive settings))
         (prompt "Do you want to upgrade?"))))


made i18n format a bit more robust

made i18n format a bit more robust

--- src/untangled/i18n.cljc
+++ src/untangled/i18n.cljc
@@ -1,29 +1,33 @@
-(ns  untangled.i18n
-  #?(:cljs (:require [untangled.i18n.core :as ic])))
+(ns untangled.i18n
+  #?(:cljs (:require
+             [untangled.i18n.core :as ic]
+             [untangled.client.logging :as log])))

 #?(:cljs (defn current-locale [] @ic/*current-locale*))

 #?(:cljs (defn translations-for-locale [] (get @ic/*loaded-translations* (current-locale))))

 #?(:cljs (set! js/tr
-               (fn [msg]
-                 (let [msg-key (str "|" msg)
-                       translations (translations-for-locale)
-                       translation (get translations msg-key)]
-                   (cond
-                     (= (current-locale) "en-US") msg
-                     (empty? translation) msg
-                      :else translation)
-                   ))
+           (fn [msg]
+             (let [msg-key (str "|" msg)
+                   translations (translations-for-locale)
+                   translation (get translations msg-key)]
+               (cond
+                 (= (current-locale) "en-US") msg
+                 (empty? translation) msg
+                 :else translation)
                ))
+           ))

 #?(:cljs (set! js/trc (fn [ctxt msg] msg)))
 #?(:cljs
    (set! js/trf
-         (fn [fmt & {:keys [] :as argmap}]
-           (let [formatter (js/IntlMessageFormat. fmt (current-locale))]
-             (.format formatter (clj->js argmap))
-             ))))
+     (fn [fmt & {:keys [] :as argmap}]
+       (try
+         (let [formatter (js/IntlMessageFormat. fmt (current-locale))]
+           (.format formatter (clj->js argmap)))
+         (catch :default e (log/error "Failed to format " fmt " args: " argmap " exception: " e)
+                           "???")))))

 #?(:cljs (defn format-date
            "Format a date with an optional style. The default style is :short.


New db function to read all words with different spelling

--- src/zg/db_interface.clj
+++ src/zg/db_interface.clj
@@ -224,6 +224,16 @@
             (log/error e "read changes")
             [])))

+(defn read-different-spelling-words
+    "Read all words that have different spelling."
+    []
+    (try
+        (jdbc/query db-spec/zg-db
+                        ["select word, count(word) cnt from dictionary d where dictionary='u' group by word having cnt>1"])
+        (catch Exception e
+            (log/error e "read different spelling words")
+            [])))
+
 (defn read-changes-for-user
     "Read all changes for selected user sorted by date and time the change has been made."
     [user-name]


cleanup: move all (defns) to top of page

--- test/babel/test/it.cljc
+++ test/babel/test/it.cljc
@@ -64,6 +64,23 @@
          (= (:rule rule)
             "vp-pronoun-nonphrasal")))))

+;; roundtrip parser testing
+(defn roundtrip-parsing [n]
+  (take n
+        (repeatedly #(let [generated
+                           (morph (generate {:synsem {:cat :verb
+                                                      :subcat []}}))
+                           parsed (reduce concat (map :parses (parse generated)))]
+                       (log/info (str "generated: " generated))
+                       (log/info (str "semantics: "
+                                      (or
+                                       (strip-refs
+                                        (get-in (first parsed)
+                                                [:synsem :sem]))
+                                       (str "NO PARSE FOUND FOR: " generated))))
+                       {:generated generated
+                        :pred (get-in (first parsed) [:synsem :sem :pred])
+                        :subj (get-in (first parsed) [:synsem :sem :subj :pred])}))))

 (defmacro deftest [test-name & arguments]
   (let [wrapped-arguments
@@ -72,6 +89,56 @@
                 `[(log/info (str "done with test: " ~test-name))])]
     `(realtest/deftest ~test-name ~@wrapped-arguments)))

+(defn screen-out-false [m]
+  (->>
+   (dag_unify.core/paths m)
+   (filter #(let [v (dag_unify.core/get-in m %)]
+              (and (not (= false v))
+                   (not (map? v)))))
+   (map (fn [path]
+          [path (get-in m path)]))
+   (map (fn [[path v]]
+          (assoc-in {} path v)))
+   (reduce (fn [a b] (merge-with merge a b)))))
+
+(defn grab-bag []
+  (let [semantics (-> "io lo ho" parse first :parses
+                      first (dag_unify.core/get-in [:synsem :sem]))
+
+        semantics-any-subject
+        (dag_unify.core/dissoc-paths semantics [[:subj]])
+
+        semantics-any-object
+        (unify (dag_unify.core/dissoc-paths semantics [[:obj]])
+               {:obj {:pred :top}})]
+    (count
+     (take 5 (repeatedly
+              #(-> {:synsem {:subcat []
+                             :cat :verb
+                             :sem (screen-out-false semantics)}}
+                   generate
+                   morph time
+                   println))))
+    (println "----")
+    (count
+     (take 5 (repeatedly
+              #(-> {:synsem {:subcat []
+                             :cat :verb
+                             :sem (screen-out-false semantics-any-subject)}}
+                   generate
+                   morph time
+                   println))))
+
+    (println "----")
+    (count
+     (take 5 (repeatedly
+              #(-> {:synsem {:subcat []
+                             :cat :verb
+                             :sem (screen-out-false semantics-any-object)}}
+                   generate
+                   morph time
+                   println))))
+    (-> "loro vedono casa" parse first (get :parses) first (get-in [:synsem :sem]) clojure.pprint/pprint)))

 ;; (repeatedly #(println (morph (time (generate reflexive-passato-is-slow)))))

@@ -458,35 +525,6 @@
 (deftest parse-with-boot-stem
   (is (not (empty? (:parses (first (parse "lei esce")))))))

-;; roundtrip parser testing
-(defn roundtrip-parsing [n]
-  (take n
-        (repeatedly #(let [generated
-                           (morph (generate {:synsem {:cat :verb
-                                                      :subcat []}}))
-                           parsed (reduce concat (map :parses (parse generated)))]
-                       (log/info (str "generated: " generated))
-                       (log/info (str "semantics: "
-                                      (or
-                                       (strip-refs
-                                        (get-in (first parsed)
-                                                [:synsem :sem]))
-                                       (str "NO PARSE FOUND FOR: " generated))))
-                       {:generated generated
-                        :pred (get-in (first parsed) [:synsem :sem :pred])
-                        :subj (get-in (first parsed) [:synsem :sem :subj :pred])}))))
-
-(defn ps-tree [tree morph]
-  "return just the essentials of a tree: just rule names and surface forms at leaves."
-  (let [rule (get-in tree [:rule])
-        head (get-in tree [:head])
-        comp (get-in tree [:comp])]
-    (if (and head comp rule)
-      (conj {:rule rule}
-            {:head (ps-tree head morph)
-             :comp (ps-tree comp morph)})
-      (morph tree))))
-
 ;; should fail fast: instead seems to run forever.
 (deftest difficult-generate
   (let [synsem
@@ -500,68 +538,6 @@
 (deftest casa-parse
   (is (not (empty?
             (reduce concat (map :parses (parse "io sono a casa")))))))
-
-;;(-> (parse "io lo ho") first clojure.pprint/pprint)
-;;(def sem (->> (-> "io lo ho" parse first :parses first (dag_unify.core/get-in [:synsem :sem]))))
-;;(repeatedly #(println (time (morph (generate {:synsem {:subcat []
-;;                                                                :cat :verb
-;;                                                                :sem (screen-out-false sem)}})))))
-
-;; (def parse-tree (-> "ho Antonia e Luisa"
-;;                                   parse
-;;                                 first
-;;                                   :parses
-;;                                   first))
-
-(defn screen-out-false [m]
-  (->>
-   (dag_unify.core/paths m)
-   (filter #(let [v (dag_unify.core/get-in m %)]
-              (and (not (= false v))
-                   (not (map? v)))))
-   (map (fn [path]
-          [path (get-in m path)]))
-   (map (fn [[path v]]
-          (assoc-in {} path v)))
-   (reduce (fn [a b] (merge-with merge a b)))))
-
-(defn sunday-night []
-  (let [semantics (-> "io lo ho" parse first :parses
-                      first (dag_unify.core/get-in [:synsem :sem]))
-
-        semantics-any-subject
-        (dag_unify.core/dissoc-paths semantics [[:subj]])
-
-        semantics-any-object
-        (unify (dag_unify.core/dissoc-paths semantics [[:obj]])
-               {:obj {:pred :top}})]
-    (count
-     (take 5 (repeatedly
-              #(-> {:synsem {:subcat []
-                             :cat :verb
-                             :sem (screen-out-false semantics)}}
-                   generate
-                   morph time
-                   println))))
-    (println "----")
-    (count
-     (take 5 (repeatedly
-              #(-> {:synsem {:subcat []
-                             :cat :verb
-                             :sem (screen-out-false semantics-any-subject)}}
-                   generate
-                   morph time
-                   println))))
-
-    (println "----")
-    (count
-     (take 5 (repeatedly
-              #(-> {:synsem {:subcat []
-                             :cat :verb
-                             :sem (screen-out-false semantics-any-object)}}
-                   generate
-                   morph time
-                   println))))))

 (deftest gestiscono
   (let [result
@@ -889,4 +865,3 @@
            (-> spec
                generate
                morph)))))
-


~(deftest furniture-test): add {:synsem {:sem {:aspect :simple}}}

--- test/babel/test/it.cljc
+++ test/babel/test/it.cljc
@@ -633,6 +633,7 @@
                                     :number :sing
                                     :spec {:def :def}}
                               :pred :in-front-of
+                              :aspect :simple
                               :tense :present
                               :subj {:pred :chair
                                      :mod []


Revert Jetty back to version 9.2.17

Revert Jetty back to version 9.2.17

Jetty 9.3 requires Java 8.

--- ring-jetty-adapter/project.clj
+++ ring-jetty-adapter/project.clj
@@ -7,7 +7,7 @@
   :dependencies [[org.clojure/clojure "1.5.1"]
                  [ring/ring-core "1.6.0-beta1"]
                  [ring/ring-servlet "1.6.0-beta1"]
-                 [org.eclipse.jetty/jetty-server "9.3.10.v20160621"]]
+                 [org.eclipse.jetty/jetty-server "9.2.17.v20160517"]]
   :profiles
   {:dev {:dependencies [[clj-http "2.2.0"]]}
    :1.6 {:dependencies [[org.clojure/clojure "1.6.0"]]}


Update Jetty to 9.4.40

Update Jetty to 9.4.40

Fixes: https://nvd.nist.gov/vuln/detail/CVE-2021-28165

--- ring-jetty-adapter/project.clj
+++ ring-jetty-adapter/project.clj
@@ -7,7 +7,7 @@
   :dependencies [[org.clojure/clojure "1.7.0"]
                  [ring/ring-core "1.9.2"]
                  [ring/ring-servlet "1.9.2"]
-                 [org.eclipse.jetty/jetty-server "9.4.38.v20210224"]]
+                 [org.eclipse.jetty/jetty-server "9.4.40.v20210413"]]
   :aliases {"test-all" ["with-profile" "default:+1.8:+1.9:+1.10" "test"]}
   :profiles
   {:dev  {:dependencies [[clj-http "3.10.0"]


names in let match classes

names in let match classes

--- test/java_time_test.clj
+++ test/java_time_test.clj
@@ -403,96 +403,96 @@
 (deftest ordering

   (testing "times"
-    (let [dt (j/local-date-time clock)
-          dt+5 (j/plus dt (j/days 5))]
-      (is (j/after? dt+5 dt))
-      (is (not (j/after? dt dt+5)))
-      (is (j/before? dt dt+5))
-      (is (not (j/before? dt+5 dt)))
-      (is (j/not-after? dt dt))
-      (is (j/not-after? dt dt+5))
-      (is (not (j/not-after? dt+5 dt)))
-      (is (j/not-before? dt dt))
-      (is (j/not-before? dt+5 dt))
-      (is (not (j/not-before? dt dt+5))))
-
-    (let [dt (j/local-date clock)
-          dt+5 (j/plus dt (j/days 5))]
-      (is (j/after? dt+5 dt))
-      (is (not (j/after? dt dt+5)))
-      (is (j/before? dt dt+5))
-      (is (not (j/before? dt+5 dt)))
-      (is (j/not-after? dt dt))
-      (is (j/not-after? dt dt+5))
-      (is (not (j/not-after? dt+5 dt)))
-      (is (j/not-before? dt dt))
-      (is (j/not-before? dt+5 dt))
-      (is (not (j/not-before? dt dt+5))))
-
-    (let [dt (j/local-time clock)
-          dt+5 (j/plus dt (j/minutes 5))]
-      (is (j/after? dt+5 dt))
-      (is (not (j/after? dt dt+5)))
-      (is (j/before? dt dt+5))
-      (is (not (j/before? dt+5 dt)))
-      (is (j/not-after? dt dt))
-      (is (j/not-after? dt dt+5))
-      (is (not (j/not-after? dt+5 dt)))
-      (is (j/not-before? dt dt))
-      (is (j/not-before? dt+5 dt))
-      (is (not (j/not-before? dt dt+5))))
-
-    (let [dt (j/zoned-date-time clock)
-          dt+5 (j/plus dt (j/minutes 5))]
-      (is (j/after? dt+5 dt))
-      (is (not (j/after? dt dt+5)))
-      (is (j/before? dt dt+5))
-      (is (not (j/before? dt+5 dt)))
-      (is (j/not-after? dt dt))
-      (is (j/not-after? dt dt+5))
-      (is (not (j/not-after? dt+5 dt)))
-      (is (j/not-before? dt dt))
-      (is (j/not-before? dt+5 dt))
-      (is (not (j/not-before? dt dt+5))))
-
-    (let [dt (j/offset-date-time clock)
-          dt+5 (j/plus dt (j/minutes 5))]
-      (is (j/after? dt+5 dt))
-      (is (not (j/after? dt dt+5)))
-      (is (j/before? dt dt+5))
-      (is (not (j/before? dt+5 dt)))
-      (is (j/not-after? dt dt))
-      (is (j/not-after? dt dt+5))
-      (is (not (j/not-after? dt+5 dt)))
-      (is (j/not-before? dt dt))
-      (is (j/not-before? dt+5 dt))
-      (is (not (j/not-before? dt dt+5))))
-
-    (let [dt (j/offset-time clock)
-          dt+5 (j/plus dt (j/minutes 5))]
-      (is (j/after? dt+5 dt))
-      (is (not (j/after? dt dt+5)))
-      (is (j/before? dt dt+5))
-      (is (not (j/before? dt+5 dt)))
-      (is (j/not-after? dt dt))
-      (is (j/not-after? dt dt+5))
-      (is (not (j/not-after? dt+5 dt)))
-      (is (j/not-before? dt dt))
-      (is (j/not-before? dt+5 dt))
-      (is (not (j/not-before? dt dt+5))))
-
-    (let [dt (j/instant clock)
-          dt+5 (j/plus dt (j/minutes 5))]
-      (is (j/after? dt+5 dt))
-      (is (not (j/after? dt dt+5)))
-      (is (j/before? dt dt+5))
-      (is (not (j/before? dt+5 dt)))
-      (is (j/not-after? dt dt))
-      (is (j/not-after? dt dt+5))
-      (is (not (j/not-after? dt+5 dt)))
-      (is (j/not-before? dt dt))
-      (is (j/not-before? dt+5 dt))
-      (is (not (j/not-before? dt dt+5)))))
+    (let [ldt (j/local-date-time clock)
+          ldt+5 (j/plus ldt (j/days 5))]
+      (is (j/after? ldt+5 ldt))
+      (is (not (j/after? ldt ldt+5)))
+      (is (j/before? ldt ldt+5))
+      (is (not (j/before? ldt+5 ldt)))
+      (is (j/not-after? ldt ldt))
+      (is (j/not-after? ldt ldt+5))
+      (is (not (j/not-after? ldt+5 ldt)))
+      (is (j/not-before? ldt ldt))
+      (is (j/not-before? ldt+5 ldt))
+      (is (not (j/not-before? ldt ldt+5))))
+
+    (let [ld (j/local-date clock)
+          ld+5 (j/plus ld (j/days 5))]
+      (is (j/after? ld+5 ld))
+      (is (not (j/after? ld ld+5)))
+      (is (j/before? ld ld+5))
+      (is (not (j/before? ld+5 ld)))
+      (is (j/not-after? ld ld))
+      (is (j/not-after? ld ld+5))
+      (is (not (j/not-after? ld+5 ld)))
+      (is (j/not-before? ld ld))
+      (is (j/not-before? ld+5 ld))
+      (is (not (j/not-before? ld ld+5))))
+
+    (let [lt (j/local-time clock)
+          lt+5 (j/plus lt (j/minutes 5))]
+      (is (j/after? lt+5 lt))
+      (is (not (j/after? lt lt+5)))
+      (is (j/before? lt lt+5))
+      (is (not (j/before? lt+5 lt)))
+      (is (j/not-after? lt lt))
+      (is (j/not-after? lt lt+5))
+      (is (not (j/not-after? lt+5 lt)))
+      (is (j/not-before? lt lt))
+      (is (j/not-before? lt+5 lt))
+      (is (not (j/not-before? lt lt+5))))
+
+    (let [zdt (j/zoned-date-time clock)
+          zdt+5 (j/plus zdt (j/minutes 5))]
+      (is (j/after? zdt+5 zdt))
+      (is (not (j/after? zdt zdt+5)))
+      (is (j/before? zdt zdt+5))
+      (is (not (j/before? zdt+5 zdt)))
+      (is (j/not-after? zdt zdt))
+      (is (j/not-after? zdt zdt+5))
+      (is (not (j/not-after? zdt+5 zdt)))
+      (is (j/not-before? zdt zdt))
+      (is (j/not-before? zdt+5 zdt))
+      (is (not (j/not-before? zdt zdt+5))))
+
+    (let [odt (j/offset-date-time clock)
+          odt+5 (j/plus odt (j/minutes 5))]
+      (is (j/after? odt+5 odt))
+      (is (not (j/after? odt odt+5)))
+      (is (j/before? odt odt+5))
+      (is (not (j/before? odt+5 odt)))
+      (is (j/not-after? odt odt))
+      (is (j/not-after? odt odt+5))
+      (is (not (j/not-after? odt+5 odt)))
+      (is (j/not-before? odt odt))
+      (is (j/not-before? odt+5 odt))
+      (is (not (j/not-before? odt odt+5))))
+
+    (let [ot (j/offset-time clock)
+          ot+5 (j/plus ot (j/minutes 5))]
+      (is (j/after? ot+5 ot))
+      (is (not (j/after? ot ot+5)))
+      (is (j/before? ot ot+5))
+      (is (not (j/before? ot+5 ot)))
+      (is (j/not-after? ot ot))
+      (is (j/not-after? ot ot+5))
+      (is (not (j/not-after? ot+5 ot)))
+      (is (j/not-before? ot ot))
+      (is (j/not-before? ot+5 ot))
+      (is (not (j/not-before? ot ot+5))))
+
+    (let [i (j/instant clock)
+          i+5 (j/plus i (j/minutes 5))]
+      (is (j/after? i+5 i))
+      (is (not (j/after? i i+5)))
+      (is (j/before? i i+5))
+      (is (not (j/before? i+5 i)))
+      (is (j/not-after? i i))
+      (is (j/not-after? i i+5))
+      (is (not (j/not-after? i+5 i)))
+      (is (j/not-before? i i))
+      (is (j/not-before? i+5 i))
+      (is (not (j/not-before? i i+5)))))

   (testing "clocks"
     (is (j/after? (j/fixed-clock 1000) (j/fixed-clock 0)))


Add test for `of-minutes`

Add test for `of-minutes`

--- test/tick/api_test.cljc
+++ test/tick/api_test.cljc
@@ -351,7 +351,8 @@
   (is (= (t/of-nanos 10) (t/new-duration 10 :nanos)))
   (is (= (t/of-micros 10) (t/new-duration 10 :micros)))
   (is (= (t/of-millis 10) (t/new-duration 10 :millis)))
-  (is (= (t/of-seconds 10) (t/new-duration 10 :seconds))))
+  (is (= (t/of-seconds 10) (t/new-duration 10 :seconds)))
+  (is (= (t/of-minutes 10) (t/new-duration 10 :minutes))))


fix bug in hour-of-day assertion.

fix bug in hour-of-day assertion.

--- src/metabase/task/send_pulses.clj
+++ src/metabase/task/send_pulses.clj
@@ -153,7 +153,7 @@
    that are scheduled to run and send them."
   [hour weekday monthday monthweek]
   {:pre [(integer? hour)
-         (and (<= 0 hour) (> 23 hour))
+         (and (<= 0 hour) (>= 23 hour))
          (pulse-channel/day-of-week? weekday)
          (contains? #{:first :last :mid :other} monthday)
          (contains? #{:first :last :other} monthweek)]}


Make file-content-sans-ns trim leading whitespace

--- src/refactor_nrepl/ns/helpers.clj
+++ src/refactor_nrepl/ns/helpers.clj
@@ -65,4 +65,4 @@
                                 (when (= c open)
                                   (swap! paren-count inc))
                                 true)))]
-    (apply str (drop-while still-in-ns-form? s))))
+    (str/triml (apply str (drop-while still-in-ns-form? s)))))


fix Filter is nil error after re-login

fix Filter is nil error after re-login

--- src/status_im/transport/core.cljs
+++ src/status_im/transport/core.cljs
@@ -102,7 +102,7 @@
   account A messages without this."
   [{:keys [db]} callback]
   (let [{:transport/keys [filters]} db]
-    {:shh/remove-filters {:filter   (mapcat (fn [[chat-id chat-filters]]
+    {:shh/remove-filters {:filters  (mapcat (fn [[chat-id chat-filters]]
                                               (map (fn [filter]
                                                      [chat-id filter])
                                                    chat-filters))


tuning the watcher code

tuning the watcher code

--- sidecar/src/figwheel_sidecar/watching.clj
+++ sidecar/src/figwheel_sidecar/watching.clj
@@ -20,6 +20,7 @@
   (.startsWith child (str dir java.io.File/separator)))

 ;;; we are going to have to throttle this
+;; so that we can catch more than one file at a time

 (defn take-until-timeout [in]
   (let [time-out (timeout 50)]
@@ -37,8 +38,9 @@
         individual-file-map   (single-files files)
         canonical-source-dirs (set (map #(.getCanonicalPath %) dirs))

-        source-paths (concat (map str dirs)
-                             (distinct (map #(.getParent %) files)))
+        source-paths (distinct
+                      (concat (map str dirs)
+                              (map #(.getParent %) files)))

         valid-file?   (fn [file]
                         (and file
@@ -69,15 +71,10 @@
     (go-loop []
       (when-let [v (<! throttle-chan)]
         (let [files (<! (take-until-timeout throttle-chan))]
-          (callback (filter valid-file? (map :file (cons v files)))))
+          (when-let [result-files (not-empty (filter valid-file? (map :file (cons v files))))]
+            (callback result-files)))
         (recur)))

-    (add-watch quit :close-watch
-               (fn [_ _ _ v]
-                 (when v
-                   (prn "stopping"))
-                   (close! throttle-chan)
-                   (hawk/stop! watcher)))
     {:watcher watcher
      :throttle-chan throttle-chan}))


adjust backup-config to new backup schema

--- main/src/dda/pallet/dda_managed_vm/domain.clj
+++ main/src/dda/pallet/dda_managed_vm/domain.clj
@@ -17,6 +17,7 @@
   (:require
     [schema.core :as s]
     [dda.config.commons.map-utils :as mu]
+    [dda.config.commons.user-home :as user-home]
     [dda.pallet.commons.secret :as secret]
     [dda.pallet.dda-managed-vm.domain.user :as user]
     [dda.pallet.dda-managed-vm.domain.git :as git]
@@ -82,14 +83,17 @@
   "Managed vm crate default configuration"
   [domain-config :- DdaVmDomainResolvedConfig]
   (let [{:keys [user]} domain-config
-        {:keys [name]} user]
+        {:keys [name]} user
+        user-home (user-home/user-home-dir name)]
     {:backup-name "dda-managed-vm"
      :script-path "/usr/local/lib/dda-backup/"
      :gens-stored-on-source-system 1
      :elements [{:type :file-compressed
                  :name "user-home"
-                 :root-dir (str "/home/" name)
-                 :subdir-to-save ".ssh .gnupg .mozilla"}]
+                 :backup-path [(str user-home ".ssh")
+                               (str user-home ".gnupg")
+                               (str user-home ".mozilla")
+                               (str user-home ".thunderbird")]}]
      :backup-user {:name "dataBackupSource"
                    :encrypted-passwd "WIwn6jIUt2Rbc"}}))


Adds remove-node and remove-nodes

Adds remove-node and remove-nodes

--- src/the_little_clojurian/todo.clj
+++ src/the_little_clojurian/todo.clj
@@ -1,7 +1,52 @@
 (ns the-little-clojurian.todo
   (:require [clojure.test :refer :all]))

-(declare complete-map* complete-list* complete-node* complete-nodes* leftmost-node rightmost-node)
+(declare complete-map* complete-list* complete-node* complete-nodes* leftmost-node rightmost-node remove-nodes remove-node)
+
+(with-test
+  (def remove-nodes
+    (fn [id nodes]
+      (cond (nil? nodes) nil
+            (empty? nodes) '()
+            :else (cons (remove-node id (first nodes))
+                        (remove-nodes id (rest nodes))))))
+
+  (is (= (remove-nodes 1 nil)
+         nil))
+
+  (is (= (remove-nodes 1 '())
+         '()))
+
+  (is (= (remove-nodes 1 '({:id 1}))
+         '(nil)))
+
+  (is (= (remove-nodes 1 '({:id 1} {:id 1}))
+         '(nil nil)))
+
+  (is (= (remove-nodes 1 '({:id 1} {:id 2}))
+         '(nil {:id 2 :nodes nil}))))
+
+(with-test
+  (def remove-node
+    (fn [id root]
+      (cond (nil? root) nil
+            (= (:id root) id) nil
+            :else (assoc root :nodes (remove-nodes id (:nodes root))))))
+
+  (is (= (remove-node 1 nil)
+         nil))
+
+  (is (= (remove-node 1 {:id 1})
+         nil))
+
+  (is (= (remove-node 2 {:id 1})
+         {:id 1 :nodes nil}))
+
+  (is (= (remove-node 2 {:id 1 :nodes '({:id 2})})
+         {:id 1 :nodes '(nil)}))
+
+  (is (= (remove-node 3 {:id 1 :nodes '({:id 2 :nodes ({:id 3 :nodes ({:id 5})} {:id 4})})})
+         {:id 1 :nodes '({:id 2 :nodes (nil {:id 4 :nodes nil})})})))

 (with-test
   (def leftmost-node


Version 0.0.8

Version 0.0.8

--- api/project.clj
+++ api/project.clj
@@ -1,4 +1,4 @@
-(defproject coffee-table "0.0.8-SNAPSHOT"
+(defproject coffee-table "0.0.8"
   :description "A site for Gaelan's café reviews"
   :url "http://github.com/RobotDisco/coffee-table"
   :license {:name "Eclipse Public License - v 1.0"


Add an additional test around capacity validation

--- test/maestro/messages/data_test.clj
+++ test/maestro/messages/data_test.clj
@@ -233,10 +233,15 @@
                                                                                :max 1
                                                                                :min 2}}}}}) => (contains {:status :error}))

-(fact "that validating capacity fails if desired capacity is not between min and max"
+(fact "that validating capacity fails if desired capacity is above max"
       (validate-capacity {:parameters {:new-state {:tyranitar {:deployment-params {:desired-capacity 6
                                                                                :max 3
                                                                                :min 1}}}}}) => (contains {:status :error}))
+
+(fact "that validating capacity fails if desired capacity is below min"
+      (validate-capacity {:parameters {:new-state {:tyranitar {:deployment-params {:desired-capacity 1
+                                                                                :max 3
+                                                                                :min 2}}}}}) => (contains {:status :error}))

 (fact "that validating capacity succeeds if all three capacity parameters are equal"
       (validate-capacity {:parameters {:new-state {:tyranitar {:deployment-params {:desired-capacity 1


Use list groups for stops list

Use list groups for stops list

--- src/cljs/gtfve/components/side_panel.cljs
+++ src/cljs/gtfve/components/side_panel.cljs
@@ -45,15 +45,16 @@
                 :placeholder "Search"
                 :value query
                 :on-change #(utils/edit-input owner :input-stops-search %)}]]]]]
-          [:table.table.table-striped.table-hover
-           [:thead
-            [:tr
-             [:th "#"]
-             [:th "Code"]
-             [:th "Name"]
-             [:th "Description"]
-             [:th "Lat/Lng"]]]
-           [:tbody]]])))))
+          (into [:div.list-group]
+                (map (fn [stop]
+                       [:a.list-group-item {:key (:db/id stop)
+                                            :href "#"}
+                        [:h5.list-group-item-heading (:stop/name stop)]
+                        [:p.list-group-item-text (str (:stop/latitude stop)
+                                                      "/"
+                                                      (:stop/longitude stop))]])
+                     data))
+          ])))))

 (defn side-panel [{:keys [panel data]} owner]
   (reify


minor refactor

minor refactor

--- src/cljx/jamesmacaulay/zelkova/mouse.cljx
+++ src/cljx/jamesmacaulay/zelkova/mouse.cljx
@@ -9,19 +9,19 @@
   (:require-macros [cljs.core.async.macros :refer [go go-loop]]))

 #+cljs
-(defn- listen [el type]
-  (let [out (async/chan)]
-    (events/listen el type
-                   (fn [e] (async/put! out e)))
+(defn- listen
+  [el type & args]
+  (let [out (apply async/chan 1 args)]
+    (events/listen el type (fn [e] (async/put! out e)))
     out))

 #+cljs
 (defn position-channel
   [graph opts]
-  (let [dom-events (listen js/document "mousemove")
-        xform (comp (map (fn [e] [(.-offsetX e) (.-offsetY e)]))
-                    (map (partial z/->Event ::position)))]
-    (async/pipe dom-events (async/chan 1 xform))))
+  (listen js/document
+          "mousemove"
+          (comp (map (fn [e] [(.-offsetX e) (.-offsetY e)]))
+                (map (partial z/->Event ::position)))))

 #+cljs
 (def position (assoc (z/input [0 0] ::position)
@@ -36,10 +36,10 @@
 #+cljs
 (defn clicks-channel
   [graph opts]
-  (let [dom-events (listen js/document "click")
-        xform (comp (map (constantly :click))
-                    (map (partial z/->Event ::clicks)))]
-    (async/pipe dom-events (async/chan 1 xform))))
+  (listen js/document
+          "click"
+          (comp (map (constantly :click))
+                (map (partial z/->Event ::clicks)))))

 #+cljs
 (def clicks (assoc (z/input :click ::clicks)


heap:: optimised versions of heapify-opt + heap-extract-min-opt + implemented heap-sort with a reasonable running time

--- src/clojure_learning/algorithms/heaps.clj
+++ src/clojure_learning/algorithms/heaps.clj
@@ -289,7 +289,7 @@
 ;; with this HEAP-SORT becomes a pie @implementation
 ;;;;;;;;
 (set! *warn-on-reflection* true)
-(def nums (shuffle (range 0 10000)))
+(def nums (shuffle (range 0 100000)))
 nums

 (time
@@ -309,7 +309,6 @@
               (.add sorted min)
               (recur)))))
   sorted
-))) ;; for 10.000 nums:: "Elapsed time: 91,800.966877 msecs"

 ;; my merge-sort from previous implementation-studies computed
 ;; shuffled 100K nums in:: "Elapsed time: 1785.201451 msecs"
@@ -333,13 +332,9 @@
   (def s (heap-sort-by-heapify nums)))
 s

-(let [xs (ArrayList.)]
-  (.addAll xs (java.util.Arrays/asList (to-array [1 2 3])))
-  xs)
-(type (java.util.Arrays/asList (to-array [1 2])))
-(type (reduce (fn [lst x] (.add lst x) lst) (ArrayList.) (to-array [1 2 3])))
-
-;; ANALYSING the running times.....
+;;;;;;;;;;;;;;;
+;; ANALYSING & IMPROVING the running times.....
+;;;;;;;;;;;;;;;
 (time
   (def a (reduce (fn [acc x] (.add acc x) acc) (ArrayList.) (range 0 100000))))
 ;; producing a new ArrayList with 100K items requires:: "Elapsed time: 142.279817 msecs"
@@ -349,25 +344,29 @@
 ;; i've used ArrayList in my heap-insert/heap-extract implementations relying on
 ;; dynamic shrinking the array-list while removing items from it, however behind
 ;; the scenes, the entire array is copied with System.arraycopy...which is NOT
-;; wise at all...
-
-;; own thoughts...on how to improve the performance
-;; to optimize the heapify operation, i should discard ALL the ((2^height - 1) level) items
-;; bubbling-up, because those are leafs and shouldn't by heap-ordered!
-;; therefore:: based on the .length of the array, i should find the
+;; performant-wise at all...
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; OWN ideas...on how to improve the running time ;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; To optimize the heapify operation, i should discard ALL the ((2^height - 1) level) items
+;; bubbling-up, because those are leaves and shouldn't be heap-ordered!
+
+;; Therefore:: based on the (alength) of the array, i should find the
 ;; correspondent:: 2^x factor. i'm interested in finding the "x" here...
-;; where the x stands for the height, if i know the height, i know which items
-;; should be discarded based on the total items
-;; applying Math here, i'm interested in finding the (log2 x) by applying the
-;; (log10 x) / (log10 2) -> gives the logarithm in base 2
-(/ (Math/log10 8) (Math/log10 2)) ;; => (log2 x) -> where x = 3
-(/ (Math/log10 11) (Math/log10 2)) ;; => (log2 x) -> where x = 3.4594316186372978
-;; -> so flooring the number and i got the height
-;; if the items in an array size is: 11 -> then we can apply the math formula,
+;; where the x stands for the height/level => if i know the height =>
+;; i know which items should be discarded based on the total items.
+
+;; Applying a rudimental math here, i'm interested in finding the (log2 x)
+;; by applying the formula:: (log10 x) / (log10 2) => (log2 x) gives the log base 2
+(/ (Math/log10 8) (Math/log10 2)) ;; => (log2 x) -> where x = 3 => x = pow of 2:: 2^3
+(/ (Math/log10 11) (Math/log10 2)) ;; => (log2 x) -> where x = 3.4594316186372978 = pow of 2:: 2^3
+;; => so flooring the number and i got the height
+;; If the items in an array size is: 11 -> then i can apply the math formula,
 ;; and get the height, then applying the power of 2 using that computed height
 ;; i know the range of the items that SHOULD BE included in the heap operation.

-(defn heapify [xs]
+(defn heapify-opt [xs]
   "heapify takes a vector and transforms it into a heapified data-structure
    the operations performs in O(nlogn) just like any sorting operation
    Note:: there's no better sorting operation that performs faster than
@@ -414,5 +413,141 @@
                  ;; no attention required
                  (recur first-idxs)
 ))))))))
-(heapify [3 4 1 2 6 9 5 7 8]) ;; [1, 2, 3, 4, 6, 9, 5, 7, 8] => OK
-(heapify [12 8 7 6 5 11 4 2 3 1 10]) ;; [1, 2, 4, 3, 5, 11, 7, 6, 12, 8, 10] => OK
+(heapify-opt [3 4 1 2 6 9 5 7 8])        ;; [1, 2, 3, 4, 6, 9, 5, 7, 8] => OK
+(heapify-opt [12 8 7 6 5 11 4 2 3 1 10]) ;; [1, 2, 4, 3, 5, 11, 7, 6, 12, 8, 10] => OK
+
+;; with optimisation => discarding all the leaves::
+(time (def h (heapify-opt nums))) ;; => "Elapsed time: 2597.754177 msecs"
+;; without optimisation::
+(time (def h (heapify nums))) ;; => "Elapsed time: 2945.936282 msecs"
+;; => with optimisation i saved ~ 400 millis => which is quite good!
+(time (def h
+        (let [a (ArrayList.)] (doseq [x nums] (heap-insert a x)) a )))
+;; => iterating through all the nums and BUILDING the HEAP WHILE iterating
+;; takes MUCH less time:: "Elapsed time: 918.576557 msecs"
+
+;; optimizing the heap-extract-min to work with primitive-arrays, and
+;; avoiding the dumb copying that ArrayList does...
+(defn heap-extract-min-opt [heapified-arr last-idx]
+  "extract-min should perform in O(logn) time complexity
+   the steps required are::
+   1. assuming the root is the min -> heap sorted by min-nodes(root is always the min)
+      extract it, by removing it from the heap-structure
+   2. eventually the heap(logical binary searched tree will remain inconsistent without a root)
+      so pick the LAST leaf node from the heap structure and PROMOTE it as ROOT.
+      because being the last node(in a sorted heap) will 'FORCE' the mechanics to
+      downgrade it to a valid heap-level, this operation is called the:: bubble-down operation
+   3. as in the heapify operation:: compare new-promoted-root with both left-right logical children
+      and (because the root is the min) choose the smaller between those children.
+   4. perform the swap with new-promoted-root hence bubbling-down the promoted-root, and bubbling-up
+      the child node. Recursivelly bubble down until (here's the base-case) there's NO more children!"
+  (letfn [(promote-as-root! [h last-idx]
+            "side effectful operation:: will return old min root and perform the promotion of last leaf-node to new root"
+            (cond
+              (< last-idx 0) nil
+              (zero? last-idx)
+                (let [single (aget h last-idx)]
+                  (aset h last-idx nil)
+                  single)
+              :else
+                (let [last-node (aget h last-idx)
+                      root-node-idx 0
+                      root-min-node (aget h root-node-idx)]
+                  (aset h last-idx nil)
+                  (aset h root-node-idx last-node)
+                  root-min-node)))
+
+          (left-child-of [h curr-idx end-idx]
+            "primitive func that takes an array and an index and retrieves the logical
+             representation for the passed-index left-child"
+            (let [left-idx (dec (* 2 (inc curr-idx)))]
+              (if (> left-idx end-idx)
+                [-1 nil]
+                [left-idx (aget h left-idx)]
+          )))
+
+          (right-child-of [h curr-idx end-idx]
+            "primitive func that takes an array and an index and retrieves the logical
+             representation for the passed-index right-child"
+            (let [right-idx (dec (inc (* 2 (inc curr-idx))))]
+              (if (> right-idx end-idx)
+                [-1 nil]
+                [right-idx (aget h right-idx)]
+          )))
+
+          (cas-bubble-down! [start-idx [lidx lval] [ridx rval] h]
+            (let [startval (aget h start-idx)]
+              (cond
+                (and (< 0 lidx) (< 0 ridx)
+                     (> startval lval) (> startval rval)
+                     (> lval rval)) ;; take min children
+                  ;; swap with rval -> as it's the smallest
+                  (do
+                    (aset h start-idx rval)
+                    (aset h ridx startval)
+                    ridx) ;; new start-idx
+                (and (< 0 lidx) (< 0 ridx)
+                     (> startval lval) (> startval rval) (> rval lval))
+                  ;; swap with lval -> as it's the smallest
+                  (do
+                    (aset h start-idx lval)
+                    (aset h lidx startval)
+                    lidx)
+                (and (< 0 ridx) (> startval rval))
+                  ;; swap with rval -> as it's the smallest
+                  (do
+                    (aset h start-idx rval)
+                    (aset h ridx startval)
+                    ridx) ;; new start-idx
+
+                (and (< 0 lidx) (> startval lval))
+                  ;; swap with lval -> as it's the smallest
+                  (do
+                    (aset h start-idx lval)
+                    (aset h lidx startval)
+                    lidx)
+
+                :else (inc start-idx)
+          )))
+
+          (restructure-heap-recur! [h start-idx end-idx]
+            (when (< start-idx end-idx)
+              (let [[l-idx l :as lnode] (left-child-of h start-idx end-idx)
+                    [r-idx r :as rnode] (right-child-of h start-idx end-idx)]
+                (let [bubbled-down-idx (cas-bubble-down! start-idx lnode rnode h)]
+                  (recur h bubbled-down-idx end-idx)))))]
+
+    ;; the control of passing the last-idx is externalized...
+    (let [min-node (promote-as-root! heapified-arr last-idx)
+          start-idx 0]
+      ;; after promotion -> the array is shrinked -> last-idx is less with one
+      (restructure-heap-recur! heapified-arr start-idx (dec last-idx))
+      min-node)) ;; return min-node
+)
+(def h (heapify-opt [12 8 7 6 5 11 4 2 3 1 10]))
+;; [1, 2, 4, 3, 5, 11, 7, 6, 12, 8, 10] => OK
+
+;; second step ...extracting each min in the RIGHT reversed order...
+(for [rev-idx (reverse (range 0 (alength h)))]
+  (heap-extract-min h rev-idx))
+;; => (1 2 3 4 5 6 7 8 10 11 12) => niceeeeee
+
+;;;;;;;;;;;;;;;
+;; optimized heap-sort:: wooohoooo :) what a nice and neat function...
+;;;;;;;;;;;;;;;
+(defn heap-sort-opt [xs]
+  (let [heapified-arr (heapify-opt xs)]
+    (for [rev-idx (reverse (range 0 (count xs)))]
+      (heap-extract-min-opt heapified-arr rev-idx))
+))
+
+(def nums (shuffle (range 0 100000)))
+(time
+  (def s (heap-sort-opt nums))) ;; "Elapsed time: 2427.288922 msecs"
+;; => MUCH BETTER than the NON-optimised solution...comparable with merge-sort func
+;; now compare this running time(not a pure running time, but...) with the
+;; initial NON optimised versions where time to perform:: 92,053.150033 msecs
+;; ORDER OF MAGNITUDE ....well done!
+
+(time
+  (def core-sorted (sort nums))) ;; "Elapsed time: 40.887231 msecs"


Fixing single collection migration so that it migrates granules in the collection.

--- src/cmr/bootstrap/data/bulk_migration.clj
+++ src/cmr/bootstrap/data/bulk_migration.clj
@@ -111,10 +111,12 @@
 (defn- get-dataset-record-id-for-collection
   "Retrieve the id for a given collection/dataset from the catalog-rest table."
   [system provider-id collection-id]
-  (:id (j/with-db-transaction
+  (-> (j/with-db-transaction
          [conn (system->db system)]
-         (j/query conn (get-dataset-record-id-for-collection-sql system provider-id collection-id)))))
-
+         (j/query conn (get-dataset-record-id-for-collection-sql system provider-id collection-id)))
+      first
+      :id
+      int))

 (defn- get-provider-collection-list-sql
   "Gengerate SQL to get the list of collections (datasets) for the given provider."


Fixed typo

Fixed typo

--- src/elefant_server/domain/sse_service.clj
+++ src/elefant_server/domain/sse_service.clj
@@ -10,7 +10,7 @@

 (defn broadcast-message! [trumpetee-id message]
   {:pre [trumpetee-id]}
-  (log/info "Sending message " (:message message) "with id" (:id message) "to trumpetee" trumpetee-id)
+  (log/info "Sending message" (:message message) "with id" (:id message) "to trumpetee" trumpetee-id)
   (if-let [subscriber (@subscribers trumpetee-id)]
     (do (reset! (:last-accessed subscriber) (time/now))
         (go (>! (:sse-stream subscriber) (with-meta message {:event-type "trumpet"}))))


Fix argument order in mad2 example

Fix argument order in mad2 example

--- examples/mad2.clj
+++ examples/mad2.clj
@@ -36,7 +36,7 @@
          (cond
            (coll? i) (i2p i scale root)
            (nil? i) nil
-           :default (+ root (degree->interval scale i))))
+           :default (+ root (degree->interval i scale))))
        intervals))

 (defn play-over


Wrapped refresh-prices in try/catch statement

--- src/hackerati_interval_web_app/schema.clj
+++ src/hackerati_interval_web_app/schema.clj
@@ -119,19 +119,19 @@
        :password))

 (defn refresh-prices []
-  (let [products (select products)
-        agents (map #(agent %) (range (count products)))]
-    (doseq [a agents]
-      (send-off a (fn [_] (hash-map :productid (:productid (nth products @a)) :price (scrape/get-price-from-url (:url (nth products @a)))))))
-    (doseq [a agents]
-      (await-for 4000 a))
-    (doseq [a agents]
-      (.println System/out @a))
-    (doseq [a agents]
-      (add-price! @a))))
+  (try
+    (let [products (select products)
+         agents (map #(agent %) (range (count products)))]
+     (doseq [a agents]
+       (send-off a (fn [_] (hash-map :productid (:productid (nth products @a)) :price (scrape/get-price-from-url (:url (nth products @a)))))))
+     (doseq [a agents]
+       (await-for 4000 a))
+     (doseq [a agents]
+       (.println System/out @a))
+     (doseq [a agents]
+       (add-price! @a)))
+    (catch Exception e (str "Error refreshing prices: " e))))

-(defn user-exists? [username]
-  (seq (select users (where {:username username}))))

 (defn valid-user? [username password]
   (if (user-exists? username)


Tried sending error messages when exception occurs, though wasn't displayed by notebook. Cheating for now by sending an execute_result with :err value as the result

--- src/ipython_clojure/messaging/execute.clj
+++ src/ipython_clojure/messaging/execute.clj
@@ -14,15 +14,51 @@
   {:execution_count execution-count
    :code (get-in message [:content :code])})

-(defn pyout-content [execution-count execute-result]
-  {:execution_count execution-count
-   :data {:text/plain (str execute-result)}
-   :metadata {}})
+(defn prepare-resp
+  [resp]
+  (->> resp (map repl/read-response-value) repl/combine-responses))

 (defn execute [repl-conn request]
-  (let [resp (repl/message (repl/client repl-conn 1000) {:op "eval" :code (get-in request [:content :code])})]
+  (let [resp (repl/message (repl/client repl-conn 1000) {:op "eval" :code (get-in request [:content :code])})
+        prepared-resp (prepare-resp resp)]
     (swap! nrepl-session (fn [_] (-> resp first :session)))
-    (first (repl/response-values resp))))
+    (if (:value prepared-resp)
+      {:value (first (:value prepared-resp))}
+      (select-keys prepared-resp [:err :root-ex :ex]))))
+
+(defn execute-reply-message
+  [execute-result]
+  (if (:err execute-result)
+    {:status "error"
+     :execution_count @execution-count
+     :ename (:ex execute-result)
+     :evalue (:err execute-result)
+     :traceback [(:err execute-result)]}
+    {:status "ok"
+     :execution_count @execution-count
+     :payload [{:source "page" :data {:text/plain (str (:value execute-result))} :start 0}]
+     :user_expressions {}}))
+
+(defn send-out-message!
+  [iopub-socket username parent-header session-id execute-result]
+  (if (:err execute-result)
+    (do
+      (send-message iopub-socket "error" username
+                  {:execution_count @execution-count
+                   :ename (:ex execute-result)
+                   :evalue (:err execute-result)
+                   :traceback []}
+                  parent-header {} session-id)
+      (send-message iopub-socket "execute_result" username
+                    {:execution_count @execution-count
+                     :data {:text/plain (str (:err execute-result))}
+                     :metadata {}}
+                    parent-header {} session-id))
+    (send-message iopub-socket "execute_result" username
+                  {:execution_count @execution-count
+                   :data {:text/plain (str (:value execute-result))}
+                   :metadata {}}
+                  parent-header {} session-id)))

 (defmethod reply-to-message "execute_request"
   [message shell-socket iopub-socket nrepl-conn]
@@ -36,17 +72,13 @@
     (send-message iopub-socket "execute_input" username (pyin-content @execution-count message)
                   parent-header {} session-id)
     (send-message shell-socket "execute_reply" username
-                  {:status "ok"
-                   :execution_count @execution-count
-                   :payload [{:source "page" :data {:text/plain (str execute-result)} :start 0}]
-                   :user_expressions {}}
+                  (execute-reply-message execute-result)
                   parent-header
                   {:dependencies_met "True"
                    :engine session-id
                    :status "ok"
                    :started (now)} session-id)
-    (send-message iopub-socket "execute_result" username (pyout-content @execution-count execute-result)
-                  parent-header {} session-id)
+    (send-out-message! iopub-socket username parent-header session-id execute-result)
     (send-message iopub-socket "status" username (status-content "idle")
                   parent-header {} session-id)))


use RT.classForNameNonLoading rather than Class/forName

--- src/main/clojure/clojure/tools/reader.clj
+++ src/main/clojure/clojure/tools/reader.clj
@@ -631,7 +631,7 @@
 (defn- read-ctor [rdr class-name]
   (when-not *read-eval*
     (reader-error "Record construction syntax can only be used when *read-eval* == true"))
-  (let [class (Class/forName (name class-name) false (RT/baseLoader))
+  (let [class (RT/classForNameNonLoading (name class-name))
         ch (read-past whitespace? rdr)] ;; differs from clojure
     (if-let [[end-ch form] (case ch
                              \[ [\] :short]


Fix error in buffer block store test.

Fix error in buffer block store test.

--- test/blocks/store/buffer_test.clj
+++ test/blocks/store/buffer_test.clj
@@ -22,7 +22,8 @@
     (is (empty? (block/list backer)))
     (block/put! backer c)
     (is (= 3 (count (block/list store))))
-    (is (= (every? (set (map :id [a b c])) (block/list store))))
+    (is (every? (set (map :id [a b c]))
+                (map :id (block/list store))))
     (is (= (:id c) (:id (block/put! store c))))
     (is (= 2 (count (block/list buffer))))
     (blocks.store.buffer/flush! store)


fixed indicators by judgement query test

--- test/cia/stores/es/query_test.clj
+++ test/cia/stores/es/query_test.clj
@@ -51,7 +51,7 @@
              :query
              {:bool
               {:must
-               {:terms {:judgements.judgement
+               {:terms {:judgements.judgement_id
                         #{"judgement-41dae4cf-1721-4b25-a111-77cf28e8ca6d"
                           "judgement-734f0a85-f862-4abd-83e0-beda53556e29"}}}}}}}}})))


fix conditional of "can"

fix conditional of "can"

--- src/babel/english/lexicon.cljc
+++ src/babel/english/lexicon.cljc
@@ -305,13 +305,13 @@
                      :sem {:pred :call}}}

    "can"
-   {:english {:past "could"
+   {:english {:participle "being able to"
+              :past "could"
               :present {:3sing "can"}
               :future "be able to"
-              :conditional "could"}
+              :conditional "be able to"}
     :synsem {:cat :verb
-
-                     :sem {:pred :can}}}
+             :sem {:pred :can}}}

    "car" {:synsem {:cat :noun
                    :sem {:pred :car


for verbs, aux defaults to false

for verbs, aux defaults to false

--- src/babel/english/lexicon.cljc
+++ src/babel/english/lexicon.cljc
@@ -769,6 +769,7 @@
    "guess" {:synsem {:cat :verb
                      :sem {:pred :guess}}}

+   ;; TODO: add auxiliary sense of "have"
    "have" {:synsem {:cat :verb
                     :sem {:activity false
                           :discrete false
@@ -2040,6 +2041,11 @@
                  (if-then {:synsem {:cat :verb
                                     :sem {:reflexive false}}}
                           {:synsem {:sem {:reflexive false}}})
+
+                 ;; if not(aux), then aux=false
+                 (if-then {:synsem {:cat :verb
+                                    :aux false}}
+                          {:synsem {:aux false}})

                  ;; subject-and-reflexive-pronoun agreement
                  (if-then {:synsem {:sem {:reflexive true}
@@ -2050,5 +2056,3 @@
                           (let [subject-agr (atom :top)]
                             {:synsem {:subcat {:1 {:agr subject-agr}
                                                :2 {:agr subject-agr}}}}))))
-
-


set rootedness for vp-aux-22

set rootedness for vp-aux-22

--- src/babel/francais/grammar.clj
+++ src/babel/francais/grammar.clj
@@ -356,6 +356,7 @@

                    ;; [nous [être + naître]] => nous somme nées
                    (unifyc h22
+                           root-is-comp
                            (let [obj-agr (ref :top)] ;; TODO: Remove: this obj-agr is not used.
                              {:head {:phrasal false}
                               :rule "vp-aux-22"


Fixed merged issuesy

Fixed merged issuesy

--- src/clinvar_submitter/core.clj
+++ src/clinvar_submitter/core.clj
@@ -9,7 +9,6 @@
   (:import [java.lang.Exception])
   (:gen-class))

-;cli-options
 (def cli-options
   [;; output file defaults to clinvar-variant.csv and will not overwrite
    ;; unless -f force-overwrite option is specified


Add conversion from 0-based to 1-based numbering for ClinVar genomic coordinates.

--- src/clinvar_submitter/form.clj
+++ src/clinvar_submitter/form.clj
@@ -55,22 +55,26 @@
  (defn variant-start
   "Return the variant reference sequence start pos (1-based transform)."
   [t v]
-  ; TODO figure out how to go from 0-based to 1-based
-  (let [start (ld-> t v "referenceCoordinate" "start")]
-    (csv-colval (get start "index"))))
-
+  ; if ref is not null add 1 to start otherwise as-is
+  (let [ref (ld-> t v "referenceCoordinate" "refAllele")
+        alt (get v "allele")
+        start (ld-> t v "referenceCoordinate" "start")]
+    (csv-colval (if (blank? ref) (get start "index") (+ 1 (get start "index"))))))
+
  (defn variant-stop
   "Return the variant reference sequence stop pos (1-based transform)."
   [t v]
-  ; TODO figure out how to go from 0-based to 1-based
-  (let [stop (ld-> t v "referenceCoordinate" "end")]
-    (csv-colval (get stop "index"))))
+  ; if ref is blank and alt is not add 1 to stop otherwise as-is
+  (let [ref (ld-> t v "referenceCoordinate" "refAllele")
+        alt (get v "allele")
+        stop (ld-> t v "referenceCoordinate" "end")]
+    (csv-colval (if (and (blank? ref) (not (blank? alt))) (+ 1 (get stop "index")) (get stop "index")))))

  (defn variant-ref
   "Return the variant ref allele sequence."
   [t v]
-  (let [refseq (ld-> t v "referenceCoordinate")]
-    (csv-colval (get refseq "refAllele"))))
+  (let [refcoord (ld-> t v "referenceCoordinate")]
+    (csv-colval (get refcoord "refAllele"))))

  (defn variant-alt
    "Return the variant alt allele sequence."