bugfix for null references

bugfix for null references

--- src/ardoq/swagger/swagger2_refs.clj
+++ src/ardoq/swagger/swagger2_refs.clj
@@ -53,13 +53,16 @@
   (let [wid (get-in resource [:component :rootWorkspace])
         _id (get-in resource [:component :_id])]
     (doseq [{:keys [$ref]} parameters]
-      (let [k (keyword (last (.split $ref "/")))]
-        (if-let [m (k params)]
-          (-> (api/map->Reference {:rootWorkspace wid
-                                   :source (str _id)
-                                   :target (str(:_id m))
-                                   :type 1})
-              (api/create client)))))))
+      (if $ref
+        (let [k (keyword (last (.split $ref "/")))]
+          (if-let [m (k params)]
+            (-> (api/map->Reference {:rootWorkspace wid
+                                     :source (str _id)
+                                     :target (str(:_id m))
+                                     :type 1})
+              (api/create client)))))
+
+      )))

 (defn create-input-refs [client input-models models comp id]
   (doall (keep (fn [k]


remove WARNING because of unknown compiler option.

--- src/asset_builder/builders/cljs.clj
+++ src/asset_builder/builders/cljs.clj
@@ -20,6 +20,6 @@
                    (format "ClojureScript [%s] has been compiled." source-path)]
     (->> (merge
            {:output-dir "target/out"}
-           cljs
+           (dissoc cljs :source-path)
            {:verbose true})
          (cljs-build! source-path))))


Better count-adjacency

Better count-adjacency

--- src/atom_finder/results_sandbox.clj
+++ src/atom_finder/results_sandbox.clj
@@ -93,16 +93,19 @@
 (defn count-adjacent [a]
   (- (count a) (count (dedupe a))))

-'((->> (range 7)
-     (repeat 2)
-     flatten
-     combo/permutations
-     (map count-adjacent)
-     frequencies
-     sort
-     (map prn)
-     time-mins
-     ))
+'((->> (range 8)
+       (map
+        #(->> (range (pap %))
+              (repeat 2)
+              flatten
+              combo/permutations
+              (map count-adjacent)
+              frequencies
+              (sort-by first)
+              pprint
+              time-mins
+              ))))
+

 (->> "tmp/emacs_md5_01_0dc2e11dfd2b264679024d9939775a1ccebb13d8.c"
      parse-file


Whitespace

Whitespace


Refactor, only provide pipeline name if set

--- src/buildviz/controllers/status.clj
+++ src/buildviz/controllers/status.clj
@@ -2,16 +2,14 @@
   (:require [buildviz.data.results :as results]
             [buildviz.util.http :as http]))

-(defn- with-latest-build-start [all-builds response]
-  (if-let [build-starts (seq (remove nil? (map :start all-builds)))]
-    (assoc response
-           :latestBuildStart (apply max build-starts)
-           :earliestBuildStart (apply min build-starts))
-    response))
-
 (defn get-status [build-results pipeline-name]
   (let [all-builds (results/all-builds build-results)
-        total-build-count (count all-builds)]
-    (http/respond-with-json (with-latest-build-start all-builds
-                              {:totalBuildCount total-build-count
-                               :pipelineName pipeline-name}))))
+        total-build-count (count all-builds)
+        build-starts (->> all-builds
+                          (map :start)
+                          (remove nil?)
+                          seq)]
+    (http/respond-with-json (cond-> {:totalBuildCount total-build-count}
+                              pipeline-name (assoc :pipelineName pipeline-name)
+                              build-starts (assoc :latestBuildStart (apply max build-starts)
+                                                  :earliestBuildStart (apply min build-starts))))))


Add tests for multihoming-related properties

--- test/postal/test/smtp.clj
+++ test/postal/test/smtp.clj
@@ -65,4 +65,12 @@
              :pass nil}
             {"mail.smtp.port" 25
              "mail.smtp.auth" "false"
-             "mail.smtp.host" "smtp.bar.dom"}))
+             "mail.smtp.host" "smtp.bar.dom"})
+  (is-props {:host "smtp.bar.dom"
+             :localaddress "1.2.3.4"
+             :localhost "mail.bar.dom"}
+            {"mail.smtp.port" 25
+             "mail.smtp.auth" "false"
+             "mail.smtp.host" "smtp.bar.dom"
+             "mail.smtp.localaddress" "1.2.3.4"
+             "mail.smtp.localhost" "mail.bar.dom"}))


fix modal for anon users

fix modal for anon users

--- src/cljs/salava/badge/ui/modal.cljs
+++ src/cljs/salava/badge/ui/modal.cljs
@@ -38,7 +38,7 @@
                                 :content-language (init-content-language (:content data))
                                 :tab-no tab-no
                                 :permission "success"))
-                 (init-badge-connection state (:badge_id data))))}
+               (if (:user-logged-in @state)  (init-badge-connection state (:badge_id data)))))}
     (fn [] (swap! state assoc :permission "error"))))

 (defn show-settings-dialog [badge-id state init-data context]


Rename hmac functions with more consistent names.

--- src/clojure/buddy/core/mac/hmac.clj
+++ src/clojure/buddy/core/mac/hmac.clj
@@ -122,6 +122,6 @@
   [input key ^Keyword alg]
   (make-hmac input key alg))

-(defn hmac-verify
+(defn verify
   [input ^bytes signature key ^Keyword alg]
   (verify-hmac input signature key alg))


Added genome_two_point_crossover instruction.

--- src/clojush/instructions/genome.clj
+++ src/clojush/instructions/genome.clj
@@ -477,4 +477,19 @@
                                                 :alignment-deviation dev}))))
                         :genome)))
       state)))
+
+(define-registered
+  genome_two_point_crossover
+  ^{:stack-types [:genome]}
+  (fn [state]
+    (if (not (empty? (rest (:genome state))))
+      (let [genome1 (first (:genome state))
+            genome2 (second (:genome state))]
+        (->> (pop-item :genome state)
+             (pop-item :genome)
+             (push-item (vec (:genome (two-point-crossover
+                                        {:genome genome}
+                                        @push-argmap)))
+                        :genome)))
+      state)))
 ;; @@


Show discuss when trying to add a new argument

