Show message number id in log entry

Show message number id in log entry

--- src/cljs/onyx_dashboard/components/log.cljs
+++ src/cljs/onyx_dashboard/components/log.cljs
@@ -11,6 +11,7 @@
   (render [_]
           (dom/tr {:key (str "entry-" (:message-id entry))
                    :title (str (om/value entry))}
+                  (dom/td (str (:message-id entry)))
                   (dom/td (str (:id (:args entry))))
                   (dom/td (str (:fn entry)))
                   (dom/td (.fromNow (js/moment (str (js/Date. (:created-at entry)))))))))
@@ -18,7 +19,7 @@
 (defcomponent log-entries-table [entries owner]
   (render [_]
           (t/table {:striped? true :bordered? true :condensed? true :hover? true}
-                   (dom/thead (dom/tr (dom/th "ID") (dom/th "fn") (dom/th "Time")))
+                   (dom/thead (dom/tr (dom/th "#") (dom/th "ID") (dom/th "fn") (dom/th "Time")))
                    (dom/tbody (map (fn [entry]
                                      (om/build log-entry-row entry {}))
                                    entries)))))


doseq form instead of map-dorun

doseq form instead of map-dorun

--- cljx/plongeur-clj/src/kierros/core.clj
+++ cljx/plongeur-clj/src/kierros/core.clj
@@ -1,6 +1,6 @@
 (ns kierros.core
   "Cycle-flavoured core functions."
-  (:require [clojure.core.async :as a :refer [<! chan]]
+  (:require [clojure.core.async :as a :refer [<! chan close!]]
             [taoensso.timbre :refer [info]]))

 (defn sink-proxies
@@ -9,7 +9,7 @@
   [drivers]
   (->> drivers
        keys
-       (map (fn [name] [name (chan)]))
+       (map (fn [name] [name (chan 10)]))
        (into {})))

 (defn call-drivers
@@ -26,17 +26,18 @@
 (defn weld-cycle!
   "Closes the cycle between the sinks and sink-proxies."
   [sink-chans sink-proxy-chans]
-  (->> sink-chans
-       (map (fn [[key sink-chan]]
-              (when sink-chan
-                (a/pipe sink-chan (key sink-proxy-chans)))))
-       (dorun)))
+  (doseq [[key sink-chan] sink-chans]
+    (when sink-chan
+      (a/pipe sink-chan (key sink-proxy-chans)))))

 (defn run
-  "Cycle.run equivalent. Accepts a main function and a map of drivers."
+  "Cycle.run equivalent. Accepts a main function and a map of drivers.
+  Returns a shutdown function that closes the sink proxy channels."
   [main drivers]
   (let [sink-proxy-chans (sink-proxies drivers)
         source-chans     (call-drivers drivers sink-proxy-chans)
         sink-chans       (main source-chans)
-        _                (weld-cycle! sink-chans sink-proxy-chans)]
-    (info "cycle running")))+        _                (weld-cycle! sink-chans sink-proxy-chans)
+        close-all!       (fn [] (doseq [ch (vals sink-proxy-chans)] (close! ch)))]
+    (info "cycle running")
+    close-all!))


delaney.clj: first version of (minimal) function in pure Clojure.

--- clojure/org/gavrog/clojure/delaney.clj
+++ clojure/org/gavrog/clojure/delaney.clj
@@ -427,10 +427,27 @@
   (let [p (type-partition ds)]
     (every? (fn [D] (= D (pfind p D))) (elements ds))))

+(defn minimal [ds]
+  (let [p (type-partition ds)
+        reps (filter (fn [D] (= D (pfind p D))) (elements ds))]
+    (if (= (size ds) (count reps))
+      ds
+      (let [emap (zipmap reps (range 1 (inc (count reps))))
+            idcs (indices ds)
+            imap (zipmap idcs (range (inc (dim ds))))
+            set-op (fn [ops [D i]] (assoc-in ops [(imap i) (emap D)]
+                                             (emap (pfind p (s ds i D)))))
+            ops (reduce set-op {} (for [i idcs, D reps] [D i]))
+            d-set (DSymbol. (dim ds) (count reps) ops {})
+            set-v (fn [vs [D i j]]
+                    (let [this-r (r d-set (imap i) (imap j) (emap D))]
+                      (assoc-in vs [(imap i) (emap D)]
+                                (/ (m ds i j D) this-r))))
+            vs (reduce set-v {} (for [[i j] (zipmap idcs (rest idcs)), D reps]
+                                  [D i j]))]
+        (DSymbol. (dim ds) (count reps) ops vs)))))
+
 ;; === Wrapped Java methods
