(TK-103) Restored query-params-test-async tests

This commit restores the `query-params-test-async` tests, using a client
to make the requests since the client-less single-request async APIs are
no longer available.

--- test/puppetlabs/http/client/async_plaintext_test.clj
+++ test/puppetlabs/http/client/async_plaintext_test.clj
@@ -129,6 +129,50 @@
             (is (= "Hello, World!" (slurp (:body @response))))))
         (.close client)))))

+(deftest query-params-test-async
+  (testlogging/with-test-logging
+    (testutils/with-app-with-config app
+      [jetty9/jetty9-service test-params-web-service]
+      {:webserver {:port 8080}}
+        (testing "URL Query Parameters work with the Java client"
+          (let [client (Async/createClient (ClientOptions.))]
+            (try
+              (let [request-options (RequestOptions.
+                                      (URI. "http://localhost:8080/params?foo=bar&baz=lux"))
+                    response        (.get client request-options)]
+                (is (= 200 (.getStatus (.deref response))))
+                (is (= queryparams (read-string (slurp (.getBody
+                                                         (.deref response)))))))
+              (finally
+                (.close client)))))
+
+        (testing "URL Query Parameters work with the clojure client"
+          (with-open [client (async/create-client {})]
+            (let [opts     {:method       :get
+                            :url          "http://localhost:8080/params/"
+                            :query-params queryparams
+                            :as           :text}
+                  response (common/get client "http://localhost:8080/params" opts)]
+                (is (= 200 (:status @response)))
+                (is (= queryparams (read-string (:body @response)))))))
+
+        (testing "URL Query Parameters can be set directly in the URL"
+          (with-open [client (async/create-client {})]
+            (let [response (common/get client
+                                       "http://localhost:8080/params?paramone=one"
+                                       {:as :text})]
+              (is (= 200 (:status @response)))
+              (is (= (str {"paramone" "one"}) (:body @response))))))
+
+        (testing (str "URL Query Parameters set in URL are overwritten if params "
+                      "are also specified in options map")
+          (with-open [client (async/create-client {})]
+            (let [response (common/get client
+                                       "http://localhost:8080/params?paramone=one&foo=lux"
+                                       query-options)]
+              (is (= 200 (:status @response)))
+              (is (= queryparams (read-string (:body @response))))))))))
+
 (deftest redirect-test-async
   (testlogging/with-test-logging
     (testutils/with-app-with-config app


update collection UI handler/template (only enable uploads if current user is coll owner)

--- src-cljs/imago/collection.cljs
+++ src-cljs/imago/collection.cljs
@@ -41,12 +41,19 @@

 (defn remove-file
   [local id]
+  (swap! local update-in [:files] dissoc id)
+  (dom/remove! (dom/by-id id))
+  (when (empty? (:files @local))
+    (dom/show! (dom/by-id "drop-msg"))))
+
+(defn remove-all-files
+  [state local])
+
+(defn remove-file*
+  [local id]
   (fn [e]
     (.preventDefault e)
-    (swap! local update-in [:files] dissoc id)
-    (dom/remove! (dom/by-id id))
-    (when (empty? (:files @local))
-      (dom/show! (dom/by-id "drop-msg")))))
+    (remove-file local id)))

 (defn add-files
   [state local]
@@ -65,7 +72,7 @@
               (dom/create-dom!
                [:div.row {:id id}
                 [:div.col-xs-1
-                 [:button.close {:type "button" :events [[:click (remove-file local id)]]} "\u00D7"]]
+                 [:button.close {:type "button" :events [[:click (remove-file* local id)]]} "\u00D7"]]
                 [:div.col-xs-5 fname]
                 [:div.col-xs-2 (ff/format [KB "KB"] fsize)]
                 [:div.col-xs-4
@@ -77,6 +84,42 @@
       (dom/remove-class! (dom/by-id "dropzone-wrapper") "dropzone-active")
       (debug @local))))

+(defn show-template
+  [state local]
+  (->> (:app-root config/app)
+       (dom/clear!)
+       (dom/create-dom!
+        [:div
+         [:div.row
+          [:div.col-xs-12
+           [:h2 (:title @local)]]]
+         (when (= (:owner @local) (-> @state :user :id))
+           (list
+            [:div#dropzone-wrapper.jumbotron
+             {:events [[:dragenter (fn [e] (dom/add-class! (dom/by-id "dropzone-wrapper") "dropzone-active"))]
+                       [:dragleave (fn [e] (dom/remove-class! (dom/by-id "dropzone-wrapper") "dropzone-active"))]
+                       [:drop (add-files state local)]]}
+             [:div#dropzone.container
+              [:h2#drop-msg.text-center "Drop media files here"]]]
+            [:div.row
+             [:div.col-xs-12
+              [:button#bt-upload.btn.btn-primary.btn-lg
+               {:events [[:click (upload-files state local)]]}
+               "Upload media"] " "
+              [:button#bt-upload.btn.btn-default.btn-lg
+               {:disabled "disabled"
+                :events [[:click (remove-all-files state local)]]}
+               "Cancel all"]]]))
+         [:div.row
+          [:div.col-xs-12
+           [:h3 [:span.label.label-default (count (:items @local))] " items in collection..."]]]
+         [:div.row
+          (for [{:syms [?thumb ?xl]} (:items @local)]
+            [:div.col-xs-2
+             [:a.thumbnail {:href (str "/media/image/" ?xl)}
+              [:img {:src (str "/media/image/" ?thumb)}]]])]
+         ])))
+
 (defn load-collection
   [state local]
   (io/request
@@ -84,41 +127,26 @@
    :method  :get
    :edn?    true
    :success (fn [status body]
-              (let [coll (trio/as-model (:body body))
-                    thumbs (q/query {:select :* :from coll
-                                     :query [{:where '[[?img "dct:hasVersion" ?thumb]
-                                                       [?img "dct:hasVersion" ?xl]
-                                                       [?thumb "dct:references"
-                                                        "617e6192-d1a3-4422-b3cc-d7fcfb782de5"]
-                                                       [?xl "dct:references"
-                                                        "fd9e54e5-3700-4736-ba32-a1bae45cf0b3"]]}]})]
-                (dom/create-dom!
-                 [:div.row
-                  (for [{:syms [?thumb ?xl]} thumbs]
-                    [:div.col-xs-2
-                     [:a.thumbnail {:href (str "/media/image/" ?xl)}
-                      [:img {:src (str "/media/image/" ?thumb)}]]])]
-                 (:app-root config/app))
-                (async/publish (:bus @state) :load-coll-success coll)))
+              (let [graph (trio/as-model (:body body))
+                    title (-> graph (trio/select (:id @local) "dct:title" nil) (first) (peek))
+                    owner (-> graph (trio/select (:id @local) "dct:creator" nil) (first) (peek))
+                    items (q/query {:select :* :from graph
+                                    :query [{:where '[[?img "dct:hasVersion" ?thumb]
+                                                      [?img "dct:hasVersion" ?xl]
+                                                      [?thumb "dct:references"
+                                                       "617e6192-d1a3-4422-b3cc-d7fcfb782de5"]
+                                                      [?xl "dct:references"
+                                                       "fd9e54e5-3700-4736-ba32-a1bae45cf0b3"]]}]})]
+                (swap!
+                 local assoc
+                 :title title
+                 :owner owner
+                 :items items
+                 :graph graph)
+                (show-template state local)))
    :error   (fn [status body]
               (warn :error-response status body)
               (async/publish (:bus @state) :load-coll-fail (:body body)))))
-
-(defn show-template
-  [state local]
-  (->> (:app-root config/app)
-       (dom/clear!)
-       (dom/create-dom!
-        [:div
-         [:div#dropzone-wrapper.jumbotron
-          {:events [[:dragenter (fn [e] (dom/add-class! (dom/by-id "dropzone-wrapper") "dropzone-active"))]
-                    [:dragleave (fn [e] (dom/remove-class! (dom/by-id "dropzone-wrapper") "dropzone-active"))]
-                    [:drop (add-files state local)]]}
-          [:div#dropzone.container
-           [:h2#drop-msg.text-center "Drop media files here"]]]
-         [:button#bt-upload.btn.btn-primary.btn-lg
-          {:events [[:click (upload-files state local)]]}
-          "Upload media"]])))

 (defn init
   [bus]
@@ -133,6 +161,5 @@
     (go-loop []
       (let [[_ [state {:keys [id]}]] (<! init)]
         (swap! local assoc :id id :files {})
-        (show-template state local)
         (load-collection state local)
         (recur)))))


remove-trace-ns! -- :quiet ly init workspace

--- src/com/billpiel/mem_tracer/core.clj
+++ src/com/billpiel/mem_tracer/core.clj
@@ -39,9 +39,10 @@
                       ns-sym))

 (defn remove-trace-ns!
-"`ns-sym` is a symbol that references an existing namespace. Removes all
+  "`ns-sym` is a symbol that references an existing namespace. Removes all
   traces applied to the namespace."
-[ns-sym] (#'ws/remove-trace-ns! workspace ns-sym))
+  [ns-sym] (#'ws/remove-trace-ns! (init-workspace! :quiet)
+                                  ns-sym))

 (defn enable-all-traces!
 "Enables any disabled traces in active workspace."


Update summary tests.

Update summary tests.

--- test/blocks/summary_test.clj
+++ test/blocks/summary_test.clj
@@ -1,6 +1,6 @@
 (ns blocks.summary-test
   (:require
-    [blocks.core :as block]
+    [blocks.data :as data]
     [blocks.summary :as sum]
     [clojure.test :refer :all]))

@@ -13,9 +13,9 @@

 (deftest storage-summaries
-  (let [block-a (block/read! "foo")
-        block-b (block/read! "bar")
-        block-c (block/read! "baz")
+  (let [block-a (data/read-block :sha1 "foo")
+        block-b (data/read-block :sha1 "bar")
+        block-c (data/read-block :sha1 "baz")
         summary-a (sum/update (sum/init) block-a)
         summary-ab (sum/update summary-a block-b)
         summary-c (sum/update (sum/init) block-c)]


test more cases

test more cases

--- test/chat/test/server/db.clj
+++ test/chat/test/server/db.clj
@@ -113,6 +113,11 @@
                                        :thread-id (db/uuid)
                                        :created-at (java.util.Date.)
                                        :content "Hello?"})
+        message-1-b (db/create-message! {:id (db/uuid)
+                                         :user-id (user-1 :id)
+                                         :thread-id (db/uuid)
+                                         :created-at (java.util.Date.)
+                                         :content "Hello?"})
         message-2 (db/create-message! {:id (db/uuid)
                                        :user-id (user-1 :id)
                                        :thread-id (db/uuid)
@@ -124,4 +129,7 @@
       (is (contains? (set (db/get-open-threads-for-user (user-1 :id))) (message-2 :thread-id))))
     (testing "user can hide thread"
       (db/user-hide-thread! (user-1 :id) (message-1 :thread-id))
-      (is (not (contains? (set (db/get-open-threads-for-user (user-1 :id))) (message-1 :thread-id)))))))
+      (is (not (contains? (set (db/get-open-threads-for-user (user-1 :id))) (message-1 :thread-id)))))
+    (testing "user can hide thread"
+      (db/user-hide-thread! (user-1 :id) (message-2 :thread-id))
+      (is (not (contains? (set (db/get-open-threads-for-user (user-1 :id))) (message-2 :thread-id)))))))


WebServices.

WebServices.

--- from-repl.clj
+++ from-repl.clj
@@ -16,7 +16,11 @@
 (render-site "HTML/02_forms_controls_inputs")
 (render-site "HTML/03_templating_with_Jinja2")
 (render-site "HTML/05_styling_sites_with_Bootstrap")
+
 (render-site "React/01_introduction_to_React")
 (render-site "React/02_dynamic_sites_with_React")
 (render-site "React/03_grids_and_calculation_with_React")
+
 (render-site "AgileDevelopment/01_basic_testing")
+
+(render-site "WebServices/01_running_Flask")


parse port properly

parse port properly

--- env/dev/clj/sparky_elephants/repl.clj
+++ env/dev/clj/sparky_elephants/repl.clj
@@ -30,10 +30,18 @@
                                             {:dirs ["src/clj"]
                                              :additional-ns ['sparky-elephants.handler]}))

+(defn parse-port
+  [p]
+  (cond
+    (nil? p) nil
+    (integer? p) p
+    (string? p) (Integer/parseInt p)
+    :else (throw (ex-info (str "can't parse port: " p)) {:port p})))
+
 (defn start-server
   "used for starting the server in development mode from REPL"
   [& [port]]
-  (let [port (if port (Integer/parseInt port) 10000)]
+  (let [port (parse-port port)]
     (sparky-elephants.server/start-or-restart-server port {:handler (reload-handler)})
     (println (str "You can view the site at http://localhost:" port))))


remove redundant vagrant functionality (now in connections/vagrant.clj)

--- test/matross/test/helper.clj
+++ test/matross/test/helper.clj
@@ -1,8 +1,6 @@
 (ns matross.test.helper
   "Helper functions for writing and running tests"
-  (:require [me.raynes.conch :refer [with-programs]]
-            [matross.connections.core :refer [get-connection]]
-            [matross.connections.ssh :refer [ssh-config-connection]]))
+  (:require [me.raynes.conch :refer [with-programs]]))

 (defn get-running-vms []
   (with-programs [vagrant grep cut]
@@ -11,8 +9,3 @@
         (vagrant "status" {:seq true})
         {:seq true})
       {:seq true})))
-
-(defn get-vagrant-connection [box-name]
-  (with-programs [vagrant]
-    (let [config (vagrant "ssh-config" box-name)]
-      (-> config ssh-config-connection get-connection))))


Checks in parse-int: multiple zero values (negative one etc.)

--- test/clouseau/test_utils.clj
+++ test/clouseau/test_utils.clj
@@ -392,3 +392,34 @@
         false (parse-boolean "unknown")
         false (parse-boolean nil)))

