Rewrite cmd-hook to not use robert-hooke excessively; fix #1

--- src/yetibot/core/hooks.clj
+++ src/yetibot/core/hooks.clj
@@ -17,69 +17,72 @@
   [data-structure]
   (with-meta data-structure {:suppress true}))

-(defn cmd-unhook [topic]
+; Stores the mapping of prefix-regex -> sub-commands.
+(defonce hooks (atom {}))
+
+(defonce prefix->topic (atom {}))
+
+(defn find-sub-cmds
+  "Matches prefix against command regexes in `hooks.`"
+  [prefix]
+  (first (filter (fn [[k v]] (re-find k prefix)) @hooks)))
+
+(defn cmd-unhook
+  "Removes the sub-commands for a prefix / topic."
+  [topic]
   (help/remove-docs topic)
-  (rh/remove-hook #'handle-cmd topic))
+  (swap! hooks dissoc topic))

-(defmacro cmd-hook [prefix & exprs]
-  ; let consumer pass [topic regex] as prefix arg when a (str regex) isn't enough
+(defn handle-with-hooked-cmds
+  "Looks up the set of possible commands by matching the first word against
+   prefixes stored in `hooks`. If it finds a match, it then matches against
+   sub-commands and defaults to help if no sub-commands match.
+   If unable to match prefix, it calls the callback, letting `handle-cmd`
+   implement its own default behavior."
+  [callback cmd-with-args {:keys [chat-source user opts] :as extra}]
+  (let [[cmd args] (s/split cmd-with-args #"\s+" 2)
+        args (or args "")] ; make it an empty string if no args
+    (if-let [[cmd-re sub-cmds] (find-sub-cmds cmd)]
+      ; Now try to find a matching sub-commands
+      (let [cmd-pairs (partition 2 sub-cmds)]
+        (info "found" cmd-re "on cmd" cmd "args:" args)
+        (if-let [[match sub-fn] (some (fn [[sub-re sub-fn]]
+                                        (info "some?" sub-re args)
+                                        (when-let [match (re-find sub-re args)]
+                                          [match sub-fn])) cmd-pairs)]
+          (sub-fn (merge extra {:cmd cmd :args args :match match}))
+          ; couldn't find any sub commands so default to help.
+          (yetibot.core.handler/handle-unparsed-expr (str "help " (get @prefix->topic cmd-re)))))
+      (callback cmd-with-args extra))))
+
+; Hook the actual handle-cmd called during interpretation.
+(rh/add-hook #'handle-cmd #'handle-with-hooked-cmds)
+
+(defn cmd-hook-resolved
+  "Expects fully resolved syntax where as plain cmd-hook can take normally
+   unresolved symbols like _ and translate them into '_"
+  [prefix & cmds]
   (let [[topic prefix] (if (vector? prefix) prefix [(str prefix) prefix])
-        callback (gensym "callback")
-        cmd-with-args (gensym "cmd-with-args")
-        cmd (gensym "cmd")
-        args (gensym "args")
-        user (gensym "user")
-        opts (gensym "opts")
-        match (gensym "match")
-        chat-source (gensym "chat-source")
-        extra (gensym "extra")]
-    `(do
-       (rh/add-hook
-         #'handle-cmd
-         ~topic ; use topic string as the hook-key to enable removing/re-adding
-         ; (fn [~callback ~cmd ~args ~user ~opts])
-         (fn [~callback ~cmd-with-args {~chat-source :chat-source
-                                        ~user :user
-                                        ~opts :opts
-                                        :as ~extra}]
-           (let [[~cmd & ~args] (s/split ~cmd-with-args #"\s+")
-                 ~args (s/join " " ~args)]
-             ; only match against the first word in ~args
-             (if (re-find ~prefix (s/lower-case ~cmd))
-               (do
-                 (info "found" ~prefix "on cmd" ~cmd
-                       ; "opts:" ~opts ; "extra" ~extra
-                       "args:" ~args)
-                 ; try matching the available sub-commands
-                 (cond-let [~match]
-                           ; rebuild the pairs in `exprs` as valid input for cond-let
-                           ~@(map (fn [i#]
-                                    (cond
-                                      ; prefix to match
-                                      (instance? Pattern i#) `(re-find ~i# ~args)
-                                      ; placeholder / fallthrough - set match equal to
-                                      ; :empty, which will trigger this match for
-                                      ; cond-let while not explicitly matching
-                                      ; anything.
-                                      (= i# '_) `(or :empty)
-                                      ; send result back to hooked fn
-                                      :else `(~i# {:cmd ~cmd
-                                                   :args ~args
-                                                   :match ~match
-                                                   :user ~user
-                                                   :chat-source ~chat-source
-                                                   :opts ~opts})))
-                                  exprs)
-                           ; default to help
-                           true (yetibot.core.handler/handle-unparsed-expr (str "help " ~topic))))
-               (~callback ~cmd-with-args ~extra)))))
-       ; extract the meta from the commands and use it to build docs
-       (help/add-docs ~topic
-                      (map
-                        (fn [i#]
-                          (when (and (symbol? i#) (not= i# '_))
-                            (:doc (meta (resolve i#)))))
-                        '~exprs)))))
+        cmd-pairs (partition 2 cmds)]
+    (swap! prefix->topic conj {prefix topic})
+    (help/add-docs topic
+                   (map (fn [[_ cmd-fn]] (:doc (meta cmd-fn)))
+                        cmd-pairs))
+    (swap! hooks conj {prefix cmds})))
+
+(defmacro cmd-hook
+  "Takes potentially special syntax and resolves it to symbols for
+   cmd-hook-resolved. Currently _ is the only special syntax."
+  [prefix & cmds]
+  (let [cmd-pairs (partition 2 cmds)]
+    `(cmd-hook-resolved
+       ~prefix
+       ~@(mapcat (fn [[k# v#]]
+                   [(condp = k#
+                      '_ #".*"
+                      k#)
+                    (resolve v#)])
+                 cmd-pairs))))

 (defn obs-hook
   "Pass a collection of event-types you're interested in and an observer function


modify browser navigation

modify browser navigation

--- src_cljs/rrm/corecljs.cljs
+++ src_cljs/rrm/corecljs.cljs
@@ -3223,10 +3223,11 @@
       (http-get-auth (str serverhost "districts") dist-res))))

 (defroute login-page "/login" []
-  (when (nil? (get-value! :user))
+  (if (nil? (get-value! :user))
     (do
       (set-key-value :page-location [login])
-      (set-login-page))))
+      (set-login-page))
+    (accountant/navigate! "/")))

 (defroute "*" []
   (js/alert "
Not Found Page
"))


Fixed #8: engine tests don't run

Fixed #8: engine tests don't run

--- test/leiningen/less/engine_test.clj
+++ test/leiningen/less/engine_test.clj
@@ -51,6 +51,10 @@
     ))

+(defmacro tests []
+  `(vals (ns-interns ~*ns*)))
+
+
 (defn test-ns-hook
   "Filter tests based on the type of JVM used to run the tests."
   []
@@ -58,7 +62,7 @@
         [_ M m] (clojure.string/split jvm #"\.")
         rhino? (#{"5" "6" "7"} M)
         nashorn? (#{"8" "9"} M)
-        tests (filter (comp :test meta) (vals (ns-interns *ns*)))
+        tests (filter (comp :test meta) (tests))
         tests (concat
                 (remove (comp :rhino meta) (remove (comp :nashorn meta) tests))
                 (when rhino? (filter (comp :rhino meta) tests))


up version for release

up version for release

--- kafka-clj/project.clj
+++ kafka-clj/project.clj
@@ -1,4 +1,4 @@
-(defproject kafka-clj "3.0.2-SNAPSHOT"
+(defproject kafka-clj "3.0.2"
   :description "fast kafka library implemented in clojure"
   :url "https://github.com/gerritjvv/kafka-fast"
   :license {:name "Eclipse Public License"


release stable version

release stable version

--- kafka-clj/project.clj
+++ kafka-clj/project.clj
@@ -1,4 +1,4 @@
-(defproject kafka-clj "2.1.2-SNAPSHOT"
+(defproject kafka-clj "2.1.3"
   :description "fast kafka library implemented in clojure"
   :url "https://github.com/gerritjvv/kafka-fast"
   :license {:name "Eclipse Public License"


Make `fatrpm` generate backwards-compatible RPMs

Right now, the generated rpm digest and payloads depend of the settings
of the Linux distribution being used, which means that on any recent
CentOS we end up creating packages that use the following:

    * File digest: SHA384
    * Payload: xz

A non-gzip payload breaks backwards compatibility, so what this patch
does is making both settings use the most basic (and default) build
settings. Now the generated package is:

    * File digest: MD5
    * Payload: gzip

This should make the rpm installable in any distribution that does rpm.

--- tasks/leiningen/fatrpm.clj
+++ tasks/leiningen/fatrpm.clj
@@ -155,6 +155,10 @@
                                            (file (:root project)
                                                  "pkg" "rpm" "preinst.sh")))
     (set-mojo! mojo "requires" (create-dependency ["java >= 1.7.0"]))
+    (set-mojo! mojo "defineStatements" ["_source_filedigest_algorithm 1",
+                                        "_binary_filedigest_algorithm 1",
+                                        "_source_payload w9.gzdio",
+                                        "_binary_payload w9.gzdio"])
     (.execute mojo)))

 (defn extract-rpm


Fixing failing granule tests.

Fixing failing granule tests.

--- umm-lib/src/cmr/umm/validation/core.clj
+++ umm-lib/src/cmr/umm/validation/core.clj
@@ -31,10 +31,7 @@

 (def granule-validations
   "Defines validations for granules"
-  {
-   ;; TODO this is a temporary validation. There must be at least one validation or else bouncer fails.
-   :access-value v/integer
-   })
+  {})

 (def umm-validations
   "A list of validations by type"


Added second test for the main function

Added second test for the main function

--- test/zg/core_test.clj
+++ test/zg/core_test.clj
@@ -134,8 +134,17 @@

 (deftest test-main-1
     "Check the function zg.core/main."
-    (testing "the function zg.core/main.")
+    (testing "the function zg.core/main."
         ; use mock instead of jetty/run-jetty
         (with-redefs [jetty/run-jetty (fn [app port] port)]
-            (is (= {:port 3000} (-main)))))
+            (is (= {:port 3000} (-main))))))

+(deftest test-main-2
+    "Check the function zg.core/main."
+    (testing "the function zg.core/main."
+        ; use mock instead of jetty/run-jetty
+        (with-redefs [jetty/run-jetty (fn [app port] port)]
+            (are [x y] (= x y)
+                {:port 2000} (-main "-p"     "2000")
+                {:port 2000} (-main "--port" "2000")))))
+


Bump ndvi def above the rain def since rain depends on ndvi.


fix test

fix test

--- test/trackif/core_test.clj
+++ test/trackif/core_test.clj
@@ -10,7 +10,7 @@
 (deftest history-price-test
   (with-redefs
     [orch (fn [method key]
-            [{:value {:price 123} :reftime 123123123}
-             {:value {:price 212} :reftime 123123122}])]
-    (is (= '({:time 123123123, :price 123} {:time 123123122, :price 212})
-           (history-price "http://oyanglul.us")))))
+            {:results [{:value {:price 123} :reftime 123123123}
+                       {:value {:price 212} :reftime 123123122}]})
+     (is (= '({:time 123123123, :price 123} {:time 123123122, :price 212})
+            (history-price "http://oyanglul.us")))]))


Update s3 dest key as per agreed format.

--- src/uswitch/bifrost/s3.clj
+++ src/uswitch/bifrost/s3.clj
@@ -1,24 +1,33 @@
 (ns uswitch.bifrost.s3
-  (:require [com.stuartsierra.component :refer (Lifecycle system-map using start stop)]
+  (:require [aws.sdk.s3 :refer (put-object bucket-exists? create-bucket)]
+            [clj-kafka.zk :refer (committed-offset set-offset!)]
+            [clj-time.core :refer (now)]
+            [clj-time.format :as tf]
+            [clojure.core.async :refer [<!! >!! thread timeout]]
+            [clojure.java.io :refer (file)]
+            [clojure.string :as str]
             [clojure.tools.logging :refer (info warn error debug)]
-            [clojure.core.async :refer (<! >! go-loop thread chan close! alts! timeout >!! <!!)]
-            [clojure.java.io :refer (file)]
-            [aws.sdk.s3 :refer (put-object bucket-exists? create-bucket)]
+            [com.stuartsierra.component :refer (Lifecycle system-map using start stop)]
             [metrics.timers :refer (time! timer)]
-            [clj-kafka.zk :refer (committed-offset set-offset!)]
-            [uswitch.bifrost.util :refer (close-channels)]
             [uswitch.bifrost.async :refer (observable-chan map->Spawner)]
             [uswitch.bifrost.telemetry :refer (rate-gauge reset-gauge! stop-gauge! update-gauge!)]
-            [clj-time.core :refer (now)]
-            [clj-time.format :as tf]))
+            [uswitch.bifrost.util :refer (close-channels)]))

 (def buffer-size 100)
 (def key-date-formatter (tf/formatters :basic-date))

+(defn generate-topic-key [topic]
+  (str/replace
+   (if-let [[name idx] (next (re-matches #"(\w+?)(\d+)" topic))]
+     (format "%s/%02d" name (Integer/valueOf idx))
+     topic)
+   #"_"
+   "/" ))
+
 (defn generate-key [topic partition first-offset]
-  (format "%s/%s/partition%02d/%s.baldr.gz"
+  (format "%s/%s/%02d/%s.baldr.gz"
           (tf/unparse key-date-formatter (now))
-          topic
+          (generate-topic-key topic)
           partition
           (format "%010d" first-offset)))


Fix default connection string on figwheel build script.

--- scripts/figwheel.clj
+++ scripts/figwheel.clj
@@ -17,6 +17,7 @@
       :parallel-build false
       :optimizations :none
       :warnings {:ns-var-clash false}
+      :closure-defines {"uxbox.config.url" "https://test.uxbox.io/api"}
       :language-in  :ecmascript6
       :language-out :ecmascript5
       :output-to "resources/public/js/main.js"
@@ -32,6 +33,7 @@
       :parallel-build false
       :optimizations :none
       :warnings {:ns-var-clash false}
+      :closure-defines {"uxbox.config.url" "https://test.uxbox.io/api"}
       :language-in  :ecmascript6
       :language-out :ecmascript5
       :output-to "resources/public/js/view.js"


CMR-222: Added tests for collection search sorting by platform, instrument and sensor.

--- test/cmr/system_int_test/search/collection_sorting_search_test.clj
+++ test/cmr/system_int_test/search/collection_sorting_search_test.clj
@@ -65,7 +65,7 @@
            "-entry_title"
            "-dataset_id"))

-     (testing "temporal start date"
+    (testing "temporal start date"
       (are [sort-key items] (d/refs-match-order?
                               items
                               (search/find-refs :collection {:page-size 20
@@ -106,3 +106,70 @@
          ;; Tests provider sorting for collections
          ["provider" "-entry_title"] [c4 c3 c2 c1 c8 c7 c6 c5]
          ["-provider" "-entry_title"] [c8 c7 c6 c5 c4 c3 c2 c1])))
+
+(deftest collection-platform-sorting-test
+  (let [make-collection (fn [& platforms]
+                          (d/ingest "PROV1"
+                                    (dc/collection
+                                      {:platforms (map dc/platform platforms)})))
+        c1 (make-collection "c10" "c41")
+        c2 (make-collection "c20" "c51")
+        c3 (make-collection "c30")
+        c4 (make-collection "c40")
+        c5 (make-collection "c50")]
+    (index/flush-elastic-index)
+    (are [sort-key items]
+         (d/refs-match-order? items
+                              (search/find-refs :collection {:page-size 20
+                                                             :sort-key sort-key}))
+
+         ;; Descending sorts by the min value of a multi value fields
+         "platform" [c1 c2 c3 c4 c5]
+         ;; Descending sorts by the max value of a multi value fields
+         "-platform" [c2 c5 c1 c4 c3])))
+
+(deftest collection-instrument-sorting-test
+  (let [make-collection (fn [& instruments]
+                          (d/ingest "PROV1"
+                                    (dc/collection
+                                      {:platforms [(apply dc/platform (d/unique-str "platform")
+                                                          (map dc/instrument instruments))]})))
+        c1 (make-collection "c10" "c41")
+        c2 (make-collection "c20" "c51")
+        c3 (make-collection "c30")
+        c4 (make-collection "c40")
+        c5 (make-collection "c50")]
+    (index/flush-elastic-index)
+    (are [sort-key items]
+         (d/refs-match-order? items
+                              (search/find-refs :collection {:page-size 20
+                                                             :sort-key sort-key}))
+
+         ;; Descending sorts by the min value of a multi value fields
+         "instrument" [c1 c2 c3 c4 c5]
+         ;; Descending sorts by the max value of a multi value fields
+         "-instrument" [c2 c5 c1 c4 c3])))
+
+(deftest collection-sensor-sorting-test
+  (let [make-collection (fn [& sensors]
+                          (d/ingest "PROV1"
+                                    (dc/collection
+                                      {:platforms [(dc/platform
+                                                     (d/unique-str "platform")
+                                                     (apply dc/instrument (d/unique-str "instrument")
+                                                            (map dc/sensor sensors)))]})))
+        c1 (make-collection "c10" "c41")
+        c2 (make-collection "c20" "c51")
+        c3 (make-collection "c30")
+        c4 (make-collection "c40")
+        c5 (make-collection "c50")]
+    (index/flush-elastic-index)
+    (are [sort-key items]
+         (d/refs-match-order? items
+                              (search/find-refs :collection {:page-size 20
+                                                             :sort-key sort-key}))
+
+         ;; Descending sorts by the min value of a multi value fields
+         "sensor" [c1 c2 c3 c4 c5]
+         ;; Descending sorts by the max value of a multi value fields
+         "-sensor" [c2 c5 c1 c4 c3])))


Remove rogue newline

Remove rogue newline

--- src/clj/made_merits/service/winner_calculator.clj
+++ src/clj/made_merits/service/winner_calculator.clj
@@ -34,4 +34,3 @@
     (if (more-than-one-winner? users-with-status)
       (mark-everyone-as-a-loser users-with-status)
       users-with-status)))
-


Fix winner modal

Fix winner modal


fix fnil expression: 0 for nil in second position (#854)

--- planck-cljs/src/planck/repl.cljs
+++ planck-cljs/src/planck/repl.cljs
@@ -1971,7 +1971,7 @@
          (if (::as-code? opts)
            planck.pprint.code/pprint
            planck.pprint.data/pprint))
-       value {:width      ((fnil + 0) term-width (::term-width-adj opts))
+       value {:width      ((fnil + 0 0) term-width (::term-width-adj opts))
               :theme      theme
               :spec?      (::spec? opts)
               :keyword-ns (::keyword-ns opts)})


Add OPTIONS handler for results route

Add OPTIONS handler for results route

--- server/src/clinicico/server/handler.clj
+++ server/src/clinicico/server/handler.clj
@@ -110,6 +110,8 @@
 (defresource result-resource
   :available-media-types ["application/json"]
   :available-charsets ["utf-8"]
+  :method-allowed? (request-method-in :options :get)
+  :generate-options-header (fn [_] {"Allow" "OPTIONS, GET"})
   :exists? (fn [ctx]
              (let [id (get-in ctx [:request :params :id])
                    result (store/get-result id)]


All the read-chunk defmethods should have varargs.

--- src/onyx/log/zookeeper.clj
+++ src/onyx/log/zookeeper.clj
@@ -295,70 +295,70 @@
        (zk/set-data conn node bytes version)))))

 (defmethod extensions/read-chunk [ZooKeeper :catalog]
-  [{:keys [conn opts prefix] :as log} kw id _]
+  [{:keys [conn opts prefix] :as log} kw id & _]
   (clean-up-broken-connections
    (fn []
      (let [node (str (catalog-path prefix) "/" id)]
        (decompress (:data (zk/data conn node)))))))

 (defmethod extensions/read-chunk [ZooKeeper :workflow]
-  [{:keys [conn opts prefix] :as log} kw id _]
+  [{:keys [conn opts prefix] :as log} kw id & _]
   (clean-up-broken-connections
    (fn []
      (let [node (str (workflow-path prefix) "/" id)]
        (decompress (:data (zk/data conn node)))))))

 (defmethod extensions/read-chunk [ZooKeeper :flow-conditions]
-  [{:keys [conn opts prefix] :as log} kw id _]
+  [{:keys [conn opts prefix] :as log} kw id & _]
   (clean-up-broken-connections
    (fn []
      (let [node (str (flow-path prefix) "/" id)]
        (decompress (:data (zk/data conn node)))))))

 (defmethod extensions/read-chunk [ZooKeeper :task]
-  [{:keys [conn opts prefix] :as log} kw id _]
+  [{:keys [conn opts prefix] :as log} kw id & _]
   (clean-up-broken-connections
    (fn []
      (let [node (str (task-path prefix) "/" id)]
        (decompress (:data (zk/data conn node)))))))

 (defmethod extensions/read-chunk [ZooKeeper :sentinel]
-  [{:keys [conn opts prefix] :as log} kw id _]
+  [{:keys [conn opts prefix] :as log} kw id & _]
   (clean-up-broken-connections
    (fn []
      (let [node (str (sentinel-path prefix) "/" id)]
        (decompress (:data (zk/data conn node)))))))

 (defmethod extensions/read-chunk [ZooKeeper :bootstrapped-segment]
-  [{:keys [conn opts prefix] :as log} kw id {:keys [task-id]}]
+  [{:keys [conn opts prefix] :as log} kw id & {:keys [task-id]}]
   (clean-up-broken-connections
    (fn []
      (let [node (str (bootstrap-path prefix) "/" task-id "/segment-" id)]
        (decompress (:data (zk/data conn node)))))))

 (defmethod extensions/read-chunk [ZooKeeper :bootstrapped-index]
-  [{:keys [conn opts prefix] :as log} kw id {:keys [task-id]}]
+  [{:keys [conn opts prefix] :as log} kw id & {:keys [task-id]}]
   (clean-up-broken-connections
    (fn []
      (let [node (str (bootstrap-path prefix) "/" task-id "/index")]
        (decompress (:data (zk/data conn node)))))))

 (defmethod extensions/read-chunk [ZooKeeper :origin]
-  [{:keys [conn opts prefix] :as log} kw id _]
+  [{:keys [conn opts prefix] :as log} kw id & _]
   (clean-up-broken-connections
    (fn []
      (let [node (str (origin-path prefix) "/origin")]
        (decompress (:data (zk/data conn node)))))))

 (defmethod extensions/read-chunk [ZooKeeper :job-scheduler]
-  [{:keys [conn opts prefix] :as log} kw id _]
+  [{:keys [conn opts prefix] :as log} kw id & _]
   (clean-up-broken-connections
    (fn []
      (let [node (str (job-scheduler-path prefix) "/scheduler")]
        (decompress (:data (zk/data conn node)))))))

 (defmethod extensions/read-chunk [ZooKeeper :messaging]
-  [{:keys [conn opts prefix] :as log} kw id _]
+  [{:keys [conn opts prefix] :as log} kw id & _]
   (clean-up-broken-connections
    (fn []
      (let [node (str (messaging-path prefix) "/messaging")]


[#427] [Client] Improve performance of `prepare-request-headers` (@bsless)

--- src/org/httpkit/client.clj
+++ src/org/httpkit/client.clj
@@ -25,11 +25,11 @@

 (defn- prepare-request-headers
   [{:keys [headers form-params basic-auth oauth-token user-agent] :as req}]
-  (merge headers
-         (when form-params {"Content-Type"  "application/x-www-form-urlencoded"})
-         (when basic-auth  {"Authorization" (basic-auth-value basic-auth)})
-         (when oauth-token {"Authorization" (str "Bearer " oauth-token)})
-         (when user-agent  {"User-Agent"    user-agent})))
+  (cond-> headers
+    form-params (assoc "Content-Type"  "application/x-www-form-urlencoded")
+    basic-auth  (assoc "Authorization" (basic-auth-value basic-auth))
+    oauth-token (assoc "Authorization" (str "Bearer " oauth-token))
+    user-agent  (assoc "User-Agent"    user-agent)))

 (defn- prepare-response-headers [headers]
   (reduce (fn [m [k v]] (assoc m (keyword k) v)) {} headers))


Start bringing back conditionals. Need logic in emit-program!

--- proto-oct/src/proto_oct/core.clj
+++ proto-oct/src/proto_oct/core.clj
@@ -17,12 +17,15 @@
   (reduce str (map #(emit-code %) s)))

 (defn define
-  ([name value]
+  ([name value condition]
      {:type :define
       :name name
-      :value value})
+      :value value
+      :condition condition})
+  ([name value]
+     (define name value nil))
   ([name]
-     (define name nil)))
+     (define name nil nil)))

 (defemit :define [m]
   (if (:value m)
@@ -30,12 +33,15 @@
     (str "#define " (:name m))))

 (defn include
-  ([file system?]
+  ([file system? condition]
      {:type :include
       :file file
-      :system system?})
+      :system system?
+      :condition condition})
+  ([file system?]
+     (include file system? nil))
   ([file]
-     (include file nil)))
+     (include file false nil)))

 (defemit :include [m]
   (if (:system m)


Add /kv prefix, leave off category

Add /kv prefix, leave off category

--- src/poky/protocol/http.clj
+++ src/poky/protocol/http.clj
@@ -222,8 +222,7 @@
   (let [api-routes (routes
                      (context "/kv" [] (-> (kv-routes kvstore)
                                            (new-relic/wrap-transaction-name
-                                             :category "kv"
-                                             :tx-name-fn #(str "/" (name (:request-method %))))))
+                                             :tx-name-fn #(str "/kv/" (name (:request-method %))))))
                      (context "/multi" [] (-> (multi-routes kvstore)
                                               (new-relic/wrap-transaction-name
                                                 :tx-name-fn #(str "/multi/" (name (:request-method %))))))


Fix CSS nesting

Fix CSS nesting

--- src/braid/client/ui/styles/message.cljs
+++ src/braid/client/ui/styles/message.cljs
@@ -31,26 +31,29 @@
      :position "absolute"
      :border-radius "20%"}]

-   [:.info
+   ["> .info"
     {:height "1rem"
      :margin-left (m/+ avatar-size (rem 0.5))
      :overflow "hidden"
      :white-space "nowrap"}
+
     [:.bot-notice
      {:background-color "#c0afc0"
       :border-radius (px 5)
       :padding (rem 0.25)
       :font-weight "bold"
       :color "#413f42"}]
-      [:.nickname
-       {:display "inline"
-        :font-weight "bold"
-        :text-decoration "none"
-        :color "#000"}]
-      [:.time
-       {:display "inline"
-        :margin-left "0.25rem"
-        :color "#ccc"}]]
+
+    [:.nickname
+     {:display "inline"
+      :font-weight "bold"
+      :text-decoration "none"
+      :color "#000"}]
+
+    [:.time
+     {:display "inline"
+      :margin-left "0.25rem"
+      :color "#ccc"}]]

    ["> .content"
     {:white-space "pre-wrap"


Adding support for asserting an element is empty

--- web-client/test/test_burgerboard/huh.cljs
+++ web-client/test/test_burgerboard/huh.cljs
@@ -85,6 +85,12 @@
     )
   )

+(defn nothing [component]
+  (if (nil? component)
+    true
+    {:msg "non empty container" :expected nil :actual component}
+    )
+  )

 (defn text [text]
   (fn [component]


replaced  with kronecker

replaced  with kronecker

--- src/clj/forma/trends/analysis.clj
+++ src/clj/forma/trends/analysis.clj
@@ -92,13 +92,6 @@
   [coll]
   (apply (partial map vector) coll))

-(defn outer-product
-  "returns a flattened vector of the outer product of a vector and its
-  transpose"
-  [coll]
-  (let [mat (i/matrix coll)]
-    (flatten (i/mmult mat (i/trans mat)))))
-
 (defn element-sum
   "returns a vector of sums of each respective element in a vector of vectors,
   i.e., a vector with the first element being the sum of the first
@@ -114,8 +107,8 @@
   TODO: remove redundancy, keep readability"
   [y & x]
   (let [foc (apply first-order-conditions y x)]
-    [(element-sum (map outer-product (transpose foc)))
-     (element-sum (map outer-product (transpose (map i/cumulative-sum foc))))]))
+    [(element-sum (map i/kronecker (transpose foc)))
+     (element-sum (map i/kronecker (transpose (map i/cumulative-sum foc))))]))

 (defn hansen-stat
   "returns the Hansen (1992) test statistic; number of first-order
@@ -152,7 +145,8 @@
   (map #(* scalar %) coll))

 (defn harmonic-series
-  "return two vectors "
+  "returns a vector of scaled cosine and sine series of the same
+  length as `coll`; the scalar is the harmonic coefficient"
   [freq coll k]
   (let [pds (count coll)
         scalar (/ (* 2 (. Math PI) k) freq)]
@@ -160,6 +154,8 @@
                     (scaled-vector scalar (idx coll))))))

 (defn k-harmonic-matrix
+  "returns an N x (2*k) matrix of harmonic series, where N is the
+  length of `coll` and `k` is the number of harmonic terms."
   [freq k coll]
   (let [degree-vector (vec (map inc (range k)))]
     (apply i/bind-columns
@@ -181,6 +177,8 @@
   (let [S (:fitted (s/linear-model coll (k-harmonic-matrix freq k coll)))]
     (map #(+ (average coll) %)
          (apply (partial map -) [coll S]))))
+
+

 ;; ## WHOOPBANG :: Collect the short-term drop associated with a
 ;; ## time-series


Fix indentation

Fix indentation

--- src/cljs/asciinema_player/vt.cljs
+++ src/cljs/asciinema_player/vt.cljs
@@ -118,7 +118,7 @@
 (defn reduce-param [chars]
   (let [digits (map #(- % 0x30) chars)
         components (map * (reverse digits) (iterate (partial * 10) 1))]
-  (reduce + 0 components)))
+    (reduce + 0 components)))

 (defn get-params [vt]
   (let [chars (get-in vt [:parser :param-chars])


catch compilation errors from clojail

catch compilation errors from clojail

--- src/shuppet/middleware.clj
+++ src/shuppet/middleware.clj
@@ -28,7 +28,7 @@
        (->  (ring-response/response (write-str {:message (e :message)}))
             (ring-response/content-type "application/json")
             (ring-response/status (e :status))))
-     (catch  clojure.lang.Compiler$CompilerException e
+     (catch  java.util.concurrent.ExecutionException e
        (->  (ring-response/response (write-str {:message (.getMessage e)}))
             (ring-response/content-type "application/json")
             (ring-response/status 400)))


return vector

return vector

--- src/cljs/infinitelives/pixi/sprite.cljs
+++ src/cljs/infinitelives/pixi/sprite.cljs
@@ -252,4 +252,5 @@
     container))

 (defn container-transform [container pos]
-  (.applyInverse (.-worldTransform container) pos))
+  (let [p (.applyInverse (.-worldTransform container) pos)]
+    [(.-x p) (.-y p)]))


simplify register-sound!

simplify register-sound!

--- src/cljs/infinitelives/utils/sound.cljs
+++ src/cljs/infinitelives/utils/sound.cljs
@@ -25,19 +25,11 @@
     (.send req)
     c))

-(defn register-sound
-  ([url]
-   (go
-     (when (or (string/ends-with? url ".ogg")
-               (string/ends-with? url ".mp3")
-               (string/ends-with? url ".wav"))
-       (swap! !sounds
-              assoc (string/url-keyword url)
-              (<! (load-sound url))))))
-  ([url obj]
-   (swap! !sounds
-              assoc (string/url-keyword url)
-              obj))
+(defn register-sound!
+  [url obj]
+  (swap! !sounds
+         assoc (string/url-keyword url)
+         obj)
 )

 (defn get-sound [key]


dialog switch confirmation btns

dialog switch confirmation btns

--- src/cljs/swarmpit/component/dialog.cljs
+++ src/cljs/swarmpit/component/dialog.cljs
@@ -26,13 +26,13 @@
       (comp/dialog-actions
         {}
         (comp/button
+          {:onClick #(state/update-value [:open] false dialog-cursor)
+           :color   "primary"} "Cancel")
+        (comp/button
           {:onClick (fn []
                       (action-fn)
                       (state/update-value [:open] false dialog-cursor))
-           :color   "primary"} "Ok")
-        (comp/button
-          {:onClick #(state/update-value [:open] false dialog-cursor)
-           :color   "primary"} "Cancel")))))
+           :color   "primary"} "Ok")))))

 (rum/defc form-dialog < rum/reactive [action-fn form dialog-title]
   (let [{:keys [open]} (state/react dialog-cursor)]


CMR-760: Added filter for deleted concepts on get by concept id.

--- src/cmr/search/services/transformer.clj
+++ src/cmr/search/services/transformer.clj
@@ -122,8 +122,11 @@
                                            (acl-service/filter-concepts
                                              context
                                              (map add-acl-enforcement-fields concepts))))
-         [t3 values] (u/time-execution (mapv #(concept->value-map % format) concepts))]
+         ;; Filtering deleted concepts
+         [t3 concepts] (u/time-execution (filter #(not (:deleted %)) concepts))
+         [t4 values] (u/time-execution (mapv #(concept->value-map % format) concepts))]
      (debug "get-latest-concepts time:" t1
             "acl-filter-concepts time:" t2
-            "concept->value-map time:" t3)
+            "tombstone-filter time:" t3
+            "concept->value-map time:" t4)
      values)))


Refactored some logic in live-neighbors-count into private function, neighbor-cells; renamed local 'cell' to 'target-cell'.

--- src/conways_game_of_life/grid.clj
+++ src/conways_game_of_life/grid.clj
@@ -12,17 +12,21 @@
   [grid [x y :as cell]]
   (get (get grid x) y))

+(defn- neighbor-cells
+  [grid [cx cy :as target-cell]]
+  (for [x (range (- cx 1) (+ cx 2))
+        y (range (- cy 1) (+ cy 2))
+        :when (not= target-cell (list x y))]
+    (vector x y)))
+
 (defn live-neighbors-count
-  [grid [cx cy :as cell]]
+  [grid [cx cy :as target-cell]]
   (count
    (filter
     (partial = 1)
     (map
      (partial value-at-cell grid)
-     (for [x (range (- cx 1) (+ cx 2))
-           y (range (- cy 1) (+ cy 2))
-           :when (not= cell (list x y))]
-       (vector x y))))))
+     (neighbor-cells grid target-cell)))))

 (defn next-generation
   [grid]


Require backend and util instead of using them

--- src/de/kotka/vimclojure/nails.clj
+++ src/de/kotka/vimclojure/nails.clj
@@ -22,19 +22,11 @@

 (clojure.core/ns de.kotka.vimclojure.nails
   (:use
-     (de.kotka.vimclojure [util :only (with-command-line
-                                       clj->vim
-                                       safe-var-get
-                                       decide-completion-in
-                                       pretty-print
-                                       pretty-print-code
-                                       make-completion-item
-                                       resolve-and-load-namespace
-                                       stream->seq)]
-                          backend)
      [clojure.contrib.def :only (defvar)])
   (:require
-     [de.kotka.vimclojure.repl :as repl])
+     (de.kotka.vimclojure [repl :as repl]
+                          [util :as util]
+                          [backend :as backend]))
   (:import
      com.martiansoftware.nailgun.NGContext
      clojure.lang.LineNumberingPushbackReader
@@ -65,7 +57,7 @@
                            LineNumberingPushbackReader.)
                  ~'*out* (-> ~'nailContext .out OutputStreamWriter.)
                  ~'*err* (-> ~'nailContext .err PrintWriter.)]
-         (with-command-line (.getArgs ~'nailContext)
+         (util/with-command-line (.getArgs ~'nailContext)
            ~usage
            ~arguments
            ~@body)
@@ -75,9 +67,9 @@
 (defnail DocLookup
   "Usage: ng de.kotka.vimclojure.nails.DocString [options]"
   [[nspace n "Lookup the symbols in the given namespace." "user"]]
-  (let [nspace  (resolve-and-load-namespace nspace)
+  (let [nspace  (util/resolve-and-load-namespace nspace)
         symbols (map symbol (line-seq (BufferedReader. *in*)))]
-    (print (doc-lookup nspace symbols))
+    (print (backend/doc-lookup nspace symbols))
     (flush)))

 (defnail FindDoc
@@ -90,27 +82,30 @@
 (defnail JavadocPath
   "Usage: ng de.kotka.vimclojure.nails.JavadocPath [options]"
   [[nspace n "Lookup the symbols in the given namespace." "user"]]
-  (let [nspace         (resolve-and-load-namespace nspace)
+  (let [nspace         (util/resolve-and-load-namespace nspace)
         our-ns-resolve #(ns-resolve nspace %)]
-    (doseq [path (map #(-> % symbol our-ns-resolve javadoc-path-for-class)
-                      (stream->seq *in*))]
+    (doseq [path (map #(-> %
+                         symbol
+                         our-ns-resolve
+                         backend/javadoc-path-for-class)
+                      (util/stream->seq *in*))]
       (println path))))

 (defnail MetaLookup
   "Usage: ng de.kotka.vimclojure.nails.MetaLookup [options]"
   [[nspace n "Lookup the symbols in the given namespace." "user"]]
-  (let [nspace         (resolve-and-load-namespace nspace)
+  (let [nspace         (util/resolve-and-load-namespace nspace)
         our-ns-resolve #(ns-resolve nspace %)]
     (doseq [metainfo (map #(-> % symbol our-ns-resolve meta)
-                     (stream->seq *in*))]
-      (pretty-print metainfo))))
+                     (util/stream->seq *in*))]
+      (util/pretty-print metainfo))))

 (defnail DynamicHighlighting
   "Usage: ng de.kotka.vimclojure.nails.DynamicHighlighting"
   []
   (let [nspace    (read)
         c-c       (the-ns 'clojure.core)
-        the-space (resolve-and-load-namespace nspace)
+        the-space (util/resolve-and-load-namespace nspace)
         refers    (remove #(= c-c (-> % second meta :ns)) (ns-refers the-space))
         aliases   (mapcat (fn [[the-alias the-alias-space]]
                             (map #(vector (symbol (name the-alias)
@@ -128,7 +123,7 @@
         vars      (set (concat refers aliases namespaces))
         macros    (set (filter #(-> % second meta :macro) vars))
         vars      (clojure.set/difference vars macros)
-        fns       (set (filter #(let [v (safe-var-get (second %))]
+        fns       (set (filter #(let [v (util/safe-var-get (second %))]
                                   (or (fn? v)
                                       (instance? clojure.lang.MultiFn v)))
                                vars))
@@ -136,14 +131,14 @@
     (-> (hash-map "Func"     (map first fns)
                   "Macro"    (map first macros)
                   "Variable" (map first vars))
-      clj->vim
+      util/clj->vim
       println)))

 (defnail NamespaceOfFile
   "Usage: ng de.kotka.vimclojure.nails.NamespaceOfFile"
   []
   (let [of-interest '#{in-ns ns clojure.core/in-ns clojure.core/ns}
-        in-seq      (stream->seq *in*)
+        in-seq      (util/stream->seq *in*)
         candidate   (first
                       (drop-while #(or (not (instance? clojure.lang.ISeq %))
                                        (not (contains? of-interest (first %))))
@@ -159,20 +154,20 @@
 (defnail NamespaceInfo
   "Usage: ng de.kotka.vimclojure.nails.NamespaceInfo"
   []
-  (println (clj->vim (map #(-> % symbol find-ns ns-info)
-                          (line-seq (BufferedReader. *in*))))))
+  (println (util/clj->vim (map #(-> % symbol find-ns backend/ns-info)
+                               (line-seq (BufferedReader. *in*))))))

 (defnail MacroExpand
   "Usage: ng de.kotka.vimclojure.nails.MacroExpand [options]"
   [[nspace n "Lookup the symbols in the given namespace." "user"]
    [one?   o "Expand only the first macro."]]
-  (let [nspace (resolve-and-load-namespace nspace)
+  (let [nspace (util/resolve-and-load-namespace nspace)
         expand (if one
                  #(macroexpand-1 %)
                  #(macroexpand %))]
     (binding [*ns* nspace]
-      (doseq [expr (stream->seq *in*)]
-        (-> expr expand pretty-print-code)))))
+      (doseq [expr (util/stream->seq *in*)]
+        (-> expr expand util/pretty-print-code)))))

 (defnail Repl
   "Usage: ng de.kotka.vimclojure.nails.Repl [options]"
@@ -186,7 +181,7 @@
   (let [id     (Integer/parseInt id)
         line   (Integer/parseInt line)
         nspace (when (not= nspace "")
-                 (resolve-and-load-namespace nspace))]
+                 (util/resolve-and-load-namespace nspace))]
     (cond
       start (println (repl/start))
       stop  (repl/stop id)
@@ -196,7 +191,7 @@
   "Usage: ng de.kotka.vimclojure.nails.CheckSyntax"
   []
   (try
-    (dorun (stream->seq *in*))
+    (dorun (util/stream->seq *in*))
     (println true)
     (catch Exception e
       (println false))))
@@ -206,11 +201,12 @@
   [[nspace n "Start completion in this namespace." "user"]
    [prefix p "Prefix used for the match, ie. the part before /." ""]
    [base   b "Base pattern to be matched."]]
-  (let [nspace (resolve-and-load-namespace nspace)
+  (let [nspace (util/resolve-and-load-namespace nspace)
         prefix (symbol prefix)]
     (if-not (and (= base "") (= prefix ""))
-      (let [to-complete (decide-completion-in nspace prefix base)
-            completions (mapcat #(complete % nspace prefix base) to-complete)
-            completions (map #(apply make-completion-item %) completions)]
-        (println (clj->vim completions)))
+      (let [to-complete (util/decide-completion-in nspace prefix base)
+            completions (mapcat #(backend/complete % nspace prefix base)
+                                to-complete)
+            completions (map #(apply util/make-completion-item %) completions)]
+        (println (util/clj->vim completions)))
       (println "[]"))))


Remove call to try-dispatch from main fn

--- src/tailrecursion/boot.clj
+++ src/tailrecursion/boot.clj
@@ -55,5 +55,4 @@
             *data-readers* {'boot/configuration #'configure}]
     (alias 'tmp 'tailrecursion.boot.tmpregistry)
     (alias 'boot 'tailrecursion.boot)
-    (load-file "boot.clj")
-    (dispatch/try-dispatch @env *command-line-args*)))
+    (load-file "boot.clj")))


pass a limit on high-level select-one

pass a limit on high-level select-one

--- src/er_cassandra/model/select.clj
+++ src/er_cassandra/model/select.clj
@@ -141,7 +141,11 @@

   ([session ^Model model key record-or-key-value opts]
    (m/with-monad dm/deferred-monad
-     (m/mlet [records (select session model key record-or-key-value opts)]
+     (m/mlet [records (select session
+                              model
+                              key
+                              record-or-key-value
+                              (merge opts {:limit 1}))]
              (m/return (first records))))))

 (defn select-many


Fix function call.

Fix function call.

--- src/lexemic/sentiment/simple.cljs
+++ src/lexemic/sentiment/simple.cljs
@@ -3,13 +3,13 @@
         [cljs.reader :only [read-string]])
   (:require [lexemic.data.sentiment :as data]))

-(defn collect-matches [tokens lexicon]
+(defn- collect-matches [tokens lexicon]
   (vec
    (for [token tokens
          :when (contains? lexicon token)]
      token)))

-(defn rate [phrase lexicon]
+(defn- rate [phrase lexicon]
   (let [tokens (split (lower-case phrase) #"\s+")
         matches (collect-matches tokens lexicon)
         hits (count matches)])
@@ -23,7 +23,7 @@

 (defn analyse [phrase]
   (let [negative (negative-rating phrase)
-        positive (positive-ration phrase)]
+        positive (positive-rating phrase)]
     {:score (- (positive :score) (negative :score))
      :comparative (- (positive :comparative) (negative :comparative))
      :positive positive


Explicitly require clara.rules macros in the main clara.rules namespace.

--- src/main/clojure/clara/rules.cljc
+++ src/main/clojure/clara/rules.cljc
@@ -4,7 +4,8 @@
             [schema.core :as s]
             #?(:cljs [clara.rules.listener :as l])
             #?(:clj [clara.rules.compiler :as com])
-            #?(:clj [clara.rules.dsl :as dsl])))
+            #?(:clj [clara.rules.dsl :as dsl]))
+  #?(:cljs (:require-macros clara.rules)))

 (defn insert
   "Inserts one or more facts into a working session. It does not modify the given


expose all lang-in/out Closure options

expose all lang-in/out Closure options

--- src/main/clojure/cljs/closure.clj
+++ src/main/clojure/cljs/closure.clj
@@ -177,12 +177,20 @@

   (when (contains? opts :language-in)
     (case (:language-in opts)
+      :no-transpile       (.setLanguageIn compiler-options CompilerOptions$LanguageMode/NO_TRANSPILE)
+      :ecmascript6        (.setLanguageIn compiler-options CompilerOptions$LanguageMode/ECMASCRIPT6)
+      :ecmascript6-strict (.setLanguageIn compiler-options CompilerOptions$LanguageMode/ECMASCRIPT6_STRICT)
+      :ecmascript6-typed  (.setLanguageIn compiler-options CompilerOptions$LanguageMode/ECMASCRIPT6_TYPED)
       :ecmascript5        (.setLanguageIn compiler-options CompilerOptions$LanguageMode/ECMASCRIPT5)
       :ecmascript5-strict (.setLanguageIn compiler-options CompilerOptions$LanguageMode/ECMASCRIPT5_STRICT)
       :ecmascript3        (.setLanguageIn compiler-options CompilerOptions$LanguageMode/ECMASCRIPT3)))

   (when (contains? opts :language-out)
     (case (:language-out opts)
+      :no-transpile       (.setLanguageOut compiler-options CompilerOptions$LanguageMode/NO_TRANSPILE)
+      :ecmascript6        (.setLanguageOut compiler-options CompilerOptions$LanguageMode/ECMASCRIPT6)
+      :ecmascript6-strict (.setLanguageOut compiler-options CompilerOptions$LanguageMode/ECMASCRIPT6_STRICT)
+      :ecmascript6-typed  (.setLanguageOut compiler-options CompilerOptions$LanguageMode/ECMASCRIPT6_TYPED)
       :ecmascript5        (.setLanguageOut compiler-options CompilerOptions$LanguageMode/ECMASCRIPT5)
       :ecmascript5-strict (.setLanguageOut compiler-options CompilerOptions$LanguageMode/ECMASCRIPT5_STRICT)
       :ecmascript3        (.setLanguageOut compiler-options CompilerOptions$LanguageMode/ECMASCRIPT3)))


+:note

+:note

--- src/babel/reader.clj
+++ src/babel/reader.clj
@@ -451,7 +451,8 @@
              (= k :present)
              (= k :1sing)
              (= k :2sing)
-             (= k :3sing))
+             (= k :3sing)
+             (= k :note))
          (not (map? v)))
     (str v)


s/println/log/

s/println/log/

--- src/babel/repair.clj
+++ src/babel/repair.clj
@@ -16,12 +16,12 @@
                          (do
                            (if (:sql member-of-unit)
                              (do
-                               (println (str "doing sql: " (:sql member-of-unit)))
+                               (log/debug (str "doing sql: " (:sql member-of-unit)))
                                (exec-raw (:sql member-of-unit))))

                            (if (:fill member-of-unit)
                              (let [count (or (->> member-of-unit :fill :count) 10)]
-                               (println (str "doing fill-by-spec: " (->> member-of-unit :fill :spec)
+                               (log/debug (str "doing fill-by-spec: " (->> member-of-unit :fill :spec)
                                              "; count=" count))
                                (fill-by-spec
                                 (->> member-of-unit :fill :spec)


fix variable ordering

fix variable ordering

--- src/babel/writer.clj
+++ src/babel/writer.clj
@@ -6,7 +6,7 @@
     [clojure.data.json :as json]
     [clojure.string :as string]
     [clojure.tools.logging :as log]
-    [dag-unify.core :refer [get-in strip-refs serialize unify ref?]]
+    [dag-unify.core :refer [get-in merge strip-refs serialize unify ref?]]
     [babel.engine :as engine]
     [babel.korma :as korma]
     [korma.core :refer [exec-raw]]))
@@ -44,6 +44,7 @@
         no-target-language (if (nil? target-language-model)
                              (throw (Exception. "No target language model was supplied.")))

+        ;; 1. generate sentence in target language.
         ;; resolve future
         target-language-model (if (future? target-language-model)
                                 @target-language-model
@@ -52,9 +53,8 @@
         target-language-sentence (engine/generate spec target-language-model :enrich true)

         target-language-sentence (if (:morph-walk-tree target-language-model)
-                                   (do
-                                     ((:morph-walk-tree target-language-model) target-language-sentence)
-                                     target-language-sentence)
+                                   (merge ((:morph-walk-tree target-language-model) target-language-sentence)
+                                          target-language-sentence)
                                    (do (log/warn (str "there is no morph-walk-tree function for the model:"
                                                       (:name target-language-model) " of language: "
                                                       (:language target-language-model)))
@@ -68,31 +68,15 @@
                                                   {:synsem {:sem {:subj subj}}}))
                                          true
                                          target-language-sentence))
+        target-fo (:morph target-language-model)
+
+        semantics (strip-refs (get-in target-language-sentence [:synsem :sem] :top))
+
+        ;; 2. generate sentence in source language using semantics of sentence in target language.
         ;; resolve future
         source-language-model (if (future? source-language-model)
                                 @source-language-model
                                 source-language-model)
-
-        source-fo (:morph source-language-model)
-        target-fo (:morph target-language-model)
-
-        ;; TODO: add warning if semantics of target-expression is merely :top - it's
-        ;; probably not what the caller expected. Rather it should be something more
-        ;; specific, like {:pred :eat :subj {:pred :antonio}} ..etc.
-        source-language-sentence (engine/generate (get-in target-language-sentence
-                                                          [:synsem :sem] :top)
-                                                  source-language-model :enrich true)
-
-        source-language-sentence (if (:morph-walk-tree source-language-model)
-                                   (do
-                                     ((:morph-walk-tree source-language-model) source-language-sentence)
-                                     source-language-sentence)
-                                   (do (log/warn (str "there is no morph-walk-tree function for the model:"
-                                                      (:name source-language-model) " of language: "
-                                                      (:language source-language-model)))
-                                       source-language-sentence))
-
-        semantics (strip-refs (get-in target-language-sentence [:synsem :sem] :top))
         debug (log/debug (str "semantics of resulting expression: " semantics))
         debug (log/trace (str "entire expression: " target-language-sentence))

@@ -100,10 +84,10 @@
         debug (log/debug (str "target surface: " target-language-surface))

         source-language (:language source-language-model)
-        target-language (:language target-language-model)
         error (if (or (nil? target-language-surface)
                       (= target-language-surface ""))
-                (let [message (str "Could not generate a sentence in target language '" target-language
+                (let [message (str "Could not generate a sentence in source language '"
+                                   (:language source-language-model)
                                    "' for this spec: " spec)]
                   (if (= true mask-populate-errors)
                     (log/warn message)
@@ -119,17 +103,29 @@
                       ;; an entire sentence.

                       (throw (Exception. message))))))
-        source-language-sentence (engine/generate {:synsem {:sem semantics
-                                                            :subcat '()}}
-                                                  source-language-model
-                                                  :enrich true)
+
+        ;; TODO: add warning if semantics of target-expression is merely :top - it's
+        ;; probably not what the caller expected. Rather it should be something more
+        ;; specific, like {:pred :eat :subj {:pred :antonio}} ..etc.
+        source-language-sentence (engine/generate {:synsem {:sem semantics}}
+                                                  source-language-model :enrich true)
+
+        source-language-sentence (if (:morph-walk-tree source-language-model)
+                                   (merge ((:morph-walk-tree source-language-model) source-language-sentence)
+                                          source-language-sentence)
+                                   (do (log/warn (str "there is no morph-walk-tree function for the model:"
+                                                      (:name source-language-model) " of language: "
+                                                      (:language source-language-model)))
+                                       source-language-sentence))
+
+        source-fo (:morph source-language-model)
         source-language-surface (source-fo source-language-sentence)
         debug (log/debug (str "source surface: " source-language-surface))

         error (if (or (nil? source-language-surface)
                       (= source-language-surface ""))
                 (let [message (str "Could not generate a sentence in source language '" source-language
-                                   "' for this semantics: " semantics "; target language was: " target-language
+                                   "' for this semantics: " semantics "; target language was: " (:language target-language-model)
                                    "; target expression was: '" ((:morph  @target-language-model) target-language-sentence) "'"
                                    "; target rule was: '" (:rule target-language-sentence) "'"
                                    "; target head rule was: '" (:rule (:head target-language-sentence)) "'"


Nicer logging when we clear uncommitted jobs.

--- scheduler/src/cook/mesos/util.clj
+++ scheduler/src/cook/mesos/util.clj
@@ -690,6 +690,9 @@
       (throw (ex-info "There is overlap between committed and uncommitted jobs, there is something wrong!"
                       {:count-committed (count committed-jobs)
                        :count-uncommitted (count uncommitted-jobs)})))
+    (if dry-run?
+      (log/info "clear-uncommitted-jobs would delete" (count uncommitted-before) "uncommitted jobs submitted before" submitted-before)
+      (log/info "clear-uncommitted-jobs is deleting" (count uncommitted-before) "uncommitted jobs submitted before" submitted-before))
     (when-not dry-run?
       (doseq [batch (partition-all 100 uncommitted-before)]
         @(d/transact conn (mapv #(vector :db.fn/retractEntity (:db/id %))


performance improvements

performance improvements

--- src/clj/neb/cell.clj
+++ src/clj/neb/cell.clj
@@ -126,21 +126,19 @@
               array-format? (and nested-format? (= :ARRAY (first array-format)))
               type-format? (and (keyword array-format) (get @data-types array-format))
               nested-map-format? (and nested-format? (not array-format?))
-              require-packing? (or array-format? type-format?)]
+              require-packing? (or array-format? type-format?)
+              nested-schema (when (and (not nested-map-format?) (not require-packing?)) (:f (schema-by-sname array-format)))
+              repeat-func (cond
+                            nested-map-format?
+                            #(recur-nested array-format)
+                            nested-schema
+                            #(recur-nested nested-schema)
+                            require-packing?
+                            #(:d (recur-nested [[:d array-format]])))]
           (.advancePointer cell-reader type_lengths/intLen)
           (apply
             array-func
-            (doall
-              (repeatedly
-                array-len
-                (fn []
-                  (cond
-                    nested-map-format?
-                    (recur-nested array-format)
-                    :else
-                    (if require-packing?
-                      (:d (recur-nested [[:d array-format]]))
-                      (recur-nested (:f (schema-by-sname array-format))))))))))))))
+            (doall (repeatedly array-len repeat-func))))))))

 (defn walk-schema-for-write
   "It was assumed to have some side effect"
@@ -170,17 +168,16 @@
                        type-format? (and (keyword array-format) (get @data-types array-format))
                        nested-map-format? (and nested-format? (not array-format?))
                        require-packing? (or array-format? type-format?)
+                       nested-schema (when (and (not nested-map-format?) (not require-packing?)) (:f (schema-by-sname array-format)))
+                       map-func (cond
+                                  nested-map-format?
+                                  (partial recur-nested array-format)
+                                  nested-schema
+                                  (partial recur-nested nested-schema)
+                                  require-packing?
+                                  #(recur-nested [[:d array-format]] {:d %}))
                        array-content
-                       (doall (map
-                                (fn [item]
-                                  (cond
-                                    nested-map-format?
-                                    (recur-nested array-format item)
-                                    :else
-                                    (if require-packing?
-                                      (recur-nested [[:d array-format]] {:d item})
-                                      (recur-nested (:f (schema-by-sname array-format)) item))))
-                                array-items))]
+                       (doall (map map-func array-items))]
                    (apply array-func array-name array-format array-header array-content))
                  (recur-nested field-format (get data field-name)))
                (is-type? field-format)


Add a missing comma in a map literal

Add a missing comma in a map literal

--- src/cljam/io/csi.clj
+++ src/cljam/io/csi.clj
@@ -81,7 +81,7 @@
     (->> #(let [bin (lsb/read-int rdr)
                 loffset (lsb/read-long rdr)
                 chunks (read-chunks! rdr)]
-            {:bin (long bin) :loffset loffset, :chunks chunks})
+            {:bin (long bin), :loffset loffset, :chunks chunks})
          (repeatedly n-ref)
          vec)))


fix tests

fix tests

--- test/citrus/core_test.cljs
+++ test/citrus/core_test.cljs
@@ -82,7 +82,7 @@

   (testing "dispatch-sync! a non-existing event fails"
     (is (thrown-with-msg? js/Error
-                          #"Assert failed: Controller :test doesn't declare :non-existing-event method"
+                          #"No method .* for dispatch value: :non-existing-event"
                           (citrus/dispatch-sync! r :test :non-existing-event)))))

@@ -101,7 +101,7 @@

   (testing "broadcast-sync! a non-existing event fails"
     (is (thrown-with-msg? js/Error
-                          #"Assert failed: Controller :test doesn't declare :non-existing-event method"
+                          #"No method .* for dispatch value: :non-existing-event"
                           (citrus/broadcast-sync! r :non-existing-event)))))

@@ -123,9 +123,12 @@
                                             (done)))))

   (testing "dispatch! an non-existing event fails"
-    (is (thrown-with-msg? js/Error
-                          #"Assert failed: Controller :test doesn't declare :non-existing-dispatch method"
-                          (citrus/dispatch! r :test :non-existing-dispatch)))))
+    (let [err-handler (fn [err] (is (re-find #"No method .* for dispatch value: :non-existing-dispatch" (.toString err))))]
+      (obj/set js/window "onerror" err-handler)
+      (citrus/dispatch! r :test :non-existing-dispatch)
+      (async done (js/requestAnimationFrame (fn []
+                                              (obj/set js/window "onerror" nil)
+                                              (done)))))))

 (deftest broadcast!
@@ -150,9 +153,12 @@
                                             (done)))))

   (testing "broadcast! an non-existing event fails"
-    (is (thrown-with-msg? js/Error
-                          #"Assert failed: Controller :test doesn't declare :non-existing-broadcast method"
-                          (citrus/broadcast! r :non-existing-broadcast)))))
+    (let [err-handler (fn [err] (is (re-find #"No method .* for dispatch value: :non-existing-broadcast" (.toString err))))]
+      (obj/set js/window "onerror" err-handler)
+      (citrus/broadcast! r :non-existing-broadcast)
+      (async done (js/requestAnimationFrame (fn []
+                                              (obj/set js/window "onerror" nil)
+                                              (done)))))))

 (deftest dispatch-nil-state-issue-20
   ;https://github.com/roman01la/citrus/issues/20


add samsara.version in uberjar

add samsara.version in uberjar

Whilst looking into how to do this found
https://github.com/m0smith/lein-resource which may be useful in the
future ?

--- ingestion-api/project.clj
+++ ingestion-api/project.clj
@@ -30,7 +30,7 @@

   :main ingestion-api.main

-  :profiles {:uberjar {:aot :all}
+  :profiles {:uberjar {:aot :all :resource-paths ["../samsara.version"]}
              :dev {:dependencies [[midje "1.6.3"]
                                   [clj-http "2.1.0"]
                                   [clojurewerkz/machine_head "1.0.0-beta9"]


Whitespace changes only

Whitespace changes only

--- modules/messaging/src/main/clojure/immutant/messaging.clj
+++ modules/messaging/src/main/clojure/immutant/messaging.clj
@@ -25,7 +25,8 @@
             [immutant.registry         :as reg]))

 (defn start
-  "Create a message destination; name should be prefixed with either /queue or /topic"
+  "Create a message destination; name should be prefixed with either
+   /queue or /topic"
   [name & opts]
   (cond
    (queue-name? name) (apply start-queue name opts)
@@ -34,26 +35,26 @@

 (defn publish
   "Send a message to a destination. dest can either be the name of the
-destination or a javax.jms.Destination. If the message is a javax.jms.Message,
-then the message is sent without modification to dest. Returns the JMS message
-object that was published.
+   destination or a javax.jms.Destination. If the message is a
+   javax.jms.Message, then the message is sent without modification to
+   dest. Returns the JMS message object that was published.

-The following options are supported [default]:
-  :encoding        :clojure :json or :text [:clojure]
-  :priority        0-9 or :low :normal :high :critical [4]
-  :ttl             time to live, in ms [0=forever]
-  :persistent      whether undelivered messages survive restarts [true]
-  :properties      a hash to which selectors may be applied [nil]
-  :correlation-id  used to set the JMSCorrelationID (see
-                   http://docs.oracle.com/javaee/6/api/javax/jms/Message.html#setJMSCorrelationID(java.lang.String) [nil]
-  :host           the remote host to connect to (default is to connect in-vm)
-                  [nil]
-  :port           the remote port to connect to (requires :host to be set)
-                  [nil, or 5445 if :host is set]
-  :username       the username to use to auth the connection (requires :password
-                  to be set) [nil]
-  :password       the password to use to auth the connection (requires :username
-                  to be set) [nil]"
+   The following options are supported [default]:
+     :encoding        :clojure :json or :text [:clojure]
+     :priority        0-9 or :low :normal :high :critical [4]
+     :ttl             time to live, in ms [0=forever]
+     :persistent      whether undelivered messages survive restarts [true]
+     :properties      a hash to which selectors may be applied [nil]
+     :correlation-id  used to set the JMSCorrelationID [nil]
+                      see http://docs.oracle.com/javaee/6/api/javax/jms/Message.html#setJMSCorrelationID(java.lang.String)
+     :host            the remote host to connect to (default is to connect in-vm)
+                      [nil]
+     :port            the remote port to connect to (requires :host to be set)
+                      [nil, or 5445 if :host is set]
+     :username        the username to use to auth the connection (requires :password
+                      to be set) [nil]
+     :password        the password to use to auth the connection (requires :username
+                      to be set) [nil]"
   [dest message & {:as opts}]
   (with-connection opts
     (let [session (session)
@@ -69,21 +70,21 @@
       encoded)))

 (defn receive
-  "Receive a message from a destination. dest can either be the name of the
-destination or a javax.jms.Destination.
+  "Receive a message from a destination. dest can either be the name
+   of the destination or a javax.jms.Destination.

-The following options are supported [default]:
-  :timeout    time in ms, after which nil is returned [10000]
-  :selector   A JMS (SQL 92) expression matching message properties
-  :decode?    if true, the decoded message body is returned. Otherwise, the
-              javax.jms.Message object is returned [true]
-  :host       the remote host to connect to (default is to connect in-vm) [nil]
-  :port       the remote port to connect to (requires :host to be set) [nil, or
-              5445 if :host is set]
-  :username   the username to use to auth the connection (requires :password to
-              be set) [nil]
-  :password   the password to use to auth the connection (requires :username to
-              be set) [nil]"
+   The following options are supported [default]:
+     :timeout    time in ms, after which nil is returned [10000]
+     :selector   A JMS (SQL 92) expression matching message properties
+     :decode?    if true, the decoded message body is returned. Otherwise, the
+                 javax.jms.Message object is returned [true]
+     :host       the remote host to connect to (default is to connect in-vm) [nil]
+     :port       the remote port to connect to (requires :host to be set) [nil, or
+                 5445 if :host is set]
+     :username   the username to use to auth the connection (requires :password to
+                 be set) [nil]
+     :password   the password to use to auth the connection (requires :username to
+                 be set) [nil]"
   [dest & {:keys [timeout selector decode?] :or {timeout 10000 decode? true} :as opts}]
   (with-connection opts
     (let [session (session)
@@ -94,26 +95,28 @@
         (codecs/decode-if decode? encoded)))))

 (defn message-seq
-  "A lazy sequence of messages received from a destination. Accepts same options as receive"
+  "A lazy sequence of messages received from a destination. Accepts
+   same options as receive"
   [dest & opts]
   (lazy-seq (cons (apply receive dest opts) (message-seq dest))))

 (defn listen
-  "The handler function, f, will receive each message sent to dest. dest can
-either be the name of the destination or a javax.jms.Destination.
+  "The handler function, f, will receive each message sent to dest.
+   dest can either be the name of the destination or a
+   javax.jms.Destination.

-The following options are supported [default]:
-  :concurrency  the number of threads handling messages [1]
-  :selector     A JMS (SQL 92) expression matching message properties
-  :decode?      if true, the decoded message body is passed to f. Otherwise, the
-                javax.jms.Message object is passed [true]
-  :host         the remote host to connect to (default is to connect in-vm) [nil]
-  :port         the remote port to connect to (requires :host to be set) [nil,
-                or 5445 if :host is set]
-  :username     the username to use to auth the connection (requires :password
-                to be set) [nil]
-  :password     the password to use to auth the connection (requires :username
-                to be set) [nil]"
+   The following options are supported [default]:
+     :concurrency  the number of threads handling messages [1]
+     :selector     A JMS (SQL 92) expression matching message properties
+     :decode?      if true, the decoded message body is passed to f. Otherwise, the
+                   javax.jms.Message object is passed [true]
+     :host         the remote host to connect to (default is to connect in-vm) [nil]
+     :port         the remote port to connect to (requires :host to be set) [nil,
+                   or 5445 if :host is set]
+     :username     the username to use to auth the connection (requires :password
+                   to be set) [nil]
+     :password     the password to use to auth the connection (requires :username
+                   to be set) [nil]"
   [dest f & {:keys [concurrency selector decode?] :or {concurrency 1 decode? true} :as opts}]
   (let [connection (.createXAConnection (connection-factory opts)
                                         (:username opts)
@@ -140,11 +143,13 @@

 (defn request
   "Send a message to queue and return a delay that will retrieve the response.
-Implements the request-response pattern, and is used in conjunction with respond.
-queue can either be the name of the queue or a javax.jms.Queue.
-In addition to the same options as publish, it also accepts [default]:
-   :timeout  time in ms for the delayed receive to wait once it it is
-             dereferenced, after which nil is returned [10000]"
+   Implements the request-response pattern, and is used in conjunction
+   with respond. The queue parameter can either be the name of a
+   queue or an actual javax.jms.Queue.
+
+   It takes the same options as publish, and one more [default]:
+     :timeout  time in ms for the delayed receive to wait once it it is
+               dereferenced, after which nil is returned [10000]"
   [queue message & {:as opts}]
   {:pre [(queue? queue)]}
   (let [^javax.jms.Message message (mapply publish queue message
@@ -156,11 +161,12 @@
                :selector (str "JMSCorrelationID='" (.getJMSMessageID message) "'"))))))

 (defn respond
-  "Listen for messages on queue sent by the request function and respond with the
-result of applying f to the message. queue can either be the name of the
-queue or a javax.jms.Queue. Accepts the same options as listen."
-  [queue f & {:keys [decode?] :or {decode? true} :as opts}]
-  {:pre [(queue? queue)]}
+  "Listen for messages on queue sent by the request function and
+   respond with the result of applying f to the message. queue can
+   either be the name of the queue or a javax.jms.Queue. Accepts the
+   same options as listen."
+  [queue f & {:keys [decode?] :or {decode?
+   true} :as opts}] {:pre [(queue? queue)]}
   (letfn [(respond* [^javax.jms.Message msg]
             (publish (.getJMSDestination msg)
                      (f (codecs/decode-if decode? msg))
@@ -174,15 +180,15 @@

 (defn unlisten
   "Pass the result of a call to listen or respond to de-register the handler.
-You only need to do this if you wish to stop the handler's destination before
-your app is undeployed."
+   You only need to do this if you wish to stop the handler's
+   destination before your app is undeployed."
   [^javax.jms.XAConnection listener]
   (.close listener))

 (defn stop
   "Destroy a message destination. Typically not necessary since it
-  will be done for you when your app is undeployed. This will fail
-  with a warning if any handlers are listening"
+   will be done for you when your app is undeployed. This will fail
+   with a warning if any handlers are listening"
   [name]
   (if (or (queue-name? name) (topic-name? name))
     (stop-destination name)


main component can load most things up

main component can load most things up

--- src/crawler/main.clj
+++ src/crawler/main.clj
@@ -37,14 +37,25 @@
                  structure-driven/extractor
                  structure-driven/stop?)))

-(defn execute-model
+(defn execute-model-crawler
   [start-url model num-leaves]
   (let [stop-fn    (fn [{visited :visited}]
                      (<= num-leaves visited))

         leaf-fn    (fn [x] false) ;; FIX
+
+        model      (crawler-model/read-model model)

-        extract-fn (rc-extractor/state-action)]))
+        extract-fn (fn [page-src url-ds template-removed blacklist]
+                     (rc-extractor/state-action-model (first model)
+                                                      page-src
+                                                      url-ds
+                                                      template-removed
+                                                      blacklist))]
+    (crawl/crawl start-url
+                 leaf-fn
+                 extract-fn
+                 stop-fn)))

 (defn -main
   [& args]
@@ -65,9 +76,9 @@

                 start-url  (-> options :start)
                 num-leaves (-> options :num-docs)]
-            (execute-model start-url
-                           model
-                           num-leaves))
+            (execute-model-crawler start-url
+                                   model
+                                   num-leaves))

           :else
           (println "Pick one bruh"))))


extraction des settings du body des ennemis

--- desktop/src-common/con_world/entity-enemy.clj
+++ desktop/src-common/con_world/entity-enemy.clj
@@ -51,32 +51,34 @@
          (body! body :create-fixture))
     body))

-(defn spawn-enemy [screen entities]
-  (let [{:keys [level]} (find-cell entities)
-         index (+ level 1 (u/rand-sign 1))
-         [size nb-sprite] (enemy-index index)
-         {en-images :sprites stand :first} (image->sprite (str "entities/ennemi" index ".png") size size nb-sprite)
-        width (u/pixels->world size)
-        height (u/pixels->world size)
-        x-max (- u/z-width width)
+(defn init-enemy-body-spacial-settings [{:keys [width height z-side] :as enemy-entity}]
+  (let [x-max (- u/z-width width)
         y-max (- u/z-height height)
-        z-side (directions (rand-int 3))
         [x y x-velocity y-velocity]
         (condp = z-side
           :right [(+ x-max) (rand-int y-max) (- u/cell-x-velocity) 0]
           :bottom [(rand-int x-max) 0 0 u/cell-y-velocity]
           :left [0 (rand-int y-max) u/cell-x-velocity 0])]
-    (println x y x-velocity y-velocity z-side)
-    (doto
+    (doto enemy-entity
+      (body-position! x y 0)
+      (body! :set-linear-velocity x-velocity y-velocity))))
+
+(defn spawn-enemy [screen entities]
+  (let [{:keys [level]} (find-cell entities)
+        index (+ level 1 (u/rand-sign 1))
+        [size nb-sprite] (enemy-index index)
+        {en-images :sprites stand :first} (image->sprite (str "entities/ennemi" index ".png") size size nb-sprite)
+        width (u/pixels->world size)]
+    (->
         (assoc stand
           :stand stand
           :walk (animation 0.1 en-images :set-play-mode (play-mode :loop-pingpong))
           :body (create-enemy-body! screen (/ width 2))
-          :width width :height height
+          :width width
+          :height (u/pixels->world size)
           :enemy? true
-          :z-side z-side)
-      (body-position! x y 0)
-      (body! :set-linear-velocity x-velocity y-velocity))))
+          :z-side (directions (rand-int 3)))
+      (init-enemy-body-spacial-settings))))

 (defn may-spawn-enemy [{:keys [last-spawn total-time] :as screen} entities]
   (if (and (not= last-spawn (int total-time))


Make lollipops whirl around cuz why not

Make lollipops whirl around cuz why not

--- dev-src/examples/interactive/interactive.cljs
+++ dev-src/examples/interactive/interactive.cljs
@@ -68,6 +68,21 @@
                        {:x 0 :y 0}
                        (om/build-all clickablesprite (vals sprites) {:key :key :fn bindimageandchannel})))))

+(defcomponentk spinelement [[:data x y spinspeed spinelement] owner]
+  (display-name [_] "SpinElement")
+  (init-state [_] {:clusterrotation 0 :spincallback nil})
+  (did-mount [_] (let [spinfn (fn spincallback [_] (let [oldrotation (om/get-state owner :clusterrotation)
+                                                         rotationdelta (* 0.016 spinspeed)
+                                                         newrotation (+ oldrotation rotationdelta)]
+                                                     (om/set-state! owner :clusterrotation newrotation)
+                                                     (om/set-state! owner :spincallback (js/requestAnimationFrame spincallback))))]
+                   (om/set-state! owner :spincallback (js/requestAnimationFrame spinfn))))
+  (will-unmount [_] (when-let [spinfn (om/get-state owner :spincallback)]
+                      (js/cancelAnimationFrame spinfn)))
+  (render-state [_ state] (let [r (:clusterrotation state)]
+                (pixi/displayobjectcontainer {:x x :y y :rotation r}
+                                             (pixi/displayobjectcontainer {:x (- x) :y (- y)}
+                                                                          spinelement)))))

 (defcomponentk interactivestage [[:data width height sprites :as props ] owner]
   (display-name [_] "InteractiveStage")
@@ -86,12 +101,16 @@
                 (let [addchannel (:addspritechannel state)
                       deletechannel (:deletespritechannel state)
                       fontstyle {:font "40 Comic_Neue_Angular"}
-                      fonttint 16rff88ff88]
+                      fonttint 16rff88ff88
+                      halfheight (/ height 2)
+                      halfwidth (/ width 2)
+                      spritecluster (om/build removeablesprites {:sprites sprites :deletechannel (:deletespritechannel state)})]
                   (pixi/stage {:width width :height height :interactive true}
                               (pixi/bitmaptext {:text "Click the cherry to add a lollipop" :x 10 :y 10 :tint fonttint :style fontstyle :key "text1"})
                               (pixi/bitmaptext {:text "Click a lollipop to remove it" :x 10 :y 60 :tint fonttint :style fontstyle :key "text2"})
                               (om/build clickablesprite {:spritedata {:x 100 :y 150 :key "addbutton" :interactive true :image (assetpath "cherry.png")} :clickchannel (:addspritechannel state)})
-                              (om/build removeablesprites {:sprites sprites :deletechannel (:deletespritechannel state)})))))
+                              (om/build spinelement {:spinelement spritecluster :x halfwidth :y halfheight :spinspeed 3})
+                              ))))

 ;;
 ;; entry/start code


Possible fix for sessio-down error

Possible fix for sessio-down error

--- src/dakait/files.clj
+++ src/dakait/files.clj
@@ -25,8 +25,7 @@
 (defn- session []
   "Get the currently active session, if one doesn't exist, create a new one and make sure the
   session is connected"
-  (when (or (nil? @ssh-session)
-            (not (ssh/connected? @ssh-session)))
+  (when (nil? @ssh-session)
     ;; Recreate our session if it doesn't exist or is not connected for some reason
     (let [host (config :sftp-host)
           user (config :username)
@@ -35,10 +34,15 @@
           session (ssh/session agent host {:port port
                                            :username user
                                            :strict-host-key-checking :no})]
-      (info "Connecting new session")
-      (info "Session parameters" host user port)
-      (ssh/connect session)
+      (info "New session created with param: " host user port)
       (reset! ssh-session session)))
+  ;; seems to me the ssh/connected? seems to return true and then the channel creation fails with "Session not connected"
+  ;; Explictely call connect every time the session is requested.
+  (try
+    (info "Force connecting session")
+    (ssh/connect @ssh-session)
+    (catch Exception e
+      "Call ot session connect failed with: " (.getMessage e)))
   @ssh-session)

 (defn all-files [path]


allow reset of screen; fix problem of full screen windows

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

--- plugins/SlideExplorer2/src/slide_explorer/user_controls.clj
+++ plugins/SlideExplorer2/src/slide_explorer/user_controls.clj
@@ -79,10 +79,9 @@
 (def old-bounds (atom {}))

 (defn full-screen!
-  "Make the given window/frame full-screen. Pass nil to return all windows
-to normal size."
+  "Make the given window/frame full-screen."
   [window]
-  (when window
+  (when (and window (not (@old-bounds window)))
     (when-not (@old-bounds window)
       (swap! old-bounds assoc window (.getBounds window)))
     (.dispose window)
@@ -95,15 +94,17 @@
     (.show window)))

 (defn exit-full-screen!
+  "Restore the given full-screened window to its previous
+   (non-full-screen) bounds."
   [window]
-  (when window
+  (when (and window (@old-bounds window))
     (.dispose window)
     (.setUndecorated window false)
     (when (JavaUtils/isMac)
       (.setFullScreenWindow (window-screen window) nil))
     (when-let [bounds (@old-bounds window)]
       (.setBounds window bounds)
-      (swap! old-bounds assoc window nil))
+      (swap! old-bounds dissoc window))
     (.repaint window)
     (.show window)))

@@ -189,12 +190,17 @@

 (defn handle-wheel [component z-atom]
-  (.addMouseWheelListener component
-    (proxy [MouseAdapter] []
-      (mouseWheelMoved [e]
-                       (swap! z-atom update-in [:z]
-                              + (.getWheelRotation e)))))
-  z-atom)
+  (let [last-move (atom 0)]
+    (def lm last-move)
+    (.addMouseWheelListener component
+      (proxy [MouseAdapter] []
+        (mouseWheelMoved [e]
+          (let [t (System/currentTimeMillis)]
+            (when (< 250 (- t @last-move))
+              (reset! last-move t)
+              (swap! z-atom update-in [:z]
+                     (if (pos? (.getWheelRotation e)) inc dec))))))))
+    z-atom)

 (defn handle-resize [component size-atom]
   (let [update-size #(let [bounds (.getBounds component)]
@@ -290,16 +296,18 @@
          :y (long (+ y (/ mouse-y-centered zoom scale) (/ h -2)))
          :z z}))))

-(defn handle-refresh [component]
-  (bind-keys component ["R"] #(do (.repaint component) (println "repaint")) true))
-
+(defn handle-reset [window screen-state-atom]
+  (bind-window-keys window ["shift R"]
+               #(swap! screen-state-atom
+                       assoc :x 0 :y 0 :z 0 :zoom 1)))
+

 ;(defn handle-open [window]
 ;  (bind-window-keys window ["S"] create-dir-dialog))

 (defn make-view-controllable [panel screen-state-atom]
-  (handle-refresh panel)
-  ((juxt handle-drags handle-arrow-pan handle-wheel handle-resize handle-pointing)
+  ((juxt handle-reset handle-drags handle-arrow-pan
+         handle-wheel handle-resize handle-pointing)
          panel screen-state-atom)
   ((juxt handle-zoom handle-dive) ; watch-keys)
          (.getTopLevelAncestor panel) screen-state-atom))


Handle config without keepalive provided

--- src/org/spootnik/fleet/engine.clj
+++ src/org/spootnik/fleet/engine.clj
@@ -45,7 +45,7 @@
             (a/put! @subscription :close)
             (a/close! @subscription))
           (reset! subscription close-ch)
-          (when (pos? keepalive)
+          (when (and keepalive (pos? keepalive))
             (info "found keepalive, starting loop")
             (go
               (loop []


Lint fix :shirt:

Lint fix :shirt:

--- src/metabase/query_processor/expand.clj
+++ src/metabase/query_processor/expand.clj
@@ -427,8 +427,8 @@
 ;; this namespace ever even sees the query. But since the GA driver's queries consist of custom `metric` and `segment` clauses we need to at least
 ;; accept them without barfing so we can expand a query in order to check what permissions it requires.
 ;; TODO - in the future, we should just make these functions expand Metric and Segment macros for consistency with the rest of the MBQL clauses
-(defn- ^:ql metric  [& _])
-(defn- ^:ql segment [& _])
+(defn ^:ql metric  "Placeholder expansion function for GA metric clauses. (This does not expand normal Metric macros; that is done in `metabase.query-processor.macros`.)"   [& _])
+(defn ^:ql segment "Placeholder expansion function for GA segment clauses. (This does not expand normal Segment macros; that is done in `metabase.query-processor.macros`.)" [& _])

 ;;; # ------------------------------------------------------------ Expansion ------------------------------------------------------------


reformatted tests

reformatted tests


updated dependencies

updated dependencies

--- iwaswhere-web/project.clj
+++ iwaswhere-web/project.clj
@@ -20,9 +20,9 @@
                  [com.drewnoakes/metadata-extractor "2.9.1"]
                  [ubergraph "0.2.3"]
                  [camel-snake-kebab "0.4.0"]
-                 [matthiasn/systems-toolbox "0.6.1-alpha5"]
-                 [matthiasn/systems-toolbox-ui "0.6.1-alpha6"]
-                 [matthiasn/systems-toolbox-sente "0.6.1-alpha6"]
+                 [matthiasn/systems-toolbox "0.6.1-alpha6"]
+                 [matthiasn/systems-toolbox-ui "0.6.1-alpha8"]
+                 [matthiasn/systems-toolbox-sente "0.6.1-alpha7"]
                  [matthiasn/inspect-probe "0.6.1-alpha1"]
                  [clucy "0.4.0"]
                  [seesaw "1.4.5"]


Remove unnecessary requires and fix typo

--- euler_clojure/src/euler_clojure/problem51.clj
+++ euler_clojure/src/euler_clojure/problem51.clj
@@ -15,9 +15,7 @@
 ;; prime value family.

 (ns euler.problem51
-  (:require [euler.toolset :refer [prime? get-primes]]
-            [clojure.math.combinatorics :as comb]
-            [clojure.math.numeric-tower :as math]))
+  (:require [euler.toolset :refer [prime? get-primes]]))

 (defn to-digits [n]
   ;; 1234 => (1 2 3 4)
@@ -67,7 +65,7 @@
       (to-num (replace-digits digits indices x)))))

 (defn smallest-member?
-  "Does the number statisfy the problem specification?"
+  "Does the number satisfy the problem specification?"
   [num]
   (some true? (for [indices (find-indices num)]
                 (= 8 (count (filter prime? (family num indices)))))))


(PDB-4637) Move table analysis outside migrations

Because it can't be in a transactiona and we're planning to move the
other code inside a common transaction.

--- src/puppetlabs/puppetdb/scf/migrate.clj
+++ src/puppetlabs/puppetdb/scf/migrate.clj
@@ -1518,8 +1518,8 @@
    33 add-certname-id-to-certnames
    34 add-certname-id-to-resource-events
    ;; This dummy migration ensures that even databases that were up to
-   ;; date when the "vacuum analyze" code was added to run-migrations
-   ;; will still analyze their existing databases.
+   ;; date when the analyze-tables code was added will still analyze
+   ;; their existing databases.
    35 (fn [] true)
    36 rename-environments-name-to-environment
    37 add-jsonb-columns-for-metrics-and-logs
@@ -1644,11 +1644,22 @@
     (apply jdbc/do-commands-outside-txn
            (map #(str "vacuum analyze " %) tables))))

+(defn- analyze-tables
+  [requested]
+  {:pre [(or (nil? requested) (set? requested))]}
+  ;; Always analyze these small tables since we had a good long period
+  ;; where the post-migration analysis above wasn't actually working,
+  ;; and since this shouldn't be expensive.
+  (let [small-tables (set ["value_types" "report_statuses"])]
+    (analyze-if-exists (set/union small-tables requested))))
+
 (defn run-migrations
+  "Migrates database to the latest schema version. Does nothing if
+  database is already at the latest schema version.  Returns a set of
+  tables that should be analyzed if there were any migrations."
   []
   (require-valid-schema)
-  (let [small-tables (set ["value_types" "report_statuses"])
-        tables (jdbc/with-db-transaction []
+  (let [tables (jdbc/with-db-transaction []
                  (when-let [pending (seq (pending-migrations))]
                    (->> pending
                         (map (fn [[version migration]]
@@ -1662,14 +1673,10 @@
                                    result))))
                         (filter map?)
                         (map ::vacuum-analyze)
-                        seq)))]
-    (when-not tables
+                        (apply set/union))))]
+    (when-not (empty? tables)
       (log/info (trs "There are no pending migrations")))
-    ;; Always analyze these since we had a good long period where
-    ;; the post-migration analysis above wasn't actually working,
-    ;; and since this shouldn't be expensive.
-    (analyze-if-exists (apply set/union small-tables tables))
-    (not (empty? tables))))
+    tables))

 ;; SPECIAL INDEX HANDLING
@@ -1721,9 +1728,10 @@
   version, etc. has already been validated."
   []
   (try
-    (let [migrated? (run-migrations)]
+    (let [tables-to-analyze (run-migrations)]
+      (analyze-tables tables-to-analyze)
       (indexes!)
-      migrated?)
+      (not (empty? tables-to-analyze)))
     (catch java.sql.SQLException e
       (log/error e (trs "Caught SQLException during migration"))
       (loop [ex (.getNextException e)]


Fix for the fix (#833)

Fix for the fix (#833)

* Fix for the fix

* Fixing indentation

* Second attempt at fixing indentation

* Again fixing indentation. But correctly this time

--- src/cljs/main/broadfcui/page/method_repo/methods_configs_acl.cljs
+++ src/cljs/main/broadfcui/page/method_repo/methods_configs_acl.cljs
@@ -79,6 +79,7 @@
             (style/create-identity-select
              {:ref (str "acl-value" i)
               :style {:float "right" :width column-width :height 33}
+              :disabled (= (utils/get-user-email) (:user acl-entry))
               :defaultValue (:role acl-entry)}
              access-levels)
             (common/clear-both)])
@@ -92,7 +93,8 @@
                   :style {:marginLeft "2em" :verticalAlign "middle"}
                   :onChange #(swap! state assoc :public-status (-> (@refs "publicbox") .-checked))
                   :checked public-status}]
-         [:span {:style {:paddingLeft 6 :verticalAlign "middle"}} "Publicly Readable?"]]]))
+         [:span {:style {:paddingLeft 6 :verticalAlign "middle"}} "Publicly Readable?"]]
+        (style/create-server-error-message (:persist-error @state))]))
    :-persist-acl
    (fn [{:keys [props state refs this]}]
      (swap! state dissoc :validation-error :save-error)
@@ -106,13 +108,16 @@
                                               (if (:public-status @state) reader-level no-access-level)})]
            (swap! state assoc :saving? true)
            (endpoints/call-ajax-orch
-             {:endpoint (:save-endpoint props)
-              :headers utils/content-type=json
-              :payload non-empty-acls-w-public
-              :on-done (net/handle-ajax-response
-                         (fn [{:keys [success? parsed-response] :as response}]
-                           (swap! state assoc :acl-response response)
-                           (swap! state dissoc :saving?)))})))))
+            {:endpoint (:save-endpoint props)
+             :headers utils/content-type=json
+             :payload non-empty-acls-w-public
+             :on-done (net/handle-ajax-response
+                       (fn [{:keys [success? parsed-response] :as response}]
+                         (if success?
+                           (modal/pop-modal)
+                           (do
+                             (swap! state assoc :persist-error (:message parsed-response))
+                             (swap! state dissoc :saving?)))))})))))
    :-capture-ui-state
    (fn [{:keys [state refs]}]
      (mapv


MVP for resolve-locations CLI

MVP for resolve-locations CLI

--- src/degasolv/cli.clj
+++ src/degasolv/cli.clj
@@ -1,6 +1,6 @@
 (ns degasolv.cli
   (:require [degasolv.util :refer :all]
-            [clojure.tools.cli :refer [parse-opts]]
+            [clojure.tools.cli :refer [parse-opts summarize]]
             [clojure.string :as string]
             [clojure.pprint :as pprint]
             [clojure.java.io :as io]
@@ -13,6 +13,19 @@
   `(let [x# ~body]
      (println "dbg:" '~body "=" x#)
 x#))
+
+(defn- mysummary [sq]
+  (with-out-str
+    (pprint/pprint
+     (map
+      (fn [arg-parts]
+        (select-keys arg-parts
+                     [:short-opt
+                      :long-opt
+                      :required
+                      :desc
+                      :default-desc]))
+      sq))))

 (defn- generate-repo-index!
   [options arguments]
@@ -47,7 +60,9 @@
        ow))))

 (defn- resolve-locations!
-  [options arguments])
+  [options arguments]
+  (pprint/pprint options)
+  )

 (def subcommand-cli
   {"generate-repo-index"
@@ -68,16 +83,22 @@
    {:description "Print the locations of the packages which will resolve all given dependencies."
     :function resolve-locations!
     :cli [["-r" "--repository REPO"
-           "Specify a repository to use. May be used more than once."]
+           "Specify a repository to use. May be used more than once."
+           :assoc-fn
+           (fn [m k v] (update-in m [k] #(conj % v)))]
           ["-s" "--resolve-strategy STRATEGY"
            "Specify a strategy to use when resolving. May be 'fast' or 'thorough'."
-           :default "thorough"]
+           :default "thorough"
+          :validate [#(or (= "thorough" %) (= "fast" %))
+                     "Strategy must either be 'thorough' or 'fast'."]]
           ["-R" "--repo-merge-strategy STRATEGY"
            "Specify a repo merge strategy. May be 'priority' or 'global'."
-           :default "priority"]
-          ["-c" "--resolve-card-spec CARD_FILE"
-           (str "Instead of resolving using commandline argument, resolve the"
-                " requirements found in the given degasolv card file.")]]}})
+           :default "priority"
+           :validate [#(or (= "priority" %) (= "global" %))
+                      "Strategy must either be 'priority' or 'global'."]]
+          ["-c" "--project-file PROJECT_FILE"
+           "Resolve the requirements found in the given degasolv project file."
+          :validate [#(fs/file? %) "Project file must exist."]]]}})

 (defn command-list [commands]
   (->> ["Commands are:"
@@ -88,6 +109,16 @@
         ""
         ]
        (string/join \newline)))
+
+(defn errors [errors usg]
+  (string/join \newline
+               "Errors:"
+               ""
+               (map #(str "  - " %) errors)
+               ""
+               usg
+               ""
+               ""))

 (defn usage [options-summary & {:keys [sub-command]}]
   (let [display-command (if sub-command
@@ -99,7 +130,8 @@
                display-command
                "-options>")
           ""
-          "Options are:"
+          "Options are shown below, with their default values and"
+          "  descriptions:"
           ""
           options-summary
           ]
@@ -111,7 +143,7 @@
          (str " for subcommand `" sub-command "`")
          "")
        ":\n\n"
-       (string/join \newline (map #(str "  - " errors)))))
+       (string/join \newline (map #(str "  - " %) errors))))

 (defn exit [status msg]
   (.println *err* msg)
@@ -120,6 +152,7 @@
 (def cli-options
   [["-c" "--config-file FILE" "config file"
     :default (fs/file (fs/expand-home "~/.config/degasolv/config.edn"))
+    :default-desc "~/.config/degasolv/config.edn"
     :validate [#(and (fs/exists? %)
                      (fs/file? %))
                "Must be a regular file (which hopefully contains config info."]]])
@@ -128,7 +161,7 @@
   (let [{:keys [options arguments errors summary]}
         (parse-opts args (concat
                           cli-options
-                          [["-h" "--help"]])
+                          [["-h" "--help" "Print this help page"]])
                     :in-order true)]
     (cond
       (:help options) (exit 0 (str (usage summary)
@@ -136,9 +169,15 @@
                                    (command-list (keys subcommand-cli))
                                    "\n\n"
                                    ))
-      errors (exit 1 (usage summary
-                            "\n"
-                            (command-list (keys subcommand-cli)))))
+      errors (exit 1 (string/join
+                      \newline
+                      [(error-msg errors)
+                      ""
+                      (usage summary)
+                      ""
+                       (command-list (keys subcommand-cli))
+                       ""])))
+
     (let [global-options options
           subcommand (first arguments)
           subcmd-cli (get subcommand-cli subcommand)]
@@ -147,10 +186,15 @@
       (let [{:keys [options arguments errors summary]}
             (parse-opts args (concat
                               (:cli subcmd-cli)
-                              [["-h" "--help"]]))]
+                              [["-h" "--help" "Print this help page"]]))]
         (cond
           (:help options) (exit 0 (usage summary :sub-command subcommand))
-          errors (exit 1 (usage summary :sub-command subcommand)))
+          errors (exit 1 (string/join
+                          \newline
+                          [(error-msg errors :sub-command subcommand)
+                          ""
+                          (usage summary :sub-command subcommand)
+                          ""])))
         ((:function subcmd-cli)
          (merge
           (edn/read-string


Attempt to fix the build

Attempt to fix the build

--- src/degasolv/cli.clj
+++ src/degasolv/cli.clj
@@ -764,24 +764,24 @@
                ""))

 (defn get-config [configs]
-  (as-> configs it
-        (map (fn [{:keys [file read-fn]}]
-               {:string (default-slurp file)
-                :read-fn read-fn}) it)
-        (map (fn [{:keys [string read-fn]}]
-               (read-fn string))
-             it)
-        (reduce merge it)
-        (try it
-          (catch Exception e
-            (binding [*out* *err*]
-              (println "Warning: problem reading config files, they were not used:"
-                       (str "\n"
-                            (string/join
-                              \newline
-                              (map #(str "  - " %)
-                                   configs)))))
-            (hash-map)))))
+  (try
+    (as-> configs it
+      (map (fn [{:keys [file read-fn]}]
+             {:string (default-slurp file)
+              :read-fn read-fn}) it)
+      (map (fn [{:keys [string read-fn]}]
+             (read-fn string))
+           it)
+      (reduce merge it))
+    (catch Exception e
+      (binding [*out* *err*]
+        (println "Warning: problem reading config files, they were not used:"
+                 (str "\n"
+                      (string/join
+                       \newline
+                       (map #(str "  - " %)
+                            configs)))))
+      (hash-map))))

 (defn -main [& args]