Update buddy-core dependency to 0.9.0.

Update buddy-core dependency to 0.9.0.

--- project.clj
+++ project.clj
@@ -4,7 +4,7 @@
   :license {:name "Apache 2.0"
             :url "http://www.apache.org/licenses/LICENSE-2.0"}
   :dependencies [[org.clojure/clojure "1.7.0" :scope "provided"]
-                 [buddy/buddy-core "0.8.1"]
+                 [buddy/buddy-core "0.9.0"]
                  [clojurewerkz/scrypt "1.2.0"]]
   :source-paths ["src/clojure"]
   :java-source-paths ["src/java"]


lein-release plugin: bumped version from 0.1.1 to 0.1.2-SNAPSHOT for next development cycle

--- project.clj
+++ project.clj
@@ -1,4 +1,4 @@
-(defproject etcd-clojure "0.1.1"
+(defproject etcd-clojure "0.1.2-SNAPSHOT"
   :description "etcd client library in clojure"
   :url "https://github.com/aterreno/etcd-clojure"
   :lein-release {:deploy-via :clojars}


Version 0.2.8-SNAPSHOT

Version 0.2.8-SNAPSHOT

--- project.clj
+++ project.clj
@@ -1,4 +1,4 @@
-(defproject wb-es "0.2.7"
+(defproject wb-es "0.2.8-SNAPSHOT"
   :description "FIXME: write description"
   :url "http://example.com/FIXME"
   :min-lein-version "2.7.0"


Add "assets" to source paths.

Add "assets" to source paths.

--- project.clj
+++ project.clj
@@ -8,7 +8,7 @@
   :deploy-repositories {"releases" :clojars
                         "snapshots" :clojars}

-  :source-paths ["src"]
+  :source-paths ["src" "assets"]
   :test-paths ["test"]

   :cljsbuild {:test-commands {"test" ["node" "output/tests.js"]}


Update project version -> 0.2.0

Update project version -> 0.2.0

--- project.clj
+++ project.clj
@@ -1,4 +1,4 @@
-(defproject clj-ravendb "0.1.2"
+(defproject clj-ravendb "0.2.0"
   :description "A clojure library for consuming a RavenDB rest api."
   :url "https://bitbucket.org/markwoodhall/clj-ravendb"
   :license {:name "Eclipse Public License"


bump transit-clj version to fix msgpack bug

--- project.clj
+++ project.clj
@@ -23,7 +23,7 @@
                  [inliner "0.1.0"]
                  [de.ubercode.clostache/clostache "1.4.0"]
                  [mount "0.1.10"]
-                 [com.cognitect/transit-clj "0.8.285" :exclusions [com.fasterxml.jackson.core/jackson-core]]
+                 [com.cognitect/transit-clj "0.8.288" :exclusions [com.fasterxml.jackson.core/jackson-core]]
                  [ring-transit "0.1.6" :exclusions [com.fasterxml.jackson.core/jackson-core]]
                  ;client
                  [org.clojure/clojurescript "1.9.93"]


Update clojurescript

Update clojurescript

--- project.clj
+++ project.clj
@@ -5,7 +5,7 @@
             :url  "https://opensource.org/licenses/MIT"}

   :dependencies [[org.clojure/clojure "1.8.0"]
-                 [org.clojure/clojurescript "1.9.946"]
+                 [org.clojure/clojurescript "1.10.64"]
                  [org.clojure/data.generators "0.1.2"]
                  [org.clojure/core.async "0.3.465"]
                  [com.stuartsierra/component "0.3.2"]


add protocols ns to api docs

add protocols ns to api docs

--- project.clj
+++ project.clj
@@ -14,7 +14,8 @@
   :codox {:source-paths ["target/classes" "src/clj"]
           :namespaces [com.rpl.specter
                        com.rpl.specter.macros
-                       com.rpl.specter.zipper]
+                       com.rpl.specter.zipper
+                       com.rpl.specter.protocols]
           :source-uri
             {#"target/classes" "https://github.com/nathanmarz/specter/tree/{version}/src/clj/{classpath}x#L{line}"
              #".*"             "https://github.com/nathanmarz/specter/tree/{version}/src/clj/{classpath}#L{line}"


Update dependencies.

Update dependencies.

--- project.clj
+++ project.clj
@@ -20,15 +20,14 @@
                  [io.netty/netty-all "4.1.0.Beta7"]
                  [cheshire "5.5.0" :exclusions [com.fasterxml.jackson.core/jackson-core]]
                  [ns-tracker "0.3.0"]
-                 [slingshot "0.12.2"]
                  [manifold "0.1.1" :exclusions [riddley]]
                  [com.stuartsierra/component "0.3.1"]
                  [commons-io/commons-io "2.4"]
-                 [buddy/buddy-sign "0.8.1" :exclusions [org.clojure/tools.reader]]
+                 [buddy/buddy-sign "0.9.0" :exclusions [org.clojure/tools.reader]]
                  [funcool/cuerdas "0.7.1"]
-                 [funcool/promesa "0.6.0"]
-                 [funcool/cats "1.2.0"]
+                 [funcool/promesa "0.7.0"]
+                 [funcool/cats "1.2.1"]
                  [danlentz/clj-uuid "0.1.6"]
                  [environ "1.0.1"]
-                 [potemkin "0.4.2"]
+                 [potemkin "0.4.3"]
                  [com.cognitect/transit-clj "0.8.285"]])


have to munge the ns names

have to munge the ns names

--- support/src/figwheel/client/utils.clj
+++ support/src/figwheel/client/utils.clj
@@ -1,5 +1,6 @@
 (ns figwheel.client.utils
   (:require [cljs.analyzer.api :as api]
+            [cljs.compiler]
             [clojure.walk :as walk]))

 (def dev-blocks? (atom false))
@@ -27,6 +28,6 @@
 (defmacro get-all-ns-meta-data []
   (no-seqs
    (into {}
-         (map (juxt name meta)
+         (map (juxt (comp cljs.compiler/munge name)
+                    meta)
               (map :name (map api/find-ns (api/all-ns)))))))
-


Getting the current time only once when listing URLs

--- src/ui/relevance/display.cljs
+++ src/ui/relevance/display.cljs
@@ -197,46 +197,47 @@
         ]])))

 (defn list-urls [urls site-data]
-  (->>
-    urls
-    (map-indexed
-      (fn [i tab]
-        (let [url     (:url tab)
-              favicon (:icon (get site-data (host-key (hostname url))))
-              title   (:title tab)
-              label   (if (empty? title)
-                        url
-                        title)
-              display (if (< 100 (count label))
-                        (apply str (concat (take 100 label) "..."))
-                        label)
-              age-ms  (- (.now js/Date) (:ts tab))
-              ;; Colors picked at http://www.w3schools.com/tags/ref_colorpicker.asp
-              color   (cond
-                        (< age-ms ms-hour) "#00ff00"
-                        (< age-ms ms-day) "#00cc00"
-                        (< age-ms (* 3 ms-day)) "#009900"
-                        (< age-ms (* 7 ms-day)) "#ff8000"
-                        (< age-ms (* 14 ms-day)) "#cc6600"
-                        :else "#994c00"
-                        )
-              ]
-          ^{:key i}
-          [:tr
-           [:td {:class "col-sm-2"}
-            (time-display (:time tab))]
-           [:td {:class "col-sm-8"}
-            [:a
-             {:href url :target "_blank"}
-             (if favicon
-               [:img {:src    favicon
-                      :width  16
-                      :height 16}])
-             display]]
-           [:td {:class "col-sm-2"}
-            [:i (merge {:class "fa fa-circle" :style {:color color}})]
-            (time-display (quot age-ms 1000))]
-           ])))))
+  (let [now (.now js/Date)]
+    (->>
+      urls
+      (map-indexed
+        (fn [i tab]
+          (let [url     (:url tab)
+                favicon (:icon (get site-data (host-key (hostname url))))
+                title   (:title tab)
+                label   (if (empty? title)
+                          url
+                          title)
+                display (if (< 100 (count label))
+                          (apply str (concat (take 100 label) "..."))
+                          label)
+                age-ms  (- now (:ts tab))
+                ;; Colors picked at http://www.w3schools.com/tags/ref_colorpicker.asp
+                color   (cond
+                          (< age-ms ms-hour) "#00ff00"
+                          (< age-ms ms-day) "#00cc00"
+                          (< age-ms (* 3 ms-day)) "#009900"
+                          (< age-ms (* 7 ms-day)) "#ff8000"
+                          (< age-ms (* 14 ms-day)) "#cc6600"
+                          :else "#994c00"
+                          )
+                ]
+            ^{:key i}
+            [:tr
+             [:td {:class "col-sm-2"}
+              (time-display (:time tab))]
+             [:td {:class "col-sm-8"}
+              [:a
+               {:href url :target "_blank"}
+               (if favicon
+                 [:img {:src    favicon
+                        :width  16
+                        :height 16}])
+               display]]
+             [:td {:class "col-sm-2"}
+              [:i (merge {:class "fa fa-circle" :style {:color color}})]
+              (time-display (quot age-ms 1000))]
+             ]))))))

 (defn div-urltimes []


Add missing urlmapping entries.

Add missing urlmapping entries.

--- src/uxbox/frontend/routes.clj
+++ src/uxbox/frontend/routes.clj
@@ -96,11 +96,13 @@
        [:get "library/image-collections" #'images/list-collections]
        [:post "library/image-collections" #'images/create-collection]
        [:get "library/image-collections/:id/images" #'images/list-images]
-       [:post "library/image-collections/:id/images" #'images/create-image]
+       [:get "library/image-collections/images" #'images/list-images]

        ;; Images
        [:delete "library/images/:id" #'images/delete-image]
+       [:get "library/images/:id" #'images/retrieve-image]
        [:put "library/images/:id" #'images/update-image]
+       [:post "library/images" #'images/create-image]

        ;; Color Collections
        [:put "library/color-collections/:id" #'colors/update-collection]
@@ -116,6 +118,7 @@
        [:delete "pages/:id" #'pages/delete-page]
        [:post "pages" #'pages/create-page]

+       ;; Profile
        [:get "profile/me" #'users/retrieve-profile]
        [:put "profile/me" #'users/update-profile]
        [:put "profile/me/password" #'users/update-password]


Allow authorization header.

Allow authorization header.

--- src/uxbox/frontend/routes.clj
+++ src/uxbox/frontend/routes.clj
@@ -35,7 +35,7 @@
 (def cors-conf
   {:origin "*"
    :max-age 3600
-   :allow-headers ["X-Requested-With", "Content-Type"]})
+   :allow-headers ["X-Requested-With", "Content-Type", "Authorization"]})

 (defn app
   []


add export file icons

add export file icons


Make sure an element with .login is present

--- src-cljs/frontend/components/header.cljs
+++ src-cljs/frontend/components/header.cljs
@@ -141,13 +141,13 @@
                [:li [:a {:href "/"} "Back to app"]]]
               (list
                 [:form.navbar-right.navbar-form
-                 [:button#login.login-link.btn.btn-success {:href (auth-url)
-                                                            :on-click #(raise! owner [:track-external-link-clicked {:path (auth-url) :event "Auth GitHub" :properties {:source "header sign-up" :url js/window.location.pathname}}])
-                                                            :title "Sign up with Github"}
+                 [:button.login-link.btn.btn-success {:href (auth-url)
+                                                      :on-click #(raise! owner [:track-external-link-clicked {:path (auth-url) :event "Auth GitHub" :properties {:source "header sign-up" :url js/window.location.pathname}}])
+                                                      :title "Sign up with Github"}
                   "Sign up"]]
                 [:ul.nav.navbar-nav.navbar-right
                  [:li
-                  [:a#login.login-link {:href (auth-url)
+                  [:a.login.login-link {:href (auth-url)
                                         :on-click #(raise! owner [:track-external-link-clicked {:path (auth-url) :event "Auth GitHub" :properties {:source "header sign-in" :url js/window.location.pathname}}])
                                         :title "Sign in with Github"}
                    "Sign in"]]]))]]])))))


popup::set-chrome-proxy does not work

popup::set-chrome-proxy does not work

--- ext/chrome/src/cljs/owl/web/popup.cljs
+++ ext/chrome/src/cljs/owl/web/popup.cljs
@@ -11,13 +11,23 @@
     (set-value! (by-id "proxy_uri")
                 (if (> (count s) 0) s u))))

+(defn set-chrome-proxy! [uri]
+  (let [c {:mode "fixed_servers"
+           :rules {:proxyForHttp {:scheme "socks5"
+                                 :host uri}}}]
+    (.set js/chrome.proxy.settings
+          {:value c :scope "regular"}
+          #(.log js/console (str "####" %)))))
+
 (defn on-proxy-run []
-  (.log js/console "begin run proxy")
-  (.setItem js/localStorage
-            :proxy_uri
-            (value (by-id "proxy_uri")))
-  (.getSelected js/chrome.tabs
-                (fn [t] (.log js/console t.url))))
+  (let [uri (value (by-id "proxy_uri"))]
+    (.log js/console "begin run proxy")
+    (.setItem js/localStorage
+              :proxy_uri
+              uri)
+    (.getSelected js/chrome.tabs
+                  (fn [t] (.log js/console t.url)))
+    (set-chrome-proxy! uri)))

 (defn on-doc-ready
   []


Update Apache Commons FileUpload to 1.3.1

--- ring-core/project.clj
+++ ring-core/project.clj
@@ -8,7 +8,7 @@
                  [org.clojure/tools.reader "0.8.1"]
                  [ring/ring-codec "1.0.0"]
                  [commons-io "2.4"]
-                 [commons-fileupload "1.3"]
+                 [commons-fileupload "1.3.1"]
                  [clj-time "0.9.0"]
                  [crypto-random "1.2.0"]
                  [crypto-equality "1.0.0"]]


Update tools.reader to 0.9.1

Update tools.reader to 0.9.1

--- ring-core/project.clj
+++ ring-core/project.clj
@@ -5,7 +5,7 @@
   :license {:name "The MIT License"
             :url "http://opensource.org/licenses/MIT"}
   :dependencies [[org.clojure/clojure "1.3.0"]
-                 [org.clojure/tools.reader "0.8.1"]
+                 [org.clojure/tools.reader "0.9.1"]
                  [ring/ring-codec "1.0.0"]
                  [commons-io "2.4"]
                  [commons-fileupload "1.3.1"]


Added routes for landing pages.

Added routes for landing pages.

--- search-app/src/cmr/search/site/routes.clj
+++ search-app/src/cmr/search/site/routes.clj
@@ -11,10 +11,23 @@
    [cmr.common.api.context :as context]
    [cmr.common-app.api-docs :as api-docs]))

+(defn get-landing-pages
+  ""
+  [request]
+  {:status 200
+   :body "TBD"})
+
 (defn build-routes [system]
   (let [relative-root-url (get-in system [:public-conf :relative-root-url])]
     (routes
       (context relative-root-url []
+        ;; Landing pages - Note that the landing pages must come before the
+        ;; api-docs, since api-docs/docs-routes also use a context of "site"
+        ;; but have the last entry as a 404 renderer, and as such, would
+        ;; prevent any pages in the "site" context from rendering after that
+        ;; point.
+        (GET "/site/collections/landing-pages" req
+          (get-landing-pages req))
         ;; Add routes for API documentation
         (api-docs/docs-routes
           (get-in system [:public-conf :protocol])


Fix wrong data validation.

Fix wrong data validation.

Bugs found thanks to test.check.

--- src/buddy/sign/jwe.clj
+++ src/buddy/sign/jwe.clj
@@ -52,10 +52,13 @@

 (defn- parse-header
   [^String data]
-  (let [{:keys [alg typ enc zip]} (-> (b64/decode data)
-                                      (codecs/bytes->str)
-                                      (json/parse-string true))]
-    (cond-> {:typ typ :zip (= zip "DEF") }
+  (let [{:keys [alg typ enc zip] :as header} (-> (b64/decode data)
+                                                 (codecs/bytes->str)
+                                                 (json/parse-string true))]
+    (when-not (map? header)
+      (throw (ex-info "Message seems corrupt or manipulated."
+                      {:type :validation :cause :header})))
+    (cond-> {:typ typ :zip (= zip "DEF")}
       alg (assoc :alg (keyword (str/lower-case alg)))
       enc (assoc :enc (keyword (str/lower-case enc))))))

@@ -76,8 +79,9 @@

 (defn- decode-payload
   [payload zip]
-  (cond-> payload
-    zip (deflate/uncompress)))
+  (if zip
+    (deflate/uncompress payload)
+    payload))

 (defmulti aead-encrypt :alg)
 (defmulti aead-decrypt :alg)
@@ -233,29 +237,31 @@
   "Decrypt the jwe compliant message and return its payload."
   ([input key] (decrypt input key nil))
   ([input key {:keys [alg enc] :or {alg :dir enc :a128cbc-hs256} :as opts}]
-   (try
-     (let [[header ecek iv ciphertext authtag] (split-jwe-message input)
-
-           {:keys [zip] :as hdr} (parse-header header)
-           ecek (b64/decode ecek)
-           scek (cek/decrypt {:key key :ecek ecek :alg alg :enc enc})
-           iv (b64/decode iv)
-           header (codecs/str->bytes header)
-           ciphertext (b64/decode ciphertext)
-           authtag (b64/decode authtag)
-           payload (aead-decrypt {:ciphertext ciphertext
-                                  :authtag authtag
-                                  :alg enc
-                                  :aad header
-                                  :secret scek
-                                  :iv iv})]
-       (decode-payload payload zip))
-     (catch com.fasterxml.jackson.core.JsonParseException e
+   (let [[header ecek iv ciphertext authtag] (split-jwe-message input)]
+     (when (or (nil? ecek) (nil? iv) (nil? ciphertext) (nil? authtag))
        (throw (ex-info "Message seems corrupt or manipulated."
                        {:type :validation :cause :signature})))
-     (catch org.bouncycastle.crypto.InvalidCipherTextException e
-       (throw (ex-info "Message seems corrupt or manipulated."
-                       {:type :validation :cause :signature}))))))
+     (try
+       (let [{:keys [zip] :as hdr} (parse-header header)
+             ecek (b64/decode ecek)
+             scek (cek/decrypt {:key key :ecek ecek :alg alg :enc enc})
+             iv (b64/decode iv)
+             header (codecs/str->bytes header)
+             ciphertext (b64/decode ciphertext)
+             authtag (b64/decode authtag)
+             payload (aead-decrypt {:ciphertext ciphertext
+                                    :authtag authtag
+                                    :alg enc
+                                    :aad header
+                                    :secret scek
+                                    :iv iv})]
+         (decode-payload payload zip))
+       (catch com.fasterxml.jackson.core.JsonParseException e
+         (throw (ex-info "Message seems corrupt or manipulated."
+                         {:type :validation :cause :signature})))
+       (catch org.bouncycastle.crypto.InvalidCipherTextException e
+         (throw (ex-info "Message seems corrupt or manipulated."
+                         {:type :validation :cause :signature})))))))

 (util/defalias encode encrypt)
 (util/defalias decode decrypt)


Clean up t1 requires.

Clean up t1 requires.

--- src/cbfg/world/t1.cljs
+++ src/cbfg/world/t1.cljs
@@ -1,7 +1,6 @@
 (ns cbfg.world.t1
   (:require-macros [cljs.core.async.macros :refer [go-loop]]
-                   [cbfg.act :refer [act act-loop actx-top achan achan-buf
-                                     aalts aput atake]])
+                   [cbfg.act :refer [act achan achan-buf aput atake]])
   (:require [cljs.core.async :refer [<! >! close! chan map< merge timeout
                                      dropping-buffer]]
             [goog.dom :as gdom]


Added name to default coll.

Added name to default coll.

--- src/cbfg/world/t2.cljs
+++ src/cbfg/world/t2.cljs
@@ -40,6 +40,10 @@

 ; TODO: Split between logical schema and physical runtime objects.

+(defn make-coll [actx rev m]
+  {:rev rev
+   :name (:key m)})
+
 (defn make-initial-server-state [actx]
   {:rev 0
    :realms {"_system" {:rev 0
@@ -50,7 +54,9 @@
                       :users {"_anon" {:rev 0
                                        :pswd ""}}
                       :collsets {"default" {:rev 0
-                                            :colls {"default" {:rev 0}}}}}}})
+                                            :colls {"default" {:rev 0
+                                                               :name "default"}
+                                                    }}}}}})

 (def initial-lane-state
   {:cur-realm "_lobby"
@@ -58,10 +64,6 @@
    :cur-realm-collset-coll "default"
    :cur-user-realm "_lobby"
    :cur-user "_anon"})
-
-(defn make-coll [actx rev m]
-  {:rev rev
-   :name (:key m)})

 ; --------------------------------------------


build

build

--- src/ci3/agent/core.clj
+++ src/ci3/agent/core.clj
@@ -205,13 +205,5 @@
   (System/exit 0))

-
 (defn local [& args])

-#_(defn $run [& args]
-  (let [repo (checkout-project)] (println repo))
-  (let [id (build-id)
-        build (merge (yaml/parse-string (slurp "ci3.yaml") true) build)]
-    (k8s/patch k8s/cfg :builds id
-               (select-keys  build [:pipeline :environment]))
-    (run-build build)))


error as code block

error as code block

--- src/ci3/agent/core.clj
+++ src/ci3/agent/core.clj
@@ -106,7 +106,7 @@
                         (get-in build [:commit :message]) " \n"
                         "By: " (or (get-in build [:commit :author :raw]) (get-in build [:commit :author :name])) " \n"
                         base-url "builds/" (get-in build [:metadata :name])
-                        (when text (str " \n ``` \n" (err-msg (str/join text)) " \n ```") ))))
+                        (when text (str " \n ```" (err-msg (str/join text)) "```") ))))

 (defn error [build res]
   (println build)


Test new notifications

Test new notifications

--- src/ci3/build/core.clj
+++ src/ci3/build/core.clj
@@ -45,7 +45,6 @@
   ::build
   [{env :env cfg :k8s {{{nm :name} :metadata :as build}  :object tp :type } :resource}]
   (let [cfg {:prefix "api" :apiVersion "v1" :ns "default"}]
-    (log/warn tp (:status build))
     (when (and (= tp "ADDED") (= "pending" (:status build)))
       (log/info "Create build pod" (str "build-" nm))
       (let [pod (k8s/create cfg :pods


fix Geist trigger with Street Peddler

fix Geist trigger with Street Peddler

--- src/clj/game/cards.clj
+++ src/clj/game/cards.clj
@@ -2578,7 +2578,8 @@
                           (install-cost-bonus -1) (runner-install (dissoc target :facedown))
                           (trash (update-in card [:hosted]
                                                    (fn [coll]
-                                                     (remove-once #(not= (:cid %) (:cid target)) coll)))))}]}
+                                                     (remove-once #(not= (:cid %) (:cid target)) coll)))
+                                 {:cause :ability-cost}))}]}

    "Sub Boost"
    {:choices {:req #(and (= (:type %) "ICE") (:rezzed %))}


whitespace

whitespace

--- src/clj/inky/entry.clj
+++ src/clj/inky/entry.clj
@@ -23,6 +23,7 @@
             [clojure.edn :as edn]
             [somnium.congomongo :as mon]
             [slingshot.slingshot :refer (try+)]))
+
 (mon/set-connection! (mon/make-connection (env/str :mongo-url "mongodb://localhost:27017/inky")))

 (def current-inky-version


Add browser repl to repl ns.

Add browser repl to repl ns.

--- src/clj/sally/repl.clj
+++ src/clj/sally/repl.clj
@@ -2,7 +2,7 @@
   (:require [taoensso.timbre :as timbre]
             [com.stuartsierra.component :as component]
             [environ.core :refer [env]]
-            (sally [server :refer [create-http-server]])))
+            (sally [server :refer [create-browser-repl create-http-server]])))

 (defn- setup-timbre! []
   (timbre/set-level! (env :log-level))


Fix wrong brackets

Fix wrong brackets

--- src/cljam/bam/core.clj
+++ src/cljam/bam/core.clj
@@ -55,7 +55,7 @@
   (read-blocks
     ([this]
        (reader/read-blocks-sequentially* this :normal))
-    ([this {:keys [mode] :or [mode :normal]}]
+    ([this {:keys [mode] :or {mode :normal}}]
        (reader/read-blocks-sequentially* this mode)))
   (read-coordinate-blocks [this]
     (reader/read-blocks-sequentially* this :coordinate)))


Update core.clj

Update core.clj

--- support/src/figwheel/core.clj
+++ support/src/figwheel/core.clj
@@ -49,10 +49,7 @@
    (if ring-handler
      (routes (GET "/figwheel-ws" [] (reload-handler server-state)) ring-handler)
      (routes (GET "/figwheel-ws" [] (reload-handler server-state))))
-   {:port server-port
-
-
-    }))
+   {:port server-port}))

 (defn append-msg [q msg]
   (conj (take 30 q) msg))


Five tests added into module fileutils-test

--- test/clj_fileutils/fileutils_test.clj
+++ test/clj_fileutils/fileutils_test.clj
@@ -14,6 +14,43 @@
   (:require [clojure.test :refer :all]
             [clj-fileutils.fileutils :refer :all]))

