use (mapcat :parses) to get all parses from all possible tokenizations, rather than simply the parses from the first tokenization

--- test/babel/test/it.cljc
+++ test/babel/test/it.cljc
@@ -101,10 +101,11 @@
     (is (not (empty? result)))
     (is (= "lei è andata") (morph (first (:parses (first result)))))))

-;; ..whereas this should fail:
+;; ..whereas this should fail - that is, there
+;; should be no parses found, i.e. (= 0 (count parses))
 (deftest passato-prossimo-parsing-negative
-  (let [result (:parses (first (parse "lei è andato")))]
-    (is (empty? result))))
+  (let [result (mapcat :parses (parse "lei è andato"))]
+    (is (= 0 (count result)))))

 (deftest fix-regression
   (let [spec {:synsem {:cat :verb


Fixing namespace declaration of unit tests, and writing a test for text matching

--- test/test_huh/test_core.cljs
+++ test/test_huh/test_core.cljs
@@ -1,10 +1,33 @@
-(ns test-huh.test.core
+(ns test.test-huh.core
   (:require-macros [cemerick.cljs.test
                     :refer (is deftest with-test run-tests testing test-var)])
   (:require [cemerick.cljs.test :as t]
+            [om.core :as om :include-macros true]
+            [om.dom :as dom :include-macros true]
             [huh.core :as huh]))
+
+(defn rendered-div [props contents]
+  (huh/rendered-component
+   (fn [data owner]
+     (reify
+       om/IRender
+       (render [this#]
+         (dom/div props
+                  contents))))
+   (huh/setup-state {})))

 ;; To be deleted when there is reasonable test coverage for the
 ;; library.
 (deftest test-coverage-is-good-enough
   (is (= 2 3)))
+
+(deftest with-text-returns-true-when-text-present
+  (is (= true ((huh/with-text "some text")
+               (rendered-div #js {}
+                             "some text")))))
+
+(deftest with-text-returns-error-without-match
+  (is (= {:msg "Text does not match" :expected "some text" :actual "other text"}
+         ((huh/with-text "some text")
+          (rendered-div #js {}
+                        "other text")))))


Add test for `of-seconds`

Add test for `of-seconds`

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


given improvements

given improvements

--- test/yada/test/util.clj
+++ test/yada/test/util.clj
@@ -29,14 +29,20 @@
   `(do
      ~@(for [[a b c] (partition 3 body)]
         (case b
+          ;; Equals?
           := `(is (= ((as-test-function ~a) ~v) ~c))
           :!= `(is (not= ((as-test-function ~a) ~v) ~c))
+          ;; Schema checks
           :- `(is (nil? (s/check ~c ((as-test-function ~a) ~v))))
+          ;; Is?
           :? `(is (~c ((as-test-function ~a) ~v)))
           :!? `(is (not (~c ((as-test-function ~a) ~v))))
+          ;; Matches regex?
           :# `(is (re-matches (re-pattern ~c) ((as-test-function ~a) ~v)))
           :!# `(is (not (re-matches (re-pattern ~c) ((as-test-function ~a) ~v))))
-          :> `(is (set/subset? (set ~c) (set ((as-test-function ~a) ~v))))
-          :!> `(is (not (set/subset? (set ~c) (set ((as-test-function ~a) ~v)))))
-          :< `(is (set/superset? (set ~c) (set ((as-test-function ~a) ~v))))
-          :!< `(is (not (set/superset? (set ~c) (set ((as-test-function ~a) ~v)))))))))
+          ;; Is superset?
+          :> `(is (set/superset? (set ((as-test-function ~a) ~v)) (set ~c)))
+          :!> `(is (not (set/superset? (set ((as-test-function ~a) ~v)) (set ~c))))
+          ;; Is subset?
+          :< `(is (set/subset? (set ((as-test-function ~a) ~v)) (set ~c)))
+          :!< `(is (not (set/subset? (set ((as-test-function ~a) ~v)) (set ~c))))))))


Test for function get-user-name

Test for function get-user-name

--- test/zg/server_test.clj
+++ test/zg/server_test.clj
@@ -245,6 +245,15 @@
     (testing "the function get-user-name."
         (are [x y] (= x (get-user-name y))
             nil nil)))
+
+(deftest test-get-user-name
+    "Check the function get-user-name."
+    (testing "the function get-user-name."
+        (are [x y] (= x (get-user-name y))
+            "new user" {:params  {"user-name" "new user"}}
+            "new user" {:params  {"user-name" "new user"}
+                        :cookies {"user-name" {:value "old user"}}}
+            "old user" {:cookies {"user-name" {:value "old user"}}})))

 (deftest test-get-title
     "Check the function get-title."


CMR-1280: Documents ISO MENDS spatial parsing multimethods

--- umm-lib/src/cmr/umm/iso_mends/spatial.clj
+++ umm-lib/src/cmr/umm/iso_mends/spatial.clj
@@ -16,9 +16,15 @@
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; Parsing XML

-(defmulti ^:private parse-geo-element :tag)
+(defmulti ^:private parse-geo-element
+  "Returns a UMM geometry values from the child element of ISO extent
+  geographicElement elements. Dispatches on tag of element."
+  :tag)

-(defmulti ^:private parse-gml :tag)
+(defmulti ^:private parse-gml
+  "Returns a UMM geometry value for a gml:* child of a
+  EX_BoundingPolygon element. Dispatches on tag."
+  :tag)

 ;; EX_BoundingPolygon always contains a single gmd:polygon, which in
 ;; turn contains a single gml:Point, gml:LineString, or gml:Polygon


note to self

note to self

--- server/src/gratefulplace/controllers/users.clj
+++ server/src/gratefulplace/controllers/users.clj
@@ -46,6 +46,9 @@
           ss/ent->user
           {:exclude [:password]})})

+;; TODO more definite way of updating specified fields? perhaps
+;; creating a route which passes the fields as an argument to the
+;; controller?
 (defn update-about!
   [params auth]
   (protect


Display system info when calling `resume`

This allows automated tools like replant to show the web server
host/port.  Which is even more important now it is random.

Fix #42

--- lib.app.dev/src/dev_extras.clj
+++ lib.app.dev/src/dev_extras.clj
@@ -35,7 +35,7 @@
                                          [:doc :file :line :column :arglists]))))
              vars)))

-(proxy-ns integrant.repl clear halt prep init reset reset-all suspend resume)
+(proxy-ns integrant.repl clear halt prep init reset reset-all suspend)
 (proxy-ns clojure.tools.deps.alpha.repl add-lib)

 (defmacro ^:private watch-var
@@ -57,6 +57,12 @@
     (doseq [message (system.meta/useful-infos system-config system)]
       (println (io.aviso.ansi/yellow (format "[Edge] %s" message))))
     (println (io.aviso.ansi/bold-yellow "[Edge] Now make code changes, then enter (reset) here"))
+    res))
+
+(defn resume []
+  (let [res (integrant.repl/resume)]
+    (doseq [message (system.meta/useful-infos system-config system)]
+      (println (io.aviso.ansi/yellow (format "[Edge] %s" message))))
     res))

 (integrant.repl/set-prep! #(system/system-config {:profile :dev}))


Use window.location.hostname to locate API, close #64

--- frontend/src/cruncher/config.cljs
+++ frontend/src/cruncher/config.cljs
@@ -1,12 +1,12 @@
 (ns cruncher.config)

-(def api {:host "http://localhost:5000/"
-          :init "api/init/"
-          :base "api/"
-          :login "api/login"
-          :get-all-pokemon "api/pokemon"
-          :toggle-favorite "api/pokemon/favorite"
+(def api {:host                    (str "http://" (.. js/window -location -hostname) ":5000/")
+          :init                    "api/init/"
+          :base                    "api/"
+          :login                   "api/login"
+          :get-all-pokemon         "api/pokemon"
+          :toggle-favorite         "api/pokemon/favorite"
           :crunch-selected-pokemon "api/pokemon/delete"
-          :status-delete "api/status/delete"
-          :get-player "api/player"
-          :evolve-pokemon "api/pokemon/evolve"})
+          :status-delete           "api/status/delete"
+          :get-player              "api/player"
+          :evolve-pokemon          "api/pokemon/evolve"})


CMR-4467 - Add a workaround for provider-id in services ingest until CMR-4468.

--- ingest-app/src/cmr/ingest/services/ingest_service/service.clj
+++ ingest-app/src/cmr/ingest/services/ingest_service/service.clj
@@ -43,6 +43,9 @@
   db."
   [service]
   {:concept-type :service
+   ;; The following is a placeholder until UMM-Service fully supports
+   ;; provider ids; see CMR-4468
+   :provider-id (or (:provider-id service) "CMR")
    :native-id (:native-id service)
    :metadata (pr-str service)
    :user-id (:originator-id service)


Update external_config.clj

Update external_config.clj

--- integration/dda/pallet/dda_managed_vm/app/external_config.clj
+++ integration/dda/pallet/dda_managed_vm/app/external_config.clj
@@ -33,15 +33,14 @@
           (s/optional-key :gpg-private-key) s/Str
           (s/optional-key :gpg-passphrase) s/Str}})

-(def provisioning-ip
-  "192.168.56.103")
-
-(defn provisioning-ip-new [file]
- (-> (ex-config file) :provisioning :ip))
+(defn provisioning-ip
+  (let [file user-config-path])
+  (-> (ex-config file) :provisioning :ip))

 (def provisioning-user
-  {:login "initial"
-   :password "secure1234"})
+  (let [file user-config-path])
+  {:login (-> (ex-config file) :provisioning :login)
+   :password (-> (ex-config file) :provisioning :password)})

 ;TODO: works with keypin and additional recursive conversion protocols
 ;TODO: source: https://groups.google.com/forum/#!topic/clojure/1NzLnWUtj0Q


adjust to updated dda-pallet-commons

adjust to updated dda-pallet-commons

--- integration/dda/pallet/dda_user_crate/app/instantiate_aws.clj
+++ integration/dda/pallet/dda_user_crate/app/instantiate_aws.clj
@@ -16,8 +16,8 @@
 (ns dda.pallet.dda-user-crate.app.instantiate-aws
   (:require
     [clojure.inspector :as inspector]
-    [org.domaindrivenarchitecture.pallet.commons.session-tools :as session-tools]
-    [org.domaindrivenarchitecture.pallet.commons.pallet-schema :as ps]
+    [dda.pallet.commons.session-tools :as session-tools]
+    [dda.pallet.commons.pallet-schema :as ps]
     [dda.cm.operation :as operation]
     [dda.cm.aws :as cloud-target]
     [dda.pallet.dda-user-crate.infra.user.os-user :as os-user]


Swap Triggered for Author in the builds table

--- src-cljs/frontend/components/builds_table.cljs
+++ src-cljs/frontend/components/builds_table.cljs
@@ -90,7 +90,7 @@
           [:th "Revision"]
           (when show-branch?
             [:th "Branch"])
-          [:th "Triggered by"]
+          [:th "Author"]
           [:th "Log"]
           [:th.condense "Started at"]
           [:th.condense "Length"]


Fix ns-test-case, add test-all-ns

Fix ns-test-case, add test-all-ns

--- src/main/clojure/com/stuartsierra/lazytest.clj
+++ src/main/clojure/com/stuartsierra/lazytest.clj
@@ -291,53 +291,47 @@
   that.  If the Var's :test metadata is a function, generates a
   TestCase with an assertion that calls the function.  If none of
   these are true, returns nil."  [v]
-  (cond (= ::TestCase (type (var-get v)))
-        (var-get v)
-
-        (= ::TestCase (type (:test (meta v))))
-        (:test (meta v))
-
-        (fn? (:test (meta v)))
-        (TestCase [] [(:test (meta v))]
-                  {:doc "Var :test metadata function."
-                   :name (:name (meta v))
-                   :ns (:ns (meta v))}
-                  nil)
-
-        :else nil))
+  (let [value (try (var-get v)
+                   (catch Exception e nil))]
+    (cond (= ::TestCase (type value))
+          value
+
+          (= ::TestCase (type (:test (meta v))))
+          (:test (meta v))
+
+          (fn? (:test (meta v)))
+          (TestCase [] [(:test (meta v))]
+                    {:doc "Var :test metadata function."
+                     :name (:name (meta v))
+                     :ns (:ns (meta v))}
+                    nil)
+
+          :else nil)))

 (defn test-var
   "Finds and runs a TestCase for the Var."
   [v]
   (run-test-case (var-test-case v)))

