Added keyword test for temporal keywords.

--- test/cmr/system_int_test/search/collection_keyword_search_test.clj
+++ test/cmr/system_int_test/search/collection_keyword_search_test.clj
@@ -51,7 +51,7 @@
         coll14 (d/ingest "CMR_PROV2" (dc/collection {:entry-title "coll14" :long-name "spoonA laser"}))
         coll15 (d/ingest "CMR_PROV2" (dc/collection {:entry-title "coll15" :processing-level-id "plid1"
                                                      :collection-data-type "cldt" :platforms [p1]
-                                                     :summary "summary"}))
+                                                     :summary "summary" :temporal-keywords ["tk1" "tk2"]}))
         coll16 (d/ingest "CMR_PROV2" (dc/collection {:entry-id "entryid4"}) :dif)]

     (index/refresh-elastic-index)
@@ -97,9 +97,12 @@
            ;; summary
            "summary" [coll15]

+           ;; temporal keywords
+           "tk1" [coll15]
+
+
            ;; TODO
            ;; spatial keywords
-           ;; temporal keywords
            ;; associated dif
            ;; two d coord
            ;; archive center


added example of combining vectors and maps

--- test/structural_typing/docs/f_wiki_condensed_type_descriptions.clj
+++ test/structural_typing/docs/f_wiki_condensed_type_descriptions.clj
@@ -178,7 +178,29 @@
   :Line2)

-;;; This
+(type! :Point1
+       (requires :x :y :color)
+       {[(forks :x :y)] integer?})
+
+(type! :Point2
+       {[:x] [required-key integer?]
+        [:y] [required-key integer?]
+        [:color] [required-key]})
+
+(tabular
+  (fact
+    (let [result (with-out-str (checked ?version {:x 3.0}))]
+      result => #":color must exist"
+      result => #":x should be `integer"
+      result => #":y must exist"))
+  ?version
+  :Point1
+  :Point2)
+
+
+
+
+;;; Took out the documentation for this feature, but it still exists.
 (future-fact "Delete undocumented feature?")

 (type! :Figure1


More dynamic declarations.

More dynamic declarations.

--- test/midje/util/t_laziness.clj
+++ test/midje/util/t_laziness.clj
@@ -8,13 +8,13 @@

 ;; Justification for use of eagerly
 (def counter (atom 1))
-(def mocked-function-produces-next-element inc)
+(def ^{:dynamic true} *mocked-function-produces-next-element* inc)

 (defn function-under-test-produces-a-lazy-list []
-  (iterate mocked-function-produces-next-element 1))
+  (iterate *mocked-function-produces-next-element* 1))

 (defn mock-use []
-  (binding [mocked-function-produces-next-element (fn [n] (swap! counter inc) (inc n))]
+  (binding [*mocked-function-produces-next-element* (fn [n] (swap! counter inc) (inc n))]
     (eagerly (take 5 (function-under-test-produces-a-lazy-list)))))

 (fact "eagerly forces evaluation"


Give watch test a little more time before checking

--- test/onyx/log/curator_test.clj
+++ test/onyx/log/curator_test.clj
@@ -47,6 +47,9 @@
         ;; add another child so watcher will be triggered
         (cu/create client2 "/ab/zd/hi/entry-" :sequential? true :persistent? true)

+        ;; Give it a second before checking watch
+        (Thread/sleep 200)
+
         (facts "Check watcher triggered"
                (fact @watcher-sentinel => 1))


Reformat code.

Reformat code.

--- src/dsbdp/local_dpp_self_adaptivity.clj
+++ src/dsbdp/local_dpp_self_adaptivity.clj
@@ -146,7 +146,5 @@
                 )
               )
           :default nil
-          ))
-    ))
-  )
+          )))))


add debug to cluster

add debug to cluster

--- src/edu/berkeley/ai/scripts/cluster.clj
+++ src/edu/berkeley/ai/scripts/cluster.clj
@@ -27,7 +27,7 @@
 		  "-o" (str (util/file-stem f) ".out")
 		  "-e" (str (util/file-stem f) ".err")]
 		*default-qsub-options*
