Add state-aggregation and lifecycle calls

--- src/cljs/onyx_cheat_sheet/core.cljs
+++ src/cljs/onyx_cheat_sheet/core.cljs
@@ -175,7 +175,7 @@
     :flow/predicate
     {:doc "When denoted as a keyword, this must be a fully qualified, namespaced keyword pointing to a function on the classpath at runtime. This function takes at least 4 arguments - the Event map, the old segment before `:onyx/fn` was applied, the new segment after `:onyx/fn` was applied, and the sequence of new segments generated by the old semgent. If the old segment generated exactly one segment, and not a sequence of segments, the value of the last parameter will be a collection with only the new segment in it.

-When denoted as a vector of keywords, the first value in the vector  may either be the keyword `:and`, `:or`, or `:not`, or be a keyword as described above. In the latter case, any subsequent values must be keywords that resolve to keys in the flow condition entries map. The values of these keys are resolved and passed as additional parameters to the function. In the former case, the result of the function (which may again be wrapped with a vector to nest logical operators or parameters), is applied with the designated logical operator. This yields predicate composition."
+          When denoted as a vector of keywords, the first value in the vector  may either be the keyword `:and`, `:or`, or `:not`, or be a keyword as described above. In the latter case, any subsequent values must be keywords that resolve to keys in the flow condition entries map. The values of these keys are resolved and passed as additional parameters to the function. In the former case, the result of the function (which may again be wrapped with a vector to nest logical operators or parameters), is applied with the designated logical operator. This yields predicate composition."
      :type [:keyword [:keyword]]
      :optional? false}

@@ -235,7 +235,7 @@
     :window/aggregation
     {:doc "If this value is a keyword, it is a fully qualified, namespaced keyword pointing to a symbol on the classpath at runtime. This symbol must be a map with keys as further specified by the information model. Onyx comes with a handful of aggregations built in, such as `:onyx.windowing.aggregation/min`. See the User Guide for the full list. Users can also implement their own aggregations.

-If this value is a vector, it contain two values: a keyword as described above, and another keyword which represents the key to aggregate over."
+          If this value is a vector, it contain two values: a keyword as described above, and another keyword which represents the key to aggregate over."
      :type [:keyword [:keyword]]
      :optional? false}

@@ -276,6 +276,19 @@
      :type :string
      :optional? true}}