+(defn all-vars-test-case
+  "Returns a TestCase that tests all Vars in namespace n."
+  [n]
+  (TestCase [] (vec (filter identity
+                            (map var-test-case (vals (ns-interns n)))))
+            {:name 'all-vars-test
+             :doc "Generated by all-vars-test-case"}
+            nil))
+
 (defn ns-test-case
-  "Returns a TestCase for a Namespace.  If the namespace's :test
-  metadata is a TestCase, returns that.  If the namespace's :test
-  metadata is another namespace, recurses on that.  If the
-  namespace's :test metadata is a symbol, require's that namespace and
-  recurses.  If the namespace's :test metadata is a function,
-  generates a TestCase with an assertion that calls the function.  If
-  none of these are true, returns nil."  [n]
-  (let [t (:test (meta n))]
-    (cond (= ::TestCase (type t))
-          t
-
-          (instance? clojure.lang.Namespace t)
-          (ns-test-case t)
-
-          (symbol? t)
-          (do (require t)
-              (ns-test-case (the-ns t)))
-
-          (fn? t)
-          (TestCase [] [t]
-                    {:doc "Namespace :test metadata function."
-                     :name (ns-name n)}
-                    nil)
-
-;; todo: generate test-all-vars testcase
-          :else nil)))
+  "Returns a TestCase for namespace n.  If the namespace's :test
+  metadata is a TestCase, returns that.  Otherwise, generates a
+  TestCase that tests all Vars interned in the namespace."
+  [n]
+  (let [n (the-ns n)
+        t (:test (meta n))]
+    (if (= ::TestCase (type t))
+      t
+      (all-vars-test-case n))))

 (defn test-ns
   "Finds and runs a TestCase for the namespace."
@@ -349,9 +343,13 @@
 (extend clojure.lang.Namespace Testable {:run-tests test-ns})

 (defn all-ns-test-case
-  "Returns a TestCase for all Namespaces."
+  "Returns a generated TestCase for tests in all namespaces."
   []
-  (TestCase [] (vec (map (fn [n] (ns-test-case n)) (all-ns)))
-            {:name 'all-ns-tests,
+  (TestCase [] (vec (map ns-test-case (all-ns)))
+            {:name 'all-ns-test
              :doc "Generated by all-ns-test-case"}
-            nil))+            nil))
+
+(defn test-all-ns
+  "Runs tests in all namespaces."
+  [] (run-test-case (all-ns-test-case)))


allow configuration of :node-library exported name via :umd-root-name

closes #212

--- src/main/shadow/build/targets/node_library.clj
+++ src/main/shadow/build/targets/node_library.clj
@@ -23,13 +23,16 @@
       simple-keyword?
       shared/unquoted-qualified-symbol?)))