-		[:in (str *default-clj* " "f) :dir (util/dirname f)])))))))
+		[:in (str *default-clj* f) :dir (util/dirname f)])))))))

 (defn run-experiment-set-subprocesses [es]
   (run-files-subprocesses


Add formatter test for s/multi-spec

Add formatter test for s/multi-spec

--- test/cljc/pinpointer/formatter_test.cljc
+++ test/cljc/pinpointer/formatter_test.cljc
@@ -6,6 +6,13 @@

 (s/def ::x integer?)
 (s/def ::y string?)
+
+(defmulti shape-spec :type)
+(s/def ::shape (s/multi-spec shape-spec :type))
+
+(s/def ::radius number?)
+(defmethod shape-spec :circle [_]
+  (s/keys :req-un [::radius]))

 (deftest format-test
   (are [spec input result]
@@ -92,4 +99,12 @@
     ["!!!{:y 42}!!!\n"
      "{:y !!!42!!!}\n"]

+    ::shape
+    {:type :rectangle}
+    ["!!!{:type :rectangle}!!!\n"]
+
+    ::shape
+    {:type :circle :radius "100"}
+    ["{:type :circle, :radius !!!\"100\"!!!}\n"]
+
     ))


revert to lbq

revert to lbq

--- src/bolth.clj
+++ src/bolth.clj
@@ -128,7 +128,7 @@
       (finally (deliver (nth finished worker-id) 1)))))

 (defn run-gathered-tests [^AbstractQueue tests-to-run pharrallelism]
-  (let [results (ArrayBlockingQueue. 1024)
+  (let [results (LinkedBlockingQueue.)
         printer-running (atom true)
         finished (into [] (map (fn [_] (promise)) (range pharrallelism)))
         workers (map #(run-worker results tests-to-run % finished) (range pharrallelism))


[#70] db-client*: add :keep-alive? option (@kirankulkarni)

--- src/taoensso/faraday.clj
+++ src/taoensso/faraday.clj
@@ -93,8 +93,8 @@
     etc."
   (memoize
    (fn [{:keys [provider creds access-key secret-key endpoint proxy-host proxy-port
-                proxy-username proxy-password
-               conn-timeout max-conns max-error-retry socket-timeout]
+               proxy-username proxy-password
+               conn-timeout max-conns max-error-retry socket-timeout keep-alive?]
         :as client-opts}]
      (if (empty? client-opts) (AmazonDynamoDBClient.) ; Default client
        (let [creds (or creds (:credentials client-opts)) ; Deprecated opt
@@ -116,7 +116,8 @@
                conn-timeout    (.setConnectionTimeout g)
                max-conns       (.setMaxConnections    g)
                max-error-retry (.setMaxErrorRetry     g)
-               socket-timeout  (.setSocketTimeout     g))]
+               socket-timeout  (.setSocketTimeout     g)
+               keep-alive?     (.setUseTcpKeepAlive   g))]
          (doto-cond [g (if provider
                          (AmazonDynamoDBClient. provider  client-config)
                          (AmazonDynamoDBClient. aws-creds client-config))]


Add path and points processing functions

--- src/whisper2cyanite/core.clj
+++ src/whisper2cyanite/core.clj
@@ -15,56 +15,67 @@

 (def ^:const pbar-width 35)

+(defn- calc-ttl
+  "Calc TTL."
+  [time retention]
+  (- time (- (utils/now) retention)))
+
+(defn- migrate-points
+  "Migrate points."
+  [mstore options tenant rollup period retention path series]
+  (let [min-ttl (:min-ttl options default-min-ttl)
+        run (:run options false)]
+    (doseq [point series]
+      (let [time (first point)
+            value (last point)
+            ttl (calc-ttl time retention)]
+        (when (not= time 0)
+          (when (> ttl min-ttl)
+            (log/trace
+             (format (str "Migrating point: rollup: %s, period: %s, "
+                          "path: %s, time: %s, value: %s, ttl: %s")
+                     rollup period path time value ttl))
+            (when (and run mstore)
+              (mstore/insert mstore tenant rollup period path time value
+                             ttl))))))))
+
 (defn- process-archive
   "Process an archive."
-  [ra-file file archive mstore pstore tenant path from to retention options]
+  [ra-file file archive mstore tenant path from to retention options points-fn]
   (let [rollup (:seconds-per-point archive)
         points (:points archive)
         period (if retention (/ retention rollup) points)
         retention (if retention retention (* rollup points))
         data (whisper/fetch-archive-seq-ra ra-file file archive from to)
-        series (:series data)
-        path-stored? (atom false)
-        run (:run options false)
-        min-ttl (:min-ttl options default-min-ttl)]
-    (doseq [point series]
-      (let [time (first point)
-            value (last point)]
-        (when (not= time 0)
-          (let [ttl (- time (- (utils/now) retention))]
-            (when (> ttl min-ttl)
-              (log/trace
-               (format (str "Processing point: rollup: %s, period: %s, "
-                            "path: %s, time: %s, value: %s, ttl: %s")
-                       rollup period path time value ttl))
-              (when run
-                (when mstore
-                  (mstore/insert mstore tenant rollup period path time
-                                 value ttl))
-                (when-not @path-stored?
-                  (when pstore
-                    (pstore/insert pstore tenant path))
-                  (swap! path-stored? (fn [_] true)))))))))))
+        series (:series data)]
+    (points-fn mstore options tenant rollup period retention path series)))
+
+(defn- migrate-path
+  "Migrate a path."
+  [pstore tenant path]
+  (when pstore
+    (pstore/insert pstore tenant path)))

 (defn- process-file
   "Process a file."
-  [file dir mstore pstore tenant from to options]
-  (let [path (whisper/file-to-name file dir)
-        ra-file (RandomAccessFile. file "r")
-        rollups (:rollups options)]
-    (try
-      (let [info (whisper/read-info-ra ra-file file)
-            archives (:archives info)]
-        (doseq [archive archives]
-          (let [seconds-per-point (:seconds-per-point archive)]
-            (when (or (not (> (count rollups) 0))
-                      (contains? rollups seconds-per-point))
-              (let [retention (get rollups seconds-per-point
-                                   (:retention archive))]
-                (process-archive ra-file file archive mstore pstore tenant path
-                                 from to retention options))))))
-      (finally
-        (.close ra-file)))))
+  [file dir mstore pstore tenant from to options path-fn points-fn]
+  (let [path (whisper/file-to-name file dir)]
+    (path-fn pstore tenant path)
+    (let [ra-file (RandomAccessFile. file "r")
+          rollups (:rollups options)]
+      (try
+        (let [info (whisper/read-info-ra ra-file file)
+              archives (:archives info)]
+          (doseq [archive archives]
+            (let [seconds-per-point (:seconds-per-point archive)]
+              (when (or (not (> (count rollups) 0))
+                        (contains? rollups seconds-per-point))
+                (let [retention (get rollups seconds-per-point
+                                     (:retention archive))]
+                  (process-archive ra-file file archive mstore tenant path
+                                   from to retention options points-fn))))))
+        (finally
+          (.close ra-file))))))

 (defn- get-paths
   "Get paths."
@@ -129,7 +140,7 @@

 (defn- process
   "Process a Whisper database."
-  [source tenant cass-host es-url options start-title title]
+  [source tenant cass-host es-url options path-fn points-fn start-title title]
   (wlog/set-logging! options)
   (try
     (wlog/info start-title)
@@ -141,12 +152,12 @@
           pool (cp/threadpool jobs)
           mstore (create-mstore cass-host options)
           pstore (create-pstore es-url options)
-          process-fn (fn [file]
-                       (wlog/info "Processing path: " file)
-                       (when-not @wlog/print-log?
-                         (prog/tick))
-                       (process-file file root-dir mstore pstore tenant from to
-                                     options))]
+          process-file-fn (fn [file]
+                            (wlog/info "Processing path: " file)
+                            (when-not @wlog/print-log?
+                              (prog/tick))
+                            (process-file file root-dir mstore pstore tenant
+                                          from to options path-fn points-fn))]
       (try
         (prog/set-progress-bar!
          "[:bar] :percent :done/:total Elapsed :elapseds ETA :etas")
@@ -156,7 +167,7 @@
         (when-not @wlog/print-log?
           (println title)
           (prog/init files-count))
-        (dorun (cp/pmap pool process-fn files))
+        (dorun (cp/pmap pool process-file-fn files))
         (when-not @wlog/print-log?
           (prog/done))
         (catch Exception e
@@ -173,8 +184,8 @@
 (defn migrate
   "Do migration."
   [source tenant cass-host es-url options]
-  (process source tenant cass-host es-url options "Starting migration"
-           "Migrating"))
+  (process source tenant cass-host es-url options migrate-path migrate-points
+           "Starting migration" "Migrating"))

 (defn list-paths
   "List paths."


Refresh button refreshes page

Refresh button refreshes page

--- src/wishlistd/cljs/main.cljs
+++ src/wishlistd/cljs/main.cljs
@@ -192,6 +192,12 @@
   (fn [e]
     (hide-info!)))

+(delegate $body "#icon-refresh" :click
+  (fn [e]
+    (let [code (get-path)]
+      (when-not (empty? code)
+        (read-wishlist-rem code)))))
+
 ; START IT UP

 (defn start-up []


wishes renamed wish

wishes renamed wish

--- src/wishlistd/cljs/main.cljs
+++ src/wishlistd/cljs/main.cljs
@@ -69,7 +69,7 @@

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

 (defn value-changed?! [$this]


sleep to wait for jetty to start up SSL

sleep to wait for jetty to start up SSL

--- test/clj_http/test/core.clj
+++ test/clj_http/test/core.clj
@@ -141,6 +141,8 @@
                                           {:port 8081 :ssl-port 18082 :ssl? true
                                            :keystore "test-resources/keystore"
                                            :key-password "keykey"})) .start)]
+    ;; wait for jetty to start up completely
+    (Thread/sleep 3000)
     (try
       (is (thrown? javax.net.ssl.SSLPeerUnverifiedException
                    (request {:request-method :get :uri "/get"


updating get-collection to just collection

--- src/org/libraryweasel/ligature/core.clj
+++ src/org/libraryweasel/ligature/core.clj
@@ -11,8 +11,9 @@

 (defprotocol LigatureStore
   "A Store manages many named Collections."
-  (get-collection [this collection-name]
-    "Returns an existing or new collection based on the name passed.")
+  (collection [this collection-name]
+    "Returns a collection based on the name passed.
+    Calling this function will not create a new collection, it just binds a Store and Collection name.")
   (delete-collection [this collection-name]
     "Deletes the collection of the name given.")
   (all-collections [this]


add IGraphExecutor/include-vertex! method, update receive-signal to ignore unchanged sig values

--- src/thi/ng/fabric/async.cljc
+++ src/thi/ng/fabric/async.cljc
@@ -27,7 +27,8 @@
 (defprotocol IGraphExecutor
   (execute! [_])
   (stop! [_])
-  (notify [_ evt]))
+  (notify! [_ evt])
+  (include-vertex! [_ v]))

 (defn simple-collect
   [collect-fn]
@@ -103,10 +104,13 @@
       _))
   (receive-signal
     [_ src sig]
-    (swap! state
-           #(-> %
-                (update ::uncollected conj sig)
-                (assoc-in [::signal-map src] sig)))
+    (let [sig-map (::signal-map @state)]
+      (if-not (= sig (sig-map src))
+        (swap! state
+               #(-> %
+                    (update ::uncollected conj sig)
+                    (assoc-in [::signal-map src] sig)))
+        (info (str id " ignoring unchanged signal: " (pr-str sig)))))
     _))

 #?(:clj
@@ -174,11 +178,11 @@
           (do (debug (format "%d receive from %d: %s" id src-id (pr-str sig)))
               (receive-signal vertex src-id sig)
               (when (should-collect? vertex collect-thresh)
-                (notify ctx [:collect id])
+                (notify! ctx [:collect id])
                 (collect! vertex)
                 ;;(debug (format "%d post-collection: %s" id (pr-str @vertex)))
                 (when (should-signal? vertex signal-thresh)
-                  (notify ctx [:signal id])
+                  (notify! ctx [:signal id])
                   (signal! vertex)))
               (recur))
           #_(debug (str id " stopped")))))
@@ -217,20 +221,21 @@
         [_]
         (stop-execution bus (vertices (:graph ctx)))
         result)
-      (notify [_ evt]
+      (notify! [_ evt]
         (go (>! (rand-nth bus) evt)))
+      (include-vertex!
+        [_ v]
+        (processor v _)
+        (when (should-collect? v c-thresh)
+          (collect! v))
+        (when (should-signal? v s-thresh)
+          (signal! v))
+        _)
       (execute! [_]
         (if-not (realized? result)
           (let [t0 (System/nanoTime)]
             (go
-              (loop [verts (vertices (:graph ctx))]
-                (when-let [v (first verts)]
-                  (processor v _)
-                  (when (should-collect? v c-thresh)
-                    (collect! v))
-                  (when (should-signal? v s-thresh)
-                    (signal! v))
-                  (recur (next verts))))
+              (run! #(include-vertex! _ %) (vertices (:graph ctx)))
               (loop [colls 0 sigs 0]
                 (if (<= (+ colls sigs) max-ops)
                   (let [t (if max-t (timeout max-t))
@@ -269,7 +274,7 @@
             (->> outs
                  (map
                   (fn [[k [_ opts]]]
-                    (str (:id v) "->" (:id k) "[label=" (pr-str opts) "];\n")))
+                    (str (:id v) "->" (:id k) "[label=\"" (pr-str opts) "\"];\n")))
                  (cons
                   (format
                    "%d[label=\"%d (%s)\"];\n"
@@ -283,8 +288,8 @@
 %s}")
        (spit path)))

-(def g (compute-graph))
-(def ctx
+#_(def g (compute-graph))
+#_(def ctx
   (async-context
    {:graph     g
     :bus-size  64


(PDB-2732) Inline message handling middleware fns

Currently message processing, retry and discard logic is fragmented
across many functions. Because of this fragmentation, it's difficult to
understand all of the steps involved in our processing, causing some
code duplication. This commit inlines that code into a large as a step
in the refactoring process.

--- src/puppetlabs/puppetdb/mq_listener.clj
+++ src/puppetlabs/puppetdb/mq_listener.clj
@@ -9,7 +9,7 @@
             [puppetlabs.puppetdb.mq :as mq]
             [puppetlabs.kitchensink.core :as kitchensink]
             [puppetlabs.puppetdb.cheshire :as json]
-            [slingshot.slingshot :refer [try+]]
+            [slingshot.slingshot :refer [try+ throw+]]
             [puppetlabs.puppetdb.metrics.core :as metrics]
             [metrics.meters :refer [meter mark!]]
             [metrics.histograms :refer [histogram update!]]
@@ -154,6 +154,13 @@
    (catch Throwable e
      e)))

+(defn parse-command
+  [msg]
+  (try+
+   (cmd/parse-command msg)
+   (catch Throwable e
+     (throw+ {:kind ::parse-error} e "Error parsing command"))))
+
 (defn annotate-with-attempt
   "Adds an `attempt` annotation to `msg` indicating there was a failed attempt
   at handling the message, including the error and trace from `e`."
@@ -296,11 +303,45 @@
         on-parse-error #(handle-parse-error %1 %2 discard)
         on-fatal       #(handle-command-failure %1 %2 discard)
         on-retry       #(handle-command-retry %1 %2 send-delayed-msg-fn)]
-    (-> message-fn
-        (wrap-with-discard on-discard maximum-allowable-retries)
-        (wrap-with-exception-handling on-retry on-fatal)
-        (wrap-with-command-parser on-parse-error)
-        (wrap-with-meter (global-metric :seen)))))
+    (fn [msg]
+      (mark! (global-metric :seen))
+      (try+
+       (let [{:keys [command version annotations] :as parsed-result} (parse-command msg)]
+
+         (try+
+
+          (mark! (global-metric :seen))
+          (time! (global-metric :processing-time)
+                 (let [retries (count (:attempts annotations))]
+                   (create-metrics-for-command! command version)
+                   (mark! (cmd-metric command version :seen))
+                   (update! (global-metric :retry-counts) retries)
+                   (update! (cmd-metric command version :retry-counts) retries)
+
+                   (when (>= retries maximum-allowable-retries)
+                     (mark! (global-metric :discarded))
+                     (mark! (cmd-metric command version :discarded))
+                     (on-discard parsed-result))
+
+                   (when (< retries maximum-allowable-retries)
+                     (let [result (time! (cmd-metric command version :processing-time)
+                                         (message-fn parsed-result))]
+                       (mark! (cmd-metric command version :processed))
+                       result))))
+          (mark! (global-metric :processed))
+
+          (catch fatal? {:keys [cause]}
+            (on-fatal parsed-result cause)
+            (mark! (global-metric :fatal)))
+
+          (catch Throwable exception
+            (on-retry parsed-result exception)
+            (mark! (global-metric :retried)))))
+
+       (catch [:kind ::parse-error] _
+         (mark! (global-metric :fatal))
+         (log/errorf (:throwable &throw-context) "Fatal error parsing command: %s" msg)
+         (discard msg (:throwable &throw-context)))))))

 (defprotocol MessageListenerService
   (register-listener [this schema listener-fn])


(PDB-3544) Improve facts_factset_id_index

Prior to this commit, the facts table had an index on factset_id.

After this commit, we update that index to by on factset_id,
fact_path_id because these two columns are often filtered on together
or one is filtered on while the other is used in a join.

--- src/puppetlabs/puppetdb/scf/migrate.clj
+++ src/puppetlabs/puppetdb/scf/migrate.clj
@@ -1251,6 +1251,12 @@
 (defn add-gin-index-on-resource-params-cache []
   (jdbc/do-commands
     "create index resource_params_cache_parameters_idx on resource_params_cache using gin (parameters)"))
+
+(defn improve-facts-factset-id-index []
+  (jdbc/do-commands
+    "DROP INDEX IF EXISTS facts_factset_id_idx"
+    "DROP INDEX IF EXISTS facts_factset_id_fact_path_id_idx"
+    "CREATE INDEX facts_factset_id_fact_path_id_idx ON facts(factset_id, fact_path_id)"))

 (def migrations
   "The available migrations, as a map from migration version to migration function."
@@ -1287,7 +1293,8 @@
    55 index-certnames-unique-latest-report-id
    56 merge-fact-values-into-facts
    57 add-package-tables
-   58 add-gin-index-on-resource-params-cache})
+   58 add-gin-index-on-resource-params-cache
+   59 improve-facts-factset-id-index})

 (def desired-schema-version (apply max (keys migrations)))


Fix config load.

Fix config load.

--- test/onyx/log/full_test.clj
+++ test/onyx/log/full_test.clj
@@ -10,7 +10,7 @@
             [zookeeper :as zk]))

 (facts "peers all join and watch each other"
-       (let [config (load-config "test-config.edn")
+       (let [config (load-config)
              onyx-id (java.util.UUID/randomUUID)
              env-config (assoc (:env-config config) :onyx/id onyx-id)
              peer-config (assoc (:peer-config config) :onyx/id onyx-id)


Fixed override

Fixed override

--- src/video_server/watcher.clj
+++ src/video_server/watcher.clj
@@ -93,10 +93,10 @@

 (defn- list-files
   "Lists files related to the video by title and filter."
-  [dir video filter]
+  [dir video filt]
   (let [file (io/file dir)]
-    (distinct (concat (.listFiles file ^FilenameFilter (filter (:title video)))
-                      (.listFiles file ^FilenameFilter (filter (norm-title (:title video))))))))
+    (distinct (concat (.listFiles file ^FilenameFilter (filt (:title video)))
+                      (.listFiles file ^FilenameFilter (filt (norm-title (:title video))))))))

 (defn add-images
   "Performs a scan for image files related to the title."


Ensure cmd evaluation is handled async in a go block

--- src/yetibot/core/handler.clj
+++ src/yetibot/core/handler.clj
@@ -5,6 +5,7 @@
     [yetibot.core.util.format :refer [to-coll-if-contains-newlines format-exception-log]]
     [yetibot.core.parser :refer [parse-and-eval]]
     [clojure.core.match :refer [match]]
+    [clojure.core.async :refer [timeout chan go <! >! >!! <!!]]
     [yetibot.core.chat :refer [chat-data-structure]]
     [clojure.string :refer [join]]
     [clojure.stacktrace :as st]))
@@ -20,11 +21,8 @@
      (handle-unparsed-expr body)))
   ([body] (parse-and-eval body)))

-
 (def ^:private exception-format "👮 %s 👮")

-; TODO: move handle-unparsed-expr calls out of the adapters and call it from
-; here instead
 (defn handle-raw
   "No-op handler for optional hooks.
    Expected event-types are:
@@ -35,18 +33,17 @@
    :kick"
   [chat-source user event-type body]
   ; only :message has a body
-  (when body
-    ; see if it looks like a command
-    (when-let [[_ body] (re-find #"^\!(.+)" body)]
-      (with-fresh-db
-        (try
-          (chat-data-structure
-            (handle-unparsed-expr chat-source user body))
-          (catch Throwable ex
-            (error
-              "error handling expression:" body
-              (format-exception-log ex))
-            (chat-data-structure (format exception-format ex))))))))
-
+  (go (when body
+        ; see if it looks like a command
+        (when-let [[_ body] (re-find #"^\!(.+)" body)]
+          (with-fresh-db
+            (try
+              (chat-data-structure
+                (handle-unparsed-expr chat-source user body))
+              (catch Throwable ex
+                (error
+                  "error handling expression:" body
+                  (format-exception-log ex))
+                (chat-data-structure (format exception-format ex)))))))))

 (defn cmd-reader [& args] (handle-unparsed-expr (join " " args)))


Throw exception if doesn't find country

Throw exception if doesn't find country

--- raw_data/convert_players.clj
+++ raw_data/convert_players.clj
@@ -22,7 +22,9 @@
 (defn club [s]
   (let [[_ club country-code] (re-find #"(\w+) \((\w+)\)" s)
         country (country-by-code country-code)]
-    { :name club, :country country }))
+    (if (nil? country)
+      (throw (Exception. (str "No country for " country-code)))
+      { :name club, :country country })))

 ; Player conversion
 (defn convert-player [country data]


- clojure/arrays: removed cached zero, useless now

--- clojure/arrays.clj
+++ clojure/arrays.clj
@@ -29,7 +29,7 @@
 (defregister X 25)

 (defmacro with-next [& body]
-  `(do ~@body (recur (inc ~'pc) ~'zero ~'arrays)))
+  `(do ~@body (recur (inc ~'pc) ~'arrays)))

 (defn run [^ints code]
   (with-open [out (java.io.FileOutputStream. (java.io.FileDescriptor/out))]
@@ -40,13 +40,12 @@
           r (int-array 8 0)]
       (aset arrays 0 code)
       (loop [pc 0
-             zero code
              arrays arrays]
-        (let [ins (aget zero pc)
+        (let [ins (aget ^ints (aget arrays 0) pc)
               op (bit-and (bit-shift-right ins 28) 15)]
           ; (printf "%3d %d %d %d %d %d\n" pc op (A) (B) (C) (X))
           (case op
-            0 (with-next (if (zero? (C)) r (A (B))))
+            0 (with-next (when-not (zero? (C)) (A (B))))
             1 (with-next (A (aget ^ints (aget arrays (B)) (C))))
             2 (with-next (aset ^ints (aget arrays (A)) (B) (C)))
             3 (with-next (A (unchecked-add-int (B) (C))))
@@ -78,8 +77,8 @@
             12 (if-not (zero? (B))
                  (let [zero (aclone ^ints (aget arrays (B)))]
                    (aset arrays 0 zero)
-                   (recur (C) zero arrays))
-                 (recur (C) zero arrays))
+                   (recur (C) arrays))
+                 (recur (C) arrays))
             13 (with-next (X (bit-and ins 0x1ffffff)))
             (throw (ex-info "unknown opcode" {:opcode ins}))))
         ))))


Set production IP

Set production IP

--- src/clojure/uk/org/potentialdifference/darknet/config.clj
+++ src/clojure/uk/org/potentialdifference/darknet/config.clj
@@ -1,6 +1,8 @@
 (ns uk.org.potentialdifference.darknet.config)

+(def ip "192.168.1.24")
+
 (def config
-  {:ws-url "wss://192.168.0.6:8081"
-   :api-url "http://192.168.0.6:8080"
+  {:ws-url  (str "wss://" ip ":8081")
+   :api-url (str "http://") ip ":8080"
    :api-key "x9RHJ2I6nWi376Wa"})


Fix curate tool name conflict

Fix curate tool name conflict

--- dev/curate.clj
+++ dev/curate.clj
@@ -88,9 +88,9 @@
 ;; the EDN files in a directory with `save-sources`.

 (comment
-  (save-sources "sources/california/H02V09-35.edn" 25)
-  (save-sources "sources/california/H02V09-627.edn" 25)
-  (save-sources "sources/california/H02V09-857.edn" 25))
+  (save-sources "sources/california/H02V09-35.edn" 1)
+  (save-sources "sources/california/H02V09-627.edn" 1)
+  (save-sources "sources/california/H02V09-857.edn" 1))

 ;; Step 4: See how things are going. This will inspect the
 ;; sources table for activity and check the most recent
@@ -141,7 +141,7 @@
        (partition 2)
        (map (partial pair->source base-uri)))))

-(defn save-sources
+(defn save-source-as-edn
   "Produce an EDN file containing sources (id, checksum, uri).

   Because the list of sources only contains the filename and checksum,
@@ -191,5 +191,5 @@
   "
   (def ^:dynamic *base-uri* "https://edclpdsftp.cr.usgs.gov/downloads/lcmap")
   (let [files (dir->files "sites/lakes")
-        saver #(save-sources *base-uri* % "data/sources/lakes")]
+        saver #(save-source-as-edn *base-uri* % "data/sources/lakes")]
     (dorun (pmap saver files))))


Increase deployment timeout

Increase deployment timeout

--- support/build-support/src/main/clojure/fnbox/build/tools.clj
+++ support/build-support/src/main/clojure/fnbox/build/tools.clj
@@ -72,10 +72,9 @@
     (when-not (.exists to-file)
       (io/copy file to-file))))

-(defn increase-deployment-timeout [xml]
-  xml)
+(defn increase-deployment-timeout [loc]
+  (zip/edit loc #(assoc-in % [:attrs :deployment-timeout] "false")))

-;; TODO Is there really a danger of the fnbox exts being there?
 (defn add-extension [loc name]
   (let [module-name (str "org.fnbox." name)]
     (zip/append-child loc {:tag :extension :attrs {:module module-name}})))
@@ -83,7 +82,6 @@
 (defn add-extensions [loc]
   (reduce add-extension loc (keys fnbox-modules)))

-;; TODO Is there really a danger of the fnbox subs being there?
 (defn add-subsystem [loc name]
   (let [module-name (str "urn:jboss:domain:fnbox-" name ":1.0")]
     (zip/append-child loc {:tag :subsystem :attrs {:xmlns module-name}})))
@@ -130,6 +128,7 @@
              (looking-at? :virtual-server loc) (set-welcome-root loc)
              (looking-at? :system-properties loc) (unquote-cookie-path loc)
              (looking-at? :jms-destinations loc) (zip/remove loc)
+             (looking-at? :deployment-scanner loc) (increase-deployment-timeout loc)
              :else loc)))))

 (defn transform-config [file]


addressed merge conflicts

addressed merge conflicts

--- search-app/src/cmr/search/data/elastic_relevancy_scoring.clj
+++ search-app/src/cmr/search/data/elastic_relevancy_scoring.clj
@@ -68,7 +68,7 @@
   (let [use-keyword-sort? (keywords-extractor/contains-keyword-condition? query)
         use-usage-sort? (seq (->> query
                                   :sort-keys
-                                  (filter #(= :usage-relevancy-score (:field %)))))
+                                  (filter #(= :usage-relevancy-score (:field %)))))
         use-temporal-sort? (and (temporal-conditions/contains-temporal-conditions? query)
                                 (sort-use-temporal-relevancy))]
     (seq
@@ -102,7 +102,7 @@
        (when use-keyword-sort?
          [{:end-date {:order :desc
                       :missing (time-coerce/to-long (time/now))}}
-          {:processing-level-id.lowercase.humanized {:order :desc}}])))))
+          {:processing-level-id-lowercase.humanized {:order :desc}}])))))

 (defn- temporal-sort-order
   "If there are temporal ranges in the query and temporal relevancy sorting is turned on,


[fix 5903] fix empty screen when navigating back in create-account

--- src/status_im/accounts/create/core.cljs
+++ src/status_im/accounts/create/core.cljs
@@ -95,7 +95,7 @@

 (defn step-back [step cofx]
   (case step
-    :enter-password (navigation/navigate-back (:db cofx))
+    :enter-password (navigation/navigate-back cofx)
     :confirm-password (reset-account-creation cofx)))

 ;;;; COFX


Test that an address was added, but not that the DB was empty.

--- test/circle/web/test_web.clj
+++ test/circle/web/test_web.clj
@@ -35,6 +35,5 @@
     get-response => (contains {:status 200})
     body => #"Thanks"
     body =not=> #"form"
-    db-entries-before => 0
-    db-entries-after => 1))
+    db-entries-after => (+ 1 db-entries-before)))


