moved pomegranate helpers to comment in utils

--- src/strange_coop/util.clj
+++ src/strange_coop/util.clj
@@ -1,7 +1,6 @@
 (ns strange-coop.util
   (:require [clojure.data.csv :as csv]
-            [clojure.core.async :as async :refer [>!! <!!]]
-            [cemerick.pomegranate :refer [add-dependencies]]))
+            [clojure.core.async :as async :refer [>!! <!!]]))

 (defn log
   [& args]
@@ -54,11 +53,15 @@
   [f]
   (.addShutdownHook (Runtime/getRuntime) (Thread. f)))

-(defn load-dep
-  [dep]
-  (add-dependencies :coordinates [dep] :repositories (merge cemerick.pomegranate.aether/maven-central {"clojars" "http://clojars.org/repo"})))
-
 (defn dequalify-keyword
   [kw]
   (-> :this/that str (clojure.string/split #"\/") last keyword))

+(comment
+  ;; for dev only
+  (require '[cemerick.pomegranate :refer [add-dependencies]])
+  (defn load-dep
+    [dep]
+    (add-dependencies :coordinates [dep] :repositories (merge cemerick.pomegranate.aether/maven-central {"clojars" "http://clojars.org/repo"})))
+  )
+


Try flagging the authentication thread done to stop it, rather than sending it the Die message

--- src/frereth_server/system.clj
+++ src/frereth_server/system.clj
@@ -200,6 +200,7 @@
      (kill-authenticator universe 5))

   ([universe retries]
+     (throw (RuntimeException. "Should this be called from here?"))
      ;; FIXME: Add an atom to universe to indicate that we expect
      ;; authenticator to be around in the first place. If it's the
      ;; first time through, don't waste time on this.
@@ -259,10 +260,18 @@
     (when-let [ctx @(:network-context universe)]
       (println "Have a context to shut down")
       (try
-        (kill-authenticator universe)
-        (println "Authenticator killer didn't throw")
+        ;;(kill-authenticator universe)
+        ;;(println "Authenticator killer didn't throw")
+        (let [done (:done universe)]
+          (when (not @done)
+            (swap! done false)
+            (let [auth-thread @(:authentication-thread universe)]
+              (.join auth-thread 500)
+              (println "Authentication thread has exited"))))
+        (catch InterruptedException e
+          (str "Exception waiting for authentication thread to exit: "
+               (.getMessage e)))
         (finally
-          ;; Or whatever the clojure equivalent is.
           (when-let [sock @(:clients universe)]
             (.close sock))
           (println "Client thread closed")
@@ -277,7 +286,7 @@
           ;; those messages before exiting.
           ;; This does not work.
           ;; FIXME: How do I force it to accept failure?
-          (throw (RuntimeException. "Start here"))
+          ;;(throw (RuntimeException. "Start here"))
           (.term ctx)))))
   (println "Universe destroyed.")
   ;; Just return a completely fresh instance.


Average category transaction

Average category transaction

--- src/swanson/models/db.clj
+++ src/swanson/models/db.clj
@@ -231,3 +231,14 @@
                WHERE date >= date_trunc('month', now()) - INTERVAL '1 month'
                AND date <= date_trunc('MONTH', now()) - INTERVAL '1 day'
                GROUP by category ORDER by amount DESC"]))
+
+(defn category-average
+  "average category transaction per month"
+  [category-id]
+  (jdbc/query db-spec
+              ["SELECT
+               EXTRACT(month from transactions.date) mon,
+               EXTRACT(ISOYEAR from transactions.date) yr,
+               ROUND(AVG(transactions.amount)::numeric, 2) average
+               FROM transactions WHERE category_id = ?
+               GROUP by mon, yr ORDER by mon desc" category-id]))


use xml-to-text at reply, not needed elsewhere

--- src/glory_of_empires/main.clj
+++ src/glory_of_empires/main.clj
@@ -15,14 +15,13 @@

 (defn run-command [ command ]
   (swap! game-state command)
-  "done")
+  "ok")

 (defn get-map
   ( [] (get-map {}) )
   ( [ opts ]
     (let [ m (@game-state :map) ]
-      (if (nil? m) "No map"
-        (xml-to-text (map-to-svg m opts))))))
+      (if (nil? m) "No map" (map-to-svg m opts)))))

 (defn set-random-map
   ( [] (set-random-map { :size 3 } ))
@@ -35,17 +34,18 @@
 (defn reply [ content ]
   { :status 200
     :headers {"Content-Type" "text/html" "Access-Control-Allow-Origin" "*"}
-    :body content }  )
+    :body (xml-to-text content) }  )
+
+(defn handle-exception [ ex ]
+  (println (str ex))
+  [ :span { :style "color: #ff0000;" } (str "Error: " (.getMessage ex)) ] )

 (defn handler [request]
   (println "------------ request received -----------")
   (let [ message-text (slurp (:body request)) ]
     (println message-text)
     (let [ message (read-string message-text) ]
-      (reply
-        (try
-          (eval message)
-          (catch Exception e (do (println (str e)) (str "Error: " (.getMessage e)))))))))
+      (reply (try (eval message) (catch Exception e (handle-exception e)))))))

 (defn -main [& args]
   (reset! game-state (load-from-file "game-state.clj"))


Remove server logging

Remove server logging

--- src/clj/comic_reader/server.clj
+++ src/clj/comic_reader/server.clj
@@ -96,8 +96,6 @@
                      {:keys [chapter page url]} :page-info}
                     :edn-params
                     :as request}
-      (println (:edn-params request))
-      (println)
       (let [site (keyword site)]
         (if-let [img-tag (scrape/fetch-image-tag
                           (sites/image-data site


slight update to static docs.

slight update to static docs.

--- src/clj/forma/source/static.clj
+++ src/clj/forma/source/static.clj
@@ -3,15 +3,9 @@
         [forma.source.modis :only (wgs84-resolution)]
         [forma.static :only (static-datasets)]
         [forma.reproject :only (wgs84-indexer
-<<<<<<< HEAD
                                 modis-indexer)])
   (:require [cascalog.ops :as c]
             [forma.source.modis :as m]
-=======
-                                modis-indexer)]
-        [clojure.string :only (split)])
-  (:require [forma.source.modis :as m]
->>>>>>> wgs84-indexer now accepts ascii-map in all cases.
             [forma.hadoop.predicate :as p]
             [clojure.contrib.duck-streams :as duck]))


Do not eval when checking. EVER.

Do not eval when checking. EVER.

--- src/clj/sally/checkers/core.clj
+++ src/clj/sally/checkers/core.clj
@@ -38,5 +38,6 @@
   ([checkable checkers]
    (for [checker checkers]
      (assoc (:sally (meta checker))
-            :issues (checker checkable))))
+            :issues (binding [*read-eval* false]
+                      (checker checkable)))))
   ([checkable] (check checkable checkers)))


Fix variant 2

Fix variant 2

