rename a variable

rename a variable

--- src/clj/calc_angle/core.clj
+++ src/clj/calc_angle/core.clj
@@ -18,7 +18,7 @@
 ;;
 ;; Write field is x (-10, 10) y (22, 32)
 ;;
-(def min-y 18)
+(def yfield-offset 18)
 (def xfield-size 24)
 (def xfield-offset 0)
 (def yfield-size 12)
@@ -26,7 +26,7 @@
 (def base-high 25.4)
 (def first-arm 20.9)
 (def second-arm 24.0)
-(def offset-last 5.5)
+(def offset-last 5.2)

 (defn to-int [val]
   (int (+ 0.5 val)))
@@ -148,7 +148,7 @@
 (defmacro process-stroke [stroke xscale yscale default-z]
   `(map (fn [[x# y# z#]] (list
                            (+ (- (* xfield-size (/ x# ~xscale)) (/ xfield-size 2.)) xfield-offset)
-                           (+ (* yfield-size (/ (- ~yscale y#) ~yscale)) min-y)
+                           (+ (* yfield-size (/ (- ~yscale y#) ~yscale)) yfield-offset)
                            (if (number? ~default-z) ~default-z z#)))
         ~stroke))


Removed unused split from namespace.

Removed unused split from namespace.

--- src/clj/forma/date_time.clj
+++ src/clj/forma/date_time.clj
@@ -4,7 +4,6 @@

 (ns forma.date-time
   (:use [clj-time.core :only (date-time month year)]
-        [clojure.string :only (split)]
         [clojure.contrib.def :only (defnk)])
   (:require [clj-time.core :as time]
             [clj-time.format :as f]))


move currency to configuration map

move currency to configuration map

--- src/cljs/stripe/client.cljs
+++ src/cljs/stripe/client.cljs
@@ -22,20 +22,20 @@
   site (in test mode). When the order's submitted, Stripe will pass a
   map of :token -> stripe token and :args -> additional args into the
   supplied channel."
-  [{:keys [out image key bitcoin?]} :- StripeOptions]
+  [{:keys [out image key currency bitcoin?]} :- StripeOptions]
   (-> js/StripeCheckout
       (.configure #js {:key key
                        :image image
                        :bitcoin (boolean bitcoin?)
+                       :currency (or currency "USD")
                        :opened #(put! out [:opened])
                        :closed #(put! out [:closed])
                        :token (fn [t args] (put! out [:token (js->clj t :keywordize-keys true)]))})))

 (s/defn present-stripe
-  [{:keys [amt email name description currency] :as opts} :- StripeOptions]
+  [{:keys [amt email name description] :as opts} :- StripeOptions]
   (.open (stripe-handler opts)
          #js {:name name
               :email email
               :description description
-              :currency (or currency "USD")
               :amount amt}))


Init board

Init board

--- src/cljs/triboard/core.cljs
+++ src/cljs/triboard/core.cljs
@@ -8,6 +8,7 @@
 (def board-width 16)
 (def board-height 11)
 (def init-block-count 12) ;; Init blocks for red, blue, green, gray
+(def players [:blue :red :green])

 ;; -----------------------------------------

@@ -35,22 +36,28 @@
   "Create random initial positions for the players"
   []
   (draw-slices init-block-count
-    [:blue :red :green :gray] (shuffle all-positions)))
+    (conj players :gray)
+    (shuffle all-positions)))

-(defn new-board
-  "Create a new board"
-  []
+(defn new-board []
   (reduce (fn [r [color [x y]]]
             (prn [x y])
             (assoc-in r [x y] color))
     empty-board (init-positions)))

+(defn new-game []
+  {:board (new-board)
+   :turn 0
+   ;; From the turn you can deduce the number of turn left
+   ;; There is an invariant holding: total score = 12 * 3 + turn
+   :scores
+   {:blue 12
+    :red 12
+    :green 12}})
+
 ;; -----------------------------------------

-(defonce app-state
-  (atom
-    {:board (new-board)
-     }))
+(defonce app-state (atom (new-game)))

 ;; -----------------------------------------


Ideas

Ideas

--- src/cljs/triboard/core.cljs
+++ src/cljs/triboard/core.cljs
@@ -86,7 +86,7 @@

 (defn convertible-cells
   "Indicates the convertible cells for the provided player - when clicking at [x y]"
-  [board [x y] [dx dy] player]
+  [board [x y] [dx dy] player] ;; TODO - Instead, return the player that can do a thing here
   (let [cells (range-cells board [(+ x dx) (+ y dy)] [dx dy])
         [head tail :as cell-groups] (partition-by identity cells)]
     (cond


Factorization

Factorization

--- src/cljs/triboard/core.cljs
+++ src/cljs/triboard/core.cljs
@@ -390,11 +390,9 @@
   [x y player options]
   [:rect.cell
    (merge
-     {:x (+ 0.05 x) :width  0.9
-      :y (+ 0.05 y) :height 0.9
-      ;; :fill color
-      :class (str "cell--" (name player))
-      }
+     {:class (str "cell--" (name player))
+      :x (+ 0.05 x) :width  0.9
+      :y (+ 0.05 y) :height 0.9}
      options)
    ])

@@ -449,14 +447,12 @@
      [:svg.board
       {:view-box (str "0 0 " board-width " " board-height)
        :style {:max-height (str (max-board-height) "px")}}]
-     (for [[x y] all-positions]
+     (for [[x y] all-positions
+           :let [cell (get-in @board [x y])]]
        ^{:key [x y]}
-       (case (get-in @board [x y])
+       (case cell
          :empty [empty-cell x y @game] ;; TODO - Help cell somewhere here
-         :blue [rect-cell x y :blue] ;; TODO - Factorize
-         :red [rect-cell x y :red]
-         :green [rect-cell x y :green]
-         :wall [rect-cell x y :wall]
+                [rect-cell x y cell]
          )))
    ])


99pop code update

99pop code update

--- src/clojure/nossal/data.clj
+++ src/clojure/nossal/data.clj
@@ -105,9 +105,9 @@
              :description "💲 Ganhe R$20,00 de desconto na primeira corrida 99! ✅"
              :text [:p "Ganhe " [:span.value "R$20,00"]" de desconto na sua " [:strong "primeira"] " corrida 99! " [:ruby "🎉 " [:rt "ta-da!"]]
                      [:small"Este cupom pode ser utilizado apenas uma vez por pessoa, em sua primeira corrida. Ganhe até " [:span.value "100%"] " de desconto na sua viagem."]]}
-   "99pop"  {:code "RhJemrf3mHV"
+   "99pop"  {:code "1dc3jc0vTAsX"
              :title "99POP"
-             :url "https://d.99taxis.mobi/RhJemrf3mHV"
+             :url "https://d.99taxis.mobi/1dc3jc0vTAsX"
              :description "💲 Ganhe R$15,00 de desconto na viagem corrida 99POP! ✅"
              :text [:p "Ganhe " [:span.value "R$15,00"]" de desconto na sua " [:strong "primeira"] " corrida 99POP! " [:ruby "🎉 " [:rt "ta-da!"]]
                      [:small"Aceite meu convite e experimente já o 99POP. <br>Ganhe até " [:span.value "100%"] " de desconto na sua viagem."]]}})


Reduce DB connection pool partition count

We defaulted to creating 5 partitions in our connection pooling code.
Partitions are useful only inasmuch as they reduce lock contention when
attempting to acquire a new connection. Even in high-throughput
environments, we are never bottlenecked on connection acquisition.

By defaulting to 1 partition, we reduce the number of bookkeeping
threads required. Each partition requires 5 bookkeeping threads, so by
reducing the partition count to 1 we eliminate 20 threads, and save
about 20M of resident memory on users systems.

Signed-off-by: Deepak Giridharagopal <d11186354d1ef01ca06ae37d7e23e827da13e85f@puppetlabs.com>

--- src/com/puppetlabs/jdbc.clj
+++ src/com/puppetlabs/jdbc.clj
@@ -108,8 +108,8 @@
            stats log-statements log-slow-statements
            conn-max-age conn-keep-alive]
     :or   {partition-conn-min  1
-           partition-conn-max  10
-           partition-count     5
+           partition-conn-max  50
+           partition-count     1
            stats               true
            ;; setting this to a String value, because that's what it would
            ;;  be in the config file and we're manually converting it to a boolean


bumping dependencies

bumping dependencies

--- qanal/project.clj
+++ qanal/project.clj
@@ -1,22 +1,22 @@
-(defproject qanal "0.2.1"
+(defproject qanal "0.3.0-SNAPSHOT"
   :description "An Application that bulk indexes docs from Kafka to Elasticsearch"
   :url "https://github.com/samsara/qanal"
   :license {:name "Apache License 2.0"
             :url "http://www.apache.org/licenses/LICENSE-2.0"}
-  :dependencies [[org.clojure/clojure "1.6.0"]
-                 [org.clojure/tools.cli "0.3.1"]            ;Command line parsing
-                 [com.taoensso/timbre "3.3.1"]              ;logging
-                 [clj-kafka "0.2.8-0.8.1.1"]                ;kafka
-                 [clojurewerkz/elastisch "2.1.0"]           ;elasticsearch
-                 [cheshire "5.4.0"]                         ;JSON
-                 [prismatic/schema "0.4.0"]                 ;validation
-                 [samsara/trackit "0.2.0"]                  ;Metrics tracking
+  :dependencies [[org.clojure/clojure "1.7.0"]
+                 [org.clojure/tools.cli "0.3.3"]
+                 [com.taoensso/timbre "3.4.0"]
+                 [clj-kafka "0.3.2"]
+                 [clojurewerkz/elastisch "2.1.0"]
+                 [cheshire "5.5.0"]
+                 [prismatic/schema "0.4.4"]
+                 [samsara/trackit "0.2.0"]
                  [org.clojure/core.async "0.1.346.0-17112a-alpha"]
                  ]
   :main qanal.core

   :profiles {:uberjar {:aot :all}
-             :dev {:dependencies [[midje "1.6.3"]
+             :dev {:dependencies [[midje "1.7.0"]
                                   [midje-junit-formatter "0.1.0-SNAPSHOT"]]
                    :plugins [[lein-midje "3.1.3"]
                              [lein-bin "0.3.5"]]}}


[#6850] fix Add to contacts appears in public chat

--- src/status_im/ui/screens/chat/views.cljs
+++ src/status_im/ui/screens/chat/views.cljs
@@ -69,7 +69,7 @@
                                        :accessibility-label :chat-menu-button}
                            :handler   #(on-options chat-id name group-chat public?)}]])]
      [connectivity/connectivity-view]
-     (when-not (or public? group-chat)
+     (when (and (not group-chat) (first contacts))
        [add-contact-bar (first contacts)])]))

 (defmulti message-row (fn [{{:keys [type]} :row}] type))


fixed indentation

fixed indentation

--- exercises/minesweeper/src/example.clj
+++ exercises/minesweeper/src/example.clj
@@ -21,7 +21,7 @@
 (defn draw [field]
   (if (empty? field) ""
       (->> field
-         split-lines
-         windows
-         (map (fn [line] (map count-mines-around line)))
-         (cl-format nil "~{~{~a~}~^~%~}"))))
+           split-lines
+           windows
+           (map (fn [line] (map count-mines-around line)))
+           (cl-format nil "~{~{~a~}~^~%~}"))))


Added function for computing context size

simple thing.

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

--- src/conexp/fca/contexts.clj
+++ src/conexp/fca/contexts.clj
@@ -180,6 +180,14 @@

 ;;; Common Operations in Contexts
+
+(defn context-size
+  "Returns tuple of number of objects, number of attributes and fill rate."
+  [ctx]
+  (let [obj-cnt (count (objects ctx)),
+	att-cnt (count (attributes ctx)),
+	inz-cnt (count (incidence ctx))]
+    [obj-cnt, att-cnt, (double (/ inz-cnt obj-cnt att-cnt))]))

 (defn rename-objects
   "Rename objects in ctx by given hash old-to-new."


fix the giant buttons in the builds table

--- frontend/components/builds_table.cljs
+++ frontend/components/builds_table.cljs
@@ -69,9 +69,10 @@
             ;; TODO: how are we going to get back to the correct build in the app-state?
             ;;       Not a problem here, b/c the websocket will be updated, but something to think about
             (forms/stateful-button
-             [:a {:on-click #(put! controls-ch [:cancel-build-clicked {:build-id build-id
-                                                                       :vcs-url vcs-url
-                                                                       :build-num build-num}])}
+             [:button.cancel_build
+              {:on-click #(put! controls-ch [:cancel-build-clicked {:build-id build-id
+                                                                    :vcs-url vcs-url
+                                                                    :build-num build-num}])}
               "Cancel"])))])]))

 (defn builds-table [builds owner opts]


small changes to example project

small changes to example project

the example project is more of a dev project

--- example/project.clj
+++ example/project.clj
@@ -26,12 +26,14 @@
                          :source-paths ["src"]
                          :compiler { :output-to "resources/public/js/compiled/example.js"
                                      :output-dir "resources/public/js/compiled/out"
+                                     :source-map true
                                      :optimizations :none}}]}

   :figwheel {
              :http-server-root "public" ;; default and assumes "resources"
              :server-port 3449 ;; default
              :css-dirs ["resources/public/css"]
+             ;; if you want to embed a server in figwheel do it like so:
              #_:ring-handler #_example.server/handler
              })


Further refactoring

Further refactoring

--- src/clojure/staircase/resources/histories.clj
+++ src/clojure/staircase/resources/histories.clj
@@ -4,7 +4,9 @@
         [clojure.tools.logging :only (info)])
   (:require staircase.sql
             staircase.resources
-            [honeysql.helpers :refer (select from where left-join group order-by)]
+            [honeysql.helpers :refer
+              (select merge-select from where merge-where
+               left-join group order-by merge-order-by)]
             [honeysql.core :as hsql]
             [staircase.resources.schema :as schema]
             [com.stuartsierra.component :as component]
@@ -19,23 +21,24 @@

 (def table-spec (merge schema/histories schema/history-step))

+(defn- base-history-query []
+  (-> (select :h.id :h.title :h.created_at :h.description :h.owner)
+      (from [:histories :h])
+      (left-join [:history_step :hs] [:= :h.id :hs.history_id])
+      (where [:= :h.owner :?user])
+      (order-by [:h.created_at :desc])))
+
 (defn- all-history-query []
-  (-> (select :h.id :h.title :h.created_at :h.description :h.owner [:%count.hs.* :steps])
-                    (from [:histories :h])
-                    (left-join [:history_step :hs] [:= :h.id :hs.history_id])
-                    (group :h.id :h.title :h.created_at :h.description :h.owner)
-                    (where [:= :h.owner :?user])
-                    (order-by [:h.created_at :desc])
-                    (hsql/format :params staircase.resources/context)))
+  (-> (base-history-query)
+      (merge-select [:%count.hs.* :steps])
+      (group :h.id :h.title :h.created_at :h.description :h.owner)
+      (hsql/format :params staircase.resources/context)))

 (defn- one-history-query [history]
-  (-> (select :h.*, :hs.step_id)
-      (from [:histories :h])
-      (left-join [:history_step :hs] [:= :h.id :hs.history_id])
-      (where [:and
-              [:= :h.id :?history]
-              [:= :h.owner :?user]])
-      (order-by [:hs.created_at :desc])
+  (-> (base-history-query)
+      (merge-select :hs.step_id)
+      (merge-where [:= :h.id :?history])
+      (merge-order-by [:hs.created_at :desc])
       (hsql/format :params (assoc staircase.resources/context :history history))))

 (defrecord HistoryResource [db]


Add pet funcition adopter note.

Add pet funcition adopter note.

--- src/clojure/uncomplicate/neanderthal/core.clj
+++ src/clojure/uncomplicate/neanderthal/core.clj
@@ -175,6 +175,8 @@
       (vctr float-factory 1 2 3)
       (vctr opencl-factory [1 2 3])
       (vctr opencl-factory (vctr float-factory [1 2 3]))
+
+  Yiu Ming Huynh's pet function.

   "
   ([factory source]


Fix whitespace in Aeron media driver

Fix whitespace in Aeron media driver

--- src/desdemona/launcher/aeron_media_driver.clj
+++ src/desdemona/launcher/aeron_media_driver.clj
@@ -20,19 +20,21 @@
                     (println (clojure.string/join " " (take 3 opt))))
                   cli-options)
             (System/exit 0))
-        _ (when (and (System/getProperty "aeron.threading.mode")                                                                                threading-mode)
+        _ (when (and (System/getProperty "aeron.threading.mode") threading-mode)
             (throw (Exception. "Cannot set both aeron.threading.mode property and threading-mode command-line arg")))
         threading-mode-obj (cond (or (nil? threading-mode)
                                      (= threading-mode "shared"))
                                  ThreadingMode/SHARED
                                  (= threading-mode "dedicated")
-                                 ThreadingMode/DEDICATED                                                                                (= threading-mode "shared-network")
+                                 ThreadingMode/DEDICATED
+                                 (= threading-mode "shared-network")
                                  ThreadingMode/SHARED_NETWORK)
         _ (println "Starting media driver with threading mode:" threading-mode ". Use -t to supply an alternative threading mode.")
         ctx (cond-> (MediaDriver$Context.)
               threading-mode (.threadingMode threading-mode-obj)
               delete-dirs (.dirsDeleteOnStart delete-dirs))
-        media-driver (try                                                                                (MediaDriver/launch ctx)
-                                                                                (catch IllegalStateException ise                                                                                (throw (Exception. "Error starting media driver. This may be due to a media driver data incompatibility between versions. Check that no other media driver has been started and then use -d to delete the directory on startup" ise))))]
+        media-driver (try (MediaDriver/launch ctx)
+                       (catch IllegalStateException ise
+                         (throw (Exception. "Error starting media driver. This may be due to a media driver data incompatibility between versions. Check that no other media driver has been started and then use -d to delete the directory on startup" ise))))]
     (println "Launched the Media Driver. Blocking forever...")
     (<!! (chan))))


Refactor image variants code a bit

Refactor image variants code a bit

--- src/docker_clojure/core.clj
+++ src/docker_clojure/core.clj
@@ -83,12 +83,14 @@
           (print out)))))
   (println))

+(defn image-variants []
+  (map variant-map
+       (combo/cartesian-product base-images distros (keys build-tools))))
+
 (defn build-images []
   (println "Building the following images:")
-  (let [variants (combo/cartesian-product
-                  base-images distros (keys build-tools))
-        map-variants (map variant-map variants)]
-    (doseq [variant map-variants]
+  (let [variants (image-variants)]
+    (doseq [variant variants]
       (when-not (exclude? variant)
         (build-image variant)))))


Updated logging message.

Updated logging message.

--- src/hxgm30/language/app/handler/assembled.clj
+++ src/hxgm30/language/app/handler/assembled.clj
@@ -34,6 +34,7 @@

 (defn- -get-var
   [string]
+  (log/tracef "Resolving %s ..." string)
   (-> string
       symbol
       resolve
@@ -41,9 +42,7 @@

 (defn- -lang-freqs
   [world lang]
-  (log/error "string:" (format "%s.%s/%s" base-ns world lang))
   (-get-var (format "%s.%s/%s" base-ns (name world) (name lang))))
-

 (defn- -supported-langs
   [world]


Fix command-line

Fix command-line

--- src/featured_gml/runner.clj
+++ src/featured_gml/runner.clj
@@ -104,8 +104,8 @@
     ;; Handle help and error conditions
     (cond
       (:help options) (exit 0 (usage summary))
-       (:version options) (exit 0 (implementation-version))
-      (not= (count arguments) 4) (exit 1 (usage summary))
+      (:version options) (exit 0 (implementation-version))
+      (not= (count arguments) 5) (exit 1 (usage summary))
       errors (exit 1 (error-msg errors)))
     ;; Execute program with options
     (if (= 5 (count args))


Cleanup.

Cleanup.

--- clj_record/core.clj
+++ clj_record/core.clj
@@ -117,8 +117,8 @@
   Optional forms for associations and validation are specified here.
   See clj_record/test/model/manufacturer.clj for an example."
   [& option-groups]
-  (let [model-name (last (str-utils/re-split #"\." (name (ns-name *ns*))))]
-    (let [optional-defs (defs-from-option-groups model-name option-groups)]
+  (let [model-name (last (str-utils/re-split #"\." (name (ns-name *ns*))))
+        optional-defs (defs-from-option-groups model-name option-groups)]
       `(do
         (init-model-metadata ~model-name)
         (defn ~'model-metadata [& args#]
@@ -138,4 +138,4 @@
           (destroy-record ~model-name record#))
         (defn ~'validate [record#]
           (clj-record.validation/validate ~model-name record#))
-        ~@optional-defs))))
+        ~@optional-defs)))