Show debug buttons more clearly

Show debug buttons more clearly

Show debug buttons more clearly

--- src/webapp/framework/client/components/system_container.cljs
+++ src/webapp/framework/client/components/system_container.cljs
@@ -389,16 +389,22 @@
                                            #js {
                                                 :marginTop "30px"
                                                 }}
-                                      (dom/button #js {:onClick (fn [e]
+                                      (dom/button #js {:style #js  {:margin "10px" :color "red"}
+
+                                                       :onClick (fn [e]
                                                                   (om/root ankha/inspector app-state
                                                                            {:target (js/document.getElementById "playback_state")})
                                                                   nil )} "UI state")

-                                      (dom/button #js {:onClick (fn [e]
+                                      (dom/button #js {:style #js  {:margin "10px" :color "blue"}
+
+                                                       :onClick (fn [e]
                                                                   (om/root ankha/inspector data-state
                                                                            {:target (js/document.getElementById "data_state")})
                                                                   nil )} "Data state")
-                                      (dom/button #js {:onClick (fn [e]
+                                      (dom/button #js {:style #js  {:margin "10px" :color "green"}
+
+                                                       :onClick (fn [e]
                                                                   (admin)
                                                                   nil )} "Admin")
                                       ))


added slamhound for ns cleanups

added slamhound for ns cleanups

--- profiles.clj
+++ profiles.clj
@@ -2,5 +2,6 @@
         :plugins [[cider/cider-nrepl "0.9.1"]
                   [refactor-nrepl "1.1.0"]
                   [lein-midje "3.1.3"]]
-        :dependencies [[org.clojure/tools.nrepl "0.2.7"]]
+        :dependencies [[org.clojure/tools.nrepl "0.2.7"]
+                       [slamhound "1.5.5"]]
         }}


Added show-table tool

Added show-table tool

--- profiles.clj
+++ profiles.clj
@@ -14,6 +14,7 @@
                         :upload-list
                         :histories
                         :hello-world
