Use SNAPSHOT

Use SNAPSHOT

--- desktop/project.clj
+++ desktop/project.clj
@@ -5,7 +5,7 @@
                  [com.badlogicgames.gdx/gdx-backend-lwjgl "0.9.9"]
                  [com.badlogicgames.gdx/gdx-platform "0.9.9"
                   :classifier "natives-desktop"]
-                 [nightcode "0.3.0"
+                 [nightcode "0.3.1-SNAPSHOT"
                   :exclusions [leiningen
                                lein-ancient
                                lein-cljsbuild


remove unhelpful TODOs: reduce is slower than this recursive implementation

--- src/babel/generate.cljc
+++ src/babel/generate.cljc
@@ -178,7 +178,6 @@
    (filter #(not (= :fail %)))
    (map #(u/assoc-in! % [::done?] true))))

-;; TODO: use reduce.
 (defn- assoc-each-default [tree children path]
   (if (not (empty? children))
     (lazy-cat
@@ -192,7 +191,6 @@
            (default-fn)))
      (assoc-each-default tree (rest children) path))))

-;; TODO: use reduce
 (defn- assoc-children [tree children path]
   (if (not (empty? children))
     (let [child (first children)]


rename

rename

--- src/babel/generate.cljc
+++ src/babel/generate.cljc
@@ -49,13 +49,13 @@
     (->>
      (lightning-bolts model spec depth max-depth)
      (pmap (fn [bolt]
-             (let [cp2c
+             (let [comp-paths-to-complements
                    (comp-paths-to-complements bolt (find-comp-paths bolt) model depth max-depth)]
-               (if (not (nil? cp2c))
+               (if (not (nil? comp-paths-to-complements))
                  (merge
                   {[]
                    (filter not-fail? [bolt])}
-                  cp2c)))))
+                  comp-paths-to-complements)))))
      (remove nil?)
      (map (fn [each-bolt-and-comps]
             (map (fn [each-path-through-trellis]


more work on (defn create-model)

more work on (defn create-model)

--- src/babel/italiano.cljc
+++ src/babel/italiano.cljc
@@ -143,18 +143,15 @@
 (defn create-model [ & words]
   (let [base-model (babel.italiano.grammar/model)
         base-lexicon
-        (zipmap
-         (sort (keys (:lexicon base-model)))
-         (map (fn [k]
-                (get (
-                (sort (keys (:lexicon base-model)))
-
-
-        (->> (:lexicon base-model)
-                          (filter (fn [x] true));; TODO: articles
-                          (filter (fn [x] true)) ;; TODO: subject pronouns
-                          (filter (fn [x] true)) ;; TODO: ..etc.
-                          )]
+        (babel.lexiconfn/only-nonempty-vals
+         (:lexicon base-model)
+         (fn [vals]
+           (filter (fn [v]
+                     (or (and (= :det (dag_unify.core/get-in v [:synsem :cat]))
+                              (= :def (dag_unify.core/get-in v [:synsem :def])))
+                         (and (= true (dag_unify.core/get-in v [:synsem :pronoun]))
+                              (= :nom (dag_unify.core/get-in v [:synsem :case])))))
+                   vals)))]
     (merge base-model
            {:input-words (vec words)
             :lexical-cache (atom (cache/fifo-cache-factory {} :threshold 1024))


When registering schemas, keep the schema as a vector

With new data-spec, concat makes it a seq, which fails validation

--- src/braid/base/api.cljc
+++ src/braid/base/api.cljc
@@ -136,7 +136,7 @@
        [schema]
        {:pre [(vector? schema)
               (every? (partial util/valid? braid.base.server.schema/rule-dataspec) schema)]}
-       (swap! braid.base.server.schema/schema concat schema))
+       (swap! braid.base.server.schema/schema into schema))

      (defn register-db-seed-txns!
        ;; have to take fns that return maps rather than just taking maps


Expose scalarmult consts

Expose scalarmult consts

--- src/caesium/binding.clj
+++ src/caesium/binding.clj
@@ -124,7 +124,11 @@
     ^int crypto_hash_sha512
     [^bytes ^{Pinned {}} buf
      ^bytes ^{Pinned {}} msg
-     ^long ^{LongLong {}} msglen]})
+     ^long ^{LongLong {}} msglen]
+
+    ^int ^{size_t {}} crypto_scalarmult_bytes []
+    ^int ^{size_t {}} crypto_scalarmult_scalarbytes []
+    ^String crypto_scalarmult_primitive []})

 (defmacro ^:private defsodium
   []


Scrolling and custom tables for all!

Scrolling and custom tables for all!

--- src-cljs/kixi/hecuba/tabs/programmes.cljs
+++ src-cljs/kixi/hecuba/tabs/programmes.cljs
@@ -118,47 +118,6 @@
                     :keywords? true}))))))
     (recur)))

-;; TODO histkey is really id key. resolve name confusion.
-(defn table [cursor owner {:keys [histkey path]}]
-  (reify
-    om/IRender
-    (render [_]
-      ;; Select the first row
-      ;;(put! out {:type :row-selected :row (first (om/get-state owner :data))})
-      (let [cols (get-in cursor [:header :cols])
-            table-id (str (name histkey) "-table")
-            history (om/get-shared owner :history)]
-        (dom/div #js {:id (str table-id "-container")}
-         (dom/table
-          #js {;; :id table-id
-               :className "table table-hover hecuba-table"} ;; table-hover table-stripedso,
-          (dom/thead
-           nil
-           (dom/tr
-            nil
-            (into-array
-             (for [[_ {:keys [label]}] cols]
-               (dom/th nil label)))))
-          (dom/tbody
-           nil
-           (into-array
-            (for [{:keys [id href ] :as row} (-> cursor :data
-                                                (cond-> path path))]
-              (dom/tr
-               #js {:onClick (fn [_ _ ]
-                               (om/update! cursor :selected id)
-                               (history/update-token-ids! history histkey id))
-                    :className (if (= id (:selected cursor)) "success")
-                    ;; TODO use this to scroll the row into view.
-                    ;; Possible solution here: http://stackoverflow.com/questions/1805808/how-do-i-scroll-a-row-of-a-table-into-view-element-scrollintoview-using-jquery
-                    :id (str table-id "-selected")}
-               (into-array
-                (for [[k {:keys [href]}] cols]
-                  (let [k (if (vector? k) k (vector k))]
-                    (dom/td nil (if href
-                                  (dom/a #js {:href (get row href)} (get-in row k))
-                                  (get-in row k))))))))))))))))
-
 (defn device-detail [{:keys [selected data] :as cursor} owner]
   (om/component
    (let [row      (first (filter #(= (:id %) selected) data))]
@@ -180,24 +139,15 @@
   (let [[type _] (str/split selected #"-")]
     type))

-(defn programmes-div [tables owner]
-  (reify
-    om/IRender
-    (render [_]
-      (let [programmes (-> tables :programmes)]
-        (html
-         ;; hide div if we've already chosen something
-         [:div {:id "programmes-div"}
-          [:h1 "Programmes"]
-          (om/build programmes-table programmes)])))))
-
 ;; our banner is 50px so we need to tweak the scrolling
 (defn fixed-scroll-to-element [element]
   (-> (.getElementById js/document element)
                                     .scrollIntoView)
   (.scrollBy js/window 0 -50))

-(defn programmes-table [cursor owner]
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; programmes
+(defn programmes-table [programmes owner]
   (reify
     om/IRender
     (render [_]
@@ -208,15 +158,54 @@
           [:thead
            [:tr [:th "ID"] [:th "Organisations"] [:th "Name"] [:th "Created At"]]]
           [:tbody
-           (for [row (sort-by :id (:data cursor))]
+           (for [row (sort-by :id (:data programmes))]
              (let [{:keys [id lead-organisations name description created-at]} row]
                [:tr {:onClick (fn [_ _]
-                                (om/update! cursor :selected id)
+                                (om/update! programmes :selected id)
                                 (history/update-token-ids! history :programmes id)
                                 (fixed-scroll-to-element "projects-div"))
-                     :className (if (= id (:selected cursor)) "success")
+                     :className (if (= id (:selected programmes)) "success")
                      :id (str table-id "-selected")}
                 [:td id [:a {:id (str "row-" id)}]] [:td lead-organisations] [:td name] [:td created-at]]))]])))))
+
+(defn programmes-div [tables owner]
+  (reify
+    om/IRender
+    (render [_]
+      (let [programmes (-> tables :programmes)]
+        (html
+         ;; hide div if we've already chosen something
+         [:div {:id "programmes-div"}
+          [:h1 "Programmes"]
+          (om/build programmes-table programmes)])))))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; projects
+(defn projects-table [projects owner]
+  (reify
+    om/IRender
+    (render [_]
+      (let [table-id   "projects-table"
+            history    (om/get-shared owner :history)]
+        (html
+         [:table {:className "table table-hover"}
+          [:thead
+           [:tr [:th "Name"] [:th "Type"] [:th "Description"] [:th "Created At"] [:th "Organisation"] [:th "Project Code"]]]
+          [:tbody
+           (for [row (sort-by :id (:data projects))]
+             (let [{:keys [id name type-of description created-at organisation project-code]} row]
+               [:tr {:onClick (fn [_ _]
+                                (om/update! projects :selected id)
+                                (history/update-token-ids! history :projects id)
+                                (fixed-scroll-to-element "properties-div"))
+                     :className (if (= id (:selected projects)) "success")
+                     :id (str table-id "-selected")}
+                [:td name]
+                [:td type-of]
+                [:td description]
+                [:td created-at]
+                [:td organisation]
+                [:td project-code]]))]])))))

 (defn projects-div [tables owner]
   (reify
@@ -238,7 +227,31 @@
                              (history/update-token-ids! history :programmes nil)
                              (fixed-scroll-to-element "programmes-div"))}
                  (title-for programmes)]]]
-          (om/build table projects {:opts {:histkey :projects}})])))))
+          (om/build projects-table projects {:opts {:histkey :projects}})])))))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; properties
+(defn properties-table [properties owner]
+  (reify
+    om/IRender
+    (render [_]
+      (let [table-id   "properties-table"
+            history    (om/get-shared owner :history)]
+        (html
+         [:table {:className "table table-hover"}
+          [:thead
+           [:tr [:th "Address"] [:th "Country"]]]
+          [:tbody
+           (for [row (sort-by :name (:data properties))]
+             (let [{:keys [id addressStreetTwo country]} row]
+               [:tr {:onClick (fn [_ _]
+                                (om/update! properties :selected id)
+                                (history/update-token-ids! history :properties id)
+                                (fixed-scroll-to-element "devices-div"))
+                     :className (if (= id (:selected properties)) "success")
+                     :id (str table-id "-selected")}
+                [:td addressStreetTwo]
+                [:td country]]))]])))))

 (defn properties-div [tables owner]
   (reify
@@ -261,8 +274,10 @@
                              (history/update-token-ids! history :projects nil)
                              (fixed-scroll-to-element "projects-div"))}
                  (title-for projects)]]]
-          (om/build table properties {:opts {:histkey :properties}})])))))
-
+          (om/build properties-table properties {:opts {:histkey :properties}})])))))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; devices
 (defn devices-div [tables owner]
   (reify
     om/IRender
@@ -289,10 +304,54 @@
            [:li [:a
                  {:onClick (fn [_ _]
                              (history/update-token-ids! history :properties nil)
-                             (fixed-scroll-to-element "projects-div"))}
+                             (fixed-scroll-to-element "properties-div"))}
                  (title-for properties :title-key :addressStreetTwo)]]]
           (om/build table devices {:opts {:histkey :devices}})])))))

