enable set inc and dec

enable set inc and dec

--- src/cljs/movement/session.cljs
+++ src/cljs/movement/session.cljs
@@ -14,60 +14,60 @@
     [movement.text :refer [text-edit-component text-input-component auto-complete-did-mount]]))

 #_(defn replace-movement [event {:keys [kw movement part-number]}]
-  (.preventDefault event)
-  (cond
-    (= :swap kw) (let [slot-category (:slot-category movement)
-                       category (if slot-category
-                                  (name (first (shuffle slot-category)))
-                                  (name (first (shuffle (:category movement)))))]
-                   (GET "movement-from-category" {:params        {:user-id  (:user-id (session/get :user))
-                                                                  :category category}
-                                                  :handler       (fn [new-movement]
-                                                                   (let [old-movement (dissoc movement :next :previous) ; remove data that may not be overwritten by merging with the new movement
-                                                                         part (session/get-in [:movement-session :parts part-number])
-                                                                         pos (first (positions #{movement} part))
-                                                                         new-part (assoc part pos (merge old-movement (first new-movement)))]
-                                                                     (session/assoc-in! [:movement-session :parts part-number] new-part)))
-                                                  :error-handler (fn [r] nil)}))
-    (or (= :next kw)
-        (= :previous kw)) (let [new-movement (first (shuffle (kw movement)))]
-                            (GET "movement" {:params        {:user-id  (:user-id (session/get :user))
-                                                             :name new-movement}
-                                             :handler       (fn [new-movement]
-                                                              (let [old-movement (dissoc movement :next :previous) ; remove data that may not be overwritten by merging with the new movement
-                                                                    part (session/get-in [:movement-session :parts part-number])
-                                                                    pos (first (positions #{movement} part))
-                                                                    new-part (assoc part pos (merge old-movement new-movement))]
-                                                                (session/assoc-in! [:movement-session :parts part-number] new-part)))
-                                             :error-handler (fn [r] nil)}))
-    :else nil))
+    (.preventDefault event)
+    (cond
+      (= :swap kw) (let [slot-category (:slot-category movement)
+                         category (if slot-category
+                                    (name (first (shuffle slot-category)))
+                                    (name (first (shuffle (:category movement)))))]
+                     (GET "movement-from-category" {:params        {:user-id  (:user-id (session/get :user))
+                                                                    :category category}
+                                                    :handler       (fn [new-movement]
+                                                                     (let [old-movement (dissoc movement :next :previous) ; remove data that may not be overwritten by merging with the new movement
+                                                                           part (session/get-in [:movement-session :parts part-number])
+                                                                           pos (first (positions #{movement} part))
+                                                                           new-part (assoc part pos (merge old-movement (first new-movement)))]
+                                                                       (session/assoc-in! [:movement-session :parts part-number] new-part)))
+                                                    :error-handler (fn [r] nil)}))
+      (or (= :next kw)
+          (= :previous kw)) (let [new-movement (first (shuffle (kw movement)))]
+                              (GET "movement" {:params        {:user-id (:user-id (session/get :user))
+                                                               :name    new-movement}
+                                               :handler       (fn [new-movement]
+                                                                (let [old-movement (dissoc movement :next :previous) ; remove data that may not be overwritten by merging with the new movement
+                                                                      part (session/get-in [:movement-session :parts part-number])
+                                                                      pos (first (positions #{movement} part))
+                                                                      new-part (assoc part pos (merge old-movement new-movement))]
+                                                                  (session/assoc-in! [:movement-session :parts part-number] new-part)))
+                                               :error-handler (fn [r] nil)}))
+      :else nil))

 #_(defn add-movement [category part-number]
-  (GET "movement-from-category" {:params        {:user-id  (:user-id (session/get :user))
-                                                 :category (name category)}
-                                 :handler       (fn [[new-movement]]
-                                                  (let [part (session/get-in [:movement-session :parts part-number])
-                                                        new-part (conj part new-movement)]
-                                                    (session/assoc-in! [:movement-session :parts part-number] new-part)))
-                                 :error-handler (fn [r] nil)}))
+    (GET "movement-from-category" {:params        {:user-id  (:user-id (session/get :user))
+                                                   :category (name category)}
+                                   :handler       (fn [[new-movement]]
+                                                    (let [part (session/get-in [:movement-session :parts part-number])
+                                                          new-part (conj part new-movement)]
+                                                      (session/assoc-in! [:movement-session :parts part-number] new-part)))
+                                   :error-handler (fn [r] nil)}))

 #_(defn add-movement-from-search [name part-number]
-  (GET "movement" {:params        {:user-id  (:user-id (session/get :user))
-                                   :name name}
-                   :handler       (fn [new-movement]
-                                    (let [part (session/get-in [:movement-session :parts part-number])
-                                          new-part (conj part  new-movement)]
-                                      (session/assoc-in! [:movement-session :parts part-number] new-part)))
-                   :error-handler (fn [r] nil)}))
-
-#_(defn inc-set-completed [event m part-number]
+    (GET "movement" {:params        {:user-id (:user-id (session/get :user))
+                                     :name    name}
+                     :handler       (fn [new-movement]
+                                      (let [part (session/get-in [:movement-session :parts part-number])
+                                            new-part (conj part new-movement)]
+                                        (session/assoc-in! [:movement-session :parts part-number] new-part)))
+                     :error-handler (fn [r] nil)}))
+
+(defn inc-set-completed [event m part-number]
   (.preventDefault event)
   (let [part (session/get-in [:movement-session :parts part-number])
         pos (positions #{m} part)
         new-part (assoc part (first pos) (update m :performed-sets inc))]
     (session/assoc-in! [:movement-session :parts part-number] new-part)))

-#_(defn dec-set-completed [event m part-number]
+(defn dec-set-completed [event m part-number]
   (.preventDefault event)
   (let [part (session/get-in [:movement-session :parts part-number])
         pos (positions #{m} part)
@@ -135,36 +135,45 @@
       [:div.pure-g.movement {:id id}
        [:div.pure-u-1
         [:div.pure-g {:style {:cursor 'pointer}}
-         [:div.pure-u-1-5 {:onClick (fn [e] (.preventDefault e) (reset! expand (not @expand))) :onTouchEnd (fn [e] (.preventDefault e) (reset! expand (not @expand)))}
-          [:img.graphic {:src (str "http://s3.amazonaws.com/mumrik-movement-images/" image) :title name :alt name}]]
-         [:div.pure-u-2-5 {:onClick (fn [e] (.preventDefault e) (reset! expand (not @expand))) :onTouchEnd (fn [e] (.preventDefault e) (reset! expand (not @expand)))
-                           :style   {:display 'flex :text-align 'center}}
+         [:div.pure-u-1-5 {:onClick    (fn [e] (.preventDefault e) (reset! expand (not @expand)))
+                           :onTouchEnd (fn [e] (.preventDefault e) (reset! expand (not @expand)))}
+          [:img.graphic {:src   (str "http://s3.amazonaws.com/mumrik-movement-images/" image)
+                         :title name :alt name}]]
+         [:div.pure-u-2-5 {:onClick    (fn [e] (.preventDefault e) (reset! expand (not @expand)))
+                           :onTouchEnd (fn [e] (.preventDefault e) (reset! expand (not @expand)))
+                           :style      {:display 'flex :text-align 'center}}
           [:h3.title {:style {:margin 'auto}} name]]
-         [:div.pure-u-1-5 {:onClick (fn [e] (.preventDefault e) (reset! expand (not @expand))) :onTouchEnd (fn [e] (.preventDefault e) (reset! expand (not @expand)))}
-
-          [:div.pure-g [:div.pure-u-1
-                        (if (pos? weight) (r-component {:data weight :name "kg"})
-                                          [:div.pure-g {:style {:opacity 0.0}} [:div.pure-u {:style {:font-size "200%"}} 0]])]]
-          [:div.pure-g [:div.pure-u-1
-                        (when (pos? rep) (r-component {:data rep :name "reps"}))
-                        (when (pos? distance) (r-component {:data distance :name "m"}))
-                        (when (pos? duration) (r-component {:data duration :name "s"}))]]
-          [:div.pure-g [:div.pure-u-1
-                        (when (pos? rest) (r-component {:data rest :name "s pause"}))]]]
-
-         [:div.pure-u-1-5.set-area {;:onClick    #(inc-set-completed % m part-number)
-                                    ;:onTouchEnd #(inc-set-completed % m part-number)
+         [:div.pure-u-1-5 {:onClick    (fn [e] (.preventDefault e) (reset! expand (not @expand)))
+                           :onTouchEnd (fn [e] (.preventDefault e) (reset! expand (not @expand)))}
+
+          [:div.pure-g
+           [:div.pure-u-1
+            (if (pos? weight)
+              (r-component {:data weight :name "kg"})
+              [:div.pure-g {:style {:opacity 0.0}}
+               [:div.pure-u {:style {:font-size "200%"}} 0]])]]
+          [:div.pure-g
+           [:div.pure-u-1
+            (when (pos? rep) (r-component {:data rep :name "reps"}))
+            (when (pos? distance) (r-component {:data distance :name "m"}))
+            (when (pos? duration) (r-component {:data duration :name "s"}))]]
+          [:div.pure-g
+           [:div.pure-u-1
+            (when (pos? rest) (r-component {:data rest :name "s pause"}))]]]
+
+         [:div.pure-u-1-5.set-area {
+                                    :onClick    #(inc-set-completed % m part-number)
+                                    :onTouchEnd #(inc-set-completed % m part-number)
                                     }
           [:div.pure-g
            [:div.pure-u-1
-            [:i.fa.fa-minus {:onClick    #(;dec-set-completed % m part-number
-                                           )
-                             :onTouchEnd #(;dec-set-completed % m part-number
-                                           )
-                             :style      {:opacity    (when-not performed-sets 0)
-                                          :color      (when performed-sets 'red)
-                                          :margin-top 5 :margin-right 5
-                                          :float      'right}}]]]
+            [:i.fa.fa-minus
+             {:onClick    #(dec-set-completed % m part-number)
+              :onTouchEnd #(dec-set-completed % m part-number)
+              :style      {:opacity    (when-not performed-sets 0)
+                           :color      (when performed-sets 'red)
+                           :margin-top 5 :margin-right 5
+                           :float      'right}}]]]
           (if set
             [:div.pure-g {:style {:display 'flex}}
              [:div.pure-u {:style {:margin 'auto :margin-top 10 :opacity 0.05 :font-size "100%"}} set]]
@@ -205,8 +214,8 @@
              [:input {:style {:margin-left 3 :margin-right 3 :width 75}
                       :id    (str "rest-input" id) :type "number" :defaultValue rest :min 0}]
              [:span "sek"]]
-            [:a.pure-u-1-3.pure-button.pure-button-primary {:style   {:margin "5px 5px 5px 5px"}
-                                                            :onClick (fn [e] (.preventDefault e) (update-movement {:id id :m m :parts parts :part-number part-number :pos pos}))
+            [:a.pure-u-1-3.pure-button.pure-button-primary {:style      {:margin "5px 5px 5px 5px"}
+                                                            :onClick    (fn [e] (.preventDefault e) (update-movement {:id id :m m :parts parts :part-number part-number :pos pos}))
                                                             :onTouchEnd (fn [e] (.preventDefault e) (update-movement {:id id :m m :parts parts :part-number part-number :pos pos}))}
              "Oppdater"]]
            [:div.pure-g
@@ -262,9 +271,9 @@
                              ))
              :style      {:margin-right '50 :cursor 'pointer}}])
          [:i.fa.fa-search-plus.fa-3x
-          {:onClick #(all-movements % show-search-input?)
+          {:onClick    #(all-movements % show-search-input?)
            :onTouchEnd #(all-movements % show-search-input?)
-           :style {:cursor 'pointer}}]]
+           :style      {:cursor 'pointer}}]]
         (when @show-search-input?
           (let [id (str "mtags" part-number)
                 movements-ac-comp (with-meta text-input-component


added auto erasure of text input when valid move is inputted

--- src/quick_chess/core.cljs
+++ src/quick_chess/core.cljs
@@ -264,7 +264,8 @@
             (handle-deselection from-pos positions)))
     (swap! text-state assoc
            :move-to {}
-           :piece-str "")))
+           :piece-str ""
+           :text "")))

 (defn move-command?
   [{:keys [piece-str move-to text]}]


Make lava flow terminate near player starting point

--- src/robinson/worldgen.clj
+++ src/robinson/worldgen.clj
@@ -134,15 +134,17 @@
         [sx sy] (first non-water-samples)]
     (xy->pos sx sy)))

-(defn find-lava-terminal-pos [seed max-x max-y]
-  (let [angle (dg/rand-nth (range (* 2 Math/PI)))
-        radius (/ (min max-x max-y) 2)
-        [cx cy] [(/ max-x 2) (/ max-y 2)]
-        [x y]   [(+ (* radius (Math/cos angle)) cx)
-                 (+ (* radius (Math/sin angle)) cy)]
-        points  (line-segment [x y] [cx cy])
-        samples  points
-        _       (cliskp/seed-simplex-noise! seed)
+(defn find-lava-terminal-pos [seed starting-pos max-x max-y]
+  (let [{x :x y :y}  starting-pos
+        player-angle (Math/atan2 (- x (/ max-x 2)) (- y (/ max-y 2)))
+        angle        (- player-angle 0.03)
+        radius       (/ (min max-x max-y) 2)
+        [cx cy]      [(/ max-x 2) (/ max-y 2)]
+        [x y]        [(+ (* radius (Math/cos angle)) cx)
+                      (+ (* radius (Math/sin angle)) cy)]
+        points       (line-segment [x y] [cx cy])
+        samples       points
+        _            (cliskp/seed-simplex-noise! seed)
         non-water-samples (remove
           (fn [[x y]]
             (let [s (mapv #(.calc ^clisk.IFunction % (double (/ x max-x)) (double (/ y max-y)) (double 0.0) (double 0.0))
@@ -306,7 +308,7 @@

         starting-pos           (find-starting-pos seed max-x max-y)
         volcano-xy             [x y]
-        lava-terminal-pos      (find-lava-terminal-pos seed max-x max-y)
+        lava-terminal-pos      (find-lava-terminal-pos seed starting-pos max-x max-y)
         lava-segments          (partition 2 (apply line-segments [(first volcano-xy) (second volcano-xy) (get lava-terminal-pos :x) (get lava-terminal-pos :y)]))
         lava-points            (map first lava-segments)
         _                      (info "lava-points" lava-points)
@@ -365,6 +367,7 @@
                     :thirst 0
                     :max-thirst 100
                     :pos starting-pos
+                    :starting-pos starting-pos
                     :place :0_0
                     :body-parts #{:head :neck :face :abdomen :arm :leg :foot}
                     :attacks #{:punch}


converting operations

converting operations

--- src/celestial/api/users.clj
+++ src/celestial/api/users.clj
@@ -21,9 +21,10 @@

 (defn into-persisted
    "converting user to persisted version"
-   [{:keys [password envs] :as user}]
+   [{:keys [password envs operations] :as user}]
   (cond-> (-> user convert-roles)
      (not (empty? envs)) (update-in [:envs] (partial mapv keyword))
+     (not (empty? operations)) (update-in [:operations] (partial mapv keyword))
      (not (empty? password)) hash-pass
      ))


For dynamic demonstration purposes, make the server send two strings a few seconds apart.

--- src/clj/om_sente/server.clj
+++ src/clj/om_sente/server.clj
@@ -118,14 +118,16 @@
         (add-token uid (unique-id)))
       (chsk-send! uid [(if valid :auth/success :auth/fail)]))))

-;; Reply with the message in angle brackets.
+;; Reply with the same message, followed by the reverse of the message a few seconds later.
 ;; Also record activity to keep session alive.

 (defmethod handle-event :test/echo
   [[_ msg] req]
   (when-let [uid (session-uid req)]
     (keep-alive uid)
-    (chsk-send! uid [:test/reply (str "<" msg ">")])))
+    (chsk-send! uid [:test/reply msg])
+    (Thread/sleep 3000)
+    (chsk-send! uid [:test/reply (clojure.string/reverse msg)])))

 ;; When the client pings us, send back the session state:


Fix Height of Item Chart

Fix Height of Item Chart

--- src/cljs/lens/workbook.cljs
+++ src/cljs/lens/workbook.cljs
@@ -97,7 +97,7 @@

 (defn draw-item-chart [id value-hist]
   (let [data value-hist
-        svg (.newSvg js/dimple (str "#" id) "100%" 200)
+        svg (.newSvg js/dimple (str "#" id) "100%" "100%")
         chart (new js/dimple.chart svg (clj->js data))]
     (.setMargins chart 50 10 50 35)
     (.addCategoryAxis chart "x" "Bucket")


Clean up div (graph) sizes.

Clean up div (graph) sizes.

--- src/cljs/om_sente/core.cljs
+++ src/cljs/om_sente/core.cljs
@@ -67,9 +67,9 @@

 (def animation-tick 75)
 (def animation-factor 15)
-(def graph-scale 4)
+(def graph-scale 3)
 (def graph-bar-width 30)
-(def graph-height 500)
+(def graph-height 400)

 (defn animated-bar-graph
   "Component that displays the data (text) returned by the server after processing."
@@ -93,7 +93,7 @@
     (render-state [this {:keys [data]}]
                   (let [s (:data/text app)
                         t (make-target s)]
-                    (html [:div {:style {:height 600}}
+                    (html [:div {:style {:height (+ 100 graph-height)}}
                            [:p (str "The string '" s "' represented as a bar chart:")]
                            (into [:svg {:id "display" :width "100%" :height graph-height}]
                                  (map (fn [v1 v2 o]
@@ -272,7 +272,7 @@
                   (line-graph (vec (make-target (:data/text app))))))
     om/IRender
     (render [this]
-            (dom/div #js {:style #js {:height 300}
+            (dom/div #js {:style #js {:height 250}
                           :react-key "d3-node" ;; ensure React knows this is non-reusable
                           :ref "d3-node"       ;; label it so we can retrieve it via get-node
                           :id "d3-node"}))))   ;; set id so D3 can find it!
@@ -312,7 +312,7 @@
                   (nv-line-graph (mapv (fn [a b] {:y a :x b}) (make-target (:data/text app)) (range)))))
     om/IRender
     (render [this]
-            (dom/div #js {:style #js {:height 500}
+            (dom/div #js {:style #js {:height 400}
                           :react-key "nv-node"
                           :ref "nv-node"
                           :id "nv-node"}))))


More classy

More classy

--- src/cljs/triboard/core.cljs
+++ src/cljs/triboard/core.cljs
@@ -423,7 +423,7 @@
    [top-panel-button #(put! (:game-events game-loop) :new-game) (special-char "↻")]
    (show-scores scores player)
    [top-panel-button #(swap! app-state update :help not) "?"]
-   [top-panel-button cancel-last-move! (special-char "←")]])
+   [top-panel-button cancel-last-move! (special-char "↩")]])

 (defn max-board-height []
   (- (-> (dom/getWindow) dom/getViewportSize .-height) 100))


More optimizations

More optimizations

--- src/cljs/triboard/core.cljs
+++ src/cljs/triboard/core.cljs
@@ -62,35 +62,29 @@
   [cell]
   (or (= cell :empty) (= cell :wall)))

-(defn range-cells
-  "Give all the pairs [cell coordinate] in the provided direction"
+(defn available-cells-by-dir
+  "Indicates the convertible cells when clicking at [x y], and returns:
+	{:move [7 5]
+   :winner :blue,
+   :looser :red,
+   :taken [[8 5] [9 5]]}"
   [board [xi yi] [dx dy]]
-  (loop [x xi, y yi,
-         taken nil,
-         res []]
+  (loop [x (+ xi dx)
+         y (+ yi dy)
+         looser nil
+         taken []]
     (if-let [c (get-in board [x y])]
       (cond
         (is-cell-empty? c) nil ;; No move: reached end and only 1 type of cell
-        (and taken (not= taken c)) {:winner c     ;; Who wins the cells
-                                    :looser taken ;; Who looses the cells
-                                    :taken res}
+        (and looser (not= looser c)) {:winner c      ;; Who wins the cells
+                                      :looser looser ;; Who looses the cells
+                                      :move [xi yi]  ;; The move performed
+                                      :taken taken}  ;; The cells taken
         :else (recur
                 (+ x dx) (+ y dy)
-                (or taken c)
-                (conj res [x y])))
-      res)))
-
-(defn available-cells-by-dir
-  "Indicates the convertible cells for the provided player - when clicking at [x y]
-   Returns an object of the form
-		{:move [7 5]
-     :winner :blue,
-		 :looser :red,
-		 :taken [[8 5] [9 5]]}"
-  [board [x y :as pos] [dx dy :as dir]]
-  (when-let [m (range-cells board [(+ x dx) (+ y dy)] dir)]
-    (conj m [:move pos])
-    ))
+                (or looser c)
+                (conj taken [x y])))
+      nil)))

 (defn available-moves-at
   "Provides the list of moves that can be done from a cell"


Change "future" detection in relative timestamp after checking the moment.js code.

--- src/posthere/cljs/posthere.cljs
+++ src/posthere/cljs/posthere.cljs
@@ -60,8 +60,8 @@
     ;; Relative times in the future make no sense for our case.
     ;; It just mean clocks are out of sync between our server
     ;; and the user's browser. Change future relative times, marked
-    ;; by the presence of "from", to "just now".
-    (if (re-find #"from" relative-time)
+    ;; by the presence of "in ", to "just now".
+    (if (re-find #"in " relative-time)
       "just now"
       relative-time)))


CMR-4674: Updated test.

CMR-4674: Updated test.

--- system-int-test/test/cmr/system_int_test/ingest/bulk_update/bulk_update_test.clj
+++ system-int-test/test/cmr/system_int_test/ingest/bulk_update/bulk_update_test.clj
@@ -207,6 +207,9 @@
     (let [response (ingest/bulk-update-collections "PROV1" duplicate-body)
           _ (index/wait-until-indexed)
           {:keys [task-id]} response
+          ;; I am surprised to find out that the task-id returned in the response is a string
+          ;; Here I am just blindly patch this test to work with a string.
+          next-task-id (+ 1 (Integer/parseInt task-id))
           collection-response (ingest/bulk-update-task-status "PROV1" task-id)]
       (is (= "COMPLETE" (:task-status collection-response)))

@@ -215,9 +218,10 @@
       (let [response (ingest/bulk-update-collections "PROV1" bulk-update-body)]
         (is (= 400 (:status response)))
         (is (= ["Bulk update is disabled."] (:errors response))))
-      (let [collection-response (ingest/bulk-update-task-status "PROV1" 2)]
+      (let [collection-response (ingest/bulk-update-task-status "PROV1" next-task-id)]
         (is (= 404 (:status collection-response)))
-        (is (= ["Bulk update task with task id [2] could not be found for provider id [PROV1]."]
+        (is (= [(format "Bulk update task with task id [%s] could not be found for provider id [PROV1]."
+                        next-task-id)]
                (:errors collection-response))))
       (let [collection-response (ingest/bulk-update-task-status "PROV1" task-id)]
         (is (= 200 (:status collection-response))))


Alpha sorting of requires.

Alpha sorting of requires.

--- search-app/src/cmr/search/web/routes.clj
+++ search-app/src/cmr/search/web/routes.clj
@@ -4,22 +4,19 @@
   human consumption (site routes). It also provides routes that apply to both
   (e.g., robots.txt)."
   (:require
-   ;; Third-party libs
-   [clojure.java.io :as io]
-   [compojure.core :refer :all]
-   [compojure.route :as route]
-   [ring.middleware.keyword-params :as keyword-params]
-   [ring.middleware.nested-params :as nested-params]
-   [ring.middleware.params :as params]
-
-   ;; CMR libs
-   [cmr.acl.core :as acl]
-   [cmr.common.api.errors :as errors]
-   [cmr.common.api.context :as context]
-   [cmr.common-app.api.routes :as common-routes]
-   [cmr.search.api.request-context-user-augmenter :as context-augmenter]
-   [cmr.search.api.routes :as api-routes]
-   [cmr.search.site.routes :as site-routes]))
+    [clojure.java.io :as io]
+    [cmr.acl.core :as acl]
+    [cmr.common.api.errors :as errors]
+    [cmr.common.api.context :as context]
+    [cmr.common-app.api.routes :as common-routes]
+    [cmr.search.api.request-context-user-augmenter :as context-augmenter]
+    [cmr.search.api.routes :as api-routes]
+    [cmr.search.site.routes :as site-routes]
+    [compojure.core :refer :all]
+    [compojure.route :as route]
+    [ring.middleware.keyword-params :as keyword-params]
+    [ring.middleware.nested-params :as nested-params]
+    [ring.middleware.params :as params]))

 (defn copy-of-body-handler
   "Copies the body into a new attribute called :body-copy so that after a post


Resize window on font change

Resize window on font change

--- src/robinson/autoreloadcore.clj
+++ src/robinson/autoreloadcore.clj
@@ -126,5 +126,14 @@
                      (print-stack-trace ex)
                      state))))
               (zevents/add-event-listener terminal :close (fn [keyin] (log/info "received :close") (System/exit 0)))
+              (zevents/add-event-listener terminal :font-change (fn [{:keys [character-width
+                                                                             character-height]}]
+                                                                  (let [{:keys [columns rows]} (get (zt/groups terminal) :app)]
+                                                                  (log/info "received :font-change")
+                                                                  (log/info "terminal shape" columns rows)
+                                                                  (log/info "font dims" character-width character-height)
+                                                                  (zt/set-window-size! terminal
+                                                                                {:width (* columns character-width)
+                                                                                :height (* rows character-height)}))))
             (async/<!! done-chan)))))))


cljc annotation has been added for system.core

--- core/src/cljc/hellhound/system/core.cljc
+++ core/src/cljc/hellhound/system/core.cljc
@@ -9,11 +9,12 @@
    [hellhound.logger           :as log]
    [hellhound.component        :as hcomp])

-  (:import
-   (hellhound.component IComponent)
-   (clojure.lang IPersistentMap
-                 PersistentArrayMap
-                 PersistentVector)))
+
+  #?(:clj (:import
+           (hellhound.component IComponent)
+           (clojure.lang IPersistentMap
+                         PersistentArrayMap
+                         PersistentVector))))

 ;; Main storage for system data.
 (def system (atom {}))
@@ -58,6 +59,7 @@
   (if (s/valid? :hellhound.component/component component)
     [(hcomp/get-name component) (hcomp/initialize component)]
     ;; If component did not satisfies component spec
+    ;; TODO: fix the long line
     (throw (ex-info "Component does not satisfies ':hellhound.component/component' spec."
                     {:cause (hcomp/get-name component)
                      :explain (s/explain-data :hellhound.component/component component)}))))
@@ -66,12 +68,13 @@
 (s/fdef hellhound.system.core/conform-component
         :args (s/cat :component :hellhound.component/component)
         :ret  vector?
-        :fn #(= (first (:ret %)) (:hellhound.component/name (:component (:args %)))))
+        :fn #(= (first (:ret %))
+                (:hellhound.component/name (:component (:args %)))))

-(defn ^IPersistentMap components-map
+(defn #?(:clj ^IPersistentMap) components-map
   "Returns a map of components from the given `system`. Basically
   the return value of this function would be index of components."
-  [^IPersistentMap system-map]
+  [#?(:clj ^IPersistentMap) system-map]
   (into {} (map conform-component
                 (utils/get-components system-map))))

@@ -84,20 +87,21 @@

 (defn set-system!
   "Sets the system of HellHound."
-  [^IPersistentMap system-map]
+  [#?(:clj ^IPersistentMap) system-map]
   (reset! system (update-system-components system-map)))

 (defn get-dependencies-of
   "Returns a vector of dependencies for the given `component` ins the given
   `system`."
-  [system-map component]
+  [#?(:clj ^IPersistentMap) system-map component]
   (let [dependencies (hcomp/dependencies component)]
     (filter #(some #{(hcomp/get-name %)} dependencies)
             (vals (utils/get-components system-map)))))

-(defn ^IPersistentMap start-component!
+(defn #?(:clj ^IPersistentMap) start-component!
   "Starts the given `component` of the given `system`."
-  [^IPersistentMap system-map ^IComponent component]
+  [#?(:clj ^IPersistentMap) system-map
+   #?(:clj ^IComponent)     component]
   (let [dependencies (get-dependencies-of system-map component)
         new-system   (reduce start-component! system-map dependencies)]
     (update-in new-system
@@ -110,7 +114,8 @@

 (defn stop-component!
   "Stops the given `component` of the given `system`."
-  [^IPersistentMap system-map ^IComponent component]
+  [#?(:clj ^IPersistentMap) system-map
+   #?(:clj ^IComponent)     component]
   (reduce stop-component!
           (update-in system-map
                      [:components (hcomp/get-name component)]
@@ -128,7 +133,7 @@
   TODO: More explaination."
   {:public-api true
    :added      1.0}
-  [^IPersistentMap system-map]
+  [#?(:clj ^IPersistentMap) system-map]
   (if-not (s/valid? ::system-map system-map)
     (throw (ex-info "Provided system is not valid"
                     {:cause (s/explain-data ::system-map system-map)})))
@@ -145,7 +150,7 @@
   TODO: More explaination"
   {:public-api true
    :added      1.0}
-  [^IPersistentMap system-map]
+  [#?(:clj ^IPersistentMap) system-map]
   (reset! system
           (reduce stop-component!
                   system-map


1.1.6  Conditional Expressions and Predicates


Fix off-by-one error in number of tests reported

--- src/simple_check/core.clj
+++ src/simple_check/core.clj
@@ -121,7 +121,7 @@
   (ct/report-failure property result trial-number failing-params)
   {:result result
    :failing-size size
-   :num-tests trial-number
+   :num-tests (inc trial-number)
    :fail (vec failing-params)
    :shrunk (shrink-loop property-fun failing-params result)})


carry-debugger: bump carry cotnrib dependencies

--- contrib/debugger/project.clj
+++ contrib/debugger/project.clj
@@ -10,8 +10,8 @@
   :dependencies [[org.clojure/clojure "1.8.0" :scope "provided"]
                  [org.clojure/clojurescript "1.9.229" :scope "provided"]

-                 [carry-schema "0.4.0"]
-                 [carry-reagent "0.5.0"]
+                 [carry-schema "0.6.0"]
+                 [carry-reagent "0.7.0"]

                  [org.clojure/core.match "0.3.0-alpha4"]
                  [reagent "0.6.0"]


changing the search field placeholder to ctrl+f

--- src/saved_for_reddit/views.cljs
+++ src/saved_for_reddit/views.cljs
@@ -82,7 +82,7 @@
 (defn search-bar-html []
   [:form {:class "navbar-form navbar-left" :role "search"}
    [:div {:class "form-group"}
-    [:input {:id "txt-search-posts" :type "text" :class "form-control" :placeholder "Loading..." :disabled true}]]
+    [:input {:id "txt-search-posts" :type "text" :class "form-control" :placeholder "Ctrl + F" :disabled true}]]
    [:button {:id "btn-search-posts" :type "submit" :class "btn btn-primary" :disabled true}
     [:span {:class "glyphicon glyphicon-search" :aria-hidden "true"}]]
    [:button {:id "btn-refresh" :type "submit" :class "btn btn-primary"


remove queriac hacks, use new add syntax

--- src/semtag_web/client/main.cljs
+++ src/semtag_web/client/main.cljs
@@ -185,9 +185,7 @@
   (home)
   (.click ($ :#add_url_button))
   (if-let [input (util/param-value "input")]
-    ; TODO: remove hacks when not using cmd service that overrides ':' and ';'
-    (let [input (-> (clojure.string/replace input #"\.\." ":"))
-          input (-> (clojure.string/replace input #",," ";"))]
+    (do
       (.text ($ :#add_url_text) (.decodeURI js/window input))
       (.click ($ :#add_url_button)))
     (alert "No input given.")))


Display person's full name via title

Display person's full name via title

--- frontend/src/faceboard/views/boards/people.cljs
+++ frontend/src/faceboard/views/boards/people.cljs
@@ -60,7 +60,8 @@
           (dom/div {:class "left-part"}
             (dom/div {:class "photo"}
               (dom/img {:src (or (get-in bio [:photo :url] nil) "/images/unknown.jpg")}))
-            (dom/div {:class "name f16"}
+            (dom/div {:class "name f16"
+                      :title (:full-name bio)}
               (:name bio)
               (when-not (nil? flag-code)
                 (dom/div {:class (str "flag " flag-code)}))))


Fix corpse drops and boar gore attack

Fix corpse drops and boar gore attack

--- src/dungeon_crusade/combat.clj
+++ src/dungeon_crusade/combat.clj
@@ -59,6 +59,7 @@
       [:*       "Player" :bite  :*       :hit]  (format "The %s sinks its teeth into your flesh." attacker-name)
       [:*       "Player" :claw  :*       :hit]  (format "The %s claws into your flesh." attacker-name)
       [:*       "Player" :punch :*       :hit]  (format "The %s punches you.`" attacker-name)
+      [:*       "Player" :gore  :*       :hit]  (format "The %s gores into your body with it's tusks.`" attacker-name)
       [:*       "Player" :sting :*       :hit]  (format "The %s stings you, pumping you full of poison." attacker-name))))

 (defn attack
@@ -93,7 +94,7 @@
             ;; remove defender
             (remove-in (butlast defender-path) (partial = defender))
             ;; maybe add corpse
-            (update-in [:world :places current-place-id y x :items]
+            (update-in [:world :places (current-place-id state) y x :items]
                        (fn [items]
                          (if (zero? (rand-int 3))
                            (conj items {:type :food :name (format "%s corpse" (name (get defender :race))) :hunger 10})


ricerca anagrafe enti piu' raffinata

ricerca anagrafe enti piu' raffinata

--- src/fxc_soldipubblici/core.clj
+++ src/fxc_soldipubblici/core.clj
@@ -14,7 +14,7 @@
   (:import (org.apache.commons.compress.compressors.xz XZCompressorInputStream))
   )

-(defn apri-xz
+(defn apri-csv-xz
   "apri un file singolo compresso con xz, restituisce io/reader"
   [filename]
   (with-open [in-file (-> filename
@@ -22,9 +22,8 @@
                           io/input-stream
                           (XZCompressorInputStream. true)
                           io/reader)]
-    (doall
-     (csv/read-csv in-file)))
-)
+    (doall (csv/read-csv in-file)))
+  )

 (defn analizza-dati [dati]
   (let [colonne [:2016 :2015 :2014 :siope :desc]
@@ -84,26 +83,32 @@
     df
   ))

-(defn cerca-enti [needle]
-  (let [anag (apri-xz "assets/ANAG_ENTI_SIOPE.D160624.H0102.csv.xz")]
+(defn cerca-enti

-    ;; cod_ente siope
-    ;; data_inc_siope date,
-    ;; data_esc_siope date,
-    ;; cod_fiscale character(16),
-    ;; descr_ente character varying,
-    ;; cod_comune character(3),
-    ;; cod_provincia character(3),
-    ;; num_abitanti character varying,
-    ;; sottocomparto_siope character varying,
+  ;; 1 cod_ente siope
+  ;; 2 data_inc_siope date,
+  ;; 3 data_esc_siope date,
+  ;; 4 cod_fiscale character(16),
+  ;; 5 descr_ente character varying,
+  ;; 6 cod_comune character(3),
+  ;; 7 cod_provincia character(3),
+  ;; 8 num_abitanti character varying,
+  ;; 9 sottocomparto_siope character varying,

-    (->> anag
+  ([needle]
+   (->> (apri-csv-xz "assets/ANAG_ENTI_SIOPE.D160624.H0102.csv.xz")
+        ;; fast grep on all lines as strings to exclude bulk non matching
         (keep #(if (string/includes? (str %) (string/upper-case needle)) %))
-        (into [["codice" "creazione" "scadenza" "cod.fiscale" "nome" "cod.comune" "cod.provincia" "popolazione" "comparto"]])
-        mappify
-        doall)
-  ))
+        (into [["codice" "creazione" "scadenza" "fiscale" "nome" "comune" "provincia" "popolazione" "comparto"]])
+        mappify ;; this takes time
+        ))

+  ([needle pos]
+   (->> (cerca-enti needle)
+        (keep #(if (= (pos %) needle) %))
+        ))
+
+)

 (defn raccogli-tutto
   "Raccoglie tutti i dati disponibili su qualsiasi ente la cui descrizione contiene la stringa"


todo notes

todo notes

--- src/dalap/html/selector.clj
+++ src/dalap/html/selector.clj
@@ -65,6 +65,7 @@
            true
            (html/has-class? dom-node class)))))

+;;; TODO make this a protocol function
 (defn- compile-selector
   "Creates a node matching predicate from a single selector."
   [single-selector]
@@ -81,6 +82,7 @@
     (fn type-matcher [node]
       (= (type node) single-selector))))

+;;; TODO make this a protocol function
 (defn- compile-selector* [selector]
   (cond
     (vector? selector)
@@ -111,6 +113,7 @@
                    predicates+visitors)))
         node)))

+;;; TODO make this a protocol function
 (defn normalize-visitor [visitor]
   (cond
     (vector? visitor)


refactoring

refactoring

--- src/desdemona/ui/table.cljs
+++ src/desdemona/ui/table.cljs
@@ -10,20 +10,19 @@
    (conj coll k)))

 (defn columns-toggler-component
-  []
-  (let [ks (:all-table-ks @session/state)]
-    (into [:ul.nav.nav-pills.nav-stacked]
-     (for [k ks]
-      [:li
-       [:a {:href "#"
-            :on-click #(session/update! :table-toggled-ks toggle-key k)}
-        (wd/describe-key k)]]))))
+  [ks session-entry]
+  (into [:ul.nav.nav-pills.nav-stacked]
+   (for [k ks]
+    [:li
+     [:a {:href "#"
+          :on-click #(session/update! session-entry toggle-key k)}
+      (wd/describe-key k)]])))

 (defn table-component
   []
   (let [state-deref @session/state]
     [:div {:class "container-fluid"}
-     [columns-toggler-component]
+     [columns-toggler-component (:all-table-ks state-deref) :table-toggled-ks]
      [:div {:class "table-responsive table-sorted"}
       [wd/sorted-table
        (:table-toggled-ks state-deref)


Feed with statement-map

Feed with statement-map

--- src/discuss/references.cljs
+++ src/discuss/references.cljs
@@ -93,15 +93,16 @@
   []
   (reify om/IRender
     (render [_]
-      (dom/div nil
-               (dom/div #js {:className "text-center"}
-                        "Do you agree or disagree with this statement?")
-               (om/build usage-view {})
-               (dom/div #js {:className "text-center"}
-                        (bs/button-primary #(println "foo")
-                                           (vlib/fa-icon "fa-thumbs-up")
-                                           " Agree")
-                        " "
-                        (bs/button-primary nil
-                                           (vlib/fa-icon "fa-thumbs-down")
-                                           " Disagree"))))))
+      (let [statement (lib/selected-statement)]
+        (dom/div nil
+                 (dom/div #js {:className "text-center"}
+                          "Do you agree or disagree with this statement?")
+                 (om/build usage-view statement)
+                 (dom/div #js {:className "text-center"}
+                          (bs/button-primary #(println "foo")
+                                             (vlib/fa-icon "fa-thumbs-up")
+                                             " Agree")
+                          " "
+                          (bs/button-primary nil
+                                             (vlib/fa-icon "fa-thumbs-down")
+                                             " Disagree")))))))


Include comment.

Include comment.

--- src/zaffre/glterminal.clj
+++ src/zaffre/glterminal.clj
@@ -359,6 +359,8 @@
                ; Process messages in the main thread rather than the input go-loop due to Windows only allowing
                ; input on the thread that created the window
                (Display/processMessages)
+               ;; Close the display if the close window button has been clicked
+               ;; or the gl-lock has been released programmatically (e.g. by destroy!)
                (or (Display/isCloseRequested) (not @gl-lock)))
            (do
              (log/info "Destroying display")


prelim switch to using type tag, e.g. :bower

--- tasklib/src/boot_bowdlerize.clj
+++ tasklib/src/boot_bowdlerize.clj
@@ -39,6 +39,7 @@
         ;;            '[clojure.java.io :as io]
         ;;            '[clojure.string :as str]
         ;;            '[cheshire.core :as json])
+        _ (println "bower-meta: " pkg)
         info (sh shcmd "info" "-j" pkg)
         j (json/parse-string (:out info) true)
         ]
@@ -66,86 +67,133 @@

 (defn- normalize-configs
   [base configs]
-  ;; (println "normalize-configs: " configs)
-  (let [resources (filter #(symbol? (first %)) configs)
-        ;; _ (println "RESOURCES: " resources)
+  (println "normalize-configs: " configs)
+  (let [bowers (filter #(:bower %) configs)
+        _ (println "BOWERS: " bowers)
+        normbowers (flatten (into [] (for [bower bowers]
+                              (if (map? (:runtime bower))
+                                (into [] (for [[sym uri] (:runtime bower)]
+                                           (do ;; (println "FOO: "bower)
+                                             (merge bower
+                                                    {:runtime sym
+                                                     :uri uri
+                                                     :ns (namespace sym)
+                                                     :name (name sym)}))))
+                                (do ;; (println "BAR: " bower)
+
+                                (let [m (bower-meta (:bower bower))
+                                      kw (keyword (-> m :latest :name))
+                                      _ (println "kw: " kw)
+                                      poly (str/starts-with? (:bower bower) "Polymer")
+                                      _ (println "poly: " poly)
+                                      uris (bower->uris base m)]
+                                  (merge bower (if (> (count uris) 1)
+                                                 (throw (Exception.
+                                                         (str "too many uris for bower pkg '"
+                                                              (:bower bower)
+                                                              "'; run bower info -j on the package and create a config for each latest.main entry"))))
+                                         {:ns (namespace (:runtime bower))
+                                          :name (name (:runtime bower))}
+                                         ;; (if (str/ends-with? (first uris) ".js")
+                                         ;;   {:js true})
+                                         ;; (if (str/ends-with? (first uris) ".css")
+                                         ;;   {:css true})
+                                         (if poly {:polymer {:kw kw}})
+                                         {:uri (first uris)})))))))
+
+                                    ;; #_(merge bower
+                                    ;;        {:ns (namespace (:runtime bower))
+                                    ;;         :name (name (:runtime bower))})
+        _ (println "NORMBOWERS: " normbowers)
+
+        resources (filter #(not (:bower %)) configs)
+        _ (println "RESOURCES: " resources)
+
         normresources (into [] (for [resource resources]
-                                 (do ;; (println "RESOURCE: " resource)
-                                 (merge (last resource)
-                                        (if (str/ends-with? (:uri (last resource)) ".js")
-                                          {:js true})
-                                        (if (str/ends-with? (:uri (last resource)) ".css")
-                                          {:css true})
-                                        {:ns (namespace (first resource))
-                                         :name (name (first resource))}))))
-        ;; _ (println "NORMRESOURCES: " normresources)
+                                 (do (println "RESOURCE: " resource)
+                                     (merge resource
+                                            ;; (if (str/ends-with? (:uri resource) ".js")
+                                            ;;   {:js true})
+                                            ;; (if (str/ends-with? (:uri resource) ".css")
+                                            ;;   {:css true})
+                                            {:ns (namespace (:runtime resource))
+                                             :name (name (:runtime resource))}))))
+        _ (println "NORMRESOURCES: " normresources)
+
         simples (filter #(and (not (symbol? (first %)))
                               (or (symbol? (last %)) (map? (last %)))) configs)
         normsimples (for [[k v] simples]
-               (merge {:bower-pkg k}
+               (merge {:bower k}
                       (condp apply [v] symbol? {:ns (symbol (namespace v)) :name (symbol (name v))}
                              map?    v)))
-        ;; _ (println "NORMSIMPLES: " normsimples)
-        compounds (filter #(vector? (last %)) configs)
-        ;; _ (println "COMPOUNDS: " compounds)
+        _ (println "NORMSIMPLES: " normsimples)
+
+        compounds (filter #(vector? (:runtime %)) configs)
+        _ (println "COMPOUNDS: " compounds)
         normcomp (flatten (into [] (for [[pkg cfgs] compounds]
                                      (into [] (for [cfg cfgs]
                                                 (do ;;(println "CFG: " cfg)
                                                 (merge
-                                                 (if (str/ends-with? (:uri cfg) ".js")
-                                                   {:js true})
-                                                 (if (str/ends-with? (:uri cfg) ".css")
-                                                   {:css true})
-                                                 {:bower-pkg pkg} cfg)))))))
-        normed (concat normcomp normsimples normresources)
+                                                 ;; (if (str/ends-with? (:uri cfg) ".js")
+                                                 ;;   {:js true})
+                                                 ;; (if (str/ends-with? (:uri cfg) ".css")
+                                                 ;;   {:css true})
+                                                 {:bower pkg} cfg)))))))
+        _ (println "NORMCOMPOUNDS: " normcomp)
+
+        normed (concat normcomp normsimples normresources normbowers)
+        _ (println "NORMED: " normed)
         ]
     normed))

 (defn- get-config-maps
   "convert config map to data map suitable for stencil"
   [bower-base configs]
-  ;; (println "get-config-maps")
-  (let [nss (set (flatten (for [[k v] configs]
-                            (if (string? k)
-                              (cond
-                                (symbol? v) (let [ns (namespace v)]
-                                              (if ns (symbol ns)
-                                                  (throw (Exception. "var must be namespaced"))))
-                                (map? v) (:ns v)
-                                (vector? v)
-                                (into [] (for [item v] (:ns item)))
-                                ;;FIXME: better error msg
-                                :else (throw (Exception. "config val must be map or vector of maps")))
-                              (if (symbol? k)
-                                (namespace k)
-                                (throw (Exception. "config entries must be {sym {:uri str}} or {str config}")
-                              ))))))
+  (println "get-config-maps: " configs)
+  (let [
+        ;; nss (set (flatten (for [[k v] configs]
+        ;;                     (if (string? k)
+        ;;                       (cond
+        ;;                         (symbol? v) (let [ns (namespace v)]
+        ;;                                       (if ns (symbol ns)
+        ;;                                           (throw (Exception. "var must be namespaced"))))
+        ;;                         (map? v) (:ns v)
+        ;;                         (vector? v)
+        ;;                         (into [] (for [item v] (:ns item)))
+        ;;                         ;;FIXME: better error msg
+        ;;                         :else (throw (Exception. "config val must be map or vector of maps")))
+        ;;                       (if (symbol? k)
+        ;;                         (namespace k)
+        ;;                         (throw (Exception. "config entries must be {sym {:uri str}} or {str config}")
+        ;;                       ))))))
         ;; _ (println "nss: " nss)
         normal-configs (normalize-configs bower-base configs)
-        ;; _ (println "NORMAL-CONFIGS:")
-        ;; _ (pp/pprint normal-configs)
+        _ (println "NORMAL-CONFIGS:")
+        _ (pp/pprint normal-configs)
         ;;now add missing uris
         config-map (into [] (for [ns-config normal-configs]
+                              (do (println "ns-config: " ns-config)
                               (if (-> ns-config :uri)
                                 ns-config
-                                (let [m (bower-meta (:bower-pkg ns-config))
+                                (let [m (bower-meta (:bower ns-config))
                                       kw (keyword (-> m :latest :name))
-                                      ;; _ (println "kw: " kw)
-                                      poly (str/starts-with? (:bower-pkg ns-config) "Polymer")
-                                      ;;_ (println "poly: " poly)
+                                      _ (println "kw: " kw)
+                                      poly (str/starts-with? (:bower ns-config) "Polymer")
+                                      _ (println "poly: " poly)
                                       uris (bower->uris bower-base m)]
                                   (merge ns-config (if (> (count uris) 1)
                                                      (throw (Exception.
                                                              (str "too many uris for bower pkg '"
-                                                             (:bower-pkg ns-config)
+                                                             (:bower ns-config)
                                                              "'; run bower info -j on the package and create a config for each latest.main entry")))
                                                      (merge
-                                                      (if (str/ends-with? (first uris) ".js")
-                                                        {:js true})
-                                                      (if (str/ends-with? (first uris) ".css")
-                                                        {:css true})
+                                                      ;; (if (str/ends-with? (first uris) ".js")
+                                                      ;;   {:js true})
+                                                      ;; (if (str/ends-with? (first uris) ".css")
+                                                      ;;   {:css true})
                                                       (if poly {:polymer {:kw kw}})
-                                                      {:uri (first uris)})))))))]
+                                                      {:uri (first uris)}))))))))]
+    (println "xxxx config-map: " config-map)
     config-map))

 (defn- ns->filestr
@@ -154,22 +202,24 @@

 (defn prep-for-stencil
   [& configs]
-  ;; (println "prep-for-stencil: " configs)
+  (println "prep-for-stencil: " configs)
   (let [nss (set (map #(-> % :ns) configs))
-        ;; _ (println "nss: " nss)
+        _ (println "nss: " nss)
         res (into [] (for [ns- nss]
+                       (do (println "ns- " ns-)
                        (let [ns-cfgs (filter #(= ns- (-> % :ns)) configs)]
                          ;; (println "XXXXXXXXXXXXXXXX config-ns: " ns-)
                          {:config-ns ns-
                           :config
                           (into [] (for [ns-cfg ns-cfgs]
-                                     ns-cfg))})))]
+                                     ns-cfg))}))))]
     ;; (println "FOR STENCIL:")
     ;; (pp/pprint res)
     res))

 (defn- merge-config-maps
   [ms]
+  (println "merge-config-maps: " ms)
   (let [ks (set (map #(symbol (:config-ns %)) ms))
         merged-maps (into []
                           (for [k (seq ks)]
@@ -181,12 +231,24 @@
     ;; (pp/pprint merged-maps)
     merged-maps))

+(defn- typify
+  [config-maps]
+  (for [cfg config-maps]
+    (do (println "TYPIFY: " cfg)
+        (merge cfg
+               {:config (for [config (:config cfg)]
+                          (merge config
+                                 (if (str/ends-with? (:uri config) ".js")
+                                   {:js true})
+                                 (if (str/ends-with? (:uri config) ".css")
+                                   {:css true})))}))))
+
 (boot/deftask config
-  [c nss NSS #{sym} "config namespaced sym"
+  [c config-syms CONFIG-SYMS #{sym} "config namespaced sym"
    b base PATH str "bower components base path, default: bower_components"
    o outdir PATH str "install dir, default: classes"]
-  (let [nss   (if nss nss #_(if (namespace nss)
-                              nss (throw (Exception. (str "config symbol must be namespaced"))))
+  (let [config-syms   (if config-syms config-syms #_(if (namespace config-syms)
+                              config-syms (throw (Exception. (str "config symbol must be namespaced"))))
                   #{'bower/config})
         base (if base base "bower_components")
         outdir   (if (nil? outdir) "classes" outdir)
@@ -198,9 +260,9 @@
       (let [config-maps
             (into []
                   (flatten
-                   (for [config-sym nss]
+                   (for [config-sym config-syms]
                         (let [config-ns (symbol (namespace config-sym))]
-                          ;; (println "CONFIG-NS: " config-ns)
+                          (println "CONFIG-NS: " config-ns)
                           (require config-ns)
                           ;; (doseq [[ivar isym] (ns-interns config-ns)] (println "interned: " ivar isym))
                           (if (not (find-ns config-ns)) (throw (Exception. (str "can't find config ns"))))
@@ -216,10 +278,12 @@
                                 ;;                    config-ns (count config-specs)))
                                 ]
                             config-specs)))))
-            config-nss (merge-config-maps config-maps)]
-        ;; (println "CONFIG-MAPS: " (count config-nss))
-        ;; (pp/pprint config-nss)
-        (doseq [config-map config-nss]
+            ;; _ (println "CONFIG-MAPS: " config-maps)
+            config-maps (merge-config-maps config-maps)
+            config-maps (typify config-maps)]
+        ;; (println "CONFIG-MAPS: " (count config-maps))
+        ;; (pp/pprint config-maps)
+        (doseq [config-map config-maps]
             (let [config-file-name (str outdir "/" (ns->filestr (-> config-map :config-ns)) ".clj")
                   ;; _ (println "writing: " config-file-name)
                   config-file (stencil/render-file "boot_bowdlerize/bower.mustache"


CMR-4247 - Added cascade support for in-memoery db.

--- metadata-db-app/src/cmr/metadata_db/data/memory_db.clj
+++ metadata-db-app/src/cmr/metadata_db/data/memory_db.clj
@@ -10,6 +10,7 @@
    [cmr.metadata-db.data.concepts :as concepts]
    [cmr.metadata-db.data.ingest-events :as ingest-events]
    [cmr.metadata-db.data.oracle.concepts.tag :as tag]
+   [cmr.metadata-db.data.oracle.concepts.variable :as variable]
    [cmr.metadata-db.data.oracle.concepts]
    [cmr.metadata-db.data.providers :as providers]
    [cmr.metadata-db.services.provider-validation :as pv]))
@@ -32,6 +33,22 @@
                                            (update :revision-id inc)))
                               tag-associations)]
           ;; publish tag-association delete events
+          (doseq [tombstone tombstones]
+            (ingest-events/publish-event
+              (:context db)
+              (ingest-events/concept-delete-event tombstone)))
+          (concat concepts tombstones))
+
+        ;; CMR-2520 Remove this case when asynchronous cascaded deletes are implemented.
+        (and (= :variable (:concept-type concept))
+             (:deleted concept))
+        (let [variable-associations (variable/get-associations-for-variable-tombstone
+                                     db concept)
+              tombstones (map (fn [ta] (-> ta
+                                           (assoc :metadata "" :deleted true)
+                                           (update :revision-id inc)))
+                              variable-associations)]
+          ;; publish variable-association delete events
           (doseq [tombstone tombstones]
             (ingest-events/publish-event
               (:context db)


Introducing various optimizations

Introducing various optimizations

--- jvm-runner/project.clj
+++ jvm-runner/project.clj
@@ -11,6 +11,7 @@
   :source-paths      ["src/clojure"]
   :java-source-paths ["src/java"]
   :env {:timeout "2000"}
-  :profiles {:uberjar {:aot :all}
-             :env {:timeout "2000"}}
+  :profiles {:uberjar {:aot :all
+                       :omit-source true
+                       :javac-options ["-g:none"]}}
   :main codewars.core)


constrain patterns that were incorrectly matching reflexives

--- src/babel/francais/morphology/verbs.cljc
+++ src/babel/francais/morphology/verbs.cljc
@@ -8,7 +8,8 @@
    #?(:cljs [babel.logjs :as log])
    [dag_unify.core :refer (copy dissoc-paths fail? get-in ref? strip-refs unify)]))

-;; TODO: convert to (babel.morphology/conjugation) (see babel.latin.morphology for an example of how to use conjugation)
+;; TODO: convert to (babel.morphology/conjugation)
+;; (see babel.latin.morphology for an example of how to use babel.morphology/conjugation)
 (def present-nonreflexive-er-verb
   (map
    #(merge %
@@ -384,7 +385,7 @@
                                 :cat :verb}}
                       (:u %))})
   [{:p [#"^(\S+)ais$"       "$1"]
-    :g [#"^(\S+)$"          "$1ais"]
+    :g [#"^([^' ]+)$"        "$1ais"]
     :u {:synsem {:agr {:number :sing
                        :person :1st}}}}
    {:p [#"^(\S+)ais$"       "s'$1"]
@@ -396,7 +397,7 @@
     :u {:synsem {:agr {:number :sing
                        :person :1st}}}}
    {:p [#"^(\S+)ais$"       "$1"]
-    :g [#"^(\S+)$"          "$1ais"]
+    :g [#"^([^' ]+)$"       "$1ais"]
     :u {:synsem {:agr {:number :sing
                        :person :2nd}}}}
    {:p [#"^(\S+)ais$"       "s'$1"]
@@ -410,7 +411,7 @@
     :u {:synsem {:agr {:number :sing
                        :person :2nd}}}}
    {:p [#"^(\S+)rais$"      "$1re"]
-    :g [#"^(\S+)$"          "$1ais"]
+    :g [#"^([^' ]+)$"       "$1ais"]
     :u {:synsem {:agr {:number :sing
                        :person :1st}}}}
    {:p [#"^(\S+)rais$"      "s'$1re"]
@@ -422,7 +423,7 @@
     :u {:synsem {:agr {:number :sing
                        :person :1st}}}}
    {:p [#"^(\S+)rais$"      "$1"]
-    :g [#"^(\S+)re$"        "$1ais"]
+    :g [#"^([^' ]+)re$"     "$1ais"]
     :u {:synsem {:agr {:number :sing
                        :person :2nd}}}}
    {:p [#"^(\S+)rais$"      "s'$1"]
@@ -434,7 +435,7 @@
     :u {:synsem {:agr {:number :sing
                        :person :2nd}}}}
    {:p [#"^(\S+)ait$"       "$1"]
-    :g [#"^(\S+)$"          "$1ait"]
+    :g [#"^([^' ]+)$"       "$1ait"]
     :u {:synsem {:agr {:number :sing
                        :person :3rd}}}}
    {:p [#"^(\S+)ait$"       "s'$1"]
@@ -446,7 +447,7 @@
     :u {:synsem {:agr {:number :sing
                        :person :3rd}}}}
    {:p [#"^(\S+)rait$"      "$1re"]
-    :g [#"^(\S+)re$"        "$1rait"]
+    :g [#"^([^' ]+)re$"     "$1rait"]
     :u {:synsem {:agr {:number :sing
                        :person :3rd}}}}
    {:p [#"^(\S+)rait$"      "s'$1re"]
@@ -458,7 +459,7 @@
     :u {:synsem {:agr {:number :sing
                        :person :3rd}}}}
    {:p [#"^(\S+)ions$"      "$1"]
-    :g [#"^(\S+)$"          "$1ions"]
+    :g [#"^([^' ]+)$"       "$1ions"]
     :u {:synsem {:agr {:number :plur
                        :person :1st}}}}
    {:p [#"^(\S+)ions$"      "s'$1"]
@@ -470,7 +471,7 @@
     :u {:synsem {:agr {:number :plur
                        :person :1st}}}}
    {:p [#"^(\S+)rions$"     "$1re"]
-    :g [#"^(\S+)re$"        "$1rions"]
+    :g [#"^([^' ]+)re$"     "$1rions"]
     :u {:synsem {:agr {:number :plur
                        :person :1st}}}}
    {:p [#"^(\S+)rions$"     "s'$1re"]
@@ -482,7 +483,7 @@
     :u {:synsem {:agr {:number :plur
                        :person :1st}}}}
    {:p [#"^(\S+)iez$"       "$1"]
-    :g [#"^(\S+)$"          "$1iez"]
+    :g [#"^([^' ]+)$"        "$1iez"]
     :u {:synsem {:agr {:number :plur
                        :person :2nd}}}}
    {:p [#"^(\S+)iez$"       "s'$1"]
@@ -494,7 +495,7 @@
     :u {:synsem {:agr {:number :plur
                        :person :2nd}}}}
    {:p [#"^(\S+)riez$"      "$1re"]
-    :g [#"^(\S+)re$"        "$1riez"]
+    :g [#"^([^' ]+)re$"        "$1riez"]
     :u {:synsem {:agr {:number :plur
                        :person :2nd}}}}
    {:p [#"^(\S+)riez$"      "s'$1re"]
@@ -506,7 +507,7 @@
     :u {:synsem {:agr {:number :plur
                        :person :2nd}}}}
    {:p [#"^(\S+)aient$"     "$1"]
-    :g [#"^(\S+)$"          "$1aient"]
+    :g [#"^([^' ]+)$"       "$1aient"]
     :u {:synsem {:agr {:number :plur
                        :person :3rd}}}}
    {:p [#"^(\S+)aient$"     "s'$1"]
@@ -518,7 +519,7 @@
     :u {:synsem {:agr {:number :plur
                        :person :3rd}}}}
    {:p [#"^(\S+)raient$"    "$1re"]
-    :g [#"^(\S+)$"          "$1aient"]
+    :g [#"^([^' ]+)$"       "$1aient"]
     :u {:synsem {:agr {:number :plur
                        :person :3rd}}}}
    {:p [#"^(\S+)raient$"    "s'$1re"]
@@ -540,7 +541,7 @@
                                 :infl :future}})})
    [
     {:p [#"^(\S+)ai$"     "$1"]
-     :g [#"^(\S+)$"       "$1ai"]
+     :g [#"^([^' ]+)$"    "$1ai"]
      :u {:synsem {:agr {:number :sing
                         :person :1st}}}}
     {:p [#"^(\S+)ai$"     "s'$1"]
@@ -552,7 +553,7 @@
      :u {:synsem {:agr {:number :sing
                         :person :1st}}}}
     {:p [#"^(\S+)as$"     "$1"]
-     :g [#"^(\S+)$"       "$1as"]
+     :g [#"^([^' ]+)$"    "$1as"]
      :u {:synsem {:agr {:number :sing
                         :person :2nd}}}}
     {:p [#"^(\S+)as$"     "s'$1"]
@@ -564,7 +565,7 @@
      :u {:synsem {:agr {:number :sing
                         :person :2nd}}}}
     {:p [#"^(\S+)rai$"    "$1re"]
-     :g [#"^(\S+)$"       "$1ai"]
+     :g [#"^([^' ]+)$"    "$1ai"]
      :u {:synsem {:agr {:number :sing
                         :person :1st}}}}
     {:p [#"^(\S+)rai$"    "s'$1re"]
@@ -576,7 +577,7 @@
      :u {:synsem {:agr {:number :sing
                         :person :1st}}}}
     {:p [#"^(\S+)ras$"    "$1re"]
-     :g [#"^(\S+)re$"     "$1as"]
+     :g [#"^([^' ]+)re$"  "$1as"]
      :u {:synsem {:agr {:number :sing
                         :person :2nd}}}}
     {:p [#"^(\S+)ras$"    "s'$1re"]
@@ -588,7 +589,7 @@
      :u {:synsem {:agr {:number :sing
                         :person :2nd}}}}
     {:p [#"^(\S+)a$"      "$1"]
-     :g [#"^(\S+)$"       "$1a"]
+     :g [#"^([^' ]+)$"       "$1a"]
      :u {:synsem {:agr {:number :sing
                         :person :3rd}}}}
     {:p [#"^(\S+)a$"      "s'$1"]
@@ -600,7 +601,7 @@
      :u {:synsem {:agr {:number :sing
                         :person :3rd}}}}
     {:p [#"^(\S+)ra$"     "$1re"]
-     :g [#"^(\S+)re$"     "$1ra"]
+     :g [#"^([^' ]+)re$"  "$1ra"]
      :u {:synsem {:agr {:number :sing
                         :person :3rd}}}}
     {:p [#"^(\S+)ra$"     "s'$1re"]
@@ -612,7 +613,7 @@
      :u {:synsem {:agr {:number :sing
                         :person :3rd}}}}
     {:p [#"^(\S+)ons$"    "$1"]
-     :g [#"^(\S+)$"       "$1ons"]
+     :g [#"^([^' ]+)$"    "$1ons"]
      :u {:synsem {:agr {:number :plur
                         :person :1st}}}}
     {:p [#"^(\S+)ons$"    "s'$1"]
@@ -624,7 +625,7 @@
      :u {:synsem {:agr {:number :plur
                         :person :1st}}}}
     {:p [#"^(\S+)rons$"   "$1re"]
-     :g [#"^(\S+)re$"     "$1rons"]
+     :g [#"^([^' ]+)re$"  "$1rons"]
      :u {:synsem {:agr {:number :plur
                         :person :1st}}}}
     {:p [#"^(\S+)rons$"   "s'$1re"]
@@ -636,7 +637,7 @@
      :u {:synsem {:agr {:number :plur
                         :person :1st}}}}
     {:p [#"^(\S+)ez$"     "$1"]
-     :g [#"^(\S+)$"       "$1ez"]
+     :g [#"^([^' ]+)$"    "$1ez"]
      :u {:synsem {:agr {:number :plur
                         :person :2nd}}}}
     {:p [#"^(\S+)ez$"     "s'$1"]
@@ -648,7 +649,7 @@
      :u {:synsem {:agr {:number :plur
                         :person :2nd}}}}
     {:p [#"^(\S+)rez$"    "$1re"]
-     :g [#"^(\S+)re$"     "$1rez"]
+     :g [#"^([^' ]+)re$"  "$1rez"]
      :u {:synsem {:agr {:number :plur
                         :person :2nd}}}}
     {:p [#"^(\S+)rez$"    "s'$1re"]
@@ -660,7 +661,7 @@
      :u {:synsem {:agr {:number :plur
                         :person :2nd}}}}
     {:p [#"^(\S+)ont$"    "$1"]
-     :g [#"^(\S+)$"       "$1ont"]
+     :g [#"^([^' ]+)$"    "$1ont"]
      :u {:synsem {:agr {:number :plur
                         :person :3rd}}}}
     {:p [#"^(\S+)ont$"    "s'$1"]
@@ -672,7 +673,7 @@
      :u {:synsem {:agr {:number :plur
                         :person :3rd}}}}
     {:p [#"^(\S+)ront$"   "$1re"]
-     :g [#"^(\S+)re$"     "$1ront"]
+     :g [#"^([^' ]+)re$"  "$1ront"]
      :u {:synsem {:agr {:number :plur
                         :person :3rd}}}}
     {:p [#"^(\S+)ront$"   "s'$1re"]
@@ -875,7 +876,7 @@
                   :agr {:number :plur
                         :person :3rd}}})}

-   ;; 5. imperfect tense
+   ;; 5. imperfect irregular with :imperfect-stem
    {:path [:français :imperfect-stem]
     :merge-fn
     (fn [val]


Some more clean up

Some more clean up

--- src/clj/org/openforis/ceo/db/imagery.clj
+++ src/clj/org/openforis/ceo/db/imagery.clj
@@ -1,18 +1,18 @@
 (ns org.openforis.ceo.db.imagery
   (:require [clojure.data.json :as json]
             [org.openforis.ceo.database :refer [call-sql sql-primitive]]
-            [org.openforis.ceo.db.institutions :refer [is-inst-admin-query]] ; FIXME this function has not yet been converted in institutions
+            [org.openforis.ceo.db.institutions :refer [is-inst-admin-query]]
             [org.openforis.ceo.utils.type-conversion :as tc]
             [org.openforis.ceo.views :refer [data-response]]))

-(defn- clean-source [sourceConfig]
-  (if (#{"GeoServer" "SecureWatch" "Planet"})
-    (dissoc sourceConfig [:geoserverParams :accessToken])
-    sourceConfig))
+(defn- clean-source [source-config]
+  (if (#{"GeoServer" "SecureWatch" "Planet"} (:type source-config))
+    (dissoc source-config [:geoserverParams :accessToken])
+    source-config))

 (defn- map-imagery [imagery admin?]
   (mapv (fn [{:keys [imagery_id institution_id visibility title attribution extent source_config]}]
-          {:id           imagery_id ; FIXME, legacy variable name, update to imageryId
+          {:id           imagery_id
            :institution  institution_id ; FIXME, legacy variable name, update to institutionId
            :visibility   visibility
            :title        title


Refactored age-combining-function as prep for :proportionate option.

--- src/clojush/pushgp/genetic_operators.clj
+++ src/clojush/pushgp/genetic_operators.clj
@@ -19,12 +19,19 @@

 (defn age-combining-function
   "Returns the actual age combining function specified by the :age-combining-function
-  in the argmap."
+  in the argmap. The function will take three arguments: the two parents, and the
+  genome of the child."
   [argmap]
   (case (:age-combining-function argmap)
-    :max max
-    :min min
-    :average average))
+    :max (fn [p1 p2 g]
+           (max (inc (:age p1))
+                (inc (:age p2))))
+    :min (fn [p1 p2 g]
+           (min (inc (:age p1))
+                (inc (:age p2))))
+    :average (fn [p1 p2 g]
+               (average (inc (:age p1))
+                        (inc (:age p2))))))

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; reproduction
@@ -514,9 +521,7 @@
                                      after-combination)))]
     (make-individual :genome new-genome
                      :history (:history parent1)
-                     :age ((age-combining-function argmap)
-                           (inc (:age parent1))
-                           (inc (:age parent2)))
+                     :age ((age-combining-function argmap) parent1 parent2 new-genome)
                      :ancestors (if maintain-ancestors
                                   (cons (:genome parent1) (:ancestors parent1))
                                   (:ancestors parent1)))))
@@ -553,9 +558,7 @@
                                 (dec iteration-budget)))))]
     (make-individual :genome new-genome
                      :history (:history parent1)
-                     :age ((age-combining-function argmap)
-                           (inc (:age parent1))
-                           (inc (:age parent2)))
+                     :age ((age-combining-function argmap) parent1 parent2 new-genome)
                      :ancestors (if maintain-ancestors
                                   (cons (:genome parent1) (:ancestors parent1))
                                   (:ancestors parent1)))))
@@ -579,9 +582,7 @@
                                       genome1)))]
     (make-individual :genome new-genome
                      :history (:history parent1)
-                     :age ((age-combining-function argmap)
-                           (inc (:age parent1))
-                           (inc (:age parent2)))
+                     :age ((age-combining-function argmap) parent1 parent2 new-genome)
                      :ancestors (if maintain-ancestors
                                   (cons (:genome parent1) (:ancestors parent1))
                                   (:ancestors parent1)))))
@@ -614,9 +615,7 @@
                                  long-genome)))]
       (make-individual :genome new-genome
                        :history (:history parent1)
-                       :age ((age-combining-function argmap)
-                             (inc (:age parent1))
-                             (inc (:age parent2)))
+                       :age ((age-combining-function argmap) parent1 parent2 new-genome)
                        :ancestors (if maintain-ancestors
                                     (cons (:genome parent1) (:ancestors parent1))
                                     (:ancestors parent1))))))
@@ -886,9 +885,7 @@
                          [])))]
     (assoc (make-individual :genome new-genome
                             :history (:history parent1)
-                            :age ((age-combining-function argmap)
-                                  (inc (:age parent1))
-                                  (inc (:age parent2)))
+                            :age ((age-combining-function argmap) parent1 parent2 new-genome)
                             :ancestors (if maintain-ancestors
                                          (cons (:genome parent1) (:ancestors parent1))
                                          (:ancestors parent1)))
@@ -940,9 +937,7 @@
                                         [])
                               :history (:history parent1)
                               :age (if use-child
-                                     ((age-combining-function argmap)
-                                      (inc (:age parent1))
-                                      (inc (:age parent2)))
+                                     ((age-combining-function argmap) parent1 parent2 new-genome)
                                      0)
                               :ancestors (if maintain-ancestors
                                            (cons (:genome parent1) (:ancestors parent1))
@@ -950,18 +945,3 @@
         :is-random-replacement
         (if use-child false true)))))

-
-
-
-
-
-
-
-
-
-
-
-
-
-
-


Revised :reproductive-change-changes-differently and  :symbolic-reproductive-change-changes-differently diversification tests

--- src/clojush/pushgp/genetic_operators.clj
+++ src/clojush/pushgp/genetic_operators.clj
@@ -1366,7 +1366,9 @@
     (assoc ind :diversifying
       (and (distinct? 1 mbsim-c-gc mbsim-gc-ggc)
            (distinct? 1 mbsim-c2-gc2 mbsim-gc2-ggc2)
-           (distinct? mbsim-gc-ggc mbsim-gc2-ggc2)))))
+           ;(distinct? mbsim-gc-ggc mbsim-gc2-ggc2)
+           (distinct? (- mbsim-c-gc mbsim-gc-ggc)
+                      (- mbsim-c2-gc2 mbsim-gc2-ggc2))))))

 (defn symbolic-reproductive-change-changes-differently-diversifying?
   [ind argmap]
@@ -1391,7 +1393,9 @@
     (assoc ind :diversifying
       (and (distinct? 1 mbsim-c-gc mbsim-gc-ggc)
            (distinct? 1 mbsim-c2-gc2 mbsim-gc2-ggc2)
-           (distinct? mbsim-gc-ggc mbsim-gc2-ggc2)))))
+           ;(distinct? mbsim-gc-ggc mbsim-gc2-ggc2)
+           (distinct? (- mbsim-c-gc mbsim-gc-ggc)
+                      (- mbsim-c2-gc2 mbsim-gc2-ggc2))))))

 (defn use-mate-diversifying?
   [ind argmap]


more robust way to determine if the key is separate from the value

--- pigpen-cascading/src/main/clojure/pigpen/cascading.clj
+++ pigpen-cascading/src/main/clojure/pigpen/cascading.clj
@@ -78,18 +78,17 @@
         fields (cfields field-names)
         cogroup-opts (get-in flowdef [:cogroup-opts pipe])]
     (if-not (nil? cogroup-opts)
-      (let [buffer (case (:group-type cogroup-opts)
+      (let [key-separate-from-value (> (count (first (map :args code-defs))) (:num-streams cogroup-opts))
+            buffer (case (:group-type cogroup-opts)
                      :group (GroupBuffer. inits funcs fields (:num-streams cogroup-opts)
                                           (:group-all cogroup-opts)
                                           (:join-nils cogroup-opts)
                                           (:join-requirements cogroup-opts)
                                           udf
-                                          (:key-separate-from-value cogroup-opts))
+                                          key-separate-from-value)
                      :join (JoinBuffer. (first inits) (first funcs) fields (:all-args cogroup-opts)))]
         (update-in flowdef [:pipes pipe] #(Every. % buffer Fields/RESULTS)))
-      (-> flowdef
-          (update-in [:pipes pipe] #(Each. % (PigPenFunction. (first inits) (first funcs) fields) Fields/RESULTS))
-          (add-val [:pipe-fields] pipe field-names)))))
+      (update-in flowdef [:pipes pipe] #(Each. % (PigPenFunction. (first inits) (first funcs) fields) Fields/RESULTS)))))

 (defmethod command->flowdef :group
   [{:keys [id keys fields join-types ancestors opts]} flowdef]
@@ -101,8 +100,6 @@
                         (Insert. (cfields ["group_all"]) (into-array [1]))
                         (cfields ["group_all" "value"]))]
                 (map (:pipes flowdef) ancestors))
-        key-separate-from-value (or is-group-all
-                                    (every? #(> (count %) 1) (map (:pipe-fields flowdef) ancestors)))
         is-inner (every? #{:required} join-types)
         pipes (map (fn [p k] (if is-inner
                                (Each. p (cfields k) (FilterNull.))
@@ -114,13 +111,12 @@
                                        (into-array (map cfields keys))
                                        Fields/NONE
                                        (BufferJoin.)))
-        (add-val [:cogroup-opts] id {:group-id                id
-                                     :key-separate-from-value key-separate-from-value
-                                     :group-type              :group
-                                     :join-nils               (true? (:join-nils opts))
-                                     :group-all               is-group-all
-                                     :num-streams             (count pipes)
-                                     :join-requirements       (map #(= :required %) join-types)}))))
+        (add-val [:cogroup-opts] id {:group-id          id
+                                     :group-type        :group
+                                     :join-nils         (true? (:join-nils opts))
+                                     :group-all         is-group-all
+                                     :num-streams       (count pipes)
+                                     :join-requirements (map #(= :required %) join-types)}))))

 (defmethod command->flowdef :join
   [{:keys [id keys fields join-types ancestors opts]} flowdef]


indenting

indenting

--- test/celestial/test/proxmox.clj
+++ test/celestial/test/proxmox.clj
@@ -8,8 +8,7 @@
     [celestial.model :only (vconstruct)]
     [proxmox.generators :only (ct-id)]
     [celestial.fixtures :only (redis-prox-spec with-conf)])
-  (:import clojure.lang.ExceptionInfo)
-  )
+  (:import clojure.lang.ExceptionInfo))

 (defn with-m? [m]
  (fn [actual]


remove redundant call to serialization/realize

--- test/clj_money/trading_test.clj
+++ test/clj_money/trading_test.clj
@@ -564,7 +564,7 @@
     (is (= expected gains-items) "The capital gains account is credited the correct amount")))

 (deftest selling-a-commodity-for-a-loss-debits-capital-loss
-  (let [context (serialization/realize storage-spec (sell-context))
+  (let [context (sell-context)
         ira (->> context
                  :accounts
                  (filter #(= "IRA" (:name %)))


Add tests for fasta random reading with multiple lines.

--- test/cljam/io/sequence_test.clj
+++ test/cljam/io/sequence_test.clj
@@ -82,6 +82,16 @@
            "AGGTTTTATAAAACAA"))
     (is (= (protocols/read-in-region rdr {:chr "ref2" :start 1 :end 16} {:mask? true})
            "aggttttataaaacaa"))))
+
+(deftest read-sequence-medium-fasta-test
+  (let [expect (str "tgaatcaCATCAATTAAGAACTTTCTTCACCACCCCTTCGCTGTCATC"
+                    "CTTTTCTCTCCACTATTCACCCAACATCATCCGGGACCAGAACTAATGTC"
+                    "AGCAAAGC")
+        u-expect (cstr/upper-case expect)]
+    (with-open [rdr (cseq/fasta-reader medium-fa-file)]
+      (is (= (cseq/read-sequence rdr {:chr "chr3" :start 2053 :end 2158}) u-expect))
+      (is (= (cseq/read-sequence rdr {:chr "chr3" :start 2053 :end 2158} {:mask? false}) u-expect))
+      (is (= (cseq/read-sequence rdr {:chr "chr3" :start 2053 :end 2158} {:mask? true}) expect)))))

 (deftest read-sequence-twobit-test
   (testing "reference test"


DLL Autoreloader -- almost working on Mac

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

--- plugins/DLLAutoReloader/src/DLLAutoReloader/core.clj
+++ plugins/DLLAutoReloader/src/DLLAutoReloader/core.clj
@@ -18,8 +18,12 @@
         [clojure.data :only (diff)]
         [org.micromanager.mm :only (edt load-mm mmc core gui)]
         [clojure.pprint :only (pprint)])
-  (:import (javax.swing JLabel JWindow)
-           (java.awt Color)))
+  (:import (javax.swing JButton JFrame JLabel JWindow)
+           (java.awt Color)
+           (java.awt.event ActionListener)
+           (java.util.prefs Preferences)
+           (org.micromanager.utils FileDialogs FileDialogs$FileType
+                                   GUIUtils JavaUtils)))

 (load-mm (org.micromanager.MMStudioMainFrame/getInstance))

@@ -141,7 +145,8 @@
     (future
       (while @keep-following
         (Thread/sleep 500)
-        (reset! date-atom (file-dates path))))
+        (when-not (.isAcquisitionRunning gui)
+          (reset! date-atom (file-dates path)))))
     #(reset! keep-following false)))

 (defn watch-dates
@@ -158,9 +163,9 @@
 (defn module-for-dll
   "Finds the module name for a dll path."
   [dll]
-  (-> dll
-      file .getName (.split "\\.")
-      first (.replace "mmgr_dal_" "")))
+  (let [name (-> dll file .getName (.split "\\.") first)]
+    (when (.contains name "mmgr_dal_") ; else not a lib!
+      (second (.split name "mmgr_dal_")))))

 (defonce
   status-frame
@@ -189,8 +194,26 @@
       (.setText label (apply label-html message-parts))
       (.show frame))
     (when temporary?
-    (future (Thread/sleep 3000)
-            (edt (.hide frame))))))
+      (future (Thread/sleep 3000)
+              (edt (.hide frame))))))
+
+(defmacro pausing-live-mode
+  "Temporarily stop live mode (if it is running), run body code, and then
+   start live mode again (if it was running)."
+  [& body]
+  `(let [live-mode# (.isLiveModeOn gui)]
+    (when live-mode#
+      (.enableLiveMode gui false))
+    ~@body
+    (when live-mode#
+      (.enableLiveMode gui true))))
+
+(defn new-dll-name
+  [dll]
+  (let [name (.getName dll)]
+    (if (JavaUtils/isWindows)
+      name
+      (.replace name ".la" ""))))

 (defn reload-updated-module
   "Unload a module, copy the new version to the Micro-Manager
@@ -200,16 +223,12 @@
         module (module-for-dll dll)
         loaded-modules (keys (devices-in-each-module))]
     (when (some #{module} loaded-modules)
-      (let [live-mode (.isLiveModeOn gui)]
-        (when live-mode
-          (.enableLiveMode gui false))
-        (notify-user false "Reloading " module " module...")
+      (notify-user false "Reloading " module " module...")
+      (pausing-live-mode
         (reload-module module
                        (copy dll
-                             (file "." (.getName dll))))
-        (notify-user true "Finished reloading " module "!")
-        (when live-mode
-          (.enableLiveMode gui true))))))
+                             (file "." (new-dll-name dll)))))
+      (notify-user true "Finished reloading " module "!"))))

 (defn reload-modules-on-device-adapter-change
   "Watch the directory where compiled DLLs are placed by Visual
@@ -223,15 +242,57 @@

 (def ^{:dynamic true} stop (fn []))

-(def default-directory "C:\\projects\\micromanager\\bin_x64")
-
-(defn show-plugin [plugin]
-  (println "starting DLLAutoReloader plugin")
+(defn activate
+  "Start device adapter library reloading."
+  [path]
   (stop)
-  (def stop (reload-modules-on-device-adapter-change default-directory))
+  (def stop (reload-modules-on-device-adapter-change path))
   (notify-user true "Ready to autoreload!"))

-(defn handle-exit [] (stop))
+(defn deactivate []
+  "Stop device adapter library reloading."
+  []
+  (stop)
+  (notify-user true "Autoreloading deactivated!"))
+
+(def dll-directory-type (FileDialogs$FileType. "DLL Directory" "New DLL location" "" false nil))
+
+(defn choose-dll-dir
+  []
+  (FileDialogs/openDir nil "Please choose a directory where new DLLs will appear"
+                       dll-directory-type))
+
+(def prefs (.. Preferences userRoot (node "DLLAutoReloader")))
+
+(defn startup
+  []
+  (let [frame (proxy [JFrame] []) ; use proxy to get unique JFrame class
+        path (.get prefs "dir" nil)
+        path-button (JButton. (or path "(choose path)"))]
+    (when path
+      (activate path))
+    (doto frame
+      (.setBounds 100 100 700 50)
+      (.setResizable false)
+      (GUIUtils/recallPosition)
+      (.setTitle "DLL Auto Reloading"))
+    (.addActionListener path-button
+                        (proxy [ActionListener] []
+                          (actionPerformed [e]
+                            (when-let [dir (file (choose-dll-dir))]
+                              (let [path (.getAbsolutePath dir)]
+                              (.setText path-button path)
+                              (activate path)
+                              (.put prefs "dir" path))))))
+    (doto (.getContentPane frame)
+      (.add path-button))
+    (.show frame)))
+
+(defn showPlugin [this]
+  (startup))
+
+(defn handle-exit []
+  (stop))

 ;; testing

@@ -240,4 +301,4 @@
 (defn test-unload []
   (core unloadLibrary test-lib))

-(def test-file (file default-directory "mmgr_dal_DemoCamera.dll"))
+;(def test-file (file default-directory "mmgr_dal_DemoCamera.dll"))


adding missing rate spec for mouse-y ugen

--- src/overtone/sc/ugen/input.clj
+++ src/overtone/sc/ugen/input.clj
@@ -20,6 +20,7 @@
               {:name "warp",
                :default :linear
                :map {:linear 0 :exponential 1 :lin 0 :exp 1}
+               :rates #{:kr}
                :doc "mapping curve - either :linear or :exponential (:lin and :exp abbreviations are allowed)"}
               {:name "lag", :default 0.2 :doc "lag factor to dezipper cursor movement."}]


Helpers are now public (for testing), add-trigram tests if its argument is a valid trigram.

--- KataTrigrams/src/kata_trigrams/core.clj
+++ KataTrigrams/src/kata_trigrams/core.clj
@@ -3,25 +3,27 @@
   (:require [clojure.data.json :as json])
   (:use [clojure.string :only (split)]))

-(defn- str->trigrams
+(defn str->trigrams
   "Return trigrams from a string. It splits on spaces, so punctuation
    is kept."
   [s]
   (let [words (split s #"\s+")]
     (partition 3 1 words)))

-(defn- add-trigram
+(defn add-trigram
   "Add a trigram to a map."
   ;; the map maps words pairs ("w1 w2") to sets of possible third words, e.g.:
   ;; { "foo bar" #{"baz" "quux" ... }, "bar foo" #{...}, ... }
   [m t]
-  (let [k (str (first t) " " (second t)) ; key
-        v (last t)]                      ; value
-    (if (m k)
-      ;; if the key exists, append the value to its set
-      (assoc m k (conj (m k) v))
-      ;; if not, create its set
-      (assoc m k #{v}))))
+  (if (not= 3 (count t))
+    m ; t is not a trigram, return the original map
+    (let [k (str (first t) " " (second t)) ; key
+          v (last t)]                      ; value
+      (if (m k)
+        ;; if the key exists, append the value to its set
+        (assoc m k (conj (m k) v))
+        ;; if not, create its set
+        (assoc m k #{v})))))

 (defn index
   "Index all trigrams from filename-in and store them in filename-out


Fixed error handling on process-after-token-acquire

--- src/saved_for_reddit/core.cljs
+++ src/saved_for_reddit/core.cljs
@@ -97,13 +97,13 @@
                                    {:with-credentials? false
                                     :oauth-token (:token @app-state)}))
             body  (:body response)
-            error (:error response)]
+            error (:error body)]
         (println response)
         (if (or (nil? error) (clojure.string/blank? error))
           (do
             (set-app-state-field :username (:name body))
             (get-saved-posts))
-          (handle-error error)))))
+          (handle-error (str error " " (:error-text response) "\nYour API token might've expired."))))))

 (defn request-reddit-auth-token [client-id redirect-uri code]
   (go (let [response (<! (http/post "https://www.reddit.com/api/v1/access_token"


letfn over let #()

letfn over let #()

--- src/midje/ideas/tabular.clj
+++ src/midje/ideas/tabular.clj
@@ -32,7 +32,7 @@
   (when (and false (some #(= % '|) table))
     (println "The `|` syntactic sugar for tabular facts is deprecated and will be removed in Midje 1.4." @deprecation-hack:file-position))

-  (let [strip-off-where #(if (#{:where 'where} (first %)) (rest %) % )]
+  (letfn [(strip-off-where [x] (if (#{:where 'where} (first x)) (rest x) x))]
     (->> table strip-off-where (remove #(= % '|)))))

 (defn- table-variable? [locals s]


fix x-axis offset to center

fix x-axis offset to center

--- src/sierpinski_sieve/core.cljs
+++ src/sierpinski_sieve/core.cljs
@@ -34,9 +34,11 @@
         (set! (.-fillStyle ctx) "black")
         (.fillRect ctx 0 0 size size)
         (set! (.-fillStyle ctx) "white")
-        (doseq [x (range (count sieve)) y (range (count sieve))]
-          (if (odd? (get-in sieve [x y] 0))
-            (put-pixel ctx x y)))))))
+        (doseq [[y row] (reverse (map-indexed vector sieve))
+                [x value] (map-indexed vector row)]
+          (let [disp-x (+ (* (- size y) 0.5) x)]
+            (if (odd? value)
+              (put-pixel ctx disp-x y))))))))

 (reagent/render-component [render-canvas]
                           (. js/document (getElementById "app")))


Decrease `threshold` to catch issues with vertex functions:

`bezier-vertex`, `quadratic-vertex`, `curve-vertex`.

--- test/clj/quil/snippet.clj
+++ test/clj/quil/snippet.clj
@@ -138,7 +138,7 @@
 (t/deftest ^:manual
   all-cljs-snippets-produce-expected-output
   (let [driver (etaoin/firefox)
-        threshold 0.01]
+        threshold 0.003]
     (etaoin/go driver "http://localhost:3000/test.html")
     (let [elements (etaoin/query-all driver {:tag :option})
           names    (doall (map #(etaoin/get-element-text-el driver %) elements))]


Cleanup

Cleanup

--- test/icecap/test_data.clj
+++ test/icecap/test_data.clj
@@ -1,6 +1,15 @@
 (ns icecap.test-data)

-(defn success-step [name] {:type :succeed :name name})
-(def simple-http-step {:type :http :url "http://example.test"})
-(def simple-https-step {:type :http :url "https://example.test"})
-(def simple-ftp-step {:type :ftp :loc "ftp://example.test"})
+(defn success-step
+  [name]
+  {:type :succeed :name name})
+
+(def simple-http-step
+  {:type :http :url "http://example.test"})
+
+(def simple-https-step
+  {:type :http :url "https://example.test"})
+
+(def simple-ftp-step
+  {:type :ftp
+   :loc "ftp://example.test"})


Don't include board author and viewer list in board rep in org response of public access.

--- src/oc/storage/api/orgs.clj
+++ src/oc/storage/api/orgs.clj
@@ -21,9 +21,16 @@

 ;; ----- Utility functions -----

-(defn- board-with-access-level [org board user]
-  (let [level (access/access-level-for org board user)]
-    (if level (merge board level) board)))
+(defn- board-with-access-level
+  "
+  Merge in `access` level user is accessing this board with, and if that level is public, remove author and
+  viewer lists.
+  "
+  [org board user]
+  (let [level (access/access-level-for org board user)
+        public? (= :public (:access-level level))
+        clean-board (if public? (dissoc board :authors :viewers) board)]
+    (if level (merge clean-board level) clean-board)))

 ;; ----- Actions -----


Do not error in case a non premium org tries to update the brand color, just discard it and move on.

--- src/oc/storage/api/orgs.clj
+++ src/oc/storage/api/orgs.clj
@@ -238,21 +238,24 @@
     (catch clojure.lang.ExceptionInfo e
       [false, {:reason (.getMessage e)}]))) ; Not a valid new org

+(defn- clean-brand-color [new-props ctx]
+  (if (:premium? ctx)
+    new-props
+    (dissoc new-props :brand-color)))
+
 (defn- valid-org-update? [conn slug ctx]
   (try
     (if-let [org (org-res/get-org conn slug)]
       (let [org-props (:data ctx)
-            updated-org (merge org (org-res/ignore-props org-props))
+            cleaned-org-props (-> org-props
+                                  (org-res/ignore-props)
+                                  (clean-brand-color ctx))
+            updated-org (merge org cleaned-org-props)
             updating-org-name? (contains? org-props :name)
-            org-name (:name org-props)
-            premium-org? (:premium? ctx)]
+            org-name (:name org-props)]
         (cond (and updating-org-name?
                    (not (valid-org-name? org-name)))
               [false {:reason (org-name-error org-name)
-                      :updated-org updated-org}]
-              (and (not premium-org?)
-                   (contains? org-props :brand-color))
-              [false {:reason (format "Non premium orgs can't change brand color: %s" (:brand-color org-props))
                       :updated-org updated-org}]
               (not (lib-schema/valid? common-res/Org updated-org))
               [false {:reason (schema/check common-res/Org updated-org)


Fix indentation.

Fix indentation.

--- src/oc/storage/api/orgs.clj
+++ src/oc/storage/api/orgs.clj
@@ -238,8 +238,8 @@
   ;; Authorization
   :allowed? (by-method {
     :options true
-      :get (fn [ctx] (let [user (user-from-context ctx)]
-                       (access/access-level-for conn slug user)))
+    :get (fn [ctx] (let [user (user-from-context ctx)]
+                     (access/access-level-for conn slug user)))
     :patch (fn [ctx] (access/allow-authors conn slug (:user ctx)))})

   ;; Validations


Better validation - check whether read-log is used with mem://

--- src/onyx/plugin/datomic.clj
+++ src/onyx/plugin/datomic.clj
@@ -268,9 +268,13 @@

 (defn inject-read-log-resources
   [{:keys [onyx.core/task-map onyx.core/log onyx.core/task-id onyx.core/pipeline] :as event} lifecycle]
+  (when (re-matches #"mem://.*" (:datomic/uri task-map))
+    (throw (ex-info "Read datoms cannot support in mem datomic instances, as these do not have a transaction log." task-map)))
+
   (when-not (or (= 1 (:onyx/max-peers task-map))
                 (= 1 (:onyx/n-peers task-map)))
-    (throw (ex-info "Read log tasks must set :onyx/max-peers 1" task-map)))
+    (throw (ex-info "Read log tasks must set :onyx/max-peers 1, or :onyx/n-peers 1" task-map)))
+
   (let [start-tx (:datomic/log-start-tx task-map)
         max-tx (:datomic/log-end-tx task-map)
         {:keys [read-ch shutdown-ch commit-ch]} pipeline