Fix building of a chart component.

Fix building of a chart component.

--- src-cljs/kixi/hecuba/web/chart.cljs
+++ src-cljs/kixi/hecuba/web/chart.cljs
@@ -49,16 +49,16 @@
                                         {"month" "december" "reading" 9}]})

 (def app-state
-  {:selected false
+  {:selected []
    :devices []})

 (defn remove-chart []
   (.remove (first (nodelist-to-seq (.getElementsByTagName js/document "svg")))))

-(defn select-device [app device]
-  (.log js/console "select-device")
-  (remove-chart)
-  (om/update! app [:selected] (constantly device))
+(defn select-device [data device-name]
+  (.log js/console device-name)
+ ; (remove-chart)
+ ;  (om/transact! app [:selected] (constantly device-name))
   )

 ;;;;;;;;;;; List of devices for axis plots ;;;;;;;;;;
@@ -66,36 +66,19 @@
 (defn device-list-item
   [devices]
   (fn [data owner]
-    (.log js/console "device-list-item")
     (om/component
-     (apply dom/input #js {:type "checkbox" :onClick #(select-device app (:hecuba/name device))}
-            (for [device devices]
-              (str (get data device)))))))
+    (let [device-name  (for [device devices] (get data device))]
+      (apply dom/input #js {:type "checkbox" :onClick #(select-device data (str device-name))}
+            (str device-name))))))

 ;;;;;;;;;; Chart UI ;;;;;;;;;;

-(defn chart-view [data opts]
-  (reify
-   om/IRender
-   (render [this] (dom/div #js {:id "chart"}))
-   om/IDidMount
-   (did-mount [_ owner]
-     (let [Chart        (.-chart dimple)
-           svg          (.newSvg dimple "#chart" 400 350)
-           dimple-chart (Chart. svg (clj->js (:external-humidity mock-data)))]
-       (.setBounds dimple-chart 60 30 300 300)
-       (.addCategoryAxis dimple-chart "x" "month")
-       (.addMeasureAxis dimple-chart "y" "reading")
-       (.addSeries dimple-chart nil js/dimple.plot.line)
-       (.draw dimple-chart)))))
-
 (defn chart-item
-  [data]
+  [device-details]
   (fn [data opts]
     (reify
       om/IRender
       (render [this]
-        (.log js/console "[chart] I render")
         (dom/div #js {:id "chart"}))
       om/IDidMount
       (did-mount [_ owner]
@@ -115,12 +98,12 @@
     (reify
       om/IRender
       (render [_]
-        (om/build chart-item data)
         (dom/div #js {:className "devices"}
                  (dom/form #js {:className "devices-form"}
                            (om/build-all device-item
                                          (get-in data model-path)
-                                         {:key :hecuba/name})))))))
+                                         {:key :hecuba/name})
+                           (om/build chart-item data)))))))

 (go (let [external-temp     {:hecuba/name "01"
@@ -133,7 +116,7 @@
                                   #(vec (concat % [external-temp external-humidity])))]
         (om/root init-state (create-form-and-chart [:devices]
                                                    (device-list-item [:hecuba/name :name])
-                                                   (chart-item [:hecuba/name :name]))
+                                                   (chart-item [:hecuba/name :name :data]))
                  (.getElementById js/document "app")))))


Fix ns decl

Fix ns decl

