Separated thread load from thread display

I'll keep all threads I've loaded and refresh as necessary. Instead of
keeping track of a single thread, I'll just keep track of the URL to
display.

https://app.asana.com/0/17212341701456/170264677183621

--- src/cljs/memento/core.cljs
+++ src/cljs/memento/core.cljs
@@ -97,6 +97,7 @@
   (reaction (get-in @db [sid element-id])))

 (register-sub :note general-query)
+(register-sub :threads general-query)
 (register-sub :ui-state general-query)
 (register-sub :search-state general-query)
 (register-sub :credentials general-query)
@@ -162,6 +163,7 @@
                                  :results-page  0
                                  :memories      {:pages 0}
                                  :is-searching? false}
+                      :threads  {}
                       :note     {:edit-memory nil}
                       })))

@@ -228,10 +230,10 @@
               (> p (or (get-in app-state [:search-state :page-index]) -1)))
         (do
           (GET "/api/search" {:params        {:q q :page p}
-                                     :headers       {:authorization (str "Token " (get-in app-state [:credentials :token]))}
-                                     :handler       #(dispatch [:memories-load-success %])
-                                     :error-handler #(dispatch [:memories-load-error %])
-                                     })
+                              :headers       {:authorization (str "Token " (get-in app-state [:credentials :token]))}
+                              :handler       #(dispatch [:memories-load-success %])
+                              :error-handler #(dispatch [:memories-load-error %])
+                              })
           (-> app-state
               (assoc-in [:ui-state :is-searching?] true)
               (assoc :search-state {:query       q
@@ -290,12 +292,12 @@
 (register-handler
   :memory-edit-save-success
   (fn [app-state [_ msg]]
-    (let [thread (get-in app-state [:note :thread])]
+    (let [thread-id (get-in app-state [:ui-state :show-thread-id])]
       (dispatch [:state-message (str "Updated memory to: " msg) "alert-success"])
       (if (= :remember (get-in app-state [:ui-state :section])) ; Just in case we allow editing from elsewhere...
         (dispatch [:memories-load]))
-      (if thread
-        (dispatch [:thread-load (:id (first thread))]))
+      (if thread-id
+        (dispatch [:thread-load thread-id]))
       (-> app-state
           (assoc-in [:ui-state :is-busy?] false)
           (assoc-in [:note :edit-memory] nil)
@@ -323,14 +325,14 @@
 (register-handler
   :memory-forget-success
   (fn [app-state [_ msg]]
-    (let [thread     (get-in app-state [:note :thread])
-          in-thread? (and thread
+    (let [thread-id  (get-in app-state [:ui-state :show-thread-id])
+          in-thread? (and thread-id
                           (get-in app-state [:ui-state :show-thread?]))]
       (dispatch [:state-message (str "Thought forgotten") "alert-success"])
       (if (= :remember (get-in app-state [:ui-state :section])) ; Just in case we allow editing from elsewhere...
         (dispatch [:memories-load]))
       (if in-thread?
-        (dispatch [:thread-load (:id (first thread))]))
+        (dispatch [:thread-load thread-id]))
       (-> app-state
           (assoc-in [:ui-state :is-busy?] false)
           (assoc-in [:note :edit-memory] nil)
@@ -353,9 +355,9 @@
   (fn [app-state _]
     (let [note (get-in app-state [:note :current-note])]
       (POST "/api/thoughts" {:params        {:thought note :refine_id (get-in app-state [:note :focus :id])}
-                           :headers       {:authorization (str "Token " (get-in app-state [:credentials :token]))}
-                           :handler       #(dispatch [:memory-save-success note])
-                           :error-handler #(dispatch [:memory-save-error %])}))
+                             :headers       {:authorization (str "Token " (get-in app-state [:credentials :token]))}
+                             :handler       #(dispatch [:memory-save-success note])
+                             :error-handler #(dispatch [:memory-save-error %])}))
     (assoc-in app-state [:ui-state :is-busy?] true)))

 (register-handler
@@ -365,7 +367,7 @@
     (-> app-state
         (assoc-in [:ui-state :is-busy?] false)
         (assoc-in [:note :current-note] "")
-        (assoc-in [:note :thread] nil)
+        (assoc-in [:ui-state :show-thread-id] nil)
         (assoc-in [:ui-state :show-thread?] false)
         (assoc-in [:note :focus] nil)
         (assoc :search-state nil))))
@@ -392,16 +394,19 @@
 (register-handler
   :thread-load-error
   (fn [app-state [_ result]]
+    ; Not sure if we actually know which thread failed loading. Probably not if the call failed altogether.
+    ; If we did, we could just assoc the thread to nil.
     (dispatch [:state-message (str "Error loading thread: " result) "alert-danger"])
     app-state))

 (register-handler
   :thread-load-success
-  (fn [app-state [_ {:keys [results] :as result}]]
+  (fn [app-state [_ {:keys [id results] :as result}]]
     (dispatch [:state-ui-section :remember])
     (-> app-state
         (assoc-in [:ui-state :show-thread?] (not (empty? results)))
-        (assoc-in [:note :thread] (add-html-to-thoughts results)))
+        (assoc-in [:threads id] (add-html-to-thoughts results))
+        (assoc-in [:ui-state :show-thread-id] id))
     ))

@@ -511,9 +516,7 @@
             [:ul {:class "nav navbar-nav"}
              [navbar-item "Record" :record]
              [navbar-item "Remember" :remember]])
-          ]]
-        ]]
-      )))
+          ]]]])))

 (defn alert []
@@ -683,8 +686,9 @@

 (defn memory-thread []
-  (let [show?  (subscribe [:ui-state :show-thread?])
-        thread (subscribe [:note :thread])]
+  (let [show?     (subscribe [:ui-state :show-thread?])
+        thread-id (subscribe [:ui-state :show-thread-id])
+        thread    (subscribe [:threads @thread-id])]
     (fn []
       [Modal {:show @show? :onHide #(dispatch [:state-show-thread false])}
        [ModalBody


Add group_name to JSON search results.

Add group_name to JSON search results.

--- src/clojars/web/search.clj
+++ src/clojars/web/search.clj
@@ -12,6 +12,7 @@

 (defn- jar->json [jar]
   (let [m {:jar_name (:jar_name jar)
+           :group_name (:group_name jar)
            :version (:version jar)
            :description (:description jar)}
         created (:created jar)]


Fix a typo in function name

Fix a typo in function name

--- src/clojure/flambo/api.clj
+++ src/clojure/flambo/api.clj
@@ -505,7 +505,7 @@
   "Zips this RDD with another one, returning PairRDD with the first element in each RDD, second element in each RDD, etc."
   (memfn zip))

-(def zip-with-ndex
+(def zip-with-index
   "Zips this RDD with its element indices, returning PairRDD"
   (memfn zipWithIndex))


Reformatting API documentation

Reformatting API documentation

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

--- src/conexp/contrib/doc.clj
+++ src/conexp/contrib/doc.clj
@@ -67,7 +67,7 @@
                              (map #(nth (re-find #"(  )?(.*)$" %1) 2)
                                   (split doc #"\n")))]
              (cl-format true
-                        "~%-  Function `~A` ~%~% * Argument List: `~A` ~%~% * Documentation: ~A ~%"
+                        "~%####  Function `~A` ~%~%Argument List: `~A` ~%~%Documentation: ~A ~%"
                         f f arglist doc)))))))

 (defn public-api-to-file


Got rid of several let bindings by using map.

--- nav-obj-splitter.clj
+++ nav-obj-splitter.clj
@@ -28,11 +28,8 @@
 (defn make-single-file-name
   "Returns a file name built from object meta data."
   [object-metadata]
-  (let [type-id (:type-id object-metadata)
-        type (:type object-metadata)
-        id (:id object-metadata)
-        file-name (join "-" [type-id, type, id])]
-    (join [file-name ".txt"])))
+  (let [file-name (join "-" (map object-metadata [:type-id :type :id]))]
+    (str file-name ".txt")))

 ; Some tests
 (def meta-data-example {:type-id 1 :type "Table" :id "70902" :name "Test Table (48)"})


cycle-number should now be taken into account when cycle-numbers are put to new votes

--- src/mafia_votecount/scraper/team_liquid.clj
+++ src/mafia_votecount/scraper/team_liquid.clj
@@ -262,7 +262,7 @@
     {:cycle-number (last-cycle-number cycle-number cycle-type day-ranges)
      :last-index (-> indexed (last) (first) (#(if % % first-index)))
      :cycle-type last-cycle-type
-     :votes (days-into-votes (range 1 (inc (count day-ranges)))
+     :votes (days-into-votes (range first-index (+ first-index (count day-ranges) 1))
                       (map #(get-votes-in-range indexed %) day-ranges))}))

 (defn scan-all-votes-after [url hosts first-index cycle-number cycle-type]


started some cluster stuff

started some cluster stuff

--- src/k_means/core.clj
+++ src/k_means/core.clj
@@ -21,13 +21,8 @@

 (defn mean-centroids
   "Calculates the mean for a given centroid"
-  [c l]
-  c)
-
-(defn cluster
-  "take a vector and cluster it via distance"
-  [c l]
-  c)
+  [g]
+  g)
 ; (defn centroid)

 (defn distance
@@ -35,6 +30,25 @@
   ([[p1 p2] [q1 q2]]
     (Math/sqrt (+ (Math/pow (- q1 q2) 2) (Math/pow (- p1 p2) 2)))))
     ; (->> (map - c1 c2) (map #(* % %)) (reduce +))))) ; This is a better implementation for when this gets parallelised
+
+(defn min-index
+  [c]
+  (.indexOf c (apply min c)))
+
+(defn min-distance
+  "returns the index of the centroid c closest to vecotr v"
+  [c v]
+    (for [i c :let [d (distance i v)]] d))
+
+(defn cluster
+  "take a vector and cluster it via distance"
+  [g l c]
+  (println g)
+  (cond
+    (empty? g) (recur (hash-set (range 0 (count c))) l c)
+    (not-empty l) (recur (conj (first l) (get g (min-index (min-distance c (first l))))) (rest l) c)
+    :else
+    g))

 (defn min-vector
   "Chooses the smallest vector in a set of vectors"
@@ -52,17 +66,17 @@
 (defn k-means
   "Perform the actual k-means"
   ([l k]
-    (k-means l k (choose-initial-centroids l k) (make-array Float/TYPE k)))
+    (k-means l k (choose-initial-centroids l k) (hash-set (range 0 k))))
   ([l k c g]
-    (cond
-      ; These functions aren't actually correct
-      (< (count g) (count l)) ; Add in new data to the clusters
-        (recur (rest l) k (mean-centroids c g) (cluster g l))
-      (still-moving? c) ; Keep shifting centroids until equilibrium
-        (recur nil k (mean-centroids c g) (cluster g l))
-      :else g)))
+    (let [g (cluster g l c) c (mean-centroids g)]
+      ; (println g)
+      (cond
+        (still-moving? c) ; Keep shifting centroids until equilibrium
+          ; (recur nil k c g)
+          g
+        :else g))))

 (defn -main
   "Main function for k-means"
   [& args]
-  (k-means [[1 2] [3 2] [6 3] [1 8] [9 10] [1 4]] 2))
+  (k-means [[1 2] [3 2] [6 3] [1 8] [9 10] [1 4]] 3))


debugger: use map instead of pair for signal event

--- examples/_common/middleware/devtools.cljs
+++ examples/_common/middleware/devtools.cljs
@@ -22,7 +22,7 @@
 (def Schema
   {::debugger {:initial-model              {schema/Any schema/Any}

-               :signal-events              [(schema/pair schema/Int "id" schema/Any "signal")]
+               :signal-events              [{:id schema/Int :signal schema/Any}]
                :next-signal-id             schema/Int

                :action-events              [{:id        schema/Int
@@ -57,7 +57,8 @@

 (defn -signal-event
   [id signal]
-  [id signal])
+  {:id     id
+   :signal signal})

 (defn -action-event
   [signal-id id action result]
@@ -84,7 +85,7 @@
   (->> model
        ::debugger
        :signal-events
-       (filter #(= (first %) id))
+       (filter #(= (:id %) id))
        first))

 (defn -find-action
@@ -110,9 +111,9 @@
     (fn control
       [model signal dispatch-signal dispatch-action]
       (letfn [(record-and-dispatch-to-app [signal]
-                (let [[signal-id _ :as signal-event] (-signal-event (-> @model ::debugger :next-signal-id) signal)]
+                (let [signal-event (-signal-event (-> @model ::debugger :next-signal-id) signal)]
                   (dispatch-action [::record-signal-event signal-event])
-                  (app-control model signal dispatch-signal #(dispatch-action [::app-action signal-id %]))))]
+                  (app-control model signal dispatch-signal #(dispatch-action [::app-action (:id signal-event) %]))))]
         (match signal
                :on-start
                (do
@@ -177,8 +178,8 @@
 ;;;;;;;;;;;;;;;;;;;;;;;; Reconcile
 (defn -orphaned-signal?
   "Orphaned signal has no actions."
-  [model [signal-id _ :as _signal_]]
-  (empty? (filter #(= (:signal-id %) signal-id)
+  [model signal]
+  (empty? (filter #(= (:signal-id %) (:id signal))
                   (-> model ::debugger :action-events))))

 (defn -wrap-reconcile
@@ -249,16 +250,16 @@
                                                                                (dissoc m ::debugger))])
                    (update-in m [::debugger :next-action-id] inc))

-             ; looks like originating signal could be already cleared -> create "unknown signal" to record this action
+             ; else: looks like originating signal could be already cleared -> create "unknown signal" to record this action
              (reconcile model a))

            ; for bare app actions (e.g. when originating signal was cleared) create an "unknown signal" event
            :else
-           (let [[signal-id _ :as unknown-signal-event] (-signal-event (-> model ::debugger :next-signal-id) ::unknown-signal)]
+           (let [unknown-signal-event (-signal-event (-> model ::debugger :next-signal-id) ::unknown-signal)]
              (-> model
                  (update-in [::debugger :signal-events] concat [unknown-signal-event])
                  (update-in [::debugger :next-signal-id] inc)
-                 (reconcile [::app-action signal-id action]))))))
+                 (reconcile [::app-action (:id unknown-signal-event) action]))))))

 ;;;;;;;;;;;;;;;;;;;;;;;; View model
 (defn -view-model
@@ -358,11 +359,11 @@
   [signal-events action-events dispatch]
   [:div
    (doall
-     (for [[signal-id signal] signal-events]
-       ^{:key signal-id}
+     (for [{:keys [id signal]} signal-events]
+       ^{:key id}
        [:div
-        [-signal-view signal-id signal dispatch]
-        [-actions-view action-events signal-id dispatch]]))])
+        [-signal-view id signal dispatch]
+        [-actions-view action-events id dispatch]]))])

 (defn -initial-model-view
   [initial-model]


Modify tests to utilize the return of a hashmap from cl and lift functions

--- test/hydrofoil/expectations/model.clj
+++ test/hydrofoil/expectations/model.clj
@@ -219,10 +219,10 @@

 ;;;-------- coefficient-of-lift-symetric ---------
 (expect 0.0
-        (round-double (coefficient-of-lift (NACA-design 0 0.5 10) (run-constants 0 0 0))))
+        (round-double (:cl (coefficient-of-lift (NACA-design 0 0.5 10) (run-constants 0 0 0)))))

 (expect 2.1932
-        (round-double (coefficient-of-lift (NACA-design 0 0.5 10) (run-constants 0 0 20))))
+        (round-double (:cl (coefficient-of-lift (NACA-design 0 0.5 10) (run-constants 0 0 20)))))

 ;;;-------- coefficient-of-lift-Components ---------
 ;(expect 0.0882
@@ -239,4 +239,4 @@
         (round-double (A-1 (NACA-design 2 4 12) (run-constants 0 0 0))))

 (expect 0.2275
-        (round-double (coefficient-of-lift (NACA-design 2 4 12) (run-constants 0 0 0))))
+        (round-double (:cl (coefficient-of-lift (NACA-design 2 4 12) (run-constants 0 0 0)))))


properly munge azure fn names

properly munge azure fn names

--- src/main/shadow/build/targets/azure_app.clj
+++ src/main/shadow/build/targets/azure_app.clj
@@ -42,7 +42,7 @@
         fn-sym (-> azure-fn name symbol)

         fn-id-s
-        (name fn-id)
+        (-> fn-id name cljs-comp/munge)

         fn-meta
         (get-in state [:compiler-env :cljs.analyzer/namespaces fn-ns :defs fn-sym :meta])


More fixes for inbox pagination url.

More fixes for inbox pagination url.

--- src/oc/storage/representations/activity.clj
+++ src/oc/storage/representations/activity.clj
@@ -24,7 +24,7 @@
     (str "/orgs/" slug "/" collection-type sort-path)))
   ([collection-type {slug :slug :as org} sort-type {start :start direction :direction}]
   (let [concat-str (if (= sort-type :recent-activity) "&" "?")]
-    (str (url collection-type org sort-type) concat-str "start=" start (when direction "&direction=" (name direction))))))
+    (str (url collection-type org sort-type) concat-str "start=" start (when direction (str "&direction=" (name direction)))))))

 (defn- is-inbox? [collection-type]
   (= collection-type "inbox"))
@@ -37,8 +37,10 @@
         last-activity (last activity)
         last-activity-date (when activity? (or (:last-activity-at last-activity) (:last-activity-at last-activity)))
         next? (= (:next-count data) config/default-activity-limit)
-        url-fn (if (is-inbox? collection-type) inbox-url url)
-        next-url (when next? (url-fn collection-type org sort-type {:start last-activity-date :direction direction}))
+        next-url (when next?
+                   (if (is-inbox? collection-type)
+                     (inbox-url collection-type org {:start last-activity-date :direction direction})
+                     (url collection-type org sort-type {:start last-activity-date :direction direction})))
         next-link (when next-url (hateoas/link-map "next" hateoas/GET next-url {:accept mt/activity-collection-media-type}))]
     next-link))


cleanup

cleanup

--- src/spekl_package_manager/command_check.clj
+++ src/spekl_package_manager/command_check.clj
@@ -39,20 +39,6 @@
   )

-;; (defmacro loadcheck
-;;   [name & body]
-;;   `(fn [] (~(symbol ("spekl-package-manager.check/" name ))))
-;;   )
-
-
-
-
-
-;(macroexpand '(loadcheck a))
-
-;(loadcheck a)
-;
-

 ;; read the package file for the package that runs the tool
 ;; build a map for each package it DEPENDS on
@@ -92,18 +78,6 @@
        )
      ))
   )
-
-;((resolve (symbol "check" "default")))
-        ;;
-        ;; pass in the rest of the raw environment
-        ;;
-        ;; {
-        ;;  :specs (package/get-required-specifications (config :specs))
-        ;;  :project-files (expand-glob (config :paths))
-        ;;  :project-files-string (string/join " " (expand-glob (config :paths)))
-        ;;  }
-
-

 (defn create-run-configuration [configured-check package-data]
   {


Use a CTE and lose one index scan

Use a CTE and lose one index scan

--- src/vip/data_processor/validation/v5/id.clj
+++ src/vip/data_processor/validation/v5/id.clj
@@ -7,15 +7,20 @@
             [clojure.tools.logging :as log]))

 (defn duplicate-ids [import-id]
-  (korma/select [postgres/xml-tree-values :first]
-    (korma/fields :first.value :first.path)
-    (korma/where {:first.results_id import-id :second.results_id import-id})
-    (korma/where (postgres/ltree-match :first :path "VipObject.0.*.id"))
-    (korma/where (postgres/ltree-match :second :path "VipObject.0.*.id"))
-    (korma/join :inner [postgres/xml-tree-values :second]
-                (and
-                 (= :first.value :second.value)
-                 (not= :first.path :second.path)))))
+  (korma/exec-raw
+   (:conn postgres/xml-tree-values)
+   ["with ids as (select value, path
+                  from xml_tree_values
+                  where results_id = ?
+                    and path ~ 'VipObject.0.*.id'
+                  order by value)
+     select set1.path, set1.value
+     from ids set1
+     inner join ids set2
+             on set1.value = set2.value
+            and set1.path <> set2.path"
+    [import-id]]
+   :results))

 (defn validate-unique-ids
   [{:keys [import-id] :as ctx}]


It can walk..

It can walk..

--- ClojureScript/hello.cljs
+++ ClojureScript/hello.cljs
@@ -19,7 +19,9 @@
 (def tick-step (/ 1 100))
 (def render-step (/ 1 25))
 (def gravity-strength 300)
-(def ground-strength 100)
+(def ground-rebound-strength 200)
+(def ground-grip-strength 50)
+(def drag-factor 5)

 (defn print-to-log [v]
     (.log js/console v))
@@ -37,7 +39,7 @@
 (defn rot-cw [[x y]] [y (- x)])
 (defn rot-ccw [[x y]] [(- y) x])

-(defn make-node [x y] {:pos [x y] :vel [0 0]})
+(defn make-node [x y m] {:pos [x y] :vel [0 0] :mass m})
 (defn make-spring [a b] {:node-a a :node-b b})
 (defn make-hinge [a b c min-a max-a] {:node-a a :node-b b :node-c c :min-modifier-angle min-a :max-modifier-angle max-a})
 (defn make-state [nodes springs hinges] {
@@ -60,18 +62,23 @@

 (def initial-game-state (make-state
     {
-        :head (make-node 250 150)
-        :tail (make-node 50 150)
-        :h-l-k (make-node 260 75)
-        :h-l-f (make-node 250 0)
-        :h-t-k (make-node 260 75)
-        :h-t-f (make-node 250 0)
-        :t-l-k (make-node 40 75)
-        :t-l-f (make-node 50 0)
-        :t-t-k (make-node 40 75)
-        :t-t-f (make-node 50 0)
+        :hump (make-node 200 225 2)
+        :head (make-node 300 150 2)
+        :tail (make-node 100 150 2)
+
+        :h-l-k (make-node 310 75 0.5)
+        :h-l-f (make-node 300 0 0.5)
+        :h-t-k (make-node 310 75 0.5)
+        :h-t-f (make-node 300 0 0.5)
+
+        :t-l-k (make-node 90 75 0.5)
+        :t-l-f (make-node 100 0 0.5)
+        :t-t-k (make-node 90 75 0.5)
+        :t-t-f (make-node 100 0 0.5)
     }
     (map (partial apply make-spring) [
+        [:hump :head]
+        [:hump :tail]
         [:head :tail]
         [:head :h-l-k]
         [:h-l-k :h-l-f]
@@ -146,26 +153,37 @@
             hinges)))

 (defn calculate-gravity-forces [nodes]
-    (zipmap (keys nodes) (repeat [0 (- gravity-strength)])))
+    (zipmap (keys nodes)
+        (map (fn [{m :mass}]
+            [0 (- (* gravity-strength m))])
+            (vals nodes))))

 (defn calculate-ground-forces [nodes]
     (zipmap (keys nodes)
         (map (fn [{[ x y ] :pos [ xv yv ] :vel }]
             (if (< y 0)
-                (vec* [(- xv) (+ (Math/max 0 (- yv)) (- y))] ground-strength)
+                (vec+
+                    (vec* [(- xv) (Math/max 0 (- yv))] ground-grip-strength)
+                    (vec* [0 (- y)] ground-rebound-strength))
                 [0 0])) (vals nodes))))
+
+(defn calculate-drag-forces [nodes]
+    (zipmap (keys nodes)
+        (map (fn [{v :vel m :mass}] (vec* v (- (* m drag-factor))))
+            (vals nodes))))

 (defn calculate-all-node-forces [{:keys [nodes springs hinges]}]
     (merge-with vec+
         (calculate-spring-forces nodes springs)
         (calculate-hinge-forces nodes hinges)
         (calculate-gravity-forces nodes)
-        (calculate-ground-forces nodes)))
+        (calculate-ground-forces nodes)
+        (calculate-drag-forces nodes)))

 (defn update-node-velocities [nodes forces time-step]
     (merge-with (fn [n f]
         (assoc n
-            :vel (vec+ (:vel n) (vec* f time-step))))
+            :vel (vec+ (:vel n) (vec* f (/ time-step (:mass n))))))
         nodes
         forces))

@@ -193,30 +211,30 @@
     (assoc state
         :hinges
             (let
-                [[q w i o a s k l] (map (:keys input-state) [
-                    KeyCodes/Q KeyCodes/W KeyCodes/I KeyCodes/O
-                    KeyCodes/A KeyCodes/S KeyCodes/K KeyCodes/L
+                [[fca fcb fka fkb rca rcb rka rkb] (map (:keys input-state) [
+                    KeyCodes/I KeyCodes/O KeyCodes/K KeyCodes/L
+                    KeyCodes/Q KeyCodes/W KeyCodes/A KeyCodes/S
                     ])]
                 (map (fn [h] (let [hn (hinge-nodes h)]
                     (assoc h :modifier-angle
                         (clamp (+ (:modifier-angle h)
                             (cond
                                 (= hn [:tail :head :h-l-k])
-                                    (+ (if q 0.05 0.0) (if w -0.05 0.0))
+                                    (+ (if fca 0.05 0.0) (if fcb -0.05 0.0))
                                 (= hn [:head :h-l-k :h-l-f])
-                                    (+ (if i 0.05 0.0) (if o -0.05 0.0))
+                                    (+ (if fka 0.05 0.0) (if fkb -0.05 0.0))
                                 (= hn [:tail :head :h-t-k])
-                                    (+ (if q -0.05 0.0) (if w 0.05 0.0))
+                                    (+ (if fca -0.05 0.0) (if fcb 0.05 0.0))
                                 (= hn [:head :h-t-k :h-t-f])
-                                    (+ (if i -0.05 0.0) (if o 0.05 0.0))
+                                    (+ (if fka -0.05 0.0) (if fkb 0.05 0.0))
                                 (= hn [:head :tail :t-l-k])
-                                    (+ (if a 0.05 0.0) (if s -0.05 0.0))
+                                    (+ (if rca 0.05 0.0) (if rcb -0.05 0.0))
                                 (= hn [:tail :t-l-k :t-l-f])
-                                    (+ (if k 0.05 0.0) (if l -0.05 0.0))
+                                    (+ (if rka 0.05 0.0) (if rkb -0.05 0.0))
                                 (= hn [:head :tail :t-t-k])
-                                    (+ (if a -0.05 0.0) (if s 0.05 0.0))
+                                    (+ (if rca -0.05 0.0) (if rcb 0.05 0.0))
                                 (= hn [:tail :t-t-k :t-t-f])
-                                    (+ (if k -0.05 0.0) (if l 0.05 0.0))
+                                    (+ (if rka -0.05 0.0) (if rkb 0.05 0.0))
                                 :else
                                     0.0))
                             (:min-modifier-angle h) (:max-modifier-angle h)))))
@@ -268,7 +286,6 @@
         game-state-ref (atom initial-game-state)
         input-state-ref (atom {:keys (set)})
         canvas (dom/createDom "div" {} "")
-        button (dom/createDom "button" {} "Click!")
         tick-timer (goog.Timer. (Math/round (* 1000 tick-step)))
         render-timer (goog.Timer. (Math/round (* 1000 render-step)))
         ]
@@ -276,14 +293,13 @@
             (. tick-timer (start))
             (. render-timer (start))
             (dorun (map (partial apply events/listen) [
-                [button EventType/CLICK (partial input-event input-state-ref)]
                 [document.body EventType/KEYDOWN (partial input-event input-state-ref) true]
                 [document.body EventType/KEYUP (partial input-event input-state-ref) true]
                 [tick-timer Timer/TICK #(tick game-state-ref (deref input-state-ref))]
                 [render-timer Timer/TICK #(rerender canvas (deref game-state-ref))]]))
             (dom/appendChild document.body (dom/createDom "div" {}
-                (dom/createDom "h1" {} "Work in progress..")
-                (dom/createDom "div" {} "Try clicking the button, or pressing keys.")
+                (dom/createDom "h1" {} "QWASIOKL!!")
+                (dom/createDom "div" {} "Try pressing keys Q, W, A, S, I, O, K, and L.")
                 (dom/createDom "div" {}
                     (dom/createTextNode "My code lives here: ")
                     (dom/createDom "a" (.strobj {"href" my-code-url}) my-code-url))


drop superfluous data access layer

drop superfluous data access layer

--- dada2-core/src/test/clojure/org/dada2/test_join_model.clj
+++ dada2-core/src/test/clojure/org/dada2/test_join_model.clj
@@ -46,37 +46,29 @@
   "return seq of lhses indexed by i/fk"
   (vals ((nth lhs-indeces i) fk)))

-(defn- lhs-assoc-2 [lhs-indeces lhs-pk-key lhs-fk-keys lhs]
+(defn- lhs-assoc [lhs-indeces lhs-pk-key lhs-fk-keys lhs]
   (let [lhs-pk (lhs-pk-key lhs)]
     (mapv
      (fn [lhs-index lhs-fk-key] (assoc-in lhs-index [(lhs-fk-key lhs) lhs-pk] lhs))
      lhs-indeces
      lhs-fk-keys)))

-(defn- lhs-assoc [indeces lhs-pk-key lhs-fk-keys lhs]
-  "associate a new lhs with existing index"
-  (assoc indeces 0 (lhs-assoc-2 (first indeces) lhs-pk-key lhs-fk-keys lhs)))
-
 (defn- dissoc-in [seq [k1 k2] _]
   (assoc seq k1 (dissoc (seq k1) k2)))

-(defn- lhs-dissoc-2 [lhs-indeces lhs-pk-key lhs-fk-keys lhs]
+(defn- lhs-dissoc [lhs-indeces lhs-pk-key lhs-fk-keys lhs]
    (let [lhs-pk (lhs-pk-key lhs)]
      (mapv
       (fn [lhs-index lhs-fk-key] (dissoc-in lhs-index [(lhs-fk-key lhs) lhs-pk] lhs))
       lhs-indeces
       lhs-fk-keys)))

-(defn- lhs-dissoc [indeces lhs-pk-key lhs-fk-keys lhs]
-  "associate a new lhs with existing index"
-  (assoc indeces 0 (lhs-dissoc-2 (first indeces) lhs-pk-key lhs-fk-keys lhs)))
-
 (deftest test-lhs-access
   (let [before [{}]
 	after  [{String {3 "xxx"}}]]
-    (is (= after (lhs-assoc-2 before count [type] "xxx")))
+    (is (= after (lhs-assoc before count [type] "xxx")))
     (is (= '("xxx") (lhses-get after 0 String)))
-    (is (= [{String {}}] (lhs-dissoc-2 after count [type] "xxx")))
+    (is (= [{String {}}] (lhs-dissoc after count [type] "xxx")))
     ))

 ;;--------------------------------------------------------------------------------
@@ -86,30 +78,21 @@
   "return a lazy seq of seqs of rhses indexed by their respective fks"
   (map (fn [rhs-index lhs-fk-key] (vals (rhs-index (lhs-fk-key lhs)))) rhs-indeces lhs-fk-keys))

-(defn- rhs-assoc-2 [rhs-indeces i rhs-pk-key fk rhs]
+(defn- rhs-assoc [rhs-indeces i rhs-pk-key fk rhs]
   "associate a new rhs with existing index"
   (assoc-in rhs-indeces [i fk (rhs-pk-key rhs)] rhs))

-(defn- rhs-assoc [indeces i rhs-pk-key fk rhs]
-  "associate a new rhs with existing index"
-  (assoc indeces 1 (rhs-assoc-2 (second indeces) i rhs-pk-key fk rhs)))
-
-(defn- rhs-dissoc-2 [rhs-indeces i rhs-pk-key fk rhs]
+(defn- rhs-dissoc [rhs-indeces i rhs-pk-key fk rhs]
   "dissociate an rhs from existing index"
   (let [rhs-pk (rhs-pk-key rhs)]
-    (assoc-in rhs-indeces [i fk] (dissoc ((rhs-indeces i) fk) rhs-pk)))
-  )
-
-(defn- rhs-dissoc [indeces i rhs-pk-key fk rhs]
-  "dissociate an rhs from existing index"
-  (assoc indeces 1 (rhs-dissoc-2 (second indeces) i rhs-pk-key fk rhs)))
+    (assoc-in rhs-indeces [i fk] (dissoc ((rhs-indeces i) fk) rhs-pk))))

 (deftest test-rhs-access
   (let [before [{}]
 	after  [{String {3 "xxx"}}]]
-    (is (= after (rhs-assoc-2 before 0 count String "xxx")))
+    (is (= after (rhs-assoc before 0 count String "xxx")))
     (is (= '(("xxx")) (rhses-get after [first] [String])))
-    (is (= [{String {}}] (rhs-dissoc-2 after 0 count String "xxx")))))
+    (is (= [{String {}}] (rhs-dissoc after 0 count String "xxx")))))

 ;;--------------------------------------------------------------------------------
 ;; this layer encapsulates access to both lhs and rhs at the same time...
@@ -122,13 +105,13 @@
 ;;--------------------------------------------------------------------------------

 (defn- lhs-upsert [[old-lhs-index rhs-indeces old-joins] lhs-pk-key lhs-fk-keys lhs join-fn join-pk joined-model]
-  (let [new-lhs-indeces (lhs-assoc-2 old-lhs-index lhs-pk-key lhs-fk-keys lhs)
+  (let [new-lhs-indeces (lhs-assoc old-lhs-index lhs-pk-key lhs-fk-keys lhs)
 	joins (derive-joins rhs-indeces lhs-fk-keys lhs join-fn)
 	new-joins (reduce (fn [old-joins join] (assoc old-joins (join-pk join) join)) old-joins joins)]
     [[new-lhs-indeces rhs-indeces new-joins] (fn [_] (on-upserts joined-model joins))]))

 (defn- lhs-delete [[old-lhs-indeces rhs-indeces old-joins] lhs-pk-key lhs-fk-keys lhs join-fn join-pk joined-model]
-  (let [new-lhs-indeces (lhs-dissoc-2 old-lhs-indeces lhs-pk-key lhs-fk-keys lhs)
+  (let [new-lhs-indeces (lhs-dissoc old-lhs-indeces lhs-pk-key lhs-fk-keys lhs)
 	joins (derive-joins rhs-indeces lhs-fk-keys lhs join-fn)
 	new-joins (reduce (fn [old-joins join] (dissoc old-joins (join-pk join))) old-joins joins)]
     [[new-lhs-indeces rhs-indeces new-joins] (fn [_] (on-deletes joined-model joins))]))
@@ -151,7 +134,7 @@

 (defn- rhs-upsert [[lhs-indeces old-rhs-indeces old-joins] i rhs-pk-key rhs-fk-key lhs-fk-keys rhs join-fn join-pk joined-model]
   (let [fk (rhs-fk-key rhs)
-	new-rhs-indeces (rhs-assoc-2 old-rhs-indeces i rhs-pk-key fk rhs)
+	new-rhs-indeces (rhs-assoc old-rhs-indeces i rhs-pk-key fk rhs)
 	lhses (lhses-get lhs-indeces i fk)
 	joins (mapcat (fn [lhs] (derive-joins new-rhs-indeces lhs-fk-keys lhs join-fn)) lhses)
 	new-joins (reduce (fn [old-joins join] (assoc old-joins (join-pk join) join)) old-joins joins)
@@ -165,7 +148,7 @@
   (let [fk (rhs-fk-key rhs)
 	lhses (lhses-get lhs-indeces i fk)
 	old-joins2 (mapcat (fn [lhs] (derive-joins old-rhs-indeces lhs-fk-keys lhs join-fn)) lhses)
-	new-rhs-indeces (rhs-dissoc-2 old-rhs-indeces i rhs-pk-key fk rhs)
+	new-rhs-indeces (rhs-dissoc old-rhs-indeces i rhs-pk-key fk rhs)
 	new-joins2 (mapcat (fn [lhs] (derive-joins new-rhs-indeces lhs-fk-keys lhs join-fn)) lhses)
 	joins (remove (fn [i] (contains? (apply hash-set new-joins2) i)) old-joins2)
 	new-joins (reduce (fn [old-joins join] (dissoc old-joins (join-pk join))) old-joins joins)


Show Clipboard only when references are available

--- src/discuss/clipboard.cljs
+++ src/discuss/clipboard.cljs
@@ -47,10 +47,10 @@
                     :onDragStart drag-event}
                data))))

-
 (defn view [data owner]
   (reify om/IRender
     (render [_]
-      (dom/div nil
-               (dom/h5 nil "Clipboard")
-               (om/build-all item-view (get-stored-selections))))))+      (when (pos? (count (get-stored-selections)))
+        (dom/div nil
+                 (dom/h5 nil "Clipboard")
+                 (om/build-all item-view (get-stored-selections) {:key (swap! counter inc)}))))))


CMR-4064: Dropped handling of errors when reading the gem version off the config file.

--- collection-renderer-lib/src/cmr/collection_renderer/services/collection_renderer.clj
+++ collection-renderer-lib/src/cmr/collection_renderer/services/collection_renderer.clj
@@ -5,7 +5,6 @@
    [clojure.java.io :as io]
    [clojure.string :as str]
    [cmr.common.lifecycle :as l]
-   [cmr.common.log :refer (debug info warn error)]
    [cmr.umm-spec.migration.version-migration :as vm]
    [cmr.umm-spec.umm-json :as umm-json]
    [cmr.umm-spec.versioning :as umm-version])
@@ -30,10 +29,6 @@
   "Defines the path to the UMM schema version config file within the preview gem."
   "gems/cmr_metadata_preview-0.0.1/.umm-version")

-(def default-preview-gem-umm-version
-  "Default preview gem UMM schema version in case preview gem is mis-configured."
-  "1.8")
-
 (defn- create-jruby-runtime
   "Creates and initializes a JRuby runtime."
   []
@@ -45,15 +40,10 @@
 (defn- get-preview-gem-umm-version
   "Get the UMM schema version that is defined in preview gem."
   []
-  (try
-    (-> preview-gem-umm-version-config-file
-        io/resource
-        slurp
-        str/trim)
-    (catch Exception e
-      (error "Failed to parse preview gem UMM version, will use the default version:"
-             default-preview-gem-umm-version
-             (.printStackTrace e)))))
+  (-> preview-gem-umm-version-config-file
+      io/resource
+      slurp
+      str/trim))

 ;; Allows easily evaluating Ruby code in the Clojure REPL.
 (comment
@@ -76,8 +66,8 @@
    [this _system]
    (-> this
        (assoc :jruby-runtime (create-jruby-runtime))
-       (assoc :preview-gem-umm-version
-              (or (get-preview-gem-umm-version) default-preview-gem-umm-version))))
+       (assoc :preview-gem-umm-version (get-preview-gem-umm-version))))
+
   (stop
    [this _system]
    (dissoc this :jruby-runtime)))


user redirected to a url where their basket is saved upon saving

--- src/eatme/client/main.cljs
+++ src/eatme/client/main.cljs
@@ -37,9 +37,11 @@
 ;;    :on-success (js/alert "You should never see this")
 ;;    :on-error (js/alert "Remotes correctly handle error conditions"))

-(defn- basket-id []
-  (when-let [matches (re-matches #".*/#([1-9]*)" (.-href (.-location js/window)))]
-    (last matches)))
+(defn- basket-id
+  ([] (when-let [matches (re-matches #".*/#([1-9]*)"
+                                     (.-href (.-location js/window)))]
+        (last matches)))
+  ([id] (.assign (.-location js/window) (str "#" id))))

 (defn to-int [s]
   (js/parseInt s))
@@ -64,7 +66,7 @@
 (defn save-basket []
     (srm/rpc
      (api/save-basket (serialise-basket)) [response]
-     :on-success (js/alert (str "Basket saved! Id: " (:id response)))
+     :on-success (do (js/alert (str "Basket saved! Id: " (:id response))) (basket-id (:id response)))
      :on-error (js/alert (str "Error saving basket"))))


Fix -a option

Fix -a option

--- src/export_server/core.clj
+++ src/export_server/core.clj
@@ -111,7 +111,7 @@
     :default (:log config/defaults)
     ]
    ["-a" "--allow-scripts-executing ALLOW_SCRIPTS_EXECUTING" "Allow to execute violent scripts in phantom js."
-    :parse-fn #(or (= "true" %) (= "1" %))
+    :parse-fn #(or (= "true" %) (= "1" %) (= "y" %) (= "yes" %))
     :default true
     ]

@@ -279,6 +279,7 @@
 ;====================================================================================
 (defn -main [& args]
   (let [{:keys [options arguments errors summary]} (parse-opts args common-options)]
+    (prn (:allow-scripts-executing options))
     (state/set-options options)
     (cond
       (:version options) (exit 0 server-name)


Sketch join constructor

Sketch join constructor

--- src/aurora/btree.cljs
+++ src/aurora/btree.cljs
@@ -452,7 +452,7 @@
             (set! end? true)
             (.search this 1)))))

-;; TODO treeterator (key-ix->take?)
+;; TODO treeterator (key-ix->needed? , key-ix->produced?)

 (defn intersection [iterators]
   (if (> (alength iterators) 1)
@@ -470,7 +470,7 @@
       (.next iterator))
     results))

-(deftype Join [^:mutable key-ix iterators key-ix->iterators key-ix->intersection key-ix->iterator->present? ^:mutable end?]
+(deftype Join [^:mutable key-ix iterators key-ix->intersection key-ix->iterator->present? ^:mutable end?]
   Object
   (key [this]
        (when (false? end?)
@@ -486,7 +486,8 @@
           (.seek (aget key-ix->intersection key-ix) key)
           (.maintain this)))
   (down [this]
-        (assert (< key-ix (- (alength key-ix->iterators) 1)))
+        (assert (false? end?)) ;; have to be at a key to descend
+        (assert (< key-ix (- (alength key-ix->intersection) 1)))
         (set! key-ix (+ key-ix 1))
         (let [iterator->present? (aget key-ix->iterator->present? key-ix)]
           (dotimes [i (alength iterator->present?)]
@@ -503,6 +504,35 @@
             (.up (aget iterators i))
             (.reset (aget iterators i))))
         (.maintain this))))
+
+(defn join [trees num-vars tree->vars]
+  (assert (> num-vars 0))
+  (dotimes [i (alength trees)]
+    (let [tree-vars (aget tree->vars i)]
+      (assert (== (alength tree-vars) (.key-len (aget trees i))))
+      (dotimes [j (alength tree-vars)]
+        (assert (< (aget tree-vars j) num-vars)))))
+  (let [iterators (amap trees i _ (iterator (aget trees i)))
+        var->trees #js []
+        var->tree->present? #js []
+        var->intersection #js []]
+    (dotimes [i num-vars]
+      (.push var->trees #js [])
+      (let [tree->present? #js []]
+        (.push var->tree->present? tree->present?)
+        (dotimes [j (alength trees)]
+          (.push tree->present? false))))
+    (dotimes [tree (alength trees)]
+      (let [tree-vars (aget trees tree)]
+        (dotimes [j (alength tree-vars)]
+          (let [var (aget tree-vars j)]
+            (.push (aget var->trees var) tree)
+            (aset var->tree->present? var tree true)))))
+    (dotimes [i num-vars]
+      (.push var->intersection i (intersection (aget var->trees i))))
+    (let [join (Join. 0 iterators var->intersection var->tree->present? false)]
+      (.maintain join)
+      join)))

 ;; TESTS


Inititalise intersection properly

Inititalise intersection properly

--- src/aurora/btree.cljs
+++ src/aurora/btree.cljs
@@ -352,7 +352,9 @@
   (if (> (alength iterators) 1)
     (if (some #(.-end? %) iterators)
       (Intersection. iterators true)
-      (Intersection. (into-array (sort-by #(.key %) compare-keys iterators)) false))
+      (let [intersection (Intersection. (into-array (sort-by #(.key %) compare-keys iterators)) false)]
+        (.search intersection 0)
+        intersection))
     (aget iterators 0)))

 (defn iter-seq [iterator]


Add whitespace.

Add whitespace.

--- src/clj/cljs/repl.clj
+++ src/clj/cljs/repl.clj
@@ -103,12 +103,12 @@
 (defn- wrap-fn [form]
   (cond (and (seq? form) (= 'ns (first form))) identity
         ('#{*1 *2 *3} form) (fn [x] `(cljs.core.pr-str ~x))
-        :else (fn [x]`(cljs.core.pr-str
-                      (let [ret# ~x]
-                        (do (set! *3 *2)
-                            (set! *2 *1)
-                            (set! *1 ret#)
-                            ret#))))))
+        :else (fn [x] `(cljs.core.pr-str
+                       (let [ret# ~x]
+                         (do (set! *3 *2)
+                             (set! *2 *1)
+                             (set! *1 ret#)
+                             ret#))))))

 (defn- eval-and-print [repl-env env form]
   (let [ret (evaluate-form repl-env


getting undefined errors :|

getting undefined errors :|

--- src/cljsfmt/core.cljs
+++ src/cljsfmt/core.cljs
@@ -200,8 +200,8 @@

 (defn- indent-order [[key _]]
   (condp instance? key
-    Symbol  (str 0 key)
-    Pattern (str 1 key)))
+    ;Symbol  (str 0 key)
+    js/RegExp (str 1 key)))

 (defn- custom-indent [zloc indents]
   (if (empty? indents)


improves messaging in the test-identical-version assertion (#1442)

--- waiter/integration/waiter/basic_test.clj
+++ waiter/integration/waiter/basic_test.clj
@@ -1078,12 +1078,11 @@

 (deftest ^:parallel ^:integration-fast test-identical-version
   (testing-using-waiter-url
-    (let [{:keys [cookies]} (make-request waiter-url "/waiter-auth")]
-      (is (= 1 (->> (routers waiter-url)
-                    vals
-                    (map #(:git-version (waiter-settings % :cookies cookies)))
-                    set
-                    count))))))
+    (let [{:keys [cookies]} (make-request waiter-url "/waiter-auth")
+          router->git-version (pc/map-from-keys
+                                (fn [router-url] (:git-version (waiter-settings router-url :cookies cookies)))
+                                (vals (routers waiter-url)))]
+      (is (-> router->git-version (vals) (set) (count) (= 1)) (str router->git-version)))))

 (deftest ^:parallel ^:integration-fast test-cors-request-allowed
   (testing-using-waiter-url


:bug: Fixes paste images to viewport

:bug: Fixes paste images to viewport

--- frontend/src/app/main/data/workspace.cljs
+++ frontend/src/app/main/data/workspace.cljs
@@ -1222,7 +1222,8 @@
   (let [shape {:name (:name image)
                :metadata {:width (:width image)
                           :height (:height image)
-                          :uri (:uri image)}}
+                          :id (:id image)
+                          :path (:path image)}}
         aspect-ratio (/ (:width image) (:height image))]
     (st/emit! (create-and-add-shape :image shape aspect-ratio))))

@@ -1231,7 +1232,7 @@
   (ptk/reify ::paste-bin-impl
     ptk/WatchEvent
     (watch [_ state stream]
-      (let [file-id (get-in state [:workspace-page :file-id])
+      (let [file-id (get-in state [:workspace-file :id])
             params  {:file-id file-id
                      :local? true
                      :js-files [image]}]


Flat ast with n-ary operators finished

Flat ast with n-ary operators finished

--- src/logic/transform.clj
+++ src/logic/transform.clj
@@ -22,35 +22,27 @@
   [ast]
   (insta/transform transform-map ast))

-(defn- bar
+(defn- flat-filter
   [o l]
-  (if (list? l)
+  (if (coll? l)
     (= o (first l))
     false))

-(defn- foo
-  [ast]
-  (let [o (first ast) a (rest ast)] ; operator and arguments
-    (let [flat (map #(rest %) (filter (partial bar o) a))
-          not-flat (filter (partial (complement bar) o) a)]
-      (println :ast ast)
-      (println :flat flat)
-      (println :not-flat not-flat)
-      (println (apply concat  `((~o) ~@flat ~not-flat))))
-      ast))
-
-
-
 (defn- flat
   [ast]
+  (let [o (first ast) a (rest ast) ; operators and arguments
+        flat (map #(rest %) (filter (partial flat-filter o) a))
+        not-flat (filter (partial (complement flat-filter) o) a)]
+      (apply concat  `((~o) ~@flat ~not-flat))))
+
+(defn- flat-ast
+  [ast]
   (if (and
-        (list? ast)
+        (coll? ast)
         (n-ary? (first ast)))
-    (do
-      (println :can-maybe-flat (rest ast))
-      (foo ast)) ; TODO
+    (flat ast)
     ast))

 (defn flatten-ast
   [ast]
-  (postwalk flat ast))
+  (postwalk flat-ast ast))


why not working?

why not working?


Made coverage global object optional

Made coverage global object optional

--- src/jx/reporter/karma.cljs
+++ src/jx/reporter/karma.cljs
@@ -17,7 +17,7 @@
     (.result @karma (clj->js m))))

 (defn- coverage-result []
-  (clj->js {:coverage js/__coverage__}))
+  #js {"coverage" (aget js/window "__coverage__")})

 (defn- karma-complete! []
   (when (karma?)


Optimized Filestore schema.

Optimized Filestore schema.

--- src/konserve/filestore.clj
+++ src/konserve/filestore.clj
@@ -73,8 +73,6 @@
                  async/merge
                  (async/into #{}))]
     fns))
-
-

 ;; Helper Function for FileSystemStore
 (defn- read-key
@@ -130,7 +128,6 @@
         (finally
           (.close dos))))))

-
 (defn- write-edn-key
   "help function for -update-in"
   [serializer write-handlers read-handlers folder fn {:keys [key] :as key-meta} config]
@@ -160,7 +157,7 @@
       (finally
         (.close dos)))))

-(defn- read-memory-entry
+(defn- read-edn
   "Helper Function for -get-in"
   [f res-ch folder fn fkey rkey serializer read-handlers]
   (if-not (.exists f)
@@ -210,7 +207,9 @@
       (sync-folder folder))
     nil))

-(defn- binary-read [f res-ch folder fn key locked-cb]
+(defn- read-binary
+  "Helper function for -bget"
+  [f res-ch folder fn key locked-cb]
   (if-not (.exists f)
     (close! res-ch)
     (try
@@ -252,6 +251,47 @@
                                :key       key
                                :exception e}))))))

+
+(defn- read-binary-old [f res-ch folder fn key locked-cb]
+    (try
+          (let [ac (AsynchronousFileChannel/open (.getPath (FileSystems/getDefault)
+                                                           (str folder "/B_" fn)
+                                                           (into-array String []))
+                                                 (into-array StandardOpenOption
+                                                             [StandardOpenOption/READ]))
+                bb (ByteBuffer/allocate (.size ac))]
+            (.read ac
+                   bb
+                   0
+                   nil
+                   (proxy [CompletionHandler] []
+                     (completed [res att]
+                       (let [bais (ByteArrayInputStream. (.array bb))]
+                         (try
+                           (locked-cb {:input-stream bais
+                                       :size (.length f)
+                                       :file f})
+                           (catch Exception e
+                             (ex-info "Could not read key."
+                                      {:type :read-error
+                                       :key key
+                                       :exception e}))
+                           (finally
+                             (close! res-ch)
+                             (.close ac)))))
+                     (failed [t att]
+                       (put! res-ch (ex-info "Could not read key."
+                                             {:type :read-error
+                                              :key key
+                                              :exception t}))
+                       (close! res-ch)
+                       (.close ac)))))
+          (catch Exception e
+            (put! res-ch (ex-info "Could not read key."
+                               {:type :read-error
+                                :key key
+                                :exception e})))))
+
 (defn- write-binary
   "Helper Function for Binary Write"
   [folder fn key input config]
@@ -279,7 +319,8 @@
       (finally
         (.close fos)))))

-(defrecord FileSystemStore [folder serializer read-handlers write-handlers locks config]
+(defrecord FileSystemStore [folder serializer read-handlers write-handlers locks config
+                            stale-binaries?]
   PEDNAsyncKeyValueStore
   (-exists? [this key]
     (let [fn  (uuid key)
@@ -294,7 +335,7 @@
           fn            (uuid fkey)
           f             (io/file (str folder "/data/" fn))
           res-ch        (chan)]
-      (read-memory-entry f res-ch folder fn fkey rkey serializer read-handlers)
+      (read-edn f res-ch folder fn fkey rkey serializer read-handlers)
       res-ch))
   (-update-in [this key-vec up-fn]
     (async/thread
@@ -322,8 +363,13 @@
     (let [fn     (str (uuid key))
           f      (io/file (str folder "/data/" fn))
           res-ch (chan)]
-      (binary-read f res-ch folder fn key locked-cb)
-      res-ch))
+      ;; migrate old schema
+      (when (and stale-binaries? (.exists (io/file (str folder "/B_" fn))))
+        (read-binary-old f res-ch folder fn key #(-bassoc this key (:input-stream %)))
+        (.delete (io/file (str folder "/B_" fn)))
+        (when (:fsync config)
+          (sync-folder folder)))
+      (go (read-binary f res-ch folder fn key locked-cb))))

   (-bassoc [this key input]
     (let [file-name    (uuid key)
@@ -353,7 +399,6 @@
   (let [fns (->> (io/file folder)
                  .list
                  seq
-                 ((fn [e] (prn "foo: " e) e))
                  (filter #(re-matches #"[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}"
                                       %))
                  (map (fn [fn]
@@ -379,36 +424,73 @@

 (defn new-fs-store
   "Filestore contains a Key and a Data Folder"
-  [path  & {:keys [serializer read-handlers write-handlers config automatic-schema-update]
+  [path  & {:keys [serializer read-handlers write-handlers config]
             :or   {serializer     (ser/fressian-serializer)
                    read-handlers  (atom {})
                    write-handlers (atom {})
-                   config         {:fsync true}
-                   automatic-schema-update false}}]
-  (println "auto: " automatic-schema-update)
-  (let [_          (check-and-create-folder path)
-        old-format? (not (empty? (filter #(re-matches #"[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}" %)
-                                                      (seq (.list (io/file path))))))
-        key-path   (str path "/meta")
-        data-path  (str path "/data")
-        _          (check-and-create-folder key-path)
-        _          (check-and-create-folder data-path)
-        store (map->FileSystemStore {:folder         path
-                                     :serializer     serializer
-                                     :read-handlers  read-handlers
-                                     :write-handlers write-handlers
-                                     :locks          (atom {})})]
-    (if (and old-format? (true? automatic-schema-update))
+                   config         {:fsync true}}}]
+  (let [_               (check-and-create-folder path)
+        key-path        (str path "/meta")
+        data-path       (str path "/data")
+        _               (check-and-create-folder key-path)
+        _               (check-and-create-folder data-path)
+        stale-binaries? (->> (io/file path)
+                             .list
+                             seq
+                             (filter #(re-matches
+                                       #"B\\_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}"
+                                       %))
+                             empty?)
+        stale-edn?      (->> (io/file path)
+                             .list
+                             seq
+                             (filter #(re-matches
+                                       #"[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}"
+                                       %))
+                             empty?)
+        store           (map->FileSystemStore {:folder          path
+                                               :serializer      serializer
+                                               :read-handlers   read-handlers
+                                               :write-handlers  write-handlers
+                                               :stale-binaries? stale-binaries?
+                                               :locks           (atom {})
+                                               :config          config})]
+    (if-not stale-edn?
       (do
         (go
-          (println "Updating to new store schema.")
           (<! (filestore-schema-update store))
           store))
       (go store))))

+
+
+
 (comment
-
-  (time (def store (<!! (new-fs-store "/tmp/old-CCCP" :automatic-schema-update true))))
+
+  (read-string "{:update-store {:version-12-to-14 true}}")
+
+  (time (def store (<!! (new-fs-store "/tmp/konserve-fs-migration-test"))))
+
+  store
+
+
+
+
+  store
+  (->> (io/file "/tmp/konserve-fs-migration-test")
+       .list
+       seq
+       (filter #(re-matches
+                 #"B\\_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}"
+                 %))
+       empty?)
+
+
+  (spit "/tmp/old-CCCP/config" "update-store :version [8.11 8.12]")
+
+  (keyword (slurp "/tmp/old-CCCP/config"))
+
+  (slurp "/tmp/old-CCCP/config")

   (<!! (-assoc-in store [":123"] 43))


print collection rendering message before rendering

so users know when an error happend

--- src/io/perun.clj
+++ src/io/perun.clj
@@ -376,10 +376,10 @@
                     files          (perun/get-meta fileset)
                     filtered-files (filter (:filterer options) files)
                     grouped-files  (group-by (:groupby options) filtered-files)]
-                (doseq [[page files] grouped-files]
-                  (let [sorted        (sort-by (:sortby options) (:comparator options) files)
+                (doseq [[page page-files] grouped-files]
+                  (u/info (str "Render collection " page "\n"))
+                  (let [sorted        (sort-by (:sortby options) (:comparator options) page-files)
                         html          (render-in-pod pod renderer (perun/get-global-meta fileset) sorted)
                         page-filepath (perun/create-filepath (:out-dir options) page)]
-                    (perun/create-file tmp page-filepath html)
-                    (u/info (str "Render collection " page "\n"))))
+                    (perun/create-file tmp page-filepath html)))
                 (commit fileset tmp))))))


more refactoring of source maps in compile

--- src/main/cljs/cljs/js.cljs
+++ src/main/cljs/cljs/js.cljs
@@ -349,19 +349,17 @@
                  (recur)))
              (do
                (when (:source-map opts)
-                 (let [t   (.valueOf (js/Date.))
-                       src (str "repl-" t ".cljs")
-                       smd @comp/*source-map-data*]
+                 (let [t    (.valueOf (js/Date.))
+                       src  (str "cljs-" t ".cljs")
+                       file (str "cljs-" t ".js")
+                       smd  @comp/*source-map-data*
+                       json (sm/encode {src (:source-map smd)}
+                              {:lines (+ (:gen-line smd) 3)
+                               :file file :sources-content [source]})]
                    (.append sb
                      (str "\n//# sourceURL=repl-" t ".js"
                           "\n//# sourceMappingURL=data:application/json;base64,"
-                          (base64/encodeString
-                            (sm/encode
-                              {src (:source-map smd)}
-                              {:lines (+ (:gen-line smd) 3)
-                               :file (str "repl-" t ".js")
-                               :sources-content [source]})
-                            true)))))
+                          (base64/encodeString json true)))))
                (cb (.toString sb))))))))))

 (defn compile


cosmetics

cosmetics

--- src/nml/core.clj
+++ src/nml/core.clj
@@ -187,16 +187,14 @@
     [nml key val]))

 (def cliopts
-  [
-   ["-c" "--create"    "Create new namelist"                                                                ]
+  [["-c" "--create"    "Create new namelist"                                                                ]
    ["-g" "--get n:k"   "Get value of key 'k' in namelist 'n'"         :assoc-fn assoc-g :parse-fn parse-get ]
    ["-h" "--help"      "Show usage information"                                                             ]
    ["-i" "--in file"   "Input file (default: stdin)"                  :assoc-fn assoc-i                     ]
    ["-n" "--no-prefix" "Report values without 'namelist:key=' prefix"                                       ]
    ["-o" "--out file"  "Output file (default: stdout)"                :assoc-fn assoc-o                     ]
    ["-s" "--set n:k=v" "Set value of key 'k' in namelist 'n' to 'v'"  :assoc-fn assoc-s :parse-fn parse-set ]
-   ["-v" "--version"   "Show version information"                                                           ]
-   ])
+   ["-v" "--version"   "Show version information"                                                           ]])

 ;; formatting


Add postcondition to signing function

Add postcondition to signing function

--- src/photon/security.clj
+++ src/photon/security.clj
@@ -31,6 +31,7 @@
   (http-basic-backend {:authfn (basic-auth user-info)}))

 (defn create-token [secret user]
+  {:post [(jws/unsign % secret {:alg :hs512})]}
   (let [stringify-user
         (-> user
             (update-in [:username] str)


Remove duplicate IPath implementation for String.

--- src/datoteka/core.clj
+++ src/datoteka/core.clj
@@ -347,9 +347,6 @@
   String
   (-uri [v] (URI. v)))

-(def ^:private empty-string-array
-  (make-array String 0))
-
 (extend-protocol pt/IPath
   Path
   (-path [v] v)
@@ -359,9 +356,6 @@

   URL
   (-path [v] (Paths/get (.toURI v)))
-
-  String
-  (-path [v] (Paths/get v empty-string-array))

   clojure.lang.Sequential
   (-path [v]


Formatting...

Formatting...

--- src/overtone/protocols.clj
+++ src/overtone/protocols.clj
@@ -41,13 +41,13 @@

 (defprotocol ISynthNode
-  (control        [this & params] "Modify control parameters of the synth.")
+  (control        [this & params]             "Modify control parameters of the synth.")
   (control-range  [this ctl-start & ctl-vals] "Modify a range of control parameters of the synth.")
-  (free           [this] "Stop and delete the synth instance.")
-  (on-destroyed   [this fn & args] "Calls (apply fn node-id args) when the synth node is destroyed.")
-  (stop           [this] "Stop the synth instance.")
-  (run            [this] "Start a stopped synth node.")
-  (place          [this node] "Place this node in one of four ways:
+  (free           [this]                      "Stop and delete the synth instance.")
+  (on-destroyed   [this fn & args]            "Calls (apply fn node-id args) when the synth node is destroyed.")
+  (stop           [this]                      "Stop the synth instance.")
+  (run            [this]                      "Start a stopped synth node.")
+  (place          [this position dest-node]   "Place this node in one of four ways:

                               (place n :before dest-node)
                               (place n :after  dest-node)


thru rm_lm_study_cohorts (has column name="primary") ; commented-out

--- src/pg_demo/table_defs.clj
+++ src/pg_demo/table_defs.clj
@@ -8,6 +8,20 @@
 ; A map from table name (string) -> table creation sql (string)
 (def table-name->creation-sql
   (into (sorted-map) [
+    #_{ "rm_lm_study_cohorts"         ; #awt #todo
+          "CREATE TABLE rm_lm_study_cohorts (
+              ENTERPRISE_ID numeric NOT NULL,
+              COHORT_ID numeric NOT NULL,
+              STUDY_KEY numeric NOT NULL,
+              BLIND_NAME varchar(70),
+              BLIND_NAME_J varchar(70),
+              STUDY_TYPE_ID numeric NOT NULL,
+              SORT_ID numeric NOT NULL,
+              primary_val numeric NOT NULL,         -- #awt #todo
+              DELETED timestamp,
+              PRIMARY KEY (ENTERPRISE_ID,COHORT_ID)
+          ); " }
+
     { "rm_case_master"
           "CREATE TABLE rm_case_master (
               ENTERPRISE_ID numeric NOT NULL,
@@ -5221,20 +5235,6 @@
               PRIMARY KEY (ENTERPRISE_ID,CENTER_ID,STUDY_KEY,SEQ_NUM)
           ); " }

-    { "rm_lm_study_cohorts"
-          "CREATE TABLE rm_lm_study_cohorts (
-              ENTERPRISE_ID numeric NOT NULL,
-              COHORT_ID numeric NOT NULL,
-              STUDY_KEY numeric NOT NULL,
-              BLIND_NAME varchar(70),
-              BLIND_NAME_J varchar(70),
-              STUDY_TYPE_ID numeric NOT NULL,
-              SORT_ID numeric NOT NULL,
-              \"primary\" numeric NOT NULL,
-              DELETED timestamp,
-              PRIMARY KEY (ENTERPRISE_ID,COHORT_ID)
-          ); " }
-
   ] ))

 (def dummy


Save and restore position, size and fullscreen

--- src/lt/objs/app.cljs
+++ src/lt/objs/app.cljs
@@ -101,28 +101,30 @@
           :reaction (fn [this]
                       (ipc/send "loadedWindow" (window-number))))

-;; (behavior ::store-position-on-close
-;;                   :triggers #{:closed :refresh}
-;;                   :reaction (fn [this]
-;;                               (when-not (.-isFullscreen win)
-;;                                 (set! js/localStorage.x (.-x win))
-;;                                 (set! js/localStorage.y (.-y win))
-;;                                 (set! js/localStorage.width (.-width win))
-;;                                 (set! js/localStorage.height (.-height win))
-;;                                 (set! js/localStorage.fullscreen (.isFullScreen win)))))
-
-;; (behavior ::restore-fullscreen
-;;                   :triggers #{:show}
-;;                   :reaction (fn [this]
-;;                                 (when (= js/localStorage.fullscreen "true")
-;;                                   (.enterFullscreen win))))
-
-;; (behavior ::restore-position-on-init
-;;                   :triggers #{:show}
-;;                   :reaction (fn [this]
-;;                               (when-not (empty? (.-width js/localStorage))
-;;                                 (.resizeTo win (ensure-greater js/localStorage.width 400) (ensure-greater js/localStorage.height 400))
-;;                                 (.moveTo win (ensure-greater js/localStorage.x 0) (ensure-greater js/localStorage.y 0)))))
+(behavior ::store-position-on-close
+          :triggers #{:closed :refresh}
+          :reaction (fn [this]
+                      (when-not (.isFullScreen win)
+                        (let [[width height] (.getSize win)]
+                          (set! js/localStorage.width width)
+                          (set! js/localStorage.height height))
+                        (let [[x y] (.getPosition win)]
+                          (set! js/localStorage.x x)
+                          (set! js/localStorage.y y)))
+                      (set! js/localStorage.fullscreen (.isFullScreen win))))
+
+(behavior ::restore-fullscreen
+          :triggers #{:show}
+          :reaction (fn [this]
+                      (when (= js/localStorage.fullscreen "true")
+                        (.setFullScreen win true))))
+
+(behavior ::restore-position-on-init
+          :triggers #{:show}
+          :reaction (fn [this]
+                      (when js/localStorage.width
+                        (.setSize win (ensure-greater js/localStorage.width 400) (ensure-greater js/localStorage.height 400))
+                        (.setPosition win (ensure-greater js/localStorage.x 0) (ensure-greater js/localStorage.y 0)))))

 (behavior ::on-show-bind-navigate
                   :triggers #{:show}


fix proj template

fix proj template

--- src/leiningen/new/migae/project.clj
+++ src/leiningen/new/migae/project.clj
@@ -16,7 +16,7 @@
           :filters [{:filter "reload_filter"
                      :ns "{{name}}.reload-filter"
                      :class "{{filterclass}}"}]
-          :servlets [{{#servlets}}{:servlet "{{servlet}}",
+          :servlets [{{#servlets}}{:servlet "{{-servlet}}",
                       :src "{{src}}.clj"
                       :ns "{{ns}}",
                       :class "{{class}}",


optimize confirm-var-exists

optimize confirm-var-exists

--- src/main/clojure/cljs/analyzer.cljc
+++ src/main/clojure/cljs/analyzer.cljc
@@ -534,24 +534,38 @@
   [env prefix suffix]
   (contains? '#{goog goog.object goog.string goog.array Math} prefix))

+(defn confirm-var-exist-warning [env prefix suffix]
+  (fn [env prefix suffix]
+    (warning :undeclared-var env {:prefix prefix :suffix suffix})))
+
+(defn loaded-ns?
+  #?(:cljs {:tag boolean})
+  [env prefix]
+  (if-not (nil? (gets @env/*compiler* ::namespaces prefix))
+    true
+    (let [ns (:ns env)]
+      (if-not (nil? (get (:requires ns) prefix))
+        true
+        (if-not (nil? (get (:imports ns) prefix))
+          true
+          false)))))
+
 (defn confirm-var-exists
   ([env prefix suffix]
-    (confirm-var-exists env prefix suffix
-      (fn [env prefix suffix]
-        (warning :undeclared-var env {:prefix prefix :suffix suffix}))))
+   (let [warn (confirm-var-exist-warning env prefix suffix)]
+     (confirm-var-exists env prefix suffix warn)))
   ([env prefix suffix missing-fn]
-    (let [sufstr (str suffix)
-          suffix (symbol
-                   ;; leave cljs.core$macros/.. alone
-                   (if (and (not= ".." sufstr) (re-find #"\." sufstr))
-                     (first (string/split sufstr #"\."))
-                     suffix))]
+    (let [sufstr     (str suffix)
+          suffix-str (if (and (not (identical? ".." sufstr)) ;; leave cljs.core$macros/.. alone
+                           #?(:clj  (re-find #"\." sufstr)
+                              :cljs ^boolean (.test #"\." sufstr)))
+                       (first (string/split sufstr #"\."))
+                       suffix)
+          suffix     (symbol suffix-str)]
       (when (and (not (implicit-import? env prefix suffix))
-                 (not (and (not (gets @env/*compiler* ::namespaces prefix))
-                           (or (get (:requires (:ns env)) prefix)
-                           (get (:imports (:ns env)) prefix))))
-                 (not (and (= prefix 'cljs.core) (= suffix 'unquote)))
-                 (not (gets @env/*compiler* ::namespaces prefix :defs suffix)))
+                 (not (loaded-ns? env prefix))
+                 (not (and (= 'cljs.core prefix) (= 'unquote suffix)))
+                 (nil? (gets @env/*compiler* ::namespaces prefix :defs suffix)))
         (missing-fn env prefix suffix)))))

 (defn confirm-var-exists-throw []


Clean up definition of embed-field

Clean up definition of embed-field

--- src/main/resources/sandbox-init.clj
+++ src/main/resources/sandbox-init.clj
@@ -19,7 +19,7 @@
   (defn delete-self [] (.set k9.sandbox/*delete-self* true))

   ;; Embed utilities
-  (defn embed-field [embed t d i] (.field embed t d i))
+  (def embed-field (memfn field t d i))

   (defn embed-create [title desc & fields]
     (let [builder (com.tterrag.k9.util.EmbedCreator/builder)]


Removed python-gtkspellcheck from install-desktop-wiki

--- main/src/dda/pallet/dda_managed_vm/infra/desktop_wiki.clj
+++ main/src/dda/pallet/dda_managed_vm/infra/desktop_wiki.clj
@@ -50,7 +50,7 @@
   (actions/as-action
    (logging/info (str facility "-install system: install-desktop-wiki")))
   (actions/packages
-    :aptitude ["zim" "python-gtkspellcheck" "aspell" "aspell-de"]))
+    :aptitude ["zim" "aspell" "aspell-de"]))

 (s/defn init-system
   [facility settings]


Focus management #38

Focus management #38

--- src/flatgui/focus.clj
+++ src/flatgui/focus.clj
@@ -7,32 +7,37 @@
 ; You must not remove this notice, or any other, from this software.

 (ns flatgui.focus
-  (:require [flatgui.base :as fg]
-            [flatgui.comlogic :as fgc]
-            [flatgui.inputchannels.awtbase :as inputbase]
-            [flatgui.inputchannels.mouse :as mouse]
-            [flatgui.inputchannels.keyboard :as keyboard])
+    (:require [flatgui.base :as fg]
+      [flatgui.comlogic :as fgc]
+      [flatgui.inputchannels.awtbase :as inputbase]
+      [flatgui.inputchannels.mouse :as mouse]
+      [flatgui.inputchannels.keyboard :as keyboard])
   (:import (java.awt.event KeyEvent)))

 (def clean-state {:mode :none
                   :focused-child nil})

-(defn focus-child [child-id] {:mode :parent-of-focused
-                              :focused-child child-id})
+(defn focus-child [child-id]
+  (if (keyword? child-id)
+    {:mode :parent-of-focused
+     :focused-child child-id}
+    (throw (IllegalArgumentException. (str "child-id must be a keyword but is: " child-id)))))

-(defn accepts-focus? [component]
-  (or
-    ;; If the component is focusable itself
-    (:focusable component)
-    ;; If the component has :focus-policy and therefore is a focus cycle root
-    (:focus-policy component)))
+; TODO
+;(defn accepts-focus? [component]
+;  (or
+;    ;; If the component is focusable itself
+;    (:focusable component)
+;    ;; If the component has :focus-policy and therefore is a focus cycle root
+;    (:focus-policy component)))

 (defn get-in-cycle
   ([component dir c-id]
     (let [child-count (count (:children component))
           child-ids (mapv (fn [[k _]] k) (:children component))
+          _ (println " get-in-cycle c-id " c-id "; child-ids " child-ids)
           closed (:closed-focus-root component)
           cycle-keeper (fn [i]
                          (cond
@@ -44,8 +49,8 @@
         (= child-count 0) nil
         (= child-count 1) (nth child-ids 0)
         :else (case dir
-                :next (cycle-keeper (inc index-of-c))
-                :prev (cycle-keeper (dec index-of-c))
+                :next (nth child-ids (cycle-keeper (inc index-of-c)))
+                :prev (nth child-ids (cycle-keeper (dec index-of-c)))
                 :first (nth child-ids 0)
                 :last (nth child-ids (dec child-count))))))
   ([component dir] (get-in-cycle component dir nil)))
@@ -58,9 +63,9 @@
         parent-focus-state (get-property [] :focus-state)
         parent-focused-child (:focused-child parent-focus-state)
         parent-mode (:mode parent-focus-state)
-        child-focus-state (get-property [:this :*] :focus-state)
-        child-mode (:mode child-focus-state)
-        child-throw-mode (:throw-mode child-focus-state)]
+        ;_ (println "FOCUS EVOLVER CALLED - " (:id component) " -- " reason)
+        ;_ (println " old-focus-state = " old-focus-state)
+        ]
     (cond

       (keyboard/key-event? component)
@@ -90,7 +95,13 @@
         :parent-of-focused (if (= parent-focused-child (:id component))
                              ;; My parent is ready to give me focus. If I have any child requesting focus then I
                              ;; give focus to it. Otherwise I leave focus with myself. (*1)
-                             (if (= child-mode :requests-focus)
+                             ;(if (= child-mode :requests-focus)
+                             ;  (focus-child child-id)
+                             ;  {:mode :has-focus
+                             ;   :focused-child nil})
+                             (if-let [child-id (:id (first (filter
+                                                             #(= :requests-focus (:mode (:focus-state %)))
+                                                             (for [[_ c] (:children component)] c))))]
                                (focus-child child-id)
                                {:mode :has-focus
                                 :focused-child nil})
@@ -105,8 +116,13 @@
         :throws-focus old-focus-state)

       (fgc/child-reason? reason)
-      (let [child-id (nth reason 1)]
+      (let [child-id (nth reason 1)
+            child-focus-state (get-property [:this child-id] :focus-state)
+            child-mode (:mode child-focus-state)
+            child-throw-mode (:throw-mode child-focus-state)]
         (case child-mode
+          ;; Nothing to change in this case
+          :none old-focus-state

           ;; If my child is the parent of focused component (or parent of parent ...)
           ;; then I'm :parent-of-focused as well


add main ; Wayde

add main ; Wayde

--- src/northern_hemisphere/handler.clj
+++ src/northern_hemisphere/handler.clj
@@ -122,3 +122,6 @@

 (def app
   (ring-app system/system))
+
+(def main
+  (ring-app system/system))


Missed that

Missed that

--- src/org/spootnik/cyanite/carbon.clj
+++ src/org/spootnik/cyanite/carbon.clj
@@ -5,6 +5,7 @@
             [org.spootnik.cyanite.store :as store]
             [org.spootnik.cyanite.path  :as path]
             [org.spootnik.cyanite.tcp   :as tc]
+            [org.spootnik.cyanite.util  :refer [partition-or-time]]
             [clojure.tools.logging      :refer [info debug]]
             [gloss.core                 :refer [string]]
             [lamina.core                :refer :all]


Server module: main, initialization, middleware configuration etc.

--- src/hurvinek/core.clj
+++ src/hurvinek/core.clj
@@ -1,7 +1,77 @@
+;
+;  (C) Copyright 2016  Pavel Tisnovsky
+;
+;  All rights reserved. This program and the accompanying materials
+;  are made available under the terms of the Eclipse Public License v1.0
+;  which accompanies this distribution, and is available at
+;  http://www.eclipse.org/legal/epl-v10.html
+;
+;  Contributors:
+;      Pavel Tisnovsky
+;
+
 (ns hurvinek.core
-  (:gen-class))
+    "Core module that contains -main function called by Leiningen to start the application.")
+
+(require '[ring.adapter.jetty      :as jetty])
+(require '[ring.middleware.params  :as http-params])
+(require '[ring.middleware.cookies :as cookies])
+
+(require '[clojure.tools.cli       :as cli])
+
+(require '[hurvinek.server         :as server])
+(require '[hurvinek.config         :as config])
+(require '[hurvinek.middleware     :as middleware])
+
+(def default-port
+    "Default port on which hurvinek accepts all HTTP requests."
+    "3000")
+
+(def cli-options
+    "Definitions of all command line options that are  currenty supported."
+    ;; an option with a required argument
+    [["-p" "--port   PORT"    "port number"   :id :port]])
+
+; we need to load the configuration in advance so the 'app' could use it
+(def configuration (config/load-configuration "hurvinek.ini"))
+
+(def app
+    "Definition of a Ring-based application behaviour."
+    (-> server/handler            ; handle all events
+        (middleware/inject-configuration configuration) ; inject configuration structure into the parameter
+        cookies/wrap-cookies      ; we need to work with cookies
+        http-params/wrap-params)) ; and to process request parameters, of course
+
+(defn start-server
+    "Start the HTTP server on the specified port."
+    [port]
+    (println "Starting the server at the port: " port)
+    (jetty/run-jetty app {:port (read-string port)}))
+
+(defn get-and-check-port
+    "Accepts port number represented by string and throws AssertionError
+     if port number is outside defined range."
+    [port]
+    (let [port-number (. Integer parseInt port)]
+        (assert (> port-number 0))
+        (assert (< port-number 65536))
+        port))
+
+(defn get-port
+    "Returns specified port or default port if none is specified on the command line."
+    [specified-port]
+    (if (or (not specified-port) (not (string? specified-port)) (empty? specified-port))
+        default-port
+        (get-and-check-port specified-port)))

 (defn -main
-  "I don't do a whole lot ... yet."
-  [& args]
-  (println "Hello, World!"))
+    "Entry point to the hurvinek server."
+    [& args]
+    (let [all-options      (cli/parse-opts args cli-options)
+          options          (all-options :options)
+          port             (options :port)]
+          (config/print-configuration configuration)
+          (start-server    (get-port port))))
+
+; finito
+


simplify

simplify

git-svn-id: 03a8048b5ee8463be5048a3801110fb50f378627@7477 d0ab736e-dc22-4aeb-8dc9-08def0aa14fd

--- plugins/DataBrowser/src/org/micromanager/browser/core.clj
+++ plugins/DataBrowser/src/org/micromanager/browser/core.clj
@@ -147,7 +147,7 @@
 (defn create-browser-table-model [headings]
   (proxy [AbstractTableModel] []
     (getRowCount [] (count @current-data))
-    (getColumnCount [] (if-let [cols (first @current-data)] (count cols) (count headings)))
+    (getColumnCount [] (count headings))
     (getValueAt [row column] (when (pos? (count @current-data))
                                (nth (nth @current-data row) column)))
     (getColumnName [column] (nth headings column))))


verbosity flag

verbosity flag

--- src/matross/core.clj
+++ src/matross/core.clj
@@ -8,6 +8,10 @@
    ["-s" "--ask-password"]
    ["-S" "--ask-sudo-pass"]
    ["-d" "--debug"]
+   ["-v" nil "Verbosity Level"
+    :id :verbosity
+    :default 0
+    :assoc-fn (fn [m k _] (update-in m [k] (fn [v] (min 3 (inc v)))))]
    ["-e" "--extra-var KEY=VALUE" "Extra variables to set at run time"
     :id :extra-vars
     :assoc-fn (fn [m k v]


Use xmllint to reformat ncc.html and master.smil

Fixes #60

--- src/mdr2/dtb/xml.clj
+++ src/mdr2/dtb/xml.clj
@@ -3,6 +3,7 @@
   Book](http://www.daisy.org/daisypedia/daisy-digital-talking-book)"
   (:require [clojure.java.io :as io]
             [clojure.data.xml :as xml]
+            [clojure.java.shell :as shell]
             [mdr2.data.xml :as xml-new]
             [clojure.walk :as w]
             [clojure.zip :as zip]
@@ -93,6 +94,13 @@
   [xml production handler]
   (w/postwalk #(handler % production) xml))

+(defn xml-format!
+  "Format xml file `in` and store it in file `out`"
+  [in out]
+  (shell/sh "xmllint" "--format" "--nonet"
+            "--output" (.getAbsolutePath out)
+            (.getAbsolutePath in)))
+
 (defn update-mainfest!
   "Update the manifest file of `volume` for `production` in-place with
   the meta data from `production`. If a `manifest` is given the
@@ -103,8 +111,11 @@
    (let [updated (with-open [r (io/reader manifest)]
                   (update-meta-data (xml/parse r :support-dtd false)
                                     production handle-manifest-node))]
-    (with-open [w (io/writer manifest)]
-      (xml-new/emit updated w :doctype manifest-doctype)))))
+     (let [tmp-file (java.io.File/createTempFile "mdr2-" ".xml")]
+       (with-open [w (io/writer tmp-file)]
+         (xml-new/emit updated w :doctype manifest-doctype))
+       (xml-format! tmp-file manifest)
+       (.delete tmp-file)))))

 (defn update-master-smil!
   "Update the master smil file of `volume` for `production` in-place
@@ -115,8 +126,11 @@
                   (update-meta-data
                    (xml/parse r :support-dtd false)
                    production handle-smil-node))]
-    (with-open [w (io/writer smil)]
-      (xml-new/emit updated w :doctype smil-doctype))))
+    (let [tmp-file (java.io.File/createTempFile "mdr2-" ".smil")]
+      (with-open [w (io/writer tmp-file)]
+        (xml-new/emit updated w :doctype smil-doctype))
+      (xml-format! tmp-file smil)
+      (.delete tmp-file))))

 (defn update-meta-data!
   "Update the manifest and the smil file of a `volume` for


Log an error if the invocation of xmllint fails

--- src/mdr2/dtb/xml.clj
+++ src/mdr2/dtb/xml.clj
@@ -4,6 +4,8 @@
   (:require [clojure.java.io :as io]
             [clojure.data.xml :as xml]
             [clojure.java.shell :as shell]
+            [clojure.tools.logging :as log]
+            [clojure.string :as s]
             [mdr2.data.xml :as xml-new]
             [clojure.walk :as w]
             [clojure.zip :as zip]
@@ -97,9 +99,13 @@
 (defn xml-format!
   "Format xml file `in` and store it in file `out`"
   [in out]
-  (shell/sh "xmllint" "--format" "--nonet"
-            "--output" (.getAbsolutePath out)
-            (.getAbsolutePath in)))
+  (let [{:keys [exit err]}
+        (shell/sh "xmllint" "--format" "--nonet"
+                  "--output" (.getAbsolutePath out)
+                  (.getAbsolutePath in))]
+    (when-not (and (= 0 exit) (s/blank? err))
+      (log/errorf "xmllint of %s failed with exit %s and message \"%s\""
+                  (.getAbsolutePath in) exit (s/trim-newline err)))))

 (defn update-mainfest!
   "Update the manifest file of `volume` for `production` in-place with


remove typo

remove typo

--- src/semtag_web/service.clj
+++ src/semtag_web/service.clj
@@ -37,7 +37,7 @@
 (interceptor/defon-response html-content-type
   [response]
   (ring-resp/content-type response "text/html"))
-5
+
 (defroutes routes
   [[["/" {:get home-page}
      ;; TODO: convert ring stacktrace middleware


WIP: splitting the handlers out

WIP: splitting the handlers out

--- src/meetdown/http.clj
+++ src/meetdown/http.clj
@@ -12,39 +12,48 @@
             [taoensso.timbre :as timbre]
             [meetdown.auth :as auth]))

-(defn- handle-query
-  [db-conn]
-  (fn [{req-body :body-params, :keys [user-roles user-id]}]
-    (let [db (data/database db-conn)]
-      (case (:type req-body)
-        :get-events   {:body (data/get-events db)}
+(def auth-handlers
+  ;; Auth: test with:
+  ;; curl -iXPOST http://localhost:3000/q -d "{:type :login, :user-id "james"}" -H "Content-Type: application/edn"

-        :create-event {:body {:db/id (:db/id (data/create-entity db-conn (:txn-data req-body)))}}
+  ;; curl -iXPOST http://localhost:3000/q -d "{:type :get-current-user}" -H "Content-Type: application/edn" -H "Authorization: <token>"

-        :get-event    {:body (->> (get-in req-body [:txn-data :db/id])
-                                  (data/to-ent db))}
+  {:get-current-user (fn [{:keys [db body-params user-id user-roles]}]
+                       (if user-id
+                         {:body {:user-id user-id
+                                 :user-roles user-roles}}
+                         {:body :no-current-user
+                          :status 401}))

-        :create-user  {:body {:db/id (:db/id (data/create-entity db-conn (:txn-data req-body)))}}
+   ;; yes, we log *anyone* in...
+   :login (fn [{:keys [db body-params]}]
+            {:body :logged-in
+             :headers {"Authorization" (auth/generate-token {:user-id (:user-id body-params)
+                                                             :user-roles #{:admin}})}})})

+(def event-handlers
+  {:get-events (fn [{:keys [db body-params]}]
+                 {:body (data/get-events db)})

-        ;; Auth: test with:
-        ;; curl -iXPOST http://localhost:3000/q -d "{:type :login, :user-id "james"}" -H "Content-Type: application/edn"
+   :create-event (fn [{:keys [db db-conn body-params]}]
+                   {:body {:db/id (:db/id (data/create-entity db-conn (:txn-data body-params)))}})

-        ;; curl -iXPOST http://localhost:3000/q -d "{:type :get-current-user}" -H "Content-Type: application/edn" -H "Authorization: <token>"
+   :get-event (fn [{:keys [db body-params]}]
+                {:body (->> (get-in body-params [:txn-data :db/id])
+                            (data/to-ent db))})})

-        :get-current-user (if user-id
-                            {:body {:user-id user-id
-                                    :user-roles user-roles}}
-                            {:body :no-current-user
-                             :status 401})
+(def user-handlers
+  {:create-user (fn [{:keys [db db-conn body-params]}]
+                  {:body {:db/id (:db/id (data/create-entity db-conn (:txn-data body-params)))}})})

-        ;; yes, we log *anyone* in...
-        :login {:body :logged-in
-                :headers {"Authorization" (auth/generate-token {:user-id (:user-id req-body)
-                                                                :user-roles #{:admin}})}}
-
-
-        {:status 415 :body (str "Unsupported type - " (:type req-body))}))))
+(defn- handle-query [req]
+  (let [req-type (get-in req [:body-params :type])]
+    (if-let [handler (get (merge auth-handlers
+                                 event-handlers
+                                 user-handlers)
+                          req-type)]
+      (handler req)
+      {:status 415 :body (str "Unsupported type - " req-type)})))

 (def home-page
   (html
@@ -59,15 +68,15 @@
       [:h3 "Loading...."]
       [:p "Loading application. Please wait.... "]]
      (include-js "js/compiled/meetdown.js")
-     [:script {:type "text/javascript"} "addEventListener(\"load\", meetdown.cljscore.main, false);"]
-     ]]))
+     [:script {:type "text/javascript"} "addEventListener(\"load\", meetdown.cljscore.main, false);"]]]))

-(defn make-router [db-conn]
+(defn make-router []
   (routes
     (resources "/")
     (GET "/" [] home-page)
     (POST "/q" []
-      (handle-query db-conn))))
+      (fn [req]
+        (handle-query req)))))

 (def default-config
   {:params {:urlencoded true
@@ -85,18 +94,23 @@
       (timbre/debug "Handling request:" req)
       (handler req))))

-(defn wrap-authenticate-user
-  [handler]
-
+(defn wrap-authenticate-user [handler]
   (fn [req]
     (handler (merge req
                     (auth/authenticate-user (get-in req [:headers "authorization"]))))))

+(defn wrap-db [handler db-conn]
+  (fn [req]
+    (handler (assoc req
+               :db-conn db-conn
+               :db (data/database db-conn)))))
+
 (defn make-handler [db-conn]
-  (-> (make-router db-conn)
+  (-> (make-router)
       wrap-log-request
       (wrap-restful-format :formats [:edn :transit-json])
       wrap-authenticate-user
+      (wrap-db db-conn)
       (rmd/wrap-defaults rmd/api-defaults)))


Include not reduction.

Include not reduction.

--- src/smallex/reductions.clj
+++ src/smallex/reductions.clj
@@ -281,6 +281,7 @@
             :or (-> expr flatten-or reduce-or)
             :opt (expand-opt expr)
             :plus (expand-plus expr)
+            :not (invert-not expr)
             :star expr))
     :char-set (setify-char-set expr)
     :string expr))


Add animation-controller

Add animation-controller

--- src/play_clj/g3d.clj
+++ src/play_clj/g3d.clj
@@ -6,7 +6,29 @@
             ColorAttribute CubemapAttribute DepthTestAttribute FloatAttribute
             IntAttribute TextureAttribute]
            [com.badlogic.gdx.graphics.g3d.model.data ModelData]
-           [com.badlogic.gdx.graphics.g3d.utils ModelBuilder]))
+           [com.badlogic.gdx.graphics.g3d.utils AnimationController
+            ModelBuilder]))
+
+; animation-controller
+
+(defn animation-controller*
+  "The function version of `animation-controller`"
+  [entity]
+  (AnimationController. (u/get-obj entity :object)))
+
+(defmacro animation-controller
+  "Returns an [AnimationController](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/graphics/g3d/utils/AnimationController.html)
+
+    (animation-controller entity)"
+  [entity & options]
+  `(let [^AnimationController object# (animation-controller* ~entity)]
+     (u/calls! object# ~@options)))
+
+(defmacro animation-controller!
+  "Calls a single method on an `animation-controller`"
+  [object k & options]
+  `(let [^AnimationController object# ~object]
+     (u/call! object# ~k ~@options)))

 ; environment


Export dataset as a CSV file

Export dataset as a CSV file

Export dataset as a semicolon-separated CSV file.

--- src/strava_activity_graphs/core.clj
+++ src/strava_activity_graphs/core.clj
@@ -1,7 +1,8 @@
 (ns strava-activity-graphs.core
   (:gen-class)
   (:use [incanter.charts]
-        [incanter.core])
+        [incanter.core]
+        [incanter.io])
   (:require [clojure.data.json :as json]
             [clj-http.client :as http-client]))

@@ -37,10 +38,12 @@
     view))

 (defn display-charts [token]
-  (let [activities (get-activities token)]
-    (with-data
-      (to-dataset activities)
+  (let [activities (get-activities token)
+        activities (to-dataset activities)]
+    (with-data activities
       #_(view $data)
+      (save activities "/tmp/strava-activities.csv"
+            :delim \;)
       (ts-plot
         ($ :start_date_local)
         ($ :average_speed)


xymon.clj: event->disable: ability to send Xymon disable messages

--- src/riemann/xymon.clj
+++ src/riemann/xymon.clj
@@ -47,12 +47,26 @@

   enable HOSTNAME.TESTNAME

+  if no service is provided, the complete host is enabled.
   "
   [{:keys [host service]
     :or {host "" service "*"}}]
   (let [host (host->xymon host)
         service (service->xymon service)]
     (format "enable %s.%s" host service)))
+
+(defn event->disable
+  "
+  Convert an event to a Xymon disable message:
+  disable HOSTNAME.TESTNAME DURATION <additional text>
+
+  Fields mapping is the same as event-status'.
+  "
+  [{:keys [host service duration description]
+    :or {host "" service "*" duration "" description ""}}]
+  (let [host (host->xymon host)
+        service (service->xymon service)]
+    (format "disable %s.%s %s %s" host service duration description)))

 (defn send-line
   "Connects to Xymon server, sends line, then closes the connection.


fixed headers.

fixed headers.

--- src/wombats/components/pedestal.clj
+++ src/wombats/components/pedestal.clj
@@ -37,6 +37,7 @@
                               allowed-origin?)
      ::http/routes api-routes
      ::http/port port
+     ::http/secure-headers {:hsts-settings (sec-headers/hsts-header 31536000)}
      ::http/type type
      ::http/join? join?
      ::http/container-options (merge container-options


fixed round

fixed round

--- src/tango/export2.clj
+++ src/tango/export2.clj
@@ -115,7 +115,8 @@
   (xml/parse (java.io.FileInputStream. "test/tango/examples/real-example.xml")))

 (def class-results [{:class-name "Disco Freestyle B-klass J Po"
-                     :result {:adjudicators [{:number 2}
+                     :result {:round "S"
+                              :adjudicators [{:number 2}
                                             {:number 4}
                                             {:number 5}]
                               :dances [{:name "X-Quick Forward"}
@@ -159,10 +160,10 @@
                (make-mark-list-node (:marks couple-data))
                ))

-(defn make-result-node [result-array seq dance-qty adj-qty]
+(defn make-result-node [result-array round seq dance-qty adj-qty]
   (xml/element :Result
                {:Seq seq
-                :Round "Awsome3"
+                :Round round
                 :AdjQty adj-qty
                 :D3 "0"}
                (reduce #(conj %1 (make-couple-node %2 (count %1) dance-qty adj-qty)) [] result-array)))
@@ -177,6 +178,7 @@
                                                              ;(xml/element :Foo {})
                                                              (make-result-node
                                                               (get-in class-result [:result :result-array] )
+                                                              (get-in class-result [:result :round] )
                                                               (count (:content form))
                                                               (get-dance-count-from-class-node class)
                                                               (count  (get-in class-result [:result :adjudicators] )))


query strategies added

query strategies added

--- src/webdriver/new.clj
+++ src/webdriver/new.clj
@@ -204,25 +204,61 @@
 ;; find element(s)
 ;;

-(defn by [driver locator]
-  (swap! driver assoc :locator locator)
-  driver)
-
-(defmulti find dispatch-driver)
-
-(defmethod find :firefox [driver q]
+(defn q-xpath
+  "Turns a map into xpath clause.
+   {:tag :div :id :content :class :test :index 2}
+   //div[@id='content'][@class='test'][2]"
+  [q]
+  (let [tag (or (:tag q) :*)
+        idx (:index q)
+        attrs (dissoc q :tag :index)
+        get-val (fn [val] (if (keyword? val)
+                            (name val)
+                            (str val)))
+        pair (fn [[key val]] (format "[@%s='%s']"
+                                     (name key)
+                                     (get-val val)))
+        parts (map pair attrs)
+        xpath (apply str "//" (name tag) parts)
+        xpath (str xpath (if idx (format "[%s]" idx) ""))]
+    xpath))
+
+(defn q-discover [q]
+  (cond
+    (string? q)
+    [nil q]
+
+    (and (map? q)
+         (:xpath q))
+    ["xpath" (:xpath q)]
+
+    (and (map? q)
+         (:css q))
+    ["css selector" (:css q)]
+
+    (map? q)
+    ["xpath" (q-xpath q)]))
+
+(defmulti find-el dispatch-driver)
+
+(defmethod find-el :firefox [driver locator term]
   (with-resp driver :post
     [:session (:session @driver) :element]
-    {:using (:locator @driver) :value q}
+    {:using locator :value term}
     resp
     (-> resp :value first second)))

-(defmethod find :default [driver q]
+(defmethod find-el :default [driver locator term]
   (with-resp driver :post
     [:session (:session @driver) :element]
-    {:using (:locator @driver) :value q}
+    {:using locator :value term}
     resp
     (-> resp :value :ELEMENT)))
+
+(defn find [driver q]
+  (let [[locator term] (q-discover q)
+        locator (or locator (:locator @driver))]
+    (find-el driver locator term)))

 ;;
 ;; mouse
@@ -268,10 +304,6 @@
   (mouse-move-to driver q-from)
   (with-mouse-btn driver
     (mouse-move-to driver q-to)))
-
-;;
-;; xpath/css finders
-;;

 ;;
 ;; click
@@ -569,6 +601,11 @@
 ;; locators
 ;;

+
+(defn by [driver locator]
+  (swap! driver assoc :locator locator)
+  driver)
+
 (defmacro with-locator [driver locator & body]
   `(let [old# (-> ~driver deref :locator)]
      (swap! ~driver assoc :locator ~locator)
@@ -579,6 +616,10 @@

 (defmacro with-xpath [driver & body]
   `(with-locator ~driver "xpath"
+     ~@body))
+
+(defmacro with-xpath [driver & body]
+  `(with-locator ~driver "css selector"
      ~@body))

 ;;


Track *e on file compilation also

Track *e on file compilation also

Former-commit-id: 4f852061402770fc01e34745568414bdd6653fe7

--- planck-cljs/src/planck/core.cljs
+++ planck-cljs/src/planck/core.cljs
@@ -228,22 +228,20 @@
                  :def-emits-var true}))
             (fn [{:keys [ns value error] :as ret}]
               (if expression?
-                (if-not error
-                  (do
-                    (when (or print-nil-expression?
+                (when-not error
+                  (when (or print-nil-expression?
                             (not (nil? value)))
-                      (prn value))
-                    (when-not
+                    (prn value))
+                  (when-not
                       (or ('#{*1 *2 *3 *e} expression-form)
-                        (ns-form? expression-form))
-                      (set! *3 *2)
-                      (set! *2 *1)
-                      (set! *1 value))
-                    (reset! current-ns ns)
-                    nil)
-                  (do
-                    (set! *e error))))
+                          (ns-form? expression-form))
+                    (set! *3 *2)
+                    (set! *2 *1)
+                    (set! *1 value))
+                  (reset! current-ns ns)
+                  nil))
               (when error
+                (set! *e error)
                 (print-error error))))
           (catch :default e
             (set! *e e)


Generate a board without illegal values in it. May be solvable!

--- src/sudoku/lib_sudoku.cljs
+++ src/sudoku/lib_sudoku.cljs
@@ -111,8 +111,10 @@
   (let [random-value-to-board (fn [board value]
                                  (let [row (rand-int 9)
                                        column (rand-int 9)]
-                                   (set-value-at board [row column] value)))
+                                   (if (and (duplicate? (set-value-at board [row column] value) [row column] value)
+                                            (not (has-value? board [row column])))
+                                     (set-value-at board [row column] value)
+                                     board)))
         empty-board (vec (repeat 9 (vec (repeat 9 0))))
-        values (repeatedly 15 #(inc (rand-int 9)))]
+        values (repeatedly 45 #(inc (rand-int 9)))]
     (reduce random-value-to-board empty-board values)))
-


Change watch -> wait in audio tempalte

Change watch -> wait in audio tempalte

--- resources/leiningen/new/audio/build.boot
+++ resources/leiningen/new/audio/build.boot
@@ -15,7 +15,7 @@

 (deftask run []
   (comp
-    (watch)
+    (wait)
     (with-pre-wrap fileset
       ({{namespace}}/-main)
       fileset)))


Fix bug which meant unknown effects were silently ignored.

--- src/re_frame/fx.cljc
+++ src/re_frame/fx.cljc
@@ -35,7 +35,7 @@
               [context]
               (->> (:effects context)
                    (map (fn [[key val]]
-                          (if-let [effect-fn  (get-handler kind key)]
+                          (if-let [effect-fn  (get-handler kind key true)]
                             (effect-fn val))))
                    doall))))


Add reagent.core/render macro, throwing analysis-error with note

--- src/reagent/core.clj
+++ src/reagent/core.clj
@@ -1,5 +1,6 @@
 (ns reagent.core
-  (:require [reagent.ratom :as ra]))
+  (:require [reagent.ratom :as ra]
+            [cljs.analyzer.api :as ana-api]))

 (defmacro with-let
   "Bind variables as with let, except that when used in a component
@@ -8,3 +9,16 @@
   destroyed."
   [bindings & body]
   `(ra/with-let ~bindings ~@body))
+
+(defn- source-info [env]
+  (when (:line env)
+    {:file (ana-api/current-file)
+     :line (:line env)
+     :column (:column env)}))
+
+(defmacro render
+  "Render function was moved to reagent.dom namespace in 1.0"
+  [& body]
+  (throw (ex-info "reagent.core/render function was moved to reagent.dom namespace in Reagent v1.0"
+                  (assoc (source-info &env) :tag :cljs/analysis-error)))
+  nil)