Remove unused functions.

Remove unused functions.

--- src/oc/email/content.clj
+++ src/oc/email/content.clj
@@ -7,7 +7,6 @@
             [oc.lib.text :as text]
             [hiccup.core :as h]
             [hickory.core :as hickory]
-            [oc.lib.change :as change]
             [oc.lib.auth :as auth]
             [oc.lib.jwt :as jwt]
             [oc.lib.user-avatar :as user-avatar]
@@ -69,17 +68,6 @@

 (defn- preheader-spacer []
   (s/join (repeat 120 " ")))
-
-;; Seen data
-
-; (def seen-text "✓ You've viewed this post")
-
-; (defn get-seen-data [superuser-token entry-id]
-;   (let [c {:change-server-url config/change-server-url
-;            :auth-server-url config/auth-server-url
-;            :passphrase config/passphrase
-;            :service-name "Email"}]
-;     (change/seen-data-for c superuser-token entry-id)))

 ;; ----- HTML Fragments -----

@@ -373,14 +361,6 @@
             (spacer 16 ""))
           (post-attribution entry)]]])))

-; (defn- digest-post-seen [superuser-token user-id entry-uuid]
-;   (let [seen-data (get-seen-data superuser-token entry-uuid)
-;         seen-this (some #(= user-id (:user-id %))
-;                         (get-in seen-data [:post :read]))]
-;     (if seen-this
-;       seen-text
-;       "")))
-
 (defn- digest-post-block
   [user entry]
   (let [publisher (:publisher entry)
@@ -460,9 +440,6 @@
   }
 }
 "])
-
-(defn- digest-content-date []
-  (time-format/unparse date-format-year-comma (t/now)))

 (defn sort-must-see-board-name [a b]
   (let [must-see (compare (:must-see a) (:must-see b))]
@@ -905,31 +882,6 @@

 ;; ----- General HTML, common to all emails -----

-; (defn digest-header [digest]
-;   (let [logo-url (:logo-url digest)
-;         logo? (not (s/blank? logo-url))
-;         org-name (or (:org-name digest) "Carrot")]
-;     [:table {:class "row digest-header-table"
-;              :valign "middle"
-;              :align "center"
-;              :width "100%"}
-;       [:tr
-;         [:td {:class "small-12 large-12 columns digest-header"}
-;           [:center
-;             (spacer 24 "" "")
-;             (when logo? (org-logo {:org-name org-name
-;                                    :org-logo-url logo-url
-;                                    :org-logo-width (:logo-width digest)
-;                                    :org-logo-height (:logo-height digest)
-;                                    :align "center"
-;                                    :class "row"}))
-;             (when logo?
-;               (spacer 8 "" ""))
-;             (h1 "Your morning digest" "center-align" "")
-;             (spacer 5 "" "")
-;             (paragraph (str org-name " — " (digest-content-date)) "center-align" "digest-header-subline")
-;             (spacer 24 "" "")]]]]))
-
 (defn- body [data]
   (let [type (:type data)
         digest? (= type :digest)]


Fix merge conflict resolution issue.

Fix merge conflict resolution issue.

--- src/oc/email/content.clj
+++ src/oc/email/content.clj
@@ -419,7 +419,6 @@
         show-note? (and note? from-avatar?)
         secure-uuid (:secure-uuid entry)
         entry-url (s/join "/" [origin-url org-slug "post" secure-uuid])]
-    [:td {:class "small-10 large-12 columns" :valign "middle" :align "center"}
     [:td {:class "small-12 large-12 columns" :valign "middle" :align "center"}
       (spacer 40)
       (when logo? (org-logo entry))


better validation

better validation

--- s3/src/s3/blog.clj
+++ s3/src/s3/blog.clj
@@ -102,11 +102,12 @@
                (pad-with padding)))))

 (defn generate-title [blog]
-  (if (and (-> blog :title string?) (> (-> blog :title count) 1))
-    blog
-    (let [b (:body blog)
-          sentences (clojure.string/split b #"\.")]
-      (assoc blog :title (truncate (first sentences) 150)))))
+  (when blog
+    (if (and (-> blog :title string?) (> (-> blog :title count) 1))
+      blog
+      (let [b (:body blog)
+            sentences (clojure.string/split b #"\.")]
+        (assoc blog :title (truncate (first sentences) 150))))))

 (defn create-new-draft [user]
   (id-to-sid
@@ -119,8 +120,8 @@
         db-object (find-blog-object id)]
     (if (and (not= nil db-object) (own? user db-object))
       (-> (merge db-object new-draft)
+          (transform-fields-using from-user-to-db-transform)
           (generate-title)
-          (transform-fields-using from-user-to-db-transform)
           (insert-and-return db-object))
       (error "Db object deleted or not own. Refusing to update: " user params id))))

@@ -133,9 +134,9 @@
         new-blog (assoc db-object :draft false :id id)]
     (if (and (not= nil db-object) (own? user db-object))
       (-> new-blog
+          (transform-fields-using from-user-to-db-transform)
           (generate-title)
           (generate-seo-id id)
-          (transform-fields-using from-user-to-db-transform)
           (generate-publication-date)
           (insert-and-return db-object))
       (error "Db object deleted or not own. Refusing to update: " user new-blog id))))


we dont use a recv-queue anymore

we dont use a recv-queue anymore

--- src/overtone/core/sc.clj
+++ src/overtone/core/sc.clj
@@ -40,8 +40,6 @@
 (defonce synths*        (ref nil))

 (defonce world* (ref nil))
-
-(defonce recv-queue* (ref []))

 ;TODO: Figure out the real limits...  These are total guesses, but
 ; it should be plenty.


convert non-floaty server info values to longs when reading info from server

--- src/overtone/sc/info.clj
+++ src/overtone/sc/info.clj
@@ -40,17 +40,17 @@
                 (let [args (:args msg)
                       [nid nrid sr sd rps cr cd sso nob nib nab ncb nb nrs] args]
                   (deliver prom
-                           {:sample-rate sr
+                           {:sample-rate (long sr)
                             :sample-dur sd
                             :radians-per-sample rps
                             :control-rate cr
                             :control-dur cd
                             :subsample-offset sso
-                            :num-output-buses nob
-                            :num-input-buses nib
-                            :num-audio-buses nab
-                            :num-buffers nb
-                            :num-running-synths nrs})
+                            :num-output-buses (long nob)
+                            :num-input-buses (long nib)
+                            :num-audio-buses (long nab)
+                            :num-buffers (long nb)
+                            :num-running-synths (long nrs)})
                   :done))
               ::num-control-buses)
     (let [synth-id (snd-server-info)


Store node position as keyword in SynthNode to match SynthGroup

--- src/overtone/sc/node.clj
+++ src/overtone/sc/node.clj
@@ -112,12 +112,13 @@
      (if (not (server-connected?))
        (throw (Exception. "Not connected to synthesis engine.  Please boot or connect server.")))
      (let [id       (alloc-id :node)
-           position (or ((get location :position :tail) NODE-POSITION) 1)
+           position (get location :position :tail)
+           pos-id   (get NODE-POSITION position 1)
            target   (to-synth-id (get location :target 0))
            arg-map  (map-and-check-node-args arg-map)
            args     (flatten (seq arg-map))
            snode    (SynthNode. synth-name id target position (atom :loading))]
-       (apply snd "/s_new" synth-name id position (to-synth-id target) args)
+       (apply snd "/s_new" synth-name id pos-id (to-synth-id target) args)
        (swap! active-synth-nodes* assoc id snode)
        snode)))


Fix bug that shadows original ed with corrected one