+(deftest test-parse-int-zero
+    "Check the behaviour of function emender-jenkins.config/parse-int."
+    (are [x y] (== x y)
+        0 (parse-int "0")
+        0 (parse-int "00")
+        0 (parse-int "000")
+        0 (parse-int "-0")
+        0 (parse-int "-00")
+        0 (parse-int "-000")))
+
+(deftest test-parse-int-positive-int
+    "Check the behaviour of function emender-jenkins.config/parse-int."
+    (are [x y] (== x y)
+        1          (parse-int "1")
+        2          (parse-int "2")
+        42         (parse-int "42")
+        65535      (parse-int "65535")
+        65536      (parse-int "65536")
+        2147483646 (parse-int "2147483646")))
+
+(deftest test-parse-int-negative-int
+    "Check the behaviour of function emender-jenkins.config/parse-int."
+    (are [x y] (== x y)
+        -1          (parse-int "-1")
+        -2          (parse-int "-2")
+        -42         (parse-int "-42")
+        -65535      (parse-int "-65535")
+        -65536      (parse-int "-65536")
+        -2147483647 (parse-int "-2147483647")))
+
+


Remove hack around old CLJ bug

Remove hack around old CLJ bug

--- test/expound/alpha_test.cljc
+++ test/expound/alpha_test.cljc
@@ -3079,7 +3079,6 @@
 Detected 1 error
 "
            (binding [s/*explain-out* expound/printer]
-             ;; warning will persist until https://dev.clojure.org/jira/browse/CLJS-2980 is fixed
              (expound/explain-result-str (st/check-fn `results-str-fn1 (s/spec `results-str-fn2)))))))
   #?(:clj (testing "custom printer"
             (is (= "== Checked expound.alpha-test/results-str-fn4
@@ -3520,60 +3519,57 @@
           ;; FIXME - this is a useful test but not 100% reliable yet
           ;; so I'm disabling to get this PR in
           #_(binding [s/*recursion-limit* 2]
-              (checking
-               "expound returns string"
-               5 ;; Hard-code at 5, since generating specs explodes in size quite quickly
-               [spec-defs (s/gen ::spec-defs)
-                pred-specs (gen/vector (s/gen ::pred-spec) 5)
-                seed (s/gen pos-int?)
-                mutate-path (gen/vector gen/pos-int)]
-               (try
-                 (doseq [[spec-name spec] (map vector (missing-specs spec-defs) (cycle pred-specs))]
-                   (eval `(s/def ~spec-name ~spec)))
-                 (doseq [spec-def spec-defs]
-                   (eval spec-def))
-
-                 (let [spec (second (last spec-defs))
-                       form (last (last spec-defs))
-                       disallowed #{;; because of https://dev.clojure.org/jira/browse/CLJ-2152
-                                    ;; we can't accurately analyze forms under an '&' spec
-                                    "clojure.spec.alpha/&"
-                                    "clojure.spec.alpha/fspec"
-                                    "clojure.spec.alpha/multi-spec"
-                                    "clojure.spec.alpha/with-gen"}]
-                   (when-not (or (some
-                                  disallowed
-                                  (map str (tree-seq coll? identity form)))
-                                 (some
-                                  disallowed
-                                  (->> spec
-                                       inline-specs
-                                       (tree-seq coll? identity)
-                                       (map str))))
-                     (let [valid-form (first (sample-seq (s/gen spec) seed))
-                           invalid-form (mutate valid-form mutate-path)]
-                       (try
-                         (is (string?
-                              (expound/expound-str spec invalid-form)))
-                         (is (not
+            (checking
+             "expound returns string"
+             5 ;; Hard-code at 5, since generating specs explodes in size quite quickly
+             [spec-defs (s/gen ::spec-defs)
+              pred-specs (gen/vector (s/gen ::pred-spec) 5)
+              seed (s/gen pos-int?)
+              mutate-path (gen/vector gen/pos-int)]
+             (try
+               (doseq [[spec-name spec] (map vector (missing-specs spec-defs) (cycle pred-specs))]
+                 (eval `(s/def ~spec-name ~spec)))
+               (doseq [spec-def spec-defs]
+                 (eval spec-def))
+
+               (let [spec (second (last spec-defs))
+                     form (last (last spec-defs))
+                     disallowed #{"clojure.spec.alpha/fspec"
+                                  "clojure.spec.alpha/multi-spec"
+                                  "clojure.spec.alpha/with-gen"}]
+                 (when-not (or (some
+                                disallowed
+                                (map str (tree-seq coll? identity form)))
+                               (some
+                                disallowed
+                                (->> spec
+                                     inline-specs
+                                     (tree-seq coll? identity)
+                                     (map str))))
+                   (let [valid-form (first (sample-seq (s/gen spec) seed))
+                         invalid-form (mutate valid-form mutate-path)]
+                     (try
+                       (is (string?
+                            (expound/expound-str spec invalid-form)))
+                       (is (not
+                            (string/includes?
+                             (expound/expound-str (second (last spec-defs)) invalid-form)
+                             "should contain keys")))
+                       (catch Exception e
+                         (is (or
                               (string/includes?
-                               (expound/expound-str (second (last spec-defs)) invalid-form)
-                               "should contain keys")))
-                         (catch Exception e
-                           (is (or
-                                (string/includes?
-                                 (:cause (Throwable->map e))
-                                 "Method code too large!")
-                                (string/includes?
-                                 (:cause (Throwable->map e))
-                                 "Cannot convert path."))))))))
-                 (finally
+                               (:cause (Throwable->map e))
+                               "Method code too large!")
+                              (string/includes?
+                               (:cause (Throwable->map e))
+                               "Cannot convert path."))))))))
+               (finally
                  ;; Get access to private atom in clojure.spec
-                   (def spec-reg (deref #'s/registry-ref))
-                   (doseq [k (filter
-                              (fn [k] (= "expound-generated-spec" (namespace k)))
-                              (keys (s/registry)))]
-                     (swap! spec-reg dissoc k))))))))
+                 (def spec-reg (deref #'s/registry-ref))
+                 (doseq [k (filter
+                            (fn [k] (= "expound-generated-spec" (namespace k)))
+                            (keys (s/registry)))]
+                   (swap! spec-reg dissoc k))))))))

 (deftest clean-registry
   (testing "only base spec remains"


wait for text test added

wait for text test added

--- test/webdriver/core_test.clj
+++ test/webdriver/core_test.clj
@@ -198,10 +198,40 @@
     (wait-running :message "The server did not start.")
     (with-session {} {}
       (go-url url)
+
       (testing "wait for text simple"
+        (refresh)
         (with-xpath
           (click "//button[@id='wait-button']"))
         (wait-has-text "-secret-")
-        (is 1)
-)
-)))
+        (is true "text found"))
+
+      (testing "wait for text timeout"
+        (refresh)
+        (with-xpath
+          (click "//button[@id='wait-button']"))
+        (try+
+         (wait-has-text "-secret-" :timeout 1 :message "No -secret- text on the page.")
+         (is false "should not be executed")
+         (catch [:type :webdriver/timeout] data
+           (is (= (-> data (dissoc :predicate))
+                  {:type :webdriver/timeout
+                   :message "No -secret- text on the page."
+                   :timeout 1
+                   :poll 0.5
+                   :times 3}))
+           (is true "exception was caught"))))
+
+      (testing "wait non-existing text"
+        (refresh)
+        (try+
+         (wait-has-text "whatever-foo-bar-")
+         (is false "should not be executed")
+         (catch [:type :webdriver/timeout] data
+           (is (= (-> data (dissoc :predicate))
+                  {:type :webdriver/timeout
+                   :message nil
+                   :timeout 10
+                   :poll 0.5
+                   :times 21}))
+           (is true "exception was caught")))))))


Update helper comment

Update helper comment

--- src/leiningen/new/devcards/core.cljs
+++ src/leiningen/new/devcards/core.cljs
@@ -20,5 +20,5 @@
 (main)

 ;; remember to run lein figwheel and then browse to
-;; http://localhost:3449/devcards.html
+;; http://localhost:3449/cards.html


Make number of partitions in test configurable

--- test/onyx/plugin/input_test.clj
+++ test/onyx/plugin/input_test.clj
@@ -23,6 +23,7 @@
             [onyx.api])
   (:import [franzy.clients.producer.types ProducerRecord]))

+(def n-partitions 8)
 (defn build-job [zk-address topic batch-size batch-timeout]
   (let [batch-settings {:onyx/batch-size batch-size :onyx/batch-timeout batch-timeout}
         base-job (merge {:workflow [[:read-messages :identity]
@@ -44,8 +45,8 @@
                                     :kafka/offset-reset :earliest
                                     :kafka/force-reset? true
                                     :kafka/deserializer-fn :onyx.tasks.kafka/deserialize-message-edn
-                                    :onyx/min-peers 2
-                                    :onyx/max-peers 2}
+                                    :onyx/min-peers n-partitions
+                                    :onyx/max-peers n-partitions}
                                    batch-settings)))
         (add-task (core-async/output :out batch-settings)))))

@@ -62,7 +63,7 @@
                                           :controlled.shutdown.enable false}))

         zk-utils (k-admin/make-zk-utils {:servers [zookeeper]} false)
-        _ (k-topics/create-topic! zk-utils topic 2)
+        _ (k-topics/create-topic! zk-utils topic n-partitions)

         producer-config {:bootstrap.servers ["127.0.0.1:9092"]}
         key-serializer (byte-array-serializer)
@@ -88,7 +89,7 @@
         {:keys [out read-messages]} (get-core-async-channels job)
         mock (atom {})]
     (try
-      (with-test-env [test-env [4 env-config peer-config]]
+      (with-test-env [test-env [(+ n-partitions 2) env-config peer-config]]
         (onyx.test-helper/validate-enough-peers! test-env job)
         (reset! mock (mock-kafka test-topic zk-address))
         (onyx.api/submit-job peer-config job)


rename parsed project metadata

rename parsed project metadata

--- src-cljs/cljsbuild_ui/core.cljs
+++ src-cljs/cljsbuild_ui/core.cljs
@@ -27,9 +27,9 @@
         cljsbuild (extract-options project)]
     (assoc project
            :cljsbuild cljsbuild
-           :project-filename filename
-           :project-name (name (nth prj1 1))
-           :project-version (nth prj1 2))))
+           :filename filename
+           :name (name (nth prj1 1))
+           :version (nth prj1 2))))

 ;; TODO:
 ;; - Need to handle files listed in projects.json that no longer exist on disk


Add Project SSH Key API Path Util

Add Project SSH Key API Path Util

--- src-cljs/frontend/api/path.cljs
+++ src-cljs/frontend/api/path.cljs
@@ -28,6 +28,15 @@
                "/api/v1/project/%s/checkout-key/%s"
                repo-name fingerprint)))

+(defn project-ssh-key  [vcs-type repo-name]
+  (case vcs-type
+    "bitbucket" (gstring/format
+                  "/api/dangerzone/project/%s/%s/ssh-key"
+                  vcs-type repo-name)
+    "github" (gstring/format
+               "/api/v1/project/%s/ssh-key"
+               repo-name)))
+
 (defn project-plan [vcs-type org repo]
   (case vcs-type
     "bitbucket" (gstring/format


CLJS: resolve-symbol throws unimplemented

--- src/main/cljs/cljs/tools/reader.cljs
+++ src/main/cljs/cljs/tools/reader.cljs
@@ -696,15 +696,7 @@
 (defn ^:dynamic resolve-symbol
   "Resolve a symbol s into its fully qualified namespace version"
   [s]
-  (if (pos? (.indexOf (name s) "."))
-    s ;; If there is a period, it is interop
-    (if-let [ns-str (namespace s)]
-      (if-let [ns (resolve-ns (symbol ns-str))]
-        (symbol (ns-name* ns) (name s))
-        s)
-      (if-let [o (get (ns-map *ns*) s)]
-        (.-sym o)
-        (symbol (ns-name* *ns*) (name s))))))
+  (throw (ex-info "resolve-symbol is not implemented" {:sym s})))

 (defn- syntax-quote* [form]
   (->>


:bug: Disable email sending by default.

:bug: Disable email sending by default.

--- backend/src/uxbox/config.clj
+++ backend/src/uxbox/config.clj
@@ -53,7 +53,7 @@
    :smtp-password (lookup-env env :uxbox-smtp-password nil)
    :smtp-tls (lookup-env env :uxbox-smtp-tls false)
    :smtp-ssl (lookup-env env :uxbox-smtp-ssl false)
-   :smtp-enabled (lookup-env env :uxbox-smtp-enabled true)
+   :smtp-enabled (lookup-env env :uxbox-smtp-enabled false)

    :registration-enabled (lookup-env env :uxbox-registration-enabled true)
    :secret (lookup-env env :uxbox-secret "5qjiAndGY3")})


two more tests

two more tests

--- pedestal-app/test/semtag_web/integration_test.clj
+++ pedestal-app/test/semtag_web/integration_test.clj
@@ -3,6 +3,7 @@
             [clj-webdriver.driver :refer [init-driver]]
             [clj-webdriver.core :as core]
             [clj-webdriver.taxi :as taxi]
+            [semtag-web.route :as route]
             [clojure.string :as string])
   (:import [org.openqa.selenium.phantomjs PhantomJSDriver]
            [org.openqa.selenium.remote DesiredCapabilities]))
@@ -41,6 +42,9 @@
 (defn app-url [& args]
   (apply str "/semtag-web-test.html" args))

+(defn full-app-url [& args]
+  (str "out/public" (apply app-url args)))
+
 (defn click [text]
   (core/click (taxi/find-element {:tag :a :text text}))
   (Thread/sleep 500))
@@ -48,16 +52,7 @@
 (defn url-ends-with [& args]
   (is (.endsWith (taxi/current-url) (apply app-url args))))

-;; TODO - revisit not being able to go forward - log count stays the same going forward
-#_(deftest history-works
-  (click "Tag Stats")
-  (is (.endsWith (taxi/current-url) "/semtag-web-test.html#/tag-stats"))
-  (back)
-  (is (.endsWith (taxi/current-url) "/semtag-web-test.html#/"))
-  (forward))
-
-(deftest urls-get-updated-correctly
-  (is (.endsWith (taxi/current-url) (app-url)))
+(deftest navbar-links-work
   (url-ends-with "")
   (click "Tag Stats")
   (url-ends-with "#/tag-stats")
@@ -71,13 +66,42 @@
   (click "Home")
   (url-ends-with "#/"))

-(deftest search-submit-works
+(deftest regular-search-works
   (taxi/input-text "#url_search_text" "feynman")
   (taxi/click "#url_search_button")
   (Thread/sleep 1000)

   (url-ends-with "#/search?query=feynman&search-type=tagged")
-  (is (= "Search results for 'feynman'" (taxi/text "#search_title"))))
+  (is (= "Search results for 'feynman'" (taxi/text "#search_title")))
+  (is (.contains (taxi/text "#table_stats") "Tag Type Counts: 1 - 1 funny"))
+  (is (seq (taxi/find-elements {:css "tbody tr"}))))
+
+(deftest second-search-with-another-search-type-works
+  (taxi/input-text "#url_search_text" "feynman")
+  (taxi/click "#url_search_button")
+  (Thread/sleep 1000)
+  (url-ends-with "#/search?query=feynman&search-type=tagged")
+
+  (taxi/clear "#url_search_text")
+  (taxi/input-text "#url_search_text" "maxwell")
+  (taxi/select
+    (taxi/element "input[name='search_type'][value='tagged-with-type']"))
+  (taxi/click "#url_search_button")
+  (Thread/sleep 1000)
+  (url-ends-with "#/search?query=maxwell&search-type=tagged-with-type"))
+
+(deftest direct-urls-work
+  (doseq [rel-url (vals route/routes)]
+    (taxi/to (full-app-url rel-url))
+    (url-ends-with rel-url)))
+
+;; TODO - revisit not being able to go forward - log count stays the same going forward
+#_(deftest history-works
+  (click "Tag Stats")
+  (is (.endsWith (taxi/current-url) "/semtag-web-test.html#/tag-stats"))
+  (back)
+  (is (.endsWith (taxi/current-url) "/semtag-web-test.html#/"))
+  (forward))

 (comment
   (taxi/take-screenshot :file "out.png")


Refactor request creation out of submit-request

--- src/uruk/core.clj
+++ src/uruk/core.clj
@@ -313,6 +313,24 @@
    ;; default:
    nil ValueType/XS_STRING})

+(defn- request-obj
+  "Build a Request object using the given `request-factory` builder,
+  request `options`, and bindings for XQuery external `variables`."
+  [request-factory options variables]
+  (reduce-kv (fn [acc vname vval]
+               (if (string? vval)
+                 (.setNewVariable acc (name vname)
+                                  ValueType/XS_STRING vval)
+                 (let [{:keys [namespace type value]} vval]
+                   (if (string? namespace)
+                     (.setNewVariable acc (name vname) namespace
+                                      (variable-types type) value)
+                     (.setNewVariable acc (name vname)
+                                      (variable-types type) value))))
+               acc)
+             (doto request-factory (.setOptions (request-options options)))
+             variables))
+
 (defn submit-request
   "Construct, submit, and return raw results of request for the given
   `session` using `request-factory` and `query`. Modify it
@@ -322,26 +340,13 @@
   to maps describing the variable using mandatory key `:value` and
   optional keys `:namespace` and `:type`.`"
   [request-factory session query options variables types]
-  (let [ro      (request-options options)
-        request (reduce-kv (fn [acc vname vval]
-                             (if (string? vval)
-                               (.setNewVariable acc (name vname)
-                                                ValueType/XS_STRING vval)
-                               (let [{:keys [namespace type value]} vval]
-                                 (if (string? namespace)
-                                   (.setNewVariable acc (name vname) namespace
-                                                    (variable-types type) value)
-                                   (.setNewVariable acc (name vname)
-                                                    (variable-types type) value))))
-                             acc)
-                           (doto request-factory (.setOptions ro))
-                           variables)]
-    (let [req (sling/try+ (.submitRequest session request)
-                          (catch Exception e ;; XXX specifically XQueryException?
-                            (sling/throw+ (doto (Exception. (.toString e))
-                                            (.setStackTrace (:stack-trace &throw-context))))))]
-      (cond (= :raw types) req
-            :else          (convert-types req types)))))
+  (let [req (sling/try+ (.submitRequest session
+                                        (request-obj request-factory options variables))
+                        (catch Exception e ;; XXX specifically XQueryException?
+                          (sling/throw+ (doto (Exception. (.toString e))
+                                          (.setStackTrace (:stack-trace &throw-context))))))]
+    (cond (= :raw types) req
+          :else          (convert-types req types))))

 (defn execute-xquery
   "Execute the given xquery query as a request to the database


RS & CC | #64 | Use translator function in sign_up.clj template

--- src/objective8/templates/sign_up.clj
+++ src/objective8/templates/sign_up.clj
@@ -7,7 +7,8 @@
 (def sign-up-template (html/html-resource "templates/jade/sign-up.html" {:parser jsoup/parser}))

 (defn sign-up-page [{:keys [translations data doc] :as context}]
-  (let [objective (:objective data)]
+  (let [objective (:objective data)
+        tl8 (f/translator context)]
     (apply str
            (html/emit*
              (html/at sign-up-template
@@ -16,12 +17,12 @@
                       [:.clj-masthead-signed-out] (html/substitute (f/masthead context))
                       [:.clj-status-bar] (html/substitute (f/status-flash-bar context))

-                      [:.l8n-sign-up-title] (html/content (translations :sign-up/page-title))
-                      [:.l8n-sign-up-description] (html/content (translations :sign-up/welcome))
+                      [:.l8n-sign-up-title] (tl8 :sign-up/page-title)
+                      [:.l8n-sign-up-description] (tl8 :sign-up/welcome)

                       [:.clj-sign-up-form] (html/prepend (html/html-snippet (anti-forgery-field)))
-                      [:.l8n-label-username] (html/content (translations :sign-up/username-label))
+                      [:.l8n-label-username] (tl8 :sign-up/username-label)
                       [:.clj-username-error] (if-let [error-type (get-in doc [:errors :username])]
-                                               (html/content (translations (keyword "sign-up" (name error-type)))))
-                      [:.l8n-label-email-address] (html/content (translations :sign-up/email-label))
-                      [:.l8n-sign-up] (html/content (translations :sign-up/button)))))))
+                                               (tl8 (keyword "sign-up" (name error-type))))
+                      [:.l8n-label-email-address] (tl8 :sign-up/email-label)
+                      [:.l8n-sign-up] (tl8 :sign-up/button))))))


OK, changing approach. Now to seq...or not to seq... that is the question

--- src/adventofcode/solutions.clj
+++ src/adventofcode/solutions.clj
@@ -6,6 +6,8 @@

 (defn day-x-input [x] (str "adventofcode/day" x "-input"))
+;(defn day-x-input [x] (str "adventofcode/day" x "-input-test"))
+;(defn day-x-input [x] (str "adventofcode/temp.txt"))
 (defn slurp-day-input [x] (slurp (io/file (io/resource (day-x-input x)))))
 (defn day-input-line-seq [x] (line-seq (io/reader (io/resource (day-x-input x)))))

@@ -204,3 +206,22 @@

 ;for part 2 just place value retrieved for wire a to wire b in input for day 7:)

+(def filters [#"(?<dblslsh>\\\\)"
+              #"(?<ascii>\\x[0-9a-f]{2})"
+              #"(?<sinq>\\\")"])
+
+(defn day8 []
+  (let [input (day-input-line-seq 8)]
+    (reduce
+      (fn [acc line]
+        (let [cnt (count line)
+              content (.substring line 1 (dec cnt))
+              [last-s memc] (reduce #(let [prev (first %)
+                                           mc (count (re-seq %2 prev))
+                                           altered (st/replace prev %2 "#")]
+                                      [altered (+ (second %) mc)]) [content 0] filters)
+              diff (- cnt (count last-s))]
+          (println last-s)
+          (+ acc diff)))
+      0
+      input)))


(SERVER-1741) Generalize regex for content-type tests

--- test/integration/puppetlabs/puppetserver/error_handling_int_test.clj
+++ test/integration/puppetlabs/puppetserver/error_handling_int_test.clj
@@ -47,7 +47,7 @@
               (is (= 500 (:status response)))
               (is (= "Internal Server Error: java.lang.Exception: barf"
                      (:body response)))
-              (is (re-matches #"text/plain; charset=.*"
+              (is (re-matches #"text/plain;\s*charset=.*"
                               (get-in response [:headers "content-type"]))))))
         (testing "the CA API - in particular, one of the endpoints implemented via liberator"
           ;; Yes, this is weird - see comment above.
@@ -56,7 +56,7 @@
               (is (= 500 (:status response)))
               (is (= "Internal Server Error: java.lang.NullPointerException"
                      (:body response)))
-              (is (re-matches #"text/plain; charset=.*"
+              (is (re-matches #"text/plain;\s*charset=.*"
                               (get-in response [:headers "content-type"]))))))))))

 (deftest ^:integration test-invalid-code-id-error


Turn on peer group logging. Formatting.

Turn on peer group logging. Formatting.

--- src/onyx/peer/peer_group_manager.clj
+++ src/onyx/peer/peer_group_manager.clj
@@ -53,7 +53,8 @@

 (defmulti action
   (fn [state [type arg]]
-    (debug "ACTION:" (str (:id (:group-state state))) type arg)
+    (when-not (= type :monitor)
+      (info "Peer Group Action:" (str (:id (:group-state state))) type arg))
     type))

 ;; ONLY FOR USE IN TESTING
@@ -294,36 +295,37 @@
    [type]]
   (let [entry (first inbox-entries)]
     (if (instance? java.lang.Throwable entry)
-    (action state [:restart-peer-group])
-    (try
-     (let [_ (update-scheduler-lag! state)
-           new-replica (extensions/apply-log-entry entry (assoc replica :version (:message-id entry)))
-           diff (extensions/replica-diff entry replica new-replica)
-           tgroup (transition-group entry replica new-replica diff group-state)
-           tpeers (transition-peers (:log comm) entry replica new-replica diff peer-config vpeers)
-           reactions (into (:reactions tgroup) (:reactions tpeers))]
-       (when-let [deallocated (first (clojure.data/diff (:allocation-version replica)
-                                                        (:allocation-version new-replica)))]
-         (>!! (:ch state-store-group) [:drop-job-dbs deallocated]))
-       (update query-server :replica reset! new-replica)
-       (update messenger-group :replica reset! new-replica)
-       (let [next-state (as-> state st
-                          (update st :inbox-entries (comp vec rest))
-                          (reduce (fn [s r] (action s [:send-to-outbox r])) st reactions)
-                          (assoc st :group-state (:group-state tgroup))
-                          (assoc st :vpeers (:vpeers tpeers))
-                          (assoc st :replica new-replica))]
-         (set-peer-group-allocation-proportion! (peers-allocated-proportion next-state))
-         next-state))
-     (catch Exception e
-       ;; Stateful things happen in the transitions.
-       ;; Need to reboot entire peer group.
-       ;; Future work should eliminate uncertainty here e.g. use of log in transition-peers
-       (error e (format "Error applying log entry: %s to %s. Rebooting peer-group %s."
-                        entry
-                        replica
-                        (:id group-state)))
-       (action state [:restart-peer-group (:id group-state)]))))))
+      ;; log reading failed, restart.
+      (action state [:restart-peer-group])
+      (try
+       (let [_ (update-scheduler-lag! state)
+             new-replica (extensions/apply-log-entry entry (assoc replica :version (:message-id entry)))
+             diff (extensions/replica-diff entry replica new-replica)
+             tgroup (transition-group entry replica new-replica diff group-state)
+             tpeers (transition-peers (:log comm) entry replica new-replica diff peer-config vpeers)
+             reactions (into (:reactions tgroup) (:reactions tpeers))]
+         (when-let [deallocated (first (clojure.data/diff (:allocation-version replica)
+                                                          (:allocation-version new-replica)))]
+           (>!! (:ch state-store-group) [:drop-job-dbs deallocated]))
+         (update query-server :replica reset! new-replica)
+         (update messenger-group :replica reset! new-replica)
+         (let [next-state (as-> state st
+                            (update st :inbox-entries (comp vec rest))
+                            (reduce (fn [s r] (action s [:send-to-outbox r])) st reactions)
+                            (assoc st :group-state (:group-state tgroup))
+                            (assoc st :vpeers (:vpeers tpeers))
+                            (assoc st :replica new-replica))]
+           (set-peer-group-allocation-proportion! (peers-allocated-proportion next-state))
+           next-state))
+       (catch Exception e
+         ;; Stateful things happen in the transitions.
+         ;; Need to reboot entire peer group.
+         ;; Future work should eliminate uncertainty here e.g. use of log in transition-peers
+         (error e (format "Error applying log entry: %s to %s. Rebooting peer-group %s."
+                          entry
+                          replica
+                          (:id group-state)))
+         (action state [:restart-peer-group (:id group-state)]))))))

 (def idle-backoff-ms 10)


Inline run-row-collection, used in one place

--- src-cljs/frontend/components/pages/workflow.cljs
+++ src-cljs/frontend/components/pages/workflow.cljs
@@ -194,12 +194,6 @@

 (def run-row (om-next/factory RunRow {:keyfn :run/id}))

-(defn run-row-collection [runs]
-  (html
-   [:div
-    (card/collection
-     (map #(when % (run-row %)) runs))]))
-
 (defn a-or-span [flag href & children]
   (if flag
     [:a {:href href} children]
@@ -221,7 +215,8 @@
           (html
            [:div
             [:.page-info "Showing " [:span.run-numbers (inc offset) "–" (+ offset (count edges))]]
-            (run-row-collection (map :edge/node edges))
+            (card/collection
+             (map #(when % (run-row (:edge/node %))) edges))
             [:.list-pager
              (a-or-span (pos? offset)
                         prev-page-href


working on english generation

working on english generation

--- src/babel/english/grammar.cljc
+++ src/babel/english/grammar.cljc
@@ -566,16 +566,17 @@
 (defn model-with-vocab-items [vocab-items filter-lexicon-fn model]
   (let [input-lexicon (transform-with-english-lexical-rules
                        (reduce merge (map vocab-entry-to-lexeme vocab-items)))
+        lexicon (merge-with concat
+                            input-lexicon
+                            (filtered-lexicon
+                             (:lexicon model)
+                             filter-lexicon-fn))
+        indices (create-indices lexicon index-lexicon-on-paths)
         model (merge model
-                     {:lexicon
-                      (merge-with concat
-                                  input-lexicon
-                                  (filtered-lexicon
-                                   (:lexicon model)
-                                   filter-lexicon-fn))})]
+                     {:lexicon lexicon})]
     (merge model
-           {:generate-fn (fn [spec]
-                           (generate/generate spec model))})))
-
-
-
+           {:index-fn (fn [spec] (lookup-spec spec indices index-lexicon-on-paths))})))
+
+
+
+


fix "prepare": reflexive verbs should share :agr between both arguments to the verb

--- src/babel/english/lexicon.cljc
+++ src/babel/english/lexicon.cljc
@@ -1336,14 +1336,18 @@
                            :obj {:human false
                                  :music true}}}}]

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


+begin(modal)

+begin(modal)

--- src/babel/english/lexicon.cljc
+++ src/babel/english/lexicon.cljc
@@ -329,10 +329,16 @@
                        :subcat {:2 '()}}
               :english {:past "became"}}]

-   "begin" {:synsem {:cat :verb
-                     :sem {:pred :begin}}
-            :english {:past "began"
-                      :participle "beginning"}}
+   "begin" [{:synsem {:cat :verb
+                      :sem {:pred :begin}
+                      :subcat {:2 '()}}
+             :english {:past "began"
+                       :participle "beginning"}}
+            {:modal-with :infinitive
+             :synsem {:cat :verb
+                      :sem {:pred :begin}}
+             :english {:past "began"
+                       :participle "beginning"}}]

    "believe" (let [common {:synsem {:cat :verb
                                     :subcat {:1 {:cat :noun
@@ -789,18 +795,20 @@

    "go downstairs"
    {:synsem {:cat :verb
-              :sem {:activity true
-                    :discrete false
-                    :pred :go-downstairs}}
+             :sem {:activity true
+                   :discrete false
+                   :pred :go-downstairs}
+             :subcat {:2 '()}}
     :english {:past "went downstairs"
               :participle "going downstairs"
               :present {:3sing "goes downstairs"}}}

    "go out"
    {:synsem {:cat :verb
-              :sem {:activity true
-                    :discrete false
-                    :pred :go-out}}
+             :sem {:activity true
+                   :discrete false
+                   :pred :go-out}
+             :subcat {:2 '()}}
     :english {:past "went out"
               :participle "going out"
               :present {:3sing "goes out"}}}
@@ -809,7 +817,8 @@
    {:synsem {:cat :verb
              :sem {:activity true
                    :discrete false
-                   :pred :go-upstairs}}
+                   :pred :go-upstairs}
+             :subcat {:2 '()}}
     :english {:past "went upstairs"
               :participle "going upstairs"
               :present {:3sing "goes upstairs"}}}
@@ -1620,6 +1629,7 @@
    "set" {:synsem {:cat :verb
                    :sem {:pred :set}}
           :english {:past {:english "set"
+                           :participle "setting"
                            :note "past tense"}}}

    "share" {:synsem {:cat :verb
@@ -1922,6 +1932,13 @@
                          :participle "transferring"}
                :synsem {:cat :verb
                         :sem {:pred :transfer}}}
+
+   "try" [{:modal-with :infinitive
+           :synsem {:cat :verb
+                    :sem {:pred :try}}}
+          {:synsem {:cat :verb
+                    :sem {:pred :try}
+                    :subcat {:2 '()}}}]

    "understand" (let [common {:english {:past "understood"}}]
                   [(unify
@@ -1959,16 +1976,6 @@

    "walk" {:synsem {:cat :verb
                 :sem {:pred :walk}}}
-
-   "try" (let [modal-subject (atom {:cat :noun})]
-            {:synsem {:cat :verb
-                      :sem {:pred :try}
-                      :subcat {:1 modal-subject
-                               :2 {:cat :verb
-                                   :infl :infinitive
-                                   :subcat {:1 modal-subject
-                                            :2 '()}}
-                               :3 '()}}})

    "want" [{:modal-with :infinitive
             :synsem {:cat :verb


disable some lexemes

disable some lexemes

--- src/babel/francais/lexicon.clj
+++ src/babel/francais/lexicon.clj
@@ -165,6 +165,7 @@
    "dire"
    (let [shared-part-of-dire
          {:synsem {:cat :verb}
+          :disable true
           :français {:français "dire"
                      :passato "dit"
                      :future-stem "dir"
@@ -289,17 +290,18 @@

    "faire"
       (let [shared-part-of-faire
-              {:synsem {:cat :verb}
-               :français {:français "faire"
-                          :drop-e false
-                          :passato "fait"
-                          :future-stem "fer"
-                          :present {:1sing "fais"
-                                    :2sing "fais"
-                                    :3sing "fait"
-                                    :1plur "faisons"
-                                    :2plur "faites"
-                                    :3plur "font"}}}]
+            {:synsem {:cat :verb}
+             :disable true
+             :français {:français "faire"
+                        :drop-e false
+                        :passato "fait"
+                        :future-stem "fer"
+                        :present {:1sing "fais"
+                                  :2sing "fais"
+                                  :3sing "fait"
+                                  :1plur "faisons"
+                                  :2plur "faites"
+                                  :3plur "font"}}}]

      [(merge shared-part-of-faire
              {:synsem {:pred :do}})
@@ -463,7 +465,8 @@

   "pouvoir"
    (let [shared-part-of-pouvoir
-         {:synsem {:essere false
+         {:disable true
+          :synsem {:essere false
                    :cat :verb}
           :français {:futuro-stem "pourr"
                      :drop-e true


backward-compatible `ns` notation

backward-compatible `ns` notation

--- src/midje/emission/plugins/default_failure_lines.clj
+++ src/midje/emission/plugins/default_failure_lines.clj
@@ -1,9 +1,10 @@
 (ns ^{:doc "How the default emitter reports on failures"}
   midje.emission.plugins.default-failure-lines
   (:use midje.clojure.core
-        midje.emission.plugins.util)
-  (:require [midje.util.ecosystem :as ecosystem]
-            [com.georgejahad.difform :refer [difform]]))
+        midje.emission.plugins.util
+        [com.georgejahad.difform :only [difform]])
+  (:require [midje.util.ecosystem :as ecosystem]))
+

 (defmulti messy-lines :type)


make manage-filesytem* handle a currently running synchronization

don't restart it immediately if has been already running and then
finished. rather wait for the configured sleep-between-sync value.

--- src/brainbot/nozzle/manage.clj
+++ src/brainbot/nozzle/manage.clj
@@ -90,11 +90,12 @@
   (let [qname (rk/routing-key-string {:id id :filesystem fsid :command "*"})
         get-num-messages* #(get-num-messages (:vhost rmq-settings) id fsid)
         wait-idle #(wait-for-zero-messages get-num-messages*)]
-    (logging/debug "waiting for" qname "to become idle")
-    (wait-idle)
     (while true
-      (logging/info "starting synchronization of" qname)
-      (start-synchronization rmq-settings id fsid)
+      (if (zero? (get-num-messages*))
+        (do
+          (logging/info "starting synchronization of" qname)
+          (start-synchronization rmq-settings id fsid))
+        (logging/info "synchronization of" qname "already running"))
       (Thread/sleep 10000)
       (wait-idle)
       (logging/info "synchronization of" qname "finished. restarting in" sleep-between-sync "seconds")


(SERVER-882) Remove stray 'or' from valid-static-file-path?

--- src/clj/puppetlabs/services/master/master_core.clj
+++ src/clj/puppetlabs/services/master/master_core.clj
@@ -315,12 +315,11 @@
   The access here is designed to mimic Puppet's file_content endpoint."
   [path :- schema/Str]
   (when-let [canonicalized-path (-> path URIUtil/decodePath URIUtil/canonicalPath)]
-    (or
      ;; Here, keywords represent a single element in the path. Anything between two '/' counts.
      ;; The second vector takes anything else that might be on the end of the path.
      ;; Below, this corresponds to 'modules/*/files/**' in a filesystem glob.
      (bidi.bidi/match-route [["modules/" :module-name "/files/" [#".*" :rest]] :_]
-                            canonicalized-path))))
+                            canonicalized-path)))

 (defn static-file-content-request-handler
   "Returns a function which is the main request handler for the


(SERVER-876) Move catalog request handler into let block for clarity

--- src/clj/puppetlabs/services/master/master_core.clj
+++ src/clj/puppetlabs/services/master/master_core.clj
@@ -22,40 +22,39 @@
    endpoints are handled separately by the CA service."
   [request-handler
    get-code-id-fn]
-  (comidi/routes
-    (comidi/GET ["/node/" [#".*" :rest]] request
-                   (request-handler request))
-    (comidi/GET ["/file_content/" [#".*" :rest]] request
-                   (request-handler request))
-    (comidi/GET ["/file_metadatas/" [#".*" :rest]] request
-                   (request-handler request))
-    (comidi/GET ["/file_metadata/" [#".*" :rest]] request
-                   (request-handler request))
-    (comidi/GET ["/file_bucket_file/" [#".*" :rest]] request
-                   (request-handler request))
-    (comidi/PUT ["/file_bucket_file/" [#".*" :rest]] request
-                   (request-handler request))
-    (comidi/HEAD ["/file_bucket_file/" [#".*" :rest]] request
-                   (request-handler request))
+  (let [request-handler-with-code-id (request-core/wrap-with-code-id request-handler get-code-id-fn)]
+    (comidi/routes
+     (comidi/GET ["/node/" [#".*" :rest]] request
+                 (request-handler request))
+     (comidi/GET ["/file_content/" [#".*" :rest]] request
+                 (request-handler request))
+     (comidi/GET ["/file_metadatas/" [#".*" :rest]] request
+                 (request-handler request))
+     (comidi/GET ["/file_metadata/" [#".*" :rest]] request
+                 (request-handler request))
+     (comidi/GET ["/file_bucket_file/" [#".*" :rest]] request
+                 (request-handler request))
+     (comidi/PUT ["/file_bucket_file/" [#".*" :rest]] request
+                 (request-handler request))
+     (comidi/HEAD ["/file_bucket_file/" [#".*" :rest]] request
+                  (request-handler request))

-    (comidi/GET ["/catalog/" [#".*" :rest]] request
-                   ((request-core/wrap-with-code-id
-                     request-handler get-code-id-fn) request))
-    (comidi/POST ["/catalog/" [#".*" :rest]] request
-                    ((request-core/wrap-with-code-id
-                      request-handler get-code-id-fn) request))
-    (comidi/PUT ["/report/" [#".*" :rest]] request
-                   (request-handler request))
-    (comidi/GET ["/resource_type/" [#".*" :rest]] request
-                   (request-handler request))
-    (comidi/GET ["/resource_types/" [#".*" :rest]] request
-                   (request-handler request))
-    (comidi/GET ["/environment/" [#".*" :rest]] request
-                   (request-handler request))
-    (comidi/GET "/environments" request
-                   (request-handler request))
-    (comidi/GET ["/status/" [#".*" :rest]] request
-                   (request-handler request))))
+     (comidi/GET ["/catalog/" [#".*" :rest]] request
+                 (request-handler-with-code-id request))
+     (comidi/POST ["/catalog/" [#".*" :rest]] request
+                 (request-handler-with-code-id request))
+     (comidi/PUT ["/report/" [#".*" :rest]] request
+                 (request-handler request))
+     (comidi/GET ["/resource_type/" [#".*" :rest]] request
+                 (request-handler request))
+     (comidi/GET ["/resource_types/" [#".*" :rest]] request
+                 (request-handler request))
+     (comidi/GET ["/environment/" [#".*" :rest]] request
+                 (request-handler request))
+     (comidi/GET "/environments" request
+                 (request-handler request))
+     (comidi/GET ["/status/" [#".*" :rest]] request
+                 (request-handler request)))))

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;; Lifecycle Helper Functions


Formatting

Formatting

--- src/cljs/onyx_dashboard/controllers/websocket.cljs
+++ src/cljs/onyx_dashboard/controllers/websocket.cljs
@@ -3,31 +3,36 @@

 (defmulti msg-controller (fn [[type _] _] type))

-(defmethod msg-controller :deployment/listing [[_ msg] state]
+(defmethod msg-controller :deployment/listing
+  [[_ msg] state]
   (assoc-in state [:deployments] msg))

 (defn is-tracking? [msg state]
   (= (:tracking-id msg)
      (get-in state [:deployment :tracking-id])))

-(defmethod msg-controller :deployment/up-to-date [[_ {:keys [tracking-id last-id] :as msg}] state]
+(defmethod msg-controller :deployment/up-to-date
+  [[_ {:keys [tracking-id last-id] :as msg}] state]
   (if (and (is-tracking? msg state)
            (= last-id (:message-id-max (:deployment state))))
     (assoc-in state [:deployment :up-to-date?] true)
     state))

-(defmethod msg-controller :deployment/submitted-job [[_ {:keys [id] :as msg}] state]
+(defmethod msg-controller :deployment/submitted-job
+  [[_ {:keys [id] :as msg}] state]
   (if (is-tracking? msg state)
     (assoc-in state [:deployment :jobs id] (assoc msg :status :submitted))
     state))

-(defmethod msg-controller :job/peer-assigned [[_ {:keys [peer-id task job-id] :as msg}] state]
+(defmethod msg-controller :job/peer-assigned
+  [[_ {:keys [peer-id task job-id] :as msg}] state]
   ;(println "Peer assigned " msg)
   (if (is-tracking? msg state)
     (assoc-in state [:deployment :jobs job-id :tasks peer-id] task)
     state))

-(defmethod msg-controller :deployment/peer-joined [[_ {:keys [id] :as msg}] state]
+(defmethod msg-controller :deployment/peer-joined
+  [[_ {:keys [id] :as msg}] state]
   ;(println "Peer joined " msg)
   (if (is-tracking? msg state)
     (update-in state [:deployment :peers] union #{id})
@@ -39,7 +44,8 @@
 ;     (update-in state [:deployment :peers] union #{id})
 ;     state))

-(defmethod msg-controller :deployment/peer-notify-joined-accepted [[_ {:keys [id] :as msg}] state]
+(defmethod msg-controller :deployment/peer-notify-joined-accepted
+  [[_ {:keys [id] :as msg}] state]
   ;(println "Peer immediate notify joined " msg)
   (if (is-tracking? msg state)
     (update-in state [:deployment :peers] union #{id})
@@ -52,13 +58,15 @@
                (vals jobs))))

-(defmethod msg-controller :deployment/log-replay-crash [[_ {:keys [id] :as msg}] state]
+(defmethod msg-controller :deployment/log-replay-crash
+  [[_ {:keys [id] :as msg}] state]
   ;(println "Log replay crashed" msg)
   (if (is-tracking? msg state)
     (assoc-in state [:deployment :status] {:status :crashed :error (:error msg)})
     state))

-(defmethod msg-controller :deployment/peer-left [[_ {:keys [id] :as msg}] state]
+(defmethod msg-controller :deployment/peer-left
+  [[_ {:keys [id] :as msg}] state]
   ;(println "Peer left" msg)
   (if (is-tracking? msg state)
     (-> state
@@ -66,13 +74,15 @@
         (update-in [:deployment :jobs] remove-dead-peer id))
     state))

-(defmethod msg-controller :job/completed-task [[_ {:keys [peer-id job-id task] :as msg}] state]
+(defmethod msg-controller :job/completed-task
+  [[_ {:keys [peer-id job-id task] :as msg}] state]
   ;(println "Completed task " msg)
   (if (is-tracking? msg state)
     (update-in state [:deployment :jobs job-id :tasks] dissoc peer-id)
     state))

-(defmethod msg-controller :deployment/kill-job [[_ {:keys [id] :as msg}] state]
+(defmethod msg-controller :deployment/kill-job
+  [[_ {:keys [id] :as msg}] state]
   ;; Managed to create a kill-job entry with a nil job. Should fix this upstream
   ;; {:entry {:args {:job nil}, :fn :kill-job, :message-id 63, :created-at 1423218732944}}}
   (if (and (is-tracking? msg state) id)
@@ -85,7 +95,8 @@
           state
           job-ids))

-(defmethod msg-controller :deployment/job-statuses [[_ {:keys [finished-jobs incomplete-jobs] :as msg}] state]
+(defmethod msg-controller :deployment/job-statuses
+  [[_ {:keys [finished-jobs incomplete-jobs] :as msg}] state]
   (if (is-tracking? msg state)
     (-> state
         (update-statuses finished-jobs :finished)


add cljs.reader namespace to doc generator

--- cljs-api-parser/src/core.clj
+++ cljs-api-parser/src/core.clj
@@ -28,6 +28,7 @@
                                               "core.clj"         "src/clj/cljs/core.clj"}
                              "clojure"       {"core.clj"         "src/clj/clojure/core.clj"
                                               "core_deftype.clj" "src/clj/clojure/core_deftype.clj"}}
+   "cljs.reader"            {"clojurescript" {"reader.cljs"      "src/cljs/cljs/reader.cljs"}}
    "clojure.set"            {"clojurescript" {"set.cljs"         "src/cljs/clojure/set.cljs"}}
    "clojure.string"         {"clojurescript" {"string.cljs"      "src/cljs/clojure/string.cljs"}}
    "clojure.walk"           {"clojurescript" {"walk.cljs"        "src/cljs/clojure/walk.cljs"}}
@@ -284,6 +285,9 @@
             clj-cljs-api
             cljs-cljs-api)))

+(defmethod parse-ns-api "cljs.reader" [ns-]
+  (parse-api ns- "clojurescript" "reader.cljs"))
+
 (defmethod parse-ns-api "clojure.set" [ns-]
   (parse-api ns- "clojurescript" "set.cljs"))


Trim search query

Trim search query

--- src/clj/clojuredocs/search.clj
+++ src/clj/clojuredocs/search.clj
@@ -126,7 +126,7 @@

 (defn query [q]
   (when-not (empty? q)
-    (->> (clucy/search search-index (str (lucene-escape q) "*") 1000)
+    (->> (clucy/search search-index (str (lucene-escape (str/trim q)) "*") 1000)
          (map #(assoc % :edit-distance (levenshtein-distance (str (:name %)) q)))
          (sort-by :edit-distance)
          (take 5))))


Fix formatting

Fix formatting

--- src/clj_gatling/simulation.clj
+++ src/clj_gatling/simulation.clj
@@ -110,8 +110,7 @@
     result))

 (defn async-function-with-timeout [request timeout user-id result-channel]
-  (let [
-now      #(System/currentTimeMillis)
+  (let [now      #(System/currentTimeMillis)
         start    (now)
         response (async/chan)
         function (memoize (request-fn request))]


Checkpoint

Checkpoint

Signed-off-by: Gregory Haskins <640d9fe47775e6723f0355b7315e38f7d98d3539@gmail.com>

--- src/cljparse/config/parser.clj
+++ src/cljparse/config/parser.clj
@@ -5,4 +5,4 @@
 (def grammar (insta/parser (io/resource "config.bnf")))

 (defn parser [file]
-  (println "Parsing" file))
+  (grammar file))


improve code style

improve code style

--- src/cljs/lambdacd/history.cljs
+++ src/cljs/lambdacd/history.cljs
@@ -45,7 +45,7 @@
                                                  "Not started yet")]]
     [:div {:class "history--item--line"}
      [icon "fa fa-clock-o"]
-     [:p {:class "history--item--line--item" } (if (not (zero? duration-in-seconds))
+     [:p {:class "history--item--line--item" } (if-not (zero? duration-in-seconds)
                                                  (str "Duration: " (time/format-duration-long
                                                                      duration-in-seconds))
                                                  "Duration: 0sec")]]


[n.u.traits] Fix bugged :on-editor-action trait

--- src/clojure/neko/ui/traits.clj
+++ src/clojure/neko/ui/traits.clj
@@ -447,7 +447,7 @@
   "Takes :on-editor-action attribute, which should be function
   of three arguments, and sets it as OnEditorAction for the
   TexView widget"
-  [^TextView wdg, {:keys [on-editor-action]}]
+  [^TextView wdg, {:keys [on-editor-action]} _]
   (.setOnEditorActionListener wdg (text-view-listeners/on-editor-action-call on-editor-action)))

 ;; ### ID storing traits


Disabling tracing by default.

Disabling tracing by default.

--- src/cmr/metadata_db/system.clj
+++ src/cmr/metadata_db/system.clj
@@ -23,7 +23,7 @@
   {:db (memory/create-db)
    :log (log/create-logger)
    :web (web/create-web-server 3001 routes/make-api)
-   :zipkin (context/zipkin-config "Metadata DB")})
+   :zipkin (context/zipkin-config "Metadata DB" false)})

 (defn start
   "Performs side effects to initialize the system, acquire resources,


Now loading the tokens through AJAX

Now loading the tokens through AJAX

--- src/com/okl/tokenmgr/views.clj
+++ src/com/okl/tokenmgr/views.clj
@@ -230,6 +230,7 @@
    [:script {:src "/slick-grid/plugins/slick.cellrangedecorator.js"}]
    [:script {:src "/slick-grid/plugins/slick.cellrangeselector.js"}]
    [:script {:src "/slick-grid/plugins/slick.rowselectionmodel.js"}]
+   [:script {:src "/slick-grid/slick.dataview.js"}]
    [:script {:src "//code.jquery.com/ui/1.10.3/jquery-ui.js"}]
    [:script {:type "text/javascript"}
     "$.fn.serializeObject = function()
@@ -282,10 +283,13 @@
     autoHeight: true
    };

+
+
 var loadingIndicator = null;

 $(function () {

+var dv = Slick.Data.DataView();
 var gridSorter = function(columnField, isAsc, grid, gridData) {
     var sign = isAsc ? 1 : -1;
     var field = columnField
@@ -299,14 +303,11 @@
     grid.render();
 }

-
-var data = " (json/write-str tokens)
-";
-grid = new Slick.Grid('#testdiv', data, columns, options);
+grid = new Slick.Grid('#testdiv', dv, columns, options);

 grid.setSelectionModel(new Slick.RowSelectionModel());

-gridSorter('token', true, grid, data);
+gridSorter('token', true, grid, dv);

 grid.setSortColumn('token', true);

@@ -321,7 +322,29 @@
 });

 grid.onSort.subscribe(function(e, args) {
-  gridSorter(args.sortCol.field, args.sortAsc, grid, data);
-});
+  gridSorter(args.sortCol.field, args.sortAsc, grid, dv);
+});
+
+dv.onRowCountChanged.subscribe(function(e, args) {
+  grid.updateRowCount();
+  grid.render();
+});
+
+dv.onRowsChanged.subscribe(function (e, args) {
+  grid.invalidateRows(args.rows);
+  grid.render();
+});
+
+$.ajax({
+  url: '/api/tokens/" (url-encode app) "',
+  type: 'GET',
+  success: function(data) {
+    dv.setItems(data, 'name');
+  },
+  error: function(req, status, message) {
+    alert('Error loading data');
+  }
+});
+
   })"
 )]]))


tree structure maintained

tree structure maintained

--- src/bracketolojy/tournament.clj
+++ src/bracketolojy/tournament.clj
@@ -33,7 +33,7 @@
                  (coll? (first field)) (coll? (last field)))))
 (defmethod compute-matchup :default [_ _ matchup]
   matchup)
-(defmethod compute-matchup true [pick-scoring upset-scoring [upper-field lower-field :as fields]]
+(defmethod compute-matchup true [pick-scoring upset-scoring [[upper-field _] [lower-field _] :as fields]]
   (let [round (count upper-field)
         pick-pts (get pick-scoring round)
         upset-pts (get upset-scoring round)]
@@ -49,19 +49,27 @@
               (assoc %1 name %2)))
         {})
       vals
-;      (#(vector % fields))
+      (#(vector % fields))
       )))

 (def sample-data
-  [[[(->Team "Florida" 1 0.9502 1 \_)]
-    [(->Team "Albany" 16 0.4698 1 \_)]]
+  [
+    [
+      [[(->Team "Florida" 1 0.9502 1 \_)] \_]
+      [[(->Team "Albany" 16 0.4698 1 \_)] \_]
+      ]

-   [[(->Team "Colorado" 8 0.7156 1 \_)]
-    [(->Team "Pittsburgh" 9 0.8848 1 \_)]]])
+    [
+      [[(->Team "Colorado" 8 0.7156 1 \_)] \_]
+      [[(->Team "Pittsburgh" 9 0.8848 1 \_)] \_]
+      ]
+   ])

 ;(def sample-data
-;  [[(->Team "Colorado" 8 0.7156 1 \_)]
-;   [(->Team "Pittsburgh" 9 0.8848 1 \_)]])
+;  [
+;    [[(->Team "Colorado" 8 0.7156 1 \_)] \_]
+;    [[(->Team "Pittsburgh" 9 0.8848 1 \_)] \_]
+;   ])

 (println
   (let [result (walk/postwalk


add support for maven classifiers

add support for maven classifiers

--- src/cake/tasks/dependencies.clj
+++ src/cake/tasks/dependencies.clj
@@ -58,6 +58,7 @@
         {:group-id    (group dep)
          :artifact-id (name dep)
          :version     (:version opts)
+         :classifier  (:classifier opts)
          :exclusions  (map exclusion (concat *exclusions* (:exclusions opts)))}))))

 (defn subproject-path [dep]


Require serialization when booting.

Require serialization when booting.

--- clj_record/boot.clj
+++ clj_record/boot.clj
@@ -3,4 +3,5 @@
     core
     callbacks
     associations
-    validation)))
+    validation
+    serialization)))


Minor code refactoring.

Minor code refactoring.

--- src/cmr/indexer/services/concepts/collection.clj
+++ src/cmr/indexer/services/concepts/collection.clj
@@ -20,7 +20,7 @@
          temporal :temporal} umm-concept
         platforms (:platforms umm-concept)
         platform-short-names (map :short-name platforms)
-        instruments (flatten (map :instruments platforms))
+        instruments (mapcat :instruments platforms)
         instrument-short-names (remove nil? (map :short-name instruments))
         project-short-names (map :short-name (:projects umm-concept))
         two-d-coord-names (map :name (:two-d-coordinate-systems umm-concept))


add/remove positions in position list

add/remove positions in position list

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

--- acqEngine/src/org/micromanager/mm.clj
+++ acqEngine/src/org/micromanager/mm.clj
@@ -341,6 +341,21 @@
       (when (pos? (. p-list getNumberOfPositions))
         (.getPosition p-list idx)))))

+(defn add-msp
+  [label x y z]
+  (let [p-list (.getPositionList gui)]
+    (.addPosition p-list
+                  (doto
+                    (MultiStagePosition.
+                      (core getXYStageDevice) x y
+                      (core getFocusDevice) z)
+                    (.setLabel label)))))
+
+(defn remove-msp
+  [idx]
+  (let [p-list (.getPositionList gui)]
+    (.removePosition p-list idx)))
+
 (defn get-msp-z-position
   "Get the z position for a given z-stage from the MultiStagePosition
    with the given index in the Position List."
@@ -355,7 +370,7 @@
   [idx z-stage z]
   (when-let [msp (get-msp idx)]
     (when-let [stage-pos (. msp (get z-stage))]
-      (set! (. stage-pos x) z))))
+      (set! (. stage-pos x) z))))

 (defn str-vector
   "Convert a sequence of strings into a Micro-Manager StrVector."


Added acl direct transformer test for granules.

--- test/cmr/system_int_test/search/acls/granule_acl_search_test.clj
+++ test/cmr/system_int_test/search/acls/granule_acl_search_test.clj
@@ -46,8 +46,6 @@
   )

 (deftest granule-search-with-acls-test
-  ;; TODO test a search with no acls existing
-
   (do
     ;; -- PROV1 --
     ;; Guests have access to coll1
@@ -91,7 +89,6 @@
     (e/grant-registered-users
       (e/gran-catalog-item-id "provguid5" (e/coll-id ["coll53"]) (e/gran-id {:max-value 10})))

-    ;; Clear out acl caches
     (ingest/clear-caches))

   (let [coll1 (make-coll 1 "PROV1")
@@ -156,6 +153,9 @@
         ;; not permitted above max
         gran58 (make-gran 58 coll53 {:access-value 11})

+        all-grans [gran1 gran2 gran3 gran4 gran5 gran6 gran7 gran8 gran9 gran10 gran11 gran51 gran52
+                  gran54 gran53 gran55 gran56 gran57 gran58]
+
         ;; Tokens
         guest-token (e/login-guest)
         user1-token (e/login "user1")
@@ -183,24 +183,29 @@
          [gran3 gran5] {:token guest-token :entry-title "coll2"}
          [gran1 gran2 gran3 gran5 gran11] {:token guest-token :entry-title ["coll1" "coll2" "coll7"]}

+         ;; provider id
+         (filter #(= "PROV1" (:provider-id %))
+                 guest-permitted-granules)
+         {:token guest-token :provider-id "PROV1"}
+
+         ;; provider id and entry title
+         [gran1 gran2] {:token guest-token :entry-title "coll1" :provider-id "PROV1"}
+         [] {:token guest-token :entry-title "coll5" :provider-id "PROV1"}
+
          ;; concept id
          [gran1 gran2] {:token guest-token :concept-id (:concept-id coll1)}
          [gran3 gran5] {:token guest-token :concept-id (:concept-id coll2)}
          guest-permitted-granules
          {:token guest-token :concept-id (cons "C999-PROV1" (map :concept-id all-colls))}
-         ; user-permitted-granules
-         ; {:token guest-token :concept-id (cons "C999-PROV1" (map :concept-id all-colls))}
-
-
-         )
-
-    ;; TODO test searching
-    ;; with no collection concept ids
-    ;; 1 coll concept id
-    ;; 2 coll concept ids
-    ;; a provider id
-    ;; a provider id and entry title
-    ;; an entry title
+         user-permitted-granules
+         {:token user1-token :concept-id (cons "C999-PROV1" (map :concept-id all-colls))})
+
+    (testing "Direct transformer retrieval acl enforcement"
+      (d/assert-metadata-results-match
+          :echo10 user-permitted-granules
+          (search/find-metadata :granule :echo10 {:token user1-token
+                                                  :page-size 100
+                                                  :concept-id (map :concept-id all-grans)})))

     ))


lower limit for loading threads for tag

lower limit for loading threads for tag

--- src/chat/client/dispatcher.cljs
+++ src/chat/client/dispatcher.cljs
@@ -139,7 +139,7 @@
           (store/set-search-results! results)))))

 (defmethod dispatch! :threads-for-tag [_ {:keys [tag-id offset limit on-complete]
-                                          :or {offset 0 limit 50}}]
+                                          :or {offset 0 limit 25}}]
   (sync/chsk-send!
     [:chat/threads-for-tag {:tag-id tag-id :offset offset :limit limit}]
     2500


Publish job updates

Publish job updates

--- src/cider_ci/dispatcher/job.clj
+++ src/cider_ci/dispatcher/job.clj
@@ -6,6 +6,7 @@
   (:require
     [cider-ci.dispatcher.stateful-entity :as stateful-entity]
     [cider-ci.utils.config :as config :refer [get-config]]
+    [cider-ci.utils.messaging :as messaging]
     [cider-ci.utils.rdbms :as rdbms :refer [get-ds]]
     [clj-logging-config.log4j :as logging-config]
     [clojure.java.jdbc :as jdbc]
@@ -24,8 +25,9 @@
                  WHERE job_id = ?" (:id job)])))

 (defn- update-state-and-fire-if-changed [job-id new-state]
-  (stateful-entity/update-state
-    :jobs job-id new-state {:assert-existence true}))
+  (when (stateful-entity/update-state
+          :jobs job-id new-state {:assert-existence true})
+    (messaging/publish "job.updated" {:id job-id :state new-state})))

 (defn get-job [job-id]
   (->> (jdbc/query (rdbms/get-ds)


clearing id and using latest structure

clearing id and using latest structure

--- test/celestial/integration/persistency/quotas.clj
+++ test/celestial/integration/persistency/quotas.clj
@@ -15,20 +15,21 @@
   (add-types)
   (add-users)
   (p/add-user {:username "foo" :password "bla" :roles {} :envs []})
-  (q/add-quota (assoc-in user-quota [:quotas :proxmox :used] nil)) )
+  (q/add-quota (assoc-in user-quota [:quotas :dev :proxmox :used :count] 0)) )

 (with-state-changes [(before :facts (quotas-populate))]
   (let [redis-prox-spec' (assoc redis-prox-spec :owner "foo")]
     (fact "basic quota usage" :integration :redis :quota
-       (q/increase-use 1 redis-prox-spec') => "OK"
-       (:quotas (q/get-quota "foo"))  => (contains {:proxmox {:limit 2 :used #{1}}})
-       (q/increase-use 2  redis-prox-spec')
-       (:quotas (q/get-quota "foo"))  => (contains {:proxmox {:limit 2 :used #{1 2}}})
-       (q/with-quota (fn [] 1) redis-prox-spec') => (throws ExceptionInfo (is-type? :celestial.persistency.quotas/quota-limit-reached))
-       (q/decrease-use 2 redis-prox-spec')
-       (:quotas (q/get-quota "foo"))  => (contains {:proxmox {:limit 2 :used #{1}}})
-       (q/increase-use 3  redis-prox-spec')
-       (:quotas (q/get-quota "foo"))  => (contains {:proxmox {:limit 2 :used #{1 3}}}))
+       (q/increase-use redis-prox-spec') => "OK"
+       (get-in (q/get-quota "foo") [:quotas :dev])  => (contains {:proxmox {:limits {:count 2} :used {:count 1}}})
+       (q/increase-use redis-prox-spec')
+       (get-in (q/get-quota "foo") [:quotas :dev])  => (contains {:proxmox {:limits {:count 2} :used {:count 2}}})
+       (q/with-quota redis-prox-spec') => (throws ExceptionInfo (is-type? :celestial.persistency.quotas/quota-limit-reached))
+       (q/decrease-use redis-prox-spec')
+       (get-in (q/get-quota "foo") [:quotas :dev])  => (contains {:proxmox {:limits {:count 2} :used {:count 1}}})
+       (q/increase-use redis-prox-spec')
+       (get-in (q/get-quota "foo") [:quotas :dev])  => (contains {:proxmox {:limits {:count 2} :used {:count 2}}})
+          )

   (fact "system quota interception" :integration :redis :quota
     (with-admin


more docs

more docs

--- src/clj/forma/trends/filter.clj
+++ src/clj/forma/trends/filter.clj
@@ -23,7 +23,12 @@
   the data in the supplied time series `ts`

   Example:
-    (deseasonalize 23 ndvi)"
+    (deseasonalize 23 ndvi)
+
+  Benchmark:
+    (let [v (s/sample-normal 200)]
+      (time (dotimes [_ 150] (deseasonalize 23 v))))
+    ;;=> Elapsed time: 281.299262 msecs"
   [freq ts]
   (let [x (dummy-mat freq (i/nrow ts))
         xt (i/trans x)


Comet now respects first time event negative may.

--- src/clj/game/cards-hardware.clj
+++ src/clj/game/cards-hardware.clj
@@ -68,7 +68,9 @@
    "Comet"
    {:effect (effect (gain :memory 1)) :leave-play (effect (lose :memory 1))
     :events {:play-event
-             {:optional {:prompt "Play another event?" :once :per-turn
+             {:optional {:prompt "Play another event?"
+                         :req (req (and (first-event state side :play-event)
+                                        (not (empty? (filter #(has? % :type "Event") (:hand runner))))))
                          :effect (effect (resolve-ability
                                            {:prompt "Choose an Event to play"
                                             :choices (req (filter #(has? % :type "Event") (:hand runner)))


Implement Brain Chip

Implement Brain Chip

--- src/clj/game/cards-hardware.clj
+++ src/clj/game/cards-hardware.clj
@@ -47,6 +47,17 @@
    "Brain Cage"
    {:effect (effect (damage :brain 1 {:card card}) (gain :max-hand-size 3))
     :leave-play (effect (lose :max-hand-size 3))}
+
+   "Brain Chip"
+   (let [runner-points (fn [s] (or (get-in s [:runner :agenda-point]) 0))]
+     {:effect (req (gain state :runner :memory (:agenda-point runner) :max-hand-size (:agenda-point runner))
+                   (add-watch state (keyword (str "brainchip" (:cid card)))
+                          (fn [k ref old new]
+                            (let [bonus (- (runner-points new) (runner-points old))]
+                              (when (not= 0 bonus)
+                               (gain state :runner :memory bonus :max-hand-size bonus))))))
+      :leave-play (req (remove-watch state (keyword (str "brainchip" (:cid card))))
+                       (lose state :runner :memory (runner-points @state) :max-hand-size (runner-points @state)))})

    "Chop Bot 3000"
    {:abilities [{:msg (msg "trash " (:title target))


prevent Leprechaun from adding MU when hosted program is trashed

--- src/clj/game/cards-programs.clj
+++ src/clj/game/cards-programs.clj
@@ -279,24 +279,34 @@
                                                      (shuffle! :corp :deck))}} card))}]}

    "Lamprey"
-   {:events {:successful-run {:req (req (= target :hq)) :msg "to force the Corp to lose 1 [Credits]"
+   {:events {:successful-run {:req (req (= target :hq)) :msg "force the Corp to lose 1 [Credits]"
                               :effect (effect (lose :corp :credit 1))}
              :purge {:effect (effect (trash card))}}}

    "Leprechaun"
    {:abilities [{:label "Install a program on Leprechaun"
                  :req (req (<= (count (:hosted card)) 2)) :cost [:click 1]
-                 :prompt "Choose a program to install on Leprechaun from your grip"
+                 :prompt "Choose a program in your Grip to install on Leprechaun"
                  :choices {:req #(and (= (:type %) "Program")
                                       (= (:zone %) [:hand]))}
                  :msg (msg "host " (:title target))
                  :effect (effect (gain :memory (:memoryunits target))
-                                 (runner-install target {:host-card card}))}
+                                 (runner-install target {:host-card card})
+                                 (update! (assoc (get-card state card)
+                                                 :hosted-programs (cons (:cid target) (:hosted-programs card)))))}
                 {:label "Host an installed program on Leprechaun"
                  :req (req (<= (count (:hosted card)) 2))
-                 :prompt "Choose a program to host on Leprechaun"
+                 :prompt "Choose an installed program to host on Leprechaun"
                  :choices {:req #(and (= (:type %) "Program") (:installed %))}
-                 :msg (msg "host " (:title target)) :effect (effect (host card target))}]}
+                 :msg (msg "host " (:title target))
+                 :effect (effect (host card target)
+                                 (gain :memory (:memoryunits target))
+                                 (update! (assoc (get-card state card)
+                                                 :hosted-programs (cons (:cid target) (:hosted-programs card)))))}]
+    :events {:card-moved {:req (req (some #{(:cid target)} (:hosted-programs card)))
+                          :effect (effect (update! (assoc card
+                                                          :hosted-programs (remove #(= (:cid target) %) (:hosted-programs card))))
+                                          (lose :memory (:memoryunits target)))}}}

    "LLDS Energy Regulator"
    {:prevent {:trash [:hardware]}


Remove X-Frame-Options header from all embeddable views

--- src/clj/salava/core/handler.clj
+++ src/clj/salava/core/handler.clj
@@ -41,14 +41,12 @@
                                      (subs uri 0 (dec (count uri)))
                                      uri))))))

-(def remove-x-frame-routes
-  ["/badge/info/(\\d+)/embed"])
-
 (defn remove-x-frame-options [handler]
+  "Remove X-Frame-Options header if route ends with '/embed'"
   (fn [request]
     (let [uri (:uri request)]
       (if-let [response (handler request)]
-        (if (some #(re-find (re-pattern %) (str uri)) remove-x-frame-routes)
+        (if (re-find (re-pattern "/embed$") (str uri))
           (update-in response [:headers] dissoc "X-Frame-Options")
           response)))))


Simplify render-column

Simplify render-column

--- src/cljs/clojure_rest/core.cljs
+++ src/cljs/clojure_rest/core.cljs
@@ -148,7 +148,7 @@

 (defn render-column
   "[Pure] Render a column holding a set of cards"
-  [card-renderer {:keys [on-card-drop] :as event-handlers}]
+  [card-renderer on-card-drop]
   (fn [status cards]
     [:div.column
      {:onDragOver #(.preventDefault %)
@@ -202,7 +202,7 @@
         filtered (reaction (filter-by-title @filter @cards))
         handlers (event-handlers cards)
         card-renderer (render-card handlers)
-        column-rendered (render-column card-renderer handlers)
+        column-rendered (render-column card-renderer (handlers :on-card-drop))
         board-renderer (render-board column-rendered)]
     (fn []
       [:div


Use group by instead of filtering by status

--- src/cljs/clojure_rest/core.cljs
+++ src/cljs/clojure_rest/core.cljs
@@ -35,17 +35,12 @@
    :backgroundColor (-> card :category category->color)
   })

-(defn filter-by-status
-  "Filter card by status"
-  [status cards]
-  (filter #(= status (:status %)) (map second cards)))
-
- (defn filter-by-title
-   "Keep only cards that contains the searched string inside their title"
-   [title cards]
-   (if (empty? title)
-     cards
-     (filter #(utils/str-contains (-> % second :title) title) cards)))
+(defn filter-by-title
+  "Keep only cards that contains the searched string inside their title"
+  [title cards]
+  (if (empty? title)
+    cards
+    (filter #(utils/str-contains (-> % second :title) title) cards)))

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

@@ -125,20 +120,20 @@
   )))

 (defn render-column
-  [status cards card-renderer]
+  [card-renderer status cards]
   [:div.list
-   [:h1 (status->str status)]
-   (for [c (filter-by-status status cards)]
+   [:h1 status]
+   (for [c cards]
      ^{:key (:card-id c)} [card-renderer c])
   ])

 (defn render-board
-  ; TODO - Use group by instead of filter
-  [cards card-renderer]
-  [:div.app
-   (for [status [:backlog :under-dev :done]]
-     ^{:key status} [render-column status cards card-renderer])
-  ])
+  [card-renderer cards]
+  (let [cards-by-status (group-by :status (map second cards))]
+    [:div.app
+     (for [status [:backlog :under-dev :done]]
+       ^{:key status} [render-column card-renderer (status->str status) (cards-by-status status)])
+    ]))

 (defn render-filter
   [filter-ref]
@@ -192,8 +187,9 @@
          (render-filter filter)
          [render-add-card on-add-card]
          [render-toggle-all on-toggle-all]
-         [render-board @filtered
-          (render-card on-toggle-card on-remove-task on-check-task on-add-task)]
+         [render-board
+          (render-card on-toggle-card on-remove-task on-check-task on-add-task)
+          @filtered]
         ]))
   ))


Use a cursor for the filter in the app-state

--- src/cljs/clojure_rest/core.cljs
+++ src/cljs/clojure_rest/core.cljs
@@ -56,11 +56,6 @@
   (reaction
     (filter-by-title (:filter @app-state) (:cards @app-state))
   ))
-
-(defn update-filter!
-  "Update the filter used in the app state"
-  [filter]
-  (swap! app-state #(assoc % :filter filter)))

 (defn update-card!
   "Update a card"
@@ -148,16 +143,21 @@
      ^{:key status} [render-list status cards])
   ])

+(defn render-filter
+  [filter-cursor]
+  [:input.search-input
+    {:type "text" :placeholder "search"
+     :value @filter-cursor
+     :on-change #(reset! filter-cursor (.. % -target -value))}
+  ])
+
 (defn render-app
   []
-  [:div
-   [:input.search-input
-    {:type "text"
-     :placeholder "search"
-     :value (:filter @app-state)
-     :on-change #(update-filter! (.. % -target -value))}]
-   [render-board @card-list]
-  ])
+  (let [filter (r/cursor app-state [:filter])]
+    [:div
+     (render-filter filter)
+     [render-board @card-list]]
+  ))

 (def fetch-and-render-app
   "Render the app - adding a fetching of data when the DOM is mounted"


Use the same function for making many buttons

--- src/cljs/comic_reader/main.cljs
+++ src/cljs/comic_reader/main.cljs
@@ -30,7 +30,7 @@
    "There's nothing to see here."
    [:a {:href "/#"}]])

-(defn manga-site [site]
+(defn btn-for-id-name [site]
   (let [{:keys [id name]} site]
    ^{:key id}
      [:li
@@ -45,17 +45,13 @@
   (let [site-list (rf/subscribe [:site-list])]
     (fn []
       (when-let [site-list @site-list]
-        [:ul (map manga-site site-list)]))))
-
-(defn comic-btn [comic]
-  ^{:key (:name comic)}
-  [:li (:name comic)])
+        [:ul (map btn-for-id-name site-list)]))))

 (defn comic-list []
   (let [comics-list (rf/subscribe [:comic-list])]
     (fn []
       (when-let [comic-list @comic-list]
-        [:ul (map comic-btn comic-list)]))))
+        [:ul (map btn-for-id-name comic-list)]))))

 (defn comic-reader []
   (let [page (rf/subscribe [:page])]


Add example of effect event and refactor shots (#2)

--- src/cljs/potok_rumu/events.cljs
+++ src/cljs/potok_rumu/events.cljs
@@ -2,26 +2,39 @@
   (:require [potok.core :as ptk]
             [beicon.core :as rx]))

-(deftype ^:private SmallShot []
+(deftype ^:private Drink [^Number volume]
   ptk/UpdateEvent
   (update [_ state]
-    (update state :potok (fnil + 0) 0.2)))
+    (update state :potok (fnil + 0) volume)))
+
+(deftype ^:private SmallShot []
+  ptk/WatchEvent
+  (watch [_ _ _]
+    (rx/just (->Drink 0.2))))

 (deftype ^:private BigShot []
-  ptk/UpdateEvent
-  (update [_ state]
-    (update state :potok (fnil + 0) 0.5)))
+  ptk/WatchEvent
+  (watch [_ _ _]
+    (rx/just (->Drink 0.5))))

 (deftype ^:private Drain []
   ptk/UpdateEvent
   (update [_ state]
     (assoc state :potok 0.0)))

+(deftype ^:private Sleep []
+  ptk/EffectEvent
+  (effect [_ _ _]
+    (js/alert "Pššššš, už spí!")))
+
 (deftype ^:private GoHome []
   ptk/WatchEvent
   (watch [_ state stream]
-    (->> (rx/just (->Drain))
-         (rx/delay 2000))))
+    (rx/merge
+     (->> (rx/just (->Drain))
+          (rx/delay 2000))
+     (->> (rx/just(->Sleep))
+          (rx/delay 2500)))))

 (def ^:private events-map
   {:small-shot ->SmallShot


Make not dropping a little smoother

Make not dropping a little smoother

--- src/cljs/retroboard/client.cljs
+++ src/cljs/retroboard/client.cljs
@@ -247,7 +247,6 @@
   (let [node (om/get-node owner)
         rel-x (- (.-pageX event) (.-offsetLeft node))
         rel-y (- (.-pageY event) (.-offsetTop node))
-        node (om/get-node owner)
         move (async/tap mouse-move-mult (chan (async/sliding-buffer 5)))
         up (async/tap mouse-up-mult (chan))
         dragger (om/get-state owner :dragger)]
@@ -262,15 +261,15 @@
     (om/set-state! owner :rel-x rel-x)
     (om/set-state! owner :rel-y rel-y)))

-
-(defn -drag-end [owner event]
+(defn -drag-end [owner event & [leave?]]
   (let [node (om/get-node owner)
         move (om/get-state owner :move-ch)
         up (om/get-state owner :up-ch)]
-    (set! (.-width (.-style node)) nil)
     (async/untap mouse-move-mult move)
     (async/untap mouse-up-mult up)
-    (om/set-state! owner :state nil)))
+    (when-not leave?
+      (set! (.-width (.-style node)) nil)
+      (om/set-state! owner :state nil))))

 (defn free-drag [owner drop-fn droppable-nodes]
   (reify
@@ -293,16 +292,17 @@
         (om/set-state! owner :state :dragging)))
     IDragEnd
     (drag-end [_ event]
-      (-drag-end owner event)
       (if-let [drop-data (targeted-node @droppable-nodes (.-pageX event) (.-pageY event))]
-        (drop-fn drop-data)))))
+        (-drag-end owner event (drop-fn drop-data))
+        (-drag-end owner event)))))

 (defn perform-drop [connection [drag-type drag-data] [drop-type drop-data]]
   (case [drag-type drop-type]
     [:note :column]
     (if (not= (:column-id drag-data) drop-data)
-      (a/move-note connection (:note drag-data) (:column-id drag-data) drop-data))))
+      (do (a/move-note connection (:note drag-data) (:column-id drag-data) drop-data)
+          true))))

 (defn draggable [{:keys [drop-fn comp-fn state drag-data droppable-nodes] :as data} owner opts]
   (reify


Load forecast data to be shown later with Highcharts.

--- src/cljs/weather_demo/core.cljs
+++ src/cljs/weather_demo/core.cljs
@@ -72,9 +72,22 @@
        :response-format (json-response-format {:keywords? true})}))
   [city-field])

-(defn forecast-chart []
-  (println "Rendering forecast chart")
+(defn forecast-chart [forecast-atom]
+  (println "Rendering forecast chart for" (-> @forecast-atom :city :name))
   [hc-chart {:config {}}])
+
+(defn load-forecast-chart [city-id]
+  (let [forecast (atom nil)]
+    (fn [city-id]
+      (when city-id
+        (reset! forecast nil)
+        (println "Loading forecast data for city" city-id)
+        (GET "data/2.5/forecast"
+          {:params {:units "metric"
+                    :id city-id}
+           :handler #(reset! forecast %)
+           :response-format (json-response-format {:keywords? true})}))
+      [forecast-chart forecast])))

 (defn home-page []
   [:div [:h2 "Welcome to weather-demo"]
@@ -91,7 +104,7 @@
        [country-field @countries selected-country]
        [load-city-field (:id @selected-country)]
        [country-description @countries (:id @selected-country)]
-       [forecast-chart]])))
+       [load-forecast-chart @city-id]])))

 (defn current-page []
   [:div [(session/get :current-page)]])


Make constraints responsible for detecting self-dirtying

--- src/aurora/btree.cljs
+++ src/aurora/btree.cljs
@@ -504,6 +504,7 @@
                          (.set-hi solver var (aget los var))
                          (when (< (+ i 1) (alength vars))
                            (.set-watch solver (aget vars (+ i 1)) constraint true))
+                         (.propagate this solver constraint)
                          true)))
                    false))))
   (split-right [this solver constraint]
@@ -566,10 +567,8 @@
                  (when (< i (alength vars))
                    (let [var (aget vars i)]
                      (if (identical? (aget los var) (aget his var))
-                       (do
-                         (dotimes [j (alength vars)]
-                           (.set-eq solver (aget vars j) (aget los var)))
-                         (aset (.-constraint->dirty? solver) constraint false))
+                       (dotimes [j (alength vars)]
+                         (.set-eq solver (aget vars j) (aget los var)))
                        (recur (+ i 1)))))))))

 (defn equal [vars]
@@ -694,8 +693,8 @@
                 (recur (+ constraint 1))
                 (do
                   (debug :propagating constraint los his)
-                  (aset constraint->dirty? constraint false)
                   (.propagate (aget constraints constraint) this constraint)
+                  (aset constraint->dirty? constraint false) ;; constraint is responsible for detecting if it causes itself more work
                   (debug :propagated constraint los his)
                   (recur 0)))
               (if (key= los his)


more logging

more logging

--- src/babel/engine.cljc
+++ src/babel/engine.cljc
@@ -41,15 +41,14 @@
                                             do-enrich true
                                             max-total-depth generate/max-total-depth
                                             truncate-children true}}]
-  (log/debug (str "engine/generate with spec " (strip-refs spec) " and max-total-depth: " max-total-depth))
+  (log/debug (str "engine/generate with spec: " (strip-refs spec) "; max-total-depth: " max-total-depth "; enrich: " do-enrich))
   (let [grammar (:grammar language-model)]
     (if (empty? grammar)
       (do
         (log/error (str "grammar is empty."))
         (exception (str "grammar is empty.")))))

-  (let [do-enrich (if do-enrich do-enrich true)
-        spec (if (or (= false add-subcat)
+  (let [spec (if (or (= false add-subcat)
                      (fail? (unify spec {:synsem {:subcat '()}}))
                      (not (= :none (get-in spec [:synsem :subcat] :none))))
                spec
@@ -64,7 +63,7 @@
         lexicon (if (get-in language-model [:generate :lexicon])
                   (get-in language-model [:generate :lexicon])
                   (get-in language-model [:lexicon]))
-
+
         post-enrich-spec (if (and do-enrich (:enrich language-model))
                            ((:enrich language-model)
                             spec
@@ -85,7 +84,8 @@
                 (count
                  (map #(log/debug (str "post-enrich spec: " %))
                       spec))
-                (log/debug (str "post-enrich spec: " spec)))]
+                (log/debug (str "post-enrich spec: " spec)))
+        ]
     (first (map (fn [each-spec]
                   (generate/generate each-spec language-model
                                      :truncate-children truncate-children


Fix long delay on starting a simple sequence MDA

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

--- acqEngine/src/org/micromanager/sequence_generator.clj
+++ acqEngine/src/org/micromanager/sequence_generator.clj
@@ -423,9 +423,9 @@
                                  (sequence-fits-stage? (.getFocusDevice mmc) n-slices))
         no-channel-skips-frames (all-equal? 0 (map :skip-frames channels))
         all-channels-do-z-stack (all-equal? true (map :use-z-stack channels))
-        channel-total-exposure (if channels
+        channel-total-exposure (if have-multiple-channels
                                  (reduce + (map :exposure channels))
-                                 (default-exposure))]
+                                 default-exposure)]
     (if
       (and
         (or
@@ -468,4 +468,3 @@
             numFrames use-autofocus channels slices
             default-exposure triggers 0 relative-slices)))
       (generate-default-acq-sequence settings runnables))))
-


show post date on index page

show post date on index page

--- src/bløggr/index.clj
+++ src/bløggr/index.clj
@@ -1,13 +1,19 @@
 (ns bløggr.index
   (:require [bløggr.common :refer :all]
             [bløggr.posts :as p]
+            [clj-time.format :as tf]
             [net.cgrand.enlive-html :as html]))

-(html/deftemplate index-post-template "partials/index_post.html" [post]
-  [:span#title] (html/content (-> post :header :title))
-  [:p#lead] (html/content (post :lead))
+(defn format-post-date [date]
+  (tf/unparse (tf/formatter "MMMM dd, yyyy.") date))
+
+(html/deftemplate index-post-template "partials/index_post.html"
+  [{:keys [header lead] :as post}]
+  [:span#title] (html/content (:title header))
+  [:p#date] (html/content (format-post-date (:date header)))
+  [:p#lead] (html/content lead)
   [:a#link] (html/set-attr :href (p/post-relative-url post))
-  [:a#link] (html/set-attr :title (-> post :header :title)))
+  [:a#link] (html/set-attr :title (:title header)))

 (html/deftemplate index-template "layouts/index.html" [posts]
   [:head] (html/html-content (slurp "resources/partials/head.html"))
@@ -20,4 +26,3 @@

 (defn get-index [posts]
   (apply str (index-template posts)))
-