-(deftest a-test
-  (testing "FIXME, I fail."
-    (is (= 0 1))))
+
+;
+; Common functions used by tests.
+;
+
+(defn callable?
+    "Test if given function-name is bound to the real function."
+    [function-name]
+    (clojure.test/function? function-name))
+
+
+;
+; Actual tests.
+;
+
+(deftest test-print-slurp-exception-existence
+    "Check that the clj-fileutils.fileutils/print-slurp-exception function definition exists."
+    (testing "if the clj-fileutils.fileutils/print-slurp-exception function definition exists."
+        (is (callable? 'clj-fileutils.fileutils/print-slurp-exception))))
+
+(deftest test-slurp-existence
+    "Check that the clj-fileutils.fileutils/slurp- function definition exists."
+    (testing "if the clj-fileutils.fileutils/slurp- function definition exists."
+        (is (callable? 'clj-fileutils.fileutils/slurp-))))
+
+(deftest test-new-file-existence
+    "Check that the clj-fileutils.fileutils/new-file function definition exists."
+    (testing "if the clj-fileutils.fileutils/new-file function definition exists."
+        (is (callable? 'clj-fileutils.fileutils/new-file))))
+
+(deftest test-mv-file-existence
+    "Check that the clj-fileutils.fileutils/mv-file function definition exists."
+    (testing "if the clj-fileutils.fileutils/mv-file function definition exists."
+        (is (callable? 'clj-fileutils.fileutils/mv-file))))
+
+(deftest test-move-file-existence
+    "Check that the clj-fileutils.fileutils/move-file function definition exists."
+    (testing "if the clj-fileutils.fileutils/move-file function definition exists."
+        (is (callable? 'clj-fileutils.fileutils/move-file))))
+


Changed parameters to be same as bioavailability paper.

--- src/clojush/examples/bioavailability.clj
+++ src/clojush/examples/bioavailability.clj
@@ -138,8 +138,8 @@
   :atom-generators bioavailability-atom-generators
   :max-points 500
   :evalpush-limit 500
-  :population-size 200
-  :max-generations 50
+  :population-size 500
+  :max-generations 100
   :mutation-probability 0.1
   :crossover-probability 0.8
   :simplification-probability 0.05


Doubled max points

Doubled max points

--- src/clojush/problems/software/median.clj
+++ src/clojush/problems/software/median.clj
@@ -127,7 +127,7 @@
 (def argmap
   {:error-function (median-error-function median-data-domains)
    :atom-generators median-atom-generators
-   :max-points 400
+   :max-points 800
    :max-genome-size-in-initial-program 100
    :evalpush-limit 200
    :population-size 1000


CMR-5199 Adds request-id to result map.

CMR-5199 Adds request-id to result map.

--- src/cmr/exchange/common/results/core.clj
+++ src/cmr/exchange/common/results/core.clj
@@ -9,16 +9,19 @@
    took
    ;; The actual items in the result set
    items
+   ;; The randomly generated request-id string
+   request-id
    ;; Any non-error messages that need to be returned
    warnings])

 (defn create
-  [results & {:keys [elapsed warnings]}]
+  [results & {:keys [request-id elapsed warnings]}]
   (map->CollectionResults
     (merge {;; Our 'hits' is simplistic for now; will change when we support
             ;; paging, etc.
             :hits (count results)
             :took elapsed
+            :request-id request-id
             :items results}
            warnings)))


Update to 1.5.5-SNAPSHOT

Update to 1.5.5-SNAPSHOT

--- scheduler/project.clj
+++ scheduler/project.clj
@@ -13,7 +13,7 @@
 ;; See the License for the specific language governing permissions and
 ;; limitations under the License.
 ;;
-(defproject cook "1.5.4"
+(defproject cook "1.5.5-SNAPSHOT"
   :description "This launches jobs on a Mesos cluster with fair sharing and preemption"
   :license {:name "Apache License, Version 2.0"}
   :dependencies [[org.clojure/clojure "1.8.0"]


removing non-existant test form tests_to_run

--- test/untangled_spec/tests_to_run.cljs
+++ test/untangled_spec/tests_to_run.cljs
@@ -3,7 +3,6 @@
     untangled-spec.assertions-spec
     untangled-spec.async-spec
     untangled-spec.contains-spec
-    untangled-spec.dom.edn-renderer-spec
     untangled-spec.dom.events-spec
     untangled-spec.dom.util-spec
     untangled-spec.provided-spec


Update version as deploy of 2.2.1.0 failed for some reason. Had to redeploy with higher version.

--- clj/project.clj
+++ clj/project.clj
@@ -1,4 +1,4 @@
-(defproject quil/lein-template "2.2.1.0"
+(defproject quil/lein-template "2.2.1.1"
   :description "Leiningen template for Quil ClojureScript project."
   :url "https://github.com/quil/quil-templates"
   :license {:name "Eclipse Public License"


fix drawing pulling things from wrong place

--- src-cljs/frontend/components/drawing.cljs
+++ src-cljs/frontend/components/drawing.cljs
@@ -563,33 +563,40 @@
                          f identity]
                     (if (>= (inc i) post-layer-count)
                       f
-                      (let [build-count (min (- post-layer-count i) (inc i))]
+                      (let [build-count (min (- post-layer-count (inc i)) (inc i))]
                         (recur (+ i build-count)
                                (let [offset (+ vote-box-height
                                                post-layer-offset)
+                                     start-offset (if (>= i build-count)
+                                                    (- (inc i) build-count)
+                                                    0)
                                      x (+ (:start-x vote-box) (* vote-box-width (/ 2 3)))
                                      start-y (+ (:start-y vote-box)
                                                 (* vote-box-height (/ 2 3))
                                                 (* i offset))]
-                                 (comp (fn [tick-state]
-                                         (add-alt-drag tick-state (min (* build-count 15)
-                                                                       30)
-                                                       {:layers (reduce (fn [acc i]
-                                                                          (into acc (shift-post-layers post-layers (* i offset))))
-                                                                        [] (range 0 build-count))
-                                                        :start-x x
-                                                        :end-x x
-                                                        :start-y start-y
-                                                        :end-y (+ start-y (* build-count offset))}))
-                                       (fn [tick-state]
-                                         (add-mouse-transition tick-state 5
-                                                               {:end-x x
-                                                                :end-y start-y
-                                                                :tool :select}
-                                                               {:start-x x
-                                                                :start-y start-y
-                                                                :tool :select}))
-                                       f))))))]
+                                 (comp
+                                  (fn [tick-state]
+                                    (add-alt-drag tick-state (min (* build-count 15)
+                                                                  30)
+                                                  {:layers (reduce
+                                                            (fn [acc j]
+                                                              (into acc
+                                                                    (shift-post-layers post-layers
+                                                                                (* j offset))))
+                                                            [] (range start-offset (+ start-offset build-count)))
+                                                   :start-x x
+                                                   :end-x x
+                                                   :start-y start-y
+                                                   :end-y (+ start-y (* build-count offset))}))
+                                  (fn [tick-state]
+                                    (add-mouse-transition tick-state 5
+                                                          {:end-x x
+                                                           :end-y start-y
+                                                           :tool :select}
+                                                          {:start-x x
+                                                           :start-y start-y
+                                                           :tool :select}))
+                                  f))))))]
     (-> {:tick-ms 16
          :bot state/product-hunt-bot
          :ticks {}}


transition the width when the button text changes

--- src-cljs/frontend/components/landing.cljs
+++ src-cljs/frontend/components/landing.cljs
@@ -19,6 +19,7 @@
             [frontend.utils.date :refer (date->bucket)]
             [goog.dom]
             [goog.labs.userAgent.browser :as ua]
+            [goog.style]
             [om.core :as om :include-macros true]
             [om.dom :as dom :include-macros true])
   (:require-macros [sablono.core :refer (html)])
@@ -121,71 +122,87 @@

 (defn make-button [{:keys [document/id]} owner]
   (reify
-    om/IRender
-    (render [_]
+    om/IInitState
+    (init-state [_]
+      {:word-list ["demos"
+                   "stuff"
+                   "doodles"
+                   "mockups"
+                   "designs"
+                   "layouts"
+                   "details"
+                   "diagrams"
+                   "sketches"
+                   "drawings"
+                   "giraffes"
+                   "projects"
+                   "concepts"
+                   "products"
+                   "new ideas"
+                   "documents"
+                   "notebooks"
+                   "precursors"
+                   "prototypes"
+                   "wireframes"
+                   "user flows"
+                   "flowcharts"
+                   "interfaces"
+                   "inventions"
+                   "some stuff"
+                   "experiences"
+                   "brainstorms"
+                   "big squares"
+                   "masterpieces"
+                   "presentations"
+                   "illustrations"
+                   "walk-throughs"
+                   "awesome ideas"
+                   "teammates happy"
+                   "your team happy"]})
+    om/IDidMount
+    (did-mount [_]
+      (om/set-state! owner :widths (time (reduce (fn [acc word]
+                                                   (assoc acc word (.-width (goog.style/getSize (om/get-node owner word)))))
+                                                 {} (om/get-state owner :word-list)))))
+    om/IRenderState
+    (render-state [_ {:keys [chosen-word-width word-list widths]}]
       (let [cast! (om/get-shared owner :cast!)
             nav-ch (om/get-shared owner [:comms :nav])
-            word-list (shuffle ["demos"
-                                "stuff"
-                                "doodles"
-                                "mockups"
-                                "designs"
-                                "layouts"
-                                "details"
-                                "diagrams"
-                                "sketches"
-                                "drawings"
-                                "giraffes"
-                                "projects"
-                                "concepts"
-                                "products"
-                                "new ideas"
-                                "documents"
-                                "notebooks"
-                                "precursors"
-                                "prototypes"
-                                "wireframes"
-                                "user flows"
-                                "flowcharts"
-                                "interfaces"
-                                "inventions"
-                                "some stuff"
-                                "experiences"
-                                "brainstorms"
-                                "big squares"
-                                "masterpieces"
-                                "presentations"
-                                "illustrations"
-                                "walk-throughs"
-                                "awesome ideas"
-                                "teammates happy"
-                                "your team happy"])
-            middle-index (int (/ (count word-list) 2))
-            random-word (nth word-list (- (count word-list) 4))]
-        (html
-          [:button.make-button
-           {:role "button"
-            :on-click #(do
-                         (cast! :landing-closed)
-                         (put! nav-ch [:navigate! {:path (str "/document/" id)}]))
-            :on-touch-end #(do
-                             (.preventDefault %)
-                             (cast! :landing-closed)
-                             (put! nav-ch [:navigate! {:path (str "/document/" id)}]))
-            :on-mouse-enter #(om/refresh! owner)}
-           [:div.make-prepend
-            {:data-before "or "}
-            "Make "]
-           [:div.make-something
-            [:div.something-default
-             random-word]
-            [:div.something-wheel
-             {:data-before (str/join " " (drop-last 4 word-list))
-              :data-after  (str/join " " (take-last 3 word-list))}
-             random-word]]
-           [:div.make-append
-            {:data-before " first"}
-            "."]])))))
+            chosen-word (first word-list)
+            [before-words after-words] (partition-all (- (count word-list) 3) (rest word-list))]
+        (html
+         [:button.make-button
+          {:role "button"
+           :on-click #(do
+                        (cast! :landing-closed)
+                        (put! nav-ch [:navigate! {:path (str "/document/" id)}]))
+           :on-touch-end #(do
+                            (.preventDefault %)
+                            (cast! :landing-closed)
+                            (put! nav-ch [:navigate! {:path (str "/document/" id)}]))
+           :on-mouse-enter #(om/set-state! owner :word-list (shuffle word-list))}
+          [:div.make-prepend
+           {:data-before "or "}
+           "Make "]
+          [:div.make-something
+           [:div.something-default (when widths
+                                     {:style {:width (get widths chosen-word)
+                                              :transition "width 200ms"}})
+            (str chosen-word ".")]
+           (when-not widths
+             (for [word word-list]
+               [:span {:style {:top "-1000px"
+                               :left "-1000px"
+                               :position "absolute"}
+                       :ref word}
+                word]))
+           [:div.something-wheel
+            (merge
+             {:data-before (str/join " " before-words)
+              :data-after  (str/join " " after-words)})
+            (str chosen-word ".")]]
+          [:div.make-append
+           {:data-before " first"}]])))))

 (defn the-why [app owner]
   (reify


better github link setup

better github link setup

--- src-cljs/frontend/components/overlay.cljs
+++ src-cljs/frontend/components/overlay.cljs
@@ -36,25 +36,35 @@
   (:require-macros [sablono.core :refer (html)])
   (:import [goog.ui IdGenerator]))

-(defn share-input [{:keys [url placeholder]
+;; focus-id lets us trigger a focus from outside of the component
+(defn share-input [{:keys [url placeholder focus-id]
                     :or {placeholder "Copy the url to share"}} owner]
-  (reify
-    om/IDisplayName (display-name [_] "Share input")
-    om/IRender
-    (render [_]
-      (html
-       [:form.menu-invite-form.make
-        [:input {:type "text"
-                 :required "true"
-                 :data-adaptive ""
-                 :onMouseDown (fn [e]
-                                (set! (.-value (.-target e)) url) ; send cursor to end of input
-                                (.focus (.-target e))
-                                (goog.dom.selection/setStart (.-target e) 0)
-                                (goog.dom.selection/setEnd (.-target e) 10000)
-                                (utils/stop-event e))
-                 :value url}]
-        [:label {:data-placeholder placeholder}]]))))
+  (let [focus-and-select (fn [elem]
+                           (set! (.-value elem) url) ; send cursor to end of input
+                           (.focus elem)
+                           (goog.dom.selection/setStart elem 0)
+                           (goog.dom.selection/setEnd elem 10000))]
+    (reify
+      om/IDisplayName (display-name [_] "Share input")
+      om/IDidMount (did-mount [_]
+                     (when focus-id
+                       (focus-and-select (om/get-node owner "url-input"))))
+      om/IDidUpdate (did-update [_ prev-props _]
+                      (when (not= (:focus-id prev-props) focus-id)
+                        (focus-and-select (om/get-node owner "url-input"))))
+      om/IRender
+      (render [_]
+        (html
+         [:form.menu-invite-form.make
+          [:input {:type "text"
+                   :ref "url-input"
+                   :required "true"
+                   :data-adaptive ""
+                   :onMouseDown (fn [e]
+                                  (focus-and-select (.-target e))
+                                  (utils/stop-event e))
+                   :value url}]
+          [:label {:data-placeholder placeholder}]])))))

 (defn auth-link [app owner {:keys [source] :as opts}]
   (reify
@@ -616,13 +626,17 @@
           [:div.content.make (om/build share-input {:url (urls/absolute-doc-png doc)
                                                     :placeholder "or use this url"})]

-          [:div.content.make.export-title
-           "Embed in a GitHub README or issue"]
+          [:div.vein.make {:onClick #(om/set-state! owner :focus-id (utils/uuid))}
+           (common/icon :github)
+           "Embed in a README or issue"]

           [:div.content.make (om/build share-input
                                        {:url (gstring/format "[![Precursor](%s)](%s)"
                                                              (urls/absolute-doc-svg doc)
                                                              (urls/absolute-doc-url doc))
+                                        ;; id that we can use to know if we should focus input
+                                        ;; Should be set to a unique value
+                                        :focus-id (om/get-state owner :focus-id)
                                         :placeholder "copy as markdown"})]])))))

 (defn info [app owner]


Better Sablonified Table.

Better Sablonified Table.

And cleaned up some cruft in the overall layout.

--- src-cljs/kixi/hecuba/tabs/programmes.cljs
+++ src-cljs/kixi/hecuba/tabs/programmes.cljs
@@ -176,7 +176,7 @@
                                 (history/update-token-ids! history :programme id))
                      :className (if (= id (:selected cursor)) "success")
                      :id (str table-id "-selected")}
-                [:td id] [:td lead-organisations] [:td name] [:td created-at]]))]])))))
+                [:td id [:a {:id (str "row-" id)}]] [:td lead-organisations] [:td name] [:td created-at]]))]])))))

 (defn programmes-tab [data owner]
   (let [{tables :tables} data]
@@ -219,41 +219,41 @@
         ;;      we need to decide on singular/plural for entities. I vote singular.
         ;;
         (let [{:keys [programmes projects properties devices sensor-select]} tables]
-          (dom/div nil
-                   (html [:h1 {:id "programmes"} (:title data)]
-                         (om/build programmes-table programmes)
-
-                         [:h2 {:id "projects"} "Projects" [:a {:href "#programmes"} (title-for programmes)]]
-                         (om/build table projects {:opts {:histkey :project}})
-
-                         [:h2  {:id "properties"} "Properties" (title-for projects) [:small (title-for programmes)]]
-                         (om/build table properties {:opts {:histkey :property}})
-
-                         [:h2 {:id "devices"} "Devices" (title-for properties :title-key :addressStreetTwo) [:small (title-for programmes) (title-for projects)]]
-                         (om/build table devices {:opts {:histkey :device}})
-
-                         (om/build device-detail devices)
-
-                         [:h2 {:id "sensors"} "Sensors" (title-for devices :title-key [:location :name]) [:small (title-for programmes) (title-for projects) (title-for properties :title-key :addressStreetTwo)]]
-                         (om/build sensor/table data {:opts {:histkey :sensor
-                                                             :path    :readings}})
-                         (om/build sensor/define-data-set-button data)
-
-                         [:h2 "Chart"]
-                         [:div {:id "date-picker"}
-                          (om/build dtpicker/date-picker data {:opts {:histkey :range}})]
-                         (om/build chart-feedback-box (get-in data [:chart :message]))
-                         [:div {:className "well" :id "chart" :style {:width "100%" :height 600}}
-                          (om/build chart/chart-figure (:chart data))]
-                         (om/build sensor/selection-dialog (:tables data)
-                             {:opts {:id "sensor-selection-dialog"
-                                     :handler (fn [e]
-                                                (.preventDefault e)
-                                                (POST (str "/4/entities/" (:selected @properties) "/datasets")
-                                                      {:params          (:sensor-group @sensor-select)
-                                                       :handler         #(println "Yah!")
-                                                       :error-handler   #(println "Error!")
-                                                       :response-format "application/edn"
-                                                       :keywords?       true}))}}))))))))
-
-
+          (html [:div
+                 [:h1 {:id "programmes"} (:title data)]
+                 (om/build programmes-table programmes)
+
+                 [:h2 {:id "projects"} "Projects" [:small [:a {:href "#programmes"} (title-for programmes)]]]
+                 (om/build table projects {:opts {:histkey :project}})
+
+                 [:h2  {:id "properties"} "Properties" [:small (title-for programmes) (title-for projects)]]
+                 (om/build table properties {:opts {:histkey :property}})
+
+                 [:h2 {:id "devices"} "Devices" [:small (title-for programmes) (title-for projects) (title-for properties :title-key :addressStreetTwo)]]
+                 (om/build table devices {:opts {:histkey :device}})
+
+                 (om/build device-detail devices)
+
+                 [:h2 {:id "sensors"} "Sensors" [:small (title-for programmes) (title-for projects) (title-for properties :title-key :addressStreetTwo) (title-for devices :title-key [:location :name])]]
+                 (om/build sensor/table data {:opts {:histkey :sensor
+                                                     :path    :readings}})
+                 (om/build sensor/define-data-set-button data)
+
+                 [:h2 "Chart"]
+                 [:div {:id "date-picker"}
+                  (om/build dtpicker/date-picker data {:opts {:histkey :range}})]
+                 (om/build chart-feedback-box (get-in data [:chart :message]))
+                 [:div {:className "well" :id "chart" :style {:width "100%" :height 600}}
+                  (om/build chart/chart-figure (:chart data))]
+                 (om/build sensor/selection-dialog (:tables data)
+                           {:opts {:id "sensor-selection-dialog"
+                                   :handler (fn [e]
+                                              (.preventDefault e)
+                                              (POST (str "/4/entities/" (:selected @properties) "/datasets")
+                                                    {:params          (:sensor-group @sensor-select)
+                                                     :handler         #(println "Yah!")
+                                                     :error-handler   #(println "Error!")
+                                                     :response-format "application/edn"
+                                                     :keywords?       true}))}})]))))))
+
+


