Adding some changes at grids

Adding some changes at grids

--- src_cljs/rrm/corecljs.cljs
+++ src_cljs/rrm/corecljs.cljs
@@ -388,7 +388,7 @@
                      :dateofinstitution [[v/required :message "Field is required"]]
                      :nameofpo [[v/required :message "Field is required"]]
                      :dateofdecision [[v/required :message "Field is required"]]
-                      :title [[v/required :message "Field is required"]]
+                     :title [[v/required :message "Field is required"]]
                      :khasranumber [[v/required :message "Field is required"]]
                      ;; :area [[v/required :message "Field is required"]]
                      :khatakhatuninumber [[v/required :message "Field is required"]]
@@ -573,14 +573,12 @@
        [add-check-input-element :senddate "Send Date" data-set focus]
        ]
       [:div.box-footer
-       [:div.col-sm-12.col-md-offset-5
+       [:div.col-sm-12.col-md-offset-5
         [button-tool-bar
-         [button {:bs-style "success" :on-click save-function} "Save"]
+         [button {:bs-style "success" :on-click save-function} "Save"]
          (when (nil? (:id @data-set)) [button {:bs-style "info" :on-click #((reset! data-set {:isactive true})
                                                                             (reset-mut-combo-boxes))} "Refresh"])
-         [button {:bs-style "danger" :on-click form-cancel } "Cancel"]
-         ]
-        ]
+         [button {:bs-style "danger" :on-click form-cancel } "Cancel"]]]
        ;;[:span (str @data-set)]
        ]]]]])

@@ -646,12 +644,12 @@
        [upd-check-input-element data-set focus]
        ]
       [:div.box-footer
-       [:div.col-sm-8.col-md-offset-5
+       [:div.col-sm-12.col-md-offset-5
         [button-tool-bar
-         [button {:bs-style "success" :on-click save-function } "Save"]]
-        [button {:bs-style "danger" :on-click form-cancel } "Cancel"]]
+         [button {:bs-style "success" :on-click save-function } "Save"]
+         [button {:bs-style "danger" :on-click form-cancel } "Cancel"]]
        ;;[:span (str @data-set)]
-       ]]]]])
+       ]]]]]])

 (defn map-mutation-data [mut]
@@ -1254,30 +1252,29 @@
        [:table {:class "table table-bordered table-striped dataTable"}
         [:thead
          [:tr
+          (when (is-admin-or-super-admin)[:th " "])
+          (when (is-admin-or-super-admin)[:th " "])
           [:th "S.No"]
           [:th "Sub Division Name"]
           [:th "Name of the Village"]
           ;; [:th "Tehsil"]
           [:th "Year"]
           [:th "Rack Number"]
-          [:th "Description"]
-          (when (is-admin-or-super-admin)[:th " "])
-          (when (is-admin-or-super-admin)[:th " "])]]
+          [:th "Description"]]]
         [:tbody
          (doall (for [mt revenues]
                   ^{:key (.-id mt)} [:tr
+
+                                     (when (is-admin-or-super-admin)[:td [button {:bs-style "success"
+                                                                                :on-click  #(revenue-update(.-id mt))} "Update"]])
+                                     (when (is-admin-or-super-admin)[:td  [button {:bs-style "danger" :on-click #(revenue-delete(.-id mt))} "Delete"]])
                                      [:td (.-serialnumber mt)]
                                      [:td (.-subdivisionname mt)]
                                      [:td (.-villagename mt)]
                                      ;; [:td (.-tehsil mt)]
                                      [:td (.-year mt)]
                                      [:td (.-racknumber mt)]
-                                     [:td (.-description mt)]
-                                     (when (is-admin-or-super-admin)[:td [:a {:href "javascript:;"
-                                                                              :on-click  #(revenue-update(.-id mt))
-                                                                              :class "btn btn-success btn-sm glyphicon glyphicon-edit"}]])
-                                     (when (is-admin-or-super-admin)[:td  [:a {:href "javascript:;" :on-click #(revenue-delete(.-id mt))
-                                                                               :class "btn btn-danger btn-sm glyphicon glyphicon-remove"}]])]))]]
+                                     [:td (.-description mt)]]))]]
        [:div{:class "col-xs-6 col-centered col-max"} [shared-state 0]]]]]]])

@@ -1474,6 +1471,8 @@
        [:table {:class "table table-bordered table-striped dataTable"}
         [:thead
          [:tr
+          (when (is-admin-or-super-admin)[:th " "])
+          (when (is-admin-or-super-admin)[:th " "])
           [:th "S.No"]
           [:th "Name of the Village"]
           [:th "Sub Division Name"]
@@ -1481,24 +1480,21 @@
           [:th "Year"]
           [:th "Rack Number"]
           [:th "Description"]
-          (when (is-admin-or-super-admin)[:th " "])
-          (when (is-admin-or-super-admin)[:th " "])
           ]]
         [:tbody
          (doall (for [mt khasragirdwanis]
                   ^{:key (.-id mt)} [:tr
+
+                                     (when (is-admin-or-super-admin)[:td [button {:bs-style "success"
+                                                                                :on-click  #(khasragirdwani-update(.-id mt))} "Update"]])
+                                     (when (is-admin-or-super-admin)[:td  [button {:bs-style "danger" :on-click #(khasragirdwani-delete(.-id mt))} "Delete"]])
                                      [:td (.-serialnumber mt)]
                                      [:td (.-villagename mt)]
                                      [:td (.-subdivisionname mt)]
                                      [:td (.-tehsil mt)]
                                      [:td (.-year mt)]
                                      [:td (.-racknumber mt)]
-                                     [:td (.-description mt)]
-                                     (when (is-admin-or-super-admin)[:td [:a {:href "javascript:;"
-                                                                              :on-click  #(khasragirdwani-update(.-id mt))
-                                                                              :class "btn btn-success btn-sm glyphicon glyphicon-edit"}]])
-                                     (when (is-admin-or-super-admin)[:td  [:a {:href "javascript:;" :on-click #(khasragirdwani-delete(.-id mt))
-                                                                               :class "btn btn-danger btn-sm glyphicon glyphicon-remove"}]])]))]]
+                                     [:td (.-description mt)]]))]]
        [:div{:class "col-xs-6 col-centered col-max"} [shared-state 0]]]]]]])

@@ -2172,14 +2168,23 @@
                      ;; :receiveddate [[v/required :message "Field is required"]]
                      )))