--- test/caesium/crypto/generichash_test.clj
+++ test/caesium/crypto/generichash_test.clj
@@ -1,9 +1,9 @@
 (ns caesium.crypto.generichash-test
   (:require [caesium.crypto.generichash :as g]
+            [caesium.test-utils :refer [const-test]]
             [caesium.util :refer [array-eq]]
             [caesium.vectors :as v]
-            [caesium.test-utils :refer [const-test]]
-            [clojure.test :refer [deftest are is]]))
+            [clojure.test :refer [are deftest is]]))

 (const-test
  g/bytes 32


removing do

removing do

--- test/celestial/integration/workflows.clj
+++ test/celestial/integration/workflows.clj
@@ -30,7 +30,7 @@

 (with-admin
  (with-conf local-conf
-  (with-state-changes [(before :facts (do (populate-system redis-type redis-ec2-spec)))]
+  (with-state-changes [(before :facts (populate-system redis-type redis-ec2-spec))]
     (fact "aws creation workflows" :integration :ec2 :workflow
       (letfn [(spec [] (assoc (s/get-system 1) :system-id 1))]
         (wf/create (spec)) => nil


don't install securitymanager hack

don't install securitymanager hack

--- src/leiningen/new/migae.clj
+++ src/leiningen/new/migae.clj
@@ -80,7 +80,7 @@
                  ["doc/intro.md" (render "intro.md" data)]
                  [".gitignore" (render "gitignore" data)]

-                 ["src/main/java/com/google/apphosting/utils/security/SecurityManagerInstaller.java" (render "SecurityManagerInstaller.java" data)]
+                 ;; ["src/main/java/com/google/apphosting/utils/security/SecurityManagerInstaller.java" (render "SecurityManagerInstaller.java" data)]

                  ;; NB: treatment of '-', '_', '/', and '.'
                  ;; "lein new migae foo-bar" yields:


use for instead of map

use for instead of map

--- src/metabase/driver/druid/query_processor.clj
+++ src/metabase/driver/druid/query_processor.clj
@@ -557,8 +557,8 @@
 (defmethod post-process ::groupBy    [_ results] (map :event results))

 (defmethod post-process ::grouped-timeseries [_ results]
-  (map (fn [event]
-    (conj {:timestamp (:timestamp event)} (:result event))) results))
+  (for [event results]
+    (conj {:timestamp (:timestamp event)} (:result event))))

 (defn post-process-native
   "Post-process the results of a *native* Druid query.


handle order-by for select queries

handle order-by for select queries

--- src/metabase/driver/druid/query_processor.clj
+++ src/metabase/driver/druid/query_processor.clj
@@ -443,15 +443,15 @@
                                                      {:dimension (->rvalue field)
                                                       :direction direction}))))

-(defmethod handle-order-by ::grouped-timeseries [_ {{ag-type :aggregation-type} :aggregation, [breakout-field] :breakout, [{field :field, direction :direction}] :order-by} druid-query]
-  (let [field             (->rvalue field)
-        breakout-field    (->rvalue breakout-field)
-        sort-by-breakout? (= field breakout-field)]
-    (if (and sort-by-breakout?
-             (= direction :descending))
-      (assoc druid-query :descending true)
-      druid-query)))
-
+(defn sort-by-timestamp [field direction druid-query]
+  (assoc druid-query :descending (and (= (->rvalue field) "timestamp")
+                                      (= direction :descending))))
+
+(defmethod handle-order-by ::grouped-timeseries [_ {[{field :field, direction :direction}] :order-by} druid-query]
+  (sort-by-timestamp field direction druid-query))
+
+(defmethod handle-order-by ::select [_ {[{field :field, direction :direction}] :order-by} druid-query]
+  (sort-by-timestamp field direction druid-query))

 ;;; ### handle-fields


First joiner always left since it wasn't in the ring - fixed.

--- src/onyx/log/commands/notify_join_cluster.clj
+++ src/onyx/log/commands/notify_join_cluster.clj
@@ -17,7 +17,7 @@
     (assert (<= (count rets) 1))
     (when (seq rets)
       {:observer (first (vals rets))
-       :subject (get-in old [:pairs (first (keys rets))])
+       :subject (or (get-in old [:pairs (first (keys rets))]) (first (keys rets)))
        :accepted-observer (first (keys rets))
        :accepted-joiner (first (vals rets))})))


Fix regression

Fix regression

--- src/rdf-repository/grafter/rdf/repository.clj
+++ src/rdf-repository/grafter/rdf/repository.clj
@@ -333,7 +333,7 @@
                                QueryLanguage/SPARQL
                                sparql-string)]

