DRY up options schemas

DRY up options schemas

DRY up options schemas by putting the server id option in its own
schema, then associating other options into it as necessary for
other schemas.

--- src/puppetlabs/trapperkeeper/services/webserver/jetty9_core.clj
+++ src/puppetlabs/trapperkeeper/services/webserver/jetty9_core.clj
@@ -55,30 +55,23 @@
    :path schema/Str
    :port schema/Int})

+(def ServerIDOption
+  {(schema/optional-key :server-id) schema/Keyword})
+
+(def ContextHandlerOptions
+  (assoc ServerIDOption (schema/optional-key :context-listeners) [ServletContextListener]))
+
+(def ServletHandlerOptions
+  (assoc ServerIDOption (schema/optional-key :servlet-init-params) {schema/Str schema/Str}))
+
 (def ProxyOptions
-  {(schema/optional-key :scheme) (schema/enum :orig :http :https)
-   (schema/optional-key :ssl-config) (schema/either
-                                       (schema/eq :use-server-config)
-                                       config/WebserverSslPemConfig)
-   (schema/optional-key :callback-fn) (schema/pred ifn?)
-   (schema/optional-key :request-buffer-size) schema/Int
-   (schema/optional-key :server-id) schema/Keyword})
-
-
-(def ContextHandlerOptions
-  {(schema/optional-key :server-id)         schema/Keyword
-   (schema/optional-key :context-listeners) [ServletContextListener]})
-
-(def RingAndWarHandlerOptions
-  {(schema/optional-key :server-id) schema/Keyword})
-
-(def ServletHandlerOptions
-  {(schema/optional-key :server-id)           schema/Keyword
-   (schema/optional-key :servlet-init-params) {schema/Str schema/Str}})
-
-(def ProxyRouteOptions
-  {(schema/optional-key :server-id) schema/Keyword
-   (schema/optional-key :options)   ProxyOptions})
+  (assoc ServerIDOption
+    (schema/optional-key :scheme) (schema/enum :orig :http :https)
+    (schema/optional-key :ssl-config) (schema/either
+                                        (schema/eq :use-server-config)
+                                        config/WebserverSslPemConfig)
+    (schema/optional-key :callback-fn) (schema/pred ifn?)
+    (schema/optional-key :request-buffer-size) schema/Int))

 (def ServerContext
   {:state     Atom
@@ -664,7 +657,7 @@
     (add-context-handler s base-path context-path context-listeners)))

 (schema/defn ^:always-validate add-ring-handler!
-  [context handler path options :- RingAndWarHandlerOptions]
+  [context handler path options :- ServerIDOption]
   (let [defaults {:server-id :default}
         opts     (merge defaults options)
         server-id (:server-id opts)
@@ -691,7 +684,7 @@
     (add-servlet-handler s servlet path servlet-init-params)))

 (schema/defn ^:always-validate add-war-handler!
-  [context war path options :- RingAndWarHandlerOptions]
+  [context war path options :- ServerIDOption]
   (let [defaults  {:server-id :default}
         opts      (merge defaults options)
         server-id (:server-id opts)


Set standard-sockets binding group to full-ha-sockets [IMMUTANT-74]

--- support/build-support/src/main/clojure/immutant/build/tools.clj
+++ support/build-support/src/main/clojure/immutant/build/tools.clj
@@ -134,6 +134,13 @@
       (add-subsystems (if (= "full-ha" name)
                         (zip/edit loc assoc-in [:attrs :name] "default")
                         loc)))))
+
+(defn fix-socket-binding-group [loc]
+  (let [name (get-in (zip/node loc) [:attrs :name])]
+    (cond
+     (= "standard-sockets" name) (zip/remove loc)
+     (= "full-ha-sockets" name) (zip/edit loc assoc-in [:attrs :name] "standard-sockets")
+     :else loc)))

 (defn server-element [name offset]
   {:tag :server
@@ -227,6 +234,7 @@
              (looking-at? :jms-connection-factories loc) (disable-flow-control loc)
              (looking-at? :servers loc) (replace-servers loc)
              (looking-at? :server-groups loc) (replace-server-groups loc)
+             (looking-at? :socket-binding-group loc) (fix-socket-binding-group loc)
              :else loc)))))

 (defn transform-config [file]


One more example

One more example

--- test/demo.cljs
+++ test/demo.cljs
@@ -102,11 +102,18 @@
   (let [val (atom "foo")]
     (fn []
       [:div
-       [:p "The value of " [:code "val"] " is now: " @val]
+       [:p "The value is now: " @val]
        [:p "Change it: "
         [:input
          {:type "text" :value @val
           :on-change #(reset! val (-> % .-target .-value))}]]])))
+
+(defn timer-component []
+  (let [seconds-elapsed (atom 0)]
+    (fn []
+      (js/setTimeout #(swap! seconds-elapsed inc) 1000)
+      [:div
+       "Seconds Elapsed: " @seconds-elapsed])))

 (defn render-simple []
   (cloact/render-component [simple-component]
@@ -156,9 +163,9 @@
    [:h2 "Introduction to Cloact"]

    [:p "Cloact provides a minimalistic interface between ClojureScript
-and React. It allows you to define React components using nothing but
-plain ClojureScript functions, that describe your UI using a
-Hiccup-like syntax."]
+   and React. It allows you to define React components using nothing
+   but plain ClojureScript functions, that describe your UI using a
+   Hiccup-like syntax."]

    [:p "A very basic component may look something like this: "]
    [demo-component {:comp simple-component
@@ -204,12 +211,17 @@
    [demo-component {:comp local-state
                     :defs [:ns :local-state]}]

-   [:p "This example also uses another feature of Cloact: a component
+   [:p "The previous example also uses another feature of Cloact: a component
    function can return another function, that is used to do the actual
    rendering. It is called with the same arguments as any other
    component function. This allows you to perform some setup of newly
    created components, without resorting to React's lifecycle
-   events."]])
+   events."]
+
+   [:p "Here is another example, where we call setTimeout everytime
+   the component is rendered to update a simple clock:"]
+   [demo-component {:comp timer-component
+                    :defs [:timer-component]}]])

 (defn essential-api []
   [:div


Rename label

Rename label

--- abg_clojure/src/abg_clojure/core.clj
+++ abg_clojure/src/abg_clojure/core.clj
@@ -5,7 +5,7 @@
         '(java.awt GridLayout)
         '(quexotic.org Abg))

-(defn celsius []
+(defn abg []
   (let [frame (JFrame. "Arterial blood gas interpretation")
         pH-text (JTextField.)
         pH-label (JLabel. "pH")
@@ -15,7 +15,7 @@
         HCO3-label (JLabel. "HCO3")
         convert-button (JButton. "Interpret")
         no-label (JLabel. "")
-        fahrenheit-label (JLabel. "ABG Interpretation:")]
+        abg-label (JLabel. "ABG Interpretation:")]
     (.addActionListener
      convert-button
      (reify ActionListener
@@ -24,7 +24,7 @@
              (let [pH (Double/parseDouble (.getText pH-text))
                    pCO2 (Double/parseDouble (.getText pCO2-text))
                    HCO3 (Double/parseDouble (.getText HCO3-text))]
-               (.setText fahrenheit-label
+               (.setText abg-label
                          (Abg/interpret pH pCO2 HCO3))))))
     (doto frame
       (.setLayout (GridLayout. 6 1 3 3))
@@ -36,9 +36,9 @@
       (.add HCO3-label)
       (.add convert-button)
       (.add no-label)
-      (.add fahrenheit-label)
+      (.add abg-label)
       (.setSize 300 480)
       (.setVisible true))))
-(celsius)
+(abg)


adds the token into the request log for token api operations (#1189)

--- waiter/src/waiter/token.clj
+++ waiter/src/waiter/token.clj
@@ -334,8 +334,9 @@
             (make-peer-requests-fn "tokens/refresh"
                                    :body (utils/clj->json {:owner token-owner, :token token})
                                    :method :post)
-            (utils/clj->json-response {:delete token, :hard-delete hard-delete, :success true}
-                                      :headers {"etag" version-hash}))
+            (-> {:delete token, :hard-delete hard-delete, :success true}
+              (utils/clj->json-response :headers {"etag" version-hash})
+              (assoc :waiter/token token)))
           (throw (ex-info (str "Token " token " does not exist")
                           {:status http-404-not-found :token token :log-level :warn}))))
       (throw (ex-info "Couldn't find token in request" {:status http-400-bad-request :token token :log-level :warn})))))
@@ -357,21 +358,22 @@
       ;;NB do not ever return the password to the user
       (let [epoch-time->date-time (fn [epoch-time] (DateTime. epoch-time))]
         (log/info "successfully retrieved token" token)
-        (utils/clj->json-response
-          (cond-> (merge service-parameter-template
-                         (select-keys token-metadata sd/user-metadata-keys))
-            show-metadata
-            (merge (cond-> (loop [loop-token-metadata (select-keys token-metadata sd/system-metadata-keys)
-                                  nested-last-update-time-path ["last-update-time"]]
-                             (if (get-in loop-token-metadata nested-last-update-time-path)
-                               (recur (update-in loop-token-metadata nested-last-update-time-path epoch-time->date-time)
-                                      (concat ["previous"] nested-last-update-time-path))
-                               loop-token-metadata))
-                     (not (contains? token-metadata "cluster"))
-                     (assoc "cluster" (get-default-cluster cluster-calculator))
-                     (not (contains? token-metadata "root"))
-                     (assoc "root" token-root))))
-          :headers {"etag" token-hash}))
+        (-> (utils/clj->json-response
+              (cond-> (merge service-parameter-template
+                             (select-keys token-metadata sd/user-metadata-keys))
+                show-metadata
+                (merge (cond-> (loop [loop-token-metadata (select-keys token-metadata sd/system-metadata-keys)
+                                      nested-last-update-time-path ["last-update-time"]]
+                                 (if (get-in loop-token-metadata nested-last-update-time-path)
+                                   (recur (update-in loop-token-metadata nested-last-update-time-path epoch-time->date-time)
+                                          (concat ["previous"] nested-last-update-time-path))
+                                   loop-token-metadata))
+                         (not (contains? token-metadata "cluster"))
+                         (assoc "cluster" (get-default-cluster cluster-calculator))
+                         (not (contains? token-metadata "root"))
+                         (assoc "root" token-root))))
+              :headers {"etag" token-hash})
+          (assoc :waiter/token token)))
       (throw (ex-info (str "Couldn't find token " token)
                       {:headers {}
                        :status http-404-not-found
@@ -531,10 +533,11 @@
           existing-editable-token-data (token-description->editable-token-parameters existing-token-description)]
       (if (and (not admin-mode?)
                (= existing-editable-token-data new-user-editable-token-data))
-        (utils/clj->json-response
-          {:message (str "No changes detected for " token)
-           :service-description (:service-parameter-template existing-token-description)}
-          :headers {"etag" (token-description->token-hash existing-token-description)})
+        (-> (utils/clj->json-response
+              {:message (str "No changes detected for " token)
+               :service-description (:service-parameter-template existing-token-description)}
+              :headers {"etag" (token-description->token-hash existing-token-description)})
+          (assoc :waiter/token token))
         (let [token-limit (if admin-mode?
                             (do
                               (log/info "will not enforce count limit on owner tokens in admin mode" {:owner owner})
@@ -551,12 +554,13 @@
                                        (not (get existing-token-metadata "deleted")))
                                 "updated "
                                 "created ")]
-            (utils/clj->json-response
-              {:message (str "Successfully " creation-mode token)
-               :service-description new-service-parameter-template}
-              :headers {"etag" (token-description->token-hash
-                                 {:service-parameter-template new-service-parameter-template
-                                  :token-metadata new-token-metadata})})))))))
+            (-> (utils/clj->json-response
+                  {:message (str "Successfully " creation-mode token)
+                   :service-description new-service-parameter-template}
+                  :headers {"etag" (token-description->token-hash
+                                     {:service-parameter-template new-service-parameter-template
+                                      :token-metadata new-token-metadata})})
+              (assoc :waiter/token token))))))))

 (defn handle-token-request
   "Ring handler for dealing with tokens.


Add a "root" route to server index.html

Add a "root" route to server index.html

--- src/leiningen/new/chestnut/src/clj/chestnut/server.clj
+++ src/leiningen/new/chestnut/src/clj/chestnut/server.clj
@@ -1,6 +1,6 @@
 (ns {{project-ns}}.server
   (:require [clojure.java.io :as io]
-            [compojure.core :refer [GET defroutes]]
+            [compojure.core :refer [ANY GET PUT POST DELETE defroutes]]
             [compojure.route :refer [resources]]
             [ring.middleware.defaults :refer [wrap-defaults {{ring-defaults}}]]
             [ring.middleware.gzip :refer [wrap-gzip]]
@@ -9,6 +9,10 @@
   (:gen-class))

 (defroutes routes
+  (GET "/" _
+    {:status 200
+     :headers {"Content-Type" "text/html; charset=utf-8"}
+     :body (io/input-stream (io/resource "public/index.html"))})
   (resources "/"))

 (def http-handler


handler.clj: remove singleton, correct clojure.walk namespace

--- src/main/clojure/org/altlaw/extract/scrape/handler.clj
+++ src/main/clojure/org/altlaw/extract/scrape/handler.clj
@@ -1,13 +1,14 @@
 (ns org.altlaw.extract.scrape.handler
   (:require [org.altlaw.util.jruby :as ruby]
-            [clojure.contrib.walk :as walk]
-            [clojure.contrib.singleton :as sing]))
+            [clojure.walk :as walk]))

-(def scraper-handler
-     (sing/per-thread-singleton
-      (fn []
-        (ruby/eval-jruby "require 'org/altlaw/extract/scrape/scraper_handler'")
-        (ruby/eval-jruby "ScraperHandler.new"))))
+(def #^{:private true} *scraper-handler*
+     (delay
+      (ruby/eval-jruby "require 'org/altlaw/extract/scrape/scraper_handler'")
+      (ruby/eval-jruby "ScraperHandler.new")))
+
+(defn scraper-handler []
+  (force *scraper-handler*))

 (defn run-scrapers [download]
   (assert (map? download))


Add comment to cljs/repl.clj about interaction support fns

--- src/clj/cljs/repl.clj
+++ src/clj/cljs/repl.clj
@@ -234,6 +234,9 @@
   [repl-env & {:as opts}]
   (repl* repl-env opts))

+;; =============================================================================
+;; ClojureScript REPL interaction support
+
 (defmacro doc
   "Prints documentation for a var or special form given its name"
   [sym]


Add panel with buttons for change sort type

--- src/teach_by_friends/shared/scenes/chapters_scene.cljs
+++ src/teach_by_friends/shared/scenes/chapters_scene.cljs
@@ -156,6 +156,25 @@
                          :on-press #(dispatch [:toggle-search])}
    [search-icon {:style {:width 15 :height 15}}]])

+(defn sort-row []
+  [ui/view {:style {:margin-left 13
+                    :margin-right 13
+                    :padding-top 13
+                    :padding-bottom 13
+                    :border-top-width 1
+                    :border-top-color "rgb(155,155,155)"
+                    :border-bottom-width 1
+                    :border-bottom-color "rgb(155,155,155)"
+                    :flex-direction "row"}}
+   [ui/touchable-opacity {:style {:flex 1
+                                  :align-items "center"
+                                  :justify-content "center"}}
+    [ui/text {:style {:color "rgb(155,155,155)"}} "Timeline"]]
+   [ui/touchable-opacity {:style {:flex 1
+                                  :align-items "center"
+                                  :justify-content "center"}}
+    [ui/text {:style {:color "rgb(155,155,155)"}} "Alphabet"]]])
+
 (defn chapters-content [activity-indicator]
   (let [chapters (subscribe [:chapters])
         chapter (subscribe [:get-chapter])
@@ -170,11 +189,14 @@
                         :flex-direction "column"
                         :align-items    "stretch"}}
        (if (not (empty? @chapter))
-         [timeline-and-table {:style {:flex             12
-                                      :flex-direction   "row"}
-                              :render-row #(identity [term-row (nth @chapter-terms %)])
-                              :chapter @chapter-terms
-                              :term-row-height TERM_ROW_HEIGHT}]
+         [ui/view {:style {:flex 12}
+                   :background-color "black"}
+          [sort-row]
+          [timeline-and-table {:style {:flex 1
+                                       :flex-direction   "row"}
+                               :render-row #(identity [term-row (nth @chapter-terms %)])
+                               :chapter @chapter-terms
+                               :term-row-height TERM_ROW_HEIGHT}]]
          [ui/view {:style {:flex             (if (nil? @chapters) 13 12)
                            :background-color "white"
                            :justify-content  "center"


return grep matches each on its own line

--- storm-core/src/clj/backtype/storm/daemon/logviewer.clj
+++ storm-core/src/clj/backtype/storm/daemon/logviewer.clj
@@ -273,8 +273,9 @@
           (if grep
             (html [:pre#logContent
                    (if grep
-                     (filter #(.contains % grep)
-                             (.split log-string "\n"))
+                     (->> (.split log-string "\n")
+                          (filter #(.contains % grep))
+                          (string/join "\n"))
                      log-string)])
             (let [pager-data (pager-links fname start length file-length)]
               (html (concat pager-data


Make vt/get-params 2x faster

Make vt/get-params 2x faster

--- src/asciinema/vt.cljc
+++ src/asciinema/vt.cljc
@@ -135,7 +135,7 @@
                                     (map reduce-param groups)))))

 (defn get-params [vt]
-  (get-cached-params (get-in vt [:parser :param-chars])))
+  (get-cached-params (-> vt :parser :param-chars)))

 (defn get-param [vt n default]
   (let [v (nth (get-params vt) n 0)]


Test for the function properties->map

Test for the function properties->map

--- test/cloverage_jenkins_reporter/config_loader_test.clj
+++ test/cloverage_jenkins_reporter/config_loader_test.clj
@@ -28,7 +28,7 @@

 (ns cloverage-jenkins-reporter.config-loader-test
   (:require [clojure.test :refer :all]
-            [cloverage-jenkins-reporter.config :refer :all]))
+            [cloverage-jenkins-reporter.config-loader :refer :all]))

 ;
 ; Common functions used by tests.
@@ -54,3 +54,28 @@
     (testing "if the cloverage-jenkins-reporter.config-loader/load-configuration-file definition exists."
         (is (callable? 'cloverage-jenkins-reporter.config-loader/load-configuration-file))))

+;
+; Test for function behaviours
+;
+
+(deftest test-properties->map-1
+    "Check the behaviour of function emender-jenkins/properties->map."
+    (let [property (doto (new java.util.Properties)
+                         (.setProperty "a" "A")
+                         (.setProperty "b" "B"))]
+        (is (= {:a 'A :b 'B} (properties->map property)))))
+
+(deftest test-properties->map-2
+    "Check the behaviour of function emender-jenkins/properties->map."
+    (let [property (doto (new java.util.Properties)
+                         (.setProperty "propertyA" "property_a")
+                         (.setProperty "propertyB" "property_b"))]
+        (is (= {:propertyA 'property_a :propertyB 'property_b} (properties->map property)))))
+
+(deftest test-properties->map-3
+    "Check the behaviour of function emender-jenkins/properties->map."
+    (let [property (doto (new java.util.Properties)
+                         (.setProperty "value1" "1")
+                         (.setProperty "value2" "2"))]
+        (is (= {:value1 1 :value2 2} (properties->map property)))))
+


if-not -> when-not

if-not -> when-not

--- src/cheshire/core.clj
+++ src/cheshire/core.clj
@@ -61,8 +61,7 @@
     (parse
      (.createJsonParser ^JsonFactory (or *json-factory* json-factory)
                         (StringReader. string))
-     true (or keywords? false) nil
-     array-coerce-fn)))
+     true (or keywords? false) nil array-coerce-fn)))

 (defn parse-stream
   "Returns the Clojure object corresponding to the given reader, reader must
@@ -98,7 +97,7 @@
   (let [eof (Object.)]
     (lazy-seq
      (let [elem (parse parser true keywords? eof array-coerce-fn)]
-       (if-not (identical? elem eof)
+       (when-not (identical? elem eof)
          (cons elem (parsed-seq* parser keywords? array-coerce-fn)))))))

 (defn parsed-seq


Return the roles as a set of keywords

Return the roles as a set of keywords

as opposed to a list of strings


Remove auto-search fn until i fixed it

Remove auto-search fn until i fixed it

--- src/discuss/find.cljs
+++ src/discuss/find.cljs
@@ -46,12 +46,15 @@
 (defn- item-view [data _owner]
   (reify om/IRender
     (render [_]
-      (dom/div #js {:className "bs-callout bs-callout-info"}
-               (dom/span #js {:className "badge pull-right"}
-                         (lib/str->int (:distance data)))
-               (dom/div nil (dom/a #js {:href    "javascript:void(0)"
-                                        :onClick #(com/ajax-get-and-change-view (:url data) :default)}
-                                   (vlib/safe-html (:text data))))))))
+      (let [distance (lib/str->int (:distance data))
+            argument (first (:arguments data))
+            issue (:issue data)]
+        (when (:text argument)
+          (dom/div #js {:className "bs-callout bs-callout-info"}
+                   (dom/span #js {:className "badge pull-right"} distance)
+                   (dom/a #js {:href    "javascript:void(0)"
+                               :onClick #(com/jump-to-argument (:slug issue) (:uid argument))}
+                          (vlib/safe-html (:text argument)))))))))

 (defn- issue-selector-view
   "Create option items from each issue."
@@ -82,7 +85,7 @@
                (issue-component owner)
                (dom/div #js {:className "input-group"}
                         (dom/input #js {:className   "form-control"
-                                        :onChange    #(update-state-find-statement :search-value % issue-id owner)
+                                        :onChange    #(vlib/commit-component-state :search-value % owner)
                                         :value       search-value
                                         :placeholder "Find Statement"})
                         (dom/span #js {:className "input-group-btn"}


ContactInformation is optional for VoterService

For a VoterService without any contact information, the final XML
wouldn't incorrectly omit it, but not any more!

--- src/vip/data_processor/db/translations/v5_1/voter_services.clj
+++ src/vip/data_processor/db/translations/v5_1/voter_services.clj
@@ -31,33 +31,18 @@
 (defn voter-service->ltree [vss parent-with-id]
   (fn [idx-fn parent-path _]
     (mapcat (fn [vs]
-              (when-not (every? #(clojure.string/blank? (get vs %))
-                                [:ci_address_line_1
-                                 :ci_address_line_2
-                                 :ci_address_line_3
-                                 :ci_directions
-                                 :ci_email
-                                 :ci_fax
-                                 :ci_hours
-                                 :ci_hours_open_id
-                                 :ci_latitude
-                                 :ci_longitude
-                                 :ci_latlng_source
-                                 :ci_name
-                                 :ci_phone
-                                 :ci_uri])
-                (let [path (str parent-path ".VoterService." (idx-fn))
-                      label-path (str path ".label")
-                      sub-idx-fn (util/index-generator 0)]
-                  (conj
-                   (mapcat #(% sub-idx-fn path vs)
-                           [(ci/contact-information->ltree)
-                            (util/internationalized-text->ltree :description)
-                            (util/simple-value->ltree :election_official_person_id)
-                            (util/simple-value->ltree :type)
-                            (util/simple-value->ltree :other_type)])
-                   {:path label-path
-                    :simple_path (util/path->simple-path label-path)
-                    :value (:id vs)
-                    :parent_with_id parent-with-id}))))
+              (let [path (str parent-path ".VoterService." (idx-fn))
+                    label-path (str path ".label")
+                    sub-idx-fn (util/index-generator 0)]
+                (conj
+                 (mapcat #(% sub-idx-fn path vs)
+                         [(ci/contact-information->ltree)
+                          (util/internationalized-text->ltree :description)
+                          (util/simple-value->ltree :election_official_person_id)
+                          (util/simple-value->ltree :type)
+                          (util/simple-value->ltree :other_type)])
+                 {:path label-path
+                  :simple_path (util/path->simple-path label-path)
+                  :value (:id vs)
+                  :parent_with_id parent-with-id})))
             vss)))


Partial fix to delete error

Partial fix to delete error


Some optimization attempts for efficient-simulator-sets

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

--- src/conexp/contrib/dl/languages/description_graphs.clj
+++ src/conexp/contrib/dl/languages/description_graphs.clj
@@ -347,7 +347,7 @@
         neighbours-2 (neighbours G-2),
         edge-2? (fn [v r w] (contains? (neighbours-2 v) [r w])),

-        #^HashMap sim-sets (HashMap.)]
+        ^HashMap sim-sets (HashMap.)]

     (doseq [v (vertices G-1)]
       (.put sim-sets v (set-of w [w (vertices G-2)
@@ -397,26 +397,30 @@
         ^HashMap remove (HashMap.),
         ^HashMap pre*   (HashMap.),

-        label-1 (:labels G-1),
-        label-2 (:labels G-2),
+        label-1    (:labels G-1),
+        label-2    (:labels G-2),
+        base-set-1 (:base-set G-1),
+        base-set-2 (:base-set G-2),
+        post-1     (:post G-1),
+        post-2     (:post G-2),
+        pre-2      (:pre G-2),

         R (role-names language)]
-    (doseq [v (:base-set G-1)]
+    (doseq [v base-set-1]
       (.put sim v
-            (set-of u [u (:base-set G-2),
+            (set-of u [u base-set-2,
                        :when (and (subset? (label-1 v) (label-2 u))
-                                  (forall [r R]
-                                    (=> (empty? ((:post G-2) u r))
-                                        (empty? ((:post G-1) v r)))))]))
+                                  (forall [r R] (=> (empty? (post-2 u r))
+                                                    (empty? (post-1 v r)))))]))
       (doseq [r R]
         (.put remove [v r]
-              (set-of w [w (:base-set G-2),
-                         :let [post-w ((:post G-2) w r)]
-                         :when (and (not (empty? post-w))
+              (set-of w [w base-set-2,
+                         :let [post-w (post-2 w r)]
+                         :when (and (seq post-w) ;i.e. (not (empty? post-w))
                                     (empty? (intersection (.get sim v) post-w)))]))))
-    (doseq [w (:base-set G-2)]
+    (doseq [w base-set-2]
       (.put pre* w
-            (set-of [u r] [r R, u ((:pre G-2) w r)])))
+            (set-of [u r] [r R, u (pre-2 w r)])))
     [sim remove pre*]))

 (defn efficient-simulator-sets
@@ -434,19 +438,23 @@
         ^HashMap remove (nth vars 1),
         ^HashMap pre*   (nth vars 2),

-        ^HashSet non-empty-removes (HashSet.)]
-    (doseq [v (:base-set G-1),
+        ^HashSet non-empty-removes (HashSet.),
+
+        base-set-1 (:base-set G-1),
+        post-2     (:post G-2),
+        pre-1      (:pre G-1)]
+    (doseq [v base-set-1,
             r R,
             :when (not (empty? (.get remove [v r])))]
       (.add non-empty-removes [v r]))
     (while-let [[v r] (first non-empty-removes)]
-      (doseq [u ((:pre G-1) v r),
+      (doseq [u (pre-1 v r),
               w (.get remove [v r])]
         (when (contains? (.get sim u) w)
           (.put sim u
                 (disj (.get sim u) w))
           (doseq [[w* r*] (.get pre* w)]
-            (when (empty? (intersection (.get sim u) ((:post G-2) w* r*)))
+            (when (empty? (intersection (.get sim u) (post-2 w* r*)))
               (.put remove [u r*]
                     (conj (.get remove [u r*]) w*))
               (.add non-empty-removes [u r*])))))


CMR-2717: Reducing number of calls to get sids for user.

--- access-control-app/src/cmr/access_control/services/auth_util.clj
+++ access-control-app/src/cmr/access_control/services/auth_util.clj
@@ -27,14 +27,12 @@
 (defn- get-system-acls
   "Returns ACLs which grant the given permission to the context user for system-level groups."
   [context permission]
-  (let [context (put-sids-in-context context)]
-    (seq (acl/get-permitting-acls context :system-object "GROUP" permission))))
+  (seq (acl/get-permitting-acls context :system-object "GROUP" permission)))

 (defn- get-all-provider-acls
   "Returns all ACLs that grant given permission to context user for any provider-level groups."
   [context permission]
-  (let [context (put-sids-in-context context)]
-    (acl/get-permitting-acls context :provider-object "GROUP" permission)))
+  (acl/get-permitting-acls context :provider-object "GROUP" permission))

 (defn- get-provider-acls
   "Returns any ACLs that grant the given permission to the context user for the specified group object."
@@ -51,7 +49,7 @@
   (when-let [target-guid (:legacy-guid group)]
     (seq
       (filter #(= target-guid (-> % :single-instance-object-identity :target-guid))
-              (acl/get-permitting-acls (put-sids-in-context context)
+              (acl/get-permitting-acls context
                                        :single-instance-object "GROUP" permission)))))

 (defn- describe-group
@@ -73,11 +71,11 @@
   "Throws a permission service error if no ACLs exist that grant the desired permission to the
   context user on group."
   [context action-description permission group]
-  ; (proto-repl.saved-values/save 12)
-  (when-not (or (get-instance-acls context permission group)
-                (get-provider-acls context permission group)
-                (get-system-acls context permission))
-    (throw-group-permission-error action-description group)))
+  (let [context (put-sids-in-context context)]
+    (when-not (or (get-instance-acls context permission group)
+                  (get-provider-acls context permission group)
+                  (get-system-acls context permission))
+      (throw-group-permission-error action-description group))))

 (defn verify-can-create-group
   "Throws a service error if the context user cannot create a group under provider-id."
@@ -109,7 +107,8 @@

 (defmethod qe/add-acl-conditions-to-query :access-group
   [context query]
-  (let [system-condition (when (get-system-acls context :read)
+  (let [context (put-sids-in-context context)
+        system-condition (when (get-system-acls context :read)
                            (qm/negated-condition (qm/exist-condition :provider-id)))
         provider-ids (map #(-> % :provider-object-identity :provider-id)
                           (get-all-provider-acls context :read))


cleanup

cleanup

--- Clojure-Websockets/MainApp/src/cljs/birdwatch/core.cljs
+++ Clojure-Websockets/MainApp/src/cljs/birdwatch/core.cljs
@@ -22,11 +22,11 @@
    [:cmd/make-comp {:cmp-id :state-comp :mk-state-fn c/mk-state :handler-fn c/handle-incoming}]
    [:cmd/make-comp {:cmp-id :tweets-comp :mk-state-fn tw/make-state :state-pub-handler-fn tw/state-pub-handler}]
    [:cmd/make-comp {:cmp-id :cloud-comp :mk-state-fn cloud/mk-state :state-pub-handler-fn cloud/state-pub-handler
-                    :opts {:throttle-ms 5000}}]
+                    :opts   {:throttle-ms 5000}}]
    [:cmd/make-comp {:cmp-id :wc-c-comp :mk-state-fn wc-c/mk-state :state-pub-handler-fn wc-c/state-pub-handler
-                    :opts {:throttle-ms 1000}}]
+                    :opts   {:throttle-ms 1000}}]
    [:cmd/make-comp {:cmp-id :ts-comp :mk-state-fn ts-c/mk-state :state-pub-handler-fn ts-c/state-pub-handler
-                    :opts {:throttle-ms 500}}]
+                    :opts   {:throttle-ms 500}}]

    [:cmd/make-r-comp {:cmp-id :count-comp :view-fn cv/count-view :dom-id "tweet-count"}]
    [:cmd/make-r-comp {:cmp-id :users-count-comp :view-fn cv/users-count-view :dom-id "users-count"}]
@@ -36,24 +36,13 @@
    [:cmd/make-r-comp {:cmp-id :pag-comp :view-fn pag/pagination-view :dom-id "pagination"}]

    [:cmd/tap-comp [:state-comp :ws]]
+   [:cmd/tap-comps
+    [[:ws :tweets-comp :search-comp :sort-comp :pag-comp :cloud-comp :wc-c-comp]
+     :state-comp]]

-   [:cmd/tap-comp [:ws :state-comp]]
-   [:cmd/tap-comp [:tweets-comp :state-comp]]
-   [:cmd/tap-comp [:search-comp :state-comp]]
-   [:cmd/tap-comp [:sort-comp :state-comp]]
-   [:cmd/tap-comp [:pag-comp :state-comp]]
-   [:cmd/tap-comp [:cloud-comp :state-comp]]
-   [:cmd/tap-comp [:wc-c-comp :state-comp]]
-
-   [:cmd/sub-comp [:state-comp :tweets-comp]]
-   [:cmd/sub-comp [:state-comp :cloud-comp]]
-   [:cmd/sub-comp [:state-comp :wc-c-comp]]
-   [:cmd/sub-comp [:state-comp :ts-comp]]
-   [:cmd/sub-comp [:state-comp :search-comp]]
-   [:cmd/sub-comp [:state-comp :sort-comp]]
-   [:cmd/sub-comp [:state-comp :pag-comp]]
-   [:cmd/sub-comp [:state-comp :count-comp]]
-   [:cmd/sub-comp [:state-comp :users-count-comp]]
-   [:cmd/sub-comp [:state-comp :tt-count-comp]]])
+   [:cmd/sub-comps
+    [:state-comp
+     [:tweets-comp :cloud-comp :wc-c-comp :ts-comp :search-comp :sort-comp :pag-comp
+      :count-comp :users-count-comp :tt-count-comp]]]])

 (doseq [cmd cmds] (sb/send switchboard cmd))


Componentized Twitterclient with watch & restart

--- Clojure-Websockets/src/clj/birdwatch/twitter_client.clj
+++ Clojure-Websockets/src/clj/birdwatch/twitter_client.clj
@@ -1,39 +1,24 @@
 (ns birdwatch.twitter-client
   (:gen-class)
-  (:use
-   [twitter.callbacks]
-   [twitter.callbacks.handlers]
-   [twitter.api.streaming])
   (:require
-   [clojure.edn :as edn]
    [clojure.string :as str]
    [clojure.data.json :as json]
    [clj-time.core :as t]
    [clojure.pprint :as pp]
    [clojure.tools.logging :as log]
-   [http.async.client :as ac]
+   [twitter.api.streaming :as tas]
    [twitter.oauth :as oauth]
+   [twitter.callbacks.handlers :as tch]
    [clojure.core.async :as async :refer [<! <!! >! >!! chan put! alts! timeout go go-loop close!]]
    [com.stuartsierra.component :as component])
-  (:import
-   (twitter.callbacks.protocols AsyncStreamingCallback)))
+  (:import (twitter.callbacks.protocols AsyncStreamingCallback)))

 (defn- creds [config] (oauth/make-oauth-creds (:consumer-key config) (:consumer-secret config)
                                               (:user-access-token config) (:user-access-token-secret config)))

-;; channels
-(def ^:private chunk-chan (chan))
-(def ^:private msg-chan (chan))
-
-;; atoms for keeping track of counts, incomplete chunk and last received timestamp
-(def ^:private last-received (atom (t/epoch)))
-(def ^:private chunk-buff (atom ""))
-(def ^:private counter (atom 0))
-
-(defn- parse [jstr tweets-chan]
+(defn- parse [jstr tweets-chan msg-chan counter]
   (try
-    (let [c @counter
-          json (json/read-json jstr)]
+    (let [c @counter  json (json/read-json jstr)]
       (when (== (mod c 1000) 0) (log/info "processed" c "since startup"))
       (if (:text json)
         (>!! tweets-chan json)
@@ -41,23 +26,17 @@
       (swap! counter inc))
     (catch Exception ex (log/error ex "JSON parsing" jstr))))

-;; loop for logging messages from Streaming API other than tweets
-(go-loop []
-         (let [m (<! msg-chan)]
-           (log/error "msg-chan" m))
-         (recur))
+(defn- run-msg-loop [msg-chan]
+  "loop for logging messages from Streaming API other than tweets"
+  (go-loop [] (let [m (<! msg-chan)]
+                (log/error "msg-chan" m))
+           (recur)))

-(defn- tweet-chunk-callback []
-  (AsyncStreamingCallback. #(>!! chunk-chan (str %2))
-                           (comp println response-return-everything)
-                           exception-print))
-
-;; loop for processing chunks from Streaming API
-(defn- processing-loop [tweets-chan]
+(defn- run-processing-loop [tweets-chan chunk-chan msg-chan chunk-buff counter last-received]
+  "loop for processing chunks from Streaming API"
   (go-loop []
            (let [ch (<! chunk-chan)
-                 buff @chunk-buff
-                 combined (str buff ch)
+                 combined (str @chunk-buff ch)
                  tweet-strings (str/split-lines combined)
                  to-process (butlast tweet-strings)
                  last-chunk (last tweet-strings)]
@@ -66,58 +45,65 @@
                (do
                  (doseq [ts to-process]
                    (when (not (str/blank? ts))
-                     (parse ts tweets-chan)))
+                     (parse ts tweets-chan msg-chan counter)))
                  (reset! chunk-buff last-chunk))
                (reset! chunk-buff combined)))
            (recur)))

-(defrecord Twitterclient [conf channels connection]
-  ;; Implement the Lifecycle protocol
+(defn- tweet-chunk-callback [chunk-chan]
+  (tas/AsyncStreamingCallback. #(>!! chunk-chan (str %2))
+                               (comp println tch/response-return-everything)
+                               tch/exception-print))
+
+(defn start-twitter-conn! [conf conn chunk-chan]
+  (log/info "Starting Twitter client.")
+  (reset! conn (tas/statuses-filter
+                :params {:track (:track conf)}
+                :oauth-creds (creds conf)
+                :callbacks (tweet-chunk-callback chunk-chan))))
+
+(defn- stop-twitter-conn! [conn chunk-buff]
+  (let [m (meta @conn)]
+    (when m
+      (log/info "Stopping Twitter client.")
+      ((:cancel m))
+      (reset! chunk-buff ""))))
+
+(defn run-watch-loop [conf conn chunk-buff chunk-chan last-received watch-active]
+  "run loop watching the twitter client and restarting it if necessary"
+  (reset! watch-active true)
+  (go-loop [] (<! (timeout 10000)) ;; check connection every 10 seconds
+           (let [since-last-sec (t/in-seconds (t/interval @last-received (t/now)))
+                 active @watch-active]
+             (when active
+               (when (> since-last-sec (:tw-check-interval-sec conf))
+                 (log/error since-last-sec "seconds since last tweet received")
+                 (stop-twitter-conn! conn chunk-buff)
+                 (<! (timeout (* (:tw-check-interval-sec conf) 1000)))
+                 (start-twitter-conn! conf conn chunk-chan))
+               (recur)))))
+
+(defrecord Twitterclient [conf channels connection chunk-buff watch-active]
   component/Lifecycle
+  (start [component]
+         (log/info "Starting Twitterclient Component")
+         (let [chunk-chan (chan)
+               msg-chan (chan)
+               conn (atom {})
+               counter (atom 0)
+               chunk-buff (atom "")
+               last-received (atom (t/epoch))
+               watch-active (atom false)]
+           (start-twitter-conn! conf conn chunk-chan)
+           (run-watch-loop conf conn chunk-buff chunk-chan last-received watch-active)
+           (run-processing-loop (:tweets channels) chunk-chan msg-chan chunk-buff counter last-received)
+           (run-msg-loop msg-chan)
+           (assoc component :connection conn :msg-chan msg-chan :chunk-chan chunk-chan :chunk-buff chunk-buff
+             :watch-active watch-active)))
+  (stop [component]
+        (log/info "Stopping Twitterclient Component")
+        (reset! watch-active false)
+        (stop-twitter-conn! connection chunk-buff)
+        (assoc component :connection nil :msg-chan nil :chunk-chan nil :chunk-buff nil :watch-active nil)))

-  (start [component]
-         (log/info "Starting Twitterclient")
-         ;; In the 'start' method, initialize this component
-         ;; and start it running. For example, connect to a
-         ;; database, create thread pools, or initialize shared
-         ;; state.
-         (let [conn (statuses-filter :params {:track (:track conf)}
-                                     :oauth-creds (creds conf)
-                                     :callbacks (tweet-chunk-callback))]
-           (reset! chunk-buff "")
-           (processing-loop (:tweets channels))
-           ;; Return an updated version of the component with
-           ;; the run-time state assoc'd in.
-           (assoc component :connection conn)))
-
-  (stop [component]
-        (log/info "stop connection to Twitter Streaming API")
-        ;; In the 'stop' method, shut down the running
-        ;; component and release any external resources it has
-        ;; acquired.
-        (let [m (meta connection)]
-          (when m
-            ((:cancel m))
-            (reset! chunk-buff "")))
-        ;; Return the component, optionally modified. Remember that if you
-        ;; dissoc one of a record's base fields, you get a plain map.
-        (assoc component :connection nil)))
-
-(defn new-twitterclient [conf]
-  "create new twitter client component"
-  (map->Twitterclient {:conf conf}))
-
-;; loop watching the twitter client and restarting it if necessary
-#_(defn watch-twitter-conn! []
-  "monitor twitter component, restart when necessary"
-  (go
-   (while true
-     (<! (timeout (* (:tw-check-interval-sec conf) 1000)))
-     (let [now (t/now)
-           since-last-sec (t/in-seconds (t/interval @last-received now))]
-       (when (> since-last-sec (:tw-check-interval-sec conf))
-         (do
-           (log/error since-last-sec "seconds since last tweet received")
-           (alter-var-root #'twitter-client component/stop)
-           (<! (timeout (* (:tw-check-interval-sec conf) 1000)))
-           (alter-var-root #'twitter-client component/start)))))))
+(defn new-twitterclient [conf] (map->Twitterclient {:conf conf}))


CMR-1812: Addressing another naming comment.

--- search-app/src/cmr/search/services/acls/granule_acls.clj
+++ search-app/src/cmr/search/services/acls/granule_acls.clj
@@ -220,8 +220,8 @@

 (defn granule-identifier-matches-concept?
   "Returns true if the granule identifier is nil or it matches the concept."
-  [gran-id concept]
-  (let [{:keys [access-value temporal]} gran-id
+  [gran-identifier concept]
+  (let [{:keys [access-value temporal]} gran-identifier
         umm-temporal (:temporal concept)]

     (and (if access-value
@@ -234,26 +234,26 @@

 (defn collection-identifier-matches-concept?
   "Returns true if the collection identifier is nil or it matches the concept."
-  [context coll-id concept]
-  (if coll-id
+  [context coll-identifier concept]
+  (if coll-identifier
     (let [collection-concept-id (:collection-concept-id concept)
           collection (coll-cache/get-collection context collection-concept-id)]
       (when-not collection
         (errors/internal-error!
           (format "Collection with id %s was in a granule but was not found using collection cache."
                   collection-concept-id)))
-      (umm-matchers/coll-matches-collection-identifier? collection coll-id))
+      (umm-matchers/coll-matches-collection-identifier? collection coll-identifier))
     true))

 (defn acl-match-concept?
   "Returns true if the acl matches the concept indicating the concept is permitted."
   [context acl concept]
   (let [{provider-id :provider-id
-         gran-id :granule-identifier
-         coll-id :collection-identifier} (:catalog-item-identity acl)]
+         gran-identifier :granule-identifier
+         coll-identifier :collection-identifier} (:catalog-item-identity acl)]
     (and (= provider-id (:provider-id concept))
-         (granule-identifier-matches-concept? gran-id concept)
-         (collection-identifier-matches-concept? context coll-id concept))))
+         (granule-identifier-matches-concept? gran-identifier concept)
+         (collection-identifier-matches-concept? context coll-identifier concept))))

 (defmethod acl-service/acls-match-concept? :granule
   [context acls concept]


fixing some schema rules references and adding example functionality to documentation

--- sidecar/src/figwheel_sidecar/config_check/type_check.clj
+++ sidecar/src/figwheel_sidecar/config_check/type_check.clj
@@ -131,10 +131,23 @@

 #_(required-keys 'FigOpts :hello :goodbye)

+(defn doc-type? [x]
+  (and (map? x)
+       (= #{:content :example} (set (keys x)))
+       (let [{:keys [example content]} x]
+         (or (fn? example)
+             (string? example)))))
+
+(defn doc-key-val [root k d]
+  (cond
+    (string?   d) [[root :doc-key k d]]
+    (doc-type? d) [[root :doc-key k (:content d)]
+                   [root :doc-key-example k (:example d)]]))
+
 (defn doc
   ([root type-doc kd]
    (cons [root :doc-type type-doc]
-         (mapv (fn [[k d]] [root :doc-key k d]) kd)))
+         (mapcat (fn [[k d]] (doc-key-val root k d)) kd)))
   ([root type-doc]
    (doc root type-doc [])))

@@ -142,7 +155,9 @@
  (doc 'FigOpts "This is a cool option"
       {
        :hello ":hello is needed to say hello"
-       :good ":good is needed to say goodbye"}))
+       :good ":good is needed to say goodbye"
+       :hey-there {:content "This is docs"
+                   :example "This is an example"}}))

 ;; Direct Implementation
 ;; this is still squirrely
@@ -1032,12 +1047,12 @@

 (defn parent-is-sequence? [{:keys [type-sig path]}]
   (and (integer? (first path))
-       ((set (map last (*schema-rules* [:=> (second type-sig)]))) :SEQQ)))
+       ((set (map last (schema-rules [:=> (second type-sig)]))) :SEQQ)))

 (defmulti predicate-explain (fn [pred _] pred))

 (defmethod predicate-explain :default [pred value]
-  (if-let [typ (first (for [[t _ p] (*schema-rules* :=)
+  (if-let [typ (first (for [[t _ p] (schema-rules :=)
                             :when (= p pred)] t))]
     (name typ)
     pred))
@@ -1259,7 +1274,7 @@
 ;; tighten up unknown-key errors to include information about current parent config

 (defn type-doc [parent-type]
-  (when-let [[_ _ d] (first (*schema-rules* [:doc-type parent-type]))]
+  (when-let [[_ _ d] (first (schema-rules [:doc-type parent-type]))]
     d))

 (declare key-doc)
@@ -1267,18 +1282,18 @@
 (defn find-key-doc [parent-type ky]
   (doall
    (concat
-    (for [[_ _ [pt _ next-type]] (*schema-rules* [:- ky])
+    (for [[_ _ [pt _ next-type]] (schema-rules [:- ky])
           :when (and pt (= pt parent-type))]
       (or (type-doc next-type)
           (first (find-key-doc next-type ky))))
-    (for [[_ _ next-type]  (*schema-rules* [:-- parent-type])
+    (for [[_ _ next-type]  (schema-rules [:-- parent-type])
           :when next-type]
       (or (type-doc next-type)
           (first (find-key-doc next-type ky)))))))

 (defn key-doc [parent-type ky]
   (first (concat
-          (for [[_ _ k d] (*schema-rules* [:doc-key parent-type])
+          (for [[_ _ k d] (schema-rules [:doc-key parent-type])
                 :when (and k (= ky k))]
             d)
           (find-key-doc parent-type ky))))


Added some !'s

Added some !'s

--- src/cljs/wombats_web_client/panels/simulator.cljs
+++ src/cljs/wombats_web_client/panels/simulator.cljs
@@ -15,7 +15,7 @@
 ;; Lifecycle Methods
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

-(defn- component-will-mount []
+(defn- component-will-mount! []
   (re-frame/dispatch [:simulator/initialized false])
   (get-simulator-templates))

@@ -31,18 +31,18 @@
 ;; Callback Methods
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

-(defn- on-code-change [evt]
+(defn- on-code-change! [evt]
   ;; Propogate the updated code into db
   (re-frame/dispatch [:simulator/update-code evt.target.value]))

-(defn- on-step-click [evt state]
+(defn- on-step-click! [evt state]
   (ws/send-message :process-simulation-frame {:game-state state}))

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; Helper methods
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

-(defn- initialize-simulator
+(defn- initialize-simulator!
   [templates wombats]
   (re-frame/dispatch [:simulator/initialize {:simulator-template-id (:simulator-template/id (first templates))
                                              :wombat-id (:wombat/id (first wombats))}]))
@@ -51,7 +51,7 @@
 ;; Render Methods
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

-(defn- render-left-pane [state]
+(defn- render-left-pane! [state]
   (let [arena-frame (get-in state [:frame :frame/arena])]
     (arena/arena arena-frame canvas-id)
     [:div {:class-name "left-pane"}
@@ -63,17 +63,17 @@
   [:div {:class-name "right-pane"}
    [:textarea
     {:id "editor"
-     :onChange #(on-code-change %)
+     :onChange #(on-code-change! %)
      :value (or (get-player-code state) "")}]
-   [:button {:onClick #(on-step-click % state)}
+   [:button {:onClick #(on-step-click! % state)}
     "Step"]])

 (defn- render! [initialized? state templates wombats]
   (when (and (not initialized?) templates wombats)
-    (initialize-simulator templates wombats))
+    (initialize-simulator! templates wombats))

   [:div {:class-name "simulator-panel"}
-   [render-left-pane state]
+   [render-left-pane! state]
    [render-right-pane state]])

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -86,6 +86,6 @@
         sim-templates (re-frame/subscribe [:simulator/templates])
         wombats (re-frame/subscribe [:my-wombats])]
     (reagent/create-class
-     {:component-will-mount #(component-will-mount)
+     {:component-will-mount #(component-will-mount!)
       :props-name "simulator-panel"
       :reagent-render #(render! @sim-initialized? @sim-state @sim-templates @wombats)})))


CMR-132: Removed a comment.

CMR-132: Removed a comment.

--- src/cmr/metadata_db/services/concept_services.clj
+++ src/cmr/metadata_db/services/concept_services.clj
@@ -25,7 +25,7 @@
   )

 (defn- set-or-generate-concept-id
-  "Get an exiting concept-id from the DB for the given concept or generate one
+  "Get an existing concept-id from the DB for the given concept or generate one
   if the concept has never been saved."
   [db concept]
   (if (:concept-id concept)
@@ -46,8 +46,7 @@
           revision-id (if existing-revision-id (inc existing-revision-id) 0)]
       (assoc concept :revision-id revision-id))))

-;;; TODO move this to the services layer
-(defn- validate-concept-revision-id
+(defn validate-concept-revision-id
   "Validate that the revision-id for a concept (if given) is one greater than
   the current maximum revision-id for this concept."
   [db concept previous-revision]
@@ -66,8 +65,6 @@
                                messages/invalid-revision-id-msg
                                0
                                revision-id))))))
-
-

 (defn- set-deleted-flag [value concept] (assoc concept :deleted value))

@@ -99,7 +96,6 @@
       ; FIXME there might be a case where two first revision of a collection come in at the same time
       ;; they might accidentally get different concept ids. We'd need to recur then.
       )))
-

 (defn- try-to-save
   "Try to save a concept by looping until we find a good revision-id or give up."


CMR-3781: Add ACLs, tags, groups, and humanizers to the list of concept types that are checked for NULL metadata replication errors.

--- bootstrap-app/src/cmr/bootstrap/services/replication.clj
+++ bootstrap-app/src/cmr/bootstrap/services/replication.clj
@@ -89,7 +89,9 @@
      (into (when (contains? (set concept-types) :granule) ["small_prov_granules"]))
      (into (when (contains? (set concept-types) :service) ["small_prov_services"]))
      (into (when (contains? (set concept-types) :access-group) ["cmr_groups"]))
-     (into (when (contains? (set concept-types) :tag) ["cmr_tags"]))))))
+     (into (when (contains? (set concept-types) :acl) ["cmr_acls"]))
+     (into (when (contains? (set concept-types) :tag) ["cmr_tags"]))
+     (into (when (contains? (set concept-types) :humanizer) ["cmr_humanizers"]))))))

 (defn fix-null-replicated-concepts-query-str
@@ -107,7 +109,9 @@
   "AWS DMS is replicating BLOBs that are over 4K in size as NULL. We need to identify all of them
   and fix them."
   [db revision-datetime]
-  (let [all-tables (apply conj (get-concept-tablenames db :collection) (tables-with-null-blobs))]
+  (let [all-tables (apply conj (get-concept-tablenames db :collection :service :access-group :acl
+                                                       :tag :humanizer)
+                          (tables-with-null-blobs))]
     (doseq [table all-tables]
       (let [curr-time (System/currentTimeMillis)
             stmt (fix-null-replicated-concepts-query-str table revision-datetime)]


update/rollback order view info #212

update/rollback order view info
#212

--- src/cljs/swarmpit/component/service/info/deployment.cljs
+++ src/cljs/swarmpit/component/service/info/deployment.cljs
@@ -16,9 +16,11 @@
   (let [autoredeploy (:autoredeploy deployment)
         update-delay (get-in deployment [:update :delay])
         update-parallelism (get-in deployment [:update :parallelism])
+        update-order (get-in deployment [:update :order])
         update-failure-action (get-in deployment [:update :failureAction])
         rollback-delay (get-in deployment [:rollback :delay])
         rollback-parallelism (get-in deployment [:rollback :parallelism])
+        rollback-order (get-in deployment [:rollback :order])
         rollback-failure-action (get-in deployment [:rollback :failureAction])
         placement (:placement deployment)
         restart-policy-condition (get-in deployment [:restartPolicy :condition])
@@ -27,8 +29,8 @@
     [:div.form-layout-group.form-layout-group-border
      (form/section "Deployment")
      (form/item "AUTOREDEPLOY" (if autoredeploy
-                                      "on"
-                                      "off"))
+                                 "on"
+                                 "off"))
      (if (not-empty placement)
        [:div
         (form/subsection "Placement")
@@ -42,10 +44,12 @@
      (form/subsection "Update Config")
      (form/item "PARALLELISM" update-parallelism)
      (form/item "DELAY" (str update-delay "s"))
+     (form/item "ORDER" update-order)
      (form/item "ON FAILURE" update-failure-action)
      (if (= "rollback" update-failure-action)
        [:div
         (form/subsection "Rollback Config")
         (form/item "PARALLELISM" rollback-parallelism)
         (form/item "DELAY" (str rollback-delay "s"))
+        (form/item "ORDER" rollback-order)
         (form/item "ON FAILURE" rollback-failure-action)])]))


Bug in clusters

Bug in clusters

--- src/clusters.clj
+++ src/clusters.clj
@@ -67,7 +67,7 @@
            iter max-iters]
       ; make sure we don't use clusters where k < k
       (let [new-clusters (cluster-step data-iter k clusters)]
-        (if (or (= iter 0) (same-clustering? )
+        (if (= iter 0)
         ;(if (or (= iter 0) (same-clustering? new-clusters clusters))
           new-clusters
           (recur new-clusters (dec iter)))))))


refactoring of PareditAutoEditStrategy

refactoring of PareditAutoEditStrategy

--- ccw.core/src/ccw/editors/antlrbased/PareditAutoEditStrategy.clj
+++ ccw.core/src/ccw/editors/antlrbased/PareditAutoEditStrategy.clj
@@ -24,6 +24,22 @@
    "}" :paredit-close-curly
    "\"" :paredit-doublequote})

+(defn- call-paredit [command document-text]
+  (cond
+    (and (zero? (:length command))
+         (contains? *one-char-command* (:text command)))
+      (paredit (get *one-char-command* (:text command))
+               {:text document-text
+                :offset (:offset command)
+                :length 0})
+    (and (zero? (-> command :text .length))
+         (= 1 (:length command)))
+      (paredit :paredit-forward-delete ; TODO how to distinguish from forward delete and backward delete ?
+               {:text document-text
+                :offset (:offset command)
+                :length 1})))
+
+
 (defn paredit-enabled?
   [#^org.eclipse.jface.preference.IPreferenceStore prefs-store]
   (.getBoolean prefs-store ccw.preferences.PreferenceConstants/ACTIVATE_PAREDIT))
@@ -31,14 +47,11 @@
 (defn -customizeDocumentCommand
   [#^IAutoEditStrategy this, #^IDocument document, #^DocumentCommand command]
   (when (and (paredit-enabled? (-> this .state deref :prefs-store))
-             (.doit command)
-             (= 0 (.length command))
-             (contains? *one-char-command* (.text command)))
-    (let [result (paredit (get *one-char-command* (.text command))
-                          {:text (.get document)
-                           :offset (.offset command)
-                           :length 0})]
-      (when (not= :ko (-> result :parser-state))
+             (.doit command))
+    (let [document-text (.get document)
+          par-command {:text (.text command) :offset (.offset command) :length (.length command)}
+          result (call-paredit par-command document-text)]
+      (when (and result (not= :ko (-> result :parser-state)))
         (if-let [modif (-?> result :modifs first)]
           (do
             (set! (.offset command) (-> result :modifs first :offset))


"unknown user" makes it look ugly

"unknown user" makes it look ugly

--- src/org/zalando/stups/friboo/zalando_specific/auth.clj
+++ src/org/zalando/stups/friboo/zalando_specific/auth.clj
@@ -32,7 +32,7 @@
 (defn get-auth
   "Convenience wrapper around fetch-auth, with logging"
   [{:as this :keys [configuration]}
-   {:as tokeninfo :strs [access_token realm uid] :or {uid "unknown user"}}
+   {:as tokeninfo :strs [access_token realm uid]}
    payload]
   (if-not (:magnificent-url configuration)
     ;; Don't log anything
@@ -44,7 +44,7 @@
 (defn require-auth
   "Like get-auth, but throws an error if user has no access"
   [this
-   {:as tokeninfo :strs [uid] :or {uid "unknown user"}}
+   {:as tokeninfo :strs [uid]}
    payload]
   (when-not (get-auth this tokeninfo payload)
     (api/throw-error 403 "ACCESS DENIED" {:payload payload :user uid})))


Clean up pepa.api/xhr-request! some more.

--- src-cljs/pepa/api.cljs
+++ src-cljs/pepa/api.cljs
@@ -4,12 +4,12 @@

             [clojure.string :as s]
             [goog.string :as gstring]
-
+
             [om.core :as om]
             [pepa.data :as data]

             [clojure.browser.event :as event])
-  (:import [goog.net XhrIo XmlHttp XmlHttpFactory])
+  (:import [goog.net XhrIo XmlHttp XmlHttpFactory EventType])
   (:require-macros [cljs.core.async.macros :refer [go go-loop]]))

 (def +xhr-timeout+ (* 5 1000))
@@ -59,31 +59,34 @@

   Returns a channel containing something."
   ([uri method content-type data timeout & [progress]]
-   (let [ch (async/chan)]
-     (assert uri)
-     (let [factory (xhr-factory-dummy)
-           xhr (XhrIo. factory)]
-       (let [put! (fn [d] (when progress (async/put! progress d)))]
-         (doto (.-upload (.createInstance factory))
-           (.addEventListener "progress" #(put! (/ (.-loaded %) (.-total %))))
-           (.addEventListener "load "    #(put! :loaded))
-           (.addEventListener "error"    #(put! :error))
-           (.addEventListener "abort"    #(put! :abort))))
-       (doto xhr
-         (.setTimeoutInterval timeout)
-         (event/listen "complete" (fn [e]
-                                    (when progress
-                                      (async/close! progress))
-                                    (async/put! ch (parse-xhr-response e.target))))
-         (.send uri
-                (s/upper-case (name method))
-                (if (= "application/transit+json" content-type)
-                  (transit/write writer data)
-                  data)
-                (clj->js
-                 (merge {"Accept" "application/transit+json"
-                         "Accept-Charset" "utf-8"}
-                        (when data {"Content-Type" (when data content-type)}))) )))
+   {:pre [(string? uri)
+          (keyword? method)
+          (string? content-type)]}
+   (let [ch (async/chan)
+         factory (xhr-factory-dummy)
+         xhr (XhrIo. factory)]
+     ;; Request load/error/abort requests
+     (let [upload (.-upload (.createInstance factory))
+           put! (fn [d] (when progress (async/put! progress d)))]
+       (doseq [[type f] [[EventType.PROGRESS #(put! (/ (.-loaded %) (.-total %)))]
+                         [EventType.LOAD     #(put! :loaded)]
+                         [EventType.ERROR    #(put! :error)]
+                         [EventType.ABORT    #(put! :abort)]]]
+         (.addEventListener upload type f)))
+     (doto xhr
+       (.setTimeoutInterval timeout)
+       (event/listen EventType.COMPLETE
+                     (fn [e]
+                       (when progress (async/close! progress))
+                       (async/put! ch (parse-xhr-response e.target))))
+       (.send uri
+              (s/upper-case (name method))
+              (if (= "application/transit+json" content-type)
+                (transit/write writer data)
+                data)
+              (clj->js
+               (merge {"Accept" "application/transit+json"}
+                      (when data {"Content-Type" (when data content-type)}))) ))
      ch))
   ([uri method content-type data]
    (xhr-request! uri method content-type data +xhr-timeout+))
@@ -203,7 +206,7 @@
                                          :post
                                          {:title title, :tags tags}))]
           (if (= 200 (:status response))
-            (let [new-document (-> response
+            (let [new-document (-> response
                                    :response/transit
                                    (db-document->Document))]
               (data/store-document! new-document)


Fix warning in macOS Nix cache build

Fix warning in macOS Nix cache build

Signed-off-by: Pedro Pombeiro <f8c34e1c5d363d76a4b9e8313641f62c1029c3e7@users.noreply.github.com>

--- src/status_im/ui/screens/keycard/onboarding/views.cljs
+++ src/status_im/ui/screens/keycard/onboarding/views.cljs
@@ -11,7 +11,8 @@
             [status-im.ui.components.common.common :as components.common]
             [status-im.ui.components.styles :as components.styles]
             [status-im.ui.components.text-input.view :as text-input]
-            [status-im.ui.components.tooltip.views :as tooltip]))
+            [status-im.ui.components.tooltip.views :as tooltip]
+            [status-im.ui.screens.hardwallet.pin.views :as pin.views]))

 (defn intro []
   [react/view styles/container
@@ -330,7 +331,7 @@
                            :margin-bottom 30}}
        (i18n/label :t/open-nfc-settings)]]]]])

-(def pin status-im.ui.screens.hardwallet.pin.views/create-pin)
+(def pin pin.views/create-pin)

 (defview recovery-phrase []
   (letsubs [mnemonic [:hardwallet-mnemonic]]


bugfix admin filter

bugfix admin filter

--- resources/leiningen/new/closp/clj/routes/user.clj
+++ resources/leiningen/new/closp/clj/routes/user.clj
@@ -33,8 +33,9 @@
   (vali-password? pass confirm)
   (not (vali/errors? :id :pass :confirm)))

-(defn admin-page [& [filter]]
-  (layout/render "user/admin.html" {:users (db/get-all-users filter) :roles available-roles}))
+(defn admin-page [params]
+  (layout/render "user/admin.html" (merge {:users (db/get-all-users (get params :filter)) :roles available-roles}
+                                          params)))

 (defn login-page [& [content]]
   (layout/render "user/login.html" content))


[CS] queue/initialize returns sets (no order!)

--- resources/leiningen/new/kraken/queue.clj
+++ resources/leiningen/new/kraken/queue.clj
@@ -31,8 +31,8 @@
                   "{{name}}.ok"
                   (config :rabbitmq :queues "{{name}}.ok"))
       (k/responder ok-ch "{{name}}.ok" handlers/ok)
-      {:connections [@connection]
-       :channels [ok-ch]})))
+      {:connections #{@connection}
+       :channels #{ok-ch}})))

 (defn close-resources! [resources]
   (doseq [resource resources]


[PATCH] This happened because the service failure handling is to ham handed

--- test/layzee/integration/storage/simple_db_examples.clj
+++ test/layzee/integration/storage/simple_db_examples.clj
@@ -21,7 +21,7 @@
        (fact "Getting something that does not exist returns nil"
              (simple-db/get amazon-credential domain "xxx-does-not-exist-xxx") => nil)

-       (fact "Adding to non-existent domain fails with error"
+       (future-fact "Adding to non-existent domain fails with error"
              (simple-db/set amazon-credential "xxx-domain-does-not-exist-xxx" "I used to have a fear of hurdles" "But I got over it") => (throws Exception #"The specified domain does not exist"))

        (fact "You can list domains"


Satisfy clj-kondo

Satisfy clj-kondo

--- test/refactor_nrepl/ns/slam/hound/regrow_test.clj
+++ test/refactor_nrepl/ns/slam/hound/regrow_test.clj
@@ -4,10 +4,10 @@
    [clojure.test :refer [deftest is]]))

 (deftest works
-  (is ('#{#{java.lang.Thread sun.jvm.hotspot.runtime.Thread}
-          #{java.lang.Thread}}
-       (sut/candidates :import 'Thread [] {})))
+  (is (contains? '#{#{java.lang.Thread sun.jvm.hotspot.runtime.Thread}
+                    #{java.lang.Thread}}
+                 (sut/candidates :import 'Thread [] {})))

-  (is ('#{#{clojure.core}
-          #{clojure.core cljs.core}}
-       (sut/candidates :refer 'areduce [] {}))))
+  (is (contains? '#{#{clojure.core}
+                    #{clojure.core cljs.core}}
+                 (sut/candidates :refer 'areduce [] {}))))


statsd reporter fix

statsd reporter fix

--- trackit-statsd/src/samsara/trackit/reporter_statsd.clj
+++ trackit-statsd/src/samsara/trackit/reporter_statsd.clj
@@ -1,98 +1,20 @@
-(ns samsara.trackit.reporter
+(ns samsara.trackit.reporter-statsd
   (:import  [java.util.concurrent TimeUnit]
             [com.codahale.metrics MetricFilter])
-  (:require [metrics.reporters.console :as console]
-            #_[metrics.reporters.ganglia :as ganglia])
-  #_(:require [metrics.reporters.graphite :as graphite]
-            #_[metrics.reporters.ganglia :as ganglia])
-  #_(:import  [com.codahale.metrics.ganglia GangliaReporter]
-            [info.ganglia.gmetric4j.gmetric GMetric GMetric$UDPAddressingMode])
-  #_(:import  [com.codahale.metrics.riemann RiemannReporter Riemann]
-            [com.aphyr.riemann.client RiemannClient TcpTransport])
-
-  #_(:import  [com.bealetech.metrics.reporting StatsdReporter Statsd]))
-
-(defmulti start-reporting (fn [registry cfg] (:type cfg)))
+  (:require [samsara.trackit.reporter])
+  (:import  [com.bealetech.metrics.reporting StatsdReporter Statsd]))

+(defmethod samsara.trackit.reporter/start-reporting :statsd
+  [registry
+   {:keys [reporting-frequency-seconds host port prefix rate-unit duration-unit]
+    :or  {reporting-frequency-seconds 10, host "localhost", port 8125, prefix "trackit"
+          rate-unit TimeUnit/SECONDS, duration-unit TimeUnit/MILLISECONDS} :as cfg}]

-(defmethod start-reporting :default [registry cfg]
-  (println "TRACKit!: no reporting method selected."))
-
-
-
-(defmethod start-reporting :console
-  [registry
-   {:keys [reporting-frequency-seconds stream rate-unit duration-unit]
-    :or  {reporting-frequency-seconds 300, stream (System/err)
-          rate-unit TimeUnit/SECONDS, duration-unit TimeUnit/MILLISECONDS} :as cfg}]
-  (console/start
-   (console/reporter registry cfg)
-   reporting-frequency-seconds))
-
-
-(comment
-  (defmethod start-reporting :graphite
-    [registry
-     {:keys [reporting-frequency-seconds host port prefix rate-unit duration-unit]
-      :or  {reporting-frequency-seconds 10, host "localhost", port 2003, prefix "trackit"
-            rate-unit TimeUnit/SECONDS, duration-unit TimeUnit/MILLISECONDS} :as cfg}]
-    (require 'metrics.reporters.graphite)
-    (graphite/start
-     (graphite/reporter registry cfg)
-     reporting-frequency-seconds)))
-
-(comment
-  (defmethod start-reporting :statsd
-    [registry
-     {:keys [reporting-frequency-seconds host port prefix rate-unit duration-unit]
-      :or  {reporting-frequency-seconds 10, host "localhost", port 8125, prefix "trackit"
-            rate-unit TimeUnit/SECONDS, duration-unit TimeUnit/MILLISECONDS} :as cfg}]
-
-    (-> (StatsdReporter/forRegistry registry)
-        (.prefixedWith prefix)
-        (.convertDurationsTo duration-unit)
-        (.convertRatesTo rate-unit)
-        (.filter MetricFilter/ALL)
-        (.build (Statsd. host port))
-        (.start reporting-frequency-seconds TimeUnit/SECONDS))))
-
-
-(comment
-  (defmethod start-reporting :riemann
-    [registry
-     {:keys [reporting-frequency-seconds host port prefix rate-unit duration-unit]
-      :or  {reporting-frequency-seconds 10, host "localhost", port 5555, prefix "trackit"
-            rate-unit TimeUnit/SECONDS, duration-unit TimeUnit/MILLISECONDS} :as cfg}]
-
-    (let [;; tell Riemann client to do not cache the dns name
-          rc (Riemann.
-              (RiemannClient.
-               (doto
-                   (TcpTransport. host (int port))
-                 (-> .-cacheDns (.set false)))))]
-      (-> (RiemannReporter/forRegistry registry)
-          (.prefixedWith prefix)
-          (.convertDurationsTo duration-unit)
-          (.convertRatesTo rate-unit)
-          (.useSeparator ".")
-          (.filter MetricFilter/ALL)
-          (.build rc)
-          (.start reporting-frequency-seconds TimeUnit/SECONDS))))
-
-
-
-  (defmethod start-reporting :ganglia
-    [registry
-     {:keys [reporting-frequency-seconds host port prefix rate-unit duration-unit]
-      :or  {reporting-frequency-seconds 60, host "localhost", port 8649, prefix "trackit"
-            rate-unit TimeUnit/SECONDS, duration-unit TimeUnit/MILLISECONDS} :as cfg}]
-
-    (-> (GangliaReporter/forRegistry registry)
-        (.prefixedWith prefix)
-        (.convertDurationsTo duration-unit)
-        (.convertRatesTo rate-unit)
-        (.filter MetricFilter/ALL)
-        (.build (GMetric. host (int port) GMetric$UDPAddressingMode/MULTICAST 1))
-        (.start reporting-frequency-seconds TimeUnit/SECONDS)))
-  )
+  (-> (StatsdReporter/forRegistry registry)
+      (.prefixedWith prefix)
+      (.convertDurationsTo duration-unit)
+      (.convertRatesTo rate-unit)
+      (.filter MetricFilter/ALL)
+      (.build (Statsd. host port))
+      (.start reporting-frequency-seconds TimeUnit/SECONDS)))


CMR-3839 Fix indentation

CMR-3839 Fix indentation

--- search-app/src/cmr/search/api/request_context_user_augmenter.clj
+++ search-app/src/cmr/search/api/request_context_user_augmenter.clj
@@ -12,11 +12,11 @@
   [cmr.transmit.echo.tokens :as tokens]))

 (def CACHE_TIME
-  "The number of milliseconds token information will be cached for."
-  (* 5 60 1000))
+ "The number of milliseconds token information will be cached for."
+ (* 5 60 1000))

 (def token-sid-cache-name
-  :token-sid)
+ :token-sid)

 (def token-user-id-cache-name
  :token-user-id)


Run render functions in new pods each run.

Closes #3

--- src/io/perun.clj
+++ src/io/perun.clj
@@ -179,17 +179,24 @@
 (def ^:private +render-defaults+
   {:out-dir "public"})

+(defn- render-in-pod [pod sym file]
+  {:pre [(symbol? sym) (namespace sym)]}
+  (pod/with-eval-in pod
+    (require '~(symbol (namespace sym)))
+    ((resolve '~sym) ~file)))
+
 (deftask render
   "Render pages"
   [o out-dir  OUTDIR   str  "The output directory"
-   r renderer RENDERER code "Page renderer"]
-  (let [tmp     (boot/tmp-dir!)
-        options (merge +render-defaults+ *opts*)
-        render-fn (:renderer options)]
-    (boot/with-pre-wrap fileset
-      (let [files (vals (get-perun-meta fileset))]
+   r renderer RENDERER sym  "Page renderer. Must be fully qualified symbol which resolves to a function."]
+  (let [pods    (pod/pod-pool (boot/get-env))
+        tmp     (boot/tmp-dir!)
+        options (merge +render-defaults+ *opts*)]
+    (boot/with-pre-wrap fileset
+      (let [pod   (pods :refresh)
+            files (vals (get-perun-meta fileset))]
         (doseq [file files]
-          (let [html          (render-fn file)
+          (let [html          (render-in-pod pod renderer file)
                 page-filepath (perun/create-filepath
                                 (:out-dir options)
                                 (or (perun/url-to-path (:permalink file))
@@ -207,19 +214,20 @@
 (deftask collection
   "Render collection files"
   [o out-dir    OUTDIR     str  "The output directory"
-   r renderer   RENDERER   code "Page renderer"
+   r renderer   RENDERER   sym  "Page renderer. Fully qualified symbol resolving to a function."
    f filterer   FILTER     code "Filter function"
    s sortby     SORTBY     code "Sort by function"
    c comparator COMPARATOR code "Sort by comparator function"
    p page       PAGE       str  "Collection result page path"]
-  (let [tmp       (boot/tmp-dir!)
-        options   (merge +collection-defaults+ *opts*)
-        render-fn (:renderer options)]
-    (boot/with-pre-wrap fileset
-      (let [files          (vals (get-perun-meta fileset))
+  (let [pods      (pod/pod-pool (boot/get-env))
+        tmp       (boot/tmp-dir!)
+        options   (merge +collection-defaults+ *opts*)]
+    (boot/with-pre-wrap fileset
+      (let [pod            (pods :refresh)
+            files          (vals (get-perun-meta fileset))
             filtered-files (filter (:filterer options) files)
-            sorted-files   (sort-by (:sortby options) (:comparator options) filtered-files)
-            html           (render-fn sorted-files)
+            sorted-files   (vec (sort-by (:sortby options) (:comparator options) filtered-files))
+            html           (render-in-pod pod renderer sorted-files)
             page-filepath  (perun/create-filepath (:out-dir options) page)]
         (perun/create-file tmp page-filepath html)
         (u/info (str "Render collection " page "\n"))


CMR-599: Modified to return http status code 400 (Bad Request) when searching for granules in DIF format.

--- search-app/src/cmr/search/api/routes.clj
+++ search-app/src/cmr/search/api/routes.clj
@@ -4,6 +4,7 @@
             [compojure.core :refer :all]
             [clojure.string :as str]
             [clojure.java.io :as io]
+            [clojure.set :as set]
             [ring.util.response :as r]
             [ring.util.request :as request]
             [ring.util.codec :as codec]
@@ -171,13 +172,27 @@
      ;; set the default format to xml
      (mt/mime-type->format mime-type default-mime-type))))

+(defn- get-search-results-format-by-concept
+  "Establishes valid mime types by concept and delegates requested search results format determination to get-search-results-format fn."
+  [concept-type path-w-extension headers default-mime-type]
+  (let [invalid-gran-mime-types #{"application/dif+xml"}
+        invalid-coll-mime-types #{}
+        gran-mime-types (set/difference search-result-supported-mime-types invalid-gran-mime-types)
+        coll-mime-types (set/difference search-result-supported-mime-types invalid-coll-mime-types)]
+    (cond
+      (= :collection concept-type)
+      (get-search-results-format path-w-extension headers coll-mime-types default-mime-type)
+      (= :granule concept-type)
+      (get-search-results-format path-w-extension headers gran-mime-types default-mime-type)
+      :else (get-search-results-format path-w-extension headers default-mime-type))))
+
 (defn process-params
   "Processes the parameters by removing unecessary keys and adding other keys like result format."
   [params path-w-extension headers default-mime-type]
-   (-> params
-       (dissoc :path-w-extension)
-       (dissoc :token)
-       (assoc :result-format (get-search-results-format path-w-extension headers default-mime-type))))
+  (-> params
+      (dissoc :path-w-extension)
+      (dissoc :token)
+      (assoc :result-format (get-search-results-format path-w-extension headers default-mime-type))))

 (defn- search-response
   "Generate the response map for finding concepts by params or AQL."
@@ -196,7 +211,7 @@
             context (-> context
                         (acl/add-authentication-to-context params headers)
                         (assoc :query-string query-string))
-            params (process-params params path-w-extension headers "application/xml")
+            params (process-params concept-type params path-w-extension headers "application/xml")
             result-format (:result-format params)
             _ (info (format "Searching for %ss from client %s in format %s with params %s."
                             (name concept-type) (:client-id context) result-format


Use correct map key

Use correct map key

--- src/io/perun.clj
+++ src/io/perun.clj
@@ -846,7 +846,7 @@
                                  (let [path (str tag ".html")]
                                    (-> result
                                        (update-in [path :entries] conj entry)
-                                       (assoc-in [path :group-meta :tag] tag))))
+                                       (assoc-in [path :entry :tag] tag))))
                                {})))]
     (assortment-pre-wrap {:task-name "tags"
                           :tracer :io.perun/tags


:sparkles: Show correct kb shortcuts for zoom

--- frontend/src/uxbox/main/ui/workspace/header.cljs
+++ frontend/src/uxbox/main/ui/workspace/header.cljs
@@ -54,11 +54,11 @@
        [:li {:on-click on-decrease}
         "Zoom out" [:span "-"]]
        [:li {:on-click on-zoom-to-50}
-        "Zoom to 50%"]
+        "Zoom to 50%" [:span "Shift + 0"]]
        [:li {:on-click on-zoom-to-100}
-        "Zoom to 100%" [:span "Shift + 0"]]
+        "Zoom to 100%" [:span "Shift + 1"]]
        [:li {:on-click on-zoom-to-200}
-        "Zoom to 200%"]]]]))
+        "Zoom to 200%" [:span "Shift + 2"]]]]]))


Stop web app auto-reloading namespaces.

Stop web app auto-reloading namespaces.

--- src/afterglow/core.clj
+++ src/afterglow/core.clj
@@ -5,7 +5,6 @@
   (:require
     [afterglow.web.handler :refer [app]]
     [afterglow.web.session :as session]
-    [ring.middleware.reload :as reload]
     [org.httpkit.server :as http-kit]
     [environ.core :refer [env]]
     [clojure.tools.cli :refer [parse-opts]]
@@ -99,7 +98,7 @@
   (when @web-server (throw (IllegalStateException. "Web UI server is already running.")))
   (reset! web-server
           (http-kit/run-server
-           (if (env :dev) (reload/wrap-reload #'app) app)
+           app
            {:port port}))
   ;;Start the expired session cleanup job
   (reset! session-cleaner (session/start-cleanup-job!)))


s/fo/get-string-1/

--- src/babel/english/morphology.clj
+++ src/babel/english/morphology.clj
@@ -50,8 +50,9 @@
         (get-in input [:a])
         (get-in input [:b]))
    (str (string/join " "
-                     (list (fo (get-in input [:a]))
-                           (fo (get-in input [:b])))))
+                     (list (get-string-1 (get-in input [:a]))
+                           (get-string-1 (get-in input [:b])))))
+
    (or (seq? input)
        (vector? input))
    (str "(" (string/join " , "


standardize (defn generate)

standardize (defn generate)

--- src/babel/espanol.cljc
+++ src/babel/espanol.cljc
@@ -49,10 +49,10 @@
   ((:lookup (medium)) lexeme))

 (defn generate
-  [spec & [model
-           {:keys [max-total-depth truncate-children]
-            :or {max-total-depth generate/max-total-depth
-                 truncate-children true}}]]
+  [spec & {:keys [max-total-depth model truncate-children]
+           :or {model (medium)
+                max-total-depth generate/max-total-depth
+                truncate-children true}}]
   (log/debug (str "generating with spec: " (strip-refs spec) " with max-total-depth: " max-total-depth))
   (let [model (if model model (medium))]
     (let [result (generate/generate spec model


Added back accidentally removed download.

--- src/clj/popchange/lib/raster_calculation_ajax.clj
+++ src/clj/popchange/lib/raster_calculation_ajax.clj
@@ -150,6 +150,8 @@
     [:strong
      [:a {:href (:pdf-url params) :target "_blank"} "Download PDF"]]
     [:br]
+    [:a {:href (:img-src-png params) :target "_blank"} "Download PNG"]
+    [:br]
     [:a {:href (:img-src-tiff params) :target "_blank"} "Download GeoTIFF"]
     [:br]
     [:a {:href (:img-src-shp params) :target "_blank"} "Download Shapefile"]


Move view attendees button

Move view attendees button

--- src/cljs/elevent_client/pages/events/id/core.cljs
+++ src/cljs/elevent_client/pages/events/id/core.cljs
@@ -210,10 +210,7 @@
       (when can-check-in
         [:div.ui.vertical.segment
          [:h2.ui.header
-          "Attendees"
-          [:a.ui.right.floated.small.button
-           {:href (routes/event-attendees event)}
-           "View"]]
+          "Attendees"]
          [:table.ui.table
           [:thead
            [:tr
@@ -241,9 +238,9 @@
           [:tfoot
            [:tr
             [:th {:colSpan "4"}
-             [:div.ui.right.floated.small.labeled.icon.button
-              [:i.edit.icon]
-              "Edit"]]]]]])
+             [:a.ui.right.floated.small.button
+              {:href (routes/event-attendees event)}
+              "View all"]]]]]])
       [:div.ui.vertical.segment
        [:h2 "Your Schedule"]
        [schedule/component scheduled-activities


added linux to prevent possible confusion

--- src-cljs/frontend/components/header.cljs
+++ src-cljs/frontend/components/header.cljs
@@ -337,7 +337,7 @@
             [:div "Projects utilizing more containers generally have faster builds and less queueing. "
              [:a {:on-click #(raise! owner [:activate-plan-trial event-data])}
               "Click here "]
-             "to activate a free two-week trial of 3 additional containers."]]
+             "to activate a free two-week trial of 3 additional linux containers."]]
            [:a.dismiss {:on-click #(raise! owner [:dismiss-trial-offer-banner event-data])}
             [:i.material-icons "clear"]]])))))


up arrow centered

up arrow centered

--- src/checkmate/views/overview.clj
+++ src/checkmate/views/overview.clj
@@ -40,4 +40,9 @@
               [:div#msg]]]
             [:div.row
              [:div.col-md-12
-              (render-group grouped)]]]}))
+              (render-group grouped)]]
+            [:div.row
+             [:div.col-md-4.col-xs-5]
+             [:div.col-md-4.col-xs-4
+              [:a {:href "#top"} [:span.glyphicon.glyphicon-arrow-up]]]]
+            ]}))


Enables access selection for Hades Shard

Fixes stealing multiple agendas against Haarpsichord.

--- src/clj/game/cards-resources.clj
+++ src/clj/game/cards-resources.clj
@@ -240,7 +240,7 @@
    {:abilities [{:msg "access all cards in Archives"
                  :effect (req (trash state side card {:cause :ability-cost})
                               (swap! state update-in [:corp :discard] #(map (fn [c] (assoc c :seen true)) %))
-                              (handle-access state side (get-in @state [:corp :discard])))}]
+                              (resolve-ability state :runner (choose-access (get-in @state [:corp :discard]) '(:archives)) card nil))}]
     :install-cost-bonus (req (if (and run (= (:server run) [:archives]) (= 0 (:position run)))
                                [:credit -7 :click -1] nil))
     :effect (req (when (and run (= (:server run) [:archives]) (= 0 (:position run)))


def-dir

def-dir

--- src/ci3/agent/core.clj
+++ src/ci3/agent/core.clj
@@ -77,11 +77,9 @@
   (println "STEP:" (:type step) (pr-str step))
   (println "------------------------------")
   (let [start (System/nanoTime)
+        dir (or dir "/workspace/repo/")
         result (sh/with-sh-env (or (:env env) {})
-                 (if dir
-                   (sh/with-sh-dir dir
-                     (execute step env))
-                   (execute step env)))]
+                   (sh/with-sh-dir dir (execute step env)))]
     (println "------------------------------")
     (println "step done in " (humanize/duration (/ (- (System/nanoTime) start) 1000000) {:number-format str}))


CMR-8376: add info log for when the prototype feature toggle environment variable is detected

--- common-lib/src/cmr/common/config.clj
+++ common-lib/src/cmr/common/config.clj
@@ -3,6 +3,7 @@
   through an environment variable. Configuration items should be added using the defconfig macro."
   (:require
    [camel-snake-kebab.core :as csk]
+   [cmr.common.log :as log :refer [debug info warn error]]
    [cheshire.core :as json]
    [clojure.edn :as edn]
    [clojure.set :as set]
@@ -215,6 +216,15 @@
   {:default false
    :type Boolean})

+(defconfig approved-pipeline-documents
+  "This is the feature toggle for the new document pipeline prototype, as well as serving as
+   the base truth list of approved document types.
+   This string should contain JSON that looks like:
+   {'grid': ['0.0.1'],
+    'variable': ['1.8.0']}"
+  {:default ""
+   :parser #(json/parse-string % true)})
+
 (defn check-env-vars
   "Checks any environment variables starting with CMR_ are recognized as known environment variables.
   If any are unrecognized a warning message is logged. Usually this should be called at the start
@@ -236,9 +246,5 @@
          true)
        false))))

-(defconfig approved-pipeline-documents
-  "This string should contain JSON that looks like:
-   {'grid': ['0.0.1'],
-    'variable': ['1.8.0']}"
-  {:default ""
-   :parser #(json/parse-string % true)})
+(when (seq (approved-pipeline-documents))
+  (info "Prototype feature toggle detected"))


Lein: Add lib-dev profile, for easier release to clojars

--- clojure/lein.symlink/profiles.clj
+++ clojure/lein.symlink/profiles.clj
@@ -10,4 +10,19 @@
                   [lein-try "0.4.3"]
                   [cider/cider-nrepl "0.8.2"]
                   [lein-ancient "0.6.7"]
-                  [lein-pprint "1.1.1"]]}}
+                  [lein-pprint "1.1.1"]]}
+ :lib-dev {
+           :gsub-version/files #{"README.md"}
+           :release-tasks [["clean"]
+                           ["vcs" "assert-committed"]
+                           ["change" "version"
+                            "leiningen.release/bump-version" "release"]
+                           ["gsub-version"]
+                           ["vcs" "commit"]
+                           ["vcs" "tag"]
+                           ["deploy"]
+                           ["change" "version" "leiningen.release/bump-version"]
+                           ["vcs" "commit"]
+                           ["vcs" "push"]]
+           :plugins [
+                  [com.gfredericks/corncob-cigar "0.1.5"]]}}


Set default for mongo url

Set default for mongo url

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

 (def current-inky-version
   (try
@@ -375,6 +374,7 @@
                      (html-response
                        (render-dev ns)))))

+  ;; (?!)
   (GET "/:login/:gist-id" [login gist-id]
     (fn [r]
       (let [recompile? (-> r :params :recompile)]


add generate transactions for groceries and credit card

--- src/clj_money/seed.clj
+++ src/clj_money/seed.clj
@@ -96,7 +96,9 @@
                          "Social Security"
                          "Medicare"
                          "Rent"
-                         "Checking"]
+                         "Groceries"
+                         "Checking"
+                         "Credit card"]
                         (map (fn [account-name]
                                [(keywordize account-name)
                                 (->> all-accounts
@@ -127,4 +129,34 @@
                                     :amount 750M}
                                    {:action :credit
                                     :account-id (-> accounts :checking :id)
-                                    :amount 750M}]})))))))
+                                    :amount 750M}]}))))
+
+      ; Groceries
+      (dorun (->> (periodic-seq (t/plus start-date Days/TWO) Weeks/ONE)
+                  (take 52)
+                  (map #(transactions/create
+                          s
+                          {:entity-id (:id entity)
+                           :transaction-date %
+                           :description "Market Street"
+                           :items [{:action :debit
+                                    :account-id (-> accounts :groceries :id)
+                                    :amount 89M}
+                                   {:action :credit
+                                    :account-id (-> accounts :credit-card :id)
+                                    :amount 89M}]}))))
+
+      ; Credit card
+      (dorun (->> (periodic-seq (t/plus start-date (Days/days 10)) Months/ONE)
+                  (take 12)
+                  (map #(transactions/create
+                          s
+                          {:entity-id (:id entity)
+                           :transaction-date %
+                           :description "Discover Card"
+                           :items [{:action :debit
+                                    :account-id (-> accounts :credit-card :id)
+                                    :amount 325M}
+                                   {:action :credit
+                                    :account-id (-> accounts :checking :id)
+                                    :amount 325M}]})))))))


expire quicker

expire quicker

--- src/cljs/app/core.cljs
+++ src/cljs/app/core.cljs
@@ -17,7 +17,7 @@

 (secretary/set-config! :prefix "#")

-(def expiration (* 60 1000))
+(def expiration (* 30 1000))

 (defonce devices-var (atom {}))


Moved type byte size function from SES to util ns.

--- src/cmr/exchange/common/util.clj
+++ src/cmr/exchange/common/util.clj
@@ -93,3 +93,30 @@
         (var-get (ns-resolve name-sp fun)))
       (catch  Exception _
         (log/warn "Couldn't resolve one or more of" fqfn)))))
+
+(defn data-type->bytes
+  [data-type]
+  (case (keyword (string/lower-case data-type))
+    :byte 1
+    :float 4
+    :float32 4
+    :float64 8
+    :double 8
+    :ubyte 1
+    :ushort 2
+    :uint 4
+    :uchar 1
+    :string 2
+    :char8 1
+    :uchar8 1
+    :short 2
+    :long 4
+    :int 4
+    :int8 1
+    :int16 2
+    :int32 4
+    :int64 8
+    :uint8 1
+    :uint16 2
+    :uint32 4
+    :uint64 8))


::reader-fn spec explanation

::reader-fn spec explanation

--- src/com/wsscode/pathom/core.cljc
+++ src/com/wsscode/pathom/core.cljc
@@ -15,6 +15,10 @@
 (s/def ::reader-map (s/map-of keyword? ::reader))
 (s/def ::reader-seq (s/coll-of ::reader :kind vector? :into []))
 (s/def ::reader-fn fn?)
+; using the version above until we have a correct ::env to set, otherwise the calls
+; to the reader usually fails since it doens't have all the information, checking
+; for just fn? is more relaxing since it doens't try to call it
+;(s/def ::reader-fn (s/fspec :args (s/cat :env ::env) :ret any?))

 (s/def ::reader
   (s/or :fn ::reader-fn


CMR-2882: Removed TODO

CMR-2882: Removed TODO

--- ingest-app/src/cmr/ingest/services/ingest_service.clj
+++ ingest-app/src/cmr/ingest/services/ingest_service.clj
@@ -49,11 +49,6 @@
   [context collection-concept validate-keywords?]
   (v/validate-concept-request collection-concept)
   (v/validate-concept-metadata collection-concept)
-  ;; TODO validate collection UMMM-C here
-  ;; 1. Parse collection into UMM-C record
-  ;; 2. Convert to UMM-JSON and validate against UMM-C JSON schema
-  ;; 2a. Return errors if present (or actually just print them but continue on anyway to normal ingest)
-  ;; 3. Validate against UMM-C validation rules written in Clojure (TODO started this sprint in other issues)
   (let [{:keys [format metadata]} collection-concept
         collection (spec/parse-metadata context :collection format metadata)
         umm-json (umm-json/umm->json collection)


Remove obsolete dependencies

Remove obsolete dependencies

--- src/gorillalabs/tesla/component/authorization.clj
+++ src/gorillalabs/tesla/component/authorization.clj
@@ -2,7 +2,6 @@
   (:require [mount.core :as mnt]
             [clojure.tools.logging :as log]
             [gorillalabs.tesla.component.configuration :as config]
-            [gorillalabs.tesla.component.mongo :refer [mongo retrievePage retrieveItem]]
             [buddy.sign.jwe :as jwe]
             [clj-time.core :refer [hours from-now]]
             [buddy.auth.backends.token :as auth]


Location plugin, improved coordinate rounding

--- src/cljs/salava/location/ui/explore.cljs
+++ src/cljs/salava/location/ui/explore.cljs
@@ -21,9 +21,9 @@

 (defn- get-markers [kind my-map layer-group opt]
   (let [bounds (.getBounds my-map)
-        round-to (if (> (.getZoom my-map) 6) 2 0)
+        rounded (if (> (.getZoom my-map) 6) #(.toFixed % 2) #(js/Math.round (+ % 0.5)))
         group-fn (fn [coll v]
-                   (update coll [(-> v :lat (.toFixed round-to)) (-> v :lng (.toFixed round-to))] conj v)) ; Put items at same lat/lng into a list
+                   (update coll [(-> v :lat rounded) (-> v :lng rounded)] conj v)) ; Put items at same lat/lng into a list
         click-cb (case kind
                    "users"
                    (fn [u]


Allow ULTRA operator to delete.

Allow ULTRA operator to delete.

--- src/clojush/pushgp/genetic_operators.clj
+++ src/clojush/pushgp/genetic_operators.clj
@@ -333,7 +333,7 @@
 (defn linearly-mutate
   [open-close-sequence mutation-rate atom-generators]
   (map #(if (< (lrand) mutation-rate)
-          (let [element (lrand-nth (concat atom-generators [:open :close]))]
+          (let [element (lrand-nth (concat atom-generators [:open :close ()]))]
             (if (fn? element) (element) element))
           %)
        open-close-sequence))


Add :first-reuse option for :age-combining-function.

--- src/clojush/pushgp/genetic_operators.clj
+++ src/clojush/pushgp/genetic_operators.clj
@@ -70,7 +70,11 @@
                          (+ (inc (min (:age p1) (:age p2)))
                             (* (Math/abs (float (- (:age p1) (:age p2))))
                             	         (/ (Math/abs (float (- p1-dist p2-dist)))
-                                            (+ p1-dist p2-dist))))))))))
+                                            (+ p1-dist p2-dist))))))))
+    :first-reuse (fn [p1 p2 g]
+                   (+ (:age p1)
+                      (max (sequence-similarity g (:genome p1))
+                           (sequence-similarity g (:genome p2)))))))

 ;; test effects of :proportionate with expressions like this:
 ;(float ((age-combining-function {:age-combining-function :proportionate})
@@ -1163,3 +1167,4 @@
         (if use-child false true)))))

+


fixed module

fixed module

--- src/crawler/corpus.clj
+++ src/crawler/corpus.clj
@@ -197,7 +197,7 @@
        (let [docs-at-path (filter
                            (fn [[u x]]
                              (= (:path x)
-                                as))
+                                (reverse as)))
                            corpus)

              action-taken-at-doc (try (nth (reverse an-action-seq) (count as))