increasing wait time

increasing wait time

--- test/celestial/test/hooks.clj
+++ test/celestial/test/hooks.clj
@@ -45,7 +45,7 @@
           (send-off hosts fail)
           (update-dns {:event :success :workflow :create :system-id 1
                        :domain "local" :dnsmasq "192.168.1.1" :user "foo" }) => truthy
-          (await-for 2000 hosts) => true
+          (await-for 4000 hosts) => true
           (agent-error hosts) => nil)

     (with-redefs [execute fail]


Add a test for parsing function calls

Add a test for parsing function calls

--- test/desdemona/query_test.clj
+++ test/desdemona/query_test.clj
@@ -5,7 +5,11 @@

 (deftest infx-parser-tests
   (is (= [:expr [:ipv4-address "10" "0" "0" "1"]]
-         (#'q/infix-parser "10.0.0.1"))))
+         (#'q/infix-parser "10.0.0.1")))
+  (is (= [:expr [:fn-application
+                 [:identifier "ip"]
+                 [:identifier "x"]]]
+         (#'q/infix-parser "ip(x)"))))

 (deftest infix->dsl-tests
   (is (= '(= (:ip x) "10.0.0.1")


Shell out to git

Shell out to git

--- src/doctopus/shell.clj
+++ src/doctopus/shell.clj
@@ -17,4 +17,13 @@
     ([command args]
         (apply sh/sh (cons command args)))
     ([command args root-dir]
+     (println command)
+     (println args)
+     (println root-dir)
         (apply sh/sh (cons command (conj args :dir root-dir)))))
+
+(defn git-clone
+  [repo dest]
+  (let [res (sh/sh "git" "clone" repo dest)
+        status (:exit res)]
+    (= 0 status)))


Update valutakurser

Update valutakurser

--- src/clj_simple_chart/ssb/valutakurser.clj
+++ src/clj_simple_chart/ssb/valutakurser.clj
@@ -31,7 +31,7 @@
                                    "1 ILS" "100 INR" "100 JPY" "100 KRW" "1 LTL" "100 MXN" "1 MYR" "1 NZD"
                                    "100 PHP" "100 PKR" "1 PLN" "100 RON" "100 RUB" "100 SEK" "1 SGD"
                                    "100 THB" "100 TRY" "100 TWD" " TWI" "1 USD" "1 XDR" "1 ZAR" "100 BYR"
-                                   "1 BYN"])))
+                                   "1 BYN" "100 BDT" "100 MMK"])))

 (test/is (= "Jan-60" (:Date (first data))))


Support fullscreen on older Webkit

Support fullscreen on older Webkit

--- src/cljs/asciinema_player/fullscreen.cljs
+++ src/cljs/asciinema_player/fullscreen.cljs
@@ -7,12 +7,14 @@
   (let [options ["fullscreenElement"
                  "mozFullScreenElement"
                  "webkitFullscreenElement"
+                 "webkitCurrentFullScreenElement"
                  "msFullscreenElement"]]
   (some (comp boolean document-prop) options)))

 (defn request [dom-node]
   (let [options ["requestFullscreen"
                  "webkitRequestFullscreen"
+                 "webkitRequestFullScreen"
                  "mozRequestFullScreen"
                  "msRequestFullscreen"]
         f (some (partial aget dom-node) options)]
@@ -22,6 +24,7 @@
 (defn exit []
   (let [options ["exitFullscreen"
                  "webkitExitFullscreen"
+                 "webkitCancelFullScreen"
                  "mozCancelFullScreen"
                  "msExitFullscreen"]
         f (some document-prop options)]


(maint) Introduce ReaderSchema WriterSchema schemas

--- src/clojure/puppetlabs/ssl_utils/core.clj
+++ src/clojure/puppetlabs/ssl_utils/core.clj
@@ -8,7 +8,9 @@
            (com.puppetlabs.ssl_utils SSLUtils
                                      ExtensionsUtils)
            (java.util Map List Date Set)
-           (org.bouncycastle.asn1.x500.style BCStyle))
+           (org.bouncycastle.asn1.x500.style BCStyle)
+           (java.io InputStream File Reader BufferedReader Writer OutputStream BufferedWriter)
+           (java.net URI URL Socket))
   (:require [clojure.tools.logging :as log]
             [clojure.walk :as walk]
             [clojure.string :as string]
@@ -130,6 +132,12 @@

 (def Something
   (schema/pred #(not (nil? %))))
+
+(def ReaderSchema
+  (schema/cond-pre Reader BufferedReader InputStream File URI URL Socket byte[] char[] String))
+
+(def WriterSchema
+  (schema/cond-pre Writer BufferedWriter OutputStream File URI URL Socket byte[] char[] String))

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;; Internal
@@ -498,7 +506,7 @@
    `pem`: the file path to write the PEM output to
           (or some other object supported by clojure's `writer`)"
   [crl :- X509CRL
-   pem :- Something]
+   pem :- WriterSchema]
   (with-open [w (writer pem)]
     (SSLUtils/writeToPEM crl w)))

@@ -507,14 +515,14 @@
    decode the contents into a `X509CRL`.

    See `crl->pem!` to PEM-encode a certificate revocation list."
-  [pem :- Something]
+  [pem :- ReaderSchema]
   (with-open [r (reader pem)]
     (SSLUtils/pemToCRL r)))

 (schema/defn ^:always-validate pem->crls :- [X509CRL]
   "Given the path to a PEM file (or some other object supported by clojure's
   `reader`), decode the contents into a collection of `X509CRL` instances."
-  [pem :- Something]
+  [pem :- ReaderSchema]
   (with-open [r (reader pem)]
     (SSLUtils/pemToCRLs r)))

@@ -523,7 +531,7 @@
   decode the contents into a `PKCS10CertificationRequest`.

   See `obj->pem!` to PEM-encode a certificate signing request."
-  [pem :- Something]
+  [pem :- ReaderSchema]
   (with-open [r (reader pem)]
     (SSLUtils/pemToCertificateRequest r)))

@@ -536,7 +544,7 @@
   "Given a file path (or some other object supported by clojure's `reader`), reads
   PEM-encoded objects and returns a collection of objects of the corresponding
   type from `java.security`."
-  [pem :- Something]
+  [pem :- ReaderSchema]
   (with-open [r (reader pem)]
     (let [objs (seq (SSLUtils/pemToObjects r))]
       (doseq [o objs]
@@ -553,21 +561,21 @@

   `pem`: the file path to write the PEM output to (or some other object supported by clojure's `writer`)"
   [obj :- Something
-   pem :- Something]
+   pem :- WriterSchema]
   (with-open [w (writer pem)]
     (SSLUtils/writeToPEM obj w)))

 (schema/defn ^:always-validate pem->certs :- [X509Certificate]
   "Given the path to a PEM file (or some other object supported by clojure's `reader`),
   decodes the contents into a collection of `X509Certificate` instances."
-  [pem :- Something]
+  [pem :- ReaderSchema]
   (with-open [r (reader pem)]
     (SSLUtils/pemToCerts r)))

 (schema/defn ^:always-validate pem->cert :- X509Certificate
   "Given the path to a PEM file (or some other object supported by clojure's `reader`),
   decodes the contents into an `X509Certificate`."
-  [pem :- Something]
+  [pem :- ReaderSchema]
   (with-open [r (reader pem)]
     (SSLUtils/pemToCert r)))

@@ -579,7 +587,7 @@
    `pem`: the file path to write the PEM output to
           (or some other object supported by clojure's `writer`)"
   [cert :- X509Certificate
-   pem :- Something]
+   pem :- WriterSchema]
   (with-open [w (writer pem)]
     (SSLUtils/writeToPEM cert w)))

@@ -591,7 +599,7 @@
 (schema/defn ^:always-validate pem->private-keys :- [PrivateKey]
   "Given the path to a PEM file (or some other object supported by clojure's `reader`),
   decodes the contents into a collection of `PrivateKey` instances."
-  [pem :- Something]
+  [pem :- ReaderSchema]
   (with-open [r (reader pem)]
     (SSLUtils/pemToPrivateKeys r)))

@@ -600,7 +608,7 @@
   decode the contents into a `PrivateKey` instance. Throws an exception if multiple keys
   are found in the PEM.
   See `key->pem!` and `pem->private-keys` to write/read keys."
-  [pem :- Something]
+  [pem :- ReaderSchema]
   (with-open [r (reader pem)]
     (SSLUtils/pemToPrivateKey r)))

@@ -609,7 +617,7 @@
    decode the contents into a `PublicKey` instance. Throws an exception if multiple
    keys are found in the PEM.
    See `key->pem!` to write public keys."
-  [pem :- Something]
+  [pem :- ReaderSchema]
   (with-open [r (reader pem)]
     (SSLUtils/pemToPublicKey r)))

@@ -620,7 +628,7 @@
   `key`: the key to encode and write; usually an instance of `PrivateKey` or `PublicKey`
   `pem`: the file path to write the PEM output to (or some other object supported by clojure's `writer`)"
   [key :- Key
-   pem :- Something]
+   pem :- WriterSchema]
   (with-open [w (writer pem)]
     (SSLUtils/writeToPEM key w)))

@@ -646,7 +654,7 @@
               (or some other object supported by clojure's `reader`)"
   [keystore :- KeyStore
    prefix :- schema/Str
-   pem :- Something]
+   pem :- ReaderSchema]
   (with-open [r (reader pem)]
     (SSLUtils/associateCertsFromReader keystore prefix r)))