-         (when dataset (.setDataset pq restriction))
+         (when restriction (.setDataset pq restriction))
          pq))))

 (defn prepare-update


[FIX #1474] Fix copy/paste of coordinates, address, and map viewing

--- src/status_im/chat/views/message/message.cljs
+++ src/status_im/chat/views/message/message.cljs
@@ -412,9 +412,9 @@
                                 :on-long-press #(cond (= content-type text-content-type)
                                                       (share content (label :t/message))
                                                       (and (= content-type content-type-command) (= "location" (:content-command content)))
-                                                      (let [params (str/split (get-in content [:params "address"]) #"&")
-                                                            latlong (rest params)]
-                                                        (share-or-open-map (first params) (first latlong) (second latlong))))}
+                                                      (let [address (get-in content [:params :address])
+                                                            [location lat long] (str/split address #"&")]
+                                                        (share-or-open-map location lat long)))}
            [view
             (let [incoming-group (and group-chat (not outgoing))]
               [message-content message-body (merge message


friendly emails + sso

friendly emails + sso

--- src/metabase/util/stats.clj
+++ src/metabase/util/stats.clj
@@ -115,10 +115,10 @@
    :check_for_updates     (setting/get :check-for-updates)
    :site_name             (not= settings/site-name "Metabase")
    :report_timezone       (setting/get :report-timezone)
-   :friendly_names        true ;; HOW DO I GET THIS?
+   :friendly_names        (metabase.models.humanization/enable-advanced-humanization)
    :email_configured      ((resolve 'metabase.email/email-configured?))
    :slack_configured      ((resolve 'metabase.integrations.slack/slack-configured?))
-   :sso_configured        true ;; HOW DO I GET THIS?
+   :sso_configured        (not (nil? metabase.api.session/google-auth-client-id))
    :instance_started      (new java.util.Date) ;; HOW DO I GET THIS?
    :has_sample_data       (db/exists? 'Database, :is_sample true)
    }


Make final if not in deploy state

Make final if not in deploy state

--- src/obb_rules/game_mode.clj
+++ src/obb_rules/game_mode.clj
@@ -5,9 +5,11 @@
 (defn final?
   "Checks if the game is finished"
   [game]
-  (or
-    (board/empty-board? game :p1)
-    (board/empty-board? game :p2)))
+  (and
+    (not (= game/state :deploy))
+    (or
+      (board/empty-board? game :p1)
+      (board/empty-board? game :p2))))

 (defn winner
   "Gets the winner of the given game"


Fixed typo in form.

Fixed typo in form.

--- src/active/clojure/record_spec.cljc
+++ src/active/clojure/record_spec.cljc
@@ -104,7 +104,7 @@
   ```"
   [the-name constructor predicate the-keys]
   (let [ns-key (ns-keyword the-name)
-        ks (mapv n-keyword the-keys)]
+        ks (mapv ns-keyword the-keys)]
     `(s/def ~ns-key
        (s/spec (s/and ~predicate (s/keys :req-un ~ks))
                :gen (fn []


Short-circuit deep=

Short-circuit deep=

--- src/overcode/introvert.cljs
+++ src/overcode/introvert.cljs
@@ -74,6 +74,9 @@
   "Compares JS values for equality by value instead of by reference."
   ([val1 val2 visited]
    (cond
+    (identical? val1 val2)
+    true
+
     (and (arr? val1) (arr? val2))
     (and (= (count val1) (count val2))
          (every? true? (map #(deep= %1 %2 visited) val1 val2)))


update docstring

update docstring

--- src/overtone/libs/event.clj
+++ src/overtone/libs/event.clj
@@ -28,7 +28,7 @@
      true)))

 (defn on-event
-  "Runs handler whenever events of event-type are fired asynchronously. This
+  "Asynchronously runs handler whenever events of event-type are fired. This
   asynchronous behaviour can be overridden if required - see sync-event for
   more information. Events may be triggered with the fns event and sync-event.


make sure direct application of fn in apply-at also gets executed on the thread pool for consistency

--- src/overtone/music/time.clj
+++ src/overtone/music/time.clj
@@ -46,5 +46,5 @@
   [#^clojure.lang.IFn ms-time f & args]
   (let [delay-time (- ms-time *apply-ahead* (now))]
     (if (<= delay-time 0)
-      (apply f (#'clojure.core/spread args))
+      (.execute @player-pool* #(apply f (#'clojure.core/spread args)))
       (after-delay delay-time #(apply f (#'clojure.core/spread args))))))


test step-results updates through the event-bus instead of the deprecated step-results-channel

--- test/clj/lambdacd/internal/execution_test.clj
+++ test/clj/lambdacd/internal/execution_test.clj
@@ -112,6 +112,17 @@

 (defn some-pipeline-state []
   (atom {}))
+
+
+(defn- step-finished-events-for [ctx]
+  (-> (event-bus/subscribe ctx :step-finished)
+      (event-bus/only-payload)
+      (buffered)))
+
+(defn step-result-updates-for [ctx]
+  (-> (event-bus/subscribe ctx :step-result-updated)
+      (event-bus/only-payload)
+      (buffered)))

 (deftest execute-step-test
   (testing "that executing returns the step result added to the input args"
@@ -132,19 +143,19 @@
   (testing "that the context data is being passed on to the step"
     (is (= {:outputs { [0 0] {:status :success :context-info "foo"}} :status :success} (execute-step {} [(some-ctx-with :step-id [0 0] :the-info "foo") some-step-consuming-the-context]))))
   (testing "that the final pipeline-state is properly set for a step returning a static result"
-    (let [step-results-channel (async/chan 100)]
-      (execute-step {} [(some-ctx-with :step-id [0 0]
-                                       :build-number 5
-                                       :step-results-channel step-results-channel
-                                       :pipeline-state-component (noop-pipeline-state/new-no-op-pipeline-state)) some-successful-step])
+    (let [ctx                  (some-ctx-with :step-id [0 0]
+                                              :build-number 5
+                                              :pipeline-state-component (noop-pipeline-state/new-no-op-pipeline-state))
+          step-results-channel (step-result-updates-for ctx)]
+      (execute-step {} [ctx some-successful-step])
       (is (= [{ :build-number 5 :step-id [0 0] :step-result {:status :running } }
               { :build-number 5 :step-id [0 0] :step-result {:status :success } }] (slurp-chan step-results-channel)))))
   (testing "that the final pipeline-state is properly set for a step returning a static and an async result"
-    (let [step-results-channel (async/chan 100)]
-      (execute-step {} [(some-ctx-with :step-id [0 0]
-                                       :build-number 5
-                                       :step-results-channel step-results-channel
-                                       :pipeline-state-component (noop-pipeline-state/new-no-op-pipeline-state)) some-step-that-sends-failure-on-ch-returns-success])
+    (let [ctx                  (some-ctx-with :step-id [0 0]
+                                              :build-number 5
+                                              :pipeline-state-component (noop-pipeline-state/new-no-op-pipeline-state))
+          step-results-channel (step-result-updates-for ctx)]
+      (execute-step {} [ctx some-step-that-sends-failure-on-ch-returns-success])
       (is (= [{ :build-number 5 :step-id [0 0] :step-result {:status :running } }
               { :build-number 5 :step-id [0 0] :step-result {:status :failure } }
               { :build-number 5 :step-id [0 0] :step-result {:status :success } }] (slurp-chan step-results-channel)))))
@@ -155,11 +166,11 @@
     (is (= {:outputs {[0 0] {:status :success } } :status :success }
            (execute-step {} [(some-ctx-with :step-id [0 0]) some-step-that-sends-failure-on-ch-returns-success]))))
   (testing "that we can pass in a step-results-channel that receives messages with the complete, accumulated step result"
-    (let [step-results-channel (async/chan 100)]
-      (execute-step {} [(some-ctx-with :step-id [0 0]
-                                       :build-number 5
-                                       :step-results-channel step-results-channel
-                                       :pipeline-state-component (noop-pipeline-state/new-no-op-pipeline-state)) some-step-building-up-result-state-incrementally])
+    (let [ctx                  (some-ctx-with :step-id [0 0]
+                                              :build-number 5
+                                              :pipeline-state-component (noop-pipeline-state/new-no-op-pipeline-state))
+          step-results-channel (step-result-updates-for ctx)]
+      (execute-step {} [ctx some-step-building-up-result-state-incrementally])
     (is (= [{:build-number 5 :step-id [0 0] :step-result {:status :running } }
             {:build-number 5 :step-id [0 0] :step-result {:status :running :out "hello"} }
             {:build-number 5 :step-id [0 0] :step-result {:status :running :out "hello world"} }
@@ -169,9 +180,7 @@
     (let [ctx (some-ctx-with :step-id [0 0]
                              :build-number 5
                              :pipeline-state-component (noop-pipeline-state/new-no-op-pipeline-state))
-          step-results-channel (-> (event-bus/subscribe ctx :step-result-updated)
-                                   (event-bus/only-payload)
-                                   (buffered))]
+          step-results-channel (step-result-updates-for ctx)]
       (execute-step {} [ctx some-step-building-up-result-state-incrementally])
     (is (= [{:build-number 5 :step-id [0 0] :step-result {:status :running } }
             {:build-number 5 :step-id [0 0] :step-result {:status :running :out "hello"} }
@@ -181,9 +190,7 @@
   (testing "that the event bus is notified when a step finishes"
     (let [ctx (some-ctx-with :build-number 3
                              :step-id [1 2 3])
-          step-finished-events (-> (event-bus/subscribe ctx :step-finished)
-                                   (event-bus/only-payload)
-                                   (buffered))]
+          step-finished-events (step-finished-events-for ctx)]
       (execute-step {} [ctx some-other-step])
       (is (= [{:build-number 3
                :step-id [1 2 3]
@@ -246,12 +253,13 @@

 (deftest execute-steps-inheritance-test
   (testing "that the step-results channel passed in contains the step-results of all childrens"
-    (let [step-results-channel (async/chan 100)]
+    (let [step-results-channel (async/chan 100)
+          ctx (some-ctx-with   :step-results-channel step-results-channel
+                               :step-id [0]
+                               :build-number 2)]
       (execute-steps [some-other-step some-step-faking-events-from-build-3 some-failing-step]
                      {}
-                     (some-ctx-with :step-results-channel step-results-channel
-                                    :step-id [0]
-                                    :build-number 2))
+                     ctx)
       (is (= [{:build-number 2 :step-id [1 0] :step-result {:status :running}}
               {:build-number 2 :step-id [1 0] :step-result {:foo :baz :status :success}}
               {:build-number 2 :step-id [2 0] :step-result {:status :running}}


Add --add-src option to sync task (back by popular demand!)

--- boot/core/src/boot/task/built_in.clj
+++ boot/core/src/boot/task/built_in.clj
@@ -252,7 +252,8 @@
   The move option applies a find/replace transformation on all paths in the
   output fileset."

-  [m move MATCH:REPLACE {regex str} "The map of regex to replacement path strings."
+  [a add-src            bool        "Add all input files to output fileset."
+   m move MATCH:REPLACE {regex str} "The map of regex to replacement path strings."
    i include REGEX      #{regex}    "The set of regexes that paths must match."
    x exclude REGEX      #{regex}    "The set of regexes that paths must not match."]

@@ -264,12 +265,12 @@
                        (let [from-path (core/tmppath %2)
                              to-path   (mvpath from-path move)]
                          (core/mv %1 from-path to-path)))
-          remover #(if (keep? (io/file (core/tmppath %2))) %1 (core/rm %1 [%2]))]
+          remover #(if (keep? (io/file (core/tmppath %2))) %1 (core/rm %1 [%2]))
+          addsrcs #(if-not add-src % (core/mv-resource % (core/input-files %)))]
       (util/info "Sifting output files...\n")
-      (->> (reduce remover fileset outs)
-           ((juxt identity core/output-files))
-           (apply reduce mover)
-           core/commit!))))
+      (-> (addsrcs fileset)
+          (core/fileset-reduce core/output-files remover mover)
+          core/commit!))))

 (core/deftask add-repo
   "Add all files in project git repo to fileset.


Refactored

Refactored

--- src/rpi_challenger/core.clj
+++ src/rpi_challenger/core.clj
@@ -40,12 +40,11 @@
     (= (:body response) (:answer challenge))))

 (defn record-reponse
-  [url challenge response]
-  (println "Record response:" url challenge response)
-  (if (correct? response challenge)
-    (dosync
-      (alter services update-in [url :score ] #(+ % 1)))
-    (dosync
+  [url response challenge]
+  (println "Record response:" url response challenge)
+  (dosync
+    (if (correct? response challenge)
+      (alter services update-in [url :score ] #(+ % 1))
       (alter services update-in [url :score ] #(- % 1)))))

 (defn poll-service
@@ -54,8 +53,7 @@
   (with-open [client (http/create-client)]
     (let [challenge (challenges/hello-world)
           response (post-request (:url service) (:challenge challenge))]
-      (println "Got response" response)
-      (record-reponse (:url service) challenge response))))
+      (record-reponse (:url service) response challenge))))

 (defn poll-services
   []


genarate program, fire-a-process

genarate program, fire-a-process

--- src/sandbox/multithread.clj
+++ src/sandbox/multithread.clj
@@ -9,12 +9,9 @@
 "S = INSTRS
   INSTRS = ((INSTR | LOCKED-INSTRS) <optional-whitespace>)*
   INSTR = HEAVY-OP | MEDIUM-OP | LIGHT-OP
-  HEAVY-OP = <optional-whitespace> 'heavy-op' <whitespace> ID
-<SEP>
-  MEDIUM-OP = <optional-whitespace> 'medium-op' <whitespace> ID
-<SEP>
-  LIGHT-OP = <optional-whitespace> 'light-op' <whitespace> ID
-<SEP>
+  HEAVY-OP = <optional-whitespace> 'heavy-op' <whitespace> ID <SEP>
+  MEDIUM-OP = <optional-whitespace> 'medium-op' <whitespace> ID <SEP>
+  LIGHT-OP = <optional-whitespace> 'light-op' <whitespace> ID <SEP>

   LOCKED-INSTRS = LOCK INSTRS UNLOCK
   LOCK = <optional-whitespace> 'lock' <whitespace> ID <SEP>
@@ -26,3 +23,37 @@
   whitespace = #'\\s+'
   optional-whitespace = #'\\s*'
   SEP = #'\\s*' ';'")
+
+(defn gen-program [parser program]
+  (insta/transform
+   {:S identity
+    :INSTRS (fn [& args] (vec args))
+    :INSTR identity
+    :HEAVY-OP (fn [x y] {:inst-type :heavy-op :inst-id (get y 1)})
+    :MEDIUM-OP (fn [x y] {:inst-type :medium-op :inst-id (get y 1)})
+    :LIGHT-OP (fn [x y] {:inst-type :light-op :inst-id (get y 1)})
+    :LOCKED-INSTRS (fn [& args] (vec args))
+    :LOCK (fn [x y] {:inst-type :lock :inst-id {:lock (get y 1)}})
+    :UNLOCK (fn [x y] {:inst-type :unlock :inst-id {:unlock  (get y 1)}})}
+   (parser program)))
+
+(defn fire-a-process [grammar program process-id priority]
+  (let [prsr (insta/parser grammar)
+        vec-instructions (gen-program prsr program)
+;;=> the nested structure
+        zpr (z/vector-zip vec-instructions)]
+    (loop [result []
+           loc (->  zpr z/down)]
+      (if (z/end? loc)
+;;=> the end of recursion, no more nodes to visit
+        {:process-id process-id
+         :instructions result
+         :priority priority}
+;;=> We generate the process
+        (recur (if (map? (z/node loc))
+;;=> We only append to result the elements of type 'map'
+                 (conj result (z/node loc))
+                 result)
+;;=> else we pass result as is in the recursion
+               (z/next loc))))))
+;;=> and we recur with the next element.


Currently both suite and classname are required within buildviz, this also applies to TeamCity sync

--- src/buildviz/teamcity/transform.clj
+++ src/buildviz/teamcity/transform.clj
@@ -18,7 +18,7 @@

 (defn- parse-teamcity-test-name [full-name]
-  (let [match (re-matches #"^(?:(.+): )?(?:([^:]+)\.)?([^:\.]+)$" full-name)
+  (let [match (re-matches #"^(.+): ([^:]+)\.([^:\.]+)$" full-name)
         suites (nth match 1)
         classname (nth match 2)
         test-name (nth match 3)]


Updated protocols a smidge

Updated protocols a smidge

--- src/clj_bots/pin_ctrl/protocols.clj
+++ src/clj_bots/pin_ctrl/protocols.clj
@@ -39,13 +39,16 @@
   (set-mode! [board pin-n mode] "Set the mode of the pin, as long as it's supported by the pin's board."))

 (defprotocol PReadablePin
-  (read-value [board pin-n] "Read the binary or analog value of a pin. For analog input values this should be a normalized value between 0 and 1"))
+  (read-value [board pin-n] "Read the binary or analog value of a pin. For analog input values this should be the raw, non-normalized value."))

 (defprotocol PAinPin
+(defprotocol PAnalogPin
+  ; XXX This really needs to go away in favor of get-analog-bits
+  (analog-bits [board pin-n]))
   (read-raw-value [board pin-n] "Read the raw analog value of a pin. Maximum value depends on the number of bits ADC."))

 (defprotocol PWriteablePin
-  (write-value! [board pin-n val] "Set the binary or analog value of a pin."))
+  (write-value! [board pin-n val] "Set the binary or analog value of a pin; for analog, should be the raw, non-normalized value."))

 (defprotocol PEdgeDetectablePin
   "Edge detection allows efficient detection of GPIO state changes (such as from a button press).


Reveal intent better

Reveal intent better

--- src/cljs/asciinema_player/view.cljs
+++ src/cljs/asciinema_player/view.cljs
@@ -20,7 +20,7 @@
         bg-class (if final-bg (str "bg-" final-bg))
         bold-class (if bold "bright")
         underline-class (if underline "underline")
-        classes (filter boolean [fg-class bg-class bold-class underline-class])]
+        classes (remove nil? [fg-class bg-class bold-class underline-class])]
     (string/join " " classes)))

 (defn part [p]


support for TAB key in card typeahead

support for TAB key in card typeahead

--- src/cljs/netrunner/deckbuilder.cljs
+++ src/cljs/netrunner/deckbuilder.cljs
@@ -115,10 +115,10 @@
            (om/update-state! owner :selected dec))
       40 (when (< selected (dec (count matches)))
            (om/update-state! owner :selected inc))
-      13 (when-not (= (om/get-state owner :query) (:title (first matches)))
-           (.preventDefault event)
-           (-> ".deckedit .qty" js/$ .focus)
-           (om/set-state! owner :query (:title (nth matches selected))))
+      (9 13) (when-not (= (om/get-state owner :query) (:title (first matches)))
+               (.preventDefault event)
+               (-> ".deckedit .qty" js/$ .focus)
+               (om/set-state! owner :query (:title (nth matches selected))))
       (om/set-state! owner :selected 0))))

 (defn handle-add [owner event]


[fix] removed empty map being returned from gen-fake-data

--- src/server/handlers/api.clj
+++ src/server/handlers/api.clj
@@ -34,8 +34,7 @@

 (defn ^:private wrap-data [data]
   {:type :post
-   :data data }
-  )
+   :data data })

 (defn ^:private gen-fake-data []
   (wrap-data
@@ -46,7 +45,7 @@
     :timestamp (floor (random-date
                         (c/to-long (t/now))
                         (c/to-long
-                          (t/plus (t/now) (t/seconds 100)))))}) {})
+                          (t/plus (t/now) (t/seconds 100)))))}))

 (defn ^:private message-handler
   [ws-chan ch {:keys [content-type delivery-tag type] :as meta} ^bytes payload]


Additional sandbox items

Additional sandbox items

--- src/test_utils/sandbox.cljs
+++ src/test_utils/sandbox.cljs
@@ -36,6 +36,10 @@

 (defn typical-vertical-depth []
   (tuc/draw-normal 8000 1216))
+
+(defn typical-measured-depth []
+  (+ (tuc/draw-normal 8000 1216)
+     (* 5280 (rand))))

 (defn typical-toe-measured-depth []
   (tuc/draw-normal 18000 1500))
@@ -369,4 +373,14 @@
 (defn typical-proppant-concentration [units]
    (cond (= units :ppga)
          (value-from-typical-range 0.2 10)))
-
+
+
+(defn rand-uwi []
+  (apply str
+         (interpose "-"
+                    (map str [(two-digit-zero-pad (tuc/rand-2))
+                              (tuc/rand-3)
+                              (tuc/rand-5)
+                              (two-digit-zero-pad (tuc/rand-2))
+                              (two-digit-zero-pad (tuc/rand-2))]))))
+


add new true async context, remove notify! event arg (only used to trigger async ctx to update)

--- src/thi/ng/fabric/core.cljc
+++ src/thi/ng/fabric/core.cljc
@@ -45,7 +45,7 @@
 (defprotocol IGraphExecutor
   (execute! [_])
   (stop! [_])
-  (notify! [_ evt])
+  (notify! [_])
   (include-vertex! [_ v]))

 (defn collect-pure
@@ -316,7 +316,7 @@
             (-deref [_] ctx)])
       IGraphExecutor
       (stop! [_] (err/unsupported!))
-      (notify! [_ evt] (err/unsupported!))
+      (notify! [_] (err/unsupported!))
       (include-vertex! [_ v] (err/unsupported!))
       (execute!
         [_]
@@ -402,7 +402,7 @@
             (-deref [_] ctx)])
       IGraphExecutor
       (stop! [_] (err/unsupported!))
-      (notify! [_ evt] (err/unsupported!))
+      (notify! [_] (err/unsupported!))
       (include-vertex! [_ v] (err/unsupported!))
       (execute!
         [_]
@@ -430,3 +430,75 @@
                   (recur (long (+ colls colls')) (long (+ sigs sigs'))))
                 (->result :max-ops-reached sigs colls t0))
               (->result :converged sigs colls t0))))))))
+
+(defn async-execution-context2
+  [opts]
+  (let [ctx         (merge (default-async-context-opts) opts)
+        g           (:graph ctx)
+        c-thresh    (:collect-thresh ctx)
+        s-thresh    (:signal-thresh ctx)
+        max-ops     (:max-ops ctx)
+        processor   ((:processor ctx) s-thresh c-thresh)
+        threads     (:threads ctx)
+        res-chan    (or (:result ctx) (async/chan))
+        notify-chan (async/chan (async/dropping-buffer 1))
+        watch-id    (keyword (gensym))
+        v-filter    (filter #(or (should-signal? % s-thresh) (should-collect? % c-thresh)))
+        ->result    (fn [type sigs colls t0]
+                      (warn :send-result type)
+                      (go (>! res-chan (execution-result type sigs colls t0))))]
+    (reify
+      #?@(:clj
+           [clojure.lang.IDeref
+            (deref [_] ctx)]
+           :cljs
+           [IDeref
+            (-deref [_] ctx)])
+      IGraphExecutor
+      (stop!
+        [_]
+        (remove-watch! g :add-vertex watch-id)
+        (remove-watch! g :remove-vertex watch-id)
+        (remove-watch! g :add-edge watch-id)
+        (async/close! notify-chan))
+      (notify!
+        [_] (go (>! notify-chan true)) nil)
+      (execute!
+        [_]
+        (let [t0     (atom (now))
+              active (atom (sequence v-filter (vertices g)))
+              enable (atom #{})]
+          (add-watch! g :add-vertex watch-id
+                      (fn [[__ v]]
+                        (swap! enable into (signal! v sync-vertex-signal))))
+          (add-watch! g :remove-vertex watch-id
+                      (fn [[__ v]]
+                        (swap! enable into (signal! v sync-vertex-signal))))
+          (add-watch! g :add-edge watch-id
+                      (fn [[__ src dest]]
+                        (swap! enable into [src dest])))
+          (go-loop [colls 0, sigs 0]
+            ;;(warn :active-count (count @active))
+            (if (seq @active)
+              (if (<= (+ colls sigs) max-ops)
+                (let [[act' sigs' colls']
+                      (r/fold
+                       (max 512 (long (/ (count @active) threads)))
+                       combine-stats
+                       processor @active)]
+                  ;;(warn :auto (count @enable))
+                  (reset! active (into (into #{} v-filter act') @enable))
+                  (reset! enable #{})
+                  (recur (long (+ colls colls')) (long (+ sigs sigs'))))
+                (do (stop! _)
+                    (->result :max-ops-reached sigs colls @t0)))
+              (do (->result :converged sigs colls @t0)
+                  (if (:auto-stop ctx)
+                    (stop! _)
+                    (when (<! notify-chan)
+                      (reset! t0 (now))
+                      (reset! active (sequence v-filter (vertices g)))
+                      (reset! enable #{})
+                      ;;(warn :rerun (count @active))
+                      (recur 0 0))))))
+          res-chan)))))


tweak user testbench

tweak user testbench

--- dev/user.clj
+++ dev/user.clj
@@ -21,11 +21,15 @@
   (let [zid (or zid (postgres/get-zid-from-zinvite (:postgres runner/system) zinvite))]
     (conv-man/load-or-init (:conversation-manager runner/system) zid)))

+
+;; Can toggle between do and comment here for refiring entire file
+;(do
 (comment
-  (runner/run! system/base-system)
-  (runner/stop!)
+  ;(runner/run! system/base-system)
+  ;(runner/run! system/full-system)
+  (runner/run! system/darwin-system)
+
   (def args {:zid 15228})
-
   (def conv (load-conv args))

   (:config runner/system)
@@ -42,4 +46,6 @@
     ;(:repness updated-conv'))
   ;(get-conv args)
   (-> runner/system :conversation-manager :conversations deref)
+
+  (runner/stop!)
   :end)


remove stray paren

remove stray paren

--- src/gamma_driver/drivers/basic.cljs
+++ src/gamma_driver/drivers/basic.cljs
@@ -28,7 +28,7 @@

 (defn default-input-fn [driver program binder-fn variable old new]
   (let [t (:tag new)]
-    (if (and old new (= (old t) (new t))))
+    (if (and old new (= (old t) (new t)))
       new
       (binder-fn (gd/gl driver) program variable new))))


Fixes app menu

Fixes app menu

--- src/great_things_done/app-menu.cljs
+++ src/great_things_done/app-menu.cljs
@@ -51,12 +51,12 @@
                                             :accelerator "Command+A"
                                             :selector "selectAll:"}]}
                                 {:label "View"
-                                 :submenu: [{:label "Reload"
-                                             :accelerator "Command+R"
-                                             :click #(.reloadIgnoringCache (.getFocusedWindow BrowserWindow))}
-                                            {:label "Toggle DevTools"
-                                             :accelerator "Alt+Command+I"
-                                             :click #(.toggleDevTools (.getFocusedWindow BrowserWindow))}]}
+                                 :submenu [{:label "Reload"
+                                            :accelerator "Command+R"
+                                            :click #(.reloadIgnoringCache (.getFocusedWindow BrowserWindow))}
+                                           {:label "Toggle DevTools"
+                                            :accelerator "Alt+Command+I"
+                                            :click #(.toggleDevTools (.getFocusedWindow BrowserWindow))}]}
                                 {:label "Window"
                                  :submenu [{:label "Minimize"
                                             :accelerator "Command+M"


more assertions and fix get-merge-sha

more assertions and fix get-merge-sha

--- src/hu/ssh/github_changelog/git.clj
+++ src/hu/ssh/github_changelog/git.clj
@@ -2,7 +2,8 @@
   (:require
     [clj-jgit.porcelain :as git]
     [clj-jgit.util :as util])
-  (:import (java.io FileNotFoundException)))
+  (:import (java.io FileNotFoundException)
+           (org.eclipse.jgit.lib Ref)))

 (defn- repo? [x] (instance? org.eclipse.jgit.api.Git x))

@@ -27,11 +28,13 @@
     repo))

 (defn- get-merge-sha [tag]
-  {:post [(string? %)]}
-  (. (if-let [object-id (. tag getPeeledObjectId)] object-id (. tag getPeeledObjectId)) name))
+  {:pre  (instance? Ref repo)
+   :post [(string? %)]}
+  (. (if-let [peeled-id (. tag getPeeledObjectId)] peeled-id (. tag getObjectId)) name))

 (defn- map-tag [repo tag]
-  {:post [(map? %)]}
+  {:pre  (instance? Ref repo)
+   :post [(map? %)]}
   (let [peeled (. repo peel tag)]
     {:name (. tag getName) :sha (get-merge-sha peeled)}))


Pass the namespace to the complexity workhorse function, and confine the dynamic scope to the macro.

--- src/kolmogorov_music/kolmogorov.clj
+++ src/kolmogorov_music/kolmogorov.clj
@@ -24,11 +24,11 @@
        (map #(complexity-sym % terminal?))
        (reduce + (count sexpr)))))

-(defn complexity* [expr]
-  (let [terminal? #(not (in-ns? % *ns*))]
+(defn complexity* [expr ns]
+  (let [terminal? #(not (in-ns? % ns))]
     (if (seq? expr)
       (complexity-sexpr terminal? expr)
       (complexity-sym expr terminal?))))

 (defmacro complexity [expr]
-  (complexity* expr))
+  (complexity* expr *ns*))


removed zero elements from percept satisfaction vectors

--- src/main/clj/emotions_demo/core.clj
+++ src/main/clj/emotions_demo/core.clj
@@ -96,10 +96,8 @@
    :linus_torvalds
    {:name "Recognised"
     :other-agents #{:linus_torvalds}
-    :satisfaction-vector {:phys-anger 0.0
-                          :phys-hunger 0.0
-                          :phys-fear 0.1
-                          :saf-bored -0.5
+    :satisfaction-vector {:phys-fear 0.1
+                          :saf-bored -0.6
                           :saf-delight -0.4
                           :saf-playful -0.1
                           :soc-lonely -0.2}}
@@ -107,19 +105,15 @@
    {:name "Recognised"
     :other-agents #{:steve_ballmer}
     :satisfaction-vector {:phys-anger 0.1
-                          :phys-hunger 0.0
                           :phys-fear 0.8
                           :saf-bored -0.5
-                          :saf-delight 0.0
                           :saf-playful -0.1
                           :soc-lonely -0.1}}
    :nao_robot
    {:name "Recognised"
     :other-agents #{:nao_robot}
-    :satisfaction-vector {:phys-anger 0.0
-                          :phys-hunger 0.0
-                          :phys-fear -0.2
-                          :saf-bored -0.5
+    :satisfaction-vector {:phys-fear -0.2
+                          :saf-bored -0.6
                           :saf-delight -0.6
                           :saf-playful -0.2
                           :soc-lonely -0.3}}


add edit and delete icons for table grid

--- src_cljs/rrms/corecljs.cljs
+++ src_cljs/rrms/corecljs.cljs
@@ -31,7 +31,7 @@
   (xhr/send url callback "POST" data  (structs/Map. (clj->js {:Content-Type "application/json"}))))

 (defn http-delete [url callback]
-  (xhr/send url callback "DELETE" (structs/Map. (clj->js {:Content-Type "application/json"}))))
+  (xhr/send url callback "DELETE"  (structs/Map. (clj->js {:Content-Type "application/json"}))))

 (declare render-documents)

@@ -99,7 +99,6 @@
 (defn click-update[id]
   (.assign js/location (str "#/documents/update/" id)))

-
 (defn docupdate [event]
   (let [onres (fn[data]
                 (.assign js/location "/"))]
@@ -126,52 +125,57 @@
     (http-delete (str "http://localhost:8193/documents/delete/" id)  onres)))

 (defn render-documents [documents]
-  [:div {:id "app"}
+  [:div
    ;; [:div.padding]
    ;; [:div.page-header [:h1 "Record Room Management System"]]
-   ;; [:div#add]
+   [:div#add]
    [:div#update]
    [:div {:class "box"}
     [:div {:class "box-header"}
      [:h8 ""]]
     ;; [:br]
     ;; [:h1.text-center "List of Documents"]
-    [:div {:class "col-xs-12"}
-     [:div.form-group
-      [:div.col-sm-2 [:input.form-control {:id "sText" :type "text"
-                                           :placeholder "search by title"}]]
-      [:input {:type "button" :value "Search"
-               :class "btn btn-primary" :on-click search}]
-      (url-format "#/documents/add" "Add")]]
-    [:div {:class "box-body"}
-
-     [:table {:id "example1" :class "table table-bordered table-striped dataTable" :role "grid" :aria-describedby "example1_info"}
-
-      [:thead
-       [:tr {:role "row"}
-        [:th "DocumentName"]
-        [:th "Title"]
-        [:th "Employeename"]
-        [:th "Date"]
-        [:th "Location"]
-        [:th " "]
-        [:th " "]
-        ]]
-      [:tbody
-       (for [dn documents]
-         ^{:key (.-id dn)} [:tr
-                            [:td (.-documentname dn)]
-                            [:td (.-title dn)]
-                            [:td (.-employeename dn)]
-                            [:td  (f/unparse (f/formatter "dd-MMM-yyyy")(f/parse (.-date dn)))]
-                            ;; [:td (.-date dn)]
-                            [:td (.-location dn)]
-                            [:td [:input {:type "button" :on-click #(click-update(.-id dn))
-                                          :class "glyphicon glyphicon-edit" :value "Update"}
-                                  ]]
-                            [:td [:input {:type "button" :on-click #(delete(.-id dn))
-                                          :class "glyphicon glyphicon-remove"  :value "Delete"}]]
-                            ])]]
+    [:div {:class "row"}
+     [:div {:class "col-xs-12"}
+      [:div.form-group
+       [:div.col-sm-2 [:input.form-control {:id "sText" :type "text"
+                                            :placeholder "search by title"}]]
+       [:input {:type "button" :value "Search"
+                :class "btn btn-primary" :on-click search}]
+       (url-format "#/documents/add" "Add")]
+      [:div {:class "box-body"}
+
+       [:table {:id "example1" :class "table table-bordered table-striped dataTable"}
+        [:thead
+         [:tr
+          [:th "DocumentName"]
+          [:th "Title"]
+          [:th "Employeename"]
+          [:th "Date"]
+          [:th "Location"]
+          [:th " "]
+          [:th " "]
+          ]]
+        [:tbody
+         (for [dn documents]
+           ^{:key (.-id dn)} [:tr
+                              [:td (.-documentname dn)]
+                              [:td (.-title dn)]
+                              [:td (.-employeename dn)]
+                              [:td  (f/unparse (f/formatter "dd-MMM-yyyy")(f/parse (.-date dn)))]
+                              ;; [:td (.-date dn)]
+                              [:td (.-location dn)]
+                              ;; [:td [:input {:type "button" :on-click #(click-update(.-id dn))
+                              ;;               :class "glyphicon glyphicon-edit" :value "Update"}
+                              ;;       ]]
+                              [:td [:a {:href "javascript:;" :on-click  #(click-update(.-id dn))  :class "glyphicon glyphicon-edit"}]]
+                              ;; [:td [:input {:type "button" :on-click #(delete(.-id dn))
+                              ;;               :class "glyphicon glyphicon-remove"  :value "Delete"}]]
+                              [:td  [:a {:href "javascript:;" :on-click #(delete(.-id dn))  :class "glyphicon glyphicon-remove"}] ]
+
+                              ])]]]
+      ]
+
      ]

     ]


Allow 4 digits in a sequence as year is common.

--- src/oc/storage/resources/common.clj
+++ src/oc/storage/resources/common.clj
@@ -21,7 +21,7 @@

 (defn- allowed-org-name? [name]
   (and (string? name)
-       (not (re-matches #".*\d(\s*)\d(\s*)\d(\s*)\d.*" name)) ; don't allow any more than 3 numerals in a row
+       (not (re-matches #".*\d(\s*)\d(\s*)\d(\s*)\d(\s*)\d.*" name)) ; don't allow any more than 4 numerals in a row
        (= (count name) (.codePointCount name 0 (count name))))) ; same # of characters as Unicode points

 (defn- allowed-board-name? [name]


(maint) fix sending of error messages

(maint) fix sending of error messages

We'd managed to miss error_message in the changes for one of the earlier
protocol changes.

--- src/puppetlabs/cthun/websockets.clj
+++ src/puppetlabs/cthun/websockets.clj
@@ -62,9 +62,8 @@
                 (let [error-body {:description (str "Error " (:type m) " handling message: " (:message &throw-context))}
                       error-message (-> (message/make-message)
                                         (assoc :id (kitchensink/uuid)
-                                               :expires ""
-                                               :data_schema "http://puppetlabs.com/error_message"
-                                               :sender "cth://server")
+                                               :message_type "http://puppetlabs.com/error_message"
+                                               :sender "cth:///server")
                                         (message/set-json-data error-body))]
                   (s/validate validation/ErrorMessage error-body)
                   (log/warn "sending error message" error-body)


CMR-5281: Refactored code based on review comment.

--- umm-spec-lib/test/cmr/umm_spec/test/validation/umm_spec_granule_validation_tests.clj
+++ umm-spec-lib/test/cmr/umm_spec/test/validation/umm_spec_granule_validation_tests.clj
@@ -715,6 +715,31 @@
          {:path [:two-d-coordinate-system :start-coordinate-1]
           :errors ["The field [Start Coordinate 1] falls outside the bounds [0 ∞] defined in the collection"]}]))))

+(defn- make-granule-with-equator-crossing
+  "Creates a granule with the given equator-crossing-date-time.
+  This function is tied to the collection that is used in test
+  granule-ocsd-equator-crossing-date-time and is only intended to be used in that test."
+  [equator-crossing-date-time]
+  (make-granule
+   {:temporal (g/map->GranuleTemporal
+               {:range-date-time
+                {:beginning-date-time (dtp/parse-datetime "2015-01-01T00:00:00Z")
+                 :ending-date-time (dtp/parse-datetime "2015-06-01T00:00:00Z")}})
+    :spatial-coverage (g/map->SpatialCoverage
+                       {:orbit (g/->Orbit 76.123 50.0 :asc 50.0 :desc)})
+    :orbit-calculated-spatial-domains
+    [;; a valid equator crossing to test handling of more than one orbit calculated spatial domains
+     (g/map->OrbitCalculatedSpatialDomain
+      {:orbit-number  1
+       :start-orbit-number 1
+       :stop-orbit-number 1
+       :equator-crossing-date-time (dtp/parse-datetime "2015-02-01T00:00:00Z")})
+     (g/map->OrbitCalculatedSpatialDomain
+      {:orbit-number  1
+       :start-orbit-number 1
+       :stop-orbit-number 1
+       :equator-crossing-date-time (dtp/parse-datetime equator-crossing-date-time)})]}))
+
 (deftest granule-ocsd-equator-crossing-date-time
   (let [collection-with-orbit (make-collection
                                {:TemporalExtents [(cmn/map->TemporalExtentType
@@ -725,28 +750,7 @@
                                                    :Period 100.0
                                                    :SwathWidth 2600.0
                                                    :StartCircularLatitude 50.0
-                                                   :NumberOfOrbits 2.0}}})
-        make-granule-with-equator-crossing
-        (fn [equator-crossing-date-time]
-          (make-granule
-           {:temporal (g/map->GranuleTemporal
-                       {:range-date-time
-                        {:beginning-date-time (dtp/parse-datetime "2015-01-01T00:00:00Z")
-                         :ending-date-time (dtp/parse-datetime "2015-06-01T00:00:00Z")}})
-            :spatial-coverage (g/map->SpatialCoverage
-                               {:orbit (g/->Orbit 76.123 50.0 :asc 50.0 :desc)})
-            :orbit-calculated-spatial-domains
-            [;; a valid equator crossing to test handling of more than one orbit calculated spatial domains
-             (g/map->OrbitCalculatedSpatialDomain
-              {:orbit-number  1
-               :start-orbit-number 1
-               :stop-orbit-number 1
-               :equator-crossing-date-time (dtp/parse-datetime "2015-02-01T00:00:00Z")})
-             (g/map->OrbitCalculatedSpatialDomain
-              {:orbit-number  1
-               :start-orbit-number 1
-               :stop-orbit-number 1
-               :equator-crossing-date-time (dtp/parse-datetime equator-crossing-date-time)})]}))]
+                                                   :NumberOfOrbits 2.0}}})]

     (testing "granules with orbit calcualted spatial domains equator crossing date time"
       (are3 [equator-crossing expected-errors]


Removed wrong form

Removed wrong form


Don't start env in test.

Don't start env in test.

--- test/onyx/peer/single_peer_test.clj
+++ test/onyx/peer/single_peer_test.clj
@@ -31,8 +31,6 @@
    :onyx.peer/join-failure-back-off 500
    :onyx.peer/job-scheduler scheduler
    :onyx.messaging/impl messaging})
-
-(def env (onyx.api/start-env env-config))

 (def n-messages 100)


Remove etl from system componenets.

Remove etl from system componenets.

--- dev/kixi/hecuba/system.clj
+++ dev/kixi/hecuba/system.clj
@@ -21,8 +21,7 @@
    [kixi.hecuba.amon :refer (new-amon-api)]
    [kixi.hecuba.user :refer (new-user-api)]
    [kixi.hecuba.cljs :refer (new-cljs-routes)]
-   [kixi.hecuba.dev.etl :refer (new-user-data-loader new-csv-loader)]
-
+   [kixi.hecuba.dev.etl :refer (new-user-data-loader)]
    [clojurewerkz.cassaforte.client :as cassaclient]
    [clojurewerkz.cassaforte.query :as cassaquery]
    [clojurewerkz.cassaforte.cql :as cql]
@@ -68,20 +67,6 @@
     (let [session (get-in this [:session :session])]
       (assert session "No session found in system")
       (binding [cassaclient/*default-session* session]
-
-        (ignoring-error (cql/drop-table "programmes"))
-        (ignoring-error (cql/drop-table "projects"))
-        (ignoring-error (cql/drop-table "entities"))
-        (ignoring-error (cql/drop-table "devices"))
-        (ignoring-error (cql/drop-table "sensors"))
-        (ignoring-error (cql/drop-table "sensor_metadata"))
-        (ignoring-error (cql/drop-table "measurements"))
-        (ignoring-error (cql/drop-table "difference_series"))
-        (ignoring-error (cql/drop-table "hourly_rollups"))
-        (ignoring-error (cql/drop-table "daily_rollups"))
-        (ignoring-error (cql/drop-table "users"))
-        (ignoring-error (cql/drop-table "data_sets"))
-

         ;; While developing, it's a pain to have to keep logging in
         ;;(ignoring-error (cql/drop-table "user_sessions"))
@@ -356,7 +341,6 @@
          :user-api (new-user-api)
          :cljs-routes (new-cljs-routes (:cljs-builder cfg))
          :user-data-loader (new-user-data-loader cfg)
-         :csv-loader (new-csv-loader cfg)
          )

         (mod/system-using
@@ -369,6 +353,5 @@
           :pipeline [:store]
           :scheduler [:pipeline]
           :user-data-loader [:bidi-ring-handler :web-server :user-api]
-          :csv-loader [:bidi-ring-handler :amon-api :web-server :user-data-loader :store]
           ;;:cljs-routes [:cljs-builder]
           :session [:cluster]}))))


figwheel.main reload changed clj files

figwheel.main reload changed clj files

--- figwheel-main/src/figwheel/main.clj
+++ figwheel-main/src/figwheel/main.clj
@@ -74,17 +74,34 @@

 #_((suffix-filter #{"clj"}) nil {:file (io/file "project.clj")})

+;; config :reload-clj-files false
+;; :reload-clj-files {:clj true :cljc false}
+
 (defn watch [inputs opts cenv]
-  (prn "Called Watch!!!")
   (when-let [inputs (if (coll? inputs) inputs [inputs])]
     (add-watch! (-> opts meta :build-id (or :dev))
                 {:paths inputs
-                 :filter (suffix-filter #{"cljs" "clj" "cljc"})
+                 :filter (suffix-filter #{"cljs" "clj" "cljc" "js"})
                  :handler (throttle
                            50
-                           (fn [evts]
-                           (let [inputs (if (coll? inputs) (apply bapi/inputs inputs) inputs)]
-                             (figwheel.core/build inputs opts cenv))))})))
+                           (bound-fn [evts]
+                             (let [files (mapv (comp #(.getCanonicalPath %) :file) evts)
+                                   inputs (if (coll? inputs) (apply bapi/inputs inputs) inputs)]
+                               (try
+                                 (when-let [clj-files
+                                            (not-empty
+                                             (filter
+                                              #(or (.endsWith % ".clj")
+                                                   (.endsWith % ".cljc"))
+                                              files))]
+                                   (figwheel.core/reload-clj-files clj-files))
+                                 (figwheel.core/build inputs opts cenv files)
+                                 (catch Throwable t
+                                   #_(clojure.pprint/pprint
+                                      (Throwable->map t))
+                                   (figwheel.core/notify-on-exception
+                                    cljs.env/*compiler* t {})
+                                   false)))))})))

 ;; ----------------------------------------------------------------------------
 ;; Additional cli options


fix agreement between noun and its determiner

--- src/babel/pos.clj
+++ src/babel/pos.clj
@@ -26,9 +26,9 @@
           {:synsem {:cat cat
                     :pronoun pronoun
                     :case :top
-                    :subcat {:1 {:number number
-                                 :person person
-                                 :gender gender}}
+                    :subcat {:1 {:agr {:number number
+                                       :person person
+                                       :gender gender}}}
                     :agr agr}})
         common
         {:synsem {:cat :noun


fix bug in defile's when

fix bug in defile's when

--- src/cake/core.clj
+++ src/cake/core.clj
@@ -107,8 +107,8 @@
                                                    (map #(file ".cake" "run" (name %))
                                                         task-deps))))
                                (empty? '~deps))
-                           ~pred))
-                ~@actions)))))
+                           ~pred)
+                  ~@actions))))))

 (defmacro undeftask [& names]
   `(swap! tasks dissoc ~@(map #(list 'quote %) names)))


Rename work-fn to cb (for callback).

Rename work-fn to cb (for callback).

--- src/cbfg/kvs.cljs
+++ src/cbfg/kvs.cljs
@@ -42,36 +42,36 @@
    :dirty (make-kc) ; Mutations go here, until "persisted / made durable".
    :next-sq 1})

-(defn kvs-checker [kvs-ident work-fn]
+(defn kvs-checker [kvs-ident cb]
   (fn [state] ; Returns wrapper fn to check if kvs-ident is current.
     (if-let [[name uuid] kvs-ident]
       (if-let [kvs (get-in state [:kvss name])]
         (if (= uuid (:uuid kvs))
-          (work-fn state kvs)
+          (cb state kvs)
           [state {:status :mismatch :status-info :wrong-uuid}])
         [state {:status :not-found :status-info :no-kvs}])
       [state {:status :invalid :status-info :no-kvs-ident}])))

-(defn kvs-do [actx state-ch res-ch work-fn]
+(defn kvs-do [actx state-ch res-ch cb]
   (act kvs-do actx
-       (aput kvs-do state-ch [work-fn res-ch])))
+       (aput kvs-do state-ch [cb res-ch])))

 (defn make-scan-fn [kc-kind scan-kind result-key get-entry]
   (fn [actx state-ch m]
      (let [{:keys [from to res-ch]} m
-           work-fn (fn [state kvs]
-                     (act scan-work actx
-                          (let [kc (kc-kind kvs)]
-                            (doseq [[k v] (subseq (into (sorted-map) (scan-kind kc))
-                                                  >= from < to)]
-                              (when-let [entry (get-entry kc k v)]
-                                (when (not (:deleted entry))
-                                  (aput scan-work res-ch (merge m {:partial :ok
-                                                                   result-key key
-                                                                   :entry entry})))))
-                            (aput-close scan-work res-ch (merge m {:status :ok}))))
-                     nil)]
-       (kvs-do actx state-ch nil (kvs-checker (:kvs-ident m) work-fn)))))
+           cb (fn [state kvs]
+                (act scan-work actx
+                     (let [kc (kc-kind kvs)]
+                       (doseq [[k v] (subseq (into (sorted-map) (scan-kind kc))
+                                             >= from < to)]
+                         (when-let [entry (get-entry kc k v)]
+                           (when (not (:deleted entry))
+                             (aput scan-work res-ch (merge m {:partial :ok
+                                                              result-key key
+                                                              :entry entry})))))
+                       (aput-close scan-work res-ch (merge m {:status :ok}))))
+                nil)]
+       (kvs-do actx state-ch nil (kvs-checker (:kvs-ident m) cb)))))

 (def op-handlers
   {:kvs-open
@@ -98,39 +98,38 @@

    :multi-get
    (fn [actx state-ch m]
-     (let [keys (:keys m)
-           res-m (dissoc m :keys)
+     (let [res-m (dissoc m :keys)
            res-ch (:res-ch m)
-           work-fn (fn [state kvs]
-                     (act multi-get actx
-                          (let [kc (:clean kvs)]
-                            (doseq [key keys]
-                              (if-let [entry (kc-entry-by-key kc key)]
-                                (aput multi-get res-ch
-                                      (merge res-m {:partial :ok :key key :entry entry}))
-                                (aput multi-get res-ch
-                                      (merge res-m {:partial :not-found :key key}))))
-                            (aput-close multi-get res-ch (merge res-m {:status :ok}))))
-                     nil)]
-       (kvs-do actx state-ch nil (kvs-checker (:kvs-ident m) work-fn))))
+           cb (fn [state kvs]
+                (act multi-get actx
+                     (let [kc (:clean kvs)]
+                       (doseq [key (:keys m)]
+                         (if-let [entry (kc-entry-by-key kc key)]
+                           (aput multi-get res-ch
+                                 (merge res-m {:partial :ok :key key :entry entry}))
+                           (aput multi-get res-ch
+                                 (merge res-m {:partial :not-found :key key}))))
+                       (aput-close multi-get res-ch (merge res-m {:status :ok}))))
+                nil)]
+       (kvs-do actx state-ch nil (kvs-checker (:kvs-ident m) cb))))

    :multi-change
    (fn [actx state-ch m]
-     (let [res-m (dissoc m :status :status-info :partial :changes)
+     (let [res-m (dissoc m :changes)
            res-ch (:res-ch m)
-           work-fn (fn [state kvs]
-                     (let [next-sq (:next-sq kvs)
-                           [next-kvs ress] (reduce (fn [[kvs ress] change]
-                                                     (let [[kvs res] (change kvs next-sq)]
-                                                       [kvs (conj ress res)]))
-                                                   [(assoc kvs :next-sq (inc next-sq)) []]
-                                                   (:changes m))]
-                       (act multi-change actx
-                            (doseq [res ress]
-                              (aput multi-change res-ch (merge res-m res)))
-                            (aput-close multi-change res-ch (merge res-m {:status :ok})))
-                       [(assoc-in state [:kvss (:name kvs)] next-kvs) nil]))]
-       (kvs-do actx state-ch nil (kvs-checker (:kvs-ident m) work-fn))))
+           cb (fn [state kvs]
+                (let [next-sq (:next-sq kvs)
+                      [next-kvs ress] (reduce (fn [[kvs ress] change]
+                                                (let [[kvs res] (change kvs next-sq)]
+                                                  [kvs (conj ress res)]))
+                                              [(assoc kvs :next-sq (inc next-sq)) []]
+                                              (:changes m))]
+                  (act multi-change actx
+                       (doseq [res ress]
+                         (aput multi-change res-ch (merge res-m res)))
+                       (aput-close multi-change res-ch (merge res-m {:status :ok})))
+                  [(assoc-in state [:kvss (:name kvs)] next-kvs) nil]))]
+       (kvs-do actx state-ch nil (kvs-checker (:kvs-ident m) cb))))

    :scan-keys
    (make-scan-fn :clean :keys :key kc-entry-by-key-sq)


Better net var names and comments.

Better net var names and comments.

--- src/cbfg/net.cljs
+++ src/cbfg/net.cljs
@@ -13,15 +13,13 @@
   :done)

 (defn make-net [actx request-listen-ch request-connect-ch & opts]
-  (ago-loop net actx
+  (ago-loop net actx     ; A conn is represented by dual streams.
             [ts 0        ; A increasing event / time stamp counter.
              listens {}  ; Keyed by [addr port], value is [close-accept-ch accept-ch].
-             streams {}  ; A conn is represented by dual streams, where streams
-                         ; is keyed by send-ch and a value of...
+             streams {}  ; Keyed by send-ch and a value is...
                          ; {:send-addr :send-port :send-ch
                          ;  :recv-addr :recv-port :recv-ch
-                         ;  :side (:client|:server)
-                         ;  :server-addr :server-port
+                         ;  :side (:client|:server) :server-addr :server-port
                          ;  :msgs [[deliver-at msg] ...]}.
              results []] ; A result entry is [result-ch msg].
             (let [close-accept-chs (map first (vals listens))
@@ -29,12 +27,12 @@
                                            (when-let [close-recv-ch (:close-recv-ch stream)]
                                              [close-recv-ch]))
                                          streams)
-                  deliverables (mapcat (fn [[send-ch stream]]
-                                         (when-let [[deliver-at msg] (first (:msgs stream))]
-                                           (when (and (:recv-ch stream)
-                                                      (>= ts deliver-at))
-                                             [[(:recv-ch stream) msg]])))
-                                       streams)
+                  deliverable-msgs (mapcat (fn [[send-ch stream]]
+                                             (when-let [[deliver-at msg] (first (:msgs stream))]
+                                               (when (and (:recv-ch stream)
+                                                          (>= ts deliver-at))
+                                                 [[(:recv-ch stream) msg]])))
+                                           streams)
                   send-chs (mapcat (fn [[send-ch stream]]
                                      (when (and (not (:send-closed stream))
                                                 (< (count (:msgs stream))
@@ -44,12 +42,12 @@
                   chs (-> [request-listen-ch request-connect-ch]
                           (into close-accept-chs)
                           (into close-recv-chs)
-                          (into deliverables)
+                          (into deliverable-msgs)
                           (into send-chs)
                           (into results))
                   [v ch] (aalts net chs)]
               (cond
-               (= ch request-listen-ch)
+               (= ch request-listen-ch) ; Server listen request.
                (if-let [[addr port result-ch] v]
                  (if (get listens [addr port])
                    (do (aclose net result-ch)
@@ -60,7 +58,7 @@
                             streams
                             (conj results [result-ch accept-chs]))))
                  (net-clean-up net listens streams results))
-               (= ch request-connect-ch)
+               (= ch request-connect-ch) ; Client connect request.
                (if-let [[to-addr to-port from-addr result-ch] v]
                  ; TODO: Need to model connection delay, perhaps with a generic "later".
                  (if-let [[close-accept-ch accept-ch] (get listens [to-addr to-port])]
@@ -92,7 +90,7 @@
                    (do (aclose net result-ch)
                        (recur (inc ts) listens streams results)))
                  (net-clean-up net listens streams results))
-               (some #(= ch %) send-chs)
+               (some #(= ch %) send-chs) ; Peer aput to a send-ch.
                (let [send-ch ch
                      stream (get streams send-ch)]
                  (if-let [[msg result-ch] v]
@@ -122,9 +120,9 @@
                             (assoc streams (:send-ch stream2) stream2)
                             results)))
                  (if-let [stream (first (filter #(= (:close-recv-ch %) ch) (vals streams)))]
-                   (if v
+                   (if v ; Or, test if it's a closed close-recv-ch.
                      (recur (inc ts) listens streams results)
-                     (do (aclose net (:recv-ch stream)) ; Handle a closed close-recv-ch.
+                     (do (aclose net (:recv-ch stream))
                          (recur (inc ts)
                                 listens
                                 (assoc streams (:send-ch stream)
@@ -135,16 +133,13 @@
                                 results)))
                    (if-let [[addr-port [close-accept-ch accept-ch]]
                             (first (filter #(= ch (first (second %))) (seq listens)))]
-                     (if v
+                     (if v ; Or, test if it's a closed close-accept-ch.
                        (recur (inc ts) listens streams results)
-                       (do (aclose net accept-ch) ; Handle a closed close-accept-ch.
+                       (do (aclose net accept-ch)
                            (recur (inc ts)
                                   (dissoc listens addr-port)
                                   streams
                                   results)))
-                     (if (seq (filter #(= ch (first %)) results))
-                       (do (aclose net ch) ; Handle a completed result-ch aput.
-                           (recur (inc ts) listens streams
-                                  (remove #(= (first %) ch) results)))
-                       (println "UNKNOWN ch"
-                                listens :streams streams :results results)))))))))
+                     (do (aclose net ch) ; Or, handle a completed result-ch aput.
+                         (recur (inc ts) listens streams
+                                (remove #(= (first %) ch) results))))))))))


add mtable

add mtable

--- user.clj
+++ user.clj
@@ -1,5 +1,5 @@
 (ns u
-  (:require  [clojure.pprint :as pp])
+  (:require [clojure.pprint :as pp])
 )

 (defn class-path "Prints list of class paths" []
@@ -12,6 +12,10 @@

 (defn java-methods "List of methods for a java class" [klass]
   (sort (distinct (map #(.getName %) (seq (.getMethods klass))))))
+
+; mtable 'doc
+(defn mtable "Prints meta of a function as a table" [sym]
+  (table.core/table (meta (resolve sym))))

 ; TODO: can't construct full symbol for doc correctly
 ;(defmacro ls


Fix things. Not really sure what we fixed, though.

Signed-off-by: bbaumgar <1708599f4f51c687c2d8f76eae88ad70ac478427@virginia.edu>

--- markov-clj/src/markov_clj/twitter.clj
+++ markov-clj/src/markov_clj/twitter.clj
@@ -82,6 +82,6 @@

 ;; (spit "ktweets.txt" (str ktweets))
 (first (markov-clj.markov/generate ktweets 1))
-(count (apply str (interpose " " ktweets)))
+(apply str (interpose " " ktweets))

 (defn -main [] (process-followers))


adding the other methods back

adding the other methods back

--- sidecar/src/figwheel_sidecar/core.clj
+++ sidecar/src/figwheel_sidecar/core.clj
@@ -134,7 +134,7 @@
       ;; super promiscuous please don't uses figwheel as a production server :)
       (cors/wrap-cors
        :access-control-allow-origin #".*"
-       :access-control-allow-methods [:head :options :get])
+       :access-control-allow-methods [:head :options :get :put :post :delete])
       (run-server {:port server-port})))

 (defn append-msg [q msg] (conj (take 30 q) msg))


Make nREPL middleware configurable

Make nREPL middleware configurable

--- sidecar/src/figwheel_sidecar/repl.clj
+++ sidecar/src/figwheel_sidecar/repl.clj
@@ -514,10 +514,22 @@

 (defn start-nrepl-server [figwheel-options autobuild-options]
   (when (:nrepl-port figwheel-options)
-    (let [middleware (if (require? 'cider.nrepl)
-                       (map resolve (deref (resolve 'cider.nrepl/cider-middleware)))
-                       (list))
-          middleware (conj middleware #'cemerick.piggieback/wrap-cljs-repl)]
+    (let [middleware (or
+                      (:nrepl-middleware figwheel-options)
+                      ["cemerick.piggieback/wrap-cljs-repl"])
+          resolve-mw (fn [name]
+                       (let [s (symbol name)
+                             ns (symbol (namespace s))]
+                         (if (and
+                              (require? ns)
+                              (resolve s))
+                           (let [var (resolve s)
+                                 val (deref var)]
+                             (if (vector? val)
+                               (map resolve val)
+                               (list var)))
+                           (println (format "WARNING: unable to load \"%s\" middleware" name)))))
+          middleware (mapcat resolve-mw middleware)]
       (nrepl-serv/start-server
        :port (:nrepl-port figwheel-options)
        :bind (:nrepl-host figwheel-options)


Clojure program now takes input parameters for vector size and amount of mappers

--- Code/KMeans/src/main/clojure/hello.clj
+++ Code/KMeans/src/main/clojure/hello.clj
@@ -9,6 +9,9 @@
            [kmeans.parsing DataParser])
   (:gen-class))

+(defn string-to-number [s]
+  ;(Integer/parseInt s))
+  (read-string s))

 (defn work [amount current]
   (if (< amount current)
@@ -23,12 +26,13 @@
       (elapsed (. TimeUnit MILLISECONDS)))))

 (defn partition-workers [vectors, workers]
-  (. (Partitioner.) (partition vectors workers)))
+  (. (Partitioner.) (partition vectors (string-to-number workers))))

 (defn generate-data []
   (. DataGenerator (generateData)))

-(defn generate-means [count]
+(defn generate-random-vectors [count]
+  (println (type count))
   (. DataGenerator (generateRandomVectors count)))

 (defn clustering [data means]
@@ -111,7 +115,7 @@
     (print (. stopwatch
              (stop)
              (elapsed (. TimeUnit MILLISECONDS))))
-    (print-result stopwatch maxIterations nrClusters nrWorkers "")))
+    (print-result stopwatch maxIterations nrClusters (string-to-number nrWorkers) "")))

 (defn run-static-test []
   (let
@@ -121,13 +125,16 @@
     (. ResultWriter (printVectors static-means))
     (. ResultWriter (writeVectorsToDisk static-means, "Clojure"))))

-(defn run-clustering-standard []
+(defn run-clustering-standard [vectors nrWorkers]
   (let
-    [vectors (generate-data)
-     means (generate-means 5)]
-    (run-clustering vectors means, 4, 1))
+    [vectors (generate-random-vectors (string-to-number vectors))
+     means (generate-random-vectors 5)]
+    (run-clustering vectors means, nrWorkers, 10))
   )
+
+; #vectors #mappers
 (defn -main [& args]
-  ;(run-clustering-standard)
-  (run-static-test)
+  (println (first args) (first (rest args)))
+  (run-clustering-standard (first args) (first (rest args)))
+  ;(run-static-test)
   (shutdown-agents))


Fixing build failure from virtual product app.

--- dev-system/project.clj
+++ dev-system/project.clj
@@ -61,6 +61,7 @@
                  [nasa-cmr/cmr-ingest-app "0.1.0-SNAPSHOT"]
                  [nasa-cmr/cmr-metadata-db-app "0.1.0-SNAPSHOT"]
                  [nasa-cmr/cmr-mock-echo-app "0.1.0-SNAPSHOT"]
+                 [nasa-cmr/cmr-virtual-product-app "0.1.0-SNAPSHOT"]
                  [nasa-cmr/cmr-search-app "0.1.0-SNAPSHOT"]
                  [nasa-cmr/cmr-system-int-test "0.1.0-SNAPSHOT"]]


refactored schemas to have a conditonal owner or current-state

--- src-cljs/frontend/analytics/core.cljs
+++ src-cljs/frontend/analytics/core.cljs
@@ -17,26 +17,23 @@
   {:event-type s/Keyword
    (s/optional-key :properties) (s/maybe {s/Keyword s/Any})})

+(defn analytics-event-schema
+  ([] (analytics-event-schema {}))
+  ([schema]
+   (s/conditional :owner (merge schema CoreAnalyticsEvent {:owner s/Any})
+                  :current-state (merge schema CoreAnalyticsEvent {:current-state {s/Any s/Any}}))))
+
 (def AnalyticsEvent
-  (merge
-    CoreAnalyticsEvent
-    (s/either {:owner s/Any}
-              {:current-state {s/Any s/Any}})))
+  (analytics-event-schema))

 (def PageviewEvent
-  (merge
-    AnalyticsEvent
-    {:navigation-point s/Keyword}))
+  (analytics-event-schema {:navigation-point s/Keyword}))

 (def ExternalClickEvent
-  (merge
-    AnalyticsEvent
-    {:event s/Keyword}))
+  (analytics-event-schema {:event s/Keyword}))

 (def BuildEvent
-  (merge
-    AnalyticsEvent
-    {:build {s/Keyword s/Any}}))
+  (analytics-event-schema {:build {s/Keyword s/Any}}))

 ;; Below are the lists of our supported events.
 ;; Events should NOT be view specific. They should be view agnostic and


Fix display on short screens

Fix display on short screens

--- src/braid/client/register/views.cljs
+++ src/braid/client/register/views.cljs
@@ -27,8 +27,8 @@
   [:form.register
    {:display "flex"
     :flex-direction "column"
-    :height "100vh"
-    :padding [["3rem" 0 "1.5rem"]]
+    :min-height "100vh"
+    :padding [["1.5rem" 0]]
     :box-sizing "border-box"
     :justify-content "space-around"}

@@ -207,7 +207,7 @@
            {:background "#f3f3f3"}]

           [:body
-           {:height "100vh"
+           {:min-height "100vh"
             :font-family "Open Sans"
             :max-width "23em"
             :margin "0 auto"


Remove code showing user in search results

It wasn't being triggered anyway

--- src/braid/search/ui/search_page.cljs
+++ src/braid/search/ui/search_page.cljs
@@ -3,10 +3,7 @@
    [re-frame.core :refer [dispatch subscribe]]
    [reagent.core :as r]
    [reagent.ratom :include-macros true :refer-macros [reaction]]
-   [braid.core.client.ui.views.thread :refer [thread-view]]
-   [braid.core.client.ui.views.user-hover-card :refer [user-hover-card-view]]))
-
-(def user-uuid-re #"@([a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12})")
+   [braid.core.client.ui.views.thread :refer [thread-view]]))

 (defn search-page-view
   []
@@ -14,8 +11,6 @@
         threads (subscribe [:threads])
         query (subscribe [:braid.search/query])
         group-id (subscribe [:open-group-id])
-        user-search (some->> @query (re-find user-uuid-re)
-                             second uuid)
        status (cond
                    (@page :search-error?) :error
                    (@page :loading?) :loading
@@ -28,8 +23,7 @@
        [:div.title (str "Search for \"" @query "\"")]
        [:div.content
         [:div.description
-         "Searching..."]
-        (when user-search [user-hover-card-view user-search])]]
+         "Searching..."]]]

       :error
       [:div.page.search
@@ -40,8 +34,7 @@
          {:on-click
           (fn [_]
             (dispatch [:braid.search/search-history! [(@page :query) @group-id]]))}
-         "Try again"]
-        (when user-search [user-hover-card-view user-search])]]
+         "Try again"]]]

       (:done-results :loading)
       (let [loaded-threads (vals (select-keys @threads (@page :thread-ids)))
@@ -90,7 +83,6 @@
                           (= 0 (.-deltaX e) (.-deltaZ e)))
                  (set! (.-scrollLeft this-elt)
                        (- (.-scrollLeft this-elt) (.-deltaY e))))))}
-          (when user-search [user-hover-card-view user-search])
           (doall
             (for [thread sorted-threads]
               ^{:key (:id thread)}
@@ -100,5 +92,4 @@
       [:div.page.search
        [:div.title (str "Search for \"" @query "\"")]
        [:div.content
-        [:div.description "No results."]
-        (when user-search [user-hover-card-view user-search])]])))
+        [:div.description "No results."]]])))


Argument naming consistency

Argument naming consistency

--- src/caesium/magicnonce/secretbox.clj
+++ src/caesium/magicnonce/secretbox.clj
@@ -165,10 +165,10 @@

 (defn decrypt-to-buf!
   "Like [[open-to-buf!]], but with different argument order."
-  [out key nonced-ctext]
-  (open-to-buf! out nonced-ctext key))
+  [m k c]
+  (open-to-buf! m c k))

 (defn decrypt
   "Like [[open]], but with different argument order."
-  [key nonced-ctext]
-  (open nonced-ctext key))
+  [k c]
+  (open c k))


Move the xor impls to a saner place

Move the xor impls to a saner place

--- src/caesium/magicnonce/secretbox.clj
+++ src/caesium/magicnonce/secretbox.clj
@@ -72,20 +72,6 @@
   mutable byte array."
   [plaintext])

-(defn ^:private xor!
-  "Populates `out` with the XOR of matching elements in `a`, `b`.
-
-  All three arrays should be of identical length. Returns `out`."
-  [^bytes out ^bytes a ^bytes b]
-  (dotimes [i (alength a)]
-    (aset-byte out i (bit-xor (aget a i) (aget b i))))
-  out)
-
-(defn ^:private xor-inplace!
-  "XORs elements of array `a` in-place with the matching elem from `b`."
-  [^bytes a ^bytes b]
-  (xor! a a b))
-
 (defn secretbox-det
   "secretbox, with deterministic nonce.

@@ -110,6 +96,19 @@
   To decrypt, use [[decrypt]] or [[open]], depending on which argument order
   you prefer."
   [msg key])
+(defn ^:private xor!
+  "Populates `out` with the XOR of matching elements in `a`, `b`.
+
+  All three arrays should be of identical length. Returns `out`."
+  [^bytes out ^bytes a ^bytes b]
+  (dotimes [i (alength a)]
+    (aset-byte out i (bit-xor (aget a i) (aget b i))))
+  out)
+
+(defn ^:private xor-inplace!
+  "XORs elements of array `a` in-place with the matching elem from `b`."
+  [^bytes a ^bytes b]
+  (xor! a a b))

 (defn secretbox-nmr
   "Encrypt a message like secretbox, but nonce-misuse resistant.