-
-
-(defn misc-input-row [id label ttype data-set focus]
+(defn misc-input-element [id ttype data-set placeholder in-focus bool]
+  [:input.form-control {:id id
+                        :type ttype
+                        :value (@data-set id)
+                        :placeholder placeholder
+                        :on-change #(swap! data-set assoc id (-> % .-target .-value))
+                        :on-blur  #(reset! in-focus "on")
+                        :disabled bool
+                        }])
+
+
+(defn misc-input-row [id label ttype data-set focus bool]
   (let [input-focus (r/atom nil)]
     (fn []
       [:div.form-group
        [:label.col-sm-3.control-label label]
-       [:div.col-sm-6 [input-element id ttype data-set label input-focus]]
+       [:div.col-sm-6 [misc-input-element id ttype data-set label input-focus bool]]
        [:div.col-sm-3 (if (or @input-focus @focus)
                         (if (= nil (misc-form-validator @data-set))
                           [:div]
@@ -2191,7 +2196,7 @@
 (defn misc-form-cancel [event]
   (secretary/dispatch! "/misc"))

-(defn misc-template [doc-name data-set focus save-function]
+(defn misc-template [doc-name data-set focus save-function bool]
   [:div.container
    [:div.col-md-12
     [:div.box.box-info
@@ -2199,12 +2204,12 @@
       [:h2.box-title doc-name]]
      [:div.form-horizontal
       [:div.box-body
-       [misc-input-row :filenumber "File Numbar" "text" data-set focus]
-       [misc-input-row :subject "Subject" "text" data-set focus]
-       [misc-input-row :title "Title" "text" data-set focus]
-       [misc-input-row :remarks "Remarks" "text" data-set focus]
-       [misc-input-row :dispatcheddate "Dispatched Date" "date" data-set focus]
-       [misc-input-row :receiveddate "Recevied Date" "date" data-set focus]
+       [misc-input-row :filenumber "File Numbar" "text" data-set focus bool]
+       [misc-input-row :subject "Subject" "text" data-set focus bool]
+       [misc-input-row :title "Title" "text" data-set focus bool]
+       [misc-input-row :remarks "Remarks" "text" data-set focus bool]
+       [misc-input-row :dispatcheddate "Dispatched Date" "date" data-set focus bool]
+       [misc-input-row :receiveddate "Recevied Date" "date" data-set focus false]
        [:div.box-footer
         [:button.btn.btn-default {:on-click misc-form-cancel} "Cancel"]
         [:button.btn.btn-info.pull-right {:on-click save-function} "Save"]]]]]]])
@@ -2230,7 +2235,7 @@
            "Misc Add Form"
            add-data
            focus
-           #(misc-add-form-onclick add-data focus)])))
+           #(misc-add-form-onclick add-data focus) false])))

 (defn misc-update-template [id dmt]
   (let [update-data (r/atom {:id (int id)
@@ -2242,12 +2247,18 @@
                              :receiveddate (.-receiveddate dmt)
                              })
         focus (r/atom nil)]
-    (fn [] [misc-template
-           "Misc Update Form"
-           update-data
-           focus
-           #(misc-update-form-onclick update-data focus)])))
-
+    (fn []
+      (if (is-admin-or-super-admin)
+        [misc-template
+         "Misc Update Form"
+         update-data
+         focus
+         #(misc-update-form-onclick update-data focus) false]
+        [misc-template
+         "Misc Update Form"
+         update-data
+         focus
+         #(misc-update-form-onclick update-data focus) true]))))


Added keys to control the reindeer - qwioaskl

--- ClojureScript/hello.cljs
+++ ClojureScript/hello.cljs
@@ -32,20 +32,20 @@
 (def normalize (comp (partial apply vec*) (juxt identity (comp (partial / 1.0) magnitude))))
 (defn dot-product [v w] (apply + (map * v w)))
 (defn cross-product [[a b] [c d]] (- (* a d) (* b c)))
-;(defn clamp [v lower upper] (Math/min (Math/max v lower) upper))
+(defn clamp [v lower upper] (Math/min (Math/max v lower) upper))
 (defn angle [v w] (Math/atan2 (cross-product v w) (dot-product v w)))
 (defn rot-cw [[x y]] [y (- x)])
 (defn rot-ccw [[x y]] [(- y) x])

 (defn make-node [x y] {:pos [x y] :vel [0 0]})
 (defn make-spring [a b] {:node-a a :node-b b})
-(defn make-hinge [a b c] {:node-a a :node-b b :node-c c})
+(defn make-hinge [a b c min-a max-a] {:node-a a :node-b b :node-c c :min-modifier-angle min-a :max-modifier-angle max-a})
 (defn make-state [nodes springs hinges] {
     :nodes nodes
     :springs (map
         (fn [s] (assoc s
             :rest-length (magnitude (vec- (:pos (nodes (:node-a s))) (:pos (nodes (:node-b s)))))
-            :strength 1000))
+            :strength 2000))
         springs)
     :hinges (map
         (fn [h] (assoc h
@@ -53,7 +53,8 @@
                 a (vec- (:pos (nodes (:node-a h))) (:pos (nodes (:node-b h))))
                 c (vec- (:pos (nodes (:node-c h))) (:pos (nodes (:node-b h))))]
                 (angle a c))
-            :strength 20000))
+            :modifier-angle 0.0
+            :strength 1000000))
         hinges)
 })

@@ -61,14 +62,14 @@
     {
         :head (make-node 250 150)
         :tail (make-node 50 150)
-        :h-l-k (make-node 270 75)
-        :h-l-f (make-node 270 0)
-        :h-t-k (make-node 230 75)
-        :h-t-f (make-node 230 0)
-        :t-l-k (make-node 70 75)
-        :t-l-f (make-node 70 0)
-        :t-t-k (make-node 30 75)
-        :t-t-f (make-node 30 0)
+        :h-l-k (make-node 260 75)
+        :h-l-f (make-node 250 0)
+        :h-t-k (make-node 260 75)
+        :h-t-f (make-node 250 0)
+        :t-l-k (make-node 40 75)
+        :t-l-f (make-node 50 0)
+        :t-t-k (make-node 40 75)
+        :t-t-f (make-node 50 0)
     }
     (map (partial apply make-spring) [
         [:head :tail]
@@ -82,14 +83,14 @@
         [:t-t-k :t-t-f]
     ])
     (map (partial apply make-hinge) [
-        [:tail :head :h-l-k]
-        [:head :h-l-k :h-l-f]
-        [:tail :head :h-t-k]
-        [:head :h-t-k :h-t-f]
-        [:head :tail :t-l-k]
-        [:tail :t-l-k :t-l-f]
-        [:head :tail :t-t-k]
-        [:tail :t-t-k :t-t-f]
+        [:tail :head :h-l-k -0.5 0.5]
+        [:head :h-l-k :h-l-f -1 0.0]
+        [:tail :head :h-t-k -0.5 0.5]
+        [:head :h-t-k :h-t-f -1 0.0]
+        [:head :tail :t-l-k -0.5 0.5]
+        [:tail :t-l-k :t-l-f -1 0.0]
+        [:head :tail :t-t-k -0.5 0.5]
+        [:tail :t-t-k :t-t-f -1 0.0]
     ])
 ))

@@ -135,8 +136,8 @@
 (defn calculate-hinge-forces [nodes hinges]
     (apply merge-with vec+
         (map
-            (fn [{:keys [node-a node-b node-c rest-angle strength]}] (let [
-                [force-a force-c] (calculate-hinge-force (:pos (nodes node-a)) (:pos (nodes node-b)) (:pos (nodes node-c)) rest-angle strength)]
+            (fn [{:keys [node-a node-b node-c rest-angle modifier-angle strength]}] (let [
+                [force-a force-c] (calculate-hinge-force (:pos (nodes node-a)) (:pos (nodes node-b)) (:pos (nodes node-c)) (+ rest-angle modifier-angle) strength)]
                 {
                     node-a force-a
                     node-b (vec- [0 0] force-a force-c)
@@ -185,17 +186,41 @@
                         (conj keys (.keyCode event))
                     :else keys)})))

+(defn hinge-nodes [h]
+    (map h [:node-a :node-b :node-c]))
+
 (defn tick-imp [state tick-step input-state]
     (assoc state
-        :springs
-            (let [modifier (cond
-                    ((:keys input-state) KeyCodes/Q) 0.99
-                    ((:keys input-state) KeyCodes/W) 1.01
-                    :else 1.0)]
-                (map (fn [s]
-                    (assoc s :rest-length
-                        (* modifier (:rest-length s))))
-                        (:springs state)))
+        :hinges
+            (let
+                [[q w i o a s k l] (map (:keys input-state) [
+                    KeyCodes/Q KeyCodes/W KeyCodes/I KeyCodes/O
+                    KeyCodes/A KeyCodes/S KeyCodes/K KeyCodes/L
+                    ])]
+                (map (fn [h] (let [hn (hinge-nodes h)]
+                    (assoc h :modifier-angle
+                        (clamp (+ (:modifier-angle h)
+                            (cond
+                                (= hn [:tail :head :h-l-k])
+                                    (+ (if q 0.05 0.0) (if w -0.05 0.0))
+                                (= hn [:head :h-l-k :h-l-f])
+                                    (+ (if i 0.05 0.0) (if o -0.05 0.0))
+                                (= hn [:tail :head :h-t-k])
+                                    (+ (if q -0.05 0.0) (if w 0.05 0.0))
+                                (= hn [:head :h-t-k :h-t-f])
+                                    (+ (if i -0.05 0.0) (if o 0.05 0.0))
+                                (= hn [:head :tail :t-l-k])
+                                    (+ (if a 0.05 0.0) (if s -0.05 0.0))
+                                (= hn [:tail :t-l-k :t-l-f])
+                                    (+ (if k 0.05 0.0) (if l -0.05 0.0))
+                                (= hn [:head :tail :t-t-k])
+                                    (+ (if a -0.05 0.0) (if s 0.05 0.0))
+                                (= hn [:tail :t-t-k :t-t-f])
+                                    (+ (if k -0.05 0.0) (if l 0.05 0.0))
+                                :else
+                                    0.0))
+                            (:min-modifier-angle h) (:max-modifier-angle h)))))
+                    (:hinges state)))
         :nodes
             (update-node-positions
                 (update-node-velocities


move to dev local

move to dev local

--- tutorial/query_tour.clj
+++ tutorial/query_tour.clj
@@ -8,13 +8,10 @@

 (require '[datomic.client.api :as d]
          '[datomic.samples.repl :as repl])
-(import '(java.util UUID))

-(def client-cfg (read-string (slurp "config.edn")))
-(def client (d/client client-cfg))
-(def db-name (str "scratch-" (UUID/randomUUID)))
-(d/create-database client {:db-name db-name})
-(def conn (d/connect client {:db-name db-name}))
+(def client (d/client {:server-type :dev-local :system "day-of-datomic-cloud"}))
+(d/create-database client {:db-name "query-tour"})
+(def conn (d/connect client {:db-name "query-tour"}))

 (repl/setup-sample-db-1 conn)

@@ -97,6 +94,4 @@
           hist
           editor-id
           :user/firstName)
-     (sort-by first))
-
-(d/delete-database client {:db-name db-name})
+     (sort-by first))


More checks for function third()

More checks for function third()

--- test/clouseau/test_utils.clj
+++ test/clouseau/test_utils.clj
@@ -191,6 +191,10 @@
     "Check the function clouseau.utils/third."
     (testing "the function clouseau.utils/third."
         (are [x y] (= x y)
+            nil (third [])
+            nil (third '())
+            nil (third [1])
+            nil (third '(1))
             nil (third [1 2])
             nil (third '(1 2)))))


test: uncomment map coll w/ bools

test: uncomment map coll w/ bools

--- test/datasplash/api_test.clj
+++ test/datasplash/api_test.clj
@@ -337,23 +337,21 @@
           (is (= input
                  rslt))))))

-  ;; TODO: fix me! generate-input is broken with boolean values in maps :(
-  ;; see issue #101
-  ;; (testing "map coll w/ boolean values"
-  ;;   (let [input #{{:done true} {:done false}}]
-  ;;     (tio/with-tempdir [tmp-dir]
-  ;;       (let [p (sut/make-pipeline [])
-  ;;             rslt (sut/generate-input input p)]
-
-  ;;         (sut/write-edn-file (tio/join-path tmp-dir "test")
-  ;;                             {:num-shards 1} rslt)
-
-  ;;         (sut/wait-pipeline-result (sut/run-pipeline p)))
-  ;;       (let [rslt (->> (tio/read-edns-file (first (tio/list-files tmp-dir)))
-  ;;                       (into #{}))]
-  ;;         (is (= input
-  ;;                rslt))))))
-  )
+  ;; nippy fix, by @RolT. see #101
+  (testing "map coll w/ boolean values"
+    (let [input #{{:done true} {:done false}}]
+      (tio/with-tempdir [tmp-dir]
+        (let [p (sut/make-pipeline [])
+              rslt (sut/generate-input input p)]
+
+          (sut/write-edn-file (tio/join-path tmp-dir "test")
+                              {:num-shards 1} rslt)
+
+          (sut/wait-pipeline-result (sut/run-pipeline p)))
+        (let [rslt (->> (tio/read-edns-file (first (tio/list-files tmp-dir)))
+                        (into #{}))]
+          (is (= input
+                 rslt)))))))

 (deftest map-test
   (testing "with system"


Replace Count and Sum trident aggregators with ones using the defcombineraggregator macro

--- src/clj/marceline/storm/testing/trident_wordcount.clj
+++ src/clj/marceline/storm/testing/trident_wordcount.clj
@@ -44,16 +44,18 @@
                         (t/each ["sentence"]
                                  split-args
                                  ["word"])
+                        (t/project ["word"])
                         (t/group-by ["word"])
                         (t/persistent-aggregate word-state-factory
                                                  ["word"]
-                                                 (Count.)
+                                                 count-words
                                                  ["count"])
                         (t/parallelism-hint 16))
         count-query (-> (t/drpc-stream trident-topology "words" drpc)
                         (t/each ["args"]
                                  split-args
                                  ["word"])
+                        (t/project ["word"])
                         (t/group-by ["word"])
                         (t/state-query word-counts
                                         ["word"]
@@ -61,8 +63,9 @@
                                         ["count"])
                         (t/each ["count"] (FilterNull.))
                         (t/aggregate ["count"]
-                                      (Sum.)
-                                      ["sum"]))]
+                                      sum
+                                      ["sum"])
+                        (t/debug))]
     trident-topology))

 (defn run-local! []
@@ -72,8 +75,8 @@
                      {}
                      (.build
                       (build-topology local-drpc)))
-    (Thread/sleep 1000)
-    (.execute local-drpc "words" "cat the dog jumped")
+    (Thread/sleep 10000)
+    (.execute local-drpc "words" "cat dog the man jumped")
     (.shutdown cluster)
     (System/exit 0)))


Fix server component start and default handler

--- src/polismath/components/server.clj
+++ src/polismath/components/server.clj
@@ -4,7 +4,7 @@
   (:require
     ;; XXX Deprecate; use component config directly
     [clojure.core.async :as async :refer [chan >!! <!! >! <! go]]
-    [clojure.tools.logging :as log]
+    [taoensso.timbre :as log]

     [ring.component.jetty :as jetty]
     [com.stuartsierra.component :as component]
@@ -28,7 +28,6 @@
   "This wraps a handler such that requested for /healthcheck"
   [handler]
   (fn [{:as request :keys [uri]}]
-    (log/debug "uri:" uri)
     (if (= uri "/healthcheck")
       (healthcheck-handler request)
       (handler request))))
@@ -37,19 +36,24 @@
   [config opts app jetty-server]
   component/Lifecycle
   (start [component]
+    (log/info ">> Starting server component with config:" config)
     (let [wrapped-handler (wrap-handler (:handler app))
           jetty-server (jetty/jetty-server (merge {:app (merge app {:handler wrapped-handler})}
                                                   (:server config)
                                                   opts))]
+      (component/start jetty-server)
       (assoc component :jetty-server jetty-server)))
   (stop [component]
+    (log/info "<< Stopping server component")
     (component/stop jetty-server)
     component))

 (defn create-server
   ;; Default handler just return the healthcheck response always
-  ([{:as opts :or {handler healthcheck-handler}}]
-   (map->Server opts))
+  ([opts]
+   (let [opts (merge {:app {:handler healthcheck-handler}}
+                     opts)]
+     (map->Server opts)))
   ([]
    (create-server {})))


fix psueodocount priors for group-aware-consensus

--- src/polismath/math/conversation.clj
+++ src/polismath/math/conversation.clj
@@ -575,7 +575,7 @@
                      (fn [result [gid gid-stats]]
                        (reduce
                          (fn [result [tid {:keys [A S] :or {A 0 S 0}}]]
-                           (let [prob (/ A (+ S 1.0))]
+                           (let [prob (/ (+ A 1.0) (+ S 2.0))]
                              (assoc-in result [tid gid] prob)))
                          result
                          (:votes gid-stats)))


CMR-4683: Address review comments

CMR-4683: Address review comments

--- search-app/src/cmr/search/services/query_execution/facets/hierarchical_v2_facets.clj
+++ search-app/src/cmr/search/services/query_execution/facets/hierarchical_v2_facets.clj
@@ -161,6 +161,13 @@
                    :when (= parent-value-lowercase (get query-params-lowercase query-param))]
                query-param))))))

+(defn- extract-value-from-bucket
+  "Returns the value from a bucket. The value could be from either :key or :key_as_string."
+  [bucket field]
+  (if (some? (:key_as_string bucket))
+    (temporal-facets/parse-date (:key_as_string bucket) field)
+    (:key bucket)))
+
 (defn- generate-hierarchical-children
   "Generate children nodes for a hierarchical facet v2 response.
   recursive-parse-fn - function to call to recursively generate any children filter nodes.
@@ -173,21 +180,20 @@
   [recursive-parse-fn has-siblings-fn generate-links-fn field field-hierarchy elastic-aggregations]
   ;; Each value for this field has its own bucket in the elastic aggregations response
   ;; Top level could be a field
-  (for [bucket (or (get-in elastic-aggregations [field :buckets] (get elastic-aggregations :buckets)))
-        :let [temporal? (some? (:key_as_string bucket))
-              value (if temporal?
-                      (temporal-facets/parse-date (:key_as_string bucket) field)
-                      (:key bucket))
-              count (get-in bucket [:coll-count :doc_count] (:doc_count bucket))
-              sub-facets (recursive-parse-fn value bucket)
-              ;; Sort alphabetically
-              sub-facets (when (seq (:children sub-facets))
-                           (update sub-facets :children
-                                   #(sort-by :title util/compare-natural-strings %)))
-              children-values-to-remove (find-applied-children sub-facets field-hierarchy false)
-              has-siblings? (has-siblings-fn value)
-              links (generate-links-fn value has-siblings? children-values-to-remove)]]
-    (v2h/generate-hierarchical-filter-node value count links sub-facets)))
+  (let [buckets (or (get-in elastic-aggregations [field :buckets])
+                    (get elastic-aggregations :buckets))]
+    (for [bucket buckets
+          :let [value (extract-value-from-bucket bucket field)
+                count (get-in bucket [:coll-count :doc_count] (:doc_count bucket))
+                sub-facets (recursive-parse-fn value bucket)
+                ;; Sort alphabetically
+                sub-facets (when (seq (:children sub-facets))
+                             (update sub-facets :children
+                                     #(sort-by :title util/compare-natural-strings %)))
+                children-values-to-remove (find-applied-children sub-facets field-hierarchy false)
+                has-siblings? (has-siblings-fn value)
+                links (generate-links-fn value has-siblings? children-values-to-remove)]]
+      (v2h/generate-hierarchical-filter-node value count links sub-facets))))

 (defn- parse-hierarchical-bucket-v2
   "Recursively parses the elasticsearch aggregations response and generates version 2 facets.


(PDB-4656) command/process-message: move message handling here

Have message-handler create a function that just calls a new
process-message function to handle each message instead of including
all of the processing code directly inside the anonymous function.

--- src/puppetlabs/puppetdb/command.clj
+++ src/puppetlabs/puppetdb/command.clj
@@ -624,59 +624,66 @@

 (def ^:private iso-formatter (fmt-time/formatters :date-time))

+(defn process-message
+  [{:keys [certname command version received delete? id] :as cmdref}
+   q command-chan dlo delay-pool broadcast-pool write-dbs response-chan stats
+   blacklist-config stop-status maybe-send-cmd-event!]
+  (try+
+   (when received
+     (let [q-time (-> (fmt-time/parse iso-formatter received)
+                      (time/interval (now))
+                      time/in-seconds)]
+       (create-metrics-for-command! command version)
+       (update! (global-metric :queue-time) q-time)
+       (update! (cmd-metric command version :queue-time) q-time)))
+   (if delete?
+     (process-delete-cmdref cmdref q (first write-dbs) response-chan
+                            stats blacklist-config maybe-send-cmd-event!)
+     (let [retries (count (:attempts cmdref))]
+       (try+
+        (process-cmdref cmdref q (first write-dbs) response-chan stats
+                        blacklist-config maybe-send-cmd-event!)
+        (catch fatal? obj
+          (mark! (global-metric :fatal))
+          (let [ex (:cause obj)]
+            (log/error
+             (:wrapper &throw-context)
+             (trs "[{0}] [{1}] Fatal error on attempt {2} for {3}" id command retries certname))
+            (discard-message cmdref ex q dlo maybe-send-cmd-event!)))
+        (catch Exception _
+          (let [ex (:throwable &throw-context)]
+            (mark-both-metrics! command version :retried)
+            (if (< retries maximum-allowable-retries)
+              (do
+                (log/error
+                 ex
+                 (trs "[{0}] [{1}] Retrying after attempt {2} for {3}, due to: {4}"
+                      id command retries certname ex))
+                (schedule-delayed-message cmdref ex command-chan delay-pool stop-status))
+              (do
+                (log/error
+                 ex
+                 (trs "[{0}] [{1}] Exceeded max attempts ({2}) for {3}" id command retries certname))
+                (discard-message cmdref ex q dlo maybe-send-cmd-event!))))))))
+   (catch [:kind ::queue/parse-error] _
+     (mark! (global-metric :fatal))
+     (log/error (:wrapper &throw-context)
+                (trs "Fatal error parsing command: {0}" (:id cmdref)))
+     (discard-message cmdref (:throwable &throw-context) q dlo maybe-send-cmd-event!))))
+
 (defn message-handler
   "Processes the message via (process-message msg), retrying messages
   that fail via (delay-message msg), and discarding messages that have
   fatal errors or have exceeded their maximum allowed attempts."
-  [q command-chan dlo delay-pool broadcast-pool scf-write-dbs response-chan stats
-   blacklist-config stop-status maybe-send-cmd-event!]
-  (assert (= 1 (count scf-write-dbs)))
-  (fn [{:keys [certname command version received delete? id] :as cmdref}]
-    (try+
-
-     (when received
-       (let [q-time (-> (fmt-time/parse iso-formatter received)
-                        (time/interval (now))
-                        time/in-seconds)]
-         (create-metrics-for-command! command version)
-         (update! (global-metric :queue-time) q-time)
-         (update! (cmd-metric command version :queue-time) q-time)))
-
-     (if delete?
-       (process-delete-cmdref cmdref q (first scf-write-dbs) response-chan
-                              stats blacklist-config maybe-send-cmd-event!)
-       (let [retries (count (:attempts cmdref))]
-         (try+
-          (process-cmdref cmdref q (first scf-write-dbs) response-chan stats
-                          blacklist-config maybe-send-cmd-event!)
-          (catch fatal? obj
-            (mark! (global-metric :fatal))
-            (let [ex (:cause obj)]
-              (log/error
-               (:wrapper &throw-context)
-               (trs "[{0}] [{1}] Fatal error on attempt {2} for {3}" id command retries certname))
-              (discard-message cmdref ex q dlo maybe-send-cmd-event!)))
-          (catch Exception _
-            (let [ex (:throwable &throw-context)]
-              (mark-both-metrics! command version :retried)
-              (if (< retries maximum-allowable-retries)
-                (do
-                  (log/error
-                   ex
-                   (trs "[{0}] [{1}] Retrying after attempt {2} for {3}, due to: {4}"
-                        id command retries certname ex))
-                  (schedule-delayed-message cmdref ex command-chan delay-pool stop-status))
-                (do
-                  (log/error
-                   ex
-                   (trs "[{0}] [{1}] Exceeded max attempts ({2}) for {3}" id command retries certname))
-                  (discard-message cmdref ex q dlo maybe-send-cmd-event!))))))))
-
-     (catch [:kind ::queue/parse-error] _
-       (mark! (global-metric :fatal))
-       (log/error (:wrapper &throw-context)
-                  (trs "Fatal error parsing command: {0}" (:id cmdref)))
-       (discard-message cmdref (:throwable &throw-context) q dlo maybe-send-cmd-event!)))))
+  [q command-chan dlo delay-pool broadcast-pool write-dbs
+   response-chan stats blacklist-config stop-status maybe-send-cmd-event!]
+  (assert (= 1 (count write-dbs)))
+  (fn [cmdref]
+    (process-message cmdref
+                     q command-chan dlo
+                     delay-pool broadcast-pool write-dbs
+                     response-chan stats
+                     blacklist-config stop-status maybe-send-cmd-event!)))

 (def stop-commands-wait-ms (constantly 5000))
 (def threadpool-shutdown-ms 10000)


Check syntax of path

Check syntax of path

--- src/rdf_path_examples/resources.clj
+++ src/rdf_path_examples/resources.clj
@@ -10,7 +10,8 @@
             [liberator.core :refer [defresource]])
   (:import [org.apache.jena.sparql.engine.http QueryExceptionHTTP]
            [org.apache.jena.rdf.model Model]
-           [schema.utils ErrorContainer]))
+           [schema.utils ErrorContainer]
+           [org.apache.jena.riot RiotException]))

 (def ^:private default-response
   {:representation {:media-type "application/ld+json"}})
@@ -54,13 +55,14 @@
                          (= content-type "application/ld+json"))
   :malformed? (fn [{{:keys [body query-params]} :request}]
                 (let [configuration (parse-query-params query-params)
-                      path (rdf/json-ld->rdf-model body)]
-                  (if-let [error (or (:error configuration) (validate-path path))]
-                    [true (assoc default-response
-                                 :malformed-error (if (instance? ErrorContainer configuration)
-                                                    (str error)
-                                                    error))]
-                    [false {:request {:params (preprocess-config configuration)}
-                            :rdf-path path}])))
+                      error (:error configuration)
+                      [valid-syntax? path] (try [true (rdf/json-ld->rdf-model body)]
+                                                (catch RiotException ex [false (.getMessage ex)]))]
+                  (cond error [true (assoc default-response :malformed-error (str error))]
+                        (not valid-syntax?) [true (assoc default-response :malformed-error path)]
+                        :else (if-let [error (validate-path path)]
+                                [true (assoc default-response :malformed-error error)]
+                                [false {:request {:params (preprocess-config configuration)}
+                                        :rdf-path path}]))))
   :new? (constantly false)
   :respond-with-entity? (constantly true))


Basic formatting modifications

Basic formatting modifications

--- etc/synthdefs/synth-designs.clj
+++ etc/synthdefs/synth-designs.clj
@@ -48,9 +48,9 @@
           src (* amp src)]
       (replace-out out-bus src)))