@@ -685,9 +693,9 @@
                      to a keystore without a signed certificate."
   [keystore :- KeyStore
    alias :- schema/Str
-   pem-private-key :- Something
+   pem-private-key :- ReaderSchema
    pw :- schema/Str
-   pem-cert :- Something]
+   pem-cert :- ReaderSchema]
   (with-open [key-reader  (reader pem-private-key)
               cert-reader (reader pem-cert)]
     (SSLUtils/associatePrivateKeyFromReader keystore alias key-reader pw cert-reader)))
@@ -714,9 +722,9 @@
   `:keystore`    - an instance of KeyStore initialized with the cert and private key
   `:keystore-pw` - a string containing a dynamically generated password for the KeyStore
   `:truststore`  - an instance of KeyStore containing the CA cert."
-  [cert :- Something
-   private-key :- Something
-   ca-cert :- Something]
+  [cert :- ReaderSchema
+   private-key :- ReaderSchema
+   ca-cert :- ReaderSchema]
   (with-open [cert-reader    (reader cert)
               key-reader     (reader private-key)
               ca-cert-reader (reader ca-cert)]
@@ -750,10 +758,10 @@
   Returns the SSLContext instance."
   ([cert private-key ca-cert]
     (pems->ssl-context cert private-key ca-cert nil))
-  ([cert :- Something
-    private-key :- Something
-    ca-cert :- Something
-    crls :- schema/Any]
+  ([cert :- ReaderSchema
+    private-key :- ReaderSchema
+    ca-cert :- ReaderSchema
+    crls :- (schema/maybe ReaderSchema)]
     (with-open [cert-reader    (reader cert)
                 key-reader     (reader private-key)
                 ca-cert-reader (reader ca-cert)]
@@ -775,7 +783,7 @@
   reference a PEM that contains the CA cert.

   Returns the SSLContext instance."
-  [ca-cert :- Something]
+  [ca-cert :- ReaderSchema]
   (with-open [ca-cert-reader (reader ca-cert)]
     (SSLUtils/caCertPemToSSLContext ca-cert-reader)))

@@ -791,8 +799,8 @@
   reference a PEM that contains one or more CRLs.

   Returns the SSLContext instance."
-  [ca-cert :- Something
-   crls :- Something]
+  [ca-cert :- ReaderSchema
+   crls :- ReaderSchema]
   (with-open [ca-cert-reader (reader ca-cert)
               crls-reader    (reader crls)]
     (SSLUtils/caCertAndCrlPemsToSSLContext ca-cert-reader
@@ -821,7 +829,7 @@
    returns nil.

    If the :ssl-context and :ssl-ca-cert keys are both missing, an exception will be thrown."
-  [options]
+  [options :- SSLContextOptions]
   (let [ssl-opts (select-keys options [:ssl-cert :ssl-key :ssl-ca-cert :ssl-ca-crls :ssl-context])
         from-context?           (contains? ssl-opts :ssl-context)
         from-pems?              (every? ssl-opts [:ssl-cert :ssl-key :ssl-ca-cert])


Fixed SQL statement generation.

Fixed SQL statement generation.

--- src/cmr/bootstrap/data/bulk_migration.clj
+++ src/cmr/bootstrap/data/bulk_migration.clj
@@ -40,17 +40,17 @@
 (defn catalog-rest-dataset-table
   "Get the dataset table name for a given provider."
   [system provider-id]
-  (keyword (str (catalog-rest-user system) "." provider-id "-dataset-records")))
+  (str (catalog-rest-user system) "." provider-id "_dataset_records"))

 (defn catalog-rest-granule-table
   "Get the granule table name for a given provider."
   [system provider-id]
-  (keyword (str (catalog-rest-user system) "." provider-id "-granule-records")))
+  (str (catalog-rest-user system) "." provider-id "_granule_records"))

 (defn metadata-db-concept-table
   "Get the collection/granule table name for a given provider."
   [system provider-id concept-type]
-  (keyword (str (metadata-db-user system) "." (tables/get-table-name provider-id concept-type))))
+  (str (metadata-db-user system) "." (tables/get-table-name provider-id concept-type)))

 (defn create-provider-url
   [system]
@@ -138,12 +138,12 @@
    (let [dataset-table (catalog-rest-dataset-table system provider-id)
          collection-table (metadata-db-concept-table system provider-id :collection)
          stmt (format (str "INSERT INTO %s (id, concept_id, native_id, metadata, format, short_name, "
-                           "version_id, entry_title, delete_time, revision_date) VALUES SELECT %s_seq.NEXTVAL,"
+                           "version_id, entry_title, delete_time, revision_date) SELECT %s_seq.NEXTVAL,"
                            "echo_collection_id, dataset_id, compressed_xml, xml_mime_type, short_name,"
                            "version_id, dataset_id, delete_time, ingest_updated_at FROM %s")
-                      (name collection-table)
-                      (name collection-table)
-                      (name dataset-table)
+                      collection-table
+                      collection-table
+                      dataset-table
                       collection-id)]
      (if collection-id
        (format "%s WHERE echo_collection_id = '%s'" stmt collection-id)
@@ -158,43 +158,34 @@
   ([system provider-id collection-id]
    (info "Copying collection data for provider" provider-id)
    (let [stmt (copy-collection-data-sql system provider-id collection-id)]
-     (println (pr-str stmt))
      (j/with-db-transaction
        [conn (:db system)]
-       (j/execute! conn stmt)))))
+       (j/execute! conn [stmt])))))

 (defn- copy-granule-data-for-collection-sql
   "Generate the SQL to copy the granule data from the catalog reset datbase to the metadata db."
   [system provider-id collection-id dataset-record-id]
   (let [granule-echo-table (catalog-rest-granule-table system provider-id)
-        granule-mdb-table (metadata-db-concept-table system provider-id :granule)]
-    (su/build (insert granule-mdb-table [:id
-                                         :concept-id
-                                         :native-id
-                                         :parent-collection-id
-                                         :metadata
-                                         :format
-                                         :delete-time
-                                         :revision-date]
-                      (select [(keyword (str granule-mdb-table "_seq.NEXTVAL"))
-                               :echo-granule-id
-                               :granule-ur
-                               collection-id
-                               :compressed-xml
-                               :xml-mime-type
-                               :delete-time
-                               :ingest-updated-at]
-                              (from granule-echo-table)
-                              (where `(= :dataset-record-id ~dataset-record-id)))))))
+        granule-mdb-table (metadata-db-concept-table system provider-id :granule)
+        stmt (format (str "INSERT INTO %s (id, concept_id, native_id, parent_collection_id, "
+                          "metadata, format, delete_time, revision_date) "
+                          "SELECT %s_seq.NEXTVAL, echo_granule_id, granule_ur, '%s', "
+                          "compressed_xml, xml_mime_type, delete_time, ingest_updated_at "
+                          "FROM %s WHERE dataset_record_id = %d")
+                     granule-mdb-table
+                     granule-mdb-table
+                     collection-id
+                     granule-echo-table
+                     (.intValue dataset-record-id))]
+    stmt))

 (defn- copy-granule-data-for-collection
   "Copy the granule data from the catalog reset datbase to the metadata db."
   [system provider-id collection-id dataset-record-id]
   (let [stmt (copy-granule-data-for-collection-sql system provider-id collection-id dataset-record-id)]
-    (println (pr-str stmt))
     (j/with-db-transaction
       [conn (:db system)]
-      (j/execute! conn stmt))))
+      (j/execute! conn [stmt]))))

 (defn- copy-granule-data-for-provider
   "Copy the granule data for every collection for a given provider."


Use _ instead of nil to denote missing short option (updates #130)

--- boot/core/src/boot/cli.clj
+++ boot/core/src/boot/cli.clj
@@ -120,7 +120,9 @@

 (defn- argspec-seq [args]
   (when (seq args)
-    (let [[ret [doc & more]] (split-with (complement string?) args)]
+    (let [[[short long & optarg-type] [doc & more]]
+          (split-with (complement string?) args)
+          ret (into [(when (not= short '_) short) long] optarg-type)]
       (cons (conj (vec ret) doc) (when (seq more) (argspec-seq more))))))

 (defn- cli-argspec->bindings [argspec]
@@ -163,11 +165,12 @@
   (let [[doc argspecs & body]
         (if (string? (first forms))
           forms
-          (list* "No description provided." forms))]
-    (assert-argspecs argspecs)
+          (list* "No description provided." forms))
+        argspecs (argspec-seq argspecs)]
+    (assert-argspecs (mapcat identity argspecs))
     (let [doc      (string/replace doc #"\n  " "\n")
           helpspec '[h help bool "Print this help info."]
-          argspecs (cons helpspec (argspec-seq argspecs))
+          argspecs (cons helpspec argspecs)
           cli-args (mapv (partial apply argspec->cli-argspec) argspecs)
           bindings (cli-argspec->bindings cli-args)
           arglists (list 'list (list 'quote ['& bindings]))


Proper duck typing, accept anything that our dependencies return if it's mappable

--- src/greenyet/parse.clj
+++ src/greenyet/parse.clj
@@ -59,7 +59,7 @@
 (defn components [json {component-conf :components}]
   (when component-conf
     (if-let [components-json (get-complex-key json component-conf)]
-      (if (or (list? components-json) (vector? components-json))
+      (if (sequential? components-json)
         (let [status-results (map #(component % component-conf) components-json)]
           (apply mapv vector status-results))
         [[] [(format "greenyet: List expected from components for config '%s'" component-conf)]])


fix API calls as per updated Clj-MiscUtil

--- src/main/clj/org/bituf/fountain/jdbc.clj
+++ src/main/clj/org/bituf/fountain/jdbc.clj
@@ -80,7 +80,7 @@
      (mu/array? ~args) (let [~(with-meta qargs ; Object[]
                                 {:tag "[Ljava.lang.Object;"}) ~args]
                          ~@body)
-     :else (mu/illegal-arg-value "args"
+     :else (mu/illegal-argval "args"
              "either map, or collection, or array" ~args)))

@@ -158,7 +158,7 @@
                                     (map into-array batch-args)]
                                 (show-sql-fn)
                                 (.batchUpdate (get-sjt) sql args-list))
-                       :else (mu/illegal-arg-value "batch-args"
+                       :else (mu/illegal-argval "batch-args"
                                "either list of lists, or list of maps"
                                batch-args))]
     (map identity result-array)))


Small cleaning up

Small cleaning up

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

--- src/main/clojure/conexp/fca/contexts.clj
+++ src/main/clojure/conexp/fca/contexts.clj
@@ -8,8 +8,8 @@

 (ns conexp.fca.contexts
   "Provides the implementation of formal contexts and functions on them."
-  (:use conexp.base)
-  (:require [clojure.core.reducers :as r]))
+  (:require [clojure.core.reducers :as r]
+            [conexp.base :refer :all]))

 ;;;


Limit access to cached atom

Limit access to cached atom

--- src/main/hbase_region_inspector/core.clj
+++ src/main/hbase_region_inspector/core.clj
@@ -1,6 +1,5 @@
 (ns hbase-region-inspector.core
-  (:require [clojure.pprint :refer [pprint]]
-            [clojure.string :as str]
+  (:require [clojure.string :as str]
             [ring.adapter.jetty :refer [run-jetty]]
             [ring.util.response :refer [response content-type resource-response]]
             [ring.middleware.defaults :refer [wrap-defaults api-defaults site-defaults]]
@@ -123,9 +122,9 @@

 (defn regions-by-servers
   "Generates output for /server_regions.json. Regions grouped by their servers."
-  [regions metric sort tables]
-  (let [all-regions (remove :meta? (:regions @cached))
-        servers (:servers @cached)
+  [regions servers metric sort tables]
+  (let [;; Exclude meta regions
+        all-regions (remove :meta? regions)

         ;; Sort the tables in descending order by the sum of the given metric
         all-tables (keys (sort-by
@@ -168,7 +167,7 @@
   "Generates output for /table_regions.json. Regions grouped by their tables."
   [regions metric sort]
   (let [;; Exclude hbase:meta table
-        all-regions (filter (complement :meta?) (:regions @cached))
+        all-regions (filter (complement :meta?) regions)
         ;; Sort the regions
         sorted-regions (if (= sort :metric)
                          (reverse (sort-by metric all-regions))
@@ -255,7 +254,7 @@
        (let [tables (get params "tables[]" [])
              tables (if (instance? String tables) [tables] tables)]
          (response
-           (regions-by-servers (:regions @cached)
+           (regions-by-servers (:regions @cached) (:servers @cached)
                                (keyword metric) (keyword sort) tables))))
   (GET "/table_regions.json"
        {{:keys [sort metric]


Fixing problem with indexer tests running out of memory

--- indexer-app/project.clj
+++ indexer-app/project.clj
@@ -14,6 +14,9 @@
                  [nasa-cmr/cmr-elastic-utils-lib "0.1.0-SNAPSHOT"]]
   :plugins [[lein-test-out "0.3.1"]]
   :repl-options {:init-ns user}
+
+  :jvm-opts  ["-XX:PermSize=256m" "-XX:MaxPermSize=1024m"]
+
   :profiles
   {:dev {:dependencies [[ring-mock "0.1.5"]
                         [org.clojure/tools.namespace "0.2.10"]


Refactor: duplication

Refactor: duplication

--- src/layzee/adapters/amazon/simple_db.clj
+++ src/layzee/adapters/amazon/simple_db.clj
@@ -16,5 +16,5 @@
   (ex amazon-credential #(-> (sdb/get-attrs % domain key) :key)))

 (defn create-domain[amazon-credential name]
-  (sdb/create-domain (config-for amazon-credential) name))
+  (ex amazon-credential #(sdb/create-domain % name)))


Add an error message for reader exceptions. Fixes #95.

Actually the last commit fixed #95, but I want to auto-close it with a
commit message because I'm lazy, and this is related. =)

--- src/leiningen/repl.clj
+++ src/leiningen/repl.clj
@@ -59,7 +59,8 @@
   (copy-out reader)
   (let [eof (Object.)
         input (try (read *in* false eof)
-                   (catch Exception e nil))]
+                   (catch Exception e
+                     (println "Couldn't read input.")))]
     (when-not (= eof input)
       (.write writer (str (pr-str input) "\n"))
       (.flush writer)


lein test should aggregate all test failures/passes etc and display a summary at the end of all the tests

--- src/leiningen/test.clj
+++ src/leiningen/test.clj
@@ -14,12 +14,30 @@
 (defn merge-predicates [preds]
   (fn [t] (every? #(% t) preds)))

+(let [orig-report report
+      aggregates (ref [])]
+  (defn lein-report [event]
+    (when (= (:type event) :summary)
+      (dosync (commute aggregates conj event)))
+    (orig-report event))
+
+  (defn super-summary []
+    (with-test-out
+      (println "\n\n--------------------\nTotal:"))
+    (orig-report (apply merge-with (fn [a b]
+                                     (if (number? a)
+                                       (+ a b)
+                                       a))
+                        @aggregates))))
+
 (defn run-matching [project preds]
   (binding [test-var (partial test-var-matching (merge-predicates preds))]
     (doseq [n (find-namespaces-in-dir
                (file (:root project) "test"))]
       (require n)
-      (run-tests n))))
+      (binding [report lein-report]
+        (run-tests n)))
+    (super-summary)))

 (defn test
   "Run the projects tests. Accept a list of predicates called with each test


Add 'ancestor? and 'dirty-repo? functions.

--- src/leiningen/voom.clj
+++ src/leiningen/voom.clj
@@ -116,6 +116,35 @@
        (assoc-in m [(keyword remote) (keyword direction)] url)))
    {}
    (:lines (git {:gitdir gitdir} "remote" "-v"))))
+
+(defn ancestor?
+  [gitdir old new]
+  (:bool (git {:gitdir gitdir :ok-statuses #{0 1}}
+                   "merge-base" "--is-ancestor" old new)))
+
+(defn dirty-repo?
+  [gitdir]
+  (let [g {:gitdir gitdir}
+        dirty (:lines (git g "status" "--short"))
+        stashes (:lines (git g "stash" "list"))
+        remotes (->> (git g "ls-remote")
+                     :lines
+                     next
+                     (map #(first (s/split % #"\t" 2)))
+                     set)
+        local-refs (filter (complement #{"refs/stash"})
+                           (:lines (git g "rev-parse" "--symbolic" "--all")))
+        local-shas (:lines (apply git g "rev-parse" local-refs))
+        locals (zipmap local-refs local-shas)
+        unpushed-local-refs (map key (filter #(not (remotes (val %))) locals))
+        local-commits (filter #(not (some (partial ancestor? gitdir %)
+                                          remotes))
+                              unpushed-local-refs)]
+    (if (empty? (concat dirty stashes local-commits))
+      false
+      {:dirty-files dirty
+       :stashes stashes
+       :local-commits local-commits})))

 (defn with-log-level [level f]
   (let [handlers (doall (.getHandlers (Logger/getLogger "")))


pulse in the beat

pulse in the beat

--- src/lights/my_show.clj
+++ src/lights/my_show.clj
@@ -113,7 +113,15 @@
 (show/add-effect! :dimmers (global-dimmer-effect 189))

 ; Variable to control lightness level on all PARs
-(show/set-variable! :lightness-level 50)
+(show/set-variable! :lightness-level 30)
 (show/add-effect! :color (global-color-effect
   (params/build-color-param :h 60 :s 100 :l :lightness-level)))
-(show/set-variable! :lightness-level 50)+
+(def hue-param (params/build-oscillated-param
+                 (oscillators/sawtooth-bar) :max 360))
+
+(def light-param (params/build-oscillated-param
+                 (oscillators/triangle-beat :beat-ratio 0.5) :max 20))
+
+(show/add-effect! :color (global-color-effect
+   (params/build-color-param :s 100 :l light-param :h hue-param)))


use Clojure 1.8 and Cambium for tests

use Clojure 1.8 and Cambium for tests

--- json-bundle/project.clj
+++ json-bundle/project.clj
@@ -12,8 +12,7 @@
   :javac-options ["-target" "1.7" "-source" "1.7" "-Xlint:-options"]
   :global-vars {*warn-on-reflection* true
                 *unchecked-math* :warn-on-boxed}
-  :profiles {:dev {:dependencies [[org.clojure/clojure       "1.7.0"]
-                                  [org.clojure/tools.logging "0.3.1"
-                                   :exclusions [org.clojure/clojure]]
-                                  [org.slf4j/slf4j-api       "1.7.12"]]}})
+  :profiles {:dev {:dependencies [[org.clojure/clojure "1.8.0"]
+                                  [cambium             "0.2.0"]
+                                  [org.slf4j/slf4j-api "1.7.12"]]}})


improve example core

improve example core

--- src/leiningen/new/lein_quick_om/core.cljs
+++ src/leiningen/new/lein_quick_om/core.cljs
@@ -5,9 +5,21 @@
             [goog.dom :as gdom]
             [{{name}}.devbar :as db]
             [{{name}}.state-viewer :as sv]
+            [om-bootstrap.button :as b]
             [cljs.core.async :refer [<! >! put! chan]]))

-(defonce state (atom {:example-data (vec (range 1 5))}))
+(defonce app-name "{{name}}")
+(defonce intro-text
+  ["This is an example application using "
+   (dom/a #js {:href "https://github.com/omcljs/om"} "Om")
+   ". You can modify this example by editing "
+   (dom/code nil (str "src/" app-name "/core.cljs"))
+   "."])
+
+(def init-state
+  {:example-data (mapv (fn [n] {:value n}) (range 1 5))})
+
+(defonce state (atom init-state))

 (declare reset-state cond-render-dev-bar cond-render-state-view)

@@ -40,13 +52,20 @@
                                [toggle-state-view "toggle state viewer"]]})
     (db/remove-dev-bar)))

+;force conditional code to be called on each reload
+;TODO: replace this with a function that figwheel can call on refresh
 (cond-render-dev-bar)
 (cond-render-state-view)

-(def init-state
-  {:example-data (vec (range 1 5))})
-
-
+(defn small-button
+  [f label]
+  (b/button {:bs-style "primary"
+             :bs-size "xsmall"
+             :onClick f
+             :style #js {:width "15pt"
+                         :marginRight "5px"
+                         :marginLeft "5px"}}
+            label))

 (defn reset-state
   []
@@ -64,17 +83,37 @@
   (reify
     om/IRender
     (render [_]
-      (dom/div nil
-               (dom/span nil (str "example component " data))
-))))
+      (dom/div #js {:className "row"
+                    :style #js {:marginBottom "20pt"}}
+               (dom/div #js {:className "col-xs-4"}
+                        (dom/b nil (str "example component " (:value data))))
+                        (small-button #(om/transact! data :value dec) "-")
+                        (small-button #(om/transact! data :value inc) "+")))))
+
+(def jumbotron
+  (dom/div #js {:className "jumbotron"}
+           (dom/div #js {:className "container"}
+                    (dom/h1 nil (str "hello from " app-name))
+                    (dom/p nil intro-text))))
+
+(defn main-component
+  [data owner]
+  (reify
+    om/IRender
+    (render [_]
+    (dom/div #js {:className "container"}
+             (dom/div #js {:className "col-md-3"} nil)
+             (apply dom/div #js {:className "col-md-6"}
+                    (om/build-all child-component (:example-data data)))
+             (dom/div #js {:className "col-md-3"} nil)))))

 (defn master-component
   [data owner]
   (reify
     om/IRender
     (render [_]
-      (apply dom/div nil
-             (dom/h1 nil "Hello from {{name}}...")
-             (om/build-all child-component (:example-data data))))))
+      (dom/div nil
+             jumbotron
+             (om/build main-component data)))))

 (om/root master-component state {:target (gdom/getElement "app")})


Use a deep structural comparison to address issue #55

--- src/main/clojure/clara/rules/compiler.clj
+++ src/main/clojure/clara/rules/compiler.clj
@@ -431,6 +431,52 @@
       ;; Tests are last.
       :test false)))

+(defn- gen-compare
+  "Generic compare function for arbitrary Clojure data structures.
+   The only guarantee is the ordering of items will be consistent
+   between invocations."
+  [left right]
+  (cond
+
+   ;; Ignore functions for our comparison purposes,
+   ;; since we won't distinguish rules by them.
+   (and (fn? left) (fn? right))
+   0
+
+   ;; If the types differ, compare based on their names.
+   (not= (type left)
+         (type right))
+   (compare (.getName ^Class (type left))
+            (.getName ^Class (type right)))
+
+   ;; Compare items in a sequence until we find a difference.
+   (sequential? left)
+   (if-let [[left-val right-val] ; Find the first tuple that's different.
+            (->> (map (fn [left-val right-val] [left-val right-val]) left right)
+                 (drop-while (fn [[left-val right-val]] (= 0 (gen-compare left-val right-val))))
+                 first)]
+     (gen-compare left-val right-val)
+
+     ;; All existing items matched, but check for differing lengths.
+     (- (count right) (count left)))
+
+   ;; Covert maps to sequences sorted by keys and compare those sequences.
+   (map? left)
+   (let [kv-sort-fn (fn [[key1 _] [key2 _]] (gen-compare key1 key2))
+         left-kvs (sort kv-sort-fn (seq left))
+         right-kvs (sort kv-sort-fn (seq right))  ]
+
+     (gen-compare left-kvs right-kvs))
+
+   ;; The content is comparable and not a sequence, so simply compare them.
+   (instance? Comparable left)
+   (compare left right)
+
+   ;; Unknown items are just treated as equal for our purposes,
+   ;; since we can't define an ordering.
+   :default 0
+   ))
+
 (sm/defn to-beta-tree :- [schema/BetaNode]
   "Convert a sequence of rules and/or queries into a beta tree. Returns each root."
   [productions :- [schema/Production]]
@@ -467,7 +513,7 @@
         ;; Sort nodes so the same id is assigned consistently,
         ;; then map the to corresponding ids.
         nodes-to-id (zipmap
-                     (sort #(< (hash %1) (hash %2)) nodes)
+                     (sort gen-compare nodes)
                      (range))

         ;; Anonymous function to walk the nodes and


don't set mcount model name manually

don't set mcount model name manually

--- src/main/clojure/org/dada/demo/whales.clj
+++ src/main/clojure/org/dada/demo/whales.clj
@@ -446,11 +446,12 @@
 	 ])
       ))

-(defn mcount [chain tgt-key]
+(defn mcount [chain]
   (fn []
       (let [[downstream-metadata-accessor applicator] (chain)
 	    src-key-type Object ;; TODO: problem - we don't know the src-key yet
-	    tgt-metadata (count-reducer-metadata src-key-type)]
+	    tgt-metadata (count-reducer-metadata src-key-type)
+	    tgt-key "count"]
 	[ ;; get metadata / key
 	 (fn [] [tgt-metadata tgt-key])
 	 ;; apply
@@ -499,13 +500,12 @@
 (def my-whales (mlift whales "my-whales"))

 ;; count up whales by type...
-(execute
- (munion
-  (mcount
-   (msplit my-whales :type false)
-   "count()")
-  "union(count(split(whales, :type)))")
- )
+;; (execute
+;;  (munion
+;;   (mcount
+;;    (msplit my-whales :type false))
+;;   "union(count(split(whales, :type)))")
+;;  )

 ;; count up whales by time by type
 (def #^NavigableSet years
@@ -522,30 +522,32 @@
        (Date. 8 0 1)
        (Date. 9 0 1))))

+;; (execute
+;;  ;; (msplit
+;;  (munion
+;;   (mcount
+;;    (msplit my-whales :time false (fn [time] (list (or (.lower years time) time)))))
+;;   "union(count(split(whales, :time)))")
+;;  ;;  :type
+;;  ;;  false)
+;;  )
+
 (execute
- ;; (msplit
  (munion
   (mcount
-   (msplit my-whales :time false (fn [time] (list (or (.lower years time) time))))
-   "count(split(whales, :time))")
+   (msplit
+    (msplit
+     my-whales
+     :type
+     false)
+    :time
+    false
+    (fn [time] (list (or (.lower years time) time))) ;; TODO: fencepost error...
+    ))
   "union(count(split(whales, :time)))")
- ;;  :type
- ;;  false)
  )

-;; (execute
-;;  (munion
-;; ;;  (msplit
-;;    (mcount
-;;     (msplit
-;;      my-whales
-;;      :type false)
-;;     "count(split(:time))")
-;; ;;   :time
-;; ;;   false
-;; ;;   (fn [time] (list (or (.lower years time) time))))
-;;   "union(split(count(:type(split(:time)))))")
-;;  )
+

 ;;--------------------------------------------------------------------------------


change filter demos over to weight/length, since we are now using type for splitting

--- src/main/clojure/org/dada/demo/whales.clj
+++ src/main/clojure/org/dada/demo/whales.clj
@@ -65,6 +65,9 @@
 	    "beaked whale"
 	    ])

+(def max-weight 172) ;; metric tons
+(def max-length 32.9) ;; metres
+
 (defn rnd [seq] (nth seq (rand-int (count seq))))

 ;; IDEAS
@@ -108,16 +111,19 @@
  whales
  (let [num-whales 1000
        time (System/currentTimeMillis)
-       #^Creator creator (.getCreator whale-metadata)]
+       #^Creator creator (.getCreator whale-metadata)
+       max-length-x-100 (* max-length 100)
+       max-weight-x-100 (* max-weight 100)]
    (for [id (range time (+ time num-whales))]
      (.create
       creator
-      (into-array Object
-		  [id
-		   0
-		   (rnd types)
-		   (/ (rand-int 3290) 100)	       ;; 32.9 metres
-		   (/ (rand-int 172) 100)]))))) ;; 172 metric tons
+      (into-array
+       Object
+       [id
+	0
+	(rnd types)
+	(/ (rand-int max-length-x-100) 100)
+	(/ (rand-int max-weight-x-100) 100)])))))

 ;;----------------------------------------

@@ -126,8 +132,15 @@

 ;;----------------------------------------

-(def blue-whales (do-filter "type='blue whale'" whales '(:type) #(= "blue whale" %)))
-(insert *metamodel* blue-whales)
+(let [half-max-length (/ max-length 2)]
+  (def longer-whales (do-filter "longer" whales '(:length) #(> % half-max-length))))
+
+(insert *metamodel* longer-whales)
+
+(let [half-max-weight (/ max-weight 2)]
+  (def heavier-whales (do-filter "heavier" whales '(:weight) #(> % half-max-weight))))
+
+(insert *metamodel* heavier-whales)

 ;;----------------------------------------
 ;; demonstrate transformation - only selecting a subset of the
@@ -135,11 +148,11 @@
 ;; attributes...
 ;;----------------------------------------

-(def blue-whales-weight (do-transform "weight" blue-whales :time :version :weight))
-(insert *metamodel* blue-whales-weight)
-
-(def blue-whales-length (do-transform "length" blue-whales :time :version :length))
-(insert *metamodel* blue-whales-length)
+(def longer-whales-weight (do-transform "weight" longer-whales :time :version :weight))
+(insert *metamodel* longer-whales-weight)
+
+(def heavier-whales-length (do-transform "length" heavier-whales :time :version :length))
+(insert *metamodel* heavier-whales-length)

 ;;----------------------------------------
 ;; try a transformation on top of a filtration


whoops

whoops

--- src/main/clojure/pdok/featured/config.clj
+++ src/main/clojure/pdok/featured/config.clj
@@ -6,8 +6,6 @@
              [projectors :as proj]
              [timeline :as timeline]]
             [environ.core :refer [env]]))
-
-(-> (java.util.logging.LogManager/getLogManager) (.readConfiguration (io/input-stream (io/resource "logging.properties"))))

 (Thread/setDefaultUncaughtExceptionHandler
  (reify Thread$UncaughtExceptionHandler


Fix 'Non-terminating decimal expansion' error in pulse rendering

--- src/metabase/pulse.clj
+++ src/metabase/pulse.clj
@@ -325,12 +325,12 @@
         xmin   (apply min xs)
         xmax   (apply max xs)
         xrange (- xmax xmin)
-        xs'    (map #(/ (- % xmin) xrange) xs)
+        xs'    (map #(/ (float (- % xmin)) xrange) xs)
         ys     (map second rows)
         ymin   (apply min ys)
         ymax   (apply max ys)
         yrange (max 1 (- ymax ymin)) ; `(max 1 ...)` so we don't divide by zero
-        ys'    (map #(/ (- % ymin) yrange) ys)
+        ys'    (map #(/ (float (- % ymin)) yrange) ys) ; cast to float to avoid "Non-terminating decimal expansion" errors
         rows'  (reverse (take-last 2 rows))
         values (map (comp format-number second) rows')
         labels (format-timestamp-pair (map first rows') (first cols))]


add canvas size to client info

add canvas size to client info

--- src/pc/views/admin.clj
+++ src/pc/views/admin.clj
@@ -317,6 +317,7 @@
      [:th "layer count"]
      [:th "logged-in?"]
      [:th "run-time (h:m:s)"]
+     [:th "canvas-size"]
      [:th "subscriber-count"]
      [:th "visibility"]]
     (for [[client-id stats] (reverse (sort-by (comp :last-update second) client-stats))
@@ -342,6 +343,8 @@
        [:td (h/h (get-in stats [:stats :layer-count]))]
        [:td (h/h (get-in stats [:stats :logged-in?]))]
        [:td (h/h (some-> (get-in stats [:stats :run-time-millis]) format-runtime))]
+       [:td (h/h (when-let [canvas-size (get-in stats [:stats :canvas-size])]
+                   (str (:width canvas-size) "x" (:height canvas-size))))]
        [:td (count (get document-subs doc-id))]
        [:td (let [visibility (h/h (get-in stats [:stats :visibility]))]
               (list visibility


some cleanup of namespaces in push.types.*

--- src/push/type/core.clj
+++ src/push/type/core.clj
@@ -1,5 +1,6 @@
 (ns push.type.core
   (:require [push.instructions.core :as core]
+            [push.instructions.dsl :as dsl]
             [push.router.core :as router])
   )

@@ -76,9 +77,9 @@
       instruction-name
       docstring
       :tags #{:arithmetic :base}
-      `(push.instructions.dsl/consume-top-of ~stackname :as :arg1)
-      `(push.instructions.dsl/calculate [:arg1] #(~operation %1) :as :result)
-      `(push.instructions.dsl/push-onto ~stackname :result)))))
+      `(dsl/consume-top-of ~stackname :as :arg1)
+      `(dsl/calculate [:arg1] #(~operation %1) :as :result)
+      `(dsl/push-onto ~stackname :result)))))

 (defn simple-2-in-1-out-instruction
@@ -92,10 +93,10 @@
       instruction-name
       docstring
       :tags #{:arithmetic :base}
-      `(push.instructions.dsl/consume-top-of ~stackname :as :arg2)
-      `(push.instructions.dsl/consume-top-of ~stackname :as :arg1)
-      `(push.instructions.dsl/calculate [:arg1 :arg2] #(~operation %1 %2) :as :result)
-      `(push.instructions.dsl/push-onto ~stackname :result)))))
+      `(dsl/consume-top-of ~stackname :as :arg2)
+      `(dsl/consume-top-of ~stackname :as :arg1)
+      `(dsl/calculate [:arg1 :arg2] #(~operation %1 %2) :as :result)
+      `(dsl/push-onto ~stackname :result)))))

 (defn simple-1-in-predicate
@@ -109,9 +110,9 @@
       instruction-name
       docstring
       :tags #{:arithmetic :base}
-      `(push.instructions.dsl/consume-top-of ~stackname :as :arg1)
-      `(push.instructions.dsl/calculate [:arg1] #(~operation %1) :as :result)
-      '(push.instructions.dsl/push-onto :boolean :result)))))
+      `(dsl/consume-top-of ~stackname :as :arg1)
+      `(dsl/calculate [:arg1] #(~operation %1) :as :result)
+      `(dsl/push-onto :boolean :result)))))

 (defn simple-item-to-code-instruction
@@ -124,6 +125,6 @@
       instruction-name
       (str "`:" instruction-name "` pops the top `" stackname "` item and pushes it to `:code`")
       :tags #{:complex :base :conversion}
-      `(push.instructions.dsl/consume-top-of ~stackname :as :arg)
-      '(push.instructions.dsl/push-onto :code :arg)))))
+      `(dsl/consume-top-of ~stackname :as :arg)
+      `(dsl/push-onto :code :arg)))))


s/warn/info/

s/warn/info/

--- src/babel/korma.clj
+++ src/babel/korma.clj
@@ -49,7 +49,7 @@
               true
               (do
                 (if (not (empty? sequence))
-                  (log/warn (str "using default of 'text' as SQL type for"
+                  (log/info (str "using default of 'text' as SQL type for"
                                  " sequence of type:" (type sequence)
                                  (str " whose first member is of type:"
                                       (type (first sequence)))


Update re-frame in build.boot

Update re-frame in build.boot

--- resources/leiningen/new/exponent/reagent/build.boot
+++ resources/leiningen/new/exponent/reagent/build.boot
@@ -9,7 +9,7 @@
                  [org.clojure/clojure "1.9.0-alpha10"]
                  [org.clojure/clojurescript      "1.9.293"]
                  [reagent "0.6.0-SNAPSHOT" :exclusions [cljsjs/react cljsjs/react-dom cljsjs/react-dom-server]]
-                 [re-frame "0.7.0"]
+                 [re-frame "0.9.1"]
                  [cljs-exponent "0.1.4"]])

 (require


Fix test functions

Fix test functions

--- resources/leiningen/new/lambone/common/dev/boot.clj
+++ resources/leiningen/new/lambone/common/dev/boot.clj
@@ -178,16 +178,13 @@
     exclusions (assoc-in [:test :exclusions] exclusions)))

 (defn test-backend
-  "Run tests once for the backend (uses clojure.test)."
-  [options]
-  (comp (with-pass-thru _
-          (util/dbug "[test-backend] options:\n%s\n" (with-out-str (pprint options)))
-          (apply-options! options)
-          (require 'adzerk.boot-test))
-        (with-pre-wrap fs
-          (let [test (resolve 'adzerk.boot-test/test)
-                middleware (apply test (mapcat identity (:test options)))]
-            ((middleware identity) fs)))))<% endif %>
+  "Run backend tests once."
+  [options]
+  (util/dbug "[test-backend] options:\n%s\n" (with-out-str (pprint options)))
+  (apply-options! options)
+  (require 'adzerk.boot-test)
+  (let [test (resolve 'adzerk.boot-test/test)]
+    (comp (apply test (mapcat identity (:test options))))))<% endif %>
 <% if any frontend %>
 (defn build-frontend
   "Return a boot task for building the frontend.
@@ -250,17 +247,10 @@
                    (assoc-in [:test-cljs :namespaces] namespaces))))

 (defn test-frontend
-  "Run tests once.
-
-  If no type is passed in, it tests against the production build. It
-  optionally accepts (a set of) symbols that are used for testing only
-  some namespaces."
-  [options]
-  (comp (with-pass-thru _
-          (util/dbug "[test-frontend] options:\n%s\n" (with-out-str (pprint options)))
-          (apply-options! options)
-          (require 'crisptrutski.boot-cljs-test))
-        (with-pre-wrap fs
-          (let [test-cljs (resolve 'crisptrutski.boot-cljs-test/test-cljs)
-                middleware (apply test-cljs (mapcat identity (:test-cljs options)))]
-            ((middleware identity) fs)))))<% endif %>+  "Run frontend tests once."
+  [options]
+  (util/dbug "[test-frontend] options:\n%s\n" (with-out-str (pprint options)))
+  (apply-options! options)
+  (require 'crisptrutski.boot-cljs-test)
+  (let [test-cljs (resolve 'crisptrutski.boot-cljs-test/test-cljs)]
+    (comp (apply test-cljs (mapcat identity (:test-cljs options))))))<% endif %>


Repair proppant concentration unit error

--- src/test_utils/fracture_diagnostics.cljc
+++ src/test_utils/fracture_diagnostics.cljc
@@ -24,6 +24,7 @@
                             :length                 [:ft :m]
                             :mass                   [:lb :kg]
                             :power                  [:hp :W]
+                            :proppant-concentration [:lb-per-gal :kg-per-m3]
                             :slurry-rate            [:bpm :m3-per-min]
                             :volume                 [:bbl :m3]
                             :temperature            [:F :C]}]
@@ -631,9 +632,12 @@
        :W (make-measurement typical-energy power-unit) ;; assume energy expended for 1 s
        :hp (power-as (typical-power :W) :hp)))))

-(defn generate-pair [units generate-units-f generate-measurement-f measurement-as-f]
+(defn generate-measurement-pair [units generate-units-f generate-measurement-f measurement-as-f]
   (let [unit        (generate-units-f)
         measurement (generate-measurement-f unit)]
     [measurement (measurement-as-f measurement (first (remove (partial = unit) units)))]))

-(generate-pair #{:F :C} rand-temperature-unit typical-monitor-temperature temperature-as)
+(generate-measurement-pair #{:lb-per-gal :kg-per-m3}
+                           rand-proppant-concentration-unit
+                           typical-proppant-concentration
+                           proppant-concentration-as)