+                        :show-table
                         ]
             :web-audience "http://localhost:3000"
             :verifier "https://verifier.login.persona.org/verify"


Handle web requests asynchronously using Aleph and core.async

--- clstreams/src/clstreams/webapi.clj
+++ clstreams/src/clstreams/webapi.clj
@@ -1,6 +1,8 @@
 (ns clstreams.webapi
   (:require [bidi.ring :as bidi]
+            [clojure.core.async :refer [<! go timeout]]
             [clstreams.webapi.component :refer [new-aleph]]
+            [manifold.stream :as stream]
             [ring.middleware.json :refer [wrap-json-body wrap-json-response]]
             [ring.util.response :refer [response]])
   (:import org.apache.kafka.streams.state.QueryableStoreTypes))
@@ -15,8 +17,17 @@
   (bidi/make-handler
    [["/word-count/" :word] (make-word-count-handler component)]))

+(defn make-async-handler [component]
+  (fn [request]
+    (let [handler (make-main-handler component)]
+      (-> (go
+            (<! (timeout 900))
+            (handler request))
+          stream/->source
+          stream/take!))))
+
 (defn make-app [component]
-  (-> (make-main-handler component)
+  (-> (make-async-handler component)
       wrap-json-body
       wrap-json-response))


Fixed typo.

Fixed typo.

--- search-app/src/cmr/search/services/query_execution.clj
+++ search-app/src/cmr/search/services/query_execution.clj
@@ -37,7 +37,7 @@
   (and (specific-items-query? query)
        (t/transformer-supported-format? result-format)
        (not all-revisions?)
-       ;; Facets ant tags require elastic search
+       ;; Facets and tags require elastic search
        (not-any? #(contains? #{:facets :tags} %) result-features)
        ;; Sorting hasn't been specified or is set to the default value
        ;; Note that we don't actually sort items by the default sort keys


Remove reference to specs which are not ready yet

--- test/cddr/ksml/eval_test.clj
+++ test/cddr/ksml/eval_test.clj
@@ -4,7 +4,6 @@
    [cddr.ksml.eval :as k]
    [cddr.ksml.core :refer [ksml*]]
    [clojure.spec.alpha :as s]
-   [cddr.ksml.specs :as specs]
    [cddr.ksml.core :refer [ksml*]])
   (:import
    (org.apache.kafka.streams.kstream KStream KStreamBuilder )


Only run test in CLJ

Only run test in CLJ

--- test/expound/alpha_test.cljc
+++ test/expound/alpha_test.cljc
@@ -3267,8 +3267,8 @@
            #"No method in multimethod"
            (printer-str {:print-specs? false} ed))))))