-  ;; (save-to-pi mixer)
-  ;; (save-to-pi basic-mixer)
-  )
+  (comment
+    (save-to-pi mixer)
+    (save-to-pi basic-mixer)))

 ;; Simple Trigger synths
@@ -722,51 +722,49 @@
           snd           (balance2 snd-l snd-r pan amp)
           snd           (* env snd)]
       (out out-bus snd)))
-
-   ;; (save-to-pi mono_player)
-   ;; (save-to-pi stereo_player)
-   ;; (save-to-pi basic_mono_player)
-   ;; (save-to-pi basic_stereo_player)
-
-  )
+  (comment
+    (save-to-pi mono_player)
+    (save-to-pi stereo_player)
+    (save-to-pi basic_mono_player)
+    (save-to-pi basic_stereo_player)))

 (do

   (defsynth tb303
-  "A simple clone of the sound of a Roland TB-303 bass synthesizer."
-  [note     52        ; midi note value input
-   note_slide 0
-   amp      1
-   amp_slide 0
-   pan      0
-   pan_slide 0
-   attack   0.01
-   sustain  0
-   release  2
-   cutoff   80
-   cutoff_slide 0
-   cutoff_min 30
-   res      0.2       ; rlpf resonance
-   res_slide 0
-   wave     0         ; 0=saw, 1=pulse
-   pulse_width 0.5    ; only for pulse wave
-   pulse_width_slide 0
-   out-bus  0]
-  (let [note            (lag note note_slide)
-        amp             (lag amp amp_slide)
-        pan             (lag pan pan_slide)
-        cutoff_slide    (lag cutoff cutoff_slide)
-        res             (lag res res_slide)
-        pulse_width     (lag pulse_width pulse_width_slide)
-        cutoff-freq     (midicps cutoff)
-        cutoff-min-freq (midicps cutoff_min)
-        freq            (midicps note)
-        env             (env-gen (env-lin attack sustain release) :action FREE)
-        snd             (rlpf (select wave [(saw freq) (pulse freq pulse_width)])
-                              (+ cutoff-min-freq (* env cutoff-freq))
-                              res)
-        snd             (* env snd)]
-    (out out-bus (pan2 snd pan amp))))
+    "A simple clone of the sound of a Roland TB-303 bass synthesizer."
+    [note     52                        ; midi note value input
+     note_slide 0
+     amp      1
+     amp_slide 0
+     pan      0
+     pan_slide 0
+     attack   0.01
+     sustain  0
+     release  2
+     cutoff   80
+     cutoff_slide 0
+     cutoff_min 30
+     res      0.2                       ; rlpf resonance
+     res_slide 0
+     wave     0                         ; 0=saw, 1=pulse
+     pulse_width 0.5                    ; only for pulse wave
+     pulse_width_slide 0
+     out-bus  0]
+    (let [note            (lag note note_slide)
+          amp             (lag amp amp_slide)
+          pan             (lag pan pan_slide)
+          cutoff_slide    (lag cutoff cutoff_slide)
+          res             (lag res res_slide)
+          pulse_width     (lag pulse_width pulse_width_slide)
+          cutoff-freq     (midicps cutoff)
+          cutoff-min-freq (midicps cutoff_min)
+          freq            (midicps note)
+          env             (env-gen (env-lin attack sustain release) :action FREE)
+          snd             (rlpf (select wave [(saw freq) (pulse freq pulse_width)])
+                                (+ cutoff-min-freq (* env cutoff-freq))
+                                res)
+          snd             (* env snd)]
+      (out out-bus (pan2 snd pan amp))))

   (defsynth supersaw [note 52
                       note_slide 0
@@ -837,7 +835,7 @@
       (out out-bus output)))

   (defsynth prophet
-  "The Prophet Speaks (page 2)
+    "The Prophet Speaks (page 2)

    Dark and swirly, this synth uses Pulse Width Modulation (PWM) to
    create a timbre which continually moves around. This effect is
@@ -853,46 +851,46 @@
    frequency) and its LFO has a little bit of randomisation thrown into
    its frequency component for that extra bit of variety."