--- src/cljs/avalon/pages/play.cljs
+++ src/cljs/avalon/pages/play.cljs
@@ -90,7 +90,7 @@
            [:h5 "Prepare and shuffle the " [:strong "Loyalty Deck"] " for Lancelot."
             [:ul
              [:li [:strong "Variant 1"] " - Three \"No Change\" cards, two \"Change Allegiance\" cards, draw a card in rounds 3, 4, and 5."]
-             [:li [:strong "Variant 2"] " - Five \"No Change\" cards, two \"Change Allegiance\" cards, reveal 3 cards at game start. Evil Lancelot must always fail any quest."]]]]])
+             [:li [:strong "Variant 2"] " - Five \"No Change\" cards, two \"Change Allegiance\" cards, reveal a card for each round at game start. Evil Lancelot must always fail any quest."]]]]])
        [row
         [col
          [row


Reindent for line length

Reindent for line length

--- src/cljs/comic_reader/main.cljs
+++ src/cljs/comic_reader/main.cljs
@@ -37,7 +37,8 @@
       (when-let [site-list @site-list]
         [:div
          [:ul (map (id-btn-for-callback
-                    #(r/go-to (r/comics-path {:site (name (:id %))})))
+                    #(r/go-to (r/comics-path
+                               {:site (name (:id %))})))
                    site-list)]]))))

 (defn comic-list []
@@ -59,10 +60,12 @@
 (defn img-component [site
                      {:keys [comic]}
                      {:keys [chapter page tag]}]
+  (.log js/console "Make an img-component.")
   (let [waypoint (clojure.core/atom nil)]
     (reagent/create-class
      {:component-did-mount
       (fn [this]
+        (.log js/console "Did mount.")
         (let [wp (js/Waypoint.
                   #js {:element (reagent/dom-node this)
                        :offset "bottom-in-view"
@@ -75,6 +78,7 @@
           (reset! waypoint wp)))
       :reagent-render
       (fn [site location {:keys [tag]}]
+        (.log js/console "Render.")
         tag)})))

 (defn reader []


add helper to check for unsaved txes

add helper to check for unsaved txes

--- src/cljs/dato/lib/web_peer.cljs
+++ src/cljs/dato/lib/web_peer.cljs
@@ -148,7 +148,6 @@
 (defn maybe-send-next-item
   "Acquires a lock and empties the queue, sending each item sequentially"
   [db-conn send-fn q]
-  ;; TODO: is it possible for items to get stuck on the queue?
   ;; TODO: do lost connections need special logic here?
   (when (lock-send-queue db-conn)
     (go
@@ -180,36 +179,51 @@
 (defn add-item-to-queue [db-conn item]
   (queue/enqueue! (get-queue-atom db-conn) item))

-(defn deref-db [db-conn]
+(defn deref-db
+  "Like deref, but also \"optimistically\" applies txes that haven't been confirmed by the server"
+  [db-conn]
   (reduce (fn [db queued-tx]
             (d/db-with db (:txes queued-tx)))
-          ;; TODO: is it enough to get items from the queue--are things in transit recorded there?
           @db-conn @(get-queue-atom db-conn)))

 (defn transact [db-conn txes & [tx-meta]]
   (let [db (deref-db db-conn)
+        ;; Dependency on earlier txes could cause cascading effects if many
+        ;; transactions are queued and there is a conflict in an early tx.
+        ;; Should optimisic-reports be recalculated if there is a diff between
+        ;; an earlier optimistic report and the actual report?
         optimistic-report (d/with db txes tx-meta)]
     (add-item-to-queue db-conn {:optimistic-report optimistic-report
                                 :txes txes
                                 :guids (make-guid-map optimistic-report)
                                 :tx-meta tx-meta})
-    ;; TODO: will this cause problems? Listeners might be called twice
-    ;;       Could pass in an extra bit of data to indicate that it's optimistic?
-    ;; Should only be called once if no conflicts?
     (doseq [[_ callback] @(:listeners (meta db-conn))]
-      (callback optimistic-report))
+      (callback (assoc optimistic-report :optimistic? true)))
     optimistic-report))

 (defn add-web-peer-metadata [db-conn send-fn meta-data]
   (assert (empty? (::tx-queue meta-data)))
   (let [q (queue/new-queue)]
+    ;; This is overly complicated b/c the queue we built is kind of crappy, but we have
+    ;; requirements for when things should be removed from the queue that core.async
+    ;; doesn't satisfy (we also don't like depending on core.async in a library)
     (queue/add-consumer q (fn [q-atom] (maybe-send-next-item db-conn send-fn q-atom)))
     (assoc meta-data ::tx-queue {:queue q
-                                 :sending (atom #{})
+                                 ;; lock is required so that we can send txes sequentially
                                  :lock (atom nil)})))

-(defn web-peerify-conn [db-conn send-fn]
+(defn web-peerify-conn
+  "Takes a datascript connection and a function to send txes to the server.
+   Modifies the ds conn's metadata to store data needed by web-peer/transact"
+  [db-conn send-fn]
   (alter-meta! db-conn (partial add-web-peer-metadata db-conn send-fn)))
+
+(defn pending-txes?
+  "Checks for pending transactions that haven't been confirmed by the server.
+   Can be used to prevent the user from leaving the page before his changes are saved."
+  [db-conn]
+  (assert (::tx-queue (meta db-conn)) "Called pending-txes? on a non-web-peerified conn")
+  (empty? @(get-queue-atom db-conn)))

 (defn inspect-meta [db-conn]
   (js/console.log (dissoc (meta db-conn)


Run hook to browser navigation once

Run hook to browser navigation once

--- src/cljs/hacker_agent/core.cljs
+++ src/cljs/hacker_agent/core.cljs
@@ -179,4 +179,5 @@
        (secretary/dispatch! (.-token event))))
     (.setEnabled true)))
 ;; need to run this after routes have been defined
-(hook-browser-navigation!)
+(defonce hooked
+  (hook-browser-navigation!))


Get rid of redundant default music and text.

--- src/cljs/leipzig_live/core.cljs
+++ src/cljs/leipzig_live/core.cljs
@@ -1,16 +1,17 @@
 (ns leipzig-live.core
   (:require
-    [leipzig-live.processing] ; Import action definitions.
+    [leipzig-live.processing :as processing]
     [leipzig-live.views :as view]
     [leipzig-live.framework :as framework]
     [reagent.core :as reagent]))

-(def initial-state
-  {:looping? false
-   :music [[1 0.5 1.5] [100 125 150]]
-   :text "[[1 (- 1 0.5) 1.5] [100 (+ 100 25) (* 3 50)]]"})
+(def initial-text "[[1 (- 1 0.5) 1.5] [100 (+ 100 25) (* 3 50)]]")

-(defonce state-atom (reagent/atom initial-state))
+(defonce state-atom
+  (reagent/atom
+    {:looping? false
+     :text initial-text
+     :music (processing/evaluate initial-text)}))

 (defn reload! []
   (swap! state-atom identity))


Mention notabenoid on index page

Mention notabenoid on index page

--- src/cljs/subman/components.cljs
+++ src/cljs/subman/components.cljs
@@ -68,9 +68,12 @@
                                ", "
                                [:a {:href "http://www.podnapisi.net/"
                                     :target "_blank"} "podnapisi.net"]
-                               " and "
+                               ", "
                                [:a {:href "http://subscene.com/"
                                     :target "_blank"} "subscene.com"]
+                               " and "
+                               [:a {:href "http://notabenoid.com/"
+                                    :target "_blank"} "notabenoid.com"]
                                "."]
                               [:p "In query you can specifie language with "
                                [:code ":lang name"]


RR: cljfmt fix

RR: cljfmt fix

--- src/hatti/views/dataview.cljs
+++ src/hatti/views/dataview.cljs
@@ -109,11 +109,14 @@
         views (-> @shared/app-state :views :all)
         settings-views (-> @shared/app-state :views :settings :all)]
     (when (contains? (set settings-views) settings-section)
-      (transact! shared/app-state (fn [app-state]
-                             (-> app-state
-                               (assoc-in [:views] {:selected view})
-                               (assoc-in [:views :settings] {:active-tab settings-section})
-                               (assoc-in [:views :settings :integrated-apps] {:active-section active-section}))))
+      (transact!
+       shared/app-state
+       (fn [app-state]
+         (-> app-state
+             (assoc-in [:views] {:selected view})
+             (assoc-in [:views :settings] {:active-tab settings-section})
+             (assoc-in [:views :settings :integrated-apps]
+                       {:active-section active-section}))))
       (if (= app-type "google_sheets")
         (merge-into-app-state! shared/app-state
                                [:views :settings :integrated-apps]


Add exhaust synonym.

Add exhaust synonym.

--- src/haystack/create_index.clj
+++ src/haystack/create_index.clj
@@ -23,11 +23,14 @@
   )

 (def synonym-list
-  ["romex nm"
+  [
+   "bx mc"
+   "exhaust fart"
+   "gfi gfci"
+   "pipe conduit"
+   "romex nm"
    "so seoow seow soow sow"
-   "pipe conduit"
-   "gfi gfci"
-   "bx mc"])
+   ])

 (defn synonyms
   []


index only stores title

index only stores title

--- src/help_me_im_dumb/index.clj
+++ src/help_me_im_dumb/index.clj
@@ -59,8 +59,7 @@
         url (doc "url")
         comments (doc "comments")
         comment-string (concat (map #(get % "text") comments))]
-    {:url url :text (sanitize-tokens (apply str body " " comment-string))}))
-
+    {:url url :title (sanitize-tokens title) :text (sanitize-tokens (apply str body " " comment-string))}))

 (defn doc-seq-from-file
   "Returns doc lazy seq from file"
@@ -77,7 +76,7 @@
   (apply
    concat
    (map
-    (fn [{id :id tokens :text}]
+    (fn [{id :id tokens :title}]
       (map #(vector id %) tokens))
     doc-seq)))


Fix lazy catcher sequence

Fix lazy catcher sequence

--- src/infoq_podcast/catcher.clj
+++ src/infoq_podcast/catcher.clj
@@ -114,7 +114,7 @@
 (defn latest
   ([] (latest 0))
   ([marker]
-     (let [dom (-> (str base-url "/presentations/" marker) html/dom)]
-       (debug "Fetching page" marker)
-       ;; FIXME: Sequence currently not lazy. But why?!
-       (lazy-cat (overview-ids dom) #_(lazy-seq (latest (+ marker 12)))))))
+     (debug "Fetching overview from index:" marker)
+     (let [dom (-> (str base-url "/presentations/" marker) html/dom)
+           items (overview-ids dom)]
+       (lazy-cat items (latest (+ marker (count items)))))))


Dependancies doesn't need to be a fn

Dependancies doesn't need to be a fn

--- src/kixi/datastore/system.clj
+++ src/kixi/datastore/system.clj
@@ -30,8 +30,7 @@
   [profile]
   (aero/read-config (io/resource "config.edn") {:profile profile}))

-(defn component-dependencies
-  []
+(def component-dependencies
   {:metrics []
    :communications []
    :logging [:metrics]
@@ -80,4 +79,4 @@
   (let [config (config profile)]
     (-> (new-system-map config)
         (configure-components config)
-        (system-using (component-dependencies)))))
+        (system-using component-dependencies))))


Improve error handling on user events.

Improve error handling on user events.

--- src/uxbox/data/users.cljs
+++ src/uxbox/data/users.cljs
@@ -31,13 +31,9 @@
 (defrecord FetchProfile []
   rs/WatchEvent
   (-apply-watch [_ state s]
-    (letfn [(on-error [err]
-              (uum/error (tr "errors.profile-fetch"))
-              (rx/empty))]
-      (->> (rp/req :fetch/profile)
-           (rx/catch on-error)
-           (rx/map :payload)
-           (rx/map profile-fetched)))))
+    (->> (rp/req :fetch/profile)
+         (rx/map :payload)
+         (rx/map profile-fetched))))

 (defn fetch-profile
   []
@@ -48,13 +44,9 @@
 (defrecord UpdateProfile [data]
   rs/WatchEvent
   (-apply-watch [_ state s]
-    (letfn [(on-error [err]
-              (uum/error (tr "errors.update-profile"))
-              (rx/empty))]
-      (->> (rp/req :update/profile data)
-           (rx/catch on-error)
-           (rx/map :payload)
-           (rx/map profile-fetched)))))
+    (->> (rp/req :update/profile data)
+         (rx/map :payload)
+         (rx/map profile-fetched))))

 (defn update-profile
   [data]
@@ -69,27 +61,24 @@

   rs/EffectEvent
   (-apply-effect [_ state]
-    (uum/info (tr "profile.password-saved"))))
+    (udm/info! (tr "profile.password-saved"))))

 ;; --- Update Password

 (defrecord UpdatePassword [data]
   rs/WatchEvent
   (-apply-watch [_ state s]
-    (letfn [(on-error [{payload :payload :as data}]
-              (if (= (:type payload) :form/validation)
-                (rx/of
-                 (forms/assign-errors :profile/password (:payload payload)))
-                (do
-                  (uum/error (tr "errors.profile.update-password") {:timeout 3000})
-                  (rx/empty))))]
+    (letfn [(on-error [{payload :payload}]
+              (->> (:payload payload)
+                   (udf/assign-errors :profile/password)
+                   (rx/of)))]
       (let [params {:old-password (:old-password data)
                     :password (:password-1 data)}]
         (->> (rp/req :update/password params)
-             (rx/map #(->PasswordUpdated))
-             (rx/catch on-error))))))
+             (rx/catch rp/client-error? on-error)
+             (rx/map #(->PasswordUpdated)))))))

-(def update-password-schema
+(def ^:private update-password-schema
   [[:password-1 sc/required sc/string [sc/min-len 6]]
    [:password-2 sc/required sc/string
     [sc/identical-to :password-1 :message "errors.form.password-not-match"]]
@@ -99,5 +88,5 @@
   [data]
   (let [[errors data] (sc/validate data update-password-schema)]
     (if errors
-      (forms/assign-errors :profile/password errors)
+      (udf/assign-errors :profile/password errors)
       (UpdatePassword. data))))


[l.d.build] Crunch library resources too

--- src/leiningen/droid/build.clj
+++ src/leiningen/droid/build.clj
@@ -134,6 +134,9 @@
       (run-dx project (concat [compile-path] deps support-jars
                               external-classes-paths)))))

+;; Because of the AAPT bug we must turn paths to files here so that proper
+;; canonical names are calculated.
+;;
 (defn crunch-resources
   "Updates the pre-processed PNG cache.

@@ -141,10 +144,15 @@
   [{{:keys [res-path out-res-path]} :android :as project}]
   (info "Crunching resources...")
   (ensure-paths res-path)
-  (let [aapt-bin (sdk-binary project :aapt)]
-    (sh aapt-bin "crunch -v"
-        "-S" res-path
-        "-C" out-res-path)))
+  (let [aapt-bin (sdk-binary project :aapt)
+        crunch (fn [src-dir target-dir]
+                 (sh aapt-bin "crunch -v" "-S" src-dir "-C" target-dir))]
+    (doseq [aar (get-aar-files project)
+            :when (.exists ^File (io/file aar "R.txt"))
+            :let [out (io/file aar "out-res")]]
+      (.mkdirs ^File out)
+      (crunch (io/file aar "res") out))
+    (crunch (io/file res-path) (io/file out-res-path))))

 ;; We have to declare a future reference here because `build` and
 ;; `build-project-dependencies` are mutually-recursive.
@@ -231,12 +239,16 @@
         assets (mapcat #(when (.exists (io/file %)) ["-A" (str %)])
                        (concat assets-paths [assets-gen-path]
                                (get-aar-files project "assets")))
-        aar-resources (for [res (get-aar-files project "res")] ["-S" (str res)])
+        aar-resources (for [res (get-aar-files project "res")] ["-S" res])
+        aar-crunched-resources (for [res (get-aar-files project "out-res")
+                                     :when (.exists ^File res)]
+                                 ["-S" res])
         external-resources (for [res external-res-paths] ["-S" res])]
     (sh aapt-bin "package" "--no-crunch" "-f" debug-mode "--auto-add-overlay"
         "-M" manifest-path
         "-S" out-res-path
         "-S" res-path
+        aar-crunched-resources
         aar-resources
         external-resources
         assets


test for uuid in entry data

test for uuid in entry data

--- src/oc/storage/api/boards.clj
+++ src/oc/storage/api/boards.clj
@@ -91,7 +91,8 @@
 ;; ----- Validations -----
 (defn- valid-entry-with-board?
   [conn entry author]
-  (if-let [found-entry (entry-res/get-entry conn (:uuid entry))]
+  (if-let* [entry-uuid (:uuid entry)
+           found-entry (entry-res/get-entry conn entry-uuid)]
     found-entry
     (entry-res/->entry conn entry-res/temp-uuid entry author)))


Take a consistent snapshot of the peer space.

--- src/onyx/coordinator/impl.clj
+++ src/onyx/coordinator/impl.clj
@@ -27,14 +27,23 @@
 (defn complete-task [sync task-node]
   (extensions/create-node sync (str task-node complete-marker)))

-(defn n-peers [sync peers task-node states]
-  (count
-   (filter
-    (fn [peer]
-      (let [state (:content (extensions/dereference sync peer))]
-        (and (= (:task-node state) task-node)
-             (some #{(:state state)} states))))
-    peers)))
+(defn n-peers [sync task-node]
+  (let [peers (extensions/bucket sync :peer-state)
+        counts
+        (reduce
+         (fn [all peer]
+           (let [content (:content (extensions/dereference sync peer))]
+             (if (= task-node (:task-node content))
+               (assoc all (:state content) (inc (get all (:state content) 0)))
+               all)))
+         {}
+         peers)]
+    ;; Avoid NPE on addition
+    (-> counts
+        (assoc :acking (get counts :acking 0))
+        (assoc :active (get counts :active 0))
+        (assoc :waiting (get counts :waiting 0))
+        (assoc :sealing (get counts :sealing 0)))))

 (defmethod extensions/mark-peer-born ZooKeeper
   [sync peer-node]
@@ -117,16 +126,14 @@
   (let [node-data (extensions/read-node sync exhaust-node)
         state-bucket (extensions/bucket sync :peer-state)
         task-node (:task-node node-data)
-        n (n-peers sync state-bucket task-node #{:acking :active :waiting :sealing})
-        n-active (n-peers sync state-bucket task-node #{:active})
-        n-waiting (n-peers sync state-bucket task-node #{:waiting})
-        n-sealing (n-peers sync state-bucket task-node #{:sealing})
+        peers (n-peers sync task-node)
+        n (+ (:acking peers) (:active peers) (:waiting peers) (:sealing peers))
         state-path (extensions/resolve-node sync :peer-state (:id node-data))
         peer-state (:content (extensions/dereference sync state-path))
         same-task? (= (:task-node peer-state) task-node)
         complete? (task-complete? sync task-node)
-        state (if (and (>= n-waiting (dec n))
-                       (zero? n-sealing)
+        state (if (and (>= (:waiting peers) (dec n))
+                       (zero? (:sealing peers))
                        (= (:state peer-state) :active))
                 (assoc peer-state :state :sealing)
                 (assoc peer-state :state :waiting))]
@@ -152,8 +159,8 @@
         state-path (extensions/resolve-node sync :peer-state (:id node-data))
         peer-state (:content (extensions/dereference sync state-path))
         complete? (task-complete? sync (:task-node peer-state))
-        n (n-peers sync (extensions/bucket sync :peer-state)
-                   (:task-node peer-state) #{:acking :active})]
+        peers (n-peers sync (:task-node peer-state))
+        n (+ (:acking peers) (:active peers))]
     (if (and (or (= (:state peer-state) :sealing)
                  (= (:state peer-state) :dead))
              (= (:task-node peer-state) (:task-node node-data)))
@@ -211,7 +218,8 @@
   (let [states (extensions/bucket sync :peer-state)]
     (filter
      (fn [task]
-       (>= (n-peers sync states task #{:active :acking :sealing}) 1))
+       (let [peers (n-peers sync task)]
+         (>= (+ (:acking peers) (:active peers) (:sealing peers)) 1)))
      tasks)))

 (defn next-inactive-task [sync job-node]
@@ -232,8 +240,11 @@
             incomplete-tasks)))

 (defn sort-tasks-by-peer-count [sync tasks]
-  (sort-by #(n-peers sync (extensions/bucket sync :peer-state)
-                     % #{:active :acking :sealing}) (sort tasks)))
+  (sort-by
+   (fn [task]
+     (let [peers (n-peers sync task)]
+       (+ (:acking peers) (:active peers) (:sealing peers))))
+   (sort tasks)))

 (defn next-active-task [sync job-node]
   (let [incomplete-tasks (find-incomplete-concurrent-tasks sync job-node)]


Cosmetic

Cosmetic

--- src/overtime/xsession_gui.clj
+++ src/overtime/xsession_gui.clj
@@ -1,6 +1,5 @@
 (ns overtime.xsession-gui
   (:require [overtone.core :as ot]
-            [overtime.instr-control :as instr]
             [overtime.instr-gui :as gui]
             [overtime.patterns :as pat]
             [overtime.xsession :as xs]


Revert "What even happened"

Revert "What even happened"

This reverts commit 423c30152f7526336afee7f64d7c4a50347f7b01.

--- src/degasolv/cli.clj
+++ src/degasolv/cli.clj
@@ -670,11 +670,8 @@
             :default-desc "semver"
             :validate [#(some #{%} (keys version-comparators))
                        "Version comparison must be 'debian', 'maven', 'naive', 'python', 'rubygem', or 'semver'."]]
-           ]
-     }
     "resolve-locations"
-    {
-     :description "Print the locations of the packages which will resolve all given dependencies."
+    {:description "Print the locations of the packages which will resolve all given dependencies."
      :function resolve-locations!
      :required-arguments {:repositories ["-R" "--repository"]
                           :requirements ["-r" "--requirement"]}
@@ -779,11 +776,9 @@
                           (and (.exists ^java.io.File f)
                                (.canExecute ^java.io.File f)))
                        "Must be an executable file which exists on the file system."]]
-           ]
-    }
+           ]}
     "query-repo"
-    {
-     :description "Query repository for a particular package"
+    {:description "Query repository for a particular package"
      :function query-repo!
      :required-arguments {:repositories ["-R" "--repository"]
                           :query ["-q" "--query"]}
@@ -834,6 +829,8 @@
     }
    }
   )
+
+

 (defn errors [errors usg]
   (string/join \newline


Override ttl for an entry

Override ttl for an entry

--- src/demo/caching.clj
+++ src/demo/caching.clj
@@ -1,6 +1,7 @@
 (ns demo.caching
   (:require [immutant.caching :as c]
-            [immutant.caching.core-memoize :refer [memo]]))
+            [immutant.caching.core-memoize :refer [memo]])
+  (:import java.util.concurrent.TimeUnit))

 ;;; Caches implement org.infinispan.Cache and
 ;;; java.util.concurrent.ConcurrentMap. They are mutable maps, so
@@ -16,8 +17,7 @@
 (.put foo :a 1)

 ;;; Override its time-to-live
-;;; TODO
-;;; (cache/put foo :a 1 {:ttl [1 :hour]})
+(.put foo :a 1, 1 TimeUnit/HOURS)

 ;;; Add all the entries in the map to the cache
 (.putAll foo {:b 2, :c 3})


refactored video

refactored video

--- src/elliot/video.clj
+++ src/elliot/video.clj
@@ -18,11 +18,15 @@
 (s/def ::block (s/keys :req [::block-id ::words]))
 (s/def ::blocks (s/coll-of ::block))

-(defn parse-int [s]
+(defn parse-int
+  "Takes a string and parses out an integer using the regex \\d+."
+  [s]
   (try (Integer. (re-find  #"\d+" s ))
        (catch Exception e 0)))

-(defn parse-block-time [block-time-text]
+(defn parse-block-time
+  "Converts the time block in the .srt file and turns it into a data structure"
+  [block-time-text]
   (->> block-time-text
         (#(clojure.string/split % #" --> "))
        (map #(clojure.string/split % #"[:,]"))
@@ -32,7 +36,9 @@
        (interleave [:start :stop])
        (apply hash-map)))

-(defn time-struct->string [{h :hour m :minute s :second mi :millis}]
+(defn time-struct->string
+  "Takes the time-struct and turns it into a colon seperated string"
+  [{h :hour m :minute s :second mi :millis}]
   (str h ":" m ":" s ":" mi))

 (deftest test-parse-block-time
@@ -42,7 +48,9 @@
          {:start {:hour 0 :second 1 :millis 670 :minute 5}
           :stop  {:hour 0 :second 6 :millis 970 :minute 5}}))))

-(defn load-caption-blocks [f]
+(defn load-caption-blocks
+  "Takes an srt file and assocs in ::block-id ::words ::time"
+  [f]
   (-> (slurp f)
       (clojure.string/replace #"<[^>]+>" "")
       (clojure.string/split #"\r\n\r\n")
@@ -54,7 +62,9 @@
 (deftest video-make
   (println (make "resources/subs/elliot_hulse/p2zvOJe1Iq4_0_en.srt")))

-(defn de-blockify [video key]
+(defn de-blockify
+  "Makes a single list from a key in blocks"
+  [video key]
   (reduce
    #(concat %1 (key %2))
    []


Support custom IConnectionPool implementations

--- src/taoensso/carmine/connections.clj
+++ src/taoensso/carmine/connections.clj
@@ -93,7 +93,7 @@

 (defn conn-pool
   [opts & [cached?]]
-  (if (instance? ConnectionPool opts)
+  (if (satisfies? IConnectionPool opts)
     opts ; 1.x backwards compatiblity, testing
     (if-let [dp (and cached? (@pool-cache opts))]
       @dp


fixing test

fixing test


Updates some sample data.

Updates some sample data.

--- src/tumblr_identity_manager/data.clj
+++ src/tumblr_identity_manager/data.clj
@@ -19,11 +19,11 @@
                         :reflexive "xirself"}
     :social-justice-causes ["manspreading"
                             "microaggressions"
-                            "white able-bodied heterosexual cisgender male privilege"]
-    :trigger-words ["food"
-                    "dessert"
-                    "homogenous"
-                    "cake"]
+                            "white able-bodied heterosexual cisgender species-normative male privilege"]
+    :trigger-words ["uncle"
+                    "mucus"
+                    "penetration"
+                    "rigid"]
     :disabilities ["trans-autism"
                    "trans-immobile"
                    "blood addiction"]
@@ -44,13 +44,13 @@
     :social-justice-causes ["HAES/FA"
                             "shirtgate"
                             "slut shaming"]
-    :nounself-pronouns {:third-singular-subject "accipatheriposimuisea"
-                        :third-singular-object "accipatheriposimoisiam"
-                        :reflexive "accipatheriposimousoself"}
-    :trigger-words ["uncle"
-                    "mucus"
-                    "penetration"
-                    "rigid"]
+    :nounself-pronouns {:third-singular-subject "ziuxi"
+                        :third-singular-object "ziuxous"
+                        :reflexive "ziuxouself"}
+    :trigger-words ["handsome"
+                    "dessert"
+                    "homogenous"
+                    "food"]
     :disabilities ["transobesity"]
     :headmates [7]
     :tuplas [8]}
@@ -182,7 +182,7 @@
                          :p-shift true}
     :social-justice-causes ["alternative medicine"
                             "anti-vax"
-                            "chemtrails awareness"]
+                            "pretty privilege"]
     :nounself-pronouns {:third-singular-subject "qui"
                         :third-singular-object "quir"
                         :reflexive "quirself"}


Make parse-deftype-specs hygenic.

Make parse-deftype-specs hygenic.

In particular, it uses canonical names for the interfaces and
protocols you implement.

--- src/useful/experimental/delegate.clj
+++ src/useful/experimental/delegate.clj
@@ -1,4 +1,19 @@
-(ns useful.experimental.delegate)
+(ns useful.experimental.delegate
+  (:require [useful.ns :as ns]))
+
+(defn canonical-name
+  "Resolve a symbol in the current namespace; but intead of returning its value,
+   return a canonical name that can be used to name the same thing in any
+   namespace."
+  [sym]
+  (if-let [val (resolve sym)]
+    (case (class val)
+      java.lang.Class (symbol (str val))
+      clojure.lang.Var (ns/var-name val)
+      (throw (IllegalArgumentException.
+              (format "%s names %s, an instance of %s, which has no canonical name."
+                      sym val (class val)))))
+    sym))

 (defn parse-deftype-specs
   "Given a mess of deftype specs, possibly with classes/interfaces specified multiple times,
@@ -11,8 +26,9 @@
       (if (seq? x)
         (recur (assoc-in ret [curr-key (first x)] x),
                curr-key, xs)
-        (recur (update-in ret [x] #(or % {})),
-               x, xs))
+        (let [interface-name (canonical-name x)]
+          (recur (update-in ret [interface-name] #(or % {})),
+                 interface-name, xs)))
       ret)))

 (defn emit-deftype-specs


Refactor tests in generate_and_parse and add in commented out test for testing with randomly generated service records

--- umm-spec-lib/test/cmr/umm_spec/test/generate_and_parse.clj
+++ umm-spec-lib/test/cmr/umm_spec/test/generate_and_parse.clj
@@ -40,37 +40,14 @@
    :iso19115 "iso19115.xml"
    :iso-smap "iso_smap.xml"})

-(defn collection-xml-round-trip
+(defn xml-round-trip
   "Returns record after being converted to XML and back to UMM through
   the given to-xml and to-umm mappings."
-  [record format]
-  (let [metadata-xml (core/generate-metadata :collection format record)]
+  [concept-type metadata-format record]
+  (let [metadata-xml (core/generate-metadata concept-type metadata-format record)]
     ;; validate against xml schema
-    (is (empty? (core/validate-xml :collection format metadata-xml)))
-    (core/parse-metadata :collection format metadata-xml)))
-
-(defn service-xml-round-trip
-  "Returns record after being converted to XML and back to UMM through
-  the given to-xml and to-umm mappings."
-  [record format]
-  (let [metadata-xml (core/generate-metadata :service format record)]
-    ;; validate against xml schema
-    (is (empty? (core/validate-xml :service format metadata-xml)))
-    (core/parse-metadata :service format metadata-xml)))
-
-(comment
-  (println (core/generate-metadata :service :serf expected-conversion/example-service-record))
-)
-
-(deftest roundtrip-example-collection-record
-  (doseq [metadata-format tested-collection-formats]
-    (testing (str metadata-format)
-      (is (= (expected-conversion/convert expected-conversion/example-collection-record metadata-format)
-             (collection-xml-round-trip expected-conversion/example-collection-record metadata-format))))))
-
-(deftest roundtrip-example-service-record
-  (is (= (expected-conversion/convert expected-conversion/example-service-record :serf)
-         (service-xml-round-trip expected-conversion/example-service-record :serf))))
+    (is (empty? (core/validate-xml concept-type metadata-format metadata-xml)))
+    (core/parse-metadata concept-type metadata-format metadata-xml)))

 (defn- generate-and-validate-xml
   "Returns a vector of errors (empty if none) from attempting to convert the given UMM record
@@ -78,6 +55,16 @@
   [concept-type metadata-format record]
   (let [metadata-xml (core/generate-metadata concept-type metadata-format record)]
     (core/validate-xml concept-type metadata-format metadata-xml)))
+
+(deftest roundtrip-example-collection-record
+  (doseq [metadata-format tested-collection-formats]
+    (testing (str metadata-format)
+      (is (= (expected-conversion/convert expected-conversion/example-collection-record metadata-format)
+             (xml-round-trip :collection metadata-format expected-conversion/example-collection-record))))))
+
+(deftest roundtrip-example-service-record
+  (is (= (expected-conversion/convert expected-conversion/example-service-record :serf)
+         (xml-round-trip :service :serf expected-conversion/example-service-record))))

 (deftest roundrobin-collection-example-record
   (doseq [[origin-format filename] collection-format-examples
@@ -88,17 +75,18 @@
     (testing (str origin-format " to " dest-format)
       (is (empty? (generate-and-validate-xml :collection dest-format umm-c-record))))))

-(deftest roundtrip-example-record
-  (doseq [metadata-format tested-collection-formats]
-    (testing (str metadata-format)
-      (is (= (expected-conversion/convert expected-conversion/example-collection-record metadata-format)
-             (collection-xml-round-trip expected-conversion/example-collection-record metadata-format))))))
-
 (defspec roundtrip-generated-collection-records 100
   (for-all [umm-record (gen/no-shrink umm-gen/umm-c-generator)
             metadata-format (gen/elements tested-collection-formats)]
     (is (= (expected-conversion/convert umm-record metadata-format)
-           (collection-xml-round-trip umm-record metadata-format)))))
+           (xml-round-trip :collection metadata-format umm-record)))))
+
+;; TODO - Fix these test failures with CMR-2332 and uncomment the test
+#_(defspec roundtrip-generated-service-records 100
+  (for-all [umm-record (gen/no-shrink umm-gen/umm-s-generator)
+            metadata-format (gen/elements tested-service-formats)]
+    (is (= (expected-conversion/convert umm-record metadata-format)
+           (xml-round-trip :service metadata-format umm-record)))))

 (defn- parse-iso19115-projects-keywords
   "Returns the parsed projects keywords for the given ISO19115-2 xml"
@@ -132,7 +120,7 @@
   (println (core/generate-metadata :collection :iso-smap user/failing-value))

   (is (= (expected-conversion/convert user/failing-value :iso-smap)
-         (collection-xml-round-trip user/failing-value :iso-smap)))
+         (xml-round-trip :collection user/failing-value :iso-smap)))

   ;; random XML gen
   (def metadata-format :echo10)
@@ -140,6 +128,12 @@
   (def metadata-format :dif10)
   (def metadata-format :iso19115)
   (def metadata-format :iso-smap)
+  (def metadata-format :serf)
+
+  ;; UMM concept-type
+  (def concept-type :collection)
+  (def concept-type :service)
+

   (def sample-record (first (gen/sample (gen/such-that
                                           #(not-any? :Instruments (:Platforms %))
@@ -154,21 +148,18 @@
   ;; Evaluate to print generated metadata from the record selected above.
   (println (core/generate-metadata :collection metadata-format sample-record))

-  ;; Evaluate to return the UMM parsed from a XML round trip.
-  (xml-round-trip sample-record metadata-format)
-
   ;; our simple example record
   (core/generate-metadata :collection metadata-format expected-conversion/example-record)

   (core/validate-xml :collection metadata-format metadata-xml)

   ;; round-trip
-  (collection-xml-round-trip sample-record metadata-format)
+  (xml-round-trip concept-type metadata-format sample-record)

   ;; Evaluate to see diff between expected conversion and result of XML round trip.
   (is (= (expected-conversion/convert sample-record metadata-format)
-         (collection-xml-round-trip sample-record metadata-format)))
+         (xml-round-trip concept-type metadata-format sample-record)))

   ;; for generated test failures
   (is (= (expected-conversion/convert user/failing-value metadata-format)
-         (collection-xml-round-trip user/failing-value metadata-format))))
+         (xml-round-trip concept-type metadata-format user/failing-value))))


Get template names from resources

Get template names from resources

--- src/nightmod/screens.clj
+++ src/nightmod/screens.clj
@@ -3,6 +3,7 @@
             [clojure.java.io :as io]
             [nightcode.editors :as editors]
             [nightcode.ui :as ui]
+            [nightcode.utils :as nc-utils]
             [nightmod.utils :as u]
             [play-clj.core :refer :all]
             [play-clj.ui :refer :all]
@@ -17,8 +18,7 @@

 (defn read-title
   [f]
-  [(.getCanonicalPath f)
-   (or (-> (io/file f u/properties-file)
+  [(or (-> (io/file f u/properties-file)
             slurp
             edn/read-string
             :title
@@ -27,7 +27,8 @@
            Long/parseLong
            u/format-date
            (try (catch Exception _)))
-       (.getName f))])
+       (.getName f))
+   (.getCanonicalPath f)])

 (defn load-project!
   [path]
@@ -80,14 +81,11 @@
     (when-not @u/main-dir
       (reset! u/main-dir (u/get-data-dir)))
     (let [ui-skin (skin "uiskin.json")
-          create-button (fn [[k v]]
-                          (text-button v ui-skin :set-name k))
-          template-names ["Arcade" "Platformer"
-                          "Orthogonal RPG" "Isometric RPG"
-                          "Barebones 2D" "Barebones 3D"]
+          create-button (fn [[display-name path]]
+                          (text-button display-name ui-skin :set-name path))
           new-games (->> (for [i (range (count templates))]
-                           [(nth templates i)
-                            (nth template-names i)])
+                           [(nc-utils/get-string (nth templates i))
+                            (nth templates i)])
                          (map create-button))
           saved-games (->> (io/file @u/main-dir)
                            .listFiles


eastwood

eastwood

--- src/oc/email/content.clj
+++ src/oc/email/content.clj
@@ -3,7 +3,6 @@
             [clojure.walk :refer (keywordize-keys)]
             [clj-time.format :as format]
             [hiccup.core :as h]
-            [taoensso.timbre :as timbre]
             [oc.lib.text :as text]
             [oc.email.config :as config]))


Fix notification copy for notify messages.

--- src/oc/email/content.clj
+++ src/oc/email/content.clj
@@ -826,8 +826,8 @@
         (str "You were mentioned in a comment: ")
         (str "You were mentioned in a post: "))
       (if (= (:user-id entry-publisher) user-id)
-        (str "There is a new comment on your post:")
-        (str "Also " (:name author) " commented on " (:name entry-publisher) "'s post")))))
+        (str "There is a new comment on your post: ")
+        (str (:name author) " replied to a thread: ")))))

 (defn- notify-content [msg]
   (let [notification (:notification msg)


Capture space outside editor

Capture space outside editor

--- src/fugue/space.cljs
+++ src/fugue/space.cljs
@@ -1,6 +1,7 @@
 (ns fugue.space
   (:require-macros [fugue.env :refer [analyzer-state]])
   (:require [cljs.js]
+            [clojure.string :as s]
             [reagent.core :as r]
             [fugue.boxes :as b]
             [fugue.editor :as editor]))
@@ -69,8 +70,12 @@
     (defn on-keydown [e]
       (let [key (.-key e)]
         (cond
-          (and (not @popup) (= " " key))
-          (show-popup!)
+          (and (not @popup)
+               (= " " key)
+               (not= "textarea" (s/lower-case (.-tagName (.-activeElement js/document)))))
+          (do
+            (print (.-tagName (.-activeElement js/document)))
+            (show-popup!))
           (not (nil? @popup))
           (do
             (.preventDefault e)


Support :ns being a string

Support :ns being a string

--- src/grimoire/doc.clj
+++ src/grimoire/doc.clj
@@ -55,6 +55,18 @@
             (read (java.io.PushbackReader. pbr)))
           (str text))))))

+(defn ns-stringifier [x]
+  (cond (instance? clojure.lang.Namespace x)
+        ,,(ns-name x)
+
+        (string? x)
+        ,,x
+
+        :else
+        ,,(throw
+           (Exception.
+            (str "Don't know how to stringify " x)))))
+
 (defn write-docs-for-var

   [config var]
@@ -62,7 +74,7 @@
                  (assoc  :src  (var->src var)
                          :type (var->type var))
                  (update :name name)
-                 (update :ns   ns-name))]
+                 (update :ns   ns-stringifier))]
     (api/write-meta config
                     (var->thing config var)
                     docs)))


stupid change to launch deploy in heroku

--- src/holston/core.clj
+++ src/holston/core.clj
@@ -13,6 +13,6 @@
   (not-found "
Page not found.
"))

 (defn -main
-  "Starts the application"
+  "Starts the server"
   [port]
   (run-server (site #'all-routes) {:port (Integer. port)}))


Ignore sensors without period.

Ignore sensors without period.

--- src/kixi/hecuba/controller/pipeline.clj
+++ src/kixi/hecuba/controller/pipeline.clj
@@ -77,7 +77,7 @@
                 where     {:device_id device_id :type type}
                 range     (misc/start-end-dates :mislabelled_sensors_check s where)
                 new-item  (assoc item :sensor s :range range)]
-            (when range
+            (when (and range (some #{period} ["INSTANT" "PULSE" "CUMULATIVE"]))
               (log/info  "Checking if mislabelled: " device_id type)
               (checks/mislabelled-sensors store new-item)
               (misc/reset-date-range store s :mislabelled_sensors_check (:start-date range) (:end-date range))))))


New tests: test-override-options-by-cli

New tests: test-override-options-by-cli

--- test/emender_jenkins/config_test.clj
+++ test/emender_jenkins/config_test.clj
@@ -329,3 +329,26 @@
             (-> cfg :jenkins :jenkins-job-list-url)    "api/json?tree=jobs[name,url,color,scm[userRemoteConfigs[url]],buildable,lastSuccessfulBuild[description]]"
             (-> cfg :jenkins :jenkins-auth)            ""))))

+(deftest test-override-options-by-cli-2
+    "Check the behaviour of function emender-jenkins.config/override-options-by-cli."
+    (testing "the behaviour of function emender-jenkins.config/override-options-by-cli."
+    (let [cfg (-> (load-configuration-from-ini "test/test1.ini")
+                  (override-options-by-cli "new-jenkins-url" nil))]
+        (are [x y] (= x y)
+            (-> cfg :info  :version)                   "0.1.0"
+            (-> cfg :jenkins :jenkins-url)             "new-jenkins-url"
+            (-> cfg :jenkins :jenkins-job-prefix-url)  "job/"
+            (-> cfg :jenkins :jenkins-job-list-url)    "api/json?tree=jobs[name,url,color,scm[userRemoteConfigs[url]],buildable,lastSuccessfulBuild[description]]"
+            (-> cfg :jenkins :jenkins-auth)            ""))))
+
+(deftest test-override-options-by-cli-3
+    "Check the behaviour of function emender-jenkins.config/override-options-by-cli."
+    (testing "the behaviour of function emender-jenkins.config/override-options-by-cli."
+    (let [cfg (-> (load-configuration-from-ini "test/test1.ini")
+                  (override-options-by-cli nil "jobs-suffix"))]
+        (are [x y] (= x y)
+            (-> cfg :info  :version)                   "0.1.0"
+            (-> cfg :jenkins :jenkins-url)             "http://10.20.30.40:8080/"
+            (-> cfg :jenkins :jenkins-job-list-url)    "api/json?tree=jobs[name,url,color,scm[userRemoteConfigs[url]],buildable,lastSuccessfulBuild[description]]"
+            (-> cfg :jenkins :jenkins-auth)            ""))))
+


Fixed last timestamp update in poller

Fixed last timestamp update in poller

--- src/polismath/poller.clj
+++ src/polismath/poller.clj
@@ -137,7 +137,8 @@
             (->> (format-conv-for-mongo prep-for-uploading-bidToPid-mapping (@conversations zid) zid lastVoteTimestamp)
               (mongo-upsert-results (mongo-collection-name "bidToPid")))))

-        ; Update last-timestamp
-        (swap! last-timestamp (fn [_] (:created (last new-votes))))))))
+        ; Update last-timestamp, if needed
+        (when-let [last-vote (last new-votes)]
+          (swap! last-timestamp (fn [_] (:created last-vote))))))))