+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; sensors
+(defn sensors-div [data owner]
+  (let [tables (:tables data)]
+    (reify
+      om/IRender
+      (render [_]
+        (let [{:keys [programmes projects properties devices active-components]} tables
+              history (om/get-shared owner :history)]
+          (html
+           [:div {:id "sensors-div"}
+            [:h2 {:id "sensors"} "Sensors"]
+            [:ul {:class "breadcrumb"}
+             [:li [:a
+                   {:onClick (fn [_ _]
+                               (history/update-token-ids! history :devices nil)
+                               (history/update-token-ids! history :properties nil)
+                               (history/update-token-ids! history :projects nil)
+                               (history/update-token-ids! history :programmes nil)
+                               (fixed-scroll-to-element "programmes-div"))}
+                   (title-for programmes)]]
+             [:li [:a
+                   {:onClick (fn [_ _]
+                               (history/update-token-ids! history :devices nil)
+                               (history/update-token-ids! history :properties nil)
+                               (history/update-token-ids! history :projects nil)
+                               (fixed-scroll-to-element "projects-div"))}
+                   (title-for projects)]]
+             [:li [:a
+                   {:onClick (fn [_ _]
+                               (history/update-token-ids! history :devices nil)
+                               (history/update-token-ids! history :properties nil)
+                               (fixed-scroll-to-element "properties-div"))}
+                   (title-for properties :title-key :addressStreetTwo)]]
+             [:li [:a
+                   {:onClick (fn [_ _]
+                               (history/update-token-ids! history :devices nil)
+                               (fixed-scroll-to-element "devices-div"))}
+                   (title-for devices :title-key [:location :name])]]]
+            (om/build sensor/table data {:opts {:histkey :sensors
+                                                :path    :readings}})]))))))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Main View
 (defn programmes-tab [data owner]
   (let [{tables :tables} data]
     (reify
@@ -332,40 +391,26 @@
                  (om/build projects-div tables)
                  (om/build properties-div tables)
                  (om/build devices-div tables)
-
                  ;; (om/build device-detail devices)
-
-                 [:h2 {:id "sensors"} "Sensors"]
-                 [:ul {:class "breadcrumb"}
-                  [:li (title-for programmes)]
-                  [:li (title-for projects)]
-                  [:li (title-for properties :title-key :addressStreetTwo)]
-                  [:li (title-for devices :title-key [:location :name])]]
-                 (om/build sensor/table data {:opts {:histkey :sensors
-                                                     :path    :readings}})
+                 (om/build sensors-div data)
                  ;; (om/build sensor/define-data-set-button data)

-                 [:h2 "Chart"]
-                 [:ul {:class "breadcrumb"}
-                  [:li (title-for programmes)]
-                  [:li (title-for projects)]
-                  [:li (title-for properties :title-key :addressStreetTwo)]
-                  [:li (title-for devices :title-key [:location :name])]
-                  [:li (title-for-sensor sensors)]]
-                 [:div {:id "date-picker"}
-                  (om/build dtpicker/date-picker data {:opts {:histkey :range}})]
-                 (om/build chart-feedback-box (get-in data [:chart :message]))
-                 [:div {:className "well" :id "chart" :style {:width "100%" :height 600}}
-                  (om/build chart/chart-figure (:chart data))]
-                 (om/build sensor/selection-dialog (:tables data)
-                           {:opts {:id "sensor-selection-dialog"
-                                   :handler (fn [e]
-                                              (.preventDefault e)
-                                              (POST (str "/4/entities/" (:selected @properties) "/datasets")
-                                                    {:params          (:sensor-group @sensor-select)
-                                                     :handler         #(println "Yah!")
-                                                     :error-handler   #(println "Error!")
-                                                     :response-format "application/edn"
-                                                     :keywords?       true}))}})]))))))
-
-
+                 [:div {:id "chart-div"}
+                  [:h2 "Chart"]
+                  [:div {:id "date-picker"}
+                   (om/build dtpicker/date-picker data {:opts {:histkey :range}})]
+                  (om/build chart-feedback-box (get-in data [:chart :message]))
+                  [:div {:className "well" :id "chart" :style {:width "100%" :height 600}}
+                   (om/build chart/chart-figure (:chart data))]
+                  (om/build sensor/selection-dialog (:tables data)
+                            {:opts {:id "sensor-selection-dialog"
+                                    :handler (fn [e]
+                                               (.preventDefault e)
+                                               (POST (str "/4/entities/" (:selected @properties) "/datasets")
+                                                     {:params          (:sensor-group @sensor-select)
+                                                      :handler         #(println "Yah!")
+                                                      :error-handler   #(println "Error!")
+                                                      :response-format "application/edn"
+                                                      :keywords?       true}))}})]]))))))
+
+


Fixed precondition

Fixed precondition

--- src/clj/puppetlabs/master/certificate_authority.clj
+++ src/clj/puppetlabs/master/certificate_authority.clj
@@ -177,7 +177,7 @@
   individual dns alt names with all surrounding whitespace removed. If
   hostnames is empty or nil, then nil is returned."
   [hostnames]
-  {:pre  [(or nil? (string? hostnames))]
+  {:pre  [(or (nil? hostnames) (string? hostnames))]
    :post [(every? string? %)]}
   (let [hostnames (str/trim (or hostnames ""))]
     (when (and hostnames (> (count hostnames) 0))


replica enabling when update

replica enabling when update

--- src/cljs/swarmpit/component/service/form_settings.cljs
+++ src/cljs/swarmpit/component/service/form_settings.cljs
@@ -57,7 +57,7 @@
              :label    "Global"
              :value    "global"}))))

-(defn- form-replicas [value update-form?]
+(defn- form-replicas [value]
   (material/form-edit-row
     (str "REPLICAS  " "(" value ")")
     (material/slider #js {:min          1
@@ -65,7 +65,6 @@
                           :step         1
                           :defaultValue 1
                           :value        value
-                          :disabled     update-form?
                           :onChange     (fn [e v] (update-item :replicas v))
                           :sliderStyle  #js {:marginTop "14px"}})))

@@ -87,5 +86,5 @@
      (form-image image)
      (form-name serviceName update-form?)
      (form-mode mode update-form?)
-     (if (= "replicated" mode) (form-replicas replicas update-form?))
+     (if (= "replicated" mode) (form-replicas replicas))
      (form-autoredeploy autoredeploy)]))


Updated image ref

Updated image ref

--- src/cljs/wombats_web_client/components/cards/game.cljs
+++ src/cljs/wombats_web_client/components/cards/game.cljs
@@ -19,7 +19,7 @@
   [:div.arena-freq
    [freq "food/food_cherry"]
    [freq "poison/poison_vial2"]
-   [freq "steel-barrier/wall"]
+   [freq "steel-barrier/steelwall_1"]
    [freq "zakano/zakano_front"]
    [freq "wood-barrier/woodwall_1"]])


style(e4): remove printlns

style(e4): remove printlns

--- ccw.core.e4/src/clj/ccw/e4/dsl.clj
+++ ccw.core.e4/src/clj/ccw/e4/dsl.clj
@@ -23,7 +23,7 @@
                    (update-in [:tags]
                               (fnil conj #{})
                               "ccw"))]