--- src/pinpointer/core.cljc
+++ src/pinpointer/core.cljc
@@ -144,11 +144,11 @@
   ([ed {:keys [width colorize fallback-on-error]
         :or {width 70, fallback-on-error true}}]
    (if ed
-     (let [{:keys [::s/problems ::s/value] :as ed} (correct-paths ed)
+     (let [{:keys [::s/problems ::s/value] :as ed'} (correct-paths ed)
            nproblems (count problems)
            traces (try
                     (binding [strace/*eval-fn* *eval-fn*]
-                      (trace/traces ed))
+                      (trace/traces ed'))
                     (catch #?(:clj Throwable :cljs :default) e e))]
        (cond (vector? traces)
              (binding [*colorize-fn* (choose-colorize-fn colorize)]


Adding a set-line function to editor.cljs

--- src/lt/objs/editor.cljs
+++ src/lt/objs/editor.cljs
@@ -288,6 +288,9 @@

 (defn line [e l]
   (.getLine (->cm-ed e) l))
+
+(defn set-line [e l text]
+  (.setLine (->cm-ed e) l text))

 (defn first-line [e]
   (.firstLine (->cm-ed e)))


Bugfix; update-in needs a vector

Bugfix; update-in needs a vector

--- src/polismath/export.clj
+++ src/polismath/export.clj
@@ -234,8 +234,8 @@
 (defn reconstruct-vote-matrix
   [votes]
   (let [new-nmat (nm/named-matrix)
-        ;; Flip the signs on the votes XXX
-        votes (map #(update-in % :vote (partial * -1)) votes)
+        ;; Flip the signs on the votes XXX (remove when we switch)
+        votes (map #(update-in % [:vote] (partial * -1)) votes)
         vote-tuples (map #(map % [:pid :tid :vote]) votes)]
     (nm/update-nmat new-nmat vote-tuples)))


create keys more robust cleanup

create keys more robust cleanup

--- src/proxmox/provider.clj
+++ src/proxmox/provider.clj
@@ -27,8 +27,10 @@
    :password [str? (required)]
    :hostname [str? (required)]
    :hypervisor [str? (required)]
-   :features [vec?]
-   })
+   :features [vec?]})
+
+(def create-req-keys
+  (keys (dissoc ct-validations :hypervisor :features)))

 (def node-available?
   "Node availability check, result is cached for one minute"
@@ -82,8 +84,8 @@
   (create [this]
           (debug "creating" (:vmid spec))
           (try+
-            (let [cleanend-spec (apply dissoc spec [:features :hypervisor])]
-               (check-task node (prox-post (str "/nodes/" node "/openvz") )))
+            (let [cleanend-spec (select-keys spec create-req-keys)]
+               (check-task node (prox-post (str "/nodes/" node "/openvz") cleanend-spec)))
             ; TODO enable this later
             ;(enable-features this spec)
             (catch [:status 500] e


Make child-boundaries non-lazy.

Make child-boundaries non-lazy.

--- src/merkle_db/index.clj
+++ src/merkle_db/index.clj
@@ -147,14 +147,14 @@
   trailing boundary, corresponding to the split keys on either side of that
   child."
   [index]
-  (->>
-    (concat
-      [nil]
-      (map vector (::children index) (::keys index))
-      [[(last (::children index))]])
-    (partition 2 1)
-    (map (fn [[[_ first-key] [link last-key]]]
-           [link first-key last-key]))))
+  (loop [boundaries [[(first (::children index)) nil (first (::keys index))]]
+         children (next (::children index))
+         split-keys (::keys index)]
+    (if (seq children)
+      (recur (conj boundaries [(first children) (first split-keys) (second split-keys)])
+             (next children)
+             (next split-keys))
+      boundaries)))

 (defn read-all


Fix typos in review params

Fix typos in review params

--- src/myshelf/reviews.clj
+++ src/myshelf/reviews.clj
@@ -33,10 +33,10 @@
 (defn add-book-review
   "Add a book review. Automatically adds book to read shelf."
   [consumer access-token book-id rating & [review-text]]
-  (let [review-url (build-url "review")
+  (let [review-url (build-url "review.xml")
         params (merge {:format "xml"
                        :book_id book-id
-                       (keyword "review[rating") rating
+                       (keyword "review[rating]") rating
                        :shelf "read"}
                       (when review-text
                         {(keyword "review[review]") review-text}))]


Added gen-class for standalone jar

Added gen-class for standalone jar

Cleanup

--- src/powermeter/core.clj
+++ src/powermeter/core.clj
@@ -1,4 +1,5 @@
 (ns powermeter.core
+  (:gen-class)
   (:use org.httpkit.server)
   (:use ring.util.response)
   (:require [compojure.core :refer :all]
@@ -15,22 +16,14 @@

 (def ^{:private true} default-port 8093)
+
 (def ^{:private true} max-data-length (* 13 60))
 (def ^{:private true} pwr-data (atom []))

-
 (def ^{:private true} prev-data (atom 0))

-; @pwr-data
+(defonce server (atom nil))

-;; store as list and return reversed vector ?
-; or a vector, as of now ?. What would be most efficient...
-
-; (last @pwr-data)
-; (vector? @pwr-data)
-
-; (vector? (rest (vector @pwr-data)))
-; (reset! pwr-data (rest (vec @pwr-data)))

 (defn- time-string [millisec]
   (str (t/from-time-zone
@@ -41,9 +34,6 @@
 (defn- ms-time [ts]
   (* 1000 (read-string (first (clojure.string/split ts #"\."))))
 )
-
-
-@prev-data

 (defn- add-pwr-data
@@ -95,11 +85,9 @@
       ))

-(defonce server (atom nil))

 (defn start-server [port-no]
   (reset! server (run-server #'handler {:port port-no})))
-

 (defn stop-server []
   (when-not (nil? @server)
@@ -109,10 +97,6 @@
     (reset! server nil)))

-; (start-server 8093)
-; (stop-server)
-
-
 (defn -main [& args]
   (let [port (Integer. (or (System/getenv "PORT") default-port))]
     (println "Using port:" port)


streams/where: fully qualify member? check in tagged.

--- src/reimann/streams.clj
+++ src/reimann/streams.clj
@@ -441,7 +441,8 @@

 (defn where-test [k v]
   (case k
-    'tagged (list 'member? v (list :tags 'event))
+    'tagged (list 'when (list :tags 'event)
+                  (list 'reimann.common/member? v (list :tags 'event)))
     ; Otherwise, match literal value.
     (if (= (class v) java.util.regex.Pattern)
       (list 're-find v (list (keyword k) 'event))


Formatting

Formatting

--- src/riemann/shinken.clj
+++ src/riemann/shinken.clj
@@ -13,22 +13,23 @@
 (defn- format-event
   "Formats an event for Shinken."
   [event]
-  {
-    :time_stamp (int (:time event))
-    :host_name (:host event)
-    :service_description (:service event)
-    :return_code (:state event)
-    :output (:metric event)
-  })
+  {:time_stamp (int (:time event))
+   :host_name (:host event)
+   :service_description (:service event)
+   :return_code (:state event)
+   :output (:metric event)})

 (defn shinken
-  "Returns a function which accepts an event and sends it to Shinken's ws-arbiter module.
+  "Returns a function which accepts an event and sends it to Shinken's
+  ws-arbiter module.

-  (shinken {:hostname \"127.0.0.1\" :port 7760 :username \"admin\" :password \"admin\"})
+  (shinken {:hostname \"127.0.0.1\" :port 7760 :username \"admin\" :password
+  \"admin\"})

   Options:

-  :hostname     Host name of the Shinken receiver/arbiter. Default is \"127.0.0.1\".
+  :hostname     Host name of the Shinken receiver/arbiter. Default is
+                \"127.0.0.1\".
   :port         Port that mod-ws-arbiter is listening to. Default is 7760
   :username     Username. Default is \"admin\".
   :password     Password of the corresponding user. Default is \"admin\"."


Make the template tests pass

Make the template tests pass

Now the CI build should succeed.

--- src/theatralia/core.clj
+++ src/theatralia/core.clj
@@ -1,10 +1,7 @@
 (ns theatralia.core)

-;;; This is an incorrect implementation, such as might be written by
-;;; someone who was used to a Lisp in which an empty list is equal to
-;;; nil.
 (defn first-element [sequence default]
-  (if (nil? sequence)
-    default
-    (first sequence)))
+  (if (seq sequence)
+    (first sequence)
+    default))


Forward/backward movement

Forward/backward movement

--- src/try_lwjgl/logic.clj
+++ src/try_lwjgl/logic.clj
@@ -35,14 +35,17 @@

 (def player-position (atom [0.0, 1.0, 10.0]))

-(defn move-sideways [direction]
-  (let [index 0]
-    (swap! player-position (fn [pos]
-                             (let [old-val (pos index)
-                                   new-val (+ old-val (* direction 1.0))]
-                               (assoc pos index new-val))))))
+(defn move [axis amount]
+  (swap! player-position (fn [pos]
+                           (let [old-val (pos axis)
+                                 new-val (+ old-val (* amount 1.0))]
+                             (assoc pos axis new-val)))))

-(defn move-forward [direction])
+(defn move-sideways [amount]
+  (move 0 amount))
+
+(defn move-forward [amount]
+  (move 2 (* -1.0 amount)))

 (def listeners
   [{:key :left, :down? true, :repeat? false :callback key-left-down}


Renames get-time format-time

Renames get-time format-time

--- src/wordsmith/core.cljs
+++ src/wordsmith/core.cljs
@@ -82,7 +82,7 @@

 ;; Save button

-(defn get-time [date]
+(defn format-time [date]
   (let [hours (.getHours date)
         minutes (.getMinutes date)
         seconds (.getSeconds date)]
@@ -100,7 +100,7 @@
                          :onClick #(button-click app)} "Save")
         (dom/span #js {:id "last-saved"}
           (when-let [last-saved (:last-saved app)]
-            (str "Last saved at: " (get-time last-saved))))))))
+            (str "Last saved at: " (format-time last-saved))))))))

 ;; The main app


Formatting

Formatting

--- src/simpledb/wrapper.clj
+++ src/simpledb/wrapper.clj
@@ -13,8 +13,9 @@
   []
   (try
     (do
-      (-> (jdbc/get-connection @prdDb)
-          (.close))
+      (->
+        (jdbc/get-connection @prdDb)
+        (.close))
       @prdDb)
     (catch Exception e @devDb)))


exclude deps common with storm

exclude deps common with storm

--- storm-state/project.clj
+++ storm-state/project.clj
@@ -3,7 +3,9 @@
   :java-source-path "src/jvm"
   :javac-options {:debug "true" :fork "true"}
   :repositories {"cloudera" "https://repository.cloudera.com/artifactory/cloudera-repos/"}
-  :dependencies [[org.apache.hadoop/hadoop-core "0.20.2-cdh3u4"]
+  :dependencies [[org.apache.hadoop/hadoop-core "0.20.2-cdh3u4"
+                  :exclusions [org.mortbay.jetty/jetty org.mortbay.jetty/jetty-util
+                  commons-codec/commons-codec commons-logging/commons-logging javax.servlet/servlet-api]]
                  ]
   :dev-dependencies [[org.clojure/clojure "1.4.0"]
                      [storm "0.8.0-SNAPSHOT"]]


Move conn-spec parsing stuff from `with-new-pubsub-listener` to (more general) `with-new-listener`

--- src/taoensso/carmine.clj
+++ src/taoensso/carmine.clj
@@ -350,11 +350,11 @@
       3. An atom containing any other optional listener state.

   Useful for pub/sub, monitoring, etc."
-  [connection-spec handler initial-state & body]
+  [conn-spec handler initial-state & body]
   `(let [handler-atom# (atom ~handler)
          state-atom#   (atom ~initial-state)
-         conn# (conns/make-new-connection (assoc ~connection-spec
-                                            :listener? true))
+         conn# (conns/make-new-connection
+                (assoc (conns/conn-spec ~conn-spec) :listener? true))
          in#   (:in-stream conn#)]

      (future-call ; Thread to long-poll for messages
@@ -394,8 +394,7 @@
   Returns the Listener to allow manual closing and adjustments to
   message-handlers."
   [conn-spec message-handlers & subscription-commands]
-  `(with-new-listener (assoc (conns/conn-spec ~conn-spec)
-                        :pubsub-listener? true)
+  `(with-new-listener (assoc ~conn-spec :pubsub-listener? true)

      ;; Message handler (fn [message state])
      (fn [[_# source-channel# :as incoming-message#] msg-handlers#]
@@ -434,4 +433,4 @@

 (defmacro with-conn "DEPRECATED: Use `wcar` instead."
   [connection-pool connection-spec & body]
-  `(wcar {:pool ~connection-pool :spec ~connection-spec} ~@body))
+  `(wcar {:pool ~connection-pool :spec ~connection-spec} ~@body))


Misc hk

Misc hk

--- src/taoensso/carmine.clj
+++ src/taoensso/carmine.clj
@@ -72,9 +72,9 @@

 ;;;; Misc

-(encore/defalias as-bool     encore/as-bool  "Returns x as bool, or nil.")
-(encore/defalias as-int      encore/as-int   "Returns x as integer, or nil.")
-(encore/defalias as-float    encore/as-float "Returns x as float, or nil.")
+(encore/defalias as-bool     encore/as-?bool)
+(encore/defalias as-int      encore/as-?int)
+(encore/defalias as-float    encore/as-?float)
 (encore/defalias as-map      encore/as-map)
 (encore/defalias parse       protocol/parse)
 (encore/defalias parser-comp protocol/parser-comp)


[#2127] Fix latest-dataset-versions args fun call

--- backend/src/akvo/lumen/db/transformation.clj
+++ backend/src/akvo/lumen/db/transformation.clj
@@ -7,8 +7,8 @@
 (defn latest-dataset-version-by-dataset-id [conn opts]
   (db-latest-dataset-version-by-dataset-id conn (merge dv/defaults opts)))

-(defn latest-dataset-versions [conn opts]
-  (db-latest-dataset-versions conn (merge dv/defaults opts)))
+(defn latest-dataset-versions [conn]
+  (db-latest-dataset-versions conn dv/defaults))

 (defn latest-dataset-versions-by-dataset-ids [conn opts]
   (db-latest-dataset-versions-by-dataset-ids conn (merge dv/defaults opts)))


[#20] Removed unnecessary code

[#20] Removed unnecessary code

Removed code that fixed but when using the suspendable protocol,
something we are not.

--- backend/src/org/akvo/dash/component/http.clj
+++ backend/src/org/akvo/dash/component/http.clj
@@ -10,9 +10,8 @@
     (if (:server component)
       component
       (let [options (-> component (dissoc :app))
-            handler (atom (delay (:handler app)))
-            server (web/run (fn [req]
-                              (@@handler req)) options)]
+            handler (:handler app)
+            server (web/run (fn [req] handler) options)]
         (assoc component
                :server server
                :handler handler))))


Memoize intern-series-name to avoid repeated DB lookups of series ID's.

--- metlog-vault/src-server/metlog_vault/data.clj
+++ metlog-vault/src-server/metlog_vault/data.clj
@@ -22,7 +22,7 @@
       (app req))))

 (defn call-with-query-logging [ name actual-args fn ]
-  (log/debug "query" name actual-args)
+  (log/trace "query" name actual-args)
   (let [begin-t (. System (nanoTime))
         result (fn)]
     (log/debug "query time" name "-" (/ (- (. System (nanoTime)) begin-t) 1000000.0))
@@ -48,20 +48,22 @@
                (jdbc/insert! *db* :series
                              {:series_name series-name}))))

-(defn intern-series-name [ series-name ]
-  (let [ series-name (.trim (name (or series-name ""))) ]
-    (if (= 0 (.length series-name))
-      nil
-      (with-transaction
-        (or (get-series-id series-name)
-            (add-series-name series-name))))))
+(def intern-series-name
+  (memoize
+   (fn [ series-name ]
+     (let [ series-name (.trim (name (or series-name ""))) ]
+       (if (= 0 (.length series-name))
+         nil
+         (with-transaction
+           (or (get-series-id series-name)
+               (add-series-name series-name))))))))

 (def latest-sample-times (atom {}))

 (defquery query-series-latest-sample-time [ series-name ]
   (if-let [ t (query-scalar *db* [(str "SELECT MAX(t) FROM sample"
                                        " WHERE series_id = ?")
-                                  (get-series-id series-name)])]
+                                  (intern-series-name series-name)])]
     t))

 (defn get-series-latest-sample-time [ series-name ]
@@ -70,7 +72,7 @@
       latest-t
       (let [query-latest-t (query-series-latest-sample-time series-name)]
         (swap! latest-sample-times assoc series-id query-latest-t)
-        (log/info [:lst latest-sample-times])
+        (log/info "Latest sample times from DB" @latest-sample-times)
         query-latest-t))))

 (defn restrict-to-series [ samples series-name ]
@@ -83,7 +85,7 @@

 (defquery store-data-samples [ samples ]
   (doseq [ sample samples ]
-    (log/debug "Inserting sample: " sample)
+    (log/trace "Inserting sample: " sample)
     (let [series-id (intern-series-name (:series_name sample))]
       (check-latest-series-time series-id (:t sample))
       (jdbc/insert! *db* :sample
@@ -113,7 +115,7 @@
                          "   AND UNIX_MILLIS(t-session_timezone()) > ?"
                          "   AND UNIX_MILLIS(t-session_timezone()) < ?"
                          " ORDER BY t")
-                    (get-series-id series-name)
+                    (intern-series-name series-name)
                     begin-t
                     end-t])))


CMR-4763

--- collection-renderer-lib/project.clj
+++ collection-renderer-lib/project.clj
@@ -14,7 +14,7 @@
    the hardcoded commit id during dev integration with cmr_metadata_preview project.
    The hardcoded commit id should be updated when MMT releases a new version of the gem."
   (or (System/getenv "CMR_METADATA_PREVIEW_COMMIT")
-      "b45096f"))
+      "3867430"))

 (def gem-install-path
   "The directory within this library where Ruby gems are installed."


Increases REPL timeout to 3 minutes.

Increases REPL timeout to 3 minutes.

--- dev-system/project.clj
+++ dev-system/project.clj
@@ -72,7 +72,7 @@
             [lein-test-out "0.3.1"]]

   :repl-options {:init-ns user
-                 :timeout 120000}
+                 :timeout 180000}

   :jvm-opts ["-XX:-OmitStackTraceInFastThrow"]


When creating new pods store their environment in boot.pod/env (fixes #81)

--- boot/pod/src/boot/pod.clj
+++ boot/pod/src/boot/pod.clj
@@ -154,6 +154,7 @@
               out (io/output-stream (doto (io/file out-path) io/make-parents))]
     (io/copy in out)))

+(def  env            nil)
 (def  pod-id         (atom nil))
 (def  worker-pod     (atom nil))
 (def  shutdown-hooks (atom nil))
@@ -303,19 +304,6 @@
                 (filter (comp keep? first))
                 (map (fn [[k v]] [v (.getPath (io/file outdir k))])))]
     (doseq [[url-str out-path] ents] (copy-url url-str out-path))))
-
-(defn- init-pod!
-  [pod]
-  (doto pod
-    (require-in "boot.pod")
-    (.invoke "boot.pod/set-worker-pod!" @worker-pod)
-    (with-eval-in
-      (require 'boot.util)
-      (reset! boot.util/*verbosity* ~(deref util/*verbosity*))
-      (create-ns 'pod)
-      (dosync (alter @#'clojure.core/*loaded-libs* conj 'pod))
-      (alter-var-root #'*ns* (constantly (the-ns 'pod)))
-      (clojure.core/refer-clojure))))

 (defn lifecycle-pool
   [size create destroy & {:keys [priority]}]
@@ -336,12 +324,26 @@
       ([] (take))
       ([op] (case op :refresh (do (swap) (take)) :shutdown (stop))))))

+(defn- init-pod!
+  [env pod]
+  (doto pod
+    (require-in "boot.pod")
+    (.invoke "boot.pod/set-worker-pod!" @worker-pod)
+    (with-eval-in
+      (require 'boot.util 'boot.pod)
+      (reset! boot.util/*verbosity* ~(deref util/*verbosity*))
+      (alter-var-root #'boot.pod/env (constantly '~env))
+      (create-ns 'pod)
+      (dosync (alter @#'clojure.core/*loaded-libs* conj 'pod))
+      (alter-var-root #'*ns* (constantly (the-ns 'pod)))
+      (clojure.core/refer-clojure))))
+
 (defn make-pod
   ([] (init-pod! (boot.App/newPod)))
   ([{:keys [directories] :as env}]
      (let [dirs (map io/file directories)
            jars (resolve-dependency-jars env)]
-       (->> (concat dirs jars) (into-array java.io.File) boot.App/newPod init-pod!))))
+       (->> (concat dirs jars) (into-array java.io.File) boot.App/newPod (init-pod! env)))))

 (defn destroy-pod
   [pod]


Adds exit-code to pod-completed passport event (#1935)

* Adds exit-code to pod-completed passport event

* Adds instance-exited? field to passport event

--- scheduler/src/cook/kubernetes/controller.clj
+++ scheduler/src/cook/kubernetes/controller.clj
@@ -155,12 +155,13 @@

 (defn write-status-to-passport
   "Helper function for logging completed job status to cook passport"
-  [{:keys [name]}
-   {:keys [task-id state reason]}]
+  [{:keys [name]} {:keys [task-id state reason]} exit-code]
   (passport/log-event (merge
                         (api/pod-name->job-map (task-id :value))
                         {:compute-cluster name
                          :event-type passport/pod-completed
+                         :exit-code exit-code
+                         :instance-exited? (some? exit-code)
                          :reason reason
                          :state state})))

@@ -334,7 +335,7 @@
   (when-not (api/synthetic-pod? pod-name)
     (let [{:keys [status exit-code]} (calculate-pod-status compute-cluster pod-name k8s-actual-state :reason reason)]
       (write-status-to-datomic compute-cluster status)
-      (write-status-to-passport compute-cluster status)
+      (write-status-to-passport compute-cluster status exit-code)
       (when exit-code
         (sandbox/aggregate-exit-code (:exit-code-syncer-state compute-cluster) pod-name exit-code))))
   ; Must never return nil, we want it to return non-nil so that we will retry with writing the state to datomic in case we lose a race.


Restructure test.

Restructure test.

--- project/analyze-data/test/analyze_data/naive_bayes/predict_test.clj
+++ project/analyze-data/test/analyze_data/naive_bayes/predict_test.clj
@@ -1,19 +1,21 @@
 (ns analyze-data.naive-bayes.predict-test
   (:require [clojure.core.matrix :as m]
-            [clojure.test :refer [deftest is]]
+            [clojure.test :refer [deftest is testing]]
             [analyze-data.naive-bayes.predict :as test-ns]))

 (deftest predict-test
   (let [parameters {:log-phi (m/log [[1/2 1/4] [1/2 3/4]])
                     :log-phi-y (m/log [1/3 2/3])}
         x [0 1]
-        prediction (test-ns/predict parameters x)
         expected-class 1
         expected-prob (float 6/7)]
-    (is (= expected-class (first prediction)))
-    (is (= (format "%.2f" expected-prob)
-           (format "%.2f" (second prediction))))
-    (is (= [nil nil]
-           (test-ns/predict parameters x, :threshold expected-prob))
-        (str "returns [nil nil] when prob of most likely label does not "
-             "exceed :threshold"))))
+    (let [prediction (test-ns/predict parameters x)]
+      (is (= expected-class (first prediction))
+          "predicts the correct class")
+      (is (= (format "%.2f" expected-prob)
+             (format "%.2f" (second prediction)))
+          "calculates the correct probability"))
+    (testing ":threshold option"
+      (is (= [nil nil]
+             (test-ns/predict parameters x, :threshold 0.99))
+          "returns [nil nil] when prob does not exceed :threshold"))))


All interactions with remote queue should be remote, too.

--- integration-tests/apps/tx/test/tx/test/listen.clj
+++ integration-tests/apps/tx/test/tx/test/listen.clj
@@ -29,20 +29,20 @@
 (deftest transactional-writes-in-listener-should-work
   (trigger-listener)
   (is (= "kiwi" (imsg/receive "/queue/test")))
-  (is (= "starfruit" (imsg/receive "/queue/remote-test")))
+  (is (= "starfruit" (imsg/receive "/queue/remote-test" :host "localhost" :port 5445)))
   (is (= 1 (:a core/cache))))

 (deftest transactional-writes-in-listener-should-fail-on-exception
   (trigger-listener :throw? true)
   (is (nil? (imsg/receive "/queue/test" :timeout 2000)))
-  (is (nil? (imsg/receive "/queue/remote-test" :timeout 2000)))
+  (is (nil? (imsg/receive "/queue/remote-test" :timeout 2000 :host "localhost" :port 5445)))
   (is (nil? (:a core/cache)))
   (is (= 10 (:deliveries core/cache))))

 (deftest transactional-writes-in-listener-should-fail-on-rollback
   (trigger-listener :rollback? true)
   (is (nil? (imsg/receive "/queue/test" :timeout 2000)))
-  (is (nil? (imsg/receive "/queue/remote-test" :timeout 2000)))
+  (is (nil? (imsg/receive "/queue/remote-test" :timeout 2000 :host "localhost" :port 5445)))
   (is (nil? (:a core/cache)))
   (is (= 10 (:deliveries core/cache))))

@@ -52,5 +52,5 @@
   (is (util/wait-for #(= 10 (:deliveries core/cache))))
   (is (= 1 (:a core/cache)))
   (is (every? #(= "kiwi" %) (take 10 (imsg/message-seq "/queue/test"))))
-  (is (every? #(= "starfruit" %) (take 10 (imsg/message-seq "/queue/remote-test")))))
+  (is (every? #(= "starfruit" %) (take 10 (imsg/message-seq "/queue/remote-test" :host "localhost" :port 5445)))))


full stack persistence with datomic

full stack persistence with datomic

--- intermediate/om-async/src/cljs/om_async/core.cljs
+++ intermediate/om-async/src/cljs/om_async/core.cljs
@@ -9,4 +9,89 @@

 (enable-console-print!)

-(println "Hello world!")
+(def ^:private meths
+  {:get "GET"
+   :put "PUT"
+   :post "POST"
+   :delete "DELETE"})
+
+(defn edn-xhr [{:keys [method url data on-complete]}]
+  (let [xhr (XhrIo.)]
+    (events/listen xhr goog.net.EventType.COMPLETE
+                   (fn [e]
+                     (on-complete (reader/read-string (.getResponseText xhr)))))
+    (. xhr
+       (send url (meths method) (when data (pr-str data))
+             #js {"Content-Type" "application/edn"}))))
+
+(def app-state
+  (atom {:classes []}))
+
+(defn display [show]
+  (if show
+    #js {}
+    #js {:display "none"}))
+
+(defn handle-change [e data edit-key owner]
+  (om/transact! data edit-key (fn [_] (.. e -target -value))))
+
+(defn end-edit [text owner cb]
+  (om/set-state! owner :editing false)
+  (cb text))
+
+(defn editable [data owner {:keys [edit-key on-edit] :as opts}]
+  (reify
+    om/IInitState
+    (init-state [_]
+                {:editing false})
+    om/IRenderState
+    (render-state [_ {:keys [editing]}]
+                  (let [text (get data edit-key)]
+                    (dom/li nil
+                            (dom/span #js {:style (display (not editing))} text)
+                            (dom/input
+                               #js {:style (display editing)
+                                    :value text
+                                    :onChange #(handle-change % data edit-key owner)
+                                    :onKeyDown #(when (= (.-key %) "Enter")
+                                                  (end-edit text owner on-edit))
+                                    :onBlur (fn [e]
+                                              (when (om/get-state owner :editing)
+                                                (end-edit text owner on-edit)))})
+                            (dom/button
+                               #js {:style (display (not editing))
+                                    :onClick #(om/set-state! owner :editing true)}
+                               "Edit"))))))
+
+(defn on-edit [id title]
+  (edn-xhr
+    {:method :put
+     :url (str "class/" id "/update")
+     :data {:class/title title}
+     :on-complete
+     (fn [res]
+       (println "server-response:" res))}))
+
+(defn classes-view [app owner]
+  (reify
+    om/IWillMount
+    (will-mount [_]
+                (edn-xhr
+                   {:method :get
+                    :url "classes"
+                    :on-complete #(om/transact! app :classes (fn [_] %))}))
+    om/IRender
+    (render [_]
+            (dom/div #js {:id "classes"}
+                     (dom/h2 nil "Classes")
+                     (apply dom/ul nil
+                            (map
+                               (fn [class]
+                                 (let [id (:class/id class)]
+                                   (om/build editable class
+                                              {:opts {:edit-key :class/title
+                                                      :on-edit #(on-edit id %)}})))
+                               (:classes app)))))))
+
+(om/root classes-view app-state
+         {:target (.getElementById js/document "classes")})


Delete tags section

Delete tags section

--- template/index.html.clj
+++ template/index.html.clj
@@ -38,7 +38,4 @@
   (post-list)
   (prev-next-page-link)]

-;; Sample post tags
-(page-header "Tags")
-(tag-list)


Make sure auto-complete is loaded

Make sure auto-complete is loaded

--- lein-light-nrepl/src/lighttable/nrepl/handler.clj
+++ lein-light-nrepl/src/lighttable/nrepl/handler.clj
@@ -10,6 +10,7 @@
             [lighttable.nrepl.sonar :as sonar]
             [lighttable.nrepl.cljs :as cljs]
             [lighttable.nrepl.doc :as doc]
+            lighttable.nrepl.auto-complete
             [clj-stacktrace.repl :as stack :refer [pst+]]
             [fs.core :as fs]
             [clojure.repl :as repl]))


for opensource show only tab available - config

--- src-cljs/frontend/components/build_head.cljs
+++ src-cljs/frontend/components/build_head.cljs
@@ -736,10 +736,14 @@
    ;; default to the queue tab if the build is currently usage queued, and
    ;; the user is has the right permissions (and is logged in).
    (and (:read-settings scopes)
-        (build-model/in-usage-queue? build))
+        (or (build-model/in-usage-queue? build)
+            ;; "circle.yml" take sup too much room for paid customers.
+            (feature/enabled? :ui-v2)))
    :usage-queue
    ;; If there's no SSH info, build isn't finished, show the usage-queue or commits.
-   (build-model/running? build) (if (feature/enabled? :ui-v2) :usage-queue :commits)
+   (build-model/running? build) (if (feature/enabled? :ui-v2)
+                                  :config
+                                  :commits)
    ;; Otherwise, just use the first one.
    :else :tests))


Update Test Metadata Message

Update Test Metadata Message

  * Add Link to Parallelisation Setup
  * Remove Build Failed Alert

--- src-cljs/frontend/components/build_head.cljs
+++ src-cljs/frontend/components/build_head.cljs
@@ -359,7 +359,7 @@
        [:ul
         [:li "Show a summary of all test failures across all containers"]
         [:li "Identify your slowest tests"]
-        [:li "Balance tests between containers when using properly configured parallelization"]]
+        [:li [:a {:href "/docs/parallel-manual-setup"} "Balance tests between containers when using properly configured parallelization"]]]
        ])

 (defmulti format-test-name test-model/source)
@@ -493,7 +493,7 @@
                                     (:classname slowest)
                                     (:name slowest)
                                     (:run_time slowest))]])]
-              :else [:div.alert.iconified {:class (if build-succeeded? "alert-info" "alert-danger")}
+              :else [:div.alert.iconified {:class "alert-info" }
                      [:div [:img.alert-icon {:src (common/icon-path
                                                    (if build-succeeded? "Info-Info" "Info-Error"))}]]
                      (tests-ad owner (:language project))]))])))))


memoize grain calculation.

memoize grain calculation.

--- clojure/grains/grains.clj
+++ clojure/grains/grains.clj
@@ -1,10 +1,11 @@
 (ns grains)

-(defn square [num]
+(defn- square-unmemoized [num]
   (loop [n num acc 1]
    (if (= n 1)
       acc
       (recur (dec n) (*' 2 acc)))))
+(def square (memoize square-unmemoized))

 (defn total []
   (let [squares (map square (range 1 65))]


define test data structure

define test data structure

--- datomic-dsl/test/datomic_dsl/add_nested_test.clj
+++ datomic-dsl/test/datomic_dsl/add_nested_test.clj
@@ -6,3 +6,12 @@
             [datomic-dsl.create-nested-test :refer :all]
             [clojure.pprint :refer :all]
             [datomic.api :as d]))
+
+(def nest-datom-dsl
+  "Define data structure."
+  {"borrowevent"
+   {"book" {"title" "Mutiny on the Bounty"
+            "author" "Charles Nordoff"}
+    "borrower" {"name" "John Smith"}
+    "date" "today"}})
+


parallelize individual commits and skip long-running files

--- src/atom_finder/questions/atom_committers.clj
+++ src/atom_finder/questions/atom_committers.clj
@@ -70,14 +70,18 @@

 '((->>
    (commits-with
-    gcc-repo ;"b6a9b2f6a629e399fbd35000c656a02bef947866" 1
+    gcc-repo "41ac8cbf4e888a2d80aec9254ea56ea9823169fa"
     (fn [rev-commit]
-      (doseq [commit (:srcs rev-commit)
-              :when (and (:atoms-before commit) (:atoms-after commit))]
-         (log-err (str "edit-lines " (:rev-str commit)) {} ;todo rev-str isn't working here?
-                  (when-let [added (added-atoms commit)]
-                       (prn added))))))
-       (log-to "tmp/atom-committers_gcc_2018-01-04_01.edn")
+      (->> rev-commit
+           :srcs
+           (filter #(and (:atoms-before %) (:atoms-after %)))
+           (pmap #(with-timeout 200 (added-atoms %)))
+           (remove empty?)
+           (map prn)
+           dorun
+          (log-err (str "edit-lines " (->> rev-commit :srcs first :rev-str)) {})
+          )))
+       (log-to "tmp/atom-committers_gcc_2018-01-04_03-200-timeout.edn")
        time-mins
        ))


Yep yep yep

Yep yep yep

--- src/clj_simple_chart/ncs/goliatdiagramtwo.clj
+++ src/clj_simple_chart/ncs/goliatdiagramtwo.clj
@@ -11,7 +11,7 @@
               {:margin-top    marg
                :margin-left   marg
                :margin-bottom 35.0}
-              [{:text "Goliat — ein ekte kjempe?" :font "Roboto Black" :font-size 24}
+              [{:text "Goliat — ein ekte kjempe?" :font "Roboto Black" :font-size 20}
                {:text "Dei ti største oljefelta, pluss Goliat" :font "Roboto Bold" :font-size 14}
                {:text "Opprinneleg utvinnbart, millionar fat olje" :font-size 14}]))


extra_hosts compose support #292

extra_hosts compose support
#292

--- src/cljs/swarmpit/component/service/edit.cljs
+++ src/cljs/swarmpit/component/service/edit.cljs
@@ -44,7 +44,7 @@
      :on-success
             (fn [{:keys [response]}]
               (settings/tags-handler (-> response :repository :name))
-              (state/set-value (select-keys response [:repository :version :serviceName :mode :replicas :stack :agent :command :tty :user :dir :healthcheck]) settings/form-value-cursor)
+              (state/set-value (select-keys response [:repository :version :serviceName :mode :replicas :stack :agent :command :tty :user :dir :healthcheck :hosts]) settings/form-value-cursor)
               (state/set-value (-> (:ports response)
                                    (state/assoc-keys)) ports/form-value-cursor)
               (state/set-value (-> (:mounts response)


add socket logging

add socket logging

--- src/cljs/wombats_web_client/utils/socket.cljs
+++ src/cljs/wombats_web_client/utils/socket.cljs
@@ -15,7 +15,11 @@
 (defn- parse
   "Parses a string into its proper structure"
   [string]
-  (reader/read-string string))
+  (try
+    (reader/read-string string)
+    (catch js/Error e
+      (js/console.error (clj->js {:error e
+                                  :string string})))))

 (defn disconnect
   []


fix multi-line indent

fix multi-line indent

--- src/com/billpiel/mem_tracer/string_output.clj
+++ src/com/billpiel/mem_tracer/string_output.clj
@@ -23,9 +23,9 @@
 (defn base-indent-slinky
   [& {:keys [override underride]
       :or {override [] underride []}}]
-  #spy/d (concat override
+  (concat override
           [:start " "
-           :end " o o  "
+           :end " "
            :default (fn [i]
                       {:fg* i :text "|"})]
           underride))
@@ -67,6 +67,14 @@
          (clojure.string/join ";")
          (format "\33[%sm"))))

+(defn first-wins
+  [kv-coll]
+  (->> kv-coll
+       (partition 2)
+       reverse
+       (map vec)
+       (into {})))
+
 (defn slicky-match
   [i len sl]
   (when-not (-> sl first #{:start :end})
@@ -99,7 +107,7 @@

 (defn slinky->str
   [sl n]
-  (let [[& {:keys [start end]}] sl]
+  (let [{:keys [start end]} (first-wins sl)]
     (->> [[(slinky-part->str start nil)]
           (map #(slinky-part->str
                  (slinky-first-match sl
@@ -149,7 +157,7 @@
            (str "\n"
                 (indent-line-breaks (str s "\n")
                                     indent-base
-                                    :override [:end " x x x  "]))
+                                    :override [:end "   "]))
            (str s))
          "\n")))


Add support for reports to the benchmark command

A report directory can now be specified with -R. If it is supplied
"store report" commands will be submitted every tick, alongside a
catalog submission. For consistency, this also changes the argument for
specifying a catalog directory to -C from -d.

If either reports or catalogs are not supplied, that kind of data will
be skipped, and only the other will be benchmarked.

Also improved error handling during submission, as they're done in
futures and thus would swallow all errors. Similarly, if an agent
experiences a failure, that will now be logged and the agent restarted.

--- src/com/puppetlabs/puppetdb/cli/benchmark.clj
+++ src/com/puppetlabs/puppetdb/cli/benchmark.clj
@@ -77,10 +77,21 @@
     (when-not (= pl-http/status-ok (:status result))
       (log/error result))))

-(defn tweak-catalog
-  "Slightly tweak the given catalog, returning a new catalog"
-  [catalog]
-  (catutils/add-random-resource-to-wire-catalog catalog))
+(defn submit-report
+  "Send the given wire-format `report` (associated with `host`) to a
+  command-processing endpoint located at `puppetdb-host`:`puppetdb-port`."
+  [puppetdb-host puppetdb-port report]
+  (let [result (command/submit-command-via-http! puppetdb-host puppetdb-port "store report" 1 report)]
+    (when-not (= pl-http/status-ok (:status result))
+      (log/error result))))
+
+(defn maybe-tweak-catalog
+  "Slightly tweak the given catalog, returning a new catalog, `rand-percentage`
+  percent of the time."
+  [rand-percentage catalog]
+  (if (< (rand 100) rand-percentage)
+    (catutils/add-random-resource-to-wire-catalog catalog)
+    catalog))

 (defn update-host
   "Send a new _clock tick_ to a host
@@ -95,17 +106,25 @@
     hosts catalog changes in accordance to the users preference)

   * Submit the resulting catalog"
-  [{:keys [host lastrun catalog puppetdb-host puppetdb-port run-interval rand-percentage] :as state} clock]
+  [{:keys [host lastrun catalog report puppetdb-host puppetdb-port run-interval rand-percentage] :as state} clock]
   (if (> (- clock lastrun) run-interval)
-    (let [catalog (if (< (rand 100) rand-percentage)
-                    (tweak-catalog catalog)
-                    catalog)]
-      ;; Submit the catalog in a separate thread, so as to not disturb
-      ;; the world-loop and otherwise distort the space-time
-      ;; continuum.
-      (future
-        (log/info (format "[%s] submitting catalog" host))
-        (submit-catalog puppetdb-host puppetdb-port catalog))
+    (let [catalog (if catalog (maybe-tweak-catalog rand-percentage catalog))]
+      ;; Submit the catalog and reports in separate threads, so as to not
+      ;; disturb the world-loop and otherwise distort the space-time continuum.
+      (when catalog
+        (future
+          (try
+            (submit-catalog puppetdb-host puppetdb-port catalog)
+            (log/info (format "[%s] submitted catalog" host))
+            (catch Exception e
+              (log/error (format "[%s] failed to submit catalog: %s" host e))))))
+      (when report
+        (future
+          (try
+            (submit-report puppetdb-host puppetdb-port report)
+            (log/info (format "[%s] submitted report" host))
+            (catch Exception e
+              (log/error (format "[%s] failed to submit report: %s" host e))))))
       (assoc state :lastrun clock :catalog catalog))
     state))

@@ -121,23 +140,35 @@

       ;; Send out updated ticks to each agent
       (doseq [host hosts]
-        (send host update-host curr-time))
+        (send host update-host curr-time)
+        (when-let [error (agent-error host)]
+          (log/error error (format "[%s] agent failed; restarting" host))
+          ;; Restart it with exactly the same state. Hopefully that's okay!
+          (restart-agent host @host)))

       (Thread/sleep 10)
       (recur curr-time))))

 (defn associate-catalog-with-host
-  "Takes the given catalog and transforms it to appear related to
+  "Takes the given `catalog` and transforms it to appear related to
   `hostname`"
   [hostname catalog]
   (-> catalog
       (assoc-in ["data" "name"] hostname)
       (assoc-in ["data" "resources"] (for [resource (get-in catalog ["data" "resources"])]
                                        (update-in resource ["tags"] conj hostname)))))
+
+(defn associate-report-with-host
+  "Takes the given `report` and transforms it to appear related to
+  `hostname`"
+  [hostname report]
+  (assoc report "certname" hostname))
+
 (defn -main
   [& args]
   (let [[options _]     (cli! args
                               ["-C" "--catalogs" "Path to a directory containing sample JSON catalogs (files must end with .json)"]
+                              ["-R" "--reports" "Path to a directory containing sample JSON reports (files must end with .json)"]
                               ["-i" "--runinterval" "What runinterval (in minutes) to use during simulation"]
                               ["-n" "--numhosts" "How many hosts to use during simulation"]
                               ["-rp" "--rand-perc" "What percentage of submitted catalogs are tweaked (int between 0 and 100)"])
@@ -146,7 +177,8 @@
                             (inis-to-map)
                             (configure-logging!))

-        catalogs        (load-sample-data (:catalogs options))
+        catalogs        (if (:catalogs options) (load-sample-data (:catalogs options)))
+        reports         (if (:reports options) (load-sample-data (:reports options)))

         nhosts          (:numhosts options)
         hostnames       (set (map #(str "host-" %) (range (Integer/parseInt nhosts))))
@@ -162,8 +194,13 @@
                              :rand-percentage rand-percentage
                              :run-interval run-interval
                              :lastrun (- (System/currentTimeMillis) (rand-int run-interval))
-                             :catalog (associate-catalog-with-host % (rand-nth catalogs))})
+                             :catalog (if catalogs (associate-catalog-with-host % (rand-nth catalogs)))
+                             :report (if reports (associate-report-with-host % (rand-nth reports)))})
                     hostnames)]

+    (when-not catalogs
+      (log/info "No catalogs specified; skipping catalog submission"))
+    (when-not reports
+      (log/info "No reports specified; skipping report submission"))
     ;; Loop forever
     (world-loop hosts)))


working on AMI

working on AMI

--- src/clj/clojurewerkz/statistiker/metrics.clj
+++ src/clj/clojurewerkz/statistiker/metrics.clj
@@ -1,18 +1,14 @@
 (ns clojurewerkz.statistiker.metrics
-  (:require [clojure.math.combinatorics :refer [cartesian-product]]))
+  (:require [clojure.math.combinatorics :refer [cartesian-product]]
+            [clojurewerkz.statistiker.entropy :refer [shannon-entropy]]))

-; Adjusted Mutual Information (AMI) is an adjustment of the Mutual Information (MI) score to account for chance.
-; AMI(U, V) = [MI(U, V) - E(MI(U, V))] / [max(H(U), H(V)) - E(MI(U, V))]
-; It takes a sequence of golden standard cluster labels (e.g,. [1 1 2 2 4 4]) and a set of predicted labels (e.g., [1 1 1 2 4 4])
-
-; This metric is independent of the absolute values of the labels: a permutation of the class
-; or cluster label values won’t change the score value in any way.
-(defn adjusted_mutual_information
-  [U V]
-  {:pre [(= (count U) (count V))
-         (not-any? coll? U)
-         (not-any? coll? V)]}
-  0.0)
+;TODO move this to a util NS? Or find a better implementation
+(defn factorial
+  [x]
+    (loop [n x f 1]
+        (if (= n 1)
+            f
+            (recur (dec n) (* f n)))))

 ; The Mutual Information is a measure of the similarity between two labels of the same data.
 ; Where P(i) is the probability of a random sample occurring in cluster U_i and P'(j) is the probability of a random sample
@@ -38,6 +34,42 @@
                (fn [[i j]]
                  (* (norm_n [i j])
                     (Math/log (/ (norm_n [i j])
-                                         (/ (* (a i) (b j))
-                                            (* N N))))))
+                                 (/ (* (a i) (b j))
+                                    (* N N))))))
                cells))))
+
+;TODO: write this!
+(defn expected_mututal_information
+  [U V]
+   (let [a (frequencies U)
+        b (frequencies V)
+        n (apply merge-with + (map #(hash-map [%1 %2] 1) U V))
+        N (count U)
+        ;; TODO: Use a fmap.
+        norm_n (into {} (map (fn[[k v]] [k (/ v N)]) n))
+        cells (keys norm_n)]
+(reduce + (map
+            (fn [[i j]]
+
+              (/
+               (* (factorial (a i)) (factorial (b j)) (factorial (- N (a i))) (factorial (- N (b j))))
+               (* (factorial N) (n [i j])
+              )
+               cells))))
+
+; Adjusted Mutual Information (AMI) is an adjustment of the Mutual Information (MI) score to account for chance.
+; AMI(U, V) = [MI(U, V) - E(MI(U, V))] / [max(H(U), H(V)) - E(MI(U, V))]
+; It takes a sequence of golden standard cluster labels (e.g,. [1 1 2 2 4 4]) and a set of predicted labels (e.g., [1 1 1 2 4 4])
+
+; This metric is independent of the absolute values of the labels: a permutation of the class
+; or cluster label values won’t change the score value in any way.
+(defn adjusted_mutual_information
+  [U V]
+  {:pre [(= (count U) (count V))
+         (not-any? coll? U)
+         (not-any? coll? V)]}
+  (let [MI (mutual_information U V)
+        EMI (expected_mututal_information U V)
+        h_U (shannon-entropy U)
+        h_V (shannon-entropy V)]
+    (/ (- MI EMI) (- (max h_U h_V) EMI))))


bump up test.check

bump up test.check

--- src/leiningen/new/clanhr_service/project.clj
+++ src/leiningen/new/clanhr_service/project.clj
@@ -47,7 +47,7 @@
                        :dev {:env {:dev true
                                    :secret "test"
                                    :gateway-provider :postgres}
-                       :dependencies [[org.clojure/test.check "0.8.0"]
+                       :dependencies [[org.clojure/test.check "0.8.1"]
                                       [ring-mock "0.1.5"]
                                       [criterium "0.4.3"]]
                        :global-vars {*warn-on-reflection* false


(maint) Fix tests to avoid disallowed md5 hash

Puppet recently removed support for using md5 hashes with
file-bucket. This updates our tests accordingly.

--- test/integration/puppetlabs/services/jruby/request_handler_test.clj
+++ test/integration/puppetlabs/services/jruby/request_handler_test.clj
@@ -38,15 +38,15 @@
                                                     (byte -127)
                                                     (byte -126)])
                digested                (.digest
-                                         (MessageDigest/getInstance "MD5")
+                                         (MessageDigest/getInstance "SHA-256")
                                          raw-byte-arr)
-               expected-md5            (.toString (BigInteger. 1 digested) 16)
+               expected-sha256         (.toString (BigInteger. 1 digested) 16)
                expected-bucket-file    (string/join
                                          "/"
                                          [bucket-dir
                                           (string/join "/"
-                                                       (subs expected-md5 0 8))
-                                          expected-md5
+                                                       (subs expected-sha256 0 8))
+                                          expected-sha256
                                           "contents"])
                options                 (merge ssl-request-options
                                               {:body (ByteArrayInputStream.
@@ -54,8 +54,8 @@
                                                :headers {"accept" "binary"
                                                          "content-type" "application/octet-stream"}})
                response (http-client/put (str "https://localhost:8140/"
-                                              "puppet/v3/file_bucket_file/md5/"
-                                              expected-md5
+                                              "puppet/v3/file_bucket_file/sha256/"
+                                              expected-sha256
                                               "?environment=production")
                                          options)]
            (is (= 200 (:status response)) "Bucket PUT request failed")


upgrade famous 0.6.2

upgrade famous 0.6.2

--- examples/lesson-carousel-starter-kit/project.clj
+++ examples/lesson-carousel-starter-kit/project.clj
@@ -8,7 +8,7 @@
                            [org.clojure/clojurescript "0.0-3308"]
                            [figwheel "0.3.3"]
                            [org.clojure/core.async "0.1.346.0-17112a-alpha"]
-                           [com.famous/famous "0.6.0"]
+                           [com.famous/famous "0.6.2"]
                            [reagent "0.5.0"]]

             :plugins [[lein-cljsbuild "1.0.6"]


Updated miscrna gene type assertion rule

Cannot complete rule until I know what SO concept to subclass

--- resources/rules/post_identifier_merge/ice_to_bio/miscrna_gene_type_assertions.clj
+++ resources/rules/post_identifier_merge/ice_to_bio/miscrna_gene_type_assertions.clj
@@ -3,8 +3,8 @@
 ;; -----------------------------------------------
 `{:name "miscrna-gene-type-assertion"
   :description "This rule asserts miscRNA gene type"
-  ;; miscRNA maps to SO: (so:)
-  :head ((?/egKabobDna rdfs/subClassOf obo/SO_XXXXXX))
+  :head ((?/gene rdfs/subClassOf obo/SO_XXXXXX))   ; miscRNA maps to SO: (so:)
+
   :body ((?/record rdf/type ccp/IAO_EXT_0000681) ; ccp:NCBI_gene_info_record
          (?/record obo/BFO_0000051 ?/dna_field_value) ; BFO:has_part
          (?/gene_field_value rdf/type ccp/IAO_EXT_0000876) ; ccp:NCBI_gene_info_record__gene_identifier_field_value


Use consistent language w.r.t flipped arguments

--- src/cats/core.cljc
+++ src/cats/core.cljc
@@ -380,7 +380,7 @@
   (sequence (map mf coll)))

 (defn forseq
-  "Same as mapseq but with the arguments in reverse order.
+  "Same as `mapseq` but with the arguments flipped.

   Let's see a little example:

@@ -456,7 +456,7 @@

 (defn =<<
   "Same as the two argument version of `>>=` but with the
-  arguments interchanged."
+  arguments flipped."
   [f mv]
   (>>= mv f))


Version 0.6.2-SNAPSHOT

Version 0.6.2-SNAPSHOT

--- metlog-vault/project.clj
+++ metlog-vault/project.clj
@@ -1,4 +1,4 @@
-(defproject metlog-vault "0.6.1"
+(defproject metlog-vault "0.6.2-SNAPSHOT"
   :description "Repository for storing and displaying time series data reported by metlog-agent.."

   :license {:name "Eclipse Public License"


Version 0.3.0-SNAPSHOT

Version 0.3.0-SNAPSHOT

--- metlog-vault/project.clj
+++ metlog-vault/project.clj
@@ -1,4 +1,4 @@
-(defproject metlog-vault "0.2.2"
+(defproject metlog-vault "0.3.0-SNAPSHOT"
   :description "Repository for long term storage of series data."

   :license {:name "Eclipse Public License"


Fixed problem with dismissing dialog after launch analysis

Also initialized radio buttons to first option

--- src/cljs/org/broadinstitute/firecloud_ui/page/workspace/method_config_editor.cljs
+++ src/cljs/org/broadinstitute/firecloud_ui/page/workspace/method_config_editor.cljs
@@ -134,9 +134,13 @@
                             (utils/call-ajax-orch
                               (paths/get-entities-by-type-path workspace)
                               {:on-success (fn [{:keys [parsed-response]}]
-                                             (let [emap (group-by (fn [e] (e "entityType")) parsed-response)]
+                                             (let [emap (group-by (fn [e] (e "entityType")) parsed-response)
+                                                   first-entities (get emap (first (keys emap)))
+                                                   first-entity (first first-entities)]
                                                (swap! state assoc :blocker nil :submitting? true
-                                                 :entity-map emap :entities (get emap (first (keys emap))))))
+                                                 :entity-map emap
+                                                 :entities first-entities
+                                                 :selected-entity first-entity)))
                                :on-failure (fn [{:keys [status-text]}]
                                              (swap! state assoc :blocker nil)
                                              (js/alert (str "Error: " status-text)))
@@ -158,40 +162,49 @@
                       :fontSize "137%" :fontWeight 400 :lineHeight 1}}
         "Select Entity"]
        [:div {:style {:position "absolute" :top 4 :right 4}}
-        [comps/Button {:icon :x :onClick #(swap! state assoc :submitting? false)}]]
-       [:div {:ref "launchContainer" :style {:padding "22px 48px 40px" :backgroundColor (:background-gray style/colors)}}
-        (style/create-form-label "Select Entity Type")
-        (style/create-select
-          {:style {:width "50%" :minWidth 50 :maxWidth 200} :ref "filter"
-           :onChange #(let [value (-> (@refs "filter") .getDOMNode .-value)]
-                       (swap! state assoc :entities (get-in @state [:entity-map value])))}
-          (keys (:entity-map @state)))
-        (style/create-form-label "Select Entity")
-        (if (zero? (count (:entities @state)))
-          (style/create-message-well "No entities to display.")
-          [:div {:style {:backgroundColor "#fff" :border (str "1px solid " (:line-gray style/colors))
-                         :padding "1em" :marginBottom "0.5em"}}
-           (let [attribute-keys (apply union (map (fn [e] (set (keys (e "attributes")))) (:entities @state)))]
-             [table/Table
-              {:key (get-id)
-               :columns (concat
-                          [{:header "" :starting-width 40 :resizable? false
-                            :content-renderer (fn [i data]
-                                                [:input {:type "radio"
-                                                         :checked (identical? data (:selected-entity @state))
-                                                         :onChange #(swap! state assoc :selected-entity data)}])}
-                           {:header "Entity Type" :starting-width 100 :sort-by :value}
-                           {:header "Entity Name" :starting-width 100 :sort-by :value}]
-                          (map (fn [k] {:header k :starting-width 100 :sort-by :value}) attribute-keys))
-               :data (map (fn [m]
-                            (concat
-                              [m
-                               (m "entityType")
-                               (m "name")]
-                              (map (fn [k] (get-in m ["attributes" k])) attribute-keys)))
-                       (:entities @state))}])])
-        (style/create-form-label "Define Expression")
-        (style/create-text-field {:ref "expressionname" :defaultValue "" :placeholder "leave blank for default"})]
+        [comps/Button {:icon :x :onClick #(swap! state assoc :submitting? false
+                                           :launch-result nil :launch-exception nil)}]]
+       [:div {:style {:padding "22px 48px 40px" :backgroundColor (:background-gray style/colors)}}
+        (if (:launch-result @state)
+          [:div {}
+           (when (:launch-exception @state)
+             (icons/font-icon {:style {:fontSize "200%" :color (:exception-red style/colors)}}
+               :status-warning-triangle))
+           (:launch-result @state)]
+          [:div {}
+           (style/create-form-label "Select Entity Type")
+           (style/create-select
+             {:style {:width "50%" :minWidth 50 :maxWidth 200} :ref "filter"
+              :onChange #(let [value (-> (@refs "filter") .getDOMNode .-value)
+                               entities (get-in @state [:entity-map value])]
+                          (swap! state assoc :entities entities :selected-entity (first entities)))}
+             (keys (:entity-map @state)))
+           (style/create-form-label "Select Entity")
+           (if (zero? (count (:entities @state)))
+             (style/create-message-well "No entities to display.")
+             [:div {:style {:backgroundColor "#fff" :border (str "1px solid " (:line-gray style/colors))
+                            :padding "1em" :marginBottom "0.5em"}}
+              (let [attribute-keys (apply union (map (fn [e] (set (keys (e "attributes")))) (:entities @state)))]
+                [table/Table
+                 {:key (get-id)
+                  :columns (concat
+                             [{:header "" :starting-width 40 :resizable? false
+                               :content-renderer (fn [i data]
+                                                   [:input {:type "radio"
+                                                            :checked (identical? data (:selected-entity @state))
+                                                            :onChange #(swap! state assoc :selected-entity data)}])}
+                              {:header "Entity Type" :starting-width 100 :sort-by :value}
+                              {:header "Entity Name" :starting-width 100 :sort-by :value}]
+                             (map (fn [k] {:header k :starting-width 100 :sort-by :value}) attribute-keys))
+                  :data (map (fn [m]
+                               (concat
+                                 [m
+                                  (m "entityType")
+                                  (m "name")]
+                                 (map (fn [k] (get-in m ["attributes" k])) attribute-keys)))
+                          (:entities @state))}])])
+           (style/create-form-label "Define Expression")
+           (style/create-text-field {:ref "expressionname" :defaultValue "" :placeholder "leave blank for default"})])]
        [:div {:style {:fontSize "106%" :lineHeight 1 :textAlign "center"}}
         [:div {:style {:padding "0.7em 0" :cursor "pointer"
                        :backgroundColor (:button-blue style/colors)
@@ -214,12 +227,10 @@
                                     :data (utils/->json-string payload)
                                     :headers{"Content-Type" "application/json"}
                                     :on-done (fn [{:keys [success? xhr]}]
-                                                 ;; TODO total hack below for UI ...
-                                                 (if success?
-                                                   (set! (-> (@refs "launchContainer") .getDOMNode .-innerHTML) (.-responseText xhr))
-                                                   (do
-                                                     (set! (-> (@refs "launchContainer") .getDOMNode .-style .-backgroundColor) (:exception-red style/colors))
-                                                     (set! (-> (@refs "launchContainer") .getDOMNode .-innerHTML) (.-responseText xhr)))))
+                                               ;; TODO total hack below for UI ...
+                                               (swap! state assoc :launch-result (.-responseText xhr))
+                                               (if-not success?
+                                                 (swap! state assoc :launch-exception true)))
                                     :canned-response {:responseText (utils/->json-string
                                                                       [{"workspaceName" {"namespace" "broad-dsde-dev",
                                                                                "name" "alexb_test_submission"},


Add group-by dsl function.

Add group-by dsl function.

--- src/cljooq/dsl.clj
+++ src/cljooq/dsl.clj
@@ -123,6 +123,16 @@
   [q select']
   (DSL/exists select'))

+(defn group-by
+  [q & groups]
+  (->> (map (fn [fields]
+              (->> (map field fields)
+                   (into-array org.jooq.Field)
+                   (DSL/groupingSets)))
+            groups)
+       (into-array org.jooq.GroupField)
+       (.groupBy q)))
+
 (defn limit
   "Creates limit clause."
   [q num]


Grammar fix.

Grammar fix.

--- examples/showvideo.clj
+++ examples/showvideo.clj
@@ -1,6 +1,6 @@
 (ns showvideo
-  "Example of decoding AR.Drone video with asynchronous display and
-  latency reduction."
+  "This is an example of decoding AR.Drone video with asynchronous
+  display and latency reduction."
   (:require [clojure.java.io :as io]
             [clojure.tools.logging :as log]
             [com.lemondronor.turboshrimp.h264j :as decode]


downgrade lein-packer to 0.1.0 (stable)

downgrade lein-packer to 0.1.0 (stable)

--- ext/chrome/project.clj
+++ ext/chrome/project.clj
@@ -6,7 +6,7 @@

   :plugins [[lein-figwheel "0.5.9"]
             [lein-cljsbuild "1.1.5"]
-            [lein-packer "0.1.1"]]
+            [lein-packer "0.1.0"]]

   :clean-targets ^{:protect false} ["resources/public/js"
                                     "resources/public/js/owl.js"


upgrade lein-packer to 0.1.1

upgrade lein-packer to 0.1.1

--- ext/chrome/project.clj
+++ ext/chrome/project.clj
@@ -3,7 +3,9 @@
                  [org.clojure/clojurescript "1.9.229"]
                  [domina "1.0.3"]]
   :plugins [[lein-figwheel "0.5.9"]
-            [lein-cljsbuild "1.1.5"]]
+            [lein-cljsbuild "1.1.5"]
+            [lein-packer "0.1.1"]]
+
   :clean-targets ^{:protect false} ["resources/public/js"
                                     "resources/public/js/owl.js"
                                     :target-path]
@@ -33,7 +35,13 @@
                                  :output-to "resources/public/js/owl.js"
                                  :optimizations :advanced
                                  :pretty-print false}
-                      }]}}
+                      }]}
+                   :pack {:mapping [{:source-paths ["manifest.json"
+                                                    "resources/public"]
+                                     :target-path "target/pro"
+                                     :excludes [#"\w+\.\w+\~"]}]
+                          :target {:type "crx"
+                                   :path "target/pro"}}}
              }


CMR-5848 Updated test to better test the source granule ingest.

--- system-int-test/test/cmr/system_int_test/virtual_product/virtual_product_test.clj
+++ system-int-test/test/cmr/system_int_test/virtual_product/virtual_product_test.clj
@@ -38,9 +38,8 @@

   (def isc (vp/ingest-source-collections))

-  (def vpc (vp/ingest-virtual-collections isc))
-
-  )
+  (def vpc (vp/ingest-virtual-collections isc)))
+

 (deftest specific-granule-in-virtual-product-test
   (let [[ast-coll] (vp/ingest-source-collections
@@ -375,19 +374,26 @@

 (deftest CMR-5848-umm-json-granule-virtual-product-ingest-test
   (testing "ingest with Virtual-Product-Service with a umm-json granule"
-    (let [psa1 (data-umm-cmn/additional-attribute {:Name "source_granule_ur" :DataType "STRING" :Description "Test"})
-          collection (d/ingest-umm-spec-collection "GES_DISC" (data-umm-c/collection
-                                                                {:EntryTitle "OMI/Aura Surface UVB Irradiance and Erythemal Dose Daily L3 Global 1.0x1.0 deg Grid V003 (OMUVBd) at GES DISC"
-                                                                 :ShortName "OMUVBd_ErythemalUV"
-                                                                 :AdditionalAttributes [psa1]
-                                                                 :Version "003"}))
-          granule (dg/granule-with-umm-spec-collection
-                   collection
-                   (:concept-id collection)
-                   {:provider-id "GES_DISC"
-                    :collection-ref (umm-g/map->CollectionRef {:entry-title "OMI/Aura Surface UVB Irradiance and Erythemal Dose Daily L3 Global 1.0x1.0 deg Grid V003 (OMUVBd) at GES DISC"})})
+    (let [[ast-coll] (vp/ingest-source-collections
+                       [(assoc
+                          (dc/collection
+                            {:entry-title "ASTER L1A Reconstructed Unprocessed Instrument Data V003"
+                             :short-name "AST_L1A"
+                             :projects (dc/projects "proj1" "proj2" "proj3")})
+                          :provider-id "LPDAAC_ECS")])
+          vp-colls (vp/ingest-virtual-collections [ast-coll])
+          granule-ur "SC:AST_L1A.003:2006227720"
+          granule (vp/add-granule-attributes "LPDAAC_ECS"
+                                              (dg/granule ast-coll {:granule-ur granule-ur
+                                                                    :provider-id "LPDAAC_ECS"
+                                                                    :project-refs ["proj1"]}))
+
           concept (d/item->concept granule {:format :umm-json
-                                            :version "1.4"})]
+                                            :version "1.4"})
+          _ (ingest/ingest-concept concept)
+          expected-granule-urs (vp/source-granule->virtual-granule-urs granule)
+          all-expected-granule-urs (cons (:granule-ur granule) expected-granule-urs)]
+      (index/wait-until-indexed)
       (vp/assert-matching-granule-urs
-       (:granule-ur concept)
+       all-expected-granule-urs
        (search/find-refs :granule {:page-size 50})))))


Prepare to use an out-fn for counting.

Prepare to use an out-fn for counting.

--- src/dsbdp/main.clj
+++ src/dsbdp/main.clj
@@ -175,7 +175,7 @@
     proc-fns))

 (defn prepare-in-fn
-  [options scenario in-data ^Counter in-cntr ^Counter out-cntr in-chan pipeline queue-size]
+  [options scenario in-data ^Counter in-cntr out-fn in-chan pipeline queue-size]
   (let [batch-delay (:batch-delay options)
         batch-size (:batch-size options)
         create-batched-in-fn (fn [in-fn]
@@ -194,33 +194,30 @@
         in-fn (cond
                 (.endsWith scenario "-direct")
                   (fn []
-                    (direct-proc-fn in-data)
-                    (.inc out-cntr))
+                    (out-fn (direct-proc-fn in-data)))
                 (.endsWith scenario "-direct-pmap")
                   (let [d (repeat collection-size in-data)]
                     (doall d)
                     (fn []
-                      (doseq [_ (pmap direct-proc-fn d)]
-                        (.inc out-cntr))))
+                      (doseq [obj (pmap direct-proc-fn d)]
+                        (out-fn obj))))
                 (.endsWith scenario "-direct-reducers-map")
                   (let [in-vec (vec (repeat collection-size in-data))]
                     (doall in-vec)
                     (fn []
-                      (doseq [_ (reducers/fold
-                                  partition-size
-                                  reducers/cat
-                                  reducers/append!
-                                  (reducers/map direct-proc-fn in-vec))]
-                        (.inc out-cntr))))
+                      (doseq [obj (reducers/fold
+                                    partition-size
+                                    reducers/cat
+                                    reducers/append!
+                                    (reducers/map direct-proc-fn in-vec))]
+                        (out-fn obj))))
                 (.endsWith scenario "-simple-pmap")
-                  (let [out-fn (fn [_] (.inc out-cntr))
-                        pmap-proc (create-simple-pmap-processor direct-proc-fn collection-size out-fn)]
+                  (let [pmap-proc (create-simple-pmap-processor direct-proc-fn collection-size out-fn)]
                     (fn []
                       (pmap-proc in-data)
                       (.inc in-cntr)))
                 (.endsWith scenario "-simple-reducers-map")
-                  (let [out-fn (fn [_] (.inc out-cntr))
-                        red-proc (create-simple-reducers-map-processor direct-proc-fn collection-size partition-size out-fn)]
+                  (let [red-proc (create-simple-reducers-map-processor direct-proc-fn collection-size partition-size out-fn)]
                     (fn []
                       (red-proc in-data)
                       (.inc in-cntr)))
@@ -247,7 +244,7 @@
                   (not (nil? in-data))
                   (not (nil? pipeline))) (create-flood-in-fn (get-in-fn pipeline))
                 :default (if (not (.contains scenario "async-pipeline"))
-                           (fn [] (.inc out-cntr))))]
+                           out-fn))]
     in-fn))

 (defn -main [& args]
@@ -260,6 +257,7 @@
     (println "Using args:" arguments)
     (let [in-cntr (Counter.)
           out-cntr (Counter.)
+          out-fn (fn [_] (.inc out-cntr))
           delta-cntr (delta-counter)
           ^String scenario (:scenario options)
           in-data (prepare-in-data options)


docstrings added

docstrings added

--- src/etaoin/api.clj
+++ src/etaoin/api.clj
@@ -772,16 +772,22 @@
   Returns: a string with the attribute value, `nil` if no such
   attribute for that element.

+  Note: it does not split CSS classes! A single string with spaces is
+  returned.
+
   Example:

   (def driver (firefox))
   (get-element-attr driver {:tag :a} :class)
-  >> \"link link__external\"
+  >> \"link link__external link__button\" ;; see note above
 "
   [driver q name]
   (get-element-attr* driver (query driver q) name))

-(defn get-element-attrs [driver q & names]
+(defn get-element-attrs
+  "Returns multiple attributes in batch. The result is a vector of
+  corresponding attributes."
+  [driver q & names]
   (let [el (query driver q)]
     (mapv
      #(get-element-attr* driver el %)
@@ -798,10 +804,37 @@
     resp
     (-> resp :value not-empty)))

-(defn get-element-css [driver q name]
+(defn get-element-css
+  "Returns a CSS property of an element. The property might be both
+  own or inherited.
+
+  Arguments:
+
+  - `driver`: a driver instance,
+
+  - `q`: a query term,
+
+  - `name`: a string/keyword with a CSS name (:font,
+  \"background-color\", etc).
+
+  Returns a string with a value, `nil` if there is no such property.
+
+  Note: colors, fonts and some other properties may be represented in
+  their own ways depending on a browser.
+
+  Example:
+
+  (def driver (firefox))
+  (get-element-css driver {:id :content} :background-color)
+  >> \"rgb(204, 204, 204)\" ;; or \"rgba(204, 204, 204, 1)\"
+"
+  [driver q name]
   (get-element-css* driver (query driver q) name))

-(defn get-element-csss [driver q & names]
+(defn get-element-csss
+  "Returns multiple CSS properties in batch. The result is a vector of
+  corresponding properties."
+  [driver q & names]
   (let [el (query driver q)]
     (mapv
      #(get-element-css* driver el %)


Remove protocols from sahucs

Remove protocols from sahucs

--- src/exp/sahucs.clj
+++ src/exp/sahucs.clj
@@ -15,20 +15,15 @@
 ;; TODO: pass incremental updates upwards.
 ;; Difficulty: nodes with multiple ancestors.

-(defprotocol HasCutoff (cutoff [x]))
-(defprotocol HasQueue  (queue [x]))

-(deftype PartialResult [result-map cutoff]
-  HasCutoff (cutoff [] cutoff))
+
+(deftype PartialResult [result-map cutoff])

 ;; A PartialResult stores a map from states to rewards, where a state is present
 ;; iff it has reward > cutoff.

-
-(deftype SANode [context action result-map-atom queue]
-  HasCutoff (cutoff [] (- (second (queues/pq-peek-min queue))))
-  HasQueue  (queue [] queue))
+(deftype SANode [context action result-map-atom queue])

 ;; Represents an action sequence from a state, with sanode representing the first action in remaining-actions.
  ; (or nil, if remaining-actions is empty.)
@@ -66,6 +61,8 @@
                         [(SANodeEntry s (when (seq ref) (get-sa-node cache s (first ref))) 0.0 ref) 0.0])))))))

+(defn cutoff [#^::SANode node]
+  (- (second (queues/pq-peek-min (:queue node)))))

 (defn stitch-results [effect-map state reward-to-state]
   (util/map-map
@@ -80,7 +77,7 @@
                          (util/filter-map #(<= (val %) last-cutoff)  @(:result-map-atom node)))]
      (if (< (cutoff node) next-best)
          (PartialResult (stitch-results new-results state reward-to-state) (cutoff node))
-       (let [[entry neg-reward] (queues/pq-remove-min-with-cost! (queue node))
+       (let [[entry neg-reward] (queues/pq-remove-min-with-cost! (:queue node))
              b-s (:state entry), b-rts (:reward-to-state entry), b-ra (:remaining-actions entry), b-sa (:sanode entry)
              rec-next-best (max next-best (cutoff node))]
            (if (empty? b-ra)
@@ -89,9 +86,9 @@
                  (recur (assoc-safe new-results >= eff b-rts)))
              (let [rec (expand-sa-node b-sa cache (- rec-next-best b-rts) b-s b-rts (- 0 neg-reward b-rts))]
                (when (> (:cutoff rec) Double/NEGATIVE_INFINITY)
-                 (queues/pq-replace! (queue node) entry (- 0 b-rts (:cutoff rec))))
+                 (queues/pq-replace! (:queue node) entry (- 0 b-rts (:cutoff rec))))
                (doseq [[ss sr] (:result-map rec)]
-                 (queues/pq-add! (queue node)
+                 (queues/pq-add! (:queue node)
                    (SeqNodeEntry ss (when (next b-ra) (get-sa-node cache ss (second b-ra))) sr (next b-ra))
                    (- sr)))
                (recur new-results)))))))


Update gp.clj

Update gp.clj

--- src/simple_symbolic_regression_clojure/gp.clj
+++ src/simple_symbolic_regression_clojure/gp.clj
@@ -68,7 +68,7 @@
   (assoc individual :score score))

 (defn get-score [individual]
-  (:score (deref individual)))
+  (:score individual))

 ;;; Generating random scripts, individuals, etc.


CSS animation was deleted

CSS animation was deleted

--- src/gol/styles.clj
+++ src/gol/styles.clj
@@ -7,78 +7,16 @@
 )

-(def cell-size 10)
-
-
-(defkeyframes cell-blinking
-  [:from {:opacity 1}]
-  [:50% {:opacity 0.6}]
-  [:to {:opacity 1}]
-)
-
-
-(defkeyframes cell-animation
-  [:form {
-    :width (percent 100)
-    :height (percent 100)
-    :border-radius (percent 50) }]
-
-  [:20% {
-    :width (percent 110)
-    :height (percent 110)
-    :border-radius [[(percent 47) (percent 100) (percent 60) (percent 81)]] }]
-
-  [:40% {
-    :width (percent 100)
-    :height (percent 100)
-    :border-radius [[(percent 188) (percent 40) (percent 206) (percent 80)]] }]
-
-  [:60% {
-    :width (percent 110)
-    :height (percent 110)
-    :border-radius [[(percent 81) (percent 99) (percent 66) (percent 75)]] }]
-
-  [:80% {
-    :width (percent 100)
-    :height (percent 100)
-    :border-radius [[(percent 71) (percent 33) (percent 63) (percent 47)]] }]
-
-  [:to {
-    :width (percent 100)
-    :height (percent 100)
-    :border-radius (percent 50) }]
-)
-
-
-(defkeyframes cell-core
-  [:form {
-    :left (percent 50)
-    :top (percent 50) }]
-
-  [:33% {
-    :left (percent 30)
-    :top (percent 60) }]
-
-  [:66% {
-    :left (percent 35)
-    :top (percent 40) }]
-
-  [:to {
-    :left (percent 50)
-    :top (percent 50) }]
-)
+(def cell-size 12)

 (defstyles styles
-  cell-animation
-  cell-blinking
-  cell-core
-
   [:html {
     :height (percent 100) }]

   [:body {
     :display "table"
+    :min-width (px 980)
     :width (percent 100)
     :height (percent 100)
     :margin 0
@@ -100,17 +38,15 @@
     [:&:hover
       [:b {:border-color (hex->rgb "#ccc")}] ]

-    [:.cell ^:prefix {
-      :animation [[cell-blinking (s 2) "infinite" "linear"]] }]
-
     [:b {
       :display "inline-block"
       :width (px cell-size)
       :height (px cell-size)
       :padding (px 1)
       :margin [[(px -1) 0 0 (px -1)]]
+      :border [[(px 1) "dotted" "transparent"]]
       :vertical-align "top"
-      :border [[(px 1) "dotted" "transparent"]] }
+      :white-space "nowrap" }

       [:i {
         :position "relative"
@@ -124,9 +60,6 @@
           :border-radius (percent 50)
           :box-shadow [[0 0 (px 10) (rgba 0 0 0 0.2)]] }]

-        [:& ^:prefix {
-          :animation [[cell-animation (s 5) "infinite" "linear"]] }]
-
         [:&:after {
           :position "absolute"
           :top (percent 50)
@@ -137,8 +70,5 @@
           :content "\"\""}
           [:& ^:prefix {
             :border-radius (percent 50)
-            :box-shadow [[0 0 (px 3) (rgba 0 0 0 0.5)]] }]
-
-          [:& ^:prefix {
-            :animation [[cell-core (s 3) "infinite" "linear"]] }] ]]]]
+            :box-shadow [[0 0 (px 3) (rgba 0 0 0 0.5)]] }] ]]]]
 )


Adding a note about Cassandra CQL/Thrift interfaces/

--- src/clojure/clojurewerkz/cassaforte/thrift/schema.clj
+++ src/clojure/clojurewerkz/cassaforte/thrift/schema.clj
@@ -22,6 +22,7 @@

 (defn ^org.apache.cassandra.thrift.KsDef
   describe-keyspace
+  "Doesn't show any of cql3-created column famlies: https://issues.apache.org/jira/browse/CASSANDRA-4913"
   [^String name]

   (conv/to-map (.describe_keyspace ^CassandraClient cc/*cassandra-client* name)))


changed error color

changed error color

Former-commit-id: 42faf66c1d8b10c631054c2e432304a2929215e8

--- src/status_im/contacts/views/new_contact.cljs
+++ src/status_im/contacts/views/new_contact.cljs
@@ -38,6 +38,7 @@
   []
   [text-field
    {:error (if (str/blank? name) "" nil)
+    :errorColor "#7099e6"
     :value name
     :label           (label :t/name)
     :onChangeText          #(dispatch [:set-in [:new-contact :name] %])}])
@@ -51,6 +52,7 @@
     [view button-input-container
    [text-field
     {:error error
+     :errorColor "#7099e6"
      :value whisper-identity
      :wrapperStyle                 (merge button-input)
      :label           (label :t/address)


[#9666] Missing translations on "Lock app with fingerprint", "Save with password" popups

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

--- src/status_im/ui/screens/biometric/views.cljs
+++ src/status_im/ui/screens/biometric/views.cljs
@@ -18,8 +18,9 @@
            ok-button-label cancel-button-label on-cancel on-confirm]}]
   (let [supported-biometric-auth (get-supported-biometric-auth)
         bio-type-label           (get-bio-type-label)]
-    [react/view {:margin-top  24
-                 :align-items :center}
+    [react/view {:margin-top         24
+                 :align-items        :center
+                 :padding-horizontal 24}
      [react/view {:width            32
                   :height           32
                   :background-color colors/blue-light
@@ -63,7 +64,7 @@

 (defn enable-biometric-popover []
   [biometric-popover
-   {:title-label       :t/biometric-enable-title
+   {:title-label       :t/biometric-secure-with
     :description-label :t/to-enable-biometric
     :ok-button-label   :t/biometric-enable-button
     :on-confirm        :biometric-logout}])
@@ -72,11 +73,9 @@
   (let [keycard-account? @(re-frame/subscribe
                            [:multiaccounts.login/keycard-account?])]
     [biometric-popover
-     {:title-label     :t/biometric-secure-with
-      :ok-button-label :t/biometric-enable-button
-      :on-confirm      :biometric/enable
-
-      :description-label
-      (if keycard-account?
-        (i18n/label :t/biometric-enable-keycard)
-        (i18n/label :t/biometric-enable))}]))
+     {:title-label       :t/biometric-secure-with
+      :ok-button-label   :t/biometric-enable-button
+      :on-confirm        :biometric/enable
+      :description-label (if keycard-account?
+                           :t/biometric-enable-keycard
+                           :t/biometric-enable)}]))


Descending is a better way of referring to CAR scales.

--- src/african_polyphony_and_polyrhythm/talk.clj
+++ src/african_polyphony_and_polyrhythm/talk.clj
@@ -221,20 +221,20 @@

-; Little-endian pentatonic
+; Descending pentatonic
 (def pentatonic (scale [2 3 2 2 3]))
-(def little-endian -)
+(def descending -)

 (comment
   (map (comp A pentatonic) (range 0 6))
-  (map (comp A little-endian pentatonic) (range 0 6))
+  (map (comp A descending pentatonic) (range 0 6))

   (->> (phrase (repeat 1/4) (range 0 6))
        (where :pitch (comp midi->hz A pentatonic))
        live/play)

   (->> (phrase (repeat 1/4) (range 0 6))
-       (where :pitch (comp midi->hz A little-endian pentatonic))
+       (where :pitch (comp midi->hz A descending pentatonic))
        live/play))

@@ -299,7 +299,7 @@
        (map rand-variations)
        (introduce-successively 4)
        (map pan)
-       (where :pitch (comp midi->hz high A little-endian pentatonic))
+       (where :pitch (comp midi->hz high A descending pentatonic))
        (tempo (bpm 120))))

 (comment


added test for listen on port

added test for listen on port

--- integration/org/domaindrivenarchitecture/pallet/serverstate/run_on_pallet_node.clj
+++ integration/org/domaindrivenarchitecture/pallet/serverstate/run_on_pallet_node.clj
@@ -45,6 +45,11 @@
    e.g: [ [\"root\" \"/root\"] ... ] "
   [user-list]
   (println "Testing if user pallet exists.")
+  (= 1 (count (filter #(= (first %) "pallet") user-list))))
+
+(defn test-palletport-listening
+  "Tests if ports are listened."
+  [port-list]
   (= 1 (count (filter #(= (first %) "pallet") user-list))))

 (defmethod dda-crate/dda-test facility [dda-crate config]


Explain atom tomfoolery

Explain atom tomfoolery

--- src/reply/core.clj
+++ src/reply/core.clj
@@ -71,15 +71,18 @@
             request-prompt)
         (throw e)))))

-(defn -main [& args]
-  (set-break-handler! handle-ctrl-c)
-  (reset! jline-reader (make-reader))
-  (reset! jline-pushback-reader
+(defn setup-reader! []
+  (reset! jline-reader (make-reader)) ; since construction is side-effect-y
+  (reset! jline-pushback-reader ; since this depends on jline-reader
     (CustomizableBufferLineNumberingPushbackReader.
       (JlineInputReader.
         {:jline-reader @jline-reader
          :set-empty-prompt set-empty-prompt})
-      1))
+      1)))
+
+(defn -main [& args]
+  (set-break-handler! handle-ctrl-c)
+  (setup-reader!)
   (repl :read jline-read
         :prompt (fn [] false)
         :need-prompt (fn [] false))


Add proper import to namespace

Add proper import to namespace

--- src/vadas/core.clj
+++ src/vadas/core.clj
@@ -1,9 +1,10 @@
-(ns vadas.core)
+(ns vadas.core
+  (:import (edu.cmu.sphinx.api Configuration)))

 (defn start-listening
   "Test CMU Sphinx4 listener"
   []
-  (let [config (new edu.cmu.sphinx.api.Configuration)]
+  (let [config (new Configuration)]
     (println "Created new configuration: " (str config))))

 (defn -main


get the maximum beat

get the maximum beat

--- ohack/src/ohack/core.clj
+++ ohack/src/ohack/core.clj
@@ -288,7 +288,9 @@
                                                         [])])
                                         (parse-guitar-tab-line tab-line)))
                              )))
-                        )]
-    play-map)
+                        )
+        max-beat (apply max (keys play-map))
+        ]
+    max-beat)

   )


[#2643] Sort subbucket bar viz data

[#2643] Sort subbucket bar viz data

--- backend/src/akvo/lumen/lib/aggregation/bar.clj
+++ backend/src/akvo/lumen/lib/aggregation/bar.clj
@@ -40,7 +40,7 @@
             sort_table
           ON
             sort_table.x = data_table.x
-          ORDER BY %5$s"
+          ORDER BY %5$s, data_table.s"
           (:columnName bucket-column)
           aggregation
           table-name


Excise threading mode

Excise threading mode

DEDICATED, normally the default, is what you want.

--- src/desdemona/launcher/aeron_media_driver.clj
+++ src/desdemona/launcher/aeron_media_driver.clj
@@ -3,24 +3,16 @@
   (:require [clojure.core.async :refer [chan <!!]]
             [clojure.tools.cli :refer [parse-opts]])
   (:import [uk.co.real_logic.aeron Aeron$Context]
-           [uk.co.real_logic.aeron.driver MediaDriver MediaDriver$Context ThreadingMode]))
+           [uk.co.real_logic.aeron.driver MediaDriver MediaDriver$Context]))

 (def cli-options
-  [["-t" "--threading-mode THREADING-MODE" "Aeron media driver threading mode: shared or dedicated or shared-network"
-    :default "shared"
-    :validate [#{"shared" "dedicated" "shared-network"} "Must be shared, dedicated, or shared-network"]]
-   ["-d" "--delete-dirs" "Delete the media drivers directory on startup" :default false]
+  [["-d" "--delete-dirs" "Delete the media drivers directory on startup" :default false]
    ["-h" "--help"]])

 (defn -main [& args]
   (let [opts (parse-opts args cli-options)
-        {:keys [help threading-mode delete-dirs]} (:options opts)
-        threading-mode-obj (cond
-                             (= threading-mode "dedicated") ThreadingMode/DEDICATED
-                             (= threading-mode "shared-network") ThreadingMode/SHARED_NETWORK
-                             :else ThreadingMode/SHARED)
+        {:keys [help delete-dirs]} (:options opts)
         ctx (cond-> (MediaDriver$Context.)
-              threading-mode (.threadingMode threading-mode-obj)
               delete-dirs (.dirsDeleteOnStart delete-dirs))
         media-driver (try (MediaDriver/launch ctx)
                           (catch IllegalStateException ise
@@ -30,8 +22,5 @@
               (println (clojure.string/join " " (take 3 opt))))
             cli-options)
       (System/exit 0))
-    (when (and (System/getProperty "aeron.threading.mode") threading-mode)
-      (throw (Exception. "Cannot set both aeron.threading.mode property and threading-mode command-line arg")))
-    (println "Starting media driver with threading mode:" threading-mode ". Use -t to supply an alternative threading mode.")
     (println "Launched the Media Driver. Blocking forever...")
     (<!! (chan))))


Add test to verify the :shrink-step events

--- src/test/clojure/clojure/test/check/test.cljc
+++ src/test/clojure/clojure/test/check/test.cljc
@@ -979,6 +979,34 @@
       (is (= #{:trial :complete}
              (->> @calls (map :type) set))))))

+(deftest shrink-step-events-test
+  (let [events (atom [])
+        reporter-fn (partial swap! events conj)
+        pred (fn [n] (not (< 100 n)))
+        prop (prop/for-all [n (gen/scale (partial * 10) gen/nat)]
+                           (pred n))]
+    (tc/quick-check 100 prop :reporter-fn reporter-fn)
+    (let [shrink-steps (filter #(= :shrink-step (:type %)) @events)
+          failing-steps (filter (complement :pass?) shrink-steps)
+          passing-steps (filter :pass? shrink-steps)
+          get-args-and-smallest-args (juxt (comp first :args) (comp first :args :current-smallest))]
+      (is (every? #(not (pred (-> % :args first))) failing-steps)
+          "pred on args is falsey in all failing steps")
+      (is (every? #(pred (-> % :args first)) passing-steps)
+          "pred on args is truthy in all passing steps")
+      (is (->> failing-steps
+               (map get-args-and-smallest-args)
+               (every? (fn [[args current-smallest-args]] (= args current-smallest-args))))
+          "for every failing step, current-smallest args are equal to args")
+      (is (->> passing-steps
+               (map get-args-and-smallest-args)
+               (every? (fn [[args current-smallest-args]] (< args current-smallest-args))))
+          "for every passing step, current-smallest args are smaller than args")
+      (let [shrunk-args (map (comp first :args) failing-steps)]
+        (is (= shrunk-args
+               (reverse (sort shrunk-args)))
+            "failing steps args are sorted in descending order")))))
+
 ;; TCHECK-77 Regression
 ;; ---------------------------------------------------------------------------


[#843] Remove some duplication

[#843] Remove some duplication

--- backend/src/akvo/lumen/component/tenant_manager.clj
+++ backend/src/akvo/lumen/component/tenant_manager.clj
@@ -78,27 +78,26 @@
       (swap! tenants
              assoc-if-key-does-not-exist
              label
-             {::uri   decrypted-db-uri
+             {::uri  decrypted-db-uri
               ::spec (delay (pool {:db_uri              decrypted-db-uri
                                    :dropwizard-registry (:dropwizard-registry config)
                                    :label               label}))}))
     (throw (Exception. "Could not match dns label with tenant from tenats."))))

+(defn get-or-create-tenant [db config tenants label]
+  (if-let [tenant (get @tenants label)]
+    tenant
+    (->
+      (load-tenant db config tenants label)
+      (get label))))
+
 (defrecord TenantManager [db config]
   TenantConnection
   (connection [{:keys [tenants]} label]
-    (if-let [tenant (get @tenants label)]
-      @(::spec tenant)
-      (do
-        (load-tenant db config tenants label)
-        @(::spec (get @tenants label)))))
+    @(::spec (get-or-create-tenant db config tenants label)))

   (uri [{:keys [tenants]} label]
-    (if-let [tenant (get @tenants label)]
-      (::uri tenant)
-      (do
-        (load-tenant db config tenants label)
-        (::uri (get @tenants label)))))
+    (::uri (get-or-create-tenant db config tenants label)))

   TenantAdmin
   (current-plan [{:keys [db]} label]