Allow rendering of game scenes outside of devcard environment. Much much faster execution there.

--- src/player/core.cljs
+++ src/player/core.cljs
@@ -292,9 +292,9 @@
                            (enter-state has ha (:state ha) t))
                          deps)]
     #_(println "next transitions" #_reenter-has (transition-intervals has
-                                                                  (second reenter-has)
-                                                                  Infinity
-                                                                  (required-transitions (second reenter-has))))
+                                                                      (second reenter-has)
+                                                                      Infinity
+                                                                      (required-transitions (second reenter-has))))
     (merge has (zipmap (map :id reenter-has) reenter-has))))

 (defn update-scene [scene now inputs]
@@ -312,11 +312,11 @@
     (cond
       (> min-t qnow) (assoc scene :now now)
       (= min-t qnow) (do #_(println "clean border") (assoc scene :now now
-                                   :objects (follow-transitions has transitions)))
+                                                                 :objects (follow-transitions has transitions)))
       :else (do #_(println "messy border overflow" (- now min-t)) (update-scene (assoc scene :now min-t
-                                        :objects (follow-transitions has transitions))
-                           now
-                           inputs))
+                                                                                :objects (follow-transitions has transitions))
+                                                                                now
+                                                                                inputs))
       )))

 (defonce scene-a (atom {}))
@@ -356,11 +356,11 @@
                              ; got to let every HA enter its current (initial) state to set up state invariants like
                              ; pending required and optional transitions
                              obj-dict (zipmap obj-ids (map #(enter-state obj-dict % (:state %) 0) objects))]
-                         {:now     0
-                          :then    0
-                          :playing false
+                         {:now           0
+                          :then          0
+                          :playing       false
                           :pause-on-play false
-                          :objects obj-dict}))
+                          :objects       obj-dict}))
 (defn reset-scene-a! []
   (swap! scene-a (fn [_]
                    (make-scene-a 8))))
@@ -409,59 +409,60 @@
            scene-a)

 #_(defcard ha-deps
-         (fn [scene _owner]
-           [(ha-dependencies (get-in @scene [:objects :a])) (ha-dependencies (get-in @scene [:objects :b]))])
-         scene-a)
+           (fn [scene _owner]
+             [(ha-dependencies (get-in @scene [:objects :a])) (ha-dependencies (get-in @scene [:objects :b]))])
+           scene-a)

 (defcard ha-states-card
          (fn [scene _owner]
            (ha-states @scene))
          scene-a)