+   :state-aggregation
+   {:aggregation/init {:doc "Fn (window) to initialise the state."
+                       :type :function
+                       :optional? true}
+    :aggregation/fn {:doc "Fn (state, window, segment) to generate a serializable state machine update."
+                     :type :function
+                     :optional? false}
+    :aggregation/super-aggregation-fn {:doc "Fn (state-1, state-2, window) to combine two states in the case of two windows being merged, e.g. session windows."
+                                       :type :function
+                                       :optional? false}
+    :aggregation/apply-state-update {:doc "Fn (state, entry) to apply state machine update entry to a state."
+                                     :type :function
+                                     :optional? false}}
    :trigger-entry
    {:trigger/window-id
     {:doc "The name of a `:window/id` window to fire the trigger against."
@@ -304,7 +317,7 @@
      :type :boolean
      :optional? true
      :default false}
-
+
     :trigger/doc
     {:doc "A docstring for this trigger."
      :type :string
@@ -326,6 +339,29 @@
     {:doc "A docstring for this lifecycle."
      :type :string
      :optional? true}}
+
+   :lifecycle-calls
+    {:lifecycle/start-task? {:doc "A function that takes two arguments - an event map, and the matching lifecycle map. Must return a boolean value indicating whether to start the task or not. If false, the process backs off for a preconfigured amount of time and calls this task again. Useful for lock acquisition. This function is called prior to any processes inside the task becoming active."
+                            :type :function
+                            :optional? true}
+    :lifecycle/before-task-start {:doc "A function that takes two arguments - an event map, and the matching lifecycle map. Must return a map that is merged back into the original event map. This function is called after processes in the task are launched, but before the peer listens for incoming segments from other peers."
+                                  :type :function
+                                  :optional? true}
+    :lifecycle/before-batch {:doc "A function that takes two arguments - an event map, and the matching lifecycle map. Must return a map that is merged back into the original event map. This function is called prior to receiving a batch of segments from the reading function."
+                             :type :function
+                             :optional? true}
+    :lifecycle/after-batch {:doc "A function that takes two arguments - an event map, and the matching lifecycle map. Must return a map that is merged back into the original event map. This function is called immediately after a batch of segments has been read by the peer. The segments are available in the event map by the key `:onyx.core/batch`."
+                            :type :function
+                            :optional? true}
+    :lifecycle/after-task-stop {:doc "A function that takes two arguments - an event map, and the matching lifecycle map. Must return a map that is merged back into the original event map. This function is called before the peer relinquishes its task. No more segments will be received."
+                                :type :function
+                                :optional? true}
+    :lifecycle/after-ack-segment {:doc "A function that takes four arguments - an event map, a message id, the return of an input plugin ack-segment call, and the matching lifecycle map. May return a value of any type which will be discarded. This function is whenever a segment at the input task has been fully acked."
+                                  :type :function
+                                  :optional? true}
+    :lifecycle/after-retry-segment {:doc "A function that takes four arguments - an event map, a message id, the return of an input plugin ack-segment call, and the matching lifecycle map. May return a value of any type which will be discarded. This function is whenever a segment at the input task has been pending for greater than pending-timeout time and will be retried."
+                                    :type :function
+                                    :optional? true}}

    :peer-config
    {:onyx.peer/inbox-capacity
@@ -693,11 +729,23 @@
 (defn lifecycle-entry-options []
   (feature-options model :lifecycle-entry))

+(defn lifecycle-calls-view []
+  (feature-view :lifecycle-calls))
+
+(defn lifecycle-calls-entry-options []
+  (feature-options model :lifecycle-calls))
+
 (defn window-entry-view []
   (feature-view :window-entry))

 (defn window-entry-options []
   (feature-options model :window-entry))
+
+(defn state-aggregation-entry-view []
+  (feature-view :state-aggregation))
+
+(defn state-aggregation-entry-options []
+  (feature-options model :state-aggregation))

 (defn trigger-entry-view []
   (feature-view :trigger-entry))
@@ -757,9 +805,11 @@
                 (n/nav-item {:key 1 :href "#" :on-click #(swap! app-state assoc :view :catalog)} "Catalogs")
                 (n/nav-item {:key 2 :href "#" :on-click #(swap! app-state assoc :view :flow-conditions)} "Flow Conditions")
                 (n/nav-item {:key 3 :href "#" :on-click #(swap! app-state assoc :view :lifecycles)} "Lifecycles")
-                (n/nav-item {:key 4 :href "#" :on-click #(swap! app-state assoc :view :windows)} "Windows")
-                (n/nav-item {:key 5 :href "#" :on-click #(swap! app-state assoc :view :triggers)} "Triggers")
-                (n/nav-item {:key 6 :href "#" :on-click #(swap! app-state assoc :view :peer-config)} "Peer Configuration"))))
+                (n/nav-item {:key 4 :href "#" :on-click #(swap! app-state assoc :view :lifecycle-calls)} "Lifecycle Calls")
+                (n/nav-item {:key 5 :href "#" :on-click #(swap! app-state assoc :view :windows)} "Windows")
+                (n/nav-item {:key 6 :href "#" :on-click #(swap! app-state assoc :view :state-aggregation)} "State / Aggregation")
+                (n/nav-item {:key 7 :href "#" :on-click #(swap! app-state assoc :view :triggers)} "Triggers")
+                (n/nav-item {:key 8 :href "#" :on-click #(swap! app-state assoc :view :peer-config)} "Peer Configuration"))))
              (g/col
               {:xs 18 :md 6}
               (cond (= view :catalog)
@@ -768,8 +818,12 @@
                     (flow-conditions-entry-view)
                     (= view :lifecycles)
                     (lifecycle-entry-view)
+                    (= view :lifecycle-calls)
+                    (lifecycle-calls-view)
                     (= view :windows)
                     (window-entry-view)
+                    (= view :state-aggregation)
+                    (state-aggregation-entry-view)
                     (= view :triggers)
                     (trigger-entry-view)
                     (= view :peer-config)
@@ -787,8 +841,12 @@
                     (flow-condition-entry-options)
                     (= view :lifecycles)
                     (lifecycle-entry-options)
+                    (= view :lifecycle-calls)
+                    (lifecycle-calls-entry-options)
                     (= view :windows)
                     (window-entry-options)
+                    (= view :state-aggregation)
+                    (state-aggregation-entry-options)
                     (= view :triggers)
                     (trigger-entry-options)
                     (= view :peer-config)


git ignore /+project+ file in project root since it is generated by 'cake bin'

--- src/cake/tasks/new.clj
+++ src/cake/tasks/new.clj
@@ -49,7 +49,7 @@
     (spit (file template "project.clj") default-template)
     (log "Created template file: project.clj")
     (spit (file template ".gitignore")
-          (apply str (interleave [".cake" "pom.xml" "*.jar" "*.war" "lib" "classes" "build"] (repeat "\n"))))
+          (apply str (interleave [".cake" "pom.xml" "*.jar" "*.war" "lib" "classes" "build" "/+project+"] (repeat "\n"))))
     (log "Created template file: .gitignore")
     (extract-resource "LICENSE" template)
     (log "Created template LICENSE file (Eclipse Public License)")))


Add handler fn which is dupe of the on-keypress currently in views. Not wired to anything yet.

--- src/cljs/reframe_test/handlers.cljs
+++ src/cljs/reframe_test/handlers.cljs
@@ -30,6 +30,17 @@
     [db [new-name]]               ;; because of trim-v, not [_ new-name]
     new-name))

+(register-handler
+  :act-on-keypress
+  (fn [db [cur-zipper keypress]]
+   (let [_ (println "type " (type (.-keyCode keypress)))
+        keychar (char (.-keyCode keypress))]
+    (println "keychar " keychar)
+    (println "cur-zipper " @cur-zipper)
+    (println "str keypress " (str keypress))
+    ;(println (h/act-on keychar))
+    )))
+
 (register-handler                 ;; handlers changes the footer filter
   :append-node
   (fn                             ;; handler
@@ -38,4 +49,3 @@
       (println "db is " db)
       (assoc db :zipper (h/append zipper)))))

-;TODO :key-press handler


Fix genome size limit in genome_gene_dup.

--- src/clojush/instructions/genome.clj
+++ src/clojush/instructions/genome.clj
@@ -22,7 +22,7 @@
              (not (empty? (:genome state)))
              (not (empty? (stack-ref :genome 0 state)))
              (< (count (first (:genome state)))
-                (/ @global-max-points 2)))
+                (/ @global-max-points 4)))
       (let [genome (stack-ref :genome 0 state)
             index (mod (stack-ref :integer 0 state) (count genome))]
         (->> (pop-item :integer state)
@@ -276,4 +276,3 @@
   ;; pushes false, but is replaced with boolean_rand during
   ;; nondetermistic autoconstruction
   ^{:stack-types [:genome :boolean]} (fn [state] (push-item false :boolean state)))
-


more comments and todos

more comments and todos

--- src/clj/algorithms_clj/macro_initiation.clj
+++ src/clj/algorithms_clj/macro_initiation.clj
@@ -365,6 +365,9 @@

 ;; --------------------------------------------------------
 ;; Example 5-a: Adding logs around functions
+;;
+;; Show that we can extend the language as desired
+;; Macros can help address operational constraints
 ;; --------------------------------------------------------

 (defn log-enter-message
@@ -461,6 +464,9 @@
 ;; Example 6: DFS to do a topological sort
 ;; - You list a bunch of dependencies
 ;; - You get a list of tasks to run
+;;
+;; Show that we can use macro for software architecture
+;;
 ;; Result:
 ;; 1. Simple (re-use topological sort runtime)
 ;; 2. Explicit ordering (not implicit positioning)
@@ -536,12 +542,15 @@
   []
   ((:shut init-shut-sequence)))

+
 ;; --------------------------------------------------------
 ;; Example 7: Generating some code based on data structure
 ;; Something based on description of data model
 ;; - Generate the code to save it
 ;; - Generate the classes
 ;; - Find something else...
+;;
+;; Show that macros can be used at the business level as well
 ;; --------------------------------------------------------

 ;; TODO


Correct ts for entries in reqs.

Correct ts for entries in reqs.

--- src/cbfg/world/t1.cljs
+++ src/cbfg/world/t1.cljs
@@ -219,7 +219,7 @@
               prog-res (try (js/eval prog-js) (catch js/Object ex ex))]
           (go-loop [num-requests 0 num-responses 0]
             (let [[v ch] (alts! [req-ch (:res-ch @prog-base)])
-                  ts (:ts @prog-curr)]
+                  ts (inc (:ts @prog-curr))]
               (when v
                 (if (= ch req-ch)
                   (if (= (:op v) "replay")


Whitespace.

Whitespace.

--- src/cbfg/world/t1.cljs
+++ src/cbfg/world/t1.cljs
@@ -7,7 +7,7 @@
             [om.dom :as dom :include-macros true]
             [cbfg.vis :refer [listen-el get-el-value get-el-innerHTML]]))

-;; How to assign locations to world entities before rendering?
+;; TODO: How to assign locations to world entities before rendering?

 (def run-controls
   (atom {:controls
@@ -67,9 +67,7 @@
 (defn render-controls[app owner]
      (apply dom/ul nil
             (map (fn [[k v]]
-                   (dom/li nil
-                           (dom/button #js {:onClick v}
-                                       k)))
+                   (dom/li nil (dom/button #js {:onClick v} k)))
                  (:controls app))))

 (defn render-world [app owner]


small refactor to db to make thread-last-open more flexible

--- src/chat/server/db.clj
+++ src/chat/server/db.clj
@@ -457,7 +457,7 @@
        (map first)
        set))

-(defn thread-add-last-open-at [thread user-id]
+(defn thread-last-open-at [thread user-id]
   (let [user-hides-at (->> (d/q
                              '[:find [?inst ...]
                                :in $ ?thread-id ?user-id
@@ -474,7 +474,10 @@
                               (filter (fn [m] (= (m :user-id) user-id)))
                               (map :created-at)
                               (map (fn [t] (.getTime t))))]
-  (assoc thread :last-open-at (apply max (concat [0] user-hides-at user-messages-at)))))
+    (apply max (concat [0] user-hides-at user-messages-at))))
+
+(defn thread-add-last-open-at [thread user-id]
+  (assoc thread :last-open-at (thread-last-open-at thread user-id)))

 (defn update-thread-last-open [thread-id user-id]
   (when (seq (d/q '[:find ?t


Refactor airbrake into its own function, don't send airbrake notifies when running tests

--- src/circle/workers.clj
+++ src/circle/workers.clj
@@ -5,7 +5,7 @@
   (:use [clojure.tools.logging :only (infof errorf error)])
   (:require [circle.ruby :as ruby])
   (:use midje.sweet)
-  (:require [clj-airbrake.core :as airbrake])
+  (:use [circle.airbrake :only (airbrake)])
   (:require [circle.env :as env])
   (:require [fs]))

@@ -33,7 +33,7 @@
          result#)
        (catch Exception e#
          (error e# "%s threw" (quote ~@body))
-         (airbrake/notify "3ccfad1720b6acd8c82e9b30d4b95a30" env/env (fs/cwd) e# {:body (quote ~@body) :future true :url "http://fakeurl.com"})
+         (airbrake {:body (quote ~@body) :future true})
          (throw e#)))))

 (fact "log-future returns futures"


Debug when game finishes

Debug when game finishes

--- src/clj/ji/service.clj
+++ src/clj/ji/service.clj
@@ -81,7 +81,9 @@
         game-env (atom (game-env/create-game-env game-id game join-chan))
         game-chan (go-game game-env)]
     (swap! game-envs assoc game-id game-env)
-    (go (<! game-chan) (swap! game-envs dissoc game-id))
+    (go (let [finshed-game (<! game-chan)]
+          (println ("GAME FINISH" finished-game))
+          (swap! game-envs dissoc (:id finshed-game))))
     game-env))

 (let [cs (vec "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")]


Proper SAP routing

Proper SAP routing

--- src/clj/ndt/server.clj
+++ src/clj/ndt/server.clj
@@ -38,11 +38,11 @@
   (context "/api" []
     (defroutes api-routes
       (POST "/login" {body :body} (authenticate body))))
-  (GET "/" _
+  (resources "/")
+  (GET "*" _
     {:status 200
      :headers {"Content-Type" "text/html; charset=utf-8"}
-     :body (io/input-stream (io/resource "public/index.html"))})
-  (resources "/"))
+     :body (io/input-stream (io/resource "public/index.html"))}))

 (def auth-backend (jws-backend {:secret secret :options {:alg :hs512}}))


Tick search should bail out if range is non-numeric or has length zero to avoid an infinite loop. Closes #33.

--- src/cljx/c2/ticks.cljx
+++ src/cljx/c2/ticks.cljx
@@ -24,10 +24,10 @@
   "Objective function modeling niceness of step sizes and whether a range includes zero"
   [q j label-range-contains-zero]
   (let [v (if label-range-contains-zero 1 0)]
-    (if (<= (count Q) 1)
-      (+ (- 1 j) v)
-      (+ (- 1 (/ (index-of q Q) (dec (count Q))) j)
-         v))))
+      (if (<= (count Q) 1)
+        (+ (- 1 j) v)
+        (+ (- 1 (/ (index-of q Q) (dec (count Q))) j)
+           v))))

 (defn max-simplicity [q j] (simplicity q j true))

@@ -42,10 +42,10 @@
   "When the label range is centered on the data range"
   [d-min d-max span]
   (let [d-range (- d-max d-min)]
-    (if (> span d-range)
-      (- 1 (sq (/ (- span d-range)
-                  (* 0.2 d-range))))
-      1)))
+      (if (> span d-range)
+        (- 1 (sq (/ (- span d-range)
+                    (* 0.2 d-range))))
+        1)))

 (defn density
@@ -65,10 +65,10 @@
   "Balance the relative merits of different metrics"
   [[simplicity coverage density legibility]]
   (let [w [0.2 0.25 0.5 0.05]]
-    (+ (* simplicity (w 0))
-       (* coverage (w 1))
-       (* density (w 2))
-       (* legibility (w 3)))))
+      (+ (* simplicity (w 0))
+         (* coverage (w 1))
+         (* density (w 2))
+         (* legibility (w 3)))))

@@ -93,55 +93,60 @@
                          length         500
                          clamp?         false}}]

+  (if-not (and (number? d-min) (number? d-max)
+               (not= d-min d-max))
+    ;;Return empty shape
+    {:extent 0 :min d-min :max d-max :ticks []}
+
+    ;;Calculate ticks
+    (let [best-score (atom -2)
+          label (atom {})]

-  (let [best-score (atom -2)
-        label (atom {})]
+        (iter {for q in Q}

-    (iter {for q in Q}
+              (iter {for j from 1}
+                    {for ms = (max-simplicity q j)}
+                    {return-if (< (w [ms 1 1 1]) @best-score)}

-          (iter {for j from 1}
-                {for ms = (max-simplicity q j)}
-                {return-if (< (w [ms 1 1 1]) @best-score)}
+                    (iter {for k from 2}
+                          {for md = (max-density (/ k length) target-density)}
+                          {return-if (< (w [ms 1 md 1]) @best-score)}

-                (iter {for k from 2}
-                      {for md = (max-density (/ k length) target-density)}
-                      {return-if (< (w [ms 1 md 1]) @best-score)}
+                          (let [delta ;;power of ten by which to multiply the step size
+                                (/ (- d-max d-min)
+                                   (* (inc k) j k))]
+                              (iter {for z from (ceil (log10 delta))}
+                                    {for l-step = (* q j (expt 10 z))}
+                                    {for mc = (max-coverage d-min d-max (* (dec k) l-step))}
+                                    {return-if (< (w [ms mc md 1]) @best-score)}

-                      (let [delta ;;power of ten by which to multiply the step size
-                            (/ (- d-max d-min)
-                               (* (inc k) j k))]
-                        (iter {for z from (ceil (log10 delta))}
-                              {for l-step = (* q j (expt 10 z))}
-                              {for mc = (max-coverage d-min d-max (* (dec k) l-step))}
-                              {return-if (< (w [ms mc md 1]) @best-score)}
+                                    (iter {for start
+                                           from (- (floor (/ d-max l-step))
+                                                   (dec k))
+                                           to (/ d-min l-step)
+                                           by (/ 1 j)}
+                                          {for l-min = (* start l-step)}
+                                          {for l-max = (+ l-min (* (dec k) l-step))}
+                                          {for s = (simplicity q j (label-range-contains-zero? l-min l-max l-step))}
+                                          {for c = (coverage d-min d-max l-min l-max)}
+                                          {for d = (density (/ k length) target-density)}
+                                          {for score = (w [s c d 1])}
+                                          {return-if (< score @best-score)}

-                              (iter {for start
-                                     from (- (floor (/ d-max l-step))
-                                             (dec k))
-                                     to (/ d-min l-step)
-                                     by (/ 1 j)}
-                                    {for l-min = (* start l-step)}
-                                    {for l-max = (+ l-min (* (dec k) l-step))}
-                                    {for s = (simplicity q j (label-range-contains-zero? l-min l-max l-step))}
-                                    {for c = (coverage d-min d-max l-min l-max)}
-                                    {for d = (density (/ k length) target-density)}
-                                    {for score = (w [s c d 1])}
-                                    {return-if (< score @best-score)}
+                                          ;;(println "inner loop")
+                                          ;;todo, optimize legibility

-                                    ;;(println "inner loop")
-                                    ;;todo, optimize legibility
-
-                                    (reset! best-score score)
-                                    (reset! label {:min l-min
-                                                   :max l-max
-                                                   :step l-step})))))))
-    (let [l @label
-          extent [(if clamp? d-min (min (:min l) d-min))
-                 (if clamp? d-max (max (:max l) d-max))]]
-      {:extent extent
-       :min (first extent) :max (second extent)
-       :ticks (filter #(within? % extent)
-                      (irange (:min l) (:max l) (:step l)))})))
+                                          (reset! best-score score)
+                                          (reset! label {:min l-min
+                                                         :max l-max
+                                                         :step l-step})))))))
+      (let [l @label
+            extent [(if clamp? d-min (min (:min l) d-min))
+                    (if clamp? d-max (max (:max l) d-max))]]
+          {:extent extent
+           :min (first extent) :max (second extent)
+           :ticks (filter #(within? % extent)
+                          (irange (:min l) (:max l) (:step l)))}))))

 (comment
   (search [0.0 5000.0]


Add missing forward declaration

Add missing forward declaration

--- src/cljx/revue/vm.cljx
+++ src/cljx/revue/vm.cljx
@@ -126,12 +126,12 @@
 ;;; =============================

 ;;; We need to have the VM instructions available for the assembler,
-;;; thus we define the `assemble` function after the VM instructions.
-;;; However, for some instructions it is convenient to have `assemble`
-;;; available (e.g., for `CC`), so we provide a forward declaration
-;;; here.
-
-(declare assemble)
+;;; thus we define the `assemble` and `assemble-inst` functions after
+;;; the VM instructions. However, for some instructions it is
+;;; convenient to have these functions available (e.g., for `CC`), so
+;;; we provide a forward declaration here.
+
+(declare assemble assemble-inst)

 ;;; VM Instructions
 ;;; ===============


Now it compiles

Now it compiles

--- src/cloogling/core.clj
+++ src/cloogling/core.clj
@@ -1,6 +1,6 @@
 (ns cloogling.core)

-(defn foo
-  "I don't do a whole lot."
+(defn get-entries
+  "Get results from json data retrieved from engine"
   [x]
-  (println x "Hello, World!"))
+  x)


nrepl -- apply view to query output

nrepl -- apply view to query output

--- src/com/billpiel/sayid/nrepl_middleware.clj
+++ src/com/billpiel/sayid/nrepl_middleware.clj
@@ -403,8 +403,8 @@
         k (keyword sk)
         n (util/->int sn)
         query (remove nil? [k n q-vec])]
-    (-> (apply sd/ws-query* query)
-        so/tree->text-prop-pair)))
+    (sd/with-view (-> (apply sd/ws-query* query)
+                      so/tree->text-prop-pair))))

 (defn ^:nrepl sayid-buf-query-id-w-mod
   [{:keys [trace-id mod] :as msg}]


fixed #134

fixed #134

--- src/frontend/core.cljs
+++ src/frontend/core.cljs
@@ -88,7 +88,7 @@

 (.change (js/$ "#file-upload")
   (fn [e]
-    (let [file (aget (.-files (.-target e)) 0)]
+    (if-let [file (aget (.-files (.-target e)) 0)]
       (check-hash file))))

 (.click (js/$ "#clear-songs-button")


add min-cut v0.1

add min-cut v0.1

--- src/gecf/connected.clj
+++ src/gecf/connected.clj
@@ -48,4 +48,21 @@

 "

+(defn min-cut [g fm start] ;;vd: visited; c: cur; s: successor
+  (let [rsd (partial residual g fm)
+        scs (partial succs g)
+        ;; uses recursion for dfs stack; simpler...
+        dfs (fn dfs [vd c] (reduce #(if (or (%1 %2) (= 0 (rsd c %2))) ;; already visited or zero residual: ignore
+                                      %1
+                                      (dfs %1 %2)) (conj vd c) (scs c)))
+        vd (dfs #{} start)
+        ]
+    (for [c vd      ;; cut is edges from visited to not visited
+          s (scs c)
+          :when (not (vd s))]
+      [c s])))

+
+
+
+


Factor out projection code

Factor out projection code

This will make it easy to swap between a flat projection and the fisheye
one.

--- src/graphito/core.cljs
+++ src/graphito/core.cljs
@@ -33,9 +33,8 @@
 (def displacement-factor 1)

 (def max-radius 32)
-(def min-radius 2)
-(def edge-buffer (+ min-radius 3))
-
+
+(def zoom-out-scale 0.25)

 ;; SVG setup

@@ -123,19 +122,18 @@
     (<= 1.5 t 2.5) (+ 0.875 (/ (- t 1.5) 8))
     :else 1))

-(defn view-position [state pos]
+(defn view-position [state pos projector]
   (let [{:keys [view-size camera-pos]} state
         view-center (scalar-multiply view-size 0.5)
         corner-distance (vec-length view-center)
         displacement (subtract-vec pos camera-pos)
         r (scaled-distance-from-camera state pos)
-        projected-r (project-displacement r)]
+        projected-r (projector r)]
     (add-vec view-center
              (scalar-multiply displacement (/ projected-r r)))))

 (defn project-radius [t]
-  (+ min-radius (* (- max-radius min-radius)
-                   (min 1 (/ 1 (.pow js/Math 2 (* 2 (- t 0.25))))))))
+  (* max-radius (min 1 (/ 1 (.pow js/Math 2 (* 2 (- t 0.25)))))))

 (defn project-opacity [t]
   (cond
@@ -144,10 +142,23 @@
     (<= 2 t 3) (- 0.75 (* 0.75 (- t 2)))
     :else 0))

+(def fisheye-projectors {:project-displacement project-displacement
+                         :project-radius project-radius
+                         :project-opacity project-opacity})
+
+(def zoom-out-projectors {:project-displacement (partial * zoom-out-scale)
+                          :project-radius (constantly (* zoom-out-scale max-radius))
+                          :project-opacity (constantly 1)})
+
 (defn sync-graph! [state]
   (let [{:keys [svg nodes links camera-pos view-size]} state
+        {:keys [project-displacement
+                project-radius
+                project-opacity]} fisheye-projectors
         positions (mapv (fn [node]
-                          (view-position state (:pos node))) nodes)
+                          (view-position state
+                                         (:pos node)
+                                         project-displacement)) nodes)
         distances-from-camera
         (mapv (fn [node]
                 (scaled-distance-from-camera state (:pos node))) nodes)]


log create-game

log create-game

--- src/greybear/model.clj
+++ src/greybear/model.clj
@@ -18,6 +18,7 @@
 (ns greybear.model
   (:require [clojure.java.jdbc :as jdbc])
   (:use [clojure.string :only [split]]
+        [clojure.tools.logging :as log]
         [korma db core]
         [cemerick.friend.credentials :only [hash-bcrypt bcrypt-verify]]
         [greybear.utils :only [place-stone parse-int]]))
@@ -185,11 +186,13 @@
 (defn create-game
   "Start a new game between two players, returns the new game's id"
   [black white]
-  (:id (insert games
+  (let [game-id (:id (insert games
                (values {:stones starting-stones
                         :white_id white
                         :black_id black
-                        :active true}))))
+                        :active true})))]
+    (log/info "Game" game-id "created between" black "and" white)
+    game-id))

 (defn make-move
   "Make a new move in a game


api: hand-over correct struct to resolution

--- src/io/cyanite/api.clj
+++ src/io/cyanite/api.clj
@@ -92,6 +92,7 @@
         to    (or (parse-time to) (now!))
         paths (->> (mapcat (partial index/prefixes index)
                            (if (sequential? path) path [path]))
+                   (map :path)
                    (map (partial engine/resolution engine from))
                    (remove nil?))]
     (store/query! store from to paths)))


Implement "src" and "artifact" modes in loader

--- src/leiningen/grim.clj
+++ src/leiningen/grim.clj
@@ -9,9 +9,26 @@
    '[me.arrdem/detritus "0.2.0"]])

 (defn grim
-  [project & args]
-  (let [args (concat ((juxt :group :name :version) project) args)]
+  "Usage: lein grim src <dst>
+      : lein grim artifact <groupid> <artifactid> <version> <dst>
+
+In source mode, lein-grim traverses the source paths of the current project,
+enumerating and documenting all namespaces. This is intended for documenting
+projects for which you have both source and a lein project.
+
+In artifact mode, lein-grim traverses an artifact on the classpath enumerating
+and documenting the namespaces therein. This is intended for documenting
+projects such as clojure.core which may not exist as a covenient lein project
+but which do exist as artifacts."
+  [project mode & args]
+  {:pre [(#{"src" "artifact"} mode)]}
+  (let [args (if (= "src" mode)
+               (concat ((juxt :group :name :version) project) args)
+               args)
+        paths (if (= "src" mode)
+                (vec (:source-paths project))
+                :classpath)]
     (eval-in-project
      (update-in project [:dependencies] concat deps)
      `(do (require 'grimoire.doc)
-          (grimoire.doc/-main ~@args)))))
+          (grimoire.doc/-main ~@args ~paths)))))


Strip "tag:" prefixes off of refs in 'parse-sha-refs.

--- src/leiningen/voom.clj
+++ src/leiningen/voom.clj
@@ -326,7 +326,7 @@
   (let [[sha datestr parents refstr] (vec (.split #"," s 4))
         refs (when refstr
                (when-let [[_ x] (re-find #"\((.*)\)" refstr)]
-                 (vec (.split #",\s+" x))))]
+                 (mapv #(s/replace % #"^tag: " "") (.split #",\s+" x))))]
     {:sha sha, :ctime (Date. ^String datestr), :parents parents, :refs refs}))

 (defn project-change-shas


Adding point-filtering style query.

Adding point-filtering style query.

This is known to be wrong but will serve as a basis for our new query.

--- src/leiningen/voom.clj
+++ src/leiningen/voom.clj
@@ -1238,6 +1238,80 @@
   (time (p-repos (fn [p] (updated-git-db p)))))

+;; ===== point filtering query =====
+
+(defn bm-newest-voom-ver-by-spec
+"
+- given a particular projname at a path and version criteria
+- for each branch separately
+- find stop points matching projname, path and version criteria (oldver matches, newver doesn't)
+- find start points matching projname, path and version criteria (newver matches, oldver don't care)
+- find project paths matching path
+- find stop points, parenter to branch
+- find start points, parenter to branch
+- find project paths, parenter to branch
+- find project paths, childer to some start point and not childer to any stop point
+- find project paths with no childer project paths
+"
+  [db shabam proj-name {:keys [version repo branch path allow-snaps]
+                     :or {version "" allow-snaps true}}]
+  (for [gitdir (all-repos-dirs)
+        :when (or (nil? repo) (= repo (-> (remotes gitdir) :origin :fetch)))
+        :let [ptn (s/join "--" ["voom"
+                                (str (namespace proj-name) "%" (name proj-name))
+                                (str version "*")])
+              tags (set (:lines (git {:gitdir gitdir} "tag" "--list" ptn)))
+              tspecs (if (= tags [""])
+                       []
+                       (map parse-tag tags))
+              paths (set (map :path tspecs))]
+        found-path paths
+        :when (or (= found-path path) (nil? path))
+        found-branch (origin-branches gitdir)
+        :when (or (= found-branch branch) (nil? branch))
+        :let [branch-sha (first (q db [?sha] (r-branch repo found-branch ?sha)))
+              not-matches-spec? (complement version-in-range?) ;; needed for l/pred
+              ver-stop-pts (->>
+                            (q db [?sha]
+                               (l/fresh [ver pver]
+                                        (r-proj ?sha found-path proj-name ver pver _)
+                                        (l/pred not-matches-spec? [version ver])
+                                        (l/pred version-in-range? [version pver])))
+                            (into #{}))
+              {:keys [snap-stop-pts all-start-pts]}
+              , (->>
+                 (q db [?sha ?snaps]
+                    (l/fresh [ver]
+                             (r-proj ?sha found-path proj-name ver _ ?snaps)
+                             (l/pred version-in-range? [version ver])))
+                 (group-by second)
+                 (map (fn [[k v]]
+                        [(get {true :snap-stop-pts} k :all-start-pts)
+                         v])))
+              all-stop-pts (into #{} (concat ver-stop-pts snap-stop-pts))
+              all-proj-pts (->>
+                            (q db [?sha] (r-commit-path ?sha found-path))
+                            (into #{}))
+              branch-stop-pts (sha-ancestors shabam branch-sha all-stop-pts)
+              branch-start-pts (sha-ancestors shabam branch-sha all-start-pts)
+              branch-proj-pts (sha-ancestors shabam branch-sha all-proj-pts)
+              ;; need to consider stops that are successor of each found start point
+              valid-proj-pts (filter #(and (< 0 (sha-successors shabam % branch-start-pts))
+                                           (= 0 (sha-successors shabam % branch-stop-pts)))
+                               branch-proj-pts)
+              ;; Do we find starting points if they are the most recent thing?...
+              latest-proj-pts (filter #(= 0 (sha-successors shabam % valid-proj-pts))
+                               valid-proj-pts)]
+        sha latest-proj-pts
+        :let [ctime (first (q db [ctime] (r-commit sha ctime _ _)))
+              ver (:version (robust-read-project gitdir sha found-path))]]
+    {:sha sha
+     :ctime ctime
+     :version ver
+     :path found-path
+     :proj proj-name
+     :gitdir gitdir
+     :branch found-branch}))

 (def subtasks [#'build-deps #'deploy #'find-box #'freshen #'install
                #'retag-all-repos #'update-repo-dbs #'ver-parse #'wrap])


insights: styling touchup

insights: styling touchup

--- src-cljs/frontend/components/insights.cljs
+++ src-cljs/frontend/components/insights.cljs
@@ -39,7 +39,7 @@
                                  builds))
         svg-width 900
         svg-height 180
-        margins {:top 30, :right 10, :bottom 0, :left 70}
+        margins {:top 30, :right 10, :bottom 10, :left 70}
         width (- svg-width (:left margins) (:right margins))
         height (- svg-height (:top margins) (:bottom margins))
         y-scale (-> (js/d3.scale.linear)


small focus tweak

small focus tweak

--- src/main/shadow/cljs/ui/components/inspect.cljs
+++ src/main/shadow/cljs/ui/components/inspect.cljs
@@ -45,6 +45,7 @@
         (codemirror {:value val
                      :clojure (not= attr ::m/object-as-str)
                      :cm-opts {:tabindex (if active? 0 -1)
+                               :readOnly true
                                :autofocus false}})
         ;; not using codemirror initially since it wants to treat "Loading ..." as clojure code
         (<< [:div.w-full.h-full.font-mono.border-t.p-4
@@ -421,7 +422,9 @@

                   ;; (js/console.log "focusing" active-panel-el kb-focus)

-                  (when kb-focus
+                  ;; never autofocus codemirror textarea since that will consume all future keyboard
+                  ;; events and isn't easy to nav out of yet?
+                  (when (and kb-focus (not= (.-tagName kb-focus) "TEXTAREA"))
                     ;; this probably violates all ARIA guidelines but don't know how else to
                     ;; shift focus from the otherwise not visible panels?
                     (.focus kb-focus))


fix osc metadata

fix osc metadata

--- src/overtone/sc/machinery/ugen/metadata/osc.clj
+++ src/overtone/sc/machinery/ugen/metadata/osc.clj
@@ -336,12 +336,12 @@
               {:name "saw-freq",
                :default 440.0
                :doc "Frequency of the slave synched sawtooth
-                     wave. sawFreq should always be greater than
-                     syncFreq." }]
+                     wave. saw-freq should always be greater than
+                     sync-freq." }]
        :muladd true
        :rates #{:ar :kr}
        :doc "A sawtooth wave that is hard synched to a fundamental
-             apitch. This produces an effect similar to moving formants
+             pitch. This produces an effect similar to moving formants
              or pulse width modulation. The sawtooth oscillator has its
              phase reset when the sync oscillator completes a
              cycle. This is not a band limited waveform, so it may


Worked over c.c.gui.editors.contexts

Worked over c.c.gui.editors.contexts

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

--- src/conexp/contrib/gui/editors/contexts.clj
+++ src/conexp/contrib/gui/editors/contexts.clj
@@ -5,6 +5,8 @@
 ;; By using this software in any fashion, you are agreeing to be bound by
 ;; the terms of this license.
 ;; You must not remove this notice, or any other, from this software.
+
+;; This file has been written by Immanuel Albrecht, with modifications by DB

 (ns conexp.contrib.gui.editors.contexts
   (:use conexp.base
@@ -20,7 +22,7 @@
         [conexp.contrib.gui.editors.context-editor.util :only (get-current-second-operand-context)]
 	conexp.contrib.gui.plugins.base)
   (:use clojure.contrib.swing-utils
-	clojure.contrib.io
+	[clojure.contrib.io :exclude (spit)]
         [clojure.contrib.string :only (replace-str title-case)])
   (:import [java.io File]))

@@ -58,7 +60,7 @@
              "Context")))

 (defn- second-op-context-and-go
-  "Creates a random context and adds a new tab with a context-editor."
+  "Show the current second operand context in a new tab."
   [frame]
   (let [thing (get-current-second-operand-context)]
     (add-tab frame
@@ -87,20 +89,20 @@
 (defvar- *context-menu*
   {:name "Context",
    :content [{:name "Load Context",
-	      :handler (fn [x] (load-context-and-go x read-context))},
+	      :handler #(load-context-and-go % read-context)},
              {:name "Random Context",
               :handler random-context-and-go},
              {:name "Second Operand Context",
               :handler second-op-context-and-go},
              {}
              {:name "Save Context",
-              :content (vec (map (fn [x] {:name (str
-                                                  (replace-str ":" "" (str x))
-                                                  " format"),
-                                          :handler (fn [f]
-                                                     (save-context-and-go f
-                                                                          (fn [c p]
-                                                                            (write-context x c p))))})
+              :content (vec (map (fn [format]
+                                   {:name (str (replace-str ":" "" (str format))
+                                               " format"),
+                                    :handler (fn [frame]
+                                               (save-context-and-go frame
+                                                                    (fn [ctx path]
+                                                                      (write-context format ctx path))))})
                                  (list-context-formats)))},
              {}
              {:name "Show Concept Lattice",


Fix people selection for v3 of the model

--- frontend/src/faceboard/views/boards/people.cljs
+++ frontend/src/faceboard/views/boards/people.cljs
@@ -188,7 +188,7 @@

 (defcomponent countries-filter-component [data _ _]
   (render [_]
-    (let [people (:content data)
+    (let [people (get-in data [:content :people])
           expanded-filters (get-in data [:ui :filters :expanded-set])
           expanded? (contains? expanded-filters :countries)
           selected-countries (get-in data [:ui :filters :active :countries])
@@ -210,7 +210,7 @@
                                                              :report       report}))))))))))
 (defcomponent tags-filter-component [data _ _]
   (render [_]
-    (let [people (:content data)
+    (let [people (get-in data [:content :people])
           expanded? (contains? (get-in data [:ui :filters :expanded-set]) :tags)
           tags-tally (build-tags-tally people)
           selected-tags (get-in data [:ui :filters :active :tags])
@@ -232,7 +232,7 @@

 (defcomponent socials-filter-component [data _ _]
   (render [_]
-    (let [people (:content data)
+    (let [people (get-in data [:content :people])
           expanded? (contains? (get-in data [:ui :filters :expanded-set]) :socials)
           socials-tally (build-socials-tally people)
           selected-socials (get-in data [:ui :filters :active :socials])


cleanup tasks, make them cooperate better

--- src/migae/boot_gae.clj
+++ src/migae/boot_gae.clj
@@ -8,8 +8,7 @@
             [boot.pod :as pod]
             [boot.core :as core]
             [boot.util :as util]
-            [boot.task.built-in :as builtin]
-            )
+            [boot.task.built-in :as builtin])
   (:import [com.google.appengine.tools KickStart]
            [java.io File]
            [java.net URL URLClassLoader]))
@@ -45,13 +44,12 @@
                                {} boot.user/gae)))
                                ;; {} (:gae (core/get-env)))))

-(def web-inf-dir (str (:build-dir config-map) "/WEB-INF"))
-(println "web-inf-dir: " web-inf-dir)
-(println "build-dir: " (:build-dir config-map))
+;;(str (:build-dir config-map)
+(def web-inf-dir "WEB-INF")
+
 (def classes-dir (str web-inf-dir "/classes"))
-(println "classes-dir: " classes-dir)
-
-(defn lib-dir [] (str (:build-dir config-map) "/WEB-INF/lib"))
+
+(defn lib-dir [] "WEB-INF/lib")

 (def appcfg-class "com.google.appengine.tools.admin.AppCfg")

@@ -203,31 +201,12 @@
       ;; Thread.currentThread().setContextClassLoader(appengineClassloader)
       (.setContextClassLoader (Thread/currentThread) gae-class-loader))))

-(core/deftask foo "" []
+#_(core/deftask foo "" []
   (core/with-pre-wrap [fs]
     (println "FS: " (type fs))
     (let [asset-files (->> fs core/output-files (core/by-ext [".clj"]))]
          (doseq [asset asset-files] (println "foo" asset)))
     fs))
-
-;;(assoc fs :input-files (merge (:input-files fs) {"WEB-INF/classes/foo/bar.clj" "foo/bar.clj"}))
-
-(core/deftask XassetsX
-  "copy assets to build-dir"
-  [v verbose bool "Print trace messages"]
-  (core/with-pre-wrap [fs]
-    (let [tgt (core/tmp-dir!)
-          in-files (->> fs
-                        core/output-files
-                        (core/not-by-ext [".clj"])
-                        (map (juxt core/tmp-path core/tmp-file)))]
-      (doseq [[rel-path in-file] in-files]
-        (let [out-file (doto (io/file tgt (str rel-path "/foo")) io/make-parents)]
-          (println "     in-file: " in-file)
-          (println "tmp out-file: " out-file)
-          (core/cp fs in-file out-file)))
-      (core/add-asset fs tgt)
-      (core/commit! fs))))

 (core/deftask assets
   "copy assets to build-dir"
@@ -242,7 +221,7 @@
                           :ico  #"(.*ico$)"
                           :js  #"(.*js$)"
                           ""))
-        dest (if odir odir "WEB-INF")
+        dest (if odir odir "./")
         arg {regex (str dest "/$1")}]
     (builtin/sift :move arg)))

@@ -269,7 +248,7 @@
                  (condp = log
                    :jul web-inf-dir
                    :log4j classes-dir
-                   nil (:build-dir config-map)
+                   nil web-inf-dir
                    (throw (IllegalArgumentException. (str "Unrecognized :log value: " log)))))
         out-path (condp = log
                    :log4j "log4j.properties"
@@ -277,7 +256,7 @@
                    nil  "logging.properties")
         mv-arg {(re-pattern out-path) (str odir "/$1")}]
     ;; (println "STENCIL: " content)
-    (println "mv pattern: " mv-arg)
+    ;; (println "mv pattern: " mv-arg)
     (comp
      (core/with-pre-wrap fs
        (let [tmp-dir (core/tmp-dir!)
@@ -293,58 +272,33 @@
      ;;                          (str (:build-dir config-map) "/WEB-INF"))}
      ;;                 :no-clean true))))

-(core/deftask config-servlets
-  "configure gae servlets"
-  [s clj bool "Save intermediate generated .clj file"
+(core/deftask config
+  "configure gae xml config files"
+  [d dir DIR str "output dir"
    v verbose bool "Print trace messages."]
-  (print-task "config-servlets" *opts*)
-  (let [content (stencil/render-file "migae/boot_gae/servlets.mustache" config-map)
-        servlet-ns (:servlet-ns config-map)]
-    (println "STENCIL: " content)
-    ;;(builtin/show :fileset true)
-    (comp
-     ;; step 1: process template, put result in new Fileset
-     (core/with-pre-wrap fileset
-       (let [tmp-dir (core/tmp-dir!)
-             out-path (str (str/replace servlet-ns #"\.|-" {"." "/" "-" "_"}) ".clj")
-             _ (println "out-path: " out-path)
-             out-file (doto (io/file tmp-dir out-path) io/make-parents)
-             ]
-         (spit out-file content)
-         (-> fileset (core/add-resource tmp-dir) core/commit!)))
-     (builtin/aot :namespace #{(:servlet-ns config-map)})
-     (builtin/sift :include (if clj #{#".*\.class"  #"\.clj$"} #{#"\.class$"}))
-     (builtin/target :dir #{classes-dir}
-                     :no-clean false)
-       #_(builtin/show :fileset true)
-       #_(core/reset-fileset fileset)
-       #_fileset)))
-
-(core/deftask config-xml
-  "configure gae xml config files"
-  [v verbose bool "Print trace messages."]
   (print-task "config" *opts*)

   ;; TODO: implement defaults
   (let [web-xml (stencil/render-file "migae/boot_gae/xml.web.mustache" config-map)
-        appengine-xml (stencil/render-file "migae/boot_gae/xml.appengine-web.mustache" config-map)]
+        appengine-xml (stencil/render-file "migae/boot_gae/xml.appengine-web.mustache" config-map)
+        odir (if dir dir web-inf-dir)]
     ;; (println "STENCIL: " web-xml)
     (comp
      ;; step 1: process template, put result in new Fileset
      (core/with-pre-wrap fileset
        (let [tmp-dir (core/tmp-dir!)
-             web-xml-out-path "web.xml"
+             web-xml-out-path (str odir "/web.xml")
              web-xml-out-file (doto (io/file tmp-dir web-xml-out-path) io/make-parents)
-             appengine-xml-out-path "appengine-web.xml"
+             appengine-xml-out-path (str odir "/appengine-web.xml")
              appengine-xml-out-file (doto (io/file tmp-dir appengine-xml-out-path) io/make-parents)
              ]
          (spit web-xml-out-file web-xml)
          (spit appengine-xml-out-file appengine-xml)
-         (-> (core/new-fileset) (core/add-resource tmp-dir) core/commit!)))
-
-     ;; step 3: commit new .xml
-     (builtin/target :dir #{(str (:build-dir config-map) "/WEB-INF")}
-                     :no-clean true))))
+         (-> fileset (core/add-resource tmp-dir) core/commit!))))))
+
+     ;; ;; step 3: commit new .xml
+     ;; (builtin/target :dir #{(str (:build-dir config-map) "/WEB-INF")}
+     ;;                 :no-clean true))))

 (core/deftask deploy
   "Installs a new version of the application onto the server, as the default version for end users."
@@ -418,9 +372,9 @@
   (print-task "deps" *opts*)
   (println "libdir" (lib-dir))
   (comp (builtin/uber :as-jars true)
-        (builtin/sift :include #{#"jar$"})
-        (builtin/target :dir #{(lib-dir)}
-                        :no-clean true)))
+        #_(builtin/sift :include #{#"jar$"})))
+        ;; (builtin/target :dir #{(lib-dir)}
+        ;;                 :no-clean true)))
 ;;  (core/reset-fileset))

 (core/deftask install-sdk
@@ -544,6 +498,53 @@

     ))))

+(core/deftask servlets
+  "aot compile master servlet file"
+  [c clj bool "Save intermediate generated .clj file"
+   d odir DIR str "output dir for generated class files"
+   n namespace NS str "namespace to aot"
+   s servleter SERVELETER str "namespace for master servlet generator"
+   v verbose bool "Print trace messages."]
+  (print-task "servlets" *opts*)
+  (let [content (stencil/render-file "migae/boot_gae/servlets.mustache" config-map)
+        servlet-ns (:servlet-ns config-map)
+        regex (re-pattern (str "(" (str/replace servlet-ns #"\.|-" {"." "/" "-" "_"}) ".clj)"))
+        dest (if odir odir classes-dir)
+        mv-arg {regex (str dest "/$1")}
+        aot-ns (symbol (str (if odir odir classes-dir)
+                            "/" (str/replace (:servlet-ns config-map) #"\.|-" {"." "/" "-" "_"})))
+                               ]
+    ;; (println "aot-ns: " aot-ns)
+    ;; (println "STENCIL: " content)
+    (println "mv arg: " mv-arg)
+    (comp
+     ;; (builtin/sift :move mv-arg)
+     ;; (builtin/show :fileset true)
+     ;; Step 1: generate source .clj
+     (core/with-pre-wrap fileset
+       (let [tmp-dir (core/tmp-dir!)
+             odir (if odir odir classes-dir)
+             servlet-master (str (str/replace servlet-ns #"\.|-" {"." "/" "-" "_"}) ".clj")
+             _ (println "servlet-master: " servlet-master)
+             out-file (doto (io/file tmp-dir
+                                     ;;(str odir "/"
+                                     servlet-master ;;)
+                        ) io/make-parents)
+             ]
+         (println "servlet-ns: " servlet-ns)
+         (spit out-file content)
+         (-> fileset (core/add-source tmp-dir) core/commit!)))
+     ;; Step 2: compile it
+     (builtin/aot :namespace #{servlet-ns}))))
+;;                  :dir (if odir odir "./" )))))
+
+     ;; (builtin/sift :include (if clj #{#".*\.class"  #"\.clj$"} #{#"\.class$"}))
+     ;; (builtin/target :dir #{classes-dir}
+     ;;                 :no-clean false)
+     ;;   #_(builtin/show :fileset true)
+     ;;   #_(core/reset-fileset fileset)
+     ;;   #_fileset)))
+
 (core/deftask stencil
   "Process stencil templates"
   [s stencil STENCIL str "Path to a stencil (mustache) template. Must be on classpath."


Fix issues with fetching config

Fix issues with fetching config

--- src/hivewing_core/worker_config.clj
+++ src/hivewing_core/worker_config.clj
@@ -73,7 +73,7 @@
                          items
                          (remove #(worker-config-system-name? (get %1 :key)) items))
         ; Now map those to a hash key structure
-        kv-pairs (map #(hash-map (get % :key) (get % :data)) filtered-items)
+        kv-pairs (map #(vector (get % :key) (get % :data)) filtered-items)
         ; Now we have a result!
         result (into {} kv-pairs)]
     result


[inbox] No need for this-elt to be a ratom

--- src/braid/core/client/ui/views/threads.cljs
+++ src/braid/core/client/ui/views/threads.cljs
@@ -13,7 +13,7 @@
   ;; after mounting, any new threads that come in via props are appended to the end of existing threads
   ;; (except blank new threads, which are put at the front)
   (let [threads (r/atom [])
-        this-elt (r/atom nil)
+        this-elt (atom nil)
         update-threads!
         (fn [target-threads]
           (swap! threads


entity.schema-test: Fix tests after the spec for ::t/id changed

--- src/test/workflo/macros/entity/schema_test.cljc
+++ src/test/workflo/macros/entity/schema_test.cljc
@@ -9,7 +9,7 @@
 (deftest entity-with-value-spec-type-id
   (let [entity (resolve-entity 'url/selected-user)]
     (and (is (not (nil? entity)))
-         (is (= {:url/selected-user [:long]}
+         (is (= {:url/selected-user [:string]}
                 (schema/entity-schema entity))))))

 (deftest entity-with-value-spec-type-string
@@ -53,7 +53,7 @@
 ;;;; Matching schemas

 (deftest matching-entity-schemas
-  (is (= {:url/selected-user [:long]
+  (is (= {:url/selected-user [:string]
           :ui/search-text [:string]
           :ui/search-text-with-extended-spec [:string]}
          (schema/matching-entity-schemas (registered-entities)


Update accept.

Update accept.

--- src/onyx/log/commands/accept_join_cluster.clj
+++ src/onyx/log/commands/accept_join_cluster.clj
@@ -2,8 +2,9 @@
   (:require [clojure.core.async :refer [chan go >! <! >!! close!]]
             [clojure.data :refer [diff]]
             [taoensso.timbre :refer [info] :as timbre]
-            [onyx.scheduling.common-job-scheduler :as cjs]
-            [onyx.extensions :as extensions]))
+            [onyx.extensions :as extensions]
+            [onyx.log.commands.common :as common]
+            [onyx.scheduling.common-job-scheduler :refer [reconfigure-cluster-workload]]))

 (defmethod extensions/apply-log-entry :accept-join-cluster
   [{:keys [args]} replica]
@@ -16,7 +17,8 @@
         (update-in [:accepted] dissoc accepted-observer)
         (update-in [:peers] vec)
         (update-in [:peers] conj accepted-joiner)
-        (assoc-in [:peer-state accepted-joiner] :idle))))
+        (assoc-in [:peer-state accepted-joiner] :idle)
+        (reconfigure-cluster-workload))))

 (defmethod extensions/replica-diff :accept-join-cluster
   [entry old new]
@@ -28,12 +30,9 @@

 (defmethod extensions/reactions :accept-join-cluster
   [entry old new diff state]
-  (when (cjs/volunteer-via-accept? old new diff state)
-    (do ;; SCHEDULER TODO: << Removed volunteer >>
-      nil)))
+  [])

-(defmethod extensions/fire-side-effects! :accept-join-cluster
-  [entry old new diff state]
+(defn unbuffer-messages [state diff new]
   (if (= (:id state) (:subject diff))
     (do (extensions/open-peer-site (:messenger state)
                                    (get-in new [:peer-sites (:id state)]))
@@ -41,3 +40,12 @@
           (>!! (:outbox-ch state) entry))
         (assoc (dissoc state :buffered-outbox) :stall-output? false))
     state))
+
+(defmethod extensions/fire-side-effects! :accept-join-cluster
+  [entry old new diff state]
+  (let [next-state (unbuffer-messages state diff new)
+        old-allocation (common/peer->allocated-job (:allocations old) (:id next-state))
+        new-allocation (common/peer->allocated-job (:allocations new) (:id next-state))]
+    (if-not (not old-allocation new-allocation)
+      (common/start-new-lifecycle next-state diff)
+      next-state)))


Modified logging.

Modified logging.

--- src/forces_assemble/handler.clj
+++ src/forces_assemble/handler.clj
@@ -1,5 +1,6 @@
 (ns forces-assemble.handler
   (:require [clojure.java.io :as io]
+            [clojure.tools.logging :as log]
             [compojure.core :refer :all]
             [compojure.route :as route]
             [ring.middleware.defaults :refer [wrap-defaults secure-api-defaults site-defaults]]
@@ -58,9 +59,9 @@

 (defn get-server-logs
   [& {:keys [query min-time] :or {query nil min-time nil}}]
-  (let [query (or query api-uri-prefix)
+  (let [query (or query "")
         min-time (or min-time (.getEpochSecond (jt/minus (jt/instant) (jt/hours 1))))]
-    (println (str "Server log query: " query " after " min-time))
+    (log/info (str "Querying server logs for \"" query "\" occurring after " min-time))
     (http/get papertrail-events-uri
               {:headers {"X-Papertrail-Token" (env :papertrail-api-token)}
                :query-params {"q" query


another wip

another wip

--- src/gh_waiting_room/service.clj
+++ src/gh_waiting_room/service.clj
@@ -5,7 +5,7 @@
               [io.pedestal.service.http.route.definition :refer [defroutes]]
               [io.pedestal.service.interceptor :refer [defon-response]]
               [clostache.parser :refer [render-resource]]
-              [tentacles.issues :refer [my-issues]]
+              [tentacles.issues :refer [my-issues create-comment]]
               [tentacles.repos :refer [create-hook]]
               clojure.string
               [clojure.data.json :as json]
@@ -89,7 +89,14 @@
 (defn webhook-page
   [request]
   (prn request)
-  (prn "PARAMS" (-> request :params))
+  (let [params (-> request :json-params)
+        _ (prn "Params:" params)
+        action (get params "action")]
+    (when (some #{action} ["created" "reopened"])
+      (let [body "There's nothing to see here. Move along."
+            issue-num (get-in params ["issue" "number"])
+            _ (prn "ISSUE:" issue-num)]
+        (create-comment "cldwalker" "gh-waiting-room" issue-num body (gh-auth))) ))
   {:status 200})

 (defon-response html-content-type


Accomodate distracted users

Accomodate distracted users

Allow the use of the encoders above the beat and BPM displays when the
Metronome display is pinned on, in addition to the dedicated beat and
BPM encoders, because it is easy to grab them without thinking, and they
are serving no other purpose at that point. Be careful about suppressing
paired encoders when one is active.

--- src/afterglow/controllers/ableton_push.clj
+++ src/afterglow/controllers/ableton_push.clj
@@ -370,6 +370,93 @@
   ;; TODO: Do other things when synced.
   ((:tap-tempo-handler controller)))

+(defn- bpm-adjusting-interface
+  "Add an arrow showing the BPM is being adjusted."
+  [controller]
+  ;; TODO: Unless it is being externally synced...
+  (aset (get (:next-display controller) 2) 16 (:up-arrow special-symbols)))
+
+(defn sign-velocity
+  "Convert a midi velocity to its signed equivalent, to translate
+  encoder rotations, which are twos-complement seven bit numbers."
+  [val]
+   (if (>= val 64)
+     (- val 128)
+     val))
+
+(defn- adjust-bpm-from-encoder
+  "Adjust the current BPM based on how the encoder was twisted."
+  [controller message]
+  (let [delta (/ (sign-velocity (:velocity message)) 10)
+        bpm (rhythm/metro-bpm (:metronome (:show controller)))]
+    (rhythm/metro-bpm (:metronome (:show controller)) (+ bpm delta))))
+
+(defn- encoder-above-bpm-touched
+  "Add a user interface overlay to give feedback when turning the
+  encoder above the BPM display when metronome was already active,
+  since it is easy to grab that one rather than the actual BPM
+  encoder, being right above the display."
+  [controller]
+  (add-overlay controller
+               (reify IOverlay
+                 (captured-controls [this] #{72})
+                 (captured-notes [this] #{1 9})
+                 (adjust-interface [this controller]
+                   (bpm-adjusting-interface controller))
+                 (handle-control-change [this controller message]
+                   (adjust-bpm-from-encoder controller message))
+                 (handle-note-on [this controller message]
+                   ;; Suppress the actual BPM encoder while we are active.
+                   true)
+                 (handle-note-off [this controller message]
+                   (when (= (:note message) 1)
+                     ;; They released us, end the overlay.
+                     :done)))))
+
+(defn- beat-adjusting-interface
+  "Add an arrow showing the beat is being adjusted."
+  [controller]
+  (let [marker (rhythm/metro-marker (:metronome (:show controller)))
+                         arrow-pos (if @(:shift-mode controller)
+                                     (dec (.indexOf marker "." (inc (.indexOf marker "."))))
+                                     (dec (count marker)))]
+    (aset (get (:next-display controller) 2) arrow-pos (:up-arrow special-symbols))))
+
+(defn- adjust-beat-from-encoder
+  "Adjust the current beat based on how the encoder was twisted."
+  [controller message]
+  (let [delta (sign-velocity (:velocity message))
+                         snapshot (rhythm/metro-snapshot (:metronome (:show controller)))]
+                     (if @(:shift-mode controller)
+                       ;; User is adjusting the current bar
+                       (rhythm/metro-bar-start (:metronome (:show controller)) (+ (:bar snapshot) delta))
+                       ;; User is adjusting the current beat; keep the phase unchanged
+                       (do
+                         (rhythm/metro-start (:metronome (:show controller)) (+ (:beat snapshot) delta))
+                         (rhythm/metro-beat-phase (:metronome (:show controller) (:beat-phase snapshot)))))))
+
+(defn- encoder-above-beat-touched
+  "Add a user interface overlay to give feedback when turning the
+  encoder above the beat display when metronome was already active,
+  since it is easy to grab that one rather than the actual beat
+  encoder, being right above the display."
+  [controller]
+  (add-overlay controller
+               (reify IOverlay
+                 (captured-controls [this] #{71})
+                 (captured-notes [this] #{0 10})
+                 (adjust-interface [this controller]
+                   (beat-adjusting-interface controller))
+                 (handle-control-change [this controller message]
+                   (adjust-beat-from-encoder controller message))
+                 (handle-note-on [this controller message]
+                   ;; Suppress the actual beat encoder while we are active.
+                   true)
+                 (handle-note-off [this controller message]
+                   (when (= (:note message) 0)
+                     ;; They released us, end the overlay.
+                     :done)))))
+
 (defn- enter-metronome-showing
   "Activate the persistent metronome display, with sync and reset pads
   illuminated."
@@ -378,7 +465,7 @@
   (add-overlay controller
                (reify IOverlay
                  (captured-controls [this] #{3 9 20 21})
-                 (captured-notes [this] #{})
+                 (captured-notes [this] #{0 1})
                  (adjust-interface [this controller]
                    ;; Make the metronome button bright, since its information is active
                    (swap! (:next-text-buttons controller)
@@ -417,7 +504,11 @@
                                                              1 (top-pad-state :bright :green)))
                        true)))
                  (handle-note-on [this controller message]
-                   false)
+                   ;; Whoops, user grabbed encoder closest to beat or BPM display
+                   (case (:note message)
+                     0 (encoder-above-beat-touched controller)
+                     1 (encoder-above-bpm-touched controller))
+                   true)
                  (handle-note-off [this controller message]
                    false))))

@@ -601,14 +692,6 @@
 (defonce ^{:doc "Controllers which are currently bound to shows,
   indexed by the controller binding ID."}
   active-bindings (atom {}))
-
-(defn sign-velocity
-  "Convert a midi velocity to its signed equivalent, to translate
-  encoder rotations, which are twos-complement seven bit numbers."
-  [val]
-   (if (>= val 64)
-     (- val 128)
-     val))

 (defn- overlay-handled?
   "See if there is an interface overlay active which wants to consume
@@ -674,22 +757,21 @@
   (add-overlay controller
                (reify IOverlay
                  (captured-controls [this] #{15})
-                 (captured-notes [this] #{9})
+                 (captured-notes [this] #{9 1})
                  (adjust-interface [this controller]
-                   ;; Add the arrow showing the BPM is being adjusted
-                   ;; TODO: Unless it is being externally synced
-                   (aset (get (:next-display controller) 2) 16 (:up-arrow special-symbols)))
+                   (bpm-adjusting-interface controller))
                  (handle-control-change [this controller message]
-                   ;; Adjust the BPM based on how the encoder was twisted
-                   (let [delta (/ (sign-velocity (:velocity message)) 10)
-                         bpm (rhythm/metro-bpm (:metronome (:show controller)))]
-                     (rhythm/metro-bpm (:metronome (:show controller)) (+ bpm delta))))
+                   (adjust-bpm-from-encoder controller message))
                  (handle-note-on [this controller message]
-                   false)
+                   ;; Suppress the extra encoder above the BPM display.
+                   ;; We can't get a note on for the BPM encoder, because
+                   ;; that was the event that created this overlay.
+                   true)
                  (handle-note-off [this controller message]
-                   ;; Exit the overlay
-                   (swap! (:metronome-mode controller) dissoc :adjusting-bpm)
-                   :done))))
+                   (when (= (:note message) 9)
+                     ;; They released us, end the overlay
+                     (swap! (:metronome-mode controller) dissoc :adjusting-bpm)
+                     :done)))))

 (defn- beat-encoder-touched
   "Add a user interface overlay to give feedback when turning the beat
@@ -700,31 +782,21 @@
   (add-overlay controller
                (reify IOverlay
                  (captured-controls [this] #{14})
-                 (captured-notes [this] #{10})
+                 (captured-notes [this] #{10 0})
                  (adjust-interface [this controller]
-                   ;; Add the arrow showing the beat is being adjusted
-                   (let [marker (rhythm/metro-marker (:metronome (:show controller)))
-                         arrow-pos (if @(:shift-mode controller)
-                                     (dec (.indexOf marker "." (inc (.indexOf marker "."))))
-                                     (dec (count marker)))]
-                     (aset (get (:next-display controller) 2) arrow-pos (:up-arrow special-symbols))))
+                   (beat-adjusting-interface controller))
                  (handle-control-change [this controller message]
-                   ;; Adjust the current beat based on how the encoder was twisted
-                   (let [delta (sign-velocity (:velocity message))
-                         snapshot (rhythm/metro-snapshot (:metronome (:show controller)))]
-                     (if @(:shift-mode controller)
-                       ;; User is adjusting the current bar
-                       (rhythm/metro-bar-start (:metronome (:show controller)) (+ (:bar snapshot) delta))
-                       ;; User is adjusting the current beat; keep the phase unchanged
-                       (do
-                         (rhythm/metro-start (:metronome (:show controller)) (+ (:beat snapshot) delta))
-                         (rhythm/metro-beat-phase (:metronome (:show controller) (:beat-phase snapshot)))))))
+                   (adjust-beat-from-encoder controller message))
                  (handle-note-on [this controller message]
-                   false)
+                   ;; Suppress the extra encoder above the beat display.
+                   ;; We can't get a note on for the beat encoder, because
+                   ;; that was the event that created this overlay.
+                   true)
                  (handle-note-off [this controller message]
-                   ;; Exit the overlay
-                   (swap! (:metronome-mode controller) dissoc :adjusting-beat)
-                   :done))))
+                   (when (= (:note message) 10)
+                     ;; They released us, exit the overlay
+                     (swap! (:metronome-mode controller) dissoc :adjusting-beat)
+                     :done)))))

 (defn- control-change-received
   "Process a control change message which was not handled by an


Remove subsuming-sp from get-stub; rely on subsuming-sps

--- src/angelic/search/implicit/dash_astar.clj
+++ src/angelic/search/implicit/dash_astar.clj
@@ -98,20 +98,20 @@
 ;; TODO: now this will never be true; how to avoid extra connections ?
 (defprotocol TreeSummarizer
   (ts-stub [ts])
-  (subsuming-tss [ts]) ; True tree summarizers subsuming this one.
-  (add-subsuming-ts! [ts subsuming-ts]))
+  (subsuming-sps [ts]) ; True tree summarizers subsuming this one.
+  (add-subsuming-sp! [ts subsuming-sp]))

 (defn- make-tree-summarizer [stb]
-  (let [subsuming-tss-list (ArrayList.)
+  (let [subsuming-sp-list (ArrayList.)
         ret (traits/reify-traits [summaries/or-summarizable summaries/simple-cached-node]
               TreeSummarizer
               (ts-stub [ts] stb)
-              (subsuming-tss [ts] (seq subsuming-tss-list))
-              (add-subsuming-ts! [ts subsuming-ts]
-                (util/assert-is (= (norm-name (stub-name stb)) (norm-name (stub-name (ts-stub subsuming-ts)))))
-                (.add subsuming-tss-list subsuming-ts)
-                (summaries/connect-subsumed! subsuming-ts ts)))]
+              (subsuming-sps [ts] (seq subsuming-sp-list))
+              (add-subsuming-sp! [ts subsuming-sp]
+                (util/assert-is (= (norm-name (stub-name stb)) (norm-name (sp-name subsuming-sp))))
+                (.add subsuming-sp-list subsuming-sp)
+                (summaries/connect-subsumed! (sp-ts subsuming-sp) ts)))]
     (when-not (get-stub-output stb)
       (summaries/connect! ret stb)
       (summaries/connect-subsumed! ret stb))
@@ -212,7 +212,7 @@
     ret))

-(defmulti get-stub (fn [nm inp subsuming-sp] (first nm)))
+(defmulti get-stub (fn get-stub-dispatch [nm inp] (first nm)))

 ;; TODO: canonicalize in make-stub, for everyone ?
 ;; TODO: do lookups via normalized sequences?
@@ -254,7 +254,7 @@
        (if (= ni (input-set stub))
          stub
          (let [subsumed-stub (ri-fn s ni)]
-           (add-subsuming-ts! (tree-summarizer subsumed-stub) (tree-summarizer stub))
+           (add-subsuming-sp! (tree-summarizer subsumed-stub) s)
            subsumed-stub))))]
    summaries/Summarizable (summarize [s] (summary-fn s))))

@@ -385,30 +385,31 @@

 ;; TODO: we keep reward for :blocked case
 ;; Note: weirdly, sometimes ignoring it helps. (not always)
-(defn- make-atomic-subproblem [stb out-set reward status subsuming-sp]
+(defn- make-atomic-subproblem [stb out-set reward status]
   (let [inp-set  (input-set stb)
-        ri-fn    (fn [s ri] (get-stub (stub-name stb) ri s))]
-    (cond (not (= status :live))
-          (make-simple-subproblem
-           stb out-set true
-           (fn [s] (summary/make-simple-summary (min (summaries/get-bound s) reward) status s)) ri-fn)
+        ri-fn    (fn [s ri] (get-stub (stub-name stb) ri))]
+    (util/cond-let [subsuming-sp]
+      (not (= status :live))
+      (make-simple-subproblem
+       stb out-set true
+       (fn [s] (summary/make-simple-summary (min (summaries/get-bound s) reward) status s)) ri-fn)
+
+      ;; TODO: order?
+      (util/find-first #(not (terminal? %)) (subsuming-sps (tree-summarizer stb)))
+      (let [ret (make-simple-subproblem stb out-set false summaries/or-summary ri-fn)]
+        (connect-and-watch! ret subsuming-sp
+          (fn [sub-out]
+            (connect-and-watch-stub-up! ret (refine-input sub-out inp-set) #(add-sp-child! ret %))))
+        ret)

-          (and subsuming-sp (not (terminal? subsuming-sp)))
-          (let [ret (make-simple-subproblem stb out-set false summaries/or-summary ri-fn)]
-            (connect-and-watch! ret subsuming-sp
-              (fn [sub-out]
-                (connect-and-watch-stub-up! ret (refine-input sub-out inp-set) #(add-sp-child! ret %))))
-            ret)
-
-          :else
-          (let [ret (make-simple-subproblem stb out-set false summaries/or-summary ri-fn)]
-            (doseq [child-name (map make-fs-seq-name (fs/child-seqs (second (stub-name stb)) inp-set))]
-              (connect-and-watch-stub! ret (get-stub child-name inp-set nil)
-                 #(add-sp-child! ret %)))
-            ret))))
+      :else
+      (let [ret (make-simple-subproblem stb out-set false summaries/or-summary ri-fn)]
+        (doseq [child-name (map make-fs-seq-name (fs/child-seqs (second (stub-name stb)) inp-set))]
+          (connect-and-watch-stub! ret (get-stub child-name inp-set) #(add-sp-child! ret %)))
+        ret))))

 ;; Note: this is double-stage to lazily generate children.  Could be simpler single-stage.
-(defn make-atomic-stub [nm inp-set subsuming-sp]
+(defn make-atomic-stub [nm inp-set]
   (let [state (atom :ready)]  ;; set to [out-set reward] after first eval, then :go after second.
     (traits/reify-traits [(simple-stub nm inp-set)]
       summaries/Summarizable
@@ -427,16 +428,16 @@
 ;              (println "eval" nm inp-set reward status)
               (if (or (not ready?) (not (= status :live)))
                 (do (reset! state :go)
-                    (->> (make-atomic-subproblem s out-set reward status subsuming-sp)
+                    (->> (make-atomic-subproblem s out-set reward status)
                          (set-stub-output! s)))
                 (do (reset! state op) (summaries/summary-changed! s))))
             (do (reset! state :go) (summaries/summary-changed! s))))))))

 ;; Note: we must always wrap in S-A stub to get effects out of logger.
-(defmethod get-stub :Atomic [[_ fs :as n] inp-set subsuming-sp]
+(defmethod get-stub :Atomic [[_ fs :as n] inp-set]
   (let [full-name [n (if *state-abstraction* (fs/extract-context fs inp-set) inp-set)]
-        make-stub #(let [r (make-atomic-stub n % subsuming-sp)]
+        make-stub #(let [r (make-atomic-stub n %)]
                      (if *collect-equal-outputs* (make-output-collecting-stub r) r))]
      (if-let [^HashMap dc *decompose-cache*]
        (if *state-abstraction*
@@ -513,9 +514,8 @@
             #(set-stub-output! ret %))))
       ret)))

-(defmethod get-stub :Pair [[_ left-name right-name :as n] inp subsuming-sp]
-  (assert (nil? subsuming-sp))
-  (make-pair-stub1 n (get-stub left-name inp nil) #(get-stub right-name % nil)))
+(defmethod get-stub :Pair [[_ left-name right-name :as n] inp]
+  (make-pair-stub1 n (get-stub left-name inp) #(get-stub right-name %)))

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -524,7 +524,7 @@

 (defn- get-root-summarizer [inp-set fs]
-  (tree-summarizer (make-atomic-stub (atomic-name fs) inp-set nil)))
+  (tree-summarizer (make-atomic-stub (atomic-name fs) inp-set )))

 (def *lazy-cache* false)
 (def *no-subsumption* false)


Update dependency versions

Update dependency versions

Bumped up the versions for dependencies.

--- src/leiningen/new/figwheel_node/project.clj
+++ src/leiningen/new/figwheel_node/project.clj
@@ -3,11 +3,11 @@
   :url "http://example.com/FIXME"

   :dependencies [[org.clojure/clojure "1.6.0"]
-                 [org.clojure/clojurescript "0.0-2755"]
-                 [figwheel "0.2.3-SNAPSHOT"]]
+                 [org.clojure/clojurescript "0.0-3190"]
+                 [figwheel "0.2.5-SNAPSHOT"]]

   :plugins [[lein-cljsbuild "1.0.4"]
-            [lein-figwheel "0.2.3-SNAPSHOT"]]
+            [lein-figwheel "0.2.5-SNAPSHOT"]]

   :source-paths ["src"]


Simple checksum handling. Slight refactoring.

--- src/com/lemondronor/turboshrimp/navdata.clj
+++ src/com/lemondronor/turboshrimp/navdata.clj
@@ -593,7 +593,8 @@
    18 :adc-data-frame
    22 :magneto
    26 :wifi
-   27 :gps})
+   27 :gps
+   0xffff :checksum})

 (def option-parsers
   {:adc-data-frame parse-adc-data-frame-option
@@ -637,28 +638,30 @@
 (defn get-uint [^ByteBuffer bb]
   (bit-and 0xFFFFFFFF (Long. (long (.getInt bb)))))

+(defn check-checksum [value bb]
+  (log/debug "CHECKSUM"))
+
 (defn parse-options [^ByteBuffer bb]
   (loop [options (lazymap/lazy-hash-map)]
     (let [option-header (get-ushort bb)
           option-type (which-option-type option-header)
-          option-size (get-ushort bb)
-          new-options (if option-type
-                        (let [^ByteBuffer opt-bb (slice-byte-buffer
-                                                  bb
-                                                  (.position bb)
-                                                  (- option-size 4))]
-                          (lazymap/lazy-assoc
-                           options
-                           option-type (parse-option opt-bb option-type)))
-                        options)
-          old-pos (.position bb)
-          new-pos (+ old-pos (- option-size 4))]
-      (when (= option-header 0xffff)
-        (log/warn "CHECKSUM" (get-uint bb)))
-      (.position bb new-pos)
-      (if (= option-header 0xffff)
-        new-options
-        (recur new-options)))))
+          option-size (get-ushort bb)]
+      (if (= option-type :checksum)
+        (do
+          (check-checksum (get-uint bb) bb)
+          options)
+        (let [old-pos (.position bb)
+              new-pos (+ old-pos (- option-size 4))]
+          (.position bb new-pos)
+          (if option-type
+            (recur
+             (lazymap/lazy-assoc
+              options
+              option-type
+              (parse-option
+               (slice-byte-buffer bb old-pos (- option-size 4))
+               option-type)))
+            (recur options)))))))

 (def navdata-codec
   (gloss/compile-frame
@@ -669,6 +672,7 @@
     :vision-flag :uint32-le)))

 (defn parse-navdata [navdata-bytes]
+  (log/debug "-- parse-navdata")
   (let [^ByteBuffer bb (doto ^ByteBuffer (gloss.io/to-byte-buffer navdata-bytes)
                          (.order ByteOrder/LITTLE_ENDIAN))
         header (get-uint bb)


only update store when containing new tags

--- iwaswhere-web/src/cljs/iwaswhere_web/store.cljs
+++ iwaswhere-web/src/cljs/iwaswhere_web/store.cljs
@@ -1,10 +1,14 @@
 (ns iwaswhere-web.store)

 (defn entry-save-fn
+  "Save current entry that's being written and update hashtags for entry filter."
   [{:keys [current-state msg-payload]}]
-  {:new-state (assoc-in current-state [:new-entry] msg-payload)})
+  (when-not (= (:tags (:new-entry current-state)) (:tags msg-payload))
+    {:new-state (assoc-in current-state [:new-entry] msg-payload)}))

 (defn new-state-fn
+  "Update client side state with state received from backend. Currently contains
+  all entries."
   [{:keys [current-state msg-payload]}]
   {:new-state (assoc-in current-state [:entries] (:entries msg-payload))})


Fix case of tabIndex property

Fix case of tabIndex property

--- src/braid/core/client/ui/views/thread.cljs
+++ src/braid/core/client/ui/views/thread.cljs
@@ -215,7 +215,7 @@
           (if @(subscribe [:thread-open? (thread :id)])
             [:div.control.close
              {:title "Close"
-              :tabindex 0
+              :tabIndex 0
               :role "button"
               :on-click (fn [e]
                           ; Need to preventDefault & propagation when using


Minor docstring changes

Minor docstring changes

--- src/com/puppetlabs/puppetdb/scf/storage.clj
+++ src/com/puppetlabs/puppetdb/scf/storage.clj
@@ -693,14 +693,16 @@
        (sql/delete-rows :certname_facts
                         (into [(str "certname=? and name " (in-clause fact-names)) certname]  fact-names)))))

-(defn cert-fact-map [certname]
+(defn cert-fact-map
+  "Return all facts and their values for a given certname as a map"
+  [certname]
   (sql/with-query-results result-set
     ["SELECT name, value FROM certname_facts WHERE certname=?" certname]
     (zipmap (map :name result-set)
             (map :value result-set))))

 (defn diff-existing-facts
-  "Returns a vector three fact maps, facts to be added,
+  "Returns a vector with three fact maps, facts to be added,
    facts to be updated and facts to be deleted"
   [certname new-facts old-facts]
   (let [[just-new just-old _] (data/diff new-facts old-facts)
@@ -731,6 +733,8 @@
     (boolean (seq result-set))))

 (defn replace-facts!
+  "Updates the facts of an existing node, or adds all new facts if no
+   existing facts are found"
   [{:strs [name values]} timestamp]
   {:pre [(string? name)
          (every? string? (keys values))


Added predicate macros in load_tseries.

Added predicate macros in load_tseries.

--- src/clj/forma/hadoop/jobs/load_tseries.clj
+++ src/clj/forma/hadoop/jobs/load_tseries.clj
@@ -9,15 +9,32 @@
   (:require [cascalog.ops :as c])
   (:gen-class))

+(def
+  ^{:doc "Predicate macro aggregator that extracts a timeseries, given
+  `?chunk`, `?temporal-resolution` and `?date` dynamic vars."}
+  extract-tseries
+  (<- [?temporal-res ?date ?chunk :> ?pix-idx ?t-start ?t-end ?tseries]
+      (datetime->period ?temporal-res ?date :> ?tperiod)
+      (:sort ?tperiod)
+      (timeseries ?tperiod ?int-chunk :> ?pix-idx ?t-start ?t-end ?tseries)))
+
+(def
+  ^{:doc "Predicate macro function to extract relevant spatial data
+  from a given set of chunk fields."}
+  extract-attrs
+  (<- [?tilestring ?spatial-res ?chunk-size ?chunkid ?pix-idx :> ?tile-h ?tile-v ?sample ?line]
+      (tilestring->hv ?tilestring :> ?tile-h ?tile-v)
+      (tile-position ?spatial-res ?chunk-size ?chunkid ?pix-idx :> ?sample ?line)))
+
 (defn process-tseries
+  "Given a source of chunks, this subquery generates timeseries with
+  all relevant accompanying information."
   [chunk-source]
   (<- [?dataset ?spatial-res ?temporal-res ?tile-h ?tile-v ?sample ?line ?pix-idx ?t-start ?t-end ?tseries]
       (chunk-source ?dataset ?spatial-res ?temporal-res ?tilestring ?date ?chunkid ?int-chunk)
-      (datetime->period ?temporal-res ?date :> ?tperiod)
-      (tilestring->hv ?tilestring :> ?tile-h ?tile-v)
-      (:sort ?tperiod)
-      (timeseries ?tperiod ?int-chunk :> ?pix-idx ?t-start ?t-end ?tseries)
-      (tile-position ?spatial-res chunk-size ?chunkid ?pix-idx :> ?sample ?line)))
+      (count ?int-chunk :> ?chunk-size)
+      (extract-tseries ?temporal-res ?date ?int-chunk :> ?pix-idx ?t-start ?t-end ?tseries)
+      (extract-attrs ?tilestring ?spatial-res ?chunkid ?pix-idx :> ?tile-h ?tile-v ?sample ?line)))

 (defn -main
   "TODO: Docs.


Work around AOT failure for now.

Work around AOT failure for now.

--- src/clj/onyx_dashboard/onyx_deployment.clj
+++ src/clj/onyx_dashboard/onyx_deployment.clj
@@ -170,7 +170,7 @@
         (let [entry (extensions/read-log-entry log position)]
           (if-let [new-replica (apply-log-entry send-fn! tracking-id entry replica)]
             (let [diff (extensions/replica-diff entry replica new-replica)
-                  new-incomplete-jobs (set (common/incomplete-jobs new-replica))]
+                  new-incomplete-jobs #{}]
               (send-job-statuses send-fn! tracking-id incomplete-jobs new-incomplete-jobs)
               (log-notifications send-fn! new-replica diff log entry tracking-id)
               (send-log-entry send-fn! tracking-id entry)


Added RESTful route for executing actions in a certain namespace.

--- src/clj_formal_specifications_app/core.clj
+++ src/clj_formal_specifications_app/core.clj
@@ -78,10 +78,15 @@
            (load-string spec)
            (ns-spec ns-name))}))

+(defn execute-with-ns
+  [ns command]
+  {:body (str (binding [*ns* (find-ns (symbol ns))] (load-string command)))})
+
 (defroutes api-routes
   (GET "/api/examples" [] (example-listing))
   (GET "/api/examples/:filename" [filename] (example-file filename))
-  (POST "/api/compose" [specification] (compose specification)))
+  (POST "/api/compose" [specification] (compose specification))
+  (POST "/api/execute" [ns command] (execute-with-ns ns command)))

 (defn index
   [req]


add link to add conferences screen| fs / cb | #3

--- src/cljs/conference_rating/conference.cljs
+++ src/cljs/conference_rating/conference.cljs
@@ -69,7 +69,10 @@
 (defn display-conference-list [conference-list]
   [:div {:class "container"}
    [:h1 "Conferences"]
-   [:ul (map display-conference-list-item conference-list)]])
+   [:ul (map display-conference-list-item conference-list)]
+   [:h2 "Actions"]
+   [:ul
+    [:li [:a {:href "#/add-conference"} "Add conference"]]]])

 (defn conferences-page []
   (let [conference-list @conferences]


Additional lazy-seq test

Additional lazy-seq test


reversing month

reversing month

--- src/ontrail/weekly.clj
+++ src/ontrail/weekly.clj
@@ -56,7 +56,7 @@
   (let [get-entry #(if (contains? %1 %2) (%1 %2) 0)
         acc #(+ (get-entry totals %1) (get-entry result %2))
         kw-all-distance (keyword "distance_Kaikki")
-        kw-all-duration (keyword "duration_kaikki")
+        kw-all-duration (keyword "duration_Kaikki")
         kw-sport-distance (keyword (str "distance_" (:sport result)))
         kw-sport-duration (keyword (str "duration_" (:sport result)))]
     (assoc totals
@@ -64,6 +64,8 @@
       kw-all-distance (acc kw-all-distance :distance)
       kw-sport-distance (acc kw-sport-distance :distance)
       kw-sport-duration (acc kw-sport-duration :duration))))
+
+(defn to-array [sum] nil)

 (defn weekly-sums [results]
   (if (>= (count results) 1)
@@ -88,7 +90,7 @@
       week)))

 (defn generate-month [user year month]
-  (map (partial interval-as-exlist user) (week-intervals year month)))
+  (reverse (map (partial interval-as-exlist user) (week-intervals year month))))

 (defn weekly-wrapper [params]
   {})


STORM-2840: Getting resource availability from pre-GRAS supervisors

--- storm-core/src/clj/org/apache/storm/ui/core.clj
+++ storm-core/src/clj/org/apache/storm/ui/core.clj
@@ -425,8 +425,8 @@
            resourceSummary (if (> (.size sups) 0)
                              (reduce #(map + %1 %2)
                                (for [^SupervisorSummary s sups
-                                     :let [sup-total-mem (get (.get_total_resources s) Constants/COMMON_TOTAL_MEMORY_RESOURCE_NAME)
-                                           sup-total-cpu (get (.get_total_resources s) Constants/COMMON_CPU_RESOURCE_NAME)
+                                     :let [sup-total-mem (get (.get_total_resources s) Constants/COMMON_TOTAL_MEMORY_RESOURCE_NAME (get (.get_total_resources s) Config/SUPERVISOR_MEMORY_CAPACITY_MB))
+                                           sup-total-cpu (get (.get_total_resources s) Constants/COMMON_CPU_RESOURCE_NAME (get (.get_total_resources s) Config/SUPERVISOR_CPU_CAPACITY))
                                            sup-avail-mem (max (- sup-total-mem (.get_used_mem s)) 0.0)
                                            sup-avail-cpu (max (- sup-total-cpu (.get_used_cpu s)) 0.0)
                                            sup-fragmented-cpu (.get_fragmented_cpu s)
@@ -518,8 +518,8 @@
   (let [slotsTotal (.get_num_workers summary)
         slotsUsed (.get_num_used_workers summary)
         slotsFree (max (- slotsTotal slotsUsed) 0)
-        totalMem (get (.get_total_resources summary) Constants/COMMON_TOTAL_MEMORY_RESOURCE_NAME)
-        totalCpu (get (.get_total_resources summary) Constants/COMMON_CPU_RESOURCE_NAME)
+        totalMem (get (.get_total_resources summary) Constants/COMMON_TOTAL_MEMORY_RESOURCE_NAME (get (.get_total_resources summary) Config/SUPERVISOR_MEMORY_CAPACITY_MB))
+        totalCpu (get (.get_total_resources summary) Constants/COMMON_CPU_RESOURCE_NAME (get (.get_total_resources summary) Config/SUPERVISOR_CPU_CAPACITY))
         usedMem (.get_used_mem summary)
         usedCpu (.get_used_cpu summary)
         availMem (max (- totalMem usedMem) 0)


add weekly growth and reverse the counts

--- src/pc/views/admin.clj
+++ src/pc/views/admin.clj
@@ -102,28 +102,29 @@
 (defn growth-graph [user-counts]
   [:table {:border 1}
    [:tr
-    [:th "End of month"]
-    [:th "User count"]
-    [:th "Total growth"]
-    [:th "New user count"]
-    [:th "New user growth"]
-    [:th "Avg/Day"]]
-   (for [[way-before before after] (partition 3 1 (cons {:user-count 0} user-counts))]
-     [:tr
-      [:td (format "%s-%s"
-                   (clj-time.format/unparse (clj-time.format/formatter "MMM dd") (:time before))
-                   (clj-time.format/unparse (clj-time.format/formatter "MMM dd") (:time after)))]
-      [:td (:user-count after)]
-      [:td (when (pos? (:user-count before))
-             (format "%.2f%%" (float (* 100 (/ (- (:user-count after) (:user-count before))
-                                               (:user-count before))))))]
-      [:td (- (:user-count after) (:user-count before))]
-      [:td (when (pos? (:user-count before))
-             (format "%.2f%%" (float (* 100 (/ (- (- (:user-count after) (:user-count before))
-                                                  (- (:user-count before) (:user-count way-before)))
-                                               (- (:user-count before) (:user-count way-before)))))))]
-      [:td (int (/ (- (:user-count after) (:user-count before))
-                   (time/number-of-days-in-the-month (:time before))))]])])
+    [:th "Period"]
+    [:th "Users"]
+    [:th "Growth"]
+    [:th "New users"]
+    [:th "New growth"]
+    [:th "avg/day"]]
+   (reverse
+    (for [[way-before before after] (partition 3 1 (cons {:user-count 0} user-counts))]
+      [:tr
+       [:td (format "%s-%s"
+                    (clj-time.format/unparse (clj-time.format/formatter "MMM dd") (:time before))
+                    (clj-time.format/unparse (clj-time.format/formatter "MMM dd") (:time after)))]
+       [:td (:user-count after)]
+       [:td (when (pos? (:user-count before))
+              (format "%.2f%%" (float (* 100 (/ (- (:user-count after) (:user-count before))
+                                                (:user-count before))))))]
+       [:td (- (:user-count after) (:user-count before))]
+       [:td (when (pos? (- (:user-count before) (:user-count way-before)))
+              (format "%.2f%%" (float (* 100 (/ (- (- (:user-count after) (:user-count before))
+                                                   (- (:user-count before) (:user-count way-before)))
+                                                (- (:user-count before) (:user-count way-before)))))))]
+       [:td (int (/ (- (:user-count after) (:user-count before))
+                    (time/in-days (time/interval (:time before) (:time after)))))]]))])

 (defn growth []
   (let [db (pcd/default-db)
@@ -140,15 +141,39 @@
                                            (map #(time/minus now (time/months %))
                                                 (range))))
         rolling-counts (map (fn [time]
-                           {:time time
-                            :user-count (count-users db time)})
-                            rolling-times)]
+                              {:time time
+                               :user-count (count-users db time)})
+                            rolling-times)
+        weekly-times (take-while #(time/before? % (time/plus now (time/weeks 1)))
+                                 (map #(time/plus earliest (time/weeks %))
+                                      (range)))
+        weekly-user-counts (map (fn [time]
+                                  {:time time
+                                   :user-count (count-users db time)})
+                                weekly-times)
+        weekly-rolling-times (reverse (take-while #(time/after? % earliest)
+                                                  (map #(time/minus now (time/weeks %))
+                                                       (range))))
+        weekly-rolling-counts (map (fn [time]
+                                     {:time time
+                                      :user-count (count-users db time)})
+                                   weekly-rolling-times)]
     (list
-     [:style "td, th { padding: 5px; text-align: right }"]
-     [:h4 "Growth per month"]
-     [:p (growth-graph user-counts)]
-     [:h4 "Growth per rolling month"]
-     [:p (growth-graph rolling-counts)])))
+     [:style "td, th { padding: 5px; text-align: left } td {text-align: right} tr {vertical-align: top}"]
+     [:table
+      [:tr
+       [:th [:h4 "Growth per month"]]
+       [:th [:h4 "Growth per rolling month"]]]
+      [:tr
+       [:td [:p (growth-graph user-counts)]]
+       [:td [:p (growth-graph rolling-counts)]]]]
+     [:table
+      [:tr
+       [:th [:h4 "Growth per week"]]
+       [:th [:h4 "Growth per rolling week"]]]
+      [:tr
+       [:td [:p (growth-graph weekly-user-counts)]]
+       [:td [:p (growth-graph weekly-rolling-counts)]]]])))

 (defn early-access-users []
   (let [db (pcd/default-db)


spelling fix

spelling fix

--- src/polismath/play.clj
+++ src/polismath/play.clj
@@ -44,7 +44,7 @@
              (fn [v jsonGenerator]
                (encode-seq (into-array v) jsonGenerator)))

-; CAREFUL - make sure we don't lose dimentions of the N-Dimensional array.
+; CAREFUL - make sure we don't lose dimensions of the N-Dimensional array.
 (add-encoder clojure.core.matrix.impl.ndarray.NDArray
              (fn [v jsonGenerator]
                (encode-seq (into-array v) jsonGenerator)))


convert deployment settings page

convert deployment settings page

--- frontend/components/project_settings.cljs
+++ frontend/components/project_settings.cljs
@@ -610,7 +610,15 @@
         "      appname: foo-bar-123"]]]]))

 (defn other-deployment [project settings controls-ch]
-  [:div "deployment"])
+  [:div
+   [:h2
+    "Other deployments for " (vcs-url/project-name (:vcs_url project))]
+   [:div.doc
+    [:p "Circle supports deploying to any server, using custom commands. See "
+     [:a {:target "_blank",
+          :href "https://circleci.com/docs/configuration#deployment"}
+      "our deployment documentation"]
+     " to set it up."]]])

 (defn subpage-fn [subpage user]
   (get {:parallel-builds parallel-builds