Using consistent nomenclature for messages

See https://app.asana.com/0/17212341701456/45607697686001 for a longer
discussion of the rationale.

--- src/cljs/memento/core.cljs
+++ src/cljs/memento/core.cljs
@@ -107,60 +107,13 @@
   dispatches a message to clear the authorization token."
   [result]
   (if (= 401 (:status result))
-    (dispatch [:set-token nil])))
-
-
-(register-handler
-  :edit-memory-set
-  (fn [app-state [_ thought]]
-    (if (empty? thought)
-      (dispatch [:update-note nil]))
-    (assoc-in app-state [:note :edit-memory] thought)
-    ))
-
-
-(register-handler
-  :edit-memory-save
-  (fn [app-state _]
-    (let [note   (get-in app-state [:note :current-note])
-          memory (get-in app-state [:note :edit-memory])
-          url    (str "/api/memory/" (:id memory) "/thought")]
-      (PUT url {:params        {:thought note :refine_id (get-in app-state [:note :focus :id])}
-                :headers       {:authorization (str "Token " (get-in app-state [:credentials :token]))}
-                :handler       #(dispatch [:edit-memory-success note])
-                :error-handler #(dispatch [:edit-memory-error %])})
-      )
-    (assoc-in app-state [:ui-state :is-busy?] true)
-    ))
-
-
-(register-handler
-  :edit-memory-success
-  (fn [app-state [_ msg]]
-    (dispatch [:set-message (str "Updated memory to: " msg) "alert-success"])
-    (if (= :remember (get-in app-state [:ui-state :section]))         ; Just in case we allow editing from elsewhere...
-      (dispatch [:load-memories]))
-    (-> app-state
-        (assoc-in [:ui-state :is-busy?] false)
-        (assoc-in [:note :edit-memory] nil)
-        (assoc-in [:note :current-note] "")
-        (assoc-in [:note :focus] nil)
-        )))
-
-
-(register-handler
-  :edit-memory-error
-  (fn [app-state [_ result]]
-    (dispatch [:set-message (str "Error editing note: " result) "alert-danger"])
-    (clear-token-on-unauth result)
-    (assoc-in app-state [:ui-state :is-busy?] false)
-    ))
+    (dispatch [:auth-set-token nil])))

 (register-handler
   :initialize
   (fn [app-state _]
-    (dispatch [:set-token (cookies/get :token nil)])
+    (dispatch [:auth-set-token (cookies/get :token nil)])
     (merge app-state {:ui-state {:is-busy?      false
                                  :wip-login?    false
                                  :show-thread?  false
@@ -183,27 +136,27 @@
                            (get-in app-state [:credentials :password2])))]
       (if is-valid?
         (POST (str "/api/auth/" url) {:params        (:credentials app-state)
-                                      :handler       #(dispatch [:set-token (:token %)])
-                                      :error-handler #(dispatch [:login-error %])}))
+                                      :handler       #(dispatch [:auth-set-token (:token %)])
+                                      :error-handler #(dispatch [:auth-request-error %])}))
       )
     (assoc-in app-state [:ui-state :wip-login?] true)
     ))

 (register-handler
-  :set-token
+  :auth-set-token
   (fn [app-state [_ token]]
     (if (not-empty token)
-      (dispatch [:set-message ""]))
+      (dispatch [:state-message ""]))
     (cookies/set! :token token)
     (-> app-state
         (assoc-in [:credentials :token] token)
-        (assoc-in [:ui-state :section] (if (empty? token) :login ::record))
+        (assoc-in [:ui-state :section] (if (empty? token) :login :record))
         (assoc-in [:ui-state :wip-login?] false)
         (assoc-in [:credentials :password] nil)
         (assoc-in [:credentials :password2] nil))))

 (register-handler
-  :login-error
+  :auth-request-error
   (fn [app-state [_ result]]
     (.log js/console (str result))
     (let [status    (:status result)
@@ -220,94 +173,19 @@

 (register-handler
-  :update-credentials
-  (fn [app-state [_ k v]]
-    (assoc-in app-state [:credentials k] v)))
-
-(register-handler
-  :set-ui-section
-  (fn [app-state [_ section]]
-    (if (= :remember section)
-      (dispatch [:load-memories]))
-    (assoc-in app-state [:ui-state :section] section)))
-
-(register-handler
-  :log-message
-  (fn [app-state [_ msg]]
-    (.log js/console (str "Logging: " msg))
-    app-state))
-
-(register-handler
-  :set-message
-  (fn [app-state [_ msg class]]
-    (let [message {:text msg :class class}]
-      ; TODO: Consider changing this for a keyword
-      (if (= class "alert-success")
-        (js/setTimeout #(dispatch [:set-message-if-same message nil]) 3000))
-      (assoc-in app-state [:ui-state :last-message] message))))
-
-(register-handler
-  :set-message-if-same
-  (fn [app-state [_ msg new-msg]]
-    (if (= msg (get-in app-state [:ui-state :last-message]))
-      (assoc-in app-state [:ui-state :last-message] new-msg)
-      app-state
-      )))
-
-(register-handler
-  :update-note
-  (fn [app-state [_ note]]
-    (assoc-in app-state [:note :current-note] note)))
-
-(register-handler
-  :update-query
-  (fn [app-state [_ q]]
-    (dispatch [:load-memories 0])
-    (assoc-in app-state [:ui-state :current-query] q)))
-
-(register-handler
-  :load-memories
+  :memories-load
   (fn [app-state [_ page-index]]
     (GET "/api/memory/search" {:params        {:q    (get-in app-state [:ui-state :current-query])
                                                :page (or page-index (get-in app-state [:ui-state :results-page]))}
                                :headers       {:authorization (str "Token " (get-in app-state [:credentials :token]))}
-                               :handler       #(dispatch [:load-memories-success %])
-                               :error-handler #(dispatch [:load-memories-error %])
+                               :handler       #(dispatch [:memories-load-success %])
+                               :error-handler #(dispatch [:memories-load-error %])
                                })
     (assoc-in app-state [:ui-state :is-searching?] true)
     ))

 (register-handler
-  :load-thread
-  (fn [app-state [_ thought]]
-    (let [url (str "/api/memory/" (:root_id thought) "/thread")]
-      (GET url {:headers       {:authorization (str "Token " (get-in app-state [:credentials :token]))}
-                :handler       #(dispatch [:load-thread-success %])
-                :error-handler #(dispatch [:load-thread-error %])}
-           ))
-    app-state))
-
-(register-handler
-  :load-thread-error
-  (fn [app-state [_ result]]
-    (dispatch [:set-message (str "Error loading thread: " result) "alert-danger"])
-    app-state))
-
-(register-handler
-  :load-thread-success
-  (fn [app-state [_ result]]
-    (-> app-state
-        (assoc-in [:ui-state :show-thread?] true)
-        (assoc-in [:note :thread] (:results result)))
-    ))
-
-(register-handler
-  :set-show-thread
-  (fn [app-state [_ state]]
-    (assoc-in app-state [:ui-state :show-thread?] state)))
-
-(register-handler
-  :load-memories-success
+  :memories-load-success
   (fn [app-state [_ memories]]
     (.scrollIntoView top-div-target)
     (-> app-state
@@ -316,51 +194,87 @@
         (assoc-in [:ui-state :is-searching?] false))
     ))

-
-(register-handler
-  :load-memories-error
+(register-handler
+  :memories-load-error
   (fn [app-state [_ result]]
-    (dispatch [:set-message (str "Error remembering: " result) "alert-danger"])
+    (dispatch [:state-message (str "Error remembering: " result) "alert-danger"])
     (clear-token-on-unauth result)
     app-state
     ))

-
-(register-handler
-  :page-memories
+(register-handler
+  :memories-page
   (fn [app-state [_ i]]
     (let [max          (dec (get-in app-state [:ui-state :memories :pages]))
           idx          (Math/max 0 (Math/min max i))
           current-page (get-in app-state [:ui-state :memories :current-page])]
       (if (not= current-page idx)
-        (dispatch [:load-memories idx]))
+        (dispatch [:memories-load idx]))
       (assoc-in app-state [:ui-state :results-page] idx))
     ))

 (register-handler
-  :refine
+  :memory-edit-set
   (fn [app-state [_ thought]]
+    (if (empty? thought)
+      (dispatch [:state-current-note nil]))
+    (assoc-in app-state [:note :edit-memory] thought)
+    ))
+
+
+(register-handler
+  :memory-edit-save
+  (fn [app-state _]
+    (let [note   (get-in app-state [:note :current-note])
+          memory (get-in app-state [:note :edit-memory])
+          url    (str "/api/memory/" (:id memory) "/thought")]
+      (PUT url {:params        {:thought note :refine_id (get-in app-state [:note :focus :id])}
+                :headers       {:authorization (str "Token " (get-in app-state [:credentials :token]))}
+                :handler       #(dispatch [:memory-edit-save-success note])
+                :error-handler #(dispatch [:memory-edit-save-error %])})
+      )
+    (assoc-in app-state [:ui-state :is-busy?] true)
+    ))
+
+
+(register-handler
+  :memory-edit-save-success
+  (fn [app-state [_ msg]]
+    (dispatch [:state-message (str "Updated memory to: " msg) "alert-success"])
+    (if (= :remember (get-in app-state [:ui-state :section]))         ; Just in case we allow editing from elsewhere...
+      (dispatch [:memories-load]))
     (-> app-state
-        (assoc-in [:note :focus] thought)
-        (assoc-in [:ui-state :section] ::record))
-    ))
-
-
-(register-handler
-  :save-note
+        (assoc-in [:ui-state :is-busy?] false)
+        (assoc-in [:note :edit-memory] nil)
+        (assoc-in [:note :current-note] "")
+        (assoc-in [:note :focus] nil)
+        )))
+
+
+(register-handler
+  :memory-edit-save-error
+  (fn [app-state [_ result]]
+    (dispatch [:state-message (str "Error editing note: " result) "alert-danger"])
+    (clear-token-on-unauth result)
+    (assoc-in app-state [:ui-state :is-busy?] false)
+    ))
+
+
+(register-handler
+  :memory-save
   (fn [app-state _]
     (let [note (get-in app-state [:note :current-note])]
       (POST "/api/memory" {:params        {:thought note :refine_id (get-in app-state [:note :focus :id])}
                            :headers       {:authorization (str "Token " (get-in app-state [:credentials :token]))}
-                           :handler       #(dispatch [:save-note-success note])
-                           :error-handler #(dispatch [:save-note-error %])}))
+                           :handler       #(dispatch [:memory-save-success note])
+                           :error-handler #(dispatch [:memory-save-error %])}))
     (assoc-in app-state [:ui-state :is-busy?] true)
     ))

 (register-handler
-  :save-note-success
+  :memory-save-success
   (fn [app-state [_ msg]]
-    (dispatch [:set-message (str "Saved: " msg) "alert-success"])
+    (dispatch [:state-message (str "Saved: " msg) "alert-success"])
     (-> app-state
         (assoc-in [:ui-state :is-busy?] false)
         (assoc-in [:note :current-note] "")
@@ -368,12 +282,96 @@
         )))

 (register-handler
-  :save-note-error
+  :memory-save-error
   (fn [app-state [_ result]]
-    (dispatch [:set-message (str "Error saving note: " result) "alert-danger"])
+    (dispatch [:state-message (str "Error saving note: " result) "alert-danger"])
     (clear-token-on-unauth result)
     (assoc-in app-state [:ui-state :is-busy?] false)
     ))
+
+
+
+
+(register-handler
+  :thread-load
+  (fn [app-state [_ thought]]
+    (let [url (str "/api/memory/" (:root_id thought) "/thread")]
+      (GET url {:headers       {:authorization (str "Token " (get-in app-state [:credentials :token]))}
+                :handler       #(dispatch [:thread-load-success %])
+                :error-handler #(dispatch [:thread-load-error %])}
+           ))
+    app-state))
+
+(register-handler
+  :thread-load-error
+  (fn [app-state [_ result]]
+    (dispatch [:state-message (str "Error loading thread: " result) "alert-danger"])
+    app-state))
+
+(register-handler
+  :thread-load-success
+  (fn [app-state [_ result]]
+    (-> app-state
+        (assoc-in [:ui-state :show-thread?] true)
+        (assoc-in [:note :thread] (:results result)))
+    ))
+
+
+(register-handler
+  :refine
+  (fn [app-state [_ thought]]
+    (-> app-state
+        (assoc-in [:note :focus] thought)
+        (assoc-in [:ui-state :section] :record))
+    ))
+
+(register-handler
+  :state-credentials
+  (fn [app-state [_ k v]]
+    (assoc-in app-state [:credentials k] v)))
+
+
+(register-handler
+  :state-ui-section
+  (fn [app-state [_ section]]
+    (if (= :remember section)
+      (dispatch [:memories-load]))
+    (assoc-in app-state [:ui-state :section] section)))
+
+(register-handler
+  :state-message
+  (fn [app-state [_ msg class]]
+    (let [message {:text msg :class class}]
+      ; TODO: Consider changing this for a keyword
+      (if (= class "alert-success")
+        (js/setTimeout #(dispatch [:state-message-if-same message nil]) 3000))
+      (assoc-in app-state [:ui-state :last-message] message))))
+
+(register-handler
+  :state-message-if-same
+  (fn [app-state [_ compare-msg new-msg]]
+    (if (= compare-msg (get-in app-state [:ui-state :last-message]))
+      (assoc-in app-state [:ui-state :last-message] new-msg)
+      app-state
+      )))
+
+(register-handler
+  :state-current-note
+  (fn [app-state [_ note]]
+    (assoc-in app-state [:note :current-note] note)))
+
+(register-handler
+  :state-current-query
+  (fn [app-state [_ q]]
+    (dispatch [:memories-load 0])
+    (assoc-in app-state [:ui-state :current-query] q)))
+
+(register-handler
+  :state-show-thread
+  (fn [app-state [_ state]]
+    (assoc-in app-state [:ui-state :show-thread?] state)))
+
+

 ;;;;------------------------------
@@ -393,7 +391,7 @@
   (let [current     (subscribe [:ui-state :section])
         is-current? (reaction (= section @current))
         class       (when @is-current? "active")]
-    [:li {:class class} [:a {:on-click #(dispatch [:set-ui-section section])} name
+    [:li {:class class} [:a {:on-click #(dispatch [:state-ui-section section])} name
                          (if @is-current?
                            [:span {:class "sr-only"} "(current)"])]]))

@@ -412,7 +410,7 @@
              [navbar-item "Login" :login]
              [navbar-item "Sign up" :signup]]
             [:ul {:class "nav navbar-nav"}
-             [navbar-item "Record" ::record]
+             [navbar-item "Record" :record]
              [navbar-item "Remember" :remember]])
           ]]
         ]]
@@ -424,7 +422,7 @@
     (fn []
       (if (not-empty (:text @msg))
         [:div {:class (str "alert " (:class @msg))}
-         [:button {:type :button :class "close" :on-click #(dispatch [:set-message ""])} "x"]
+         [:button {:type :button :class "close" :on-click #(dispatch [:state-message ""])} "x"]
          (:text @msg)]
         )
       )))
@@ -456,7 +454,7 @@
                      :placeholder "I was thinking..."
                      :rows        12
                      :style       {:font-size "18px"}
-                     :on-change   #(dispatch-sync [:update-note (-> % .-target .-value)])
+                     :on-change   #(dispatch-sync [:state-current-note (-> % .-target .-value)])
                      :value       @note
                      }]]
         ]]))
@@ -473,11 +471,11 @@
          [:div {:class "col-sm-12"}
           [:button {:type     "reset"
                     :class    "btn btn-default"
-                    :on-click #(dispatch [:update-note ""])} "Clear"]
+                    :on-click #(dispatch [:state-current-note ""])} "Clear"]
           [:button {:type     "submit"
                     :disabled (or @is-busy? (empty? @note))
                     :class    "btn btn-primary"
-                    :on-click #(dispatch [:save-note])} "Submit"]
+                    :on-click #(dispatch [:memory-save])} "Submit"]
           ]]
         ]]
       )))
@@ -508,7 +506,7 @@
                    :class     "form-control"
                    :id        "input-search"
                    :value     @query
-                   :on-change #(dispatch-sync [:update-query (-> % .-target .-value)])}]]
+                   :on-change #(dispatch-sync [:state-current-query (-> % .-target .-value)])}]]
          ]]])))

 (defn memory-pager []
@@ -526,7 +524,7 @@
                       :first      (>= @current @max-btn)
                       :last       (< @current (- @pages @max-btn))
                       :activePage (inc @current)
-                      :onSelect   #(dispatch [:page-memories (dec (aget %2 "eventKey"))])
+                      :onSelect   #(dispatch [:memories-page (dec (aget %2 "eventKey"))])
                       }]]))))

 (defn list-memories [results show-thread-btn?]
@@ -541,8 +539,8 @@
        (if (= :open (:status memory))
          [:a {:class    "btn btn-primary btn-xs"
               :on-click #(do
-                          (dispatch [:update-note (:thought memory)])
-                          (dispatch [:edit-memory-set memory]))}
+                          (dispatch [:state-current-note (:thought memory)])
+                          (dispatch [:memory-edit-set memory]))}
           "Edit" [:i {:class "fa fa-pencil fa-space"}]])
        [:a {:class    "btn btn-primary btn-xs"
             :on-click #(do
@@ -551,7 +549,7 @@
         "Refine" [:i {:class "fa fa-comment fa-space"}]]
        (if (and show-thread-btn? (:root_id memory))
          [:a {:class    "btn btn-primary btn-xs"
-              :on-click #(dispatch [:load-thread memory])}
+              :on-click #(dispatch [:thread-load memory])}
           "Thread" [:i {:class "fa fa-file-text fa-space"}]])

        ]
@@ -568,18 +566,18 @@
         ;; not a truth-ish value.
         show?       (reaction (not (empty? @edit-memory)))]
     (fn []
-      [Modal {:show @show? :onHide #(dispatch [:edit-memory-set nil])}
+      [Modal {:show @show? :onHide #(dispatch [:memory-edit-set nil])}
        [ModalBody
         [:div {:class "col-sm-12 thought"}
          [thought-edit-box]]]
        [ModalFooter
         [:button {:type     "reset"
                   :class    "btn btn-default"
-                  :on-click #(dispatch [:edit-memory-set nil])} "Discard"]
+                  :on-click #(dispatch [:memory-edit-set nil])} "Discard"]
         [:button {:type     "submit"
                   :class    "btn btn-primary"
                   :disabled (or @is-busy? (empty? @note))
-                  :on-click #(dispatch [:edit-memory-save])} "Save"]
+                  :on-click #(dispatch [:memory-edit-save])} "Save"]
         ]])))

@@ -587,13 +585,13 @@
   (let [show?  (subscribe [:ui-state :show-thread?])
         thread (subscribe [:note :thread])]
     (fn []
-      [Modal {:show @show? :onHide #(dispatch [:set-show-thread false])}
+      [Modal {:show @show? :onHide #(dispatch [:state-show-thread false])}
        [ModalBody
         (list-memories @thread false)]
        [ModalFooter
         [:button {:type     "reset"
                   :class    "btn btn-default"
-                  :on-click #(dispatch [:set-show-thread false])} "Close"]]])))
+                  :on-click #(dispatch [:state-show-thread false])} "Close"]]])))

 (defn memory-results []
@@ -651,7 +649,7 @@
                      :class        "formControl col-sm-8"
                      :id           "inputLogin"
                      :placeholder  "user name"
-                     :on-change    #(dispatch-sync [:update-credentials :username (-> % .-target .-value)])
+                     :on-change    #(dispatch-sync [:state-credentials :username (-> % .-target .-value)])
                      :on-key-press #(dispatch-on-press-enter % [:auth-request @signup?])
                      :value        @username}]]]
           [:div {:class (str "form-group" @pw-class)}
@@ -660,7 +658,7 @@
             [:input {:type         "password"
                      :class        "formControl col-sm-8"
                      :id           "inputPassword"
-                     :on-change    #(dispatch-sync [:update-credentials :password (-> % .-target .-value)])
+                     :on-change    #(dispatch-sync [:state-credentials :password (-> % .-target .-value)])
                      :on-key-press #(dispatch-on-press-enter % [:auth-request @signup?])
                      :value        @password}]]]
           (if @signup?
@@ -670,7 +668,7 @@
               [:input {:type         "password"
                        :class        "formControl col-sm-8 col-lg-8"
                        :id           "inputPassword2"
-                       :on-change    #(dispatch-sync [:update-credentials :password2 (-> % .-target .-value)])
+                       :on-change    #(dispatch-sync [:state-credentials :password2 (-> % .-target .-value)])
                        :on-key-press #(dispatch-on-press-enter % [:auth-request @signup?])
                        :value        @confirm}]]])

@@ -687,9 +685,9 @@
     (if (and (nil? @token)
              (not= :login @section)
              (not= :signup @section))
-      (dispatch [:set-ui-section :login]))
+      (dispatch [:state-ui-section :login]))
     (condp = @section
-      ::record [write-section]
+      :record [write-section]
       :remember [memory-list]
       [login-form]
       )
@@ -699,13 +697,12 @@
 (defn header []
   (let [state  (subscribe [:ui-state :section])
         header (condp = @state
-                 ::record "Make a new memory"
+                 :record "Make a new memory"
                  :remember "Remember"
                  "")]
     (if (not-empty header)
       [:h1 {:id "forms"} header])
     ))
-


debug log

debug log

--- src/cljs/re_form/core.cljs
+++ src/cljs/re_form/core.cljs
@@ -86,7 +86,10 @@
     (fn [this props]
       (let [cur-value (nth (.. this -props -argv ) 1)
             new-value (nth props 1)]
+        (.log js/console "NEW" new-value)
+        (.log js/console "CUR" new-value)
         (when-not (= new-value cur-value)
+          (.log js/console "UPDATE")
           (init new-value))))
     :component-will-unmount
     (fn [] (deinit props))


Fix invalid markup on homepage

Fix invalid markup on homepage

- Move charset meta tag up the page
- Change div to spans inside h2s
- Add language to homepage

--- src/clojars/web/common.clj
+++ src/clojars/web/common.clj
@@ -140,8 +140,9 @@
      (footer (get ctx :footer-links? true))]]))

 (defn html-doc-with-large-header [title ctx & body]
-  (html5
+  (html5 {:lang "en"}
    [:head
+    [:meta {:charset "utf-8"}]
     [:link {:type "application/opensearchdescription+xml"
             :href "/opensearch.xml"
             :rel "search"}]
@@ -165,7 +166,6 @@
     [:meta {:name "msapplication-TileImage" :content "/mstile-144x144.png?v=47K2kprJd7"}]
     [:meta {:name "theme-color" :content "#ffffff"}]

-    [:meta {:charset "utf-8"}]
     [:meta {:name "viewport" :content "width=device-width,initial-scale=1"}]
     (structured-data/meta-tags (assoc ctx :title (if title
                                                    title
@@ -200,12 +200,12 @@
           [(link-to "/login" "login")
            (link-to "/register" "register")]))]
       [:h2.hero-text.row
-       [:div.col-md-12
+       [:span.col-md-12
         [:span.heavy "Clojars"]
         " is a "
         [:span.heavy "dead easy"]
         " community repository for "]
-       [:div.col-md-12
+       [:span.col-md-12
         " open source Clojure libraries."]]]
      [:div.search-form-container.col-md-12.col-xs-12.col-lg-12.col-sm-12
       [:form {:action "/search"}
@@ -220,11 +220,11 @@
                 :value "Search"
                 :type "submit"}]]]
      [:h2.getting-started.row
-      [:div.col-md-12
+      [:span.col-md-12
        "To get started pushing your own project "
        (link-to "/register" "register")
        " and then"]
-      [:div.col-md-12
+      [:span.col-md-12
        " check out the "
        (link-to "http://wiki.github.com/clojars/clojars-web/tutorial" "tutorial")
        ". Alternatively, "


better option support for temp-view func

--- src/clojure/flambo/sql.clj
+++ src/clojure/flambo/sql.clj
@@ -262,26 +262,24 @@
   of data is expected is given in the `:type` key, which is one of the
   following:

-* `:parquet` - parquet table format (default)
-* `:json` - a JSON formatted file
-* `:csv` - a comma delimited file"
+  * `:parquet` - parquet table format (default)
+  * `:json` - a JSON formatted file
+  * `:csv` - a comma delimited file"
   [sql-context url table-name &
    {:keys [type csv-options schema infer-schema?]
     :or {type :parquet
          infer-schema? true
          csv-options {:header true :separator "," :quote "'"}}}]
-  (let [options (java.util.HashMap.)
-        infer-schema? (and (nil? schema) infer-schema?)]
-    (.put options "path" url)
-    (if (and (= type :csv) csv-options)
-      (->> (zipmap (clojure.core/map name (keys csv-options))
-                   (clojure.core/map str (vals csv-options)))
-          (.putAll options)))
-    (if (and (nil? schema) infer-schema?)
-      (.put options "inferSchema" "true"))
+  (let [infer-schema? (and (nil? schema) infer-schema?)
+        opts (merge {"path" url}
+                    (if (and (nil? schema) infer-schema?)
+                      {"inferSchema" "true"})
+                    (if (and (= type :csv) csv-options)
+                      (zipmap (clojure.core/map name (keys csv-options))
+                              (clojure.core/map str (vals csv-options)))))]
     (cond-> (.read sql-context)
       true (.format (name type))
-      true (.options options)
+      true (.options opts)
       infer-schema? (.schema schema)
       true .load
       table-name (.createOrReplaceTempView table-name))
@@ -307,7 +305,7 @@

   See [[setup-temporary-view]] for `:type` key."
   [url & {:keys [type]}]
-  (-> (query url "select * from tmp" :type type)
+  (-> (query url "select * from schema-tmp" :type type)
       (schema)))

 (defn struct-type


better debugging

better debugging

--- src/cloxiang/handlers.cljs
+++ src/cloxiang/handlers.cljs
@@ -9,15 +9,18 @@
             (aget "url")
             rest)))

-(defn pret [thing]
-    (do (println thing) thing))
+(defn debug [thing & [message]]
+    (let [to-print (if message
+                    (str message thing)
+                    thing)])
+    (do (println to-print) thing))

 (defn registrar [req]
     (let [id (get-id req)]
         (swap! games #(open % id))
         (-> @games
-            pret
+            (debug "all the games evar: ")
             (get id)
-            pret
+            (debug "the game u found: ")
             missing-player
             name)))


save/load benchmark results.

save/load benchmark results.

--- test/cavm/benchmark/core.clj
+++ test/cavm/benchmark/core.clj
@@ -1,6 +1,8 @@
 (ns cavm.benchmark.core
   (:require [clojure.java.io :as io])
   (:require [clojure.string :as s])
+  (:require [clojure.edn :as edn])
+  (:require [clojure.tools.cli :refer [parse-opts]])
   (:require [cavm.benchmark.data :as benchmark-data])
   (:require [cavm.benchmark.install :refer [install]])
   (:require [cavm.h2 :as h2])
@@ -125,19 +127,34 @@
     :body (fn [xena genes]
             (cnv-gene xena (dataset-map :cnv-large) genes))}])

+(def test-map
+  (into {} (map #(-> [(:id %) %]) tests)))
+
+(defn print-results [results]
+  (doseq [{:keys [id result]} results]
+    (println (report (:desc (test-map id)) result))) )
+
+(def ^:private argspec
+  [["-o" "--output FILE" "Output file" :default "bench.edn"]
+   ["-r" "--input FILE" "Read and print results from FILE"]])
+
 (defn -main [& args]
-  (println "benchmark" args)
-
   (try
-    (if (= args ["install"])
-      (install (io/file (System/getProperty "user.home") "xena-benchmark"))
-      (let [xena (h2/create-xenadb dbfile)
-            {:keys [id probes]} (first benchmark-data/probemaps)
-            {cnv-id :id} (first benchmark-data/cnv)]
-        (doseq [{:keys [desc params body]} tests]
-          (let [params (params)
-                res (apply body xena params)]
-            (println (report desc res))))
-        ))
+    (let [{:keys [options arguments summary errors]} (parse-opts args argspec)]
+      (cond
+        errors (binding [*out* *err*]
+                 (println (s/join "\n" errors)))
+        (= arguments ["install"]) (install
+                                     (io/file (System/getProperty "user.home")
+                                              "xena-benchmark"))
+        (:input options) (print-results (edn/read-string (slurp (:input options))))
+        :else (let [xena (h2/create-xenadb dbfile)
+                    results (atom [])]
+                (doseq [{:keys [id desc params body]} tests]
+                  (let [params (params)
+                        result (apply body xena params)]
+                    (swap! results conj {:id id :result result})
+                    (println (report desc result))))
+                (spit (:output options) (pr-str @results)))))
     (finally
       (shutdown-agents))))


Added a test for commit fn when message is multi-line

--- test/clj_git/object_test.clj
+++ test/clj_git/object_test.clj
@@ -11,4 +11,14 @@
         :author "j <jamie.williams89@gmail.com> 1453468511 +0000",
         :committer "j <jamie.williams89@gmail.com> 1453468511 +0000"}
     )))
+  (testing "Check structure for multi-line commit"
+    (is (=
+      (commit "a4c719416bd67212ec386b2bbb3405c62b0c8ac5")
+      {:message
+      "Don't write objects that exist.\n\nSet files to non-writable once written",
+      :tree "de850342386653cd371fd3a0eb2c0d7e051052e6",
+      :parent "7d6811bc2e5065e170a5b6d787283c7054927f32",
+      :author "j <jamie.williams89@gmail.com> 1453647595 +0000",
+      :committer "j <jamie.williams89@gmail.com> 1453647595 +0000"}
+    )))
 )


Test for the function parse-boolean

Test for the function parse-boolean

--- test/clouseau/test_utils.clj
+++ test/clouseau/test_utils.clj
@@ -368,3 +368,14 @@
             "xbbx"  (replaceAll "xaaaax" "aa" "b")
             "xbxbx" (replaceAll "xaaxaax" "aa" "b"))))

+(deftest test-parse-boolean
+    "Check the behaviour of function emender-jenkins.config/parse-boolean."
+    (are [x y] (= x y)
+        true (parse-boolean "true")
+        true (parse-boolean "True")
+        false (parse-boolean "false")
+        false (parse-boolean "False")
+        false (parse-boolean "")
+        false (parse-boolean "unknown")
+        false (parse-boolean nil)))
+


Add test for the "no logs whatsoever" case

--- test/elite_mfd/core_test.clj
+++ test/elite_mfd/core_test.clj
@@ -59,6 +59,16 @@
     (java.io.StringReader. in)))

 (deftest test-system-poller-loop
+  (testing "Absolutely nothing"
+    (let [last-system (ref nil)
+          [file stream] (system-poller-loop
+                          nil nil  ; no last-file/stream yet
+                          :pick-log #(identity nil)
+                          :open-log #(is (nil? %)) ; should not be called
+                          :callback #(dosync (ref-set last-system %)))]
+      (is (nil? file))
+      (is (nil? stream))
+      (is (nil? @last-system))))
   (testing "First run"
     (let [last-system (ref nil)
           [file stream] (system-poller-loop


Fix test runner with advanced compilation.

--- test/promesa/core_tests.cljc
+++ test/promesa/core_tests.cljc
@@ -379,7 +379,7 @@

 #?(:cljs (enable-console-print!))
 #?(:cljs (set! *main-cli-fn* #(t/run-tests
-                               *ns*
+                               'promesa.core-tests
                                'promesa.issue-36)))
 #?(:cljs
    (defmethod t/report [:cljs.test/default :end-run-tests]


Story ID: develop Summary: Fixed weird bug with specs not having the correct assert-expr loaded when they were compiled due to the fact that suite was compiled after *spec files. Fixed it by adding a require to suite macros in core.cljs after verifying my theory by turning on :verbose true and seeing the order *spec files and suite files were compiled in.

--- src/untangled_spec/core.cljs
+++ src/untangled_spec/core.cljs
@@ -1,4 +1,5 @@
 (ns untangled-spec.core
   (:require [untangled-spec.async]
             [untangled-spec.stub]
-            [cljs.test :include-macros true]))
+            [cljs.test :include-macros true]
+            [untangled-spec.reporters.suite :include-macros true]))


clean up the run-test-server fixture

clean up the run-test-server fixture

--- test/subrosa/test/expect.clj
+++ test/subrosa/test/expect.clj
@@ -15,10 +15,9 @@
   (let [server (create-server *port*)]
     (try
       (with-out-str ((:start-fn server)))
-      #_(Thread/sleep 500)
       (f)
-      (with-out-str ((:stop-fn server)))
-      #_(Thread/sleep 2000))))
+      (finally
+       (with-out-str ((:stop-fn server)))))))

 (defn socket-read-line [in]
   (try


I should do this before I commit

I should do this before I commit

--- src/wishlistd/cljs/main.cljs
+++ src/wishlistd/cljs/main.cljs
@@ -39,8 +39,8 @@
   (append $header  (wishlist-title title)))

 (defn wishlist-from-html []
-  {:title (title-from-html)
+  {:title  (title-from-html)
    :wishes (wishes-from-html)
-   :code (get-path)})
+   :code   (get-path)})


fix resource metadata for user templates

--- cimi/src/com/sixsq/slipstream/ssclj/resources/spec/user_template.cljc
+++ cimi/src/com/sixsq/slipstream/ssclj/resources/spec/user_template.cljc
@@ -20,7 +20,7 @@
              :json-schema/providerMandatory true
              :json-schema/consumerMandatory true
              :json-schema/mutable true
-             :json-schema/consumerWritable true
+             :json-schema/consumerWritable false

              :json-schema/displayName "method"
              :json-schema/description "user creation method"
@@ -43,7 +43,7 @@
              :json-schema/providerMandatory true
              :json-schema/consumerMandatory true
              :json-schema/mutable true
-             :json-schema/consumerWritable true
+             :json-schema/consumerWritable false

              :json-schema/displayName "instance"
              :json-schema/description "instance name of user creation method"


updated push to be able to push in both directions

--- src/divergence/system.cljs
+++ src/divergence/system.cljs
@@ -45,10 +45,7 @@
                 y-future (move-entity @p [y-v 0 0])]
           (doseq [e entities]
             (when (phys/colliding? x-future @e)
-              (swap! e assoc-in [:velocity 0] 1))
-            (when (phys/colliding? y-future @e)
-              (swap! e assoc-in [:velocity 1] 1)))
-          )))))
+              (swap! e assoc-in [:velocity 0] (* (compare x-v 0) 2)))))))))

 (defn friction
   [entities]


Clarify binding visibility in for-all docstring

--- src/main/clojure/clojure/test/check/properties.cljc
+++ src/main/clojure/clojure/test/check/properties.cljc
@@ -65,16 +65,17 @@
   (map second (partition 2 bindings)))

 (defmacro for-all
-  "Macro sugar for `for-all*`. `for-all` lets you name the parameter
-  and use them in expression, without wrapping them in a lambda. Like
-  `for-all*`, it returns a property.
+  "Macro sugar for `for-all*`. `for-all` uses `let`-style bindings
+  for the generated values. Note that when using multiple bindings,
+  the earlier bindings are not visible to the later bindings.
+
+  Returns a property.

   Examples

   (for-all [a gen/int
             b gen/int]
-    (>= (+ a b) a))
-  "
+    (>= (+ a b) a))"
   [bindings & body]
   `(for-all* ~(vec (binding-gens bindings))
              (fn [~@(binding-vars bindings)]


use ext

use ext

--- src/ecregister/avatars.clj
+++ src/ecregister/avatars.clj
@@ -52,7 +52,7 @@
           filename (str image-name "." ext)
           out-file (file (str output-dir filename))]
       (if has-alpha?
-        (ImageIO/write image "png" out-file)
+        (ImageIO/write image ext out-file)
         ; else need to tweak jpeg compression quality
         (let [writer (.next (ImageIO/getImageWritersByFormatName "jpeg"))
               param (.getDefaultWriteParam writer)


file is safe for children now

file is safe for children now

--- test/midje/t_checkers.clj
+++ test/midje/t_checkers.clj
@@ -56,9 +56,9 @@
   (fact ?actual ?arrow ?expected)

   ?expected                      ?actual ?arrow
-  odd?                           3       =>             ;; why does this ONLY blwo up when I uncomment all rows of the table?
+  odd?                           3       =>
   odd?                           odd?    =not=>
-                                                        ;; fuck an a dude.
+
   (exactly odd?)                 3       =not=>
   (exactly odd?)                 odd?    =>


Add mock columns from Onadata API

Add mock columns from Onadata API

Signed-off-by: Njagi Mwaniki <b6a4ba60ad861b9c9afb6daea7294be4be68f44c@urbanslug.com>

--- src/hatti/views/table.cljs
+++ src/hatti/views/table.cljs
@@ -124,6 +124,20 @@
 (def select-unselect-all-records-element
   (str "<input type=\"checkbox\" id=\"" select-unselect-all-records-id "\">"))
 (def delete-record-class "delete-record")
+
+(defn mock-onadata-tasking-fields
+  [cols] (let [review-status {:id "_review_status"
+                              :name "Review status"
+                              :sortable true
+                              :field "_review_status"
+                              :type "text"}
+               comment {:id "_review_comment"
+                        :name "Review comment"
+                        :sortable true
+                        :field "_review_comment"
+                        :type "text"}
+               [actions data] (split-at 1 cols)]
+            (vec (flatten (conj data comment review-status actions)))))

 (defmethod actions-column :default
   [owner has-hxl?]
@@ -166,7 +180,8 @@
                      :hxl hxl}))]
     (clj->js (cond-> columns
                (not hide-actions-column?)
-               (conj (actions-column owner has-hxl?))))))
+               (conj (actions-column owner has-hxl?))
+               true  mock-onadata-tasking-fields))))

 (defn init-sg-pager [grid dataview]
   (let [Pager (.. js/Slick -Controls -Pager)]
@@ -366,7 +381,7 @@
                                           default-num-displayed-records)
                             :totalPages total-page-count})
     (.setFilter dataview (partial filterfn form))
-    (.setItems dataview (clj->js data) _id)
+    (.setItems dataview (clj->js (map #(assoc % :_review_status "Pending" :_review_comment "A comment!") data)) _id)
     (resizeColumns grid)
     [grid dataview]))


PLD: default num displayed records in def

--- src/hatti/views/table.cljs
+++ src/hatti/views/table.cljs
@@ -12,6 +12,8 @@
             [hatti.shared :as shared]
             [hatti.utils :refer [click-fn hyphen->camel-case safe-regex]]
             [cljsjs.slickgrid-with-deps]))
+
+(def default-num-displayed-records 25)

 ;; DIVS
 (def table-id "submission-grid")
@@ -155,7 +157,8 @@
     ;; page, filter, and data set-up on the dataview
     (init-sg-pager grid dataview)
     (.setPagingOptions dataview
-                       #js {:pageSize (or num-displayed-records 25)
+                       #js {:pageSize (or num-displayed-records
+                                          default-num-displayed-records)
                             :totalPages total-page-count})
     (.setFilter dataview (partial filterfn form))
     (.setItems dataview (clj->js data) _id)


Add a namespace docstring

Add a namespace docstring

--- src/io/aviso/rook/core.clj
+++ src/io/aviso/rook/core.clj
@@ -1,4 +1,5 @@
 (ns io.aviso.rook.core
+  "Rook is a simple package used to map the functions of a namespace as web resources, following a naming pattern or explicit meta-data."
   (:require
     [clojure.tools.logging :as l]
     [compojure.core :as compojure]


fixed test

fixed test

--- test/selmer/core_test.clj
+++ test/selmer/core_test.clj
@@ -73,7 +73,7 @@
       (= (fix-line-sep "\n{% block header %}\nB header\n\n
child-a header
\n<<\noriginal header\n>>\n\n{% endblock %}\n\n
{% block content %}\nSome content\n{% endblock %}
\n\n{% block footer %}\n
footer
\n{% endblock %}\n")
          (preprocess-template "templates/inheritance/child-b.html")))
     (is
-      (= "{%ifequal greeting|default:\"Hello!\" name|default:\"JaneDoe\"%} {{greeting|default:\"Hello!\"}} {{name|default:\"JaneDoe\"}} {%endifequal%}"
+      (= "{%ifequal greeting|default:\"Hello!\" name|default:\"Jane Doe\"%} {{greeting|default:\"Hello!\"}} {{name|default:\"JaneDoe\"}} {%endifequal%}"
          (preprocess-template "templates/inheritance/parent.html")))
     (is
       (= (fix-line-sep "\n    \n    \n        {% block hello %}\n\n            Hello \n         World\n{% endblock %}\n    \n")


fixing tests on windows

fixing tests on windows

--- test/selmer/core_test.clj
+++ test/selmer/core_test.clj
@@ -9,6 +9,8 @@
   (:import java.io.File))

 (def path (str "test/templates" File/separator))
+
+(defn fix-line-sep [s] (clojure.string/replace s "\n" (System/lineSeparator)))

 (deftest dev-error-handling
   (is (= "No filter defined with the name 'woot'"
@@ -68,33 +70,33 @@
      *block-super-pattern* (pattern "\\" *tag-open* "\\" *filter-open* "\\s*block.super\\s*\\" *filter-close* "\\" *tag-close*)
      *endblock-pattern* (pattern "\\" *tag-open* "\\" *tag-second* "\\s*endblock.*")]
     (is
-      (= "\n{% block header %}\nB header\n\n
child-a header
\n<<\noriginal header\n>>\n\n{% endblock %}\n\n
{% block content %}\nSome content\n{% endblock %}
\n\n{% block footer %}\n
footer
\n{% endblock %}\n"
+      (= (fix-line-sep "\n{% block header %}\nB header\n\n
child-a header
\n<<\noriginal header\n>>\n\n{% endblock %}\n\n
{% block content %}\nSome content\n{% endblock %}
\n\n{% block footer %}\n
footer
\n{% endblock %}\n")
          (preprocess-template "templates/inheritance/child-b.html")))
     (is
       (= "{%ifequal greeting|default:\"Hello!\" name|default:\"JaneDoe\"%} {{greeting|default:\"Hello!\"}} {{name|default:\"JaneDoe\"}} {%endifequal%}"
          (preprocess-template "templates/inheritance/parent.html")))
     (is
-      (= "\n    \n    \n        {% block hello %}\n\n            Hello \n         World\n{% endblock %}\n    \n"
+      (= (fix-line-sep "\n    \n    \n        {% block hello %}\n\n            Hello \n         World\n{% endblock %}\n    \n")
          (preprocess-template "templates/inheritance/super-b.html")))
     (is
-      (= "\n    \n    \n        {% block hello %}\n\n\n            Hello \n         World\nCruel World\n{% endblock %}\n    \n"
+      (= (fix-line-sep "\n    \n    \n        {% block hello %}\n\n\n            Hello \n         World\nCruel World\n{% endblock %}\n    \n")
          (preprocess-template "templates/inheritance/super-c.html")))
     (is
-      (= "start a\n{% block a %}{% endblock %}\nstop a\n\n{% block content %}{% endblock %}\n\nHello, {{name}}!\n"
+      (= (fix-line-sep "start a\n{% block a %}{% endblock %}\nstop a\n\n{% block content %}{% endblock %}\n\nHello, {{name}}!\n")
          (preprocess-template "templates/inheritance/inherit-a.html")))
     (is
-      (= "start a\n{% block a %}\nstart b\n{% block b %}{% endblock %}\nstop b\n{% endblock %}\nstop a\n\n{% block content %}content{% endblock %}\n\nHello, {{name}}!\n"
+      (= (fix-line-sep "start a\n{% block a %}\nstart b\n{% block b %}{% endblock %}\nstop b\n{% endblock %}\nstop a\n\n{% block content %}content{% endblock %}\n\nHello, {{name}}!\n")
          (preprocess-template "templates/inheritance/inherit-b.html")))
     (is
-      (= "start a\n{% block a %}\nstart b\n{% block b %}\nstart c\nstop c\n{% endblock %}\nstop b\n{% endblock %}\nstop a\n\n{% block content %}content{% endblock %}\n\nHello, {{name}}!\n"
+      (= (fix-line-sep "start a\n{% block a %}\nstart b\n{% block b %}\nstart c\nstop c\n{% endblock %}\nstop b\n{% endblock %}\nstop a\n\n{% block content %}content{% endblock %}\n\nHello, {{name}}!\n")
          (preprocess-template "templates/inheritance/inherit-c.html")))
     (is
-      (= "Base template.\n\n\t\n

\n\n\n"
+      (= (fix-line-sep "Base template.\n\n\t\n

\n\n\n")
          (render-file "templates/child.html" {})))
     (is (= "base tempate hello"
            (render-file "templates/inheritance/include-snippet.html" {})))
     (is
-      (= "Base template.\n\n\t\n
blah
\n\n\n"
+      (= (fix-line-sep "Base template.\n\n\t\n
blah
\n\n\n")
          (render-file "templates/child.html" {:content "blah"})))
     (is
       (= "hello"
@@ -128,7 +130,7 @@
                 :tag-close \]})))

   (is
-    (= "Base template.\n\n\t\n

\n\n\n"
+    (= (fix-line-sep "Base template.\n\n\t\n

\n\n\n")
        (render-file "templates/child-custom.html"
                     {}
                     {:tag-open \[
@@ -165,7 +167,7 @@
 (deftest test-verbatim
   (is (= "{{if dying}}Still alive.{{/if}}"
          (render "{% verbatim %}{{if dying}}Still alive.{{/if}}{% endverbatim %}" {})))
-  (is (= "\n
{%=file.name%}
\n\n"
+  (is (= (fix-line-sep "\n
{%=file.name%}
\n\n")
          (render-file "templates/verbatim.html" {}))))

 (deftest test-with
@@ -299,19 +301,19 @@

 (deftest if-tag-test
   (is
-    (= "\n\n\n\n
NOT BAR!
\n\n\n\n\"bar\"\n\n\n\n\t\n\tinner\n\t\n"
+    (= (fix-line-sep "\n\n\n\n
NOT BAR!
\n\n\n\n\"bar\"\n\n\n\n\t\n\tinner\n\t\n")
        (render-template (parse parse-input (str path "if.html")) {:nested "x" :inner "y"})))
   (is
-    (= "\n\n\n\n
NOT BAR!
\n\n\n\n\"foo\"\n\n\n"
+    (= (fix-line-sep "\n\n\n\n
NOT BAR!
\n\n\n\n\"foo\"\n\n\n")
        (render-template (parse parse-input (str path "if.html")) {:user-id "bob"})))
   (is
-    (= "\n\n\n\n
NOT BAR!
\n\n\n\n\"bar\"\n\n\n"
+    (= (fix-line-sep "\n\n\n\n
NOT BAR!
\n\n\n\n\"bar\"\n\n\n")
        (render-template (parse parse-input (str path "if.html")) {:foo false})))
   (is
-    (= "\n
FOO!
\n\n\n\n\n
NOT BAR!
\n\n\n\n\"bar\"\n\n\n"
+    (= (fix-line-sep "\n
FOO!
\n\n\n\n\n
NOT BAR!
\n\n\n\n\"bar\"\n\n\n")
        (render-template (parse parse-input (str path "if.html")) {:foo true})))
   (is
-    (= "\n
FOO!
\n\n\n\n\n
BAR!
\n\n\n\n\"bar\"\n\n\n"
+    (= (fix-line-sep "\n
FOO!
\n\n\n\n\n
BAR!
\n\n\n\n\"bar\"\n\n\n")
        (render-template (parse parse-input (str path "if.html")) {:foo true :bar "test"})))
   (is
     (= ""
@@ -574,7 +576,7 @@
 (deftest custom-resource-path-setting-url
   (set-resource-path! (clojure.java.io/resource "templates/inheritance"))
   (is (string? @custom-resource-path))
-  (is (= "Hello, World!\n"  (render-file "foo.html" {:name "World"})))
+  (is (= (fix-line-sep "Hello, World!\n")  (render-file "foo.html" {:name "World"})))
   (set-resource-path! nil))

 (deftest safe-filter


fix specs

fix specs

--- test/shorty/core_test.clj
+++ test/shorty/core_test.clj
@@ -9,8 +9,8 @@

 (deftest fill-stop-server-fn
   (testing "start assigns stop-server-fn"
-    (stop)
-    (with-redefs [org.httpkit.server/run-server (constantly true)]
+    (with-redefs [org.httpkit.server/run-server (constantly true)
+                  ring.adapter.undertow/run-undertow (constantly true)]
       (start)
       (is (= true @stop-server-fn)))))


Generate classes for constraints

Generate classes for constraints

--- ingraph-engine/ingraph-engine-sre-clj/src/sre/plan/dsl/constraint.clj
+++ ingraph-engine/ingraph-engine-sre-clj/src/sre/plan/dsl/constraint.clj
@@ -7,33 +7,6 @@
     (if (some? constraint)
       `(~@(iter-implications rest) [#'~constraint ~@(map keyword vars)])
       `())))
-
-(defmacro defconstraint
-  "Let's you define a constraint like a boss.
-
-  Usage:
-    (defconstraint MyConstraint [& vars] :implies* constraint-argument-pairs*)
-
-  Examples:
-    (defconstraint Element [element])
-    (defconstraint Vertex [vertex] :implies Element[vertex])
-    (defconstraint PowerPuffGirls [sugar spice everything-nice]
-        :implies
-          Element [sugar]
-          Element [spice]
-          Element [everything-nice]
-          Mix [sugar spice everything-nice]"
-  [name vars & rest]
-  `(do
-     (def ~name {:name    #'~name
-                 :vars    [~@(map keyword vars)]
-                 :arity   ~(count vars)
-                 :implies #{~@(let [[implies-kw# & implications#] rest]
-                                (case implies-kw#
-                                  nil `()
-                                  :implies (iter-implications implications#)))}})
-     ~(if (contains? (ns-interns *ns*) 'constraints)
-       `(def ~'constraints (conj ~'constraints ~name)))))

 (defn bind
   "Binds constraint parameters to the given arguments"
@@ -58,3 +31,38 @@
       result
       (let [[first & rest] (into () unresolved)]
         (recur (union (implies first) (into #{} rest)) (conj result first))))))
+
+
+(defmacro defconstraint
+  "Let's you define a constraint like a boss.
+
+  Usage:
+    (defconstraint MyConstraint [& vars] :implies* constraint-argument-pairs*)
+
+  Examples:
+    (defconstraint Element [element])
+    (defconstraint Vertex [vertex] :implies Element[vertex])
+    (defconstraint PowerPuffGirls [sugar spice everything-nice]
+        :implies
+          Element [sugar]
+          Element [spice]
+          Element [everything-nice]
+          Mix [sugar spice everything-nice]"
+  [name vars & rest]
+  (let [prefix# (str name "Factory-")]
+    `(do
+       (def ~name {:name    #'~name
+                   :vars    [~@(map keyword vars)]
+                   :arity   ~(count vars)
+                   :implies #{~@(let [[implies-kw# & implications#] rest]
+                                  (case implies-kw#
+                                    nil `()
+                                    :implies (iter-implications implications#)))}})
+       (defn ~(symbol (str prefix# "create")) [~@vars] (bind ~name ~@vars))
+       (gen-class :name ~(str *ns* "." name "Factory")
+                  :prefix ~prefix#
+                  :methods [^:static [~'create [~@(repeat (count vars) Integer)] Object]])
+       ~(if (contains? (ns-interns *ns*) 'constraints)
+          `(def ~'constraints (conj ~'constraints ~name))))))
+
+


fix filter for prod

fix filter for prod

--- src/shuppet/core.clj
+++ src/shuppet/core.clj
@@ -99,7 +99,7 @@
 (defn- filter-tooling-services
   [names]
   (clojure.set/difference
-   names
+   (set names)
    (set (split (env :service-tooling-applications) #","))))

 (defn update-configs


update-article db func

update-article db func

--- src/wiki/db/core.clj
+++ src/wiki/db/core.clj
@@ -6,7 +6,8 @@
 (defonce data-error-message {:message "Unable to process Data"
                              :error_code 1
                              :error_message "Data Error"})
-(def mysql-db {:subprotocol "mysql"
+(def mysql-db {:classname "com.mysql.jdbc.Driver"
+               :subprotocol "mysql"
                :subname "//127.0.0.1:3306/wiki"
                :user "root"
                :password "root"})
@@ -40,4 +41,26 @@
       (update-edits article-id (+ edits 1)))
     ))

+(defn update-content [article-id content]
+  (j/update! mysql-db :articles {:content content} ["id = ?" article-id]))

+(defn current-time []
+  (let [date (new java.util.Date)]
+    (let [sdf (new java.text.SimpleDateFormat "yyyyMMddHHmmss")]
+      (.format sdf (.getTime date)))))
+
+(defn update-modified-time [article-id]
+  (j/update! mysql-db :articles {:modified_time (current-time)} ["id = ?" article-id]))
+
+(defn update-article [article-id content]
+  (j/with-db-transaction [t-con mysql-db]
+    (do
+      (update-content article-id content)
+      (update-modified-time article-id)
+      (increment-edits article-id))))
+
+
+
+
+
+


fixed a small issue with sentence parser

--- src/ziad/common.cljc
+++ src/ziad/common.cljc
@@ -97,8 +97,12 @@
          cur-word []
          words []]
     (cond
+      (and (nil? cur-char)
+           (empty? cur-word))
+      words
+
       (nil? cur-char)
-      words
+      (conj words (apply str cur-word))

       (= \space cur-char)
       (recur rest-sent [] (conj words (apply str cur-word)))


Chunked seqs made the Clojure dumb fib version a lot worse. Adding this as a record for showing that it can be efficient. This commit is meant to be reverted.

--- clojure-functional/src/test/clojure/no/knowit/clojure_functional/euler_two.clj
+++ clojure-functional/src/test/clojure/no/knowit/clojure_functional/euler_two.clj
@@ -25,8 +25,14 @@
          (f b (+ a b)))))
     0N 1N))

+(defn unchunk [s]
+  (when (seq s)
+    (lazy-seq
+      (cons (first s)
+        (unchunk (next s))))))
+
 (defn fib-range [f]
-  (map f (range)))
+  (map f (unchunk (range))))

 (defn even-nums [coll]
   (filter even? coll))
@@ -40,7 +46,7 @@
       (even-nums (f)))))

 (deftest euler-two-fibonacci-sum
-  (is (= (euler-two 40 #(fib-range fib)) 44))
+  (is (= (euler-two 4000000 #(fib-range fib)) 4613732))
   (is (= (euler-two 4000000 #(fib-range fib-mem)) 4613732))
   (is (= (euler-two 4000000 #(fib-range fib-tail)) 4613732))
   (is (= (euler-two 4000000 fib-lazy) 4613732))


Added SSL support to Jetty adapter

Added SSL support to Jetty adapter

--- src/ring/adapter/jetty.clj
+++ src/ring/adapter/jetty.clj
@@ -1,6 +1,7 @@
 (ns ring.adapter.jetty
   (:import (org.mortbay.jetty.handler AbstractHandler)
-           (org.mortbay.jetty Server))
+           (org.mortbay.jetty Server)
+           (org.mortbay.jetty.security SslSocketConnector))
   (:use (ring.util servlet)
         (clojure.contrib except)))

@@ -14,14 +15,36 @@
         (update-servlet-response response response-map)
         (.setHandled request true)))))

+(defn- add-ssl-connector!
+  "Add an SslSocketConnector to a Jetty Server instance."
+  [server options]
+  (let [ssl-connector (SslSocketConnector.)]
+    (doto ssl-connector
+      (.setPort        (options :ssl-port 443))
+      (.setKeystore    (options :keystore))
+      (.setKeyPassword (options :key-password)))
+    (when (options :truststore)
+      (.setTruststore ssl-connector (options :truststore)))
+    (when (options :trust-password)
+      (.setTrustPassword ssl-connector (options :trust-password)))
+    (.addConnector server ssl-connector)))
+
+(defn- create-server
+  "Construct a Jetty Server instance."
+  [options]
+  (let [port   (options :port 80)
+        server (Server. port)]
+    (when (or (options :ssl) (options :ssl-port))
+      (add-ssl-connector! server options))
+    (.setSendDateHeader true)
+    server))
+
 (defn run-jetty
   "Serve the given handler according to the options.
   Options:
     :port, an Integer."
   [handler options]
-  (let [port    (or (:port options) (throwf ":port missing from options"))
-        server  (doto (Server. port) (.setSendDateHeader true))
-        handler (proxy-handler handler)]
-    (.setHandler server handler)
-    (.start server)
-    (.join  server)))
+  (doto (create-server options)
+    (.setHandler (proxy-handler handler))
+    (.start)
+    (.join)))


adding stub of test for playing a card

adding stub of test for playing a card

--- test/cartagena/core_test.clj
+++ test/cartagena/core_test.clj
@@ -72,6 +72,15 @@
       (testing "Board state is correct"
         (assert-board-state)))))

+(deftest play-card-test
+  ; board-spaces becomes a vector of vectors that contain keys for pirate colors they contain? or players?  maybe players should be color-based?
+  (let [expected {:player {:cards updated-cards
+                           :pirates updated-pirates}
+                  :board-spaces updated-spaces
+                  :discard-pile updated-discard-pile}
+        updated-state (play-card player card pirate board discard-pile)]
+    (is (= expected updated-state))))
+
 ;(deftest discard-card-test
 ;  (testing "Discarding a card adds it to the discard pile"
 ;    (new-game! [{:name "tanya" :color :orange} {:name "rusty" :color :black}])


slow tests commented out

slow tests commented out


fix tests

fix tests

--- test/foosball/test/stats.clj
+++ test/foosball/test/stats.clj
@@ -124,15 +124,17 @@
                              :inactivity 2}))))

 (facts "about player form when applied to example matches"
-       (let [{:keys [logs]} (ratings-with-log [] example-matches)]
+       (let [{:keys [won-matches]} (ratings-with-log [] example-matches)
+             calculate-form-helper (fn [num-matches player]
+                                                 (get (calculate-form-from-matches won-matches num-matches) player))]
          (fact "it should calculate as expected"
-               (calculate-current-form-for-player logs 5 "Thomas")     => [false true true]
-               (calculate-current-form-for-player logs 2 "Thomas")     => [true true]
-               (calculate-current-form-for-player logs 1 "Thomas")     => [true]
-               (calculate-current-form-for-player logs 5 "Anders")     => [false false false true]
-               (calculate-current-form-for-player logs 5 "Lisse")      => [true false true false]
-               (calculate-current-form-for-player logs 5 "Knud Erik")  => [true true]
-               (calculate-current-form-for-player logs 5 "Maria")      => [true false false])))
+               (calculate-form-helper 5 "Thomas")    => [false true true]
+               (calculate-form-helper 2 "Thomas")    => [true true]
+               (calculate-form-helper 1 "Thomas")    => [true]
+               (calculate-form-helper 5 "Anders")    => [false false false true]
+               (calculate-form-helper 5 "Lisse")     => [true false true false]
+               (calculate-form-helper 5 "Knud Erik") => [true true]
+               (calculate-form-helper 5 "Maria")     => [true false false])))

 (facts "about possible-matchups"
        (fact "the number of results is bound to the size of the input"


Fix keyword error message

Fix keyword error message

--- modules/bootstrap/src/modular/bootstrap/cylon/user_forms.clj
+++ modules/bootstrap/src/modular/bootstrap/cylon/user_forms.clj
@@ -173,6 +173,11 @@
                            :action (-> model :form :action)}

         [:h2.form-signin-heading reset-pw-prompt]
+        (when (-> model :reset-status)
+            [:div.alert.alert-warning.alert-dismissable
+             [:button.close {:type "button" :data-dismiss "alert" :aria-hidden "true"} "×"]
+             [:span [:strong "Failed: "]
+                      (-> model :reset-status)]])

         (for [[n {:keys [name password? placeholder required autofocus value]}]
               (map vector (range) (-> model :form :fields))]
@@ -185,7 +190,7 @@
             (when required {:required required})
             (when autofocus {:autofocus autofocus}))])

-        [:button.btn.btn-lg.btn-primary.btn-block {:type "submit"} "Reset Pw"]
+        [:button.btn.btn-lg.btn-primary.btn-block {:type "submit"} "Reset Password"]

         ]]))))


Add tests for pattern/fn?

Add tests for pattern/fn?

Also pull out a common test case

--- test/oxcart/pattern_test.clj
+++ test/oxcart/pattern_test.clj
@@ -19,6 +19,10 @@
 (def fail
   (ast
    (fn [] 1)))
+
+
+(def addition
+  (ast (let [x 1] (+ x 2))))

 (deftest def?-tests
@@ -44,9 +48,16 @@
   (is (p/top-level? bar))
   (is (p/top-level? fail))
   (is-not (p/top-level?
-           (-> (ast (let [x 1] (+ x 2)))
+           (-> addition
                :body
                :ret))))
+
+
+(deftest fn?-tests
+  (is (p/fn? (:init foo)))
+  (is (p/fn? (:init bar)))
+  (is (p/fn? fail))
+  (is-not (p/fn? addition)))

 (def private-defn


Changed from dev to poke

Changed from dev to poke

--- test/shuppet/integration.clj
+++ test/shuppet/integration.clj
@@ -43,7 +43,7 @@
            response => (contains {:status 200})))

    (fact "Test config is applied without errors"
-         (client/get (url+ "/envs/dev/apps/test/clean"))
-         (client/get (url+ "/envs/dev/apps/test/apply")) => (contains {:status 200})
-         (client/get (url+ "/envs/dev/apps/test/apply")) => (contains {:status 200})
-         (client/get (url+ "/envs/dev/apps/test/clean"))))
+         (client/get (url+ "/envs/poke/apps/test/clean"))
+         (client/get (url+ "/envs/poke/apps/test/apply")) => (contains {:status 200})
+         (client/get (url+ "/envs/poke/apps/test/apply")) => (contains {:status 200})
+         (client/get (url+ "/envs/poke/apps/test/clean"))))


Расширение...

Расширение...

--- radiolamp-6P3S/src/ixinfestor/omut.cljs
+++ radiolamp-6P3S/src/ixinfestor/omut.cljs
@@ -2427,6 +2427,16 @@
                                                 (modal-hide app) 1)
                                     :text     "Закрыть"})
                         }}))))
+
+
+
+(defn form-show-invalid-messages!! [app message & [input-app input-message]]
+  (alert-clean-and-set!! app :alert-danger (or message "Ошибка ввода данных"))
+  (when input-app
+    (input-css-string-has?-clean-and-set!! input-app :has-error?)
+    (helper-p-clean-and-set!!
+     input-app :text-danger (or input-message "ошибка ввода"))))
+

@@ -3696,3 +3706,38 @@

 ;; END Ввод элементов из справочника
 ;;..................................................................................................
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+


Added ?g1 to the select statement for the delete_duplicate_triples query

--- resources/directives/duplicates/delete_duplicate_triples.clj
+++ resources/directives/duplicates/delete_duplicate_triples.clj
@@ -6,7 +6,7 @@
   :sparql-string "prefix franzOption_chunkProcessingAllowed: <franz:yes>
                   prefix franzOption_memoryLimit: <franz:85g>
                   delete { graph ?g1 {?s ?p ?o}} where {
-                               select ?s ?p ?o  {
+                               select ?g1 ?s ?p ?o  {
                                    graph ?g1 {
                                         ?s ?p ?o
                                    }


Fix stop method of http-kit component

Fix stop method of http-kit component

The method returned nil if the component was not started.

--- modules/http-kit/src/modular/http_kit.clj
+++ modules/http-kit/src/modular/http_kit.clj
@@ -22,9 +22,9 @@
                       {:this this}))))

   (stop [this]
-    (when-let [server (:server this)]
-      (server)
-      (dissoc this :server))))
+    (if-let [server (:server this)]
+      (server))
+    (dissoc this :server)))

 (defn new-webserver [& {:as opts}]
   (let [{:keys [port]} (->> (merge {:port default-port} opts)


Update tests to remove (now) unnecessary stringification of simple num args

--- test/test_carmine/main.clj
+++ test/test_carmine/main.clj
@@ -47,21 +47,21 @@
     (is (= "fido" (wc (r/get k))))
     (is (= 15 (wc (r/append k " [shutdown]"))))
     (is (= "fido [shutdown]" (wc (r/getset k "fido [running]"))))
-    (is (= "running" (wc (r/getrange k "6" "12")))))
+    (is (= "running" (wc (r/getrange k 6 12)))))
   (let [k (test-key "mykey")]
-    (wc (r/setbit k "7" "1"))
-    (is (= 1 (wc (r/getbit k "7")))))
+    (wc (r/setbit k 7 1))
+    (is (= 1 (wc (r/getbit k 7)))))
   (let [k (test-key "multiline")]
     (is (= "OK" (wc (r/set k "Redis\r\nDemo"))))
     (is (= "Redis\r\nDemo" (wc (r/get k))))))

 (deftest test-incr-decr
   (let [k (test-key "connections")]
-    (wc (r/set k "10"))
+    (wc (r/set k 10))
     (is (= 11 (wc (r/incr k))))
-    (is (= 20 (wc (r/incrby k "9"))))
+    (is (= 20 (wc (r/incrby k 9))))
     (is (= 19 (wc (r/decr k))))
-    (is (= 10 (wc (r/decrby k "9"))))))
+    (is (= 10 (wc (r/decrby k 9))))))

 (deftest test-del
   (let [k (test-key "something")]
@@ -72,7 +72,7 @@
   (let [k (test-key "resource:lock")]
     (wc (r/set k "Redis Demo"))
     (is (= -1 (wc (r/ttl k))))
-    (is (= 1 (wc (r/expire k "120"))))
+    (is (= 1 (wc (r/expire k 120))))
     (is (< 0 (wc (r/ttl k))))))

 (deftest test-lists
@@ -81,16 +81,16 @@
     (wc (r/rpush k "Bob"))
     (wc (r/lpush k "Sam"))
     (is (= ["Sam" "Tom" "Bob"]
-           (wc (r/lrange k "0" "-1"))))
+           (wc (r/lrange k 0 -1))))
     (is (= ["Sam" "Tom"]
-           (wc (r/lrange k "0" "1"))))
+           (wc (r/lrange k 0 1))))
     (is (= ["Sam" "Tom" "Bob"]
-           (wc (r/lrange k "0" "2"))))
+           (wc (r/lrange k 0 2))))
     (is (= 3 (wc (r/llen k))))
     (is (= "Sam" (wc (r/lpop k))))
     (is (= "Bob" (wc (r/rpop k))))
     (is (= 1 (wc (r/llen k))))
-    (is (= ["Tom"] (wc (r/lrange k "0" "-1"))))
+    (is (= ["Tom"] (wc (r/lrange k 0 -1))))
     (wc (r/del k))))

 (deftest test-non-ascii-params
@@ -120,7 +120,7 @@

 (deftest test-parallelism
   (let [k (test-key "parallel-key")]
-    (wc (r/set k "0"))
+    (wc (r/set k 0))
     (->> (fn [] (future (dotimes [n 100] (wc (r/incr k)))))
          (repeatedly 100) ; No. of parallel clients
          (doall)
@@ -136,8 +136,8 @@
     (is (= "value1" (wc (r/hget k "field1"))))
     (is (= 1 (wc (r/hexists k "field1"))))
     (is (= ["field1" "value1"] (wc (r/hgetall k))))
-    (wc (r/hset k "field2" "1"))
-    (is (= 3 (wc (r/hincrby k "field2" "2"))))
+    (wc (r/hset k "field2" 1))
+    (is (= 3 (wc (r/hincrby k "field2" 2))))
     (is (= ["field1" "field2"] (wc (r/hkeys k))))
     (is (= ["value1" "3"] (wc (r/hvals k))))
     (is (= 2 (wc (r/hlen k))))
@@ -180,11 +180,11 @@
     (wc (r/zunionstore* k1-U-k2 [k1 k2]))
     (wc (r/zinterstore* k1-I-k2 [k1 k2]))
     (is (= ["Alan Kay" "Richard Stallman" "Yukihiro Matsumoto"]
-           (wc (r/zrange k1 "2" "4"))))
+           (wc (r/zrange k1 2 4))))
     (is (= ["Claude Shannon" "Alan Kay" "Richard Stallman" "Ferris Beuler"]
-           (wc (r/zrange k1-U-k2 "2" "5"))))
+           (wc (r/zrange k1-U-k2 2 5))))
     (is (= ["Emmanuel Goldstein" "Dade Murphy"]
-           (wc (r/zrange k1-I-k2 "0" "1"))))))
+           (wc (r/zrange k1-I-k2 0 1))))))

 (deftest test-pipeline
   (let [k1 (test-key "children")
@@ -197,7 +197,7 @@
                          (r/get k2))))
     (is (= ["B" ["A" "B" "C"] "B"]
            (wc (r/get k2)
-               (r/lrange k1 "0" "3")
+               (r/lrange k1 0 3)
                (r/get k2))))))

 (deftest test-pubsub
@@ -295,7 +295,7 @@
   (let [k (test-key "big-list")
         n 250000]
     (wc (dorun (repeatedly n (fn [] (r/rpush k "value")))))
-    (is (= (repeat n "value") (wc (r/lrange k "0" "-1"))))))
+    (is (= (repeat n "value") (wc (r/lrange k 0 -1))))))

 (deftest test-lua
   (when (redis-version-sufficient? "2.6.0")
@@ -303,11 +303,11 @@
           script "return redis.call('set',KEYS[1],'script-value')"
           script-hash (r/hash-script script)]
       (wc (r/script-load script))
-      (wc (r/evalsha script-hash "1" k))
+      (wc (r/evalsha script-hash 1 k))
       (is (= "script-value" (wc (r/get k))))
       (is (= ["key1" "key2" "arg1" "arg2"]
              (wc (r/eval "return {KEYS[1],KEYS[2],ARGV[1],ARGV[2]}"
-                         "2" "key1" "key2" "arg1" "arg2")))))))
+                         2 "key1" "key2" "arg1" "arg2")))))))

 (deftest test-reply-parsing
   (let [k (test-key "reply-parsing")]


(MAINT) Move i18n middlware call

(MAINT) Move i18n middlware call

--- src/puppetlabs/trapperkeeper/services/status/status_core.clj
+++ src/puppetlabs/trapperkeeper/services/status/status_core.clj
@@ -460,16 +460,15 @@
         (middleware/wrap-uncaught-errors t))))

 (defn build-handler [path status-fns]
-  (i18n/locale-negotiator
-    (comidi/routes->handler
-     (comidi/wrap-routes
-      (comidi/context path
-        (comidi/context "/v1"
-          (-> (build-json-routes "/services" status-fns)
-              (comidi/wrap-routes (errors-by-type-middleware :json)))
-          (-> (build-plaintext-routes "/simple" status-fns)
-              (comidi/wrap-routes (errors-by-type-middleware :plain)))))
-      #(ring-defaults/wrap-defaults % ring-defaults/api-defaults)))))
+  (comidi/routes->handler
+   (comidi/wrap-routes
+    (comidi/context path
+      (comidi/context "/v1"
+        (-> (build-json-routes "/services" status-fns)
+            (comidi/wrap-routes (errors-by-type-middleware :json)))
+        (-> (build-plaintext-routes "/simple" status-fns)
+            (comidi/wrap-routes (errors-by-type-middleware :plain)))))
+    #(i18n/locale-negotiator (ring-defaults/wrap-defaults % ring-defaults/api-defaults)))))

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;; Status Service Status


Update :1.8 profile with clojure 1.8.0-RC1

--- profiles.clj
+++ profiles.clj
@@ -9,4 +9,4 @@
             [lein-ancient "0.6.7"]]}
  :1.6 {:dependencies [[org.clojure/clojure "1.6.0"]]}
  :1.5 {:dependencies [[org.clojure/clojure "1.5.1"]]}
- :1.8 {:dependencies [[org.clojure/clojure "1.8.0-beta2"]]}}
+ :1.8 {:dependencies [[org.clojure/clojure "1.8.0-RC1"]]}}


Some failed frustration

Some failed frustration

--- src/Miscellaneous/practiceTMT.clj
+++ src/Miscellaneous/practiceTMT.clj
@@ -3,31 +3,10 @@
             [incanter.io :as io]
             [clojure.string :as string]))

-
-;;import the CSV data, turn it to a dataset of incanter and read the lines of it.
-
-(def bb
-  (->>
- (io/read-dataset "E:/training/pubmed-oa-subset.csv")
- :rows
- first
- :col3))
-
 (def punc-regex  #"[,.\s;:-?!\/\\\"\'_\(\)\{\}\[\]@—\$&\^\*\+\t\r\n\a\e\f\v]")

-(incanter/view (io/read-dataset "E:/training/pubmed-oa-subset.csv"))
+;(incanter/view (io/read-dataset "E:/training/pubmed-oa-subset.csv"))

-
-(seq "hahahah")
-
-(string/split "ha,hahah.gaga,wa_wa (go)by{crazy}is[tit]3@4—mama$100&fa
-              fa#"
-             punc-regex)
-
-(def sstt "ha,hahah.gaga,wa_wa(go)by{CGrazy}is[tit]3@4—mama$100&fa
-             fa#")
-
-(str " " "a")

 (defn tokenizer
   [text]
@@ -81,24 +60,21 @@
          set
          )))

-(heuristic-filter "E:/training/pubmed-oa-subset.csv" "col3")
-(#{1 2 3} 4)
+;(heuristic-filter "D:/training/pubmed-oa-subset.csv" "col3")
+
+;(read-text "D:/training/pubmed-oa-subset.csv" "col3")
+
+(defn data-ready
+  [csv-file col-name]
+  (let [flt (heuristic-filter csv-file col-name)]
+    (for [row (read-text csv-file col-name)]
+      (assoc row (keyword col-name) (filter #(flt %) (get row (keyword col-name))))
+    )))
+
+;(data-ready "D:/training/pubmed-oa-subset.csv" "col3")

-(def aa (read-text "E:/training/pubmed-oa-subset.csv" "col3"))
-
-
-
-
-
-
-(rest {:a 2 :b 3 :c 4})
-
-
-
-(filter #(<= (val %) 5) {:a 2 :b 3 :d 10})
-(filter [])

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;tips;;;;;;;;;;;;;;;;;;;;


CMR-1852: Minor cleanup

CMR-1852: Minor cleanup

--- umm-spec-lib/src/cmr/umm_spec/xml_to_umm_mappings/echo10.clj
+++ umm-spec-lib/src/cmr/umm_spec/xml_to_umm_mappings/echo10.clj
@@ -48,7 +48,7 @@
          :Sensors (map parse-sensor (select inst "Sensors/Sensor"))))

 (defn parse-metadata-association
-  "Returns a UMM MetadataAssocation record from an ECHO10 CollectionAsscociation element."
+  "Returns a UMM MetadataAssocation from an ECHO10 CollectionAsscociation element."
   [element]
   (let [version-id (value-of element "VersionId")
         assoc-type (value-of element "CollectionType")]
@@ -58,9 +58,10 @@
      :Description (value-of element "CollectionUse")}))

 (defn parse-metadata-associations
-  "Returns a seq of UMM MetadataAssocation records from an ECHO10 document."
+  "Returns a seq of UMM MetadataAssocations from an ECHO10 document."
   [doc]
-  (map parse-metadata-association (select doc "/Collection/CollectionAssociations/CollectionAssociation")))
+  (map parse-metadata-association
+       (select doc "/Collection/CollectionAssociations/CollectionAssociation")))

 (defn parse-data-dates
   "Returns UMM DataDates seq from ECHO 10 XML document."


improve performance of (defn get-string)

--- src/babel/espanol/morphology.cljc
+++ src/babel/espanol/morphology.cljc
@@ -103,8 +103,8 @@
       (and (map? (get-in word '(:a)))
            (map? (get-in word '(:b))))
       (get-string
-       (get-in word '(:a))
-       (get-in word '(:b)))
+       (get-string (get-in word [:a]))
+       (get-string (get-in word [:b])))

       ;; TODO: this rule is pre-empting all of the following rules
       ;; that look in :a and :b. Either remove those following rules


implement ALL NONE removal for some of default cases

--- src/clj/com/rpl/specter/navs.cljc
+++ src/clj/com/rpl/specter/navs.cljc
@@ -149,24 +149,27 @@
        (let [empty-structure (empty structure)]
          (cond (and (list? empty-structure) (not (queue? empty-structure)))
             ;; this is done to maintain order, otherwise lists get reversed
-              ;;TODO: need to handle NONE here
+               ;;TODO: need to handle NONE here
                (doall (map next-fn structure))

                (map? structure)
-            ;; reduce-kv is much faster than doing r/map through call to (into ...)
+               ;; reduce-kv is much faster than doing r/map through call to (into ...)
                (reduce-kv
                  (fn [m k v]
-                   ;;TODO: need to handle NONE here
-                   (let [[newk newv] (next-fn [k v])]
-                     (assoc m newk newv)))
+                   (let [newkv (next-fn [k v])]
+                     (if (identical? newkv i/NONE)
+                      m
+                      (assoc m (nth newkv 0) (nth newkv 1)))))

                  empty-structure
                  structure)

                :else
-               ;;TODO: need to handle NONE here
-               (->> structure (r/map next-fn) (into empty-structure))))))
+               (->> structure
+                    (r/map next-fn)
+                    (r/filter #(-> % (identical? i/NONE) not))
+                    (into empty-structure))))))

   #?(:cljs default)


rough draft of new, faster short-term trend collection

--- src/clj/forma/trends/analysis.clj
+++ src/clj/forma/trends/analysis.clj
@@ -142,3 +142,77 @@
           len-spectral (lengthening-ts start-pd end-pd spectral-ts)]
       (map (partial long-trend intervals)
            len-reli len-spectral)))
+
+
+(defn deseasonalize
+  [freq spectral-ts reli-ts]
+  (->> (make-reliable #{3 2} #{1 0} reli-ts spectral-ts)
+       (harmonic-seasonal-decomposition 23 3)
+       (i/matrix)))
+
+(defn trend-mat
+  [len]
+  (i/bind-columns
+   (repeat len 1)
+   (map inc (range len))))
+
+(defn proj-mat
+  [block-len]
+  (let [X (trend-mat block-len)]
+    (i/mmult (i/solve (i/mmult (i/trans X) X))
+             (i/trans X))))
+
+(defn grab-trend
+  [proj-mat sub-coll]
+  (second (i/mmult proj-mat sub-coll)))
+
+(defn moving-subvec
+  [coll window]
+  (loop [idx 0
+         res []]
+    (if (> idx (- (count coll) window))
+      res
+      (recur
+       (inc idx)
+       (conj res (i/sel coll :rows (range idx (+ window idx))))))))
+
+(defn block-ols-trend
+  [block-len spectral-ts reli-ts]
+  (map (partial grab-trend (proj-mat block-len))
+       (moving-subvec (deseasonalize 23 spectral-ts reli-ts) block-len)))
+
+(defn collect-short
+  [block-len training-end spectral-ts reli-ts]
+  (let [leading-buffer (+ 2 (- training-end (+ block-len 10)))]
+    (->> (block-ols-trend block-len spectral-ts reli-ts)
+         (utils/moving-average 10)
+         (reductions min)
+         (drop leading-buffer))))
+
+         ;; (drop leading-buffer)
+
+;; (defn test-trends
+;;   [spectral-ts reli-ts long-block]
+;;   (let [proj     (proj-mat long-block)
+;;         clean-ts (deseasonalize 23 spectral-ts reli-ts)]
+;;     (loop [iter 0
+;;            mat (i/sel clean-ts :rows (range iter (+ iter long-block)))
+;;            res  []]
+;;       (println res)
+;;       (println proj)
+;;       (println "")
+;;       (println (i/sel clean-ts :rows
+;;                       (range iter (+ iter long-block))))
+;;       (if (> iter 5)
+;;         res
+;;         (recur (inc iter)
+;;                (i/sel clean-ts :rows (range iter (+ iter long-block)))
+;;                (conj res (grab-trend proj-mat mat)))))))
+
+;; (reduce min (utils/moving-average 5 ndvi))
+;; (if (< (count sub-coll) 30)
+;;         res
+;;         (recur
+;;          (inc i)
+;;          (i/sel coll :rows  i (+ 30 i))
+;;          (conj res (grab-trend proj sub-coll))))


partial implementation of Targeted Marketing

--- src/clj/game/cards-operations.clj
+++ src/clj/game/cards-operations.clj
@@ -457,6 +457,21 @@

    "Sweeps Week"
    {:effect (effect (gain :credit (count (:hand runner))))}
+
+   "Targeted Marketing"
+   {:abilities [{:req (req (= (:zone card) [:current]))
+                 :label "Gain 10 [Credits] because the Runner installed the named card"
+                 :prompt "Choose the card you named in the Runner's rig"
+                 :choices {:req #(and (= (:side %) "Runner")
+                                      (not (:facedown %))
+                                      (not= (first (:zone %)) :discard)
+                                      (not= (:type %) "Identity"))}
+                 :msg (msg "gain 10 [Credits] from the Runner playing " (:title target))
+                 :effect (effect (gain :credit 10))}
+                {:req (req (and (= (:zone card) [:current]) (= (:type (last (:discard runner))) "Event")))
+                 :label "Gain 10 [Credits] because the Runner played the named Event"
+                 :msg (msg "gain 10 [Credits] from the Runner playing " (:title (last (:discard runner))))
+                 :effect (effect (gain :credit 10))}]}

    "The All-Seeing I"
    (let [trash-all-resources {:player :runner


Some renaming for aiding debugging.

Some renaming for aiding debugging.

--- src/cljs/cljs_repl_web/views.cljs
+++ src/cljs/cljs_repl_web/views.cljs
@@ -17,7 +17,7 @@
             [cljs-repl-web.views.utils :as utils]
             [cljs-repl-web.markdown :as md]))

-(trace-forms {:tracer (tracer :color "orange")}
+;;

 ;; (set! re-com.box/debug true)

@@ -397,12 +397,12 @@
                                     [build-related-symbols-ui related])
                                   (when (not-empty examples)
                                     [build-examples-ui examples showing?])]]])]]))
-(defn build-symbol-ui
+(defn api-symbol
   "Builds the UI for a single symbol. Will be a button."
   [symbol]
   (let [showing? (reagent/atom false)
         popover-position (reagent/atom :below-center)]
-    (fn []
+    (fn api-symbol-form2 [symbol]
      [box
       :size "0 1 auto"
       :align :center
@@ -440,7 +440,9 @@
            :level :level4
            :class "api-panel-topic"]])

-(defn build-section-ui
+(trace-forms {:tracer (tracer :color "orange")}
+
+(defn api-section
   "Builds the UI for a section."
   [section]
   [v-box
@@ -467,14 +469,16 @@
                                                     :justify :start
                                                     :style {:flex-flow "wrap"}
                                                     :children (for [symbol (:symbols topic)]
-                                                                [build-symbol-ui symbol])]]])]]]]])
-
-(defn build-api-panel-ui
+                                                                [api-symbol symbol])]]])]]]]])
+
+
+
+(defn api-panel
   "Builds the UI for the api panel."
   [sections]
   (let [cols (subscribe [:api-panel-columns]) ;; must be a divisor of 12
         secs (count sections)]
-    (fn [sections]
+    (fn api-panel-form2 [sections]
       [h-box
        :size "1 1 auto"
        :gap "10px"
@@ -485,10 +489,9 @@
                                       :size (str "0 1 " (quot 100 @cols) "%")
                                       :gap "10px"
                                       :children (for [section sections]
-                                                  [build-section-ui section])])]])))
-
-(defn api-panel []
-  [build-api-panel-ui (:sections api-utils/custom-api-map)])
+                                                  [api-section section])])]])))
+
+)

 (defn footer-component []
   [h-box
@@ -540,7 +543,7 @@
    :size "1 1 auto"
    :gap "4px"
    :align :stretch
-   :children [[api-panel]]])
+   :children [[api-panel (:sections api-utils/custom-api-map)]]])

 (defn repl-component []
   [h-box
@@ -554,4 +557,4 @@
                :style {:overflow "hidden"}
                :child [cljs-console-component]]]])

-)
+;; )


omnibar with fuzzy match

omnibar with fuzzy match

--- src/cljs/github_omnibar/core.cljs
+++ src/cljs/github_omnibar/core.cljs
@@ -1,103 +1,113 @@
 (ns github-omnibar.core
-    (:require [reagent.core :as r :refer [atom cursor]]
+  (:use [clj-fuzzy.metrics :only [tversky]])
+  (:require [reagent.core :as r :refer [atom cursor]]
               [reagent.session :as session]
               [secretary.core :as secretary :include-macros true]
               [accountant.core :as accountant]))
+

-;; (defonce actions
-
-  ;; (.toArray (.map (js/$ "[data-hotkey]") #({:label (.getAttribute %2 "aria-label") :hotkey (.getAttribute %2 "data-hotkey")}))))
-  ;; )
 (defonce omni-data
-  (r/atom {:actions [{:type :hot-key
-                      :label "Homepage"
-                      :hotkey "g h"}
-                     {:type :hot-key
-                      :label "Search"
-                      :hotkey "s"}]
+  (r/atom {:actions (.toArray (.map (js/$ "[data-hotkey]")
+                                    (fn [idx el]
+                                      {:type :hot-key
+                                       :hotkey (.getAttribute el "data-hotkey")
+                                       :label (or (.getAttribute el "aria-label") (.-textContent el))})))
            :search ""
            :highlighted 0
+           :display false
            }))
+
+;; (defn fuzzy-match [data keyword]
+;;   (filter #(re-find ))
+;;   (tokenize keyword)
+;;   )(fz/dice (:label action) keyword)
+;; ---------------------
+;; Actions
 (defn- mod-actions [idx] (mod idx (count (:actions @omni-data))))
-(defn godown []
+
+(defn fuzzy-match [data keyword]
+  (swap! data update-in [:actions]
+         (fn [actions]
+           (->> actions
+                (map #(assoc % :score (if (empty? keyword) nil (tversky (:label %) keyword))))
+                (sort-by :score)
+                reverse))))
+
+(defn godown! []
   (swap! omni-data update-in [:highlighted] (comp mod-actions inc)))

-(defn goup []
+(defn goup! []
   (swap! omni-data update-in [:highlighted] (comp mod-actions dec)))

-(defn reset []
-  (swap! omni-data update-in [:highlighted] #(identity 0)))
+(defn reset-highlight! []
+  (swap! omni-data assoc :highlighted 0))

-(defmulti action
+(defn exit! []
+  (swap! omni-data assoc :display false))
+
+(defmulti action!
   (fn [current-action]
-    (:type current-action)))
+    (or (:type current-action) :exit)))

-(defmethod action :hot-key [current]
+(defmethod action! :hot-key [current]
   (let [el (js/$ (str "[data-hotkey='" (:hotkey current) "']"))]
     (if (.is el "input, textarea")
       (.focus el)
-      (.click el))))
+      (.each el #((.click %2)))))
+  (exit!))

-(defmethod action :repo [current]
+(defmethod action! :repo [current]
   (println "search"))
+
+(defmethod action! :exit [_]
+  (exit!))

 ;; -------------------------
 ;; Views
-
-(defn home-page []
-  (let [actions (cursor omni-data [:actions])
-        highlighted (:highlighted @omni-data)
-        current-action (nth (:actions @omni-data) (:highlighted @omni-data))]
-    [:div.github-omnibar
-     [:div.filter-repos.filter-bar
-      [:input.filter-input {:type "text"
-                            :placeholder "Find ..."
-                            :auto-focus "true"
-                            :on-key-down #(case (.-which %)
-                                            40 (godown)
-                                            38 (goup)
-                                            13 (action current-action)
-                                            (reset))
-                                      }]]
-     [:ul.mini-repo-list
-      (map-indexed (fn [idx action]
-                     [:li.source {:key idx :class (if (= idx highlighted) "highlighted")}
-                      [:a.mini-repo-list-item.css-truncate
-                       [:span.repo-and-owner>span.repo (:label action)]
-                       [:span.stars>kbd (:hotkey action)]]])
-           @actions)]])
+(defn omnibar []
+  (if (:display @omni-data)
+    (let [actions (cursor omni-data [:actions])
+          highlighted (:highlighted @omni-data)
+          current-action (nth (:actions @omni-data) (:highlighted @omni-data))]
+      [:div.github-omnibar
+       [:div.filter-repos.filter-bar
+        [:input.filter-input {:type "text"
+                              :placeholder "Find ..."
+                              :auto-focus "true"
+                              :on-blur #(exit!)
+                              :on-change (fn [e]
+                                           (fuzzy-match omni-data (-> e .-target .-value)))
+                              :on-key-down #(let [key (.-which %)
+                                                  ctrl (.-ctrlKey %)]
+                                              (cond
+                                                (= key 40) (godown!)
+                                                (and (= key 78) ctrl) (godown!)
+                                                (= key 38) (goup!)
+                                                (and (= key 80) ctrl) (goup!)
+                                                (= key 13) (do (.preventDefault %)
+                                                               (action! current-action))
+                                                (= key 27) (exit!)
+                                                (and (= key 71) ctrl) (exit!)
+                                                (and (< key 90) (> key 48)) (reset-highlight!))
+                                              )}]]
+       [:ul.mini-repo-list
+        (map-indexed (fn [idx act]
+                       [:li.source {:key idx :class (if (= idx highlighted) "highlighted")}
+                        [:a.mini-repo-list-item.css-truncate
+                         {:on-click #(action! act)}
+                         [:span.repo-and-owner>span.repo (:label act)]
+                         [:span.stars>kbd (:hotkey act)]]])
+                     (filter #(not= (get % :score 1) 0) @actions))]]))
    )

-(defn about-page []
-  [:div [:h2 "About github-omnibar"]
-   [:div>a {:href "/"} "go to the home page"]])
-
-(defn current-page []
-  [:div [(session/get :current-page)]])
+;; -------------------------
+;; Initialize omnibar
+(defn mount-root []
+  (r/render [omnibar] (.getElementById js/document "omnibar")))

-;; -------------------------
-;; Routes
-
-(secretary/defroute "/" []
-  (session/put! :current-page #'home-page))
-
-(secretary/defroute "/about" []
-  (session/put! :current-page #'about-page))
-
-;; -------------------------
-;; Initialize app
-
-(defn mount-root []
-  (r/render [current-page] (.getElementById js/document "app")))
-
-(defn init! []
-  (accountant/configure-navigation!
-    {:nav-handler
-     (fn [path]
-       (secretary/dispatch! path))
-     :path-exists?
-     (fn [path]
-       (secretary/locate-route path))})
-  (accountant/dispatch-current!)
-  (mount-root))
+  (.append (js/$ "body") (js/$ "

"))
+  (.keydown (js/$ js/document) (fn [e]
+                                 (if (and (= 80 (.-which e)) (= "BODY" (.-nodeName (.-target e))))
+                                   (swap! omni-data assoc :display true))))
+  (mount-root)


ideas

ideas

--- src/cljs/triboard/logic/move.cljs
+++ src/cljs/triboard/logic/move.cljs
@@ -31,7 +31,7 @@
   (or (nil? cell) (= cell :empty) (= cell :wall)))

 (defn- available-cells-by-dir
-  "Indicates the convertible cells when clicking at [x y]"
+  "Indicates the convertible cells when clicking at [x y]"  ;; TODO - Refactor & Test
   [board [xi yi :as coord] [dx dy]]
   (loop [x (+ xi dx)
          y (+ yi dy)


Enable word wrap for markdown and text files

--- src/clojure/nightcode/editors.clj
+++ src/clojure/nightcode/editors.clj
@@ -226,6 +226,7 @@
                      "md" SyntaxConstants/SYNTAX_STYLE_NONE
                      "txt" SyntaxConstants/SYNTAX_STYLE_NONE})
 (def ^:const clojure-exts #{"clj" "cljs"})
+(def ^:const wrap-exts #{"md", "txt"})

 (defn get-extension
   [path]
@@ -252,6 +253,7 @@
     .discardAllEdits
     (.setAntiAliasingEnabled true)
     (.setSyntaxEditingStyle (get-syntax-style path))
+    (.setLineWrap (contains? wrap-exts (get-extension path)))
     (.setMarginLineEnabled true)
     (.setMarginLinePosition 80)))


more stats

more stats

--- webapp/src/webapp/site_stats.clj
+++ webapp/src/webapp/site_stats.clj
@@ -5,9 +5,16 @@
     [hiccup.core :refer :all]
     [cheshire.core :refer :all]))

-(defn slurp-logs []	(map parse-string (clojure.string/split (slurp "resources/logs/logs.txt") #"\n")))
+(defn slurp-logs []	(map #(parse-string % true) (clojure.string/split (slurp "resources/logs/logs.txt") #"\n")))
+(defn pagekey_counts [] (frequencies (into [] (map :pagekey (filter #(= "page-view" (:action %)) (slurp-logs))))))
+
 (defn stats-output [] (str site_header (html
 	[:body
 		[:h2 "Site Statistics"]
 		[:div {:class "main"}
-			[:p {:style "padding-top:10px;padding-bottom:10px;padding-left:15px"} (str (html [:b "Total Page Views"] "--" (count (slurp-logs))))]]])))+			[:p {:style "padding-top:10px;padding-bottom:10px;padding-left:15px"} (str (html [:b "Total Page Views"] "--" (reduce + (map val (dissoc (pagekey_counts) "microblog_post")))))]
+			[:p {:style "padding-left:15px"} (str "Homepage--" (get (pagekey_counts) "homepage"))]
+			[:p {:style "padding-left:15px"} (str "Microblog--" (get (pagekey_counts) "microblog"))]
+			[:p {:style "padding-left:15px"} (str "Fantasy Football--" (get (pagekey_counts) "fantasy-football"))]
+			[:p {:style "padding-left:15px;padding-bottom:15px"} (str "Site Stats--" (get (pagekey_counts) "site_stats"))]]
+	])))


add missing Form items declarations

add missing Form items declarations

--- src/fo/cubanostack/bootstrap.cljs
+++ src/fo/cubanostack/bootstrap.cljs
@@ -32,10 +32,13 @@
   Dropdown.Toggle
   FormControls
   FormControls.Static
+  FormGroup
   Glyphicon
   Grid
   Image
   Input
+  InputGroup
+  InputGroup.Addon
   Jumbotron
   Label
   ListGroup


Use actual min value instead of 0.

Use actual min value instead of 0.

--- src-cljs/kixi/hecuba/widgets/chart.cljs
+++ src-cljs/kixi/hecuba/widgets/chart.cljs
@@ -95,18 +95,19 @@

 (defn min-max-values [series]
   (if (seq series)
-    (reduce (fn [{:keys [minimum maximum]} new]
-              {:minimum (min minimum (:value new))
-               :maximum (max maximum (:value new))})
-            {:minimum 0 :maximum 2}
-            series)
+    (let [v (:value (first series))]
+      (reduce (fn [{:keys [minimum maximum]} new]
+                {:minimum (min minimum (:value new))
+                 :maximum (max maximum (:value new))})
+              {:minimum v :maximum v}
+              series))
     {:minimum 0 :maximum 0}))

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; Draw chart

 (defn y-scale [min max height]
-  (-> js/d3 .-scale (.linear) (.domain (to-array [min max])) (.range (to-array [height 0]))))
+  (-> js/d3 .-scale (.linear) (.domain (to-array [min max])) (.range (to-array [height min]))))

 (defn line-fn [x-scale y-scale]
   (doto (-> js/d3 .-svg (.line))


fix the source

fix the source

--- src-cljs/frontend/components/canvas.cljs
+++ src-cljs/frontend/components/canvas.cljs
@@ -138,7 +138,7 @@
                                              (cast! :track-external-link-clicked
                                                     {:path (auth/auth-url)
                                                      :event "Signup Clicked"
-                                                     :properties {:source "username-overlay"}})))
+                                                     :properties {:source "prcrsr-bot-drawing"}})))
                                :onMouseDown
                                (when-not (:layer/signup-button layer)
                                  #(do


another react key

another react key

--- src-cljs/frontend/components/issues.cljs
+++ src-cljs/frontend/components/issues.cljs
@@ -264,7 +264,8 @@
           (when (om/get-state owner :replying?)
             (om/build comment-form {:issue-id issue-id
                                     :parent-id comment-id
-                                    :close-callback #(om/set-state! owner :replying? false)}))
+                                    :close-callback #(om/set-state! owner :replying? false)}
+                      {:react-key "comment-form"}))
           (unrendered-comments-notice all-child-ids rendered-child-ids #(om/update-state! owner (fn [s]
                                                                                (assoc s :rendered-child-ids (:all-child-ids s)))))
           (when (and (not (contains? ancestors (:db/id comment))) ; don't render cycles


Fix tests in cljs

Fix tests in cljs

--- tests/test_state.cljx
+++ tests/test_state.cljx
@@ -2,7 +2,7 @@
   #+cljs
   (:require [cemerick.cljs.test :as ts]
             [cats.core :as m]
-            [cats.data :as data]
+            [cats.data :as d]
             [cats.monad.state :as state])
   #+cljs
   (:require-macros [cemerick.cljs.test


Minor reconfiguration.

Minor reconfiguration.

--- src/angelic/search/implicit/dash_astar.clj
+++ src/angelic/search/implicit/dash_astar.clj
@@ -163,8 +163,11 @@
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Used by stubs ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

+;; Note: putting ts stuff here rather than watching above ensures things happen
+;; in desired order.
 ;; TODO: set stub to -inf here, simplify other code?
 ;; TODO: efficiency?
+;; TODO: stb is redundant here...
 (defn- set-stub-output! [stb sp]
   (assert (empty? (get-outputs stb)))
   (assert (identical? (stub sp) stb))
@@ -244,17 +247,27 @@
 (defmethod print-method angelic.search.implicit.dash_astar.Subproblem [sp o]
  (print-method (format "#<SP$%8h %s>" (System/identityHashCode (stub sp)) (sp-name sp)) o))

-(defn direct-sp? [sp] )
-
+
+;; TODO: Must be careful to account for wrappers
+;; All SP children are added through this interface.
+;; Doing it all with stubs makes subsumption forwarding easier.
 (defn- add-sp-child-stub! [sp child-stub up?]
-  (when (= (ts-stub (sp-ts sp)) (stub sp)) ;; not a wrapper; don't double-copy!
-    ;; TODO
-    )
+  (assert (not (terminal? sp)))
   (connect-and-watch-stub! sp child-stub up?
     (fn [child-sp]
-      (assert (not (terminal? sp)))
       (summaries/summary-changed-local! sp)
       (add-output! sp child-sp))))
+
+(comment
+;; TODO: propagation could be done more efficiently using a separate,
+;;   single tracker per SP that hashes on name, for instance.
+  #_(declare norm-name)
+  (when (and *propagate-subsumption* (= (ts-stub (sp-ts sp)) (stub sp))) ;; not wrapper
+    (let [child-name (norm-name (stub-name child-stub))]
+      (doseq [])
+      )
+    ))
+

 (traits/deftrait simple-subproblem [stb out-set term? ri-fn] [] [watched-node]


Ring middleware: Rename some functions

Ring middleware: Rename some functions

--- test/com/nomistech/clojure_the_language/c_800_libraries/s_800_web/ss_020_ring.clj
+++ test/com/nomistech/clojure_the_language/c_800_libraries/s_800_web/ss_020_ring.clj
@@ -85,23 +85,23 @@
 ;;;; ___________________________________________________________________________
 ;;;; ---- rmj/wrap-json-body ----

-(defn handler-with-interesting-request [request]
+(defn handler-of-interesting-request [request]
   (let [user (get-in request [:body :user] "<no user specified>")]
     (rur/response (str "Uploaded '" user "'."))))

-(def wrapped-handler-with-interesting-request
-  (-> handler-with-interesting-request
+(def wrapped-handler-of-interesting-request
+  (-> handler-of-interesting-request
       (rmj/wrap-json-body {:keywords? true
                            :bigdecimals? true})))

 (fact "Handler with request whose body is Clojure data"
-  (handler-with-interesting-request {:body {:user "Fred"}})
+  (handler-of-interesting-request {:body {:user "Fred"}})
   => {:status 200
       :headers {}
       :body "Uploaded 'Fred'."})

 (fact "Wrapped handler with request whose body is JSON"
-  (wrapped-handler-with-interesting-request
+  (wrapped-handler-of-interesting-request
    {:headers {"content-type" "application/json; charset=utf-8"}
     :body (string->stream "{\"user\":\"Fred\"}")})
   => {:status 200
@@ -133,24 +133,24 @@
 ;;;; ___________________________________________________________________________
 ;;;; ---- Wrapping requests and responses ----

-(defn handler-with-interesting-request-and-response [request]
+(defn handler-of-interesting-request-and-response [request]
   (let [user (get-in request [:body :user] "<no user specified>")]
     (rur/response {:uploaded-user user})))

-(def wrapped-handler-with-interesting-request-and-response
-  (-> handler-with-interesting-request-and-response
+(def wrapped-handler-of-interesting-request-and-response
+  (-> handler-of-interesting-request-and-response
       (rmj/wrap-json-body {:keywords? true
                            :bigdecimals? true})
       rmj/wrap-json-response))

 (fact "Handler with request whose body is Clojure data"
-  (handler-with-interesting-request-and-response {:body {:user "Fred"}})
+  (handler-of-interesting-request-and-response {:body {:user "Fred"}})
   => {:status 200
       :headers {}
       :body {:uploaded-user "Fred"}})

 (fact "Wrapped handler with request whose body is JSON"
-  (wrapped-handler-with-interesting-request-and-response
+  (wrapped-handler-of-interesting-request-and-response
    {:headers {"content-type" "application/json; charset=utf-8"}
     :body (string->stream "{\"user\":\"Fred\"}")})
   => {:status 200


precompute has-ackers? as a micro-optimization

--- src/clj/backtype/storm/daemon/executor.clj
+++ src/clj/backtype/storm/daemon/executor.clj
@@ -345,7 +345,8 @@
                                 ;; TODO: on failure, emit tuple to failure stream
                                 ))))
         receive-queue (:receive-queue executor-data)
-        event-handler (mk-task-receiver executor-data tuple-action-fn)]
+        event-handler (mk-task-receiver executor-data tuple-action-fn)
+        has-ackers? (has-ackers? storm-conf)]
     (log-message "Opening spout " component-id ":" (keys task-datas))
     (doseq [[task-id task-data] task-datas
             :let [^ISpout spout-obj (:object task-data)
@@ -354,7 +355,7 @@
                                    (let [out-tasks (if out-task-id
                                                      (tasks-fn out-task-id out-stream-id values)
                                                      (tasks-fn out-stream-id values))
-                                         rooted? (and message-id (has-ackers? storm-conf))
+                                         rooted? (and message-id has-ackers?)
                                          root-id (if rooted? (MessageId/generateId rand))
                                          out-ids (fast-list-for [t out-tasks] (if rooted? (MessageId/generateId rand)))]
                                      (fast-list-iter [out-task out-tasks id out-ids]