+(defn scene-widget [scene owner]
+  (let [scale 2
+        view-h (str (* scale 240) "px")
+        ct (count (:objects @scene))
+        line-h (/ (* scale 240) ct)]
+    (sab/html [:div {:style {:backgroundColor "blue" :width (str (* scale 320) "px") :height view-h :position "relative"}}
+               (map (fn [{x :x y :y w :w h :h :as ha} i]
+                      (let [trans-count (count (required-transitions ha))
+                            trans-h (/ line-h trans-count)]
+                        [:div
+                         (map (fn [trans j]
+                                (let [[s e] (:interval trans)
+                                      sx (* scale (:x (extrapolate ha s)))
+                                      ex (* scale (:x (extrapolate ha e)))
+                                      line-top (+ (* i line-h) (* j trans-h))]
+                                  [:div {:style {:height   trans-h :width (.abs js/Math (- sx ex))
+                                                 :top      line-top :left (.min js/Math sx ex)
+                                                 :position :absolute :backgroundColor "grey"}}
+                                   [:div {:style {:position :absolute :top "64px" :width "200px"}} (str (:id ha) "-" (:target (:transition trans)))]
+                                   [:div {:style {:height "100%" :width (* scale 2) :position :absolute :left (if (< sx ex) "0%" "100%") :backgroundColor "green"}}]
+                                   [:div {:style {:height "100%" :width (* scale 2) :position :absolute :left (if (< sx ex) "100%" "0%") :backgroundColor "red"}}]]))
+                              (transition-intervals (:objects @scene)
+                                                    ha
+                                                    Infinity
+                                                    (required-transitions ha))
+                              (range 0 trans-count))]))
+                    (map #(extrapolate % (:now @scene)) (vals (:objects @scene)))
+                    (range 0 ct))
+               (map (fn [{x :x y :y w :w h :h :as ha}]
+                      [:div
+                       [:div {:style {:width           (str (* scale w) "px") :height (str (* scale h) "px") :borderRadius (str (* scale w) "px")
+                                      :backgroundColor "brown"
+                                      :position        "absolute" :left (str (* scale x) "px") :bottom (str (* scale y) "px")}}
+                        (str (:id ha))]])
+                    (map #(extrapolate % (:now @scene)) (vals (:objects @scene))))
+               [:button {:onClick #(swap! scene (fn [s] (assoc s :playing (not (:playing s)))))} (if (:playing @scene) "PAUSE" "PLAY")]
+               [:span {:style {:backgroundColor "lightgrey"}} "Pause on state change?"
+                [:input {:type     "checkbox"
+                         :checked  (:pause-on-play @scene)
+                         :onChange #(swap! scene (fn [s] (assoc s :pause-on-play (.-checked (.-target %)))))}]]
+               [:button {:onClick #(reset-scene-a!)} "RESET"]])))
+
 (defcard draw-scene
-         (fn [scene _owner]
-           (let [scale 2
-                 view-h (str (* scale 240) "px")
-                 ct (count (:objects @scene))
-                 line-h (/ (* scale 240) ct)]
-             (sab/html [:div {:style {:backgroundColor "blue" :width (str (* scale 320) "px") :height view-h :position "relative"}}
-                        (map (fn [{x :x y :y w :w h :h :as ha} i]
-                               (let [trans-count (count (required-transitions ha))
-                                     trans-h (/ line-h trans-count)]
-                                 [:div
-                                  (map (fn [trans j]
-                                         (let [[s e] (:interval trans)
-                                               sx (* scale (:x (extrapolate ha s)))
-                                               ex (* scale (:x (extrapolate ha e)))
-                                               line-top (+ (* i line-h) (* j trans-h))]
-                                           [:div {:style {:height   trans-h :width (.abs js/Math (- sx ex))
-                                                          :top      line-top :left (.min js/Math sx ex)
-                                                          :position :absolute :backgroundColor "grey"}}
-                                            [:div {:style {:position :absolute :top "64px" :width "200px"}} (str (:id ha) "-" (:target (:transition trans)))]
-                                            [:div {:style {:height "100%" :width (* scale 2) :position :absolute :left (if (< sx ex) "0%" "100%") :backgroundColor "green"}}]
-                                            [:div {:style {:height "100%" :width (* scale 2) :position :absolute :left (if (< sx ex) "100%" "0%") :backgroundColor "red"}}]]))
-                                       (transition-intervals (:objects @scene)
-                                                             ha
-                                                             Infinity
-                                                             (required-transitions ha))
-                                       (range 0 trans-count))]))
-                             (map #(extrapolate % (:now @scene)) (vals (:objects @scene)))
-                             (range 0 ct))
-                        (map (fn [{x :x y :y w :w h :h :as ha}]
-                               [:div
-                                [:div {:style {:width           (str (* scale w) "px") :height (str (* scale h) "px") :borderRadius (str (* scale w) "px")
-                                               :backgroundColor "brown"
-                                               :position        "absolute" :left (str (* scale x) "px") :bottom (str (* scale y) "px")}}
-                                 (str (:id ha))]])
-                             (map #(extrapolate % (:now @scene)) (vals (:objects @scene))))
-                        [:button {:onClick #(swap! scene (fn [s] (assoc s :playing (not (:playing s)))))} (if (:playing @scene) "PAUSE" "PLAY")]
-                        [:span {:style {:backgroundColor "lightgrey"}} "Pause on state change?"
-                         [:input {:type     "checkbox"
-                                  :checked  (:pause-on-play @scene)
-                                  :onChange #(swap! scene (fn [s] (assoc s :pause-on-play (.-checked (.-target %)))))}]]
-                        [:button {:onClick #(reset-scene-a!)} "RESET"]])))
+         scene-widget
          scene-a)
-

 #_(defcard next-transition
            "When and what is the next transition of object a?"
@@ -469,11 +470,18 @@
              (next-transition-ha (get-in @scene [:objects :a]) (get-in @scene [:then])))
            scene-a)

+(defonce last-scene-a nil)
+
+(defn rererender [target]
+  (when (not= @scene-a last-scene-a)
+    (js/React.render (scene-widget scene-a nil) target))
+  (.requestAnimationFrame js/window #(rererender target)))
+
 (defn main []
   ;; conditionally start the app based on wether the #main-app-area
   ;; node is on the page
   (if-let [node (.getElementById js/document "main-app-area")]
-    (js/React.render (sab/html [:div "This is working"]) node)))
+    (.requestAnimationFrame js/window #(rererender node))))

 (main)


docs for [Box ..]

docs for [Box ..]

--- src/re_demo/box.cljs
+++ src/re_demo/box.cljs
@@ -20,11 +20,17 @@
                            :width    "450px"
                            :children [[component-title "Notes"]
                                       [status-text "Stable"]
+
                                       [paragraphs
-                                       [:p "TBA..."]]
+                                      [:p "When we first put bootstrap buttons into re-com, they were streched.
+               It turned out their block display didn't play well with flex containers like h-box."]
+                                       [:p "But once we fixed that, there were other problem like they wouldn't justify correctly in a container."]
+                                       [:p "So we created the " [:span.bold "[box ...]"] " component which allows you to wrap
+               non-flex \"leaf\" elements for use in flex containers."]
+                                      [:p "You probably won't need to use it directly."]]
                                       [args-table box-args-desc]]]
                           [v-box
                            :gap      "10px"
                            :children [[component-title "Demo"]
-                                      [:span.all-small-caps "TBA..."]]]]]
+                                      [:span.all-small-caps "This space intentionally left free of dark pixels. "]]]]]
               [gap :size "30px"]]])


fix typo in box

fix typo in box

--- src/re_demo/box.cljs
+++ src/re_demo/box.cljs
@@ -25,7 +25,7 @@
                It turned out their block display didn't play well with flex containers like h-box."]
                                       [p "We fixed that, but then there were other problems like they
                                       wouldn't justify correctly in a container. All this issues arose because they
-                                      were never designed (styled) to be the children of flexbaox containers."]
+                                      were never designed (styled) to be the children of flexbox containers."]
                                       [p "So we created the " [:span.bold "[box ...]"] " component which allows you to wrap
                a single non-flex \"leaf\" element for use in a flex container."]
                                       [p "You won't often need to use it directly."]


add erro message to log and report

add erro message to log and report

--- src/shuppet/core.clj
+++ src/shuppet/core.clj
@@ -150,9 +150,9 @@
                 {:app app-name
                  :error message})
               (catch Exception e
-                (error (str app-name " in " environment " failed: " (util/str-stacktrace e)))
+                (error (str app-name " in " environment " failed: " (.getMessage e) " stacktrace: " (util/str-stacktrace e)))
                 {:app app-name
-                 :error (util/str-stacktrace e)})
+                 :error (.getMessage e)})
               (catch Object e
                 (error (str app-name " in " environment " failed: " e))
                 {:app app-name


Fixed test error

Fixed test error

--- test/integration/mongo_query_test.clj
+++ test/integration/mongo_query_test.clj
@@ -34,7 +34,7 @@

     (fact "get-metadata returns metadata for a dataset"
         (:name metadata) => "integration_test"
-        (keys metadata) => (contains [:_id :name :info :concepts :slices :tables])
+        (keys metadata) => (contains [:_id :name :database :dir :info :concepts :slices :tables])
         (get-in metadata [:tables :incomes]) =not=> nil
         (get-in metadata [:slices :incomes :metrics])
         => ["tax_returns" "adjusted_gross_income" "date_observed"]))


Add comment.

Add comment.

--- test/lein_xjc/t_integration_tests.clj
+++ test/lein_xjc/t_integration_tests.clj
@@ -62,6 +62,9 @@
                                ["com.example.ObjectFactory"
                                 "com.example.Something"])))

+;; Note: Reading the test projects automatically cleans them. Thus
+;; running 'lein install' actually regenerates and compiles the java
+;; source files. This behavior is intended.
 (fact "running 'lein install' compiles the generated java classes"
       :integration-test
       (let [project (read-single-xsd-project)]


Added integration tests for the rest of the URLs

--- test/integration/handler_test.clj
+++ test/integration/handler_test.clj
@@ -5,9 +5,7 @@
             [cfpb.qu.data :as data]
             [monger.core :as mongo]))

-(with-state-changes [(before :facts (data/connect-mongo))
-                     (after :facts (data/disconnect-mongo))]
-
+(with-state-changes [(before :facts (data/ensure-mongo-connection))]
   (fact "the index URL redirects to /data"
         (app (request :get "/"))
         => (contains {:status 302
@@ -21,5 +19,58 @@

              (app (request :get "/data.xml"))
              => (contains {:status 200
-                           :headers {"Content-Type" "application/xml;charset=UTF-8"}}))))
+                           :headers {"Content-Type" "application/xml;charset=UTF-8"}})))

+  (facts "about /data/county_taxes"
+         (fact "it returns successfully"
+             (app (request :get "/data/county_taxes"))
+             => (contains {:status 200
+                           :headers {"Content-Type" "text/html;charset=UTF-8"}})
+
+             (app (request :get "/data/county_taxes.xml"))
+             => (contains {:status 200
+                           :headers {"Content-Type" "application/xml;charset=UTF-8"}})))
+
+  (facts "about /data/bad-dataset"
+         (fact "it returns a 404"
+               (app (request :get "/data/bad-dataset"))
+               => (contains {:status 404
+                             :headers {"Content-Type" "text/html"
+                                       "Vary" "Accept"}})
+
+               (app (request :get "/data/bad-dataset.xml"))
+               => (contains {:status 404
+                             :headers {"Content-Type" "application/xml;charset=UTF-8"}})))
+
+  (facts "about /data/county_taxes/incomes"
+       (fact "it returns successfully"
+             (app (request :get "/data/county_taxes/incomes"))
+             => (contains {:status 200
+                           :headers {"Content-Type" "text/html;charset=UTF-8"}})
+
+             (app (request :get "/data/county_taxes/incomes.xml"))
+             => (contains {:status 200
+                           :headers {"Content-Type" "application/xml;charset=UTF-8"}})))
+
+  (facts "about /data/bad-dataset/bad-slice"
+         (fact "it returns a 404"
+               (app (request :get "/data/bad-dataset/bad-slice"))
+               => (contains {:status 404
+                             :headers {"Content-Type" "text/html"
+                                       "Vary" "Accept"}})
+
+               (app (request :get "/data/bad-dataset/bad-slice.xml"))
+               => (contains {:status 404
+                             :headers {"Content-Type" "application/xml;charset=UTF-8"}})))
+
+  (facts "about /data/county_taxes/bad-slice"
+         (fact "it returns a 404"
+               (app (request :get "/data/county_taxes/bad-slice"))
+               => (contains {:status 404
+                             :headers {"Content-Type" "text/html"
+                                       "Vary" "Accept"}})
+
+               (app (request :get "/data/county_taxes/bad-slice.xml"))
+               => (contains {:status 404
+                             :headers {"Content-Type" "application/xml;charset=UTF-8"}}))))
+


Update quil

Update quil

--- src/clojure/leiningen/new/graphics_clojure/project.clj
+++ src/clojure/leiningen/new/graphics_clojure/project.clj
@@ -2,5 +2,5 @@
   :description "FIXME: write description"
   :url "http://example.com/FIXME"
   :dependencies [[org.clojure/clojure "1.6.0"]
-                 [quil "1.7.0"]]
+                 [quil "2.0.0"]]
   :main {{namespace}})


Add test for traverse

Add test for traverse


Display landing/profile page on log in/logout

--- src/trak/ui/app.cljs
+++ src/trak/ui/app.cljs
@@ -4,51 +4,82 @@
             [trak.utils :as utils]
             [trak.db :as db]
             [trak.ui.components :as components]
-            [trak.globals :as globals]))
+            [trak.globals :as globals]
+            [trak.ui.components.landing :as landing]
+            [trak.ui.components.profile :as profile]))

-(defn album-artists [artists]
-  (map (fn [artist]
-         [:a {:href (:href artist) :key (:id artist)} (:name artist) [:br]]) artists))
+;(defn album-artists [artists]
+;  (map (fn [artist]
+;         [:a {:href (:href artist) :key (:id artist)} (:name artist) [:br]]) artists))
+;
+;(rum/defc album-card [album]
+;  [:.card
+;   [:.card-image [:img.img-responsive {:src (:url (first (:album/images album)))}]]
+;   [:.card-header [:h4.card-title (:album/name album)]
+;    [:h6.card-subtitle (album-artists (:album/artists album))]]
+;   [:.card-body "Available markets " (map (fn [m] (str m " ")) (:album/available_markets album))]])
+;
+;(rum/defc albums [*db]
+;  (let [albums (db/get-albums *db)]
+;    [:.columns (map (fn [album] [:.column.col-6.col-xs-12 {:key (:db/id album)} (album-card album)]) albums)]))

-(rum/defc album-card [album]
-  [:.card
-   [:.card-image [:img.img-responsive {:src (:url (first (:album/images album)))}]]
-   [:.card-header [:h4.card-title (:album/name album)]
-    [:h6.card-subtitle (album-artists (:album/artists album))]]
-   [:.card-body "Available markets " (map (fn [m] (str m " ")) (:album/available_markets album))]])
+;(rum/defc profile-login []
+;  (components/link
+;    {:href (globals/spotify-authorization-link "user-read-private user-read-email") :class-name "btn btn-primary"}
+;    "Log in"))
+;
+;(rum/defc profile [me]
+;  [:div [:h2 (:me/display_name me)] (:me/country me)])
+;
+;(rum/defc profile-base [*db]
+;  (let [me (db/me *db)]
+;    (utils/info me (:me/status me))
+;    (cond
+;      (= :logged-out (:me/status me)) (profile-login)
+;      (= :logged-in (:me/status me)) (profile me)
+;      (= :loading (:me/status me)) [:div "Loading..."])))

-(rum/defc albums [*db]
-  (let [albums (db/get-albums *db)]
-    [:.columns (map (fn [album] [:.column.col-6.col-xs-12 {:key (:db/id album)} (album-card album)]) albums)]))
+(rum/defc topbar [*db]
+  (let [me (db/me *db)]
+    [:section.section.section-header.bg-gray
+     [:section.grid-header.container.grid-960
+      [:nav.navbar
+       [:section.navbar-section
+        (components/link {:href       ""
+                          :class-name "navbar-brand mr-10"}
+                         (:me/display_name me))]
+       [:section.navbar-section (components/link {:href       ""
+                                                  :class-name "btn btn-primary"}
+                                                 "Log out")]]]]))

-(rum/defc profile-login []
-  (components/link
-    {:href (globals/spotify-authorization-link "user-read-private user-read-email") :class-name "btn btn-primary"}
-    "Log in"))
+(rum/defc sidebar [*db]
+  [:section.columns
+   [:div.trak-sidebar.column.col-3.col-sm-12 (profile/profile *db)]])

-(rum/defc profile [me]
-  [:div [:h2 (:me/display_name me)] (:me/country me)])
-
-(rum/defc profile-base [*db]
-  (let [me (db/me *db)]
-    (utils/info me (:me/status me))
-    (cond
-      (nil? me) (profile-login)
-      (= :logged-out (:me/status me)) (profile-login)
-      (= :logged-in (:me/status me)) (profile me)
-      (= :loading (:me/status me)) [:div "Loading..."])))
+(rum/defc fullpage [*db]
+  [:section
+   (topbar *db)
+   [:section.container.grid-960
+    (sidebar *db)]])

 (rum/defc app [*db]
   (when-let [match (utils/current-path *db)]
     (utils/info "Application mounted. Matched: " match)
-    [:div
-     (profile-base *db)
-     ;
-     ;(cond
-     ;  (empty? (db/me *db)) (components/link
-     ;                         {:href (globals/spotify-authorization-link "user-read-private user-read-email") :class-name "btn btn-primary"}
-     ;                         "Log in")
-     ;  :else "noi")
-     (cond
-       (= (:handler (utils/current-path *db)) :index) (albums *db))]))
+    (let [status (:me/status (db/me *db))]
+      (cond
+        (= :logged-out status) (landing/landing status)
+        (= :loading status) (landing/landing status)
+        (= :logged-in status) (fullpage *db)
+        ))
+    ;[:div
+    ; (profile-base *db)
+    ; ;
+    ; ;(cond
+    ; ;  (empty? (db/me *db)) (components/link
+    ; ;                         {:href (globals/spotify-authorization-link "user-read-private user-read-email") :class-name "btn btn-primary"}
+    ; ;                         "Log in")
+    ; ;  :else "noi")
+    ; (cond
+    ;   (= (:handler (utils/current-path *db)) :index) (albums *db))])
+    ))


fix clojure.core/read-line usage

fix clojure.core/read-line usage

--- src/main/clojure/clojure/tools/reader/reader_types.clj
+++ src/main/clojure/clojure/tools/reader/reader_types.clj
@@ -317,7 +317,8 @@
   ([rdr]
      (if (or (instance? LineNumberingPushbackReader rdr)
              (instance? BufferedReader rdr))
-       (clojure.core/read-line rdr)
+       (binding [*in* rdr]
+         (clojure.core/read-line))
        (loop [c (read-char rdr) s (StringBuilder.)]
          (if (newline? c)
            (str s)


Added localization key for purposes where a page cannot be found.

--- app/src/clj_web_example/localization.cljc
+++ app/src/clj_web_example/localization.cljc
@@ -1,6 +1,7 @@
 (ns clj-web-example.localization)

 (def dictionary {:title "Hello World!"
+                 :not-found "The page you are looking for does not exist."
                  :messages "Messages"
                  :new-message "New message"
                  :sender "Sender"


Mention the unicode shortcut

Mention the unicode shortcut

--- src/useful/utils.clj
+++ src/useful/utils.clj
@@ -120,7 +120,9 @@
         form))

 (defmacro map-entry
-  "Create a clojure.lang.MapEntry from a and b. Equivalent to a cons cell"
+  "Create a clojure.lang.MapEntry from a and b. Equivalent to a cons cell.
+
+useful.experimental.unicode contains a shortcut to this, named ·."
   [a b]
   `(clojure.lang.MapEntry. ~a ~b))


add paren

add paren

--- frontend/analytics/facebook.cljs
+++ frontend/analytics/facebook.cljs
@@ -10,5 +10,5 @@
     (if (aget js/window "_fbq")
       (track-conversion)
       (-> (goog.net.jsloader.load "//connect.facebook.net/en_US/fbds.js")
-          (.addCallback track-conversion))))
+          (.addCallback track-conversion)))))


Add bring-up-instances, which now works with NAT instance too.

--- src/acyclic/awstools/core.clj
+++ src/acyclic/awstools/core.clj
@@ -128,13 +128,6 @@
     (mseq->m sirs :request-id)))

-
-
-(defn good-strings [vs]
-  (and (sequential?  vs)
-       (every? string? vs)
-       (every? pos? (map count vs))))
-
 (defn request-instances [rs]
   (let [d (describe-spot-instance-requests :spot-instance-request-ids rs)]
     (map :instance-id (:spot-instance-requests d))))
@@ -155,6 +148,12 @@
   (let [t (stop-instances :instance-ids is)]
     (debug t)
     t))
+
+(defn start [is]
+  (let [t (start-instances :instance-ids is)]
+    (debug t)
+    t))
+

 (defn cancel-requests [rs]
   (let [ds (:spot-instance-requests (describe-spot-instance-requests :spot-instance-request-ids rs))
@@ -203,20 +202,33 @@
   (str
    "aws --region " (or region my-region)
    " sns publish --topic-arn " (or topic my-sns-topic)
-   " --message `(echo \"id: " id "\";bin/ec2-metadata -i -p -o) | base64 -w 0`"))
+   " --message `(echo \"id: " id "\";bin/ec2-metadata -i -p -o) | base64 -w 0`"
+   "\n"))

 ;(stop-instances :instance-ids ["i-7c949193"])
 ;(modify-instance-attribute :instance-id "i-7c949193" :user-data (s->b64 "echo hello"))

+(defn good-strings [vs]
+  (and (sequential?  vs)
+       (every? string? vs)
+       (every? pos? (map count vs))))
+
+
+
+(defn- really-up? [rs->info rs]
+  (let [info (get rs->info rs)]
+    (and
+     (= (:state info) "running")
+     (string? (:ip info))
+     (pos? (count (:ip info))))))

 (defn bring-up-spots  [reqmap nmin cmds & opts]
-  (let [cmd (str (send-up) "\n "(clojure.string/join "\n" cmds))
+  (let [id  (.toString (UUID/randomUUID))
+        cmd (str (send-up id) (clojure.string/join "\n" cmds) "\n")
         req (apply ph-assoc reqmap paths opts)
         req (ph-assoc req paths :udata cmd)
-        ;req (assoc req :nmin nmin)
         n   (ph-get reqmap paths :n)
         req (if (<= nmin n) req (ph-assoc req paths :n nmin))
-        id  (.toString (UUID/randomUUID))
         _   (debug "Requesting:" id req)
         cl  (notify-chan id)
         rs  (request-spots req)
@@ -225,8 +237,9 @@
     (async/go-loop [i 0]
       (if (>= i nmin)
         (let [rs->info (request-info-map rs)
-              rs-up    (filter rs->info rs)
-              rs-dn    (filter (complement rs->info) rs)]
+              pred     (partial really-up? rs->info)
+              rs-up    (filter pred rs)
+              rs-dn    (filter (complement pred) rs)]
           (close-notify-chan! id)
           (cancel-requests rs-dn)
           (map rs->info rs-up))
@@ -237,6 +250,25 @@
                       (cancel-requests rs)
                       nil)
            (= c cl) (recur (inc i))))))))
+
+(defn bring-up-instances [is]
+  (let [n  (count is)
+        id (.toString (UUID/randomUUID))
+        cl (notify-chan id)
+        to (timeout (* 5 60 1000))]
+    (doseq [i is]
+            (modify-instance-attribute :instance-id i :user-data (s->b64 (send-up id))))
+    (start is)
+    (async/go-loop [i n]
+      (if (zero? i)
+        (instance-info-map is)
+        (let [[v c] (async/alts! [cl to])]
+          (cond
+           (= c to) (do (info "Timeout on instance request:" is)
+                        (close-notify-chan! id)
+                        (stop is)
+                        nil)
+           (= c cl) (recur (dec i))))))))

 (def ag (ssh/ssh-agent {}))
@@ -305,279 +337,5 @@
           (>! c req) (close! c)))
     c))