--- src/discuss/components/tooltip.cljs
+++ src/discuss/components/tooltip.cljs
@@ -107,12 +107,12 @@
    (track-user-selection))
   (render [this]
           (html [:div#discuss-tooltip
-                 [:span.pointer {:onClick (fn [] (clipboard/add-item!) (hide))}
+                 [:span.pointer {:onClick #((clipboard/add-item!) (hide))}
                   (vlib/fa-icon "fa-bookmark-o")
                   (translate :common :save :space)]
                  (vlib/safe-space) " " (vlib/safe-space)

-                 [:span.pointer {:onClick (fn [] (lib/change-view! :create/argument) (hide))}
+                 [:span.pointer {:onClick #((lib/change-view! :create/argument) (lib/show-overlay) (hide))}
                   (vlib/fa-icon "fa-comment")
                   (translate :tooltip :discuss/start :space)]


вывод сообщения об ошибке в меседжбоксе

вывод сообщения об ошибке в меседжбоксе

--- src-cljs/ixinfestor/net.cljs
+++ src-cljs/ixinfestor/net.cljs
@@ -26,9 +26,10 @@

     (events/listen req goog.net.EventType.ERROR
                    (fn [e]
-                     (let [response (t/read r (.getResponseText (.-target e)))]
+                     (let [response-text (.getResponseText (.-target e))
+                           response (t/read r response-text)]
                        (println "ERROR: " response)
-                       (js/alert "ОШИБКА ОБРАЩЕНИЯ К СЕРВЕРУ: " (str response))
+                       (js/alert (str "ОШИБКА ОБРАЩЕНИЯ К СЕРВЕРУ:\n" response))
                        (if error-fn (error-fn response)))))

     (events/listen req goog.net.EventType.COMPLETE


Add activity to reserved board slugs list.

--- src/oc/storage/resources/board.clj
+++ src/oc/storage/resources/board.clj
@@ -71,7 +71,7 @@

 ;; ----- Board Slug -----

-(def reserved-slugs #{"create-board" "settings" "boards" "all-posts" "drafts" "must-see" "bookmarks" "inbox" "new" "following" "unfollowing"})
+(def reserved-slugs #{"create-board" "settings" "boards" "all-posts" "drafts" "must-see" "bookmarks" "inbox" "new" "following" "unfollowing" "activity"})

 (declare list-boards-by-org)
 (defn taken-slugs


Adjust case of All-hands in default boards.

--- src/oc/storage/resources/board.clj
+++ src/oc/storage/resources/board.clj
@@ -29,7 +29,7 @@
 ;; ----- Data Defaults -----

 (def default-boards ["Who We Are" "Company News"])
-(def default-storyboards ["All-Hands Update" "Investor Update"])
+(def default-storyboards ["All-hands Update" "Investor Update"])

 (def default-access :team)


don't call generator-fn for nil records

don't call generator-fn for nil records

--- src/er_cassandra/model/alia/lookup.clj
+++ src/er_cassandra/model/alia/lookup.clj
@@ -40,12 +40,12 @@
    - old-record: previous primary table record (or nil for new)
    - record: upserted primary-table record to generate lookups for
              (or nil for deletion)"
-  [model
+  [entity
    table
    key
    old-record
    record]
-  (let [uber-key (t/uber-key model)
+  (let [uber-key (t/uber-key entity)
         uber-key-value (or
                         (k/extract-key-value uber-key record)
                         (k/extract-key-value uber-key old-record))
@@ -66,7 +66,7 @@

                                 (merge
                                  (choose-lookup-additional-cols
-                                  model with-cols old-record record)
+                                  entity with-cols old-record record)

                                  lookup-record))]
             lookup-record))))))
@@ -79,26 +79,26 @@
    - record: upserted primary-table record to generate lookups for
              (or nil for deletion)"
   [session :- ModelSession
-   model :- Entity
+   entity :- Entity
    table :- t/IndexTableSchema
    old-record :- t/MaybeRecordSchema
    record :- t/MaybeRecordSchema]
-  (if record
-    (default-lookup-record-generator-for-key-fn
-     model table (:key table) old-record record)
-    []))
+  (default-lookup-record-generator-for-key-fn
+   entity table (:key table) old-record record))

 (s/defn generate-lookup-records-for-table
   "generate all the lookup records for one lookup table"
   [session :- ModelSession
-   model :- Entity
+   entity :- Entity
    {generator-fn :generator-fn
     :as table} :- t/IndexTableSchema
    old-record :- t/MaybeRecordSchema
    record :- t/MaybeRecordSchema]
-  ((or generator-fn
-       default-lookup-record-generator-fn)
-   session model table old-record record))
+  (if record
+    ((or generator-fn
+         default-lookup-record-generator-fn)
+     session entity table old-record record)
+    []))

 (s/defn stale-lookup-key-values-for-table
   [session :- ModelSession


Handle ' in vars passed to frontend

Handle ' in vars passed to frontend

--- mern_utils/src/mern_utils/lib.cljs
+++ mern_utils/src/mern_utils/lib.cljs
@@ -41,7 +41,7 @@
   "Take a list of key value string pairs and produce a JavaScript"
   [key-values]
   (let [pairs (into [] (partition 2 key-values))
-        raw (apply str (map #(str (first %) "='" (second %) "',") pairs))]
+        raw (apply str (map #(str (first %) "='" (str/replace (second %) #"'" #"\'") "',") pairs))]
     (str "var " (subs raw 0 (dec (count raw))) ";")))

 (defn set-next-url-from-param


changed processed events sample size to 25

--- src-cljs/photon/ui/frontend.cljs
+++ src-cljs/photon/ui/frontend.cljs
@@ -158,7 +158,7 @@
         (do
           (>! ws-channel {:ok true})
           (loop [elem (<! ws-channel)
-                 last-50 []
+                 last-25 []
                  timestamps []
                  previous 0
                  is-first? true]
@@ -168,14 +168,14 @@
                   #_(.log js/console (pr-str elem)))
                 (let [stats-from-msg (:stats (:message elem))
                       difference (if is-first? 0 (- (:processed stats-from-msg) previous))
-                      new-last-50 (into [] (take-last 50 (conj last-50 difference)))
-                      new-timestamps (into [] (take-last 50 (conj timestamps (.getTime (js/Date.)))))
-                      stats (assoc stats-from-msg :last-50 {:val new-last-50
+                      new-last-25 (into [] (take-last 25 (conj last-25 difference)))
+                      new-timestamps (into [] (take-last 25 (conj timestamps (.getTime (js/Date.)))))
+                      stats (assoc stats-from-msg :last-25 {:val new-last-25
                                                             :timestamps new-timestamps})]
                   (when-not is-first?
                     (om/update-state! owner #(assoc % :stats stats)))
                   (>! ws-channel {:ok true})
-                  (recur (<! ws-channel) new-last-50 new-timestamps (:processed stats-from-msg) false))))))
+                  (recur (<! ws-channel) new-last-25 new-timestamps (:processed stats-from-msg) false))))))
         (do
           (.log js/console "Error:" (pr-str error)))))))

@@ -290,7 +290,7 @@
                     block)))))))

 (defn update-chart! [chart data]
-  (let [vector-data (clj->js (concat ["Incoming Events"] (:val data)))
+  (let [vector-data (clj->js (concat ["Events Processed"] (:val data)))
         x-axis (clj->js (concat ["x"] (:timestamps data)))]
     #_(.log js/console vector-data)
     (.load chart #js {:columns #js [x-axis vector-data]})))
@@ -299,11 +299,11 @@
   (reify
     om/IInitState
     (init-state [_]
-      {:chart nil})
+      {:events-processed-chart nil})
     om/IDidMount
     (did-mount [_]
-      (let [chart (.generate js/c3
-                             #js {:bindto "#chart"
+      (let [events-processed-chart (.generate js/c3
+                             #js {:bindto "#events-processed"
                                   :data
                                   #js {:x "x"
                                        :columns #js []}
@@ -314,15 +314,21 @@
                                               :tick #js {:format "%H:%M:%S"}}}
                                   :transition
                                   #js {:duration 0}})]
-        (om/update-state! owner (fn [state] (assoc state :chart chart)))))
+        (om/update-state! owner (fn [state] (assoc state :events-processed-chart events-processed-chart)))))
     om/IRenderState
     (render-state [_ state]
-                  (.log js/console (pr-str (:stats params)))
-      (if-let [chart (:chart state)]
-        (update-chart! chart (:last-50 (:stats params))))
+      (.log js/console (pr-str (:stats params)))
+      (if-let [events-processed-chart (:events-processed-chart state)]
+        (update-chart! events-processed-chart (:last-25 (:stats params))))
       (dom/div #js {:className "dashboard"}
         (dom/div
-          #js {:id "chart"})
+          #js {:className "col-sm-12 col-md-6 col-lg-6"}
+          (dom/div
+            #js {:id "events-processed"}))
+        (dom/div
+          #js {:className "col-sm-12 col-md-6 col-lg-6"}
+          (dom/div
+            #js {:id "chart"}))
         (dom/div
           #js {:className "col-sm-12 col-md-6 col-lg-4"}
           (dom/div


cache fork info per repo - saves 2 requests

--- src/github_contributions/github.clj
+++ src/github_contributions/github.clj
@@ -31,6 +31,8 @@
         commits (some #(and (= user (:login %)) (:contributions %)) contribs)]
     {:full_name full-name :commits (or commits "-")}))

+(def memoized-fetch-fork-info (memoize fetch-fork-info))
+
 (defn stream-contributions [send-event-fn sse-context user]
   (if user
     ;; TODO: remove limit
@@ -41,7 +43,7 @@
        (format "Found %s repositories, %s forked repositories: %s"
                (count repos) (count forked) (pr-str (mapv :name forked))))
       (doseq [fork forked]
-        (let [fork-map (fetch-fork-info user (get! fork :name))]
+        (let [fork-map (memoized-fetch-fork-info user (get! fork :name))]
           (message-event
            (format "Fork: %s, Commits: %s"
                    (:full_name fork-map)


Moved to log messages from 'info' to 'debug'.

--- jar-async/src/slipstream/async/collector.clj
+++ jar-async/src/slipstream/async/collector.clj
@@ -151,7 +151,7 @@
         (let [[[user connector] ch] (alts! [chan (timeout timeout-processing-loop)])]
           (when (not-nil? user)
             (try
-              (log/log-info "Will execute collect request for " (user-connector user connector))
+              (log/log-debug "Will execute collect request for " (user-connector user connector))
               (collect! user connector)
               (catch Exception e (log/log-warn "caught exception executing collect request: " (.getMessage e))))))))))

@@ -175,7 +175,7 @@

 (defn inform-inserted
   [context u c t]
-  (log/log-info context ": inserted collect request for " (user-connector u c) " after timeout " t))
+  (log/log-debug context ": inserted collect request for " (user-connector u c) " after timeout " t))

 (defn inform-nothing-to-do
   [context]
@@ -221,4 +221,4 @@

 (defn -start
   []
-  (collect-writers))+  (collect-writers))


Fixed bug which caused strings in the wg-xml to split in case of spaces.

--- app/src/weather/utils.clj
+++ app/src/weather/utils.clj
@@ -38,5 +38,5 @@
         :when (some #{tag} tags)]
     [tag (if
            (symbol? (read-string content))
-           (str (read-string content))
+           (str content)
            (read-string content))]))


Adding necessary bind require to demo code.

--- src/overtone/gui/spinner_label.clj
+++ src/overtone/gui/spinner_label.clj
@@ -94,6 +94,7 @@
        'seesaw.core
        'seesaw.border
        'seesaw.dev)
+  (require '[seesaw.bind :as bind])
   (def sl (spinner-label
             :id :my-spin-label
             :halign :center
@@ -101,5 +102,6 @@
             :model (spinner-model 10.0 :from 0.0 :to 100.0 :by 0.5)))
   (selection! sl 99.5)
   (bind/bind sl (bind/b-do [v] (println "new value " (value sl) ", " (selection sl))))
-  (-> (frame :content sl) pack! show!))
+  (-> (frame :content sl) pack! show!)
+  )


Remove overwritten function

Remove overwritten function

--- src/leiningen/new/cljskel/web_unit.clj
+++ src/leiningen/new/cljskel/web_unit.clj
@@ -2,13 +2,6 @@
   (:require [cheshire.core :as json])
   (:use [{{name}}.web]
         [midje.sweet]))
-
-(defn request
-  [method resource & {:as others}]
-  (routes (merge {:request-method method
-                  :uri resource} (update-in others [:body]
-                                         #(java.io.ByteArrayInputStream.
-                                           (.getBytes (json/generate-string %)))))))

 (defn request [method resource]
   (routes {:request-method method


[GAWB-1535] single entity view does not render collections (#825)

* [GAWB-1535] single entity view does not render collections

* Code review feedback

--- src/cljs/main/broadfcui/page/workspace/data/utils.cljs
+++ src/cljs/main/broadfcui/page/workspace/data/utils.cljs
@@ -1,5 +1,6 @@
 (ns broadfcui.page.workspace.data.utils
-  (:require [broadfcui.endpoints :as endpoints]
+  (:require [broadfcui.common :as common]
+            [broadfcui.endpoints :as endpoints]
             [broadfcui.utils :as utils]
             ))

@@ -12,12 +13,22 @@
      {:endpoint (endpoints/get-entity workspace-id entity-type entity-name)
       :on-done (fn [{:keys [success? get-parsed-response]}]
                  (if success?
-                   (if (is-entity-set? entity-type)
-                     (let [attrs (:attributes (get-parsed-response true))
-                           items (case entity-type
-                                   "sample_set" (:items (:samples attrs))
-                                   "pair_set" (:items (:pairs attrs))
-                                   "participant_set" (:items (:participants attrs)))]
-                       (update-parent-state :selected-attr-list items :loading-attributes false))
-                     (update-parent-state :selected-attr-list (:attributes (get-parsed-response true)) :loading-attributes false))
-                   (update-parent-state :server-error (get-parsed-response false) :loading-attributes false)))})))
+                   (let [attrs (:attributes (get-parsed-response true))]
+                     (if (is-entity-set? entity-type)
+                       ;; for set entity types we display _only_ the set elements, expanded into separate rows.
+                       (let [entities (case entity-type
+                                        "sample_set" (:samples attrs)
+                                        "pair_set" (:pairs attrs)
+                                        "participant_set" (:participants attrs))]
+                         (update-parent-state :selected-attr-list (:items entities) :loading-attributes false))
+                       ;; otherwise display all attribute values, expanded into separate rows.
+                       ;; generate a user-friendly string for list-valued attributes.
+                       (let [attr-value-mapper
+                             (fn [v]
+                               (if-let [items (common/attribute-values v)]
+                                 (if (empty? items)
+                                   "0 items"
+                                   (str (count items) " items: " (clojure.string/join ", " items)))
+                                 v))]
+                         (update-parent-state :selected-attr-list (utils/map-values attr-value-mapper attrs) :loading-attributes false)))
+                     (update-parent-state :server-error (get-parsed-response false) :loading-attributes false))))})))


Remove last redundant calls to .read in parser

--- src/main/clojure/clojure/data/json.clj
+++ src/main/clojure/clojure/data/json.clj
@@ -56,16 +56,17 @@
 (defn- parse-array [^PushbackReader stream]
   ;; Expects to be called with the head of the stream AFTER the
   ;; opening bracket.
-  (loop [c (.read stream), result (transient [])]
-    (when (neg? c)
-      (throw (EOFException. "JSON error (end-of-file inside array)")))
-    (codepoint-case c
-      :whitespace (recur (.read stream) result)
-      \, (recur (.read stream) result)
-      \] (persistent! result)
-      (do (.unread stream c)
-          (let [element (-parse stream true nil)]
-            (recur (.read stream) (conj! result element)))))))
+  (loop [result (transient [])]
+    (let [c (.read stream)]
+      (when (neg? c)
+        (throw (EOFException. "JSON error (end-of-file inside array)")))
+      (codepoint-case c
+        :whitespace (recur result)
+        \, (recur result)
+        \] (persistent! result)
+        (do (.unread stream c)
+            (let [element (-parse stream true nil)]
+              (recur (conj! result element))))))))

 (defn- parse-object [^PushbackReader stream]
   ;; Expects to be called with the head of the stream AFTER the


Dodge mines

Dodge mines

--- src/bot/brain.clj
+++ src/bot/brain.clj
@@ -115,7 +115,7 @@

 (defn obstacles [tiles]
   (into-array (map (fn [row]
-                     (into-array Integer/TYPE (map #(if (= % \x) 1 0) row)))
+                     (into-array Integer/TYPE (map #(if (or (= % \x) (= % \#)) 1 0) row)))
                    tiles)))

 (defn java-a* [tiles sx sy tx ty]


don't fetch deps when not copying. always extract native

--- src/cake/deps.clj
+++ src/cake/deps.clj
@@ -32,30 +32,12 @@
       (with-root path
         (cake-exec "install")))))

-(defn extract-native! [deps dest]
-  (doseq [jars (vals deps), jar jars]
+(defn extract-native! [dest]
+  (doseq [jars (vals @dep-jars), jar jars]
     (ant Copy {:todir dest :flatten true}
       (add-zipfileset {:src jar :includes (format "native/%s/%s/*" (os-name) (os-arch))}))
     (ant Copy {:todir dest :flatten true}
       (add-zipfileset {:src jar :includes "lib/*.jar" }))))
-
-(let [dest {:dependencies     ""
-            :dev-dependencies "dev"
-            :ext-dependencies "ext"}]
-
-  (defn copy-deps [deps]
-    (let [build (file "build" "lib")
-          lib   (file (first (:library-path *project*)))]
-      (when (or *overwrite*
-                (not (file-exists? lib)))
-        (doseq [[type jars] deps :when (seq jars)]
-          (ant Copy {:todir (file build (dest type)) :flatten true}
-            (.addFileset (:fileset (meta jars)))))
-        (rmdir lib)
-        (mv build lib)
-        (extract-native! deps (file lib "native")))
-      (into {} (for [[type jars] deps]
-                 [type (map #(file lib (dest type) (.getName %)) jars)])))))

 (defn fetch-deps [type]
   (binding [depot/*repositories* default-repos
@@ -77,13 +59,31 @@
                        (.getName jar))))
       (println))))

+(let [subdir {:dependencies     ""
+              :dev-dependencies "dev"
+              :ext-dependencies "ext"}]
+
+  (defn copy-deps [dest]
+    (let [build (file "build" "deps")]
+      (when (or *overwrite*
+                (not (file-exists? dest)))
+        (doseq [type dep-types]
+          (when-let [jars (fetch-deps type)]
+            (ant Copy {:todir (file build (subdir type)) :flatten true}
+              (.addFileset (:fileset (meta jars))))))
+        (rmdir dest)
+        (mv build dest))
+      (map-to #(fileset-seq {:dir (file dest (subdir %)) :includes "*.jar"})
+              dep-types))))
+
 (defn fetch-deps! []
-  (install-subprojects!)
-  (let [deps (map-to fetch-deps dep-types)]
+  (let [lib (file (first (:library-path *project*)))]
+    (install-subprojects!)
     (reset! dep-jars
             (if (:copy-deps *project*)
-              (copy-deps deps)
-              deps))))
+              (copy-deps lib)
+              (map-to fetch-deps dep-types)))
+    (extract-native! (file lib "native"))))

 (defn clear-deps! []
   (doseq [type dep-types]


Enable MVCC in h2.

Enable MVCC in h2.

This helps only slightly, to avoid blocking
readers. During a tsv load readers are still
blocked.

--- src/cavm/core.clj
+++ src/cavm/core.clj
@@ -148,7 +148,7 @@
                   (println error))
                 (do
                   (h2/set-tmp-dir! tmp)
-                  (let [db (h2/create-xenadb (:database options))
+                  (let [db (h2/create-xenadb (str (:database options) ";MVCC=TRUE"))
                         detector (apply cr/detector docroot detectors)
                         loader (cl/loader-agent db detector docroot)]
                     (when (:auto options)


temp file cleanup and return the result of body

--- plugins/matross/tasks/temp_file.clj
+++ plugins/matross/tasks/temp_file.clj
@@ -24,3 +24,4 @@
            (with-temp-files ~conn ~(subvec bindings 1) ~@body)
            (finally (run-task ~conn {:type :command
                                      :command (str "rm -f " ~(bindings 0))}))))))
+


this is probably easier to understand /cc @drsnyder

--- src/vignette/api/legacy/routes.clj
+++ src/vignette/api/legacy/routes.clj
@@ -80,7 +80,7 @@
 (defn zone [map]
   (if (and (not (empty? (:zone map)))
            (not (archive? map)))
-    (if (= (subs (:zone map) 0 1) "/")
+    (if (.startsWith (:zone map) "/")
       (subs (:zone map) 1)
       (:zone map))
     nil))


counter-devcards: removed automatic sync from reference for the first time, added more comments

--- examples/counter-devcards/src/app/core.cljs
+++ examples/counter-devcards/src/app/core.cljs
@@ -8,6 +8,7 @@
   (:require-macros [devcards.core :refer [defcard-rg]]))

 (enable-console-print!)
+
 (devcards.core/start-devcard-ui!)

 ;;;;;;;;;;;;;;;;;;;;;;;;
@@ -21,11 +22,6 @@
 ;;;;;;;;;;;;;;;;;;;;;;;;
 (defn -connect-atom
   [r model dispatch-signal]
-  ; sync from reference for the first time
-  (dispatch-signal [::on-reset @r])
-
-  #_(println "1 DATA ATOM WATCHES = " (pr-str (count (.-watches r))))
-
   ; sync model from reference
   (add-watch r
              model
@@ -38,9 +34,7 @@
              r
              (fn [_key _ref _old-state new-state]
                (when (not= @r new-state)
-                 (reset! r new-state))))
-
-  #_(println "2 DATA ATOM WATCHES = " (pr-str (count (.-watches r)))))
+                 (reset! r new-state)))))

 (defn -unconnect-atom
   [r model]
@@ -50,7 +44,9 @@
 (defn add-atom-sync
   "Carry middleware.
    On start creates a bidirectional sync between the specified atom-like reference and the app model.
-   Is useful for integration with Devcards or for direct hacking with app model in REPL."
+   On stop sync is removed.
+   Current reference values are not updated until one of the references changes.
+   Is useful for direct hacking with app model in REPL and for integration with Devcards."
   [spec r]
   (-> spec
       (update :control
@@ -85,26 +81,37 @@
                          :else
                          (app-reconcile model action)))))))

-(defn with-unmount-callback
+(defn -div-with-unmount-callback
   [_body unmount-cb]
-  (r/create-class {:reagent-render         (fn [body _unmount-cb]
-                                             (into [:div] body))
+  (r/create-class {:reagent-render         (fn [body _unmount-cb] (into [:div] body))
                    :component-will-unmount (fn [_this] (unmount-cb))}))

 (defcard-rg
   counter-with-history
+  "Preserves model value between hot reloads."
   (fn [data-atom _]
+    ; Create app instance.
     (let [app (carry/app (-> counter/spec
-                             (add-atom-sync data-atom)))    ; <-- connect devcards atom
+
+                             ; Get model value from data atom.
+                             (assoc :initial-model @data-atom)
+
+                             ; Setup bidirectional sync with data atom.
+                             (add-atom-sync data-atom)))
           [_ app-view] (carry-reagent/connect app counter/view-model counter/view)]
-      ((:dispatch-signal app) :on-start)                    ; <-- start the app
+      ((:dispatch-signal app) :on-start)                    ; Start the app.

-      [with-unmount-callback
+      ; Render app view.
+      [-div-with-unmount-callback
        [app-view]
-       #((:dispatch-signal app) :on-stop)]))                ; <-- stop the app on umount

-  (atom (:initial-model counter/spec))                      ; <-- create devcards atom with initial model value
+       ; Stop the app on umount/hot-reload.
+       #((:dispatch-signal app) :on-stop)]))

+  ; Create devcards atom with initial model value.
+  (atom (:initial-model counter/spec))
+
+  ; Card options.
   {:inspect-data true
    :history      true})


Fixed bug with not all models getting links

--- src/ardoq/swagger/swagger_v2.clj
+++ src/ardoq/swagger/swagger_v2.clj
@@ -157,29 +157,27 @@
 (defn find-nested-model-deps [model]
   ;;Finds all references in a given model
   (map (fn [v]
-         (clojure.pprint/pprint v)
          (last (.split v "/")))
    (keep :$ref (tree-seq #(or (map? %) (vector? %)) identity model))))

 (defn interdependent-model-refs [client models]
   ;;Creates refs between models
-  (mapcat
-   (fn [model]
-     (let [rrr (find-nested-model-deps (:schema model))]
-       (doall (keep
-               (fn [model-key]
-                 (if-let [m ((keyword model-key) models)]
-                   (-> (api/map->Reference {:rootWorkspace (:rootWorkspace model)
-                                            :source (str (:_id model))
-                                            :target (str (:_id m))
-                                            :type 3})
-                       (api/create client))))
-               rrr))))
-   (vals models)))
+  (doall (mapcat
+          (fn [model]
+            (let [rrr (find-nested-model-deps model)]
+              (doall (keep
+                      (fn [model-key]
+                        (if-let [m ((keyword model-key) models)]
+                          (-> (api/map->Reference {:rootWorkspace (:rootWorkspace model)
+                                                   :source (str (:_id model))
+                                                   :target (str (:_id m))
+                                                   :type 3})
+                              (api/create client))))
+                      rrr))))
+          (vals models))))

 (defn create-ref [client keys models comp id type]
   ;; Makes the refs given the values found by create-refs
-  (clojure.pprint/pprint keys)
   (if (seq? keys)
     (doall (map (fn [k]
                   (let [k (keyword (last (.split k "/")))]
@@ -213,7 +211,6 @@
                                     )
                                   input-models))])
                (doall (keep (fn [k]
-                              (clojure.pprint/pprint k)
                               (cond
                                (seq (find-nested-model-deps k)) (create-ref client (find-nested-model-deps k) models comp id 0)
                                (get-in k [:$ref]) (create-ref client (get-in k [:$ref]) models comp id 0)
@@ -273,7 +270,7 @@

 (defn import-swagger2 [client base-url name headers swag]
   (println "Importing swagger doc from " base-url ". Custom headers" headers)
-  (let [spec (if (blank? swag) (get-resource-listing base-url headers) swag)]
+  (let [spec (if (s/blank? swag) (get-resource-listing base-url headers) swag)]
     (get-info client spec))
   (println "Done importing swagger doc from " base-url "."))


Add some blue to green for the colour blind

--- src/baustellen/visualization.clj
+++ src/baustellen/visualization.clj
@@ -3,7 +3,7 @@
             [clojure.string :as s]
             [baustellen :refer :all]))

-(def green "#00aa00")
+(def green "#00aa77")

 (defn providers [site-k allocation]
   (for [bundles (vals (allocation site-k))


WIP: find who to send & what to send for daily

--- src/chat/server/email_digest.clj
+++ src/chat/server/email_digest.clj
@@ -22,10 +22,19 @@
             (time/before? last-open (to-date-time created-at)))
           (thread :messages))))

-(defn updates-for-user
-  [user-id]
-  (db/with-conn
-    (doall (filter thread-unseen? (db/get-open-threads-for-user user-id)))))
+(defn last-message-after?
+  [cutoff thread]
+  (some (fn [{:keys [created-at]}]
+          (time/after? (to-date-time created-at) cutoff))
+        (thread :messages)))
+
+(defn updates-for-user-since
+  [user-id cutoff]
+  (into ()
+        (comp (filter thread-unseen?)
+              (filter (partial last-message-after? cutoff)))
+        (db/with-conn
+          (db/get-open-threads-for-user user-id))))

 (defn daily-update-users
   "Find all ids for users that want daily digest updates"
@@ -60,7 +69,14 @@
 ; daily digest
 (defjob DailyDigestJob
   [ctx]
-  (timbre/debugf "Starting daily email job"))
+  (timbre/debugf "Starting daily email job")
+  (let [user-ids (daily-update-users)
+        cutoff (time/minus (time/now) (time/days 1))]
+    (doseq [uid user-ids]
+      (when-let [threads (seq (updates-for-user-since uid cutoff))]
+        (let [user (db/with-conn (db/user-by-id uid))
+              msg nil]
+          )))))

 (defn daily-digest-job
   []


implementing get-entities

implementing get-entities

--- src/clj/eventsourcing/custom.clj
+++ src/clj/eventsourcing/custom.clj
@@ -168,6 +168,24 @@
             {}
             efacts)))

+(defn get-entities [attribute value]
+  "Retrieves entire entities."
+  (let [db (get-logic-db)
+        efacts (lp/with-db db
+                 (l/run* [q]
+                   (l/fresh [e a v e2 a2 v2]
+                     (fact e a v (l/lvar))
+                     (l/== a attribute)
+                     (l/== v value)
+                     (fact e2 a2 v2 (l/lvar))
+                     (l/== e2 e)
+                     (l/== q [e2 a2 v2 (l/lvar)]))))]
+    (-> (reduce (fn [s [e a v t]]
+                  (assoc-in s [e a] v))
+                {}
+                efacts)
+        vals)))
+

 ;;;
 ;;; APPLICATION SPECIFIC STUFF
@@ -187,7 +205,7 @@

 (defn get-user [eid]
   (map->User (merge (get-entity eid)
-                    {:comments (lazy-seq [(get-comment 3)])})))
+                    {:comments (lazy-seq (get-entities :comment/author eid))})))

 (defn get-comment [eid]
   (map->Comment (get-entity eid)))


Fix for Street Peddler cards disappearing if they can't be afforded. Reformat some code.

--- src/clj/game/cards-resources.clj
+++ src/clj/game/cards-resources.clj
@@ -106,26 +106,16 @@
                  :msg "force the Corp to trash the top card of R&D"}]}

    "DDoS"
-   {:abilities [{
-                 :msg "prevent the corp from rezzing the outermost piece of ice during a run on any server this turn"
+   {:abilities [{:msg "prevent the corp from rezzing the outermost piece of ice during a run on any server this turn"
                  :effect (effect
                            (register-turn-flag!
-                                    card
-                                    :can-rez
-                                     (fn [state side card]
-                                       (if (and
-                                             (has? card :type "ICE")
-                                             (= (count (get-in @state [:run :ices])) (get-in @state [:run :position]))
-                                             )
-                                         ((constantly false)
-                                           (system-msg state side (str "is prevented from rezzing any outermost ICE by DDoS"))
-                                           )
-                                         true
-                                         )
-                                       ))
-                           (trash card {:cause :ability-cost}))
-                 }]
-    }
+                             card :can-rez
+                             (fn [state side card]
+                               (if (and (has? card :type "ICE")
+                                        (= (count (get-in @state [:run :ices])) (get-in @state [:run :position])))
+                                 ((constantly false) (system-msg state side (str "is prevented from rezzing any outermost ICE by DDoS")))
+                                 true)))
+                           (trash card {:cause :ability-cost}))}]}

    "Decoy"
    {:prevent {:tag [:all]}
@@ -137,7 +127,7 @@
                  :msg (msg "make the text box of " (:title target) " blank for the remainder of the turn")
                  :effect (req (let [c target]
                                 (update! state side (dissoc target :events :abilities))
-                                (desactivate state side target)
+                                (deactivate state side target)
                                 (register-events state side
                                                  {:runner-turn-ends
                                                   {:effect (effect (card-init (get-card state c))
@@ -613,12 +603,14 @@
                                                           (can-pay? state side (modified-install-cost state side % [:credit -1])))
                                                     (:hosted card))))
                  :msg (msg "install " (:title target) " lowering its install cost by 1 [Credits]")
-                 :effect (effect
-                           (install-cost-bonus [:credit -1]) (runner-install (dissoc target :facedown))
-                           (trash (update-in card [:hosted]
-                                             (fn [coll]
-                                               (remove-once #(not= (:cid %) (:cid target)) coll)))
-                                  {:cause :ability-cost}))}]}
+                 :effect (req
+                           (when (can-pay? state side (modified-install-cost state side target [:credit -1]))
+                             (install-cost-bonus state side [:credit -1])
+                             (runner-install state side (dissoc target :facedown))
+                             (trash state side (update-in card [:hosted]
+                                                          (fn [coll]
+                                                            (remove-once #(not= (:cid %) (:cid target)) coll)))
+                                    {:cause :ability-cost})))}]}

    "Symmetrical Visage"
    {:events {:runner-click-draw {:req (req (first-event state side :runner-click-draw))


Fix build.

Fix build.

--- src/clucy/positions_searcher.clj
+++ src/clucy/positions_searcher.clj
@@ -177,6 +177,7 @@
         br-phrases (map (fn [phrase] (map #(BytesRef. %) phrase)) search-phrases)
         iwords (into #{} br-words)
         dict-lenght (count words)
+        with-stemmed *with-stemmed*
         searcher (fn [^org.apache.lucene.store.Directory index]
                    (let [^DirectoryReader ireader (DirectoryReader/open index)
                          ^Terms terms (.getTermVector ireader
@@ -201,7 +202,7 @@
                                                ps ; Positions [[beg end]... ]
                                                ]]
                                            (if (iwords wd)
-                                             (if *with-stemmed*
+                                             (if with-stemmed
                                                (let [word (.utf8ToString wd)]
                                                  (map (fn [pos]
                                                         [word pos])
@@ -210,14 +211,14 @@
                                          (term-iter))
                                     (map (fn [br-word word]
                                            (if (.seekExact te br-word)
-                                             (if *with-stemmed*
+                                             (if with-stemmed
                                                (map (fn [pos]
                                                       [word pos])
                                                     (get-positions te))
                                                (get-positions te))))
                                          br-words search-words))
                                   (map (fn [br-phrase phrase]
-                                         (if *with-stemmed*
+                                         (if with-stemmed
                                            (let [phrase-str
                                                  (clojure.string/join " " phrase)]
                                              (map (fn [pos]


Added small TODO list for fuzzy FCA

Added small TODO list for fuzzy FCA

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

--- src/conexp/contrib/fuzzy/fca.clj
+++ src/conexp/contrib/fuzzy/fca.clj
@@ -53,14 +53,14 @@
   (let [mv-ctx (make-mv-context (set objects)
                                 (set attributes)
                                 truth-function)]
-    (when-not (forall [[_ v] (incidence mv-ctx)] (and (number? v) (<= 0 v 1)))
+    (when-not (forall [v (vals (incidence mv-ctx))] (and (number? v) (<= 0 v 1)))
       (illegal-argument "Given function does not return real values between 0 and 1."))
     (mv->fuzzy-context-nc mv-ctx)))

 (defmethod make-fuzzy-context [clojure-coll clojure-coll clojure-coll]
   [objects attributes values]
   (let [mv-ctx (make-mv-context-from-matrix objects attributes values)]
-    (when-not (forall [[_ v] (incidence mv-ctx)] (and (number? v) (<= 0 v 1)))
+    (when-not (forall [v (vals (incidence mv-ctx))] (and (number? v) (<= 0 v 1)))
       (illegal-argument "Given value table does not contain of real values between 0 and 1."))
     (mv->fuzzy-context-nc mv-ctx)))

@@ -121,6 +121,10 @@
                                  (inz [g m]))])]
     (make-context objs atts inci)))

-;;;
+;;; TODO:
+;;;  - Compute fuzzy concepts
+;;;  - attribute exploration?
+;;;  - non-redundant basis of implications
+;;;  - glinclosure

 nil


specify the image for the design post

specify the image for the design post

--- src/pc/views/blog/clojure_is_a_product_design_tool.clj
+++ src/pc/views/blog/clojure_is_a_product_design_tool.clj
@@ -46,6 +46,7 @@
   {:title "Clojure is a product design tool."
    :blurb "Clojure makes me more efficient and extends my reach as a designer. And it protects me from complex design tools..."
    :author "Danny"
+   :image (cdn-path "/blog/clojurescript-is-a-design-tool/illustrator-onoff.gif")
    :body
    (list
     [:article


Fix make admin icon

Fix make admin icon

fixes #10785

Signed-off-by: Gheorghe Pinzaru <742a0a3885ab52ea1795e48e261ec4223e194612@gmail.com>

--- src/status_im/ui/screens/profile/group_chat/views.cljs
+++ src/status_im/ui/screens/profile/group_chat/views.cljs
@@ -37,7 +37,7 @@
        :title               :t/make-admin
        :accessibility-label :make-admin
        ;; TODO(Ferossgp): Fix case for make admin icon
-       :icon                :main-icons/make_admin
+       :icon                :main-icons/make-admin
        :on-press            #(chat.sheets/hide-sheet-and-dispatch [:group-chats.ui/make-admin-pressed chat-id (:public-key member)])}])
    (when-not (:admin? member)
      [list-item/list-item


[#455] Removed unused code

[#455] Removed unused code

--- backend/src/akvo/lumen/component/user_manager.clj
+++ backend/src/akvo/lumen/component/user_manager.clj
@@ -19,19 +19,6 @@
   (invites [this tenant-conn] "List active invites.")
   (verify-invite [this tenant-conn tenant id] "Add user to tenant."))

-
-(defn email-body
-  [server-name invite-id author-name]
-  (str/join
-   "\n"
-   ["Hi,"
-    ""
-    (format "You been invited to join %s by %s." server-name author-name)
-    "To complete your invite please visit:"
-    (format "https://%s/verify/%s" server-name invite-id)
-    ""
-    "Thanks"
-    "Akvo"]))

 (defn do-invite [tenant-conn {:keys [emailer keycloak] :as user-manager}
                  server-name email author-claims]


[1144] Fix filter regression

[1144] Fix filter regression

--- backend/src/akvo/lumen/lib/aggregation/filter.clj
+++ backend/src/akvo/lumen/lib/aggregation/filter.clj
@@ -1,5 +1,6 @@
 (ns akvo.lumen.lib.aggregation.filter
-  (:require [clojure.string :as str])
+  (:require [akvo.lumen.transformation.engine :as engine]
+            [clojure.string :as str])
   (:import [java.sql.Timestamp]))

 (defn invalid-filter [msg map]
@@ -21,14 +22,9 @@
                         (take 10)
                         (apply str))))

-(defn dollar-quote
-  [v]
-  (let [tag (random-tag)]
-    (format "$%s$%s$%s$" tag v tag)))
-
 (defn parse-number [s]
   (try
-    (dollar-quote (Double/parseDouble s))
+    (Double/parseDouble s)
     (catch NumberFormatException e
       (invalid-filter "Not a number" {:string s}))))

@@ -78,7 +74,7 @@
       "text" (format "coalesce(%1$s, '') %2$s %3$s"
                      column-name
                      op
-                     (dollar-quote value))
+                     (engine/pg-escape-string value))
       (invalid-filter "Type not supported" {:type column-type}))))

 (defmethod filter-sql "isEmpty"


[#2252] Fix reference https://github.com/akvo/akvo-lumen/commit/8526d5923b5a06ca77545062309276564b6aefbc

--- backend/src/akvo/lumen/lib/visualisation/maps.clj
+++ backend/src/akvo/lumen/lib/visualisation/maps.clj
@@ -92,7 +92,7 @@
         _ (log/debug :map-config map-config)
         layer-group-id (-> (http.client/post* url (merge http-client-req-defaults
                                                          {:body (json/encode map-config)
-                                                          :headers headers
+                                                          :headers headers*
                                                           :content-type :json}))
                            :body json/decode (get "layergroupid"))
         layer-meta (map-metadata/build tenant-conn raster_table {:layerType "raster"} nil)]


Revert "Factor out HTTP methods"

Revert "Factor out HTTP methods"

This reverts commit c37b648d3c45787b42ff2a811d993cfe20ea4a49.

--- test/icecap/handlers/http_test.clj
+++ test/icecap/handlers/http_test.clj
@@ -7,14 +7,6 @@
             [icecap.test-data :refer [simple-http-step simple-https-step]]
             [aleph.http :as h]
             [clojure.test :refer :all]))
-
-(def http-methods
-  #{:DELETE
-    :HEAD
-    :GET
-    :PATCH
-    :POST
-    :PUT})

 (deftest schema-tests
   (testing "valid steps"
@@ -48,7 +40,13 @@

          {:url (:url simple-http-step)
           :method :BOGUS}
-         '{:method (not (http-methods :BOGUS))}
+         '{:method (not (#{:DELETE
+                           :HEAD
+                           :GET
+                           :PATCH
+                           :POST
+                           :PUT}
+                         :BOGUS))}

          {:url "bogus://example.test"
           :method :GET}


update

update

--- src/hivewing_core/hive_image.clj
+++ src/hivewing_core/hive_image.clj
@@ -48,7 +48,6 @@
   (def repo (jgit/load-repo "/tmp/1418838486719-105021364-1/0b9cf547-c04f-4fe2-949e-94269df0dce7.git"))
   (def repo (jgit/discover-repo "/tmp/1418838486719-105021364-1/0b9cf547-c04f-4fe2-949e-94269df0dce7.git"))

-  (println repo)
   (def reference "master")
   (def rev-walk (jgit-i/new-rev-walk repo))
   (jgit/git-log repo)


Use `when-not` when throwing exceptions

Use `when-not` when throwing exceptions

--- src/main/cljc/mikron/buffer.cljc
+++ src/main/cljc/mikron/buffer.cljc
@@ -168,7 +168,7 @@
 (defn get-bit-buffer
   "Gets the bit buffer of `buffer`."
   #?(:clj {:inline (fn [buffer]
-                     (if-not (util/can-have-meta? buffer)
+                     (when-not (util/can-have-meta? buffer)
                        (throw (ex-info "Invalid buffer" {:buffer buffer})))
                      `(.-bit-buffer ~(vary-meta buffer assoc :tag `Buffer)))})
   ^mikron.buffer.IMikronBitBuffer [^Buffer buffer]
@@ -177,7 +177,7 @@
 (defn get-byte-buffer
   "Gets the byte buffer of `buffer`."
   #?(:clj {:inline (fn [buffer]
-                     (if-not (util/can-have-meta? buffer)
+                     (when-not (util/can-have-meta? buffer)
                        (throw (ex-info "Invalid buffer" {:buffer buffer})))
                      `(.-byte-buffer ~(vary-meta buffer assoc :tag `Buffer)))})
   ^mikron.buffer.IMikronByteBuffer [^Buffer buffer]


Time quiscience

Time quiscience

--- src/aurora/runtime/core.cljs
+++ src/aurora/runtime/core.cljs
@@ -45,6 +45,7 @@
 (enable-console-print!)

 (defn quiescience [prev env init-facts]
+  (js/console.time "quiescience")
   (let [aurora-facts [(language/fact :aurora/time #js [(.getTime (js/Date.))])]]
     (let [cur (language/tick (:rules env) prev)]
       (language/add-facts-compat cur :known|pretended init-facts)
@@ -54,8 +55,8 @@
              prev prev
              i 0]
         (cond
-         (>= i 10) (do (println "Aborting!") cur)
-         (language/unchanged? prev cur) cur
+         (>= i 10) (do (js/console.timeEnd "quiescience") (println "Aborting!") cur)
+         (language/unchanged? prev cur) (do (js/console.timeEnd "quiescience") cur)
          :else (let [next (language/tick (:rules env) cur)]
                  (language/add-facts-compat next :known|pretended aurora-facts)
                  (language/fixpoint! next)


remove @reporter reference

remove @reporter reference

--- kafka-clj/src/kafka_clj/consumer/consumer.clj
+++ kafka-clj/src/kafka_clj/consumer/consumer.clj
@@ -200,8 +200,6 @@

           wu-processor (partial process-wu! state conn-pool delegate-f)]

-      @reporter
-
       (start-wu-publisher! (assoc state :shutdown-flag shutdown-flag)  publish-exec-service exec-service wu-processor)
       (assoc state :publish-exec-service publish-exec-service :exec-service exec-service :conn-pool conn-pool :shutdown-flag shutdown-flag))))


reduce max-bytes floor value to 1mb

reduce max-bytes floor value to 1mb

--- kafka-clj/src/kafka_clj/consumer/consumer.clj
+++ kafka-clj/src/kafka_clj/consumer/consumer.clj
@@ -100,8 +100,7 @@
 (defn- error-code->status [error-vec]
   (let [code (error-code error-vec)]
     (condp = code
-      ;@TODO we need to delete work units here but only if they are behind the max offset
-      ;1 :fail-delete
+      1 :fail-delete
       :fail)))

@@ -171,8 +170,8 @@
                        (int (* max-bytes (/ len consume-step)))
                        max-bytes))]
      (io!
-       ;we always specify a minimum of 5 megabytes
-       (send-fetch (assoc-in producer [:conf :max-bytes] (Math/max max-bytes 5242880)) [[topic [{:partition partition :offset offset}]]])
+       ;we always specify a minimum of 1 megabytes
+       (send-fetch (assoc-in producer [:conf :max-bytes] (Math/max max-bytes 1048576)) [[topic [{:partition partition :offset offset}]]])
        (handle-response producer work-unit f-delegate (get state :conf)))))


indention

indention

--- src/ca_recipe/tnywb/core.clj
+++ src/ca_recipe/tnywb/core.clj
@@ -15,14 +15,18 @@
        (render
         view
         (controller http-request))}
-      (catch ControllerException e {:status-code (.getStatusCode e) :body ""}) (catch RenderingException e {:status-code 500
-                                                                                :body "Exception while rendering"})
+      (catch ControllerException e {:status-code (.getStatusCode e) :body ""})
+      (catch RenderingException e {:status-code 500
+                                   :body "Exception while rendering"})
       (catch Exception e (.printStackTrace e) {:status-code 500 :body ""}))))
+
 (defn- apply-filters [filters http-request]
   (let [composed-filter (reduce comp (reverse filters))]
-    (composed-filter http-request))) (defn tinyweb [request-handlers filters]
-(fn [http-request]
-(let [filtered-request (apply-filters filters http-request)
-      path (http-request :path)
-      handler (request-handlers path)]
-  (execute-request filtered-request handler))))
+    (composed-filter http-request)))
+
+(defn tinyweb [request-handlers filters]
+  (fn [http-request]
+    (let [filtered-request (apply-filters filters http-request)
+          path (http-request :path)
+          handler (request-handlers path)]
+      (execute-request filtered-request handler))))


renamed input key for clarity

renamed input key for clarity

--- plugins/matross/tasks/template.clj
+++ plugins/matross/tasks/template.clj
@@ -3,15 +3,15 @@
             [clostache.parser :as template]))

-(deftask :template [conn {:keys [dest vars file content]}]
+(deftask :template [conn {:keys [dest vars file inline]}]

   (comment
     :dest where to put the templated content
     :vars for template substitution
     :file a file to render
-    :content a string to render (optional, instead of :file))
+    :inline a string to render (optional, instead of :file))

-  (let [content (if file (slurp file) content)
+  (let [content (if file (slurp file) inline)
         rendered (template/render content vars)]
     (run-task
      conn


Remove empty file.

Remove empty file.


various font sizes

various font sizes

--- src/clj/just_married/css.clj
+++ src/clj/just_married/css.clj
@@ -87,16 +87,20 @@
 (def main-page
   [[:.container common-grid-options]
    [:h3 {:color (:dark-red COLOR-PALLETTE)}]
-   [:body {:color (:navy COLOR-PALLETTE)
-           :font-family (:alex-brush FONT-FAMILIES)}]
+   [:body {:color       (:navy COLOR-PALLETTE)
+           :font-family (:alex-brush FONT-FAMILIES)
+           :font-size   "1.4em"}]
+
    [:.countdown {:grid-column 1
-                 :grid-row 1
-                 ;; :color (:marsala COLOR-PALLETTE)
-                                        ;:font-weight "bold"
-                 ;; might be nice to shrink this in theory??
-                 ;; :width "50%"
-                 ;;:font-family (:alex-brush FONT-FAMILIES)
-                 :font-size "x-large"}]
+                 :grid-row    1}]
+
+   [:.countdown__internal {:text-align "center"
+                           :width      "500px"}]
+
+   [:.timer {:font-size "1.5em"
+             :font-family (:alex-brush FONT-FAMILIES)
+             :border-color (:dark-red COLOR-PALLETTE)
+             :margin-top "10px"}]

    [:.button__add-to-calendar {:background-color (:dark-red COLOR-PALLETTE)
                                :color (:white COLOR-PALLETTE)}]
@@ -162,18 +166,6 @@
                        :box-shadow (format "0 0 20px %s" (:dark-red COLOR-PALLETTE))}]

    [:app {:background-color (:marsala COLOR-PALLETTE)}]
-   ;; maybe the image containing the rest should actually be an element
-   ;; by itself?
-   [:.countdown__internal {:text-align "center"
-                           :width "500px"}]
-
-   ;; countdown settings
-   [:.timer {;:background-color (:marsala COLOR-PALLETTE)
-             :border-width "1px"
-             :border-style "solid"
-             :font-size "2em"
-             :font-family (:alex-brush FONT-FAMILIES)
-             :border-color (:dark-red COLOR-PALLETTE)}]

    ;; find us settings
    [:.google-map {:width map-width


Apply each stage up to munch in the compile test (succeeds up to basic blocks)

--- src/clj/minijava/compile.clj
+++ src/clj/minijava/compile.clj
@@ -38,7 +38,8 @@
       treemap)))

 (defn compile-program [program]
-  (let [treemap  (apply-tree (parse program))
-        canonmap (map-method canon treemap)
-        munchmap (map-method select treemap)]
+  (let [treemap   (apply-tree (parse program))
+        canonmap  (map-method canon treemap)
+        blocksmap (map-method basic-blocks canonmap)
+        munchmap  (map-method select blocksmap)]
     munchmap))


interpret decimal validation failure

interpret decimal validation failure

--- src/clj_money/validation.clj
+++ src/clj_money/validation.clj
@@ -29,6 +29,12 @@
              (= 'integer? pred))
     [path (format "%s must be an integer" (humanize (last path)))]))

+(defn- interpret-decimal-failure
+  [{:keys [path pred]}]
+  (when (and (symbol? pred)
+             (= 'decimal? pred))
+    [path (format "%s must be a decimal" (humanize (last path)))]))
+
 (defn non-empty-string?
   [value]
   (and (string? value)
@@ -112,6 +118,7 @@
 (def problem-interpreters
   [interpret-required-failure
    interpret-integer-failure
+   interpret-decimal-failure
    interpret-regex-failure
    interpret-empty-string-failure
    interpret-positive-big-dec-failure


Switch over to break when finished with a pomodoro

--- src/cljs/pomodonut/core.cljs
+++ src/cljs/pomodonut/core.cljs
@@ -44,14 +44,18 @@

 (defn start-timer
   [c duration s]
-  (let [i (go-loop [t (inc s)]
-            (om/transact! c `[(timer/update-elapsed-time {:t ~t})])
+  (let [i (go-loop [t s]
+            (om/transact! c `[(timer/update-elapsed-time ~{:t t})])
             (.play tick-sound)
             (if (< t duration)
               (do
                 (<! (wait 1000))
                 (recur (inc t)))
-              (clear-timeout)))]
+              (do
+                (clear-timeout)
+                (om/transact! c `[(timer/reset ~{:break? true
+                                                 :duration FIVE-MINUTES
+                                                 :elapsed 0})]))))]
     (reset! interval i)))

 (defn stop-timer [c]
@@ -64,9 +68,13 @@
     [:break? :duration :elapsed])
   Object
   (componentDidMount [this]
-    (om/transact! this `[(timer/reset {:break? false
-                                       :duration ~TWENTY-FIVE-MINUTES
-                                       :elapsed ~0})]))
+    (om/transact! this `[(timer/reset ~{:break? false
+                                        :duration TWENTY-FIVE-MINUTES
+                                        :elapsed 0})]))
+  (componentDidUpdate [this prev-props _]
+    (let [{:keys [break? duration elapsed]} (om/props this)]
+      (when (and break? (not (:break? prev-props)))
+        (start-timer this duration elapsed))))
   (render [this]
     (let [{:keys [break? duration elapsed]} (om/props this)]
       (dom/div #js {:className (timer-class break?)


Set interval shorter for testability.

Set interval shorter for testability.

--- src/cljs/pomodoro/timer.cljs
+++ src/cljs/pomodoro/timer.cljs
@@ -52,7 +52,7 @@
       (do
         (reset! pomodoro-time (+ @pomodoro-time 500))
         (reset! pomodoro-time-label (util/ms->time @pomodoro-time))))
-    500))
+    1))

 (defn- start-pomodoro []
   (settings/disable-settings)


trying spec for event messagesé

trying spec for event messagesé

--- src/cljs/triboard/store.cljs
+++ src/cljs/triboard/store.cljs
@@ -1,7 +1,9 @@
 (ns triboard.store
   (:require
+    [cljs.spec :as s]
     [reagent.core :as reagent]
     [triboard.ai.ai :as ai]
+    [triboard.logic.board :as board]
     [triboard.logic.game :as game]
     [triboard.logic.turn :as turn])
   (:require-macros
@@ -12,14 +14,14 @@
 ;; Private
 ;; -----------------------------------------

-(def is-ai? #{:red :green})
+(def ^:private is-ai? #{:red :green})

 (defonce app-state
   (reagent/atom
     {:game (game/new-game)
      :help false}))

-(defn play-game-turn! [move]
+(defn- play-game-turn! [move]
   (swap! app-state update :game game/play-move move))

@@ -42,6 +44,13 @@
 ;; Public API (updates)
 ;; -----------------------------------------

+(s/def ::game-event
+  (s/or
+    :no-params (s/tuple #{:new-game :toggle-help :restart :undo :ai-play})
+    :player-move (s/tuple #{:player-move} ::board/coord)))
+
+(s/fdef send-event! :args (s/tuple ::game-event))
+
 (defn- send-event!
   [msg]
   (case (first msg)
@@ -52,4 +61,3 @@
     :ai-play (play-game-turn! (ai/best-move @current-turn @current-player))
     :player-move (play-game-turn! (second msg))
     ))
-


Realize each stage as late as possible.

Realize each stage as late as possible.

--- src/cmr/opendap/ous/core.clj
+++ src/cmr/opendap/ous/core.clj
@@ -126,35 +126,49 @@

 (defn stage1
   [search-endpoint user-token raw-params]
+  (log/debug "Starting stage 1 ...")
   (let [start (util/now)
         params (params/parse raw-params)
         bounding-box (:bounding-box params)
-        granules (granule/get-metadata search-endpoint user-token params)
-        coll (collection/get-metadata search-endpoint user-token params)]
-    [start params bounding-box granules coll]))
+        grans-promise (granule/async-get-metadata
+                       search-endpoint user-token params)
+        coll-promise (collection/async-get-metadata
+                      search-endpoint user-token params)]
+    (log/debug "Finishing stage 1 ...")
+    [start params bounding-box grans-promise coll-promise]))

 (defn stage2
-  [search-endpoint user-token params coll granules]
-  (let [data-files (map granule/extract-datafile-link granules)
+  [search-endpoint user-token params coll-promise grans-promise]
+  (log/debug "Starting stage 2 ...")
+  (let [granules (granule/extract-metadata grans-promise)
+        coll (collection/extract-metadata coll-promise)
+        data-files (map granule/extract-datafile-link granules)
         service-ids (collection/extract-service-ids coll)
         vars (apply-bounding-conditions search-endpoint user-token coll params)]
     (log/trace "data-files:" (into [] data-files))
+    (log/debug "Finishing stage 2 ...")
     [data-files service-ids vars]))

 (defn stage3
   [search-endpoint user-token bounding-box service-ids vars]
-  (let [services (service/get-metadata search-endpoint user-token service-ids)
+  (log/debug "Starting stage 3 ...")
+  (let [services-promise (service/async-get-metadata
+                          search-endpoint user-token service-ids)
         bounding-info (map #(variable/extract-bounding-info % bounding-box)
                            vars)]
     (log/debug "variable bounding-info:" (into [] bounding-info))
-    [services bounding-info]))
+    (log/debug "Finishing stage 3 ...")
+    [services-promise bounding-info]))

 (defn stage4
-  [bounding-box services bounding-info]
-  (let [pattern-info (service/extract-pattern-info (first services))
+  [bounding-box services-promise bounding-info]
+  (log/debug "Starting stage 4 ...")
+  (let [services (service/extract-metadata services-promise)
+        pattern-info (service/extract-pattern-info (first services))
         query (bounding-info->opendap-query bounding-info bounding-box)]
     (log/trace "pattern-info:" pattern-info)
     (log/debug "query:" query)
+    (log/debug "Finishing stage 4 ...")
     [pattern-info query]))

 (defn get-opendap-urls


remove spurious vals call

remove spurious vals call

Signed-off-by: Chris Granger <5654cde260ae99bc4d30054171b8bcd902efd19a@gmail.com>

--- lein-light-nrepl/src/lighttable/nrepl/doc.clj
+++ lein-light-nrepl/src/lighttable/nrepl/doc.clj
@@ -70,7 +70,7 @@
 (defn get-cljs-doc [nsp sym]
   (env/with-compiler-env cljs/compiler-env
                       (->
-                       (ana/resolve-var {:ns ((-> @env/*compiler* :cljs.analyzer/namespaces vals) (symbol nsp))} (symbol sym))
+                       (ana/resolve-var {:ns ((-> @env/*compiler* :cljs.analyzer/namespaces) (symbol nsp))} (symbol sym))
                        (clean-meta)
                        (format-cljs-result))))


CMR-2153 Updates docstring.

CMR-2153 Updates docstring.

--- system-int-test/src/cmr/system_int_test/data2/core.clj
+++ system-int-test/src/cmr/system_int_test/data2/core.clj
@@ -17,7 +17,7 @@
             [clojure.string :as str]))

 (defn- item->native-id
-  "Returns the native id of an ingest item."
+  "Returns the native id of a UMM record."
   [item]
   (some #(get item %) [:granule-ur :entry-title :native-id :EntryTitle]))


Fix small bugs in extended-luxenburger-basis

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

--- src/conexp/contrib/experimental/extended_luxenburger_basis.clj
+++ src/conexp/contrib/experimental/extended_luxenburger_basis.clj
@@ -19,7 +19,7 @@
   corresponding extended iceberg intent seq, which is the iceberg
   lattice of all intents and pseudo-intents."
   [context minsupp]
-  (let [mincount (round (ceil (* minsupp (count (objects context)))))]
+  (let [mincount (ceil (* minsupp (count (objects context))))]
     (all-closed-sets-in-family (fn [intent]
                                  (>= (count (attribute-derivation context intent))
                                      mincount))
@@ -46,7 +46,9 @@
                           :when (>= (confidence ar) minconf)]),
         X        (set-of (make-association-rule context C-pp C-pp)
                          [C (difference closures
-                                        (set-of (conclusion impl) [impl LB+DG]))
+                                        (set-of (union (premise impl)
+                                                       (conclusion impl))
+                                                [impl LB+DG]))
                           :let [C-pp (context-attribute-closure context C)]])]
     (union LB+DG X)))


clarify dox

clarify dox

--- src/metabase/driver/metadata.clj
+++ src/metabase/driver/metadata.clj
@@ -2,7 +2,8 @@
   "Metadata multi-methods. Implemented by the various drivers, e.g. `metabase.driver.postgres.metadata`.")

 (defn- field-info-dispatch
-  "Dispatch fn for the various field info multi-methods. (Dispatches on kw like `:postgres`)"
+  "Dispatch fn for the various field info multi-methods. When calling a method like `field-count`, FIELD's Database
+   is fetched and we dispatch on it's `engine` (as a keyword). e.g. `:postgres`"
   [{:keys [db] :as field}]
   (let [{:keys [engine]} @db]
     (require (symbol (str "metabase.driver." engine ".metadata")))  ; dynamically load the correct driver implementation


Parsed and scraped band discography info.  Scraped band bio.

--- src/metallumapi/scrape/bands.clj
+++ src/metallumapi/scrape/bands.clj
@@ -8,15 +8,20 @@
 (def ^:dynamic *band-id* 148)
 (def ^:dynamic *band-url* (str *base-url* "bands/" *band-name*))
 (def ^:dynamic *discography-url* (str *base-url*
-                            "band/discography/id/"
-                            *band-id* "/tab/"))
+                                      "band/discography/id/"
+                                      *band-id* "/tab/"))
+(def ^:dynamic *band-bio-url* (str *base-url*
+                                   "band/read-more/id/"
+                                   *band-id*))

 (def ^:dynamic *band-content* [:div#band_content])

 (def ^:dynamic *band-stats* #{[:div#band_stats :dt]
                               [:div#band_stats :dd]})

-(def ^:dynamic *discography* [:table.discog])
+(def ^:dynamic *discography* [:table.discog :tbody :tr])
+
+(def ^:dynamic *bio* [:body])

 (defn fetch-url [url]
@@ -59,10 +64,30 @@

 (defn band-discography []
   (letfn [(disco [d]
-            (html/select (fetch-url (str *discography-url* d))
-                         *discography*))]
+            (let [content (html/select (fetch-url (str *discography-url* d))
+                                       *discography*)]
+              (map (fn [row]
+                     (let [[n t y r] (map :content (html/select row [:td]))
+                           rating (first (:content (second r)))]
+                       {:album {:name (first (:content (first n)))
+                                :link (:href (:attrs (first n)))}
+                        :type (first t)
+                        :year (first y)
+                        :rating (if rating
+                                  {:link (:href (:attrs (second r)))}
+                                  (let [rating-match (re-matcher #"(\d+)\s(\((\d+)%\))" rating)
+                                        [_ number _ percentage] (re-find rating-match)]
+                                    {:reviews number
+                                     :avg-rating (str percentage "%")
+                                     :link (:href (:attrs (second r)))}))}))
+                   content)))]
     {:complete (fn [] (disco "all"))
      :main (fn [] (disco "main"))
      :live (fn [] (disco "lives"))
      :demos (fn [] (disco "demos"))
      :misc (fn [] (disco "misc"))}))
+
+(defn band-bio []
+  (let [bio (html/select (fetch-url *band-bio-url*)
+                              *bio*)]
+    bio))


Allows asserts in addition to exceptions.

--- nucleotide-count/nucleotide_count_test.clj
+++ nucleotide-count/nucleotide_count_test.clj
@@ -21,7 +21,7 @@
   (is (= 1 (nucleotide-count/count \T "GGGGGTAACCCGG"))))

 (deftest validates-nucleotides
-  (is (thrown-with-msg? Exception #"invalid nucleotide" (nucleotide-count/count \X "GACT"))))
+    (is (thrown-with-msg? Throwable #"invalid nucleotide" (nucleotide-count/count \X "GACT"))))

 (deftest counts-all-nucleotides
   (let [s "AGCTTTTCATTCTGACTGCAACGGGCAATATGTCTCTGTGTGGATTAAAAAAAGAGTGTCTGATAGCAGC"]


delete drvs mixin as this is now also handled by the drv mixin

--- src/org/martinklepsch/derivatives.cljc
+++ src/org/martinklepsch/derivatives.cljc
@@ -149,21 +149,7 @@
           :will-unmount  (fn [s]
                            (let [release-drv! (-> s :rum/react-component (gobj/get "context") (gobj/get release-k))]
                              (assert release-drv! "No release! derivative function found in component context")
-                             (reduce #(do (release-drv! %2 token) (update %1 ::derivatives dissoc %2)) s drv-ks)))})))
-
-  #_(defn drvs
-    "Rum mixin similar to `drv` except that you can supply multiple derivative identifiers"
-    [& drv-ks]
-    #?(:cljs
-       (let [ds           (map drv drv-ks)
-             will-mount   (rutil/collect :will-mount ds)
-             will-unmount (rutil/collect :will-unmount ds)]
-         {:class-properties {:contextTypes context-types}
-          :will-mount (fn [s]
-                        (assoc
-                         (rutil/call-all s will-mount)
-                         ::drvs drv-ks))
-          :will-unmount (fn [s] (rutil/call-all s will-unmount))}))))
+                             (reduce #(do (release-drv! %2 token) (update %1 ::derivatives dissoc %2)) s drv-ks)))}))))

 (def ^:dynamic *derivatives* nil)


No need for a full record/protocol for connection state machine

--- src/onyx/messaging/netty_tcp.clj
+++ src/onyx/messaging/netty_tcp.clj
@@ -327,8 +327,7 @@
   (connected [this]))

 (defn add-failed-check
-  "Check if the future failed. link-val is used as a staleness check
-  for the connection as it should not be reset if it has already been reset."
+  "Check if the message failed to send"
   [f connection buf]
   (.addListener f (reify GenericFutureListener
                     (operationComplete [_ _]
@@ -336,35 +335,36 @@
                         (timbre/error "Message failed to send: " (.cause f))
                         (reset-connection connection))))))

-
 (defn make-pending-chan [messenger]
   (chan (sliding-buffer (:pending-buffer-size messenger))))

-(defrecord ConnectionState [state]
-  IConnectionState
-  (initializing [_]
-    (compare-and-set! state :initializing :connecting))
-  (reset [_]
+(defn state->connecting [state]
+  (compare-and-set! state :initializing :connecting))
+
+(defn state->reset [state]
     (compare-and-set! state :connected :reset))
-  (connecting [_]
-    (or (compare-and-set! state :reset :connecting)
-        (compare-and-set! state :initializing :connecting)
-        (compare-and-set! state :failed :connecting)))
-  (failed [_]
-    (compare-and-set! state :connecting :failed))
-  (connected [_]
-    (compare-and-set! state :connecting :connected)))
+
+(defn state->connecting [state]
+  (or (compare-and-set! state :reset :connecting)
+      (compare-and-set! state :initializing :connecting)
+      (compare-and-set! state :failed :connecting)))
+
+(defn state->failed [state]
+  (compare-and-set! state :connecting :failed))
+
+(defn state->connected [state]
+  (compare-and-set! state :connecting :connected))

 (defrecord ConnectionManager [messenger site state pending-ch channel]
   IConnectionManager
   (reset-connection [connection]
-    (when (reset state)
+    (when (state->reset state)
       (reset! pending-ch (make-pending-chan messenger))
       (reset! channel nil)
       (connect connection)))

   (enqueue-pending [connection buf]
-    (case @(:state state)
+    (case @state
       :initializing (>!! @pending-ch buf)
       :connecting (>!! @pending-ch buf)
       :reset (connect connection)
@@ -390,17 +390,17 @@
   (connect [_]
     ; The state machine decides who gets to connect to ensure only one thread
     ; will connect, and the remaining will write out to the pending channel
-    (when (connecting state)
+    (when (state->connecting state)
       (future
         (if-let [opened-channel (create-client (:client-group messenger)
                                                (:netty/external-addr site)
                                                (:netty/port site))]
-          (let [connected? (connected state)]
+          (let [connected? (state->connected state)]
             (assert connected?)
             (flush-pending opened-channel @pending-ch)
             (reset! channel opened-channel))
           (do
-            (failed state)
+            (state->failed state)
             (reset! channel nil)
             (reset! pending-ch (make-pending-chan messenger))))))))

@@ -409,7 +409,7 @@
   (doto
     (->ConnectionManager messenger
                          site
-                         (->ConnectionState (atom :initializing))
+                         (atom :initializing)
                          (atom (make-pending-chan messenger))
                          (atom nil))
     connect))


Cleanup lifecycle build in task-lifecycles.

--- src/onyx/peer/task_lifecycle.clj
+++ src/onyx/peer/task_lifecycle.clj
@@ -12,11 +12,11 @@
             [onyx.log.entry :as entry]
             [onyx.log.replica]
             [onyx.messaging.common :as mc]
+            [onyx.messaging.messenger-state :as ms]
             [onyx.messaging.protocols.messenger :as m]
             [onyx.messaging.protocols.publisher :as pub]
             [onyx.messaging.protocols.subscriber :as sub]
             [onyx.messaging.protocols.status-publisher :as status-pub]
-            [onyx.messaging.messenger-state :as ms]
             [onyx.monitoring.measurements :refer [emit-latency emit-latency-value]]
             [onyx.peer.constants :refer [initialize-epoch]]
             [onyx.peer.task-compile :as c]
@@ -46,7 +46,7 @@
             [onyx.static.logging :as logger]
             [onyx.state.state-extensions :as state-extensions]
             [onyx.static.util :refer [ms->ns]]
-            [onyx.types :refer [->Results ->MonitorEvent]]
+            [onyx.types :refer [->Results ->MonitorEvent ->MonitorEventLatency]]
             [schema.core :as s]
             [taoensso.timbre :refer [debug info error warn trace fatal]])
   (:import [org.agrona.concurrent IdleStrategy SleepingIdleStrategy]
@@ -447,89 +447,122 @@
 (defn new-task-information [peer task]
   (map->TaskInformation (select-keys (merge peer task) [:log :job-id :task-id :id])))

+(defn build-lifecycles [event]
+  [{:lifecycle :lifecycle/poll-recover
+    :fn poll-recover-input-function
+    :type #{:input}
+    :blockable? true}
+   {:lifecycle :lifecycle/poll-recover
+    :type #{:function}
+    :fn poll-recover-input-function
+    :blockable? true}
+   {:lifecycle :lifecycle/poll-recover
+    :type #{:output}
+    :fn poll-recover-output
+    :blockable? true}
+   {:lifecycle :lifecycle/offer-barriers
+    :type #{:input :function}
+    :fn offer-barriers
+    :blockable? true}
+   {:lifecycle :lifecycle/offer-barrier-status
+    :type #{:input :function :output}
+    :fn offer-barrier-status
+    :blockable? true}
+   {:lifecycle :lifecycle/recover-input
+    :type #{:input}
+    :fn recover-input}
+   {:lifecycle :lifecycle/recover-state
+    :type #{:windowed}
+    :fn recover-state}
+   {:lifecycle :lifecycle/unblock-subscribers
+    :type #{:input :function :output}
+    :fn unblock-subscribers}
+   {:lifecycle :lifecycle/next-iteration
+    :type #{:input :function :output}
+    :fn next-iteration}
+   {:lifecycle :lifecycle/input-poll-barriers
+    :type #{:input}
+    :fn input-poll-barriers}
+   {:lifecycle :lifecycle/prepare-barrier-sync
+    :type #{:input :function}
+    :fn prepare-barrier-sync}
+   {:lifecycle :lifecycle/seal-barriers?
+    :fn seal-barriers?
+    :type #{:output}
+    :blockable? false}
+   {:lifecycle :lifecycle/seal-barriers
+    :fn seal-barriers
+    :type #{:output}
+    :blockable? true}
+   ;; TODO: double check that checkpoint doesn't occur immediately after recovery
+   {:lifecycle :lifecycle/checkpoint-input
+    :fn checkpoint-input
+    :type #{:input}
+    :blockable? true}
+   {:lifecycle :lifecycle/checkpoint-state
+    :fn checkpoint-state
+    :type #{:windowed}
+    :blockable? true}
+   {:lifecycle :lifecycle/checkpoint-output
+    :fn checkpoint-output
+    :type #{:output}
+    :blockable? true}
+   {:lifecycle :lifecycle/offer-barriers
+    :fn offer-barriers
+    :type #{:input :function}
+    :blockable? true}
+   {:lifecycle :lifecycle/offer-barrier-status
+    :type #{:input :function :output}
+    :fn offer-barrier-status
+    :blockable? true}
+   {:lifecycle :lifecycle/unblock-subscribers
+    :type #{:input :function :output}
+    :fn unblock-subscribers}
+   {:lifecycle :lifecycle/before-batch
+    :type #{:input :function :output}
+    :fn (build-lifecycle-invoke-fn event :lifecycle/before-batch)}
+   {:lifecycle :lifecycle/read-batch
+    :type #{:input}
+    :fn function/read-input-batch}
+   {:lifecycle :lifecycle/read-batch
+    :type #{:function :output}
+    :fn function/read-function-batch}
+   {:lifecycle :lifecycle/after-read-batch
+    :type #{:input :function :output}
+    :fn (build-lifecycle-invoke-fn event :lifecycle/after-read-batch)}
+   {:lifecycle :lifecycle/apply-fn
+    :type #{:input :function :output}
+    :fn apply-fn}
+   {:lifecycle :lifecycle/after-apply-fn
+    :type #{:input :function :output}
+    :fn (build-lifecycle-invoke-fn event :lifecycle/after-apply-fn)}
+   {:lifecycle :lifecycle/assign-windows
+    :type #{:windowed}
+    :fn assign-windows}
+   {:lifecycle :lifecycle/prepare-batch
+    :type #{:input :function :output}
+    :fn prepare-batch}
+   {:lifecycle :lifecycle/write-batch
+    :type #{:input :function :output}
+    :fn write-batch
+    :blockable? true}
+   {:lifecycle :lifecycle/after-batch
+    :type #{:input :function :output}
+    :fn (build-lifecycle-invoke-fn event :lifecycle/after-batch)}
+   {:lifecycle :lifecycle/offer-heartbeats
+    :type #{:input :function :output}
+    :fn offer-heartbeats}])
+
 (defn filter-task-lifecycles
   [{:keys [onyx.core/task-map onyx.core/windows onyx.core/triggers] :as event}]
-  (let [task-type (:onyx/type task-map)
-        windowed? (or (not (empty? windows))
-                      (not (empty? triggers)))]
-    (cond-> []
-      (#{:input} task-type)                   (conj {:lifecycle :lifecycle/poll-recover-input
-                                                     :fn poll-recover-input-function
-                                                     :blockable? true})
-      (#{:function} task-type)                (conj {:lifecycle :lifecycle/poll-recover-function
-                                                     :fn poll-recover-input-function
-                                                     :blockable? true})
-      (#{:output} task-type)                  (conj {:lifecycle :lifecycle/poll-recover-output
-                                                     :fn poll-recover-output
-                                                     :blockable? true})
-      (#{:input :function} task-type)         (conj {:lifecycle :lifecycle/offer-barriers
-                                                     :fn offer-barriers
-                                                     :blockable? true})
-      (#{:input :function :output} task-type) (conj {:lifecycle :lifecycle/offer-barrier-status
-                                                     :fn offer-barrier-status
-                                                     :blockable? true})
-      (#{:input} task-type)                   (conj {:lifecycle :lifecycle/recover-input
-                                                     :fn recover-input})
-      windowed?                               (conj {:lifecycle :lifecycle/recover-state
-                                                     :fn recover-state})
-      (#{:input :function :output} task-type) (conj {:lifecycle :lifecycle/unblock-subscribers
-                                                     :fn unblock-subscribers})
-      (#{:input :function :output} task-type) (conj {:lifecycle :lifecycle/next-iteration
-                                                     :fn next-iteration})
-      (#{:input} task-type)                   (conj {:lifecycle :lifecycle/input-poll-barriers
-                                                     :fn input-poll-barriers})
-      (#{:input :function} task-type)         (conj {:lifecycle :lifecycle/prepare-barrier-sync
-                                                     :fn prepare-barrier-sync})
-      (#{:output} task-type)                  (conj {:lifecycle :lifecycle/seal-barriers?
-                                                     :fn seal-barriers?
-                                                     :blockable? false})
-      (#{:output} task-type)                  (conj {:lifecycle :lifecycle/seal-barriers
-                                                     :fn seal-barriers
-                                                     :blockable? true})
-      ;; TODO: double check that checkpoint doesn't occur immediately after recovery
-      (#{:input} task-type)                   (conj {:lifecycle :lifecycle/checkpoint-input
-                                                     :fn checkpoint-input
-                                                     :blockable? true})
-      windowed?                               (conj {:lifecycle :lifecycle/checkpoint-state
-                                                     :fn checkpoint-state
-                                                     :blockable? true})
-      ;; OUTPUT IS TOO AHEAD?
-      (#{:output} task-type)                  (conj {:lifecycle :lifecycle/checkpoint-output
-                                                     :fn checkpoint-output
-                                                     :blockable? true})
-      (#{:input :function} task-type)         (conj {:lifecycle :lifecycle/offer-barriers
-                                                     :fn offer-barriers
-                                                     :blockable? true})
-      ;; rename aligneds -> aligments
-      (#{:input :function :output} task-type) (conj {:lifecycle :lifecycle/offer-barrier-status
-                                                     :fn offer-barrier-status
-                                                     :blockable? true})
-      (#{:input :function :output} task-type) (conj {:lifecycle :lifecycle/unblock-subscribers
-                                                     :fn unblock-subscribers})
-      (#{:input :function :output} task-type) (conj {:lifecycle :lifecycle/before-batch
-                                                     :fn (build-lifecycle-invoke-fn event :lifecycle/before-batch)})
-      (#{:input} task-type)                   (conj {:lifecycle :lifecycle/read-batch
-                                                     :fn function/read-input-batch})
-      (#{:function :output} task-type)        (conj {:lifecycle :lifecycle/read-batch
-                                                     :fn function/read-function-batch})
-      (#{:input :function :output} task-type) (conj {:lifecycle :lifecycle/after-read-batch
-                                                     :fn (build-lifecycle-invoke-fn event :lifecycle/after-read-batch)})
-      (#{:input :function :output} task-type) (conj {:lifecycle :lifecycle/apply-fn
-                                                     :fn apply-fn})
-      (#{:input :function :output} task-type) (conj {:lifecycle :lifecycle/after-apply-fn
-                                                     :fn (build-lifecycle-invoke-fn event :lifecycle/after-apply-fn)})
-
-      windowed?                               (conj {:lifecycle :lifecycle/assign-windows
-                                                     :fn assign-windows})
-      (#{:input :function :output} task-type) (conj {:lifecycle :lifecycle/prepare-batch
-                                                     :fn prepare-batch})
-      (#{:input :function :output} task-type) (conj {:lifecycle :lifecycle/write-batch
-                                                     :fn write-batch
-                                                     :blockable? true})
-      (#{:input :function :output} task-type) (conj {:lifecycle :lifecycle/after-batch
-                                                     :fn (build-lifecycle-invoke-fn event :lifecycle/after-batch)})
-      (#{:input :function :output} task-type) (conj {:lifecycle :lifecycle/offer-heartbeats
-                                                     :fn offer-heartbeats}))))
+  (let [task-type (cond-> #{(:onyx/type task-map)}
+                    (or (not (empty? windows))
+                        (not (empty? triggers)))
+                    (conj :windowed))]
+    (->> (build-lifecycles event)
+         (filter (fn [lifecycle]
+                   (not-empty (clojure.set/intersection task-type (:type lifecycle)))))
+         (vec))))

 (defn send-heartbeats! [state]
   (let [messenger (get-messenger state)]
@@ -542,12 +575,13 @@
                            ^int iteration-idx
                            ^int batch-idx
                            ^int nstates
-                           lifecycle-names
+                           #^"[Lclojure.lang.Keyword;" lifecycle-names
                            #^"[Lclojure.lang.IFn;" lifecycle-fns
                            ^:unsynchronized-mutable ^int idx
                            ^:unsynchronized-mutable ^java.lang.Boolean advanced
                            ^:unsynchronized-mutable sealed
                            ^:unsynchronized-mutable replica
+                           monitoring
                            ^:unsynchronized-mutable messenger
                            messenger-group
                            ^:unsynchronized-mutable coordinator
@@ -576,7 +610,7 @@
   (advanced? [this]
     advanced)
   (get-lifecycle [this]
-    (get lifecycle-names idx))
+    (aget lifecycle-names idx))
   (heartbeat! [this]
     ;; TODO, publisher should be smarter about sending a message only when it hasn't
     ;; been sending messages, as segments count as heartbeats too
@@ -725,30 +759,47 @@
        (remove nil?)
        (first)))

-(defn lookup-batch-start-endex [lifecycles]
+(defn wrap-lifecycle-metrics [monitoring lifecycle]
+  (let [lfn (:fn lifecycle)]
+    (if-let [mon-fn (get monitoring (:lifecycle lifecycle))]
+      (fn [state]
+        (let [start (System/nanoTime)
+              next-state (lfn state)
+              end (System/nanoTime)
+              elapsed (unchecked-subtract end start)]
+          (mon-fn next-state elapsed)
+          next-state))
+      lfn)))
+
+(defn lookup-batch-start-index [lifecycles]
   ;; before-batch may be stripped, thus before or read may be first batch fn
   (int (or (lookup-lifecycle-idx lifecycles :lifecycle/before-batch)
            (lookup-lifecycle-idx lifecycles :lifecycle/read-batch))))

 (defn new-state-machine [event opts messenger messenger-group coordinator]
-  (let [{:keys [onyx.core/input-plugin onyx.core/output-plugin]} event
+  (let [{:keys [onyx.core/input-plugin onyx.core/output-plugin onyx.core/monitoring]} event
         {:keys [replica-version] :as base-replica} (onyx.log.replica/starting-replica opts)
         lifecycles (filter :fn (filter-task-lifecycles event))
-        names (mapv :lifecycle lifecycles)
-        arr #^"[Lclojure.lang.IFn;" (into-array clojure.lang.IFn (map :fn lifecycles))
+        names (into-array clojure.lang.Keyword (mapv :lifecycle lifecycles))
+        state-fns (->> lifecycles
+                       (mapv #(wrap-lifecycle-metrics monitoring %))
+                       (into-array clojure.lang.IFn))
         recover-idx (int 0)
         iteration-idx (int (lookup-lifecycle-idx lifecycles :lifecycle/next-iteration))
-        batch-idx (lookup-batch-start-endex lifecycles)
+        batch-idx (lookup-batch-start-index lifecycles)
+        start-idx recover-idx
         heartbeat-ns (ms->ns (arg-or-default :onyx.peer/heartbeat-ms opts))
         idle-strategy (SleepingIdleStrategy. (arg-or-default :onyx.peer/idle-sleep-ns opts))
         window-states (c/event->windows-states event)]
-    (->TaskStateMachine idle-strategy recover-idx iteration-idx batch-idx (alength arr) names arr
-                        (int 0) false false base-replica messenger messenger-group coordinator
-                        input-plugin output-plugin event event window-states nil
-                        replica-version initialize-epoch heartbeat-ns (System/nanoTime))))
+    (->TaskStateMachine idle-strategy recover-idx iteration-idx batch-idx
+                        (count state-fns) names state-fns start-idx false
+                        false base-replica monitoring messenger messenger-group
+                        coordinator input-plugin output-plugin event event
+                        window-states nil replica-version initialize-epoch
+                        heartbeat-ns (System/nanoTime))))

 ;; NOTE: currently, if task doesn't start before the liveness timeout, the peer will be killed
-;; this should be re-evaluated
+;; peer should probably be heartbeating here
 (defn backoff-until-task-start!
   [{:keys [onyx.core/kill-flag onyx.core/task-kill-flag onyx.core/opts] :as event} start-fn]
   (while (and (not (or @kill-flag @task-kill-flag))
@@ -761,15 +812,16 @@
 (defn take-final-state!! [component]
   (<!! (:task-lifecycle-ch component)))

-(defn compile-task [{:keys [task-information job-id task-id id monitoring log
-                            replica-origin replica opts outbox-ch group-ch task-kill-flag kill-flag]}]
+(defn compile-task
+  [{:keys [task-information job-id task-id id monitoring log replica-origin
+           replica opts outbox-ch group-ch task-kill-flag kill-flag]}]
   (let [{:keys [workflow catalog task flow-conditions resume-point
                 windows triggers lifecycles metadata]} task-information
         log-prefix (logger/log-prefix task-information)
         task-map (find-task catalog (:name task))
         filtered-windows (vec (wc/filter-windows windows (:name task)))
         window-ids (set (map :window/id filtered-windows))
-        filtered-triggers (filterv #(window-ids (:trigger/window-id %)) triggers)
+        filtered-triggers (filterv (comp window-ids :trigger/window-id) triggers)
         _ (info log-prefix "Compiling lifecycle")]
     (assert (:onyx/tenancy-id opts) (:onyx/tenancy-id opts))
     (->> {:onyx.core/id id


[#6956] delete duplicates after iteration over messages/statuses

--- src/status_im/data_store/realm/schemas/account/migrations.cljs
+++ src/status_im/data_store/realm/schemas/account/migrations.cljs
@@ -246,7 +246,9 @@
 (defn v27 [old-ream new-realm]
   (let [messages (.objects new-realm "message")
         user-statuses (.objects new-realm "user-status")
-        old-ids->new-ids (volatile! {})]
+        old-ids->new-ids (volatile! {})
+        messages-to-be-deleted (volatile! [])
+        statuses-to-be-deleted (volatile! [])]
     (dotimes [i (.-length messages)]
       (let [message         (aget messages i)
             prev-message-id (aget message "message-id")
@@ -270,11 +272,14 @@
              new-realm
              "message"
              message-id)
-          (.delete new-realm message)
+          (vswap! messages-to-be-deleted conj message)
           (do
             (aset message "message-id" message-id)
             (aset message "raw-payload-hash" raw-payload-hash)
             (aset message "old-message-id" old-message-id)))))
+
+    (doseq [message @messages-to-be-deleted]
+      (.delete new-realm message))

     (dotimes [i (.-length user-statuses)]
       (let [user-status (aget user-statuses i)
@@ -286,7 +291,10 @@
              new-realm
              "user-status"
              new-status-id)
-          (.delete new-realm user-status)
+          (vswap! statuses-to-be-deleted conj user-status)
           (when (contains? @old-ids->new-ids message-id)
             (aset user-status "status-id" new-status-id)
-            (aset user-status "message-id" new-message-id)))))))
+            (aset user-status "message-id" new-message-id)))))
+
+    (doseq [status @statuses-to-be-deleted]
+      (.delete new-realm status))))


More stable require of hotloaded dependencies

- make sure we match up the coords we're interested in with the
  correct jar from alembic/resolve-dependencies

- if some namespace in that jar doesn't load correctly, keep going
  with the others (compojure.handler, I'm looking at you)

--- src/refactor_nrepl/artifacts.clj
+++ src/refactor_nrepl/artifacts.clj
@@ -95,16 +95,20 @@
   "Once the deps are available on cp we still have to load them and
   reset slamhound's cache to make resolve-missing work."
   [coords repos]
-  (try
-    (let [dep (first (alembic/resolve-dependencies alembic/the-still coords repos nil))
-          jarfile (JarFile. (:jar dep))]
-      (dorun (map require (find/find-namespaces-in-jarfile jarfile)))
-      (slamhound/reset))
-    (catch ClassNotFoundException _
-      ;; I've seen this happen after adding core.async as a dependency.
-      ;; A failure here isn't a big deal, it only means that resolve-missing
-      ;; isn't going to work until the namespace has been loaded manually.
-      )))
+  (let [dep (->> (alembic/resolve-dependencies alembic/the-still coords repos nil)
+                 (some (fn [dep] (when (= (:coords dep) (first coords)) dep))))
+        jarfile (JarFile. (:jar dep))]
+    (doseq [namespace (find/find-namespaces-in-jarfile jarfile)]
+      (try
+        (require namespace)
+        (catch Exception _
+          ;; I've seen this happen after adding core.async as a dependency.
+          ;; It also happens if you try to require namespaces that no longer work,
+          ;; like compojure.handler.
+          ;; A failure here isn't a big deal, it only means that resolve-missing
+          ;; isn't going to work until the namespace has been loaded manually.
+          )))
+    (slamhound/reset)))

 (defn- ensure-quality-coordinates [coordinates]
   (let [coords (->> coordinates read-string (take 2) vec)]


fix off-by-one-error in pprint

fix off-by-one-error in pprint

This would cause non-vector libspecs in prefix vectors to bleed together
under certain circumstances

Deciding to take on the pprint code was a huge mistake.

--- src/refactor_nrepl/ns/pprint.clj
+++ src/refactor_nrepl/ns/pprint.clj
@@ -4,24 +4,25 @@
             [refactor-nrepl.ns.helpers :refer [prefix-form?]]))

 (defn- libspec-vectors-last [libspecs]
-  (conj (vec (remove sequential? libspecs))
-        (vec (filter sequential? libspecs))))
+  (concat (remove sequential? libspecs)
+          (filter sequential? libspecs)))

 (defn- pprint-prefix-form [[name & libspecs]]
   (printf "[%s" name)
   (dorun
    (map-indexed (fn [idx libspec]
-                  (when (and (sequential? libspec)
+                  ;; insert newline after all non-libspec vectors
+                  (when (and (vector? libspec)
                              (or (= idx 0)
-                                 (= idx (count (take-while symbol? libspecs)))))
+                                 (= (dec idx) (count (take-while symbol? libspecs)))))
                     (println))
                   (if (= idx (dec (count libspecs)))
                     (printf "%s]\n" libspec)
-                    (if (sequential? libspec)
+                    (if (vector? libspec)
                       (pprint libspec)
                       (if (= idx 0)
                         (printf " %s " libspec)
-                        (if (sequential? (nth libspecs (inc idx)))
+                        (if  (vector? (nth libspecs idx))
                           (printf "%s" libspec)
                           (printf "%s " libspec))))))
                 (libspec-vectors-last libspecs))))
@@ -57,7 +58,7 @@

 (defn- pprint-import-form
   [[_ & imports]]
-  (printf "(:import " )
+  (printf "(:import ")
   (dorun
    (map-indexed
     (fn [idx import]


working on retrieving expressions from db and displaying

--- src/babel/workbook.clj
+++ src/babel/workbook.clj
@@ -8,8 +8,10 @@
    [babel.italiano.grammar :as it]
    [babel.over :refer [over]]
    [babel.html :as html]
+   [babel.korma :as korma]
    [babel.parse :as parse]
    [babel.pos :as pos]
+   [babel.reader :as reader]
    [babel.test.fr :as frtest]
    [clojail.core :refer [sandbox]]
    [clojail.testers :refer :all]
@@ -23,11 +25,14 @@
    [hiccup.core :refer [html]]
 ))

-;; TODO: add other languages
+;; TODO: add other languages (English and Spanish)
 (defn parse [string]
   (concat
    (fr/parse string)
    (it/parse string)))
+
+(defn expr [id]
+  (reader/id2expression [id]))

 ;; this does some sample runtime behavior (generates sentences)
 ;; which allow certain things to get initialized so that remote (i.e. HTTP