-  [note 52
-   note_slide 0
-   amp 1
-   amp_slide 0
-   pan 0
-   pan_slide 0
-   attack 0.01
-   sustain 0
-   release 2
-   cutoff 110
-   cutoff_slide 0
-   res 0.3
-   res_slide 0
-   out-bus 0 ]
-
-  (let [note        (lag note note_slide)
-        amp         (lag amp amp_slide)
-        pan         (lag pan pan_slide)
-        cutoff      (lag cutoff cutoff_slide)
-        res         (lag res res_slide)
-        freq        (midicps note)
-        cutoff-freq (midicps cutoff)
-        snd         (mix [(pulse freq (* 0.1 (/ (+ 1.2 (sin-osc:kr 1)) )))
-                          (pulse freq (* 0.8 (/ (+ 1.2 (sin-osc:kr 0.3) 0.7) 2)))
-                          (pulse freq (* 0.8 (/ (+ 1.2 (lf-tri:kr 0.4 )) 2)))
-                          (pulse freq (* 0.8 (/ (+ 1.2 (lf-tri:kr 0.4 0.19)) 2)))
-                          (* 0.5 (pulse (/ freq 2) (* 0.8 (/ (+ 1.2 (lf-tri:kr (+ 2 (lf-noise2:kr 0.2))))
-                                                             2))))])
-        snd         (normalizer snd)
-        env         (env-gen (env-lin attack sustain release) :action FREE)
-        snd         (rlpf (* env snd snd) cutoff-freq res)
-        snd         (pan2 snd pan amp)]
-
-    (out out-bus snd)))
-
-  ;; (save-to-pi tb303)
-  ;; (save-to-pi supersaw)
-  ;; (save-to-pi supersaw_s)
-  ;; (save-to-pi prophet)
-  )
+    [note 52
+     note_slide 0
+     amp 1
+     amp_slide 0
+     pan 0
+     pan_slide 0
+     attack 0.01
+     sustain 0
+     release 2
+     cutoff 110
+     cutoff_slide 0
+     res 0.3
+     res_slide 0
+     out-bus 0 ]
+
+    (let [note        (lag note note_slide)
+          amp         (lag amp amp_slide)
+          pan         (lag pan pan_slide)
+          cutoff      (lag cutoff cutoff_slide)
+          res         (lag res res_slide)
+          freq        (midicps note)
+          cutoff-freq (midicps cutoff)
+          snd         (mix [(pulse freq (* 0.1 (/ (+ 1.2 (sin-osc:kr 1)) )))
+                            (pulse freq (* 0.8 (/ (+ 1.2 (sin-osc:kr 0.3) 0.7) 2)))
+                            (pulse freq (* 0.8 (/ (+ 1.2 (lf-tri:kr 0.4 )) 2)))
+                            (pulse freq (* 0.8 (/ (+ 1.2 (lf-tri:kr 0.4 0.19)) 2)))
+                            (* 0.5 (pulse (/ freq 2) (* 0.8 (/ (+ 1.2 (lf-tri:kr (+ 2 (lf-noise2:kr 0.2))))
+                                                               2))))])
+          snd         (normalizer snd)
+          env         (env-gen (env-lin attack sustain release) :action FREE)
+          snd         (rlpf (* env snd snd) cutoff-freq res)
+          snd         (pan2 snd pan amp)]
+
+      (out out-bus snd)))
+
+  (comment
+    (save-to-pi tb303)
+    (save-to-pi supersaw)
+    (save-to-pi supersaw_s)
+    (save-to-pi prophet)))

 ;;FX
 (do


Add function to assoc-in objects

Add function to assoc-in objects

Defines `lt.object/assoc-in!`, a function that allows the caller to
`assoc-in` objects conforming to the BOT model.

The function takes an object, a sequence of keys, and the value to be
set. If the key already exists in the nested associative structure
described by the sequence, its value is reset; if it doesn't, the new
key-value pair is created, fully reproducing the sequence as hash-maps
if necessary.

Useful to update and create deeply-nested keyvals in a concise fashion,
i.e. without passing full maps as required by `object/merge!`.

--- src/lt/object.cljs
+++ src/lt/object.cljs
@@ -220,6 +220,11 @@
 (defn update! [obj & r]
   (swap! obj #(apply update-in % r)))

+(defn assoc-in! [obj k v]
+  (when (and k (not (sequential? k)))
+    (throw (js/Error. (str "Associate requires a sequence of keys: " k))))
+  (swap! obj #(assoc-in % k v)))
+
 (defn ->id [obj]
   (if (deref? obj)
     (::id @obj)


CRM-3290 Removes debug statement

CRM-3290 Removes debug statement

--- access-control-app/src/cmr/access_control/services/event_handler.clj
+++ access-control-app/src/cmr/access_control/services/event_handler.clj
@@ -71,7 +71,6 @@
                   acl-entry-titles (:entry-titles (:collection-identifier catalog-item-id))]
             :when (and (= (:provider-id collection-concept) (:provider-id catalog-item-id))
                        (some #{entry-title} acl-entry-titles))]
-      (debug "relevant ACL =" (pr-str acl-concept))
       (if (= 1 (count acl-entry-titles))
         ;; the ACL only references the collection being deleted, and therefore the ACL should be deleted
         (acl-service/delete-acl context (:concept-id acl-concept))


performance improvements

performance improvements

--- kafka-clj/src/kafka_clj/consumer.clj
+++ kafka-clj/src/kafka_clj/consumer.clj
@@ -12,6 +12,7 @@
             [group-redis.core :refer [host-name]]
             [group-redis.partition :refer [controlled-assignments]]
             [clojure.pprint :refer [pprint]]
+            [clojure.core.reducers :as r]
             [clojure.core.async :refer [<!! >!! alts!! timeout chan go >! <! close! go-loop]]
             [clj-tuple :refer [tuple]])
   (:import [kafka_clj.fetch Message FetchError]
@@ -230,7 +231,8 @@
 				            (error "timeout reading from " (:broker producer))
 				            [[] [{:error (RuntimeException. (str "Timeout while waiting for " (:broker producer)))}]]
 				            ))
-			         (finally ((:p-close persister)))))))))
+			         (finally (do ((:p-close persister))
+                             (info "End of request for broker " (:broker producer) )))))))))

 (defn consume-broker [producer group-conn topic-offsets msg-ch conf]
@@ -317,25 +319,42 @@
     (if-let [producer (first (filter (fn [{:keys [broker]}] (= broker broker-k)) producers))]
       producer
       (create-fetch-producer broker-k conf))))
