Simplify verify namespace

Simplify verify namespace

- standardize test inputs and result handling

--- test/transit/verify.clj
+++ test/transit/verify.clj
@@ -18,11 +18,24 @@
             [transit.read :as r]
             [transit.write :as w]
             [transit.generators :as gen]
-            [transit.corner-cases :as cc])
-  (:import [java.io PrintStream ByteArrayOutputStream ByteArrayInputStream
+            [transit.corner-cases :as cc]
+            [clojure.pprint :as pp])
+  (:import [java.io ByteArrayOutputStream ByteArrayInputStream
             BufferedInputStream BufferedOutputStream FileInputStream]
-           [org.apache.commons.codec.binary Hex]
-           [java.math MathContext]))
+           [org.apache.commons.codec.binary Hex]))
+
+(def ^:dynamic *style* false)
+
+(def styles {:reset "[0m"
+             :red "[31m"
+             :green "[32m"
+             :bright "[1m"})
+
+(defn with-style [style & strs]
+  (let [s (apply str (interpose " " strs))]
+    (if (and *style* (not= style :none))
+      (str \u001b (style styles) s \u001b (:reset styles))
+      s)))

 (def TIMEOUT
   "Timeout for roundtrip requests to native implementation"
@@ -73,13 +86,11 @@
   stream which can be used to send data to the process, `:p` the
   process and `:reader` a transit reader."
   [command encoding]
-  ;; TODO: what if there is exception here? need to report that we
-  ;; couldn't start the process?
-  ;; TODO: how do we communicate that the encoding is not supported?
   (let [p (.start (ProcessBuilder. [command (name encoding)]))
         out (BufferedOutputStream. (.getOutputStream p))
         in (BufferedInputStream. (.getInputStream p))]
-    ;; r/reader does not return until data starts to flow over in
+    ;; for JSON, r/reader does not return until data starts to flow
+    ;; over input stream
     {:out out :p p :reader (future (r/reader in encoding))}))

 (defn stop-process
@@ -98,21 +109,24 @@
   data to the output stream. Throws an exception of the output stream
   is closed."
   [proc transit-data]
-  #_(println "Send bytes:")
-  #_(println (count transit-data))
-  #_(println (Hex/encodeHexString transit-data))
   (try
     (.write (:out proc) transit-data 0 (count transit-data))
     (.flush (:out proc))
-    (catch Throwable _
-      (throw (ex-info "Disconnected" {:status :disconnected :p proc :transit transit-data})))))
+    (catch Throwable e
+      (throw (ex-info "Disconnected" {:status :disconnected :cause e})))))

 (defn read-response
   "Given a process and a timeout in milliseconds, attempt to read
   a transit value.  If the read times out, returns `::timeout`.`"
   [proc timeout-ms]
-  (let [f (future (r/read @(:reader proc)))]
-    (deref f timeout-ms ::timeout)))
+  (let [f (future (r/read @(:reader proc)))
+        result (try
+                 (deref f timeout-ms ::timeout)
+                 (catch Throwable e
+                   (throw (ex-info "Read error" {:status :read-error :cause e}))))]
+    (if (= result ::timeout)
+      (throw (ex-info "Response timeout" {:status :timeout}))
+      result)))

 (defn equalize [data]
   (walk/prewalk (fn [node]
@@ -128,74 +142,83 @@
                         node))
                 data))

-(defn roundtrip-transit
-  "Given a process, a byte array of transit data and an encoding,
-  roundtrip the transit data and return a map of test results. Throws
-  an exception if sending transit data causes a timeout. The results
-  map contains the expected and actual Clojure data and the test
-  status: one of `:error` or `:success`."
-  [proc transit-out encoding]
-  (let [start (System/nanoTime)]
-    (write-to-stream proc transit-out)
-    (let [data-in (read-response proc TIMEOUT)
-          end (System/nanoTime)
-          data-out (read-transit transit-out encoding)]
-      (if (= data-in ::timeout)
-        (throw (ex-info "Response timeout" {:status :timeout :p proc :transit transit-out}))
-        {:transit-expected (String. transit-out)
+(defn roundtrip
+  "Given a process and an input data map, roundtrip the transit data
+  and return a map of test results."
+  [proc {:keys [edn encoded encoding] :as data}]
+  (try
+    (let [start (System/nanoTime)]
+      (write-to-stream proc encoded)
+      (let [data-in (read-response proc TIMEOUT)
+            end (System/nanoTime)
+            data-out (read-transit encoded encoding)]
+        {:data data
+         :transit-string (String. encoded)
          :data-expected data-out
          :data-actual data-in
          :nano-time (- end start)
-         ;; only checks the top level type
          :status (if (= (equalize data-out) (equalize data-in))
                    :success
-                   :error)}))))
-
-(defn roundtrip-edn
-  "Given a process, an EDN form and an encoding, roundtrip the EDN
-  data and return a map of test results. See `roundtrip-transit`."
-  [proc edn encoding]
+                   :error)}))
+    (catch Throwable e
+      (if-let [ed (ex-data e)]
+        (merge ed {:data data :message (.getMessage e)})
+        {:status :exception
+         :message "Generic Exception"
+         :cause e
+         :data data}))))
+
+(defn test-each
+  "Given a process and a collection of test inputs, roundtrip each
+  input and return a sequence of results."
+  [proc data]
+  (loop [data data
+         prev nil
+         ret []]
+    (if-let [input (first data)]
+      (let [result (assoc (roundtrip proc input) :prev-data prev)]
+        (if (contains? #{:success :error} (:status result))
+          (recur (rest data) input (conj ret result))
+          (conj ret result)))
+      ret)))
+
+(defn test-timing
+  "Given a process and a collection of test inputs, record the time in
+  milliseconds that it takes to roundtrip all of the inputs."
+  [proc data]
+  (dotimes [x 200]
+    (mapv #(roundtrip proc %) data))
+  (quot (reduce + (map :nano-time
+                       (mapv #(roundtrip proc %) data)))
+        1000000))
+
+(defn edn->test-input [form encoding]
   (try
-    (let [transit-out (write-transit edn encoding)]
-      (roundtrip-transit proc transit-out encoding))
+    (let [encoded (write-transit form encoding)]
+      {:edn form
+       :encoded encoded
+       :hex (Hex/encodeHexString encoded)
+       :encoding encoding})
     (catch Throwable e
-      (if (contains? #{:disconnected :timeout} (-> e ex-data :status) )
-        (throw (ex-info (.getMessage e) (assoc (ex-data e) :edn edn)))
-        (throw e)))))
-
-(defn test-transit
-  "Given a collection of transit byte arrays, a process and the
-  transit enconding, roundtrip each transit message and return a
-  sequence of results."
-  [transits proc encoding]
-  (mapv #(roundtrip-transit proc % encoding) transits))
-
-(defn test-edn
-  "Given a collection of EDN forms, a process and a transit
-  enconding, roundtrip each form and return a sequence of results."
-  [forms proc encoding]
-  (mapv #(roundtrip-edn proc % encoding) forms))
-
-(defn test-timing
-  "Given a collection of transit byte arrays, a process and the
-  transit enconding, record the time in milliseconds that it takes
-  to roundtrip all of the transit messages."
-  [transits proc encoding]
-  (dotimes [x 200]
-    (mapv #(roundtrip-transit proc % encoding) transits))
-  (quot (reduce + (map :nano-time
-                       (mapv #(roundtrip-transit proc % encoding) transits)))
-        1000000))
+      (println (with-style :red "Error! transit-clj Could not encode edn form"))
+      (println (pr-str form))
+      (.printStackTrace e))))
+
+(defn transit->test-input [transit encoding]
+  {:edn (read-transit transit encoding)
+   :encoded transit
+   :hex (Hex/encodeHexString transit)
+   :encoding encoding})

 (def extension {:json ".json"
                 :msgpack ".mp"})

 (defn exemplar-transit
-  "Given an encoding, return a collection of transit byte arrays in
-  that encoding. The byte arrays are loaded from the exemplar files in
-  the `transit` repository."
+  "Given an encoding, return a collection of test inputs in that
+  encoding. The inputs are loaded from the exemplar files in the
+  `transit` repository."
   [encoding]
-  (map #(read-bytes %)
+  (map #(transit->test-input (read-bytes %) encoding)
        (filter #(and (.isFile %) (.endsWith (.getName %) (extension encoding)))
                (file-seq (io/file "../transit/simple-examples")))))

@@ -212,27 +235,27 @@
               :desc "exemplar file"
               :input transit-exemplars
               :path [:tests :exemplar-file]
-              :test #(test-transit % proc encoding)}
+              :test #(test-each proc %)}
              {:pred (constantly true)
               :desc "EDN corner case"
-              :input cc/forms
+              :input (mapv #(edn->test-input % encoding) cc/forms)
               :path [:tests :corner-case-edn]
-              :test #(test-edn % proc encoding)}
+              :test #(test-each proc %)}
              {:pred (fn [_ e _] (= e :json))
               :desc "JSON transit corner case"
-              :input (map (fn [s] (.getBytes s)) cc/transit-json)
+              :input (mapv #(transit->test-input (.getBytes %) encoding) cc/transit-json)
               :path [:tests :corner-case-transit-json]
-              :test #(test-transit % proc encoding)}
+              :test #(test-each proc %)}
              {:pred (fn [_ _ o] (:gen o))
               :desc "generated EDN"
-              :input (:generated-forms opts)
+              :input (mapv #(edn->test-input % encoding) (:generated-forms opts))
               :path [:tests :generated-edn]
-              :test #(test-edn % proc encoding)}
+              :test #(test-each proc %)}
              {:pred (fn [_ _ o] (:time o))
               :desc "timing"
               :input transit-exemplars
               :path [:time]
-              :test #(let [ms (test-timing % proc encoding)]
+              :test #(let [ms (test-timing proc %)]
                        {:ms ms
                         :count (count transit-exemplars)
                         :encoding encoding})}])))
@@ -265,7 +288,7 @@
         results)
       (catch Throwable e
         (stop-process proc)
-        (merge results {:exception e})))))
+        (.printStackTrace e)))))

 (declare report)

@@ -273,15 +296,14 @@
   "Given a project name, an encoding and user provided options, run
   tests against this project."
   [project encoding opts]
-  (println (format "testing %s's %s encoding"
+  (println (format "testing %s's %s encoding skills..."
                    project
                    (name encoding)))
   (let [command (str "../" project "/bin/roundtrip")]
     (report (-> (verify-impl-encoding command encoding opts)
-                (assoc :project project))
-            opts)))
-
-  (defn verify-impl
+                (assoc :project project)))))
+
+(defn verify-encodings
   "Given a project name like 'transit-java', 'transit-clj' or
   'transit-ruby', and user provided options, run tests for each
   encoding specified in the options. Encoding can be either `:json` or
@@ -290,7 +312,7 @@
   (doseq [e (if enc [enc] [:json :msgpack])]
     (run-test project e opts)))

-(defn verify-all
+(defn verify
   "Given user provided options, run all tests specified by the
   options. If options is an empty map then run all tests against all
   implementations for both encodings."
@@ -299,12 +321,13 @@
         testable-impls (keep #(let [script (io/file root (str % "/bin/roundtrip"))]
                                 (when (.exists script) %))
                              (.list root))
+        ;; Generate n random forms. Use the same set for all tests.
         forms (when-let [n (:gen opts)]
                 (take n (repeatedly gen/ednable)))]
     (doseq [impl testable-impls]
       (when (or (not impls)
                 (contains? impls impl))
-        (verify-impl impl (assoc opts :generated-forms forms))))))
+        (verify-encodings impl (assoc opts :generated-forms forms))))))

 (defn read-options
   "Given a sequence of strings which are the command line arguments,
@@ -320,90 +343,67 @@
           {}
           (partition-all 2 (partition-by #(.startsWith % "-") args))))

-(def ^:dynamic *style* false)
-
 (defn -main [& args]
   (binding [*style* true]
-    (verify-all (read-options args))
+    (verify (read-options args))
     (shutdown-agents)))

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; Reporting

-(def styles {:reset "[0m"
-             :red "[31m"
-             :green "[32m"
-             :bright "[1m"})
-
-(defn with-style [style & strs]
-  (let [s (apply str (interpose " " strs))]
-    (if (and *style* (not= style :none))
-      (str \u001b (style styles) s \u001b (:reset styles))
-      s)))
-
-(defn result-type [results]
-  (cond (= (:status (ex-data (:exception results))) :timeout)
-        :timeout
-        (= (:status (ex-data (:exception results))) :disconnected)
-        :disconnected
-        (:exception results)
-        :exception
-        (every? #(= (:data-actual %) ::read-error) (apply concat (vals (:tests results))))
-        :not-implemented))
-
-(defmulti print-report (fn [results opts] (result-type results)))
-
-(defmethod print-report :timeout [results opts]
-  (let [timeout-form (-> results :exception ex-data :edn)
-        [prev curr] (first (filter #(= (last %) timeout-form)
-                                   ;; TODO: timeout could occur
-                                   ;; in other kinds of tests
-                                   (partition 2 1 (:generated-forms opts))))]
-    (println (with-style :red "Response Timeout"))
-    (println (with-style :red "Timeout while processing:"))
-    (println (pr-str timeout-form))
-    (println (with-style :red "Previous form was:"))
-    (println (pr-str prev))))
-
-(defmethod print-report :disconnected [results opts]
-  (let [error-form (-> results :exception ex-data :transit)]
-    (println (with-style :red "Implementation Disconnected"))
-    (println (with-style :red "Disconnect when sending:"))
-    (println (pr-str (String. error-form)))))
-
-(defmethod print-report :exception [results opts]
-  (do (println results)
-      (.printStackTrace (:exception results))))
-
-(defmethod print-report :not-implemented [results opts]
-  (println (with-style :red "Not Implemented")))
-
-(defmethod print-report :default [results opts]
-  ;; TODO: need to do something better for printing transit data
-  ;; (when bytes)
-  (doseq [[k v] (:tests results)]
-    (let [errors (filter #(= (:status %) :error) v)
-          ecnt (count errors)
-          pcnt (- (count v) ecnt)
-          style (if (pos? ecnt) :red :green)]
-      (println (with-style style (format "Testing with %s %s inputs"
-                                         (count v) k)))
-      (println (with-style style (format "Summary: passed: %s, errors: %s"
-                                         pcnt ecnt)))
-      (when (pos? ecnt)
-        (do (doseq [error errors]
-              (println "Sent Transit:" (pr-str (:transit-expected error)))
-              (println "Expected:    " (pr-str (:data-expected error)))
-              (println "Actual:      " (pr-str (:data-actual error)))))))))
-
-(defn report [{:keys [project command encoding tests time] :as results} opts]
-  (println (with-style :bright "Project: " project))
+(defn error-report [message errors]
+  (doseq [error errors]
+    (println (with-style :red message))
+    (when (:cause error)
+      (println (with-style :red "Cause: " (.toString (:cause error)))))
+    (println (with-style :red "Error when sending:"))
+    (println (pr-str (-> error :data :edn)))
+    (println (with-style :red "Previous sent form was:"))
+    (println (pr-str (-> error :prev-data :edn)))))
+
+(defmulti print-report (fn [type results] type))
+
+(defmethod print-report :timeout [_ results]
+  (error-report "Response Timeout" results))
+
+(defmethod print-report :disconnected [_ results ]
+  (error-report "Disconnected" results))
+
+(defmethod print-report :read-error [_ results]
+  (error-report "Read Error" results))
+
+(defn plural [things w]
+  (if (= (count things) 1) w (str w "s")))
+
+(defmethod print-report :success [_ results]
+  (println (with-style :green (format "%s successful %s"
+                                      (count results)
+                                      (plural results "roundtrip")))))
+
+(defmethod print-report :error [_ results]
+  (println (with-style :red (format "%s roundtrip %s"
+                                    (count results)
+                                    (plural results "error"))))
+  (doseq [error results]
+    (println "Sent edn:    " (pr-str (-> error :data :edn)))
+    (println "     bytes:  " (-> error :data :hex))
+    (println "     string: " (pr-str (:transit-string error)))
+    (println "Expected:    " (pr-str (:data-expected error)))
+    (println (with-style :red "Actual:      " (pr-str (:data-actual error))))))
+
+(defmethod print-report :default [type results]
+  (pp/pprint results))
+
+(defn report [{:keys [project command encoding time tests] :as results}]
+  (println (with-style :bright "Project: " project "/" (name encoding)))
   (println "Command: " command)
-  (println "Encoding:" encoding)
   (when time
     (println (with-style :bright
                (format "Time: %s ms to roundtrip %s %s exemplar files"
                        (:ms time)
                        (:count time)
                        (name (:encoding time))))))
-  (print-report results opts))
+  (doseq [[k v] tests]
+    (println "Results for test:" (name k))
+    (doseq [[type results] (group-by :status v)]
+      (print-report type results))))


Allow lookup by ServiceName or String

Allow lookup by ServiceName or String

--- modules/core/src/main/clojure/immutant/registry.clj
+++ modules/core/src/main/clojure/immutant/registry.clj
@@ -25,6 +25,6 @@

 (defn service [name]
   (if registry
-    (let [key (ServiceName/parse name)
+    (let [key (if (string? name) (ServiceName/parse name) name)
           value (.getService registry key)]
       (and value (.getValue value)))))


adding conditional initialization based on scene

--- src/timsg/scene_var.clj
+++ src/timsg/scene_var.clj
@@ -20,12 +20,13 @@
 (s/def ::def-entity-args
   (s/cat
     :name symbol?
+    :scenes (s/? (s/coll-of string? :kind vector?))
     :tails (s/alt
              :single-arity ::tail-impl
              :n-arities (s/* (s/spec ::tail-impl)))))

 (defn- parse-def-form [args]
-  (as/qwik-conform [{:keys [name tails] :as spec} ::def-entity-args args]
+  (as/qwik-conform [{:keys [name tails scenes] :as spec} ::def-entity-args args]
     (let [qualified-name  (symbol
                             (c/name (ns-name *ns*))
                             (c/name name))
@@ -40,6 +41,7 @@
                              1 :update)]
                      [k `(fn ~args ~@tail)])))
           init-spec (assoc fmap
+                      :scenes (or scenes :all)
                       :kw qualified-kw
                       :name qualified-name)]
       init-spec)))