-(comment
-(def my-subnets {"us-east-1c"  "subnet-08eff44e"
-                 "us-east-1a"  "subnet-f290abda"
-                 "us-east-1b"  "subnet-572dd420"})
-(def my-zone    "us-east-1a")
-(def my-req {:spot-price 		0.01
-             :instance-count 		1
-             :type 			"one-time"
-             :launch-specification     {:image-id 	       "ami-5cd51634"
-                                        :instance-type 	       "t1.micro"
-                                        :placement             {:availability-zone my-zone}
-                                        :key-name	       "telekhine"
-                                        :security-groups-ids   ["sg-78deaf1d"]
-                                        :subnet-id             (get my-subnets my-zone)
-                                        :iam-instance-profile  {:arn "arn:aws:iam::633840533036:instance-profile/girder-peer"}}})
-
-
-)
-
-
-#_(defn dns-names [is]
-  (loop [n 5]
-    (let [ds    (:reservations (describe-instances :instance-ids is))
-          names (map #(get-in % [:instances 0 :public-dns-name]) ds)]
-      (cond (or
-           (and (seq names)
-                (= (count names) (count is))
-                (every? string? names))
-           (zero? n))
-        names
-        (zero? n)
-        nil
-        :else
-        (do
-          (Thread/sleep 10000)
-          (recur (dec n)))))))
-
-#_(defn request-spots [n & {:keys [zone itype price image key profile group subnet]}]
-  (let [zone   (or zone "us-east-1c")
-        itype  (or itype "t1.micro")
-        price  (str (or price "0.005"))
-        image  (or image "BLEH")
-        sgs    (if (seq sg) sg [sg])
-        req    [:spot-price 			price
-                :instance-count 		n
-                :type 			"one-time"
-                :launch-specification
-                {:image-id 			image
-                 :instance-type 		itype
-                 :placement {:availability-zone      zone}
-                 :key-name			key
-                 :security-groups-ids	     sgs
-                 :subnet-id                  (get my-subnets zone)
-                 :iam-instance-profile       {:arn "arn:aws:iam::633840533036:instance-profile/girder-peer"}}]
-        (apply request-spot-instances req)]
-    (map :spot-instance-request-id  (:spot-instance-requests r))))
-
-#_(defn patience
-  "Invoke (genfn) every time-wait sec until predicate returns true or time-limit sec has passed.
-Returns result of genfn, or nil in the case of timeout."
-  [pred genfn time-limit time-wait]
-  (let [t1     (if (number? time-limit) (timeout (* 1000 time-limit)) time-limit)
-        out    (chan)]
-    (async/go-loop []
-      (let [r   (genfn)
-            p   (pred r)]
-        (if p
-         (do (debug "Returning" r)
-              (>! out r) (close! out))
-         (let [t2     (timeout (* 1000  time-wait))
-               _      (debug "Still" r "Waiting" time-wait "sec")
-               [v c] (async/alts! [t1 t2])]
-           (if (= c t1)
-             (do
-               (debug time-limit "seconds expired.  Returning nil.")
-               (close! out))
-             (recur))))))
-    out))
-
-
-#_(defn patience-every [pred collfn time-limit time-wait]
-  (patience #(every? pred %) collfn time-limit time-wait))
-
-
-#_(defn- add-sessions [res]
-  (let [out   (chan)
-        tout  (timeout 60000)
-        rs    (:rs res)
-        hosts (:hosts res)
-        sess  (map #(ssh/session ag % {:strict-host-key-checking :no
-                                                  :username "ec2-user"})
-                   hosts)]
-    (async/go-loop []
-      (if (every? ssh/connected? sess)
-        (do (debug "All connected.  Returning.")
-            (>! out (assoc res :sessions sess)))
-        (let
-          (if (= c tout)
-            (do
-              (debug "Failed to establish connections after timeout.  Terminating.")
-              (cancel rs)
-              (close! out))
-            (if #(every? ssh/connected? sess)
-              (do (debug "Returning connected" sess)
-                  (>! out (assoc res :sessions sess)))
-              (do
-                (debug "Waiting 10 sec")
-                (<! (timeout 10000))
-                (recur)))))))
-    out))
-
-
-#_(defn- add-requests [res]
-  (let [req (:req res)
-        out (chan)]
-    (go
-      (let [rs  (request-spots req)]
-        (debug "waiting for" rs "to be active")
-        (<! (timeout 1000))
-        (if (<! (patience-every #(= "active" %) #(request-status rs) 600 60))
-          (do (debug "All instances active! Returning" (assoc res :rs rs))
-              (>! out (assoc res :rs rs)))
-          (give-up-and-cancel res out "Requests failed.")
-)))
-    out))
-
-
-#_(defn request-info [ids]
-  (let [d      (cmd-timeout 5 describe-spot-instance-requests :spot-instance-request-ids (filter #(re-find #"^sir-" %) ids))
-        sirs   (:spot-instance-requests d)
-        rs     (map :spot-instance-request-id sirs)
-        rs->rs (into {} (map #(vector %1 %2) rs0 rs))
-        ss     (map :state sirs)
-        is     (map :instance-id sirs)
-        rs->i  (into {} (map #(vector %1 %2) rs is))
-        is-up  (filter identity is)
-        is-r   (:reservations (describe-instances :instance-ids is-up))
-        is-i   (map #(get-in % [:instances 0]) is-r)
-        ;ip-pub (map :public-ip-address is-i)
-        is-up  (map :instance-id is-i)
-        ip-pri (map :private-ip-address is-i)
-        hosts  (map :public-dns-name is-i)
-        hosts  (map #(when (seq %) %) hosts)
-        i->inf (into {} (map #(vector %1 {:instance %1 :ip %2 :host %3}) is-up ip-pri hosts))
-        ]
-    (map #(merge {:request %1 :status %2} ((comp i->inf rs->i) %1)) rs0 ss)))
-
-
-#_(defn patience
-  "Invoke (genfn) every time-wait sec until predicate returns true or time-limit sec has passed.
-Returns result of genfn, or nil in the case of timeout."
-  [genfn pred failure time-limit time-wait]
-  (let [t1     (timeout (* 1000 time-limit))
-        out    (chan)]
-    (async/go-loop []
-      (let [rc     (go-try (genfn))
-            [v c]  (async/alts! [rc t1 out])]
-        (debug "Ats:" v c)
-        (cond
-         (= c out)                    (do (debug "Canceled")
-                                          (when failure (failure)))
-         (= c t1)                     (do (debug time-limit "sec expired")
-                                          (when failure (failure))
-                                          (close! out))
-         (and (= c rc) v (pred v))    (do (debug "Returning" v)
-                                          (>! out v))
-         :else                        (do (debug "Still" v "Waiting" time-wait)
-                                          (<! (timeout (* 1000 time-wait)))
-                                          (debug "Woke up after wait...")
-                                          (recur)))))
-    out))
-
-
-#_(defn pluck [c]
-  (let [a (atom nil)]
-    (close! (go (let [x (<! c)]
-                  (reset! a x))))
-    a))
-
-
-#_(defn- add-sessions [req]
-  (let [sess (map #(ssh/session ag % {:strict-host-key-checking :no
-                                      :username "ec2-user"})
-                  (:hosts req))]
-    (patience
-     (fn [] (let [sbad (filter #(not (ssh/connected? %)) sess)]
-              (doseq [s sbad] (ssh/connect s))
-              (assoc req :sessions sess)))
-     #(every? ssh/connected? (:sessions %1))
-     nil ;#(give-up-and-cancel req "Failed to add sesions")
-     60 10
-     )))
-
-#_(defn chain-some
-  "Each cfn must be a function of one parameter, returning a channel that will deliver
-its non-nil result, or nil on failure.  Non-nil return values will be progressively passed
-to each cfn in order.  Returns a channel that will contain the result of the final
-cfn or nil, if one of them failed along the way."
-  [x & cfns]
-  (let [out (chan)]
-    (debug "Starting" cfns)
-    (async/go-loop [[f & fs] cfns
-                    x        x]
-      (if-not f
-        (do (debug "Finished" cfns)
-            (>! out x))
-        (let [_ (debug "Invoking" f x)
-              y (<! (f x))]
-          (if-not y
-            (do (debug "Failed at" f)
-                (close! out))
-            (recur fs y)))))
-    out))
-
-
-;;
-#_(defn bring-up-aws
-  "Bring up n AWS t1.micro instances and return channel that will contain a single map
-of {:instance ids :hosts names and :sessions objects}, with appropriate timeouts.
-Returns a channel that will contain a map of :hosts, :sessions, etc or nil."
-  [reqmap nmin & opts]
-  (let [req (apply ph-assoc reqmap paths opts)
-        req (assoc req :nmin nmin)
-        n    (ph-get reqmap paths :n)
-        req (if (<= nmin n) req (ph-assoc req paths :n nmin))]
-    (debug "Bringing up" req)
-    (chain-some {:req req} add-requests; add-instances add-ips add-hosts
-                )
-    ))
-;; add-sessions
-
-
-
-#_(defn- add-requests [req]
-  (let [req (assoc req :rs (request-spots (:req req)))]
-    (patience
-     #(assoc req :req-status (cmd-timeout 5 request-status (:rs req)))
-     (fn [req] (let [rss (:req-status req)]
-                 (and (seq rss) (every? #(= "active" %) rss))))
-   #(give-up-and-cancel req "Failed to fulfill spot requests")
-   600 60)))
-
-#_(defn- add-instances [req]
-  (patience
-   #(assoc req :is (request-instances (:rs req)))
-   #(good-strings (:is %))
-   #(give-up-and-cancel req "Failed to get instance ids")
-   10 1))
-
-
-#_(defn- add-hosts [req]
-  (patience
-   (fn [] (assoc req :hosts (->> (:is req)
-                                 (describe-instances :instance-ids)
-                                 :reservations
-                                 (map #(get-in % [:instances 0 :public-dns-name])))))
-   #(good-strings (:hosts %))
-   #(give-up-and-cancel req "Failed to get hosts.")
-   10 1))
-
-
-#_(defn- add-ips [req]
-  (patience
-   (fn [] (assoc req :ips (->> (:is req)
-                                 (describe-instances :instance-ids)
-                                 :reservations
-                                 (map #(get-in % [:instances 0 :private-ip-address])))))
-   #(good-strings (:ips %))
-   #(give-up-and-cancel req "Failed to get IPs")
-   10 1))
-
-#_(defn- give-up-and-cancel [req & [msg]]
-  (when msg (debug msg))
-  (concat  (some-> req :is terminate)
-           (some-> req :rs cancel)))
-
+
+


Fixed collection predicate (by word number now).

--- src/wat/database.clj
+++ src/wat/database.clj
@@ -5,6 +5,18 @@
 (defn define-attributes [c]
   (d/transact c
               [{:db/id (d/tempid :db.part/db)
+                :db/ident :project/name
+                :db/valueType :db.type/string
+                :db/cardinality :db.cardinality/one
+                :db/doc "Project name text line belongs to."
+                :db.install/_attribute :db.part/db}
+               {:db/id (d/tempid :db.part/db)
+                :db/ident :line/id
+                :db/valueType :db.type/bigint
+                :db/cardinality :db.cardinality/one
+                :db/doc "Text line number."
+                :db.install/_attribute :db.part/db}
+               {:db/id (d/tempid :db.part/db)
                 :db/ident :line/translator
                 :db/valueType :db.type/string
                 :db/cardinality :db.cardinality/one
@@ -29,25 +41,6 @@
                 :db/doc "Female translated text line."
                 :db.install/_attribute :db.part/db}]))

-(defn create-line [original-text male-text female-text translator]
-  {:db/id (d/tempid :db.part/user)
-   :line/original original-text
-   :line/male male-text
-   :line/female female-text
-   :line/translator translator})
-
-(defn get-2000 [coll]
-  (println coll)
-  (let [sum (atom 0)]
-    (reduce (fn [x y] (println (:line/original (d/touch (d/entity (d/db conn) y))))
-              (if (< @sum 1980)
-                (do
-                  (swap! sum + (count (:line/original (d/touch (d/entity (d/db conn) y)))))
-                  (conj x y))
-              x))
-          []
-          coll)))
-
 (defonce connect-to-db-server
   (let [db-name "test-db"
         uri (str "datomic:free://localhost:3131/" db-name)
@@ -59,17 +52,38 @@
       (println "Database" db-name "already exist, its fine."))
     (println "Connection established!")))

+(defn create-line [id original-text male-text female-text translator]
+  {:db/id (d/tempid :db.part/user)
+   :project/name "default"
+   :line/id id
+   :line/original original-text
+   :line/male male-text
+   :line/female female-text
+   :line/translator translator})
+
+(defn get-n-words [n coll]
+  (let [sum (atom 0)
+        db (d/db conn)]
+    (reduce (fn [x y]
+              (if (< @sum n)
+                (do
+                  (swap! sum + (count (clojure.string/split (:line/original (d/touch (d/entity db y))) #"\s")))
+                  (conj x y))
+              x))
+          []
+          coll)))
+
 (defn get-dummy-info []
-  (define-attributes conn)
+  #_
   @(d/transact ; add entry
     conn
     [(create-line "wolololol" "" "" "noone")])
   (println ">")
-  (println (str (d/q '[:find (wat.database/get-2000 ?e) . ;; find all untranslated entries and collect till have 2000 symbols or shit
+  (println (str (d/q '[:find (wat.database/get-n-words 3 ?e) . ;; find all untranslated entries and collect till have n words
                        :where [?e :line/translator "noone"]]
                      (d/db conn))))
   (println "<")
-  (str "messing with datomic"))
+  (str "Hello there, big brother greets you!"))

 (defn get-project-list []
   "Project list, duh.")


Fix websocket echo example.

Fix websocket echo example.

Related to issue #44.

--- examples/websocket-echo/src/websocket_echo/core.clj
+++ examples/websocket-echo/src/websocket_echo/core.clj
@@ -3,7 +3,7 @@
             [clojure.java.io :as io]
             [cheshire.core :as json]
             [catacumba.core :as ct]
-            [catacumba.handlers :as hs]
+            [catacumba.handlers.misc :refer (autoreloader)]
             [catacumba.http :as http]))

 (defn home-handler
@@ -26,9 +26,9 @@
         (close! out)))))

 (def app
-  (ct/routes [[:any (hs/autoreloader)]
-              [:get #'home-handler]
-              [:get "ws" #'websocket-handler]]))
+  (ct/routes [[:any (autoreloader)]
+              [:get "ws" #'websocket-handler]
+              [:get #'home-handler]]))

 (defn -main
   "The main entry point to your application."


predicate back to Juand and i

predicate back to Juand and i

instead of Juan and I

--- src/babel/espanol/lexicon.clj
+++ src/babel/espanol/lexicon.clj
@@ -285,7 +285,7 @@
                        :person :1st
                        :number :plur}
                  :sem {:human true
-                       :pred :Juan-and-I}
+                       :pred :Juan-and-i}
                  :subcat '()}}]

    "la"


fix typo

fix typo

--- src/babel/espanol/lexicon.clj
+++ src/babel/espanol/lexicon.clj
@@ -2,7 +2,7 @@
   (:refer-clojure :exclude [get-in])
   (:require
    [babel.lexiconfn :refer [compile-lex map-function-on-map-vals unify]]
-   [babel.italiano.morphology :as morph]
+   [babel.espanol.morphology :as morph]
    [babel.espanol.pos :refer :all]
    [dag-unify.core :refer [get-in]]))


CMR-3457: Removed a unused namespace

CMR-3457: Removed a unused namespace

--- system-int-test/src/cmr/system_int_test/data2/atom.clj
+++ system-int-test/src/cmr/system_int_test/data2/atom.clj
@@ -8,7 +8,6 @@
    [clojure.string :as str]
    [cmr.common.concepts :as cu]
    [cmr.common.util :as util]
-   [cmr.common.joda-time :as joda-time]
    [cmr.common.xml :as cx]
    [cmr.search.results-handlers.atom-results-handler :as atom-results-handler]
    [cmr.spatial.line-string :as l]


Format project.clj

Format project.clj

--- frontend/project.clj
+++ frontend/project.clj
@@ -2,7 +2,7 @@
   :description "FIXME: write this!"
   :url "http://example.com/FIXME"
   :license {:name "Eclipse Public License"
-            :url "http://www.eclipse.org/legal/epl-v10.html"}
+            :url  "http://www.eclipse.org/legal/epl-v10.html"}

   :min-lein-version "2.6.1"

@@ -27,39 +27,39 @@
   :clean-targets ^{:protect false} ["resources/public/js/compiled" "target"]

   :cljsbuild {:builds
-              [{:id "dev"
+              [{:id           "dev"
                 :source-paths ["src/cruncher"]
-                :figwheel {:on-jsload "cruncher.core/on-js-reload"
-                           :open-urls ["http://localhost:3449/index.html"]}
-                :compiler {:main cruncher.core
-                           :preloads [devtools.preload]
-                           :asset-path "js/compiled/out"
-                           :output-to "resources/public/js/compiled/cruncher.js"
-                           :output-dir "resources/public/js/compiled/out"
-                           :source-map-timestamp true}}
-               {:id "devcards"
+                :figwheel     {:on-jsload "cruncher.core/on-js-reload"
+                               :open-urls ["http://localhost:3449/index.html"]}
+                :compiler     {:main                 cruncher.core
+                               :preloads             [devtools.preload]
+                               :asset-path           "js/compiled/out"
+                               :output-to            "resources/public/js/compiled/cruncher.js"
+                               :output-dir           "resources/public/js/compiled/out"
+                               :source-map-timestamp true}}
+               {:id           "devcards"
                 :source-paths ["src/cruncher" "src/devcards"]
-                :figwheel {:devcards true}
-                :compiler {:main cruncher.devcards.core
-                           :asset-path "js/compiled/devcards/out"
-                           :output-to "resources/public/js/compiled/cruncher.js"
-                           :output-dir "resources/public/js/compiled/devcards/out"
-                           :source-map-timestamp true}}
+                :figwheel     {:devcards true}
+                :compiler     {:main                 cruncher.devcards.core
+                               :asset-path           "js/compiled/devcards/out"
+                               :output-to            "resources/public/js/compiled/cruncher.js"
+                               :output-dir           "resources/public/js/compiled/devcards/out"
+                               :source-map-timestamp true}}
                ;; This next build is an compressed minified build for
                ;; production. You can build this with:
                ;; lein cljsbuild once min
-               {:id "min"
+               {:id           "min"
                 :source-paths ["src"]
-                :compiler {:output-to "resources/public/js/compiled/cruncher.js"
-                           :main cruncher.core
-                           :optimizations :advanced
-                           :pretty-print false}}]}
+                :compiler     {:output-to     "resources/public/js/compiled/cruncher.js"
+                               :main          cruncher.core
+                               :optimizations :advanced
+                               :pretty-print  false}}]}

   :figwheel {;; :http-server-root "public" ;; default and assumes "resources"
              ;; :server-port 3449 ;; default
              ;; :server-ip "127.0.0.1"

-             :css-dirs ["resources/public/css"] ;; watch and update CSS
+             :css-dirs ["resources/public/css"]             ;; watch and update CSS

              ;; Start an nREPL server into the running figwheel process
              ;; :nrepl-port 7888
@@ -103,7 +103,7 @@
                    ;; for CIDER
                    ;; :plugins [[cider/cider-nrepl "0.12.0"]]
                    :repl-options {; for nREPL dev you really need to limit output
-                                  :init (set! *print-length* 50)
+                                  :init             (set! *print-length* 50)
                                   :nrepl-middleware [cemerick.piggieback/wrap-cljs-repl]}}}

-)
+  )


adding template api

adding template api

--- src/celestial/api/systems.clj
+++ src/celestial/api/systems.clj
@@ -29,10 +29,19 @@

 (import-logging)

+(defmodel template
+  :type :string
+  :machine {:type "Machine"}
+  :aws {:type "Aws" :description "An EC2 based system"}
+  :physical {:type "Physical" :description "A physical machine"}
+  :openstack {:type "Openstack" :description "An openstack based instance"}
+  :proxmox {:type "Proxmox" :description "A Proxmox based system"}
+  :vcenter {:type "Vcenter" :description "A vCenter based system"})
+
 (defmodel system
   :env :string
   :type :string
-  :user :string
+  :owner :string
   :machine {:type "Machine"}
   :aws {:type "Aws" :description "An EC2 based system"}
   :physical {:type "Physical" :description "A physical machine"}
@@ -73,6 +82,10 @@

 (defc "/systems" [:env] (keyword v))

+(defc "/templates" [:machine :os] (keyword v))
+
+(defc "/templates" [:proxmox :type] (keyword v))
+
 (defn working-username  []
    (let [{:keys [username]} (current-user)] username))

@@ -137,11 +150,37 @@
         (success (t/get-type (:type (s/get-system id))))))

 (defroutes- systems-admin {:path "/systems" :description "Operations on Systems"}
-
   (POST- "/systems/reindex" []
     {:nickname "reindexSystems" :summary "Trigger search re-index of all systems available for user" }
-      (wrap-errors (success (s/re-index (working-username)))))
+      (wrap-errors (success (s/re-index (working-username))))))

+(defroutes- templates {:path "/templates" :description "Operations on templates"}
+  (POST- "/templates" [& ^:template spec] {:nickname "addTemplate" :summary "Add template"
+     :errorResponses (errors {:bad-req "Missing system type"})}
+    (wrap-errors
+      (let [id (s/add-template spec)]
+        (success {:message "new template saved" :id id}))))
+
+  (GET- "/templates/:id" [^:int id] {:nickname "getTemplate" :summary "Get template by id"}
+     (success (s/get-template id)))
+
+  (DELETE- "/templates/:id" [^:int id] {:nickname "deleteTemplate" :summary "Delete Template"
+                                          :errorResponses (errors {:bad-req "Template does not exist"})}
+     (try+
+        (let [spec (s/get-template! id) int-id (Integer/valueOf id)]
+          (s/delete-template! int-id)
+          (success {:message "Template deleted"}))
+       (catch [:type :celestial.persistency/missing-template] e
+          (bad-req {:message "Template does not exist"}))))
+
+  (PUT- "/templates/:id" [^:int id & ^:template template] {:nickname "updateTemplate" :summary "Update template"
+                                                         :errorResponses (errors {:conflict "Template does not exist"}) }
+        (if-not (s/template-exists? id)
+          (conflict {:message "Template does not exists, use POST /host/template first"})
+          (wrap-errors
+            (s/update-template (Integer/valueOf id) template)
+            (success {:message "template updated" :id id}))))
+
   )

 (defroutes- environments {:path "/environments" :description "Operations on environments"}


remove debug info

remove debug info

--- src/ceres_collector/mongo.clj
+++ src/ceres_collector/mongo.clj
@@ -87,7 +87,6 @@

 (defn store [db db-entry]
-  (info (:type db-entry) " -> " (:value db-entry))
   (mc/insert-and-return db (type->coll (:type db-entry)) (assoc (:value db-entry) :ts (t/now))))


fully implement Tinkering

fully implement Tinkering

--- src/clj/game/cards-events.clj
+++ src/clj/game/cards-events.clj
@@ -542,8 +542,29 @@
                :msg (msg "gain " (* 2 (count (:successful-run runner-reg))) " [Credits]")}}

    "Tinkering"
-   {:choices {:req #(and (has? % :type "ICE") (= (first (:zone %)) :servers))}
-    :msg (msg "give " (if (:rezzed target) (:title target) "an ice") " sentry, code gate, and barrier until the end of turn")}
+   {:prompt "Choose a piece of ICE"
+    :choices {:req #(and (= (last (:zone %)) :ices) (= (:type %) "ICE"))}
+    :effect (req (let [ice target
+                       serv (cond
+                             (= (second (:zone ice)) :hq) "HQ"
+                             (= (second (:zone ice)) :rd) "R&D"
+                             (= (second (:zone ice)) :archives) "Archives"
+                             :else (join " " ["Server" (last (butlast (:zone ice)))]))
+                       stypes (:subtype ice)]
+              (resolve-ability
+                 state :runner
+                 {:msg (msg "give sentry, code gate, and barrier to " (if (:rezzed ice) (:title ice) "the ICE at position ")
+                              (ice-index state ice) " of " serv " until the end of the turn")
+                  :effect (effect (update! (assoc ice :subtype
+                                                      (->> (vec (.split (:subtype ice) " - "))
+                                                           (concat ["Sentry" "Code Gate" "Barrier"])
+                                                           distinct
+                                                           (join " - "))))
+                                  (register-events {:runner-turn-ends
+                                                    {:effect (effect (update! (assoc (get-card state ice) :subtype stypes)))}}
+                                  (assoc card :zone '(:discard))))}
+               card nil)))
+    :events {:runner-turn-ends nil}}

    "Trade-In"
    {:prompt "Choose a hardware to trash" :choices {:req #(and (:installed %) (= (:type %) "Hardware"))}


Factory API, convert recipient emails to lower case

--- src/clj/salava/factory/db.clj
+++ src/clj/salava/factory/db.clj
@@ -16,12 +16,12 @@
 (defn get-uids-by-emails [ctx emails]
   (let [email-chunks (partition-all 100 emails)
         result (map #(select-uids-emails-by-emails {:emails %} (u/get-db ctx)) email-chunks)]
-    (reduce (fn [coll v] (assoc coll (:email v) (:user_id v))) {} (flatten result))))
+    (reduce (fn [coll v] (assoc coll (string/lower-case (:email v)) (:user_id v))) {} (flatten result))))

 (defn primary-emails-by-uids [ctx uids]
   (let [uid-chunks (partition-all 100 uids)
         result (map #(select-primary-emails-by-uids {:user_ids %} (u/get-db ctx)) uid-chunks)]
-    (reduce (fn [coll v] (assoc coll (:user_id v) (:email v))) {} (flatten result))))
+    (reduce (fn [coll v] (assoc coll (:user_id v) (string/lower-case (:email v)))) {} (flatten result))))

 (defn get-user-emails
   ""


use H2 for report titles

use H2 for report titles

--- src/clj_money/web/reports.clj
+++ src/clj_money/web/reports.clj
@@ -47,7 +47,7 @@
 (defmethod render-report :income-statement
   [{:keys [entity-id start-date end-date]}]
   (html
-    [:h1 (format "Income Statement: %s to %s"
+    [:h2 (format "Income Statement: %s to %s"
                  (format-date start-date)
                  (format-date end-date))]
     [:table.table.table-striped
@@ -59,7 +59,7 @@
 (defmethod render-report :balance-sheet
   [{:keys [entity-id as-of]}]
   (html
-    [:h1 (format "Balance Sheet as of %s" (format-date as-of))]
+    [:h2 (format "Balance Sheet as of %s" (format-date as-of))]
     [:table.table.table-striped
      (map report-row (reports/balance-sheet (env :db)
                                             entity-id
@@ -89,7 +89,7 @@
         as-of (or as-of
                   (budgets/end-date budget))]
     (html
-      [:h1 (format "Budget %s as of %s" (:name budget) (format-date as-of))]
+      [:h2 (format "Budget %s as of %s" (:name budget) (format-date as-of))]
       [:table.table
        [:tr
         [:th "Account"]


Added problem-specific-report printing to final-report for testing the simplified solution on the test data.

--- src/clojush/pushgp/report.clj
+++ src/clojush/pushgp/report.clj
@@ -357,11 +357,15 @@
 (defn final-report
   "Prints the final report of a PushGP run if the run is successful."
   [generation best
-   {:keys [error-function final-report-simplifications print-ancestors-of-solution]}]
+   {:keys [error-function final-report-simplifications report-simplifications
+           print-ancestors-of-solution problem-specific-report]}]
   (printf "\n\nSUCCESS at generation %s\nSuccessful program: %s\nErrors: %s\nTotal error: %s\nHistory: %s\nSize: %s\n\n"
           generation (pr-str (not-lazy (:program best))) (not-lazy (:errors best)) (:total-error best)
           (not-lazy (:history best)) (count-points (:program best)))
   (when print-ancestors-of-solution
     (printf "\nAncestors of solution:\n")
     (prn (:ancestors best)))
-  (auto-simplify best error-function final-report-simplifications true 500))
+  (let [simplified-best (auto-simplify best error-function final-report-simplifications true 500)]
+    (println "\n;;******************************")
+    (println ";; Problem-Specific Report of Simplified Solution"
+    (problem-specific-report simplified-best [] generation error-function report-simplifications)))


unit test fixes.

unit test fixes.

--- test/metabase/api/meta/table_test.clj
+++ test/metabase/api/meta/table_test.clj
@@ -129,6 +129,7 @@
                         :organization_id nil
                         :description     nil})
        :name         "CATEGORIES"
+       :display_name "Categories"
        :fields       [(match-$ (Field (id :categories :id))
                         {:description     nil
                          :table_id        (id :categories)
@@ -207,6 +208,7 @@
                         :organization_id nil
                         :description     nil})
        :name         "USERS"
+       :display_name "Users"
        :fields       [(match-$ (sel :one Field :id (id :users :id))
                         {:description     nil
                          :table_id        (id :users)
@@ -318,6 +320,7 @@
                         :organization_id nil
                         :description     nil})
        :name         "USERS"
+       :display_name "Users"
        :fields       [(match-$ (Field (id :users :id))
                         {:description     nil
                          :table_id        (id :users)
@@ -418,13 +421,14 @@
        :name        "USERS"
        :rows        15
        :updated_at  $
+       :entity_name nil
        :display_name "Userz"
        :active      true
        :pk_field    (deref $pk_field)
        :id          $
        :db_id       (db-id)
        :created_at  $})
-  (do ((user->client :crowberto) :put 200 (format "meta/table/%d" (id :users)) {:entity_name "Userz"
+  (do ((user->client :crowberto) :put 200 (format "meta/table/%d" (id :users)) {:display_name "Userz"
                                                                                :entity_type "person"
                                                                                :description "What a nice table!"})
       ((user->client :crowberto) :get 200 (format "meta/table/%d" (id :users)))))


Added pmouse-x and p-mouse-y

Added pmouse-x and p-mouse-y

--- rosado/processing/processing.clj
+++ rosado/processing/processing.clj
@@ -490,6 +490,10 @@
   ([] (.perspective *applet*))
   ([fovy aspect z-near z-far]
 	 (.perspective *applet* (float fovy) (float aspect) (float z-near) (float z-far))))
+
+(defn pmouse-x [] (.pmouseX *applet*))
+
+(defn pmouse-y [] (.pmouseY *applet*))

 (defn point
   ([x y] (.point *applet* (float x)(float y)))


Added redraw function

Added redraw function

--- rosado/processing/processing.clj
+++ rosado/processing/processing.clj
@@ -531,7 +531,8 @@

 (defn red [what] (.red *applet* (int what)))

-;; $$redraw
+(defn redraw [] (.redraw *applet*))
+
 ;; $$registerDispose
 ;; $$registerDraw
 ;; $$reqisterKeyEvent


implementing foob

implementing foob

--- test/synthesis_crawlers/core_test.clj
+++ test/synthesis_crawlers/core_test.clj
@@ -138,6 +138,13 @@
       (is (= (result "http://piyo.com") {:title []}))
       )))

+(deftest find-container-nodes-test
+  (testing "finds nodes which can be candidates of conainters"
+    (is (= (find-container-nodes
+             {"http://foo.com" "<html></html>"}
+             {"http://foo.com" {:title [(first (.getAllElements (Jsoup/parse "")))]}})
+           nil))))
+
 #_(deftest a-test
     (testing ""
       (is (= nil


send the SHA in the request payload

send the SHA in the request payload

--- src-cljs/frontend/controllers/controls.cljs
+++ src-cljs/frontend/controllers/controls.cljs
@@ -476,8 +476,9 @@
   (let [vcs-type (vcs-url/vcs-type vcs-url)
         uuid frontend.async/*uuid*]
     (go
-      (let [api-result (<! (ajax/managed-ajax :put (gstring/format "/api/v1.1/project/%s/%s/%s/pulls/%s/merge?sha=%s"
-                                                                   vcs-type owner repo number sha)))]
+      (let [api-result (<! (ajax/managed-ajax :put (gstring/format "/api/v1.1/project/%s/%s/%s/pulls/%s/merge"
+                                                                   vcs-type owner repo number)
+                                              :params {:sha sha}))]
         (if (= :success (:status api-result))
           (.log js/console "SUCCESS" (-> api-result :resp :body :message))
           (.log js/console "ERROR" (-> api-result :response :resp :message)))))))


Display submission statuses directly

Display submission statuses directly

--- src/cljs/org/broadinstitute/firecloud_ui/page/workspace/summary/tab.cljs
+++ src/cljs/org/broadinstitute/firecloud_ui/page/workspace/summary/tab.cljs
@@ -173,23 +173,13 @@
       (style/create-section-header "Analysis Submissions")
       (style/create-paragraph
         (let [count-all (count submissions)
-              success-count (->> submissions (filter all-success?) count)
-              running-count (->> submissions (filter any-running?) count)
-              fail-count (->> submissions (filter any-failed?) count)
-              unknown-count (- count-all success-count running-count fail-count)]
+              grouped-by-status (group-by #(% "status") submissions)]
              [:div {}
               (str count-all " Submission" (when-not (= 1 count-all) "s"))
-              (when (or (pos? fail-count) (pos? running-count) (pos? success-count) (pos? unknown-count))
+              (when (pos? count-all)
                     [:ul {:style {:marginTop "0"}}
-                     (when (pos? success-count)
-                           [:li {} (str success-count " succeeded")])
-                     (when (pos? fail-count)
-                           [:li {} (str fail-count " failed")])
-                     (when (pos? running-count)
-                           [:li {} (str running-count " running")])
-                     (when (pos? unknown-count)
-                           [:li {} (str unknown-count " unknown")])])]))]]))
-
+                     (for [[status subs] grouped-by-status]
+                        [:li {} (str (count subs) " " status)])])]))]]))

 (react/defc Summary
   {:refresh


CMR-1415: Fixed typo

CMR-1415: Fixed typo

--- system-int-test/test/cmr/system_int_test/search/collection_concept_revision_search_test.clj
+++ system-int-test/test/cmr/system_int_test/search/collection_concept_revision_search_test.clj
@@ -185,7 +185,7 @@
           (is (= #{"Concept revision searches are not supported for granules."}
                  (set errors)))))

-      (testing "uknown parameter"
+      (testing "unknown parameter"
         (let [{:keys [status errors]} (search/get-search-failure-data
                                         (search/find-concept-revisions
                                           :collection


search-term now allows >1 filter on same field

--- src-cljs/core.cljs
+++ src-cljs/core.cljs
@@ -4,6 +4,7 @@
   (:import [goog.net XhrIo])
   (:require [goog.events :as events]
             [clojure.string :as string]
+            [clojure.set :as set]
             [cljs.core.async :as async :refer [>! <! put! chan]]
             [om.core :as om :include-macros true]
             [om.dom :as dom :include-macros true]
@@ -24,7 +25,7 @@
 (def app-state
   (atom
     {:search {
-              :term {}
+              :term #{}
               :results []
               }
      :player-queue []
@@ -64,13 +65,15 @@
             artist (dom/span
                     #js {:className "artist"
                          :onClick #(put! search-chan
-                                         {:artist (get @track "artist")})}
+                                         [:add
+                                          [[:artist (get @track "artist")]]])}
                     (get track "artist"))
             album (dom/span
                    #js {:className "album"
                         :onClick #(put! search-chan
-                                        {:artist (get @track "artist")
-                                         :album (get @track "album")})}
+                                        [:add
+                                         [[:artist (get @track "artist")]
+                                          [:album (get @track "album")]]])}
                    (get track "album"))
             title (dom/span #js {:className "title"}
                             (str (get track "track") " - " (get track "title")))
@@ -173,7 +176,8 @@
       (let [search-chan (om/get-shared owner :search-channel)
             send-search (fn [e]
                           (let [str (.. e -target -value)]
-                            (put! search-chan {:_content str})))]
+                            (if-not (empty? str)
+                              (put! search-chan [:add [[:_content str]]]))))]
         (dom/div nil
                  (dom/h1
                   #js {:id "sledge"}
@@ -196,7 +200,7 @@
                         (map #(dom/span #js {:className "filter"
                                              :onClick
                                              (fn [e] (put! search-chan
-                                                           {(first %) nil}))}
+                                                           [:drop [%]]))}
                                         (str (name (first %)) ": " (second  %)))
                              (filter second term))))))))

@@ -226,13 +230,19 @@
                                  })
                  )))))

+(defn update-term [[command new-terms] previous]
+  (case command
+    :add (set/union previous (set new-terms))
+    :drop (set/difference previous new-terms)))
+
+
 (defn search-view [search owner]
   (reify
     om/IWillMount
     (will-mount [_]
       (let [channel (om/get-shared owner :search-channel)]
         (go (loop []
-              (let [search-for (merge (:term @search) (<! channel))
+              (let [search-for (update-term (<! channel) (:term @search))
                     _ (om/update! search [:term] search-for)
                     tracks (<! (xhr-search search-for))
                     sorted (sorted-tracks tracks)]


remove calls to mobile?

remove calls to mobile?

--- src-cljs/core.cljs
+++ src-cljs/core.cljs
@@ -19,10 +19,6 @@
       480 :phone
       600 :tablet
       :desktop)))
-
-(defn mobile? []
-  true
-  #_(= (detect-platform) :phone))

 (def app-state
   (atom
@@ -119,9 +115,8 @@
             duration (dom/span #js {:className "duration"} (mmss (get track "length")))
             button (dom/button #js {:onClick #(enqueue-track @track)} "+")]
         (apply dom/div #js {:className "track"}
-               (if (mobile?)
-                 [title artist album duration button]
-                 [artist album title duration button]))))))
+               [title artist album duration button]
+               )))))

 (defn xhr-search [term]
@@ -160,21 +155,13 @@
                     "+")
             track-components
             (om/build-all results-track-view tracks)]
-        (if (mobile?)
-          (apply dom/div #js {:className "results tracks" }
-                 (dom/div #js {:className "track"}
-                          (dom/span {:id "queue-all-tracks"}
-                                    "Queue all tracks")
-                          button)
-                 track-components)
-          (apply dom/div #js {:className "results tracks" }
-                 (dom/div #js {:className "track header"}
-                          (dom/span #js {:className "artist"} "Artist")
-                          (dom/span #js {:className "album"} "Album" )
-                          (dom/span #js {:className "title"} "Title")
-                          (dom/span #js {:className "duration"} "Length")
-                          button)
-                 track-components))))
+        (apply dom/div #js {:className "results tracks" }
+               (dom/div #js {:className "track"}
+                        (dom/span {:id "queue-all-tracks"}
+                                  "Queue all tracks")
+                        button)
+               track-components)
+        ))
     ))


Adding unit test for new addToClasspath method

--- storm-core/test/clj/org/apache/storm/supervisor_test.clj
+++ storm-core/test/clj/org/apache/storm/supervisor_test.clj
@@ -502,7 +502,26 @@
                                     (Matchers/eq full-env)
                                     (Matchers/any)
                                     (Matchers/any)
-                                    (Matchers/any)))))))))
+                                    (Matchers/any))))))
+
+      (testing "testing addToClasspath(Collection<String>, Collection<String>)"
+        (let [firstpart (java.util.ArrayList. ["a" "b" "c"])
+              secondpart (java.util.ArrayList. ["d" "e" "f"])
+              ^java.util.ArrayList nillist nil]
+          (is (= (Utils/addToClasspath firstpart secondpart)
+                 "a:b:c:d:e:f"))
+          (is (= (Utils/addToClasspath [] secondpart)
+                 "d:e:f"))
+          (is (= (Utils/addToClasspath nillist secondpart)
+                 "d:e:f"))
+          (is (= (Utils/addToClasspath firstpart [])
+                 "a:b:c"))
+          (is (= (Utils/addToClasspath firstpart nillist)
+                 "a:b:c"))
+          (is (= (Utils/addToClasspath [] [])
+                 ""))
+          (is (= (Utils/addToClasspath nillist nillist)
+                 "")))))))

 (deftest test-worker-launch-command-run-as-user
   (testing "*.worker.childopts configuration"


distinguish between authored and active forks in summary

--- src/github_authors/github.clj
+++ src/github_authors/github.clj
@@ -55,6 +55,7 @@
                              (map #(/ (difference-in-hours (:created_at %) (:closed_at %)) 24.0))
                              (apply +))]
     {:full-name (:full_name repo)
+     :fork (:fork repo)
      :count-total total
      :count-closed (count closed)
      :count-open (count open)
@@ -140,10 +141,12 @@
   (send-to
    "message"
    (format
-    "%s has authored %s repositories. See their total stats."
+    "%s has %s repositories: %s are authored and %s are active forks. See their stats."
     user
     user
-    (count repos))))
+    (count repos)
+    (count (remove :fork repos))
+    (count (filter :fork repos)))))

 (defn- fetch-repo-and-send-row [send-to user repo]
   (let [repo-map (memoized-fetch-repo-info user repo)]
@@ -157,7 +160,7 @@
   (let [active-repos (memoized-fetch-authored-repos-and-active-forks user)
         send-to (partial send-event-fn sse-context)]
     (send-to "message"
-             (format "%s has %s authored repos. Fetching data..."
+             (format "%s has %s repositories. Fetching data..."
                      user (count active-repos)))
     (->> active-repos
          (mapv (partial fetch-repo-and-send-row send-to user))


[#12008] "Community information is not found" after opening community view from home

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

--- src/status_im/ui/screens/communities/views.cljs
+++ src/status_im/ui/screens/communities/views.cljs
@@ -35,7 +35,7 @@
                                              (when last?
                                                {:border-bottom-color (quo.colors/get-color :ui-01)
                                                 :border-bottom-width 1}))
-                            :on-press (fn [id]
+                            :on-press (fn []
                                         (>evt [:dismiss-keyboard])
                                         (>evt [:navigate-to :community {:community-id id}]))}
    [:<>


Fix wrong call to when in unless implementations.

Wrong parameters number.

--- src/cats/core.cljc
+++ src/cats/core.cljc
@@ -160,7 +160,7 @@
   ([b mv]
    (when (not b) mv))
   ([ctx b mv]
-   (when ctx (not b) b mv)))
+   (when ctx (not b) mv)))

 (defn lift
   "Lift a value from the inner monad of a monad transformer


bind docstring updates

bind docstring updates

--- src/cats/core.cljc
+++ src/cats/core.cljc
@@ -96,16 +96,16 @@
   ([ctx v] (p/mreturn ctx v)))

 (defn bind
-  "Given a value inside monadic context `mv` and any function,
-  applies a function to value of mv.
+  "Given a monadic value `mv` and a function `f`,
+  apply `f` to the unwrapped value of `mv`.

       (bind (either/right 1) (fn [v]
                                (return (inc v))))
       ;; => #<Right [2]>

-  For convenience, you may prefer use a `mlet` macro
-  that add a beautiful, let like syntax for
-  compose operations with `bind` function."
+  For convenience, you may prefer to use the `mlet` macro,
+  which provides a beautiful, `let`-like syntax for
+  composing operations with the `bind` function."
   [mv f]
   (let [ctx (ctx/get-current mv)]
     (ctx/with-context ctx


making rpc errors also the :response type so they come back on the same response-channel.

--- src/plasma/rpc.clj
+++ src/plasma/rpc.clj
@@ -22,6 +22,7 @@
             val))
   {:type :response
    :id (:id req)
+   :error nil
    :result val})

 (defn rpc-event
@@ -36,8 +37,9 @@
   "An RPC error for the given request."
   [req msg & [data]]
   (log/to :rpc "rpc-error[" (trim-id (:id req)) "]: " msg)
-  {:type :error
+  {:type :response
    :id (:id req)
+   :result nil
    :error {:message msg
            :data data}})


upgrade puget to latest point release

upgrade puget to latest point release

--- boot/worker/build.boot
+++ boot/worker/build.boot
@@ -1,7 +1,7 @@
 (set-env!
  :source-paths #{"src" "test"}
  :dependencies '[[net.cgrand/parsley          "0.9.3" :exclusions [org.clojure/clojure]]
-                 [mvxcvi/puget                "1.1.0"]
+                 [mvxcvi/puget                "1.1.1"]
                  [reply                       "0.4.3"]
                  [cheshire                    "5.8.1"]
                  [clj-jgit                    "0.8.10"]


install app.cljs if neither +om nor +reagent is specified

--- src/leiningen/new/tenzing.clj
+++ src/leiningen/new/tenzing.clj
@@ -59,6 +59,9 @@

 (defn garden? [opts]
   (some #{"+garden"} opts))
+
+(defn cljs-lib? [opts]
+  (or (om? opts) (reagent? opts)))

 (defn source-paths [opts]
   (cond-> #{"src/cljs"}
@@ -144,6 +147,7 @@
                            (if (sass? opts)    ["sass/styles.sass" (render "styles.sass" data)])
                            (if (reagent? opts) [app-cljs (render "reagent-app.cljs" data)])
                            (if (om? opts)      [app-cljs (render "om-app.cljs" data)])
+                           (if (not (cljs-lib? opts)) [app-cljs (render "app.cljs" data)])

                            ["resources/index.html" (render "index.html" data)]
                            ["build.boot" (render "build.boot" data)])))))


Fixed method name of io.aeron Context introduced by https://github.com/real-logic/aeron/wiki/Change-Log#141-25-aug-2017

--- src/lib_onyx/media_driver.clj
+++ src/lib_onyx/media_driver.clj
@@ -36,7 +36,7 @@
                     Use -t to supply an alternative threading mode.")
         ctx (cond-> (MediaDriver$Context.)
               threading-mode (.threadingMode threading-mode-obj)
-              delete-dirs (.dirsDeleteOnStart delete-dirs))
+              delete-dirs (.dirDeleteOnStart delete-dirs))
         media-driver (try (MediaDriver/launch ctx)
                           (catch IllegalStateException ise
                             (throw (Exception.


Improved performances from 21us down to 4.2us for glob-matching with memoization

--- moebius/src/moebius/core.clj
+++ moebius/src/moebius/core.clj
@@ -211,6 +211,26 @@

+(def
+  ^{:doc
+    "Given a glob pattern it compiles it down to a regular expression
+     which can be used with functions like `re-matches`, `re-find`, etc.
+     To improve performances the function is `memoized` so common
+     patterns are compiled only once."
+    :arglists '([glob])}
+  glob-pattern
+  (memoize
+   (fn [glob]
+     (re-pattern
+      (-> (str "^" glob "$")
+          (s/replace "." "\\.")
+          (s/replace "**" "[[::multi::]]")
+          (s/replace "*"  "[[::single::]]")
+          (s/replace "[[::multi::]]"  ".*")
+          (s/replace "[[::single::]]" "[^.]*"))))))
+
+
+
 (defn match-glob
   "Glob matching simplifies the event matching when names
   are in a dotted form. Allowed globs are:
@@ -232,15 +252,7 @@

   "
   [glob name]
-  (re-matches
-   (re-pattern
-    (-> (str "^" glob "$")
-        (s/replace "." "\\.")
-        (s/replace "**" "[[::multi::]]")
-        (s/replace "*"  "[[::single::]]")
-        (s/replace "[[::multi::]]"  ".*")
-        (s/replace "[[::single::]]" "[^.]*")))
-   name))
+  (re-matches (glob-pattern glob) name))


Fix displaying of CurrentSelection

Fix displaying of CurrentSelection

--- src/tixi/view.cljs
+++ src/tixi/view.cljs
@@ -74,8 +74,7 @@
   "Displays the selection box around the selected item"
   [data channel]
   (let [rect (g/normalize (d/current-selection data))]
-    (when (p (and (> (g/width rect) 0) (> (g/height rect) 0)))
-      (dom/div {:className "current-selection" :style (selection-position rect)}))))
+    (dom/div {:className "current-selection" :style (selection-position rect)})))

 (q/defcomponent Tool
   "Displays the currently selected tool"
@@ -95,7 +94,7 @@
       (Canvas data channel)
       (when (not-empty selected-ids)
         (Selection data channel))
-      (when current-selection
+      (when (and current-selection (> (g/width current-selection) 0) (> (g/height current-selection) 0))
         (CurrentSelection data channel))
       (when ())
       (Tool data))))


[#1142] Fix bug where same column in popup and label fields caused crash

--- backend/src/akvo/lumen/lib/visualisation/map_config.clj
+++ backend/src/akvo/lumen/lib/visualisation/map_config.clj
@@ -128,7 +128,7 @@
 (defn popup-and-label-cols [popup-cols label-col]
   (cond
     (and (boolean popup-cols) (boolean label-col))
-    (conj popup-cols {"column" label-col})
+    (distinct (conj popup-cols {"column" label-col}))

     (boolean popup-cols)
     popup-cols


Fix board create and update validations.

--- src/oc/storage/api/boards.clj
+++ src/oc/storage/api/boards.clj
@@ -87,8 +87,11 @@
               (and (:publisher-board board-data)
                    (not config/publisher-board-enabled?))
               [false, {:reason :disallowed-publisher-board}]
-              (not= (keyword (:access board-data)) board-access)
-              [false, {:reason (keyword (str (:access board-data) "-acess-on-" (name board-access) "-endpoint"))}]
+              (and (not (:pre-flight board-map))
+                   (not= (keyword (:access board-data)) board-access))
+              [false, {:reason (keyword (str (when (:access board-data)
+                                               (str (:access board-data) "-"))
+                                             "acess-on-" (name board-access) "-endpoint"))}]
               :else
               {:new-board (api-common/rep (board-res/->board (:uuid org) board-data author))
                :existing-org (api-common/rep org)
@@ -119,16 +122,19 @@
             org (org-res/get-org conn org-slug)
             original-board (board-res/get-board conn (:uuid org) slug)]
     ;; Check public board change
-    (if (valid-board-access-update? (:premium? ctx) (:disallow-public-board (:content-visibility org))
-                                    (:access original-board) (:access updating-board))
-      [false, {:reason :board-access-not-allowed}]
-      (let [updated-board (merge original-board (board-res/clean updating-board))]
-        (if (lib-schema/valid? common-res/Board updated-board)
-          {:existing-org (api-common/rep org)
-           :existing-board (api-common/rep original-board)
-           :board-update (api-common/rep updated-board)
-           :notifications (api-common/rep (:private-notifications updating-board))}
-          [false, {:board-update (api-common/rep updated-board)}]))) ; invalid update
+    (let [valid-access-update? (valid-board-access-update? (:premium? ctx) (:disallow-public-board (:content-visibility org))
+                                                           `(:access original-board) (:access updating-board))
+          updated-board (merge original-board (board-res/clean updating-board))
+          valid-updated-board? (lib-schema/valid? common-res/Board updated-board)]
+      (cond (not valid-access-update?)
+            [false, {:reason :board-access-not-allowed}]
+            (not valid-updated-board?)
+            [false, {:board-update (api-common/rep updated-board)}]
+            :else
+            {:existing-org (api-common/rep org)
+             :existing-board (api-common/rep original-board)
+             :board-update (api-common/rep updated-board)
+             :notifications (api-common/rep (:private-notifications updating-board))}))
     true)) ; No org or board, so this will fail existence check later

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


Rename run-all-tests to test-all.

Rename run-all-tests to test-all.


Got change-log function working, along with supporting helpers.

--- src/pe_datomic_utils/core.clj
+++ src/pe_datomic_utils/core.clj
@@ -95,48 +95,8 @@
                (= parent-entid (get-in entity [parent-attr :db/id])))
       [entity-entid (dissoc entity parent-attr)])))

-(defn change-log
-  "Returns a map with 2 keys: :updates and :deletions.  The value at each key is
-  a vector of entities that have either been updated (add/update) or deleted as
-  of as-of-instant.  Each vector contains a collection of entries as maps.  The
-  parameters updated-entry-maker-fn and deleted-entry-maker-fn are used to
-  construct the maps.  updated-entry-maker-fn will be used to contruct the maps
-  to go into the :updates vector; deleted-entry-maker-fn will be used to
-  construct the maps to go into the :deletions vector.  Each of these functions
-  will receive the populated Datomic entity, and is to return a map.  Updates
-  and deletions of entities containing at least 1 attribute from attrs will be
-  included in the computation."
-  [conn
-   as-of-instant
-   attrs
-   updated-entry-maker-fn
-   deleted-entry-maker-fn]
-  (let [db (d/db conn)
-        log (d/log conn)]
-    (reduce (fn [change-log attr]
-              (let [
-                    qry '[:find ?e ?op
-                          :in ?log ?t1 ?attr $
-                          :where [(tx-ids ?log ?t1 nil) [?tx ...]]
-                          [(tx-data ?log ?tx) [[?e _ _ _ ?op]]]
-                          [$ ?e ?attr _]]
-                    results (d/q qry
-                                 log
-                                 as-of-instant
-                                 attr
-                                 db)
-                    {updates :updates} change-log]
-                (when (> (count results) 0)
-                  (assoc change-log
-                         :updates
-                         (conj updates
-                               (updated-entry-maker-fn (into {}
-                                                             (d/entity db
-                                                                       (ffirst results)))))))))
-            {:updates [] :deletions []}
-            attrs)))
-
 (defn entity-id-for-schema-attribute
+  "Returns the entity ID of attr."
   [conn attr]
   (let [results (d/q '[:find ?attr-ent
                        :in $ ?attr
@@ -147,6 +107,9 @@
       (ffirst results))))

 (defn datoms-of-attrs-as-of
+  "Returns the datoms from the log where each datom's entity id matches entid
+  and its attribute entity ID is of an attribute entity ID belonging to attrs,
+  and with a transaction date as of as-of-inst."
   [conn entid attrs as-of-inst]
   (let [attr-entids (map #(entity-id-for-schema-attribute conn %) attrs)]
     (let [txns (->> (seq (d/tx-range (d/log conn) as-of-inst nil))
@@ -159,6 +122,52 @@
                             []))]
       [txns attr-entids])))

+(defn entities-of-attrs-as-of
+  "Returns the set of entity IDs (including retracted ones) that contains at
+  least one attribute from attrs, and exists as of as-of-inst."
+  [conn attrs as-of-inst]
+  (let [attr-entids (map #(entity-id-for-schema-attribute conn %) attrs)]
+    (let [txns (->> (seq (d/tx-range (d/log conn) as-of-inst nil))
+                    (reduce (fn [txns txn]
+                              (let [{datums :data} txn]
+                                (concat txns
+                                        (filter #(some #{(.a %)} attr-entids)
+                                                datums))))
+                            []))]
+      (distinct (map #(.e %) txns)))))
+
+(defn entities-updated-as-of
+  ([conn
+    as-of-instant
+    attrs]
+   (entities-updated-as-of conn as-of-instant attrs nil))
+  ([conn
+    as-of-instant
+    attrs
+    transform-fn]
+   (let [db (d/db conn)
+         log (d/log conn)]
+     (reduce (fn [entities attr]
+               (let [qry '[:find ?e ?op
+                           :in ?log ?t1 ?attr $
+                           :where [(tx-ids ?log ?t1 nil) [?tx ...]]
+                           [(tx-data ?log ?tx) [[?e _ _ _ ?op]]]
+                           [$ ?e ?attr _]]
+                     results (d/q qry log as-of-instant attr db)]
+                 (if (> (count results) 0)
+                   (apply conj
+                          entities
+                          (map (fn [result-tuple]
+                                 (let [user-entid (first result-tuple)
+                                       entity (into {:db/id user-entid} (d/entity db user-entid))]
+                                   (if transform-fn
+                                     (transform-fn entity)
+                                     entity)))
+                               results))
+                   entities)))
+             []
+             attrs))))
+
 (defn are-attributes-retracted-as-of
   [conn entid attrs as-of-inst]
   (let [[datoms attr-entids] (datoms-of-attrs-as-of conn entid attrs as-of-inst)]
@@ -169,3 +178,33 @@
                      (when last-datom
                        (not (.added last-datom)))))
                  attr-entids))))
+
+(defn change-log
+  "Returns a map with 2 keys: :updates and :deletions.  The value at each key is
+  a vector of entities that have either been updated (add/update) or deleted as
+  of as-of-instant.  Each vector contains a collection of entries as maps.  The
+  parameters updated-entry-maker-fn and deleted-entry-maker-fn are used to
+  construct the maps.  updated-entry-maker-fn will be used to contruct the maps
+  to go into the :updates vector; deleted-entry-maker-fn will be used to
+  construct the maps to go into the :deletions vector.  Each of these functions
+  will receive the populated Datomic entity, and is to return a map.  Updates
+  and deletions of entities containing reqd-attr will be included in the
+  computation."
+  [conn
+   as-of-instant
+   reqd-attr
+   updated-entry-maker-fn
+   deleted-entry-maker-fn]
+  {:updates (entities-updated-as-of conn as-of-instant [reqd-attr] updated-entry-maker-fn)
+   :deletions (let [ent-ids (entities-of-attrs-as-of conn [reqd-attr] as-of-instant)]
+                (reduce (fn [deleted-entities ent-id]
+                          (let [is-deleted (are-attributes-retracted-as-of conn
+                                                                           ent-id
+                                                                           [reqd-attr]
+                                                                           as-of-instant)]
+                            (if is-deleted
+                              (conj deleted-entities
+                                    (deleted-entry-maker-fn {:db/id ent-id}))
+                              deleted-entities)))
+                        []
+                        ent-ids))})


remove redundant fns

remove redundant fns


Added field inheritance from dataset for granule search.

--- src/cmr/search/services/parameters.clj
+++ src/cmr/search/services/parameters.clj
@@ -3,6 +3,7 @@
   (:require [clojure.set :as set]
             [cmr.common.services.errors :as errors]
             [cmr.search.models.query :as qm]
+            [cmr.search.data.query-to-elastic :as q2e]
             [cmr.common.date-time-parser :as dt-parser]
             [cmr.common.util :as u]))

@@ -51,9 +52,9 @@
              :version :collection-query
              :updated-since :updated-since
              :temporal :temporal
-             :platform :string
-             :instrument :string
-             :sensor :string
+             :platform :inheritance
+             :instrument :inheritance
+             :sensor :inheritance
              :project :string
              :cloud-cover :num-range
              :concept-id :string
@@ -84,6 +85,16 @@
        :case-sensitive? (not= "true" (get-in options [param :ignore-case]))
        :pattern? (= "true" (get-in options [param :pattern]))})))

+;; Construct an inheritance query condition for granules.
+;; This query needs to respect the inheritance of its dataset's corresponding fields.
+(defmethod parameter->condition :inheritance
+  [concept-type param value options]
+  (let [field-condition (parameter->condition :collection param value options)]
+    (qm/or-conds
+      [field-condition
+       (qm/and-conds
+         [(qm/->CollectionQueryCondition field-condition)
+          (qm/map->MissingCondition {:field (q2e/query-field->elastic-field param concept-type)})])])))

 (defmethod parameter->condition :updated-since
   [concept-type param value options]


Extract NIO-specific code to a map called `transport`

--- src/riemann/transport/tcp.clj
+++ src/riemann/transport/tcp.clj
@@ -18,8 +18,9 @@
            [io.netty.handler.codec LengthFieldBasedFrameDecoder
                                    LengthFieldPrepender]
            [io.netty.handler.ssl SslHandler]
-           [io.netty.channel.socket.nio NioServerSocketChannel]
-           [io.netty.channel.nio NioEventLoopGroup])
+           [io.netty.channel.epoll EpollEventLoopGroup EpollServerSocketChannel]
+           [io.netty.channel.nio NioEventLoopGroup]
+           [io.netty.channel.socket.nio NioServerSocketChannel])
   (:require [less.awful.ssl :as ssl]
             [interval-metrics.core :as metrics])
   (:use [clojure.tools.logging :only [info warn]]
@@ -71,6 +72,9 @@

     (isSharable [] true)))

+(def transport {:event-loop-group-fn #(NioEventLoopGroup.)
+                :channel NioServerSocketChannel})
+
 (defn tcp-handler
   "Given a core, a channel, and a message, applies the message to core and
   writes a response back on this channel."
@@ -117,14 +121,15 @@
   (start! [this]
           (locking this
             (when-not @killer
-              (let [boss-group (NioEventLoopGroup.)
-                    worker-group (NioEventLoopGroup.)
+              (let [event-loop-group-fn (:event-loop-group-fn transport)
+                    boss-group (event-loop-group-fn)
+                    worker-group (event-loop-group-fn)
                     bootstrap (ServerBootstrap.)]

                 ; Configure bootstrap
                 (doto bootstrap
                   (.group boss-group worker-group)
-                  (.channel NioServerSocketChannel)
+                  (.channel (:channel transport))
                   (.option ChannelOption/SO_REUSEADDR true)
                   (.option ChannelOption/TCP_NODELAY true)
                   (.childOption ChannelOption/SO_REUSEADDR true)


parinfer formatting

parinfer formatting

--- src-cljs/cuttle/core.cljs
+++ src-cljs/cuttle/core.cljs
@@ -37,13 +37,14 @@
 ;; TODO: we need to handle when there is a permission error here
 (defn- copy-lein-files! [next-fn]
   (log-info "copying lein.bat to our windows bin dir")
-  (.ensureDir fs windows-bin-dir (fn []
-    (.copy fs (path-join js/__dirname "bin" "lein.bat")
-              (str windows-bin-dir "lein.bat")
-              (fn []
-                (.copy fs (path-join js/__dirname "bin" "lein.jar")
-                          (str windows-bin-dir "lein.jar")
-                          next-fn))))))
+  (.ensureDir fs windows-bin-dir
+    (fn []
+      (.copy fs (path-join js/__dirname "bin" "lein.bat")
+                (str windows-bin-dir "lein.bat")
+                (fn []
+                  (.copy fs (path-join js/__dirname "bin" "lein.jar")
+                            (str windows-bin-dir "lein.jar")
+                            next-fn))))))

 ;;------------------------------------------------------------------------------
 ;; Loading / Shutting Down Pages


only hide old header/footer for landing-b homepage

--- frontend/components/app.cljs
+++ frontend/components/app.cljs
@@ -101,7 +101,10 @@

              [:div#app {:class (concat [(if inner? "inner" "outer")]
                                        (when slim-aside? ["aside-slim"])
-                                       (when-not logged-in? ["aside-nil"]))}
+                                       (when-not logged-in? ["aside-nil"])
+                                       ;; The following 2 are meant for the landing ab test to hide old heaqder/footer
+                                       (when new-homepage? ["landing-b"])
+                                       (when (= :landing (:navigation-point app)) ["landing"]))}
               (om/build keyq/KeyboardHandler app-without-container-data
                         {:opts {:keymap keymap
                                 :error-ch (get-in app [:comms :errors])}})


BREAKING: Ring middleware: remove :session-id key (use Ring's :session/key instead)

--- src/taoensso/carmine/ring.clj
+++ src/taoensso/carmine/ring.clj
@@ -16,10 +16,7 @@
   (read-session   [_ key] (or (when key (wcar* (car/get key))) {}))
   (delete-session [_ key] (wcar* (car/del key)) nil)
   (write-session  [_ key data]
-    (let [key  (or key (new-session-key prefix))
-          ;; TODO Deprecate? Ring request already has :session/key
-          data (assoc data :session-id key)
-          ]
+    (let [key (or key (new-session-key prefix))]
       (if expiration
         (wcar* (car/setex key expiration data))
         (wcar* (car/set key data)))


Sending the user to the page times view when they save the settings

--- src/ui/relevance/display.cljs
+++ src/ui/relevance/display.cljs
@@ -107,7 +107,9 @@
     (when save?
       ;; We tell the backend to reload the data after saving the settings, since
       ;; they can have an effect on behavior.
-      (io/save :settings settings #(runtime/send-message :reload-data)))
+      (io/save :settings settings #(runtime/send-message :reload-data))
+      (dispatch [:app-state-item [:ui-state :section] :url-times])
+      )
     (assoc app-state :settings settings)))

 (register-handler


Improve workspace initialization.

Improve workspace initialization.

--- src/uxbox/data/workspace.cljs
+++ src/uxbox/data/workspace.cljs
@@ -30,18 +30,19 @@
   (reify
     rs/UpdateEvent
     (-apply-update [_ state]
-      (if-let [workspace (:workspace state)]
+      (if (:workspace state)
         (update state :workspace merge
                 {:project project
                  :page page
                  :selected #{}
                  :drawing nil})
-        (update state :workspace merge
-                {:project project
-                 :page page
-                 :flags #{:layers :element-options}
-                 :selected #{}
-                 :drawing nil})))))
+        (assoc state :workspace
+               {:project project
+                :zoom 1
+                :page page
+                :flags #{:layers :element-options}
+                :selected #{}
+                :drawing nil})))))

 (defn toggle-flag
   "Toggle the enabled flag of the specified tool."


add rule for the day before yesterday in ES

--- resources/duckling/rules/es.time.clj
+++ resources/duckling/rules/es.time.clj
@@ -130,7 +130,7 @@
   (cycle-nth :day 2)

   "the day before yesterday"
-  #"(?i)anteayer|antes de anoche|antier"
+  #"(?i)anteayer|antes de (ayer|anoche)|antier"
   (cycle-nth :day -2)

   ;;


Fix exclusions and bump boot-semver

Fix exclusions and bump boot-semver

--- resources/leiningen/new/lambone/common/build.boot
+++ resources/leiningen/new/lambone/common/build.boot
@@ -2,9 +2,9 @@
 ;;;  Dependencies  ;;;
 ;;;;;;;;;;;;;;;;;;;;;;

-(def cmd-line-deps '[[degree9/boot-semver "1.2.4" :scope "test" :exclusions [boot/core]]
+(def cmd-line-deps '[[degree9/boot-semver "1.3.5" :scope "test" :exclusions [org.clojure/clojure com.google.guava/guava]]
                      [adzerk/env "0.3.0" :scope "test"]
-                     [pandeiro/boot-http "0.7.3" :scope "test"]])
+                     [pandeiro/boot-http "0.7.3" :scope "test" :exclusions [org.clojure/clojure]]])
 <% if all backend frontend %>
 (def common-deps '[[org.clojure/clojure "1.8.0" :scope "provided"]
                    [adzerk/env "0.3.0" :scope "test"]])
@@ -61,9 +61,10 @@
                            [org.slf4j/slf4j-nop "1.7.21" :scope "test"]
                            [pandeiro/boot-http "0.7.3" :scope "test"]]))
 <% endif %>
+(def backend-exclusions '#{org.clojure/clojurescript})
+
 (set-env! :source-paths #{"dev"}
-          :dependencies cmd-line-deps
-          :exclusions '#{org.clojure/clojure com.google.guava/guava})
+          :dependencies cmd-line-deps)

 (require '[boot :refer [run]]
          '[clojure.pprint :refer [pprint]]
@@ -99,6 +100,7 @@

 (def backend-options
   {:env {:dependencies backend-deps
+         :exclusions backend-exclusions
          :source-paths #{"src/backend" "src/common"}}
    :repl {:init-ns 'dev
           :port 5055}