-
-
-
-(defn consume-brokers! [producers group-conn broker-offsets msg-ch conf]
+
+(defn- parallel-broker-consume [group-conn broker-offsets msg-ch conf {:keys [broker] :as producer}]
+  (info "inside parallel broker consume")
+  (vector broker  (consume-broker producer group-conn (get broker-offsets broker) msg-ch conf)))
+
+(defn ^Callable callable
+  "Returns a function as a Callable that applies (f i)"
+  [f i]
+  (fn [] (f i) ))
+
+(defn pmap-exec
+  "Calls (f i) inside a thread where i is a item in the list l for each i in l, this returns a list of Future
+   Then calls .get on each future, the result is a lazy list of results from futures that needs to be run in reduce or doall"
+  [^ExecutorService exec f l]
+  (r/map (fn [^Future v] (.get v 5 java.util.concurrent.TimeUnit/MINUTES))
+    (doall (map (fn [i] (.submit exec (callable f i))) l))))
+
+(defn consume-brokers! [producers exec group-conn broker-offsets msg-ch conf]
   "
    Broker-offsets should be {broker {topic [{:offset o :partition p} ...] }}
    Consume brokers and returns a list of lists that contains the last messages consumed, or -1 -2 where errors are concerned
    the data structure returned is {broker -1|-2|[{:offset o topic: a} {:offset o topic a} ... ] ...}
   "
   (try
-    (reduce
-      (fn [[state errors] [broker [msgs msg-errors]]]
-         [(merge state {broker msgs}) (if (> (count msg-errors) 0) (apply conj errors msg-errors) errors)])
-          [{} []];initial value
-          (pmap #(vector (:broker %)  (consume-broker % group-conn (get broker-offsets (:broker %)) msg-ch conf))
+    (r/fold
+      (fn
+        ([] [{} []])
+        ([[state errors] [broker [msgs msg-errors]]]
+         [(merge state {broker msgs}) (if (> (count msg-errors) 0) (apply conj errors msg-errors) errors)]))
+          (pmap-exec exec
+            (partial parallel-broker-consume group-conn  broker-offsets msg-ch conf)
                     producers))
    (finally
      ;(info ">>>>>>>>>>>>>>>>>>>>> END CONSUME BROKERS!")
      )))
+

 (defn update-broker-offsets [broker-offsets v]
   "
@@ -422,8 +441,6 @@
     (reentrant-lock group-conn (str topic "/" partition))))

-;global cached offsets for a topic
-(def cached-offsets (ref {}))

 (defn calculate-locked-offsets [topic group-conn init-broker-offsets conf cached-offsets]
   (let [
@@ -496,55 +513,61 @@
   "Consume from the current offsets,
    if any error the producers are closed and a reconnect is done, and consumption is tried again
    otherwise the broker-offsets are updated and the next fetch is done"
-
-  (loop [producers producers broker-offsets-q broker-offsets-p  cached-offsets1 nil]
-       ;broker-offsets has format:  {{:host "gvanvuuren-compile", :port 9092} {"ping" #'kafka-clj.client/c
-       ;                              ({:offset 0, :error-code 0, :locked false, :partition 0})}}
-       ;release any topics that are not consumed anymore
-       (release-left-topics-locks conn metadata-producers broker-offsets-q @topics-ref conf)
-
-       (let [topics @topics-ref
-             broker-offsets1 (check-update-broker-offsets conn metadata-producers broker-offsets-q topics conf)
-             {:keys [broker-offsets cached-offsets]}
-                                        (apply merge-with (fn [a b]
-                                                            (if
-                                                              (and (associative? a) (associative? b))
-                                                              (merge-with merge a b)
-                                                              b))
-                                              ;each topic must be done in a different thread
-	                                            (doall (pmap (fn [x];x = topic
-	                                                             (calculate-locked-offsets x group-conn
-	                                                                   ;;we need to remove all other topics from the offset map
-	                                                                   (into {} (for [[broker topics] broker-offsets1
-	                                                                               [topic1 offsets] topics :when (= topic1 x) ] [broker {x offsets}]))
-	                                                                   conf (get cached-offsets1 x) ))
-                                                      @topics-ref)))
-             broker-offsets2 broker-offsets
+  (let [exec (Executors/newCachedThreadPool)]

-             ;_ (do (info "offsets " broker-offsets))
-             producers2  (doall (create-producers-if-needed broker-offsets2 producers conf))
-             timer-ctx (.time m-consume-cycle)
-             q (consume-brokers! producers2 group-conn broker-offsets2 msg-ch conf)]
-
-
-	       (let [[v errors] q]
-			    (if (and (not (nil? errors)) (> (count errors) 0))
-			      (do
-			         (error "Error close and reconnect: " errors)
-
-			         (let [[producers broker-offsets] (close-and-reconnect conn metadata-producers producers topics-ref errors conf)]
-	                (info "Got new consumers " (map :broker producers))
-	                (persist-error-offsets group-conn broker-offsets errors conf)
-                  (.stop timer-ctx)
-			            (recur producers2 broker-offsets cached-offsets)))
-			      (do
-               (if (< (reduce #(+ %1 (count %2)  ) 0 (vals v)) 1) ; if we were reading data, no need to pause
-	               (do (info "sleep: " fetch-poll-ms) (<!! (timeout fetch-poll-ms))))
-
-               (.stop timer-ctx)
-               (recur producers2 (update-broker-offsets broker-offsets2 v) cached-offsets))))
-
-			      )))
+	  (loop [producers producers broker-offsets-q broker-offsets-p  cached-offsets1 nil]
+	       ;broker-offsets has format:  {{:host "gvanvuuren-compile", :port 9092} {"ping" #'kafka-clj.client/c
+	       ;                              ({:offset 0, :error-code 0, :locked false, :partition 0})}}
+	       ;release any topics that are not consumed anymore
+	       (release-left-topics-locks conn metadata-producers broker-offsets-q @topics-ref conf)
+	       (info " >>>>>>>>>>>>>>>>>>>>>>>>>>>>> loop ")
+	       (let [topics @topics-ref
+	             broker-offsets1 (check-update-broker-offsets conn metadata-producers broker-offsets-q topics conf)
+	             {:keys [broker-offsets cached-offsets]}
+	                                        (r/fold
+	                                            (fn
+	                                               ([] {})
+	                                               ([a b]
+	                                                 (if
+	                                                   (and (associative? a) (associative? b))
+	                                                   (merge-with (partial merge-with merge) a b)
+	                                                   b)))
+	                                              ;each topic must be done in a different thread
+		                                                 (pmap-exec
+	                                                           exec
+	                                                           (fn [x];x = topic
+		                                                             (calculate-locked-offsets x group-conn
+		                                                                   ;;we need to remove all other topics from the offset map
+		                                                                   (into {} (for [[broker topics] broker-offsets1
+		                                                                              [topic1 offsets] topics :when (= topic1 x) ] [broker {x offsets}]))
+		                                                                   conf (get cached-offsets1 x) ))
+	                                                      @topics-ref))
+	             _ (do (info "cached-offsets : " cached-offsets))
+	             broker-offsets2 broker-offsets
+	             ;_ (do (info "offsets " broker-offsets))
+	             producers2  (doall (create-producers-if-needed broker-offsets2 producers conf))
+	             timer-ctx (.time m-consume-cycle)
+	             q (consume-brokers! producers2 exec group-conn broker-offsets2 msg-ch conf)]
+
+
+		       (let [[v errors] q]
+				    (if (and (not (nil? errors)) (> (count errors) 0))
+				      (do
+				         (error "Error close and reconnect: " errors)
+
+				         (let [[producers broker-offsets] (close-and-reconnect conn metadata-producers producers topics-ref errors conf)]
+		                (info "Got new consumers " (map :broker producers))
+		                (persist-error-offsets group-conn broker-offsets errors conf)
+	                  (.stop timer-ctx)
+				            (recur producers2 broker-offsets cached-offsets)))
+				      (do
+	               (if (< (reduce #(+ %1 (count %2)  ) 0 (vals v)) 1) ; if we were reading data, no need to pause
+		               (do (info "sleep: " fetch-poll-ms) (<!! (timeout fetch-poll-ms))))
+
+	               (.stop timer-ctx)
+	               (recur producers2 (update-broker-offsets broker-offsets2 v) cached-offsets))))
+
+				      ))))

 (defn consume [conn metadata-producers group-conn msg-ch topics-ref conf]
   "Entry point for topic consumption,


Nodes connected, connection in background

and all is fine.

TODO: Understand setWorldExtent.

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

--- conexp/graphics/trials.clj
+++ conexp/graphics/trials.clj
@@ -186,17 +186,39 @@

 ;;; simple thing which can be moved around

-(defn add-thing-to-move-around [owner x y]
-  (let [segment (GSegment.)
+(defn add-node [scn x y]
+  (let [object (GObject.)
+	segment (GSegment.)
 	style (GStyle.)]
-    (.addSegment owner segment)
+    (.addSegment object segment)
+    (.add scn object)
     (doto style
       (.setForegroundColor (Color.  6  6 86))
       (.setBackgroundColor (Color. 23 11 84)))
     (.setStyle segment style)
     (.setGeometryXy segment (Geometry/createCircle (double x) (double y) 10.0))
-    (.setUserData segment (ref {:position [x y]}))
-    segment))
+    (.setUserData object (ref {:type :node, :position [x y]}))
+    object))
+
+(defn connect-nodes [scn x y]
+  (let [[x1 x2] (:position @(.getUserData x))
+	[y1 y2] (:position @(.getUserData y))
+	c (GObject.)
+	line (GSegment.)]
+    (.add scn c)
+    (.addSegment c line)
+    (.toBack c)
+    (.setUserData c (ref {:type :connection}))
+    (.setGeometry line x1 x2 y1 y2)
+    (dosync
+     (alter (.getUserData x) assoc :upper (conj (:upper @(.getUserData x)) c))
+     (alter (.getUserData y) assoc :lower (conj (:lower @(.getUserData y)) c)))))
+
+(defn node? [thing]
+  (= (:type @(.getUserData thing)) :node))
+
+(defn connection? [thing]
+  (= (:type @(.getUserData thing)) :connection))

 (defn move-interaction []
   (let [interaction-obj (ref nil)
@@ -206,8 +228,8 @@
       (event [scn evt x y]
 	(condp = evt
 	   GWindow/BUTTON1_DOWN
-	   (let [thing (.findSegment scn x y)]
-	     (when (.getUserData thing)
+	   (let [thing (.find scn x y)]
+	     (when (node? thing)
 	       (dosync
 		(ref-set interaction-obj thing)
 		(ref-set x0 x)
@@ -216,15 +238,17 @@
 	   (let [dx (- x @x0)
 		 dy (- y @y0)]
 	     (when @interaction-obj
-	       (.translate @interaction-obj dx dy)
+	       (.translate (.getSegment @interaction-obj) dx dy)
 	       (doseq [c (:upper @(.getUserData @interaction-obj))]
-		 (let [c1 (aget (.getX c) 0)
+		 (let [c (.getSegment c)
+		       c1 (aget (.getX c) 0)
 		       c2 (aget (.getY c) 0)
 		       d1 (aget (.getX c) 1)
 		       d2 (aget (.getY c) 1)]
 		   (.setGeometry c (+ c1 dx) (+ c2 dy) d1 d2)))
 	       (doseq [c (:lower @(.getUserData @interaction-obj))]
-		 (let [c1 (aget (.getX c) 0)
+		 (let [c (.getSegment c)
+		       c1 (aget (.getX c) 0)
 		       c2 (aget (.getY c) 0)
 		       d1 (aget (.getX c) 1)
 		       d2 (aget (.getY c) 1)]
@@ -239,16 +263,6 @@
 	    (ref-set interaction-obj nil))
 	   nil)))))

-(defn connect-nodes [scn x y]
-  (let [[x1 x2] (:position @(.getUserData x))
-	[y1 y2] (:position @(.getUserData y))
-	c (GSegment.)]
-    (.addSegment scn c)
-    (.setGeometry c x1 x2 y1 y2)
-    (dosync
-     (alter (.getUserData x) assoc :upper #{c})
-     (alter (.getUserData y) assoc :lower #{c}))))
-
 (defn show-some-picture []
   (let [wnd (GWindow.)
 	scn (GScene. wnd)
@@ -258,7 +272,10 @@
     (.setLayout frm (BorderLayout.))
     (-> frm .getContentPane (.add (.getCanvas wnd) BorderLayout/CENTER))
     (.setSize frm 300 300)
-    (let [x (add-thing-to-move-around scn 100 100)
-	  y (add-thing-to-move-around scn 50 50)]
-      (connect-nodes scn x y))
+    (let [x (add-node scn 100 100)
+	  y (add-node scn 50 50)
+	  z (add-node scn 75 23)]
+      (connect-nodes scn x y)
+      (connect-nodes scn x z)
+      (connect-nodes scn y z))
     (.setVisible frm true)))


Back to no magic (auto insertion of closing stuff) in default editing mode

- Fixes Issue 524 and many community complaints

--- ccw.core/src/clj/ccw/editors/clojure/PareditAutoEditStrategyImpl.clj
+++ ccw.core/src/clj/ccw/editors/clojure/PareditAutoEditStrategyImpl.clj
@@ -31,9 +31,12 @@
    })

 (def ^:dynamic *strict-commands*
-  #{:paredit-close-round, :paredit-close-square, :paredit-close-curly,
-    :paredit-forward-delete, :paredit-backward-delete})
-
+  #{:paredit-open-round, :paredit-close-round,
+    :paredit-open-square, :paredit-close-square,
+    :paredit-open-curly, :paredit-close-curly,
+    :paredit-forward-delete, :paredit-backward-delete,
+    :paredit-doublequote})
+
 (def
   command-preferences
   "map of command to map of keyword -> associated global preference key"


[clean] remove debug print.

[clean] remove debug print.

--- src/ombs/dbold.clj
+++ src/ombs/dbold.clj
@@ -114,7 +114,6 @@
                                   (sql/where {:name ename :date date} ) )))))

 (defn can-finish? [ename date]
-  (println "result: " (replace (first (sql/select summary (sql/where {:event ename :date date}))) [:debits :credits]))
   (zero? (reduce - (replace (first (sql/select summary (sql/where {:event ename :date date}))) [:debits :credits]))))
 ;============================================== GOODS  =================================================


don't print task namespace warning on 'cake deps'

--- src/cake/task.clj
+++ src/cake/task.clj
@@ -63,7 +63,8 @@
   [namespace]
   (try (require namespace)
        (catch java.io.FileNotFoundException e
-         (when-not (= 'tasks namespace)
+         (when (and (not= 'tasks namespace)
+                    (not= "deps" (first *args*)))
            (println "warning: unable to find tasks namespace" namespace)
            (println "  if you've added a new plugin to :dev-dependencies you must run 'cake deps' to install it"))))
   (into [namespace]


Remove long-dead dependency. (#1303)

Remove long-dead dependency. (#1303)

This dependency has been dead since 2016 when federation was removed.

--- scheduler/project.clj
+++ scheduler/project.clj
@@ -23,8 +23,6 @@
                  ^:displace [cheshire "5.3.1"]
                  [byte-streams "0.1.4"]
                  [org.clojure/data.json "0.2.2"]
-                 [com.taoensso/nippy "2.8.0"
-                  :exclusions [org.clojure/tools.reader]]
                  [circleci/clj-yaml "0.5.5"]
                  [camel-snake-kebab "0.4.0"]
                  [com.rpl/specter "1.0.1"]


upgrade chessground

upgrade chessground

--- cljs/puzzle2/project.clj
+++ cljs/puzzle2/project.clj
@@ -8,7 +8,7 @@
                  [com.facebook/react "0.11.1"]
                  [quiescent "0.1.4"]
                  [jayq "2.5.2"]
-                 [org.lichess/chessground "0.3.11"]]
+                 [org.lichess/chessground "0.4.0"]]
   :cljsbuild
   {:builds
    {:dev


Targetable StaticResourceService

Targetable StaticResourceService

Allow record instances to be targetted with path-for.

--- modules/bidi/src/modular/bidi.clj
+++ modules/bidi/src/modular/bidi.clj
@@ -4,7 +4,7 @@
   (:require
    [schema.core :as s]
    [modular.ring :refer (WebRequestHandler)]
-   [com.stuartsierra.component :as component]
+   [com.stuartsierra.component :as component :refer (Lifecycle)]
    [bidi.bidi :as bidi :refer (match-route resolve-handler)]
    [bidi.ring :refer (resources-maybe make-handler)]
    [clojure.tools.logging :refer :all]
@@ -46,11 +46,23 @@
        map->WebServiceFromArguments))

 (defrecord StaticResourceService [uri-context resource-prefix]
+  Lifecycle
+  (start [component]
+    (assoc component
+           :target (resources-maybe
+                    {:prefix resource-prefix
+                     ;; By adding uri-context, we ensure that the
+                     ;; path-for function works properly, as it uses an
+                     ;; = check, so we avoid the situation where the
+                     ;; wrong instance of this record returns a non-nil
+                     ;; value
+                     ::uri-context uri-context})))
+  (stop [component] component)
   WebService
   (request-handlers [_] {})
-  (routes [_]
-    [uri-context (resources-maybe {:prefix resource-prefix})])
-  (uri-context [_] "/"))
+  (routes [component]
+    [uri-context (:target component)])
+  (uri-context [_] uri-context))

 (def new-static-resource-service-schema
   {:uri-context s/Str
@@ -58,9 +70,9 @@

 (defn new-static-resource-service [& {:as opts}]
   (->> opts
-       (merge {})
-       (s/validate new-static-resource-service-schema)
-       (map->StaticResourceService)))
+    (merge {:uri-context "/"})
+    (s/validate new-static-resource-service-schema)
+    (map->StaticResourceService)))

 ;; Production of a Ring handler from a single WebService component


Simplify tagged value extension macro.

Simplify tagged value extension macro.

Instead of allowing a variable number of body forms, only accept one
expression as the body for `edn-value`.

--- src/puget/data.clj
+++ src/puget/data.clj
@@ -85,17 +85,15 @@
   given symbol as the tag and use the body to calculate the value. The symbol
   'this' is bound to the data. This macro also defines a print-method which
   delegates to edn-str."
-  [t tag & body]
+  [t tag expr]
   `(do
      (extend-type ~t
        TaggedValue
        (edn-tag [~'this] (quote ~tag))
        (edn-value [~'this]
-         ~@(if (and (= 1 (count body))
-                    (or (symbol? (first body))
-                        (keyword? (first body))))
-             (list (list (first body) 'this))
-             body)))
+         ~(if (or (symbol? expr) (keyword? expr))
+            (list expr 'this)
+            expr)))
      (defprint-method ~t)))


Delete WrapperComponent functionality

Delete WrapperComponent functionality

--- src/quiescent.cljs
+++ src/quiescent.cljs
@@ -33,51 +33,6 @@
     (fn [value & static-args]
       (react-component #js {:value value :statics static-args}))))

-(def WrapperComponent
-  "Wrapper component used to mix-in lifecycle access"
-  (.createClass js/React
-     #js {:render
-          (fn [] (this-as this (aget (.-props this) "wrappee")))
-          :componentDidUpdate
-          (fn [prev-props prev-state node]
-            (this-as this
-              (when-let [f (aget (.-props this) "onUpdate")]
-                (binding [*component* this]
-                  (f node)))))
-          :componentDidMount
-          (fn [node]
-            (this-as this
-              (when-let [f (aget (.-props this) "onMount")]
-                       (f node))))}))
-
-(defn on-update
-  "Wrap a component, specifying a function to be called on the
-  componentDidUpdate lifecycle event.
-
-  The function will be passed the rendered DOM node."
-  [child f]
-  (WrapperComponent #js {:wrappee child
-                         :onUpdate f}))
-
-(defn on-initial-render
-  "Wrap a component, specifying a function to be called on the
-  componentDidMount lifecycle event.
-
-  The function will be passed the rendered DOM node."
-  [child f]
-  (WrapperComponent #js {:wrappee child
-                         :onMount f}))
-
-(defn on-render
-  "Wrap a component, specifying a function to be called on the
-  componentDidMount AND the componentDidUpdate lifecycle events.
-
-  The function will be passed the rendered DOM node."
-  [child f]
-  (WrapperComponent #js {:wrappee child
-                         :onUpdate f
-                         :onMount f}))
-
 (defn render
   "Given a ReactJS component, immediately render it, rooted to the
   specified DOM node."


Add rename

Add rename

--- src/swiss/core.clj
+++ src/swiss/core.clj
@@ -9,21 +9,21 @@
            [java.io File InputStreamReader StringReader StringWriter]))

 (defn- compress-javascript* [input &
-                           [{:keys
-                             [disable-optimizations?
-                              preserve-semi?
-                              nomunge?
-                              line-break
-                              charset
-                              verbose?]
-                             :or
-                             {disable-optimizations? false
-                              verbose? false
-                              preserve-semi? false
-                              nomunge? false
-                              line-break -1
-                              charset "utf-8"}}
-                            :as options]]
+                             [{:keys
+                               [disable-optimizations?
+                                preserve-semi?
+                                nomunge?
+                                line-break
+                                charset
+                                verbose?]
+                               :or
+                               {disable-optimizations? false
+                                verbose? false
+                                preserve-semi? false
+                                nomunge? false
+                                line-break -1
+                                charset "utf-8"}}
+                              :as options]]
   (let [compressor (JavaScriptCompressor.
                     (StringReader. (last input))
                     nil)
@@ -76,9 +76,15 @@
           :prev-fn :concat}))

 (defn output-to [swiss-map file-path]
-  (doseq [[k v] (get-previous-output swiss-map)]
-    (spit (str file-path "/" k) v))
   (merge swiss-map
-         {:into-file file-path
-          :prev-fn :into-file}))
+         {:output-to (into {} (for [[k v] (get-previous-output swiss-map)]
+                                (do
+                                  (spit (str file-path "/" k) v)
+                                  {k v})))
+          :prev-fn :output-to}))

+(defn rename [swiss-map new-file-name]
+  (merge swiss-map
+         {:rename
+          {new-file-name (first (vals (get-previous-output swiss-map)))}
+          :prev-fn :rename}))


Add active class to play button when playing.

--- src/airhead_frontend/components.cljs
+++ src/airhead_frontend/components.cljs
@@ -42,7 +42,7 @@
                {:on-click #(.play audio)}
                [:i.fa.fa-play]
                [:span "Play"]]
-              [:button.pure-button
+              [:button.pure-button.pure-button-active
                {:on-click #(.pause audio)}
                [:i.fa.fa-pause]
                [:span "Pause"]]))


cleanup (declare) and function order

cleanup (declare) and function order

--- src/beat_detector/core.clj
+++ src/beat_detector/core.clj
@@ -44,7 +44,9 @@
   "Clojure's 'take' function implemented on sound data.
   Returns [(take n left-data) (take n right-data)]."
   [n data]
-  (mapv (fn [x] (take n x)) data))
+  (if (>= 0 n)
+    []
+    (mapv (fn [x] (vec (take n x))) data)))

 (defn drop-data
   "Clojure's 'drop' function implemented on sound data.


some print statements

some print statements

--- src/bitsplit_cli/core.cljs
+++ src/bitsplit_cli/core.cljs
@@ -18,6 +18,8 @@
 (set! (.-delimiter prompt) "")
 (set! (.-colors prompt) false)

+(set! *print-fn* #(.log js/console %))
+
 (def storage (->File SPLITS_LOCATION))
 (def client (new-client DIR storage))

@@ -30,6 +32,7 @@
         (.get prompt message
             (fn [err input]
                 (when (-> input nil? not)
+                    (println "oh noes a read" input message)
                     (put! return
                         (aget input message)))))
         return))


Explicity use hex encoding in file store.

--- src/blobble/store/file.clj
+++ src/blobble/store/file.clj
@@ -20,7 +20,8 @@
     [blobble.core :as blob]
     [clojure.java.io :as io]
     [clojure.string :as string]
-    [multihash.core :as multihash])
+    [multihash.core :as multihash]
+    [multihash.hex :as hex])
   (:import
     java.io.File
     java.util.Date))
@@ -33,13 +34,14 @@
   identifier."
   ^File
   [root id]
-  (let [{:keys [algorithm digest]} id]
+  (let [algorithm (:algorithm id)
+        digest (hex/encode (:digest id))]
     (io/file
       root
       (name algorithm)
       (subs digest 0 3)
       (subs digest 3 6)
-      (multihash/encode-hex id))))
+      (multihash/hex id))))

 (defn- file->id


add media types

add media types

--- rest-media-demo/src/rest_media_demo/handler.clj
+++ rest-media-demo/src/rest_media_demo/handler.clj
@@ -8,6 +8,10 @@
             [ring.middleware.defaults :refer [wrap-defaults site-defaults]]
             [clojure.data.json :as json]))

+(def default-media-types
+  ["application/json"
+   "text/plain"
+   "text/html"])
 (defroutes app-routes
   (GET "/" [] "Hello World")
   (route/not-found "Not Found"))


restored clear test of secretshare

restored clear test of secretshare

--- test/freecoin/fxc_test.clj
+++ test/freecoin/fxc_test.clj
@@ -52,8 +52,9 @@

   (def secret (fxc/create-secret param/encryption "STUB" (:ah fake) (:al fake)))

-  (pp/pprint (format "%x FXC %x" (:ah fake) (:al fake)))
+
   (pp/pprint nxtpass)
+  (pp/pprint secret)

   (fact "cookie is first slice" (first (:slices secret)) => (:cookie secret))


Bug fix for SP_DOMAIN support

Bug fix for SP_DOMAIN support

--- 2-collectors/clojure-collector/src/snowplow/clojure_collector/responses.clj
+++ 2-collectors/clojure-collector/src/snowplow/clojure_collector/responses.clj
@@ -45,8 +45,8 @@
   (merge
     {:value    id
      :expires (now-plus duration)}
-   (when-let [domain nil]
-    {:domain   domain})))
+   (when-let [d domain]
+    {:domain   d})))

 (defn- generate-id
   "Checks `cookies` and generates a uuid


Adding timing for JUnit tests

Adding timing for JUnit tests

--- jvm-runner/src/clojure/codewars/runner/java.clj
+++ jvm-runner/src/clojure/codewars/runner/java.clj
@@ -1,5 +1,6 @@
 (ns codewars.runner
   (:require [codewars.runner :refer [run]]
+            [codewars.clojure.test]
             [clojure.java.io :as io]
             [codewars.util :refer [write-code!]])
   (:import [codewars.java TempDir]
@@ -9,7 +10,9 @@
            [codewars.java CwRunListener]
            [java.io IOException]))

-(defn- compile! [& files]
+(defn- compile!
+  "Compile files using the java compiler"
+  [& files]
   (let [compilation-result
         (-> (ToolProvider/getSystemJavaCompiler)
             ;; TODO: write compilation errors somewhere?
@@ -18,19 +21,25 @@
       0
       (throw (IOException. "Java compilation error")))))

-(defn- load-class [dir class-name]
+(defn- load-class
   "Load a java class in a specified directory"
+  [dir class-name]
   (let [class-loader
         (URLClassLoader/newInstance
          (into-array [(-> dir .toURI .toURL)]))]
     (Class/forName (name class-name) true class-loader)))

-(defn- run-junit-tests [fixture-class]
+(defn- run-junit-tests
+  "Run a JUnit test using the Codewars Formatter for a given fixture-class"
+  [fixture-class]
   (let [runner (JUnitCore.)]
     (.addListener runner (CwRunListener.))
-    (.run runner (into-array [fixture-class]))))
+    (codewars.clojure.test/time
+     (.run runner (into-array [fixture-class])))))

-(defn- file-names [files]
+(defn- file-names
+  "Filter a sequence of files writen by write-code! and output their names"
+  [& files]
   (for [{:keys [:file-name]} files
         :when (not (nil? file-name))]
     file-name))
@@ -40,7 +49,7 @@
   (let [dir (TempDir/create "java")
         setup (when (not (empty? setup)) (write-code! "java" dir setup))
         solution (write-code! "java" dir solution)
-        files (file-names [setup solution])]
+        files (file-names setup solution)]
     (apply compile! files)
     (-> solution
         :class-name
@@ -54,6 +63,6 @@
         fixture (write-code! "java" dir fixture)
         setup (when (not (empty? setup)) (write-code! "java" dir setup))
         solution (write-code! "java" dir solution)
-        files (file-names [fixture setup solution])]
+        files (file-names fixture setup solution)]
     (apply compile! files)
     (->> fixture :class-name (load-class dir) run-junit-tests)))


Removed unnecessary tmp file output from core test

--- test/merkki/core_test.cljc
+++ test/merkki/core_test.cljc
@@ -16,35 +16,33 @@

 (deftest markdown-test
   (testing "Given a vector of block elements, return a string of markdown formatted text"
-    (is (= (let [test-text (markdown
-                            [[:uh1 "Markdown Test"]
-                             "This is a test of the merkki markdown rendering system."
-                             [:h2 "Span Elements"]
-                             ["A subvector of strings can be passed, allowing usage of span elements like "
-                              [:em "emphasized"] ", " [:strong "strong"] ", " [:link "links" "http://www.google.com"] ", and "
-                              [:code "code"] ". We can also do auto-links like so: " [:auto-link "http://www.github.com/jarcane/merkki"] "."]
-                             [:image
-                              "Here's a pug to show off images."
-                              "https://pbs.twimg.com/profile_images/378800000515894032/0758bced4b2f071fbf9916e15d28e7a8.jpeg"]
-                             [:h2 "Block Elements"]
-                             [:ol
-                              "Here"
-                              "Is"
-                              "An"
-                              "Ordered"
-                              "List"]
-                             [:ul
-                              "Here's"
-                              "An"
-                              "Unordered"
-                              "List"]
-                             [:code-block
-                              "(defn some-code [] \"Hello World!\")"]
-                             [:blockquote
-                              "Here is a big long block quote that is too long"
-                              "so we've made it onto multiple lines because that"
-                              "is just how we roll."]])]
-             (spit "/tmp/merkki-temp.md" test-text)
-             test-text)
+    (is (= (markdown
+            [[:uh1 "Markdown Test"]
+             "This is a test of the merkki markdown rendering system."
+             [:h2 "Span Elements"]
+             ["A subvector of strings can be passed, allowing usage of span elements like "
+              [:em "emphasized"] ", " [:strong "strong"] ", " [:link "links" "http://www.google.com"] ", and "
+              [:code "code"] ". We can also do auto-links like so: " [:auto-link "http://www.github.com/jarcane/merkki"] "."]
+             [:image
+              "Here's a pug to show off images."
+              "https://pbs.twimg.com/profile_images/378800000515894032/0758bced4b2f071fbf9916e15d28e7a8.jpeg"]
+             [:h2 "Block Elements"]
+             [:ol
+              "Here"
+              "Is"
+              "An"
+              "Ordered"
+              "List"]
+             [:ul
+              "Here's"
+              "An"
+              "Unordered"
+              "List"]
+             [:code-block
+              "(defn some-code [] \"Hello World!\")"]
+             [:blockquote
+              "Here is a big long block quote that is too long"
+              "so we've made it onto multiple lines because that"
+              "is just how we roll."]])
            #?(:clj (slurp (io/resource "merkki-test.md"))
               :cljs ""))))) ;; FIXME: Find alternate method to bring in test spec doc in CLJS


test.pool: fix a timing bug.

test.pool: fix a timing bug.

with-pool-test needs time to allow the pool to regenerate.

--- test/riemann/test/pool.clj
+++ test/riemann/test/pool.clj
@@ -78,6 +78,7 @@
                                    (throw (RuntimeException. "whoops")))))

            ; Pool should have regenerated.
+           (Thread/sleep 250)
            (is (= 2 @x))))

 (deftest ^:time unreliable-test


reverting back to only adding tid

reverting back to only adding tid

--- src/celestial/api/jobs.clj
+++ src/celestial/api/jobs.clj
@@ -127,7 +127,7 @@
          :notes "job status can be either pending, processing, done or nil"}
         (let [{:keys [username]} (friend/current-authentication)
               {:keys [envs] :as user} (u/get-user username)]
-          (success (doall (map-vals (jobs/jobs-status envs) (partial map enrich-job))))))
+          (success (map-vals (jobs/jobs-status envs) (partial map add-tid-link)))))

   (GET- "/jobs/done" [^:int page ^:int offset]
       {:nickname "getDoneJobs" :summary "Get done jobs"}


Formatting

Formatting

--- src/clj/cglossa/server.clj
+++ src/clj/cglossa/server.clj
@@ -46,12 +46,12 @@
 (deftemplate page (io/resource "index.html") [])

 (defroutes app-routes
-           (resources "/")
-           (GET "/request" [] handle-dump)
-           (GET "/" req (page)))
+  (resources "/")
+  (GET "/request" [] handle-dump)
+  (GET "/" req (page)))

 (defroutes db-routes
-           (GET "/corpus" [code] (transit-response (db/get-corpus code))))
+  (GET "/corpus" [code] (transit-response (db/get-corpus code))))

 (def http-handler
   (let [r (routes #'db-routes #'app-routes)


Caught minor error in canon for raising double-eseqs.

--- src/clj/minijava/canon.clj
+++ src/clj/minijava/canon.clj
@@ -19,7 +19,7 @@
   (let [s1 (canon-local (:seqs tree ))
         s2 (canon-local (get-in tree [:exp :seqs]))
         e  (canon-local  (get-in tree [:exp :exp]))]
-   		(ExpSeq ( build-args (Seq s1 s2)) e)))
+   		(ExpSeq (build-args (Seq [s1 s2])) e)))

 (defn raise-eseq-left-binop
   "(BinaryOp op (ExpSeq stmt expr) e2) -> (ExpSeq stmt (BinaryOp op expr e2))"
@@ -302,17 +302,18 @@
 	;;		(contains-call? s) ;;this wont work with the current approach; have to remove calls in a separate procedure
 	;;				(do (reset! *local-change* true) (reorganize-call s))
 		(= :minijava.ir/Seq (type s))
-			(do  	(Seq (vec(flatten;;run canon-local on each element of the sequence
-					  (for [s (:seqs s)] (canon-local s))))))
+			 	(Seq (build-args;;run canon-local on each element of the sequence
+					  (for [s (:seqs s)]
+								 (canon-local s))))
 		(= :minijava.ir/ExpSeq (type s)) ;;is this right?
-			(do  	(ExpSeq (vec (flatten;;run canon-local on each element of the sequence
-					  (for [s (:seqs s)] (canon-local s)))) (canon-local (:exp s))) )
+			 	(ExpSeq (build-args;;run canon-local on each element of the sequence
+					  (for [s (:seqs s)] (canon-local s))) (canon-local (:exp s)))
 		(= :minijava.ir/BinaryOp (type s))
 			 (BinaryOp (:op s) (canon-local (:exp1 s))  (canon-local (:exp2 s)))
 		(= :minijava.ir/Conditional (type s))
 			(Conditional (:op s) (canon-local (:exp1 s))  (canon-local (:exp2 s)) (:t s) (:f s))
 		(= :minijava.ir/Call (type s));;note, if the args of the call are themselves expseqs, they will be caught above by matches-call-arg
-			(Call (canon-local (:lbl s))  (vec (flatten   (for [s (:args s)] (canon-local s)))))
+			(Call (canon-local (:lbl s))  (build-args  (for [s (:args s)] (canon-local s))))
 		(= :minijava.ir/Mem (type s))
 				(Mem (canon-local (:adr s)))
 		(= :minijava.ir/Jump (type s))


Close channel when changing user

Close channel when changing user

--- src/clj/skytwit/server.clj
+++ src/clj/skytwit/server.clj
@@ -135,7 +135,7 @@
         uid (:id (get-user-profile creds screen-name))
         stop-old (put-old-tweets-on-channel creds screen-name ch)
         stop-new (put-new-tweets-on-channel creds screen-name ch)
-        stop-fn (fn [] (stop-old) (stop-new))]
+        stop-fn (fn [] (stop-old) (stop-new) (async/close! ch))]
     (if-let [stop-previous (:stop-fn @at)] (stop-previous))
     (reset! at {:user-name screen-name
                 :user-id uid


Use destruction in getting season-episode part

--- src/clj/subman/helpers.clj
+++ src/clj/subman/helpers.clj
@@ -40,9 +40,9 @@
 (defn get-season-episode
   "Add season and episode filters"
   [text]
-  (if-let [nums (re-find #"[sS](\d+)[eE](\d+)" text)]
-    [(remove-first-0 (get nums 1))
-     (remove-first-0 (get nums 2))]
+  (if-let [[_ season episode] (re-find #"[sS](\d+)[eE](\d+)" text)]
+    [(remove-first-0 season)
+     (remove-first-0 episode)]
     ["" ""]))

 (defn get-from-file


Remove whitespace

Remove whitespace

--- src/clj_gatling/report.clj
+++ src/clj_gatling/report.clj
@@ -14,7 +14,7 @@
         response-start end
         execution-end end
         result (if (:result request) "OK" "KO")]
-    [scenario-name id "REQUEST" "" (:name request)  execution-start request-end response-start execution-end result "\u0020"]))
+    [scenario-name id "REQUEST" "" (:name request) execution-start request-end response-start execution-end result "\u0020"]))

 (defn- scenario->rows [scenario]
   (let [start (str (:start scenario))


don't show alert when triggering

don't show alert when triggering

--- src/cljs/lambdacd/api.cljs
+++ src/cljs/lambdacd/api.cljs
@@ -13,8 +13,7 @@

 (defn- nop [response])

-(defn- confirm-triggered [response]
-  (js/alert "triggered"))
+(defn- confirm-triggered [response])

 (defn- after-retriggered [response]
   (let [build-number (get response "build-number")]


Renamed :write to :record

Renamed :write to :record

https://app.asana.com/0/17212341701456/45607689818961

--- src/cljs/memento/core.cljs
+++ src/cljs/memento/core.cljs
@@ -189,7 +189,7 @@
     (cookies/set! :token token)
     (-> app-state
         (assoc-in [:credentials :token] token)
-        (assoc-in [:ui-state :section] (if (empty? token) :login :write))
+        (assoc-in [:ui-state :section] (if (empty? token) :login ::record))
         (assoc-in [:ui-state :wip-login?] false)
         (assoc-in [:credentials :password] nil)
         (assoc-in [:credentials :password2] nil))))
@@ -334,7 +334,7 @@
   (fn [app-state [_ thought]]
     (-> app-state
         (assoc-in [:note :focus] thought)
-        (assoc-in [:ui-state :section] :write))
+        (assoc-in [:ui-state :section] ::record))
     ))

@@ -404,7 +404,7 @@
              [navbar-item "Login" :login]
              [navbar-item "Sign up" :signup]]
             [:ul {:class "nav navbar-nav"}
-             [navbar-item "Record" :write]
+             [navbar-item "Record" ::record]
              [navbar-item "Remember" :remember]])
           ]]
         ]]
@@ -681,7 +681,7 @@
              (not= :signup @section))
       (dispatch [:set-ui-section :login]))
     (condp = @section
-      :write [write-section]
+      ::record [write-section]
       :remember [memory-list]
       [login-form]
       )
@@ -691,7 +691,7 @@
 (defn header []
   (let [state  (subscribe [:ui-state :section])
         header (condp = @state
-                 :write "Make a new memory"
+                 ::record "Make a new memory"
                  :remember "Remember"
                  "")]
     (if (not-empty header)