-
-(defn minimal [ds]
-  (-> ds java-dsymbol .minimal dsymbol))

 (defn automorphisms [ds]
   (for [m (-> ds java-dsymbol DSMorphism/automorphisms)]


Correct error

Correct error

--- src/test_utils/fracture_diagnostics.cljc
+++ src/test_utils/fracture_diagnostics.cljc
@@ -534,7 +534,7 @@

 (defn typical-pumped-volume
   ([] (let [volume-unit (rand-volume-unit)]
-        [(typical-pumped-volume volume-unit) volume-unit]))
+        (typical-pumped-volume volume-unit)))
   ([volume-unit]
    (let [volume-magnitude (condp = volume-unit
                             :bbl (tuc/draw-normal 6986.70 1992.30)


Fixed error with title-case

Fixed error with title-case

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

--- src/conexp/contrib/gui/editors/contexts.clj
+++ src/conexp/contrib/gui/editors/contexts.clj
@@ -21,7 +21,7 @@
 	conexp.contrib.gui.plugins.base)
   (:use clojure.contrib.swing-utils
 	[clojure.contrib.io :exclude (spit)]
-        [clojure.contrib.string :only (replace-str title-case)])
+        [clojure.contrib.string :only (replace-str)])
   (:import [java.io File]))

 (ns-doc


Don't force link to be direct child of li

--- test-cljs/frontend/components/test_documentation.cljs
+++ test-cljs/frontend/components/test_documentation.cljs
@@ -82,7 +82,7 @@
     (is (= "Ruby (2)"
            (-> rendered-component
                om/get-node
-               (sel1 "li > a")
+               (sel1 "li a")
                utils/text)))))

 (deftest test-article-list-rendering


(PE-3238) More testing on CA init files

(PE-3238) More testing on CA init files

This commit adds a bit more thorough testing on some of the
SSL files created during initialization.

--- test/puppetlabs/master/certificate_authority_test.clj
+++ test/puppetlabs/master/certificate_authority_test.clj
@@ -14,6 +14,12 @@
 (def cacrl (str cadir "/ca_crl.pem"))
 (def csrdir (str cadir "/requests"))
 (def signeddir (str cadir "/signed"))
+
+(defn assert-subject [o subject]
+  (is (= subject (-> o .getSubjectX500Principal .getName))))
+
+(defn assert-issuer [o issuer]
+  (is (= issuer (-> o .getIssuerX500Principal .getName))))

 (deftest get-certificate-test
   (testing "returns CA certificate when subject is 'ca'"
@@ -79,11 +85,9 @@

         (testing "requests are autosigned and saved to disk"
           (is (fs/exists? expected-cert-path))
-          (let [signed-cert (utils/pem->cert expected-cert-path)
-                subject     (-> signed-cert .getSubjectX500Principal .getName)
-                issuer      (-> signed-cert .getIssuerX500Principal .getName)]
-            (is (= "CN=test-agent" subject))
-            (is (= "CN=test ca" issuer))))
+          (doto (utils/pem->cert expected-cert-path)
+            (assert-subject "CN=test-agent")
+            (assert-issuer "CN=test ca")))

         (testing "cert expiration is correct based on Puppet's ca_ttl setting"
           (let [duration (Period. now expiration)]
@@ -94,12 +98,10 @@

 (deftest get-certificate-revocation-list-test
   (testing "`get-certificate-revocation-list` returns a valid CRL file."
-    (let [crl    (-> cacrl
-                     get-certificate-revocation-list
-                     StringReader.
-                     utils/pem->crl)
-          issuer (-> crl .getIssuerX500Principal .getName)]
-      (is (= "CN=Puppet CA: localhost" issuer)))))
+    (let [crl (-> (get-certificate-revocation-list cacrl)
+                  StringReader.
+                  utils/pem->crl)]
+      (assert-issuer crl "CN=Puppet CA: localhost"))))

 (let [ssldir          (ks/temp-dir)
       cadir           (str ssldir "/ca")
@@ -120,31 +122,64 @@
                        :hostprivkey (str ssldir "/private_keys/master.pem")
                        :hostpubkey  (str ssldir "/public_keys/master.pem")}]

-  ;; TODO verify contents of each created file (PE-3238)
   (deftest initialize-ca!-test
-    (testing "Generated SSL file"
-      (try
-        (initialize-ca! ca-settings 512)
+    (try
+      (initialize-ca! ca-settings 512)
+
+      (testing "Generated SSL file"
         (doseq [file (vals cadir-contents)]
           (testing file
-            (is (fs/exists? file))))
-        (finally
-          (fs/delete-dir cadir)))))
-
-  ;; TODO verify contents of each created file (PE-3238)
+            (is (fs/exists? file)))))
+
+      (testing "cacrl"
+        (let [crl (-> cadir-contents :cacrl utils/pem->crl)]
+          (assert-issuer crl "CN=test ca")))
+
+      (testing "cacert"
+        (let [cert (-> cadir-contents :cacert utils/pem->cert)]
+          (is (utils/certificate? cert))
+          (assert-subject cert "CN=test ca")
+          (assert-issuer cert "CN=test ca")))
+
+      (testing "cakey"
+        (let [key (-> cadir-contents :cakey utils/pem->private-key)]
+          (is (utils/private-key? key))
+          (is (= 512 (utils/keylength key)))))
+
+      (finally
+        (fs/delete-dir cadir))))
+
   (deftest initialize-master!-test
-    (testing "Generated SSL file"
-      (try
-        (initialize-master! ssldir-contents "master" "test ca"
-                            (utils/pem->private-key cakey)
-                            (utils/pem->cert cacert)
-                            512)
+    (try
+      (initialize-master! ssldir-contents "master" "Puppet CA: localhost"
+                          (utils/pem->private-key cakey)
+                          (utils/pem->cert cacert)
+                          512)
+
+      (testing "Generated SSL file"
         (doseq [file (vals ssldir-contents)]
           (testing file
-            (is (fs/exists? file))))
-        (finally
-          (fs/delete-dir ssldir)))))
-
+            (is (fs/exists? file)))))
+
+      (testing "hostcert"
+        (let [cert (-> ssldir-contents :hostcert utils/pem->certs first)]
+          (is (utils/certificate? cert))
+          (assert-subject cert "CN=master")
+          (assert-issuer cert "CN=Puppet CA: localhost")))
+
+      (testing "localcacert"
+        (let [cacert (-> ssldir-contents :localcacert utils/pem->certs first)]
+          (is (utils/certificate? cacert))
+          (assert-subject cacert "CN=Puppet CA: localhost")
+          (assert-issuer cacert "CN=Puppet CA: localhost")))
+
+      (testing "hostprivkey"
+        (let [key (-> ssldir-contents :hostprivkey utils/pem->private-key)]
+          (is (utils/private-key? key))
+          (is (= 512 (utils/keylength key)))))
+
+      (finally
+        (fs/delete-dir ssldir))))

   (deftest initialize!-test
     (testing "Generated SSL file"


Fix project list collapsing bug.

Fix project list collapsing bug.

--- web-server/src/cljs/hatnik/web/client/components.cljs
+++ web-server/src/cljs/hatnik/web/client/components.cljs
@@ -5,7 +5,7 @@
   (:use [jayq.core :only [$]]))

-(defn accordion-panel [& {:keys [body-id header body open] :or {:open true}}]
+(defn accordion-panel [& {:keys [body-id header body]}]
   (dom/div
    #js {:className "panel panel-default"}
    (dom/div
@@ -17,27 +17,23 @@
                     {:data-parent "#accrodion"
                      :data-toggle "collapse"
                      :href (str "#" body-id)} header))))
-           (dom/div #js {:className (if open
-                                      "panel-collapse collapse in"
-                                      "panel-collapse collapse")
+           (dom/div #js {:className "panel-collapse collapse in"
                          :id body-id}
                     (dom/div #js {:className "panel-body"}
                              body))))

 (defn render-action [project-id action]
-  (dom/p nil
-         (str
-          (get action "artifact")
-          " - "
-          (get action "type"))))
+  (dom/div nil
+           (dom/p nil
+                  (str
+                   (get action "artifact")
+                   " - "
+                   (get action "type")))))

 (defn add-action [id]
   (state/set-form-type :email-action)
   (.modal ($ :#iModal)))

-(defn add-project []
-  (state/set-form-type :project-action)
-  (.modal ($ :#iModal)))

 (defn add-new-action [project-id]
   (dom/a #js {:className "btn btn-default"
@@ -57,9 +53,13 @@
                              (add-new-action id))]))))

 (defn project-header [project]
-  (dom/div #js {:className "project-header"}
-   (dom/p nil (get project "name"))
-   (dom/span #js {:className "glyphicon glyphicon-pencil project-header-button"})))
+  (dom/div #js {:className "row"}
+   (dom/div
+    #js {:className "col-sm-2 col-md-1 col-lg-1"}
+    (dom/p nil (get project "name")))
+   (dom/div #js {:className "col-sm-2 col-md-1 col-lg-1 pull-right"}
+            (dom/span
+             #js {:className "glyphicon glyphicon-pencil pull-right"}))))

 (defn project-list [data owner]
   (reify


Fixes and updates for temporal code and tests.

--- dev-resources/src/cmr/opendap/dev.clj
+++ dev-resources/src/cmr/opendap/dev.clj
@@ -15,6 +15,7 @@
     [cmr.opendap.components.core]
     [com.stuartsierra.component :as component]
     [org.httpkit.client :as httpc]
+    [ring.util.codec :as codec]
     [trifl.java :refer [show-methods]]
     [xml-in.core :as xml-in])
   (:import


Use run! rather than doseq now that we're on 1.7

--- src/onyx/peer/function.clj
+++ src/onyx/peer/function.clj
@@ -20,13 +20,16 @@
    (let [segments (:segments (:onyx.core/results event))]
      (when-not (empty? segments)
        (let [replica-val @replica
-             pick-peer-fns (:pick-peer-fns @peer-replica-view)]
-         (doseq [[[route hash-group] segs] (group-by #(t/vector (:route %) (:hash-group %)) segments)]
-           (let [pick-peer-fn (get pick-peer-fns (get egress-tasks route))
-                 target (pick-peer-fn hash-group)]
-             (when target
-               (when-let [link (operation/peer-link replica-val state event target)]
-                 (onyx.extensions/send-messages messenger event link segs)))))))))
+             pick-peer-fns (:pick-peer-fns @peer-replica-view)
+             grouped (group-by #(t/vector (:route %) (:hash-group %)) segments)]
+         (run! (fn [[[route hash-group] segs]]
+                 (let [pick-peer-fn (get pick-peer-fns (get egress-tasks route))
+                       target (pick-peer-fn hash-group)]
+                   (when target
+                     (when-let [link (operation/peer-link replica-val state event target)]
+                       (onyx.extensions/send-messages messenger event link segs)))))
+               grouped))))
+   {})

   ([{:keys [onyx.core/results onyx.core/messenger onyx.core/state
             onyx.core/replica onyx.core/peer-replica-view onyx.core/serialized-task] :as event}]


[#285] Split `with-channel` into smaller component parts

For example, to allow auth-conditional WebSocket upgrade responses.

--- src/org/httpkit/server.clj
+++ src/org/httpkit/server.clj
@@ -114,16 +114,35 @@
   (on-close [ch callback] (.setCloseHandler ch callback)))

 ;;;; WebSocket
-(defn accept [key]
+
+(defn sec-websocket-accept [sec-websocket-key]
   (let [md (MessageDigest/getInstance "SHA1")
         websocket-13-guid "258EAFA5-E914-47DA-95CA-C5AB0DC85B11"]
     (DatatypeConverter/printBase64Binary
-     (.digest md (.getBytes (str key websocket-13-guid))))))
+      (.digest md (.getBytes (str sec-websocket-key websocket-13-guid))))))
+
+(def accept "DEPRECATED for `sec-websocket-accept" sec-websocket-accept)
+
+(defn send-websocket-handshake!
+  "Returns true iff successfully upgraded a valid WebSocket request."
+  [^AsyncChannel ch ring-req]
+  (when-let [sec-ws-key (get-in ring-req [:headers "sec-websocket-key"])]
+    (when-let [sec-ws-accept (try (sec-websocket-accept sec-ws-key)
+                                  (catch Exception _))]
+      (.sendHandshake ch
+        {"Upgrade" "websocket"
+         "Connection" "Upgrade"
+         "Sec-WebSocket-Accept" sec-ws-accept})
+      true)))
+
+;; (defn websocket-req? [ring-req] (:websocket?    ring-req))
+;; (defn async-channel  [ring-req] (:async-channel ring-req))
+;; (defn async-response [ring-req] {:body (:async-channel ring-req)})

 (defmacro with-channel
-  "Evaluates body with `ch-name` bound to the request's underlying asynchronous
-  HTTP or WebSocket channel, and returns {:body AsyncChannel} as an
-  implementation detail.
+  "Evaluates body with `ch-name` bound to the request's underlying
+  asynchronous HTTP or WebSocket channel, and returns {:body AsyncChannel}
+  as an implementation detail.

   ;; Asynchronous HTTP response (with optional streaming)
   (defn my-async-handler [request]
@@ -158,16 +177,12 @@
     (on-close [ch callback])

   See org.httpkit.timer ns for optional timeout facilities."
-  [request ch-name & body]
-  `(let [~ch-name (:async-channel ~request)]
-     (if (:websocket? ~request)
-       (if-let [key# (get-in ~request [:headers "sec-websocket-key"])]
-         (do (.sendHandshake ~(with-meta ch-name {:tag `AsyncChannel})
-                             {"Upgrade"    "websocket"
-                              "Connection" "Upgrade"
-                              "Sec-WebSocket-Accept" (accept key#)})
-             ~@body
-             {:body ~ch-name})
+  [ring-req ch-name & body]
+  `(let [ring-req# ~ring-req
+         ~ch-name (:async-channel ring-req#)]
+
+     (if (:websocket? ring-req#)
+       (if (send-websocket-handshake! ~ch-name ring-req#)
+         (do ~@body {:body ~ch-name})
          {:status 400 :body "Bad Sec-WebSocket-Key header"})
-       (do ~@body
-           {:body ~ch-name}))))
+       (do ~@body {:body ~ch-name}))))


Fix for db/fetch-game-composers

Fix for db/fetch-game-composers

--- src/org/ocremix/api/db.clj
+++ src/org/ocremix/api/db.clj
@@ -197,6 +197,7 @@
                 {:a.id :cs.composer_id})
           (join [:songs :s]
                 {:cs.song_id :s.id})
+          (group :a.id :a.name)
           (where {:s.game game-id})))

 (defn fetch-game-art


do not specify max walk distance

do not specify max walk distance

--- src/otp_api_proxy/util.clj
+++ src/otp_api_proxy/util.clj
@@ -153,6 +153,7 @@
         otp-url
         ; (str "http://anaheim-otp.groth-geodata.com/otp/routers/default/plan"
         (str "http://anaheim-otp.groth-geodata.com/otp-0.18/routers/default/plan"
+        ;;(str "http://anaheim-otp.groth-geodata.com/anaheim-1.0/otp/routers/default/plan"
              "?"
              ;; banned routes format is: agency_id '__' route_id
              ;; agency_id 248 is Anaheim, route id 1711 is route 20
@@ -162,7 +163,9 @@
                           "&" (pass-arg "date")
                           "&mode=TRANSIT,WALK"
                           "&bannedRoutes=248__1711"
-                          "&maxWalkDistance=1000"
+                          ;;"&maxWalkDistance=1000"
+                          ;; commented out maxWalkDistance per
+                          ;; https://basecamp.com/2316867/projects/5165963/messages/68643001#comment_538262837
                           "&walkReluctance=2"
                           "&walkSpeed=0.3"
                           "&arriveBy=false"


Rewrite done, now broken.

Rewrite done, now broken.

--- src/angelic/search/incremental/implicit.clj
+++ src/angelic/search/incremental/implicit.clj
@@ -79,7 +79,7 @@
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Common Ops ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

-(def +worst-summary+ (make-live-summary is/neg-inf []))
+(def +worst-summary+ (make-blocked-summary is/neg-inf []))
 (def +best-summary+  (make-solved-summary is/pos-inf []))

 (defn better-summary? [s1 s2]
@@ -159,7 +159,7 @@
 (def #^HashMap *subproblem-cache* nil)

 ; Dependencies on plans
-(declare make-initial-plan plan-summary expand-plan)
+(declare make-initial-plan plan-summary plan-output-set expand-plan)

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Output Set Nodes ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

@@ -179,16 +179,16 @@
   (OutputSetNode. input-pair output-set is/pos-inf nil (atom +worst-summary+)
                   :terminal (atom terminal-summary) :terminal (atom +worst-summary+)))

-(def +worst-osn+ (make-terminal-root-osn state-set/empty-lfss +worst-summary+))
+(def +worst-osn+ (make-terminal-root-osn :dummy state-set/empty-lfss +worst-summary+))

 (defn make-nonterminal-root-osn [input-pair output-set reward-bound init-summary init-plans]
   (assert (live? init-summary))
-  (OutputSetNode. input-pair outputsetnode. reward-bound nil (atom +worst-summary+)
+  (OutputSetNode. input-pair output-set reward-bound nil (atom +worst-summary+)
                   (atom init-plans) (atom init-summary) (atom {}) (atom +worst-summary+)))

 (defn make-child-osn [parent-osn child-output-set]
-  (OutputSetNode. (:input-pair parent-osn) child-output-set is/pos-inf parent-osn +best-summary+
-                  (atom nil) (atom +worst-summary+) (atom {}) (atom +worst-summary+)))
+  (OutputSetNode. (:input-pair parent-osn) child-output-set (:reward-bound parent-osn) parent-osn
+                  +best-summary+ (atom nil) (atom +worst-summary+) (atom {}) (atom +worst-summary+)))

@@ -202,7 +202,7 @@
            input-pair
            (state-set/make-logging-factored-state-set [ss])
            (make-solved-summary rew [action])))
-        +worst-osp+)
+        +worst-osn+)
       (let [[opt rew]    (angelic/optimistic-set-and-reward action logged-input-set)
             rew          (min (or rew is/neg-inf) (reward-bound-fn))]
         (if (or (= rew is/neg-inf) prim? (not (angelic/can-refine-from-set? action logged-input-set)))
@@ -214,8 +214,8 @@
           (make-nonterminal-root-osn
            input-pair
            opt rew (make-live-summary rew nil)
-           (lazy-seq (for [[constraint ref] (angelic/immediate-refinements-set action init-set)
-                           :let [p (make-initial-plan init-set constraint ref)] :when p] p))))))))
+           (lazy-seq (for [[constraint ref] (angelic/immediate-refinements-set action logged-input-set)
+                           :let [p (make-initial-plan logged-input-set constraint ref)] :when p] p))))))))

 (defn get-root-osn [input-set action reward-bound-fn]
   (let [context    (env/precondition-context action input-set)]
@@ -231,40 +231,49 @@

 ;; Accessing mutex sets of plans.
 (defn ancestor-summary   [osn] @(:ancestor-summary-atom osn))
-(defn plan-summary       [osn] @(:plan-summary-atom osn))
+(defn local-summary       [osn] @(:plan-summary-atom osn))
 (defn descendant-summary [osn] @(:descendant-summary-atom osn))
+
+;; Collections of plans
+(defn tree-summary [osn]
+  (max-summary (local-summary osn) (descendant-summary osn)))
+
 (defn sub-descendant-summary [osn excluded-child-set]
   (if (empty? excluded-child-set) (descendant-summary osn)
       (->> osn :child-map-atom deref vals
            (remove excluded-child-set) (map tree-summary) (apply max-summary))))

-;; Collections of plans
-(defn tree-summary [osn]
-  (max-summary (plan-summary osn) (descendant-summary osn)))
-
 (defn subtree-summary [osn excluded-child-set]
-  (max-summary (plan-summary osn) (sub-descendant-summary sn excluded-child-set)))
+  (max-summary (local-summary osn) (sub-descendant-summary osn excluded-child-set)))

 (defn handle-summary [osn]
-  (max-summary (ancestor-summary osn) (plan-summary osn)))
+  (max-summary (ancestor-summary osn) (local-summary osn)))

 (defn broom-summary [osn excluded-child-set]
-    (max-summary (ancestor-summary osn) (subtree-summary osn excluded-child-set)))
+  (max-summary (ancestor-summary osn) (subtree-summary osn excluded-child-set)))
+
+(defn root-summary [osn]
+  (tree-summary (last (util/iterate-while :parent-node osn))))

 ;; Updating mutable fields
 (defn refresh-ancestor-summary! [osn]
   (reset! (:ancestor-summary-atom osn)
           (if-let [p (:parent-node osn)]
-            (max-summary (ancestor-summary p) (plan-summary p))
+            (max-summary (ancestor-summary p) (local-summary p))
             +worst-summary+)))

-(defn refresh-plan-summary! [osn]
+(defn refresh-local-summary! [osn]
   (reset! (:plan-summary-atom osn)
           (->> osn :plans-atom deref (map plan-summary) (apply max-summary))))

 (defn refresh-descendant-summary! [osn]
   (reset! (:descendant-summary-atom osn)
           (->> osn :child-map-atom deref vals (map tree-summary) (apply max-summary))))
+
+;; misc accessors
+(def osn-output-set :output-set)
+(def osn-action     (comp first :input-pair))
+

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Refining Plans ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -273,45 +282,42 @@
   "Get or create child osn corresponding to this output-set."
   [osn child-output-set]
   (or (-> osn :child-map-atom deref child-output-set)
-      (swap! (:child-map-atom osn) assoc child-output-set (make-child-own osn child-output-set))))
+      (swap! (:child-map-atom osn) assoc child-output-set (make-child-osn osn child-output-set))))

 (defn add-plans! "Add plans, refresh summary." [osn new-plans]
   (swap! (:plans-atom osn) concat new-plans)
   (swap! (:plan-summary-atom osn) #(apply max-summary % (map plan-summary new-plans))))

-(defn refine-osn-plan!
-  "Refine a single plan stored at this osn."
-  [osn min-reward]
-  (let [[best-plan best-summary rest-plans rest-summary]
-          (extract-best-and-summaries plan-summary @(:plans-atom osn))
-        new-plans (group-by plan-output-set
-                            (expand-plan best-plan (next-min-reward rest-summary min-reward)))]
-    (reset! (:plans-atom osn) (concat (get new-plans (:output-set osn)) rest-plans))
-    (refresh-plan-summary! osn)
-    (doseq [[child-output-set more-plans] (dissoc new-plans (:output-set osn))]
-      (add-plans! (get-osn-child! osn child-output-set) plans))))
-
-(defn refine-osn-child!
-  "Refine a single child osn."
-  [osn min-reward excluded-child-set]
-  (let [[best-child _ _ next-summary]
-          (max-thing-summary-and-next tree-summary (vals @(:child-map-atom osn)))]
-    (refine-osn! best-child (next-min-reward next-summary min-reward) nil)
-    (refresh-descendant-summary! best-child)))
+

 (defn refine-osn!
   "Repeatedly refine shallowest best plan covered by osn until solved or below min-reward."
   [osn min-reward excluded-child-set]
   (while (refinable-summary? (broom-summary osn excluded-child-set) min-reward)
     (let [[[best-op] _ _ next-summary]
-          (max-thing-summary-and-next
+          (extract-best-and-summaries
            second
-           [[#(do (refine-osn! (:parent-node osn) % nil) (refresh-ancestor-summary! osn))
-               (ancestor-summary   osn)]
-            [#(refine-osn-plan!  osn %)
-               (plan-summary       osn)]
-            [#(refine-osn-child! osn % excluded-child-set)
-             (descendant-summary osn excluded-child-set)]])]
+           [;; Ancestor
+            [#(do (refine-osn! (:parent-node osn) % nil) (refresh-ancestor-summary! osn))
+             (ancestor-summary   osn)]
+            ;; Direct plan
+            [#(let [[best-plan best-summary rest-plans rest-summary]
+                      (extract-best-and-summaries plan-summary @(:plans-atom osn))
+                    new-plans (expand-plan best-plan (next-min-reward rest-summary %))]
+                (when-not (identical? (util/singleton new-plans) best-plan)
+                  (let [grouped-plans (group-by plan-output-set new-plans)]
+                   (reset! (:plans-atom osn) (concat (get grouped-plans (:output-set osn)) rest-plans))
+                   (doseq [[child-output-set plans] (dissoc grouped-plans (:output-set osn))]
+                     (add-plans! (get-osn-child! osn child-output-set) plans))))
+                (refresh-local-summary! osn))
+             (local-summary       osn)]
+            ;; Descendant
+            [#(let [[best-child _ _ next-summary]
+                    (extract-best-and-summaries
+                     tree-summary (remove excluded-child-set (vals @(:child-map-atom osn))))]
+                (refine-osn! best-child (next-min-reward next-summary %) nil)
+                (refresh-descendant-summary! best-child))
+             (sub-descendant-summary osn excluded-child-set)]])]
       (best-op (next-min-reward next-summary min-reward)))))

@@ -320,7 +326,7 @@
 (defn split-osn
   "Return a seq of child osn's (i.e., subset output sets) to split off from osn.
    Currently splits children >= min-reward when parent < min-reward."
-  [osp min-reward excluded-child-set]
+  [osn min-reward excluded-child-set]
   (when (< (max-reward (handle-summary osn)) min-reward)
     (filter #(>= (max-reward (tree-summary %)) min-reward)
             (remove excluded-child-set (vals @(:child-map-atom osn))))))
@@ -336,44 +342,50 @@
 (defn refine-osn-input
   "Produce a new OSN, where the input set has been restricted."
   [osn new-input-set]
-  (let [new-root-osn (get-root-osn new-input-set (second (:input-pair osn)) (broom-summary osn))]
+  (let [new-root-osn (get-root-osn new-input-set (osn-action osn) (root-summary osn))]
     (if (identical? (:input-pair new-root-osn) (:input-pair osn)) osn new-root-osn)))

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Plans ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
-
-(defrecord PlanNode [sub-output-set-pointer excluded-child-set output-constraint
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Plan Nodes ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+;; Plan node is an osn in the context of a particular refinement
+
+(defrecord PlanNode [sub-osn excluded-child-set output-constraint
                      reward-bound output-set output-summary])

-(defn compute-plan-node-output-set [input-set sub-output-set-pointer output-constraint]
-  (state-set/constrain (state/transfer-effects input-set (osp-output-set sub-output-set-pointer))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Creating ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(defn make-plan-node [input-set input-summary sub-osn
+                      excluded-child-set output-constraint reward-bound]
+  (PlanNode. sub-osn excluded-child-set output-constraint reward-bound
+             (compute-plan-node-output-set input-set sub-osn output-constraint)
+             (compute-plan-node-output-summary input-summary sub-osn excluded-child-set reward-bound)))
+
+(defn make-initial-plan-node [action [input-set input-summary]]
+  (let [sub (get-root-osn input-set action (constantly is/pos-inf))]
+    (make-plan-node input-set input-summary sub #{} {} is/pos-inf)))
+
+;;;;;;;;;;;;;;;;;;;;;;; Progressing sets and summaries ;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(defn compute-plan-node-output-set [input-set sub-osn output-constraint]
+  (state-set/constrain (state/transfer-effects input-set (osn-output-set sub-osn))
                        output-constraint))

-(defn make-live-for-split [sub-osp ecs summary]
-  (if (and (blocked? summary) (can-split-osp? sub-osp ecs))
-    (make-live-summary (max-reward summary) [(:action (:subproblem sub-osp))])
+(defn make-live-for-split [sub-osn ecs summary]
+  (if (and (blocked? summary) (can-split-osn? sub-osn ecs))
+    (make-live-summary (max-reward summary) [(osn-action sub-osn)])
     summary))

-
-(defn compute-plan-node-output-summary [input-summary sub-output-set-pointer ecs reward-bound]
-  (->> (full-osp-summary sub-output-set-pointer)
+(defn compute-plan-node-output-summary [input-summary sub-osn ecs reward-bound]
+  (->> (broom-summary sub-osn ecs)
        (#(bound-summary % reward-bound))
-       (make-live-for-split sub-output-set-pointer ecs)
+       (make-live-for-split sub-osn ecs)
        (add-summaries input-summary)))

-(defn make-plan-node [input-set input-summary sub-output-set-pointer
-                      excluded-child-set output-constraint reward-bound]
-  (PlanNode. sub-output-set-pointer excluded-child-set output-constraint reward-bound
-             (compute-plan-node-output-set input-set sub-output-set-pointer output-constraint)
-             (compute-plan-node-output-summary input-summary sub-output-set-pointer excluded-child-set reward-bound)))
-
-(defn make-initial-plan-node [action [input-set input-summary]]
-  (let [sub (get-subproblem-root-pointer input-set action (constantly is/pos-inf))]
-    (make-plan-node input-set input-summary sub #{} {} is/pos-inf)))

 (defn plan-node-output-set-and-summary [pn]
   [(:output-set pn) (:output-summary pn)])
@@ -383,46 +395,61 @@
        (viable-summary? summary)))

+;;;;;;;;;;;;;;;;;;;;;;;;;;;; Refining Plan Nodes ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
 (defn refine-pn [pn input-summary min-reward]
-  (let [{:keys [sub-output-set-pointer excluded-child-set reward-bound]} pn]
-    (refine-osp! sub-output-set-pointer min-reward excluded-child-set)
-    (assoc pn :output-summary (compute-plan-node-output-summary input-summary sub-output-set-pointer excluded-child-set reward-bound))))
-
-
-(defn split-pn-output [pn input-set input-summary min-step-reward]
-  (let [{:keys [sub-output-set-pointer excluded-child-set]} pn]
-    (let [split-children (split-osp sub-output-set-pointer min-step-reward excluded-child-set)
+  (let [{:keys [sub-osn excluded-child-set reward-bound]} pn]
+    (refine-osn! sub-osn min-reward excluded-child-set)
+    (assoc pn :output-summary
+           (compute-plan-node-output-summary input-summary sub-osn excluded-child-set reward-bound))))
+
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;; Splitting Plan Nodes ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(defn split-pn-output
+  "Split this plan node into a seq of plan nodes, all but 0-1 of which will have
+   refined output sets."
+  [pn input-set input-summary min-step-reward]
+  (let [{:keys [sub-osn excluded-child-set]} pn]
+    (let [split-children (split-osn sub-osn min-step-reward excluded-child-set)
           new-ecs        (into excluded-child-set split-children)
-          new-summary     (osp-summary sub-output-set-pointer new-ecs)]
+          new-summary    (broom-summary sub-osn new-ecs)]
       (concat
-       (when (viable-summary? new-summary) [(assoc pn :excluded-child-set new-ecs :output-summary new-summary)])
-       (for [child split-children] (make-plan-node input-set input-summary child nil {} is/pos-inf))))))
-
-(defn patch-pn-summary-tuple- [pn new-input-summary]
-  (let [{:keys [sub-output-set-pointer excluded-child-set reward-bound output-set]} pn
-        new-output-summary (compute-plan-node-output-summary new-input-summary sub-output-set-pointer excluded-child-set reward-bound)]
-    (when (viable-summary? new-output-summary)
-      [[false output-set new-output-summary] (assoc pn :output-summary new-output-summary)])))
-
-
-(defn update-pn-input [[set-changed? new-input-set new-input-summary] pn]
-  (let [{:keys [sub-output-set-pointer output-constraint reward-bound output-set]} pn]
-    (if set-changed?
-      (let [new-osp (refine-osp-input sub-output-set-pointer new-input-set)]
-        (if (identical? new-osp sub-output-set-pointer)
-          (patch-pn-summary-tuple- pn new-input-summary)
-          (let [new-pn (make-plan-node new-input-set new-input-summary new-osp nil
-                                (osp-output-set sub-output-set-pointer)
-                                (max-reward (full-osp-summary sub-output-set-pointer)))
-                new-output-pair (plan-node-output-set-and-summary new-pn)]
-            (when (viable-output-set-and-summary? new-output-pair)
-              [(cons (not (= (:output-set new-pn) output-set)) new-output-pair) new-pn]))))
-      (patch-pn-summary-tuple- pn new-input-summary))))
-
-
-
+       (when (viable-summary? new-summary)
+         [(assoc pn :excluded-child-set new-ecs :output-summary new-summary)])
+       (for [child split-children]
+         (make-plan-node input-set input-summary child nil {} is/pos-inf))))))
+
+
+(defn update-pn-input
+  "Take a tuple describing updated inputs and a plan node, and return a tuple
+   describing updated outputs and the updated plan node.  Returns nil for dead-ends."
+  [[set-changed? new-input-set new-input-summary] pn]
+  (let [{:keys [sub-osn excluded-child-set output-constraint reward-bound output-set]} pn
+        new-osn (if set-changed? (refine-osn-input sub-osn new-input-set) sub-osn)]
+    (if (identical? new-osn sub-osn)
+      (let [new-output-summary (compute-plan-node-output-summary
+                                new-input-summary sub-osn excluded-child-set reward-bound)]
+        (when (viable-summary? new-output-summary)
+          [[false output-set new-output-summary] (assoc pn :output-summary new-output-summary)]))
+      (let [new-pn (make-plan-node new-input-set new-input-summary new-osn nil
+                                   (osn-output-set sub-osn)
+                                   (max-reward (broom-summary sub-osn)))
+            new-output-pair (plan-node-output-set-and-summary new-pn)]
+        (when (viable-output-set-and-summary? new-output-pair)
+          [(cons (not (= (:output-set new-pn) output-set)) new-output-pair) new-pn])))))
+
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Plans ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+;; Plan is effectively a sequence of plan nodes.

 (defrecord Plan     [input-constraint input-set plan-nodes output-set summary])
+
+(def plan-summary :summary)
+(def plan-output-set :output-set)

 (defn map-state
   "Transform a sequence via a state-machine.  transition-fn takes a state and input item,
@@ -449,7 +476,6 @@
      (Plan. ref-constraint constrained-set plan out-set out-summary))))

-
 (defn propagate-plan-changes
   "Returns a plan by propagating changes starting at the last node in prefix through remaining-nodes.
    Returns nil if the plan becomes infeasible, otherwise a plan."
@@ -457,21 +483,26 @@
   (when-let [[[_ out-set out-summary] out-nodes]
              (map-state
               update-pn-input
-              (cons set-changed? (plan-node-output-set-and-summary (last prefix-nodes))))]
+              (cons set-changed? (plan-node-output-set-and-summary (last prefix-nodes)))
+              remaining-nodes)]
     (Plan. input-constraint input-set (concat prefix-nodes out-nodes) out-set out-summary)))

 ;; Need some meta-level basis to choose what to do...
 ;; For now, just pick a node at random, try to refine it, then try to split on its output.
 (defn expand-plan [plan min-reward]
-  (let [{:keys [input-constraint input-set plan-nodes output-set summary]} plan
-        [pre-nodes [ref-node & post-nodes]] (split-at (rand-int (count plan-nodes)) plan-nodes)
-        [pre-set pre-summary]  (if (seq pre-nodes) (plan-node-output-set-and-summary (last pre-nodes)) [input-set zero-summary])
-        sub-min-reward (- min-reward
-                          (- (max-reward summary)
-                             (- (max-reward (:out-summary ref-node)) (max-reward pre-summary))))]
-    (filter identity
-            (for [next-pn (split-pn-output (refine-pn ref-node pre-summary sub-min-reward) pre-set pre-summary sub-min-reward)]
-              (propagate-plan-changes input-constraint input-set (concat pre-nodes [next-pn]) post-nodes)))))
+  (if (not (refinable-summary? (:summary plan) min-reward)) [plan]
+      (let [{:keys [input-constraint input-set plan-nodes output-set summary]} plan
+            [pre-nodes [ref-node & post-nodes]] (split-at (rand-int (count plan-nodes)) plan-nodes)
+;            _ (println summary (count pre-nodes) (class ref-node) (count post-nodes))
+            [pre-set pre-summary]  (if (seq pre-nodes) (plan-node-output-set-and-summary (last pre-nodes)) [input-set zero-summary])
+            sub-min-reward (- min-reward
+                              (- (max-reward summary)
+                                 (- (max-reward (:output-summary ref-node)) (max-reward pre-summary))))]
+        (filter identity
+                (for [next-pn (split-pn-output (refine-pn ref-node pre-summary sub-min-reward) pre-set pre-summary sub-min-reward)]
+                  (propagate-plan-changes input-constraint input-set (concat pre-nodes [next-pn]) post-nodes
+                                          (not= (:output-set next-pn) (:output-set ref-node))))))))
+

@@ -485,9 +516,9 @@
         init (env-util/initial-logging-state e)
         tla  (hierarchy-util/make-top-level-action e [(hierarchy/initial-plan henv)])]
     (binding [*subproblem-cache*    (HashMap.)]
-      (let [root (get-subproblem-root-pointer (state-set/make-logging-factored-state-set [init]) tla (constantly is/pos-inf))]
-        (refine-osp! root is/neg-inf nil)
-        (let [sum (osp-summary root nil)]
+      (let [root (get-root-osn (state-set/make-logging-factored-state-set [init]) tla (constantly is/pos-inf))]
+        (refine-osn! root is/neg-inf nil)
+        (let [sum (broom-summary root nil)]
           (println sum)
           (assert (not (refinable-summary? sum is/neg-inf)))
           (when-let [sol (optimal-solution sum)]


better message

better message

--- src/clj/algorithms_clj/macro_initiation.clj
+++ src/clj/algorithms_clj/macro_initiation.clj
@@ -406,16 +406,16 @@
     (remove keyword?)
     (vec)))

-(defn compile-log-prefix
+(defn log-prefix
   [fct-name]
-  (str "Entering the function " fct-name " with arguents: "))
+  (str "[TRACE] Entering \"" fct-name "\" with arguments: "))

 (defn compile-log-message
   [form binding-vec]
   (let [fct-name (-> form second str)
         bindings (bindings->bound-vars binding-vec)]
     `(log-enter-message
-       ~(compile-log-prefix fct-name)
+       ~(log-prefix fct-name)
        (quote ~bindings)
        ~bindings)))


Format code

Format code

--- src/clj_simple_chart/ncs/gas_rp_diagram.clj
+++ src/clj_simple_chart/ncs/gas_rp_diagram.clj
@@ -115,7 +115,7 @@
           :stroke-width-top 1.4
           :fill             fill
           :text
-          {:fill      "white"
+                            {:fill      "white"
                              :font      "Roboto Black"
                              :font-size 15
                              :text      (str/replace (format "%.1f" (double (get opts k 0)))


count resources in stack info summary

count resources in stack info summary

--- src/cljs/swarmpit/component/stack/info.cljs
+++ src/cljs/swarmpit/component/stack/info.cljs
@@ -159,7 +159,7 @@
       {:formatter (fn [value name props]
                     (.-state (.-payload props)))})))

-(rum/defc form-general < rum/static [stack-name stackfile services]
+(rum/defc form-general < rum/static [stack-name stackfile {:keys [services networks volumes configs secrets]}]
   (comp/card
     {:className "Swarmpit-form-card"
      :key       "fgc"}
@@ -174,6 +174,17 @@
     (comp/card-content
       {:key "fgccc"}
       (rum/with-key (form-services-graph services) "fgcccg"))
+    (comp/card-content
+      {:key "fgccci"}
+      (html
+        [:div {:key "ngcccid"}
+         [:span "Networks: " [:b (count networks)]]
+         [:br]
+         [:span "Volumes: " [:b (count volumes)]]
+         [:br]
+         [:span "Configs: " [:b (count configs)]]
+         [:br]
+         [:span "Secrets: " [:b (count secrets)]]]))
     (comp/divider
       {:key "fgd"})
     (comp/card-content
@@ -298,13 +309,13 @@
       (stack-secrets-handler name)
       (stackfile-handler name))))

-(defn form-general-grid [stack-name stackfile services]
+(defn form-general-grid [stack-name stackfile item]
   (comp/grid
     {:item true
      :key  "sgg"
      :xs   12}
     (rum/with-key
-      (form-general stack-name stackfile services) "sggfg")))
+      (form-general stack-name stackfile item) "sggfg")))

 (defn form-services-grid [stack-name services]
   (comp/grid
@@ -348,7 +359,7 @@

 (rum/defc form-info < rum/static [stack-name
-                                  {:keys [services networks volumes configs secrets stackfile]}]
+                                  {:keys [services networks volumes configs secrets stackfile] :as item}]
   (comp/mui
     (html
       [:div.Swarmpit-form
@@ -368,7 +379,7 @@
               (comp/grid
                 {:container true
                  :spacing   16}
-                (form-general-grid stack-name stackfile services)
+                (form-general-grid stack-name stackfile item)
                 (form-secrets-grid stack-name secrets)
                 (form-configs-grid stack-name configs)))
             (comp/grid
@@ -389,7 +400,7 @@
           (comp/grid
             {:container true
              :spacing   16}
-            (form-general-grid stack-name stackfile services)
+            (form-general-grid stack-name stackfile item)
             (form-services-grid stack-name services)
             (form-networks-grid stack-name networks)
             (form-volumes-grid stack-name volumes)


Trying to make profile data handling safe

--- src/polismath/conv_man.clj
+++ src/polismath/conv_man.clj
@@ -131,9 +131,10 @@
 (defn handle-profile-data
   "For now, just log profile data. Eventually want to send to influxDB and graphite."
   [conv]
-  (let [prof @(:profile-data conv)
-        tot  (apply + (map second prof))]
-    (log/debug "Profile data for zid" (:zid conv) ": " prof)))
+  (if-let [prof @(:profile-data conv)]
+    (let [tot (apply + (map second prof))
+          prof (assoc prof :total tot)]
+      (log/debug "Profile data for zid" (:zid conv) ": " prof))))

 (defn update-fn


Installed new fold-clusters and unfold-clusters functions in conv-man lifecycle (load-or-init and prep-main).

--- src/polismath/conv_man.clj
+++ src/polismath/conv_man.clj
@@ -1,6 +1,7 @@
 (ns polismath.conv-man
   (:require [polismath.named-matrix :as nm]
             [polismath.conversation :as conv]
+            [polismath.clusters :as clust]
             [polismath.metrics :as met]
             [polismath.db :as db]
             [polismath.utils :refer :all]
@@ -65,28 +66,12 @@
    :lastVoteTimestamp (:last-vote-timestamp results)})

-(defn- assoc-in-bc
-  "Helper function to clean up the prep-for-uploading fn"
-  [conv k v & kvs]
-  (let [this-part (assoc-in conv [:base-clusters k] v)]
-    (if (empty? kvs)
-      this-part
-      (apply assoc-in-bc this-part kvs))))
-
-
 (defn prep-main
   "Prep function for passing to format-for-mongo and on the main polismath collection."
   [results]
-  (let [base-clusters (:base-clusters results)]
-    (-> results
+  (-> results
       ; REFORMAT BASE CLUSTERS
-      (dissoc :base-clusters)
-      (assoc-in-bc
-        "x"       (map #(first (:center %)) base-clusters)
-        "y"       (map #(second (:center %)) base-clusters)
-        "id"      (map :id base-clusters)
-        "members" (map :members base-clusters)
-        "count"   (map #(count (:members %)) base-clusters))
+      (update-in [:base-clusters] clust/fold-clusters)
       ; Whitelist of keys to be included in sent data; removes intermediates
       (assoc :lastVoteTimestamp (:last-vote-timestamp results))
       (assoc :lastModTimestamp (:last-mod-timestamp results))
@@ -104,7 +89,7 @@
         :zid
         :user-vote-counts
         :votes-base
-        :group-votes}))))
+        :group-votes})))

 (defn format-for-mongo
@@ -236,10 +221,12 @@
   [zid & {:keys [recompute]}]
   (if-let [conv (and (not recompute) (db/load-conv zid))]
     (-> conv
-        (hash-map-subset #{:rating-mat :lastVoteTimestamp :zid :pca :in-conv :n :n-cmts})
+        (hash-map-subset #{:rating-mat :lastVoteTimestamp :zid :pca :in-conv :n :n-cmts :group-clusters :base-clusters})
         ; Make sure there is an empty named matrix to operate on
         (assoc :rating-mat (nm/named-matrix)
                :recompute :reboot)
+        ; Update the base clusters to be unfolded
+        (update-in [:base-clusters] clust/unfold-clusters)
         ; Make sure in-conv is a set
         (update-in [:in-conv] set))
     ; would be nice to have :recompute :initial


Make formatting consistent

Make formatting consistent

--- src/braid/server/routes/api/public.clj
+++ src/braid/server/routes/api/public.clj
@@ -79,7 +79,8 @@
         (not (invites/verify-hmac hmac (str now token invite_id email)))
         (assoc fail :body "Invalid HMAC")

-        (string/blank? invite_id) (assoc fail :body "Invalid invitation ID")
+        (string/blank? invite_id)
+        (assoc fail :body "Invalid invitation ID")

         (not (valid-nickname? nickname))
         (assoc fail :body "Nickname must be 1-30 characters without whitespace")


Vector used

Vector used

--- agiledox.clj
+++ agiledox.clj
@@ -25,10 +25,10 @@

 (defn make-spec [test-file]
   (if (test-lines? test-file)
-    (list
+    [
       (as-header (:name test-file))
       (map as-feature (:lines test-file))
-      empty-line)))
+      empty-line]))

 (dorun
   (map (fn [s] (if s (println s)))


Add format specifier

Add format specifier

Untested code... grumble

--- src/clj/runbld/notifications/email.clj
+++ src/clj/runbld/notifications/email.clj
@@ -105,7 +105,7 @@
   (-> (n/make-context opts build failures)
       (update-in [:email :to] #(str/join ", " %))
       (assoc-in [:email :subject]
-                (format "%s %s %s"
+                (format "%s %s %s %s"
                         (-> build :process :status)
                         (-> build :build :org-project-branch)
                         (-> build :vcs :commit-short)


Remove unused require

Remove unused require

--- src/clj_chrome_devtools/automation.clj
+++ src/clj_chrome_devtools/automation.clj
@@ -1,7 +1,6 @@
 (ns clj-chrome-devtools.automation
   "Higher level automation convenience API"
   (:require [clj-chrome-devtools.commands.dom :as dom]
-            [clj-chrome-devtools.commands.domsnapshot :as dom-snapshot]
             [clj-chrome-devtools.commands.page :as page]
             [clj-chrome-devtools.commands.input :as input]
             [clj-chrome-devtools.commands.runtime :as runtime]


additional cleanup on entity change

additional cleanup on entity change

--- src/cljs/clj_money/views/accounts.cljs
+++ src/cljs/clj_money/views/accounts.cljs
@@ -801,10 +801,17 @@
                ::index
                (fn [_ _ _ accts]
                  (swap! page-state
-                        assoc
-                        :expanded #{}
-                        :filter-tags #{}
-                        :hide-zero-balances? (any-non-zero-balances? accts))))
+                        #(-> %
+                             (dissoc :selected
+                                     :view-account
+                                     :commodities
+                                     :all-items-fetched?
+                                     :items)
+                             (assoc
+                               :expanded #{}
+                               :filter-tags #{}
+                               :hide-zero-balances? (any-non-zero-balances? accts))))
+                 (load-commodities page-state)))
     (fn []
       [:div.mt-3.h-100
        [:div.row


Improve context handling related stuff.

Improve context handling related stuff.

--- src/clojure/catacumba/impl/context.clj
+++ src/clojure/catacumba/impl/context.clj
@@ -26,6 +26,7 @@
   "Functions and helpers for work in a clojure
   way with ratpack types."
   (:require [catacumba.impl.helpers :as hp]
+            [catacumba.impl.registry :as reg]
             [promesa.core :as p])
   (:import catacumba.impl.DelegatedContext
            catacumba.impl.ContextHolder
@@ -92,10 +93,11 @@
   handler using the `delegate` function. Is a simple
   way to communicate the handlers chain."
   {:internal true :no-doc true}
-  [ctx]
-  (when-let [dc (-> (get-context* ctx)
-                    (hp/maybe-get DelegatedContext))]
-    (.-data dc)))
+  [context]
+  (let [^Context ctx (get-context* context)
+        ^DelegatedContext dctx (reg/maybe-get ctx DelegatedContext)]
+    (when dctx
+      (.-data dctx))))

 (defn delegate
   "Delegate handling to the next handler in line.
@@ -324,7 +326,7 @@
            (hp/on-error reject)
            (hp/then resolve))))))

-;; --- Impl
+;; --- Implementation

 (defn build-context
   {:internal true}
@@ -345,11 +347,15 @@
 (defn create-context
   {:internal true}
   [^Context ctx]
-  (let [holder (-> (.getRequest ctx)
-                   (hp/maybe-get ContextHolder))]
-    (merge (if holder
-             (.-data ^ContextHolder holder)
-             (build-context ctx))
-           {:route-params (get-route-params ctx)}
-           (get-context-params ctx))))
-
+  (let [^Request req (get-request* ctx)
+        ^ContextHolder holder (reg/maybe-get req ContextHolder)]
+    (if holder
+      (merge (.-data ^ContextHolder holder)
+             {:route-params (get-route-params ctx)}
+             (get-context-params ctx))
+      (let [context (build-context ctx)
+            holder (ContextHolder. context)]
+        (reg/add! req holder)
+        (merge context
+               {:route-params (get-route-params ctx)}
+               (get-context-params ctx))))))


Finish off sequential safety test.

Finish off sequential safety test.

--- test/onyx/coordinator/sim_test_utils.clj
+++ test/onyx/coordinator/sim_test_utils.clj
@@ -68,11 +68,23 @@
              (recur sync nodes ranges start)))))

 (defn sequential-safety [sync]
-  (doseq [state-path (extensions/bucket sync :peer-state)]
-    (let [states (sort (extensions/children sync state-path))
-          node-pairs (peer-stack-sequential-ranges sync states)
-          tx-pairs (map (fn [x] (map #(:czxid (:stat (zk/data (:conn sync) %))) x)) node-pairs)]
-      (prn tx-pairs))))
+  (let [paths (extensions/bucket sync :peer-state)]
+    (doseq [state-path paths]
+      (let [states (sort (extensions/children sync state-path))
+            node-pairs (peer-stack-sequential-ranges sync states)
+            range-nodes (map (fn [[a b]]
+                               [(:czxid (:stat (zk/data (:conn sync) a)))
+                                (:czxid (:stat (zk/data (:conn sync) b)))
+                                (:task-node (extensions/read-place sync a))])
+                             node-pairs)
+            other-peers (remove (partial = state-path) paths)]
+        (doseq [other-peer other-peers]
+          (doseq [range-node range-nodes]
+            (doseq [state (sort (extensions/children sync other-peer))]
+              (when (= (:task-node (extensions/read-place sync state)) (nth range-node 2))
+                (let [zxid (:czxid (:stat (zk/data (:conn sync) state)))]
+                  (fact (or (< zxid (first range-node))
+                            (> zxid (second range-node))) => true))))))))))

 (defn peer-liveness [sync]
   (doseq [state-path (extensions/bucket sync :peer-state)]


[#13070] No wallet is shown when switching on BSC network

Signed-off-by: andrey <b713972e59b8e606e23253c4a13e948139fea4d1@gmail.com>

--- src/status_im/multiaccounts/login/core.cljs
+++ src/status_im/multiaccounts/login/core.cljs
@@ -267,11 +267,11 @@
                              :on-success resolve
                              :on-error reject})))
           (js/Promise.
-           (fn [resolve reject]
+           (fn [resolve _]
              (json-rpc/call {:method "wallet_getTokens"
                              :params [(int network-id)]
                              :on-success resolve
-                             :on-error reject})))
+                             :on-error #(resolve nil)})))
           (js/Promise.
            (fn [resolve reject]
              (json-rpc/call {:method "wallet_getCustomTokens"


removed browser navigation, changed "<" on "x", do not updated dapp url

--- src/status_im/ui/screens/browser/views.cljs
+++ src/status_im/ui/screens/browser/views.cljs
@@ -14,7 +14,8 @@
             [status-im.ui.components.chat-icon.screen :as chat-icon.screen]
             [status-im.ui.components.icons.vector-icons :as vector-icons]
             [status-im.i18n :as i18n]
-            [status-im.utils.ethereum.core :as ethereum]))
+            [status-im.utils.ethereum.core :as ethereum]
+            [status-im.ui.components.toolbar.actions :as actions]))

 (views/defview toolbar-content-dapp [contact-identity]
   (views/letsubs [contact [:get-contact-by-identity contact-identity]]
@@ -67,7 +68,7 @@

 (defn on-navigation-change [event browser]
   (let [{:strs [url canGoBack canGoForward]} (js->clj event)]
-    (when-not (= "about:blank" url)
+    (when (and (not (:dapp? browser)) (not= "about:blank" url))
       (re-frame/dispatch [:update-browser (assoc browser :url url)]))
     (re-frame/dispatch [:update-browser-options {:can-go-back? canGoBack :can-go-forward? canGoForward}])))

@@ -86,7 +87,7 @@
     [react/keyboard-avoiding-view styles/browser
      [status-bar/status-bar]
      [toolbar.view/toolbar {}
-      (toolbar.view/nav-back-count)
+      [toolbar.view/nav-button-with-count actions/default-close]
       (if dapp?
         [toolbar-content-dapp contact]
         [toolbar-content browser])]


reload gpg agent was missing

reload gpg agent was missing

--- src/dda/pallet/dda_user_crate/infra/gpg.clj
+++ src/dda/pallet/dda_user_crate/infra/gpg.clj
@@ -73,6 +73,7 @@
       :script-env {:HOME user-home}}
      (actions/exec-checked-script
       "import & trust gpg key"
+      ("gpgconf" "--reload gpg-agent")
       ("gpg2" "--import" ~(str user-home "/pub.key"))
       ("echo" ~passphrase "|" "gpg2" "--pinentry-mode loopback"
               "--batch --passphrase-fd 0"


WIP - Adaptation du bot en Clojure pour CSB

--- clojure/codingame/competition/coders-strike-back/src/coders_strike_back/core.clj
+++ clojure/codingame/competition/coders-strike-back/src/coders_strike_back/core.clj
@@ -36,7 +36,10 @@
 (defn compute-boost [next-checkpoint-distance next-checkpoint-angle]
   (cond
     (> (Math/abs next-checkpoint-angle) 90) "0"
+    (< next-checkpoint-distance 600) "0"
     (and (< next-checkpoint-distance 1000) (> (Math/abs next-checkpoint-angle) 30)) "0"
+    (< next-checkpoint-distance 1000) "20"
+    (> (Math/abs next-checkpoint-angle) 60) "80"
     ; (< (Math/abs next-checkpoint-angle) 30) "100"
     ; (> next-checkpoint-distance 4000) "100"
     true "100"))


V0.5 client reload now made

V0.5 client reload now made

This is hard to test in development because when the server is restarted
then figwheel reloads everything on the client, clearing all the caches

--- src/webapp/framework/client/coreclient.cljs
+++ src/webapp/framework/client/coreclient.cljs
@@ -1386,23 +1386,30 @@

          info
          (do
-           (log "Client was disconnected")
+           (log (str "@client-query-cache=" @client-query-cache))
+           (log "realtime-update-check-response: "   realtime-update-check-response)
+           (log "client query caches reloaded before: " (count (keys @client-query-cache)))
            (doall (map
                     (fn[client-key]
                       (log (str "      RELOAD: "  client-key))
-                      (>! client-query-cache-requests  {
-                                                         :query-key     (dissoc (dissoc client-key :start) :end)
-
-                                                         :subset-range  {
-                                                                          :start    1
-                                                                          :end      20
-                                                                          } })
+                      (go
+                        (>! client-query-cache-requests  {
+                                                           :query-key     (dissoc (dissoc client-key :start) :end)
+
+                                                           :subset-range  {
+                                                                            :start    1
+                                                                            :end      20
+                                                                            } }))
                       )
-                    (keys @client-query-cache))))
+                    (keys @client-query-cache)))
+           (log "client query caches reloaded after: " (count (keys @client-query-cache)))
+           )

          error
+         (do
            (log "Error in response")
+           nil)

          :else
@@ -1414,7 +1421,7 @@
                     new-key2     (dissoc (dissoc xxx :start) :end)
                     ]

-               (log "Client realtime query: " new-key2)
+               ;(log "Client realtime query: " new-key2)
                (>! client-query-cache-requests  {
                                                   :query-key     new-key2

@@ -1728,7 +1735,7 @@
          query-atom                 (get @client-query-cache   query-key)
          list-of-record-positions   (range (:start params) (inc (:end params)))
        ]
-    (log (pr-str ""))
+    ;(log (pr-str ""))
     ;(log (pr-str "populate: "  query-key " : " records))
     ;(log (pr-str "  database returned      : "  records))
     ;(log (pr-str "        : "  records-count))


Be more generic and prepare to use other types of BlockingQueues.

--- src/dsbdp/data_processing_pipeline.clj
+++ src/dsbdp/data_processing_pipeline.clj
@@ -13,10 +13,12 @@
   (:require [dsbdp.data-processing-dsl :refer :all])
   (:import
     (dsbdp LocalTransferContainer ProcessingLoop)
-    (java.util.concurrent LinkedTransferQueue)))
+    (java.util.concurrent ArrayBlockingQueue BlockingQueue LinkedTransferQueue)))
+
+(def ^:dynamic *queue-size* 100000)

 (defn create-local-processing-element
-  [^LinkedTransferQueue in-queue f]
+  [^BlockingQueue in-queue f]
   (let [out-queue (LinkedTransferQueue.)
         proc-loop (ProcessingLoop.
                     (fn []


Change map rep in nav_2d

Change map rep in nav_2d

--- src/edu/berkeley/ai/domains/nav_2d.clj
+++ src/edu/berkeley/ai/domains/nav_2d.clj
@@ -6,45 +6,17 @@

-(defn preprocess-map
-  "Returns a new, hopefully fast/compact c-space free-fn"
-  [width height free-fn radius]
-  (let [width (int width)
-	height (int height)
-	radius (int radius)
-	offsets (for [dx (range (- radius) (inc radius)), dy (range (- radius) (inc radius))
-		      :when (<= (+ (* dx dx) (* dy dy)) (* radius radius))]
-		  [dx dy])
-	fill-map (make-array Boolean/TYPE (* height width))]
-    (doseq [y (range height), x (range width)]
-      (let [x (int x) y (int y)]
-	(when (some (fn [[dx dy]]
-		      (let [dx (int dx)
-			    dy (int dy)
-			    nx (+ x dx)
-			    ny (+ y dy)]
-			(or (< nx 0) (>= nx width) (< ny 0) (>= ny height) (not (free-fn [nx ny])))))
-		offsets)
-	  (aset-boolean fill-map (+ x (* y width)) true)))
-;      (println x y (aget fill-map (idx-fn x y)))
-      )
-    (fn [[x y]]
-      (let [x (int x) y (int y)]
-	(and (aget fill-map (+ x (* y width)))
-	     (some (fn [[dx dy]]
-		     (let [dx (int dx) dy (int dy)
-			   nx (+ x dx), ny (+ y dy)]
-		       (if (and (>= nx 0) (< nx width) (>= ny 0) (< ny height) (not (aget fill-map (+ nx (* ny width)))))
-			 true nil)))
-		 [[-1 0] [1 0] [0 -1] [0 1]]))))))
-

 (let [f (util/path-local "nav_2d.pddl")]
   (defn make-nav-2d-strips-domain []
     (strips/read-strips-planning-domain f)))

-(defn make-nav-2d-strips-env [border-fn [width height] [init-x init-y] [goal-x goal-y]]
+(defn make-nav-2d-strips-env
+  "map-fn takes [x y] pair, returns :free, :border, or :occupied"
+  [map-fn [width height] [init-x init-y] [goal-x goal-y]]
+  (util/assert-is (= :free (map-fn [init-x init-y])))
+  (util/assert-is (= :free (map-fn [goal-x goal-y])))
   (strips/make-strips-planning-instance
    "nav-2d"
    (make-nav-2d-strips-domain)
@@ -53,7 +25,7 @@
    (concat [['atx (util/symbol-cat "x" init-x)] ['aty (util/symbol-cat "y" init-y)]]
 	   (map (fn [x] ['left-of (util/symbol-cat "x" (dec x)) (util/symbol-cat "x" x)]) (range 1 width))
 	   (map (fn [x] ['above   (util/symbol-cat "y" (dec x)) (util/symbol-cat "y" x)]) (range 1 height))
-           (for [y (range height) x (range width) :when (border-fn [x y])]
+           (for [y (range height) x (range width) :when (= :border (map-fn [x y]))]
 	     ['border (util/symbol-cat "x" x) (util/symbol-cat "y" y)])
    	   (map (fn [x] ['above   (util/symbol-cat "y" (dec x)) (util/symbol-cat "y" x)]) (range 1 height)))
    [['atx (util/symbol-cat "x" goal-x)] ['aty (util/symbol-cat "y" goal-y)]]
@@ -64,10 +36,10 @@
 	  (for [y (range height)]
 	    (apply str
 	      (for [x (range width)]
-		  (cond (= [x y] pos)             "O"
-			(= [x y] [goal-x goal-y]) "G"
-			(border-fn [x y])         "X"
-			(nil? (border-fn [x y]))  "@"
+		  (cond (= [x y] pos)                "O"
+			(= [x y] [goal-x goal-y])    "G"
+			(= (map-fn [x y]) :border)   "X"
+			(= (map-fn [x y]) :occupied) "@"
 			:else                     ".")))))))))

 (comment
@@ -99,3 +71,59 @@

+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+(comment
+(defn preprocess-map
+  "Returns a new, hopefully fast/compact c-space free-fn"
+  [width height free-fn radius]
+  (let [width (int width)
+	height (int height)
+	radius (int radius)
+	offsets (for [dx (range (- radius) (inc radius)), dy (range (- radius) (inc radius))
+		      :when (<= (+ (* dx dx) (* dy dy)) (* radius radius))]
+		  [dx dy])
+	fill-map (make-array Boolean/TYPE (* height width))]
+    (doseq [y (range height), x (range width)]
+      (let [x (int x) y (int y)]
+	(when (some (fn [[dx dy]]
+		      (let [dx (int dx)
+			    dy (int dy)
+			    nx (+ x dx)
+			    ny (+ y dy)]
+			(or (< nx 0) (>= nx width) (< ny 0) (>= ny height) (not (free-fn [nx ny])))))
+		offsets)
+	  (aset-boolean fill-map (+ x (* y width)) true)))
+;      (println x y (aget fill-map (idx-fn x y)))
+      )
+    (fn [[x y]]
+      (let [x (int x) y (int y)]
+	(and (aget fill-map (+ x (* y width)))
+	     (some (fn [[dx dy]]
+		     (let [dx (int dx) dy (int dy)
+			   nx (+ x dx), ny (+ y dy)]
+		       (if (and (>= nx 0) (< nx width) (>= ny 0) (< ny height) (not (aget fill-map (+ nx (* ny width)))))
+			 true nil)))
+		 [[-1 0] [1 0] [0 -1] [0 1]])))))) )
+


small comment fix

small comment fix

--- src/mafia_votecount/scraper/team_liquid.clj
+++ src/mafia_votecount/scraper/team_liquid.clj
@@ -271,7 +271,8 @@
        ;                      (is-cycle-change?))
         day-ranges (-> cycle-posts
                        (keys)
-                       ; hosts can just add a line break before the night 0 message though so maybe not so important after all...?
+                       ; hosts can just add some text before the night 0 message though so maybe not so important after all...?
+                       ; or the first night post could be automatically ignored? (every cycle post before the first day post basically)
                        (#(if (= cycle-type :day)
                            (cons (dec first-index) %)
                            %))


[PDOK-2505] add logging create extracts

[PDOK-2505] add logging create extracts

--- src/main/clojure/pdok/featured/extracts.clj
+++ src/main/clojure/pdok/featured/extracts.clj
@@ -134,15 +134,18 @@
         tl (config/timeline-for-dataset dataset)
         rc (fn-timeline-query tl collection)
         parts (a/pipe rc (a/chan 1 (partition-all batch-size)))]
-    (log/info "Create extracts for:" extract-type collection)
-    (loop [records (a/<!! parts)]
+    (log/info "Start create extracts" (str dataset "-" collection "-" extract-type))
+    (loop [i 1
+           records (a/<!! parts)]
       (when records
         (*process-delete-extract* dataset collection extract-type
                                   (filter (complement nil?) (mapcat changelog->change-deletes records)))
         (*process-insert-extract* dataset collection extract-type
                                   (filter (complement nil?) (map changelog->change-inserts records)))
         (*process-delete-extract* dataset collection extract-type (filter (complement nil?) (map changelog->deletes records)))
-        (recur (a/<!! parts))))))
+        (if (= 0 (mod i 10))
+          (log/info "Creating extracts" (str dataset "-" collection "-" extract-type) "processed:" (* i batch-size)))
+        (recur (inc i) (a/<!! parts))))))

 (defn- create-extract [dataset extract-type fn-timeline-query collections]
    (if-not (every? *initialized-collection?* (map (partial template/template-key dataset extract-type)


give :editing? 3 states for description

give :editing? 3 states for description

--- src-cljs/frontend/components/issues.cljs
+++ src-cljs/frontend/components/issues.cljs
@@ -132,8 +132,7 @@
   (reify
     om/IDisplayName (display-name [_] "Description form")
     om/IInitState (init-state [_] {:issue-description nil
-                                   :editing? false
-                                   :to-not-edit? false})
+                                   :editing? nil})
     om/IRenderState
     (render-state [_ {:keys [issue-description]}]
       (let [{:keys [issue-db cust cast!]} (om/get-shared owner)
@@ -172,16 +171,15 @@
                                              :on-click submit}
                   [:span "Save"]]))]]

-           [:div.comment {:class (when-not (om/get-state owner :to-not-edit?) " make ")}
-            [:div.issue-description-out {:class (when (om/get-state owner :to-not-edit?) " to-not-edit ")}
+           ;; Don't show sliding animation when the description replaces the form after an edit
+           [:div.comment {:class (when (nil? (om/get-state owner :editing?)) " make ")}
+            [:div.issue-description-out {:class (when (nil? (om/get-state owner :editing?)) " to-not-edit ")}
              (if (:issue/description issue)
                (:issue/description issue)

                (if editable?
                  [:a {:role "button"
-                      :on-click #(do
-                                   (om/set-state! owner :editing? true)
-                                   (om/set-state! owner :to-not-edit? true))}
+                      :on-click #(om/set-state! owner :editing? true)}
                   [:span "+ Add a description."]]

                  [:span "No description yet."]))]
@@ -198,9 +196,7 @@
                  [:span.pre "  •  "]
                  [:a.issue-description-edit {:role "button"
                                              :key "Edit"
-                                             :on-click #(do
-                                                          (om/set-state! owner :editing? true)
-                                                          (om/set-state! owner :to-not-edit? true))}
+                                             :on-click #(om/set-state! owner :editing? true)}
                   [:span "Edit"]]))]]))))))

 ;; XXX: handle logged-out users


#6 create a function to create a page

#6 create a function to create a page

--- src/kalar_plugins/templates/hiccup.clj
+++ src/kalar_plugins/templates/hiccup.clj
@@ -43,10 +43,6 @@
         metadata (md/md-to-html input output :parse-meta? true :heading-anchors true)
         html     (.toString output)]
     {:header metadata :body html}))
-
-(defn hoge [f]
-  (ehtml/select (ehtml/html-resource (StringReader. f)) [:p])
-  )

 (defn load-md-abst [^String md]
   (let [compiled (load-markdown md)
@@ -94,3 +90,19 @@
                  (spit output# ~body))
                ))
            )))))
+
+(defmacro def-page [dir body]
+  `(def hiccup#
+     (reify HiccupPlugin
+       (hiccup-compile [this]
+         (let [mds# (.listFiles (io/file ~dir))]
+           (dorun
+             (for [md# mds#]
+               (let [compiled# (load-markdown (.getAbsolutePath  md#))
+                     metadata# (:header compiled#)
+                     body# (:body compiled#)
+                     output# (io/file (kfile/find-dest) (-> metadata# :url first))
+                     ~'mp metadata#]
+                 (kfile/touch output#)
+                 (spit output# ~body)
+                 ))))))))


atom -> r/atom in intro

atom -> r/atom in intro

--- demo/reagentdemo/intro.cljs
+++ demo/reagentdemo/intro.cljs
@@ -1,5 +1,5 @@
 (ns reagentdemo.intro
-  (:require [reagent.core :as reagent :refer [atom]]
+  (:require [reagent.core :as r]
             [reagent.interop :refer-macros [.' .!]]
             [reagent.debug :refer-macros [dbg println]]
             [clojure.string :as string]
@@ -37,7 +37,7 @@
    "Here is a list:"
    [lister (range 3)]])

-(def click-count (atom 0))
+(def click-count (r/atom 0))

 (defn counting-component []
   [:div
@@ -52,24 +52,24 @@
            :on-change #(reset! value (-> % .-target .-value))}])

 (defn shared-state []
-  (let [val (atom "foo")]
+  (let [val (r/atom "foo")]
     (fn []
       [:div
        [:p "The value is now: " @val]
        [:p "Change it here: " [atom-input val]]])))

 (defn timer-component []
-  (let [seconds-elapsed (atom 0)]
+  (let [seconds-elapsed (r/atom 0)]
     (fn []
       (js/setTimeout #(swap! seconds-elapsed inc) 1000)
       [:div
        "Seconds Elapsed: " @seconds-elapsed])))

 (defn render-simple []
-  (reagent/render-component [simple-component]
-                            (.-body js/document)))
-
-(def bmi-data (atom {:height 180 :weight 80}))
+  (r/render-component [simple-component]
+                      (.-body js/document)))
+
+(def bmi-data (r/atom {:height 180 :weight 80}))

 (defn calc-bmi []
   (let [{:keys [height weight bmi] :as data} @bmi-data
@@ -107,7 +107,7 @@
       [slider :bmi bmi 10 50]]]))

 (def ns-src (s/syntaxed "(ns example
-  (:require [reagent.core :as reagent :refer [atom]]))"))
+  (:require [reagent.core :as r]))"))

 (defn intro []
@@ -277,7 +277,7 @@

    [:p "Incidentally, this page also uses another React trick: the
    entire page is pre-rendered using Node, and "
-   [:code "reagent/render-component-to-string"] ". When it is loaded
+   [:code "reagent.core/render-component-to-string"] ". When it is loaded
    into the browser, React automatically attaches event-handlers to
    the already present DOM tree."]])

@@ -322,7 +322,7 @@
                     :src (s/src-of nil "todomvc/core.cljs")}]])

 (defn main []
-  (let [show-all (atom false)
+  (let [show-all (r/atom false)
         head "Reagent: Minimalistic React for ClojureScript"]
     (js/setTimeout #(reset! show-all true) 500)
     (fn []


Made the record macro more flexible; it can now work on a parameter map as well as keyword parameters.

--- src/appengine_magic/utils.clj
+++ src/appengine_magic/utils.clj
@@ -12,11 +12,18 @@

 ;;; Adapted from: http://groups.google.com/group/clojure/msg/5206fac13144ea99
 (defmacro record
-  "Dynamic factory for Clojure record objects."
-  [name & {:as vals-map}]
-  `(let [con# (first (.getDeclaredConstructors ~name))
-         num# (alength (.getParameterTypes con#))]
-     (merge (.newInstance con# (make-array Object num#)) ~vals-map)))
+  "A dynamic factory for Clojure record objects. Takes either a map of key-value
+   pairs to be used for the record, or just the key-value pairs as keyword
+   arguments. Example: (record Record :a 1 :b 2) or (record Record {:a 1 :b 2})."
+  [record-type & args]
+  (let [vals-map (if (= 1 (count args))
+                     (first args)
+                     (apply hash-map args))]
+    `(let [constructor# (first (.getDeclaredConstructors ~record-type))
+           number-constructor-parameters# (alength (.getParameterTypes constructor#))]
+       (merge (.newInstance constructor#
+                            (make-array Object number-constructor-parameters#))
+              ~vals-map))))

 (defn copy-stream [^InputStream input, ^OutputStream output]


Minor fixups

Minor fixups

Correct some comments
Print (to the error console) the stack trace of the root exception
Remove unwanted debugging output

--- src/main/clojure/cascade/exception.clj
+++ src/main/clojure/cascade/exception.clj
@@ -12,12 +12,13 @@
 ; implied. See the License for the specific language governing permissions
 ; and limitations under the License.

-(ns #^{:doc "Exception reporting"}
+(ns #^{:doc "Exception reporting view and pipeline"}
   cascade.exception
   (:import (java.lang Throwable StackTraceElement))
-  (:require
+  (:require
   	(clojure.contrib (str-utils2 :as s2)))
   (:use
+  	(clojure stacktrace)
   	cascade
   	(cascade.internal utils)
   	(cascade config logging pipeline renderer)))
@@ -36,12 +37,9 @@
 	"Converts a stack frame into DOM nodes representing the Clojure namespace and function name(s),
 	or returns nil if the stack frame is not for a Clojure call frame."
 	[class-name method-name]
-	(debug "Converting: %s.%s" class-name method-name)
 	(when (contains? #{"invoke" "doInvoke"} method-name)
 		(let [[namespace-name & raw-function-ids] (s2/split class-name #"\$")
-		_ (debug "Raw function ids: %s" (ppstring raw-function-ids))
 				  function-ids (map #(nth (first (re-seq #"(\w+)__\d+" %)) 1 nil) raw-function-ids)
-				  _ (debug "Function ids: %s" (ppstring function-ids))
 				  function-names (map #(s2/replace % \_ \-) function-ids)]
 		  (if-not (empty? raw-function-ids)
 		  	(template
@@ -73,13 +71,11 @@
   })

 (defn transform-stack-trace
-  "Transforms a primitive array of StackTraceElements into individual maps; each with two keys:
-  :frame is a string representing the method name and location,
-  :class is a string (may be nil) used when rendering the frame (values to be defined)."
+  "Transforms a primitive array of StackTraceElements into individual maps;
+  :method-name is a seq of DOM nodes to describe the method and location
+  :element is the original StackTraceElement
+  :class-name is a keyword (may be nil) used when rendering the frame as an :li element"
   [elements]
-  ;; Currently very simple, but will expand in the future, when we convert Java stack frames
-  ;; for Clojure code into clojure names, and use the CSS class to hide uninteresting
-  ;; stack frames, and highlight application stack frames.
   (loop [seen-filter false
   			 queue (map transform-stack-frame (seq elements))
   			 result []]
@@ -143,7 +139,8 @@

 (defn include-js-library
   [env path]
-  (template
+  (template
+  	; Force open/close tags for stupid browser compatibility
   	:script { :type "text/javascript" :src (classpath-asset-path env path) } [ linebreak ]))

 (defview exception-report
@@ -168,6 +165,10 @@

       :ul { :class :c-exception-report } [
         (template-for [m (expand-exception-stack (-> env :cascade :exception))]
+        	; TODO: Smarter logic about which frames to be hidden
+        	; Currently, assumes only the deepest is interesting.
+        	; When we add some additonal levels of try/catch & report
+        	; it may be useful to display some of the outer exceptions as well
           :li { :class (if (nil? (m :stack-trace)) :c-omitted) } [ (render-exception-map m) ])
       ]

@@ -177,12 +178,12 @@

 		  	(render (-> env :servlet-api :request))
 			]
-
     ]
   ])

 (create-pipeline :request-exception
   (fn [env exception]
     (debug "Request exception: %s" exception)
+    (.printStackTrace (root-cause exception))
     (call-pipeline :render-view (assoc-in env [:cascade :exception] exception) #'exception-report)))


Refactor chart component to use reagent's with-let

--- src/cljs/my_money/components/charts.cljs
+++ src/cljs/my_money/components/charts.cljs
@@ -22,20 +22,19 @@
       (get "yLabel")
       (str "€")))

-(defn chart [events-to-show starting-amount all-events]
-  (let [collapsed? (r/atom false)]
-    (fn [events-to-show starting-amount events]
-      (let [date-sums (events->date-sums events-to-show starting-amount events)
-            chart-options {:width   400
-                           :height  100
-                           :data    {:labels   (map :date date-sums)
-                                     :datasets [{:data (map date-sum->amount date-sums)
-                                                 :fill false}]}
-                           :options {:scales   {:xAxes [{:display false}]}
-                                     :legend   {:display false}
-                                     :tooltips {:callbacks {:label moneyfy-y-label}}}}]
+(defn chart [events-to-show starting-amount events]
+  (r/with-let [collapsed? (r/atom false)]
+    (let [date-sums (events->date-sums events-to-show starting-amount events)
+          chart-options {:width   400
+                         :height  100
+                         :data    {:labels   (map :date date-sums)
+                                   :datasets [{:data (map date-sum->amount date-sums)
+                                               :fill false}]}
+                         :options {:scales   {:xAxes [{:display false}]}
+                                   :legend   {:display false}
+                                   :tooltips {:callbacks {:label moneyfy-y-label}}}}]

-        [:div.container
-         [c/collapsing-button collapsed?]
-         [:div.row {:class (when @collapsed? "collapse")}
-          [line-chart chart-options]]]))))
+      [:div.container
+       [c/collapsing-button collapsed?]
+       [:div.row {:class (when @collapsed? "collapse")}
+        [line-chart chart-options]]])))


Use real recipients from events for the savings search

--- src/cljs/my_money/components/config.cljs
+++ src/cljs/my_money/components/config.cljs
@@ -1,5 +1,6 @@
 (ns my-money.components.config
   (:require [clojure.string :as string]
+            [my-money.events :as events]
             [my-money.components.common :as c]
             [ajax.core :as ajax]
             [reagent.core :as r]
@@ -42,11 +43,12 @@
          {:on-click #(swap! data update :selected-recipients disj recipient)}
          "×"]]))])

+
 (defn- fields [data]
   [:div
    [c/number-input "Starting amount (Amount of money before first event)" :amount "Amount" data [false]]
    [c/search-input "Add recipients as savings" :recipient-search "Recipient" data [false]]
-   [search-result-list data ["Savings account" "Fund"]]
+   [search-result-list data (into #{} (map :recipient @events/response-data))]
    [savings-recipient-list data]])

 (defn config-saved []


keep marker/polyline object in state.

keep marker/polyline object in state.

--- src/cljs/om_next_leaflet/ui/leaflet.cljs
+++ src/cljs/om_next_leaflet/ui/leaflet.cljs
@@ -49,32 +49,52 @@
         opts (merge {} opts)]
     (.polyline js/L (clj->js geom) (clj->js opts))))

+(defn create-marker*
+  [target-layer line-name station-name geometry]
+  (let [[lng lat] geometry
+        marker (apply create-marker lat lng (:marker-default-style custom-styles))]
+    (doto marker
+      (.bindPopup (str "" line-name "
" station-name))
+      (.on "mouseover" (fn [e] (.setStyle marker (clj->js (:station-marker-mouseover-style custom-styles)))))
+      (.on "mouseout" (fn [e] (.setStyle marker (clj->js (:station-marker-default-style custom-styles)))))
+      )
+    marker))
+
 (defn init-station-markers
   [leaflet-obj stations]
-  (let [target-layer (-> leaflet-obj om/get-state :stations-layer)]
-    (doseq [{:keys [id station-name line-name geometry]} stations]
-      (let [[lng lat] geometry
-            marker (apply create-marker lat lng (:marker-default-style custom-styles))]
-        (doto marker
-          (.bindPopup (str "" line-name "
" station-name))
-          (.on "mouseover" (fn [e] (.setStyle marker (clj->js (:station-marker-mouseover-style custom-styles)))))
-          (.on "mouseout" (fn [e] (.setStyle marker (clj->js (:station-marker-default-style custom-styles)))))
-          (.addTo target-layer))))))
+  (let [target-layer (-> leaflet-obj om/get-state :stations-layer)
+        markers (map (fn [{:keys [id station-name line-name geometry]}]
+                       (create-marker* target-layer line-name station-name geometry))
+                     stations)]
+    (when-let [old-markers (-> leaflet-obj om/get-state :markers)]
+      (doseq [marker old-markers]
+        (.removeFrom marker target-layer)))
+    (doseq [m markers]
+      (.addTo m target-layer))
+    (om/update-state! leaflet-obj assoc :markers (doall markers))))
+
+(defn create-polyline*
+  [target-layer id name geometry]
+  (let [polyline (apply create-polyline geometry (:polyline-default-style custom-styles))]
+    (doto polyline
+      (.bindTooltip (str "" name "[" id "]"))
+      (.on "mouseover" (fn [e]
+                         (.setStyle polyline (clj->js (:mouseover-style custom-styles)))
+                         (.openTooltip polyline (.-latlng e))))
+      (.on "mouseout" (fn [e]
+                        (.setStyle polyline (clj->js (:default-style custom-styles)))
+                        (.closeTooltip polyline))))
+    polyline))

 (defn init-polylines
   [leaflet-obj lines]
-  (let [target-layer (-> leaflet-obj om/get-state :lines-layer)]
-    (doseq [[id name bounding-box geometry] lines]
-      (let [polyline (apply create-polyline geometry (:polyline-default-style custom-styles))]
-        (doto polyline
-          (.bindTooltip (str "" name "[" id "]"))
-          (.on "mouseover" (fn [e]
-                             (.setStyle polyline (clj->js (:mouseover-style custom-styles)))
-                             (.openTooltip polyline (.-latlng e))))
-          (.on "mouseout" (fn [e]
-                            (.setStyle polyline (clj->js (:default-style custom-styles)))
-                            (.closeTooltip polyline)))
-          (.addTo target-layer))))))
+  (let [target-layer (-> leaflet-obj om/get-state :lines-layer)
+        polylines (map (fn [[id name bounding-box geometry]]
+                         (create-polyline* target-layer id name geometry))
+                       lines)]
+    (doseq [l polylines]
+      (.addTo l target-layer))
+    (om/update-state! leaflet-obj assoc :polylines (doall polylines))))

 (defn draw-created-fn
   [this]


add more disabled (delete-from-expressions) examples

--- src/babel/francais/writer.clj
+++ src/babel/francais/writer.clj
@@ -27,6 +27,12 @@
       (delete-from-expressions "fr" {:synsem {:sem {:aspect :perfect, :tense :past}}, :root {:français {:français "avoir"}}}))
     (if false
       (delete-from-expressions "fr" {:synsem {:sem {:aspect :perfect, :tense :past}}, :root {:français {:français "être"}}}))
+
+    (if false
+      (delete-from-expressions "fr" {:synsem {:sem {:aspect :perfect, :tense :past}}, :root {:français {:français "abandoner"}}}))
+
+    (if false
+      (delete-from-expressions "fr" {:synsem {:sem {:aspect :perfect, :tense :past}}}))

     (write-lexicon "fr" @lexicon)
     (let [


Minor style fix on sitemap.

Minor style fix on sitemap.

--- src/uxbox/ui/workspace/sidebar/sitemap.cljs
+++ src/uxbox/ui/workspace/sidebar/sitemap.cljs
@@ -46,15 +46,18 @@

 (defn page-item-render
   [own page total active?]
-  (let [deletable? (> total 1)
-        navigate #(rs/emit! (dp/go-to (:project page) (:id page)))
-        edit #(lightbox/open! :page-form {:page page})
-        delete (fn [e]
-                 (dom/prevent-default e)
-                 (dom/stop-propagation e)
-                 (let [next (dp/go-to (:project page))
-                       event (udp/delete-page (:id page) next)]
-                   (rs/emit! event)))]
+  (letfn [(edit [event]
+            (lightbox/open! :page-form {:page page}))
+
+          (navigate [event]
+            (rs/emit! (dp/go-to (:project page) (:id page))))
+
+          (delete [event]
+            (dom/prevent-default event)
+            (dom/stop-propagation event)
+            (let [next (dp/go-to (:project page))
+                  event (udp/delete-page (:id page) next)]
+              (rs/emit! event)))]
     (html
      [:li {:class (when active? "selected")
            :on-click navigate}
@@ -62,7 +65,7 @@
       [:span (:name page)]
       [:div.page-actions
        [:a {:on-click edit} i/pencil]
-       (if deletable?
+       (if (> total 1)
          [:a {:on-click delete} i/trash])]])))

 (def ^:const page-item


Use static-properties instead of class-properties.

--- src/org/martinklepsch/derivatives.cljc
+++ src/org/martinklepsch/derivatives.cljc
@@ -137,7 +137,7 @@
     mixin."
     [spec]
     #?(:cljs
-       {:class-properties {:childContextTypes context-types}
+       {:static-properties {:childContextTypes context-types}
         :child-context    (fn [_] (let [pool (derivatives-pool spec)]
                                     {release-k (partial release! pool)
                                      get-k (partial get! pool)}))}))
@@ -146,7 +146,7 @@
     "Like rum-derivatives but get the spec from the arguments passed to the components (`:rum/args`) using `get-spec-fn`"
     [get-spec-fn]
     #?(:cljs
-       {:class-properties {:childContextTypes context-types}
+       {:static-properties {:childContextTypes context-types}
         :init             (fn [s _] (assoc s ::spec (get-spec-fn (:rum/args s))))
         :child-context    (fn [s] (let [pool (derivatives-pool (::spec s))]
                                     {release-k (partial release! pool)
@@ -159,7 +159,7 @@
     #?(:cljs
        (let [token (rand-int 10000)] ; TODO think of something better here
          (assert (seq drv-ks) "The drv mixin needs at least one derivative ID")
-         {:class-properties {:contextTypes context-types}
+         {:static-properties {:contextTypes context-types}
           :will-mount    (fn [s]
                            (let [get-drv! (-> s :rum/react-component (gobj/get "context") (gobj/get get-k))]
                              (assert get-drv! "No get! derivative function found in component context")


Added verify-virtual-unbalanced as start for balance verification / auto-balancing

--- src/wealthpulse/parser.clj
+++ src/wealthpulse/parser.clj
@@ -2,11 +2,34 @@
 	(:require [instaparse.core :as insta]
 		[clojure.string :as string]))

+;
 ; Journal records
+;
+
 (defrecord Header [date status code payee note])
 (defrecord Amount [quantity commodity])
 (defrecord Entry [header account account-lineage entry-type amount note])

+
+
+;
+; Verify balances and autobalance
+;
+
+(defn verify-virtual-unbalanced
+  "Virtual unbalanced transactions must have an amount (since they are unbalanced)"
+  [entries]
+  (let [vu-entries (filter #(and (= (:entry-type %) :virtual-unbalanced)
+                                 (or (nil? (:amount %))
+                                     (nil? (:quantity (:amount %)))))
+                           entries)]
+    (if (> (count vu-entries) 0)
+      (println "This transaction has" (count vu-entries) "virtual unbalanced entries."))))
+
+
+;
+; Parse tree transforms
+;

 (defn transform-header
 	"Transform a header from the parse tree into a Header record."
@@ -80,6 +103,10 @@

+;
+; Parsing
+;
+
 (def parse-transaction
 	"Parses a string containing a single transaction."
 	(insta/parser "src/wealthpulse/transaction.grammar"))


url fix on participant list

url fix on participant list

--- src/freecoin/views/participants_list.clj
+++ src/freecoin/views/participants_list.clj
@@ -33,7 +33,7 @@

 (defn render-participant [wallet]
   [:li {:style "margin: 1em" :class "clj--participant__item"}
-   [:a {:href (str "/participant/" (:uid wallet))}
+   [:a {:href (str "/account/" (:uid wallet))}
     [:div {:class "card pull-left" }
      [:span (t/locale [:wallet :name]) ": " (:name wallet)]
      [:br]


changed at add form on click function

changed at add form on click function

--- src_cljs/rrm/corecljs.cljs
+++ src_cljs/rrm/corecljs.cljs
@@ -621,7 +621,7 @@
          (when (nil? (:id @data-set)) [button {:bs-style "info" :on-click #((reset! data-set {:isactive true})
                                                                             (reset-mut-combo-boxes))} "Refresh"])
          [button {:bs-style "danger" :on-click form-cancel } "Cancel"]]]]
-       ;;[:span (str @data-set)]
+       [:span (str @data-set)]
        ]]]])

 (defn receiveddate-validator [data-set]
@@ -733,7 +733,22 @@

 (defn add-form-onclick [data-set focus]
   (if (= nil (form-validator @data-set))
-    (let [onres (fn[json] (reset! data-set {:isactive true}))]
+    (let [onres (fn[json] (swap! data-set dissoc
+                                 :mutationnumber
+                                 :khasranumber
+                                 :khatakhatuninumber
+                                 :nameofthesecondparty
+                                 :nameofthefirstparty
+                                 :nameofpo
+                                 :o6number
+                                 :o2number
+                                 :o4number
+                                 :title
+                                 :dateofdecision
+                                 :dateofinstitution
+                                 :racknumber
+                                 :area
+                                 ))]
       (http-post (str serverhost "mutations") onres  (.serialize (Serializer.) (clj->js (map-mutation-data @data-set)))))
     (reset! focus "on")))


Forgot one :yes-effect -> :yes-ability

Forgot one :yes-effect -> :yes-ability

--- src/clj/game/cards-assets.clj
+++ src/clj/game/cards-assets.clj
@@ -12,7 +12,7 @@
     :access {:optional
              {:req (req installed) :prompt "Pay 2 [Credits] to use Aggressive Secretary ability?"
               :cost [:credit 2]
-              :yes-effect {:effect (req (let [agg card]
+              :yes-ability {:effect (req (let [agg card]
                                           (resolve-ability
                                            state side (assoc (assoc-in trash-program [:choices :max] (req (:advance-counter agg)))
                                                         :effect (effect (trash-cards targets))) agg nil)))}}}}


work around https://code.google.com/p/chromium/issues/detail?id=552455

no browser seems to support index source maps with "url"
inlining works in chrome but is too expensive

--- src/clj/shadow/cljs/build.clj
+++ src/clj/shadow/cljs/build.clj
@@ -1670,23 +1670,35 @@
   (with-open [rdr (io/reader (StringReader. text))]
     (count (line-seq rdr))))

-(defn create-index-map [state out-file init-offset {:keys [sources js-name] :as mod}]
+(defn create-index-map
+  [{:keys [public-dir cljs-runtime-path] :as state} out-file init-offset {:keys [sources js-name] :as mod}]
   (let [index-map
         (reduce
           (fn [src-map src-name]
-            (let [{:keys [type output js-name] :as rc} (get-in state [:sources src-name])]
-              (let [lc (line-count output)
-                    start-line (:current-offset src-map)
-                    ;; extra 2 lines per file
-                    ;; // SOURCE comment
-                    ;; goog.dependencies_.written[src] = true;
-                    src-map (update src-map :current-offset + lc 2)]
-                (if (= :cljs type)
-                  (update src-map :sections conj {:offset {:line (+ start-line 3) :column 0}
-                                                  :url (str js-name ".map")})
-                  ;; only have source-maps for cljs
-                  src-map)
-                )))
+            (let [{:keys [type output js-name] :as rc} (get-in state [:sources src-name])
+                  source-map-file (io/file public-dir cljs-runtime-path (str js-name ".map"))
+                  lc (line-count output)
+                  start-line (:current-offset src-map)
+
+                  ;; extra 2 lines per file
+                  ;; // SOURCE comment
+                  ;; goog.dependencies_.written[src] = true;
+                  src-map (update src-map :current-offset + lc 2)]
+
+              (if (= :cljs type)
+                (update src-map :sections conj {:offset {:line (+ start-line 3) :column 0}
+                                                ;; :url (str js-name ".map")
+                                                ;; chrome doesn't support :url
+                                                ;; see https://code.google.com/p/chromium/issues/detail?id=552455
+                                                ;; FIXME: inlining the source-map is expensive due to excessive parsing
+                                                ;; could try to insert MARKER instead and str/replace
+                                                ;; 300ms is acceptable for now, but might not be on bigger projects
+                                                ;; flushing the unoptmized version should not exceed 100ms
+                                                :map (json/read-str (slurp source-map-file))
+                                                })
+                ;; only have source-maps for cljs
+                src-map)
+              ))
           {:current-offset init-offset
            :version 3
            :file (str "../" js-name)


Get slightly hungier and thirstier

Get slightly hungier and thirstier

--- src/cljc/robinson/update.cljc
+++ src/cljc/robinson/update.cljc
@@ -1880,8 +1880,8 @@
           (update-in [:world :player :hunger] (partial + 0.01))
           (update-in [:world :player :thirst] (partial + 0.05)))
         (-> state
-          (update-in [:world :player :hunger] (partial + 0.05 (* 0.02 (count (rp/player-inventory state)))))
-          (update-in [:world :player :thirst] (partial + 0.1))))
+          (update-in [:world :player :hunger] (partial + 0.06 (* 0.02 (count (rp/player-inventory state)))))
+          (update-in [:world :player :thirst] (partial + 0.15))))
       (if (> (rp/player-hunger state) (rp/player-max-hunger state))
         (do
           (log/info "Player died from hunger")


deprecate clojure.reflect namespace now that REPLs are significantly enhanced, static vars, etc.

--- src/cljs/clojure/reflect.cljs
+++ src/cljs/clojure/reflect.cljs
@@ -1,4 +1,5 @@
 (ns clojure.reflect
+  ^{:doc "DEPRECATED. Do not use, superceded by REPL enhancements."}
   (:refer-clojure :exclude [meta])
   (:require [clojure.browser.net :as net]
             [clojure.browser.event :as event]))


Use dereferenced state

Use dereferenced state

--- src/cljs/koeeoadi/parser.cljs
+++ src/cljs/koeeoadi/parser.cljs
@@ -165,9 +165,11 @@
    (fn []
      (let [st      @state
            new-id  (new-color-id (:colors/list st))]
-       (reset! state (-> @state
+       (reset! state (-> st
                        (assoc-in [:colors/by-id new-id] {:color/id new-id :color/hex "#FFFFFF"})
-                       (update :colors/list conj [:colors/by-id new-id])))))})
+                       (update :colors/list conj [:colors/by-id new-id])
+                       (assoc :palette-widget/active-color [:colors/by-id new-id])
+                       (assoc :palette-widget/face-classes-by-color-type (util/faces-to-colorize (:faces/list st) new-id))))))})

 (defmethod mutate 'palette-widget/update
   [{:keys [state]} _ props]