Remove the use of futures altogether.

Remove the use of futures altogether.

--- src/containium/core.clj
+++ src/containium/core.clj
@@ -116,27 +116,15 @@
                    (println "Missing name argument."))

       "activate" (if name
-                   (future (try
-                             (modules/activate! (:modules systems) name
-                                                (when path (modules/module-descriptor (as-file path)))
-                                                (console-channel name))
-                             (catch Exception ex
-                               (.printStackTrace ex)
-                               (println "Failed to activate:" ex))))
-                 (println "Missing name argument."))
+                   (modules/activate! (:modules systems) name
+                                      (when path (modules/module-descriptor (as-file path)))
+                                      (console-channel name))
+                   (println "Missing name argument."))
       "deactivate" (if name
-                     (future (try
-                               (modules/deactivate! (:modules systems) name (console-channel name))
-                               (catch Exception ex
-                                 (.printStackTrace ex)
-                                 (println "Failed to deactivate:" ex))))
+                     (modules/deactivate! (:modules systems) name (console-channel name))
                      (println "Missing name argument."))
       "kill" (if name
-               (future (try
-                         (modules/kill! (:modules systems) name (console-channel name))
-                         (catch Exception ex
-                           (.printStackTrace ex)
-                           (println "Failed to kill:" ex))))
+               (modules/kill! (:modules systems) name (console-channel name))
                (println "Missing name argument."))
       (if action
         (println (str "Unknown action '" action "', see help."))


support for deactivating ManUps or Self-destruct Chips when Turntabled

--- src/clj/game/core-installing.clj
+++ src/clj/game/core-installing.clj
@@ -18,7 +18,7 @@
        (when (or (and (= (:side card) "Runner") (:installed card) (not (:facedown card)))
                  (:rezzed card)
                  (= (first (:zone card)) :current)
-                 (not (empty? (filter #(= (:cid card) (:cid %)) (get-in @state [:corp :scored])))))
+                 (= (first (:zone card)) :scored))
          (leave-effect state side card nil)))
      (when-let [prevent (:prevent (card-def card))]
        (doseq [[ptype pvec] prevent]


pick bees in better state

pick bees in better state

--- src/clj/hsm/integration/ghub.clj
+++ src/clj/hsm/integration/ghub.clj
@@ -106,6 +106,8 @@
   )
   )

+;; if the response is 403, capture the reset date and remove it from
+;; the available items

 (defn find-next-url
   "Figure out the next url to call
@@ -132,30 +134,26 @@
           {:success false :next-url nil :data nil :reason "Empty Response"}
           (do
             (let [data (parse-string-strict (:body response) true)
-                  _ (log/sometimes 0.1 (log/info (:headers response) ))
+                  _ (log/sometimes 0.01 (log/info (:headers response) ))
+                  credit-state (select-keys (:headers response) [:X-RateLimit-Reset :X-RateLimit-Remaining])
+                  ; _ (log/infof "R/L %s" credit-state)
                   next-url (find-next-url
                               (or (-> response :headers :link)
                                   (-> response :headers :Link) ;; json encoder causes this when executed remotely
                               ))]
               {:success true
                 :next-url next-url
-                :data data}))))
+                :data data
+                :credits credit-state}))))
     (catch Throwable t
       (do
         (throw+ t)
         {:success false :reason (.getMessage t) :repos [] :next-url nil }))))