-       (println "spec#:" spec#)
+       ;(println "spec#:" spec#)
        (m/merge-command! @m/app spec#))))

 ;;; TODO register for deletion in  m/*elements* (a set)
@@ -42,7 +42,7 @@
                    (update-in [:tags]
                               (fnil conj #{})
                               "ccw"))]
-        (println "spec#:" spec#)
+        ;(println "spec#:" spec#)
        (m/merge-handler! @m/app spec#)))))

 ;; TODO support options !!!
@@ -101,5 +101,5 @@
                    (update-in [:tags]
                               (fnil conj #{})
                               "ccw"))]
-     (println "spec#:" spec#)
+     ;(println "spec#:" spec#)
      (m/merge-key-binding! @m/app spec#)))


Up default percentile recorder range to 90k

--- src/engulf/formulas/http_benchmark_aggregations.clj
+++ src/engulf/formulas/http_benchmark_aggregations.clj
@@ -18,7 +18,7 @@
    "runs-failed" 0
    "status-codes" {}
    "time-slices" {}
-   "percentiles" (PercentileRecorder. (or (params "timeout") 10000))})
+   "percentiles" (PercentileRecorder. (or (params "timeout") 90000))})

 (defn successes
   [results]


fix wrapping bug

fix wrapping bug

--- frontend/localstorage.cljs
+++ frontend/localstorage.cljs
@@ -17,9 +17,9 @@
   "Fetches and deserializes key from localstorage
    Noops if localstorage isn't available."
   [localstorage-imp key]
-  (when (is-available? localstorage-imp))
-  (some-> (.get localstorage-imp key)
-          reader/read-string))
+  (when (is-available? localstorage-imp)
+    (some-> (.get localstorage-imp key)
+            reader/read-string)))

 (defn new-localstorage-imp []
   (goog.storage.mechanism.HTML5LocalStorage.))


gen/sample uses sizes up to 200

gen/sample uses sizes up to 200

This way gen/sample matches the way tests are actually run by default,
which avoids some confusion.

--- src/main/clojure/clojure/test/check/generators.cljc
+++ src/main/clojure/clojure/test/check/generators.cljc
@@ -149,7 +149,7 @@

 (defn sample-seq
   "Return a sequence of realized values from `generator`."
-  ([generator] (sample-seq generator 100))
+  ([generator] (sample-seq generator 200))
   ([generator max-size]
    (core/let [r (random/make-random)
               size-seq (make-size-range-seq max-size)]


Refactor oauth-provider view to use a loop

--- src/braid/client/register/views/user.cljs
+++ src/braid/client/register/views/user.cljs
@@ -5,18 +5,13 @@

 (defn auth-providers-view []
   [:span.auth-providers
-   [:button.github
-    {:on-click (fn []
-                 (dispatch [:register.user/remote-oauth :github]))}
-    "Github"]
-   [:button.google
-    {:on-click (fn []
-                 (dispatch [:register.user/remote-oauth :google]))}
-    "Google"]
-   [:button.facebook
-    {:on-click (fn []
-                 (dispatch [:register.user/remote-oauth :facebook]))}
-    "Facebook"]])
+   (for [provider [:github :google :facebook]]
+     [:button
+      {:class (name provider)
+       :on-click (fn [e]
+                   (.preventDefault e)
+                   (dispatch [:register.user/remote-oauth provider]))}
+      (string/capitalize (name provider))])])

 (defn returning-email-field-view []
   [:div.option.email


login page -> use bidi

login page -> use bidi

--- src/cljs/swarmpit/component/page_401.cljs
+++ src/cljs/swarmpit/component/page_401.cljs
@@ -1,5 +1,6 @@
 (ns swarmpit.component.page-401
-  (:require [rum.core :as rum]))
+  (:require [swarmpit.routes :as routes]
+            [rum.core :as rum]))

 (rum/defc not-authorized < rum/static []
   [:div.page-back
@@ -7,7 +8,7 @@
     [:span
      [:h1 "401"]
      [:p "You are not authotized for selected action"]
-     [:p "Go to login " [:a {:href "/#/login"} "page"]]]]])
+     [:p "Go to login " [:a {:href (routes/path-for-frontend :login)} "page"]]]]])

 (defn mount!
   []


make final destination automatically the original destination

--- src/cljs/travel_site/components/city.cljs
+++ src/cljs/travel_site/components/city.cljs
@@ -95,9 +95,20 @@
       (html [:div {:class "ui segment transit-view"}
              (om/build-all transit-directions-view transit-journey) ]))))

+(defn place-filled-out? [place]
+ (not (empty? (:coords place))))
+
 ;; View to edit the current journey (i.e. change start/end locations and remove existing waypoints)
 (defn attractions-selector-view [[current-city journey transit-journey] owner]
   (reify
+    om/IDidUpdate
+    (did-update [_ [_ prev-journey _] _]
+      (let [[_ journey _] (om/get-props owner)]
+        (when (and (place-filled-out? (:start-place journey))
+                   (not (place-filled-out? (:end-place journey))))
+          (js/console.log (:end-place journey))
+          (om/update! (:end-place journey) (:start-place @journey)))))
+
     om/IRender
     (render [_]
       (html [:div {:class "ui basic segment fourteen wide attractions-selector-view"}
@@ -110,13 +121,13 @@
                  (om/build inputs/address-autocomplete-input [(-> journey :start-place)
                                                               {:edit-key :address
                                                                :coords-key :coords
-                                                               :className "address-fields" ;;TODO - rename className -> class
+                                                               :className "address-fields"
                                                                :placeholder-text "Start address"}])]
                 [:div {:class "ui fluid input address-input"}
                  (om/build inputs/address-autocomplete-input [(-> journey :end-place)
                                                               {:edit-key :address
                                                                :coords-key :coords
-                                                               :className "address-fields" ;; TODO - rename className -> class
+                                                               :className "address-fields"
                                                                :placeholder-text "End address"}])]
                 [:div {:class "ui red button go-button"
                        :on-click #(animate-scroll-to-offset 550)}
@@ -129,14 +140,14 @@
                  (om/build inputs/address-autocomplete-input [(-> journey :start-place)
                                                               {:edit-key :address
                                                                :coords-key :coords
-                                                               :className "address-fields" ;;TODO - rename className -> class
+                                                               :className "address-fields"
                                                                :placeholder-text "Start address"}])]]
                 [:div {:class "sixteen wide field"}
                  [:div {:class "ui fluid input address-input"}
                   (om/build inputs/address-autocomplete-input [(-> journey :end-place)
                                                                {:edit-key :address
                                                                 :coords-key :coords
-                                                                :className "address-fields" ;; TODO - rename className -> class
+                                                                :className "address-fields"
                                                                 :placeholder-text "End address"}])]]]]]))))


Make the mapreduce inspect results also `reduce`-able.

--- src/clojure/parkour/inspect/mapreduce.clj
+++ src/clojure/parkour/inspect/mapreduce.clj
@@ -1,6 +1,7 @@
 (ns parkour.inspect.mapreduce
   {:private true}
-  (:require [parkour (mapreduce :as mr) (fs :as fs)]
+  (:require [clojure.core.protocols :as ccp]
+            [parkour (mapreduce :as mr) (fs :as fs) (conf :as conf)]
             [parkour.util :refer [ignore-errors doto-let returning]])
   (:import [java.io Closeable]
            [clojure.lang Seqable]
@@ -30,17 +31,23 @@
     (returning nil (.close rr'))
     (returning rr' (close-rr rr))))

+(defn ^:private rr-tuple
+  [^RecordReader rr]
+  [(.getCurrentKey rr) (.getCurrentValue rr)])
+
 (defn records-seqable
   [conf f klass & paths]
   (let [job (doto-let [job (mr/job conf)]
               (doseq [path paths :let [path (fs/path path)]]
                 (FileInputFormat/addInputPath job path)))
-        conf (.getConfiguration job)
+        conf (conf/ig job)
         ^InputFormat ifi (ReflectionUtils/newInstance klass conf)
         splits (seq (.getSplits ifi job))
         closer (agent ::initial)]
     (reify
-      Closeable (close [_] (send closer close-rr))
+      Closeable
+      (close [_] (send closer close-rr))
+
       Seqable
       (seq [_]
         ((fn step [^RecordReader rr splits]
@@ -57,4 +64,25 @@
                            (.initialize split tac))]
                   (returning (step rr splits)
                     (send closer update-rr rr)))))))
-         nil splits)))))
+         nil splits))
+
+      ccp/CollReduce
+      (coll-reduce [this f1] (ccp/coll-reduce this f1 (f1)))
+      (coll-reduce [_ f1 init]
+        (let [rra (atom ::initial)]
+          (try
+            (loop [acc init, splits splits, rr nil]
+              (if (and rr (.nextKeyValue ^RecordReader rr))
+                (let [acc (->> rr rr-tuple f (f1 acc))]
+                  (if (reduced? acc)
+                    @acc
+                    (recur acc splits rr)))
+                (if (empty? splits)
+                  acc
+                  (let [split (first splits), splits (rest splits)
+                        tac (new-tac conf (TaskAttemptID.)),
+                        rr (doto (.createRecordReader ifi split tac)
+                             (.initialize split tac))]
+                    (recur acc splits (swap! rra update-rr rr))))))
+            (finally
+              (close-rr @rra))))))))


reset nrepl session when worker died

reset nrepl session when worker died

--- src/main/shadow/cljs/devtools/server/nrepl_impl.clj
+++ src/main/shadow/cljs/devtools/server/nrepl_impl.clj
@@ -136,76 +136,83 @@
   ;; actually still cares about receiving results or stdout/stderr
   ;; instead just go off once and clean up after

-  (let [{:keys [relay]}
-        (api/get-runtime!)
-
-        result
-        (repl-impl/do-repl
-          worker
-          relay
-          (StringReader. code)
-          (async/chan)
-          {:init-state
-           {:ns (or (and (seq ns) (symbol ns))
-                    (:cljs-ns repl-state))}
-
-           :repl-prompt
-           (fn repl-prompt [repl-state])
-
-           :repl-read-ex
-           (fn repl-read-ex [repl-state ex]
-             (nrepl-out msg {:err (.getMessage ex)}))
-
-           :repl-result
-           (fn repl-result
-             [{:keys [ns] :as repl-state} result-as-printed-string]
-
-             ;; need to remember for later evals
-             (swap! session assoc-in [#'*repl-state* :cljs-ns] ns)
-
-             (if-not result-as-printed-string
-               ;; repl-result is called even in cases there is no result
-               ;; eg. compile errors, warnings
-               (nrepl-out msg {:value "nil"
-                               :printed-value 1
-                               :ns (str ns)})
-               ;; regular return value
-               (try
-                 (nrepl-out msg
-                   {:value (edn/read-string
-                             {:default
-                              ;; FIXME: piggieback uses own UnknownTaggedLiteral
-                              ;; not sure why? seems like it might as well skip trying to use it
-                              ;; and use the result we had instead.
-                              (fn [sym val]
-                                (throw (ex-info "unknown edn tags" {:sym sym :val val})))}
-                             result-as-printed-string)
-                    :nrepl.middleware.print/keys #{:value}
-                    :ns (str ns)})
-                 (catch Exception e
-                   (log/debug-ex e ::repl-read)
+  (if-not worker
+    (let [clj-ns (reset-session (:session msg))]
+      (nrepl-out msg {:err "The worker for this REPL has exited. You are now in CLJ again.\n"})
+      (nrepl-out msg {:value "nil"
+                      :printed-value 1
+                      :ns (str clj-ns)})
+      (nrepl-out msg {:status :done}))
+    (let [{:keys [relay]}
+          (api/get-runtime!)
+
+          result
+          (repl-impl/do-repl
+            worker
+            relay
+            (StringReader. code)
+            (async/chan)
+            {:init-state
+             {:ns (or (and (seq ns) (symbol ns))
+                      (:cljs-ns repl-state))}
+
+             :repl-prompt
+             (fn repl-prompt [repl-state])
+
+             :repl-read-ex
+             (fn repl-read-ex [repl-state ex]
+               (nrepl-out msg {:err (.getMessage ex)}))
+
+             :repl-result
+             (fn repl-result
+               [{:keys [ns] :as repl-state} result-as-printed-string]
+
+               ;; need to remember for later evals
+               (swap! session assoc-in [#'*repl-state* :cljs-ns] ns)
+
+               (if-not result-as-printed-string
+                 ;; repl-result is called even in cases there is no result
+                 ;; eg. compile errors, warnings
+                 (nrepl-out msg {:value "nil"
+                                 :printed-value 1
+                                 :ns (str ns)})
+                 ;; regular return value
+                 (try
                    (nrepl-out msg
-                     {:value result-as-printed-string
-                      :printed-value 1
-                      :ns (str ns)})))))
-
-           :repl-stderr
-           (fn repl-stderr [repl-state text]
-             (nrepl-out msg {:err text}))
-
-           :repl-stdout
-           (fn repl-stdout [repl-state text]
-             (nrepl-out msg {:out text}))})]
-
-    (when (or (= :cljs/quit result)
-              (= :repl/quit result))
-      (let [clj-ns (reset-session (:session msg))]
-        (nrepl-out msg {:err "Exited CLJS session. You are now in CLJ again.\n"})
-        (nrepl-out msg {:value (str result)
+                     {:value (edn/read-string
+                               {:default
+                                ;; FIXME: piggieback uses own UnknownTaggedLiteral
+                                ;; not sure why? seems like it might as well skip trying to use it
+                                ;; and use the result we had instead.
+                                (fn [sym val]
+                                  (throw (ex-info "unknown edn tags" {:sym sym :val val})))}
+                               result-as-printed-string)
+                      :nrepl.middleware.print/keys #{:value}
+                      :ns (str ns)})
+                   (catch Exception e
+                     (log/debug-ex e ::repl-read)
+                     (nrepl-out msg
+                       {:value result-as-printed-string
                         :printed-value 1
-                        :ns (str clj-ns)})))
-
-    (nrepl-out msg {:status :done})))
+                        :ns (str ns)})))))
+
+             :repl-stderr
+             (fn repl-stderr [repl-state text]
+               (nrepl-out msg {:err text}))
+
+             :repl-stdout
+             (fn repl-stdout [repl-state text]
+               (nrepl-out msg {:out text}))})]
+
+      (when (or (= :cljs/quit result)
+                (= :repl/quit result))
+        (let [clj-ns (reset-session (:session msg))]
+          (nrepl-out msg {:err "Exited CLJS session. You are now in CLJ again.\n"})
+          (nrepl-out msg {:value (str result)
+                          :printed-value 1
+                          :ns (str clj-ns)})))
+
+      (nrepl-out msg {:status :done}))))

 (defn handle [{:keys [session op] :as msg} next]
   (let [{::keys [build-id] :as msg} (set-build-id msg)]


WIP CLJ-1910

WIP CLJ-1910

--- src/main/clojure/clojure/tools/reader.clj
+++ src/main/clojure/clojure/tools/reader.clj
@@ -742,6 +742,47 @@
     (-> (read* rdr true nil opts pending-forms)
       syntax-quote*)))

+(defn namespace-keys [ns keys]
+  (for [key keys]
+    (if (or (symbol? key)
+            (keyword? key))
+      (let [[key-ns key-name] ((juxt namespace name) key)
+            ->key (if (symbol? key) symbol keyword)]
+        (cond
+          (nil? key-ns)
+          (->key ns key-name)
+
+          (= "_" key-ns)
+          (->key key-name)
+
+          :else
+          key))
+      key)))
+
+(defn- read-namespaced-map
+  [rdr _ opts pending-forms]
+  (let [token (read-token rdr (read-char rdr))]
+    (if-let [ns (cond
+                  (= token ":")
+                  (ns-name *ns*)
+
+                  (= \: (first token))
+                  (some-> token (subs 1) parse-symbol peek symbol resolve-ns ns-name)
+
+                  :else
+                  (some-> token parse-symbol peek))]
+
+      (let [ch (read-past whitespace? rdr)]
+        (if (identical? ch \{)
+          (let [items (read-delimited \} rdr opts pending-forms)]
+            (when-not (even? (count items))
+              (throw (Exception.)))
+            (let [keys (take-nth 2 items)
+                  vals (take-nth 2 (rest items))]
+              (zipmap (namespace-keys (str ns) keys) vals)))
+          (throw (Exception.))))
+      (throw (Exception.)))))
+
 (defn- macros [ch]
   (case ch
     \" read-string*
@@ -775,6 +816,7 @@
     \! read-comment
     \_ read-discard
     \? read-cond
+    \: read-namespaced-map
     nil))

 (defn- read-ctor [rdr class-name opts pending-forms]


ServerLoad.toString may not contain storefileUncompressedSizeMB

--- src/main/hbase_region_inspector/hbase.clj
+++ src/main/hbase_region_inspector/hbase.clj
@@ -18,11 +18,11 @@
      :store-files        (.getStorefiles load)
      :store-file-size-mb (.getStorefileSizeInMB load)}
     :store-uncompressed-size-mb
-    (->> load
-         str
-         (re-find #"storefileUncompressedSizeMB=([0-9]+)")
-         last
-         Integer/parseInt)))
+    (some->> load
+             str
+             (re-find #"storefileUncompressedSizeMB=([0-9]+)")
+             last
+             Integer/parseInt)))

 (defn- collect-server-info
   "Collects server statistics"


Add specs for assertion function evaluations

--- src/test/clojure/com/stuartsierra/lazytest_spec.clj
+++ src/test/clojure/com/stuartsierra/lazytest_spec.clj
@@ -14,74 +14,86 @@
   (given [x dummy-context-1]
          (is (= x 1) "hello" (= x 2))))

-(spec is-spec "The 'is' macro"
-      (given [it is-without-givens]
-             (spec "without any givens"
-                   (is "should create a spec"
-                       (spec? it)
+(describe
+ *ns*
+ (spec is-spec "The 'is' macro"
+       (given [it is-without-givens]
+              (spec "without any givens"
+                    (is "should create a spec"
+                        (spec? it)

-                       "should create an invokable fn"
-                       (instance? clojure.lang.IFn it)
+                        "should create an invokable fn"
+                        (instance? clojure.lang.IFn it)

-                       "should attach :doc string metadata to assertions"
-                       (= "hello" (:doc (meta (second (:children it)))))
+                        "should attach :doc string metadata to assertions"
+                        (= "hello" (:doc (meta (second (:children it)))))

-                       "should attach :form metadata to assertions"
-                       (= '(= 1 1) (:form (meta (first (:children it))))))
+                        "should attach :form metadata to assertions"
+                        (= '(= 1 1) (:form (meta (first (:children it))))))

-                   (spec "should have children"
-                         (is (seq (:children it))
+                    (spec "should have children"
+                          (is (seq (:children it))

-                             "that are specs"
-                             (every? spec? (:children it))
+                              "that are specs"
+                              (every? spec? (:children it))

-                             "that are invokable IFns"
-                             (every? #(instance? clojure.lang.IFn %) (:children it))
+                              "that are invokable IFns"
+                              (every? #(instance? clojure.lang.IFn %) (:children it))

-                             "as many as there are expressions"
-                             (= 2 (count (:children it)))))))
+                              "as many as there are expressions"
+                              (= 2 (count (:children it)))))))

-      (given [it is-with-givens]
-             (spec "with givens"
-                   (is "should create a spec"
-                       (spec? it)
+       (given [it is-with-givens]
+              (spec "with givens"
+                    (is "should create a spec"
+                        (spec? it)

-                       "should create an invokable IFns"
-                       (instance? clojure.lang.IFn it)
+                        "should create an invokable IFns"
+                        (instance? clojure.lang.IFn it)

-                       "should attach :doc string metadata to assertions"
-                       (= "hello" (:doc (meta (second (:children it)))))
+                        "should attach :doc string metadata to assertions"
+                        (= "hello" (:doc (meta (second (:children it)))))

-                       "should attach :form metadata to assertions"
-                       (= '(= x 1) (:form (meta (first (:children it))))))
+                        "should attach :form metadata to assertions"
+                        (= '(= x 1) (:form (meta (first (:children it))))))

-                   (spec "should have children"
-                         (is (seq (:children it))
+                    (spec "should have children"
+                          (is (seq (:children it))

-                             "that are specs"
-                             (every? spec? (:children it))
+                              "that are specs"
+                              (every? spec? (:children it))

-                             "that are invokable IFns"
-                             (every? #(instance? clojure.lang.IFn %) (:children it))
+                              "that are invokable IFns"
+                              (every? #(instance? clojure.lang.IFn %) (:children it))

-                             "as many as there are expressions"
-                             (= 2 (count (:children it)))
+                              "as many as there are expressions"
+                              (= 2 (count (:children it)))

-                             (spec "with contexts"
-                                   (is (seq (:contexts (first (:children it))))
-                                       "that are Context objects"
-                                       (every? context? (:contexts (first (:children it)))))))))))
+                              (spec "with contexts"
+                                    (is (seq (:contexts (first (:children it))))
+                                        "that are Context objects"
+                                        (every? context? (:contexts (first (:children it)))))))))))

-(comment
-  (spec assertions-spec "Assertions, when invoked"
-        (given [it is-without-givens]
-               (spec "should return an object"
-                     (is (not (nil? ((:first (:children it)))))
-                         "that supports success?"
-                         (ok? (success? ((:first (:children it)))))
-                         "that supports pending?"
-                         (ok? (pending? ((:first (:children it)))))
-                         "that supports error?"
-                         (ok? (error? ((:first (:children it)))))
-                         "that supports container?"
-                         (ok? (container? ((:first (:children it))))))))))+ (spec assertions-spec "Assertions, when invoked"
+       (given [it is-without-givens]
+              (spec "should return an object"
+                    (is (not (nil? ((first (:children it)))))
+                        "that supports success?"
+                        (ok? (success? ((first (:children it)))))
+                        "that supports pending?"
+                        (ok? (pending? ((first (:children it)))))
+                        "that supports error?"
+                        (ok? (error? ((first (:children it)))))
+                        "that supports container?"
+                        (ok? (container? ((first (:children it)))))))))
+
+ (spec passing-assertion "A passing assertion"
+       (given [it is-without-givens]
+              (is "should return true for success?"
+                  (true? (success? ((first (:children it)))))
+                  "should return false for error?"
+                  (false? (error? ((first (:children it)))))
+                  "should return false for pending?"
+                  (false? (pending? ((first (:children it)))))
+                  "should return false for container?"
+                  (false? (pending? ((first (:children it)))))))))


invoke console.log from worker

invoke console.log from worker

--- worker/src/worker/core.cljs
+++ worker/src/worker/core.cljs
@@ -4,7 +4,10 @@
 (enable-console-print!)

-(def b (new js/Blob (clj->js ["self.addEventListener('message', function(e) { postMessage(e.data); } ,false);"])))
+(def b (new js/Blob (clj->js ["self.addEventListener('message', function(e) {
+console.log('in worker');
+postMessage(e.data);
+} ,false);"])))

 (def w (new js/Worker (.createObjectURL js/URL b)))


Add type hints note

Add type hints note

--- clojure/basics/src/basics/core.clj
+++ clojure/basics/src/basics/core.clj
@@ -139,6 +139,9 @@
   ; wait for change
   (await a)

+  ; type hints
+  (defn len [^String x] (.length x))
+
   (let [a [1 2 3]
         b {:a 1 :b 2}
         c (list 1 2 3)]


let pr-str do some of the formatting

let pr-str do some of the formatting

--- storm-core/src/clj/backtype/storm/daemon/logviewer.clj
+++ storm-core/src/clj/backtype/storm/daemon/logviewer.clj
@@ -125,15 +125,12 @@
   (let [now-secs (current-time-secs)
         old-log-files (select-files-for-cleanup *STORM-CONF* (* now-secs 1000) log-root-dir)
         dead-worker-files (get-dead-worker-files-and-owners *STORM-CONF* now-secs old-log-files log-root-dir)]
-    (log-debug "log cleanup: now(" now-secs
-               ") old log files (" (->> old-log-files
-                                        (map #(.getName %))
-                                        (string/join ","))
-               ") dead worker files (" (->> dead-worker-files
-                                            (mapcat (fn [{l :files}] l))
-                                            (map #(.getName %))
-                                            (string/join ","))
-               ")")
+    (log-debug "log cleanup: now=" now-secs
+               " old log files " (pr-str (map #(.getName %) old-log-files))
+               " dead worker files " (->> dead-worker-files
+                                          (mapcat (fn [{l :files}] l))
+                                          (map #(.getName %))
+                                          (pr-str)))
     (dofor [{:keys [owner files]} dead-worker-files
             file files]
       (let [path (.getCanonicalPath file)]


Improve the barebones 3d template

Improve the barebones 3d template

--- resources/barebones-3d/core.clj
+++ resources/barebones-3d/core.clj
@@ -15,8 +15,9 @@
           model-mat (material :set attr)
           model-attrs (bit-or (usage :position) (usage :normal))
           builder (model-builder)]
-      (model (model-builder! builder :create-box 2 2 2 model-mat model-attrs)
-             (vector-3 0 0 0))))
+      (-> (model-builder! builder :create-box 2 2 2 model-mat model-attrs)
+          (model)
+          (assoc :x 0 :y 0 :z 0))))

   :on-render
   (fn [screen entities]


Adjust namespacing in web.app ns.

Adjust namespacing in web.app ns.

--- src/org/playasophy/wonderdome/web/app.clj
+++ src/org/playasophy/wonderdome/web/app.clj
@@ -3,13 +3,13 @@
     [clojure.string :as str]
     (compojure
       [core :refer [ANY GET POST routes]]
-      [route :as route])
+      [route :refer [not-found]])
     [com.stuartsierra.component :as component]
     [ring.adapter.jetty :as jetty]
     (ring.middleware
       [keyword-params :refer [wrap-keyword-params]]
       [params :refer [wrap-params]])
-    [ring.util.response :refer [header response status]])
+    [ring.util.response :as r])
   (:import
     org.eclipse.jetty.server.Server))

@@ -18,9 +18,9 @@

 (defn- method-not-allowed
   [& allowed]
-  (-> (response nil)
-      (header "Allow" (str/join ", " (map (comp str/upper-case name) allowed)))
-      (status 405)))
+  (-> (r/response nil)
+      (r/header "Allow" (str/join ", " (map (comp str/upper-case name) allowed)))
+      (r/status 405)))

@@ -31,23 +31,23 @@
   [config]
   (routes
     (GET "/" []
-      (response "Hello World"))
+      (r/response "Hello World"))
     (ANY "/" []
       (method-not-allowed :get))

     (GET "/about" []
-      (response "TODO: render about page"))
+      (r/response "TODO: render about page"))
     (ANY "/about" []
       (method-not-allowed :get))

     ; TODO: input endpoint

     (GET "/admin" []
-      (response "TODO: render admin page"))
+      (r/response "TODO: render admin page"))
     (ANY "/admin" []
       (method-not-allowed :get))

-    (route/not-found {:message "Not Found"})))
+    (not-found {:message "Not Found"})))

 (defn wrap-middleware


I guess doseq is probably the way

I guess doseq is probably the way

--- src/tailrecursion/boot/middleware/jar.clj
+++ src/tailrecursion/boot/middleware/jar.clj
@@ -34,7 +34,7 @@
 (defn- add! [^JarOutputStream target ^File base ^File src]
   (printf "Adding '%s' to jar.\n" (.getPath src))
   (if (.isDirectory src)
-    (doall (map (partial add! target base) (.listFiles src)))
+    (doseq [f (.listFiles src)] (add! target base f))
     (doto target (.putNextEntry (make-entry base src)) (write! src) (.closeEntry))))

 (defn jar [handler]
@@ -51,5 +51,5 @@
           jar-file    (file (:output-dir jspec) jar-name)
           directories (map file (:directories jspec))]
       (with-open [j (JarOutputStream. (output-stream jar-file) (make-manifest))]
-        (doall (map (partial add! j) directories directories)))
+        (doseq [d directories] (add! j d d)))
       (handler (assoc spec :jar jspec)))))


added TODO items to fix loading problems where multiple loads are queued that share common top-level keys

--- src/untangled/client/impl/data_fetch.cljs
+++ src/untangled/client/impl/data_fetch.cljs
@@ -81,11 +81,16 @@
   ."
   [reconciler]
   (let [state (om/app-state reconciler)
-        items-to-load (get @state :om.next/ready-to-load)]
+        items-to-load (get @state :om.next/ready-to-load)
+        ;; Go through the items-to-load. If there are two that include the same top-level keywords (on a join or prop)
+        ;; then only take the first (placing the latter into a separate collection). The result should be:
+        non-dupe-items items-to-load ; TODO: a sequence of items that contain no dupe keys
+        items-to-defer [] ; TODO: all of the items not in non-dupe-items
+        ]
     (when-not (empty? items-to-load)
       (place-load-markers state items-to-load)
-      (swap! state assoc :ui/loading-data true :om.next/ready-to-load [])
-      {:query         (full-query items-to-load)
+      (swap! state assoc :ui/loading-data true :om.next/ready-to-load items-to-defer)
+      {:query         (full-query non-dupe-items)
        :on-load       (loaded-callback reconciler)
        :on-error      (error-callback reconciler)
        :callback-args items-to-load})))


[CS] Allow table key to differ from table name

So we can have hyphens in key names but underscores in the table
names (for example).

--- src/vip/data_processor/validation/csv.clj
+++ src/vip/data_processor/validation/csv.clj
@@ -86,7 +86,7 @@
   (fn [ctx]
     (when-let [file-to-load (find-input-file ctx filename)]
       (let [sql-table (get-in ctx [:tables table])
-            column-names (sqlite/column-names (:db ctx) (name table))
+            column-names (sqlite/column-names (:db ctx) (:name sql-table))
             select-columns (fn [row] (select-keys row column-names))
             contents (read-csv-with-headers file-to-load)
             transforms (apply comp select-columns row-transform-fns)


declare build-subvec

declare build-subvec

--- src/cljs/cljs/core.cljs
+++ src/cljs/cljs/core.cljs
@@ -3178,6 +3178,8 @@
   ([vec node i off meta]
      (ChunkedSeq. vec node i off meta nil)))

+(declare build-subvec)
+
 (deftype Subvec [meta v start end ^:mutable __hash]
   Object
   (toString [this]


CMR-343: added a util function

CMR-343: added a util function

--- src/cmr/common/util.clj
+++ src/cmr/common/util.clj
@@ -91,4 +91,25 @@
   [m]
   (map-keys csk/->kebab-case-keyword m))

+;; TODO - remove these comments after review
+;; See: http://rosettacode.org/wiki/Determine_if_a_string_is_numeric#Clojure
+;; Selected this function to avoid usage of try/catch block
+;; Changed function name from numeric? to numeric-val? to avoid confusion with number?
+;; This works with any sequence of characters, not just Strings, e.g.:
+;; (numeric-val? [\1 \2 \3])  ;; yields logical true
+;; (numeric-val? "c9")  ;; yields logical false
+;; (numeric-val? ""), (numeric-val? nil) ;; yields nil
+;; (numeric-val? "12.4e05") ;; yields false
+;; (numeric-val? "-2.02") ;; yeilds true
+(defn numeric-val? [s]
+  "Returns true if supplied value is a number, false if value is alphanumeric and
+  nil for empty string and nil values"
+  (if-let [s (seq s)]
+    (let [s (if (= (first s) \-) (next s) s)
+          s (drop-while #(Character/isDigit %) s)
+          s (if (= (first s) \.) (next s) s)
+          s (drop-while #(Character/isDigit %) s)]
+      (empty? s))))

+
+


Fix broken test. Expand exploration range in test.

--- test/hydrofoil/expectations/evolution.clj
+++ test/hydrofoil/expectations/evolution.clj
@@ -10,7 +10,7 @@

 (expect true
   (let [child (new-indv (NACA-design 2 4 12))]
-    (and (<= (child :P) 5) (>= (child :P 3)))))
+    (and (<= (child :P) 9) (>= (child :P 0)))))

 (expect true
   (let [child (new-indv (NACA-design 2 4 12))]


Test peers.

Test peers.

--- test/onyx/coordinator/multi_peer_test.clj
+++ test/onyx/coordinator/multi_peer_test.clj
@@ -108,12 +108,19 @@
               (extensions/touch-place sync (:completion nodes))
               (<!! offer-ch-spy))

-            (testing "All tasks are complete"
-              (let [db (d/db (:conn log))
-                    query '[:find (count ?task) :where
-                            [?task :task/complete? true]]
-                    result (ffirst (d/q query db))]
-                (is (= result 3))))))))
+            (let [db (d/db (:conn log))]
+
+              (testing "All tasks are complete"
+                (let [query '[:find (count ?task) :where
+                              [?task :task/complete? true]]
+                      result (ffirst (d/q query db))]
+                  (is (= result 3))))
+
+              (testing "All peers are idle"
+                (let [query '[:find (count ?peer) :where
+                              [?peer :peer/status :idle]]
+                      result (ffirst (d/q query db))]
+                  (is (= result 2)))))))))

     {:eviction-delay 50000}))


(PDB-2075) Clean up template DB via shutdown hook

--- test/puppetlabs/puppetdb/testutils/db.clj
+++ test/puppetlabs/puppetdb/testutils/db.clj
@@ -105,6 +105,11 @@
   (locking ensure-pdb-db-templates-exist
     (when-not @template-created
       (assert (valid-sql-id? template-name))
+      (.addShutdownHook
+       (Runtime/getRuntime)
+       (Thread. #(jdbc/with-db-connection (db-admin-config)
+                   (jdbc/do-commands-outside-txn
+                    (format "drop database if exists %s" template-name)))))
       (jdbc/with-db-connection (db-admin-config)
         (jdbc/do-commands-outside-txn
          (format "drop database if exists %s" template-name)


Debug #1717

Debug #1717

--- backend/src/akvo/lumen/auth.clj
+++ backend/src/akvo/lumen/auth.clj
@@ -1,6 +1,7 @@
 (ns akvo.lumen.auth
   (:require [akvo.commons.jwt :as jwt]
             [cheshire.core :as json]
+            [clojure.tools.logging :as log]
             [clj-http.client :as client]
             [clojure.set :as set]
             [clojure.string :as s]
@@ -48,6 +49,7 @@
   Otherwiese grant access. This implies that access is on tenant level."
   [handler]
   (fn [{:keys [jwt-claims] :as request}]
+    (log/warn (select-keys jwt-claims ["email" "realm_access"]))
     (cond
       (public-path? request) (handler request)
       (nil? jwt-claims) not-authenticated


dump islands, create coords for everyone else

--- samples/twitterbuzz/src/twitterbuzz/layout.cljs
+++ samples/twitterbuzz/src/twitterbuzz/layout.cljs
@@ -23,8 +23,14 @@
   (sqrt (+ (sqr (- x2 x1)) (sqr (- y2 y1)))))

 (defn init-state [mentions-data]
-  {:locs (zipmap (keys mentions-data) (repeatedly #(random-loc)))
-   :mentions mentions-data})
+  (let [connected (reduce (fn [ret [k {:keys [mentions]}]]
+                            (if (pos? (count mentions))
+                              (into (conj ret k) (keys mentions))
+                              ret))
+                          #{} mentions-data)
+        mentions-data (select-keys mentions-data connected)]
+    {:locs (zipmap connected (repeatedly #(random-loc)))
+     :mentions mentions-data}))

 (defn score [{:keys [locs mentions]}]
   (let [metric (fn [d w] (sqr (- 1 (* d w))))
@@ -50,9 +56,12 @@
      :mentions mentions}))

 (defn permute-move [{:keys [locs mentions]} t]
-  (let [adj #(min 1.0 (max 0 (+ % (- (* (ann/random) 0.2) 0.1))))
-        move (fn [{:keys [x y]}]
-               {:x (adj x) :y (adj y)})
+  (let [adj #(min 1.0 (max 0 (+ % (- (* (ann/random) 0.1) 0.05))))
+        move (fn [{:keys [x y] :as loc}]
+               (if true ;;(> (ann/random) 0.8)
+                 {:x (adj x)
+                  :y (adj y)}
+                 loc))
         xys (vec (vals locs))]
     {:locs (zipmap (keys locs) (map move (vals locs)))
      :mentions mentions}))


from DO

from DO

--- proto-oct/src/proto_oct/genfile.clj
+++ proto-oct/src/proto_oct/genfile.clj
@@ -44,4 +44,5 @@
              (poc/typedef "float" "F32")
              (poc/typedef "double" "F64")])
  (poc/typedef "U8" "Bool")
+
 )


Add version to config file

Add version to config file

--- src/discuss/config.cljs
+++ src/discuss/config.cljs
@@ -1,6 +1,8 @@
 (ns discuss.config)

 (def project "discuss")
+
+(def version "0.2.1")

 (def user "Q2hyaXN0aWFu")


simpler :cmp/wire-comp syntax

simpler :cmp/wire-comp syntax

--- Clojure-Websockets/MainApp/src/cljs/birdwatch/core.cljs
+++ Clojure-Websockets/MainApp/src/cljs/birdwatch/core.cljs
@@ -20,10 +20,10 @@

 (sb/send-mult-cmd
   switchboard
-  [[:cmd/wire-comp {:cmp-id :ws-comp :cmp (sente/component)}]
-   [:cmd/wire-comp {:cmp-id :state-comp :cmp (state/component)}]
-   [:cmd/wire-comp {:cmp-id :tweets-comp :cmp (tw/component)}]
-
+  [[:cmd/wire-comp [:ws-comp (sente/component)]]
+   [:cmd/wire-comp [:state-comp (state/component)]]
+   [:cmd/wire-comp [:tweets-comp (tw/component)]]
+
    [:cmd/make-comp {:cmp-id :cloud-comp :mk-state-fn cloud/mk-state :state-pub-handler-fn cloud/state-pub-handler
                     :opts   {:throttle-ms 5000}}]
    [:cmd/make-comp {:cmp-id :wc-c-comp :mk-state-fn wc-c/mk-state :state-pub-handler-fn wc-c/state-pub-handler


Add note about not dropping response text on the floor when a form action fails. Useful to grep for if we want to make a pass over the codebase and make sure handle all the cases.

--- frontend/controllers/api.cljs
+++ frontend/controllers/api.cljs
@@ -480,32 +480,32 @@

 (defmethod api-event [:update-heroku-key :failed]
   [target message status {:keys [resp context]} state]
-  ;; XXX Should we put the resp text somewhere, maybe the flash?
+  ;; XXX-ResponseText Don't drop the resp text on the floor here,
+  ;; should be shown to the user
   state)

 (defmethod api-event [:update-heroku-key :success]
   [target message status {:keys [resp context]} state]
-  ;; XXX Do we have to check if the user is 'fresh' here?
   (update-in state state/user-path assoc :heroku_api_key (:heroku_api_key resp)))

 (defmethod api-event [:create-api-token :failed]
   [target message status {:keys [resp context]} state]
-  ;; XXX Should we put the resp text somewhere, maybe the flash?
+  ;; XXX-ResponseText Don't drop the resp text on the floor here,
+  ;; should be shown to the user
   state)

 (defmethod api-event [:create-api-token :success]
   [target message status {:keys [resp context]} state]
-  ;; XXX Do we have to check if the user is 'fresh' here?
   (update-in state state/user-tokens-path conj resp))

 (defmethod api-event [:delete-api-token :failed]
   [target message status {:keys [resp context]} state]
-  ;; XXX Should we put the resp text somewhere, maybe the flash?
+  ;; XXX Don't drop the resp text on the floor here, should be shown
+  ;; to the user
   state)

 (defmethod api-event [:delete-api-token :success]
   [target message status {:keys [resp context]} state]
-  ;; XXX Do we have to check if the user is 'fresh' here?
   (let [deleted-token (:token context)]
     (update-in state state/user-tokens-path (fn [tokens]
                                               (vec (remove #(= (:token %) (:token deleted-token)) tokens))))))


go-ified the puller (input)

go-ified the puller (input)

--- src/fowles/admitter.clj
+++ src/fowles/admitter.clj
@@ -5,30 +5,35 @@
    + Output: Put for requester."
   (:require [fowles.util :as util]
             [zeromq.zmq :as zmq]
-            [clojure.core.async :refer [chan >!!]]))
+            [clojure.core.async :refer [go-loop chan >!]]))

 (defn- mk-puller
   [ctx addr]
   (doto (zmq/socket ctx :pull)
     (zmq/connect addr)))

-(defn- enq-from-puller
-  [host port to-ch]
-  (let [ctx  (zmq/context)
-        addr (util/mk-connect-addr host port)]
-    (with-open [puller (mk-puller ctx addr)]
-      (println "Ready to receive input from addr:" addr)
-      (while true
-        (let [msg (zmq/receive-str puller)]
-          (println "receiving:" msg)
-          ;; -blocking- put
-          (>!! to-ch msg))))))
+(defn- report-unused-input
+  [msg]
+  ;; TODO: Report to failure sink!
+  )

 ;;-------------------

 (defn from-puller
   ":: int -> chan"
   [host port]
-  (let [to-ch (chan)]  ;; no buffer!
-    (.start (Thread. #(enq-from-puller host port to-ch)))
+    ;; (.start (Thread. #(enq-from-puller host port to-ch)))
+  (let [to-ch  (chan)
+        ctx    (zmq/context)
+        addr   (util/mk-connect-addr host port)
+        puller (mk-puller ctx addr)]
+    (println "Ready to receive input from addr:" addr)
+    (go-loop []
+      (let [msg (zmq/receive-str puller)]
+        (println "receiving:" msg)
+        (if (>! to-ch msg)
+          (recur)
+          (do
+            (report-unused-input msg)
+            (zmq/close puller)))))
     to-ch))


println hack

println hack

--- src/fugue_app/repl.cljs
+++ src/fugue_app/repl.cljs
@@ -37,6 +37,8 @@
 (defn start-repl!
   "Starts a fugue repl in the input CodeMirror"
   [cm]
+  (set! *print-fn* (fn [& args] (apply (partial cm/writeln! cm) args)))
   (doto cm
+    (set! (.-log js/console) #(cm/writeln! cm %))
     (cm/add-handler "Enter" #(submit-handler cm))
     (repp! "()")))


Add mdl layout to views

Add mdl layout to views

--- resources/boot/new/proud/views.cljs
+++ resources/boot/new/proud/views.cljs
@@ -6,21 +6,26 @@
               [{{name}}.events :as events]))

 (rum/defc emitting-button [store label event]
-  (mdl/button
-   {:mdl [:ripple]
-    :on-click #(ptk/emit! store event)}
-   label))
+  (mdl/button {:mdl [:ripple] :on-click #(ptk/emit! store event)} label))

 (rum/defc main < rum/reactive [store]
   (let [state (rx/to-atom store)
         button-clicked (rum/react (rum/cursor state :button/clicked))]
-    [:div
-     [:h1 "Fresh {{name}} project "]
-     [:h2
-      "Find the code for this page in "
-      [:code "`src/{{name}}/views.cljs`"]]
-     (if button-clicked
-       [:div
-        [:h3 "Oh, you already figured out the clicking!"]
-        (emitting-button store "Unclick?" (events/->ButtonUnclicked))]
-       (emitting-button store "Click me!" (events/->ButtonClicked)))]))
+    (mdl/layout
+     (mdl/header
+      (mdl/header-row
+       (mdl/layout-title "Fresh {{name}} project ")))
+     (mdl/main-content
+      (mdl/grid
+       (mdl/cell
+        {:mdl [:12]}
+        "Find the code for this page in"
+        [:code "`src/{{name}}/views.cljs`"])
+       (if button-clicked
+         (mdl/cell
+          {:mdl [:12]}
+          [:h3 "Oh, you already figured out the clicking!"]
+          (emitting-button store "Unclick?" (events/->ButtonUnclicked)))
+         (mdl/cell
+          {:mdl [:12]}
+          (emitting-button store "Click me!" (events/->ButtonClicked)))))))))


Function to invert image

Function to invert image

--- src/harnocode/core.cljs
+++ src/harnocode/core.cljs
@@ -59,7 +59,6 @@
       (let [l                (count group)
             [column rest-ts] (fill-column tokens l)
             extra-len (- (count column) l)]
-        (println extra-len)
         [(conj result column) rest-ts extra-len]))

 (defn arrange-tokens-line [ts line]
@@ -88,6 +87,10 @@
    (str (:value token))
    (str (:value token) " ")))

+(defn invert-image [img]
+  (let [invert-row (fn [row] (map #(if (= % 0) 1 0) row))]
+   (map invert-row img)))
+
 ;; Tries hard to make piece of code look like img
 ;; code -- string
 ;; img  -- 2d matrix of 0's and 1's
@@ -95,7 +98,7 @@
 (defn harnify [code img w]
   (let [tokens (js->clj (js/esprima.tokenize code) :keywordize-keys true)
         ts (map token-to-text tokens)]
-    (string/join "\n" (reverse (arrange-tokens ts img)))              ; img must be resized by now, no need in w
+    (string/join "\n" (reverse (arrange-tokens ts (invert-image img))))              ; img must be resized by now, no need in w
     ))

 (let [code      "function skipComment() {


Allow `:hawk-options` to take `:sensitivity` config. (#740)

--- sidecar/src/figwheel_sidecar/schemas/config.clj
+++ sidecar/src/figwheel_sidecar/schemas/config.clj
@@ -317,7 +317,14 @@

   :ansi-color-output false")

-(def-key ::hawk-options (s/map-of #{:watcher} #{:barbary :java :polling})
+(def-key ::hawk-options
+  (s/every
+    (fn [[k v]]
+      (contains?
+        (-> {:watcher #{:barbary :java :polling}
+             :sensitivity #{:low :medium :high}}
+          (get k))
+        v)))

   "If you need to watch files with polling instead of FS events. This can
 be useful for certain docker environments.


Fixed day_10/project.clj description

Fixed day_10/project.clj description

--- day_10/project.clj
+++ day_10/project.clj
@@ -1,5 +1,5 @@
 (defproject day_10 "1.0.0"
-  :description "Clojure solution to day 9 of the Advent of Code 2016"
+  :description "Clojure solution to day 10 of the Advent of Code 2016"
   :url "https://github.com/lux01/advent-of-code-2016"
   :license {:name "MIT License"
             :url "https://github.com/lux01/advent-of-code-2016/blob/master/LICENSE"}


added defaut ports for -main and -dev-main

--- src/mail_query/core.clj
+++ src/mail_query/core.clj
@@ -14,6 +14,7 @@

 (def mailgun-domain (System/getenv "MAILGUN_DOMAIN"))
 (def mailgun-api-key (System/getenv "MAILGUN_API_KEY"))
+(def app-port (System/getenv "APP_PORT"))

 (def resource (str "https://api.mailgun.net/v3/" mailgun-domain "/events"))

@@ -50,12 +51,18 @@
       (wrap-file-info)
       (wrap-server)))

-(defn -main [port]
+(defn -main
+  ([]
+   (-main 80))
+  ([port]
   (http-kit/run-server app
-                       {:port (Integer. port)}))
+                       {:port (Integer. port)})))

-(defn -dev-main [port]
-  (http-kit/run-server (wrap-reload #'app)
-                       {:port (Integer. port)}))
+(defn -dev-main
+  ([]
+  (-dev-main 3000))
+  ([port]
+   (http-kit/run-server (wrap-reload #'app)
+                       {:port (Integer. port)})))


rename misaki.template functions and variables

--- src/misaki/template.clj
+++ src/misaki/template.clj
@@ -38,8 +38,8 @@
   [file] (parse-template-option (slurp file)))

 (defmethod parse-template-option String
-  [data]
-  (let [lines  (map str/trim (str/split-lines data))
+  [slurped-data]
+  (let [lines  (map str/trim (str/split-lines slurped-data))
         params (remove nil? (map #(re-seq #"^;+\s*@(\w+)\s+(.+)$" %) lines))
         option (into {} (for [[[_ k v]] params] [(keyword k) v]))]
     (assoc option :tag (-> option :tag parse-tag-string))))
@@ -56,10 +56,10 @@

 ; =load-template-data
 (defn load-template-data
-  "Load template data(String) and option."
+  "Load template slurped body(String) and option."
   [#^File file]
   {:pre [(file? file)]}
-  (let [data (slurp file)
+  (let [data   (slurp file)
         option (parse-template-option data)
         result (list [data option])]
     (if-let [parent (-?> option :layout make-layout-filename io/file)]


proper card reset when moving to hand, deck or discard

--- src/node/game/core.cljs
+++ src/node/game/core.cljs
@@ -27,6 +27,15 @@
              (swap! state update-in [side (first c)] #(- % (last c)))))
       false)))

+(defn desactivate [state side card]
+  (let [c (dissoc card :counter :advance-counter :current-strength :abilities)
+        cdef (card-def card)]
+    (when-let [leave-effect (:leave-play (card-def card))]
+      (leave-effect state side card nil))
+    (when-let [mu (:memoryunits card)]
+      (gain state :runner :memory mu))
+    c))
+
 (defmulti move (fn [state side target to front] (map? target)))

 (defmethod move false [state side server to]
@@ -39,11 +48,12 @@
 (defmethod move true [state side {:keys [zone cid] :as card} to front]
   (when card
     (let [dest (if (sequential? to) to [to])
-          moved-card (assoc card :zone dest)]
+          c (if (#{:discard :hand :deck} to) (desactivate state side card) card)
+          moved-card (assoc c :zone dest)]
       (if front
         (swap! state update-in (cons side dest) #(cons moved-card (vec %)))
         (swap! state update-in (cons side dest) #(conj (vec %) moved-card)))
-      (swap! state update-in (cons (to-keyword (:side card)) zone)
+      (swap! state update-in (cons (to-keyword (:side c)) zone)
              (fn [coll] (remove-once #(not= (:cid %) cid) coll)))
       moved-card)))

@@ -290,15 +300,9 @@
   (when (>= (get-in @state [side :agenda-point]) (get-in @state [side :agenda-point-req]))
     (system-msg state side "wins the game")))

-(defn desactivate [state side card]
-  (when-let [leave-effect (:leave-play (card-def card))] (leave-effect state side card nil))
-  (when-let [mu (:memoryunits card)] (gain state :runner :memory mu)))
-
 (defn trash [state side {:keys [zone] :as card}]
-  (let [c (assoc card :counter nil :advance-counter nil :current-strength nil)
-        cdef (card-def c)
-        moved-card (move state (to-keyword (:side card)) c :discard)]
-    (when (#{:servers :rig} (first zone)) (desactivate state side card))
+  (let [cdef (card-def card)
+        moved-card (move state (to-keyword (:side card)) card :discard)]
     (when-let [trash-effect (:trash-effect cdef)]
       (resolve-ability state side trash-effect moved-card nil))
     (trigger-event state side :trash moved-card)))


fix show debt on pay action active

fix show debt on pay action active

--- src/ombs/view/event.clj
+++ src/ombs/view/event.clj
@@ -55,7 +55,7 @@

       "in-progress" (if (core/participated? uname name date)
                      {:button  (get-button :pay event)
-                      :money (partial content-wrap (core/debt uname name date))}
+                      :money (core/debt uname name date)}

                      {:button  (get-button :participate event)
                       :money (fns/part-price


[ref] Use 'div' event component (I wanna react T_T).

--- src/ombs/view/event.clj
+++ src/ombs/view/event.clj
@@ -12,13 +12,13 @@
 (declare fill-parts)
 (declare participate-action)
 (declare pay-action)
-(def event-sel [:.event])
+(def event-sel [:.event2])
 (h/defsnippet event-elem "../resources/public/event.html" event-sel [{:keys [name price date author status parts]}]
-  [:.name]              (h/set-attr :value name)
-  [:.date]              (h/set-attr :value date)
-  [:.author]            (h/set-attr :value author)
-  [:.price]             (h/set-attr :value (str price))
-  [:.debt]              (h/set-attr :value (core/debt (sess/get :username) name date))
+  [:.name]              (h/content name)
+  [:.date]              (h/content date)
+  [:.author]            (h/content author)
+  [:.price]             (h/content (str price))
+  [:.debt]              (h/content (str (core/debt (sess/get :username) name date)))
   [:#parts-row]         (partial fill-parts parts)
   [:.action.participate](partial participate-action name date status)
   [:.action.pay]        (partial pay-action name date)


Change JSON output key to be the correct 'str' instead of 'foo'

--- clojure/src/leftpad/handler.clj
+++ clojure/src/leftpad/handler.clj
@@ -12,7 +12,7 @@
   (if (= len "0") mystr (format (str "%" (str len) "s") mystr)))

 (defroutes app-routes
-  (GET "/" {:keys [params] :as request} (response {:foo
+  (GET "/" {:keys [params] :as request} (response {:str
                                                   (leftpad (get params :str "") (get params :len "0"))}))
   (route/not-found "Not Found"))


[#2676] Use single value for feature flag

When enabling `rqg` flag we can use a single value `true` for
enabling/disabling

The different code-path gets enabled by:

```
insert into environment(id, "value") VALUES('rqg', 'true'::jsonb);
```

--- backend/src/akvo/lumen/lib/import/flow_common.clj
+++ backend/src/akvo/lumen/lib/import/flow_common.clj
@@ -111,7 +111,7 @@
 (defn questions
   "Get the list of questions from a form"
   [environment form]
-  (if (first (get environment "rqg"))
+  (if (get environment "rqg")
     (questions-with-rqg-in-one-column form)
     (questions-current-implementation form)))

@@ -154,7 +154,7 @@
      ids-to-adapt)))

 (defn- questions-responses-adapter [environment questions responses]
-  (if (first (get environment "rqg"))
+  (if (get environment "rqg")
     (questions-responses-with-rqg-in-one-column questions responses)
     responses))

@@ -167,7 +167,7 @@
   [environment questions responses]
   (->> responses
        (questions-responses-adapter environment questions)
-       vals
+       vals
        (map first)
        (apply merge)))


CMR-2397: Make lowercase mappings use doc-values fields based on configuration

--- search-app/src/cmr/search/data/query_to_elastic.clj
+++ search-app/src/cmr/search/data/query_to_elastic.clj
@@ -198,18 +198,31 @@

 (defmethod q2e/concept-type->sort-key-map :granule
   [_]
-  {:provider :provider-id.lowercase-doc-values
-   :entry-title :entry-title.lowercase
-   :short-name :short-name.lowercase
-   :version :version-id.lowercase
-   :granule-ur :granule-ur.lowercase2
-   :producer-granule-id :producer-gran-id.lowercase2
-   :readable-granule-name :readable-granule-name-sort2
-   :data-size :size-doc-values
-   :platform :platform-sn.lowercase-doc-values
-   :instrument :instrument-sn.lowercase-doc-values
-   :sensor :sensor-sn.lowercase-doc-values
-   :project :project-refs.lowercase-doc-values})
+  (let [default-mappings {:provider :provider-id.lowercase
+                          :provider-id :provider-id.lowercase
+                          :data-size :size
+                          :entry-title :entry-title.lowercase
+                          :short-name :short-name.lowercase
+                          :version :version-id.lowercase
+                          :granule-ur :granule-ur.lowercase2
+                          :producer-granule-id :producer-gran-id.lowercase2
+                          :readable-granule-name :readable-granule-name-sort2
+                          :platform :platform-sn.lowercase
+                          :instrument :instrument-sn.lowercase
+                          :sensor :sensor-sn.lowercase
+                          :project :project-refs.lowercase}]
+    (if (use-doc-values-fields)
+      (merge default-mappings {:provider :provider-id.lowercase-doc-values
+                               :provider-id :provider-id.lowercase-doc-values
+                               :size :size-doc-values
+                               :data-size :size-doc-values
+                               :platform :platform-sn.lowercase-doc-values
+                               :instrument :instrument-sn.lowercase-doc-values
+                               :sensor :sensor-sn.lowercase-doc-values
+                               :project :project-refs.lowercase-doc-values
+                               :start-date :start-date-doc-values
+                               :end-date :end-date-doc-values})
+      default-mappings)))

 (defmethod q2e/concept-type->sub-sort-fields :collection
   [_]


[#2650] Add :dataset-id to undo transformation spec payload

--- backend/src/akvo/lumen/lib/transformation/engine.clj
+++ backend/src/akvo/lumen/lib/transformation/engine.clj
@@ -204,7 +204,7 @@
             (db.transformation/touch-dataset tenant-conn {:id dataset-id})
             (db.transformation/drop-table tenant-conn {:table-name previous-table-name})
             (lib/created next-dataset-version)))
-        (let [transformation (first transformations)
+        (let [transformation (assoc (first transformations) :dataset-id dataset-id)
               {:keys [success? message columns execution-log] :as transformation-result}
               (try-apply-operation deps table-name columns transformation)]
           (if success?


whitespace

whitespace

--- src/babel/generate.cljc
+++ src/babel/generate.cljc
@@ -244,13 +244,13 @@
         from-bolt bolt ;; so we can show what (add-complement) did to the input bolt, for logging.
         spec (unifyc spec (get-in bolt path))
         immediate-parent (get-in bolt (butlast path))
-        complement-candidate-lexemes (if (not (= true
-                                                 (get-in bolt (concat path [:phrasal]))))
-                                       (let [cached (if cache
-                                                      (lazy-seq (get-lex immediate-parent :comp cache spec))
-                                                      (do (log/warn (str "no cache: will go through entire lexicon to find candidate complements."))
-                                                          nil))]
-                                         (if cached cached (flatten (vals lexicon)))))
+        complement-candidate-lexemes
+        (if (not (= true
+                    (get-in bolt (concat path [:phrasal]))))
+          (let [cached (if cache
+                         (get-lex immediate-parent :comp cache spec))]
+            (if cached cached (lazy-seq (flatten (vals lexicon))))))
+
         complement-pre-check (fn [child parent path-to-child]
                                (let [child-in-bolt (get-in bolt path-to-child)
                                      result (not (fail?


add :pred to (defn show-spec)

add :pred to (defn show-spec)

--- src/babel/generate.cljc
+++ src/babel/generate.cljc
@@ -233,6 +233,8 @@
          (str "; rule=" (strip-refs (get-in spec [:rule]))))
        (if (not (= (get-in spec [:synsem :agr] ::none) ::none))
          (str "; agr=" (strip-refs (get-in spec [:synsem :agr]))))
+       (if (not (= (get-in spec [:synsem :sem :pred] ::none) ::none))
+         (str "; pred=" (strip-refs (get-in spec [:synsem :sem :pred]))))
        (if (get-in spec [:synsem :subcat :1 :cat])
          (str "; subcat1=" (strip-refs (get-in spec [:synsem :subcat :1 :cat]))))
        (if (get-in spec [:synsem :subcat :2 :cat])


increase max-total-depth to 20

increase max-total-depth to 20

--- src/babel/generate.cljc
+++ src/babel/generate.cljc
@@ -16,7 +16,8 @@
                                         )]))

 ;; during generation, will not decend deeper than this when creating a tree:
-(def ^:const max-total-depth 10)
+;; should also be possible to override per-language.
+(def ^:const max-total-depth 20)

 ;; use map or pmap.
 (def ^:const mapfn map)


add update_math task

add update_math task

--- src/polismath/tasks.clj
+++ src/polismath/tasks.clj
@@ -48,6 +48,12 @@
         (darwin/notify-of-status darwin (:task_data params) "failed")))))

+(defmethod dispatch-task! :update_math
+  [{:as poller :keys [darwin conversation-manager]} task-record]
+  (log/debug "Dispatching update_math task for:" task-record)
+  (conv-man/queue-message-batch! conversation-manager :votes (-> task-record :task_data :zid) []))
+
+
 (defn poll
   [{:as poller :keys [config postgres kill-chan]}]
   (log/debug ">> Initializing task poller loop")


Rendering msgs using color.

Rendering msgs using color.

--- src/cbfg/world-net.cljs
+++ src/cbfg/world-net.cljs
@@ -55,7 +55,7 @@
                                                         (= (last actx) "net-1"))
                                                       (:actxs vis)))))
         addrs (atom {})
-        locs (atom {})]
+        coords (atom {})]
     (doseq [[[addr port] accept-chs] (:listens net-state)]
       (swap! addrs #(assoc-in % [addr :listens port] true)))
     (doseq [[send-ch stream] (:streams net-state)]
@@ -77,7 +77,11 @@
                                          (get (:listens addr-v) accept-port))
                                 "LISTEN")
                               (mapv (fn [[[from-port to-addr to-port] msgs]]
-                                      ["
" from-port " --> " to-addr to-port "= " msgs "
"])
+                                      ["
" from-port " --> " to-addr to-port "= "
+                                       (mapv (fn [[deliver-at msg]]
+                                               ["
X
"])
+                                             msgs)
+                                       "
"])
                                     (sort-by first accept-addr-port-v))
                               "
"])
                            (sort-by first (:outs addr-v)))


[#1077] Tweak map point appearance

[#1077] Tweak map point appearance

--- backend/src/akvo/lumen/lib/visualisation/map_config.clj
+++ backend/src/akvo/lumen/lib/visualisation/map_config.clj
@@ -5,11 +5,11 @@
   (let [point-size (if (string? point-size)
                      (Long/parseLong point-size)
                      point-size)]
-    ({1 4
-      2 5
-      3 7
+    ({1 5
+      2 7
+      3 9
       4 10
-      5 13} point-size 8)))
+      5 13} point-size 5)))

 (defn point-color-css [point-color-column point-color-mapping]
   (when point-color-column
@@ -26,7 +26,7 @@
               marker-allow-overlap: true;
               marker-fill-opacity: 0.8;
               marker-fill: #6ca429;
-              marker-line-color: #ddd;
+              marker-line-color: #fff;
               marker-width: %s;
               %s
            }"


travis

travis

--- script/run_native_tests.clj
+++ script/run_native_tests.clj
@@ -10,7 +10,7 @@
 (a/go
   (clojure.java.shell/sh "./node_modules/.bin/react-native" "start"))

-(a/<!! (a/timeout 3000))
+(a/<!! (a/timeout 5000))

 (println "Starting Tests on Simulator...")
 (let [r (clojure.java.shell/sh "./node_modules/.bin/react-native" "run-ios")]


Updated popover-content-wrapper doco for demo

--- src/re_com/popover.cljs
+++ src/re_com/popover.cljs
@@ -318,8 +318,8 @@
 ;;--------------------------------------------------------------------------------------------------

 (def popover-content-wrapper-args-desc
-  [{:name :showing-injected? :required true                         :type "boolean atom"                                    :description "an atom. When the value is true, the popover shows"}
-   {:name :position-injected :required true                         :type "keyword atom"     :validate-fn position?         :description [:span "relative to this anchor. One of " position-options-list]}
+  [{:name :showing-injected? :required true                         :type "boolean atom"                                    :description [:span "an atom. When the value is true, the popover shows." [:br] [:strong "NOTE: "] "When used as direct " [:code ":popover"] " arg in popover-anchor-wrapper, this arg will be injected automatically by popover-anchor-wrapper. If using your own popover function, you must add this yourself"]}
+   {:name :position-injected :required true                         :type "keyword atom"     :validate-fn position?         :description [:span "relative to this anchor. One of " position-options-list [:br] [:strong "NOTE: "] "See above NOTE for " [:code ":showing-injected?"] ". Same applies" ]}
    {:name :position-offset   :required false                        :type "integer"          :validate-fn number?           :description [:span "px offset of the arrow from its default " [:code ":position"] " along the popover border. Is ignored when " [:code ":position"] " is one of the " [:code ":xxx-center"] " variants. Positive numbers slide the popover toward its center"]}
    {:name :no-clip?          :required false  :default false        :type "boolean"                                         :description "when an anchor is in a scrolling region (e.g. scroller component), the popover can sometimes be clipped. By passing true for this parameter, re-com will use a different CSS method to show the popover. This method is slightly inferior because the popover can't track the anchor if it is repositioned"}
    {:name :width             :required false                        :type "string"           :validate-fn string?           :description "a CSS style representing the popover width"}


Add note about closure defines type hinting

--- src/re_frame/trace.cljc
+++ src/re_frame/trace.cljc
@@ -19,6 +19,10 @@

 (defn ^boolean is-trace-enabled?
   "See https://groups.google.com/d/msg/clojurescript/jk43kmYiMhA/IHglVr_TPdgJ for more details"
+  ;; We can remove this extra step of type hinting indirection once our minimum CLJS version includes
+  ;; https://dev.clojure.org/jira/browse/CLJS-1439
+  ;; r1.10.63 is the first version with this:
+  ;; https://github.com/clojure/clojurescript/commit/9ec796d791b1b2bd613af2f62cdecfd25caa6482
   []
   trace-enabled?)


find all card properties

find all card properties

--- src/set_solver/core.clj
+++ src/set_solver/core.clj
@@ -43,6 +43,9 @@
 (def h (atom nil))
 (def c (atom nil))
 (def r (atom nil))
+
+(defn close-enough [n1 n2 max-diff]
+  (< (Math/abs (- n1 n2)) max-diff))

 (defn line-len
   ([p1 p2] (line-len (.x p1) (.y p1) (.x p2) (.y p2)))
@@ -235,6 +238,13 @@
    (< hue 275) :red
    :else :purple))

+(defn scalar-to-hsl [color]
+  (apply colors/rgb-to-hsl (take 3 (.val color))))
+
+(defn scalar-color-name [color]
+  (let [[h _ _] (scalar-to-hsl color)]
+    (color-name h)))
+
 (def shape-colors
   (map (fn [i]
          (let [[r g b] (colors/hsl-to-rgb (* i 90) 50 50)]
@@ -254,6 +264,12 @@

 (defn contour-hu-invariants [contour]
   (hu-invariants (Imgproc/moments contour)))
+
+(defn shape-name [contour]
+  (let [[h1] (contour-hu-invariants contour)]
+    (cond (< h1 0.180) :oval
+          (< h1 0.200) :diamond
+          :else :squiggle)))

 (defn contour-poly [contour]
   (let [poly2f (MatOfPoint2f.)
@@ -425,8 +441,73 @@
             (Imgproc/circle drawing center 20 color -1))
           (Imgproc/warpPerspective img target trans-mat (.size target))

-          (.copyTo target (.submat drawing (Rect. (.tl (Imgproc/boundingRect c))
+         (.copyTo target (.submat drawing (Rect. (.tl (Imgproc/boundingRect c))
                                                   (.size target))))
+
+         (let [target-gray (Mat/zeros (.size target) CvType/CV_8U)
+               target-canny (Mat. (.size target) CvType/CV_8U)]
+            (Imgproc/cvtColor target target-gray Imgproc/COLOR_BGR2GRAY)
+
+            ;(Imgproc/Canny target-gray target-canny 150 200)
+            (Imgproc/blur target-gray target-gray (Size. 2 2))
+            (Imgproc/threshold target-gray target-canny 140 255 Imgproc/THRESH_BINARY_INV)
+            (Imgproc/rectangle target-canny (Point. 0 0)
+                               (.br (Rect. (Point. 0 0) (.size target)))
+                               (Scalar. 0 0 0) 50) (println target-canny)
+            (let [card-contours (java.util.LinkedList.)
+                  card-hierarchy (MatOfInt4.)
+                  cmean (Core/mean target target-canny)
+                  [edge-h edge-s edge-l] (scalar-to-hsl cmean)
+                  cname (scalar-color-name cmean)
+                  _ (Imgproc/findContours target-canny card-contours card-hierarchy Imgproc/RETR_EXTERNAL Imgproc/CHAIN_APPROX_SIMPLE)
+                  sname (shape-name (first card-contours))
+                  mask (Mat/zeros (.size target) CvType/CV_8U)
+                  _ (Imgproc/drawContours mask card-contours -1 (Scalar. 255 255 255) -1)
+                  _ (Imgproc/drawContours mask card-contours -1 (Scalar. 0 0 0) 30)
+                  inside-color (Core/mean target mask)
+                  [inside-h inside-s inside-l] (scalar-to-hsl inside-color)
+                  _ (Imgproc/drawContours mask card-contours -1 (Scalar. 255 255 255) 30)
+                  _ (Imgproc/drawContours mask card-contours -1 (Scalar. 0 0 0) 10)
+                  _ (Imgproc/drawContours mask card-contours -1 (Scalar. 0 0 0) -1)
+                  outside-color (Core/mean target mask)
+                  [outside-h outside-s outside-l] (scalar-to-hsl outside-color)
+                  fill (cond (and (close-enough inside-l edge-l 5)
+                                  (close-enough inside-h edge-h 5))
+                             :filled
+                             (and (close-enough inside-l outside-l 5)
+                                  (close-enough inside-h outside-h 30)
+                                  (close-enough inside-s outside-s 5)) :empty
+                             :else :shaded)
+
+                  ]
+
+              (Imgproc/putText drawing #_(str (round inside-h) "/"
+                                            (round outside-h) "/"
+                                            (round edge-h))
+                                       (str (count card-contours) cname sname fill)
+                               (point-add (Point. 0 700) (.tl (Imgproc/boundingRect c)))
+                               Core/FONT_HERSHEY_COMPLEX 2 (Scalar. 255 255 255) 2)
+
+             (comment
+               (doseq [cc card-contours]
+                 (Imgproc/putText drawing (str (first (contour-hu-invariants cc)))
+                                  (point-add
+                                   (.tl (Imgproc/boundingRect c))
+                                   (.tl (Imgproc/boundingRect cc)))
+                                  Core/FONT_HERSHEY_COMPLEX 3 (Scalar. 255 255 255) 2)))
+
+              )
+            (Imgproc/threshold target-gray target-canny 140 255 Imgproc/THRESH_BINARY_INV)
+            (Imgproc/rectangle target-canny (Point. 0 0)
+                               (.br (Rect. (Point. 0 0) (.size target)))
+                               (Scalar. 0 0 0) 50) (println target-canny)
+
+            (Imgproc/cvtColor target-canny target Imgproc/COLOR_GRAY2BGR)
+            (.copyTo target (.submat drawing (Rect. (point-add (Point. 300 0)
+                                                               (.tl (Imgproc/boundingRect c)))
+                                                  (.size target))))
+
+            )
           ;(.copyTo target drawing)

           )


factor out commonalities between reflexives into if-then rule

--- src/babel/english/lexicon.clj
+++ src/babel/english/lexicon.clj
@@ -465,7 +465,6 @@

    "form" {:synsem {:cat :verb
                     :sem {:pred :form}}}
-

    "furnish"  {:synsem {:cat :verb
                         :sem {:pred :furnish}}}
@@ -719,19 +718,12 @@

    "hurt" (let [common {:english {:past "hurt (past)"}
                         :synsem {:cat :verb}}]
-            [(let [subject-semantics (ref {:human true})
-                   subject-agr (ref :top)]
-               (merge common
-                      {:synsem {:sem {:pred :hurt-oneself
-                                      :subj subject-semantics
-                                      :obj subject-semantics}
-                                :subcat {:1 {:agr subject-agr
-                                             :sem subject-semantics}
-                                         :2 {:agr subject-agr
-                                             :pronoun true
-                                             :reflexive true
-                                             :sem subject-semantics}}}}))
-             (merge common
+            [(unify common
+                    {:synsem {:sem {:pred :hurt-oneself}
+                              :subcat {:1 {:sem {:human true}}
+                                       :2 {:pronoun true
+                                           :reflexive true}}}})
+             (unify common
                     {:synsem {:sem {:pred :hurt
                                     :obj {:animate true}}}})])

@@ -1057,15 +1049,11 @@
                            :obj {:human false
                                  :music true}}}}]

-   "prepare" (let [subject-semantics (ref {:human true})]
-               {:synsem {:cat :verb
-                         :sem {:pred :get-ready
-                               :subj subject-semantics
-                               :obj subject-semantics}
-                         :subcat {:1 {:sem subject-semantics}
-                                  :2 {:pronoun true
-                                      :reflexive true
-                                      :sem subject-semantics}}}})
+   "prepare" {:synsem {:cat :verb
+                       :sem {:pred :get-ready
+                             :subj {:human true}}
+                       :subcat {:2 {:pronoun true
+                                    :reflexive true}}}}
    "preserve" {:synsem {:cat :verb
                         :sem {:pred :preserve}}}

@@ -1432,16 +1420,12 @@
    "warn" {:synsem {:cat :verb
                      :sem {:pred :warn}}}

-   "wash" (let [subject-semantics (ref :top)]
-            {:synsem {:cat :verb
-                      :sem {:pred :wash
-                            :reflexive true
-                            :subj subject-semantics
-                            :obj subject-semantics}
-                      :subcat {:1 {:sem subject-semantics}
-                               :2 {:pronoun true
-                                   :reflexive true
-                                   :sem subject-semantics}}}})
+   "wash" {:synsem {:cat :verb
+                    :sem {:pred :wash
+                          :subj {:human true}
+                          :reflexive true}
+                    :subcat {:2 {:pronoun true
+                                 :reflexive true}}}}
    "waste" {:synsem {:cat :verb
                 :sem {:pred :waste}}}

@@ -1646,7 +1630,22 @@
                          (if-then {:synsem {:cat :verb
                                             :subcat {:2 {:pronoun true
                                                          :reflexive true}}}}
-                                  (let [subject-agr (ref :top)]
-                                    {:synsem {:subcat {:1 {:agr subject-agr}
-                                                       :2 {:agr subject-agr}}}})))))
-
+                                  (let [subject-agr (ref :top)
+                                        subject-semantics (ref :top)]
+                                    {:synsem {:subcat {:1 {:sem subject-semantics
+                                                           :agr subject-agr}
+                                                       :2 {:sem subject-semantics
+                                                           :cat :noun
+                                                           :case :acc
+                                                           :agr subject-agr}}}}))
+
+                         (if-then {:synsem {:cat :noun
+                                            :pronoun true
+                                            :reflexive false}}
+                                  {:synsem {:cat :noun
+                                            :pronoun true
+                                            :reflexive false}})
+
+                         )))
+
+


entered entender

entered entender

--- src/babel/espanol/lexicon.clj
+++ src/babel/espanol/lexicon.clj
@@ -49,7 +49,7 @@
    "cambiar" {:synsem {:cat :verb
                        :sem {:pred :cambiare}}}

-   "cerrar" {:italiano {:boot-stem1 "cierr"
+   "cerrar" {:spanish {:boot-stem1 "cierr"
                         :boot-stem2 "cerr"}
              :synsem {:cat :verb
                       :sem {:pred :close}}}
@@ -214,6 +214,11 @@
                         :sem {:pred :show}}}
               {:synsem {:cat :verb
                         :sem {:pred :teach}}}]
+
+    "entender" {:spanish {:boot-stem1 "entiend"
+                        :boot-stem2 "entend"}
+             :synsem {:cat :verb
+                      :sem {:pred :understand-simply}}}

    "entrar" {:synsem {:cat :verb
                       :sem {:pred :enter}}}