+(s/def ::umd-root-name shared/non-empty-string?)
+
 (s/def ::target
   (s/keys
     :req-un
     [::exports
      ::shared/output-to]
     :opt-un
-    [::shared/output-dir]
+    [::shared/output-dir
+     ::umd-root-name]
     ))

 (defmethod config/target-spec :node-library [_]
@@ -38,7 +41,7 @@
 (defmethod config/target-spec `process [_]
   (s/spec ::target))

-(defn create-module [state {:keys [exports output-to] :as config}]
+(defn create-module [state {:keys [exports output-to umd-root-name] :as config}]
   {:pre [(data/build-state? state)
          (map? config)
          (or (qualified-symbol? exports)
@@ -94,7 +97,12 @@
         ;; based on https://github.com/umdjs/umd/blob/master/templates/returnExports.js
         [prepend append]
         (-> (slurp (io/resource "shadow/build/targets/umd_exports.txt"))
-            (str/split #"//CLJS-HERE"))]
+            (str/split #"//CLJS-HERE"))
+
+        prepend
+        (cond-> prepend
+          umd-root-name
+          (str/replace #"root.returnExports" (str "root." umd-root-name)))]

     (-> state
         (assoc :node-config node-config)


add additional nrepl middleware to emulate

--- src/main/shadow/cljs/devtools/server/nrepl.clj
+++ src/main/shadow/cljs/devtools/server/nrepl.clj
@@ -295,6 +295,7 @@

              ;; provided by fake-piggieback, only because tools expect piggieback
              #'cemerick.piggieback/wrap-cljs-repl
+             #'cider.piggieback/wrap-cljs-repl

              ;; cljs support
              #'cljs-load-file


CMR-4986: Added system tests for non-reversed UMM-Var 1.2 bounds.

--- test/cmr/opendap/tests/system/app/ous/core.clj
+++ test/cmr/opendap/tests/system/app/ous/core.clj
@@ -14,87 +14,7 @@

 (use-fixtures :once test-system/with-system)

-(deftest gridded-with-ummvar-1-1-api-v2
-  (let [collection-id "C1200267318-HMR_TME"
-        granule-id "G1200267320-HMR_TME"
-        variable-id "V1200267322-HMR_TME"
-        options (-> {}
-                    (request/add-token-header (util/get-sit-token))
-                    (util/override-api-version-header "v2"))]
-    (testing "GET without bounding box ..."
-      (let [response @(httpc/get
-                       (format (str "http://localhost:%s"
-                                    "/opendap/ous/collection/%s"
-                                    "?granules=%s"
-                                    "&variables=%s")
-                               (test-system/http-port)
-                               collection-id
-                               granule-id
-                               variable-id)
-                       options)]
-        (is (= 200 (:status response)))
-        (is (= "cmr-opendap.v2; format=json"
-               (get-in response [:headers :cmr-media-type])))
-        (is (= ["https://f5eil01.edn.ecs.nasa.gov/opendap/DEV01/user/FS2/AIRS/AIRX3STD.006/2002/AIRS.2002.09.04.L3.RetStd001.v6.0.9.0.G13208020620.hdf.nc?CH4_VMR_A,Latitude,Longitude"]
-               (util/parse-response response)))))
-    (testing "GET without subset ..."
-      (let [response @(httpc/get
-                       (format (str "http://localhost:%s"
-                                    "/opendap/ous/collection/%s"
-                                    "?coverage=%s"
-                                    "&rangesubset=%s")
-                               (test-system/http-port)
-                               collection-id
-                               granule-id
-                               variable-id)
-                       options)]
-        (is (= 200 (:status response)))
-        (is (= "cmr-opendap.v2; format=json"
-               (get-in response [:headers :cmr-media-type])))
-        (is (= ["https://f5eil01.edn.ecs.nasa.gov/opendap/DEV01/user/FS2/AIRS/AIRX3STD.006/2002/AIRS.2002.09.04.L3.RetStd001.v6.0.9.0.G13208020620.hdf.nc?CH4_VMR_A,Latitude,Longitude"]
-               (util/parse-response response)))))
-    (testing "GET with bounding box ..."
-      (let [response @(httpc/get
-                       (format (str "http://localhost:%s"
-                                    "/opendap/ous/collection/%s"
-                                    "?granules=%s"
-                                    "&variables=%s"
-                                    "&bounding-box="
-                                    "-9.984375,56.109375,19.828125,67.640625")
-                               (test-system/http-port)
-                               collection-id
-                               granule-id
-                               variable-id)
-                       options)]
-        (is (= 200 (:status response)))
-        (is (= "cmr-opendap.v2; format=json"
-               (get-in response [:headers :cmr-media-type])))
-        (is (= ["https://f5eil01.edn.ecs.nasa.gov/opendap/DEV01/user/FS2/AIRS/AIRX3STD.006/2002/AIRS.2002.09.04.L3.RetStd001.v6.0.9.0.G13208020620.hdf.nc?CH4_VMR_A[0:1:23][22:1:34][169:1:200],Latitude[22:1:34],Longitude[169:1:200]"]
-               (util/parse-response response)))))
-    (testing "GET with subset ..."
-      (let [response @(httpc/get
-                       (format (str "http://localhost:%s"
-                                    "/opendap/ous/collection/%s"
-                                    "?coverage=%s"
-                                    "&rangesubset=%s"
-                                    "&subset=lat(56.109375,67.640625)"
-                                    "&subset=lon(-9.984375,19.828125)")
-                               (test-system/http-port)
-                               collection-id
-                               granule-id
-                               variable-id)
-                       options)]
-        (is (= 200 (:status response)))
-        (is (= "cmr-opendap.v2; format=json"
-               (get-in response [:headers :cmr-media-type])))
-        (is (= ["https://f5eil01.edn.ecs.nasa.gov/opendap/DEV01/user/FS2/AIRS/AIRX3STD.006/2002/AIRS.2002.09.04.L3.RetStd001.v6.0.9.0.G13208020620.hdf.nc?CH4_VMR_A[0:1:23][22:1:34][169:1:200],Latitude[22:1:34],Longitude[169:1:200]"]
-               (util/parse-response response)))))))
-
 (deftest gridded-with-ummvar-1-1-api-v2-1
-  ;; All of these ingested items are UMM-Var 1.1; since they are using v2.1 of
-  ;; the REST API, Dimensions will be searched (and not found, since that field
-  ;; is in UMM-Var 1.2), and will subsequently conclude that the data is not
-  ;; gridded, stripping away the bounding info from all OPeNDAP queries.
   (let [collection-id "C1200267318-HMR_TME"
         granule-id "G1200267320-HMR_TME"
         variable-id "V1200267322-HMR_TME"
@@ -132,7 +52,15 @@
         (is (= "cmr-opendap.v2.1; format=json"
                (get-in response [:headers :cmr-media-type])))
         (is (= ["https://f5eil01.edn.ecs.nasa.gov/opendap/DEV01/user/FS2/AIRS/AIRX3STD.006/2002/AIRS.2002.09.04.L3.RetStd001.v6.0.9.0.G13208020620.hdf.nc"]
-               (util/parse-response response)))))
+               (util/parse-response response)))))))
+
+(deftest gridded-with-ummvar-1-1-api-v2-1-bounds
+  (let [collection-id "C1200276782-HMR_TME"
+        granule-id "G1200276783-HMR_TME"
+        variable-id "V1200276788-HMR_TME"
+        options (-> {}
+                    (request/add-token-header (util/get-sit-token))
+                    (util/override-api-version-header "v2.1"))]
     (testing "GET with bounding box ..."
       (let [response @(httpc/get
                        (format (str "http://localhost:%s"
@@ -149,7 +77,7 @@
         (is (= 200 (:status response)))
         (is (= "cmr-opendap.v2.1; format=json"
                (get-in response [:headers :cmr-media-type])))
-        (is (= ["https://f5eil01.edn.ecs.nasa.gov/opendap/DEV01/user/FS2/AIRS/AIRX3STD.006/2002/AIRS.2002.09.04.L3.RetStd001.v6.0.9.0.G13208020620.hdf.nc"]
+        (is (= ["https://f5eil01.edn.ecs.nasa.gov/opendap/DEV01/user/FS2/MOAA/MOD08_D3.006/2012.01.02/MOD08_D3.A2012002.006.2015056234420.hdf.nc?Solar_Zenith_Mean[22:1:34][169:1:200],YDim[22:1:34],XDim[169:1:200]"]
                (util/parse-response response)))))
     (testing "GET with subset ..."
       (let [response @(httpc/get
@@ -167,7 +95,7 @@
         (is (= 200 (:status response)))
         (is (= "cmr-opendap.v2.1; format=json"
                (get-in response [:headers :cmr-media-type])))
-        (is (= ["https://f5eil01.edn.ecs.nasa.gov/opendap/DEV01/user/FS2/AIRS/AIRX3STD.006/2002/AIRS.2002.09.04.L3.RetStd001.v6.0.9.0.G13208020620.hdf.nc"]
+        (is (= ["https://f5eil01.edn.ecs.nasa.gov/opendap/DEV01/user/FS2/MOAA/MOD08_D3.006/2012.01.02/MOD08_D3.A2012002.006.2015056234420.hdf.nc?Solar_Zenith_Mean[22:1:34][169:1:200],YDim[22:1:34],XDim[169:1:200]"]
                (util/parse-response response)))))))

 (deftest gridded-with-ummvar-1-2-api-v2-1


Parameterize prompt

Parameterize prompt

--- modules/bootstrap/src/modular/bootstrap/cylon/login_form.clj
+++ modules/bootstrap/src/modular/bootstrap/cylon/login_form.clj
@@ -38,7 +38,7 @@
     (wrap-content-in-boilerplate bp req content)
     content))

-(defrecord BootstrapLoginFormRenderer []
+(defrecord BootstrapLoginFormRenderer [prompt]
   LoginFormRenderer
   (render-login-form
     [this req model]
@@ -53,7 +53,7 @@
                            :style "border: 1px dotted #555"
                            :action (-> model :form :action)}

-        [:h2.form-signin-heading "  Please sign in&#8230"]
+        [:h2.form-signin-heading prompt]

         #_(when login-status
             [:div.alert.alert-warning.alert-dismissable
@@ -81,8 +81,12 @@
         #_[:a {:href "#"} "Reset password"]
         ]]))))

+(def new-bootstrap-login-form-renderer-schema
+  {(s/optional-key :boilerplate) (s/protocol ContentBoilerplate)
+   :prompt s/Str})
+
 (defn new-bootstrap-login-form-renderer [& {:as opts}]
   (->> opts
-       (merge {})
-       (s/validate {(s/optional-key :boilerplate) (s/protocol ContentBoilerplate)})
+       (merge {:prompt "Please sign in&#8230"})
+       (s/validate new-bootstrap-login-form-renderer-schema)
        map->BootstrapLoginFormRenderer))


Increase sleep

Increase sleep

--- src/nube/app.clj
+++ src/nube/app.clj
@@ -119,7 +119,7 @@
        (if (= 200 (:status @(http/get (str "http://" host ":" port "/") {:timeout 5000})))
          true
          (do
-           (Thread/sleep (* (- 10 n) 100))
+           (Thread/sleep (* (- 10 n) 500))
            (recur (dec n))))))))

 (defn health-check-instances []


Add `pst` repl-special form (WIP)

Add `pst` repl-special form (WIP)

--- planck-cljs/src/planck/core.cljs
+++ planck-cljs/src/planck/core.cljs
@@ -36,7 +36,7 @@
 (defn ns-form? [form]
   (and (seq? form) (= 'ns (first form))))

-(def repl-specials '#{in-ns require require-macros doc})
+(def repl-specials '#{in-ns require require-macros doc pst})

 (defn repl-special? [form]
   (and (seq? form) (repl-specials (first form))))
@@ -49,7 +49,10 @@
     require-macros {:arglists ([& args])
                     :doc      "Similar to the require REPL special function but\n  only for macros."}
     doc            {:arglists ([name])
-                    :doc      "Prints documentation for a var or special form given its name"}})
+                    :doc      "Prints documentation for a var or special form given its name"}
+    pst            {:arglists ([] [e])
+                    :doc      (str "Prints a stack trace of the exception. If none supplied, uses the root cause of the "
+                                   "most recent repl exception (*e)")}})

 (defn- repl-special-doc [name-symbol]
   (assoc (repl-special-doc-map name-symbol)
@@ -200,7 +203,10 @@
                   (repl/print-doc (repl-special-doc (second expression-form)))
                   (repl/print-doc
                     (let [sym (second expression-form)]
-                          (with-compiler-env st (resolve env sym))))))
+                          (with-compiler-env st (resolve env sym)))))
+            pst (let [sym (or (-> expression-form second second) '*e)
+                      err (with-compiler-env st (resolve env sym))]
+                  (print-error err)))
           (prn nil))
         (try
           (cljs/eval-str


Add zeroconf-support for web.

Add zeroconf-support for web.

--- src/pepa/web.clj
+++ src/pepa/web.clj
@@ -1,6 +1,7 @@
 (ns pepa.web
   (:require [pepa.web.handlers :refer [make-handlers]]
             [pepa.log :as log]
+            [pepa.zeroconf :as zeroconf]

             [com.stuartsierra.component :as component]
             [immutant.web :as http-server]))
@@ -25,3 +26,14 @@

 (defn make-component []
   (map->Web {}))
+
+;;; Zeroconf Service Implementation
+
+(defmethod zeroconf/service-info :web [module config]
+  (let [name "Pepa DMS"
+        port (get-in config [:web :port])]
+    (assert (< 0 port 65535))
+    (zeroconf/map->Service {:type "_http._tcp.local."
+                            :name name
+                            :port port
+                            :props {}})))


onto 0.1.11-SNAPSHOT

onto 0.1.11-SNAPSHOT

--- build.boot
+++ build.boot
@@ -1,4 +1,4 @@
-(def +version+ "0.1.10")
+(def +version+ "0.1.11-SNAPSHOT")

 (set-env!
   :source-paths #{"src"}


bump reload

bump reload

--- build.boot
+++ build.boot
@@ -2,7 +2,7 @@
  :source-paths    #{"src"}
  :resource-paths  #{"html" "conf"}
  :dependencies    '[[adzerk/boot-cljs   "0.0-2814-3"]
-                    [adzerk/boot-reload "0.2.4"]
+                    [adzerk/boot-reload "0.2.6"]
                     [pandeiro/boot-http "0.6.2"]])

 (require


prepare next release cycle

prepare next release cycle

--- build.boot
+++ build.boot
@@ -40,7 +40,7 @@
          '[me.raynes.fs       :as fs]
          '[clojure.java.io :as io])

-(def +version+ "0.0.1")
+(def +version+ "0.0.2-SNAPSHOT")

 (bootlaces! +version+)


Deprecating some cmr common util functions.

--- common-lib/src/cmr/common/util.clj
+++ common-lib/src/cmr/common/util.clj
@@ -126,7 +126,8 @@

 (defn build-validator
   "Creates a function that will call f with it's arguments. If f returns any errors then it will
-  throw a service error of the type given."
+  throw a service error of the type given.
+  DEPRECATED: we should use the validations namespace"
   [error-type f]
   (fn [& args]
     (when-let [errors (apply f args)]
@@ -134,7 +135,8 @@
         (errors/throw-service-errors error-type errors)))))

 (defn apply-validations
-  "Applies the arguments to each validation concatenating all errors and returning them"
+  "Applies the arguments to each validation concatenating all errors and returning them
+  DEPRECATED: we should use the validations namespace"
   [validations & args]
   (reduce (fn [errors validation]
             (if-let [new-errors (apply validation args)]
@@ -145,7 +147,8 @@

 (defn compose-validations
   "Creates a function that will compose together a list of validation functions into a
-  single function that will perform all validations together"
+  single function that will perform all validations together
+  DEPRECATED: we should use the validations namespace"
   [validation-fns]
   (partial apply-validations validation-fns))


add read exec group

add read exec group

--- clj-tcp/src/clj_tcp/client.clj
+++ clj-tcp/src/clj_tcp/client.clj
@@ -63,7 +63,7 @@
       ;(.writeAndFlush ctx (Unpooled/copiedBuffer "Netty Rocks1" CharsetUtil/UTF_8))
       )
     (channelRead0 [^ChannelHandlerContext ctx in]
-      (info "Read0 " (Thread/currentThead))
+      (info "Read0 " (Thread/currentThread))
       (>!! read-ch (if (instance? ByteBuf in) (buffer->bytes in)  in))
       )
     (exceptionCaught [^ChannelHandlerContext ctx cause]


remove unneeded (defn candidate-parents)

--- src/babel/generate.cljc
+++ src/babel/generate.cljc
@@ -20,7 +20,6 @@
 (def ^:const handle-unify-fail #(log/debug %))
 (def ^:const throw-exception-on-unify-fail false)

-
 (def ^:const shufflefn
   (fn [x]
     ;; deterministic generation:
@@ -37,7 +36,6 @@
 (declare add-comp-to-bolts)
 (declare add-comps-to-bolt)
 (declare add-to-bolt-at-path)
-(declare candidate-parents)
 (declare get-bolts-for)
 (declare get-lexemes)
 (declare lightning-bolts)
@@ -119,7 +117,7 @@
            (not (= false (get-in spec [:phrasal] true))))
     (let [candidate-parents (or use-candidate-parents
                                 (->>
-                                 (candidate-parents (:grammar model) spec depth)
+                                 (:grammar model)
                                  (map #(unify % spec))
                                  (filter #(not (= :fail %)))
                                  (shufflefn)))]
@@ -209,15 +207,6 @@
                       ((:default-fn model) tree)
                       tree)))))))))))

-(defn candidate-parents
-  "find subset of _rules_ for which each member unifies successfully with _spec_; _depth_ is only used for diagnostic logging."
-  [rules spec depth]
-  (->>
-   rules
-   (mapfn (fn [rule]
-            (unify spec rule)))
-   (filter #(not (= :fail %)))))
-
 (defn get-lexemes [model spec]
   "Get lexemes matching the spec. Use a model's index if available, where the index is a function that we call with _spec_ to get a set of indices. otherwise use the model's entire lexeme."
   (->>


s/mapcat/flatten+mapfn/

s/mapcat/flatten+mapfn/

--- src/babel/generate.cljc
+++ src/babel/generate.cljc
@@ -133,34 +133,39 @@
     (if (empty? comp-paths)
       [bolt] ;; done: we've added all the comps to the bolt, so just return the bolt as a singleton vector.
       ;; else, more comp-paths to go.
-      (mapcat #(add-comps % model
-                          (rest comp-paths)
-                          (rest bolts-at-paths)
-                          depth max-depth top-bolt path-from-top)
-              (let [path (first comp-paths)
-                    bolts-at (first bolts-at-paths)]
-                (mapcat (fn [bolt-at]
-                          (if (= false (get-in bolt-at [:phrasal]))
-                            [(assoc-in bolt path bolt-at)]
-                            (let [comps-map (comp-paths-to-bolts-map bolt-at model (+ 1 depth) max-depth)]
-                              (when (not (some empty? (vals comps-map)))
-                                (let [comp-paths (keys comps-map)]
-                                  (map #(assoc-in bolt path %)
-                                       (add-comps bolt-at
-                                                  model
-                                                  comp-paths
-                                                  (map (fn [path]
-                                                         (get comps-map path))
-                                                       comp-paths)
-                                                  (+ 1 depth)
-                                                  max-depth
-                                                  top-bolt)))))))
-                        bolts-at))))))
+      (flatten
+       (mapfn
+        #(add-comps % model
+                    (rest comp-paths)
+                    (rest bolts-at-paths)
+                    depth max-depth top-bolt path-from-top)
+        (let [path (first comp-paths)
+              bolts-at (first bolts-at-paths)]
+          (flatten
+           (mapfn
+            (fn [bolt-at]
+              (if (= false (get-in bolt-at [:phrasal]))
+                [(assoc-in bolt path bolt-at)]
+                (let [comps-map (comp-paths-to-bolts-map bolt-at model (+ 1 depth) max-depth)]
+                  (when (not (some empty? (vals comps-map)))
+                    (let [comp-paths (keys comps-map)]
+                      (mapfn #(assoc-in bolt path %)
+                             (add-comps bolt-at
+                                        model
+                                        comp-paths
+                                        (mapfn (fn [path]
+                                                 (get comps-map path))
+                                               comp-paths)
+                                        (+ 1 depth)
+                                        max-depth
+                                        top-bolt)))))))
+            bolts-at))))))))
 (defn generate2
   "Return all expressions matching spec _spec_ given the model _model_."
   [spec model]
   (log/debug (str "generate2: spec: " spec))
-  (mapcat (fn [bolt]
+  (flatten
+   (mapfn (fn [bolt]
             (let [comps-map (comp-paths-to-bolts-map bolt model 0 max-total-depth)
                   comp-paths (keys comps-map)
                   comp-bolts (map #(get comps-map %)
@@ -177,7 +182,7 @@
                                   comp-bolts
                                   0 max-total-depth
                                   bolt)))))
-          (lightning-bolts model spec 0 max-total-depth)))
+          (lightning-bolts model spec 0 max-total-depth))))

 (defn generate-n
   "Returns all possible expressions generated by the given language model, constrained by the given spec.


s/comp-paths-to-bolts-map/comp-path-to-bolts/

--- src/babel/generate.cljc
+++ src/babel/generate.cljc
@@ -103,24 +103,22 @@
               (flatten (vals
                         (or (:lexicon (:generate model)) (:lexicon model))))))))

-(defn comp-paths-to-bolts-map
-  "return a map between the set of all complements in the given _bolt_,and the lazy sequence of bolts for that spec."
-  [bolt comp-paths model depth max-depth]
-  (when (and (not (nil? bolt))
-             (not (empty? comp-paths)))
-    (mapfn #(let [spec (get-in bolt %)
-                  lexemes (get-lexemes model spec)
-                  bolts-at (if (< depth max-depth)
-                             (lightning-bolts
-                              model
-                              (get-in bolt %)
-                              depth max-depth))
-                  lexemes-before-phrases
-                  (lexemes-before-phrases depth max-depth)]
-              (if lexemes-before-phrases
-                (lazy-cat lexemes bolts-at)
-                (lazy-cat bolts-at lexemes)))
-           comp-paths)))
+(defn comp-path-to-bolts
+  "return a lazy sequence of bolts for all possible complements that can be added to the end of the _path_ within _bolt_."
+  [bolt path model depth max-depth]
+  (when (and (not (nil? bolt)))
+    (let [spec (get-in bolt path)
+          lexemes (get-lexemes model spec)
+          bolts-at (if (< depth max-depth)
+                     (lightning-bolts
+                      model
+                      (get-in bolt path)
+                      depth max-depth))
+          lexemes-before-phrases
+          (lexemes-before-phrases depth max-depth)]
+      (if lexemes-before-phrases
+        (lazy-cat lexemes bolts-at)
+        (lazy-cat bolts-at lexemes)))))

 (defn add-comps
   "given a bolt, return the lazy sequence of all bolts derived from this bolt after adding,
@@ -143,7 +141,8 @@
                     (if (= false (get-in bolt-at [:phrasal]))
                       [(do-defaults (assoc-in bolt path bolt-at) model)]
                       (let [comp-paths (find-comp-paths bolt-at)
-                            comp-bolts (comp-paths-to-bolts-map bolt-at comp-paths model (+ 1 depth) max-depth)]
+                            comp-bolts (map #(comp-path-to-bolts bolt-at % model (+ 1 depth) max-depth)
+                                            comp-paths)]
                         (when (not (some empty? comp-bolts))
                           (mapfn #(do-defaults (assoc-in bolt path %) model)
                                  (add-comps bolt-at
@@ -161,7 +160,9 @@
   (flatten
    (mapfn (fn [bolt]
             (let [comp-paths (find-comp-paths bolt)
-                  comp-bolts (comp-paths-to-bolts-map bolt comp-paths model 0 max-total-depth)]
+                  comp-bolts
+                  (map #(comp-path-to-bolts bolt % model 0 max-total-depth)
+                       comp-paths)]
               ;; filter by the following constraint:
               ;; that for every path that points to a complement of a bolt,
               ;; there is a non-empty set of bolts that satisfies


simplify (defn do-assocs)

simplify (defn do-assocs)

--- src/babel/generate.cljc
+++ src/babel/generate.cljc
@@ -84,10 +84,8 @@
             (map (fn [bolt-and-comps]
                    (log/debug (str "bolt-and-comps: " ((:morph-ps model) (get bolt-and-comps []))))
                    (do-defaults
-                    (let [bolt (get bolt-and-comps [])
-                          bolt-and-comps (dissoc bolt-and-comps [])]
-                      (do-assocs bolt
-                                 bolt-and-comps))
+                    (do-assocs (get bolt-and-comps [])
+                               (dissoc bolt-and-comps []))
                     model))
                  all-of-them))))

@@ -97,11 +95,10 @@
     accum
     (let [path (first (first paths-to-vals-at-path))]
       (do-assocs
-       (let [result
-             (assoc-in accum
-                       path
-                       (second (first paths-to-vals-at-path)))]
-         (dissoc-paths result [path]))
+       (dissoc-paths (assoc-in accum
+                               path
+                               (second (first paths-to-vals-at-path)))
+                     [path])
        (dissoc paths-to-vals-at-path path)))))

 (declare comp-path-to-bolts)


Add docstring + warning for caesium.binding

--- src/caesium/binding.clj
+++ src/caesium/binding.clj
@@ -1,4 +1,7 @@
 (ns caesium.binding
+  "Bindings to libsodium, using jnr-ffi.
+
+  Warning: crazy macro magic, here be dragons!"
   (:require [clojure.string :as s])
   (:import [jnr.ffi LibraryLoader]
            [jnr.ffi.annotations In Out Pinned LongLong]


Optimize things a bit.

Optimize things a bit.

--- src/cake/tasks/test.clj
+++ src/cake/tasks/test.clj
@@ -15,7 +15,7 @@
             [clansi.core :as ansi])
   (:import [java.io File]))

-(def ^:dynamic *difform* true)
+(def ^:dynamic *difform* (not (read-string (*config* "disable.difform" "false"))))

 (def + (fnil clojure.core/+ 0 0))

@@ -193,8 +193,7 @@
   "Specify which tests to run as arguments like: namespace, namespace/function, or :tag"
   "Use --auto to automatically run tests whenever your project code changes."
   {[difform?] :difform args :test}
-  (binding [*difform* (when (not= "true" (*config* "disable.difform"))
-                        (or (nil? difform?) (= "true" difform?)))]
+  (binding [*difform* (if difform? (read-string difform?) *difform*)]
     (let [opts (test-opts args)]
       (if (:auto *opts*)
         (do (clear-screen)


clojurecup text with my name

clojurecup text with my name

--- src/checkmate/views.clj
+++ src/checkmate/views.clj
@@ -21,7 +21,8 @@
            [:div.collapse.navbar-collapse.navbar-ex1-collapse
             [:ul.nav.navbar-nav
              [:li [:a {:href "/az"} "A-Z"]]
-             [:li [:a {:href "/new"} "New Checklist"]]]]]
+             [:li [:a {:href "/new"} "New Checklist"]]]
+            [:p.navbar-text.pull-right "A ClojureCup entry by Benjamin Klüglein"]]]
           [:div.container body]]))

 (defn landing-view []


simple-flake

simple-flake

--- src/clj_turtle/core.clj
+++ src/clj_turtle/core.clj
@@ -1,6 +1,8 @@
 (ns clj-turtle.core
   (:require [turtle.core :refer [draw!]]
             [turtle.renderer.vector :refer [->svg]]))
+
+(def base-angle 60)

 (defn- there-and-back
   [len]
@@ -23,7 +25,7 @@

 (defn- sector
   [angle len]
-  (let [angle-b (- 60 angle)
+  (let [angle-b (- base-angle angle)
         angle-c (- 120 (* 2 angle))
         angle-d (- 180 angle)
         sector-len (/ (/ len 2) (Math/cos (Math/toRadians angle-b)))]
@@ -31,14 +33,23 @@
      :left angle-c :fwd sector-len
      :right angle-d :fwd len]))

+(defn simple-flake
+  [len]
+  (let [single-arrow (concat
+                      (arrow len)
+                      [:fwd (* len 7/10)
+                       :right (* 2 base-angle)])
+        cycle-len (* 6 (count single-arrow))]
+    (take cycle-len (cycle single-arrow))))
+
 (defn flake
   [len star-len angle]
-  (let [star-gap (- len star-len (* (/ len 10) 3))
+  (let [star-gap (- len star-len (* len 3/10))
         single-part (concat
                      (arrow len)
                      [:fwd star-gap]
                      (sector angle star-len)
-                     [:right 60])
+                     [:right base-angle])
         cycle-len (* 6 (count single-part))]
     (take cycle-len (cycle single-part))))


remove function/closure allocation from variadic str

--- src/cljs/cljs/core.cljs
+++ src/cljs/cljs/core.cljs
@@ -1749,11 +1749,10 @@
          ""
          (.toString x)))
   ([x & ys]
-     ((fn [sb more]
-        (if more
-          (recur (. sb  (append (str (first more)))) (next more))
-          (.toString sb)))
-      (gstring/StringBuffer. (str x)) ys)))
+    (loop [sb (gstring/StringBuffer. (str x)) more ys]
+      (if more
+        (recur (. sb  (append (str (first more)))) (next more))
+        (.toString sb)))))

 (defn subs
   "Returns the substring of s beginning at start inclusive, and ending


First pass, simple text interaction

First pass, simple text interaction

--- src/cljs/shop/core.cljs
+++ src/cljs/shop/core.cljs
@@ -15,10 +15,11 @@
 ;; ──────────────────────────────────────────────────────────────────────
 ;; Utils

-(def audio false)
+(def *audio* false)
+(def *api-token* "X45BKBNG6KKPYUVAWGYQZ3YG2VE3GHZF")

 (defn ^:export say [msg]
-  (if audio
+  (if *audio*
     (.speak js/speechSynthesis (new js/SpeechSynthesisUtterance msg))
     (.log js/console msg)))

@@ -53,24 +54,37 @@

 (defonce state
   (atom {:cart {}
-         :text "Hello Chestnut!"
+         :view :main
          }))
-

 ;; ──────────────────────────────────────────────────────────────────────
 ;; Main

+(defn handle-input [data owner]
+  (let [node (om/get-node owner "query")]
+    (.log js/console (.-value node))
+    (set! (.-value node) "")))
+
+(defcomponent input [data owner]
+  (render [_]
+    (i/input {:type "text" :ref "query"
+              :auto-focus true
+              :placeholder "Hello, what can I help you find today?"
+              :bs-style "primary"
+              :on-key-down #(when (= (.-key %) "Enter")
+                              (handle-input data owner))})))
+
+
 (def intro "Hello, what can I help you find today?")
-(def api-token "X45BKBNG6KKPYUVAWGYQZ3YG2VE3GHZF")
+
+
+(defcomponent app [data owner]
+  (render [_]
+    (dom/div {:class "container-fluid"}
+      (case (:view data)
+        :main (om/build input data)))))

 (defn main []
   ;; (def mic (new-mic))
-  ;; (.connect mic api-token)
-  (om/root
-    (fn [app owner]
-      (reify
-        om/IRender
-        (render [_]
-          (dom/h1 nil (:text app)))))
-    state
-    {:target (. js/document (getElementById "app"))}))
+  ;; (.connect mic *api-token*)
+  (om/root app state {:target (. js/document (getElementById "app"))}))


Make return as alias of now multiarity pure.

--- src/cljx/cats/core.cljx
+++ src/cljx/cats/core.cljx
@@ -14,17 +14,21 @@
   `(binding [*m-context* ~ctx]
      ~@body))

-(defn return
-  "Context dependent version of pure."
-  [v]
-  (p/pure *m-context* v))
-
 (defn pure
-  "Takes a context type av value and any arbitrary
-  value v, and return v value wrapped in a minimal
-  contex of same type of av."
-  [av v]
-  (p/pure av v))
+  "Given any value v, return it wrapped in
+  default/effect free context.
+
+  This is multiarity function that with arity pure/1
+  it uses the dynamic scope for resolve the current
+  context. With pure/2, you can force specific context
+  value."
+  ([v]
+     (p/pure *m-context* v))
+  ([av v]
+     (p/pure av v)))
+
+(def ^{:doc "This is a monad version of pure."}
+  return pure)

 (defn bind
   "Given a value inside monadic context mv and any function,


Add config! macro to change existing element's attributes

--- src/clojure/neko/ui.clj
+++ src/clojure/neko/ui.clj
@@ -152,3 +152,10 @@
      (make-ui-element tree nil `context))
   ([custom-context tree]
      (make-ui-element tree nil custom-context)))
+
+(defmacro config!
+  [el-type element & attributes]
+  (let [attributes (apply hash-map attributes)
+        obj (gensym (name el-type))]
+    `(let [~obj ~element]
+       ~@(process-attributes el-type obj attributes nil))))