-(deftest macroexpansion-errors
-  (is (thrown-with-msg?
-       #?(:cljs :default :clj Exception)
-       #"should have additional elements. The next element \"\:init\-expr\" should satisfy"
-       (macroexpand `(let [~'a] 2)))))
+#?(:clj (deftest macroexpansion-errors
+          (is (thrown-with-msg?
+               #?(:cljs :default :clj Exception)
+               #"should have additional elements. The next element \"\:init\-expr\" should satisfy"
+               (macroexpand '(clojure.core/let [a] 2))))))


Test for deleted module

Test for deleted module

--- test/hurvinek/utils_test.clj
+++ test/hurvinek/utils_test.clj
@@ -1,337 +0,0 @@
-;
-;  (C) Copyright 2016  Pavel Tisnovsky
-;
-;  All rights reserved. This program and the accompanying materials
-;  are made available under the terms of the Eclipse Public License v1.0
-;  which accompanies this distribution, and is available at
-;  http://www.eclipse.org/legal/epl-v10.html
-;
-;  Contributors:
-;      Pavel Tisnovsky
-;
-
-(ns hurvinek.utils-test
-  (:require [clojure.test :refer :all]
-            [hurvinek.utils :refer :all]))
-
-;
-; Common functions used by tests.
-;
-
-(defn callable?
-    "Test if given function-name is bound to the real function."
-    [function-name]
-    (clojure.test/function? function-name))
-
-;
-; Tests for various function definitions
-;
-
-(deftest test-third-existence
-    "Check that the hurvinek.utils/third definition exists."
-    (testing "if the hurvinek.utils/third definition exists."
-        (is (callable? 'hurvinek.utils/third))))
-
-
-(deftest test-fourth-existence
-    "Check that the hurvinek.utils/fourth definition exists."
-    (testing "if the hurvinek.utils/fourth definition exists."
-        (is (callable? 'hurvinek.utils/fourth))))
-
-
-(deftest test-substring-existence
-    "Check that the hurvinek.utils/substring definition exists."
-    (testing "if the hurvinek.utils/substring definition exists."
-        (is (callable? 'hurvinek.utils/substring))))
-
-
-(deftest test-startsWith-existence
-    "Check that the hurvinek.utils/startsWith definition exists."
-    (testing "if the hurvinek.utils/startsWith definition exists."
-        (is (callable? 'hurvinek.utils/startsWith))))
-
-
-(deftest test-endsWith-existence
-    "Check that the hurvinek.utils/endsWith definition exists."
-    (testing "if the hurvinek.utils/endsWith definition exists."
-        (is (callable? 'hurvinek.utils/endsWith))))
-
-
-(deftest test-contains-existence
-    "Check that the hurvinek.utils/contains definition exists."
-    (testing "if the hurvinek.utils/contains definition exists."
-        (is (callable? 'hurvinek.utils/contains))))
-
-
-(deftest test-replaceAll-existence
-    "Check that the hurvinek.utils/replaceAll definition exists."
-    (testing "if the hurvinek.utils/replaceAll definition exists."
-        (is (callable? 'hurvinek.utils/replaceAll))))
-
-
-(deftest test-get-exception-message-existence
-    "Check that the hurvinek.utils/get-exception-message definition exists."
-    (testing "if the hurvinek.utils/get-exception-message definition exists."
-        (is (callable? 'hurvinek.utils/get-exception-message))))
-
-;
-; Tests for behaviour of all functions
-;
-
-(deftest test-get-exception-message-1
-    "Check the function hurvinek.utils/get-exception-message."
-    (testing "the function hurvinek.utils/get-exception-message."
-        (try
-            (throw (new java.lang.Exception "Message text"))
-            (is nil "Exception not thrown as expected!")
-            (catch Exception e
-                (is (= "Message text" (get-exception-message e)))))))
-
-(deftest test-get-exception-message-2
-    "Check the function hurvinek.utils/get-exception-message."
-    (testing "the function hurvinek.utils/get-exception-message."
-        (try
-            (/ 1 0)
-            (is nil "Exception not thrown as expected!")
-            (catch Exception e
-                (is (= "Divide by zero" (get-exception-message e)))))))
-
-(deftest test-get-exception-message-3
-    "Check the function hurvinek.utils/get-exception-message."
-    (testing "the function hurvinek.utils/get-exception-message."
-        (try
-            (Integer/parseInt "unparseable")
-            (is nil "Exception not thrown as expected!")
-            (catch Exception e
-                (is (.startsWith (get-exception-message e) "For input string:"))))))
-
-(deftest test-get-exception-message-4
-    "Check the function hurvinek.utils/get-exception-message."
-    (testing "the function hurvinek.utils/get-exception-message."
-        (try
-            (throw (new java.lang.Exception ""))
-            (is nil "Exception not thrown as expected!")
-            (catch Exception e
-                (is (= "" (get-exception-message e)))))))
-
-(deftest test-get-exception-message-5
-    "Check the function hurvinek.utils/get-exception-message."
-    (testing "the function hurvinek.utils/get-exception-message."
-        (try
-            (throw (new java.lang.Exception))
-            (is nil "Exception not thrown as expected!")
-            (catch Exception e
-                (is (nil? (get-exception-message e)))))))
-
-(deftest test-get-exception-message-6
-    "Check the function hurvinek.utils/get-exception-message."
-    (testing "the function hurvinek.utils/get-exception-message."
-        (try
-            (println (nth [] 10)) ; realize the sequence and getter
-            (is nil "Exception not thrown as expected!")
-            (catch Exception e
-                (is (nil? (get-exception-message e)))))))
-
-(deftest test-third-1
-    "Check the function hurvinek.utils/third."
-    (testing "the function hurvinek.utils/third."
-        (are [x y] (= x y)
-            3 (third [1 2 3])
-            3 (third [1 2 3 4 5])
-            3 (third '(1 2 3))
-            3 (third '(1 2 3 4 5)))))
-
-(deftest test-third-2
-    "Check the function hurvinek.utils/third."
-    (testing "the function hurvinek.utils/third."
-        (are [x y] (= x y)
-            nil (third [])
-            nil (third '())
-            nil (third [1])
-            nil (third '(1))
-            nil (third [1 2])
-            nil (third '(1 2)))))
-
-(deftest test-third-not-NPE
-    "Check the function hurvinek.utils/third."
-    (testing "the function hurvinek.utils/third."
-        (are [x y] (= x y)
-            nil (third nil))))
-
-(deftest test-fourth-1
-    "Check the function hurvinek.utils/fourth."
-    (testing "the function hurvinek.utils/fourth."
-        (are [x y] (= x y)
-            4 (fourth [1 2 3 4 5])
-            4 (fourth '(1 2 3 4))
-            4 (fourth '(1 2 3 4 5)))))
-
-(deftest test-fourth-2
-    "Check the function hurvinek.utils/fourth."
-    (testing "the function hurvinek.utils/fourth."
-        (are [x y] (= x y)
-            nil (fourth [])
-            nil (fourth '())
-            nil (fourth [1])
-            nil (fourth '(1))
-            nil (fourth [1 2])
-            nil (fourth '(1 2))
-            nil (fourth [1 2 3])
-            nil (fourth '(1 2 3)))))
-
-(deftest test-fourth-not-NPE
-    "Check the function hurvinek.utils/fourth."
-    (testing "the function hurvinek.utils/fourth."
-        (are [x y] (= x y)
-            nil (fourth nil))))
-
-(deftest test-substring-1
-    "Check the function hurvinek.utils/substring."
-    (testing "the function hurvinek.utils/substring."
-        (are [x y] (= x y)
-            "H"      (substring "Hello world!" 0 1)
-            "He"     (substring "Hello world!" 0 2)
-            "Hello"  (substring "Hello world!" 0 5)
-            "Hello " (substring "Hello world!" 0 6))))
-
-(deftest test-substring-2
-    "Check the function hurvinek.utils/substring."
-    (testing "the function hurvinek.utils/substring."
-        (are [x y] (= x y)
-            "w"      (substring "Hello world!" 6 7)
-            "wo"     (substring "Hello world!" 6 8)
-            "world"  (substring "Hello world!" 6 11)
-            "world!" (substring "Hello world!" 6 12))))
-
-(deftest test-substring-3
-    "Check the function hurvinek.utils/substring."
-    (testing "the function hurvinek.utils/substring."
-        (are [x y] (= x y)
-            "Hello world!" (substring "Hello world!" 0)
-            "ello world!"  (substring "Hello world!" 1)
-            "world!"       (substring "Hello world!" 6)
-            "!"            (substring "Hello world!" 11)
-            ""             (substring "Hello world!" 12))))
-
-(deftest test-substring-empty-result
-    "Check the function hurvinek.utils/substring."
-    (testing "the function hurvinek.utils/substring."
-        (are [x y] (= x y)
-            "" (substring "Hello world!" 0 0)
-            "" (substring "Hello world!" 1 1)
-            "" (substring "Hello world!" 2 2)
-            "" (substring "Hello world!" 10 10))))
-
-(deftest test-substring-NPE
-    "Check the function hurvinek.utils/substring."
-    (testing "the function hurvinek.utils/substring."
-        (is (thrown? NullPointerException (substring nil 0 0)))
-        (is (thrown? NullPointerException (substring "" nil 0)))
-        (is (thrown? NullPointerException (substring "" 0 nil)))))
-
-(deftest test-contains-1
-    "Check the function hurvinek.utils/contains."
-    (testing "the function hurvinek.utils/contains."
-        (are [x y] (= x y)
-            false (contains "Hello world!" "h")
-            true  (contains "Hello world!" "H")
-            true  (contains "Hello world!" " ")
-            true  (contains "Hello world!" "!"))))
-
-(deftest test-contains-2
-    "Check the function hurvinek.utils/contains."
-    (testing "the function hurvinek.utils/contains."
-        (are [x y] (= x y)
-            false (contains "Hello world!" "hello")
-            true  (contains "Hello world!" "Hello")
-            true  (contains "Hello world!" "o w")
-            true  (contains "Hello world!" "world!"))))
-
-(deftest test-contains-NPE
-    "Check the function hurvinek.utils/contains."
-    (testing "the function hurvinek.utils/contains."
-        (is (thrown? NullPointerException (contains nil "")))
-        (is (thrown? NullPointerException (contains "" nil)))
-        (is (thrown? NullPointerException (contains nil nil)))))
-
-(deftest test-starts-with-1
-    "Check the function hurvinek.utils/starts-with."
-    (testing "the function hurvinek.utils/starts-with."
-        (are [x y] (= x y)
-            false (startsWith "Hello world!" "hello")
-            true  (startsWith "Hello world!" "Hello")
-            true  (startsWith "Hello world!" "H")
-            true  (startsWith "Hello world!" ""))))
-
-(deftest test-starts-with-2
-    "Check the function hurvinek.utils/starts-with."
-    (testing "the function hurvinek.utils/starts-with."
-        (are [x y] (= x y)
-            false (startsWith "" "hello")
-            false (startsWith "" "Hello")
-            false (startsWith "" "H")
-            true  (startsWith "" ""))))
-
-(deftest test-starts-with-NPE
-    "Check the function hurvinek.utils/starts-with."
-    (testing "the function hurvinek.utils/starts-with."
-        (is (thrown? NullPointerException (startsWith nil nil)))
-        (is (thrown? NullPointerException (startsWith "text" nil)))
-        (is (thrown? NullPointerException (startsWith nil "text")))))
-
-(deftest test-ends-with-1 "Check the function hurvinek.utils/ends-with."
-    (testing "the function hurvinek.utils/ends-with."
-        (are [x y] (= x y)
-            true  (endsWith "Hello world!" "Hello world!")
-            false (endsWith "Hello world!" "hello world!")
-            true  (endsWith "Hello world!" "world!")
-            true  (endsWith "Hello world!" "!")
-            true  (endsWith "Hello world!" ""))))
-
-(deftest test-ends-with-2
-    "Check the function hurvinek.utils/ends-with."
-    (testing "the function hurvinek.utils/ends-with."
-        (are [x y] (= x y)
-            false (endsWith "" "hello")
-            false (endsWith "" "Hello")
-            false (endsWith "" "H")
-            true  (endsWith "" ""))))
-
-(deftest test-ends-with-NPE
-    "Check the function hurvinek.utils/ends-with."
-    (testing "the function hurvinek.utils/ends-with."
-        (is (thrown? NullPointerException (endsWith nil nil)))
-        (is (thrown? NullPointerException (endsWith "text" nil)))
-        (is (thrown? NullPointerException (endsWith nil "text")))))
-
-(deftest test-replaceAll-1
-    "Check the function hurvinek.utils/replaceAll."
-    (testing "the function hurvinek.utils/replaceAll."
-        (are [x y] (= x y)
-            ""    (replaceAll "" "" "")
-            "b"   (replaceAll "a" "a" "b")
-            "bb"  (replaceAll "aa" "a" "b")
-            "bcb" (replaceAll "aca" "a" "b"))))
-
-(deftest test-replaceAll-2
-    "Check the function hurvinek.utils/replaceAll."
-    (testing "the function hurvinek.utils/replaceAll."
-        (are [x y] (= x y)
-            "b"     (replaceAll "aa" "aa" "b")
-            "bb"    (replaceAll "aaaa" "aa" "b")
-            "xbbx"  (replaceAll "xaaaax" "aa" "b")
-            "xbxbx" (replaceAll "xaaxaax" "aa" "b"))))
-
-(deftest test-replaceAll-not-NPE
-    "Check the function hurvinek.utils/replaceAll."
-    (testing "the function hurvinek.utils/replaceAll."
-        (is (= "a" (replaceAll "a" "b" nil)))))
-
-(deftest test-replaceAll-NPE
-    "Check the function hurvinek.utils/replaceAll."
-    (testing "the function hurvinek.utils/replaceAll."
-        (is (thrown? NullPointerException (replaceAll nil "a" "b")))
-        (is (thrown? NullPointerException (replaceAll "a" nil "b")))
-        (is (thrown? NullPointerException (replaceAll "a" "a" nil)))
-        (is (thrown? NullPointerException (replaceAll nil nil "b")))))
-


Try this

Try this

--- test/littlepot/core_test.clj
+++ test/littlepot/core_test.clj
@@ -70,10 +70,10 @@
         (Thread/sleep 500)
         (is (= (range 10) (take 10 (repeatedly #(cook pot)))))
         ;; next portion is unavailable
+        (Thread/sleep 200)
         (if (< batch-num 2)
           (is (every? #(= % :no-data)
                       (take 20 (repeatedly #(cook pot)))))
-          (Thread/sleep 200)
           (is (every? #(= % :exhausted)
                       (take 20 (repeatedly #(cook pot)))))
           )))))


[scamp] apply schema to 'read-mail

[scamp] apply schema to 'read-mail

--- modules/scamp/src/scamp/core.clj
+++ modules/scamp/src/scamp/core.clj
@@ -347,8 +347,8 @@
         (add-new-node new-node)
         (add-messages new-messages))))

-(defn read-mail
-  "Take a 'destination-node and a 'message.
+(s/defn read-mail :- CommUpdateSchema
+  "Take a 'destination-node and a message.

   Process the message for 'destination-node and return a vector
   matching 'CommUpdateSchema.


[scamp] refactor 'add-messages to use 'concatv

--- modules/scamp/src/scamp/core.clj
+++ modules/scamp/src/scamp/core.clj
@@ -311,7 +311,7 @@
   messages added."
   [world :- WorldSchema
    new-messages :- [MessageEnvelopeSchema]]
-  (update-in world [:message-envelopes] concat new-messages))
+  (update-in world [:message-envelopes] concatv new-messages))

 (s/defn subscribe :- WorldSchema
   "Given 'world, a 'new-node-contact-address for the node that is


tests of recent code

tests of recent code

--- test/foosball/test/stats.clj
+++ test/foosball/test/stats.clj
@@ -1,5 +1,8 @@
 (ns foosball.test.stats
-  (:use midje.sweet foosball.statistics.core foosball.statistics.ratings foosball.statistics.team-player))
+  (:use midje.sweet
+        foosball.statistics.core
+        foosball.statistics.ratings
+        foosball.statistics.team-player))

 (facts "about determining winners"
        (let [winning-team     {:score 10 :player1 ...wp1... :player2 ...wp2...}
@@ -59,3 +62,28 @@
                                                      "Lisse" 1498.5273111823453,
                                                      "Maria" 1483.7061014233586,
                                                      "Thomas" 1516.0}))
+
+(facts "about player log when applied to example matches"
+       (let [{:keys [logs]} (ratings-with-log example-matches)
+             thomas-logs    (->> logs (filter (fn [l] (= "Thomas" (:player l)))) vec)]
+         (fact "it should match the example log for Thomas"
+               (count thomas-logs) => 3
+               (map :new-rating thomas-logs) => (just [1484.0 (roughly 1500.29 0.009) 1516.0]))))
+
+(facts "about player form when applied to example matches"
+       (let [{:keys [logs]} (ratings-with-log example-matches)]
+         (fact "it should calculate as expected"
+               (calculate-current-form-for-player logs 5 "Thomas")     => [false true true]
+               (calculate-current-form-for-player logs 2 "Thomas")     => [true true]
+               (calculate-current-form-for-player logs 1 "Thomas")     => [true]
+               (calculate-current-form-for-player logs 5 "Anders")     => [false false false true]
+               (calculate-current-form-for-player logs 5 "Lisse")      => [true false true false]
+               (calculate-current-form-for-player logs 5 "Knud Erik")  => [true true]
+               (calculate-current-form-for-player logs 5 "Maria")      => [true false false])))
+
+(facts "about possible-matchups"
+       (fact "the number of results is bound to the size of the input"
+             (possible-matchups (range 4)) => (just (repeat 3 anything))
+             (possible-matchups (range 5)) => (just (repeat 15 anything))
+             (possible-matchups (range 6)) => (just (repeat 45 anything))
+             (possible-matchups (range 7)) => (just (repeat 105 anything))))


CMR-2911: Fixing bad type hint.

CMR-2911: Fixing bad type hint.

--- common-lib/src/cmr/common/jobs.clj
+++ common-lib/src/cmr/common/jobs.clj
@@ -13,7 +13,7 @@
             [clojurewerkz.quartzite.schedule.calendar-interval :as qcal]
             [clojurewerkz.quartzite.schedule.cron :as qcron]
             [clojurewerkz.quartzite.conversion :as qc])
-  (:import org.quartz.core.QuartzScheduler))
+  (:import org.quartz.impl.StdScheduler))

 (defn defjob*
   "The function that does the bulk of the work for the def job macros."
@@ -207,7 +207,7 @@
    running?

    ;; Instance of a quartzite scheduler
-   ^QuartzScheduler qz-scheduler]
+   ^StdScheduler qz-scheduler]

   l/Lifecycle


cjl - Formatting

cjl - Formatting

--- test/icfp2015/board_test.clj
+++ test/icfp2015/board_test.clj
@@ -67,8 +67,8 @@
                   :current-unit { :members #{ [ 5 0 ] [ 6 5] }
                                   :pivot [ 0 0 ] } }
           expected-board { :width 10
-                         :height 15
-                         :filled #{ [6 6] [5 0] [6 5] }
-                         :current-unit nil }
+                           :height 15
+                           :filled #{ [6 6] [5 0] [6 5] }
+                           :current-unit nil }
           actual-board (lock-current-unit board)]
       (is (= expected-board actual-board)))))


Fixed kibit

Fixed kibit

--- test/littlepot/core_test.clj
+++ test/littlepot/core_test.clj
@@ -52,8 +52,6 @@
       (Thread/sleep 300)
       ;; it's actually exhausted
       (is (every? #(= % :exhausted) (take 10 (repeatedly #(cook pot)))))
-
-
       )))

 (deftest test-exhaustion


More descriptive heading.

More descriptive heading.

--- test/isla/test/story.clj
+++ test/isla/test/story.clj
@@ -41,7 +41,7 @@
            (instantiate-with "room" :name "palace"
                              :exit (instantiate-with "room" :name "garden"))))))

-;; story telling
+;; look

 (deftest test-look-general
   (let [summary "The floors are made of marble."


Finally keep defn on a separate line from #?(:clj).

--- test/zprint/zprint_test.cljc
+++ test/zprint/zprint_test.cljc
@@ -1302,16 +1302,14 @@
     (zprint-str "(let [a b c d e f] (list a b c d e f))"
                 {:parse-string? true, :binding {:flow? true}}))

-  ;!zprint {:format :skip}
-  ; Something strange going on with source-fn and :clj!
-  #?(:clj
-  (deftype Typetest [cnt _meta]
-            clojure.lang.IHashEq
-              (hasheq [this] (list this))
-            clojure.lang.Counted
-              (count [_] cnt)
-            clojure.lang.IMeta
-              (meta [_] _meta)))
+  #?(:clj  ; Keep the deftype on the next line
+       (deftype Typetest [cnt _meta]
+         clojure.lang.IHashEq
+           (hasheq [this] (list this))
+         clojure.lang.Counted
+           (count [_] cnt)
+         clojure.lang.IMeta
+           (meta [_] _meta)))

   (def Typeteststr
     "(deftype Typetest [cnt _meta]
@@ -1534,20 +1532,17 @@
   ;; # :extend -- support :hang? for :extend
   ;;

-
-  ;!zprint {:format :skip}
-  ; Something strange going on with source-fn and :clj!
-  #?(:clj
-  (deftype Typetest1 [cnt _meta]
-            clojure.lang.IHashEq
-              (hasheq [this]
-                (list this)
-                (list this this)
-                (list this this this this))
-            clojure.lang.Counted
-              (count [_] cnt)
-            clojure.lang.IMeta
-              (meta [_] _meta)))
+  #?(:clj  ; Keep the deftype on the next line
+       (deftype Typetest1 [cnt _meta]
+         clojure.lang.IHashEq
+           (hasheq [this]
+             (list this)
+             (list this this)
+             (list this this this this))
+         clojure.lang.Counted
+           (count [_] cnt)
+         clojure.lang.IMeta
+           (meta [_] _meta)))

   (def Typetest1str
     "(deftype Typetest1 [cnt _meta]
@@ -1610,28 +1605,26 @@
   ;; # Test a variant form of cond with :nl-separator?
   ;;

-  ;!zprint {:format :skip}
-  ; Something strange going on with defn/def source-fn and :clj!
-  #?(:clj
-  (defn zctest8x
-            []
-            (let [a (list 'with 'arguments)
-                  foo nil
-                  bar true
-                  baz "stuff"
-                  other 1
-                  bother 2
-                  stuff 3
-                  now 4
-                  output 5
-                  b 3
-                  c 5
-                  this "is"]
-              (cond (or foo bar baz) (format output now)
-                    :let [stuff (and bother foo bar)
-                          bother (or other output foo)]
-                    (and a b c (bother this)) (format other stuff))
-              (list a :b :c "d"))))
+  #?(:clj  ; Keep the defn off the same line.
+       (defn zctest8x
+         []
+         (let [a (list 'with 'arguments)
+               foo nil
+               bar true
+               baz "stuff"
+               other 1
+               bother 2
+               stuff 3
+               now 4
+               output 5
+               b 3
+               c 5
+               this "is"]
+           (cond (or foo bar baz) (format output now)
+                 :let [stuff (and bother foo bar)
+                       bother (or other output foo)]
+                 (and a b c (bother this)) (format other stuff))
+           (list a :b :c "d"))))

   (def zctest8xstr
     "(defn zctest8x


Minor changes on tools.clj script.

Minor changes on tools.clj script.

--- tools.clj
+++ tools.clj
@@ -20,28 +20,26 @@
     (println "Unknown or missing task. Choose one of:" interposed)
     (System/exit 1)))

-(defmethod task "repl"
-  [[_ type]]
-  (case type
-    (nil "clj")
-    (rebel-readline.core/with-line-reader
-      (rebel-readline.clojure.line-reader/create
-       (rebel-readline.clojure.service.local/create))
-      (clojure.main/repl
-       :prompt (fn []) ;; prompt is handled by line-reader
-       :read (rebel-readline.clojure.main/create-repl-read)))
+(defmethod task "repl:jvm"
+  [args]
+  (rebel-readline.core/with-line-reader
+    (rebel-readline.clojure.line-reader/create
+     (rebel-readline.clojure.service.local/create))
+    (clojure.main/repl
+     :prompt (fn []) ;; prompt is handled by line-reader
+     :read (rebel-readline.clojure.main/create-repl-read))))

-    "node"
-    (rebel-readline.core/with-line-reader
-      (rebel-readline.clojure.line-reader/create (rebel-readline.cljs.service.local/create))
-      (cljs.repl/repl
-       (node/repl-env)
-       :prompt (fn []) ;; prompt is handled by line-reader
-       :read (rebel-readline.cljs.repl/create-repl-read)
-       :output-dir "out"
-       :cache-analysis false))
-    (println "Unknown repl: " type)
-    (System/exit 1)))
+(defmethod task "repl:node"
+  [args]
+  (rebel-readline.core/with-line-reader
+    (rebel-readline.clojure.line-reader/create
+     (rebel-readline.cljs.service.local/create))
+    (cljs.repl/repl
+     (node/repl-env)
+     :prompt (fn []) ;; prompt is handled by line-reader
+     :read (rebel-readline.cljs.repl/create-repl-read)
+     :output-dir "out"
+     :cache-analysis false)))

 (def options
   {:main 'promesa.core-tests


layouter should skip comment nodes (for now)

--- cljs/src/main/plastic/cogs/editor/layout/code.cljs
+++ cljs/src/main/plastic/cogs/editor/layout/code.cljs
@@ -20,12 +20,12 @@
 (defn current-line-id []
   *line-id*)

-(defn code-related? [loc]
+(defn strip-comments-and-whitespaces-but-keep-linebreaks-policy [loc]
   (let [node (z/node loc)]
-    (or (node/linebreak? node) (not (node/whitespace? node)))))
+    (and (not (node/comment? node)) (or (node/linebreak? node) (not (node/whitespace? node))))))

-(def zip-down (partial zip-utils/zip-down code-related?))
-(def zip-right (partial zip-utils/zip-right code-related?))
+(def zip-down (partial zip-utils/zip-down strip-comments-and-whitespaces-but-keep-linebreaks-policy))
+(def zip-right (partial zip-utils/zip-right strip-comments-and-whitespaces-but-keep-linebreaks-policy))

 (defn collect-all-right [loc]
   (take-while zip-utils/valid-loc? (iterate zip-right loc)))


version bump cljfmt & eastwood

version bump cljfmt & eastwood

--- dot/lein/profiles.clj
+++ dot/lein/profiles.clj
@@ -2,8 +2,8 @@
  {:plugins [[lein-vanity "0.2.0" :exclusions [org.clojure/clojure]]
             [lein-ancient "0.6.15"]
             [lein-kibit "0.1.6"]
-            [jonase/eastwood "0.2.6"]
+            [jonase/eastwood "0.2.8"]
             ;;[com.billpiel/sayid "0.0.10"]
-            [lein-cljfmt "0.5.7"]]
+            [lein-cljfmt "0.6.0"]]
   :dependencies [[slamhound "1.5.5"]]
   :aliases {"slamhound" ["run" "-m" "slam.hound"]}}}


don't try to slurp until runtime

don't try to slurp until runtime

--- test/matross/test/helper.clj
+++ test/matross/test/helper.clj
@@ -11,13 +11,13 @@
          {:seq true})))

 (def vagrant-test-connection
-  (translate-ssh-config (slurp (System/getenv "TEST_SSH_CONF"))))
+  (memoize (fn [] (translate-ssh-config (slurp (System/getenv "TEST_SSH_CONF"))))))

 (defmacro task-tests
   "Evaluate the body against the test vm connection, exposed as conn"
   [conn & body]

-  `(let [~conn (ssh-connection vagrant-test-connection)]
+  `(let [~conn (ssh-connection (vagrant-test-connection))]
      (connect ~conn)
      ~@body
      (disconnect ~conn)))


test scoring of :category_all vs :description_all

--- test/wb_es/core_test.clj
+++ test/wb_es/core_test.clj
@@ -235,9 +235,10 @@

 (defn- has-hit [result id]
   (->> (get-in result [:hits :hits])
-       (some (fn [hit]
-               (= id
-                  (get-in hit [:_source :wbid]))))))
+       (filter (fn [hit]
+                 (= id
+                    (get-in hit [:_source :wbid]))))
+       (first)))

 (deftest gene-type-description-test
   (testing "gene descriptions"
@@ -254,9 +255,17 @@
   (testing "species of gene"
     (let [db (d/db datomic-conn)]
       (do
-        (index-datomic-entity (d/entity db [:gene/id "WBGene00030670"]))
         (testing "species name in search string"
-          (is (has-hit (search "C. briggsae") "WBGene00030670")))))))
+          (index-datomic-entity (d/entity db [:gene/id "WBGene00030670"]))
+          (is (has-hit (search "C. briggsae") "WBGene00030670")))
+        (testing "species name appear in :species ranked higher than appearing in descriptions"
+          (index-datomic-entity (d/entity db [:gene/id "PRJNA248911_FL82_04596"]))
+          (index-datomic-entity (d/entity db [:gene/id "WBGene00015146"]))
+          (let [hit (has-hit (search "C. elegans") "WBGene00015146")
+                ortholog-hit (has-hit (search "C. elegans") "PRJNA248911_FL82_04596")]
+            (clojure.pprint/pprint hit)
+            (clojure.pprint/pprint ortholog-hit)
+            (is (> (:_score hit) (:_score ortholog-hit)))))))))

 (deftest go-term-type-test
   (testing "go-term with creatine biosynthetic process as example"


CMR-1983: Removed debug logging

CMR-1983: Removed debug logging

--- metadata-db-app/src/cmr/metadata_db/data/oracle/concepts.clj
+++ metadata-db-app/src/cmr/metadata_db/data/oracle/concepts.clj
@@ -309,7 +309,7 @@
                              seq-name
                              (str/join "," (repeat (count values) "?")))]
             ;; Uncomment to debug what's inserted
-            (debug "Executing" stmt "with values" (pr-str values))
+            ; (debug "Executing" stmt "with values" (pr-str values))
             (j/db-do-prepared db stmt values)
             (after-save conn provider concept)


use list of types instead of storing the lastly seen type over and over again

--- corpusmaker.clj
+++ corpusmaker.clj
@@ -30,6 +30,7 @@
 (def *page-pattern*
   #"<([^<]+?)> <http://xmlns.com/foaf/0.1/page> <([^<]+?)> \.")

+(def *owl-Thing* "http://www.w3.org/2002/07/owl#Thing")
 (def *pages-db* "entities-pages")
 (def *types-db* "pages-types")
 (def *wikipage-filename* "wikipage_en.nt")
@@ -57,14 +58,15 @@
     (process-file filename collect-page)))

 (defn join-page-type
-  "Parse a N-TRIPLES statement and store the [page type] pair if match"
+  "Parse a N-TRIPLES statement and store the [page list(types)] pair if match"
   [statement]
   (let [[_ entity type_] (re-find *type-pattern* statement)]
-    (when entity
+    ; all instances are of type Thing hence not interesting for our use case
+    (when (and entity (not= type_ *owl-Thing*))
       (redis/select *pages-db*)
       (when-let [page (redis/get entity)]
         (redis/select *types-db*)
-        (redis/set page type_)))))
+        (redis/rpush page type_)))))

 (defn collect-pages-to-types
   "Parse a N-TRIPLES file to extract types to be joined with page db"


Make the table truncate op more smart.

Make the table truncate op more smart.

--- test/uxbox/tests/helpers.clj
+++ test/uxbox/tests/helpers.clj
@@ -26,9 +26,13 @@
       (mount/swap {#'uxbox.config/config +config+})
       (mount/start))
   (with-open [conn (up/get-conn)]
-    (sc/execute conn (str "truncate txlog, users, projects, pages, pages_history, "
-                          " color_collections, email_queue, image_collections, "
-                          " images CASCADE;")))
+    (let [sql (str "SELECT table_name FROM information_schema.tables "
+                   " WHERE table_schema = 'public' AND table_name != 'migrations';")
+          result (->> (sc/fetch conn sql)
+                      (map :table_name))]
+      (sc/execute conn (str "TRUNCATE "
+                            (apply str (interpose ", " result))
+                            " CASCADE;"))))
   (try
     (next)
     (finally


Docstring cleanup.

Docstring cleanup.

--- web/src/immutant/web/async.clj
+++ web/src/immutant/web/async.clj
@@ -181,13 +181,13 @@
 (defn send!
   "Send a message to the channel, asynchronously.

-   `message` can either be a String, File, InputStream, ISeq, or
-    byte[]. If it is a String, it will be encoded to the character set
-    of the response for HTTP streams, and as UTF-8 for
-    WebSockets. Files and InputStreams will be sent as up to 16k
-    chunks (each chunk being a byte[] message for WebSockets). Each
-    item in an ISeq will pass through `send!`, and can be any of the
-    valid message types.
+   `message` can either be a `String`, `File`, `InputStream`, `ISeq`,
+   or `byte[]`. If it is a `String`, it will be encoded to the character
+   set of the response for HTTP streams, and as UTF-8 for
+   WebSockets. `File`s and `InputStream`s will be sent as up to 16k
+   chunks (each chunk being a `byte[]` message for WebSockets). Each item
+   in an `ISeq` will pass through `send!`, and can be any of the valid
+   message types.

    The following options are supported in `options-map` [default]:

@@ -226,8 +226,8 @@
   The type of channel created depends on the request - if the request
   is a Websocket upgrade request, a Websocket channel will be created.
   Otherwise, an HTTP stream channel is created. You interact with both
-  channel types through the [[Channel]] protocol, and through the
-  given `callbacks`.
+  channel types using the other functions in this namespace, and
+  through the given `callbacks`.

   The callbacks common to both channel types are:


Untangled

Untangled

--- webui/src/webui/routes/api.clj
+++ webui/src/webui/routes/api.clj
@@ -47,10 +47,12 @@
   ; TODO handle nil or invalid data for spit
   ; TODO Do the yaml conversion in a functional way
 (.println System/out "")
- (info
-              {:meta (json/parse-string
-                       (get workspace :meta) true)
-               :data (map json/parse-string (get workspace :data))}))
+ (info (yaml/generate-string
+    {:workspace (json/parse-string
+             (get workspace :meta) true)
+     :artifacts (map
+             #(json/parse-string % true)
+             (get workspace :data))})))
   ;(def workspace-data (get workspace :data))
   ;(def workspace-meta (get workspace :meta))
   ;(spit (str savedir "/workspace.sav") yaml-workspace); TODO dynamic filename


Add recency sort as a sort order for A/B testing.

--- src-cljs/frontend/components/add_projects.cljs
+++ src-cljs/frontend/components/add_projects.cljs
@@ -197,7 +197,10 @@
         settings (:settings data)
         repos (:repos data)
         repo-filter-string (get-in settings [:add-projects :repo-filter-string])
-        show-forks (true? (get-in settings [:add-projects :show-forks]))]
+        show-forks (true? (get-in settings [:add-projects :show-forks]))
+        sort-order (if (= :new-recency-sort (om/get-shared owner [:ab-tests :new_add_projects]))
+                     :updated_at
+                     :name)]
     (html
      [:div.proj-wrapper
       (if-not (get-in settings [:add-projects :selected-org :login])
@@ -211,17 +214,17 @@
          :else [:div
                 (om/build repo-filter settings)
                 [:ul.proj-list
-                 (let [filtered-repos (sort-by :name (filter (fn [repo]
-                                                               (and
-                                                                (if show-forks
-                                                                  true
-                                                                  (not (:fork repo)))
-                                                                (-> repo
-                                                                    :name
-                                                                    (.toLowerCase)
-                                                                    (.indexOf (.toLowerCase repo-filter-string))
-                                                                    (not= -1))))
-                                                             repos))]
+                 (let [filtered-repos (sort-by sort-order (filter (fn [repo]
+                                                                    (and
+                                                                     (if show-forks
+                                                                       true
+                                                                       (not (:fork repo)))
+                                                                     (-> repo
+                                                                         :name
+                                                                         (.toLowerCase)
+                                                                         (.indexOf (.toLowerCase repo-filter-string))
+                                                                         (not= -1))))
+                                                                  repos))]
                    (map (fn [repo] (om/build repo-item {:repo repo
                                                         :settings settings}))
                         filtered-repos))]]))


Remove quotes

Remove quotes

--- src-cljs/frontend/components/add_projects.cljs
+++ src-cljs/frontend/components/add_projects.cljs
@@ -43,7 +43,7 @@
      [:div.orgname login]
      [:a.visit-org {:href (str (gh-utils/http-endpoint) "/" login)
                     :target "_blank"}
-      [:i.octicon.octicon-mark-github ""]]]))
+      [:i.octicon.octicon-mark-github]]]))

 (defn missing-org-info
   "A message explaining how to enable organizations which have disallowed CircleCI on GitHub."


Change copy here.

Change copy here.

--- src-cljs/frontend/components/integrations.cljs
+++ src-cljs/frontend/components/integrations.cljs
@@ -161,7 +161,7 @@
                    [:div.docker-cta
                     [:div.ctabox {:class "line"}
                      [:div
-                      [:p "Plans start at $19 per month. All plans include a free 14 day trial."]]
+                      [:p "All customers get a free container. Additional containers are $50/month."]]
                      (shared/home-button owner {:source "integrations/docker"})
                      [:div
                       [:p


refactored test

refactored test

--- test/todo/db_test.clj
+++ test/todo/db_test.clj
@@ -12,9 +12,9 @@
 (def a-date (clj-time.core/date-time 2020 01 01) )

 (defn addTodo []
-  (add-todo (new-todo "newTitle" a-date))
+  ; )
   (let [query-result (exec-raw ["SELECT * FROM TODOS"] :results )]
-    [(count query-result)
+    [(count query-result) => 1
      (:TITLE (first query-result))
      (:DATE (first query-result))
      ]
@@ -23,7 +23,12 @@

 (with-state-changes [(before :facts (delete TODOS))]
-  (fact "adding a todo result in one row in todos table"
-    (addTodo) => [1 "newTitle" (java.sql.Date. (clj-time.coerce/to-long a-date))]
-    ))
+                    (fact "adding a todo result in one row in todos table"
+                          (add-todo (new-todo "newTitle" a-date)) => number?
+                          (let [query-result (exec-raw ["SELECT * FROM TODOS"] :results)]
+                            (count query-result) => 1
+                            (:TITLE (first query-result)) => "newTitle"
+                            (:DATE (first query-result)) => (java.sql.Date. (clj-time.coerce/to-long a-date))

+                            )))
+


Turn off reflection warnings

Turn off reflection warnings

--- src/clojure/clojurewerkz/cassaforte/new_query_api.clj
+++ src/clojure/clojurewerkz/cassaforte/new_query_api.clj
@@ -13,6 +13,8 @@
   (:require [clojurewerkz.cassaforte.aliases :as alias]
             clojurewerkz.cassaforte.query.query-builder
             clojurewerkz.cassaforte.query.types))
+
+(set! *warn-on-reflection* false)

 (def ^:dynamic *batch* false)


guard against nil page id

guard against nil page id

--- src/braid/ui/views/pages/tag.cljs
+++ src/braid/ui/views/pages/tag.cljs
@@ -37,7 +37,8 @@
                                       (partial map :created-at)
                                       :messages))
                               reverse))
-        dummy (reaction (do (dispatch! :threads-for-tag {:tag-id @page-id})
+        dummy (reaction (do (when-let [tag-id @page-id]
+                              (dispatch! :threads-for-tag {:tag-id tag-id}))
                             nil))]
     (fn []
       (let [status (cond


Fix schema

Fix schema

--- src/cljc/salava/badge/endorsement_schemas.cljc
+++ src/cljc/salava/badge/endorsement_schemas.cljc
@@ -1,10 +1,10 @@
 (ns salava.badge.endorsement-schemas
-   #?(:clj (:require [schema.core :as s]
+  #? (:clj (:require [schema.core :as s]
                      [schema.coerce :as c]
                      [compojure.api.sweet :refer [describe]])
-      :cljs (:require [schema.core :as s :include-macros true])))
+           :cljs (:require [schema.core :as s :include-macros true])))

-#?(:cljs (defn describe [v _] v))
+#? (:cljs (defn describe [v _] v))

 (def content (describe (s/constrained s/Str #(and (>= (count %) 5)
                                                   (not (clojure.string/blank? %)))) "Content in markdown format"))
@@ -28,25 +28,25 @@

 (s/defschema received-user-endorsement (-> received-user-endorsement-p
                                            (assoc
-                                             :issuer_name _name
-                                             :issuer_url (s/maybe s/Str)
-                                             :profile_picture (describe (s/maybe s/Str) "Issuer's image")
-                                             :description (s/maybe s/Str)
-                                             :name (s/maybe s/Str)
-                                             :image_file (s/maybe s/Str))))
+                                            (s/optional-key :issuer_name) _name
+                                            :issuer_url (s/maybe s/Str)
+                                            :profile_picture (describe (s/maybe s/Str) "Issuer's image")
+                                            :description (s/maybe s/Str)
+                                            :name (s/maybe s/Str)
+                                            :image_file (s/maybe s/Str))))

 (s/defschema given-user-endorsement-p  (-> endorsement
                                            (assoc
-                                             :endorsee_id (describe (s/maybe s/Int) "ID of endorsement receiver"))))
+                                            :endorsee_id (describe (s/maybe s/Int) "ID of endorsement receiver"))))

 (s/defschema given-user-endorsement  (-> given-user-endorsement-p
                                          (assoc
-                                           :profile_picture (s/maybe s/Str)
-                                           :first_name _name
-                                           :last_name _name
-                                           :name (describe s/Str "Badge name")
-                                           :image_file (describe (s/maybe s/Str) "Badge image")
-                                           :description (describe (s/maybe s/Str) "Badge description"))))
+                                          :profile_picture (s/maybe s/Str)
+                                          :first_name _name
+                                          :last_name _name
+                                          :name (describe s/Str "Badge name")
+                                          :image_file (describe (s/maybe s/Str) "Badge image")
+                                          :description (describe (s/maybe s/Str) "Badge description"))))

 (s/defschema sent-request-p (-> request
                                 (assoc :requestee_id (describe (s/maybe s/Int) "ID of request receiver"))))
@@ -56,47 +56,42 @@
                                 :profile_picture (s/maybe s/Str)
                                 :name (s/maybe s/Str)
                                 :image_file (s/maybe s/Str)
-                                :issuer_name _name)))
+                                (s/optional-key :issuer_name) _name)))

 (s/defschema received-request-p (-> request
-                                      (assoc :requester_id (s/maybe s/Int))))
+                                    (assoc :requester_id (s/maybe s/Int))))

 (s/defschema received-request (-> received-request-p
                                   (assoc
-                                    :description (s/maybe s/Str)
-                                    :issuer_name s/Str
-                                    :issued_on s/Int
-                                    :issuer_content_id (s/maybe s/Str)
-                                    :first_name _name
-                                    :last_name _name
-                                    :profile_picture (s/maybe s/Str)
-                                    :image_file (s/maybe s/Str)
-                                    :name s/Str)))
+                                   :description (s/maybe s/Str)
+                                   (s/optional-key :issuer_name) s/Str
+                                   :issued_on s/Int
+                                   :issuer_content_id (s/maybe s/Str)
+                                   :first_name _name
+                                   :last_name _name
+                                   :profile_picture (s/maybe s/Str)
+                                   :image_file (s/maybe s/Str)
+                                   :name s/Str)))

 (s/defschema pending-requests [(s/maybe received-request)])

 (s/defschema pending-sent-requests [(s/maybe (-> request
-                                               (dissoc :type)
-                                               (assoc :user_id (s/maybe s/Int)
-                                                      :profile_picture (s/maybe s/Str)
-                                                      :first_name _name
-                                                      :last_name _name)))])
-
-
+                                                 (dissoc :type)
+                                                 (assoc :user_id (s/maybe s/Int)
+                                                        :profile_picture (s/maybe s/Str)
+                                                        :first_name _name
+                                                        :last_name _name)))])

 (s/defschema all-endorsements-p {:given [(s/maybe given-user-endorsement-p)]
                                  :received [(s/maybe received-user-endorsement-p)]
                                  :sent-requests [(s/maybe sent-request-p)]
                                  :requests [(s/maybe received-request-p)]})

-
-
 (s/defschema all-endorsements {:given [(s/maybe given-user-endorsement)]
                                :received [(s/maybe received-user-endorsement)]
                                :sent-requests [(s/maybe sent-request)]
                                :requests [(s/maybe received-request)]
                                :all-endorsements [(s/maybe s/Any)]})
-

 (s/defschema user-badge-endorsements-p {:endorsements [(s/maybe received-user-endorsement-p)]})


Updated process runner lifecycle to use new approach.

--- src/cmr/dev/env/manager/components/process.clj
+++ src/cmr/dev/env/manager/components/process.clj
@@ -8,6 +8,10 @@
     [com.stuartsierra.component :as component]
     [me.raynes.conch.low-level :as shell]
     [taoensso.timbre :as log]))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;;   Process Component API   ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

 (defn get-process
   [system service-key]
@@ -46,47 +50,60 @@
     (shell/destroy process-data)
     @exit))

-(defrecord ProcessRunner [
-  builder
-  process-keyword
-  process-data]
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;;   Lifecycle Implementation   ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(defrecord ProcessRunner
+  [builder
+   process-keyword
+   process-data])
+
+(defn start
+  [this]
+  (let [cfg ((:builder this) (:process-keyword this))
+        this (assoc this :config cfg)
+        process-key (:process-keyword this)
+        process-name (name process-key)]
+    (log/infof "Starting %s component ..." process-name)
+    (log/trace "Component keys:" (keys this))
+    (log/trace "Built configuration:" cfg)
+    (log/trace "Config:" (:config this))
+    (if (config/service-enabled? this process-key)
+      (let [process-data (spawn! this "lein" process-name)]
+        (log/debugf "Started %s component." process-name)
+        (assoc this :process-data process-data
+                    :enabled true))
+      (do
+        (log/debugf "Service %s not enabled; skipping component start-up."
+                    process-key)
+        (assoc this :enabled false)))))
+
+(defn stop
+  [this]
+  (let [process-key (:process-keyword this)
+        process-name (name process-key)]
+    (log/debug "Process name:" process-name)
+    (log/infof "Stopping %s component ..." process-name)
+    (if (config/service-enabled? this process-key)
+      (let [process-data (:process-data this)]
+        (log/trace "process-data:" process-data)
+        (log/trace "process:" (:process process-data))
+        (terminate! this (:process-data this))
+        (log/debugf "Stopped %s component." process-name)
+        (assoc this :process-data nil))
+      (do
+        (log/debugf "Service %s not enabled; skipping component shut-down."
+                    process-key)
+        this))))
+
+(def lifecycle-behaviour
+  {:start start
+   :stop stop})
+
+(extend ProcessRunner
   component/Lifecycle
-
-  (start [component]
-    (let [cfg (builder (:process-keyword component))
-          component (assoc component :config cfg)
-          process-key (:process-keyword component)
-          process-name (name process-key)]
-      (log/infof "Starting %s component ..." process-name)
-      (log/trace "Component keys:" (keys component))
-      (log/trace "Built configuration:" cfg)
-      (log/trace "Config:" (:config component))
-      (if (config/service-enabled? component process-key)
-        (let [process-data (spawn! component "lein" process-name)]
-          (log/debugf "Started %s component." process-name)
-          (assoc component :process-data process-data
-                           :enabled true))
-        (do
-          (log/debugf "Service %s not enabled; skipping component start-up."
-                      process-key)
-          (assoc component :enabled false)))))
-
-  (stop [component]
-    (let [process-key (:process-keyword component)
-          process-name (name process-key)]
-      (log/debug "Process name:" process-name)
-      (log/infof "Stopping %s component ..." process-name)
-      (if (config/service-enabled? component process-key)
-        (let [process-data (:process-data component)]
-          (log/trace "process-data:" process-data)
-          (log/trace "process:" (:process process-data))
-          (terminate! component (:process-data component))
-          (log/debugf "Stopped %s component." process-name)
-          (assoc component :process-data nil))
-        (do
-          (log/debugf "Service %s not enabled; skipping component shut-down."
-                      process-key)
-          component)))))
+  lifecycle-behaviour)

 (defn create-component
   ""


Don't join resource_params to catalog_resources

Expressing this as a subquery instead of a JOIN will hopefully be
faster.

--- src/com/puppetlabs/puppetdb/query/resource.clj
+++ src/com/puppetlabs/puppetdb/query/resource.clj
@@ -90,9 +90,9 @@
                                                            (select (where
                                                                     (and (= :resource_params.name name)
                                                                          (= :resource_params.value (db-serialize value)))))
-                                           (project []))]
-                                   (join resource_params catalog_resources :resource))
-
+                                           (project [:resource]))
+                         [sql & params]  (compile resource_params nil)]
+                     (apply vector (format "SELECT catalog,resource FROM catalog_resources WHERE resource IN (%s)" sql) params))
                                  ;; metadata match.
                                  [(metadata :when string?)]
                                  (select catalog_resources


Fix to previous checkin - missing paren.

--- src/clinvar_submitter/variant.clj
+++ src/clinvar_submitter/variant.clj
@@ -29,7 +29,7 @@
      (:gene variant "") ; gene symbol - not provided since we are avoiding contextual allele representation.
      (:refseq variant) ;refseq
      (if (some? hgvs) hgvs "") ; hgvs - not providing since we are avoiding contextual allele representation
-     (if (nil? (:refseq variant) (:chromosome variant) "")  ; chromosome - only provide if the refseq field is nil - clinvar does not accept both fields.
+     (if (nil? (:refseq variant)) (:chromosome variant) "")  ; chromosome - only provide if the refseq field is nil - clinvar does not accept both fields.
      (if (nil? hgvs) (:start variant-coord) "") ; start + 1  (from 0-based to 1-based)
      (if (nil? hgvs) (:stop variant-coord) "")  ; stop + 1  (from 0-based to 1-based)
      (if (nil? hgvs) (:ref variant-coord) "")   ; ref


fix for cljs

fix for cljs

--- src/clj/com/rpl/specter/navs.cljx
+++ src/clj/com/rpl/specter/navs.cljx
@@ -18,6 +18,7 @@
   (:require [com.rpl.specter.impl :as i]
             [clojure.walk :as walk]
              #+clj [clojure.core.reducers :as r]
+            [com.rpl.specter.defnavhelpers] ; so that for cljs it's loaded as macros expand to this
              )
   )


finished a draft of both whiz- and whoopbang, ready for synching with broader system (need Sam's help at this point).

--- src/clj/forma/trends/analysis.clj
+++ src/clj/forma/trends/analysis.clj
@@ -41,6 +41,15 @@
   [f window xs]
   (pmap f (partition window 1 xs)))

+(defn make-monotonic [fn coll]
+  "Note that fn has to be min or max"
+  (loop [acc (first coll) l (seq coll) res []]
+    (if (empty? l)
+        res
+        (recur (fn acc (first l))
+               (rest l)
+               (conj res (fn acc (first l)))))))
+
 ;; WHOOPBANG

 ;; The following is a routine, under the header WHOOPBANG,
@@ -60,9 +69,7 @@
   (->> (deseasonalize ts)
        (windowed-apply ols-coefficient long-block)
        (windowed-apply average window)
-       (reduce min)))
-
-
+       (make-monotonic min)))

 ;; WHIZBANG

@@ -126,18 +133,4 @@
          (map (partial lengthening-ts start-pd end-pd))
          (apply map long-trend))))

-(defn test-vec
-  [ts & cof]
-  (apply vector ts cof))

-(defn test-count
-  [v1 v2] (+ (count v1)
-             (count v2)))
-
-(let [coll (test-vec ndvi rain)]
-  (->> coll
-       (map (partial split-at 10))
-       (apply map test-count)))
-
-
-


Using full header for requests

Using full header for requests

--- src/clj/fortress/ring/request.clj
+++ src/clj/fortress/ring/request.clj
@@ -49,12 +49,7 @@
     (keyword scheme)))

 (defn content-type [^DefaultFullHttpRequest request]
-  (if-let [type (HttpHeaders/getHeader request HttpHeaders$Names/CONTENT_TYPE)]
-    (-> type
-      (s/split #";")
-      (get 0)
-      s/trim
-      s/lower-case)))
+  (HttpHeaders/getHeader request HttpHeaders$Names/CONTENT_TYPE))

 (defn content-length [^DefaultFullHttpRequest request]
   (let [length (HttpHeaders/getContentLength request 0)]


Cleans up Power Grid Overload's trace :msg

--- src/clj/game/cards-operations.clj
+++ src/clj/game/cards-operations.clj
@@ -302,7 +302,7 @@
    {:effect (req (doseq [c (take 5 (:deck corp))] (move state side c :play-area)))}

    "Power Grid Overload"
-   {:trace {:base 2 :msg "trash 1 piece of hardware with install cost less than or equal to X"
+   {:trace {:base 2 :msg "trash 1 piece of hardware"
             :effect (req (let [max-cost (- target (second targets))]
                            (resolve-ability state side
                                             {:choices {:req #(and (has? % :type "Hardware")


removed step 32 in test

removed step 32 in test

--- src/clj/test/cards-identities.clj
+++ src/clj/test/cards-identities.clj
@@ -210,7 +210,6 @@
     (play-from-hand state :runner "Study Guide")
     (take-credits state :runner)
     (core/gain state :runner :credit 7)
-    (core/request-phase-32 state :runner nil)
     (core/end-turn state :corp nil)
     (is (not (:end-turn @state)) "Corp turn has not ended")
     (card-ability state :runner (-> (get-runner) :rig :hardware first) 0)


Use new error logging in middleware ns

Use new error logging in middleware ns

--- src/clj/train_race/middleware.clj
+++ src/clj/train_race/middleware.clj
@@ -1,6 +1,6 @@
 (ns train-race.middleware
   (:require [train-race.env :refer [defaults]]
-            [clojure.tools.logging :as log]
+            [train-race.log :as log :refer [logger]]
             [train-race.layout :refer [*app-context* error-page]]
             [ring.middleware.anti-forgery :refer [wrap-anti-forgery]]
             [ring.middleware.webjars :refer [wrap-webjars]]
@@ -37,10 +37,14 @@
     (try
       (handler req)
       (catch Throwable t
-        (log/error t)
-        (error-page {:status 500
-                     :title "Something very bad has happened!"
-                     :message "We've dispatched a team of highly trained gnomes to take care of the problem."})))))
+        (let [response {:status 500
+                        :title "Something very bad has happened!"
+                        :message "We've dispatched a team of highly trained gnomes to take care of the problem."}]
+          (log/error logger ::middleware.wrap-internal-error {:msg "Failure in wrap-internal error"
+                                                              :ex t
+                                                              :request req
+                                                              :response response})
+          (error-page response))))))

 (defn wrap-csrf [handler]
   (wrap-anti-forgery


Updating banner message

Updating banner message

--- src/clj/zetawar/views/common.cljc
+++ src/clj/zetawar/views/common.cljc
@@ -94,12 +94,12 @@
    [:div.col-md-12
     [:div.alert.alert-success
      [:strong
-      "Zetawar is "
-      [:a {:href "https://www.kickstarter.com/projects/311016908/zetawar"}
-       "funded"]
-      "! Full-time development starts mid-August. Follow "
+      "Zetawar is a work in progress. Follow "
       [:a {:href "https://twitter.com/ZetawarGame"}
        "@ZetawarGame"]
+      " and check out the "
+      [:a {:href "https://www.kickstarter.com/projects/djwhitt/zetawar/updates"}
+       "Zetawar Kickstarter page"]
       " for updates."]]]])

 (defn footer []