@@ -158,39 +160,49 @@
                    "Instead returning instance of class: " (pr-str (class obj))))))
       obj)))

+(defn current-scene? [scenes]
+  (or (= scenes :all) ;; the default if no scenes specified
+      (let [this-scene (.name (UnityEngine.SceneManagement.SceneManager/GetActiveScene))]
+        (some #(cond (string? %) (= % this-scene)
+                     (instance? System.Text.RegularExpressions.Regex %) (re-matches % this-scene)
+                     :else false)
+          scenes))))
+
 ;; gotta happen on main thread!
 (defn init-def
   "Internal, don't use."
-  [{:keys [name kw init]
+  [{:keys [name kw init scenes]
     update-fn :update
     :as init-spec}]
-  (let [anchor kw
-        ;; If an existing GameObject corresponds to this anchor, get
-        ;; it. If not, construct it.
-        existing-obj (or (when-let [x (anchor->obj anchor)]
-                           (if (null-obj? x)
-                             (do (gc) ;; there shouldn't be any of these
-                                 nil)
-                             (gobj x)))
-                         (run-init init))]
-    ;; If it isn't nil, make it correspond to the anchor.
-    (when-not (nil? existing-obj)
-      (ensure-anchor existing-obj anchor))
-    ;; If the 1-ary update body to defgetter is defined, run it on the GameObject now.
-    (if update-fn
-      (let [updated-obj (run-update update-fn existing-obj)]
-        (cond
-          (game-object? updated-obj)
-          (ensure-anchor updated-obj anchor)
-
-          (nil? init)
-          (throw (Exception.
-                   (str "0-ary body of defgetter is not provided, and 1-ary body of "
-                        "defgetter does not return GameObject instance. Instead returns "
-                        "instance of: " (pr-str (class updated-obj)))))
-
-          :else existing-obj))
-      existing-obj)))
+  ;; short-circuit if this is the wrong scene
+  (when (current-scene? scenes)
+    (let [anchor kw
+          ;; If an existing GameObject corresponds to this anchor, get
+          ;; it. If not, construct it.
+          existing-obj (or (when-let [x (anchor->obj anchor)]
+                             (if (null-obj? x)
+                               (do (gc) ;; there shouldn't be any of these
+                                   nil)
+                               (gobj x)))
+                           (run-init init))]
+      ;; If it isn't nil, make it correspond to the anchor.
+      (when-not (nil? existing-obj)
+        (ensure-anchor existing-obj anchor))
+      ;; If the 1-ary update body to defgetter is defined, run it on the GameObject now.
+      (if update-fn
+        (let [updated-obj (run-update update-fn existing-obj)]
+          (cond
+            (game-object? updated-obj)
+            (ensure-anchor updated-obj anchor)
+
+            (nil? init)
+            (throw (Exception.
+                     (str "0-ary body of defgetter is not provided, and 1-ary body of "
+                          "defgetter does not return GameObject instance. Instead returns "
+                          "instance of: " (pr-str (class updated-obj)))))
+
+            :else existing-obj))
+        existing-obj))))

 ;; to def and get an object from the scene
 (defmacro defgetter
@@ -230,7 +242,7 @@

   After `defgetter` is evaluated, the var `name` will be bound to a getter function that will return the GameObject associated with `name`, or `nil` if no such GameObject exists. If the GameObject associatd with `name` changes, the getter function will subsequently return that new GameObject."
   [& args]
-  (let [{:keys [name kw] :as init-spec} (parse-def-form args)]
+  (let [{:keys [name kw scenes] :as init-spec} (parse-def-form args)]
     `(do (init-def ~(update init-spec :name #(list 'quote %)))
          (defn ^UnityEngine.GameObject ~name
            ([] (~name @world-ref))


Improve naming in some function on svg ns.

--- src/uxbox/util/svg.cljs
+++ src/uxbox/util/svg.cljs
@@ -60,8 +60,8 @@
                            apply-rotation))

 (defn calculate-transform
-  [attrs]
-  (let [result (->> (interpret-attrs attrs)
+  [shape]
+  (let [result (->> (interpret-attrs shape)
                     (apply mtx/multiply)
                     (deref)
                     (take 6)


Add normalize-categories

Add normalize-categories

Also replace (into {} (for [[k v] ..] ..)) pattern with Medley's
map-vals

--- src/clj/com/hypirion/clj_xchart.clj
+++ src/clj/com/hypirion/clj_xchart.clj
@@ -38,6 +38,19 @@
                         JFrame
                         SwingUtilities)))

+;; reduce-map + map-vals is taken from the Medley utility library:
+;; https://github.com/weavejester/medley
+;; Medley is under the same license (EPL1.0) as clj-xchart.
+(defn- reduce-map [f coll]
+  (if (instance? clojure.lang.IEditableCollection coll)
+    (persistent! (reduce-kv (f assoc!) (transient (empty coll)) coll))
+    (reduce-kv (f assoc) (empty coll) coll)))
+
+(defn- map-vals
+  "Maps a function over the values of an associative collection."
+  [f coll]
+  (reduce-map (fn [xf] (fn [m k v] (xf m k (f v)))) coll))
+
 (def colors
   "All the default java.awt colors as keywords. You can use this map
   to iterate over the keys, in case you'd like to compare different
@@ -511,16 +524,12 @@
   value 0.0 is inserted. If there are other x values not in x-order, they are
   attached at the end in sorted order."
   [series-map x-order]
-  (let [series-map (into {}
-                         (for [[k v] series-map]
-                           [k (normalize-category-series v)]))
+  (let [series-map (map-vals normalize-category-series series-map)
         x-order (vec x-order)
         extra-xs (sort (set/difference (category-series-xs series-map)
                                        (set x-order)))
         x-order (into x-order extra-xs)]
-    (into {}
-          (for [[k v] series-map]
-            [k (reorder-series v x-order)]))))
+    (map-vals #(reorder-series % x-order) series-map)))

 (defn category-chart
   "Returns a category chart. See the tutorial for more information
@@ -721,6 +730,15 @@
   Example: (extract-series {:x f, :y g, :bubble bubble} coll)
         == {:x (map f coll), :y (map g coll), :bubble (map bubble coll)}"
   [keymap coll]
-  (into {}
-        (for [[k v] keymap]
-          [k (map v coll)])))
+  (map-vals #(% coll) keymap))
+
+(defn- normalize-group
+  [m]
+  (let [sum (reduce + (vals m))]
+    (map-vals #(/ % sum) m)))
+
+(defn normalize-categories
+  [m]
+  (->> (transpose-map m)
+       (map-vals normalize-group)
+       transpose-map))


refactor

refactor

--- src/clj/jsk/conductor/conductor.clj
+++ src/clj/jsk/conductor/conductor.clj
@@ -643,25 +643,22 @@
    If agent doesn't know anything, timeout will have to kick in and fail the job.
    Email users about agent disconnect and affected exec-vertex ids"
   [interval-ms]
-  (while true
-    (let [ts-threshold (- (util/now) interval-ms)
-          agent-job-map (track/dead-agents-job-map @tracker ts-threshold)
-          dead-agents (keys agent-job-map)
-          vertex-ids (reduce into #{} (vals agent-job-map))]
-
-
-      (when (-> vertex-ids empty? not)
-        (log/info "Dead agent check, dead agents:" dead-agents ", affected vertex-ids:" vertex-ids)
-
-        ; mark status as unknown in db
-        (db/update-execution-vertices-status vertex-ids data/unknown-status (util/now))
-
-        ; remove from tracker
-        (swap! tracker track/rm-agents dead-agents)
-
-        (notify/dead-agents dead-agents vertex-ids))
-
-      (Thread/sleep interval-ms))))
+  (let [ts-threshold (- (util/now) interval-ms)
+        agent-job-map (track/dead-agents-job-map @tracker ts-threshold)
+        dead-agents (keys agent-job-map)
+        vertex-ids (reduce into #{} (vals agent-job-map))]
+
+    (when (-> vertex-ids empty? not)
+      (log/info "Dead agent check, dead agents:" dead-agents ", affected vertex-ids:" vertex-ids)
+
+      ; mark status as unknown in db
+      (db/update-execution-vertices-status vertex-ids data/unknown-status (util/now))
+
+      ; remove from tracker
+      (swap! tracker track/rm-agents dead-agents)
+
+      (notify/dead-agents dead-agents vertex-ids))))
+

 ;-----------------------------------------------------------------------
@@ -677,30 +674,6 @@
     (log/info "No agents connected. Broadcasting registration and waiting..")
     (put! publish-chan {:topic "broadcast" :data {:msg :agents-register}})
     (Thread/sleep 1000)))
-
-
-;-----------------------------------------------------------------------
-; Kicks off jobs/wfs when quartz says to.
-;-----------------------------------------------------------------------
-(defn- run-quartz-processing
-  "Quartz puts messages on ch. This reads those messages and triggers the jobs/wfs."
-  [ch]
-  (go-loop [{:keys[node-id]} (<! ch)]
-     (try
-       (trigger-node-execution node-id)
-       (catch Exception ex
-         (log/error ex)))
-     (recur (<! ch))))
-
-
-(defn- run-heartbeats
-  "Starts a new thread to put heartbeat messages on to ch everty t millisecs."
-  [ch t]
-  (util/start-thread "heartbeats"
-                     (fn[]
-                       (while true
-                         (put! ch {:topic "broadcast" :data {:msg :heartbeat}})
-                         (Thread/sleep t)))))

 (defn- populate-cache
@@ -735,9 +708,10 @@
   ; REVIEW
   ; for some reason if heartbeats are started first things work otherwise not
   ;----------------------------------------------------------------------
-  (run-heartbeats publish-chan (conf/heartbeats-interval-ms))
-
-  (util/start-thread "dead-agent-checker" #(run-dead-agent-check (conf/heartbeats-dead-after-ms)))
+  (let [hb-ms (conf/heartbeats-interval-ms)
+        dead-after-ms (conf/heartbeats-dead-after-ms)]
+    (util/periodically "heartbeats" hb-ms #(publish msg/broadcast-topic {:msg :heartbeat}))
+    (util/periodically "dead-agent-checker" dead-after-ms (partial run-dead-agent-check dead-after-ms)))

   (log/info "Populating cache.")
   (populate-cache)
@@ -748,7 +722,7 @@
   (log/info "Initializing Quartz.")
   (quartz/init quartz-chan)
   ; quartz puts stuff on the quartz-chan when a trigger is fired
-  (run-quartz-processing quartz-chan)
+  (msg/process-read-channel quartz-chan #(-> :node-id %1 trigger-node-execution))

   (log/info "Populating Quartz.")


Fix memory leak and high CPU usage (fixes #22)

--- src/cljs/asciinema_player/core.cljs
+++ src/cljs/asciinema_player/core.cljs
@@ -84,7 +84,7 @@
   for each element. It tries to always stay 'on the schedule' by measuring
   elapsed time and skipping elements if necessary."
   [coll]
-  (let [ch (chan (sliding-buffer 1))
+  (let [ch (chan)
         start (js/Date.)]
     (go
       (loop [coll coll
@@ -170,6 +170,21 @@
   [frames-ch]
   (priority-chan [:frame frames-ch] [:blink make-cursor-blink-chan]))

+(defn pipe
+  "Copies elements received on input-ch to output-ch until stop-ch closes."
+  [input-ch stop-ch]
+  (let [output-ch (chan (sliding-buffer 1))]
+    (go-loop []
+      (let [[v c] (alts! [input-ch stop-ch])]
+        (condp = c
+          input-ch (if v
+                     (do
+                       (>! output-ch v)
+                       (recur))
+                     (close! output-ch))
+          stop-ch nil)))
+    output-ch))
+
 (defmulti start-playback
   "The heart of the player. Coordinates dispatching of state update events like
   terminal line updating, time reporting and cursor blinking. Returns player
@@ -182,12 +197,12 @@
         speed (:speed player)
         all-frames (-> player :source :frames)
         frames (-> all-frames (next-frames start-at) (frames-at-speed speed))
-        frames-ch (coll->chan frames)
+        stop-playback-ch (chan)
+        frames-ch (pipe (coll->chan frames) stop-playback-ch)
         events-ch (screen-events frames-ch)
         elapsed-time #(* (elapsed-time-since start) speed)
-        timer-ch (coll->chan (repeatedly (fn []
-                                           [0.3 (+ start-at (elapsed-time))])))
-        stop-playback-ch (chan)
+        time-events (repeatedly (fn [] [0.3 (+ start-at (elapsed-time))]))
+        timer-ch (pipe (coll->chan time-events) stop-playback-ch)
         stop-fn (fn []
                   (close! stop-playback-ch)
                   (elapsed-time))]
@@ -204,6 +219,7 @@
                           (recur))
                         (dispatch player [:finished]))
             stop-playback-ch nil))) ; do nothing, break the loop
+      (close! stop-playback-ch)
       (dispatch player [:blink true]))
     (-> player
         (update-screen (screen-state-at all-frames start-at))


Rename functions and bindings

Rename functions and bindings

--- src/cljs/cglossa/search_inputs.cljs
+++ src/cljs/cglossa/search_inputs.cljs
@@ -1,26 +1,26 @@
 (ns cglossa.search-inputs
   (:require [clojure.string :as str]))

-(defn- convert-to-cqp [value phonetic?]
+(defn- phrase->cqp [phrase phonetic?]
   (let [attr (if phonetic? "phon" "word")
         chinese-chars-range "[\u4E00-\u9FFF\u3400-\u4DFF\uF900-\uFAFF]"
         ; Surround every Chinese character by space when constructing a cqp query,
         ; to treat it as if it was an individual word:
-        value (str/replace value (re-pattern (str "(" chinese-chars-range ")")) " $1 ")]
-    (->> (str/split value #"\s")
+        phrase (str/replace phrase (re-pattern (str "(" chinese-chars-range ")")) " $1 ")]
+    (->> (str/split phrase #"\s")
          (map #(if (= % "")
                 ""
                 (str "[" attr "=\"" % "\" %c]")))
          (str/join " "))))

-(defn- handle-text-changed [event search-query phonetic?]
+(defn- on-text-changed [event search-query phonetic?]
   (let [value (aget event "target" "value")
         query (if (= value "")
                 ""
-                (convert-to-cqp value phonetic?))]
+                (phrase->cqp value phonetic?))]
     (swap! search-query assoc-in [:query] query)))

-(defn- handle-phonetic-changed [event search-query]
+(defn- on-phonetic-changed [event search-query]
   (let [query (:query @search-query)
         checked? (aget event "target" "checked")
         query (if checked?
@@ -36,11 +36,11 @@
      [:form.form-inline.span12
       [:div.span10
        [:input.span12 {:type "text" :value displayed-query
-                       :on-change #(handle-text-changed % search-query phonetic?)}]
+                       :on-change #(on-text-changed % search-query phonetic?)
        [:label {:style {:marginTop 5}}]
        [:input {:name "phonetic" :type "checkbox"
                 :style {:marginTop -3} :checked phonetic?
-                :on-change #(handle-phonetic-changed % search-query)} " Phonetic form"]]]]))
+                :on-change #(on-phonetic-changed % search-query)} " Phonetic form"]]]]))

 (def components {:cwb        cwb-search-inputs
                  :cwb-speech (fn [] [:div "CWB-SPEECHE"])})


fix recuring credit icon

fix recuring credit icon

--- src/cljs/netrunner/cardbrowser.cljs
+++ src/cljs/netrunner/cardbrowser.cljs
@@ -26,7 +26,7 @@
       (make-span "\\[Credits\\]" "credit")
       (make-span "\\[Click\\]" "click")
       (make-span "\\[Subroutine\\]" "subroutine")
-      (make-span "\\[Recuring Credits\\]" "recuring-credit")
+      (make-span "\\[Recurring Credits\\]" "recurring-credit")
       (make-span "1\\[Memory Unit\\]" "mu1")
       (make-span "2\\[Memory Unit\\]" "mu2")
       (make-span "3\\[Memory Unit\\]" "mu3")


handle empty page name error

handle empty page name error

--- src/cljs/salava/page/ui/helper.cljs
+++ src/cljs/salava/page/ui/helper.cljs
@@ -300,26 +300,20 @@
                                                                               (get-in data [:page :blocks]))))]
                  (reset! state (assoc data-with-uuids :toggle-move-mode false))))}))

-#_(defn refresh-page [id state]
-   (ajax/GET
-     (path-for (str "/obpv1/page/edit/" id) true)
-     {:handler (fn [data]
-                (let [data-with-uuids (assoc-in data [:page :blocks] (vec (map #(assoc % :key (random-key))
-                                                                               (get-in data [:page :blocks]))))]
-                  (swap! state merge data-with-uuids #_(assoc data-with-uuids :toggle-move-mode false))))}))
-

 (defn save-page [state next-url]
   (let [{:keys [id name description blocks]} (:page @state)]
+   (if (blank? name)
+    (swap! state assoc :alert {:message (t :badge/Emptynamefield) :status "error"} :spinner false)
     (ajax/POST
       (path-for (str "/obpv1/page/save_content/" id))
       {:params {:name name
                 :description description
                 :blocks (prepare-blocks-to-save blocks)}
        :handler (fn [data]
-                  (swap! state assoc :spinner false)
+                  (swap! state assoc :spinner false :alert nil)
                  ;(refresh-page id state)
-                 (when next-url (navigate-to next-url)))})))
+                 (when next-url (navigate-to next-url)))}))))

 (defn save-theme [state next-url]
   (let [{:keys [id theme border padding]} (:page @state)]


Remove unnecessary comments

Remove unnecessary comments

--- src/clojure/paredit_widget/core.clj
+++ src/clojure/paredit_widget/core.clj
@@ -61,7 +61,7 @@
    [nil "]"] :paredit-close-square
    [nil "{"] :paredit-open-curly
    [nil "}"] :paredit-close-curly
-   [nil "\""] :paredit-doublequote ;; \"
+   [nil "\""] :paredit-doublequote
    ["C" "9"] :paredit-backward-slurp-sexp
    ["C" "0"] :paredit-forward-slurp-sexp
    ["C" "["] :paredit-backward-barf-sexp
@@ -87,7 +87,7 @@
    ["M" "}"] :paredit-close-curly})

 (def ^:const special-chars
-  #{"(" ")" "[" "]" "{" "}" "\""}) ;; \"
+  #{"(" ")" "[" "]" "{" "}" "\""})

 (defn exec-paredit!
   [k w buffer enable-default? enable-advanced?]


Added exec_string_iterate instruction

Added exec_string_iterate instruction

--- src/clojush/instructions/string.clj
+++ src/clojush/instructions/string.clj
@@ -345,3 +345,25 @@
                    :string
                    (pop-item :char (pop-item :string state))))
       state)))
+
+(define-registered
+  exec_string_iterate ; Returns a function that iterates over a string using the code on the exec stack.
+  ^{:stack-types [:string :char :exec] :parentheses 1}
+  (fn [state]
+    (if (or (empty? (:string state))
+            (empty? (:exec state)))
+      state
+      (let [s (top-item :string state)]
+      (cond
+        (empty? s) (->> state
+                        (pop-item :string)
+                        (pop-item :exec))
+        (empty? (rest s)) (->> state ;If the rest of the string is empty, we're done iterating.
+                            (pop-item :string)
+                            (push-item (first s) :char))
+        :else (->> state
+                (pop-item :string)
+                (push-item 'exec_string_iterate :exec)
+                (push-item (apply str (rest s)) :exec)
+                (push-item (top-item :exec state) :exec)
+                (push-item (first s) :char)))))))


speed-test-10: increase iterations from 1 to 10

--- test/babel/test/fr.cljc
+++ test/babel/test/fr.cljc
@@ -785,6 +785,6 @@

 (deftest speed-test-10
   (log/info (str "speed-test-10"))
-  (speed-test spec-10 1))
-
-
+  (speed-test spec-10 10))
+
+


+[babel.parse :as parse]

+[babel.parse :as parse]

--- test/babel/test/it.cljc
+++ test/babel/test/it.cljc
@@ -4,6 +4,7 @@
             [babel.italiano.lexicon :refer [lexicon]]
             [babel.italiano.morphology :refer [fo new-style replace-patterns]]
             [babel.italiano.workbook :refer [analyze generate generate-all parse]]
+            [babel.parse :as parse]
             #?(:clj [clojure.test :refer [deftest is]])
             #?(:cljs [cljs.test :refer-macros [deftest is]])
             #?(:clj [clojure.tools.logging :as log])


+(defn sentences-with-pronoun-objects)

+(defn sentences-with-pronoun-objects)

--- test/babel/test/it.cljc
+++ test/babel/test/it.cljc
@@ -888,3 +888,17 @@
            (-> spec
                generate
                morph)))))
+
+;; TODO: make this a deftest.
+(defn sentences-with-pronoun-objects []
+  (let [spec
+        {:modified false
+         :synsem {:cat :verb
+                  :subcat []
+                  :sem {:pred :top
+                        :tense :present
+                        :aspect :simple
+                        :subj {:pred :top}
+                        :obj {:pred :top}}}
+         :head {:comp {:synsem {:pronoun true}}}}]
+    (repeatedly #(-> spec generate morph println))))


Don't hide aside in v1 build page

Don't hide aside in v1 build page

--- src-cljs/frontend/controllers/navigation.cljs
+++ src-cljs/frontend/controllers/navigation.cljs
@@ -7,6 +7,7 @@
             [frontend.changelog :as changelog]
             [frontend.components.documentation :as docs]
             [frontend.favicon]
+            [frontend.models.feature :as feature]
             [frontend.models.build :as build-model]
             [frontend.pusher :as pusher]
             [frontend.state :as state]
@@ -142,7 +143,7 @@
       state-utils/clear-page-state
       (assoc :navigation-point navigation-point
              :navigation-data (assoc args
-                                     :show-aside-menu? false
+                                     :show-aside-menu? (not (feature/enabled? :ui-v2))
                                      :show-settings-link? false)
              :project-settings-project-name project-name)
       (assoc-in state/crumbs-path [{:type :dashboard}


Added some more batch split tests

Added some more batch split tests


Fix ::node-pred spec and remove clojure.set operations were possible.

--- evermind.core/src/evermind/domain/core.clj
+++ evermind.core/src/evermind/domain/core.clj
@@ -1,7 +1,7 @@
 (ns evermind.domain.core
-    (:require [clojure.spec.alpha :as s]
-      [clojure.set :as cljset]
-      [clojure.spec.gen.alpha :as gen]))
+  (:require [clojure.spec.alpha :as s]
+            [clojure.spec.gen.alpha :as gen]
+            [clojure.set :as cljset]))

 (s/def ::node
   (s/keys :req-un []
@@ -17,12 +17,13 @@
   (s/keys :req-un []
           :opt-un [::text]))

-(s/def ::pred-result boolean?)
-
-(s/fdef ::pred
-         :args (s/cat :node ::node)
-         :ret ::pred-result)
-
+(s/def ::node-pred (s/with-gen (s/fspec :args (s/cat :node ::node) :ret boolean?)
+                               #(gen/return
+                                  (memoize
+                                    (first
+                                      (gen/sample
+                                        (s/gen (s/fspec :args (s/cat :node ::node) :ret boolean?))
+                                        1))))))

 (defn create-node
@@ -35,21 +36,20 @@

 (defn set-attributes
-      ([node attributes]
-        (assoc node :attributes attributes)))
+  ([node attributes]
+   (assoc node :attributes attributes)))

 (s/fdef set-attributes
         :args (s/cat :node ::node :attributes ::attributes)
         :ret ::node
         :fn #(= (-> % :ret :attributes)
-                 (-> % :args :attributes)))
+                (-> % :args :attributes)))

 (defn add-child
-      ([node child]
-        (assoc node :children
-          (cljset/union (:children node) #{child}))))
+  ([node child]
+   (assoc node :children (set (conj (:children node) child)))))

 (s/fdef add-child
         :args (s/cat :node ::node :child ::node)
@@ -62,10 +62,7 @@

 (defn remove-child
   ([node child]
-    (assoc node :children
-           (cljset/union
-             #{}
-             (cljset/difference (:children node) #{child})))))
+   (assoc node :children (set (remove #(= % child) (:children node))))))

 (s/fdef remove-child
         :args (s/cat :node ::node :child ::node)
@@ -79,22 +76,20 @@

 (defn filter-children
   ([node pred]
-    (assoc node :children (cljset/union
-                            #{}
-                            (cljset/select pred (:children node))))))
+   (assoc node :children (set (filter pred (:children node))))))

 (s/fdef filter-children
-        :args (s/cat :node ::node :pred ::pred)
+        :args (s/cat :node ::node :pred ::node-pred)
         :ret ::node
-        :fn #(and
-               (<=
-                 (count (-> % :ret :children))
-                 (count (-> % :args :node :children)))))
+        :fn #(and (every? false? (map (-> % :args :pred)
+                                      (cljset/difference (-> % :args :node :children)
+                                                         (-> % :ret :children))))
+                  (every? true? (map (-> % :args :pred) (-> % :ret :children)))))

 (defn create-mindmap
-      ([] (create-node)))
+  ([] (create-node)))

 (s/fdef create-mindmap
         :args (s/cat)


Simplify the solution.

Simplify the solution.

--- src/codewar_kata/human_readable.clj
+++ src/codewar_kata/human_readable.clj
@@ -41,5 +41,4 @@
     ; Map the list above into a result string
     ; Filter out empty values
     ; Concat with commas and "and" if nessearry
-    (let [time-list (make-time-list secs)]
-      (->> time-list (map format-time-map) (filter not-empty) concat-result))))
+    (->> secs make-time-list (map format-time-map) (filter not-empty) concat-result)))


Fix scroll related bug on selrect.

Fix scroll related bug on selrect.

--- frontend/uxbox/ui/workspace/base.cljs
+++ frontend/uxbox/ui/workspace/base.cljs
@@ -113,7 +113,7 @@
      :width (- current-x start-x)
      :height (- current-y start-y)}))

-(defonce $$selrect-subscription-0$$
+(defonce $$selrect-subscription$$
   (let [ss (as-> (rx/from-atom selrect-dragging?) $
              (rx/dedupe $)
              (rx/merge $ (rx/of false))
@@ -122,22 +122,24 @@
     (as-> ss $
       (rx/filter #(= (vec %) [false true]) $)
       (rx/with-latest-from vector mouse-s $)
-      (rx/on-value $ (fn [[_ pos]]
-                       (swap! selrect-pos assoc
-                              :start pos
-                              :current pos))))
+      (rx/on-value $ (fn [[_ [x y :as pos]]]
+                       (let [scroll (or @scroll-top 0)
+                             pos [x (+ y scroll)]]
+                         (swap! selrect-pos assoc
+                                :start pos
+                                :current pos)))))
     (as-> ss $
       (rx/filter #(= (vec %) [true false]) $)
       (rx/on-value $ (fn []
                        (let [selrect (selrect->rect @selrect-pos)]
                          (rs/emit! (dw/select-shapes selrect))
-                         (reset! selrect-pos nil)))))))
-
-(defonce $$selrect-subscription-1$$
-  (as-> mouse-s $
-    (rx/filter #(deref selrect-dragging?) $)
-    (rx/on-value $ (fn [pos]
-                     (swap! selrect-pos assoc :current pos)))))
+                         (reset! selrect-pos nil)))))
+    (as-> mouse-s $
+      (rx/filter #(deref selrect-dragging?) $)
+      (rx/on-value $ (fn [[x y :as pos]]
+                       (let [scroll (or @scroll-top 0)
+                             pos [x (+ y scroll)]]
+                         (swap! selrect-pos assoc :current pos)))))))

 ;; Materialized views


Renamed type context-editor to context-editor-widget, because the plugin itself is called context-editor (d'oh!).

--- src/conexp/gui/editors/contexts.clj
+++ src/conexp/gui/editors/contexts.clj
@@ -108,13 +108,13 @@
 ;;
 ;;

-(deftype context-editor [widget table toolbar e-ctx])
-(derive ::context-editor :conexp.gui.editors.util/widget)
+(deftype context-editor-widget [widget table toolbar e-ctx])
+(derive ::context-editor-widget :conexp.gui.editors.util/widget)

 (declare make-editable-context editable-context?)

-(defn-swing make-context-editor
+(defn-swing make-context-editor-widget
   "Creates a control for editing contexts.

   Parameters:
@@ -133,13 +133,13 @@
                        (get-ui-icon "OptionPane.informationIcon")
                        [set-handler (fn [] (paste-from-clipboard table))] ) ])
          e-ctx (make-editable-context)
-         widget (context-editor root table toolbar e-ctx) ]
+         widget (context-editor-widget root table toolbar e-ctx) ]
     (apply-exprs widget setup)
     (add e-ctx widget)
     widget))

-(defn-swing do-mk-context-editor
+(defn-swing do-mk-context-editor-widget
   "Creates a control for editing contexts.

   Parameters:
@@ -163,7 +163,7 @@
                        [set-handler (fn [] (paste-from-clipboard table))] ) ])

-         widget {:managed-by-conexp-gui-editors-util "context-editor"
+         widget {:managed-by-conexp-gui-editors-util "context-editor-widget"

          :widget root
          :table table
@@ -722,8 +722,8 @@
                                           (message-box (vec (first x)))))])
              left  workspace-tree

-             right (do-mk-context-editor)
-             right2 (do-mk-context-editor)
+             right (make-context-editor-widget)
+             right2 (make-context-editor-widget)
              right3 (make-table-control)
              rpane (make-split-pane :vert right right3
                      [set-divider-location 300])
@@ -731,15 +731,14 @@
              pane (make-split-pane :horiz left rpane
                     [set-divider-location 200])
              ]
-        (do
-          (add-tab-with-name-icon-tooltip frame (get-widget pane)
-            "Contexts" nil "View and edit contexts")
-          (dosync-wait
-            (ref-set context-workspace-tree workspace-tree)
-            (ref-set context-pane pane)
-            (ref-set +debug+ right3))
-          (+debug-hook+)
-          ))) ) )
+        (add-tab-with-name-icon-tooltip frame (get-widget pane)
+          "Contexts" nil "View and edit contexts")
+        (dosync-wait
+          (ref-set context-workspace-tree workspace-tree)
+          (ref-set context-pane pane)
+          (ref-set +debug+ right3))
+        (+debug-hook+)
+        ))) )

 (defn plug-unload-hook
   "Unloads the context-editor plugin.


use logging, let the reaper log something each minute

--- src/fscrawler_tika_convert/core.clj
+++ src/fscrawler_tika_convert/core.clj
@@ -49,20 +49,22 @@
     (catch Throwable err
       err)))

-
-(defn reap-futures
-  []
-  (try
-    (logging/info "reaping futures")
-    (doseq [[a-future val] @future-map]
-      (when (realized? a-future)
-        (if-let [error (deref-exception a-future)]
-          (do
-            (println "************* error in future" (str a-future) error val)
-            ((:cleanup-on-error val))))
-        (swap! future-map dissoc a-future)))
-    (catch Throwable err
-      (println "error" err))))
+(let [call-counter (atom 0)]
+  (defn reap-futures
+    []
+    (swap! call-counter inc)
+    (when (zero? (rem @call-counter 240))
+      (logging/info "reaping futures" @call-counter))
+    (try
+      (doseq [[a-future val] @future-map]
+        (when (realized? a-future)
+          (if-let [error (deref-exception a-future)]
+            (do
+              (logging/error "************* error in future" (str a-future) error val)
+              ((:cleanup-on-error val))))
+          (swap! future-map dissoc a-future)))
+      (catch Throwable err
+        (logging/error "error occured in reap-futures" err)))))

 (defn map-from-routing-key-string
@@ -118,31 +120,25 @@
         delivery-tag (:delivery-tag metadata)
         fp (string/join File/separator [directory relpath])
         nack-this-message #(lb/nack ch delivery-tag false false)
-        ;; converted (tika/parse fp)
         ]
         ;;
     (register-future
      (future
        (try
          (let [converted (convert fp)]
-           ;; (println "before ack" (Thread/currentThread) (:delivery-tag metadata))
-
            (lb/publish ch
                        exchange
                        (routing-key-string-with-command routing-key "import_file")
                        (json/write-str (assoc body "tika-content" converted)))
            (lb/ack ch delivery-tag))
          (catch Exception err
-           (println "got exception while handling" fp err)
+           (logging/info "got exception while handling" fp err)
            (trace/print-stack-trace err)
            (lb/nack ch delivery-tag false false))))
      {:cleanup-on-error nack-this-message
       :fp fp})
-    #_(println "scheduled" fp " ****" )))
-
-    ;; (println "dir" fp " ****" (:content-type converted))))
-
-;; (println "got message" metadata (String. payload "UTF-8")))
+    (logging/debug "scheduled" fp " ****" )))
+

 (defn initialize-rabbitmq-structures
   "initialize rabbitmq queue and exchange for handling 'command' on
@@ -189,13 +185,13 @@
   ;; (convert "/home/ralf/t/seven-languages-in-seven-weeks_p4_0.pdf")

-  (let [[options args banner]
-        (cli/cli args
-                 ["--ampqp-url" "amqp url to connect to"]
-                 ["--port" "Port to listen on" :default 5000]
-                 ["--root" "Root directory of web server" :default "public"])]
-    (println "port:" (:port options))
-    (println "root:" (:root options)))
+  ;; (let [[options args banner]
+  ;;       (cli/cli args
+  ;;                ["--ampqp-url" "amqp url to connect to"]
+  ;;                ["--port" "Port to listen on" :default 5000]
+  ;;                ["--root" "Root directory of web server" :default "public"])]
+  ;;   (println "port:" (:port options))
+  ;;   (println "root:" (:root options)))

   (periodically 250 reap-futures)

@@ -203,7 +199,7 @@
     (try
       (run-with-connection "fscrawler:test")
       (catch Exception err
-        (println "got exception" err)
+        (logging/error "got exception" err)
         (trace/print-stack-trace err)
         (Thread/sleep 5000)
-        (println "restarting connection to rabbitmq")))))
+        (logging/info "restarting connection to rabbitmq")))))


Adjust spacing for presentation.

Adjust spacing for presentation.

--- src/kolmogorov_music/kolmogorov.clj
+++ src/kolmogorov_music/kolmogorov.clj
@@ -16,9 +16,7 @@
 ;;; Air on a \G String ;;;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;

-(comment
-  (repeat 1000000000000 \G)
-  )
+(comment (repeat 1000000000000 \G))

 (defmacro description-length [expr]
   (-> expr print-str count))
@@ -26,13 +24,11 @@
 (fact "The description-length is how long the string representation of the expression is."
   (description-length (repeat 65 \G)) => 13)

-
 (defn result-length [result]
   (-> result print-str count))

 (fact "The result-length is how long the string representation of the evaluated result is."
   (result-length (repeat 65 \G)) => 131)
-

 (defmacro randomness [expr]
   `(/ (description-length ~expr) (result-length ~expr)))
@@ -46,6 +42,7 @@
 (fact "A value is random if its description isn't shorter than its result."
   (random? (repeat 65 \G)) => false
   (random? (->> 66 char (repeat 14) (take 3))) => true)
+

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -98,28 +95,21 @@
       expand
       (cons []))))

