Added more lat/lon handlers

Added more lat/lon handlers

--- src/ais/mapping/common.clj
+++ src/ais/mapping/common.clj
@@ -4,13 +4,19 @@

 (defn const [c & _] c)

-(def lon (partial ais-types/I (/ 1.0 600000) 4))
+(def x-scale  600000000) ;; 1/10
+(def l-scale   60000000) ;; 1/100
+(def m-scale    6000000) ;; 1/1000
+(def s-scale     600000) ;; 1/10000

-(def lat (partial ais-types/I (/ 1.0 600000) 4))
+(def lon (partial ais-types/I (/ 1.0 s-scale) 4))
+(def lat (partial ais-types/I (/ 1.0 s-scale) 4))

-(def slon (partial ais-types/I (/ 1.0 6000000) 3))
+(def mlon (partial ais-types/I (/ 1.0 m-scale) 3))
+(def mlat (partial ais-types/I (/ 1.0 m-scale) 3))

-(def slat (partial ais-types/I (/ 1.0 6000000) 3))
+(def xlon (partial ais-types/I (/ 1.0 x-scale) 1))
+(def xlat (partial ais-types/I (/ 1.0 x-scale) 1))

 (def speed (partial ais-types/U (/ 1.0 10) 1))


cleanup; +basic-spec

cleanup; +basic-spec

--- src/babel/english/lab.cljc
+++ src/babel/english/lab.cljc
@@ -105,19 +105,17 @@
           :subj {:pred :dog
                  :mod {:first {:pred :small}}}}}})

+(def basic-spec {:synsem {:subcat []
+                          :cat :verb}})
+
 (def the-static-tree
   (unify
     (create-the-static-tree)
     semantics
-    {:synsem
-     {:sem {:pred :see
-            :obj {:pred :chair
-                  :spec {:def :def}
-                  :mod {:first {:pred :red}}}
-            :subj {:pred :dog
-                   :mod {:first {:pred :small}}}}}}))
-
-;; can be used to determine
+    basic-spec))
+
+;; can be used to determine how generation speed is affected by
+;; lexicon size
 (def tiny-lexicon
   (filter #(or
             true


clean up prompt

clean up prompt

--- src/bitsplit_cli/core.cljs
+++ src/bitsplit_cli/core.cljs
@@ -5,6 +5,8 @@
     (:use-macros
         [cljs.core.async.macros :only (go-loop)]))
 (def prompt (js/require "prompt"))
+(set! (.-message prompt) "")
+(set! (.-delimiter prompt) "")

 (def storage (->File "FAKE"))
 ; (def client (->Bitcoind ""))
@@ -22,7 +24,7 @@

 (defn read-prompt [p]
     (let [return (chan 1)]
-        (.getLine prompt p
+        (.get prompt p
             (fn [err input]
                 (put! return
                     (aget input p))))


added matrix-pmap, column-marginal, and row-marginal functions to math.matrix

--- src/brevis/math/matrix.clj
+++ src/brevis/math/matrix.clj
@@ -185,6 +185,11 @@
   [f mat]
   (seq-to-matrix (matrix-height mat) (matrix-width mat) (map f (matrix-to-seq mat))))

+(defn matrix-pmap
+  "Map a function over a matrix."
+  [f mat]
+  (seq-to-matrix (matrix-height mat) (matrix-width mat) (pmap f (matrix-to-seq mat))))
+
 (defn select-columns
   "Select the columns by index. Takes a sequence of column indices starting with 0 to numColumns - 1"
   [^BasicMatrix mat indices]
@@ -204,3 +209,17 @@
   "Appends input matrix to the right of target. This is destructive"
   [^BasicMatrix target ^BasicMatrix input]
   (.mergeRows target input))
+
+(defn column-marginal
+  "sums all rows"
+  [matrix]
+  (let [height (matrix-height matrix)
+        width (matrix-width matrix)]
+    (seq-to-matrix 1 width (map #(apply + %) (partition height (matrix-to-seq matrix))))))
+
+(defn row-marginal
+  "sums all columns"
+  [matrix]
+  (let [height (matrix-height matrix)
+        width (matrix-width matrix)]
+    (seq-to-matrix height 1 (map #(apply + %) (partition width (matrix-to-seq (transpose matrix)))))))


added a class back to unblock the backend

--- src-cljs/frontend/components/org_settings.cljs
+++ src-cljs/frontend/components/org_settings.cljs
@@ -1042,7 +1042,7 @@
           piggiebacked? (pm/piggieback? plan org-name)]
       [:div
        [:fieldset [:legend (str org-name "'s plan")]]
-       [:div
+       [:div.explanation
         (when piggiebacked?
           [:p "This organization's projects will build under "
            [:a {:href (routes/v1-org-settings {:org (:org_name plan)})}


avoid reflection warning with int coercion

--- src/calfpath/internal.cljc
+++ src/calfpath/internal.cljc
@@ -408,7 +408,8 @@
 (defn match-uri*
   ^"[Ljava.lang.Object;"
   [uri begin-index pattern-tokens attempt-partial-match? params-map]
-  (let [token-count (count pattern-tokens)
+  (let [begin-index (int begin-index)
+        token-count (count pattern-tokens)
         static-path (first pattern-tokens)]
     (if (= begin-index FULL-MATCH-INDEX)  ; if already a full-match then no need to match any further
       (when (and (= 1 token-count) (= "" static-path))


Extract declarations into a separate function

--- src/catalog/layout/fop.clj
+++ src/catalog/layout/fop.clj
@@ -311,6 +311,22 @@
       [:fo:leader]
       (if recto? (page-number) (retrieve-marker))]]))

+(defn- declarations
+  [title creator description]
+  [:fo:declarations
+    [:x:xmpmeta {:xmlns:x "adobe:ns:meta/"}
+     [:rdf:RDF {:xmlns:rdf"http://www.w3.org/1999/02/22-rdf-syntax-ns#"}
+      [:rdf:Description {:rdf:about ""
+                         :xmlns:dc "http://purl.org/dc/elements/1.1/"}
+       ;; Dublin Core properties
+       [:dc:title title]
+       [:dc:creator creator]
+       [:dc:description description]]
+      [:rdf:Description {:rdf:about ""
+                         :xmlns:xmp "http://ns.adobe.com/xap/1.0/"}
+       ;; XMP properties
+       [:xmp:CreatorTool "Apache FOP"]]]]])
+
 (defn document-sexp
   [items {:keys [title creator description date]
     :or {title "Neu im Sortiment"
@@ -328,19 +344,7 @@
      [:fo:repeatable-page-master-alternatives
       [:fo:conditional-page-master-reference {:master-reference "verso" :odd-or-even "even"}]
       [:fo:conditional-page-master-reference {:master-reference "recto" :odd-or-even "odd"}]]]]
-   [:fo:declarations
-    [:x:xmpmeta {:xmlns:x "adobe:ns:meta/"}
-     [:rdf:RDF {:xmlns:rdf"http://www.w3.org/1999/02/22-rdf-syntax-ns#"}
-      [:rdf:Description {:rdf:about ""
-                         :xmlns:dc "http://purl.org/dc/elements/1.1/"}
-       ;; Dublin Core properties
-       [:dc:title title]
-       [:dc:creator creator]
-       [:dc:description description]]
-      [:rdf:Description {:rdf:about ""
-                         :xmlns:xmp "http://ns.adobe.com/xap/1.0/"}
-       ;; XMP properties
-       [:xmp:CreatorTool "Apache FOP"]]]]]
+   (declarations title creator description)
    [:fo:page-sequence {:master-reference "main"
                        :language "de"}
     [:fo:flow {:flow-name "xsl-region-body"}


Add full catalogs (upload and download) to the menu

--- src/catalog/web/layout.clj
+++ src/catalog/web/layout.clj
@@ -35,10 +35,10 @@
         (menu-item "/logout" (glyphicon "log-out")))
        (menu-item "/login" (glyphicon "log-in")))]))

-(defn- dropdown-menu [items]
+(defn- dropdown-menu [title items]
   [:li.dropdown
    [:a.dropdown-toggle
-    {:href "#" :role "button" :data-toggle "dropdown" :aria-expanded false} "Editorials" [:span.caret]]
+    {:href "#" :role "button" :data-toggle "dropdown" :aria-expanded false} title [:span.caret]]
    [:ul.dropdown-menu {:role "menu"}
     (for [[link label] items]
       (menu-item link label))]])
@@ -60,10 +60,13 @@
     [:div.collapse.navbar-collapse
      {:id "navbar-collapse-target"}
      [:ul.nav.navbar-nav
-      (menu-item (format "/%s/%s/upload" year issue) "Upload")
-      (dropdown-menu [[(format "/%s/%s/editorial/grossdruck" year issue) "Grossdruck"]
-                      [(format "/%s/%s/editorial/braille" year issue) "Braille"]
-                      [(format "/%s/%s/editorial/hörbuch" year issue) "Hörbuch"]])]]]])
+      (dropdown-menu "Upload" [[(format "/%s/%s/upload" year issue) "Neu im Sortiment"]
+                               [(format "/%s/%s/upload-full" year issue) "Gesamtkatalog"]])
+      (dropdown-menu "Editorials" [[(format "/%s/%s/editorial/grossdruck" year issue) "Grossdruck"]
+                                   [(format "/%s/%s/editorial/braille" year issue) "Braille"]
+                                   [(format "/%s/%s/editorial/hörbuch" year issue) "Hörbuch"]])
+      (menu-item (format "/%s/%s/full-catalogs" year issue) "Full Catalogs")
+      (menu-item (format "/custom") "Custom Catalogs")]]]])

 (defn common
   "Display a page using the bootstrap css"


fix typo in collection

fix typo in collection

--- src/ceres_collector/db.clj
+++ src/ceres_collector/db.clj
@@ -119,7 +119,7 @@
   [source target]
   (mc/insert-and-return
    @db
-   "retweet"
+   "retweets"
    {:source source
     :target target
     :ts (t/now)}))


semantically, angles come before houses as well alphabetically, as houses depend on the ascendant

--- src/clj/ephemeris/core.clj
+++ src/clj/ephemeris/core.clj
@@ -70,9 +70,9 @@
                               cusps
                               ascmc)]
           (merge
+            (if (angles? (:angles want))
+              {:angles (subvec (vec ascmc) 0 8)}
+              {})
             (if (houses? (:houses want))
               {:houses (zipmap (range 1 13) (rest cusps))}
-              {})
-            (if (angles? (:angles want))
-              {:angles (subvec (vec ascmc) 0 8)}
               {})))))))


organize imports a bit

organize imports a bit

--- src/clj/runbld/process.clj
+++ src/clj/runbld/process.clj
@@ -8,15 +8,13 @@
    [runbld.io :as io]
    [runbld.schema :refer :all]
    [runbld.store :as store]
-   [runbld.util.data :as data]
    [runbld.util.date :as date]
    [runbld.util.debug :as debug]
    [schema.core :as s])
   (:import
    (clojure.core.async.impl.channels ManyToManyChannel)
-   (clojure.lang Atom Ref)
+   (clojure.lang Ref)
    (java.io File InputStream)
-   (java.util UUID)
    (java.util.concurrent TimeUnit)))

 (s/defn inc-ordinals


Break out of put loops on closed channel

--- src/clj/skytwit/server.clj
+++ src/clj/skytwit/server.clj
@@ -101,8 +101,8 @@
                (let [next-batch (get-tweets-before-tweet-id
                                   creds screen-name last-id)]
                  (when (seq next-batch)
-                   (>! chan next-batch)
-                   (recur (:id (last next-batch)))))))
+                   (if (>! chan next-batch)
+                     (recur (:id (last next-batch))))))))
     (fn [] (reset! end? true))))

 (defn put-new-tweets-on-channel
@@ -120,8 +120,8 @@
                                            twh/exception-rethrow))
         f (go-loop [s (json/parsed-seq r true)]
                    (when-not @end?
-                     (>! chan [(format-tweet (first s) id)])
-                     (recur (rest s))))]
+                     (if (>! chan [(format-tweet (first s) id)])
+                       (recur (rest s)))))]
     ;; TODO: There may be a small memory leak here: if statuses-filter
     ;;       is stopped in the middle of a JSON string, the lazy seq may
     ;;       be blocked and the go-block may not get GC'd.