Fix lint

Fix lint

--- test/icecap/schema_test.clj
+++ test/icecap/schema_test.clj
@@ -19,8 +19,10 @@
   (testing "plans with one step in them don't validate"
     (are [example reason] (= (pr-str (s/check Plan example))
                              (pr-str reason))
-         [simple-http-step] '(not ("collection of two or more plans" a-clojure.lang.PersistentVector))
-         #{simple-http-step} '(not ("collection of two or more plans" a-clojure.lang.PersistentHashSet))))
+         [simple-http-step] '(not ("collection of two or more plans"
+                                   a-clojure.lang.PersistentVector))
+         #{simple-http-step} '(not ("collection of two or more plans"
+                                    a-clojure.lang.PersistentHashSet))))
   (testing "plans with empty steps in them don't validate"
     (are [example reason] (= (pr-str (s/check Plan example))
                              (pr-str reason))


Use the latest reagent

Use the latest reagent

--- examples/todomvc/project.clj
+++ examples/todomvc/project.clj
@@ -1,7 +1,7 @@
 (defproject todomvc-re-frame "0.3.0"
   :dependencies [[org.clojure/clojure "1.6.0"]
                  [org.clojure/clojurescript "0.0-2816"]
-                 [reagent "0.5.0-alpha3"]
+                 [reagent "0.5.0"]
                  [re-frame "0.3.0"]
                  [secretary "1.2.1"]]


added tests for reagent template and snippet implementations

--- test/kioo/reagent_test.cljs
+++ test/kioo/reagent_test.cljs
@@ -8,7 +8,8 @@
             [reagent.core :as reagent :refer [atom]]
             [kioo.util :as util]
             [goog.dom :as gdom])
-  (:require-macros [kioo.reagent :refer [component]]
+  (:require-macros [kioo.reagent :refer [component snippet template
+                                         deftemplate defsnippet]]
                    [cemerick.cljs.test :refer [are is deftest testing]]))

 ;; all text get surrounded by spans in om
@@ -159,3 +160,44 @@
                           {[:div] (html-content "
t1
t2")})]
       (is (= "

t1
t2
"
              (render-dom comp))))))
+
+
+(defsnippet snip1 "wrap-test.html" [:span] [] {})
+(deftemplate tmp1 "simple-div.html" [] {})
+(defsnippet snip2 "wrap-test.html" [:span] [val]
+  {[:span] (content val)})
+(deftemplate tmp2 "simple-div.html" [val]
+  {[:div] (content val)})
+
+
+(deftest snippet-template-test
+  (testing "basic setup for snippet"
+    (let [comp (snippet "wrap-test.html" [:span] [] {})]
+      (is (= "testing"
+             (render-dom comp)))))
+  (testing "basic setup for template"
+    (let [comp (template "simple-div.html" [] {})]
+      (is (= "
test
"
+             (render-dom comp)))))
+  (testing "simple transorm for snippet"
+    (let [comp (snippet "wrap-test.html" [:span] [val]
+                        {[:span] (content val)})]
+      (is (= "test"
+             (render-dom #(comp "test"))))))
+  (testing "simple transform for template"
+    (let [comp (template "simple-div.html" [val]
+                         {[:div] (content val)})]
+      (is (= "
success
"
+             (render-dom #(comp "success"))))))
+  (testing "basic setup for defsnippet"
+    (is (= "testing"
+           (render-dom snip1))))
+  (testing "basic setup for deftemplate"
+    (is (= "
test
"
+           (render-dom tmp1))))
+  (testing "simple transfrom for defsnippet"
+    (is (= "test"
+           (render-dom #(snip2 "test")))))
+  (testing "simple transform for deftemplate"
+    (is (= "
success
"
+           (render-dom #(tmp2 "success"))))))


Use new table for method repo.

Use new table for method repo.

--- src/cljs/org/broadinstitute/firecloud_ui/page/method_repo.cljs
+++ src/cljs/org/broadinstitute/firecloud_ui/page/method_repo.cljs
@@ -5,7 +5,7 @@
    [org.broadinstitute.firecloud-ui.common :as common]
    [org.broadinstitute.firecloud-ui.common.components :as comps]
    [org.broadinstitute.firecloud-ui.common.style :as style]
-   [org.broadinstitute.firecloud-ui.common.table :as table]
+   [org.broadinstitute.firecloud-ui.common.table-v2 :as table]
    [org.broadinstitute.firecloud-ui.utils :as utils :refer [rlog jslog cljslog]]
    ))

@@ -15,28 +15,16 @@
    (fn [{:keys [props]}]
      [:div {:style {:padding "0 4em"}}
       (if (zero? (count (:methods props)))
-        [:div {:style {:textAlign "center" :backgroundColor (:background-gray style/colors)
-                       :padding "1em 0" :borderRadius 8}}
-         "No methods to display."]
+        (style/create-message-well "No methods to display.")
         [table/Table
-         (let [cell-style {:flexBasis "8ex" :flexGrow 1 :whiteSpace "nowrap" :overflow "hidden"
-                           :borderLeft (str "1px solid " (:line-gray style/colors))}
-               header-label (fn [text & [padding]]
-                              [:span {:style {:paddingLeft (or padding "1em")}}
-                               [:span {:style {:fontSize "90%"}} text]])]
-           {:columns [{:label (header-label "Namespace")
-                       :style (merge cell-style {:borderLeft "none"})}
-                      {:label (header-label "Name")
-                       :style cell-style
-                       :header-style {:borderLeft "none"}}
-                      {:label (header-label "Synopsis")
-                       :style (merge cell-style {:flexBasis "30ex"})
-                       :header-style {:borderLeft "none"}}]
-            :data (map (fn [m]
-                         [(m "namespace")
-                          (m "name")
-                          (m "synopsis")])
-                       (:methods props))})])])})
+         {:columns [{:header "Namespace" :starting-width 100}
+                    {:header "Name" :starting-width 100}
+                    {:header "Synopsis" :starting-width 300}]
+          :data (map (fn [m]
+                       [(m "namespace")
+                        (m "name")
+                        (m "synopsis")])
+                  (:methods props))}])])})

 (defn- contains-text [text fields]


fixing up dashboard api test.

fixing up dashboard api test.

--- test/metabase/api/dashboard_test.clj
+++ test/metabase/api/dashboard_test.clj
@@ -43,6 +43,7 @@
                :last_name $
                :last_login $
                :is_superuser $
+               :is_qbnewb $
                :common_name $}))

 (defn dashcard-response [{:keys [card created_at updated_at] :as dashcard}]
@@ -91,83 +92,48 @@

 ;; ## GET /api/dashboard/:id
-; <<<<<<< HEAD
-; (expect
-;   {:name            "Test Dashboard"
-;    :description     nil
-;    :creator_id      (user->id :rasta)
-;    :creator         (user-details (fetch-user :rasta))
-;    :public_perms    0
-;    :can_read        true
-;    :can_write       true
-;    :updated_at      true
-;    :created_at      true
-;    :ordered_cards   [{:sizeX        2
-;                       :sizeY        2
-;                       :col          nil
-;                       :row          nil
-;                       :updated_at   true
-;                       :created_at   true
-;                       :card         {:name                   "Dashboard Test Card"
-;                                      :description            nil
-;                                      :public_perms           0
-;                                      :creator_id             (user->id :rasta)
-;                                      :creator                (user-details (fetch-user :rasta))
-;                                      :organization_id        nil
-;                                      :display                "scalar"
-;                                      :query_type             nil
-;                                      :dataset_query          {:something "simple"}
-;                                      :visualization_settings {:global {:title nil}}}
-;                       :series       []}]
-;    :organization_id nil}
-;   ;; fetch a dashboard WITH a dashboard card on it
-;   (tu/with-temp Dashboard [{dashboard-id :id} {:name         "Test Dashboard"
-;                                                :public_perms 0
-;                                                :creator_id   (user->id :rasta)}]
-;     (tu/with-temp Card [{card-id :id} {:name                   "Dashboard Test Card"
-;                                        :creator_id             (user->id :rasta)
-;                                        :public_perms           0
-;                                        :display                "scalar"
-;                                        :dataset_query          {:something "simple"}
-;                                        :visualization_settings {:global {:title nil}}}]
-;       (tu/with-temp DashboardCard [_ {:dashboard_id dashboard-id
-;                                       :card_id      card-id}]
-;         (-> ((user->client :rasta) :get 200 (format "dashboard/%d" dashboard-id))
-;             dashboard-response)))))
-; =======
-; ;; Test that we can fetch a Dashboard, and that it comes back wrapped in a "dashboard" dictionary (WHY?!)
-; (expect-let [dash (create-dash (random-name))]
-;   {:dashboard
-;    (match-$ dash
-;      {:description     nil
-;       :can_read        true
-;       :ordered_cards   []
-;       :creator         (-> (User (user->id :rasta))
-;                            (select-keys [:email :first_name :last_login :is_superuser :is_qbnewb :id :last_name :date_joined :common_name]))
-;       :can_write       true
-;       :organization_id nil
-;       :name            $
-;       :creator_id      (user->id :rasta)
-;       :updated_at      $
-;       :id              $
-;       :public_perms    0
-;       :created_at      $})}
-;   ((user->client :rasta) :get 200 (format "dashboard/%d" (:id dash))))
-;
-; ;; Check that only the creator of a Dashboard sees it when it isn't public
-; (expect [true
-;          false]
-;   (with-temp Dashboard [{:keys [id]} {:name (random-name)
-;                                       :public_perms common/perms-none
-;                                       :creator_id (user->id :crowberto)}]
-;     (let [can-see-dash? (fn [user]
-;                           (contains? (->> ((user->client user) :get 200 "dashboard" :f :all)
-;                                           (map :id)
-;                                           set)
-;                                      id))]
-;       [(can-see-dash? :crowberto)
-;        (can-see-dash? :rasta)])))
-; >>>>>>> e4277aea02fa2f1e4d5e6d2d42546a4c277cefcf
+(expect
+  {:name            "Test Dashboard"
+   :description     nil
+   :creator_id      (user->id :rasta)
+   :creator         (user-details (fetch-user :rasta))
+   :public_perms    0
+   :can_read        true
+   :can_write       true
+   :updated_at      true
+   :created_at      true
+   :ordered_cards   [{:sizeX        2
+                      :sizeY        2
+                      :col          nil
+                      :row          nil
+                      :updated_at   true
+                      :created_at   true
+                      :card         {:name                   "Dashboard Test Card"
+                                     :description            nil
+                                     :public_perms           0
+                                     :creator_id             (user->id :rasta)
+                                     :creator                (user-details (fetch-user :rasta))
+                                     :organization_id        nil
+                                     :display                "scalar"
+                                     :query_type             nil
+                                     :dataset_query          {:something "simple"}
+                                     :visualization_settings {:global {:title nil}}}
+                      :series       []}]
+   :organization_id nil}
+  ;; fetch a dashboard WITH a dashboard card on it
+  (tu/with-temp Dashboard [{dashboard-id :id} {:name         "Test Dashboard"
+                                               :public_perms 0
+                                               :creator_id   (user->id :rasta)}]
+    (tu/with-temp Card [{card-id :id} {:name                   "Dashboard Test Card"
+                                       :creator_id             (user->id :rasta)
+                                       :public_perms           0
+                                       :display                "scalar"
+                                       :dataset_query          {:something "simple"}
+                                       :visualization_settings {:global {:title nil}}}]
+      (tu/with-temp DashboardCard [_ {:dashboard_id dashboard-id
+                                      :card_id      card-id}]
+        (-> ((user->client :rasta) :get 200 (format "dashboard/%d" dashboard-id))
+            dashboard-response)))))

 ;; ## PUT /api/dashboard/:id
@@ -220,121 +186,77 @@
 ;; # DASHBOARD CARD ENDPOINTS

 ;; ## POST /api/dashboard/:id/cards
-; <<<<<<< HEAD
-; ;; simple creation with no additional series
-; (expect
-;   [{:sizeX        2
-;     :sizeY        2
-;     :col          4
-;     :row          4
-;     :series       []
-;     :created_at   true
-;     :updated_at   true}
-;    [{:sizeX        2
-;      :sizeY        2
-;      :col          4
-;      :row          4}]]
-;   (tu/with-temp Dashboard [{dashboard-id :id} {:name         "Test Dashboard"
-;                                                :public_perms 0
-;                                                :creator_id   (user->id :rasta)}]
-;     (tu/with-temp Card [{card-id :id} {:name                   "Dashboard Test Card"
-;                                        :creator_id             (user->id :rasta)
-;                                        :public_perms           0
-;                                        :display                "scalar"
-;                                        :dataset_query          {:something "simple"}
-;                                        :visualization_settings {:global {:title nil}}}]
-;       [(-> ((user->client :rasta) :post 200 (format "dashboard/%d/cards" dashboard-id) {:cardId card-id
-;                                                                                :row    4
-;                                                                                :col    4})
-;            (dissoc :id :dashboard_id :card_id)
-;            (update :created_at #(not (nil? %)))
-;            (update :updated_at #(not (nil? %))))
-;        (db/sel :many :fields [DashboardCard :sizeX :sizeY :col :row] :dashboard_id dashboard-id)])))
-;
-; ;; new dashboard card w/ additional series
-; (expect
-;   [{:sizeX        2
-;     :sizeY        2
-;     :col          4
-;     :row          4
-;     :series       [{:name                   "Series Card"
-;                     :description            nil
-;                     :display                "scalar"
-;                     :dataset_query          {:something "simple"}
-;                     :visualization_settings {}}]
-;     :created_at   true
-;     :updated_at   true}
-;    [{:sizeX        2
-;      :sizeY        2
-;      :col          4
-;      :row          4}]
-;    [0]]
-;   (tu/with-temp Dashboard [{dashboard-id :id} {:name         "Test Dashboard"
-;                                                :public_perms 0
-;                                                :creator_id   (user->id :rasta)}]
-;     (tu/with-temp Card [{card-id :id} {:name                   "Dashboard Test Card"
-;                                        :creator_id             (user->id :rasta)
-;                                        :public_perms           0
-;                                        :display                "scalar"
-;                                        :dataset_query          {:something "simple"}
-;                                        :visualization_settings {}}]
-;       (tu/with-temp Card [{series-id1 :id} {:name                   "Series Card"
-;                                             :creator_id             (user->id :rasta)
-;                                             :public_perms           0
-;                                             :display                "scalar"
-;                                             :dataset_query          {:something "simple"}
-;                                             :visualization_settings {}}]
-;         (let [dashboard-card ((user->client :rasta) :post 200 (format "dashboard/%d/cards" dashboard-id) {:cardId card-id
-;                                                                                :row    4
-;                                                                                :col    4
-;                                                                                :series [{:id series-id1}]})]
-;           [(remove-ids-and-boolean-timestamps dashboard-card)
-;            (db/sel :many :fields [DashboardCard :sizeX :sizeY :col :row] :dashboard_id dashboard-id)
-;            (db/sel :many :field [DashboardCardSeries :position] :dashboardcard_id (:id dashboard-card))])))))
-;
-; =======
-; ;; Can we add a Card to a Dashboard?
-; (let [card-name (random-name)
-;       dash-name (random-name)]
-;   (expect-eval-actual-first
-;       (let [{card-id :id :as card} (sel :one Card :name card-name)
-;             dash-id (sel :one :id Dashboard :name dash-name)]
-;         [(match-$ (sel :one DashboardCard :dashboard_id dash-id :card_id card-id)
-;            {:sizeX        2
-;             :card         (match-$ card
-;                             {:description            nil
-;                              :creator                (-> (User (user->id :rasta))
-;                                                          (select-keys [:date_joined :last_name :id :is_superuser :is_qbnewb :last_login :first_name :email :common_name]))
-;                              :organization_id        nil
-;                              :name                   $
-;                              :creator_id             (user->id :rasta)
-;                              :updated_at             $
-;                              :dataset_query          (obj->json->obj (ql/wrap-inner-query
-;                                                                        (query categories
-;                                                                          (ql/aggregation (ql/count)))))
-;                              :id                     card-id
-;                              :display                "scalar"
-;                              :visualization_settings {:global {:title nil}}
-;                              :public_perms           0
-;                              :created_at             $
-;                              :database_id            (id)
-;                              :table_id               (id :categories)
-;                              :query_type             "query"})
-;             :updated_at   $
-;             :col          nil
-;             :id           $
-;             :card_id      card-id
-;             :dashboard_id dash-id
-;             :created_at   $
-;             :sizeY        2
-;             :row          nil})])
-;       (let [{card-id :id} (post-card card-name)
-;             {dash-id :id} (create-dash dash-name)]
-;         ((user->client :rasta) :post 200 (format "dashboard/%d/cards" dash-id) {:cardId card-id})
-;         (->> ((user->client :rasta) :get 200 (format "dashboard/%d" dash-id))
-;              :dashboard
-;              :ordered_cards))))
-; >>>>>>> e4277aea02fa2f1e4d5e6d2d42546a4c277cefcf
+;; simple creation with no additional series
+(expect
+  [{:sizeX        2
+    :sizeY        2
+    :col          4
+    :row          4
+    :series       []
+    :created_at   true
+    :updated_at   true}
+   [{:sizeX        2
+     :sizeY        2
+     :col          4
+     :row          4}]]
+  (tu/with-temp Dashboard [{dashboard-id :id} {:name         "Test Dashboard"
+                                               :public_perms 0
+                                               :creator_id   (user->id :rasta)}]
+    (tu/with-temp Card [{card-id :id} {:name                   "Dashboard Test Card"
+                                       :creator_id             (user->id :rasta)
+                                       :public_perms           0
+                                       :display                "scalar"
+                                       :dataset_query          {:something "simple"}
+                                       :visualization_settings {:global {:title nil}}}]
+      [(-> ((user->client :rasta) :post 200 (format "dashboard/%d/cards" dashboard-id) {:cardId card-id
+                                                                                :row    4
+                                                                                :col    4})
+           (dissoc :id :dashboard_id :card_id)
+           (update :created_at #(not (nil? %)))
+           (update :updated_at #(not (nil? %))))
+       (db/sel :many :fields [DashboardCard :sizeX :sizeY :col :row] :dashboard_id dashboard-id)])))
+
+;; new dashboard card w/ additional series
+(expect
+  [{:sizeX        2
+    :sizeY        2
+    :col          4
+    :row          4
+    :series       [{:name                   "Series Card"
+                    :description            nil
+                    :display                "scalar"
+                    :dataset_query          {:something "simple"}
+                    :visualization_settings {}}]
+    :created_at   true
+    :updated_at   true}
+   [{:sizeX        2
+     :sizeY        2
+     :col          4
+     :row          4}]
+   [0]]
+  (tu/with-temp Dashboard [{dashboard-id :id} {:name         "Test Dashboard"
+                                               :public_perms 0
+                                               :creator_id   (user->id :rasta)}]
+    (tu/with-temp Card [{card-id :id} {:name                   "Dashboard Test Card"
+                                       :creator_id             (user->id :rasta)
+                                       :public_perms           0
+                                       :display                "scalar"
+                                       :dataset_query          {:something "simple"}
+                                       :visualization_settings {}}]
+      (tu/with-temp Card [{series-id1 :id} {:name                   "Series Card"
+                                            :creator_id             (user->id :rasta)
+                                            :public_perms           0
+                                            :display                "scalar"
+                                            :dataset_query          {:something "simple"}
+                                            :visualization_settings {}}]
+        (let [dashboard-card ((user->client :rasta) :post 200 (format "dashboard/%d/cards" dashboard-id) {:cardId card-id
+                                                                                :row    4
+                                                                                :col    4
+                                                                                :series [{:id series-id1}]})]
+          [(remove-ids-and-boolean-timestamps dashboard-card)
+           (db/sel :many :fields [DashboardCard :sizeX :sizeY :col :row] :dashboard_id dashboard-id)
+           (db/sel :many :field [DashboardCardSeries :position] :dashboardcard_id (:id dashboard-card))])))))
+

 ;; ## DELETE /api/dashboard/:id/cards
 (expect


covered the failure cases of the n-of checkers


Repair analyzer test.

Repair analyzer test.

--- test/onyx/analyzer_test.clj
+++ test/onyx/analyzer_test.clj
@@ -9,29 +9,34 @@
   (try
     (s/validate schema v)
     (catch Throwable t
-      (a/analyze-error t))))
+      (a/analyze-error {} t))))

 (deftest workflow-errors
   (is (= {:error-type :value-predicate-error
           :error-key 1
           :error-value "b"
-          :predicate 'task-name?}
+          :predicate 'task-name?
+          :path [0 1]}
          (validate! os/Workflow [[:a "b"]])))

   (is (= {:error-type :type-error
           :expected-type clojure.lang.PersistentVector
           :found-type clojure.lang.Keyword
           :error-key 1
-          :error-value :c}
+          :error-value :c
+          :path [1]}
          (validate! os/Workflow [[:a :b] :c])))

   (is (= {:error-type :constraint-violated
-          :predicate 'edge-two-nodes?}
+          :predicate 'edge-two-nodes?
+          :path [0]}
          (validate! os/Workflow [[:a :b :c]]))))

 (deftest task-map-errors
   (is (= {:error-type :conditional-failed
           :error-key nil
+          :error-value {}
+          :path nil
           :predicates '[onyx-input-task-type
                         onyx-output-task-type
                         onyx-function-task-type]}
@@ -39,24 +44,29 @@

   (is (= {:error-type :conditional-failed
           :error-key :onyx/type
+          :error-value {:onyx/type :reader}
+          :path nil
           :predicates '[onyx-input-task-type
                         onyx-output-task-type
                         onyx-function-task-type]}
          (validate! os/TaskMap {:onyx/type :reader})))

   (is (= {:error-type :missing-required-key
-          :missing-key :onyx/plugin}
+          :missing-key :onyx/plugin
+          :path [:onyx/plugin]}
          (validate! os/TaskMap {:onyx/type :input})))

   (is (= {:error-type :conditional-failed
-          :predicates ['keyword-namespaced?
-                       'keyword?]
-          :error-key :onyx/plugin}
+          :error-value "Foo"
+          :predicates ['keyword-namespaced? 'keyword?]
+          :error-key :onyx/plugin
+          :path [:onyx/plugin]}
          (validate! os/TaskMap {:onyx/type :input
                                 :onyx/plugin "Foo"})))

   (is (= {:error-type :missing-required-key
-          :missing-key :onyx/medium}
+          :missing-key :onyx/medium
+          :path [:onyx/medium]}
          (validate! os/TaskMap {:onyx/type :input
                                 :onyx/plugin :a})))

@@ -64,7 +74,8 @@
           :expected-type clojure.lang.Keyword
           :found-type java.lang.Long
           :error-value 42
-          :error-key :onyx/medium}
+          :error-key :onyx/medium
+          :path [:onyx/medium]}
          (validate! os/TaskMap {:onyx/type :input
                                 :onyx/plugin :a
                                 :onyx/medium 42})))
@@ -72,7 +83,8 @@
   (is (= {:error-type :value-predicate-error
           :error-key :onyx/name
           :error-value "hello"
-          :predicate 'task-name?}
+          :predicate 'task-name?
+          :path [:onyx/name]}
          (validate! os/TaskMap {:onyx/name "hello"
                                 :onyx/type :input
                                 :onyx/plugin :a
@@ -82,7 +94,8 @@
           :expected-type java.lang.Integer
           :found-type clojure.lang.Keyword
           :error-value :invalid
-          :error-key :onyx/batch-size}
+          :error-key :onyx/batch-size
+          :path [:onyx/batch-size]}
          (validate! os/TaskMap {:onyx/name :hello
                                 :onyx/type :input
                                 :onyx/plugin :a
@@ -93,7 +106,8 @@
           :expected-type java.lang.String
           :found-type java.lang.Long
           :error-value 42
-          :error-key :onyx/doc}
+          :error-key :onyx/doc
+          :path [:onyx/doc]}
          (validate! os/TaskMap {:onyx/name :hello
                                 :onyx/type :input
                                 :onyx/plugin :a


Bad let binding

Bad let binding

--- test/onyx/log/replica_invariants.clj
+++ test/onyx/log/replica_invariants.clj
@@ -20,13 +20,13 @@
         slot-id-peers (mapcat keys (vals (reduce merge (vals task-slot-ids))))]
     (mapv (fn [coll]
             (is (empty? (remove (set peers) coll))))
-          (map keys [peer-state peer-sites prepared accepted pairs])))
+          (map keys [peer-state peer-sites prepared accepted pairs]))

-  (testing "slot ids only allocated once"
-    (is (= slot-id-peers
-           (distinct slot-id-peers))))
-  (is (empty? (remove (set peers) slot-id-peers)))
-  (is (empty? (reduce dissoc peer-allocations peers))))
+    (testing "slot ids only allocated once"
+      (is (= slot-id-peers
+             (distinct slot-id-peers))))
+    (is (empty? (remove (set peers) slot-id-peers)))
+    (is (empty? (reduce dissoc peer-allocations peers)))))

 (defn standard-invariants [replica]
   (job-id-invariants replica)


that should not have been there, for one

--- src/hermes/stuff/hermesutil.clj
+++ src/hermes/stuff/hermesutil.clj
@@ -33,9 +33,7 @@
 (defn
   open
   [& params]
-  {:pre [(assumedNonNilGraph [params
-                              "if you wanted to open in memory graph, don't pass nil"]
-           )
+  {:pre [
          (assumeNotLeakedGraph)
          ]
    :post [(assumeNotLeakedGraph)]


Fix mistakes from last checkin

Fix mistakes from last checkin

--- src/re_com/validate.cljs
+++ src/re_com/validate.cljs
@@ -38,29 +38,37 @@
   (.warn js/console (apply str args))
   false)

+
+(defn hash-map-with-name-keys
+  [v]
+  (zipmap (map :name v) v))
+
+
 (defn extract-arg-data
   "Package up all the relevant data for validation purposes from the xxx-args-desc map into a new map."
   [args-desc]
-  {:names       (set (map :name args-desc))
-   :required    (->> args-desc
-                     (filter :required)
-                     (map :name)
-                     set)
-   :validate-fns (filter :validate-fn args-desc)})
+  {:arg-names      (set (map :name args-desc))
+   :required-args  (->> args-desc
+                        (filter :required)
+                        (map :name)
+                        set)
+   :validated-args (->> (filter :validate-fn args-desc)
+                        vec
+                        (hash-map-with-name-keys))})

 ;; ----------------------------------------------------------------------------
 ;; Primary validation functions
 ;; ----------------------------------------------------------------------------

-(defn args-names-valid?
-  "Checks that arg names passed in are all one of the expected ones. If so, returns true. Prints errors to console."
+(defn arg-names-valid?
+  "returns true if every passed-args is value. Otherwise log the problem and return false"
   [defined-args passed-args]
   (or (superset? defined-args passed-args)
       (let [missing-args (remove defined-args passed-args)]
         (log-error "Invalid arguments: " missing-args))))

 (defn required-args-passed?
-  "Checks that all :required args are included in the arg list. If so, returns true. Prints errors to console"
+  "returns true is all the required args are supplied. Otherwise log the error and return false."
   [required-args passed-args]
   (or (superset? passed-args required-args)
       (let [missing-args (remove passed-args required-args)]
@@ -68,13 +76,14 @@

 (defn validate-fns-pass?
-  "Call validate-fn for each arg that has one (and only if the arg was actually passed). Return true if ALL were successful. Prints errors to console.
-   NOTE: Return value for validate-fn is boolean (with a twist):
+  "returns true if all argument values are valid  (for args which have a validator).
+   Otherwise log error and return false.
+   Validation functions can return:
          - true:   validation success
          - false:  validation failed - use standard error message
          - string: validation failed - use this string in place of standard error message"
-  [v-arg-defs passed-args]
-  (let [validate-arg (fn [v-arg-def]
+  [args-with-validators passed-args]
+  (let [validate-arg (fn [[_ v-arg-def]]
                        (let [arg-name        (:name v-arg-def)
                              arg-val         (arg-name passed-args)
                              validate-result ((:validate-fn v-arg-def) arg-val)]
@@ -83,7 +92,7 @@
                            (false?  validate-result) (log-error "Argument '" arg-name "' validation failed. Expected '" (:type v-arg-def) "'. Got '" (left-string arg-val 40) "'")
                            (string? validate-result) (log-error validate-result)
                            :else                     (log-error "Invalid return from validate-fn: " validate-result))))]
-    (->> (select-keys v-arg-defs (keys passed-args))
+    (->> (select-keys args-with-validators (vec (keys passed-args)))
          (map validate-arg)
          (every? true?))))

@@ -96,9 +105,9 @@
    Normally used for a call to the {:pre...} at the beginning of a function."
   [arg-defs passed-args]
   (let [passed-arg-keys (set (keys passed-args))]
-    (and (args-names-valid?     (:names        arg-defs) passed-arg-keys)
-         (required-args-passed? (:required     arg-defs) passed-arg-keys)
-         (validate-fns-pass?    (:validate-fns arg-defs) passed-args))))
+    (and (arg-names-valid?      (:arg-names      arg-defs) passed-arg-keys)
+         (required-args-passed? (:required-args  arg-defs) passed-arg-keys)
+         (validate-fns-pass?    (:validated-args arg-defs) passed-args))))

 ;; ----------------------------------------------------------------------------
@@ -107,9 +116,9 @@

 (defn validate-arg-against-set
   "Validates the passed argument against the expected set."
-  [arg arg-type valid-args]
-  (or (contains? valid-args arg)
-      (str "Invalid " arg-type ". Expected one of " valid-args ". Got '" (left-string arg 40) "'")))
+  [arg arg-name valid-set]
+  (or (contains? valid-set arg)
+      (str "Invalid " arg-name ". Expected one of " valid-set ". Got '" (left-string arg 40) "'")))

 (defn justify-style?
   [arg]


update/minimize ns form for new impl

update/minimize ns form for new impl

--- src/re_frame/router.cljs
+++ src/re_frame/router.cljs
@@ -1,9 +1,7 @@
 (ns re-frame.router
-  (:refer-clojure :exclude [flush])
-  (:require [reagent.core :refer [flush]]
-            [reagent.impl.batching :refer [do-later]]
+  (:require [reagent.impl.batching :refer [do-later]]
             [re-frame.handlers :refer [handle]]
-            [re-frame.utils :refer [warn error]]
+            [re-frame.utils :refer [error]]
             [goog.async.nextTick]))


Changed number hiding to a better system

--- src/hphelper/shared/encrypt.clj
+++ src/hphelper/shared/encrypt.clj
@@ -4,18 +4,21 @@
     )
   )

-(def key-prime 7919)
+(def keyNum (+ 2000 (rand-int 5000)))
+(def offset (+ 10 (rand-int (- keyNum 20))))

 (defn int-hide
   "Hides an integer with the prime"
   [i]
   (if (string? i)
     (int-hide (Long/parseLong i))
-    (+ (rand-int key-prime) (* key-prime i))))
+    (+ offset (* keyNum i))))

 (defn int-show
-  "Unhides an integer with the prime"
+  "Unhides an integer with the prime, returns nil if invalid"
   [i]
   (if (string? i)
     (int-show (Long/parseLong i))
-    (long (/ i key-prime))))+    (if (= offset (mod i keyNum))
+      (long (Math/floor (/ i keyNum)))
+      nil)))


count by id fix

count by id fix

--- src/ontrail/keen.clj
+++ src/ontrail/keen.clj
@@ -44,11 +44,12 @@
 (defn count-by-id [id]
   (try
     (let [filter-by [{:property_name :eid :operator :eq :property_value id}]]
-      (-> (http/get (keen-count-uri filter-by nil) connection)
+      (-> (http/get (keen-count-uri filter-by nil nil) connection)
           :body
           json/read-str
           walk/keywordize-keys))
     (catch Exception ex
+      (.info logger ex)
       {:result 0})))

 (defn group-by-eid [timeframe]


Add Listener java.io.Closeable implementation

Enables `with-open`, etc.

--- src/taoensso/carmine.clj
+++ src/taoensso/carmine.clj
@@ -310,9 +310,13 @@
 ;;
 ;; To facilitate the unusual requirements we define a Listener to be a
 ;; combination of persistent, NON-pooled connection and threaded message
-;; handler:
-
-(defrecord Listener [connection handler state])
+;; handler.
+
+(declare close-listener)
+
+(defrecord Listener [connection handler state]
+  java.io.Closeable
+  (close [this] (close-listener this)))

 (defmacro with-new-listener
   "Creates a persistent connection to Redis server and a thread to listen for


Fix bugs in specs

Fix bugs in specs

--- src/spectrace/specs/core.cljc
+++ src/spectrace/specs/core.cljc
@@ -9,10 +9,10 @@
 (s/def ::pred any?)
 (s/def ::reason string?)
 (s/def ::spec-name keyword?)
-(s/def ::trails (s/coll-of any?))
+(s/def ::trail (s/coll-of any?))

 (s/def ::state
-  (s/keys :req-un [::spec ::path ::val ::in ::trails]
+  (s/keys :req-un [::spec ::path ::val ::in ::trail]
           :opt-un [::reason ::spec-name]))

 (s/fdef strace/step
@@ -22,11 +22,11 @@
 (s/def ::problem
   (s/keys :req-un [::pred ::path ::val ::in]))
 (s/def ::s/spec
-  (s/or :spec s/spec? :regex s/regex? :fn fn? :set set?))
+  (s/or :spec s/spec? :regex s/regex? :fn fn? :set set? :keyword keyword?))
 (s/def ::s/value any?)

 (s/fdef strace/trace
-  :args (s/cat :problem ::s/problem
+  :args (s/cat :problem ::problem
                :spec  ::s/spec
                :value ::s/value)
   :ret (s/coll-of ::state))


Fix load-spec since find-parser-and-layout-symbols no longer exists.

--- spec/incise/load_spec.clj
+++ spec/incise/load_spec.clj
@@ -20,7 +20,8 @@
       (should-not (#'incise.load/namespace-is-spec-or-test? ns-sym)))))

 (describe "finding parsers and layouts"
-  (with layout-and-parser-syms (#'incise.load/find-parser-and-layout-symbols))
+  (with layout-and-parser-syms (#'incise.load/filter-namespaces
+                                 #'incise.load/namespace-is-layout-or-parser?))
   (it "does not contain spec namespaces"
     (doseq [spec-sym ['incise.layouts.impl.page-spec
                       'incise.parsers.impl.markdown-spec]]


fixed wrong number of args errors

fixed wrong number of args errors

--- cljs/src/views/editor.cljs
+++ cljs/src/views/editor.cljs
@@ -423,14 +423,13 @@
       (ui/display-error (dom/getElement "status-message")
                         could-not-create-document-err))))

-(defn save-new-document-click-callback [language feed-name e]
+(defn save-new-document-click-callback [language feed-name & e]
   (let [doc (get-document-value-map! language feed-name)]
-    (js/console.log "sndcc: " (:slug doc) (util/col-to-js (:feed doc)))
     (document/create-doc (:slug doc)
                          save-new-document-xhr-callback
                          doc)))

-(defn save-new-menu-document-click-callback [language feed-name e]
+(defn save-new-menu-document-click-callback [language feed-name & _]
   (let [doc (get-document-value-map! language
                                      feed-name
                                      (render-menu-content-string!))]
@@ -445,12 +444,12 @@
       (ui/display-error (dom/getElement "status-message")
                         could-not-save-document-err))))

-(defn save-existing-document-click-callback [language feed-name e]
+(defn save-existing-document-click-callback [language feed-name & _]
   (document/update-doc (.-value (dom/getElement "slug"))
                        save-existing-document-xhr-callback
                        (get-document-value-map! language feed-name)))

-(defn save-existing-menu-document-click-callback [language feed-name e]
+(defn save-existing-menu-document-click-callback [language feed-name & _]
   (document/update-doc (.-value (dom/getElement "slug"))
                        save-existing-document-xhr-callback
                        (get-document-value-map!
@@ -467,7 +466,7 @@
 (def *file* (atom {}))

 (defn display-image-preview [file title]
-  (let [reader (new (js* "FileReader"))]
+  (let [reader (FileReader.)]
     (set! (.-onload reader)
           (fn [e]
             (ui/render-template (dom/getElement "image-preview")
@@ -479,7 +478,7 @@
 (defn save-image-document-click-callback [create? language feed-name]
   (let [file (:obj @*file*)]
     (if file
-      (let [reader (new (js* "FileReader"))]
+      (let [reader (FileReader.)]
         (set! (.-onload reader)
               (fn [e]
                 (let [image-data (util/map-to-obj


Added anther relatedURL to test for CMR-4219

--- umm-spec-lib/test/cmr/umm_spec/test/validation/related_url.clj
+++ umm-spec-lib/test/cmr/umm_spec/test/validation/related_url.clj
@@ -23,7 +23,11 @@
                                     {:URL "http://gce-lter.marsci.uga.edu/lter/asp/db/send_eml.asp?detail=full&missing=NaN&delimiter=\t&accession=FNG-GCEM-0401"
                                      :URLContentType "PublicationURL"
                                      :Type "VIEW RELATED INFORMATION"
-                                     :SubType "USER'S GUIDE"}]})))
+                                     :SubType "USER'S GUIDE"}
+                                    {:URL "http://www.google.com"
+                                     :URLContentType "VisualizationURL"
+                                     :Type "GET RELATED VISUALIZATION"
+                                     :SubType "MAP"}]})))

   (testing "Multiple invalid related urls"
     (h/assert-warnings-multiple-invalid


Only attach coral root if not already occupied.

--- src/videotest/coral/coral.clj
+++ src/videotest/coral/coral.clj
@@ -42,20 +42,22 @@
 (defn is-bottom? [num-rows row]
   (<= (dec num-rows) row))

-(defn is-occupied? [x y]
-  )
+(defn is-occupied? [coral coords]
+  (contains? coral coords))

 (defn bumping-coral? []
   )

 (def BOTTOM-ATTACH-PCT 0.1)

-(defn is-attaching? [num-rows cell-w x y]
-  (cond
-   (is-bottom? num-rows (y->row cell-w y))
-   (> BOTTOM-ATTACH-PCT (rand))
+(defn is-attaching? [num-rows cell-w coral x y]
+  (let [[col row :as coords] (xy->coords cell-w x y)]
+   (cond
+    (is-bottom? num-rows row)
+    (and (not (is-occupied? coral coords))
+         (> BOTTOM-ATTACH-PCT (rand)))

-   :default false))
+    :default false)))

 (defn remove-seeds [all-seeds seeds]
   (remove (set seeds) all-seeds))
@@ -76,10 +78,10 @@
            seeds)))

 (defn attach-seeds
-  [display-h {:keys [motion-seeds coral-size] :as state}]
+  [display-h {:keys [motion-seeds coral-size coral] :as state}]
   (let [{:keys [num-row-bins cell-w]} coral-size
         attaching (filter (fn [{:keys [x y] :as seed}]
-                            (is-attaching? num-row-bins cell-w x y))
+                            (is-attaching? num-row-bins cell-w coral x y))
                           motion-seeds)]
     (-> state
         (update-in [:motion-seeds] #(remove-seeds % attaching))


update impress sample's _config

update impress sample's _config

--- samples/impress/_config.clj
+++ samples/impress/_config.clj
@@ -2,7 +2,6 @@
  ;; directory setting
  :public-dir   "public/"
  :template-dir "template/"
-; :post-dir     "posts/"
  :layout-dir   "layouts/"

  ;; posts and tags url setting
@@ -29,10 +28,6 @@
  ;; highlight setting
  :code-highlight {:CLJ "lang-clj", :CLOJURE "lang-clj"}

- ;; flag for detailed log
- ;;   default value: false
- :detailed-log true;false
-
  ;; compiler setting
  ;;   default value: "default"
  :compiler "default"