-
-(defn pick-bee []
-  (let [hive (wcar  {:pool {} :spec {:host "localhost" :port 6379}}
-              (car/smembers "oss.worker.bees"))]
-        (rand-nth hive)))
-
 (defn assign-worker-bee
-  [task param & {:keys [bee-picker] :or {bee-picker pick-bee}}]
-  (let [bee (bee-picker)
-        url (format "http://%s/%s/%s" bee task param )]
-      (log/info url)
+  [task bee param]
+  (let [url (format "http://%s/%s/%s" bee task param )]
+      ; (log/info url)
      (when-let [result (try
                         (dd/timed {} "worker.bee.call" {:service "oss"}
                           (-> (client/get url)
@@ -175,25 +173,103 @@
       next-url*
   ))

+(defn to-int
+  [v]
+  (try
+    (Integer/parseInt v)
+    (catch Exception ex
+      nil)))
+(defn epoch-sec
+  []
+  (int (/ (hsm.utils/now->ep) 1000)))
+
+(defn credit-report
+  [bee report]
+  (when report
+    (when-let [reset (to-int (:X-RateLimit-Reset report))]
+    (let [now (epoch-sec)
+          credits-left (to-int (:X-RateLimit-Remaining report))
+          report (merge report {:bee bee :rate (if (zero? credits-left) 0
+                                                   (float (/ (- reset now) credits-left)))})]
+    (wcar {:pool {} :spec {:host "localhost" :port 6379}}
+      (car/hset "oss.worker.bee.state" bee (generate-string report))
+      (car/zadd  "oss.worker.bee.tokens" credits-left bee )
+      (car/zadd  "oss.worker.bee.credit" reset bee)
+      (car/zadd  "oss.worker.bee.credit.rate" (str (:rate report))  bee )
+      (car/publish "oss.worker.bee.credit.line"  (generate-string report))
+      )))))
+;; bee has time reset time already set, so don't use it
+;; until the reset has been done.
+
+(defn pick-bee-by-random []
+  ; (log/info "Random bee pick")
+  (let [[hive states] (wcar  {:pool {} :spec {:host "localhost" :port 6379}}
+                        (car/smembers "oss.worker.bees")
+                        (car/hgetall "oss.worker.bee.state"))
+        states (filter (fn[x] (or (> (epoch-sec) (Integer/parseInt (:X-RateLimit-Reset x)))
+                                  (> (Integer/parseInt (:X-RateLimit-Remaining x)) 0)))
+                    (map (fn [[x y]] (parse-string y true)) (partition 2 states)))
+        chosen (rand-nth states)]
+        (if chosen
+          (do
+            (log/infof "Choses %s" chosen)
+            (:bee chosen))
+          (do
+            (log/info "Rollback to random hive bee")
+            (rand-nth hive)))))
+
+(defn pick-bee-by-rank []
+  (let [hive (mapv identity (partition 2 (wcar  {:pool {} :spec {:host "localhost" :port 6379}}
+              (car/zrangebyscore "oss.worker.bee.tokens" 10 5000 "WITHSCORES" ))))
+        selection (mapv identity (last hive))]
+        (if (or (nil? selection) (empty? selection))
+          (pick-bee-by-random)
+          (do
+            ; (log/infof "Lucky one is %s [%s]" selection hive)
+            (first selection)))))
+
+(defn pick-bee-by-rate []
+  (let [hive (mapv identity (partition 2 (wcar  {:pool {} :spec {:host "localhost" :port 6379}}
+              (car/zrangebyscore "oss.worker.bee.credit.rate" 0.01 5000 "WITHSCORES" ))))
+        selection (mapv identity (last hive))]
+        (if (or (nil? selection) (empty? selection))
+          (pick-bee-by-random)
+          (do
+            ; (log/infof "Rate Lucky one is %s [%s]" selection hive)
+            (first selection)))))
+
+(defn pick-a-bee
+  []
+  (apply (rand-nth [pick-bee-by-rank
+                    pick-bee-by-rank
+                    pick-bee-by-random
+                    pick-bee-by-rate
+                    pick-bee-by-rate]) []))
+
+;; if the chosen bee has the credit 0
+
 (defn fetch-url
   "Picks up one of the worker bee as the delegate to fetch the URL and finds the
   next link. "
-  [url]
-  (let [fetcher (fn [url & args] (assign-worker-bee "get-url" (codec/url-encode url)
+  [url & {:keys [bee-picker] :or {bee-picker pick-a-bee}}]
+
+  (let [bee (bee-picker) ;
+        fetcher (fn [url & args] (assign-worker-bee "get-url" bee (codec/url-encode url)
                                   ; :bee-picker (fn [] "localhost:10554")
                                    ))]
       (let [next-step (fetch-url-and-next url {:get-url-fn fetcher})
             next-url (:next-url next-step)
-            ; _ (log/info (:next-url next-step))
-            ]
+            _ (log/sometimes 0.9 (log/info bee (:credits next-step)))]
+            (dd/increment {} "github.calls" 1 {:bee bee :result (not (nil? next-url))})
+            (credit-report bee (:credits next-step))
         (if (nil? next-url)
           next-step
-          (let [next-url* (clean-next-url next-url)
-                next-step* (assoc next-step :next-url next-url*)]
-
+          (do
+            (let [next-url* (clean-next-url next-url)
+                  next-step* (assoc next-step :next-url next-url*)]
             (log/info (:next-url next-step*))
             next-step*
-      )))))
+      ))))))

 (defn user-data
@@ -230,6 +306,8 @@

 (defn find-existing-projects
   [conn project-list]
+    (if (empty? project-list)
+      []
     (let [projects (map :full_name
                       (jdbc/query pg-db
                       (->(sqlh/select :full_name)
@@ -239,7 +317,7 @@
                          (sql/build)
                          (sql/format :quoting :ansi))))]
       ; (log/warn (format "Found projects: %d" (count projects)))
-      projects))
+      projects)))

 (defn insert-users
   [conn coll]
@@ -348,7 +426,7 @@
           :user-does-not-exist
           (let [{:keys [next-url data]} response]
             (when-let [user-info (select-keys data user-fields)]
-              (log/warn (format "%s -> %s" user-login user-info))
+              ; (log/warn (format "%s -> %s" user-login user-info))
               user-info)))))

 (defn expand-project
@@ -358,7 +436,7 @@
       (when (!nil? response)
         (let [proj-data (parse-string (:body response) true)]
           (when-let [proj-info (select-keys proj-data ghub-proj-fields)]
-            (log/warn (format "%s -> %s" proj (select-keys proj-info [:id :watchers :full_name])))
+            ; (log/warn (format "%s -> %s" proj (select-keys proj-info [:id :watchers :full_name])))
             proj-info)))))

 (defn user-starred


More compatible substring test

More compatible substring test

--- src/cljs/db_quiz/components.cljs
+++ src/cljs/db_quiz/components.cljs
@@ -574,7 +574,7 @@
 (defn facebook-button
   "Button to send a Facebook status about your game victories."
   [url]
-  (let [app-id (if (.startsWith url "http://localhost") "873059332790811" "873050382791706")]
+  (let [app-id (if (zero? (.indexOf url "http://localhost")) "873059332790811" "873050382791706")]
      [:a.btn-hex {:href (str "https://www.facebook.com/dialog/feed?"
                              (generate-query-string {:app_id app-id
                                                      :display "page"


Extract into a separate module.

Extract into a separate module.

--- src/cljs/idealist/event-bus.cljs
+++ src/cljs/idealist/event-bus.cljs
@@ -3,3 +3,86 @@
             [om.dom :as dom :include-macros true]
             [cljs.core.async :as async :refer [<! >!]])
   (:require-macros [cljs.core.async.macros :refer [go go-loop]]))
+
+;; =============================================================================
+;; Event handling protocol. Use it in your components if you're interested
+;; in handling events from children.
+
+(defprotocol IGotEvent
+  (got-event [_ ev]))
+
+;; TODO: xform
+;; TODO: Terminate loop.
+;;
+
+(defn- init-event-bus!
+  "Adds support for triggering events and, if the component reified IGotEvent, support for handling events
+   from child components.
+
+   It does so by setting the component's local state:
+      ::trigger-fn  -  function that triggers an event;
+      ::event-bus   -  core.async channel to be passed to the component's children (see root> below).
+
+   Do not use the local state values directly; they are for internal use only."
+  [this]
+  (let [downstream (om/get-state this ::event-bus)
+        c (om/children this)]
+    (om/set-state! this ::trigger-fn #(async/put! downstream %))
+    (when (satisfies? IGotEvent c)
+      (let [upstream (async/chan)
+            branch (async/chan)
+            fork (async/mult upstream)]
+        (async/tap fork branch)
+        (async/tap fork downstream)
+        (om/set-state! this ::event-bus upstream)
+        (go-loop []
+                 (let [e (<! branch)] ;; TODO: Termination.
+                   (got-event c e))
+                 (recur))))))
+
+(defn- before-will-mount!
+  "Overrides componentWillMount pure method to call the fn before its body."
+  [methods fn]
+  (let [prev-will-mount (:componentWillMount methods)]
+    (-> methods
+        (assoc :dly_prevWillMount prev-will-mount)
+        (assoc :componentWillMount fn))))
+
+(defn- make-descriptor
+  "Creates a custom descriptor with support for an event bus."
+  []
+  (let [methods (before-will-mount! om/pure-methods (fn []
+                                                      (this-as this
+                                                               (init-event-bus! this)
+                                                               ((.-dly_prevWillMount this)))))
+        descriptor (om/specify-state-methods! (clj->js methods))]
+    descriptor))
+
+(defn- make-instrument-fn
+  "Creates the function called whenever a component calls build, build-all or build*.
+
+  What this function does is to pass on event bus core.async channel from parent to child. It uses the bus
+  in the parent's local state except for top-level components when it uses 'event-bus' passed as an argument."
+  [event-bus]
+  (fn [f x m]
+    (let [parent-bus (or
+                       (and om/*parent* (om/get-state om/*parent* ::event-bus))
+                       event-bus)]
+      (om/build* f x (update-in m [:init-state] merge {::event-bus parent-bus})))))
+
+(defn root>
+  "Uset this instead of om.core/root to add support for event bus functionality.
+
+  The arity 4 version lets you specify the channel if you also want to receive events from top-level code."
+  ([f value options]
+    (root> f value options (async/chan 1)))
+  ([f value options event-bus]
+    (om/root f value
+             (merge options {:descriptor (make-descriptor)
+                             :instrument (make-instrument-fn event-bus)}))))
+
+(defn trigger
+  "Sends an event from the component downwards to its parent components."
+  [owner event]
+  (let [event-send-fn (om/get-state owner ::trigger-fn)]
+    (event-send-fn event)))


Update thank you page

Update thank you page

--- src/cljs/whatishistory/core.cljs
+++ src/cljs/whatishistory/core.cljs
@@ -447,7 +447,8 @@
 (defn thankyou-page []
   (fn []
     [:div {:class "container thankyou"}
-     [:p "Thank you!"]]))
+     [:header [:h2 {:class "title"} "Thank you!"]]
+     [:a {:href "/defineit"} "Define Another"]]))

 ; (defn about-page []
 ;   [:div [:h2 "About whatishistory"]


Upgrading the randomness cortex uses.

Upgrading the randomness cortex uses.

--- src/cortex/gaussian.clj
+++ src/cortex/gaussian.clj
@@ -1,10 +1,10 @@
 (ns cortex.gaussian
   "Namespace for working with gaussian distributions."
   (:require [clojure.core.matrix :as m])
-  (:import [java.util Random]))
+  (:import [java.security SecureRandom]))

-(def ^:dynamic ^Random *RAND-GENERATOR* (Random.))
+(def ^:dynamic ^SecureRandom *RAND-GENERATOR* (SecureRandom.))

 (defn rand-normal ^double []
   (.nextDouble *RAND-GENERATOR*))


Improve quit behavior on OS X again

Improve quit behavior on OS X again

--- src/clojure/nightcode/window.clj
+++ src/clojure/nightcode/window.clj
@@ -19,15 +19,22 @@
     (when theme-resource (reset! editors/theme-resource theme-resource))
     (SubstanceLookAndFeel/setSkin (or skin-object (GraphiteSkin.)))))

-(defn confirm-exit-app!
+(defn show-shut-down-dialog!
   "Displays a dialog confirming whether the program should shut down."
   []
   (let [unsaved-paths (->> (keys @editors/editors)
                            (filter editors/is-unsaved?)
                            doall)]
-    (if (dialogs/show-shut-down-dialog! unsaved-paths)
-      (System/exit 0)
-      true)))
+    (dialogs/show-shut-down-dialog! unsaved-paths)))
+
+(defn confirm-exit-app!
+  "Shuts down unless a quit handler exists or the user cancels it."
+  []
+  (if (and (nil? (try (Class/forName "com.apple.eawt.QuitHandler")
+                   (catch Exception _)))
+           (show-shut-down-dialog!))
+    (System/exit 0)
+    true))

 (defn enable-full-screen!
   "Enables full screen mode on OS X."
@@ -38,21 +45,30 @@
             (into-array Class [Window Boolean/TYPE]))
           (.invoke nil (object-array [window true]))))

+(defn create-quit-handler
+  "Creates an OS X quit handler."
+  []
+  (when-let [quit-class (try (Class/forName "com.apple.eawt.QuitHandler")
+                          (catch Exception _))]
+    (Proxy/newProxyInstance (.getClassLoader quit-class)
+                            (into-array Class [quit-class])
+                            (reify InvocationHandler
+                              (invoke [this proxy method args]
+                                (when (= (.getName method)
+                                         "handleQuitRequestWith")
+                                  (if (show-shut-down-dialog!)
+                                    (.performQuit (second args))
+                                    (.cancelQuit (second args)))))))))
+
 (defn override-quit-handler!
   "Overrides the default quit handler on OS X."
   []
-  (when-let [quit-class (try (Class/forName "com.apple.eawt.QuitHandler")
-                          (catch Exception _))]
+  (when-let [quit-handler (create-quit-handler)]
     (some-> (try (Class/forName "com.apple.eawt.Application")
               (catch Exception _))
             (.getMethod "getApplication" (into-array Class []))
             (.invoke nil (object-array []))
-            (.setQuitHandler
-              (Proxy/newProxyInstance (.getClassLoader quit-class)
-                                      (into-array Class [quit-class])
-                                      (reify InvocationHandler
-                                        (invoke [this proxy method args]
-                                          (confirm-exit-app!))))))))
+            (.setQuitHandler quit-handler))))

 (defn add-listener!
   "Sets callbacks for window events."
@@ -68,4 +84,5 @@
         ; update the tree to reflect any changes in the filesystem
         (ui/update-project-tree!))
       (windowClosing [e]
-        (confirm-exit-app!)))))
+        (when (show-shut-down-dialog!)
+          (System/exit 0))))))


Use unstemmed versions of words in dict search.

--- src/clucy/positions_searcher.clj
+++ src/clucy/positions_searcher.clj
@@ -75,7 +75,7 @@
                    (doall
                     (map #(stemming-word %)
                          phrase-words)))
-                 (map #(.split % " ") dict-phrases-set))))
+                 (map #(.split % "[ -]") dict-phrases-set))))

 (defn get-positions [^TermsEnum te & {:keys [get-term
                                              get-freq
@@ -135,9 +135,13 @@
                            start (first tp)
                            ;; The end (end-offset) of the previous (last)
                            ;; matched word of the phrase in text
-                           end (llast pp)]
-                       (< (Math/abs (- start end))
-                          *words-distance-in-phrase*)))
+                           end (llast pp)
+                           delta (Math/abs (- start end))]
+                       (and
+                        ;; If phrase is a double word e.g. "green green" -
+                        ;; we find the same word
+                        (not (>= (-> pp last first) start))
+                        (< delta *words-distance-in-phrase*))))
                    this-position))]
              (if next-pos
                (recur (next pps) (cons (conj pp next-pos) result))
@@ -202,10 +206,12 @@

   When *with-stemmed* is true, the iteratior item is the following:
   [stemmed-word [start-offset end-offset]]"
-  (let [phrases (into #{} (filter #(.contains % " ") dict))
+  (let [phrases (into #{} (filter #(or (.contains % " ")
+                                       (.contains % "-")) dict))
         words (clojure.set/difference dict phrases)
-        search-words (stemming-dict words)
-        search-phrases (stemming-phrases phrases)
+        search-words (clojure.set/union (stemming-dict words) words)
+        search-phrases (clojure.set/union (stemming-phrases phrases)
+                                          (map #(.split % "[ -]") phrases))
         br-words (map #(BytesRef. %) search-words)
         br-phrases (map (fn [phrase] (map #(BytesRef. %) phrase)) search-phrases)
         iwords (into #{} br-words)
@@ -256,7 +262,10 @@
   When *with-stemmed* is true return [[matched-text stemmed-text beg]... ],
   assume first argument has [[stemmed-word [start-offset end-offset]]... ]
   structure."
-  (let [positions (sort-by first positions)]
+  (let [get-first (if *with-stemmed*
+                    (fn [x] (-> x second first))
+                    (fn [x] (first x)))
+        positions (sort-by get-first positions)]
     (cond
       ;; ---
       (string? text-data)


Better abstraction of bound parsing.

Better abstraction of bound parsing.

--- src/cmr/opendap/ous/variable.clj
+++ src/cmr/opendap/ous/variable.clj
@@ -38,7 +38,9 @@
   {:x (:Size (first (filter #(= "XDim" (:Name %)) dim)))
    :y (:Size (first (filter #(= "YDim" (:Name %)) dim)))})

-(defn parse-bounds
+(defn parse-annotated-bounds
+  "Parse bounds that are annotated with Lat and Lon, returning values
+  in the same order that CMR uses for spatial bounding boxes."
   [bounds]
   (let [lon-regex "Lon:\\s*(-?[0-9]+),\\s*(-?[0-9]+).*;\\s*"
         lat-regex "Lat:\\s*(-[0-9]+),\\s*(-?[0-9]+).*"
@@ -46,17 +48,29 @@
          (rest (re-find (re-pattern (str lon-regex lat-regex)) bounds))]
     [lon-lo lat-lo lon-hi lat-hi]))

+(defn parse-cmr-bounds
+  [bounds]
+  "Parse a list of lat/lon values ordered according to the CMR convention
+  of lower-left lon, lower-left lat, upper-right long, upper-right lat."
+  (map string/trim (string/split bounds #",\s*")))
+
+(defn parse-bounds
+  [bounds]
+  (if (string/starts-with? bounds "Lon")
+    (parse-annotated-bounds bounds)
+    (parse-cmr-bounds bounds)))
+
 (defn extract-bounds
-  [bounds]
-  (let [[lon-lo lat-lo lon-hi lat-hi]
-        (if (string/starts-with? bounds "Lon")
-          (parse-bounds bounds)
-          (map string/trim (string/split bounds #",\s*")))]))
+  [entry]
+  (->> entry
+       (#(get-in % [:umm :Characteristics :Bounds]))
+       parse-bounds
+       (map #(Integer/parseInt %))))

 (defn extract-bounding-info
   [entry]
   {:concept-id (get-in entry [:meta :concept-id])
    :name (get-in entry [:umm :Name])
    :dimensions (parse-dimensions (get-in entry [:umm :Dimensions]))
-   :bounds (parse-bounds (get-in entry [:umm :Characteristics :Bounds]))
+   :bounds (extract-bounds entry)
    :size (get-in entry [:umm :Characteristics :Size])})


added function for transforming values of a map with a given function

--- src/distillery/data.clj
+++ src/distillery/data.clj
@@ -24,6 +24,11 @@
   "Applies a function to the value of a key-value-pair."
   [f [k v]] [k (f v)])

+(defn map-values
+  "Applies a function to the values of a map and returns a map with associating the original keys with the transformed values."
+  [f m]
+  (apply (if (sorted? m) sorted-map hash-map) (apply concat (map #(map-pair-value f %) m))))
+
 (defn multi-filter
   "Applies a number of predicates to a value and returns true if all predicates are true."
   [predicates x]


reitit-interceptors into reitit bundle

reitit-interceptors into reitit bundle

--- modules/reitit/project.clj
+++ modules/reitit/project.clj
@@ -14,6 +14,7 @@
                  [metosin/reitit-ring]
                  [metosin/reitit-middleware]
                  [metosin/reitit-http]
+                 [metosin/reitit-interceptors]
                  [metosin/reitit-swagger]
                  [metosin/reitit-swagger-ui]
                  [metosin/reitit-frontend]


fixing typo

fixing typo

--- resources/leiningen/new/ow_app/dev/repl.clj
+++ resources/leiningen/new/ow_app/dev/repl.clj
@@ -10,5 +10,5 @@
 (defn stop-figwheel []
   (f/stop-figwheel!))

-(def start-browser-repl []
+(defn start-browser-repl []
   (f/cljs-repl))


Parsing product, version, and guide name form the job name

--- src/emender_jenkins/rest_api.clj
+++ src/emender_jenkins/rest_api.clj
@@ -555,6 +555,10 @@
              (-> (create-bad-request-response "running_jobs" "Can not read Jenkins queue and/or selected view")
                  (send-error-response request :internal-server-error)))))

+(defn throw-exception
+    [message previous-exception]
+    (throw (new Exception (str message (.getMessage previous-exception)))))
+
 (defn read-waive-input-data
     [request]
     (try
@@ -562,15 +566,32 @@
             read-request-body
             (json/read-str :key-fn clojure.core/keyword))
         (catch Exception e
-            (throw (new Exception (str "Can not read POST data: " (.getMessage e)))))))
+            (throw-exception "Can not read POST data: " e))))
+
+(defn parse-job-name
+    [input-data]
+    (let [job-name (:job_name input-data)]
+        (-> input-data
+            (assoc :product (results/job-name->product-name job-name))
+            (assoc :version (results/job-name->version job-name))
+            (assoc :guide   (results/job-name->book-name job-name))
+            (dissoc :job_name)
+            )))
+
+(defn parse-waive-data
+    [input-data]
+    (let [parsed-data (if (:job_name input-data)
+                          (parse-job-name input-data)
+                          input-data)]
+         parsed-data))

 (defn waive
     "Waive one test result."
     [request]
     (try
-        (let [waive-input-data  (read-waive-input-data request)]
-             ; parsed-waive-data (parse-waive-data waive-input-data)]
-              (send-response waive-input-data request))
+        (let [waive-input-data  (read-waive-input-data request)
+              parsed-waive-data (parse-waive-data waive-input-data)]
+              (send-response parsed-waive-data request))
         (catch Exception e
             (let [error-message (str "Error waiving test results: " (.getMessage e))]
                 (log/error error-message)


Don't transition to :nothing state when we don't know what to do.

--- src/app/cljs/one/sample/model.cljs
+++ src/app/cljs/one/sample/model.cljs
@@ -81,8 +81,8 @@
 (defmethod new-status [:valid :finished :empty] [p e f]
   {:status :empty})

-(defmethod new-status :default [a b c v]
-  {:status :nothing :value v})
+(defmethod new-status :default [p e f]
+  {:status p})

 (defmulti ^:private validate
   "Accepts a form id and a value and returns a map


check for bad alias table with good error message

--- library/src/doo/core.clj
+++ library/src/doo/core.clj
@@ -29,6 +29,10 @@
        (resolve-alias :slimer {}) => [:slimer]
        (resolve-alias :something {}) => []"
   [alias alias-table]
+  {:pre [(keyword? alias) (map? alias-table)]}
+  (assert (every? vector? (vals alias-table))
+          (format "The values for the alias tables must be vectors but at least one of them, %s, is not.\n\nEx: {:default [:firefox]}"
+                  (first (remove vector? (vals alias-table)))))
   (let [alias-table (merge default-aliases alias-table)
         stack-number (atom 0)]
     (letfn [(resolve-alias' [alias]


Argument name didn’t match documentation

--- src/such/imperfection.clj
+++ src/such/imperfection.clj
@@ -59,8 +59,8 @@
              (tag \"frobout\") -prn-
              ...)
 "
-  [string value]
-  (println string)
+  [tag value]
+  (println tag)
   value)

 (defn -tag


New event join chat

New event join chat

--- src/grooming/chat/web_socket.clj
+++ src/grooming/chat/web_socket.clj
@@ -42,6 +42,10 @@
   (let [ids (chatroom/members (keyword chat-room))]
     (send-event ids (assoc data :username u))))

+(defmethod handle-event :join-chat
+  [{id :id} {r :room-name}]
+  (chatroom/join id r))
+
 (defmethod handle-event :default
   [session data]
   (log/warn "Unknown message type received!"))
@@ -56,5 +60,5 @@
                                   (log/info "Channel closed: " status)
                                   (swap! open-channels dissoc session-id)))
       (httpkit/on-receive channel (fn [data] (handle-event
-                                              (:session request)
+                                              (assoc (:session request) :id session-id)
                                               (json/read-str data :key-fn json->edn)))))))


Make sixteen-nuls an actual byte array

Make sixteen-nuls an actual byte array

--- src/caesium/crypto/generichash.clj
+++ src/caesium/crypto/generichash.clj
@@ -1,7 +1,7 @@
 (ns caesium.crypto.generichash
   (:import (org.abstractj.kalium.crypto Hash)))

-(def ^:private sixteen-nuls (repeat 16 (byte 0)))
+(def ^:private sixteen-nuls (byte-array 16))

 (defn blake2b
   "Computes the BLAKE2b digest of the given message, with optional


give defaults

give defaults

--- src/hivewing_core/hive_image.clj
+++ src/hivewing_core/hive_image.clj
@@ -94,7 +94,7 @@
   (sqs/send-message config/sqs-aws-credentials (hive-images-sqs-queue) (prn-str {:worker-update worker-uuid})))

 (def gitolite-shell-command
-  (.getPath (io/file (env :hivewing-gitolite-shell-command))))
+  (.getPath (io/file (or (env :hivewing-gitolite-shell-command) "/home/git/bin/gitolite"))))

 (defn hive-image-recompile-gitolite
   "Run the commands to recompile gitolite"
@@ -108,10 +108,10 @@
   [& body] `( ~@body (hive-image-recompile-gitolite)))

 (def gitolite-root
-  (.getPath (io/file (env :hivewing-gitolite-root))))
+  (.getPath (io/file (or (env :hivewing-gitolite-root) "/home/git/.gitolite" ))))

 (def gitolite-repositories-root
-  (.getPath (io/file (env :hivewing-gitolite-repositories-root))))
+  (.getPath (io/file (or (env :hivewing-gitolite-repositories-root) "/home/git/repositories" ))))

 (def gitolite-key-root
   "The place where we'll drop public key files"
@@ -178,7 +178,7 @@
        (catch Exception e nil))))

 (def hive-image-data-bucket
-  (env :hivewing-hive-images-bucket-name))
+  (or (env :hivewing-hive-images-bucket-name) "hivewing-images-bucket-undefined"))

 (defn ensure-hive-image-bucket
   "Ensures the S3 bucket for images exists"


Add check for file property before displaying source link. Fixes #178

--- src/clj/clojuredocs/pages/vars.clj
+++ src/clj/clojuredocs/pages/vars.clj
@@ -43,8 +43,8 @@
                (assoc sa :doc (:doc looked-up-var))))))
        (remove nil?)))

-(defn source-url [{:keys [file line ns]}]
-  (when (= "clojure.core" ns)
+(defn source-url [{:keys [file line ns] :as var}]
+  (when (and (= "clojure.core" ns) file)
     (str "https://github.com/clojure/clojure/blob/clojure-1.9.0/src/clj/" file "#L" line)))

 (defn lookup-var [ns name]


Missed a couple file separators.

Missed a couple file separators.

--- src/clj/qualityclj/imports/git.clj
+++ src/clj/qualityclj/imports/git.clj
@@ -1,5 +1,6 @@
 (ns qualityclj.imports.git
-  (:require [clj-jgit.porcelain :as git]))
+  (:require [clj-jgit.porcelain :as git])
+  (:import java.io.File))

 (def repo-path "repos")

@@ -10,4 +11,4 @@

    Example: (import-repo \"https://github.com/Datomic/codeq\" \"Datomic\" \"codeq\")"
   [repo-url user repo]
-  (git/git-clone-full repo-url (str repo-path "/" user "/" repo)))
+  (git/git-clone-full repo-url (str repo-path File/separator user File/separator repo)))


Increase default timeout to the MAX!

Increase default timeout to the MAX!

closes #49

--- src/clj/reply/eval_modes/nrepl.clj
+++ src/clj/reply/eval_modes/nrepl.clj
@@ -107,8 +107,8 @@
   "Mostly ripped from nREPL's cmdline namespace."
   [options]
   (let [connection         (get-connection options)
-        default-timeout    30000
-        timeout            (Integer. (or (:timeout options) default-timeout))
+        default-timeout    Long/MAX_VALUE
+        timeout            (Long. (or (:timeout options) default-timeout))
         client             (nrepl/client connection timeout)
         session            (nrepl/new-session client)
         completion-session (nrepl/new-session client) ]


docker api 1.27 -> 1.28

docker api 1.27 -> 1.28

--- src/clj/swarmpit/docker/client.clj
+++ src/clj/swarmpit/docker/client.clj
@@ -6,7 +6,7 @@
             [cheshire.core :refer [parse-string generate-string]]
             [swarmpit.base64 :as base64]))

-(def ^:private api-version "v1.27")
+(def ^:private api-version "v1.28")
 (def ^:private base-cmd ["curl" "--unix-socket" "/var/run/docker.sock" "-w" "%{http_code}"])

 (defn- map-headers


add transaction date to transaction edit flow

--- src/clj_money/web/transactions.clj
+++ src/clj_money/web/transactions.clj
@@ -171,6 +171,9 @@
 (defn- form-fields
   [transaction back-url]
   (html
+    [:input {:type :hidden
+             :name :original-transaction-date
+             :value (:transaction-date transaction)}]
     [:div.row
      [:div.col-md-6
       (date-input-field transaction :transaction-date)]
@@ -265,6 +268,7 @@
                                                              transaction-date)
                                     :update))
          action (cond-> (path "/transactions"
+                              (:transaction-date transaction)
                               (:id transaction))

                   (:redirect params)


Add quality property to thumbnail generation function.

--- src/uxbox/util/images.clj
+++ src/uxbox/util/images.clj
@@ -15,10 +15,10 @@

 (defn thumbnail
   ([input] (thumbnail input nil))
-  ([input {:keys [size crop format]
-           :or {format "webp"
-                size [200 200]
-                crop true}
+  ([input {:keys [size quality format]
+           :or {format "jpg"
+                quality 92
+                size [200 200]}
            :as opts}]
    {:pre [(vector? size)]}
    (with-open [out (ByteArrayOutputStream.)]
@@ -31,6 +31,7 @@
                 (.thumbnail (int width) (int height))
                 (.gravity "center")
                 (.extent (int width) (int height))
+                (.quality (double quality))
                 (.addImage (into-array String [(str format ":-")])))
            cmd (doto (ConvertCmd.)
                  (.setInputProvider pipe-in)


Link to latest, not listed version

Link to latest, not listed version

This patch tweaks read-related so that rather than linking to the
version where the symbol(s) are listed as related are listed, things
sharing the version of the thing for which related symbols are requested
will be returned.

Note that this may generate invlalid links, however it is likely to give
more current results and so is provided.

--- src/grimoire/api/fs.clj
+++ src/grimoire/api/fs.clj
@@ -176,7 +176,8 @@
   ;; being a sequence of fully qualified symbols not Thing URIs. Will
   ;; work, but not optimal in terms of utility going forwards.

-  (let [thing  (ensure-thing thing)]
+  (let [thing           (ensure-thing thing)
+        current-version (thing->version thing)]
     (for [thing (api/thing->prior-versions config thing)
           :let  [v (:name (thing->version thing))
                  h (thing->related-handle config thing)]
@@ -184,7 +185,7 @@
           :when (.isFile h)
           line  (line-seq (io/reader h))
           :let  [sym (read-string line)]]
-      (-> thing
+      (-> current-version
           (->Ns  (namespace sym))
           (->Def (name sym))))))


Changing some index mappings to try to reduce space used.

--- src/cmr/indexer/data/index_set.clj
+++ src/cmr/indexer/data/index_set.clj
@@ -60,6 +60,8 @@
   "Defines mappings for attributes."
   {:type "nested"
    :dynamic "strict"
+   :_source {:enabled false}
+   :_all {:enabled false}
    :properties
    {:name string-field-mapping
     :string-value string-field-mapping
@@ -74,6 +76,8 @@
   "Defines mappings for science keywords."
   {:type "nested"
    :dynamic "strict"
+   :_source {:enabled false}
+   :_all {:enabled false}
    :properties
    {:category string-field-mapping
     :category.lowercase string-field-mapping
@@ -93,19 +97,14 @@
 (def orbit-calculated-spatial-domain-mapping
   {:type "nested"
    :dynamic "strict"
+   :_source {:enabled false}
+   :_all {:enabled false}
    :properties {:orbital-model-name string-field-mapping
                 :orbit-number int-field-mapping
                 :start-orbit-number double-field-mapping
                 :stop-orbit-number double-field-mapping
                 :equator-crossing-longitude double-field-mapping
                 :equator-crossing-date-time date-field-mapping}})
-
-(def spatial-shape-mapping
-  "Defines the mapping for a single spatial shape. Each shape is represented by a minimum bounding
-  rectangle, largest interior rectangle, and spatial ordinates."
-  {:type "nested"
-   :dynamic "strict"
-   :properties {}})

 (def spatial-coverage-fields
   "Defines the sets of fields shared by collections and granules for indexing spatial data."
@@ -127,9 +126,9 @@

    ;; ords-info contains tuples of shapes stored in ords
    ;; Each tuple contains the shape type and the number of ordinates
-   :ords-info (stored int-field-mapping)
+   :ords-info (not-indexed (stored int-field-mapping))
    ;; ords contains longitude latitude pairs (ordinates) of all the shapes
-   :ords (stored int-field-mapping)})
+   :ords (not-indexed (stored int-field-mapping))})

 (def collection-mapping
   {:collection {:dynamic "strict",


Insert spaces between terms to get desired width

--- src/harnocode/core.cljs
+++ src/harnocode/core.cljs
@@ -3,6 +3,7 @@
               [clojure.string :as string]
               [figwheel.client :as fw]))

+;; TODO: make spacing more even
 (enable-console-print!)

 ;; define your app data so that it doesn't get over-written on reload
@@ -12,6 +13,19 @@
 (defn show-harnocode! [harnocode]
   (let [output-area (dom/getElement "output")]
     (when output-area (set! (.-value output-area) harnocode))))
+
+;; Ugly, but have no time to find a better way
+(defn insert [v pos item]
+  (let [[h t] (split-at pos v)]
+    (vec (concat h [item] t))))
+
+;; Insert spaces between terms so they occupy exactly l chars
+;; TODO: make spacing more even
+(defn insert-spaces [terms l]
+  (let [terms-interleaved (butlast (interleave terms (cycle " "))) ;; TODO: need better interleave that would work as string.join (without last space)
+        spaces-needed (- l (apply + (map count terms-interleaved)))
+        f (fn [terms _] (insert terms (inc (rand-int (- (count terms) 1))) " "))]
+    (string/join (reduce f terms-interleaved (range spaces-needed)))))

 ;; Best try on filling "column" of l subsequent ones with one or more tokens
 (defn fill-column [ts l]
@@ -23,9 +37,6 @@
         ts-rest (drop (count terms-that-fit) ts)]
    [(insert-spaces terms-that-fit l) ts-rest]))

-;; Insert spaces between terms so they occupy exactly l chars
-(defn insert-spaces [terms l]
-  (string/join " " terms))

 (defmulti fill-group
   (fn [[result tokens] group]
@@ -59,8 +70,8 @@

 (let [code      "var a = 42; var b = 'hello';"
-      img       [[0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1]
-                 [0 0 0 0 0 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1]
+      img       [[0 0 0 0 0 0 0 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 1 1 1 1]
+                 [0 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 1 1 1 1]
                  [0 0 0 0 0 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1]
                  [0 0 0 0 0 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1]
                  [0 0 0 0 0 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1]


parens around parenthetical output

parens around parenthetical output

--- src/fontana/core.clj
+++ src/fontana/core.clj
@@ -26,7 +26,8 @@
              :Scene (div :scene),
              :Dialogue (div :dialogue),
              :Character (div :character),
-             :Parenthetical (div-join-lines :parenthetical),
+             :Parenthetical (comp (div-join-lines :parenthetical)
+                                  #(str "(" % ")")),
              :Talk (div-join-lines :talk),
              :Action (div-join-lines :action),
              :Header (div :header)}
@@ -34,8 +35,8 @@
     (hiccup/html
       [:html
        [:head
-        [:style (clojure.java.io/resource "screenplay.css")]
-       [:body script]])))
+        [:style (slurp (clojure.java.io/resource "screenplay.css"))]
+       [:body script]]])))

 (defn convert
   ([in out]


Damn it's grouping

Damn it's grouping

--- src/grid/render.cljs
+++ src/grid/render.cljs
@@ -4,13 +4,12 @@

 (enable-console-print!)

-(q/defcomponent User
+(q/defcomponent Row
   [data header-meta]
   (apply d/tr {}
-         (map (fn [header] (d/td {} (if(get header :renderer)
-                                      (#((get header :renderer) (get data (get header :key))))
-                                      (get data (get header :key)))))
-              (partial header-meta))))
+         (map (fn [header] (d/td {} ((get header :renderer identity)
+                                     ((:key header) data))))
+              header-meta)))

 (defn render-header [header]
   (d/thead {}
@@ -19,17 +18,32 @@
                                       :onClick (:onClick h)} (:title h)))
                        header))))

-(q/defcomponent Grid
-  [model]
+(defn render-body [model]
   (let [header-meta (get-in model [:meta :header])]
+    [(apply d/tbody {}
+             (map (fn [row]
+                    (Row row header-meta)) (:data model)))]))
+
+(defn render-grouped-body [model f]
+  (let [grouped (group-by f (:data model))
+        header-meta (get-in model [:meta :header])]
+    (map (fn [[k v]]
+            (apply d/tbody {}
+                   (cons (d/tr {:className "group-header"}
+                               (d/td {:colSpan (count header-meta)} (str k " (" (count v) ")") ))
+                         (map (fn [r] (Row r header-meta)) v)))) grouped)))
+
+(q/defcomponent Grid [model]
+  (let [header-meta (get-in model [:meta :header])
+        group-by-f (get-in model [:meta :group-by])]
     (d/div {:className "panel panel-default"}
            (d/div {:className "panel-heading"}
                   "SuperAmazing ClojureScript w/React grid")
-           (d/table {:className "table"}
-                    (render-header header-meta)
-                    (apply d/tbody {}
-                           (map (fn [d]
-                                  (User d header-meta)) (:data model)))))))
+           (apply d/table {:className "table"}
+                    (cons (render-header header-meta)
+                          (if group-by-f
+                            (render-grouped-body model group-by-f)
+                            (render-body model)))))))

 (defn render-grid [grid-data]
   (q/render (Grid grid-data)
@@ -50,9 +64,8 @@
   (fn [event reactid]
     (render-grid (f column-key))))

-(defn create-email-column-renderer [column-key]
-  (fn [key]
-    (d/a {:className "byline" :href key} key)))
+(defn link-renderer [val]
+  (d/a {:className "byline" :href val} val))

 (def my-data {:data [{:name "John Doe"
                       :email "user@email.com"
@@ -60,17 +73,25 @@
                      {:name "Frank Bølviken"
                       :email "frank.bolviken@gmail.com"
                       :country "Norway"}
+                      {:name "Jazee"
+                      :email "jz@gmail.com"
+                      :country "Norway"}
                      {:name "SS Assum"
                       :email "sss.bolviken@gmail.com"
                       :country "France"}]
               :meta {:header
-                     [{:key :email :title "Email" :className "email" :onClick
-                       (create-sorter column-sorter :email) :renderer (create-email-column-renderer)}
-                      {:key :name :title "Name"
-                       :onClick
-                       (create-sorter column-sorter :name)}
-                      {:key :country :title "Country"
+                     [{:key :email
+                       :title "Email"
+                       :className "email"
+                       :onClick (create-sorter column-sorter :email)
+                       :renderer link-renderer}
+                      {:key :name
+                       :title "Name"
+                       :onClick (create-sorter column-sorter :name)}
+                      {:key :country
+                       :title "Country"
                        :onClick (create-sorter column-sorter :country)
-                       }]}})
+                       }]
+                     :group-by :country}})

 (render-grid  my-data)


reading & parsing words.txt OK

reading & parsing words.txt OK

--- src/hangman/core.clj
+++ src/hangman/core.clj
@@ -5,4 +5,14 @@

 (defn main []
-  (println "Hello, World!"))
+  (println "Hello, World!")
+  (let [ wordFile  (slurp "resources/words.txt")
+         ; _         (println "#1: " (take 25 wordFile))
+         lines     (str/split-lines wordFile)
+         ; _         (println "#2: " (take 5 lines))
+         words     (map str/trim lines)
+         ;_         (println "#3: " (take 5 (map #(str \" % \") words) ))
+       ]
+    (println (take 5 (map #(str \" % \") words) ))
+  )
+)


Define normalize-uri in utils.

Define normalize-uri in utils.

--- src/incise/utils.clj
+++ src/incise/utils.clj
@@ -26,6 +26,13 @@
       (.getCanonicalPath)
       (subs (inc (count (.getCanonicalPath (file prefix-file)))))))

+(defn normalize-uri
+  "Prepend index.html to a uri with a trailing slash."
+  [uri]
+  (if (= (last uri) \/)
+    (str uri "index.html")
+    uri))
+
 (defn directory? [^File afile] (.isDirectory afile))

 (defn- gitignore-file? [^File file]


Add back closing socket deployer channel after status was written

--- src/containium/deployer/socket.clj
+++ src/containium/deployer/socket.clj
@@ -39,12 +39,10 @@
               ^Channel chan (.getChannel evt)
               [command & args] (commands/parse-quoted msg)]
           (when command
-            ;; TODO Add argument to done-fn for success?
-            ;; TODO Close via future? (.addListener ^ChannelFuture fut ChannelFutureListener/CLOSE)
-            (let [command-logger (logging/command-logger logger chan command
-                                                         (fn [s] (.write chan (if s "SUCCESS\n"
-                                                                                "FAILED\n"))
-                                                                 (.close chan)))]
+            (let [close-fn (fn [status]
+                             (-> (.write chan (if status "SUCCESS\n" "FAILED\n"))
+                                 (.addListener ChannelFutureListener/CLOSE)))
+                  command-logger (logging/command-logger logger chan command close-fn)]
               (try
                 (commands/handle-command command args systems command-logger)
                 (catch Throwable t


Small update to Timbre config to use only a bare message as logging output.

--- src/galleon.clj
+++ src/galleon.clj
@@ -37,10 +37,8 @@
   ;; Output formatter used by built-in appenders. Custom appenders may (but are
   ;; not required to use) its output (:output). Extra per-appender opts can be
   ;; supplied as an optional second (map) arg.
-  :fmt-output-fn (fn [{:keys [level ns message args]}]
-                   (str
-                     message
-                     (if (> (count args) 1) (str " " (pr-str (rest args))) "")))
+  :fmt-output-fn (fn [{:keys [message]}]
+                   message)

   :shared-appender-config {} ; Provided to all appenders via :ap-config key
   :appenders


(aspect-field ?aspect ?field) -> (aspect ?aspect)(type-field ?aspect field)

--- EkekoAspectJ/src/damp/ekeko/aspectj/soot.clj
+++ EkekoAspectJ/src/damp/ekeko/aspectj/soot.clj
@@ -94,7 +94,8 @@
   field-sootfield
   [?ajfield ?soot]
   (fresh [?model ?scene ?aspect ?signature]
-         (world/aspect-field ?aspect ?ajfield)
+         (world/aspect ?aspect)
+         (world/type-field ?aspect ?ajfield)
          (equals ?signature (sootsignature ?ajfield))
          (soot/soot-model-scene ?model ?scene)
          (soot/soot-field-signature ?soot ?signature)))


Update sat4j-solve

Update sat4j-solve

--- src/logic/sat-solve.clj
+++ src/logic/sat-solve.clj
@@ -9,23 +9,21 @@
 (defn sat4j-solve
   [dimacs-map]
   (let [solver (SolverFactory/newDefault)
+        reader (DimacsReader. solver)
         clauses (:clauses dimacs-map)
         MAXVAR (:num-vars dimacs-map)
         NBCLAUSES (:num-clauses dimacs-map)]
     (.newVar solver MAXVAR)
     (.setExpectedNumberOfClauses solver NBCLAUSES)

-    (loop [c clauses]
-      (if (first c)
-        (let [n (first c)
-              clause (subvec n 0 (dec (count n)))]
-          (.addClause solver (VecInt. (int-array clause)))
-          (recur (rest c)))))
+    (doall (map
+             #(.addClause solver (VecInt. (int-array (subvec % 0 (dec (count %))))))
+             clauses))

     (if (.isSatisfiable solver)
       (do
         (println "Satisfiable!")
-        (.decode (DimacsReader. solver) (.model solver)))
+        (.decode reader (.model solver)))
       (println "Unsatisfiable!"))))

 (defn sat-solve


Updated the thread macro to be the background macro

--- src/lt/objs/thread.cljs
+++ src/lt/objs/thread.cljs
@@ -4,7 +4,7 @@
             [lt.objs.platform :as platform]
             [lt.objs.console :as console]
             [cljs.reader :as reader])
-  (:require-macros [lt.macros :refer [behavior thread]]))
+  (:require-macros [lt.macros :refer [behavior background]]))

 (def cp (js/require "child_process"))

@@ -108,7 +108,7 @@
 (object/raise test :kill!)
 (object/destroy! test)

-(def t (thread (fn [m]
+(def t (background (fn [m]
           (.log js/console "this is a message! " m)
           )))


Redundant code

Redundant code

--- src/yada/interceptors.clj
+++ src/yada/interceptors.clj
@@ -449,10 +449,6 @@

     (assoc ctx :response response)))

-(defrecord Foo [])
-
-(instance? Foo (Exception.))
-
 (defn logging [ctx]
   (or
    (when-let [logger (-> ctx :resource :logger)]


Fix typo

Fix typo

--- src/zaffre/glterminal.clj
+++ src/zaffre/glterminal.clj
@@ -33,7 +33,7 @@
 (defn blend-mode->byte [blend-mode]
   (case blend-mode
     :normal 0x0
-    :multiple 0x1
+    :multiply 0x1
     (assert false (str "Unknown blend-mode " blend-mode))))

 ;; GLFW won't maintain a strong reference to our callback objects, so we have to
@@ -485,13 +485,13 @@
 (defn make-terminal-character
   ([character fg-color bg-color style blend-mode]
    ; uncomment for debugging
-   {:pre [(char? character)
+   #_{:pre [(char? character)
           (vector? fg-color)
-          #_(< 2 (count fg-color) 5)
+          (< 2 (count fg-color) 5)
           (vector? bg-color)
-          #_(< 2 (count bg-color) 5)
+          (< 2 (count bg-color) 5)
           (set? style)
-          (contains? #{:normal :multiple} blend-mode)]}
+          (contains? #{:normal :multiply} blend-mode)]}
    (GLCharacter. character fg-color bg-color style blend-mode)))

 (defn- fill-glyph-fg-bg-buffers [layer-id->character-map character->col-row character->transparent texture-columns texture-rows rows layer-size cursor-xy glyph-image-data fg-image-data bg-image-data]


Add type hints to remove reflection warnings from refresh!

--- src/zaffre/glterminal.clj
+++ src/zaffre/glterminal.clj
@@ -691,7 +691,7 @@
           (doseq [[row line] (map-indexed vector (reverse @character-map))
                   [col c]    (map-indexed vector line)]
             ;;(log/info "row" row "col" col "c" c)
-            (let [chr        (or (get c :fx-character) (get c :character))
+            (let [chr        (char (or (get c :fx-character) (get c :character)))
                   chr        (if (and (= layer-id base-layer-id)
                                       (= chr (char 0)))
                                  \space
@@ -989,8 +989,8 @@
           [fbo-id fbo-texture]
                            (with-gl-context gl-lock (fbo-texture screen-width screen-height))
           ; init shaders
-          [pgm-id
-           fb-pgm-id]      (with-gl-context gl-lock (init-shaders (get fx-shader :name)))
+          [^int pgm-id
+           ^int fb-pgm-id]      (with-gl-context gl-lock (init-shaders (get fx-shader :name)))
           pos-vertex-attribute            (with-gl-context gl-lock (GL20/glGetAttribLocation pgm-id "aVertexPosition"))
           texture-coords-vertex-attribute (with-gl-context gl-lock (GL20/glGetAttribLocation pgm-id "aTextureCoord"))
           fb-pos-vertex-attribute            (with-gl-context gl-lock (GL20/glGetAttribLocation fb-pgm-id "aVertexPosition"))
@@ -1010,7 +1010,7 @@
            u-bg
            font-size
            term-dim
-           font-tex-dim]  (with-gl-context gl-lock (mapv #(GL20/glGetUniformLocation pgm-id %)
+           font-tex-dim]  (with-gl-context gl-lock (mapv #(GL20/glGetUniformLocation pgm-id (str %))
                                                          ["glyphTextureDimensions"
                                                           "uMVMatrix"
                                                           "uPMatrix"
@@ -1023,7 +1023,7 @@
                                                           "fontTextureDimensions"]))
           [u-fb
            u-fb-MVMatrix
-           u-fb-PMatrix] (with-gl-context gl-lock (mapv #(GL20/glGetUniformLocation fb-pgm-id %)
+           u-fb-PMatrix] (with-gl-context gl-lock (mapv #(GL20/glGetUniformLocation fb-pgm-id (str %))
                                                         ["uFb"
                                                          "uMVMatrix"
                                                          "uPMatrix"]))
@@ -1034,7 +1034,7 @@
                                           [(atom value)
                                            (with-gl-context gl-lock
                                              (log/info "getting location of uniform" uniform-name)
-                                             (let [location (GL20/glGetUniformLocation fb-pgm-id uniform-name)]
+                                             (let [location (GL20/glGetUniformLocation fb-pgm-id (str uniform-name))]
                                                #_(assert (not (neg? jocation)) (str "Could not find location for uniform " uniform-name location))
                                                (log/info "got location of uniform" uniform-name location)
                                                location))]))


Update de.cljs

Update de.cljs

Signed-off-by: Julien Eluard <c768e13f1ba4c3ebed2909a1fc1e4b50bb021a2f@gmail.com>

--- src/status_im/translations/de.cljs
+++ src/status_im/translations/de.cljs
@@ -116,7 +116,7 @@
    :incorrect-code                        (str "Es tut uns leid, der Code war nicht korrekt, bitte gib ihn erneut ein")
    :phew-here-is-your-passphrase          "Puh, das war anstrengend. Hier ist deine Passphrase. *Notiere sie dir und bewahre sie sicher auf!* Du wirst sie brauchen, um deinen Account wiederherzustellen."
    :here-is-your-passphrase               "Hier ist deine Passphrase. *Notiere sie dir und bewahre sie sicher auf!* Du wirst sie brauchen, um deinen Account wiederherzustellen."
-   :here-is-your-signing-phrase           "Hier ist deine Signing Phrase. Du wirst sie benutzen, um deine Trtansaktionen zu verifizieren. *Notiere sie dir und bewahre sie sicher auf!*"
+   :here-is-your-signing-phrase           "Hier ist deine Signing Phrase. Du wirst sie benutzen, um deine Transaktionen zu verifizieren. *Notiere sie dir und bewahre sie sicher auf!*"
    :phone-number-required                 "Tippe hier, um deine Telefonnummer zu validieren und ich werde deine Freunde finden."
    :shake-your-phone                      "Du hast einen Bug gefunden oder hast einen Verbesserungsvorschlag? ~Schüttle~ einfach dein Handy!"
    :intro-status                          "Chatte mit mir, um deinen Account einzurichten und deine Einstellungen zu ändern."


fix busted commonjs transform

fix busted commonjs transform

--- src/jsx_fun/core.clj
+++ src/jsx_fun/core.clj
@@ -63,7 +63,7 @@
         comp    (doto (cl/make-closure-compiler)
                   (.init '() js options))
         root    (.parse comp (first js))]
-    (.getJSDoc root)))
+    (.toSource comp root)))

 (defn node-visitor []
   (reify


require profiling deps

require profiling deps

--- src/k_means/core.clj
+++ src/k_means/core.clj
@@ -1,5 +1,7 @@
 (ns k-means.core
-  (:gen-class))
+  (:gen-class)
+  (:require [taoensso.timbre.profiling :as profiling :refer (p profile)]))
+

 (defn choose-initial-centroids
   "Randomly choose k centroids from vectors"
@@ -36,12 +38,13 @@
     (cond
       (empty? g) l
       :else
-        (recur (rest g) (conj l (mean-2dvec (first g)))))))
+        (recur (rest g) (conj l (p :mean-2dvec (mean-2dvec (first g))))))))

 (defn distance
   "Implements euclidian distance between two vectors"
   ([c1 c2]
     (->> (map - c1 c2) (map #(* % %)) (reduce +))))
+
 (defn min-index
   [c]
   (.indexOf c (apply min c)))
@@ -58,7 +61,7 @@
   (cond
     (<= n 0) c
     :else
-      (recur (dec n) (conj c [(rand-int 5000) (rand-int 5000)])))))
+      (recur (dec n) (conj c [(rand-int 50000) (rand-int 50000)])))))

 (defn make-vector
   "create a vector containing n cols"
@@ -89,10 +92,10 @@
 (defn k-means
   "Perform the actual k-means"
   ([l k max-iterations]
-    (k-means l k (choose-initial-centroids l k) (make-vector k) max-iterations))
+    (k-means l k (p :choose-initial-centroids (choose-initial-centroids l k)) (make-vector k) max-iterations))
   ([l k c g max-iterations]
-    (let [t c g (cluster g l c) c (mean-centroids g)]
-      (println c)
+    (let [t c g (p :cluster (cluster g l c)) c (p :mean-centroids (mean-centroids g))]
+      (println "Iteration" (- 100 max-iterations) c)
       ; (println (still-moving? t c))
       (cond
         (> 0 max-iterations) g
@@ -100,11 +103,16 @@
           (recur l k c g (dec max-iterations))
         :else g))))

+(defn k-means-profile
+  [l k max-iterations]
+  (p :k-means (k-means l k max-iterations)))
+
 (def flame [[1.85 27.8] [1.35 26.65] [1.4 23.25] [0.85 23.05] [0.5 22.35] [0.65 21.35] [1.1 22.05] [1.35 22.65] [1.95 22.8] [2.4 22.45] [1.8 22] [2.5 21.85] [2.95 21.4] [1.9 21.25] [1.35 21.45] [1.35 20.9] [1.25 20.35] [1.75 20.05] [2 20.6] [2.5 21] [1.7 19.05] [2.4 20.05] [3.05 20.45] [3.7 20.45] [3.45 19.9] [2.95 19.5] [2.4 19.4] [2.4 18.25] [2.85 18.75] [3.25 19.05] [3.95 19.6] [2.7 17.8] [3.45 18.05] [3.8 18.55] [4 19.1] [4.45 19.9] [4.65 19.15] [4.85 18.45] [4.3 18.05] [3.35 17.3] [3.7 16.3] [4.4 16.95] [4.25 17.4] [4.8 17.65] [5.25 18.25] [5.75 18.55] [5.3 19.25] [6.05 19.55] [6.5 18.9] [6.05 18.2] [5.6 17.8] [5.45 17.15] [5.05 16.55] [4.55 16.05] [4.95 15.45] [5.85 14.8] [5.6 15.3] [5.65 16] [5.95 16.8] [6.25 16.4] [6.1 17.45] [6.6 17.65] [6.65 18.3] [7.3 18.35] [7.85 18.3] [7.15 17.8] [7.6 17.7] [6.7 17.25] [7.3 17.25] [6.7 16.8] [7.3 16.65] [6.75 16.3] [7.4 16.2] [6.55 15.75] [7.35 15.8] [6.8 14.95] [7.45 15.1] [6.85 14.45] [7.6 14.6] [8.55 14.65] [8.2 15.5] [7.9 16.1] [8.05 16.5] [7.8 17] [8 17.45] [8.4 18.1] [8.65 17.75] [8.9 17.1] [8.4 17.1] [8.65 16.65] [8.45 16.05] [8.85 15.35] [9.6 15.3] [9.15 16] [10.2 16] [9.5 16.65] [10.75 16.6] [10.45 17.2] [9.85 17.1] [9.4 17.6] [10.15 17.7] [9.85 18.15] [9.05 18.25] [9.3 18.7] [9.15 19.15] [8.5 18.8] [11.65 17.45] [11.1 17.65] [10.4 18.25] [10 18.95] [11.95 18.25] [11.25 18.4] [10.6 18.9] [11.15 19] [11.9 18.85] [12.6 18.9] [11.8 19.45] [11.05 19.45] [10.3 19.4] [9.9 19.75] [10.45 20] [13.05 19.9] [12.5 19.75] [11.9 20.05] [11.2 20.25] [10.85 20.85] [11.4 21.25] [11.7 20.6] [12.3 20.45] [12.95 20.55] [12.55 20.95] [12.05 21.25] [11.75 22.1] [12.25 21.85] [12.8 21.5] [13.55 21] [13.6 21.6] [12.95 22] [12.5 22.25] [12.2 22.85] [12.7 23.35] [13 22.7] [13.55 22.2] [14.05 22.25] [14.2 23.05] [14.1 23.6] [13.5 22.8] [13.35 23.5] [13.3 24] [7.3 19.15] [7.95 19.35] [7.7 20.05] [6.75 19.9] [5.25 20.35] [6.15 20.7] [7 20.7] [7.6 21.2] [8.55 20.6] [9.35 20.5] [8.3 21.45] [7.9 21.6] [7.15 21.75] [6.7 21.3] [5.2 21.1] [6.2 21.95] [6.75 22.4] [6.15 22.5] [5.65 22.2] [4.65 22.55] [4.1 23.45] [5.35 22.8] [7.4 22.6] [7.75 22.1] [8.5 22.3] [9.3 22] [9.7 22.95] [8.8 22.95] [8.05 22.9] [7.6 23.15] [6.85 23] [6.2 23.25] [5.7 23.4] [5.1 23.55] [4.55 24.15] [5.5 24] [6.1 24.05] [6.5 23.6] [6.75 23.95] [7.3 23.75] [8.3 23.4] [8.9 23.7] [9.55 23.65] [10.35 24.1] [7.95 24.05] [3.95 24.4] [3.75 25.25] [3.9 25.95] [4.55 26.65] [5.25 26.75] [6.5 27.6] [7.45 27.6] [8.35 27.35] [9.25 27.2] [9.95 26.5] [10.55 25.6] [9.9 24.95] [9.2 24.5] [8.55 24.2] [8.8 24.8] [9.2 25.35] [9.55 26.05] [9.05 26.6] [8.8 25.8] [8.15 26.35] [8.05 25.8] [8.35 25.2] [7.9 25.3] [8.05 24.7] [7.3 24.4] [7.55 24.85] [6.85 24.45] [6.25 24.65] [5.55 24.5] [4.65 25.1] [5 25.55] [5.55 26.1] [5.55 25.25] [6.2 25.2] [6.8 25.05] [7.4 25.25] [6.65 25.45] [6.15 25.8] [6.5 26.1] [6.6 26.6] [7.7 26.65] [7.5 26.2] [7.5 25.65] [7.05 25.85] [6.9 27.15] [6.15 26.9]])
 (def R15 [[9.802 10.132] [10.35 9.768] [10.098 9.988] [9.73 9.91] [9.754 10.43] [9.836 9.902] [10.238 9.866] [9.53 9.862] [10.154 9.82] [9.336 10.456] [9.378 10.21] [9.712 10.264] [9.638 10.208] [9.518 9.956] [10.236 9.91] [9.4 10.086] [10.196 9.746] [10.138 9.828] [10.062 10.26] [10.394 9.984] [10.284 10.348] [9.706 9.978] [9.906 10.588] [10.356 9.198] [9.954 9.704] [9.796 10.378] [10.386 10.608] [10.41 9.912] [10.172 10.598] [10.286 9.712] [9.932 10.234] [10.298 9.948] [10.352 9.932] [9.848 10.328] [10.514 10.498] [9.944 9.934] [9.92 10.022] [9.908 10.606] [10.182 9.99] [10.256 9.25] [12.04 10.028] [12.082 10.044] [12.4 10.156] [11.988 9.926] [12.34 9.918] [12.228 9.978] [12.348 10.488] [12.044 9.358] [11.736 10.122] [12.35 9.798] [11.246 10.122] [12.276 10.99] [12.374 10.018] [12.53 10] [12.27 9.792] [12.364 10.176] [12.458 10.18] [11.952 9.682] [11.772 9.924] [11.502 10.008] [12.134 9.482] [11.628 10.286] [12.064 9.616] [11.906 9.82] [11.736 10.29] [12.114 10.904] [11.59 9.712] [12.648 9.814] [12.164 11.018] [12.22 9.796] [11.846 9.634] [11.808 10.058] [12.096 9.846] [11.594 10.078] [12.252 9.938] [11.998 9.676] [11.894 10.012] [12.274 9.936] [12.176 10.364] [12.104 10.388] [11.372 11.466] [10.94 11.482] [11.084 11.554] [11.232 11.374] [11.22 11.64] [10.962 11.75] [11.014 11.746] [11.524 10.982] [11.012 11.364] [11.2 11.062] [11.626 11.894] [11.23 11.728] [11.144 11.91] [11.106 11.868] [11.53 11.918] [11.21 11.114] [10.746 11.702] [11.154 11.692] [11.412 11.924] [10.948 11.532] [10.988 12.298] [10.96 11.392] [11.656 11.346] [11.178 12.062] [11.368 11.56] [11.264 11.724] [11.554 11.576] [10.974 11.114] [11.12 11.634] [11.51 12.052] [10.95 11.402] [11.864 12.406] [11.198 10.854] [11.65 11.496] [11.248 11.722] [11.602 11.888] [11.424 11.454] [11.312 11.718] [10.736 11.68] [11.56 11.798] [10.028 12.268] [9.282 11.976] [9.178 11.53] [9.954 12.398] [9.622 11.558] [9.914 11.844] [9.07 11.092] [10.578 11.354] [9.582 12.14] [9.622 11.528] [9.35 11.71] [10.234 11.974] [8.986 12.31] [9.438 12.11] [9.592 12.012] [9.666 11.88] [9.364 12.012] [9.71 11.772] [9.992 11.836] [9.916 12.028] [9.382 12.226] [9.808 12.23] [9.272 12.152] [9.392 11.18] [9.28 11.976] [9.848 11.632] [9.322 11.514] [9.718 11.95] [9.12 11.76] [8.978 12.37] [10.072 12.202] [9.966 11.822] [9.506 11.648] [9.702 11.536] [9.45 11.96] [9.916 11.962] [9.96 11.538] [9.014 11.744] [9.024 11.846] [10.296 11.61] [7.87 10.838] [8.164 10.534] [8.214 10.62] [8.166 10.698] [8.05 10.746] [7.978 11.13] [8.08 10.992] [8.472 11.082] [8.494 10.584] [8.354 10.38] [8.096 10.714] [7.882 10.832] [7.908 11.346] [7.814 10.872] [8.28 10.104] [8.082 10.676] [8.068 10.118] [8.116 10.698] [8.042 10.79] [8.096 10.878] [8.124 10.932] [8.632 11.124] [8.27 10.716] [7.622 10.148] [8.198 11.398] [8.582 11.064] [7.942 11.076] [8.004 10.574] [8.504 11.378] [8.118 11.012] [7.874 11.296] [7.668 10.924] [7.966 10.72] [7.94 10.996] [7.988 11.228] [8.164 11.112] [8.386 10.772] [8.248 10.994] [8.286 10.734] [8.224 10.316] [7.976 9.578] [7.876 8.796] [8.172 9.01] [8.068 9.202] [8.416 8.654] [8.71 8.458] [8.056 8.434] [7.304 9.266] [8.118 8.608] [7.616 9.446] [8.092 8.956] [8.368 8.968] [8.022 9.334] [8.32 9.062] [7.832 8.952] [7.704 8.672] [8.236 9.108] [8.37 8.904] [8.352 8.896] [8.046 9.228] [7.71 9.538] [8.534 8.55] [7.996 9.172] [8.046 9.204] [8.622 9.174] [7.776 8.898] [8.226 9.038] [7.904 9.194] [7.874 8.856] [7.992 8.952] [8.262 9.468] [8.088 9.294] [8.034 9.792] [8.352 9.016] [7.85 9.334] [8.404 9.366] [7.892 8.808] [8.202 9.232] [7.668 9.026] [8.242 9.308] [9.432 8.61] [10.066 8.19] [9.146 8.044] [9.662 7.866] [9.6 7.874] [8.618 8.552] [9.334 7.658] [9.424 7.83] [8.892 8.166] [9.386 7.746] [9.878 8.054] [9.558 7.948] [9.222 8.002] [9.52 8.282] [9.76 7.932] [9.568 8.052] [9.736 7.552] [9.584 8.478] [9.358 8.242] [9.404 7.79] [9.458 8.54] [9.482 7.766] [8.844 8.024] [9.29 8.472] [9.274 7.566] [9.11 8.014] [9.542 7.688] [9.432 8.122] [9.786 8.066] [9.382 7.664] [9.404 8.228] [9.146 8.158] [9.622 8.004] [10.286 7.892] [9.43 7.676] [9.44 8.058] [9.788 7.684] [9.586 7.91] [9.694 7.448] [9.576 7.866] [11.442 8.688] [11.466 8.558] [10.674 8.936] [11.23 8.126] [11.614 8.588] [11.59 8.496] [11.536 7.586] [11.638 8.266] [11.16 8.43] [10.904 8.532] [11.284 8.742] [11.25 8.192] [10.84 8.218] [11.798 8.836] [11.51 8.094] [10.932 7.796] [11.404 8.206] [11.088 8.326] [11.334 8.17] [11.272 8.394] [11.59 8.408] [11.212 8.516] [11.566 8.024] [11.246 8.584] [11.252 8.566] [10.78 8.294] [11.04 8.322] [11.198 7.886] [11.168 8.262] [11.88 8.08] [11.356 8.586] [11.182 8.342] [10.836 8.664] [11.696 8.906] [11.282 8.28] [10.718 8.534] [10.444 8.684] [11.124 8.618] [11.392 8.94] [11.212 8.308] [16.674 9.638] [16.162 10.302] [16.612 10.218] [16.1 9.702] [16.404 10.072] [15.93 10.106] [16.128 9.888] [16.41 10.188] [15.982 9.92] [16.224 10.02] [16.296 9.458] [16.586 10.174] [16.314 10.716] [16.278 9.452] [16.622 9.652] [16.22 9.494] [16.626 10.162] [16.982 10.596] [16.27 10.128] [16.202 9.7] [16.532 9.776] [17.124 9.726] [16.47 9.698] [16.004 10.28] [16.366 9.796] [16.268 9.522] [16.13 9.748] [16.67 10.498] [16.488 10.542] [16.57 10.21] [16.456 10.112] [16.482 9.986] [16.584 9.754] [16.1 9.93] [16.226 9.67] [16.448 9.566] [16.572 9.624] [16.436 9.41] [16.502 9.98] [16.418 9.966] [14.362 14.644] [14.138 14.63] [14.064 15.072] [13.692 14.958] [14.238 15.296] [13.73 15.128] [13.952 14.868] [13.986 14.77] [13.916 14.996] [13.874 14.954] [14.168 15.276] [14.278 15.152] [14.098 14.9] [13.764 15.212] [13.948 14.218] [14.13 14.838] [13.362 14.932] [13.546 14.844] [14.13 15.11] [13.816 14.602] [14.386 14.686] [13.786 14.726] [14.204 14.822] [13.856 15.206] [14.074 14.384] [13.68 14.988] [14.204 14.976] [13.388 15.39] [13.708 15.048] [14.114 15.366] [14.4 15.04] [14.194 15.04] [13.888 15.436] [13.958 15.322] [13.922 14.802] [13.652 14.602] [14.294 14.996] [13.81 14.526] [13.408 15.34] [13.834 14.778] [8.826 16.474] [8.33 16.488] [8.468 16.378] [8.904 15.846] [8.662 16.354] [8.684 16.776] [8.33 16.066] [8.904 16.402] [8.778 16.486] [8.81 16.458] [8.398 16.576] [8.542 15.918] [9.064 16.456] [9.152 16.094] [8.614 15.908] [8.566 17.012] [8.12 16.11] [8.844 16.026] [8.398 16.282] [8.808 15.59] [8.502 16.166] [8.942 16.19] [8.376 16.112] [8.518 15.84] [8.878 16.004] [8.582 16.774] [8.248 16.154] [8.588 16.24] [8.706 16.374] [8.524 16.392] [8.458 16.452] [8.83 16.36] [8.616 16.112] [8.844 16.362] [8.468 15.928] [8.62 16.674] [8.974 16.53] [8.826 16.084] [8.104 15.962] [8.386 16.24] [4.576 12.878] [4.46 13.16] [3.632 12.862] [4.238 12.506] [4.348 13.268] [3.788 12.372] [4.19 12.772] [3.86 12.706] [3.978 13.308] [4.336 12.854] [4.218 13.03] [4.25 13.002] [4.334 13.06] [4.654 12.566] [4.38 12.792] [3.968 13.016] [4.614 12.526] [3.95 12.67] [4.038 12.67] [4.426 12.238] [4.066 12.514] [4.248 12.392] [4.61 12.95] [4.328 12.99] [4.5 12.522] [4.176 12.71] [4.492 12.464] [4.134 12.834] [4.316 12.764] [4.454 12.084] [4.052 12.934] [4.26 13.118] [4.058 13.718] [4.24 12.626] [3.838 12.232] [4.128 13.4] [3.764 12.38] [4.424 13.186] [4.234 12.994] [5.13 13.296] [3.9 6.742] [3.994 7.206] [4.278 7.222] [4.172 6.848] [3.882 6.894] [3.936 6.994] [4.162 6.87] [3.762 7.1] [4.256 7.612] [4.55 6.822] [4.062 6.984] [4.026 7.23] [4.364 7.184] [4.292 7.208] [4.288 6.91] [4.018 7.062] [4.07 7.104] [4.548 7.654] [4.402 7.082] [3.692 7.49] [4.888 7.194] [4.456 7.146] [4.732 7.154] [4.088 7.212] [4.502 6.928] [3.402 7.434] [4.246 6.692] [4.166 7.256] [4.852 6.83] [4.398 7.428] [5.016 7.054] [4.25 6.76] [3.738 7.082] [4.254 7.264] [4.122 7.238] [3.878 7.232] [4.55 7.29] [4.03 7.126] [4.412 7.022] [4.276 7.244] [8.376 3.788] [8.81 3.864] [8.218 3.548] [8.374 3.748] [8.102 4.3] [8.386 3.952] [8.858 3.274] [8.884 3.504] [8.294 3.38] [8.38 3.178] [8.738 4.294] [9.1 3.84] [9.086 3.6] [8.616 3.45] [8.624 3.698] [8.632 3.82] [8.286 3.704] [8.816 3.58] [8.722 3.854] [8.298 3.378] [9.014 4.034] [8.87 3.554] [8.562 3.662] [8.6 3.828] [8.94 3.836] [8.768 4.32] [8.838 3.926] [8.288 3.466] [8.652 3.782] [8.376 3.956] [7.724 3.414] [8.374 4.136] [8.6 3.712] [9.026 3.788] [8.534 3.252] [8.874 3.602] [8.796 3.888] [8.592 3.988] [8.98 4.014] [8.562 3.856] [13.894 4.16] [14.278 5.26] [14.364 4.748] [14.108 4.918] [13.998 5.498] [14.4 5.296] [14.3 5.368] [13.958 5.35] [13.842 4.984] [13.85 4.246] [13.978 5.356] [14.366 5.104] [14.272 4.94] [14.336 5.176] [14.744 5.248] [14.306 5.06] [13.986 5.05] [14.44 5.33] [14.004 4.92] [13.332 4.592] [14.218 5.544] [14.154 4.768] [13.468 4.92] [13.67 5.406] [13.664 5.016] [14.12 4.87] [13.836 4.51] [14.204 5.064] [14.004 5.228] [13.266 4.858] [13.668 5.34] [14.528 4.812] [14.318 4.592] [14.018 5.182] [14.37 4.884] [14.198 4.804] [14.32 4.59] [13.636 5.218] [14.41 4.656] [14.02 5.614]])

 (defn -main
   "Main function for k-means"
   [& args]
-  (let [c (k-means R15 8 100)]
-    (spit "k-means.txt" c)))
+  ; (profile :info :Arithmetic (k-means-profile (make-vector-rand 20000) 2 100)))
+  (let [c (profile :info :Arithmetic (k-means (make-vector-rand 40000) 7 100)) => "Done"]
+    (spit "k-means.txt" c)) (shutdown-agents))


Remove the heroku hack for swank, start swank unconditionally.

--- backend/src/circle/init.clj
+++ backend/src/circle/init.clj
@@ -1,22 +1,15 @@
 (ns circle.init
-  ;; (:require circle.swank)
+  (:require circle.swank)
   (:require circle.db)
   (:require circle.web)
   (:require circle.repl)
-  (:require circle.logging)
-  ;; (:require circle.backend.nodes
-  ;;           circle.backend.project.rails
-  ;;           circle.backend.project.circle)
-  )
+  (:require circle.logging))

 (def init*
   (delay
    (try
      (circle.logging/init)
-     ;; workaround for Heroku not liking us starting up swank
-     (when (System/getenv "SWANK")
-       (require 'circle.swank)
-       (.invoke (ns-resolve 'circle.swank 'init)))
+     (circle.swank/init)
      (circle.db/init)
      (circle.web/init)
      (circle.repl/init)


fixed another git-problem: current revision checking was still using the asynchronous bash-function and didn't wait for the result

--- src/lambdacd/git.clj
+++ src/lambdacd/git.clj
@@ -6,7 +6,7 @@
             [clojure.tools.logging :as log]))

 (defn- current-revision [repo-uri branch]
-  (.trim (:out (sh/bash "/" (str "git ls-remote --heads " repo-uri " " branch " | cut -f 1")))))
+  (.trim (:out (util/bash "/" (str "git ls-remote --heads " repo-uri " " branch " | cut -f 1")))))

 (defn- revision-changed-from [last-seen-revision repo-uri branch]


Added builder method: attrs

Added builder method: attrs

--- src/hyjinks.clj
+++ src/hyjinks.clj
@@ -105,6 +105,8 @@

 (defn assoc-css [t & key-vals]
 	(assoc t :css (merge (:css t) (apply hash-map key-vals))))
+
+(defn attrs [& key-vals] (merge empty-attrs (apply hash-map key-vals)))

 (defn css [& key-vals] (merge empty-css (apply hash-map key-vals)))


you can only be active once connected

you can only be active once connected

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

--- src/lt/objs/sidebar/clients.cljs
+++ src/lt/objs/sidebar/clients.cljs
@@ -34,8 +34,9 @@

 (defn ->active? [cur clients]
   (let [actives (:active clients)
-        found? (first (filter #(= cur (val %)) actives))]
-    (if found?
+        found? (first (filter #(= cur (val %)) actives))
+        connected? (:connected @cur)]
+    (if (and found? connected)
       (str "active client-" (name (first found?)))
       "")))


make scrolling through results in the command/navigate panes several orders of magnitude faster

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

--- src/lt/objs/sidebar/command.cljs
+++ src/lt/objs/sidebar/command.cljs
@@ -111,17 +111,22 @@
 (behavior ::move-selection
           :triggers #{:move-selection}
           :reaction (fn [this dir]
-                      (object/update! this [:selected] + dir)
-                      (object/raise this :refresh!)
+                      (object/raise this :set-selection! (+ dir (:selected @this)))
                       (ensure-visible this)
                       ))

 (behavior ::set-selection!
           :triggers #{:set-selection!}
           :reaction (fn [this idx]
-                      (object/merge! this {:selected idx})
-                      (object/raise this :refresh!)
-                      ))
+                      (let [cnt (count (:cur @this))
+                            neue-idx (mod idx (if (> cnt (:size @this))
+                                                (:size @this)
+                                                cnt))
+                            old (nth (:lis @this) (:selected @this))
+                            neue (nth (:lis @this) neue-idx)]
+                        (dom/remove-class old :selected)
+                        (dom/add-class neue :selected)
+                        (object/merge! this {:selected neue-idx}))))

 (behavior ::change!
           :triggers #{:change!}
@@ -270,8 +275,8 @@
                 :search ""
                 :init (fn [this opts]
                         (let [opts (merge {:size 100} opts)
-                              lis (for [x (range (:size opts))]
-                                    (item this x))]
+                              lis (vec (for [x (range (:size opts))]
+                                         (item this x)))]
                           (object/merge! this (merge {:lis lis} opts))
                           [:div.filter-list
                            (input this)


Reword Rerun button

Reword Rerun button

5 points

--- src-cljs/frontend/components/pages/workflow.cljs
+++ src-cljs/frontend/components/pages/workflow.cljs
@@ -192,7 +192,7 @@
                       [:li
                        [:a
                         {:on-click #(transact-run-retry this id jobs)}
-                        "Rerun from start"]]]])]
+                        "Rerun from beginning"]]]])]
              [:div.run-info
               [:div.build-info-header
                [:div.contextual-identifier


Add name for ChemCam 'CR0' abbrev

Add name for ChemCam 'CR0' abbrev

--- src/mars_ogler/cams.clj
+++ src/mars_ogler/cams.clj
@@ -35,6 +35,7 @@
                           "NRA" "NavCam Right A"
                           "NRB" "NavCam Right B"
                           "CR" "ChemCam"
+                          "CR0" "ChemCam"
                           "MH" "MAHLI"
                           "MD" "MARDI"
                           "FLA" "HazCam Front-Left A"


add `mbql->native` function on IDriver

add `mbql->native` function on IDriver

--- src/metabase/driver.clj
+++ src/metabase/driver.clj
@@ -126,6 +126,10 @@
   (humanize-connection-error-message ^String [this, ^String message]
     "*OPTIONAL*. Return a humanized (user-facing) version of an connection error message string.
      Generic error messages are provided in the constant `connection-error-messages`; return one of these whenever possible.")
+
+  (mbql->native [this, ^Map query]
+    "Transpile an MBQL structured query into the appropriate native query form for the given driver.  For example, a
+     driver like Postgres should build a valid SQL expression and return that.")

   (notify-database-updated [this, ^DatabaseInstance database]
     "*OPTIONAL*. Notify the driver that the attributes of the DATABASE have changed.  This is specifically relevant in
@@ -218,6 +222,7 @@
    :describe-table-fks                (constantly nil)
    :features                          (constantly nil)
    :humanize-connection-error-message (u/drop-first-arg identity)
+   :mbql->native                      #(throw (RuntimeException. "Driver has not implemented `mbql->native` function."))
    :notify-database-updated           (constantly nil)
    :process-query-in-context          (u/drop-first-arg identity)
    :sync-in-context                   (fn [_ _ f] (f))


map java.util.Date -> :DateTimeField instead of :DateField

--- src/metabase/driver.clj
+++ src/metabase/driver.clj
@@ -304,7 +304,7 @@
         java.math.BigInteger            :BigIntegerField
         java.sql.Date                   :DateField
         java.sql.Timestamp              :DateTimeField
-        java.util.Date                  :DateField
+        java.util.Date                  :DateTimeField
         java.util.UUID                  :TextField
         clojure.lang.PersistentArrayMap :DictionaryField
         clojure.lang.PersistentHashMap  :DictionaryField


fixed serialization bug

fixed serialization bug

--- server/src/gratefulplace/db/serializers.clj
+++ server/src/gratefulplace/db/serializers.clj
@@ -1,4 +1,5 @@
 (ns gratefulplace.db.serializers
+  (:require [gratefulplace.db.query :as db])
   (:use [gratefulplace.db.serialize]))

 (defserializer topic
@@ -14,7 +15,7 @@
            :retriever :content/author)
   (has-many :posts
             :serializer gratefulplace.db.serializers/post
-            :retriever #(db/all :post/topic [:post/topic (:db/id %)])))
+            :retriever #(gratefulplace.db.query/all :post/topic [:post/topic (:db/id %)])))

 (defserializer post
   (attr :id :db/id)
@@ -34,7 +35,7 @@
   (attr :email :user/email)
   (has-many :topics
             :serializer gratefulplace.db.serializers/topic
-            :retriever #(db/all :topic/title [:content/author (:db/id %)]))
+            :retriever #(gratefulplace.db.query/all :topic/title [:content/author (:db/id %)]))
   (has-many :posts
             :serializer gratefulplace.db.serializers/post
-            :retriever #(db/all :post/content [:content/author (:db/id %)])))+            :retriever #(gratefulplace.db.query/all :post/content [:content/author (:db/id %)])))


Render selrect for shapes that are not direct descendents of page.

Shapes that forms part of one group or subgroup also can
be selected.

--- src/uxbox/ui/workspace/canvas.cljs
+++ src/uxbox/ui/workspace/canvas.cljs
@@ -128,7 +128,8 @@
         xf (comp
             (map #(get shapes-by-id %))
             (remove :hidden))
-        shapes (sequence xf (:shapes page))
+        shapes (->> (vals shapes-by-id)
+                    (filter #(= (:page %) id)))
         shapes-selected (filter (comp workspace-selected :id) shapes)
         shapes-notselected (filter (comp not workspace-selected :id) shapes)]
     (html
@@ -142,17 +143,9 @@
       [:svg.page-layout {}
        (shapes-selrect shapes-selected)
        [:g.main {}
-        (for [item shapes]
+        (for [item (sequence xf (:shapes page))]
           (-> (shape item workspace-selected)
               (rum/with-key (str (:id item)))))
-
-        #_(cond
-          (= (count shapes-selected) 1)
-          (let [item (first shapes-selected)]
-            (selected-shape item workspace-selected))
-
-          (> (count shapes-selected) 1)
-          (selected-shapes shapes-selected))
         (mouse-selrect)]]])))

 (def canvas


Don't fully cleanup

Don't fully cleanup

--- src/obb_rules/turn.cljc
+++ src/obb_rules/turn.cljc
@@ -40,8 +40,8 @@
   [game cleanup?]
   (if cleanup?
     (-> (action/reset-action-specific-state game)
-        (dissoc :action-results)
-        (dissoc :removed-elements))
+        #_(dissoc :action-results)
+        #_(dissoc :removed-elements))
     game))

 (defn- create-result


don't send email when we retract the email entity

--- src/pc/http/datomic.clj
+++ src/pc/http/datomic.clj
@@ -171,7 +171,8 @@
 (defn send-emails [transaction]
   (let [annotations (delay (get-annotations transaction))]
     (doseq [datom (:tx-data transaction)]
-      (when (and (= :needs-email (schema/get-ident (:a datom)))
+      (when (and (:added datom)
+                 (= :needs-email (schema/get-ident (:a datom)))
                  (not (contains? #{:transaction.source/unmark-sent-email
                                    :transaction.source/mark-sent-email}
                                  (:transaction/source @annotations))))


transaction/document shouldn't be set by the frontend

--- src/pc/http/datomic.clj
+++ src/pc/http/datomic.clj
@@ -80,9 +80,6 @@
     :access-request/status
     :access-request/create-date
     :access-request/deny-date
-
-    :transaction/document
-
     })

 (defn translate-datom-dispatch-fn [db d] (:a d))


REVDEV-171 allow per-path metrics

REVDEV-171 allow per-path metrics

--- src/prometheus/core.clj
+++ src/prometheus/core.clj
@@ -15,7 +15,7 @@
   (-> (Counter/newBuilder)
       (.namespace namespace)
       (.name "http_requests_total")
-      (.labelNames (into-array String ["method" "status"]))
+      (.labelNames (into-array String ["method" "status" "path"]))
       (.documentation "A counter of the total number of HTTP requests processed.")
       (.build)))

@@ -23,7 +23,7 @@
   (-> (Counter/newBuilder)
       (.namespace namespace)
       (.name "http_request_durations_milliseconds_total")
-      (.labelNames (into-array String ["method" "status"]))
+      (.labelNames (into-array String ["method" "status" "path"]))
       (.documentation "The total amount of time Ring has spent answering HTTP requests (in milliseconds).")
       (.build)))

@@ -31,40 +31,44 @@
   (-> (Summary/newBuilder)
       (.namespace namespace)
       (.name "http_request_durations_milliseconds")
-      (.labelNames (into-array String ["method" "status"]))
+      (.labelNames (into-array String ["method" "status" "path"]))
       (.documentation "A histogram of the response latency for HTTP requests (in milliseconds).")
       (.purgeInterval 2 TimeUnit/MINUTES)
       (.build)))

-(defn- record-request-metric [request-method response-status request-time]
+(defn- record-request-metric [request-method request-path response-status request-time]
   (let [status-label (str (int (/ response-status 100)) "XX")
         method-label (.toUpperCase (name request-method))]
     (-> (.newPartial @request-counter)
         (.labelPair "method" method-label)
         (.labelPair "status" status-label)
+        (.labelPair "path" request-path)
         (.apply)
         (.increment))
     (-> (.newPartial @request-duration-counter)
         (.labelPair "method" method-label)
         (.labelPair "status" status-label)
+        (.labelPair "path" request-path)
         (.apply)
         (.increment (double request-time)))
     (-> (.newPartial @request-summary)
         (.labelPair "method" method-label)
         (.labelPair "status" status-label)
+        (.labelPair "path" request-path)
         (.apply)
         (.observe (double request-time)))))

 (defn instrument-handler [handler]
   "Ring middleware to record request metrics"
   (fn [request]
-    (let [request-method (:request-method request)
+    (let [request-path (:uri request)
+          request-method (:request-method request)
           start-time (System/currentTimeMillis)
           response (handler request)
           finish-time (System/currentTimeMillis)
           response-status (or (:status response) 404)
           request-time (- finish-time start-time)]
-      (record-request-metric request-method response-status request-time)
+      (record-request-metric request-method request-path response-status request-time)
       response)))

 (defn metrics-json []


Generalize the experimental js importing

--- src/reagent/interop.clj
+++ src/reagent/interop.clj
@@ -49,7 +49,38 @@
     (assert field (str "Field name must start with - in " field))
     `(aset ~object ~@names ~value)))

-(def react-import-ns (atom nil))
+(def js-imports (atom nil))
+
+(defmacro import-js
+  [dev-src min-src sym-name]
+  (assert (string? dev-src))
+  (assert (string? min-src))
+  (assert (string? sym-name))
+  (let [impns (get @js-imports sym-name)]
+    (if (and (not (nil? impns))
+             (not= *ns* impns))
+      ;; Our symbol was already imported in another namespace; so we avoid
+      ;; duplicate imports.
+      true
+      (let [srcfile (if *assert* dev-src min-src)
+            sym sym-name
+            src (slurp (io/resource srcfile))]
+        (swap! js-imports assoc sym-name *ns*)
+        `(js/eval ~(str "if (typeof " sym " != 'undefined' && "
+                      "typeof console != 'undefined') { "
+                      "console.log('" sym " is already defined'); "
+                      "} else { (function (exports, module) { "
+                      src "; \n
+                      if (typeof " sym " === 'undefined' && "
+                      "typeof console != 'undefined') { "
+                      "console.log('" sym " not defined in " srcfile "');
+                      }
+                      if (typeof global != 'undefined') {
+                      global." sym " = " sym ";
+                      } else if (typeof window != 'undefined') {
+                      window." sym " = " sym ";
+                      } })(); } \n
+                      //@ sourceURL=" srcfile "\n"))))))

 (defmacro import-react
   []
@@ -58,28 +89,7 @@
   (or adding react.js in a script tag). This may be more convenient when
   using :optimizations :none, since that doesn't take :preamble into account.
   Imports minimized version of React if :elide-asserts is true."
-  (if-not (or (nil? @react-import-ns)
-              (= *ns* @react-import-ns))
-    ;; React was already imported in another namespace; so we avoid
-    ;; duplicate imports.
-    true
-    (let [srcfile (if *assert* "reagent/react.js"
-                    "reagent/react.min.js")
-          src (slurp (io/resource srcfile))]
-      (if (nil? @react-import-ns)
-        (reset! react-import-ns *ns*))
-      `(js/eval ~(str "if (typeof React != 'undefined' &&
-                      typeof console != 'undefined') {
-                      console.log('WARNING: React is already defined');
-                      }"
-                      src "; \n"
-                      "if (typeof module != 'undefined' &&
-                      typeof global != 'undefined' &&
-                      module.exports && module.exports.DOM) {
-                      global.React = module.exports;
-                      } \n
-                      //@ sourceURL=" srcfile "\n")))))
-
+  `(import-js "reagent/react.js" "reagent/react.min.js" "React"))

 (defmacro fvar
   [f]


add <text> to paragraph tags

add <text> to paragraph tags

--- src/sableman/tagdef.clj
+++ src/sableman/tagdef.clj
@@ -11,7 +11,8 @@
     :lemma
     :corollary
     :example
-    :remark})
+    :remark
+    :text})

 (def block-tags
   #{:statement


fix indentation in assemble-routes

fix indentation in assemble-routes

--- src/shale/resources.clj
+++ src/shale/resources.clj
@@ -181,19 +181,19 @@

 (defn assemble-routes []
   (->
-   (routes
-    (ANY "/" [] index)
-    (ANY "/sessions" {params :params} sessions-resource)
-    (ANY "/sessions/refresh" [] (sessions-refresh-resource nil))
-    (ANY ["/sessions/:id", :id #"(?:[a-zA-Z0-9]{4,}-)*[a-zA-Z0-9]{4,}"]
-         [id]
-         (session-resource id))
-    (ANY ["/sessions/:id/refresh", :id #"(?:[a-zA-Z0-9]{4,}-)*[a-zA-Z0-9]{4,}"]
-         [id]
-         (sessions-refresh-resource id))
-    (ANY "/nodes" {params :params} nodes-resource)
-    (ANY "/nodes/refresh" [] (nodes-refresh-resource))
-    (ANY ["/nodes/:id", :id #"(?:[a-zA-Z0-9\-])+"]
-         [id]
-         (node-resource id)))
-   (dev/wrap-trace :ui :header)))
+    (routes
+      (ANY "/" [] index)
+      (ANY "/sessions" {params :params} sessions-resource)
+      (ANY "/sessions/refresh" [] (sessions-refresh-resource nil))
+      (ANY ["/sessions/:id", :id #"(?:[a-zA-Z0-9]{4,}-)*[a-zA-Z0-9]{4,}"]
+        [id]
+        (session-resource id))
+      (ANY ["/sessions/:id/refresh", :id #"(?:[a-zA-Z0-9]{4,}-)*[a-zA-Z0-9]{4,}"]
+        [id]
+        (sessions-refresh-resource id))
+      (ANY "/nodes" {params :params} nodes-resource)
+      (ANY "/nodes/refresh" [] (nodes-refresh-resource))
+      (ANY ["/nodes/:id", :id #"(?:[a-zA-Z0-9\-])+"]
+        [id]
+        (node-resource id)))
+    (dev/wrap-trace :ui :header)))


simplify implementation

simplify implementation

--- src/sicp/chapter3_1.clj
+++ src/sicp/chapter3_1.clj
@@ -68,18 +68,15 @@
                      "Insufficient funds"))
         deposit (fn [amount]
                   (swap! balance + amount))
-        exec-if-correct (fn [pass f]
-                          (fn [amount]
-                            (if (= pass password)
-                              (f amount)
-                              "Incorrect password")))
         dispatch (fn [pass m]
-                   (case m
-                     :withdraw (exec-if-correct pass withdraw)
-                     :deposit (exec-if-correct pass deposit)
-                     (throw (IllegalArgumentException.
-                             (str "Unknown request -- make-account "
-                                  m)))))]
+                   (if (= pass password)
+                     (case m
+                       :withdraw withdraw
+                       :deposit deposit
+                       (throw (IllegalArgumentException.
+                               (str "Unknown request -- make-account "
+                                    m))))
+                     (fn [_] "Incorrect password")))]
     dispatch))

 ;; Exercise 3.4
@@ -95,22 +92,20 @@
         deposit (fn [amount]
                   (swap! balance + amount))
         incorrect-cnt (atom 0)
-        exec-if-correct (fn [pass f]
-                          (fn [amount]
-                            (if (= pass password)
-                              (do (reset! incorrect-cnt 0)
-                                  (f amount))
-                              (do (swap! incorrect-cnt inc)
-                                  (if (> @incorrect-cnt 7)
-                                    (call-the-cops)
-                                    "Incorrect password")))))
         dispatch (fn [pass m]
-                   (case m
-                     :withdraw (exec-if-correct pass withdraw)
-                     :deposit (exec-if-correct pass deposit)
-                     (throw (IllegalArgumentException.
-                             (str "Unknown request -- make-account "
-                                  m)))))]
+                   (if (= pass password)
+                     (do (reset! incorrect-cnt 0)
+                         (case m
+                           :withdraw withdraw
+                           :deposit deposit
+                           (throw (IllegalArgumentException.
+                                   (str "Unknown request -- make-account "
+                                        m)))))
+                     (do (swap! incorrect-cnt inc)
+                         (fn [_]
+                           (if (> @incorrect-cnt 7)
+                             (call-the-cops)
+                             "Incorrect password")))))]
     dispatch))

 ;;; 3.1.2  The Benefits of Introducing Assignment
@@ -152,6 +147,7 @@
          double)))

 ;; Exercise 3.6
+;; dummy implementation
 (def random-init (atom 0))
 (defn rand-update [n]
   (inc n))


don't try to re-find on a nil string

don't try to re-find on a nil string

--- src-cljs/frontend/controllers/controls.cljs
+++ src-cljs/frontend/controllers/controls.cljs
@@ -650,7 +650,8 @@
                                                                           :email email}]))))

 (defn chat-cmd [body]
-  (last (re-find #"^/([^\s]+)" body)))
+  (when (seq body)
+    (last (re-find #"^/([^\s]+)" body))))

 (defmethod post-control-event! :chat-submitted
   [browser-state message _ previous-state current-state]


Cosmetic.

Cosmetic.

--- src/onyx/peer/task_lifecycle.clj
+++ src/onyx/peer/task_lifecycle.clj
@@ -252,8 +252,8 @@
     (do
       (extensions/emit monitoring (->MonitorEvent :peer-sentinel-found))
       (if (p-ext/drained? pipeline event)
-          (complete-job event)
-          (p-ext/retry-segment pipeline event (sentinel-id event)))
+        (complete-job event)
+        (p-ext/retry-segment pipeline event (sentinel-id event)))
       (update event
               :onyx.core/batch
               (fn [batch]


Trigger monitoring component for retries

--- src/onyx/peer/task_lifecycle.clj
+++ src/onyx/peer/task_lifecycle.clj
@@ -319,6 +319,7 @@
        (fatal (logger/merge-error-keys e (:onyx.core/task-information event) "Internal error. Failed to read core.async channels"))))))

 (defn input-retry-segments! [messenger {:keys [onyx.core/pipeline
+                                               onyx.core/monitoring
                                                onyx.core/compiled]
                                         :as event}
                              input-retry-timeout task-kill-ch]
@@ -332,8 +333,11 @@
               (doseq [m tail]
                 (when (p-ext/pending? pipeline event m)
                   (trace (:log-prefix compiled) (format "Input retry message %s" m))
-                  (->> (p-ext/retry-segment pipeline event m)
-                       (lc/invoke-after-retry event compiled m))))
+                  (emit-latency
+                   :peer-retry-segment
+                   monitoring
+                   #(->> (p-ext/retry-segment pipeline event m)
+                         (lc/invoke-after-retry event compiled m)))))
               (swap! (:onyx.core/state event) update :timeout-pool rsc/expire-bucket)
               (recur))))))))


Fix PR comments.

Fix PR comments.

--- src/onyx/peer/task_lifecycle.clj
+++ src/onyx/peer/task_lifecycle.clj
@@ -402,9 +402,9 @@
                       (let [trigger-entries
                             (reduce
                              (fn [entries t]
-                               (concat
+                               (into
                                 entries
-                                [unique-id
+                                [nil
                                  (triggers/fire-trigger! event window-state t {:segment segment :context :new-segment})]))
                              []
                              triggers)]


wip: add suggestions to add conference

wip: add suggestions to add conference

--- src/cljs/conference_rating/add_conference_page/add_conference_page.cljs
+++ src/cljs/conference_rating/add_conference_page/add_conference_page.cljs
@@ -6,9 +6,8 @@
             [reagent.core :refer [atom]]
             [reagent-forms.core :as forms]
             [conference-rating.util :as util]
+            [conference-rating.backend :as backend]
             [conference-rating.view-utils.navbar :as navbar]
-            [conference-rating.view-utils.header :as header]
-            [conference-rating.backend :as backend]
             [conference-rating.view-utils.typeahead :as typeahead]))

 (defn form-input [label input]


Fix/update text in test as well.

Fix/update text in test as well.

--- test/cli4clj/test/cli.clj
+++ test/cli4clj/test/cli.clj
@@ -103,7 +103,7 @@
                 "\tTerminate and close the command line interface." *cli4clj-line-sep* *cli4clj-line-sep*
                 "sleep" *cli4clj-line-sep*
                 "\tSleep for n milliseconds." *cli4clj-line-sep*
-                "\tPause the UI thread for n milliseconds. One use case for this is unit testing of CLIs that execute functionality in separate threads.")
+                "\tPause the UI thread for n milliseconds. One use case for this is unit testing of CLIs with asynchronous interaction.")
            out-string))))

 (deftest allow-eval-cli-interaction-test


Use imagemagick for image comparison.

Use imagemagick for image comparison.

--- test/clj/quil/snippet.clj
+++ test/clj/quil/snippet.clj
@@ -1,9 +1,11 @@
 (ns quil.snippet
   (:require [quil.core :as q]
             [quil.snippets.all-snippets :as as]
+            [clojure.edn :as edn]
             [clojure.java.io :as io]
-            [clojure.test :as t :refer [is]]
-            [clojure.string :as cstr]
+            [clojure.test :as t]
+            [clojure.java.shell :as sh]
+            [clojure.string :as string]
             clojure.pprint))

 (def default-size [500 500])
@@ -13,6 +15,14 @@
 (def tests-in-set 50)
 (def current-test (atom -1))

+(defn- compare-images [expected actual difference]
+  (let [{:keys [err]} (sh/sh "compare" "-metric" "mae" expected actual difference)
+        result        (second (re-find #"\((.*)\)" err))]
+    (edn/read-string result)))
+
+(defn- replace-suffix [file-name suffix]
+  (string/replace file-name #"(\w+)\.(\w+)$" (str suffix ".$2")))
+
 (defn assert-unchanged-snippet-output [name]
   (when-not (contains? #{"current-frame-rate-target-frame-rate"
                          "noise"
@@ -21,15 +31,19 @@
                          "random-3d"
                          "random"
                          "random-gaussian"
+                         "resize-sketch"
                          "time-and-date"} name)
-    (let [n (str "snippet-snapshots/" name)
-          _ (q/save (str "resources/" n "-actual.png"))
-          e (slurp (io/resource (str n "-expected.png")))
-          a (slurp (io/resource (str n "-actual.png")))
-          c (compare e a)]
-      (when (zero? c)
-        (clojure.java.io/delete-file (io/resource (str n "-actual.png"))))
-      (t/is (zero? c)))))
+    (let [n          (str "snippet-snapshots/" name)
+          _          (q/save (str "resources/" n "-actual.png"))
+          expected   (.getAbsolutePath (io/file (io/resource (str n "-expected.png"))))
+          actual     (replace-suffix expected "actual")
+          difference (replace-suffix expected "difference")
+          result     (compare-images expected actual difference)
+          threshold  0.02]
+      (when (<= result threshold)
+        (io/delete-file (io/file actual))
+        (io/delete-file (io/file difference)))
+      (t/is (<= result threshold)))))

 (defn run-snippet-as-test [{:keys [ns name opts setup body body-str mouse-clicked]}]
   (let [result (promise)
@@ -63,8 +77,8 @@
      :on-close #(deliver result nil))
     (t/is (nil? @result))))

-(defn define-snippet-as-test [{:keys [ns name opts setup body body-str] :as snippet}]
-  (let [test-name (str (cstr/replace ns "." "_")
+(defn define-snippet-as-test [{:keys [ns name opts setup body] :as snippet}]
+  (let [test-name (str (string/replace ns "." "_")
                        "_"
                        name)]
     (intern 'quil.snippet