typo in url

typo in url

--- src/cljs/work_sessions/components/session_no_found_page.cljs
+++ src/cljs/work_sessions/components/session_no_found_page.cljs
@@ -11,6 +11,6 @@
   [:div.session-not-found
    [:h4
     "It's too early! Please follow this "
-    [:a {:href "/session-two-room"}
+    [:a {:href "http://sws.eeefff.org/session-two-room"}
      "link"]
     " on 2 June 13:30 Helsinki time"]])


Fix the tr-mm bug when matrices have different layouts.

--- src/clojure/uncomplicate/neanderthal/internal/host/cblas.clj
+++ src/clojure/uncomplicate/neanderthal/internal/host/cblas.clj
@@ -344,14 +344,16 @@
 (defmacro tr-mm
   ([method alpha a b left]
    `(let [nav# (navigator ~b)
-          reg# (region ~a)]
-      (~method (.layout nav#) (if ~left CBLAS/SIDE_LEFT CBLAS/SIDE_RIGHT) (.uplo reg#)
-       (if (= nav# (navigator ~a)) CBLAS/TRANSPOSE_NO_TRANS CBLAS/TRANSPOSE_TRANS)
+          reg# (region ~a)
+          nav-eq# (= nav# (navigator ~a))]
+      (~method (.layout nav#) (if ~left CBLAS/SIDE_LEFT CBLAS/SIDE_RIGHT)
+       (if nav-eq# (.uplo reg#) (flip-uplo (.uplo reg#)))
+       (if nav-eq# CBLAS/TRANSPOSE_NO_TRANS CBLAS/TRANSPOSE_TRANS)
        (.diag reg#) (.mrows ~b) (.ncols ~b)
        ~alpha (.buffer ~a) (.offset ~a) (.stride ~a) (.buffer ~b) (.offset ~b) (.stride ~b))
       ~b))
   ([a]
-   `(dragan-says-ex "Out-of-place mv! is not supported for TR matrices." {:a (info ~a)})))
+   `(dragan-says-ex "Out-of-place mm! is not supported for TR matrices." {:a (info ~a)})))

 ;; =============== Common SY matrix macros and functions ============================


lein profile: bump ancient dependencies

lein profile: bump ancient dependencies

Tweak several others to get it working again.

Well, at least working enough to start a REPL in a basic project.

--- lein/profiles.clj
+++ lein/profiles.clj
@@ -1,60 +1,59 @@
 {:user {:aliases {"slamhound" ["run" "-m" "slam.hound"]}  ; Q: Will I ever find occasion to actually use this?
-        :dependencies [[alembic "0.3.2"]   ; Q: what's this really for? A: modifying CLASSPATH at runtime
+        :dependencies [;; Q: what's this really for? A: modifying CLASSPATH at runtime
+                       [alembic "0.3.2" :exclusions [org.tcrawley/dynapath]]
                        [commons-logging "1.2"]
-                       ;; We inherit this next through vinyasa.
-                       ;; Shouldn't need to declare it
-                       ;; Actually, this doesn't make sense in here. Its entire purpose
-                       ;; in life is to split away from vinyasa. It's a general purpose
-                       ;; library, such as useful.
-                       ;; TODO: Verify that nothing else in here depends on it.
-                       ;; (that seems to be done)
-                       ;; (I'm pretty sure it doesn't, because my general profiles.clj
-                       ;; doesn't have this)
-                       #_[im.chit/hara "2.1.11"]
                        ;; TODO: Replace this with whatever replaced it
                        ;; Careful: 0.3.4 was working OK
                        ;; Q: Did hara replace this too?
-                       [im.chit/vinyasa "0.4.3" :exclusions [org.codehaus.plexus/plexus-utils]]
-                       #_[io.aviso/pretty "0.1.24"]
-                       [leiningen #= (leiningen.core.main/leiningen-version)  :exclusions [cheshire
-                                                                                com.fasterxml.jackson.core/jackson-core
-                                                                                com.fasterxml.jackson.dataformat/jackson-dataformat-smile
-                                                                                commons-logging
-                                                                                commons-codec
-                                                                                #_org.apache.httpcomponents/httpclient
-                                                                                #_org.apache.httpcomponents/httpcore
-                                                                                #_org.apache.maven.wagon/wagon-http
-                                                                                org.apache.maven.wagon/wagon-http-shared4
-                                                                                org.apache.maven.wagon/wagon-provider-api
-                                                                                org.clojure/clojure
-                                                                                org.clojure/tools.reader
-                                                                                org.jsoup/jsoup
-                                                                                potemkin
-                                                                                slingshot]]
+                       #_[im.chit/vinyasa "0.4.7" :exclusions [im.chit/hara.reflect
+                                                             org.clojure/clojure
+                                                             org.codehaus.plexus/plexus-utils
+                                                             org.slf4j/jcl-over-slf4j]]
+                       [leiningen #= (leiningen.core.main/leiningen-version) :exclusions [cheshire
+                                                                                com.fasterxml.jackson.core/jackson-core
+                                                                                com.fasterxml.jackson.dataformat/jackson-dataformat-smile
+                                                                                #_commons-io
+                                                                                commons-logging
+                                                                                commons-codec
+                                                                                #_org.apache.httpcomponents/httpclient
+                                                                                #_org.apache.httpcomponents/httpcore
+                                                                                #_org.apache.maven.wagon/wagon-http
+                                                                                org.apache.maven.wagon/wagon-http-shared4
+                                                                                org.apache.maven.wagon/wagon-provider-api
+                                                                                org.clojure/clojure
+                                                                                org.clojure/tools.reader
+                                                                                org.jsoup/jsoup
+                                                                                potemkin
+                                                                                slingshot]]
                        ;; Q: How many of any of the rest of these do I actually use?
                        ;; This one's gone
                        #_[nrepl-inspect "0.4.1"]
                        [org.apache.maven.wagon/wagon-provider-api "2.10"]
-                       [org.codehaus.plexus/plexus-utils "3.0.22"]
+                       [org.codehaus.plexus/plexus-utils "3.0.24"]
                        ;; I use this everywhere. But it doesn't belong in here
                        #_[org.clojure/tools.namespace "0.2.10"]
                        ;; I know I have a lot of projects that transitively rely on this, but they really shouldn't
                        #_[org.clojure/tools.nrepl "0.2.12" :exclusions [org.clojure/clojure]]
-                       [pjstadig/humane-test-output "0.8.0"]
+                       [pjstadig/humane-test-output "0.8.1"]
                        ;; Q: Is there any point to this next one?
                        #_[ritz/ritz-nrepl-middleware "0.7.0"]
                        ;; This approach is long deprecated.
                        ;; See its README and put it into :aliases instead
                        #_[slamhound "1.5.5"]
-                       [slingshot "0.12.2" :exclusions [org.clojure/clojure]]]
-        :injections [(require '[vinyasa.inject :as inject])
+                       ;; Q: Do I actually use this anywhere/for anything?
+                       ;; A: leiningen does.
+                       ;; Q: Why am/was I overriding?
+                       #_[slingshot "0.12.2" :exclusions [org.clojure/clojure]]]
+        :injections [#_(require '[vinyasa.inject :as inject])
                      ;; TODO: call install-pretty-exception
                      #_(require 'io.aviso.repl)
-                     (inject/in
+                     #_(inject/in
                       ;; Default injection ns is .
                       [vinyasa.inject :refer [inject [in inject-in]]]
                       [alembic.still [distill pull]]  ; Q: what is/was this?
-                      [cemerick.pomegranate add-classpath add-dependencies get-classpath resources]
+                      ;; I still want this.
+                      ;; Q: Where did it go?
+                      #_[cemerick.pomegranate add-classpath add-dependencies get-classpath resources]

                       ;;; At least 90% certain that I don't want any of the rest of this
                       ;; Inject into clojure.core
@@ -71,7 +70,7 @@
                      (require 'pjstadig.humane-test-output)
                      (pjstadig.humane-test-output/activate!)]
         ;;:local-repo "repo"
-        :plugins [[com.jakemccrary/lein-test-refresh "0.14.0"]
+        :plugins [[com.jakemccrary/lein-test-refresh "0.16.0"]
                   [jonase/eastwood "0.2.3" :exclusions [org.clojure/clojure]]
                   ;; Check for out-dated plugins in here using `lein ancient check-profiles`
                   [lein-ancient "0.6.10" :exclusions [cheshire


add quote danger to cached state

add quote danger to cached state

--- lib/src/parinfer/indent_mode.cljc
+++ lib/src/parinfer/indent_mode.cljc
@@ -218,7 +218,7 @@

 (defn get-cached-state
   [state]
-  (select-keys state [:stack :insert]))
+  (select-keys state [:stack :insert :quote-danger?]))

 (defn commit-cached-state
   "Cache a subset of the state after some event.


added some docstrings and opts to text io

--- src/datasplash/core.clj
+++ src/datasplash/core.clj
@@ -241,7 +241,7 @@
    {:side-inputs {:docstr "Adds a map of PCollectionViews as side inputs to the underlying ParDo Transform. They can be accessed there by key in the datasplash.dv/*side-inputs* var."
                   :action (fn [transform inputs]
                             (.withSideInputs transform (map val (sort-by key inputs))))}
-    :without-coercion-to-clj {:docstr "Avoids coercing Dataflow types to Clojure, like KV. Coercion will happe, by default"}}))
+    :without-coercion-to-clj {:docstr "Avoids coercing Dataflow types to Clojure, like KV. Coercion will happen by default"}}))

 (defn map-op
   ([transform label coder]
@@ -539,18 +539,32 @@
                                compression-type-enum
                                (fn [transform enum] (.withCompressionType transform enum)))}})

+(def text-writer-schema
+  {:num-shards {:docstr "Selects the desired number of output shards (file fragments). 0 to let the system decide (recommended)."
+                :action (fn [transform shards] (.withNumShards transform shards))}
+   :without-sharding {:docstr "Forces a single file output."
+                      :action (fn [transform] (.withoutSharding transform))}
+   :without-validation {:docstr "Disables validation of path existence in Google Cloud Storage until runtime."
+                        :action (fn [transform] (.withoutValidation transform))}
+   :shard-name-template {:docstr "Uses the given shard name template."
+                         :action (fn [transform tpl] (.withShardNameTemplate transform tpl))}
+   :suffix {:docstr "Uses the given filename suffix."
+            :action (fn [transform suffix] (.withSuffix transform suffix))}})
+
 (defn write-text-file
-  {:doc "Writes a PCollection of Strings to disk or Google Storage, with records separated by newlines.
+  {:doc (with-opts-docstr
+          "Writes a PCollection of Strings to disk or Google Storage, with records separated by newlines.
 See https://cloud.google.com/dataflow/java-sdk/JavaDoc/com/google/cloud/dataflow/sdk/io/TextIO.Write.html

   Example:
     (write-text-file \"gs://target/path\" pcoll)"
+          base-schema text-writer-schema)
    :added "0.1.0"}
   ([to options ^PCollection pcoll]
    (let [opts (assoc options :label (str "write-text-file-to-"
                                          (clean-filename to)))]
      (-> pcoll
-         (.apply (with-opts base-schema opts
+         (.apply (with-opts (merge base-schema text-writer-schema) opts
                    (TextIO$Write/to to))))))
   ([to pcoll] (write-text-file to {} pcoll)))

@@ -584,11 +598,18 @@
              (from-edn options))))))

 (defn read-edn-file
+  {:doc (with-opts-docstr "Reads a PCollection of edn strings from disk or Google Storage, with records separated by newlines.
+See https://cloud.google.com/dataflow/java-sdk/JavaDoc/com/google/cloud/dataflow/sdk/io/TextIO.Read.html
+
+  Example:
+    (read-edn-file \"gs://target/path\" pcoll)"
+          base-schema text-reader-schema)
+   :added "0.1.0"}
   ([from options ^Pipeline p]
    (let [opts (assoc options :label (str "read-edn-file-from-"
                                          (clean-filename from)))]
      (-> p
-         (.apply (with-opts base-schema opts
+         (.apply (with-opts (merge base-schema text-reader-schema) opts
                    (read-edn-file-transform from opts))))))
   ([from p] (read-edn-file from {} p)))

@@ -602,10 +623,18 @@
              (write-text-file to options))))))

 (defn write-edn-file
+  {:doc (with-opts-docstr
+          "Writes a PCollection of edn strings to disk or Google Storage, with records separated by newlines.
+See https://cloud.google.com/dataflow/java-sdk/JavaDoc/com/google/cloud/dataflow/sdk/io/TextIO.Write.html
+
+  Example:
+    (write-edn-file \"gs://target/path\" pcoll)"
+          base-schema text-writer-schema)
+   :added "0.1.0"}
   ([to options ^PCollection pcoll]
    (let [opts (assoc options :label (str "write-edn-file-to-" (clean-filename to)))]
      (-> pcoll
-         (.apply (with-opts base-schema opts
+         (.apply (with-opts (merge base-schema text-writer-schema) opts
                    (write-edn-file-transform to opts))))))
   ([to pcoll] (write-edn-file to {} pcoll)))

@@ -677,6 +706,13 @@
   ([specs join-fn] (join-by {} specs join-fn)))

 (defn ddistinct
+  {:doc (with-opts-docstr
+          "Removes duplicate element from PCollection.
+See https://cloud.google.com/dataflow/java-sdk/JavaDoc/com/google/cloud/dataflow/sdk/transforms/RemoveDuplicates.html
+  Example:
+    (ds/distinct pcoll)"
+          base-schema)
+   :added "0.1.0"}
   ([options ^PCollection pcoll]
    (let [opts (assoc options :label :distinct)]
      (-> pcoll
@@ -684,7 +720,18 @@
                    (RemoveDuplicates/create))))))
   ([pcoll] (ddistinct {} pcoll)))

+(def scoped-ops-schema
+  {:scope {:docstr "Scope given to the combinating operation. One of (:globally :per-key)."}})
+
 (defn sample
+  {:doc (with-opts-docstr
+          "Takes samples of the elements in a PCollection, or samples of the values associated with each key in a PCollection of KVs.
+See https://cloud.google.com/dataflow/java-sdk/JavaDoc/com/google/cloud/dataflow/sdk/transforms/Sample.html
+
+  Example:
+    (ds/sample 100 {:scope :per-key} pcoll)"
+          base-schema scoped-ops-schema)
+   :added "0.1.0"}
   ([size {:keys [scope] :as options} ^PCollection pcoll]
    (let [opts (assoc options :label (keyword "sample-" (if scope (name scope) "any")))]
      (-> pcoll
@@ -692,7 +739,8 @@
                    (cond
                      (#{:global :globally} scope) (Sample/fixedSizeGlobally size)
                      (#{:local :per-key} scope) (Sample/fixedSizePerKey size)
-                     :else (Sample/any size)))))))
+                     :else (Sample/any size))))
+         (cond-> (:coder opts) (.setCoder (:coder opts))))))
   ([size pcoll] (sample size {} pcoll)))

 (defn dflatten


Speak English!

Speak English!

--- src/devtools/debug.cljs
+++ src/devtools/debug.cljs
@@ -9,7 +9,7 @@
 (def logger-name-stuffer "_")
 (def logger-name-padding 8)

-(def ^:dynamic *inited* false)
+(def ^:dynamic *initialized* false)
 (def ^:dynamic *indent* 0)
 (def ^:dynamic *console* nil)

@@ -65,9 +65,9 @@
                              (.apply original-log-fn js/console (into-array args))))))

 (defn init! []
-  (if *inited*
-    (println "devtools.debug already inited, nothing to do")
+  (if *initialized*
+    (println "devtools.debug already initialized, nothing to do")
     (do
       (init-logger!)
       (hijack-console!)
-      (set! *inited* true))))+      (set! *initialized* true))))


The create-config function was never called

--- src/freecoin/routes.clj
+++ src/freecoin/routes.clj
@@ -63,4 +63,5 @@
       (throw (Exception. (format "Error constructing url for action '%s', with params '%s'" action params))))))

 (defn absolute-path [action & params]
-  (str (-> config/create-config config/base-url) (apply path action params)))
+  (let [base-url (-> (config/create-config) config/base-url)]
+    (str base-url (apply path action params))))


cleanup

cleanup

--- src/cljs/swarmpit/component/stack/info.cljs
+++ src/cljs/swarmpit/component/stack/info.cljs
@@ -125,18 +125,6 @@
    {:onClick #(delete-stack-handler stack-name)
     :icon    (comp/svg icon/trash-path)
     :name    "Delete stack"}])
-
-;(defn- stack-render-item
-;  [stack-name name-key default-render-item]
-;  (fn [item row]
-;    (case (key item)
-;      :stack (if (not= stack-name (val item))
-;               (label/info "external"))
-;      (if (= name-key (key item))
-;        (if (= stack-name (:stack row))
-;          (utils/trim-stack stack-name (val item))
-;          (val item))
-;        (default-render-item item row)))))

 (rum/defc form-services-graph < rum/static [services]
   (let [data (->> services


Add a deprecation warning for unversioned URLs

--- src/com/puppetlabs/puppetdb/http/server.clj
+++ src/com/puppetlabs/puppetdb/http/server.clj
@@ -4,6 +4,7 @@
 ;; application.

 (ns com.puppetlabs.puppetdb.http.server
+  (:require [clojure.tools.logging :as log])
   (:use [com.puppetlabs.puppetdb.http.v1 :only (v1-app)]
         [com.puppetlabs.puppetdb.http.experimental :only (experimental-app)]
         [com.puppetlabs.middleware :only
@@ -12,7 +13,14 @@
         [net.cgrand.moustache :only (app)]
         [ring.middleware.resource :only (wrap-resource)]
         [ring.middleware.params :only (wrap-params)]
-        [ring.util.response :only (redirect)]))
+        [ring.util.response :only (redirect header)]))
+
+(defn backward-compatible-v1-app
+  [request]
+  (let [result (v1-app request)
+        warning (format "Use of unversioned APIs is deprecated; please use /v1%s" (:uri request))]
+    (log/warn warning)
+    (header result "X-Deprecation" warning)))

 (def routes
   (app
@@ -24,7 +32,7 @@

     ;; Mount the v1 app at / for backward compatibility with unversioned API
     [&]
-    {:any v1-app}))
+    {:any backward-compatible-v1-app}))

 (defn build-app
   "Generate a Ring application that handles PuppetDB requests


placement section info in case of no constraints

--- src/cljs/swarmpit/component/service/info/deployment.cljs
+++ src/cljs/swarmpit/component/service/info/deployment.cljs
@@ -55,8 +55,10 @@
             {:item true
              :xs   12}
             (form/subsection "Placements")
-            (map #(comp/chip {:label (:rule %)
-                              :key   (str "lp-" (:rule %))}) placement))
+            (if (empty? placement)
+              (html [:span "No placement constraints defined."])
+              (map #(comp/chip {:label (:rule %)
+                                :key   (str "lp-" (:rule %))}) placement)))
           (comp/grid
             {:item true
              :xs   12


[proxy-viewer] always show docs video

[proxy-viewer] always show docs video

--- src/cljs/work_sessions/components/proxy_viewer_page.cljs
+++ src/cljs/work_sessions/components/proxy_viewer_page.cljs
@@ -23,7 +23,7 @@

          [headers-view]

-         (when @is-docs-visible?
+         (when true ;;@is-docs-visible?
            [:div.documentation-container
             [:div.documentation
              [:div.responsive-embed.widescreen


nodes are no longer labelled by gts name

--- src/grape/tx_cypher.clj
+++ src/grape/tx_cypher.clj
@@ -36,8 +36,8 @@
     (str k " (" nid
          (let [l (:label c)]
            (if (nil? l)
-             (graphlabel)
-             (str  (graphlabel) ":" (resolve-value s l))))
+             ""
+             (str ":" (resolve-value s l))))
          (asserts->cypher s (:asserts c))
          ") "
          )))
@@ -48,7 +48,7 @@
     (str k " (" (:src c) ")-[" (:id c)
          (let [l (:label c)]
            (if (nil? l)
-             (graphlabel)
+             ""
              (str ":" (resolve-value s l))))
          (asserts->cypher s (:ass c))
          "]->(" (:tar c) ")")))


CMR-4350 - Added metadata-db integration tests for new variable constraint.

--- metadata-db-app/int_test/cmr/metadata_db/int_test/concepts/variable_save_test.clj
+++ metadata-db-app/int_test/cmr/metadata_db/int_test/concepts/variable_save_test.clj
@@ -7,30 +7,36 @@
    [cmr.metadata-db.int-test.concepts.concept-save-spec :as c-spec]
    [cmr.metadata-db.int-test.utility :as util]))

-(def provider-id "REG_PROV")
-
-;;; fixtures
+;;; fixtures & one-off utility functions
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

 (use-fixtures :each (util/reset-database-fixture
-                     {:provider-id provider-id :small false}))
+                     {:provider-id "PROV1" :small false}
+                     {:provider-id "PROV2" :small false}))

 (defmethod c-spec/gen-concept :variable
   [_ provider-id uniq-num attributes]
-  (util/variable-concept provider-id uniq-num attributes))
+  (util/variable-concept "PROV1" uniq-num attributes))
+
+(defn- get-revisions
+  [concept-id initial-revision-id second-revision-id tombstone-revision-id
+   final-revision-id]
+  (mapv #(:concept (util/get-concept-by-id-and-revision concept-id %))
+        [initial-revision-id second-revision-id tombstone-revision-id
+         final-revision-id]))

 ;; tests
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-(deftest save-variable-test
-  (c-spec/general-save-concept-test :variable [provider-id]))
+(deftest save-variable
+  (c-spec/general-save-concept-test :variable ["PROV1"]))

-(deftest save-variable-with-missing-required-parameters-test
+(deftest save-variable-with-missing-required-parameters
   (c-spec/save-test-with-missing-required-parameters
-    :variable [provider-id] [:concept-type :provider-id :native-id :extra-fields]))
+    :variable ["PROV1"] [:concept-type :provider-id :native-id :extra-fields]))

-(deftest save-variable-created-at-test
+(deftest save-variable-created-at
   (testing "Save variable multiple times gets same created-at"
-    (let [initial-var (util/variable-concept provider-id 2)
+    (let [initial-var (util/variable-concept "PROV1" 2)
           ;; 1) Save a variable
           ;; 2) Then wait for a small period of time before saving it again
           ;; 3) Then wait again and save a tombstone.
@@ -50,15 +56,43 @@
                                                 concept-id)
           _ (Thread/sleep 100)
           {final-revision-id :revision-id} (util/save-concept initial-var)
-          [initial-revision
-           second-revision
-           tombstone
-           final-revision] (mapv #(:concept (util/get-concept-by-id-and-revision concept-id %))
-                                 [initial-revision-id
-                                  second-revision-id
-                                  tombstone-revision-id
-                                  final-revision-id])]
-      (is (util/created-at-same? initial-revision
-                                 second-revision
-                                 tombstone
-                                 final-revision)))))
+          revisions (get-revisions concept-id initial-revision-id
+                                   second-revision-id tombstone-revision-id
+                                   final-revision-id)]
+      (is (apply util/created-at-same? revisions)))))
+
+(deftest save-variable-with-conflicting-native-id
+  (testing "Save a variable"
+    (let [var1 (util/variable-concept "PROV1" 1)
+          {:keys [status revision-id concept-id]} (util/save-concept var1)]
+      (is (= status 201))
+      (is (= 1 revision-id))
+      (testing "and another with all the same data"
+        (let [var2 var1
+              {:keys [status revision-id]} (util/save-concept var1)]
+          (is (= 201 status))
+          (is (= 2 revision-id))))
+      (testing "and another with same data but different provider"
+        (let [var3 (util/variable-concept "PROV2" 1)
+              {:keys [status revision-id]} (util/save-concept var3)]
+          (is (= status 201))
+          (is (= 1 revision-id))))
+      (testing "and another the same data but with a different native-id"
+        (let [var4 (assoc var1 :native-id "var-native-different")
+              failed-concept (util/save-concept var4)
+              failed-revision-id 2
+              failed-concept-id "V1200000002-PROV1"]
+          (is (= 409 (:status failed-concept)))
+          (is (= [(format (str "Revision [%s] of concept [%s] has the same "
+                               "provider [%s] and variable name [%s] but "
+                               "different native id [%s] than the new concept "
+                               "[%s] with revision [%s] and native id [%s].")
+                          failed-revision-id
+                          concept-id
+                          (:provider-id var1)
+                          (get-in var1 [:extra-fields :variable-name])
+                          (:native-id var1)
+                          failed-concept-id
+                          revision-id
+                          (:native-id var4))]
+                  (:errors failed-concept))))))))


code formatting tweak

code formatting tweak

--- src/kmp_search/core.clj
+++ src/kmp_search/core.clj
@@ -63,9 +63,8 @@
              matches []]
         (if (neg? read-count)
           matches
-          (let [new-context (search context buffer read-count)
-                match (match new-context)]
-            (if match
+          (let [new-context (search context buffer read-count)]
+            (if-let [match (match new-context)]
               (recur new-context read-count (conj matches match))
               (recur new-context (.read ins buffer) matches))))))))


Nicer error message if Graphviz is not installed.

--- src/leiningen/dolly.clj
+++ src/leiningen/dolly.clj
@@ -162,6 +162,8 @@
             _ (handle-errwarn ns-opts)
             ns-info (ns/namespaces-in-dirs ns-opts)
             _ (handle-errwarn ns-info)
+;;            _ (println "jafinger-dbg: ns-info")
+;;            _ (pp/pprint ns-info)
             graph-args (ns/ns-info->graph-args ns-info)]
         (if (contains? #{nil :text :dot} (:format ns-info))
           ;; Then don't require rhizome.viz, since by default it pops
@@ -179,22 +181,31 @@
                   graph->image (ns-resolve 'rhizome.viz 'graph->image)
                   save-image (ns-resolve 'rhizome.viz 'save-image)
                   view-graph (ns-resolve 'rhizome.viz 'view-graph)]
-              (case (:format ns-info)
-                :svg (let [svg-fname "nsdeps.svg"]
-                       (spit svg-fname (apply graph->svg graph-args))
-                       (println "Wrote file" svg-fname))
-                :png (let [png-fname "nsdeps.png"]
-                       (save-image (apply graph->image graph-args) png-fname)
-                       (println "Wrote file" png-fname))
-                :window (do
-                          (apply view-graph graph-args)
-                          ;; TBD: If I don't do something to delay the
-                          ;; program exiting here, the window is shown
-                          ;; but then is closed immediately.  Is there a
-                          ;; way to make this program end only when
-                          ;; someone closes the new window?
-                          (println "Delaying quitting until you press return, otherwise the new window will close:")
-                          (read-line)))))))
+              (try
+                (case (:format ns-info)
+                  :svg (let [svg-fname "nsdeps.svg"]
+                         (spit svg-fname (apply graph->svg graph-args))
+                         (println "Wrote file" svg-fname))
+                  :png (let [png-fname "nsdeps.png"]
+                         (save-image (apply graph->image graph-args) png-fname)
+                         (println "Wrote file" png-fname))
+                  :window (do
+                            (apply view-graph graph-args)
+                            ;; TBD: If I don't do something to delay the
+                            ;; program exiting here, the window is shown
+                            ;; but then is closed immediately.  Is there a
+                            ;; way to make this program end only when
+                            ;; someone closes the new window?
+                            (println "Delaying quitting until you press return, otherwise the new window will close:")
+                            (read-line)))
+                (catch java.io.IOException e
+                  (let [msg (.getMessage e)]
+                    (if (re-find #"Cannot run program \"dot\".* No such file" msg)
+                      (binding [*out* *err*]
+                        (println (format "Could not find program 'dot'.
+Output format %s requires installing Graphviz (http://www.graphviz.org)"
+                                         (:format ns-info))))
+                      (throw e)))))))))

       ("ls" "list-clones")
       (println "list-clones not implemented yet")


Moved mtolman rle solution back since clojure.test isn't cljs.

--- src/main/cljc/clojure_club/rle/mtolman.cljc
+++ src/main/cljc/clojure_club/rle/mtolman.cljc
@@ -1,27 +0,0 @@
-(ns clojure-club.rle.mtolman
-  (:require [clojure.string :as str]))
-(use 'clojure.test)
-
-(defn rle-encode [input]
-  (if
-    (= (count input) 0)
-    ""
-    (let [first-letter (first input)
-          size-cur-seq (count (take-while #(= % first-letter) input))
-          rest-encoded (rle-encode (subs input size-cur-seq))]
-      (str size-cur-seq first-letter rest-encoded))))
-
-(is (= "12W1B12W3B24W1B14W" (rle-encode "WWWWWWWWWWWWBWWWWWWWWWWWWBBBWWWWWWWWWWWWWWWWWWWWWWWWBWWWWWWWWWWWWWW")))
-
-(defn rle-expand-seq [input]
-  (-> input (first) (Integer/parseInt) (repeat (second input)) str/join))
-
-(is (= "BBBB" (rle-expand-seq ["4", "B"])))
-
-(defn rle-decode [input]
-  (let [rle-pieces (re-seq #"(\d+)([\w\s])" input)
-        rle-seq (map rest rle-pieces)]
-    (str/join (map rle-expand-seq rle-seq))))
-
-(is (= "WWWWWWWWWWWWBWWWWWWWWWWWWBBBWWWWWWWWWWWWWWWWWWWWWWWWBWWWWWWWWWWWWWW" (rle-decode "12W1B12W3B24W1B14W")))
-


bugfix: config moved to config, also for extracts

--- src/main/clojure/pdok/featured/extracts.clj
+++ src/main/clojure/pdok/featured/extracts.clj
@@ -2,7 +2,7 @@
    (:require [pdok.featured.mustache  :as m]
              [pdok.postgres :as pg]
              [pdok.featured.tiles :as tiles]
-             [pdok.featured.core :as core]
+             [pdok.featured.config :as config]
              [pdok.featured.json-reader :as json-reader]
              [clojure.edn :as edn]
              [clojure.java.jdbc :as j]))
@@ -48,9 +48,9 @@
   "Inserts the xml-features and tile-set in an extract schema based on dataset and feature-type,
    if schema or table doesn't exists it will be created."
   (do
-   (create-extract-collection core/data-db (str dataset "extract") feature-type)
+   (create-extract-collection config/data-db (str dataset "extract") feature-type)
    (doseq [[tiles xml-feature] rendered-features]
-     (jdbc-insert core/data-db feature-type nil nil (vec tiles) xml-feature nil))))
+     (jdbc-insert config/data-db feature-type nil nil (vec tiles) xml-feature nil))))

 (defn file-to-features [path dataset]


[PDOK-1023] timeline cleanup * _all_versions column removed * update function removed (replaced by insert&delete) * config field name fix

--- src/main/clojure/pdok/featured/timeline.clj
+++ src/main/clojure/pdok/featured/timeline.clj
@@ -42,7 +42,6 @@
                [:collection "varchar(255)"]
                [:feature_id "varchar(100)"]
                [:version "uuid"]
-               [:all_versions "uuid[]"]
                [:valid_from "timestamp without time zone"]
                [:valid_to "timestamp without time zone"]
                [:feature "text"]
@@ -158,13 +157,13 @@

 (defn- new-current-sql []
   (str "INSERT INTO " (qualified-current)
-       " (dataset, collection, feature_id, version, all_versions, valid_from, valid_to, feature, tiles)
-VALUES (?, ?, ? ,?, ?, ?, ?, ?, ?)"))
+       " (dataset, collection, feature_id, version, valid_from, valid_to, feature, tiles)
+VALUES (?, ?, ? ,?, ?, ?, ?, ?)"))

 (defn- new-current
   ([db features]
    (try
-     (let [transform-fn (juxt :_dataset :_collection :_id :_version :_all_versions
+     (let [transform-fn (juxt :_dataset :_collection :_id :_version
                               :_valid_from :_valid_to pg/to-json :_tiles)
            records (map transform-fn features)]
        (j/execute! db (cons (new-current-sql) records) :multi? true :transaction? false))
@@ -192,24 +191,6 @@
           for-cache
           (map (fn [[ds col fid f]] [ [ds col fid]] (pg/from-json f) ) (drop 1 results))]
       for-cache)))
-
-(defn- update-current-sql []
-  (str "UPDATE " (qualified-current) "
-SET feature = ?,
-    version = ?,
-    all_versions = ?,
-    valid_from = ?,
-    valid_to = ?,
-    tiles = ?
-WHERE dataset = ? AND collection = ? AND  feature_id = ?"))
-
-(defn- update-current [db features]
-  (try
-    (let [transform-fn (juxt pg/to-json :_version :_all_versions :_valid_from :_valid_to
-                             :_tiles :_dataset :_collection :_id)
-          records (map transform-fn features)]
-      (j/execute! db (cons (update-current-sql) records) :multi? true :transaction? false))
-    (catch java.sql.SQLException e (j/print-sql-exception-chain e))))

 (defn- delete-current-sql []
   (str "DELETE FROM " (qualified-current)
@@ -342,7 +323,7 @@
                          (load-current-feature-cache db dataset collection)))
         new-current-batch-size (or (:new-current-batch-size config) (:batch-size config) 10000)
         new-current-batch (ref (clojure.lang.PersistentQueue/EMPTY))
-        delete-current-batch-size (or (:update-current-batch-size config) (:batch-size config) 10000)
+        delete-current-batch-size (or (:delete-current-batch-size config) (:batch-size config) 10000)
         delete-current-batch (ref (clojure.lang.PersistentQueue/EMPTY))
         new-history-batch-size (or (:new-history-batch-size config) (:batch-size config) 10000)
         new-history-batch (ref (clojure.lang.PersistentQueue/EMPTY))


remove some old crap from editor and add in a codemirror-flags behavior

Signed-off-by: Chris Granger <5654cde260ae99bc4d30054171b8bcd902efd19a@gmail.com>

--- src/lt/objs/editor.cljs
+++ src/lt/objs/editor.cljs
@@ -34,37 +34,12 @@
 ;; Creating
 ;;*********************************************************

-(def ed-id (atom 0))
-
-(defn ed-with-elem [$elem opts]
-  (js/CodeMirror (if (.-get $elem)
-                   (.get $elem 0)
-                   $elem)
-                 (clj->js opts)))
-
-(defn ed-headless [opts]
+(defn headless [opts]
   (-> (js/CodeMirror. (fn []))
       (set-options opts)))

-(defn ->editor [opts]
-  (let [ed (ed-headless opts)]
-    (set! (.-ltid ed) (swap! ed-id inc))
-    (set! (.-ltproperties ed) (atom {}))
-    ed))
-
-(defn init [ed context]
-  (-> ed
-      (clear-props)
-      (set-props (dissoc context :content :doc))
-      (set-val (:content context))
-      (set-options {:mode (name (:mime context))
-                    :readOnly false
-                    :dragDrop false
-                    :lineNumbers false
-                    :lineWrapping true})))
-
 (defn make [context]
-  (let [e (->editor {:mode (if (:mime context)
+  (let [e (headless {:mode (if (:mime context)
                              (name (:mime context))
                              "plaintext")
                      :autoClearEmptyLines true
@@ -72,7 +47,6 @@
                      :onDragEvent (fn [] true)
                      :undoDepth 10000
                      :matchBrackets true})]
-    (set-props e (dissoc context :content :doc))
     (when-let [c (:content context)]
       (set-val e c)
       (clear-history e))
@@ -104,21 +78,6 @@
 ;;*********************************************************
 ;; Params
 ;;*********************************************************
-
-(defn clear-props [ed]
-  (reset! (.-ltproperties ed) {})
-  ed)
-
-(defn set-props [ed m]
-  (swap! (.-ltproperties ed) merge m)
-  ed)
-
-(defn ->ltid [ed]
-  (.-ltid ed))
-
-(defn ->prop
-  ([ed] (deref (.-ltproperties ed)))
-  ([ed k] (get (->prop ed) k)))

 (defn ->val [e]
   (. (->cm-ed e) (getValue)))
@@ -488,6 +447,15 @@
                       (set-options obj {:tabSize tab-size
                                         :indentWithTabs use-tabs?
                                         :indentUnit indent-unit})))
+
+(behavior ::set-codemirror-flags
+          :triggers #{:object.instant}
+          :type :user
+          :desc "Editor: Set CodeMirror flags"
+          :params [{:label "Flags map"
+                    :ex "{:undoDepth 1000}"}]
+          :reaction (fn [this flags]
+                      (set-options this flags)))

 (behavior ::read-only
           :triggers #{:object.instant}


show bpm label

show bpm label

--- src/metronome/core.cljs
+++ src/metronome/core.cljs
@@ -160,6 +160,12 @@
                  (dot 3)
                  (dot 0))))))

+(defn bpm [bpm owner]
+  (reify
+    om/IRender
+    (render [_]
+      (dom/div nil (str (.round js/Math (* 60 (/ 1000 (:interval bpm)))) " bpm")))))
+
 (om/root
  (fn [app owner]
    (reify
@@ -174,6 +180,7 @@
                (om/build clock (:bpm app) {:init-state {:sound-channel sound-channel :tempo-channel tempo-channel}})
                (om/build sound (:meter app) {:init-state {:sound-channel sound-channel}})
                (om/build tap-tempo-button nil {:init-state {:tempo-channel tempo-channel}})
-               (om/build dots (:meter app))))))
+               (om/build dots (:meter app))
+               (om/build bpm (:bpm app))))))
  app-state
  {:target (. js/document (getElementById "app"))})


Fix concat string for inbox url.

Fix concat string for inbox url.

--- src/oc/storage/representations/activity.clj
+++ src/oc/storage/representations/activity.clj
@@ -15,7 +15,7 @@
   (str "/orgs/" slug "/" collection-type))

   ([collection-type {slug :slug :as org} {start :start following :following}]
-  (let [following-concat (if start "?" "&")]
+  (let [following-concat (if start "&" "?")]
     (str (inbox-url collection-type org) (when start (str "?start=" start)) (when following (str following-concat "following=true"))))))

 (defn- dismiss-all-url [org]


Re-mark overseer.worker as `^:no-doc`

Re-mark overseer.worker as `^:no-doc`

I spaced out and removed the mark since the system is started with
`worker/start!` but this is publicly aliased as `api/start`

--- src/overseer/worker.clj
+++ src/overseer/worker.clj
@@ -1,4 +1,4 @@
-(ns overseer.worker
+(ns ^:no-doc overseer.worker
   "A Worker is the main top-level unit of Overseer. Internally, it acts as a
    supervisor for several processes that coordinate to select ready
    jobs from the queue and execute them"


Restyled angle-bracket parameters.

Restyled angle-bracket parameters.


Formatting cleanup

Formatting cleanup

--- src/qttt/ui/om_ios.cljs
+++ src/qttt/ui/om_ios.cljs
@@ -20,20 +20,16 @@
   (apply js/React.createElement js/React.TouchableWithoutFeedback opts children))

 (defn mark-text
-  [{:keys [player turn focus collapsing]}]
-  (str
-    (if collapsing
-      "~"
-      " ")
-    (if (= 0 player)
-      "+"
-      "O")))
+  [{:keys [player]}]
+  (if (= 0 player)
+    "\u2795"
+    "\u2B55"))

 (defn mark-color
   [e]
   (if (zero? (:player e))
-    "orange"
-    "yellow"))
+    "#FFC929"
+    "#FF6629"))

 (defn entanglement
   "Om component for an individual entanglement"
@@ -52,13 +48,18 @@
                                #(game/speculate % cell subcell)))
                :onPressOut (fn [evt]
                              (om/transact! game-cursor game/unspeculate))}
-          (view #js {:style #js {:flexDirection  "row"
-                                 :width          30
-                                 :height         30
-                                 :justifyContent "center"}}
-            (text #js {:style #js {:color (mark-color e) :fontWeight (if (:focus e) "bold" "normal")}}
-              (if (empty? e) " _ " (mark-text e)))
-            (text #js {:style #js {:color (mark-color e) :fontSize 6 :fontWeight (if (:focus e) "bold" "normal")}}
+          (view #js {:style #js {:flexDirection   "row"
+                                 :width           30
+                                 :height          30
+                                 :justifyContent  "center"
+                                 :borderRadius    3
+                                 :backgroundColor (cond
+                                                    (:focus e) "#333333"
+                                                    (:collapsing e) "#224433"
+                                                    :else "black")}}
+            (text #js {:style #js {:color (mark-color e) :fontSize 18 :fontWeight (if (:focus e) "bold" "normal")}}
+              (if (empty? e) "" (mark-text e)))
+            (text #js {:style #js {:color "grey" :fontSize 6}}
               (:turn e))))))))

 (defn superposition
@@ -69,8 +70,8 @@
     (render [this]
       (view nil
         (apply view #js {:style #js {:flexDirection  "row"
-                                     :borderColor    "blue"
-                                     :borderWidth    3
+                                     :borderColor    "#2675B1"
+                                     :borderWidth    1
                                      :justifyContent "center"}}
           (map (fn [row]
                  (apply view nil
@@ -89,9 +90,17 @@
   (reify
     om/IRender
     (render [this]
-      (view #js {:className "classical"}
-        (text #js {:style #js {:color (mark-color (:classical cell)) :fontSize 40 :width 90 :height 90}}
-          (mark-text (:classical cell)))))))
+      (view #js {:style #js {:flexDirection  "row"
+                             :borderColor    "#2675B1"
+                             :borderWidth    1
+                             :justifyContent "center"
+                             :width          92
+                             :height         92
+                             :padding        5}}
+        (text #js {:style #js {:textAlign "center" :color (mark-color (:classical cell)) :fontSize 60}}
+          (mark-text (:classical cell)))
+        (text #js {:style #js {:fontSize 8 :color "grey"}}
+          (:turn (:classical cell)))))))

 (defn cell
   "Om component for a square"
@@ -104,19 +113,14 @@
   (reify
     om/IRender
     (render [this]
-      (let [[player phase] (game/instructions game)
-            player-classes (if (zero? player)
-                             ["player-x" "fa-plus"]
-                             ["player-o" "fa-circle-o"])]
+      (let [[player phase] (game/instructions game)]
         (view #js {:style #js {:flexDirection  "row"
                                :justifyContent "center"}}
-          (text #js {:style #js {:flexDirection   "row"
-                                 :margin          20
-                                 :color           "white"
-                                 :backgroundColor "#EE1EEE"
-                                 :textAlign       "center"}}
-            #_(view #js {:className (apply class-name "mark" "fa" player-classes)})
-            (str (if (zero? player) "+" "O") "'s turn: " phase)))))))
+          (text #js {:style #js {:flexDirection "row"
+                                 :margin        20
+                                 :color         "#6DA6D2"
+                                 :textAlign     "center"}}
+            (str (if (zero? player) "\u2795" "\u2B55") "'s turn: " phase)))))))

 (defn board [game owner]
   (reify
@@ -124,7 +128,9 @@
     (render [this]
       (view nil
         (om/build instructions game)
-        (apply view #js {:style #js {:flexDirection "row"}}
+        (apply view #js {:style #js {:flexDirection "row"
+                                     :borderColor   "#2675B1"
+                                     :borderWidth   1}}
           (map (fn [row]
                  (apply view {:style #js {:flexDirection "row"}}
                    (map (fn [idx]


CMR-3182: Fixing flaky portion of rebalance collections test.

--- system-int-test/test/cmr/system_int_test/bootstrap/rebalance_collections_test.clj
+++ system-int-test/test/cmr/system_int_test/bootstrap/rebalance_collections_test.clj
@@ -167,10 +167,14 @@
        ;; 5 minutes.
        ;; This check is here as a demonstration of the problem and not an assertion of what we want to happen.
        ;; Fix during CMR-2668
-       (verify-provider-holdings
-         (inc-provider-holdings-for-coll
-          expected-provider-holdings coll1 -6)
-         "After finalize before clear cache")
+
+       ;; Later: This check was originally here as a demonstration of the failure but sometimes it actually
+       ;; "passes". I think there's a race condition where search will use the correct index.
+       ; (verify-provider-holdings
+         ; (inc-provider-holdings-for-coll
+          ; expected-provider-holdings coll1 -6)
+         ; "After finalize before clear cache")
+
        ;; After the cache is cleared the right amount of data is found
        (search/clear-caches)
        (verify-provider-holdings


Tell us what index events were sent too.

--- src/riemann/elastic.clj
+++ src/riemann/elastic.clj
@@ -113,7 +113,7 @@
                                           (riemann-to-elasticsearch events))]
         (when (seq bulk-create-items)
           (let [res (eb/bulk-with-index index bulk-create-items)]
-            (info "elasticized" (count (:items res)) "items in " (:took res) "ms")
+            (info "elasticized" (count (:items res)) "items to index " index "in " (:took res) "ms")
             res))))))

 (defn ^{:private true} resource-as-json [resource-name]


lein-release plugin: bumped version from 0.1.14 to 0.1.15-SNAPSHOT for next development cycle

--- re_db/project.clj
+++ re_db/project.clj
@@ -1,4 +1,4 @@
-(defproject re-db "0.1.14"
+(defproject re-db "0.1.15-SNAPSHOT"
   :description "in-memory javascript key-value store inspired by Datomic and DataScript"
   :url "https://www.github.com/braintripping/re-view/tree/master/re_db"
   :license {:name "Eclipse Public License"


Core functions for input-size and output-size

--- cortex/src/cortex/nn/core.cljc
+++ cortex/src/cortex/nn/core.cljc
@@ -58,6 +58,16 @@
   ([m input]
     (cp/forward m input)))

+(defn input-size
+  "Returns the size of the module input array."
+  ([m]
+    (cp/input-size m)))
+
+(defn output-size
+  "Returns the size of the module output array."
+  ([m]
+    (cp/output-size m)))
+
 (defn backward
   "Runs the backward training pass on a neural network module. Input must be the same as used
    in the previous forward pass."


[#1161] Run import in a try/catch

[#1161] Run import in a try/catch

- The reprojection and getting the sql data can fail too
- Move the try/catch to wrap the whole process and update the
  job_execution status on failure

--- backend/src/akvo/lumen/lib/raster_impl.clj
+++ backend/src/akvo/lumen/lib/raster_impl.clj
@@ -75,16 +75,15 @@
   (lib/ok (all-rasters conn)))

 (defn do-import [conn config data-source job-execution-id]
-  (let [source (get data-source "source")
-        file (import/get-path source (:file-upload-path config))
-        path (.getAbsolutePath (.getParentFile file))
-        filename (.getName file)
-        table-name (util/gen-table-name "raster")
-        raster-info (get-raster-info path filename)
-        prj (project-and-compress path filename)
-        sql (get-raster-data-as-sql (:path prj) (:filename prj) table-name)]
-
-    (try
+  (try
+    (let [source (get data-source "source")
+          file (import/get-path source (:file-upload-path config))
+          path (.getAbsolutePath (.getParentFile file))
+          filename (.getName file)
+          table-name (util/gen-table-name "raster")
+          raster-info (get-raster-info path filename)
+          prj (project-and-compress path filename)
+          sql (get-raster-data-as-sql (:path prj) (:filename prj) table-name)]
       (create-raster-table conn {:table-name table-name})
       (create-raster-index conn {:table-name table-name})
       (jdbc/execute! conn [sql])
@@ -104,10 +103,10 @@
                                          (.setType "jsonb")
                                          (.setValue (json/generate-string metadata)))
                              :raster-table table-name})
-        (update-successful-job-execution conn {:id job-execution-id}))
-      (catch Exception e
-        (update-failed-job-execution conn {:id job-execution-id
-                                           :reason (.getMessage e)})))))
+        (update-successful-job-execution conn {:id job-execution-id})))
+    (catch Exception e
+      (update-failed-job-execution conn {:id job-execution-id
+                                         :reason (.getMessage e)}))))

 (defn create [conn config claims data-source]
   (let [data-source-id (str (util/squuid))


[#2964] Refactor

[#2964] Refactor

--- backend/src/akvo/lumen/postgres/filter.clj
+++ backend/src/akvo/lumen/postgres/filter.clj
@@ -101,10 +101,13 @@

 (defmethod filter-sql "isEmpty"
   [{:keys [column operation]}]
-  (if (or (= (:type column) "option") (= (:type column) "text"))
-    (format "coalesce(%s, '') %s ''"
-            (column :columnName)
-            (if (= operation "keep") "=" "<>"))
+  (case (:type column)
+    "text" (format "coalesce(%s, '') %s ''"
+                   (column :columnName)
+                   (if (= operation "keep") "=" "<>"))
+    "option" (format "coalesce(%s, '') %s ''"
+                   (column :columnName)
+                   (if (= operation "keep") "=" "<>"))
     (format "%s IS %s"
             (column :columnName)
             (if (= operation "keep")


postgres.filter hot-fix

postgres.filter hot-fix

--- backend/src/akvo/lumen/postgres/filter.clj
+++ backend/src/akvo/lumen/postgres/filter.clj
@@ -55,7 +55,7 @@
 (defmethod filter-sql "isLower"
   [{:keys [column operation value]}]
   (let [op (if (= operation "keep") "<" ">=")]
-    (comparison op (:type column) (:columnName column) (:value column))))
+    (comparison op (:type column) (:columnName column) value)))

 (defmethod filter-sql "is"
   [{:keys [column operation value]}]