-(defn babel []
+(defn library-of-babel []
   (let [ascii (->> (range 32 127) (map char))]
     (->> ascii
        kleene*
        (map (partial apply str)))))

 (fact "We can construct all strings as a lazy sequence."
-  (->> (babel) (take 5)) => ["" " " "!" "\"" "#"]
-  (nth (babel) 364645) => "GEB")
-
-(defn dna []
-  (->> "GATC"
-       kleene*
-       (map (partial apply str))))
-
-(fact "We can construct all genes as a lazy sequence."
-  (->> (dna) (take 5)) => ["" "G" "A" "T" "C"]
-  (nth (dna) 7154) => "GATTACA")
+  (->> (library-of-babel) (take 5)) => ["" " " "!" "\"" "#"]
+  (nth (library-of-babel) 364645) => "GEB")

 (fact "Lexicons aren't very random."
-  (randomness (take 1000 (babel))) => #(< % 1/100)
-  (randomness (take 1000 (dna))) => #(< % 1/100))
+  (randomness (take 10000 (library-of-babel))) => #(< % 1/100))
+
+
+

 ;;;;;;;;;;;;;;;;;;;;;
@@ -135,7 +125,7 @@
   "Calculate the shortest string that is more complicated than the specified sym."
   [sym]
   `(let [source# (-> ~sym quote repl/source-fn)]
-     (->> (babel)
+     (->> (library-of-babel)
        (drop-while #(<= (complexity %) (result-length source#)))
        first)))

@@ -143,6 +133,11 @@
   "I heard you like complexity, so I put some enterprise in your enterprise."
   []
   (enterprise enterprise))
+
+
+
+
+

 ;;;;;;;;;;;;;;;;
@@ -167,6 +162,12 @@
   (->> (champernowne-word) (take 16)) => [0 1 2 3 4 5 6 7 8 9 1 0 1 1 1 2])

+
+
+
+
+
+
 ;;;;;;;;;;;;;;;;
 ;;; Anti EP ;;;;
 ;;;;;;;;;;;;;;;;
@@ -175,7 +176,6 @@
 ;;; Blurred Lines ;;;
 ;;;;;;;;;;;;;;;;;;;;;

-; Arrangement
 (defmethod live/play-note :default
   [{hertz :pitch seconds :duration}]
   (when hertz (instrument/overchauffeur (midi->hz hertz) seconds 0.02)))
@@ -192,13 +192,6 @@
 (def blurred-lines 12450012001200311273127612731276127312761273127612731276127312761245001200121245001200120031127312761273127612731276127312761273127612731276124500120012124500120012003112731276127312761273127612731276127312761273127612450012001212450012001200311273127612731276127312761273127612731276127312761245001200121240001200120031126812711268127112681271126812711268127112681271124000120012124000120012003112681271126812711268127112681271126812711268127112400012001212400012001200311268127112681271126812711268127112681271126812711240001200121252004100411264125012621249126112471245)

 (comment
-  (live/stop)
-  (fx-reverb)
-  (fx-distortion)
   (live/play (copyright-infringement-song blurred-lines))
-  (live/play (copyright-infringement-song))
-  )
+  (live/play (copyright-infringement-song)))

-;;;;;;;;;;;;;;;;;;;
-;;; In the Mood ;;;
-;;;;;;;;;;;;;;;;;;;


Remove comment code

Remove comment code

--- tutorial.moan/src/tutorial/moan/frontend/main.cljs
+++ tutorial.moan/src/tutorial/moan/frontend/main.cljs
@@ -195,7 +195,3 @@
            ::rerender
            (fn [_ _ old-state state]
              (mount state)))
-
-(comment
-  (html [:* [:h1 "Hi"]])
-  )


Add missing value and on-blur params to email field

--- src/braid/client/gateway/user_auth/views.cljs
+++ src/braid/client/gateway/user_auth/views.cljs
@@ -32,6 +32,9 @@
                   :autocapitalize false
                   :spellcheck false
                   :auto-focus true
+                  :value @value
+                  :on-blur (fn [_]
+                             (dispatch [:blur field-id]))
                   :on-change (fn [e]
                                (let [value (.. e -target -value)]
                                  (dispatch [:update-value field-id value])))


Added generator implementation.

Added generator implementation.

--- src/clj/mx/roads/forgotten/blog/generator.clj
+++ src/clj/mx/roads/forgotten/blog/generator.clj
@@ -1,6 +1,14 @@
 (ns mx.roads.forgotten.blog.generator
-  (:require [stasis.core :as stasis]))
+  (:require [mx.roads.forgotten.blog.config :as config]
+            [mx.roads.forgotten.blog.web :as web]
+            [stasis.core :as stasis]
+            [taoensso.timbre :as log]))

 (defn run
-  [args]
-  :todo)
+  [& args]
+  (let [out-dir (config/get-output-dir)]
+    (log/infof "Generating static content to %s ..." out-dir)
+    (stasis/export-pages
+      web/routes
+      out-dir)
+    (log/info "Static generation complete.")))


rename election-table to elections-list

rename election-table to elections-list

--- src/cljs/early_vote_site/elections/views.cljs
+++ src/cljs/early_vote_site/elections/views.cljs
@@ -84,7 +84,7 @@
                  :on-click #(re-frame/dispatch [:file/generate (:id election)])}
             "Generate Files"])]]])))

-(defn election-table []
+(defn elections-list []
   (let [election-list-items @(re-frame/subscribe [:elections/list])
         roles @(re-frame/subscribe [:roles])]
     [:table {:name "election-list"}
@@ -110,4 +110,4 @@
 (defn main-panel []
   [:div
    [breadcrumb]
-   [election-table]])
+   [elections-list]])


fix bad return value for bad .jar path

fix bad return value for bad .jar path

--- src/main/shadow/build/classpath.clj
+++ src/main/shadow/build/classpath.clj
@@ -539,7 +539,7 @@

     (catch ZipException e
       (log/debug-ex e ::bad-jar {:file file})
-      {})
+      [])

     (catch Exception e
       (throw (ex-info (str "failed to generate jar manifest for file: " file) {:file file} e)))


Consume both the storage and search protocols in carbon

--- src/org/spootnik/cyanite/carbon.clj
+++ src/org/spootnik/cyanite/carbon.clj
@@ -3,6 +3,7 @@
   (:require [aleph.tcp                  :as tcp]
             [clojure.string             :as s]
             [org.spootnik.cyanite.store :as store]
+            [org.spootnik.cyanite.path  :as path]
             [clojure.tools.logging      :refer [info debug]]
             [gloss.core                 :refer [string]]
             [lamina.core                :refer [receive-all map* siphon]]))
@@ -10,9 +11,11 @@
 (defn formatter
   "Split each line on whitespace, discard nan metric lines
    and format correct lines for each resolution"
-  [rollups input]
+  [index rollups input]
   (let [[path metric time] (s/split (.trim input) #" ")]
     (when (not= metric "nan")
+      ;; hardcode empty tenant for now
+      (path/register index "" path)
       (for [{:keys [rollup period rollup-to]} rollups]
         {:path   path
          :rollup rollup
@@ -23,15 +26,15 @@

 (defn handler
   "Send each metric over to the cassandra store"
-  [rollups store]
+  [index rollups insertch]
   (fn [ch info]
-    (siphon (map* (partial formatter rollups) ch)
-            (store/channel-for store))))
+    (siphon (map* (partial index formatter rollups) ch) insertch)))

 (defn start
   "Start a tcp carbon listener"
-  [{:keys [store carbon]}]
-  (let [handler (handler (:rollups carbon) store)]
+  [{:keys [store carbon index]}]
+  (let [insertch (store/channel-for store)
+        handler  (handler index (:rollups carbon) insertch)]
     (info "starting carbon handler")
     (tcp/start-tcp-server
      handler


load more ui fix

load more ui fix

Signed-off-by: Andrey Shovkoplyas <b713972e59b8e606e23253c4a13e948139fea4d1@gmail.com>

--- src/status_im/ui/screens/wallet/transactions/views.cljs
+++ src/status_im/ui/screens/wallet/transactions/views.cljs
@@ -7,9 +7,10 @@
             [status-im.ui.components.icons.vector-icons :as vector-icons]
             [status-im.ui.components.styles :as components.styles]
             [status-im.ui.components.toolbar.actions :as actions]
-            [status-im.ui.components.toolbar.view :as toolbar]
+            [status-im.ui.components.toolbar.view :as toolbar-old]
             [status-im.ui.screens.wallet.transactions.styles :as styles]
-            [status-im.ui.components.topbar :as topbar])
+            [status-im.ui.components.topbar :as topbar]
+            [status-im.ui.components.toolbar :as toolbar])
   (:require-macros [status-im.utils.views :refer [defview letsubs]]))

 (defn- transaction-icon
@@ -124,19 +125,12 @@
                    :margin-vertical 8}}
           [react/activity-indicator {:size :large
                                      :animating true}]]
-         [react/view
-          {:style {:flex               1
-                   :padding-horizontal 14
-                   :height             52
-                   :align-items        :center
-                   :justify-content    :center
-                   :background-color   colors/blue-light}}
-          [react/text
-           {:style {:color colors/blue}
-            :on-press (when-not fetching-more-history?
-                        #(re-frame/dispatch
-                          [:transactions/fetch-more address]))}
-           (i18n/label :t/transactions-load-more)]]))]))
+         [toolbar/toolbar
+          {:center {:label    (i18n/label :t/transactions-load-more)
+                    :type     :secondary
+                    :on-press (when-not fetching-more-history?
+                                #(re-frame/dispatch
+                                  [:transactions/fetch-more address]))}}]))]))

 (defn- render-item-filter [{:keys [id label checked? on-touch]}]
   [react/view {:accessibility-label :filter-item}
@@ -256,10 +250,10 @@
             [:wallet.transactions.details/screen hash address]]
     [react/view {:style components.styles/flex}
      ;;TODO options should be replaced by bottom sheet ,and topbar should be used here
-     [toolbar/toolbar {}
-      toolbar/default-nav-back
-      [toolbar/content-title (i18n/label :t/transaction-details)]
-      (when transaction [toolbar/actions (details-action hash url)])]
+     [toolbar-old/toolbar {}
+      toolbar-old/default-nav-back
+      [toolbar-old/content-title (i18n/label :t/transaction-details)]
+      (when transaction [toolbar-old/actions (details-action hash url)])]
      [react/scroll-view {:style components.styles/main-container}
       [details-header date type amount-text currency-text]
       [details-confirmations confirmations confirmations-progress (= :failed type)]


add titles for dynamic pages, finally have (html)

--- pedestal-app/app/src/semtag_web/rendering.cljs
+++ pedestal-app/app/src/semtag_web/rendering.cljs
@@ -33,6 +33,16 @@
   (dom/prepend! (dom/by-id "content")
                 (p/alert msg (str "alert-" (name alert-type)))))

+(defn- html
+  "Like str but for concating strings and dom nodes"
+  [& args]
+  (apply str (map #(if (string? %) % (.-outerHTML %)) args)))
+
+(defn path->params
+  "Assumes 2nd to last element in path is a dynamic screen e.g. :thing-id_ID"
+  [path]
+  (->> (nth path (- (count path) 2)) (get @route/dynamic-screens)))
+
 ;; Rendering fns e.g. (fn [_ _ _])
 ;;
 (defn clear-id [id]
@@ -146,63 +156,64 @@
 (defn render-types-results [_ [_ _ _ new-value] input-queue]
   (dom/set-html!
    (dom/by-id "content")
-   (str "
Type Statistics
"
-        "
Lists all thing types with statistics for each type
"
-        (.-outerHTML (p/generate-table "type_stats_table" (:results new-value)
-                                       :caption (format "%s things, %s tags"
-                                                        (get-in new-value [:counts :thing])
-                                                        (get-in new-value [:counts :tags]))
-                                       :row-partial p/type-stats-row
-                                       :fields [:name :count :name-percent :url-percent]))))
+   (html "
Type Statistics
"
+         "
Lists all thing types with statistics for each type
"
+         (p/generate-table "type_stats_table" (:results new-value)
+                           :caption (format "%s things, %s tags"
+                                            (get-in new-value [:counts :thing])
+                                            (get-in new-value [:counts :tags]))
+                           :row-partial p/type-stats-row
+                           :fields [:name :count :name-percent :url-percent])))

   (enable-clickable-links-on "#type_stats_table" input-queue))

 (defn render-tag-stats-results [_ [_ _ _ new-value] input-queue]
   (dom/set-html!
    (dom/by-id "content")
-   (str "
Tag Statistics
"
-        "
Lists all tags with statistics for each tag
"
-        (.-outerHTML (p/generate-table "tag_stats_table" new-value
-                                       :row-partial p/tag-stats-row
-                                       :caption (str "Total: " (count new-value))
-                                       :fields [:tag :count :desc]))))
+   (html "
Tag Statistics
"
+         "
Lists all tags with statistics for each tag
"
+         (p/generate-table "tag_stats_table" new-value
+                           :row-partial p/tag-stats-row
+                           :caption (str "Total: " (count new-value))
+                           :fields [:tag :count :desc])))

   (enable-clickable-links-on "#tag_stats_table" input-queue))

 (defn render-all-results [_ [_ _ _ new-value] input-queue]
   (dom/set-html!
-    (dom/by-id "content")
-    (str "
Latest Things
"
-         (.-outerHTML (p/generate-table "all_table" new-value
-                                    :row-partial p/all-row
-                                    :caption (str "Total: " (count new-value))
-                                    :fields [:type :name :url :tags :created-at]))))
+   (dom/by-id "content")
+   (html "
Latest Things
"
+         (p/generate-table "all_table" new-value
+                           :row-partial p/all-row
+                           :caption (str "Total: " (count new-value))
+                           :fields [:type :name :url :tags :created-at])))
   (enable-clickable-links-on "#all_table td:not([data-field=url])" input-queue))

 (defn render-thing-results [_ [_ path _ new-value] input-queue]
-  (let [screen (nth path (- (count path) 2))
-        thing-id (->> screen (get @route/dynamic-screens) :id)]
+  (let [thing-id (-> path path->params :id)]
     (dom/set-html!
       (dom/by-id "content")
-      (p/generate-table "thing_show_table"
-                        (conj new-value {:attribute :actions :id (:id (first new-value))})
-                        :caption (if (re-find #"\d+$" thing-id) "" (p/link-tagged thing-id))
-                        :row-partial p/thing-row
-                        :fields [:attribute :value])))
+      (html "
" thing-id "
"
+            (p/generate-table "thing_show_table"
+                         (conj new-value {:attribute :actions :id (:id (first new-value))})
+                         :caption (if (re-find #"\d+$" thing-id) "" (p/link-tagged thing-id))
+                         :row-partial p/thing-row
+                         :fields [:attribute :value]))))
   (enable-clickable-links-on "#thing_show_table td:not([data-field=url])" input-queue)
   (enable-clickable-links-on "#thing_show_table caption" input-queue))

-(defn render-type-results [_ [_ _ _ new-value] input-queue]
-  (let [{:keys [things tags]} new-value]
+(defn render-type-results [_ [_ path _ new-value] input-queue]
+  (let [{:keys [things tags]} new-value
+        type (-> path path->params :name)]
     (dom/set-html!
-      (dom/by-id "content")
-      (p/generate-table "type_show_table" things
-                        :row-partial p/type-row
-                        :caption (str "Total: " (count things))
-                        :fields [:name :url :desc :tags :created-at]))
-    (dom/insert-before! (dom/by-id "type_show_table")
-                        (p/table-stats (frequency-stat "Tag Type Counts" (map first tags))
-                                       (frequency-stat "Tag Counts" (flatten (map :tags things))))))
+     (dom/by-id "content")
+     (html "
Type " type "
"
+           (p/table-stats (frequency-stat "Tag Type Counts" (map first tags))
+                          (frequency-stat "Tag Counts" (flatten (map :tags things))))
+           (p/generate-table "type_show_table" things
+                             :row-partial p/type-row
+                             :caption (str "Total: " (count things))
+                             :fields [:name :url :desc :tags :created-at]))))
   (enable-clickable-links-on "#type_show_table td:not([data-field=url])" input-queue))

 (defn render-alert-error [_ [_ _ _ msg] _]


destructuring

destructuring

--- clojure/src/dnd/character.cljs
+++ clojure/src/dnd/character.cljs
@@ -3,28 +3,25 @@
 (defonce character {:char "@"
                     :x 3
                     :y 2
-                    :inventory [] })
+                    :inventory []})

 (defn is-character [inhabitant] (= "@" (:char inhabitant)))

 (defn move-character! [level character dx dy]
   (let [{ox :x oy :y} @character
-        old-block (get-in @level [ox oy])
-        old-inhabitants (:inhabitants old-block)
+        {old-inhabitants :inhabitants} (get-in @level [ox oy])
         remove-character #(assoc % :inhabitants (remove is-character old-inhabitants))
         level-without-character (swap! level update-in [ox oy] remove-character)
         target-block (get-in level-without-character [dx dy])
         target-inhabitants (:inhabitants target-block)
         updated-character (swap! character assoc :x dx :y dy)
         update-habs #(assoc % :inhabitants (conj target-inhabitants updated-character))
-        updated-level (swap! level update-in [dx dy] update-habs)
-        ]
+        updated-level (swap! level update-in [dx dy] update-habs)]
     [level character]))

 (defn get-item! [level character]
   (let [{:keys [x y]} @character
-        block (get-in @level [x y])
-        old-inhabitants (:inhabitants block)
+        {old-inhabitants :inhabitants} (get-in @level [x y])
         gotten-inhabitant (first (remove is-character old-inhabitants))

         inventory (:inventory @character)


CMR-7792: Race condition fix (#1358)

CMR-7792: Race condition fix (#1358)

--- system-int-test/test/cmr/system_int_test/ingest/granule_bulk_update/granule_bulk_update_test.clj
+++ system-int-test/test/cmr/system_int_test/ingest/granule_bulk_update/granule_bulk_update_test.clj
@@ -1676,8 +1676,8 @@
                            :updates ["granule_with_duplicate_opendap_types"]}
               {:keys [status task-id errors] :as response} (ingest/bulk-update-granules "PROV1" bulk-update bulk-update-options)]

-          (ingest/update-granule-bulk-update-task-statuses)
-          (index/wait-until-indexed)
+          (index/wait-until-indexed)
+          (ingest/update-granule-bulk-update-task-statuses)

           (is (= 200 status))
           (is (some? task-id))


site: fix dev page in advanced mode

site: fix dev page in advanced mode

--- site/src/parinfer_site/core.cljs
+++ site/src/parinfer_site/core.cljs
@@ -312,8 +312,8 @@

 (defn init! []
   (cond
-    js/window.parinfer_devpage (render-dev!)
-    js/window.parinfer_debug_state (render-debug-state!)
+    (aget js/window "parinfer_devpage") (render-dev!)
+    (aget js/window "parinfer_debug_state") (render-debug-state!)
     :else (render-index!)))

 (init!)


Fix updating aliases; fix devth/yetibot#399

--- src/yetibot/core/commands/alias.clj
+++ src/yetibot/core/commands/alias.clj
@@ -53,8 +53,8 @@
 (defn add-alias [{:keys [cmd-name cmd userid] :as alias-info}]
   (let [new-alias-map {:userid userid :cmd-name cmd-name :cmd cmd}]
     (info "adding alias with" new-alias-map)
-    (if (existing-alias cmd-name)
-      (model/update (:id existing-alias) new-alias-map)
+    (if-let [existing (existing-alias cmd-name)]
+      (model/update (:id existing) new-alias-map)
       (model/create new-alias-map)))
   alias-info)


core: replace

core: replace

--- core/data/core.clj
+++ core/data/core.clj
@@ -2666,6 +2666,20 @@
                  xs seen)))]
     (step coll #{})))

+(defn replace
+  "Given a map of replacement pairs and a vector/collection, returns a
+  vector/seq with any elements = a key in smap replaced with the
+  corresponding val in smap."
+  {:added "1.0"}
+  [smap coll]
+  (if (vector? coll)
+    (reduce1 (fn [v i]
+               (if-let [e (find smap (nth v i))]
+                 (assoc v i (val e))
+                 v))
+             coll (range (count coll)))
+    (map #(if-let [e (find smap %)] (val e) %) coll)))
+
 (defn empty?
   "Returns true if coll has no items - same as (not (seq coll)).
   Please use the idiom (seq x) rather than (not (empty? x))"


core: rand-int

core: rand-int

--- core/data/core.clj
+++ core/data/core.clj
@@ -2572,6 +2572,11 @@
   ([] (rand*))
   ([n] (* n (rand))))

+(defn rand-int
+  "Returns a random integer between 0 (inclusive) and n (exclusive)."
+  {:added "1.0"}
+  [n] (int (rand n)))
+
 (defmacro defn-
   "same as defn, yielding non-public def"
   {:added "1.0"}


CMR-7496: Removed the temporary /wait endpoint (#1327)

Co-authored-by: siwei xu <6532de1a8b5e90ff3cadd14b3ab551515d3f3d37@raytheon.com>

--- indexer-app/src/cmr/indexer/api/routes.clj
+++ indexer-app/src/cmr/indexer/api/routes.clj
@@ -96,12 +96,6 @@
        ;; for NGAP deployment health check
       (GET "/" {} {:status 200})

-      ;; TEMPORARY CODE - Remove this after EI-3988 is fixed.
-      (POST "/wait/:n" [n]
-        (info "Waiting" n "seconds to respond")
-        (Thread/sleep (* (Long. n) 1000))
-        {:status 200})
-
       ;; Index a concept
       (POST "/" {body :body context :request-context params :params headers :headers}
         (let [{:keys [concept-id revision-id]} (walk/keywordize-keys body)


Adding a test to Levenshtein distance

Adding a test to Levenshtein distance

--- test/clj_fuzzy/levenshtein_test.clj
+++ test/clj_fuzzy/levenshtein_test.clj
@@ -14,4 +14,5 @@
   (is (= 2 (distance "book" "back")))
   (is (= 1 (distance "hello" "helo")))
   (is (= 8 (distance "good sir" "baal")))
-  (is (= 5 (distance "say" "shiver"))))
+  (is (= 5 (distance "say" "shiver")))
+  (is (= 13 (distance "feature" "get-project-features"))))


updated forma.trends.analysis-test

updated forma.trends.analysis-test

--- test/forma/trends/analysis_test.clj
+++ test/forma/trends/analysis_test.clj
@@ -5,42 +5,42 @@
   (:require [incanter.core :as i]))

 (facts
- "test that `long-stats` yields the trend coefficient and t-test
-statistic on `ndvi`"
+ "Test that `long-stats` yields the trend coefficient and t-test
+ statistic on `ndvi`"
+
+ ;; Long-term statistics on NDVI alone
  (let [[coeff t-test] (long-stats ndvi)]
    coeff  => (roughly -1.14300)
-   t-test => (roughly -0.91826)))
+   t-test => (roughly -0.91826))

-(fact
- "first-order-conditions has been checked"
- (last (map last (first-order-conditions (i/matrix ndvi))))
- => (roughly 89557.2243))
+ ;; Long-term statistics on NDVI, with rain as a cofactor.  Note that
+ ;; the trends change slightly.
+ (let [[coeff t-test] (long-stats ndvi rain)]
+   coeff  => (roughly -1.23824)
+   t-test => (roughly -0.99763)))
+
+(fact "Test first-order conditions."
+  (ffirst
+   (first-order-conditions (i/matrix ndvi))) => (roughly -1094.50817))

 (defn- shift-down-end
   "Returns a transformed collection, where the last half is shifted
-  down by some factor; used to test that the hansen-stat identifies
+  down by 50%; used to test that the hansen-stat identifies
   down-shifts in a time-series (see next test)."
   [coll]
   (let [half-count (Math/floor (/ (count ndvi) 2))
-        first-half (take half-count ndvi)
         second-half (drop half-count ndvi)]
-    (concat first-half
+    (concat (take half-count ndvi)
             (map #(- % (/ % 2)) second-half))))

-(fact
- "test that the Hansen test statistic is relatively high for a time
+(fact "Test that the Hansen test statistic is relatively high for a time
  series with a constructed, short-term break"
- (- (hansen-stat (i/matrix (shift-down-end ndvi)))
-    (hansen-stat (i/matrix ndvi))) => pos?)
+  (- (hansen-stat (i/matrix (shift-down-end ndvi)))
+     (hansen-stat (i/matrix ndvi))) => pos?)

 (facts
-  "test the value of the hansen stat, based off standard NDVI test
-series; test also that the hansen-stat will return nil for time-series
-that yield a singular first-order-condition matrix."
+  "Test the value of the hansen stat, based off standard NDVI test
+  series; test also that the hansen-stat will return nil for
+  time-series that yield a singular first-order-condition matrix."
   (hansen-stat (i/matrix ndvi)) => (roughly 0.911317)
   (hansen-stat (repeat 100 0))  => nil)
-
-(def ts-tap
-  "sample tap that mimics 2 identical pixels (each with the same time
-series)"
-  (vec (repeat 2 {:start 0 :end 271 :ndvi ndvi :reli reli :rain rain})))


fix movement system test

fix movement system test

--- test/voke/system/movement_test.cljs
+++ test/voke/system/movement_test.cljs
@@ -48,8 +48,11 @@
         (is (= (count @attempt-to-move-args) 1))

         (let [[_ new-center new-velocity _] (first @attempt-to-move-args)]
-          (is (= new-center {:x 11 :y 10}))
-          (is (= new-velocity {:x (/ 1 (Math/sqrt 2))
-                               :y (/ 1 (Math/sqrt 2))})))))))
-
-; TODO test that total velocity is capped, not just velocity on each axis
+          (is (= (.toFixed 4 (new-center :x))
+                 (.toFixed 4 (+ 10 (/ 1 (Math/sqrt 2))))))
+          (is (= (.toFixed 4 (new-center :y))
+                 (.toFixed 4 (+ 10 (/ 1 (Math/sqrt 2))))))
+          (is (= (.toFixed 4 (new-velocity :x))
+                 (.toFixed 4 (/ 1 (Math/sqrt 2)))))
+          (is (= (.toFixed 4 (new-velocity :y))
+                 (.toFixed 4 (/ 1 (Math/sqrt 2))))))))))


minor

minor


Add more robust check for Jetty thread test

--- ring-jetty-adapter/test/ring/adapter/test/jetty.clj
+++ ring-jetty-adapter/test/ring/adapter/test/jetty.clj
@@ -150,5 +150,8 @@
     (with-server hello-world {:port 4347}
       (let [thread-count (count (all-threads))]
         (is (thrown? Exception (run-jetty hello-world {:port 4347})))
-        (Thread/sleep 100)
+        (loop [i 0]
+          (when (and (< i 100) (not= thread-count (count (all-threads))))
+            (Thread/sleep 100)
+            (recur (inc i))))
         (is (= thread-count (count (all-threads))))))))


Remove unused lein plugins

Remove unused lein plugins

--- lein/.lein/profiles.clj
+++ lein/.lein/profiles.clj
@@ -1,4 +1,3 @@
-{:user {:plugins [[nightlight/lein-nightlight "1.6.3"]
-                  [lein-auto "0.1.3"]
+{:user {:plugins [[lein-auto "0.1.3"]
                   [lein-ancient "0.6.10"]
                   [lein-kibit "0.1.3"]]}}


cleanup; Added element_visuals

cleanup; Added element_visuals

--- src/visuals/untangled/ui/element_visuals.cljs
+++ src/visuals/untangled/ui/element_visuals.cljs
@@ -250,7 +250,9 @@
 (defcard radio-visual-regressions
   (dom/div nil
     (e/ui-radio {:id "radio-1"})
-    (e/ui-radio {:id "radio-2" :disabled true})))
+    (e/ui-radio {:id "radio-1" :checked true})
+    (e/ui-radio {:id "radio-2" :disabled true})
+    (e/ui-radio {:id "radio-2" :disabled true :checked true})))

 ;; TODO Need
 ;; -------------


Improve error message for non-completeable testing spouts

--- storm-core/src/clj/backtype/storm/testing.clj
+++ storm-core/src/clj/backtype/storm/testing.clj
@@ -475,7 +475,7 @@
         (.set_spout_object spout-spec (serialize-component-object spout))))
     (doseq [spout (spout-objects spouts)]
       (when-not (extends? CompletableSpout (.getClass spout))
-        (throw (RuntimeException. "Cannot complete topology unless every spout is a CompletableSpout (or mocked to be)"))))
+        (throw (RuntimeException. (str "Cannot complete topology unless every spout is a CompletableSpout (or mocked to be); failed by " spout)))))

     (doseq [spout (spout-objects spouts)]
       (startup spout))


Исправления пагинатора

Исправления пагинатора

--- radiolamp-6P3S/src/r6p3s/cpt/paginator.cljs
+++ radiolamp-6P3S/src/r6p3s/cpt/paginator.cljs
@@ -59,7 +59,8 @@
                   " страница "
                   (dom/b nil page)
                   (when (and count-all page-size) " из ")
-                  (when (and count-all page-size) (dom/b nil (inc (quot count-all page-size))))
+                  (when (and count-all page-size) (dom/b nil (+ (quot count-all page-size)
+                                                                (if (< 0 (rem count-all page-size)) 1 0))))

                   (when count-all (dom/br nil))
                   (when count-all "всего записей ")


Improve debug utils as per @michaelklishin ocmment

--- src/clojure/clojurewerkz/cassaforte/debug_utils.clj
+++ src/clojure/clojurewerkz/cassaforte/debug_utils.clj
@@ -14,5 +14,5 @@
   `(try
      (do ~@forms)
      (catch com.datastax.driver.core.exceptions.DriverException ire#
-       (println (print-stack-trace ire# 5))
-       (println "Error came from server:" (.getMessage ire#)))))
+       (println (.getMessage ire#))
+       (print-cause-trace ire#))))


Add :java-only to Java game template

Add :java-only to Java game template

--- src/clojure/leiningen/new/game_java/ios-project.clj
+++ src/clojure/leiningen/new/game_java/ios-project.clj
@@ -6,6 +6,7 @@
                   "https://oss.sonatype.org/content/repositories/snapshots/"]]
   :java-source-paths ["src" "../desktop/src-common"]
   :javac-options ["-target" "1.7" "-source" "1.7" "-Xlint:-options"]
+  :java-only true
   :ios {:robovm-opts ["-libs" "libs/libObjectAL.a:libs/libgdx.a"
                       "-frameworks" "UIKit:OpenGLES:QuartzCore:CoreGraphics:OpenAL:AudioToolbox:AVFoundation"
                       "-resources" "../desktop/resources/**"]}


CMR-4370 - Changed variable association permission to provider-object.

--- search-app/src/cmr/search/api/variables.clj
+++ search-app/src/cmr/search/api/variables.clj
@@ -4,6 +4,7 @@
    [cheshire.core :as json]
    [cmr.acl.core :as acl]
    [cmr.common-app.api.enabled :as common-enabled]
+   [cmr.common.concepts :as concepts]
    [cmr.common.log :refer (debug info warn error)]
    [cmr.common.mime-types :as mt]
    [cmr.common.services.errors :as errors]
@@ -13,7 +14,7 @@
    [compojure.route :as route]))

 (defn- validate-variable-content-type
-  "Validates that content type sent with a variable is JSON"
+  "Validates that content type sent with a variable is JSON."
   [headers]
   (mt/extract-header-mime-type #{mt/json} headers "content-type" true))

@@ -27,18 +28,16 @@
     :headers {"Content-Type" mt/json}}))

 (defn- verify-variable-association-permission
-  "Verifies the current user has been granted permission to make variable associations"
-  [context permission-type]
-  (when-not (seq (acl/get-permitting-acls
-                  context :system-object "INGEST_MANAGEMENT_ACL" permission-type))
-    (errors/throw-service-error
-      :unauthorized
-      (format "You do not have permission to %s a variable." (name permission-type)))))
+  "Verifies the current user has been granted permission to make variable associations."
+  [context concept-id permission-type]
+  (let [provider-id (concepts/concept-id->provider-id concept-id)]
+    (acl/verify-ingest-management-permission
+     context :update :provider-object provider-id)))

 (defn associate-variable-to-collections
   "Associate the variable to a list of collections."
   [context headers body variable-concept-id]
-  (verify-variable-association-permission context :update)
+  (verify-variable-association-permission context variable-concept-id :update)
   (common-enabled/validate-write-enabled context "search")
   (validate-variable-content-type headers)
   (info (format "Associate variable [%s] on collections: %s by client: %s."
@@ -49,7 +48,7 @@
 (defn dissociate-variable-to-collections
   "Dissociate the variable to a list of collections."
   [context headers body variable-concept-id]
-  (verify-variable-association-permission context :update)
+  (verify-variable-association-permission context variable-concept-id :update)
   (common-enabled/validate-write-enabled context "search")
   (validate-variable-content-type headers)
   (info (format "Dissociating variable [%s] from collections: %s by client: %s."


Whitespace fixes courtesy of emacs

Whitespace fixes courtesy of emacs

--- modules/xml/src/main/clojure/clojure/data/xml.clj
+++ modules/xml/src/main/clojure/clojure/data/xml.clj
@@ -37,11 +37,11 @@
   "Takes a seq of events that logically represents
   a tree by each event being one of: enter-sub-tree event,
   exit-sub-tree event, or node event.
-
+
   Returns a lazy sequence whose first element is a sequence of
   sub-trees and whose remaining elements are events that are not
   siblings or descendants of the initial event.
-
+
   The given exit? function must return true for any exit-sub-tree
   event.  parent must be a function of two arguments: the first is an
   event, the second a sequence of nodes or subtrees that are children
@@ -51,7 +51,7 @@
   way the children passed as the second arg.  The node function is
   called with a single event arg on every event that is neither parent
   nor exit, and its return value will become a node of the output tree.
-
+
   (seq-tree #(when (= %1 :<) (vector %2)) #{:>} str
             [1 2 :< 3 :< 4 :> :> 5 :> 6])
   ;=> ((\"1\" \"2\" [(\"3\" [(\"4\")])] \"5\") 6)"
@@ -282,7 +282,7 @@
       (doseq [c (:content e)]
         (emit-element c ch))
       (.endElement ch (or nspace "") qname qname))))
-
+
 (defn emit
   "Prints the given Element tree as XML text to *out*. See element-tree.
   Options:
@@ -300,14 +300,14 @@
                           (str (:indent opts))))

     (when (contains? opts :xml-declaration)
-      (.setOutputProperty trans "omit-xml-declaration"
+      (.setOutputProperty trans "omit-xml-declaration"
                           (if (:xml-declaration opts) "no" "yes")))

     (when (:encoding opts)
       (.setOutputProperty trans "encoding" (:encoding opts)))

     (when (instance? java.io.OutputStreamWriter *out*)
-      (let [decl-enc (.getOutputProperty trans "encoding")
+      (let [decl-enc (.getOutputProperty trans "encoding")
             stream-enc (.getEncoding *out*)]
       (if (not= (Charset/forName decl-enc) (Charset/forName stream-enc))
         (throw (Exception. (str "Output encoding of stream (" stream-enc


Update ns_to_markdown.clj

Update ns_to_markdown.clj

--- docs/src/ns_to_markdown.clj
+++ docs/src/ns_to_markdown.clj
@@ -1,19 +1,27 @@
 (ns ns-to-markdown
-  "This script is used to generate the API documentation for the namespace `re-frame.core`. It reads the
-   source code in that namespace, extracts the docstrings (markdown) and produces a markdown-formatted
-   file suitable for providing to `mkdocs` which builds the re-frame website.
-
-   It is used within the GitHub Actions docs workflow at:
-   https://github.com/day8/re-frame/blob/78ca09785e2adf9eea11f1e4bff2477d193f4b46/.github/workflows/docs-workflow.yml#L15
-
-   The page it outputs can be seen here: http://day8.github.io/re-frame/api-re-frame.core/
+  "A script that reads a single ClojureScript namespace, like `re-frame.core`,
+   and outputs a single page of markdown-based API documentation.

    Usage: clojure -m ns-to-markdown ../src/re_frame/core.cljc > api-re-frame.core.md
-
-   Run as a script with the Clojure CLI. Expects the first arg to be a path to a ClojureScript
-   namespace. Reads the single namespace found in that file using the ClojureScript analyzer,
-   extracting public var metadata such as function names, arglists and docstrings. Subsequently
-   writes it out as markdown to stdout suitable for piping to a markdown file."
+
+   Notes:
+     - run as a script using the Clojure CLI
+     - the first argument is a path to a file containing a ClojureScript namespace.
+     - it reads the namespace within the file using the ClojureScript analyzer,
+       extracting public var metadata such as function names, arglists and docstrings.
+     - it writes a single markdown-based API doc to stdout
+     - you can see the page it outputs here: http://day8.github.io/re-frame/api-re-frame.core/
+
+   Workflow:
+     - the output is designed to be incorporated into a Static Site generator, like `mkdocs`.
+     - For re-frame, we use it as a step within the GitHub Actions workflow which builds docs. See:
+       https://github.com/day8/re-frame/blob/78ca09785e2adf9eea11f1e4bff2477d193f4b46/.github/workflows/docs-workflow.yml#L15
+
+   About The Namespace:
+     - example: https://github.com/day8/re-frame/blob/master/src/re_frame/core.cljc
+     - the docs strings are expected to be markdown-compatible.
+     - notice the subtle `metadata-ish` `{:api-docs/heading "Subscriptions"}` to group vars under headings.
+   "
   (:require
     [clojure.java.io :as io]
     [cljs.analyzer]


CMR-1872: Added additional test

CMR-1872: Added additional test

--- search-app/test/cmr/search/test/api/routes.clj
+++ search-app/test/cmr/search/test/api/routes.clj
@@ -52,7 +52,8 @@
          (= concept-id (r/path-w-extension->concept-id path-w-extension))

          "C1-PROV1" "C1-PROV1"
-         "C1-PROV1.xml" "C1-PROV1")
+         "C1-PROV1.xml" "C1-PROV1"
+         "C1-PROV1/3.echo10" "C1-PROV1")

   (testing "revision-id"
     (are [path-w-extension revision-id]


use routing-id capability for hello/hello-ok.

--- main/clojure/src/org/zproto/server.clj
+++ main/clojure/src/org/zproto/server.clj
@@ -15,7 +15,9 @@
   ;;
   ;; Fill in the blanks
   ;;
-  (println more))
+  (println more)
+  "dummy-id")
+
 (defn get-all-tags
   [& more]
   ;;
@@ -31,7 +33,7 @@

 (defprotocol HydraServer
-  (hello    [this])
+  (hello    [this routing-id])
   (get-tags [this])
   (get-tag  [this tag])
   (get-post [this post-id])
@@ -60,13 +62,10 @@

 (defrecord Server [socket state]
   HydraServer
-  (hello [this]
+  (hello [this routing-id]
     ;; (next-state state :start :connected)
-    (let [response (HydraMsg. HydraMsg/HELLO_OK)]
-      (get-latest-post response)
-      (.send response socket)
-      (.destroy response)
-      ))
+    (let [post-id (get-latest-post)]
+      (msg/hello-ok socket routing-id post-id)))

   (get-tags [this]
     (ensure-state state :connected)
@@ -94,10 +93,11 @@

 (defn match-msg
   [server ^HydraMsg msg]
-  (let [id (.id msg)]
+  (let [id (.id msg)
+        routing-id (.routingId msg)]
     (println (= id HydraMsg/HELLO))
     (cond
-     (= id HydraMsg/HELLO)    (hello    server)
+     (= id HydraMsg/HELLO)    (hello    server routing-id)
      (= id HydraMsg/GET_TAGS) (get-tags server)
      (= id HydraMsg/GET_TAG)  (get-tag  server (.tag msg))


fixup! Code tweaks in response to feedback

--- src-cljs/frontend/analytics.cljs
+++ src-cljs/frontend/analytics.cljs
@@ -19,7 +19,7 @@
   properties overriding parents'."
   [component evt]
   (if-not component
-    event
+    evt
     (recur (om-next/parent component)
            (update evt :properties #(merge (properties component) %)))))


Fix bug where first job duration is wrong

Now that run start time does not need to be computed from the first
job's build, remove the logic for doing so from the UI.

--- src-cljs/frontend/components/pages/run.cljs
+++ src-cljs/frontend/components/pages/run.cljs
@@ -120,13 +120,7 @@
      `{(:run-for-row {:< :routed-entity/run})
        ~(om-next/get-query run-row/RunRow)}
      `{(:run-for-jobs {:< :routed-entity/run})
-       [{(:jobs-for-jobs {:< :run/jobs}) ~(om-next/get-query Job)}
-        ;; NB: We need the :component metadata and :job/id here to make sure the
-        ;; merger constructs the ident successfully to merge properly. This
-        ;; reflects a shortcoming in Bodhi.
-        {(:jobs-for-first {:< :run/jobs}) ^{:component ~Job} [:job/id
-                                                              :job/build
-                                                              :job/name]}]}
+       [{:run/jobs ~(om-next/get-query Job)}]}
      {:routed-entity/job [:job/name
                           {:job/build [:build/vcs-type
                                        :build/org
@@ -172,18 +166,10 @@
           :main-content
           (element :main-content
             (let [run (:run-for-row (om-next/props this))
-                  selected-job (or (not-empty
-                                    (:routed-entity/job (om-next/props this)))
-                                   (-> (om-next/props this)
-                                       :run-for-jobs
-                                       :jobs-for-first
-                                       first))
-                  selected-job-build (get-in (om-next/props this)
-                                             (into [:legacy/state]
-                                                   state/build-path))
-                  jobs (cond-> (-> (om-next/props this) :run-for-jobs :jobs-for-jobs)
-                         selected-job-build (assoc-in [0 :job/started-at]
-                                                      (:start_time selected-job-build)))]
+                  jobs (-> this
+                           om-next/props
+                           :run-for-jobs
+                           :run/jobs)]
               (html
                [:div
                 ;; We get the :run/id for free in the route params, so even
@@ -210,9 +196,4 @@
                     [:.hr-title
                      [:span (gstring/format "%s jobs in this workflow" (count jobs))]]]
                    (job-cards-row
-                    (map (fn [job-data]
-                           (job (om-next/computed
-                                 job-data
-                                 {:selected? (= (:job/name job-data)
-                                                (:job/name selected-job))})))
-                         jobs))])])))})))))
+                    (map job jobs))])])))})))))


Fix error in Launchpad Mk2 reference manual.

--- src/afterglow/controllers/launchpad_mk2.clj
+++ src/afterglow/controllers/launchpad_mk2.clj
@@ -85,7 +85,7 @@
   (let [r (colors/red color)
         g (colors/green color)
         b (colors/blue color)]
-    (midi/midi-sysex (:port-out controller) [240 0 32 41 2 24 10 led (quot r 4) (quot g 4) (quot b 4) 247])))
+    (midi/midi-sysex (:port-out controller) [240 0 32 41 2 24 11 led (quot r 4) (quot g 4) (quot b 4) 247])))

 (defn set-pad-color
   "Set the color of one of the 64 touch pads to a specific RGB color."


Fix Enlive selector syntax in snippets.clj

--- src/app/cljs-macros/one/repmax/snippets.clj
+++ src/app/cljs-macros/one/repmax/snippets.clj
@@ -15,7 +15,7 @@

 (def ^{:private true}
   exercises-list-item-template
-  (let [sample-list-item (html/select (html/html-resource "exercises.html") [:#exercise-list :ol :li] :first)
+  (let [sample-list-item (html/select (html/html-resource "exercises.html") [:#exercise-list :ol [:li html/first-of-type]])
         list-item-without-content (html/at sample-list-item [:.list-item-label] (html/content ""))]
     (render list-item-without-content)))


fix typo

fix typo

--- src/clj/org/openforis/ceo/convert_logos.clj
+++ src/clj/org/openforis/ceo/convert_logos.clj
@@ -8,7 +8,7 @@
 ;; TODO: Delete /resources/public/img/institution-logos after migration
 ;; Call with clojure -m org.openforis.ceo.convert-logos
 (defn -main []
-  (doseq [logo (->> (io/resource "/resources/public/img/institution-logos")
+  (doseq [logo (->> (io/resource "public/img/institution-logos")
                     (io/file)
                     (file-seq)
                     (filter #(.isFile %)))]


fix paging Index of Bound ex

fix paging Index of Bound ex

--- src/cljs/material/component/list/basic.cljs
+++ src/cljs/material/component/list/basic.cljs
@@ -192,6 +192,9 @@
                                   (swap! footer-state assoc :page 0))})))))

 (rum/defc responsive-footer < rum/reactive
+                              {:init (fn [state _]
+                                       (swap! footer-state assoc :page 0)
+                                       state)}
   [render-metadata items onclick-handler-fn]
   (let [fs (rum/react footer-state)]
     (cmp/mui


fix adding optional headers

fix adding optional headers

--- src/clojure/catacumba/handlers/security.clj
+++ src/clojure/catacumba/handlers/security.clj
@@ -117,7 +117,7 @@
   http://msdn.microsoft.com/en-us/library/ie/gg622941(v=vs.85).aspx
   https://www.owasp.org/index.php/List_of_useful_HTTP_headers"
   [context]
-  (ct/set-headers! {"X-Content-Type-Options" "nosniff"})
+  (ct/set-headers! context {"X-Content-Type-Options" "nosniff"})
   (ct/delegate))

 (defn- form-post?


Add an ability to add (if-exists) to drop statement

--- src/clojure/clojurewerkz/cassaforte/cql.clj
+++ src/clojure/clojurewerkz/cassaforte/cql.clj
@@ -38,8 +38,8 @@
 (defn drop-keyspace
   "Drops a keyspace: results in immediate, irreversible removal of an existing keyspace,
    including all column families in it, and all data contained in those column families."
-  [^Session session ks]
-  (execute- session [ks] q/drop-keyspace-query))
+  [^Session session ks & query-params]
+  (execute- session (cons ks query-params) q/drop-keyspace-query))

 (defn create-keyspace
   "Creates a new top-level keyspace. A keyspace is a namespace that