lowered periodical log to debug

lowered periodical log to debug

--- src/clj/swarmpit/agent.clj
+++ src/clj/swarmpit/agent.clj
@@ -8,7 +8,7 @@
   (let [services (->> (api/services)
                       (filter #(get-in % [:deployment :autoredeploy]))
                       (filter #(not (= "updating" get-in % [:status :update]))))]
-    (log/info "Autoredeploy agent checking for updates. Service checked:" (count services))
+    (log/debug "Autoredeploy agent checking for updates. Services to be checked:" (count services))
     (doseq [service services]
       (let [id (:id service)
             repository (:repository service)


Docstring format.

Docstring format.

--- src/clj_ravendb/client.clj
+++ src/clj_ravendb/client.clj
@@ -13,6 +13,7 @@
   given url and database.

   Optionally takes a map of options.
+
   *`:replicated?` is used to find replicated endpoints
   *`:master-only-writes?` is used to indicate that write operations only go to the master
   *`:caching?` is used to indicate if documents should be cached locally
@@ -38,6 +39,7 @@
   `(load-document client [\"docId1\" \"docId2\"] options)`

   Optionally takes a map of options.
+
   `:request-builder` is a custom request builder fn.
   `:response-parser` is a customer response parser fn."
   [{:keys [load-documents] :as client} & args]
@@ -52,6 +54,7 @@
   `(put-document! client \"MyDocId\" {})`

   Optionally takes a map of options.
+
   `:request-builder` is a custom request builder fn.
   `:response-parser` is a customer response parser fn."
   [{:keys [put-document!] :as client} & args]
@@ -68,6 +71,7 @@
   `(query-index client qry options)`

   Optionally takes a map of options.
+
   `:max-attempts` is the maximum number of times to try
   and hit a non stale index.
   `:wait` is the time interval to wait before trying to
@@ -90,6 +94,7 @@
   `(put-index! client idx options)`

   Optionally takes a map of options.
+
   `:request-builder` is a custom request builder fn.
   `:response-parser` is a customer response parser fn."
   [{:keys [put-index!] :as client} & args]
@@ -103,6 +108,7 @@
   `(delete-index! client \"MyIndexName\")`

   Optionally takes a map of options.
+
   `:request-builder` is a custom request builder fn.
   `:response-parser` is a customer response parser fn."
   [{:keys [delete-index!] :as client} & args]
@@ -117,6 +123,7 @@
   `(bulk-operations! client [{:method \"DELETE\" :id \"Key1\"} {:method \"PUT\" :document {} :id \"Key2\" :metadata {}}] options)`

   Optionally takes a map of options.
+
   `:request-builder` is a custom request builder fn.
   `:response-parser` is a customer response parser fn."
   [{:keys [bulk-operations!] :as client} & args]
@@ -132,6 +139,7 @@
   `(watch-documents client [\"doc1\" \"doc2\"])`

   Options is a map and can contain,
+
   `:wait` - milliseconds to wait between watch calls."
   [{:keys [watch-documents] :as client} & args]
   (apply watch-documents client args))
@@ -149,6 +157,7 @@
      (watch-index client qry))`

   Options is a map and can contain,
+
   `:wait` - milliseconds to wait between watch calls."
   [{:keys [watch-index] :as client} & args]
   (apply watch-index client args))
@@ -159,6 +168,7 @@
   the database level.

   Optionally takes a map of options.
+
   `:request-builder` is a custom request builder fn.
   `:response-parser` is a customer response parser fn."
   [{:keys [stats] :as client} & args]
@@ -170,6 +180,7 @@
   the current authenticated (or not) user.

   Optionally takes a map of options.
+
   `:request-builder` is a custom request builder fn.
   `:response-parser` is a customer response parser fn."
   [{:keys [user-info] :as client} & args]


don't want to expose additive-, subtractive-deltas

--- src/cljc/commos/delta.cljc
+++ src/cljc/commos/delta.cljc
@@ -36,7 +36,7 @@
        pack))

 ;; Creating deltas
-(defn subtractive-deltas
+(defn- subtractive-deltas
   "Convert a map to subtractive raw deltas."
   [m]
   (let [step (fn step [root-ks [ks v]]
@@ -51,7 +51,7 @@
                        [[:ex (pop full-ks) [(peek full-ks)]]])))]
     (mapcat (partial step []) (flatten-keys m))))

-(defn additive-deltas
+(defn- additive-deltas
   "Convert a map to additive raw deltas."
   [m]
   (let [step (fn step [root-ks [ks v]]


:is has one val

:is has one val

--- src/cljc/commos/delta.cljc
+++ src/cljc/commos/delta.cljc
@@ -119,7 +119,7 @@
         [[:in [] (set/difference y x)]]

         :else
-        [[:is [] [y]]]))
+        [[:is [] y]]))

 (defn implied-deltas
   "Return deltas implied with (raw) delta so that no :is replacements


work in progress

work in progress

--- src/cljs/recipes/core.cljs
+++ src/cljs/recipes/core.cljs
@@ -14,16 +14,6 @@
 (def state (atom {:saved? false}))

 ;; -------------------------
-;; SET / GET
-
-(defn set-value! [id value]
-  (swap! state assoc :saved? false)
-  (swap! state assoc-in [:doc id] value))
-
-(defn get-value [id]
-  (get-in @state [:doc id]))
-
-;; -------------------------
 ;; Declarations

 (def new-recipe (atom {:name "" :avatar_url "" :instructions ""}))
@@ -33,6 +23,8 @@
 (def counter (atom 0))

 (def recipes (atom []))
+
+(def recipe (atom (hash-map)))

 ;; -------------------------
 ;; Forms Helpers
@@ -89,6 +81,12 @@
 (defn get-recipes []
   (GET (str js/context "/recipes")
     :handler (fn [response] (reset! recipes response))
+    :response-format :json
+    :keywords? true))
+
+(defn get-recipe [recipe-id]
+  (GET (str js/context "/recipes/" recipe-id)
+    :handler (fn [response] (js/console.log response))
     :response-format :json
     :keywords? true))

@@ -117,8 +115,7 @@
       [:td [:img {:src recipe-avatar-url :class "img-thumbnail" :style {:max-width "150px"}}]]
       [:td recipe-name]
       [:td
-        [:button "Show"]
-        [:button "Edit"]
+        [:button {:onClick #(secretary/dispatch! (str "#/recipes/" recipe-id))} "View"]
         [:button {:onClick #(destroy-recipe recipe-id)} "Destroy"]]]))

 (defn home-page []
@@ -131,7 +128,7 @@
         (do
           [recipe-item recipe]))]
     [:br]
-    [:div.row [:button { :class "btn-primary btn-lg" :onClick #(secretary/dispatch! "#/new_recipe")} "New Recipe"]]])
+    [:div.row [:button { :class "btn-primary btn-lg" :onClick #(secretary/dispatch! "#/recipes/new")} "New Recipe"]]])

 ;; -------------------------
 ;; About
@@ -204,6 +201,17 @@
       [:header
         [:h1 "New Recipe"]]
       [new-recipe-body]]])
+
+
+;; -------------------------
+;; Recipe View
+
+(defn recipe-view-page []
+  (get-recipe (get @recipe :id))
+  [:div
+    [:section
+      [:header
+        [:h1 "Recipe"]]]])

 ;; -------------------------
 ;; Nav Bar
@@ -241,9 +249,14 @@
   (session/put! :current-page #'about-page)
   (swap! state assoc :page about-page))

-(secretary/defroute "/new_recipe" []
+(secretary/defroute "/recipe/new" []
   (session/put! :current-page #'new-recipe-page)
   (swap! state assoc :page new-recipe-page))
+
+(secretary/defroute "/recipes/:id" [id query-params]
+  (session/put! :current-page #'recipe-view-page)
+  (swap! state assoc :page recipe-view-page)
+  (swap! recipe assoc :id id))

 ;; -------------------------
 ;; History


cljs/skyport.core: Add id to hexagon group

--- src/cljs/skyport/core.cljs
+++ src/cljs/skyport/core.cljs
@@ -341,17 +341,19 @@
              [:stop {:style {:stop-color "red"
                              :stop-opacity 1} :offset "50%"}]
              [:stop {:style {:stop-opacity 0} :offset "100%"}]]]
-           [:g (for [j (range (count data))
-                     k (range (count (data j)))
-                     :let [[x y] (coords-to-pixel [j k])]]
-                 (om/build hexagon-view
-                           {:x x
-                            :y y
-                            :label (get-in data [j k])
-                            :position [j k]
-                            :size TILE-SIZE}
-                           {:key :position}))]
-           [:g (om/build-all player-view (:players state) {:key :name})]
+           [:g {:id "hexagons"}
+            (for [j (range (count data))
+                  k (range (count (data j)))
+                  :let [[x y] (coords-to-pixel [j k])]]
+              (om/build hexagon-view
+                        {:x x
+                         :y y
+                         :label (get-in data [j k])
+                         :position [j k]
+                         :size TILE-SIZE}
+                        {:key :position}))]
+           [:g {:id "players"}
+            (om/build-all player-view (:players state) {:key :name})]
            (om/build action-view (:action state))]])))))

 (defn weapon-interface-view [{:keys [name level]} owner]


Add three tracks for displaying terrain stats

--- src/cljs/zetawar/subs.cljs
+++ src/cljs/zetawar/subs.cljs
@@ -453,6 +453,20 @@
   (when-let [[q r] @(selected-hex conn)]
     @(unit-at conn q r)))

+(deftrack terrain-stats [conn unit-q unit-r terrain-q terrain-r]
+  (let [unit @(unit-at conn unit-q unit-r)
+        terrain @(terrain-at conn terrain-q terrain-r)]
+    (game/unit-terrain-stats @conn unit terrain)))
+
+(deftrack selected-stats [conn]
+  (when-let [[q r] @(selected-hex conn)]
+    @(terrain-stats conn q r q r)))
+
+(deftrack targeted-stats [conn]
+  (when-let [[terrain-q terrain-r] @(targeted-hex conn)]
+    (let [[unit-q unit-r] @(selected-hex conn)]
+      @(terrain-stats conn unit-q unit-r terrain-q terrain-r))))
+
 (deftrack unit-selected? [conn]
   (when-let [[q r] @(selected-hex conn)]
     @(unit-at? conn q r)))


Removing unused sub

Removing unused sub

--- src/cljs/zetawar/subs.cljs
+++ src/cljs/zetawar/subs.cljs
@@ -424,15 +424,6 @@
                       :app/targeted-r])
       not-empty))

-;; TODO: this should be removed; you can't treat selected + targeted as a unit
-(deftrack selected-and-targeted-hex [conn]
-  (-> @(app conn)
-      (select-values [:app/selected-q
-                      :app/selected-r
-                      :app/targeted-q
-                      :app/targeted-r])
-      not-empty))
-
 (deftrack selected-unit [conn]
   (when-let [[q r] @(selected-hex conn)]
     @(unit-at conn q r)))


Change metrics function

Change metrics function

--- src/clojure/fault/core.clj
+++ src/clojure/fault/core.clj
@@ -20,20 +20,7 @@
     (s/service-executor name pool-size max-concurrency breaker metrics)))

 (defn metrics [{:keys [metrics]}]
-  (let [{:keys [failures
-                errors
-                successes
-                timeouts
-                circuit-open
-                queue-full
-                max-concurrency-level-exceeded]} metrics]
-    {:failures failures
-     :errors errors
-     :successes successes
-     :timeouts timeouts
-     :circuit-open circuit-open
-     :queue-full queue-full
-     :max-concurrency-level-exceeded max-concurrency-level-exceeded}))
+  (-> metrics :snapshot))

 (defn submit-action [service f time-out-ms]
   (s/submit-action service f time-out-ms))


Slightly cleaner types in sql

Slightly cleaner types in sql

--- src/clojure/flambo/sql.clj
+++ src/clojure/flambo/sql.clj
@@ -16,7 +16,7 @@
            [org.apache.spark.sql.hive HiveContext]
            [org.apache.spark.sql.expressions Window]
            [org.apache.spark.sql.types DataTypes]
-           [org.apache.spark.sql Encoders]))
+           [org.apache.spark.sql Encoder Encoders]))

 ;; ## SQLContext

@@ -215,10 +215,12 @@
 (defn create-or-replace-temp-view [v-name]
   (.createOrReplaceTempView v-name))

-(defn encoder-for-type
-  "Create a Spark SQL Encoder for **type**.  The available options for
-  **type** are:
-
+(defn ^Encoder encoder-for-type
+  "Create a Spark SQL Encoder for **type-**.  The available options for
+  **type-** are:
+
+  * a class to be encoded
+  * an Encoder instance
   * :object
   * :string
   * :boolean
@@ -230,10 +232,11 @@
   * :integer
   * :long
   * :string-tuple"
-  [type]
-  (cond (instance? java.lang.Class type) (Encoders/javaSerialization type)
-        (keyword? type)
-        (case type
+  [type-]
+  (cond (instance? java.lang.Class type-) (Encoders/javaSerialization type-)
+        (instance? Encoder type-) type-
+        (keyword? type-)
+        (case type-
           :object (Encoders/javaSerialization java.io.Serializable)
           :string (Encoders/STRING)
           :boolean (Encoders/BOOLEAN)
@@ -245,29 +248,31 @@
           :integer (Encoders/INT)
           :long (Encoders/LONG)
           :string-tuple (Encoders/tuple (Encoders/STRING) (Encoders/STRING)))
-        true type))
-
-(defn map
-  "Returns a new dataframe formed by passing each element of the source through the function `f`."
-  ([df f] (map df :object f))
-  ([df type f]
-   (->> (encoder-for-type type)
-        (.map df (map-function f)))))
-
-(defn filter
-  "Returns a new dataframe containing only the elements of `df` that satisfy a predicate `f`."
-  [df f]
+        :else (throw (ex-info "Invalid encoder option"))))
+
+(defn ^Dataset map
+  "Returns a new dataframe formed by passing each element of the source through
+  the function `f`."
+  ([^Dataset df f] (map df :object f))
+  ([^Dataset df type- f]
+   (.map df (map-function f) (encoder-for-type type-))))
+
+(defn ^Dataset filter
+  "Returns a new dataframe containing only the elements of `df` that satisfy a
+  predicate `f`."
+  [^Dataset df f]
   (.filter df (filter-function f)))

-(defn reduce
-  "Returns a new dataframe containing only the elements of `df` that satisfy a predicate `f`."
-  [df f]
+(defn ^Dataset reduce
+  "Returns a new dataframe containing only the elements of `df` that satisfy a
+  predicate `f`."
+  [^Dataset df f]
   (.reduce df (reduce-function f)))

-(defn flat-map
-  "Similar to `map`, but each input item can be mapped to 0 or more output items (so the
-  function `f` should return a collection rather than a single item)"
-  ([df f] (flat-map df :object f))
-  ([df type f]
-   (->> (encoder-for-type type)
-        (.flatMap df (flat-map-function f)))))
+(defn ^Dataset flat-map
+  "Similar to `map`, but each input item can be mapped to 0 or more output
+  items (so the function `f` should return a collection rather than a single
+  item)"
+  ([^Dataset df f] (flat-map df :object f))
+  ([^Dataset df type- f]
+   (.flatMap df (flat-map-function f) (encoder-for-type type-))))


placeholder: big integers in Clojure

placeholder: big integers in Clojure

--- clojure/lazy_seq.clj
+++ clojure/lazy_seq.clj
@@ -4,9 +4,9 @@
 (defn fib
   "Lazily generates Fibonacci numbers"
   ([]
-   (fib 0 1))
+   (fib 0N 1N))
   ([a b]
    (lazy-seq
     (cons a (fib b (+ a b))))))

-(println (take 20 (fib)))
+(println (take 100 (fib)))


minor refactor

minor refactor


Clear chat inputs after sending contact request (#13665)

--- src/status_im/chat/models/input.cljs
+++ src/status_im/chat/models/input.cljs
@@ -281,13 +281,12 @@
   {:events [:contacts/send-contact-request]}
   [{:keys [db] :as cofx} public-key message]
   (fx/merge cofx
-            {::json-rpc/call [{:method "wakuext_sendContactRequest"
-                               :js-response true
-                               :params [{:id public-key :message message}]
-                               :on-error #(log/warn "failed to send a contact request" %)
-
-                               :on-success #(re-frame/dispatch [:transport/message-sent %])}]}
-
+            {:chat.ui/clear-inputs nil
+             ::json-rpc/call       [{:method "wakuext_sendContactRequest"
+                                     :js-response true
+                                     :params [{:id public-key :message message}]
+                                     :on-error #(log/warn "failed to send a contact request" %)
+                                     :on-success #(re-frame/dispatch [:transport/message-sent %])}]}
             (mentions/clear-mentions)
             (mentions/clear-cursor)
             (clean-input (:current-chat-id db))


Add take.

Add take.


Refactor: use connection-manager instead of cm

--- backend/src/akvo/lumen/component/keycloak.clj
+++ backend/src/akvo/lumen/component/keycloak.clj
@@ -30,7 +30,7 @@
 (defn request-headers
   "Create a set of request headers to use for interaction with the Keycloak
    REST API. This allows us to reuse the same token for multiple requests."
-  ([{:keys [openid-config credentials cm]}]
+  ([{:keys [openid-config credentials connection-manager]}]
    (let [params (merge {:grant_type "client_credentials"}
                        credentials)
          resp (client/post (get openid-config "token_endpoint")
@@ -38,7 +38,7 @@
          access-token (-> resp :body json/decode (get "access_token"))]
      {"Authorization" (str "bearer " access-token)
       "Content-Type" "application/json"}))
-  ([{:keys [openid-config credentials cm]}
+  ([{:keys [openid-config credentials connection-manager]}
     {:keys [timeout] :as req-opts}]
    (let [params (merge {:grant_type "client_credentials"}
                        credentials)
@@ -46,7 +46,7 @@
          req-opts (-> req-opts
                       (select-keys [:timeout])
                       (assoc :form-params params))]
-     (if-some [access-token (-> (client/post url (assoc req-opts :connection-manager cm))
+     (if-some [access-token (-> (client/post url (assoc req-opts :connection-manager connection-manager))
                                 :body
                                 json/decode
                                 (get "access_token"))]
@@ -258,11 +258,11 @@

 (defn- lookup-user-id
   "Lookup email -> Keycloak user-id, via cached Keycloak API."
-  [cm req-opts api-root user-id-cache email]
+  [connection-manager req-opts api-root user-id-cache email]
   (if-some [user-id (get-user-id user-id-cache email)]
     user-id
     (let [url (format "%s/users/?email=%s" api-root email)]
-      (let [users (-> (client/get url (assoc req-opts :connection-manager cm)) :body json/decode)]
+      (let [users (-> (client/get url (assoc req-opts :connection-manager connection-manager)) :body json/decode)]
         (when-some [user-id (active-user users email)]
           (-> user-id-cache
               (swap! assoc email user-id)
@@ -276,15 +276,15 @@
   remove the leading /akvo/lumen and return paths as demo/admin."
   ([keycloak email]
    (allowed-paths keycloak email {}))
-  ([{:keys [api-root http-timeout user-id-cache cm] :as keycloak} email
+  ([{:keys [api-root http-timeout user-id-cache connection-manager] :as keycloak} email
     {:keys [timeout] :or {timeout http-timeout}}]
    (let [bare-req-opts {:timeout timeout}]
      (if-some [headers (request-headers keycloak (assoc bare-req-opts :timeout timeout))]
        (let [req-opts (assoc bare-req-opts :headers headers)]
-         (when-let [user-id (lookup-user-id cm req-opts api-root user-id-cache email)]
+         (when-let [user-id (lookup-user-id connection-manager req-opts api-root user-id-cache email)]
            (when-let [allowed-paths
                     (-> (client/get (format "%s/users/%s/groups" api-root user-id)
-                                    (assoc req-opts :connection-manager cm)) :body json/decode)]
+                                    (assoc req-opts :connection-manager connection-manager)) :body json/decode)]
              (reduce (fn [paths {:strs [path]}]
                        (conj paths (subs path 12)))
                      #{}
@@ -384,17 +384,17 @@
   (log/info "Starting keycloak")
   (let [{:keys [issuer openid-config api-root] :as this} (init-keycloak (assoc data :credentials credentials :max-user-ids-cache max-user-ids-cache))
         http-timeout 10000
-        cm (http.conn-mgr/make-reusable-conn-manager {:timeout 2 :threads 3 :insecure? false :default-per-route 10})
-        openid-config (fetch-openid-configuration issuer {:timeout http-timeout :connection-manager cm})]
+        connection-manager (http.conn-mgr/make-reusable-conn-manager {:timeout 2 :threads 3 :insecure? false :default-per-route 10})
+        openid-config (fetch-openid-configuration issuer {:timeout http-timeout :connection-manager connection-manager})]
     (log/info "Successfully got openid-config from provider.")
     (assoc this
-           :cm cm
+           :connection-manager connection-manager
            :http-timeout http-timeout
            :openid-config openid-config)))

 (defmethod ig/halt-key! :akvo.lumen.component.keycloak/keycloak  [_ opts]
-  (log/info :keycloak "closing connection manager" (:cm opts))
-  (http.conn-mgr/shutdown-manager (:cm opts)))
+  (log/info :keycloak "closing connection manager" (:connection-manager opts))
+  (http.conn-mgr/shutdown-manager (:connection-manager opts)))

 (s/def ::client_id string?)


Consistently use (co)effect helpers

Consistently use (co)effect helpers

(Note: this builds on https://github.com/Day8/re-frame/pull/547)

In `re-frame.interceptor` there are a few functions that help you modify the
context during the processing of an event. In `re-frame.std-interceptors` these
helpers were used in some but not in all places that they can be used.

This PR changes the code so that `std-interceptors` uses these helpers where
possible.

I'm not sure these helpers are really helpful, for two reasons:

1. They are very thin wrappers around accessing the `:effects` resp.
`:coeffects` key in a context. As you can see in the diff of this pr, the
difference to using the standard clojure functions to modify a context is not
very pronounced.
2. They don't cover the following use-cases, that are taken from
`re-frame.std-interceptors`:

- dissocing a key from the coeffect. This is used in `trim-v` to restore the
  context to its original form in its `after` function. Note that the `path`
  interceptor is content with leaving its `:re-frame-path/db-store` key in the
  context.
- associng a whole effects map to the context. This is used in
  `fx-handler->interceptor` to replace the `:effects` in the context with the
  result of the call to the handler function. `db-handler->interceptor` could
  make use of the helper `assoc-effect` because it assoces just the `:db` key of
  the effect in the context.

In light of this I'd argue that the helpers don't pull their weight and
shouldn't be used.

If you agree, I can prepare a PR to that end.

Since the helpers are part of the public API, they would probably have to
remain, but their usage in `std-interceptors` can be removed.

--- src/re_frame/std_interceptors.cljc
+++ src/re_frame/std_interceptors.cljc
@@ -1,7 +1,7 @@
 (ns re-frame.std-interceptors
   "contains re-frame supplied, standard interceptors"
   (:require
-    [re-frame.interceptor :refer [->interceptor get-effect get-coeffect assoc-coeffect assoc-effect]]
+    [re-frame.interceptor :refer [->interceptor get-effect get-coeffect assoc-coeffect assoc-effect update-coeffect]]
     [re-frame.loggers :refer [console]]
     [re-frame.registrar :as registrar]
     [re-frame.db :refer [app-db]]
@@ -42,13 +42,13 @@
     :before  (fn trimv-before
                [context]
                (-> context
-                   (update-in [:coeffects :event] subvec 1)
-                   (assoc-in [:coeffects ::untrimmed-event] (get-coeffect context :event))))
+                   (update-coeffect :event subvec 1)
+                   (assoc-coeffect ::untrimmed-event (get-coeffect context :event))))
     :after   (fn trimv-after
                [context]
                (-> context
                    (utils/dissoc-in [:coeffects ::untrimmed-event])
-                   (assoc-in [:coeffects :event] (get-coeffect context ::untrimmed-event))))))
+                   (assoc-coeffect :event (get-coeffect context ::untrimmed-event))))))

 ;; -- Interceptor Factories - PART 1 ---------------------------------------------------------------
@@ -76,15 +76,15 @@
               (let [new-context
                     (trace/with-trace
                       {:op-type   :event/handler
-                       :operation (get-in context [:coeffects :event])}
-                      (let [{:keys [db event]} (:coeffects context)]
+                       :operation (get-coeffect context :event)}
+                      (let [{:keys [db event]} (get-coeffect context)]
                         (->> (handler-fn db event)
                              (assoc-effect context :db))))]
                 ;; We merge these tags outside of the :event/handler trace because we want them to be assigned to the parent
                 ;; wrapping trace.
                 (trace/merge-trace!
-                  {:tags {:effects   (:effects new-context)
-                          :coeffects (:coeffects context)}})
+                  {:tags {:effects   (get-effect new-context)
+                          :coeffects (get-coeffect context)}})
                 new-context))))

@@ -109,13 +109,13 @@
             (let [new-context
                   (trace/with-trace
                     {:op-type   :event/handler
-                     :operation (get-in context [:coeffects :event])}
-                    (let [{:keys [event] :as coeffects} (:coeffects context)]
+                     :operation (get-coeffect context :event)}
+                    (let [{:keys [event] :as coeffects} (get-coeffect context)]
                       (->> (handler-fn coeffects event)
                            (assoc context :effects))))]
               (trace/merge-trace!
-                {:tags {:effects   (:effects new-context)
-                        :coeffects (:coeffects context)}})
+                {:tags {:effects   (get-effect new-context)
+                        :coeffects (get-coeffect context)}})
               new-context))))

@@ -134,11 +134,11 @@
               (let [new-context
                     (trace/with-trace
                       {:op-type   :event/handler
-                       :operation (get-in context [:coeffects :event])}
+                       :operation (get-coeffect context :event)}
                       (handler-fn context))]
                 (trace/merge-trace!
-                  {:tags {:effects   (:effects new-context)
-                          :coeffects (:coeffects context)}})
+                  {:tags {:effects   (get-effect new-context)
+                          :coeffects (get-coeffect context)}})
                 new-context))))

@@ -181,7 +181,7 @@
     :after (fn enrich-after
              [context]
              (let [event (get-coeffect context :event)
-                   db    (if (contains? (:effects context) :db)
+                   db    (if (contains? (get-effect context) :db)
                            (get-effect context :db) ;; If no db effect is returned, we provide the original coeffect.
                            (get-coeffect context :db))]
                (->> (f db event)
@@ -195,10 +195,10 @@
     :id :after
     :after (fn after-after
              [context]
-             (let [db    (if (contains? (:effects context) :db)
-                           (get-in context [:effects :db])
-                           (get-in context [:coeffects :db]))
-                   event (get-in context [:coeffects :event])]
+             (let [db    (if (contains? (get-effect context) :db)
+                           (get-effect context :db)
+                           (get-coeffect context :db))
+                   event (get-coeffect context :event)]
                (f db event) ;; call f for side effects
                context)))) ;; context is unchanged


fixed active button position

fixed active button position

--- src/status_im/contacts/screen.cljs
+++ src/status_im/contacts/screen.cljs
@@ -140,22 +140,23 @@
    edit?                [:get-in [:contacts-ui-props :edit?]]
    groups               [:all-added-groups]
    tabs-hidden?         [:tabs-hidden?]]
-  [view (st/contacts-list-container tabs-hidden?)
-   (if edit?
-     [toolbar-edit]
-     [toolbar-view])
-   (if (pos? (+ (count groups) contacts-count))
-     [scroll-view {:style    st/contact-groups}
-      (when (pos? contacts-count)
-        [contact-group-form {:contacts       contacts
-                             :contacts-count contacts-count
-                             :edit?          edit?}])
-      (for [group groups]
-        ^{:key group}
-        [contact-group-view {:group          group
-                             :edit?          edit?}])]
-     [view st/empty-contact-groups
-      [react/icon :group_big st/empty-contacts-icon]
-      [text {:style st/empty-contacts-text} (label :t/no-contacts)]])
+  [view {:flex 1}
+   [view (st/contacts-list-container tabs-hidden?)
+    (if edit?
+      [toolbar-edit]
+      [toolbar-view])
+    (if (pos? (+ (count groups) contacts-count))
+      [scroll-view {:style    st/contact-groups}
+       (when (pos? contacts-count)
+         [contact-group-form {:contacts       contacts
+                              :contacts-count contacts-count
+                              :edit?          edit?}])
+       (for [group groups]
+         ^{:key group}
+         [contact-group-view {:group          group
+                              :edit?          edit?}])]
+      [view st/empty-contact-groups
+       [react/icon :group_big st/empty-contacts-icon]
+       [text {:style st/empty-contacts-text} (label :t/no-contacts)]])]
    (when (and (not edit?) (get-in platform-specific [:contacts :action-button?]))
        [contacts-action-button])])


🥅 Assert that all events are congregation-specific

Why:
- If there is no :congregation/id, then {::congregations {nil {}}}
  could be inserted into the state
- At some point this assumption will likely be broken. For example if we
  introduce a user-specific event stream. The projection function should
  be made into a multi-method and update-congregation should be inlined
  to it, similar to other projections.

--- src/territory_bro/congregation.clj
+++ src/territory_bro/congregation.clj
@@ -65,6 +65,10 @@

 (defn projection [state event]
+  ;; XXX: this assert will fail once we start having non-congregation specific events
+  ;; TODO: change projection to be the multimethod instead of update-congregation
+  (assert (some? (:congregation/id event))
+          {:event event})
   (-> state
       (update-in [::congregations (:congregation/id event)] update-congregation event)
       (update-permissions event)))


stop user entering less than 0 qty or empty names onto their list

--- src/eatme/client/main.cljs
+++ src/eatme/client/main.cljs
@@ -106,13 +106,13 @@

 (defn add-item-to-list [item]
-  (d/append! items-list (render/shopping-list-item item))
-  (let [new-item (css/sel items-list (str "div[rel=" (:item-name item) "]"))]
-    (event/listen-once! (css/sel new-item "button[rel=delete-item]") :click #(item-deleted (event/target %)))
-    (event/listen! (css/sel new-item "button[rel=increment]") :click #(quantity-changed :inc true (event/target %)))
-    (event/listen! (css/sel new-item "button[rel=decrement]") :click #(quantity-changed :dec true (event/target %)))
-    (event/listen-once! (css/sel new-item "button[rel=complete]") :click #(completed-item (event/target %)))
-    ))
+  (when (and (< 0 (:qty item)) (not-empty (:item-name item)))
+    (d/append! items-list (render/shopping-list-item item))
+    (let [new-item (css/sel items-list (str "div[rel=" (:item-name item) "]"))]
+      (event/listen-once! (css/sel new-item "button[rel=delete-item]") :click #(item-deleted (event/target %)))
+      (event/listen! (css/sel new-item "button[rel=increment]") :click #(quantity-changed :inc true (event/target %)))
+      (event/listen! (css/sel new-item "button[rel=decrement]") :click #(quantity-changed :dec true (event/target %)))
+      (event/listen-once! (css/sel new-item "button[rel=complete]") :click #(completed-item (event/target %))))))

 (defn item-completed [{:keys [item]}]
   (d/add-class! item "btn-success")


Fixing CMR-4203. Changing the platform validation so that it validates not just the shortname but the short name, and characteristics name and value together.

--- umm-spec-lib/src/cmr/umm_spec/validation/platform.clj
+++ umm-spec-lib/src/cmr/umm_spec/validation/platform.clj
@@ -19,7 +19,40 @@
                  (vu/unique-by-name-validator :ShortName)]
    :Characteristics (vu/unique-by-name-validator :Name)})

+(def ^:private unique-fields
+  "Defines the fields to use that combined create unique platform names.
+  GCMD's keyword management system (KMS) defines aircraft, boats, ballons, etc.
+  with the model number. So the short name is not specific enough to identify
+  specific platform instances. Therefore we are adding Characteristic names and values
+  so that specific aircraft tail numbers, or boat IDS, etc. can be specified with the
+  short name."
+  #{:ShortName :Characteristics :Name :Value})
+
+(defn- get-platform-identifiers
+  "Concatenates ShortName with Characteristic Name and Value fields.
+   GCMD's keyword management system (KMS) defines aircraft, boats, ballons, etc.
+   with the model number. So the short name is not specific enough to identify
+   specific platform instances. Therefore we are adding Characteristic names and values
+   so that specific aircraft tail numbers, or boat IDS, etc. can be specified with the
+   short name."
+  [values unique-fields]
+  (let [{:keys [ShortName Characteristics Name Value]} unique-fields]
+    (map (fn [value]
+           (apply str
+                 (ShortName value)
+                 (map #(str (Name %) (Value %)) (Characteristics value))))
+         values)))
+
+(defn- unique-platform-validator
+  "Validates a list of items is unique by a specified field. Takes the name field and returns a
+  new validator."
+  [unique-fields]
+  (fn valid [field-path values]
+    (let [freqs (frequencies (get-platform-identifiers values unique-fields))]
+      (when-let [duplicate-names (seq (for [[v freq] freqs :when (> freq 1)] v))]
+        {field-path [(format "%%s must be unique. This contains duplicates named [%s]."
+                             (clojure.string/join ", " duplicate-names))]}))))
+
 (def platforms-validation
-  "Defines the list of validation functions for validating collection platforms"
   [(v/every platform-validations)
-   (vu/unique-by-name-validator :ShortName)])
+   (unique-platform-validator unique-fields)])


Disable internal Testbed image fetching

Disable internal Testbed image fetching

This change is just for testing. If the new solution works, more code
will be removed.

--- src/env_logger/handler.clj
+++ src/env_logger/handler.clj
@@ -154,43 +154,11 @@
                                       (db/weather-query-ok? db/postgres 3))
                              (get-latest-fmi-data (get-conf-value :fmi-api-key)
                                                   (get-conf-value :station-id)))
-              testbed-image (when (or (t/within? (t/interval (t/plus start-time
-                                                                     (t/minutes
-                                                                      4))
-                                                             (t/plus start-time
-                                                                     (t/minutes
-                                                                      6)))
-                                                 (t/now))
-                                      (t/within? (t/interval (t/plus start-time
-                                                                     (t/minutes
-                                                                      7))
-                                                             (t/plus start-time
-                                                                     (t/minutes
-                                                                      9)))
-                                                 (t/now)))
-                              (let [image (get-testbed-image)]
-                                (if (or (nil? image)
-                                        (< (count image) 5000))
-                                  (do
-                                    (log/error (format
-                                                (str "Testbed image at"
-                                                     " %s is empty"
-                                                     (if-not (nil? image)
-                                                       (str " (size "
-                                                            (count image)
-                                                            " bytes")
-                                                       ""))
-                                                (f/unparse
-                                                 (f/formatters
-                                                  :date-time-no-ms)
-                                                 (t/now))))
-                                    nil)
-                                  image)))
               insert-status (db/insert-observation
                              db/postgres
                              (assoc (assoc (parse-string obs-string true)
                                            :weather-data weather-data)
-                                    :testbed-image testbed-image))]
+                                    :testbed-image nil))]
           (doseq [channel @channels]
             (async/send! channel
                          (generate-string (db/get-observations db/postgres


Remove duplicated lense from canvas ns.

Remove duplicated lense from canvas ns.


decrementing counter includes url and total links

--- src/link_checker/check.clj
+++ src/link_checker/check.clj
@@ -66,12 +66,15 @@

 (def ^{:doc "Map of IDs to remaining links count"} link-counts (atom {}))

-(defn- fetch-link-and-send-row [send-to url client-id link]
+(defn- fetch-link-and-send-row [send-to url total-links client-id link]
   (let [result-map (fetch-link link)]
     (when (get @link-counts client-id)
       (swap! link-counts update-in [client-id] dec)
       (when (zero? (rem (get @link-counts client-id) 5))
-        (send-to "message" (format "Links remaining %s... "  (get @link-counts client-id)))))
+        (send-to "message" (format "%s has %s links. Links remaining %s... "
+                                   url
+                                   total-links
+                                   (get @link-counts client-id)))))
     (send-to "results" (render-haml "public/row.haml" result-map))
     result-map))

@@ -129,7 +132,8 @@
                    (format "%s has %s links. Fetching data... "
                            url (count links)))
           (let [start-time (System/currentTimeMillis)
-                link-results (doall (pmap (partial fetch-link-and-send-row send-to url (:client-id options))
+                link-results (doall (pmap (partial fetch-link-and-send-row send-to url
+                                                   (count links) (:client-id options))
                                          links))]
            (send-final-message send-to (calc-time start-time) link-results))
           (send-to "end-message" (str "result?url=" url


Remove lock icon spans on notifications card

--- src-cljs/frontend/components/account.cljs
+++ src-cljs/frontend/components/account.cljs
@@ -361,7 +361,6 @@
               :checked web-notifications-enabled?
               :on-change #(raise! owner [:set-web-notifications-permissions {:enabled? true}])
               :disabled disabled?}]
-            (when disabled? [:span " "])
             [:span.label-contents " Show me notifications when a build finishes"]]]
           [:div.radio
            [:label
@@ -371,7 +370,6 @@
               :checked (not web-notifications-enabled?)
               :on-change #(raise! owner [:set-web-notifications-permissions {:enabled? false}])
               :disabled disabled?}]
-            (when disabled? [:span " "])
             [:span.label-contents " Don't show me notifications when a build finishes"]]]]]]
        ;; -- If browser doesn't support the Web Notifications API:
        [:div.body


Fix one bug in absolute-storm-local-dir function

--- storm-core/src/clj/backtype/storm/config.clj
+++ storm-core/src/clj/backtype/storm/config.clj
@@ -134,7 +134,9 @@
 (defn absolute-storm-local-dir [conf]
   (let [storm-home (System/getProperty "storm.home")
         path (conf STORM-LOCAL-DIR)]
-    (if (is-absolute-path? path) path (str storm-home file-path-separator path))))
+    (if path
+      (if (is-absolute-path? path) path (str storm-home file-path-separator path))
+      (str storm-home file-path-separator "storm-local"))))

 (defn master-local-dir
   [conf]


Make the import more modular

Make the import more modular

so we reuse it for importing commercial audio books

--- src/mdr2/abacus/import.clj
+++ src/mdr2/abacus/import.clj
@@ -11,6 +11,7 @@
             [clojure.java.jdbc :as jdbc]
             [environ.core :refer [env]]
             [mdr2.production :as prod]
+            [mdr2.dtbook :as dtbook]
             [immutant.transactions.jdbc :refer [factory]]))

 (def ^:private db {:factory factory :name "java:jboss/datasources/productions"})
@@ -68,17 +69,9 @@
   (with-open [r (clojure.java.io/reader f)]
     (group-by extract-id (line-seq r))))

-(defn contains-wav-files
-  [coll]
-  (some #(re-matches #".*\.wav$" %) coll))
-
-(defn contains-struct-file
-  [coll]
-  (some #(re-matches #".*/struct.html$" %) coll))
-
-(defn contains-obi-project
-  [coll]
-  (some #(re-matches #".*/project.obi$" %) coll))
+(defn wav-file? [f] (re-matches #".*\.wav$" f))
+(defn struct-file? [f] (re-matches #".*/struct.html$" f))
+(defn obi-project? [f] (re-matches #".*/project.obi$" f))

 (def abacus-csv "/home/eglic/src/mdr2/samples/ABACUS_export_Books_27032015.csv")
 (def all-productions (-> abacus-csv io/file productions))
@@ -143,45 +136,44 @@
   [{id :id}]
   (get all-files-by-id id))

-(defn ready-productions
-  "All productions with state \"ready\""
-  [productions]
-  (filter #(= (:state %) "ready") productions))
+(defn ready? [production] (= (:state production) "ready"))
+(defn archived? [production] (= (:state production) "archived"))
+(defn recording? [production] (= (:state production) "recording"))
+(defn recording-no-wav? [production] (and (recording? production)
+                                          (not-any? wav-file? (get-all-files production))))
+(defn recording-no-wav-with-struct? [production] (and (recording-no-wav? production)
+                                                      (some struct-file? (get-all-files production))))
+(defn recording-with-wav? [production] (and (recording? production)
+                                            (some wav-file? (get-all-files production))))
+(defn recording-with-obi? [production] (and (recording? production)
+                                            (some wav-file? (get-all-files production))
+                                            (some obi-project? (get-all-files production))))
+(defn recording-with-wav-no-obi? [production] (and (recording? production)
+                                                   (some wav-file? (get-all-files production))
+                                                   (not-any? obi-project? (get-all-files production))))

 (defn create-ready-productions!
   "Create all productions with state \"ready\""
-  []
-  (doseq [p (ready-productions all-productions)]
-    (-> p prod/create!)))
-
-(defn archived-productions
-  "All productions with state \"archived\""
-  [productions]
-  (filter #(= (:state %) "archived") productions))
+  [productions]
+  (doseq [p (filter ready? productions)]
+    (if (:library_number p)
+      (-> p prod/create! prod/set-state-structured! dtbook/dtbook-file)
+      (-> p prod/create!))))

 (defn create-archived-productions!
   "Create all productions with state \"archived\""
-  []
-  (->> (archived-productions all-productions)
+  [productions]
+  (->> (filter archived? productions)
        (map #(assoc % :state "archived"))
        (map prod/add-default-meta-data)
        (apply jdbc/insert! db :production)))
-
-(def recording-productions-without-wav
-  "All productions with state \"recording\" that do not contain any wav file"
-  (filter #(and (= (:state %) "recording")
-                (not (contains-wav-files (get-all-files %)))) all-productions))
-
-(def recording-productions-with-struct
-  "All productions with state \"recording\" that do not contain any wav but a struct file"
-  (filter #(contains-struct-file (get-all-files %)) recording-productions-without-wav))

 (defn create-recording-productions-with-struct!
   "Create all productions with state \"recording\" that do not contain
   any wav but a struct file. Add to the db, create the directories and
   create the config file. Finally convert the \"struct.html\""
-  []
-  (doseq [p recording-productions-with-struct]
+  [productions]
+  (doseq [p (filter #(recording-no-wav-with-struct? %) productions)]
     (-> p
         prod/create!
         prod/set-state-structured!
@@ -189,24 +181,13 @@
           (copy-struct-file!)
           (convert-struct-file!)))))

-(def recording-productions-with-wav
-  "All productions with state \"recording\" that contain wav files"
-  (filter #(and (= (:state %) "recording")
-                (contains-wav-files (get-all-files %)))
-          all-productions))
-
-(def recording-productions-with-obi
-  "All productions with state \"recording\" with wav files that contain an obi project"
-  (filter #(contains-obi-project (get-all-files %))
-          recording-productions-with-wav))
-
 (defn create-recording-productions-with-obi!
   "Create all productions with state \"recording\" with wav files that
   contain an obi project. Add to the db and create the directories.
   Copy the obi project to the new place. Place an obi config file
   inside the obi project"
-  []
-  (doseq [p recording-productions-with-obi]
+  [productions]
+  (doseq [p (filter recording-with-obi? productions)]
     (-> p
         prod/create!
         prod/set-state-structured!
@@ -214,16 +195,11 @@
           (copy-obi-project!)
           (create-obi-config-file!)))))

-(def recording-productions-without-obi
-  "All productions with state \"recording\" with wav files but no obi project"
-  (filter #(not (contains-obi-project (get-all-files %)))
-          recording-productions-with-wav))
-
 (defn create-recording-productions-without-obi!
   "Create all productions with state \"recording\" with wav files that
   do not contain an obi project. Add to the db and create the directories"
-  []
-  (doseq [p recording-productions-without-obi]
+  [productions]
+  (doseq [p (filter recording-with-wav-no-obi? productions)]
     (-> p
         prod/create!
         prod/set-state-structured!
@@ -234,26 +210,34 @@
   "Print a summary of all the productions that are about to be migrated"
   []
   (println "Migrating productions from old to new Madras")
+  (println "============================================")
   (println)
   (println "Importing from ABACUS")
-  (println)
-  (println "Ready: " (count (ready-productions all-productions)))
-  (println (string/join ", " (map :id (ready-productions all-productions))))
-  (println)
-  (println "Archived: " (count (archived-productions all-productions)))
-  (println)
-  (println "Recording with no wav and a struct.html: " (count recording-productions-with-struct))
-  (println (string/join ", " (map :id recording-productions-with-struct)))
-  (println)
-  (let [weird (filter #(not (contains-struct-file (get-all-files %))) recording-productions-without-wav)]
-    (println "Recording with no wav and no struct.html: " (count weird))
+  (println "~~~~~~~~~~~~~~~~~~~~~")
+  (println)
+  (println "Ready:" (count (filter ready? all-productions)))
+  (println "-----")
+  (println (string/join ", " (map :id (filter ready? all-productions))))
+  (println)
+  (println "Archived:" (count (filter archived? all-productions)))
+  (println "--------")
+  (println)
+  (println "Recording with no wav and a struct.html:" (count (filter #(recording-no-wav-with-struct? %) all-productions)))
+  (println "---------------------------------------")
+  (println (string/join ", " (map :id (filter #(recording-no-wav-with-struct? %) all-productions))))
+  (println)
+  (let [weird (filter #(and (not-any? struct-file? (get-all-files %)) (recording-no-wav? %)) all-productions)]
+    (println "Recording with no wav and no struct.html:" (count weird))
+    (println "----------------------------------------")
     (println (string/join ", " (map :id weird))))
   (println)
-  (println "Recording with wav and an obi project: " (count recording-productions-with-obi))
-  (println (string/join ", " (map :id recording-productions-with-obi)))
-  (println)
-  (println "Recording with wav and no obi project: " (count recording-productions-without-obi))
-  (println (string/join ", " (map :id recording-productions-without-obi)))
+  (println "Recording with wav and an obi project:" (count (filter recording-with-obi? all-productions)))
+  (println "-------------------------------------")
+  (println (string/join ", " (map :id (filter recording-with-obi? all-productions))))
+  (println)
+  (println "Recording with wav and no obi project:" (count (filter recording-with-wav-no-obi? all-productions)))
+  (println "-------------------------------------")
+  (println (string/join ", " (map :id (filter recording-with-wav-no-obi? all-productions))))
   (println)
   (println "Ignoring the rest")
   (println (dissoc (frequencies (map :state all-productions)) "archived" "recording" "ready"))
@@ -261,10 +245,13 @@
     (println (str (string/capitalize state) ": ") (string/join ", " (map :id (filter #(= (:state %) state) all-productions)))))
   (println )
   (println "Importing commercial audio books")
-  (println)
-  (println "Ready: " (count (ready-productions all-commercial-productions)))
-  (println (string/join ", " (map :id (ready-productions all-commercial-productions))))
-  (println)
-  (println "Archived: " (count (archived-productions all-commercial-productions)))
+  (println "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~")
+  (println)
+  (println "Ready:" (count (filter ready? all-commercial-productions)))
+  (println "-----")
+  (println (string/join ", " (map :id (filter ready? all-commercial-productions))))
+  (println)
+  (println "Archived:" (count (filter archived? all-commercial-productions)))
+  (println "--------")
   (println)
 )


Fetch the host for this server, too.

Fetch the host for this server, too.

--- src/onyx/queue/hornetq.clj
+++ src/onyx/queue/hornetq.clj
@@ -126,6 +126,13 @@
   (let [[h p] (split s #":")]
     [(second (split h #"/")) p]))

+(defn initial-connectors [locator]
+  (map
+   (fn [config]
+     (let [params (.getParams config)]
+       [(get params "host") (get params "port")]))
+   (into [] (.getStaticTransportConfigurations locator))))
+
 (defmethod extensions/n-consumers HornetQConnection
   [queue queue-name]
   (if-not (:cluster-name queue)
@@ -144,6 +151,7 @@
       (let [reply (.request requestor message)
             result (ManagementHelper/getResult reply)
             host-port-pairs (map split-host-str (vals result))
+            host-port-pairs (into #{} (concat host-port-pairs (initial-connectors (:locator queue))))
             locators (map (partial apply connect-standalone) host-port-pairs)
             session-factories (map #(.createSessionFactory %) locators)
             sessions (map (fn [sf] (let [s (.createSession sf)] (.start s) s)) session-factories)
@@ -217,10 +225,8 @@

       (let [reply (.request requestor message)
             result (ManagementHelper/getResult reply)
-            host-port-pairs (map split-host-str
-                                 ["localhost/127.0.0.1:5445"
-                                  "localhost/127.0.0.1:5455"
-                                  "localhost/127.0.0.1:5475"])
+            host-port-pairs (map split-host-str (vals result))
+            host-port-pairs (into #{} (concat host-port-pairs (initial-connectors (:locator queue))))
             locators (map (partial apply connect-standalone) host-port-pairs)
             session-factories (map #(.createSessionFactory %) locators)
             sessions (map (fn [sf] (let [s (.createSession sf)] (.start s) s)) session-factories)


Adding a 7 channel eq using the center freqs from fruity loops

--- src/overtone/studio/eq.clj
+++ src/overtone/studio/eq.clj
@@ -31,4 +31,16 @@
         wet (b-hi-shelf wet freq6 gain6)]
     (replace-out bus wet)))

-
+(defsynth eq-7b
+  [bus 0
+   freq0 90 freq1 250 freq2 500 freq3 1500 freq4 3000 freq5 5000 freq6 8000
+   gain0 -45 gain1 -45 gain2 -45 gain3 -45 gain4 -45 gain5 -45 gain6 -45]
+  (let [dry (in bus)
+        wet (b-low-shelf dry freq0 1 gain0)
+        wet (mid-eq wet freq1 1 gain1)
+        wet (mid-eq wet freq2 1 gain2)
+        wet (mid-eq wet freq3 1 gain3)
+        wet (mid-eq wet freq4 1 gain4)
+        wet (mid-eq wet freq5 1 gain5)
+        wet (b-hi-shelf wet freq6 gain6)]
+    (replace-out bus wet)))


thru rm_case_pmda_general

thru rm_case_pmda_general

--- src/pg_demo/table_defs.clj
+++ src/pg_demo/table_defs.clj
@@ -1520,6 +1520,53 @@
               PRIMARY KEY (ENTERPRISE_ID,CASE_ID,DLP_REVISION_NUMBER)
           ); " }

+    { "rm_case_pat_tests"
+          "CREATE TABLE rm_case_pat_tests (
+              ENTERPRISE_ID numeric NOT NULL,
+              REL_TEST_ID numeric NOT NULL,
+              DELETED timestamp,
+              REL_TESTS text,
+              REL_TESTS_J text,
+              DLP_REVISION_NUMBER numeric NOT NULL,
+              REVISION_DELETE_FLAG numeric,
+              DELETED_FLAG numeric(1) NOT NULL,
+              EFFECTIVE_START_DATE timestamp NOT NULL,
+              EFFECTIVE_END_DATE timestamp NOT NULL,
+              PRIMARY KEY (ENTERPRISE_ID,REL_TEST_ID,DLP_REVISION_NUMBER)
+          ); " }
+
+    { "rm_case_pmda_event_assess"
+          "CREATE TABLE rm_case_pmda_event_assess (
+              ENTERPRISE_ID numeric NOT NULL,
+              CASE_ID numeric NOT NULL,
+              SEQ_NUM numeric NOT NULL,
+              EVENT_SEQ_NUM numeric NOT NULL,
+              PRODUCT_ID numeric NOT NULL,
+              PROD_SEQ_NUM numeric NOT NULL,
+              RPT_CAUSALITY_ID numeric,
+              DET_CAUSALITY_ID numeric,
+              DELETED timestamp,
+              DLP_REVISION_NUMBER numeric NOT NULL,
+              EFFECTIVE_START_DATE timestamp NOT NULL,
+              EFFECTIVE_END_DATE timestamp NOT NULL,
+              DELETED_FLAG numeric(1) NOT NULL,
+              REVISION_DELETE_FLAG numeric,
+              PRIMARY KEY (ENTERPRISE_ID,CASE_ID,SEQ_NUM,EVENT_SEQ_NUM,PROD_SEQ_NUM,DLP_REVISION_NUMBER)
+          ); " }
+
+    { "rm_case_pmda_general"
+          "CREATE TABLE rm_case_pmda_general (
+              ENTERPRISE_ID numeric NOT NULL,
+              CASE_ID numeric NOT NULL,
+              DELETED timestamp,
+              DLP_REVISION_NUMBER numeric NOT NULL,
+              EFFECTIVE_START_DATE timestamp NOT NULL,
+              EFFECTIVE_END_DATE timestamp NOT NULL,
+              DELETED_FLAG numeric(1) NOT NULL,
+              REVISION_DELETE_FLAG numeric,
+              PRIMARY KEY (ENTERPRISE_ID,CASE_ID,DLP_REVISION_NUMBER)
+          ); " }
+
   ] ))

 (def dummy


fix missing conv-man argument in conv-actor instantiation

--- src/polismath/conv_man.clj
+++ src/polismath/conv_man.clj
@@ -389,7 +389,7 @@
       ;; Then we already have a go loop running for this
       (>!! message-chan {:message-type message-type :message-batch message-batch})
       ;; Then we need to initialize the conversation and set up the conversation channel and go routine
-      (let [conv-actor (conv-actor zid)]
+      (let [conv-actor (conv-actor conv-man zid)]
         (swap! conversations assoc zid conv-actor)
         ;; Just call again to make sure the message gets on the chan (using the if-let fork above) :-)
         (queue-message-batch! conv-man message-type zid message-batch)))))


For editing use raw content, not transformed url

--- frontend/src/faceboard/views/boards/people/gizmos/social.cljs
+++ frontend/src/faceboard/views/boards/people/gizmos/social.cljs
@@ -56,12 +56,13 @@
     (let [{:keys [social socials committer]} data
           info (social-info social)
           state (atom social)
-          {:keys [icon url type]} info]
+          {:keys [icon content url type]} info]
       (dom/div {:class "social-item"}
         (dom/i {:class (str "icon fa " icon)})
         (dom/input {:type        "text"
-                    :value       url
+                    :value       content
                     :placeholder (if type "user profile url" "web url")
+                    :title       url
                     :on-change   (partial update-social state socials committer)})
         (dom/button {:class    "remove-action"
                      :on-click (partial remove-social social socials committer)}


Have time input components pull in "class" and "style" from props

--- src/re_com/input_time.cljs
+++ src/re_com/input_time.cljs
@@ -149,7 +149,8 @@
         text-model     (reagent/atom (time->text deref-model))
         previous-model (reagent/atom deref-model)]
     (fn
-      [& {:keys [model minimum maximum width height disabled? hide-border? show-icon?] :as args
+      [& {:keys [model minimum maximum width height disabled? hide-border? show-icon?
+                 class style] :as args
           :or   {minimum 0 maximum 2359}}]
       {:pre [(validate-args-macro input-time-args-desc args "input-time")
              (validate-arg-times (deref-or-value model) minimum maximum)]}
@@ -250,7 +251,8 @@
         text-model     (reagent/atom (time->text-12h deref-model))
         previous-model (reagent/atom deref-model)]
     (fn
-      [& {:keys [model minimum maximum width height disabled? hide-border? show-icon?] :as args
+      [& {:keys [model minimum maximum width height disabled? hide-border? show-icon?
+                 class style] :as args
           :or   {minimum 0 maximum 2359}}]
       {:pre [(validate-args-macro input-time-args-desc args "input-time")
              (validate-arg-times (deref-or-value model) minimum maximum)]}


Remove CTRL-D binding that's now handled in jline/jline2

--- src/reply/reader/jline.clj
+++ src/reply/reader/jline.clj
@@ -19,13 +19,6 @@
         history (FileHistory. (File. home ".jline-reply.history"))
         completer (jline.completion/make-var-completer 'clojure.core)
         completion-handler (jline.completion/make-completion-handler)]
-
-    (-> reader (.getKeys)
-      (.bind "\4"
-        (proxy [java.awt.event.ActionListener] []
-          (actionPerformed [e]
-            (print "^D") (flush)
-            (System/exit 0)))))

     (doto reader
       (.setHistory history)


Add thread interruption check to timer input.


not sure what's going on, threw in some agents and atoms


CMR-6164 Adds test scenario for registered user acl.

--- system-int-test/test/cmr/system_int_test/ingest/subscription_ingest_test.clj
+++ system-int-test/test/cmr/system_int_test/ingest/subscription_ingest_test.clj
@@ -312,6 +312,30 @@
                                     :items
                                     first
                                     :concept_id))
+           _ (echo-util/ungrant (system/context)
+                                (-> (access-control/search-for-acls (system/context)
+                                                                    {:provider "PROV2"
+                                                                     :target "INGEST_MANAGEMENT_ACL"}
+                                                                    {:token "mock-echo-system-token"})
+                                    :items
+                                    first
+                                    :concept_id))
+           _ (echo-util/ungrant (system/context)
+                                (-> (access-control/search-for-acls (system/context)
+                                                                    {:provider "PROV2"
+                                                                     :identity-type "catalog_item"}
+                                                                    {:token "mock-echo-system-token"})
+                                    :items
+                                    first
+                                    :concept_id))
+           _ (echo-util/ungrant (system/context)
+                                (-> (access-control/search-for-acls (system/context)
+                                                                    {:provider "PROV2"
+                                                                     :target "SUBSCRIPTION_MANAGEMENT"}
+                                                                    {:token "mock-echo-system-token"})
+                                    :items
+                                    first
+                                    :concept_id))
            _ (echo-util/grant (system/context)
                               [{:group_id user1-group-id
                                 :permissions [:read]}]
@@ -323,6 +347,16 @@
                                :granule_identifier {:access_value {:include_undefined_value true
                                                                    :min_value 1 :max_value 50}}})
            _ (echo-util/grant (system/context)
+                              [{:user_type :registered
+                                :permissions [:read]}]
+                              :catalog_item_identity
+                              {:provider_id "PROV2"
+                               :name "Provider collection/granule ACL registered users"
+                               :collection_applicable true
+                               :granule_applicable true
+                               :granule_identifier {:access_value {:include_undefined_value true
+                                                                   :min_value 100 :max_value 200}}})
+           _ (echo-util/grant (system/context)
                               [{:group_id admin-group1
                                 :permissions [:read :update]}]
                               :provider_identity
@@ -334,9 +368,25 @@
                               :provider_identity
                               {:provider_id "PROV1"
                                :target "INGEST_MANAGEMENT_ACL"})
+           _ (echo-util/grant (system/context)
+                              [{:group_id admin-group1
+                                :permissions [:read :update]}]
+                              :provider_identity
+                              {:provider_id "PROV2"
+                               :target "SUBSCRIPTION_MANAGEMENT"})
+           _ (echo-util/grant (system/context)
+                              [{:group_id admin-group1
+                                :permissions [:read :update]}]
+                              :provider_identity
+                              {:provider_id "PROV2"
+                               :target "INGEST_MANAGEMENT_ACL"})
            coll1 (data-core/ingest-umm-spec-collection "PROV1"
                                                        (data-umm-c/collection {:ShortName "coll1"
                                                                                :EntryTitle "entry-title1"})
+                                                       {:token "mock-echo-system-token"})
+           coll2 (data-core/ingest-umm-spec-collection "PROV2"
+                                                       (data-umm-c/collection {:ShortName "coll2"
+                                                                               :EntryTitle "entry-title2"})
                                                        {:token "mock-echo-system-token"})
            _ (index/wait-until-indexed)
            _ (subscription-util/ingest-subscription (subscription-util/make-subscription-concept
@@ -344,6 +394,14 @@
                                                       :SubscriberId "user1"
                                                       :EmailAddress "user1@nasa.gov"
                                                       :CollectionConceptId (:concept-id coll1)
+                                                      :Query " "})
+                                                    {:token "mock-echo-system-token"})
+           _ (subscription-util/ingest-subscription (subscription-util/make-subscription-concept
+                                                     {:provider-id "PROV2"
+                                                      :Name "test_sub_prov1"
+                                                      :SubscriberId "user1"
+                                                      :EmailAddress "user1@nasa.gov"
+                                                      :CollectionConceptId (:concept-id coll2)
                                                       :Query " "})
                                                     {:token "mock-echo-system-token"})
            _ (index/wait-until-indexed)
@@ -359,8 +417,14 @@
                                                                                {:granule-ur "Granule2"
                                                                                :access-value 66})
                                    {:token "mock-echo-system-token"})
+           gran3 (data-core/ingest "PROV2"
+                                   (data-granule/granule-with-umm-spec-collection coll2
+                                                                                (:concept-id coll2)
+                                                                                {:granule-ur "Granule3"
+                                                                                :access-value 133})
+                                   {:token "mock-echo-system-token"})
            _ (index/wait-until-indexed)
-           expected [(:concept-id gran1)]
+           expected [(:concept-id gran1) (:concept-id gran3)]
            actual (->> (process-subscriptions)
                        (map #(nth % 1))
                        flatten


(maint) Jetty/java throw IOExceptions when failing to bind port

In 9.4.13 Jetty improved the bind failure message, in doing so they now
wrap the BindException that the underlying networking utils throw in an
IOException[1].

Looking at the previous version of Jetty they declare and always test
for IOExceptions, consequently we should consider the contract to be
with IOException rather than the more specific BindException.

1. https://github.com/eclipse/jetty.project/commit/37a85152eb1a6a1aabbee226a660b07c700576aa#diff-1d979f16bca62b84b714de297a43aeec

--- test/clj/puppetlabs/trapperkeeper/services/webserver/jetty9_service_test.clj
+++ test/clj/puppetlabs/trapperkeeper/services/webserver/jetty9_service_test.clj
@@ -2,7 +2,7 @@
   (:import (org.apache.http ConnectionClosedException)
            (java.io IOException)
            (java.security.cert CRLException)
-           (java.net BindException SocketTimeoutException)
+           (java.net SocketTimeoutException)
            (java.nio.file Paths Files)
            (java.nio.file.attribute FileAttribute)
            (appender TestListAppender)
@@ -558,7 +558,7 @@
         (is (true? @shutdown-called?)
             "Service shutdown was not called."))))
   (testing (str "attempt to launch second jetty server on same port as "
-                "already running jetty server fails with BindException without "
+                "already running jetty server fails with IOException without "
                 "placing second jetty server instance on app context")
     (tk-log-testutils/with-test-logging
       (let [first-app (tk-core/boot-services-with-config
@@ -576,7 +576,7 @@
             (is (nil? second-jetty-server)
                 "Jetty server was unexpectedly attached to the service context")
             (is (thrown?
-                  BindException
+                  IOException
                   (tk-core/run-app second-app))
                 "tk run-app did not die with expected exception."))
           (finally


(MAINT) Remove extra spaces

(MAINT) Remove extra spaces

--- src/clj/puppetlabs/services/master/master_service.clj
+++ src/clj/puppetlabs/services/master/master_service.clj
@@ -15,8 +15,8 @@
    (core/validate-memory-requirements!)
    (let [path           (get-route this)
          config         (get-config)
-         certname       (get-in config    [:puppet-server :certname])
-         localcacert    (get-in config    [:puppet-server :localcacert])
+         certname       (get-in config [:puppet-server :certname])
+         localcacert    (get-in config [:puppet-server :localcacert])
          puppet-version (get-in config [:puppet-server :puppet-version])
          settings       (ca/config->master-settings config)]


Add if-exists

Add if-exists

--- src/clojure/clojurewerkz/cassaforte/new_query_api.clj
+++ src/clojure/clojurewerkz/cassaforte/new_query_api.clj
@@ -481,6 +481,10 @@
 ;; Delete column types
 ;;

+(defn if-exists
+  []
+  [:if-exists nil])
+
 (defn list-elt
   [column-name n]
   (fn list-elt-statement [query-builder]
@@ -519,6 +523,9 @@
                         (doseq [[key value] m]
                           (.using query-builder ((get with-values key) value)))
                         query-builder)
+       :if-exists    (fn value-query [query-builder _]
+                       (.ifExists query-builder))
+
        }]

   (defn delete


get rid of dead code

get rid of dead code

--- src/clj/backtype/storm/scheduler/IsolationScheduler.clj
+++ src/clj/backtype/storm/scheduler/IsolationScheduler.clj
@@ -16,16 +16,6 @@

 (defn -prepare [this conf]
   (container-set! (.state this) conf))
-
-
-(defn- compute-worker-specs "Returns list of sets of executors"
-  [^TopologyDetails details]
-  (->> (.getExecutorToComponent details)
-       reverse-map
-       (map second)
-       (apply interleave-all)
-       (partition-fixed (.getNumWorkers details))
-       (map set)))

 (defn- compute-worker-specs "Returns mutable set of sets of executors"
   [^TopologyDetails details]


change iso scheduler to not allocate anything else if isolation topologies can't be allocated (wait for enough resources to be available)

--- src/clj/backtype/storm/scheduler/IsolationScheduler.clj
+++ src/clj/backtype/storm/scheduler/IsolationScheduler.clj
@@ -192,16 +192,17 @@
             (.blacklistHost cluster host))
           )))

-    (doseq [[top-id worker-specs] topology-worker-specs]
-      (if-not (empty? worker-specs)
-        (log-warn "Unable to isolate topology " top-id)
+    (let [non-iso-topologies (->> topology-worker-specs
+                                  (mapcat (fn [[top-id worker-specs]]
+                                    (if-not (empty? worker-specs) [top-id])
+                                    )))]
+      (if (empty? non-iso-topologies)
+        ;; run default scheduler on non-isolated topologies
+        (-<> topology-worker-specs
+             allocated-topologies
+             (leftover-topologies topologies <>)
+             (DefaultScheduler/default-schedule <> cluster))
+        (log-warn "Unstable to isolate topologies " (pr-str non-iso-topologies) ". Will wait for enough resources for isolated topologies before allocating any other resources.")
         ))
-
-
-    ;; run default scheduler on iso topologies that didn't have enough slot + non-isolated topologies
-    (-<> topology-worker-specs
-         allocated-topologies
-         (leftover-topologies topologies <>)
-         (DefaultScheduler/default-schedule <> cluster))
     (.setBlacklistedHosts cluster orig-blacklist)
     ))


resources form cleanup -> sliders for cpu

--- src/cljs/swarmpit/component/service/form_resources.cljs
+++ src/cljs/swarmpit/component/service/form_resources.cljs
@@ -1,5 +1,6 @@
 (ns swarmpit.component.service.form-resources
   (:require [material.component :as comp]
+            [material.icon :as icon]
             [swarmpit.component.parser :refer [parse-int parse-float]]
             [swarmpit.component.state :as state]
             [sablono.core :refer-macros [html]]
@@ -9,21 +10,23 @@

 (def cursor [:page :service :wizard :resources])

+(defn- cpu-value
+  [value]
+  (if (zero? value)
+    "unlimited"
+    value))
+
 (defn- form-cpu-reservation [value]
   (comp/form-comp
-    "CPU"
-    (comp/vtext-field
-      {:name            "cpu-reservation"
-       :key             "cpu-reservation"
-       :type            "number"
-       :min             0.000
-       :step            0.001
-       :max             1.0
-       :validations     "isValidCPUValue"
-       :validationError "Please use maximum of 1.0 (represents a whole CPU) or leave blank for default value"
-       :value           value
-       :onChange        (fn [_ v]
-                          (state/update-value [:reservation :cpu] (parse-float v) cursor))})))
+    (str "CPU  " "(" (cpu-value value) ")")
+    (comp/slider #js {:min          0
+                      :max          2
+                      :step         0.10
+                      :defaultValue 0
+                      :value        value
+                      :onChange     (fn [_ v]
+                                      (state/update-value [:reservation :cpu] (parse-float v) cursor))
+                      :sliderStyle  #js {:marginTop "14px"}})))

 (defn- form-memory-reservation [value]
   (comp/form-comp
@@ -34,26 +37,22 @@
        :type            "number"
        :min             4
        :validations     "isValidMemoryValue"
-       :validationError "Please use minimum of 4 MB or leave blank for default value"
+       :validationError "Please use minimum of 4 MB or leave blank for unlimited"
        :value           value
        :onChange        (fn [_ v]
                           (state/update-value [:reservation :memory] (parse-int v) cursor))})))

 (defn- form-cpu-limit [value]
   (comp/form-comp
-    "CPU"
-    (comp/vtext-field
-      {:name            "cpu-limit"
-       :key             "cpu-limit"
-       :type            "number"
-       :min             0.000
-       :step            0.001
-       :max             1.0
-       :validations     "isValidCPUValue"
-       :validationError "Please use maximum of 1.0 (represents a whole CPU) or leave blank for default value"
-       :value           value
-       :onChange        (fn [_ v]
-                          (state/update-value [:limit :cpu] (parse-float v) cursor))})))
+    (str "CPU  " "(" (cpu-value value) ")")
+    (comp/slider #js {:min          0
+                      :max          2
+                      :step         0.10
+                      :defaultValue 0
+                      :value        value
+                      :onChange     (fn [_ v]
+                                      (state/update-value [:limit :cpu] (parse-float v) cursor))
+                      :sliderStyle  #js {:marginTop "14px"}})))

 (defn- form-memory-limit [value]
   (comp/form-comp
@@ -64,7 +63,7 @@
        :type            "number"
        :min             4
        :validations     "isValidMemoryValue"
-       :validationError "Please use minimum of 4 MB or leave blank for default value"
+       :validationError "Please use minimum of 4 MB or leave blank for unlimited"
        :value           value
        :onChange        (fn [_ v]
                           (state/update-value [:limit :memory] (parse-int v) cursor))})))
@@ -77,9 +76,11 @@
        {:onValid   #(state/update-value [:isValid] true cursor)
         :onInvalid #(state/update-value [:isValid] false cursor)}
        (html (comp/form-subsection "Reservation"))
+       (html (comp/form-icon-value icon/info [:span "Minimal resource availablility to run a task. Empty for unlimited."]))
        (form-cpu-reservation (:cpu reservation))
        (form-memory-reservation (:memory reservation))
        (html (comp/form-subsection "Limit"))
+       (html (comp/form-icon-value icon/info [:span "Maximal resource usage per task. Empty for unlimited."]))
        (form-cpu-limit (:cpu limit))
        (form-memory-limit (:memory limit))
        (html [:div {:style {:height "20px"}}]))]))


Wikidata-app: this time with all the parentheses

--- src/main/clojure/conexp/fca/applications/wikidata.clj
+++ src/main/clojure/conexp/fca/applications/wikidata.clj
@@ -229,16 +229,16 @@
 (defn counterexample
   "Find n counterexample to the given implication, or nil if there is none. If no
   n is provided, use 1."
-  [implication]
-  (counterexample 1)
-  [implication n]
-  (assert (number n) "non number provided in counterexample function")
+  ([implication]
+   (counterexample 1))
+  ([implication n]
+  (assert (number? n) "non number provided in counterexample function")
   (tautology-or-counterexample
    implication
    (with-sparql-bindings
      (counterexample-query-for-implication implication :limit n)
      (let [[{entity "entity"}] bindings]
-       entity))))
+       entity)))))

 (defn counterexamples
   "find all counterexample to the given implication, or nil if there is none"


Added fix for https://github.com/intermine/go-intermod/issues/1 indicating that the reason for many enrichment errors is due to the need for an intermine web service upgrade

--- src/cljs/gointermod/enrichment/views.cljs
+++ src/cljs/gointermod/enrichment/views.cljs
@@ -22,7 +22,15 @@

 (defn output-error [result]
   "Error. Error. Does not compute."
- [:div.error [:svg.icon [:use {:xlinkHref "#icon-sad"}]] "Error loading results. The server says: \""[:pre (:error result)]"\"" ])
+  [:div.error
+    [:svg.icon
+      [:use {:xlinkHref "#icon-sad"}]]
+      "Error loading results. The server says: \""
+      [:pre (:error result)]"\""
+      (cond (re-find #"I didn't get any values for \[list\]" (:error result))
+        [:p "This may be because InterMine to be upgraded on the organisms's server"]
+        )
+   ])

 (defn output-loading [result]
   [:div [utils/loader]
@@ -122,7 +130,7 @@
   (let [organisms (checked-organism-list)]
     (if (empty? organisms)
       nil
-      [:div.notsearched "The following organisms were not selected as an output species: " (clojure.string/join " " organisms)]
+      [:div.notsearched "The following organisms were not selected as an output species: " (clojure.string/join ", " organisms)]
     )
     ))


CMR-736: Added aliasing of NEAR_REAL_TIME for keyword searches.

--- src/cmr/indexer/data/concepts/keyword.clj
+++ src/cmr/indexer/data/concepts/keyword.clj
@@ -17,6 +17,10 @@
 ;; Regex to split strings with special characters into multiple words for keyword searches
 (def keywords-separator-regex #"[!@#$%^&()\-=_+{}\[\]|;'.,\"/:<>?`~* ]")

+;; Aliases for NEAR_REAL_TIME
+(def nrt-aliases
+  ["near_real_time","nrt","near real time","near-real time","near-real-time","near real-time"])
+
 (defn prepare-keyword-field
   [field-value]
   "Convert a string to lowercase then separate it into keywords"
@@ -33,6 +37,10 @@
         {{:keys [short-name long-name version-id processing-level-id collection-data-type]} :product
          :keys [entry-id entry-title summary spatial-keywords temporal-keywords associated-difs
                 projects]} collection
+        collection-data-type (if (and collection-data-type
+                                      (some #{(str/lower-case collection-data-type)} nrt-aliases))
+                               nrt-aliases
+                               collection-data-type)
         project-long-names (map :long-name projects)
         project-short-names (map :short-name projects)
         platforms (:platforms collection)


Format and update url spec

Format and update url spec

--- src/com/wsscode/pathom/diplomat/http.cljc
+++ src/com/wsscode/pathom/diplomat/http.cljc
@@ -3,7 +3,7 @@

 (s/def ::encode-type (s/with-gen keyword? #(s/gen #{::transit+json ::edn ::json})))

-(s/def ::url (s/or :string string? :uri uri?))
+(s/def ::url string?)

 (s/def ::method #{::get ::head ::post ::put ::patch ::delete ::connect ::options})

@@ -41,19 +41,23 @@
 ;; On response, should be a clojure data-structure.
 (s/def ::body any?)

-(s/def ::request (s/keys :req [::url]
-                         :opt [::method
-                               ::headers
-                               ::content-type
-                               ::accept
-                               ::as
-                               ::form-params
-                               ::debug?
-                               ::body]))
+(s/def ::request
+  (s/keys
+    :req [::url]
+    :opt [::method
+          ::headers
+          ::content-type
+          ::accept
+          ::as
+          ::form-params
+          ::debug?
+          ::body]))

-(s/def ::response (s/keys :req [::status]
-                          :opt [::headers
-                                ::body]))
+(s/def ::response
+  (s/keys
+    :req [::status]
+    :opt [::headers
+          ::body]))

 (s/def ::driver fn?)

@@ -66,8 +70,8 @@
    (driver (merge request {::url url} config))))

 (s/fdef request
-        :args (s/cat :req ::request)
-        :ret ::response)
+  :args (s/cat :req ::request)
+  :ret ::response)

 (defn request-method [{::keys [method form-params]}]
   (or (some-> method name)


supervisor logs worker command with '-quoted tokens

--- storm-core/src/clj/backtype/storm/daemon/supervisor.clj
+++ storm-core/src/clj/backtype/storm/daemon/supervisor.clj
@@ -469,8 +469,9 @@
                    (:assignment-id supervisor)
                    port
                    worker-id]
-          command (->> command (map str) (filter (complement empty?)))]
-      (log-message "Launching worker with command: " (clojure.string/join " " command))
+          command (->> command (map str) (filter (complement empty?)))
+          shell-cmd (->> command (map #(str \' % \')) (clojure.string/join " "))]
+      (log-message "Launching worker with command: " shell-cmd)
       (launch-process command :environment {"LD_LIBRARY_PATH" (conf JAVA-LIBRARY-PATH)})
       ))


cleanup

cleanup

--- Clojure-Websockets/MainApp/src/cljs/birdwatch/util.cljs
+++ Clojure-Websockets/MainApp/src/cljs/birdwatch/util.cljs
@@ -18,11 +18,6 @@
 (defn search-hash []
   (subs (js/decodeURIComponent (aget js/window "location" "hash")) 1))

-(defn swap-pmap
-  "swaps item in priority-map"
-  [app priority-map id n]
-  (swap! app assoc priority-map (assoc (priority-map @app) id n)))
-
 (defn tweets-by-order
   "find top n tweets by specified order"
   [tweets-map order]


add unit tests

add unit tests

--- test/clj_http/test/client_test.clj
+++ test/clj_http/test/client_test.clj
@@ -680,6 +680,26 @@
   (is-applied client/wrap-accept-encoding
               {:accept-encoding [:identity :gzip]}
               {:headers {"accept-encoding" "identity, gzip"}}))
+
+(deftest apply-custom-accept-encoding
+  (testing "no custom encodings to accept"
+    (is-applied (comp client/wrap-accept-encoding
+                      client/wrap-decompression)
+                {}
+                {:headers {"accept-encoding" "gzip, deflate"}
+                 :orig-content-encoding nil}))
+  (testing "accept some custom encodings, but still include gzip and deflate"
+    (is-applied (comp client/wrap-accept-encoding
+                      client/wrap-decompression)
+                {:accept-encoding [:foo :bar]}
+                {:headers {"accept-encoding" "foo, bar, gzip, deflate"}
+                 :orig-content-encoding nil}))
+  (testing "accept some custom encodings, but exclude gzip and deflate"
+    (is-applied (comp client/wrap-accept-encoding
+                      client/wrap-decompression)
+                {:accept-encoding [:foo :bar] :decompress-body false}
+                {:headers {"accept-encoding" "foo, bar"}
+                 :decompress-body false})))

 (deftest pass-on-no-accept-encoding
   (is-passed client/wrap-accept-encoding


test using reagent rendering

test using reagent rendering

--- test/cljs/ohds/component-test.cljs
+++ test/cljs/ohds/component-test.cljs
@@ -33,6 +33,11 @@
       (do (println "Not found: " res)
           false))))

+(deftest test-home
+  (with-mounted-component (c/hamburger)
+    (fn [c div]
+      (is (found-in #"Toggle Nav" div)))))
+
 (deftest atom-change-tests
   (let [state (atom {:hello "world"})]
     (testing "a-swap only swaps out single key"


cleaned up

cleaned up

--- cljx/plongeur-cljs/test/kierros/util_test.cljs
+++ cljx/plongeur-cljs/test/kierros/util_test.cljs
@@ -5,7 +5,7 @@
             [cljs.test :refer-macros [deftest is testing run-tests async]])
   (:require-macros [cljs.core.async.macros :refer [go]]))

-(def amend-state (fn [state f] (f state)))
+(defn amend-state [state f] (f state))

 (deftest sequence-scan-empty
   (let [s (->> []