Do decline offers sometimes

Do decline offers sometimes

--- src/riak_mesos/scheduler.clj
+++ src/riak_mesos/scheduler.clj
@@ -10,28 +10,29 @@
       (statusUpdate [driver status]
                     (println "got status" status))
       (resourceOffers [driver offers]
-                       (when (seq @pending)
-                         (doseq [offer offers
-                                 :let [{:keys [cpus mem]} (:resources offer)
-                                       node (first @pending)]
-                                 :when (and (>= cpus 2.0)
-                                            (>= mem 2000.0))]
-                           (swap! pending disj node)
-                           (println "launching task for node" node "(offer)" offer)
-                           (clj-mesos.scheduler/launch-tasks
-                                   driver
-                                   (:id offer)
-                                   [{:name "Riak"
-                                     :task-id (str "riak-node-" node)
-                                     :slave-id (:slave-id offer)
-                                     :resources {:cpus 2.0
-                                                 :mem 2000.0}
-                                     :container {:type :docker :docker "rtward/riak-mesos"}
-                                     :command {:shell false}
-                                     ;:executor-info {:executor-id (str "riak-node-executor-" node)
-                                     ;                :container {:image "rtward/riak-mesos"}
-                                     ;                :command {}}
-                                     }])))))))
+                      (when (seq @pending)
+                        (doseq [offer offers
+                                :let [{:keys [cpus mem]} (:resources offer)
+                                      node (first @pending)]]
+                          (if (and (>= cpus 2.0)
+                                   (>= mem 2000.0))
+                            (do (swap! pending disj node)
+                                (println "launching task for node" node "(offer)" offer)
+                                (clj-mesos.scheduler/launch-tasks
+                                  driver
+                                  (:id offer)
+                                  [{:name "Riak"
+                                    :task-id (str "riak-node-" node)
+                                    :slave-id (:slave-id offer)
+                                    :resources {:cpus 2.0
+                                                :mem 2000.0}
+                                    :container {:type :docker :docker "rtward/riak-mesos"}
+                                    :command {:shell false}
+                                    ;:executor-info {:executor-id (str "riak-node-executor-" node)
+                                    ;                :container {:image "rtward/riak-mesos"}
+                                    ;                :command {}}
+                                    }]))
+                            (do (println "yay being a good citizen") (clj-mesos.scheduler/decline-offer driver offer)))))))))

 (defn -main
   [master]


Added `tests` function in system

Added `tests` function in system

--- src/cljs/junto_labs/learn_specter/system.cljs
+++ src/cljs/junto_labs/learn_specter/system.cljs
@@ -9,8 +9,8 @@

 (def config
   {:websockets {:endpoint    "/chan"
-                :host        "0.0.0.0"
-                :port        32000
+                :host        "localhost"
+                :port        8080
                 :msg-handler handlers/event-msg-handler*}})

 (defonce system-map
@@ -22,8 +22,14 @@

 (defn -main []
   (log/debug "System stopping if running...")
-  (swap! system component/stop )`
+  (swap! system component/stop )
   (swap! system component/start)
   (log/debug "System started."))

-(-main)+(defn tests []
+  (println "SYSTEM KEYS" (-> @system :websockets))
+  ((-> @system :websockets :send-fn) [:event/name "Message"] 200
+    (fn [e] (log/debug "Thanks for calling back with this!" e))))
+
+(-main)
+(tests)


[CS] Reorder precinct element children to the spec

--- src/vip/data_processor/output/precinct.clj
+++ src/vip/data_processor/output/precinct.clj
@@ -15,13 +15,13 @@

         children (concat [(xml-node name)
                           (xml-node number)
-                          (xml-node locality_id)
-                          (xml-node ward)
-                          (boolean-xml-node mail_only)
-                          (xml-node ballot_style_image_url)]
+                          (xml-node locality_id)]
+                         electoral-district-nodes
+                         [(xml-node ward)
+                          (boolean-xml-node mail_only)]
                          polling-location-nodes
                          early-vote-site-nodes
-                         electoral-district-nodes)]
+                         [(xml-node ballot_style_image_url)])]
     (simple-xml :precinct id children)))

 (defn xml-nodes [ctx]


Hide unknown referenced messages

Hide unknown referenced messages

--- src/status_im/chat/subs.cljs
+++ src/status_im/chat/subs.cljs
@@ -136,8 +136,8 @@
 (defn quoted-message-data
   "Selects certain data from quoted message which must be available in the view"
   [message-id messages referenced-messages]
-  (let [{:keys [from content]} (get messages message-id
-                                    (get referenced-messages message-id))]
+  (when-let [{:keys [from content]} (get messages message-id
+                                         (get referenced-messages message-id))]
     {:from from
      :text (:text content)}))

@@ -149,15 +149,16 @@
             (into (list {:value datemark
                          :type  :datemark})
                   (map (fn [{:keys [message-id timestamp-str]}]
-                         (let [{:keys [content] :as message} (get messages message-id)]
-                           (cond-> (assoc message
-                                          :datemark      datemark
-                                          :timestamp-str timestamp-str
-                                          :user-statuses (get message-statuses message-id))
-                             (:response-to content) ;; quoted message reference
-                             (assoc-in [:content :response-to] (quoted-message-data (:response-to content)
-                                                                                messages
-                                                                                referenced-messages))))))
+                         (let [{:keys [content] :as message} (get messages message-id)
+                               quote (some-> (:response-to content)
+                                             (quoted-message-data messages referenced-messages))]
+                           (cond-> (-> message
+                                       (update :content dissoc :response-to)
+                                       (assoc :datemark      datemark
+                                              :timestamp-str timestamp-str
+                                              :user-statuses (get message-statuses message-id)))
+                             quote ;; quoted message reference
+                             (assoc-in [:content :response-to] quote)))))
                   message-references))
           message-groups))


Removing cruft

Removing cruft

--- src/ctia/schemas/core.clj
+++ src/ctia/schemas/core.clj
@@ -80,10 +80,6 @@

 ;; sighting

-(defschema Sighting
-  ss/Sighting
-  "sighting")
-
 (defschema NewSighting
   ss/NewSighting
   "new-sighting")


Prefer inc to +1

Prefer inc to +1

--- src/testdouble/cljs/csv.cljs
+++ src/testdouble/cljs/csv.cljs
@@ -61,7 +61,7 @@
             (if (< index data-length)
               (let [char (nth data index)
                     next-char (if (< index (- data-length 1))
-                                (nth data (+ index 1))
+                                (nth data (inc index))
                                 nil)
                     str-char (str char)]
                 (case state
@@ -75,8 +75,8 @@
                                true
                                (str field-buffer char)
                                rows)
-                        (recur (+ index 1) :in-field false field-buffer rows))
-                      (recur (+ index 1)
+                        (recur (inc index) :in-field false field-buffer rows))
+                      (recur (inc index)
                              :in-field
                              true
                              field-buffer
@@ -86,12 +86,12 @@

                     separator
                     (if in-quoted-field
-                      (recur (+ index 1)
+                      (recur (inc index)
                              :in-field
                              in-quoted-field
                              (str field-buffer char)
                              rows)
-                      (recur (+ index 1)
+                      (recur (inc index)
                              :end-field
                              in-quoted-field
                              ""
@@ -99,12 +99,12 @@

                     "\r"
                     (if (and (= newline :cr+lf) (not in-quoted-field))
-                      (recur (+ index 1)
+                      (recur (inc index)
                              :in-field
                              in-quoted-field
                              field-buffer
                              rows)
-                      (recur (+ index 1)
+                      (recur (inc index)
                              :in-field
                              in-quoted-field
                              (str field-buffer char)
@@ -112,18 +112,18 @@

                     "\n"
                     (if in-quoted-field
-                      (recur (+ index 1)
+                      (recur (inc index)
                              :in-field
                              in-quoted-field
                              (str field-buffer char)
                              rows)
-                      (recur (+ index 1)
+                      (recur (inc index)
                              :end-line
                              in-quoted-field
                              ""
                              (conj-in rows last-row-index field-buffer)))

-                    (recur (+ index 1)
+                    (recur (inc index)
                            :in-field
                            in-quoted-field
                            (str field-buffer char)
@@ -134,7 +134,7 @@
                   :end-field
                   (condp = str-char
                     "\""
-                    (recur (+ index 1) :in-field true field-buffer rows)
+                    (recur (inc index) :in-field true field-buffer rows)

                     separator
                     (recur (inc index)
@@ -143,18 +143,18 @@
                            ""
                            (conj-in rows last-row-index ""))

-                    (recur (+ index 1) :in-field in-quoted-field str-char rows))
+                    (recur (inc index) :in-field in-quoted-field str-char rows))

                   :end-line
                   (case str-char
                     "\""
-                    (recur (+ index 1)
+                    (recur (inc index)
                            :in-field
                            true
                            field-buffer
                            (conj (or rows []) []))

-                    (recur (+ index 1)
+                    (recur (inc index)
                            :in-field
                            in-quoted-field
                            (str field-buffer char)


Resolve thumbnail on profile is updated.

--- src/uxbox/frontend/users.clj
+++ src/uxbox/frontend/users.clj
@@ -55,8 +55,9 @@
         message (assoc data
                        :type :update/profile
                        :user user)]
-    (-> (sv/novelty message)
-        (p/then #(http/ok (rsp %))))))
+    (->> (sv/novelty message)
+         (p/map resolve-thumbnail)
+         (p/map #(http/ok (rsp %))))))

 ;; --- Update Password


no earmuffs

no earmuffs

--- src/engine/devel/rope.clj
+++ src/engine/devel/rope.clj
@@ -8,7 +8,7 @@
            javax.xml.transform.stream.StreamResult
            javax.xml.transform.TransformerFactory))

-(def *pdf-example* (rope "a" (rope "bc" (rope "d" "ef"))))
+(def pdf-example (rope "a" (rope "bc" (rope "d" "ef"))))

 (defn svgdoc->string ; this thing is definitely missing in lacij
   [doc & options]


updated version number.

updated version number.

--- db-serializers/scripts/connector-dump.clj
+++ db-serializers/scripts/connector-dump.clj
@@ -3,7 +3,7 @@
 ;;
 ;; Boot related scafolding.
 (set-env!
-  :version "3.12-SNAPSHOT"
+  :version "3.13-SNAPSHOT"
   :license {"Apache 2.0" "http://www.apache.org/licenses/LICENSE-2.0.txt"}
   :edition "community"


Add 'show-stats' and 'shutdown' functions

--- src/whisper2cyanite/core.clj
+++ src/whisper2cyanite/core.clj
@@ -216,8 +216,8 @@
 ;;     (assoc merged :error-paths (clojure.set/union (:error-paths total)
 ;;                                                   (:error-paths store)))))

-(defn- show-stats
-  "Show metric store stats."
+(defn- show-store-stats
+  "Show store stats."
   [title data-stats store-stats]
   (let [processed (:processed data-stats)
         data-errors (count (:error-paths data-stats))
@@ -234,6 +234,26 @@
     (println "  Processed:   " processed)
     (println "  Store errors:" (count (:error-paths store-stats)))
     (println "  Data errors: " data-errors)))
+
+(defn- show-stats
+  "Show stats."
+  [mstore pstore]
+  (when mstore
+    (show-store-stats "Metric store stats" {:processed @mstore-processed
+                                            :error-paths @mstore-error-paths}
+                      (mstore/get-stats mstore)))
+  (when pstore
+    (show-store-stats "Path store stats" {:processed @pstore-processed
+                                          :error-paths @pstore-error-paths}
+                      (pstore/get-stats pstore))))
+
+(defn- shutdown
+  "Shutdown."
+  [mstore pstore]
+  (when mstore
+    (mstore/shutdown mstore))
+  (when pstore
+    (pstore/shutdown pstore)))

 (defn- process
   "Process a Whisper database."
@@ -271,16 +291,8 @@
         (catch Exception e
           (wlog/unhandled-error e))
         (finally
-          (when mstore
-            (show-stats "Metric store stats" {:processed @mstore-processed
-                                              :error-paths @mstore-error-paths}
-                        (mstore/get-stats mstore))
-            (mstore/shutdown mstore))
-          (when pstore
-            (show-stats "Path store stats" {:processed @pstore-processed
-                                            :error-paths @pstore-error-paths}
-                        (pstore/get-stats pstore))
-            (pstore/shutdown pstore)))))
+          (show-stats mstore pstore)
+          (shutdown mstore pstore))))
     (catch Exception e
       (wlog/unhandled-error e)))
   (wlog/exit 0))


wishlist-delete-clicker cljs

wishlist-delete-clicker cljs

--- src/wishlistd/cljs/main.cljs
+++ src/wishlistd/cljs/main.cljs
@@ -111,3 +111,12 @@
       (this-as me
         (when-not (empty? (val me))
           (update-wishlist-rem))))))
+
+(defn wishlist-delete-clicker []
+  (delegate $content ".delete" :click
+    (fn []
+      (this-as me
+        (remove (.parent me))
+        (update-wishlist-rem)))))
+
+


Clicking outside info box also removes it

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

+(delegate $body "#info-container" :click
+  (fn [e]
+    (hide-info!)))
+
 (delegate $body "#icon-refresh" :click
   (fn [e]
     (let [code (get-path)]


convert stats collection to a vector

convert stats collection to a vector

--- src/wombats/sockets/game.clj
+++ src/wombats/sockets/game.clj
@@ -177,7 +177,7 @@
     (doseq [chan-id viewers]
       (send-message chan-id
                     {:meta {:msg-type :stats-update}
-                     :payload stats}))))
+                     :payload (vec stats)}))))

 (defn create-socket-handler-map
   "Allows for adding custom handlers that respond to namespaced messages


tests for use of predicates

tests for use of predicates

--- test/structural_typing/docs/f_wiki_what_can_be_in_a_path.clj
+++ test/structural_typing/docs/f_wiki_what_can_be_in_a_path.clj
@@ -33,4 +33,12 @@
   (let [result (with-out-str (checked :Nesty {:x [1]}))]
     result => #"\[:x ALL ALL :y\] is not a path"))

+(fact "predicates"
+  (type! :Odder {[ALL even?] neg?, [ALL odd?] pos?})
+  (let [result (with-out-str (checked :Odder [4 -3 2 -1]))]
+    result => #"\[0 even\?\] should be `neg\?`; it is `4`"
+    result => #"\[2 even\?\] should be `neg\?`; it is `2`"
+    result => #"\[1 odd\?\] should be `pos\?`; it is `-3`"
+    result => #"\[3 odd\?\] should be `pos\?`; it is `-1`"))
+
 (start-over!)


Fixed prod mode

Fixed prod mode

--- src/webapp/framework/client/coreclient.clj
+++ src/webapp/framework/client/coreclient.clj
@@ -82,8 +82,7 @@
           (~'render
            [~'this]

-           ~(if *show-code*
-              `(~'let [
+              (~'let [

                        ~'debug-id       (webapp.framework.client.coreclient/record-component-call
                                          (~'ns-coils-debug)
@@ -110,8 +109,6 @@

                       ~'return-val)

-              ;else
-              (first code))
            )
          ))


Fixed serving files from uberjar

Fixed serving files from uberjar

--- src/video_server/handler.clj
+++ src/video_server/handler.clj
@@ -12,7 +12,7 @@
   (:require [clojure.data.json :as json]
             [compojure.core :refer [GET defroutes]]
             [compojure.handler :refer [site]]
-            [compojure.route :refer [files not-found]]
+            [compojure.route :refer [resources not-found]]
             [ring.middleware.gzip :refer [wrap-gzip]]
             [ring.util.response :refer [response]]
             [video-server.html :refer [videos-template]]
@@ -40,7 +40,7 @@
 (defroutes app-routes
   (GET "/" [] (index))
   (GET "/api/v1/videos" [] (videos-api))
-  (files "/" {:root "resources/public"})
+  (resources "/" {:root "public"})
   (not-found "Not Found"))

 (def app


Fixed title normalization on initial folder scan

--- src/video_server/watcher.clj
+++ src/video_server/watcher.clj
@@ -13,7 +13,7 @@
             [clojure.java.io :as io]
             [clojure.tools.logging :as log]
             [video-server.file :refer [image-filter image? movie-filter subtitle-filter subtitle? video?]]
-            [video-server.library :as library :refer [add-image add-info add-subtitle current-videos has-file? remove-all video-for-file]]
+            [video-server.library :as library :refer [add-image add-info add-subtitle current-videos has-file? norm-title remove-all video-for-file]]
             [video-server.metadata :refer [read-metadata]]
             [video-server.process :refer [process-file]]
             [video-server.video :refer [modified]]))
@@ -49,17 +49,23 @@
   (when-let [info (read-metadata folder video)]
     (add-info folder video info)))

+(defn- list-files
+  "Lists files related to the video by title and filter."
+  [folder video filter]
+  (concat (.listFiles (:file folder) (filter (:title video)))
+          (.listFiles (:file folder) (filter (norm-title (:title video))))))
+
 (defn add-subtitles
   "Performs the initial scan for subtitles."
   [folder video]
-  (doseq [file (.listFiles (:file folder) (subtitle-filter (:title video)))]
+  (doseq [file (list-files folder video subtitle-filter)]
     (log/info "adding subtitle" (str file))
     (add-subtitle folder file video)))

 (defn add-images
   "Performs the initial scan for image files."
   [folder video]
-  (doseq [file (.listFiles (:file folder) (image-filter (:title video)))]
+  (doseq [file (list-files folder video image-filter)]
     (log/info "adding image" (str file))
     (add-image folder file video)))


Implicit in progress.

Implicit in progress.


STORM-461: exit-process! does not always exit the process, but throws an exception instead

--- storm-core/src/clj/backtype/storm/util.clj
+++ storm-core/src/clj/backtype/storm/util.clj
@@ -316,7 +316,7 @@

 (defn exit-process!
   [val & msg]
-  (log-error (RuntimeException. msg) "Halting process: " msg)
+  (log-error (RuntimeException. (str msg)) "Halting process: " msg)
   (.exit (Runtime/getRuntime) val))

 (defn sum


Wrong order of arguments

Wrong order of arguments

--- src/wishlistd/cljs/main.cljs
+++ src/wishlistd/cljs/main.cljs
@@ -105,7 +105,7 @@
       (this-as me
         (when (value-changed?! me)
           (when (empty? (val me))
-            (when-not (.hasClass "last" (.parent me))
+            (when-not (.hasClass (.parent me) "last")
               (remove (.parent me))))
           (update-wishlist-rem))))))


Empty push state title

Empty push state title

--- src/wishlistd/cljs/main.cljs
+++ src/wishlistd/cljs/main.cljs
@@ -42,7 +42,7 @@
     (.split js/window.location.pathname "/")))

 (defn set-path! [code]
-  (.pushState js/window.history nil "lol" code))
+  (.pushState js/window.history nil "" code))

 (defn show-wishlist! [{:keys [wishes title code] :as wishlist}]
   (empty $content)


max-n-by

max-n-by

--- src/atom_finder/util/20_collection_util.clj
+++ src/atom_finder/util/20_collection_util.clj
@@ -107,8 +107,10 @@
 (defn max-n-by
   "Find the n largest elements by f"
   [n f lst]
-  (let [not-smallest (fn [acc x] (->> [(f x) x] (conj acc) (sort-by first) rest))]
-    (reduce not-smallest (repeat n [0 nil]) lst)))
+  (let [not-smallest (fn [acc x] (->> [(f x) x] (conj acc) (sort-by (juxt first (comp #(if (nil? %) 0 1) second))) rest))]
+    (->> lst
+         (reduce not-smallest (repeat n [0 nil]))
+         (map last))))

 (defn group-dissoc
   "Group a list of maps by a key, then dissoc that key"


CMR-4320 Add docstrings to vars

CMR-4320 Add docstrings to vars

--- umm-spec-lib/src/cmr/umm_spec/validation/temporal_extent.clj
+++ umm-spec-lib/src/cmr/umm_spec/validation/temporal_extent.clj
@@ -33,10 +33,12 @@
                       "present flag to false.")]}))

 (def temporal-extent-warning-validation
+  "Temporal extent validations that will return warnings"
   [ends-at-present-validation
    {:RangeDateTimes (validations-core/every {:BeginningDateTime util/date-in-past-validator
                                              :EndingDateTime temporal-end-date-in-past-validator})
     :SingleDateTimes (validations-core/every util/date-in-past-validator)}])

 (def temporal-extent-validation
+  "Temporal extent validations that will return errors"
   {:RangeDateTimes (validations-core/every range-date-time-validation)})


Fixed mising require. Thanks, slamhound.

--- src/com/lemondronor/turboshrimp/navdata.clj
+++ src/com/lemondronor/turboshrimp/navdata.clj
@@ -3,6 +3,7 @@
             [com.lemondronor.turboshrimp.network :as network]
             [com.lemondronor.turboshrimp.util :as util]
             [gloss.core :as gloss]
+            [gloss.io]
             [lazymap.core :as lazymap])
   (:import (java.net DatagramSocket)
            (java.nio ByteBuffer ByteOrder))


STORM-555: Storm json response should set charset to UTF-8.

--- storm-core/src/clj/backtype/storm/ui/core.clj
+++ storm-core/src/clj/backtype/storm/ui/core.clj
@@ -833,8 +833,8 @@
 (defnk json-response
   [data callback :serialize-fn to-json :status 200]
      {:status status
-      :headers (if (not-nil? callback) {"Content-Type" "application/javascript"}
-                {"Content-Type" "application/json"})
+      :headers (if (not-nil? callback) {"Content-Type" "application/javascript;charset=utf-8"}
+                {"Content-Type" "application/json;charset=utf-8"})
       :body (if (not-nil? callback)
               (wrap-json-in-callback callback (serialize-fn data))
               (serialize-fn data))})


exception logging test

exception logging test

--- test/com/billpiel/mem_tracer/core_test.clj
+++ test/com/billpiel/mem_tracer/core_test.clj
@@ -91,7 +91,6 @@

     (mtt/untrace-ns* 'com.billpiel.mem-tracer.test.ns1)))

-
 (fact-group "about enable/disable -all-traces!"
   (mtt/untrace-ns* 'com.billpiel.mem-tracer.test.ns1)
   (mt/reset-workspace!)
@@ -361,54 +360,58 @@
                :depth 0,
                :id "root10"})

-#_ (fact-group "exception thrown"
-               (mt/untrace-ns 'com.billpiel.mem-tracer.test.ns1)
-               (with-redefs [mtt/now (mock-now-fn)
-                             gensym (mock-gensym-fn)]
-                 (let [trace-root (mt/trace-ns 'com.billpiel.mem-tracer.test.ns1)
-                       _ (try
-                           (com.billpiel.mem-tracer.test.ns1/func-throws :a)
-                           (catch Throwable t))
-                       trace (mt/deref-children trace-root)]
-
-                   (fact "log is correct"
-                         (dissoc trace :children)
-                         => {:depth 0
-                             :id "root10"})
-
-                   (fact "log is correct"
-                         (-> trace :children count)
-                         => 1)
-
-                   (fact "log is correct"
-                         (-> trace :children first :throw :cause)
-                         => "Exception from func-throws: :a")
-
-                   (fact "log is correct"
-                         (-> trace :children first :throw :via first)
-                         => {:at {:class-name "com.billpiel.mem_tracer.test.ns1$func_throws"
-                                  :file-name "ns1.clj"
-                                  :line-number 14
-                                  :method-name "invoke"}
-                             :message "Exception from func-throws: :a"
-                             :type java.lang.Exception})
-
-                   (fact "log is correct"
-                         (-> trace :children first (dissoc :throw))
-                         => {:args [:a]
-                             :children []
-                             :depth 1
-                             :ended-at #inst "2010-01-01T02:00:00.000-00:00"
-                             :id "11"
-                             :name "com.billpiel.mem-tracer.test.ns1/func-throws"
-                             :parent-id "root10"
-                             :started-at #inst "2010-01-01T01:00:00.000-00:00"})
-
-                   (fact "string output is correct"
-                         (remove-iso-ctrl (mt/entry->string trace))
-                         => "[31m  [m[33m [33m| com.billpiel.mem-tracer.test.ns1/func-throws[m [33m| [33m:a[0m[m [33m| [1;37;41mTHROW[m => [35m\"Exception from func-throws: :a\"[0m [33m| [31m[[0m[35m\"com.billpiel.mem_tracer.test.ns1$func_throws ns1.clj:14\"[0m[31m][0m[m")
-
-                   (mt/untrace-ns 'com.billpiel.mem-tracer.test.ns1))))
+(fact-group "exception thrown"
+
+  (mtt/untrace-ns* 'com.billpiel.mem-tracer.test.ns1)
+  (with-redefs [mtt/now (mock-now-fn)
+                gensym (mock-gensym-fn)]
+    (let [trace-root (mt/add-trace-ns! 'com.billpiel.mem-tracer.test.ns1)
+          _ (try
+              (com.billpiel.mem-tracer.test.ns1/func-throws :a)
+              (catch Throwable t))
+          trace (mt/deref-workspace!)]
+
+      (fact "log is correct"
+        (dissoc trace :children)
+        => {:depth 0
+            :id "root10"
+            :traced #{[:ns 'com.billpiel.mem-tracer.test.ns1]}})
+
+      (fact "log is correct"
+        (-> trace :children count)
+        => 1)
+
+      (fact "log is correct"
+        (-> trace :children first :throw :cause)
+        => "Exception from func-throws: :a")
+
+      (fact "log is correct"
+        (-> trace :children first :throw :via first)
+        => {:at {:class-name "com.billpiel.mem_tracer.test.ns1$func_throws"
+                 :file-name "ns1.clj"
+                 :line-number 14
+                 :method-name "invoke"}
+            :message "Exception from func-throws: :a"
+            :type java.lang.Exception})
+
+      (fact "log is correct"
+        (-> trace :children first (dissoc :throw))
+        => {:args [:a]
+            :children []
+            :depth 1
+            :ended-at #inst "2010-01-01T02:00:00.000-00:00"
+            :id "10"
+            :name "com.billpiel.mem-tracer.test.ns1/func-throws"
+            :parent-id "root10"
+            :started-at #inst "2010-01-01T01:00:00.000-00:00"})
+
+      (-> trace mt/entry->string println)
+
+      (fact "string output is correct"
+        (remove-iso-ctrl (mt/entry->string trace))
+        => "[31m [1;37m>[31m[m[33m [33m|[1;37m>[33mcom.billpiel.mem-tracer.test.ns1/func-throws[m [33m|  [33m:a[0m[m [33m| [1;37;41mTHROW[m => [35m\"Exception from func-throws: :a\"[0m [33m| [31m[[0m[35m\"com.billpiel.mem_tracer.test.ns1$func_throws ns1.clj:14\"[0m[31m][0m[m")
+
+      (mtt/untrace-ns* 'com.billpiel.mem-tracer.test.ns1))))

 (comment "
 TODO


Added three tests into process_info_test.clj

--- test/emender_jenkins/process_info_test.clj
+++ test/emender_jenkins/process_info_test.clj
@@ -23,3 +23,19 @@
     [function-name]
     (clojure.test/function? function-name))

+
+;
+; Tests for various function definitions
+;
+
+(deftest test-get-current-pid-existence
+    "Check that the emender-jenkins.process-info/get-current-pid definition exists."
+    (testing "if the emender-jenkins.process-info/get-current-pid definition exists."
+        (is (callable? 'emender-jenkins.process-info/get-current-pid))))
+
+
+(deftest test-read-properties-existence
+    "Check that the emender-jenkins.process-info/read-properties definition exists."
+    (testing "if the emender-jenkins.process-info/read-properties definition exists."
+        (is (callable? 'emender-jenkins.process-info/read-properties))))
+


Tweak :key generation to speed up item components

--- src/lolitemsets/core.cljs
+++ src/lolitemsets/core.cljs
@@ -87,11 +87,9 @@
 (defn item-select [idx item]
   [:select {:value (:id item)
             :on-change (fn [event]
-                         (swap! app
-                                #(assoc-in %
-                                   [:recommended idx]
-                                   (get-in % [:items %2]))
-                                (int (-> event .-target .-value))))}
+                         (let [item-id (int (-> event .-target .-value))]
+                           (swap! app assoc-in [:recommended idx]
+                                  (@items item-id))))}
    (for [[id {name :name}] (sort-by (comp :name val) @items)]
      [:option {:key id :value id} name])])

@@ -104,7 +102,7 @@
      :width 64 :height 64}]])

 (defn item-component [idx item]
-  [:div.media.well.well-sm {:key (:id item)}
+  [:div.media.well.well-sm
    [:div.media-left [item-image item]]
    [:div.media-body
     [:h4.media-heading
@@ -116,7 +114,8 @@

 (defn item-recommendation [recommended]
   [:div.media-list
-   (map item-component
+   (map (fn [idx item]
+          ^{:key idx} [item-component idx item])
         (range)
         recommended)])

@@ -222,17 +221,17 @@
                    stat-optimized? (as-> el [:b el]))]]))])

 (defn item-block [id block]
-  (let [items (map #(get @items (int (:id %))) (:items block))]
-   [:div.panel.panel-default {:key id}
+  (let [items (mapv #(get @items (int (:id %))) (:items block))]
+   [:div.panel.panel-default
     [:div.panel-heading
      [:input.form-control
       {:type "text"
        :on-change #(swap! app assoc-in [:itemset :blocks id :type] (-> % .-target .-value))
        :value (:type block)}]]
-      [:div.panel-body
+    [:div.panel-body
      (for [item items]
        [:span {:key (:id item)}
-        (item-image item)])]]))
+        [item-image item]])]]))

 (defn item-set [itemset]
   (let [blocks (map vector (range) (:blocks itemset))]
@@ -244,7 +243,7 @@
         :value (:title itemset)}]]
      [:div.panel-body
       (for [[id block] blocks]
-        (item-block id block))]]))
+        ^{:key id} [item-block id block])]]))

 (def troll-objectives
   (into {} (for [{:keys [name calc troll] :as stat} stats


Don't show pricing information for piggiebacked orgs.

--- src-cljs/frontend/components/org_settings.cljs
+++ src-cljs/frontend/components/org_settings.cljs
@@ -820,11 +820,12 @@
           plan-total (pm/stripe-cost plan)
           container-cost (pm/per-container-cost plan)
           price (-> plan :paid :template :price)
-          containers (pm/usable-containers plan)]
+          containers (pm/usable-containers plan)
+          piggiebacked? (pm/piggieback? plan org-name)]
       [:div
        [:fieldset [:legend (str org-name "'s plan")]]
        [:div.explanation
-        (when (pm/piggieback? plan org-name)
+        (when piggiebacked?
           [:p "This organization's projects will build under "
            [:a {:href (routes/v1-org-settings {:org (:org_name plan)})}
             (:org_name plan) "'s plan."]])
@@ -840,7 +841,9 @@
                 ".")])
         (when (pm/paid? plan)
           [:p
-           (str (pm/paid-containers plan) " of these are paid, at $" (pm/stripe-cost plan) "/month. ")
+           (str (pm/paid-containers plan) " of these are paid")
+           (if piggiebacked? ". "
+               (list ", at " (pm/stripe-cost plan) "/month. "))
            (if (pm/grandfathered? plan)
              (list "We've changed our pricing model since this plan began, so its current price "
                    "is grandfathered in. "
@@ -853,7 +856,9 @@
               [:a {:href (routes/v1-org-settings-subpage {:org (:org_name plan)
                                                           :subpage "containers"})}
                "add more"]
-              " at $" container-cost " per container for more parallelism and shorter queue times."))])
+              (when-not piggiebacked?
+                (list " at $" container-cost " per container"))
+              " for more parallelism and shorter queue times."))])
         (when  (pm/freemium? plan)
           [:p (str (pm/freemium-containers plan) " container is free, forever.")])
         [:p "Additionally, projects that are public on GitHub will build with " pm/oss-containers " extra containers -- our gift to free and open source software."]]]))))


fixed instance catalog test

fixed instance catalog test

--- test/onyx_java/test/single_javafn/catalog.clj
+++ test/onyx_java/test/single_javafn/catalog.clj
@@ -1,24 +1,27 @@
 (ns onyx-java.test.single-javafn.catalog
-  (import [org.onyxplatform.api.java Catalog Task]
-          [org.onyxplatform.api.java.utils AsyncCatalog MapFns])
-  (:require [clojure.test :refer [deftest is]]
-            [onyx-java.instance.catalog :as inscat]))
+  (:import [org.onyxplatform.api.java Catalog Task]
+          [org.onyxplatform.api.java.utils AsyncCatalog MapFns]
+          [org.onyxplatform.api.java.instance CatalogUtils])
+  (:require [clojure.test :refer [deftest is]]))

 (defn build-catalog []
-  (let [cat (Catalog.)
-        om (MapFns/fromResources "catalog-single-java.edn")
-        t (Task. om) ]
+  (let [cat (Catalog.)
+        fqns "onyxplatform.test.PassMethod"
+        ctr-args {}]
     (-> cat
-        (.addTask t)
+        (CatalogUtils/addMethod "pass" 5 50 fqns ctr-args)
         (AsyncCatalog/addInput  "in" 5 50)
         (AsyncCatalog/addOutput "out" 5 50))))

 (def expected [{:onyx/name :pass,
-                :onyx/fn :org.onyxplatform.api.java.instance.PassMethod,
+                :onyx/fn :onyx-java.instance.bind/method,
                 :onyx/type :function,
-                :onyx/batch-size 5
-                :onyx/batch-timeout 50}
+                :onyx/batch-size 5
+                :onyx/batch-timeout 50,
+                :java-instance/class "onyxplatform.test.PassMethod",
+                :java-instance/ctr-args  {},
+                :onyx/params  [:java-instance/id :java-instance/class :java-instance/ctr-args] }

                {:onyx/name :in,
                 :onyx/plugin :onyx.plugin.core-async/input,
@@ -37,6 +40,10 @@
                 :onyx/batch-timeout 50 }])

 (deftest valid-catalog?
-  (let [cat (build-catalog)]
-    (is (= expected (.tasks cat)))))
+  (let [cat (build-catalog)
+        ; Strip generated IDs before comparing
+        tasks (map
+                #(dissoc % :java-instance/id)
+                (.tasks cat)) ]
+    (is (= expected tasks))))


Try reducing the default activity limit to 7.

--- src/oc/storage/config.clj
+++ src/oc/storage/config.clj
@@ -93,4 +93,4 @@

 (defonce inline-comment-count 10)

-(defonce default-activity-limit 10)+(defonce default-activity-limit 7)


add test

add test

--- test/id3_test.clj
+++ test/id3_test.clj
@@ -9,7 +9,18 @@
 		(apply write-tag buf tag opts)
 		(.toByteArray buf)))

-(deftest test-read
+(deftest test-formats
+	(let [formats {
+			:simple {:artist ["Nobody"], :title ["Nothing"]}
+			:normal {"TPE1" ["Nobody"], "TIT2" ["Nothing"]}
+			:full {:magic-number "ID3", :version {:major 4, :minor 0}, :flags #{}, :size 1059, :frames [
+				{:encoding "UTF-8", :content ["Nobody"], :size 7, :id "TPE1", :flags #{}}
+				{:encoding "UTF-8", :content ["Nothing"], :size 8, :id "TIT2", :flags #{}}]}}]
+		(testing "Reading tags"
+			(doseq [[fmt tag] formats]
+				(is (= tag (with-mp3 [mp3 "test/resources/v4utf8.mp3" :format fmt] (:tag mp3))))))))
+
+(deftest test-encodings
 	(let [t {:artist ["Nobody"], :title ["Nothing"]}]
 		(testing "Reading tags"
 			(doseq [file ["v3latin1" "v3utf16" "v4latin1" "v4utf8" "v4utf16" "v4utf16be"]]


lein: update

lein: update

--- lein_profiles.clj
+++ lein_profiles.clj
@@ -1,5 +1,5 @@
 {:user {:plugins [
-                  [lein-cljfmt "0.5.2" :exclusions [org.clojure/clojure]]
+                  [lein-cljfmt "0.5.3" :exclusions [org.clojure/clojure]]
                   [lein-ancient "0.6.10" :exclusions [org.clojure/clojure]]
                   [lein-cloverage "1.0.6"]
                   [org.clojure/tools.nrepl "0.2.12"]


cleaner log print

cleaner log print

--- pedestal-app/test/semtag_web/integration_test.clj
+++ pedestal-app/test/semtag_web/integration_test.clj
@@ -138,4 +138,4 @@
 (comment
   (taxi/take-screenshot :file "out.png")
   (println "LOGS: ")
-  (doseq [log (taxi/execute-script "return logs;")] (println log)))
+  (doseq [log (taxi/execute-script "return logs;")] (println (vec log))))


Rework biome generation algorithm

Rework biome generation algorithm

--- src/robinson/worldgen.clj
+++ src/robinson/worldgen.clj
@@ -72,6 +72,24 @@
       (cons 'vcond (next (next clauses))))
     [0 0 0]))

+(defmacro vor
+  "Evaluates vector expresions one at a time. If any expressions are true, return [1 1 1], [0 0 0] otherwise."
+  ([] [0 0 0])
+  ([x] `(cliskf/vif ~x [1 1 1] [0 0 0]))
+  ([x & next]
+   `(cliskf/vif ~x [1 1 1] (vor ~@next))))
+
+(defmacro vand
+  "Evaluates vector expresions one at a time. If all expressions are true, return [1 1 1], [0 0 0] otherwise."
+  ([] [0 0 0])
+  ([x] `(cliskf/vif ~x [1 1 1] [0 0 0]))
+  ([x & next]
+    `(cliskf/vif ~x (vand ~@next) [0 0 0])))
+
+(defmacro vnot
+  [x]
+  `(cliskf/vif ~x [0 0 0] [1 1 1]))
+
 (defn init-ocean
   []
   (let [max-x 80
@@ -88,20 +106,25 @@

 (def island-node
   (cliskf/vectorize
-    (cliskf/vlet [c (center (invert (cliskf/offset (cliskf/scale 0.43 (cliskf/v* [0.5 0.5 0.5] cliskp/vsnoise)) cliskf/radius)))]
+    (cliskf/vlet [c  (center (invert (cliskf/offset (cliskf/scale 0.43 (cliskf/v* [0.5 0.5 0.5] cliskp/vsnoise)) cliskf/radius)))
+                  c1 (cliskf/offset [0.5 0.5] (cliskf/v+ [-0.5 -0.5 -0.5] (cliskf/scale 0.04 cliskp/noise)))
+                  c2 (cliskf/offset [-0.5 -0.5] (cliskf/v+ [-0.5 -0.5 -0.5] (cliskf/scale 0.06 cliskp/noise)))]
       (vcond
-        ;; interior jungle
-        (cliskf/v+ [-0.7 -0.7 -0.7]  (cliskf/v* c (cliskf/v+ [0.4 0.4 0.4] (cliskf/scale 0.03 cliskp/noise))))
-          [0 0.4 0.1]
-        ;; interior trees/green
-        (cliskf/v+ [-0.7 -0.7 -0.7]  (cliskf/v* c (cliskf/v+ [0.4 0.4 0.4] (cliskf/offset [0.5 0.5] (cliskf/scale 0.04 cliskp/noise)))))
-          [0 0.5 0]
-        ;; interior meadows
-        (cliskf/v+ [-0.56 -0.56 -0.56]  (cliskf/v* c (cliskf/v+ [0.3 0.3 0.3] (cliskf/offset [-0.5 -0.5] (cliskf/scale 0.06 cliskp/noise)))))
-          [0.2 0.7 0.2]
-        ;; interior dirt/brown
+        ;; interior biomes
         (cliskf/v+ [-0.55 -0.55 -0.55]  c)
-          [0.3 0.2 0.1]
+          (vcond
+            (vand c1 c2)
+            ;; interior jungle
+            [0 0.4 0.1]
+            (vand c1 (vnot c2))
+            ;; interior trees/green
+            [0 0.5 0]
+            (vand (vnot c1) c2)
+            ;; interior meadows
+            [0.2 0.7 0.2]
+            (vnot (vand c1 c2))
+            ;; dirt
+            [0.3 0.2 0.1])
         ;; shore/yellow
         (cliskf/v+ [-0.5 -0.5 -0.5]  c)
           [0.7 0.6 0.0]
@@ -441,7 +464,7 @@
   (info "unloading" id)
   (log-time "unloading"
   (async/>!! save-place-chan [id (get-in state [:world :places id])])
-  ;; TODO: remove all npcs in place
+  ;; Remove all npcs in place being unloaded
   (->
     (reduce (fn [state npc] (if (= (apply xy->place-id state (pos->xy (get npc :pos)))
                                    id)


Doubled max points

Doubled max points

--- src/clojush/problems/software/x_word_lines.clj
+++ src/clojush/problems/software/x_word_lines.clj
@@ -204,7 +204,7 @@
 (def argmap
   {:error-function (x-word-lines-error-function x-word-lines-data-domains)
    :atom-generators x-word-lines-atom-generators
-   :max-points 1600
+   :max-points 3200
    :max-genome-size-in-initial-program 400
    :evalpush-limit 1600
    :population-size 1000


Fix unexpected exception on form errors handling.

--- src/uxbox/data/forms.cljs
+++ src/uxbox/data/forms.cljs
@@ -35,7 +35,7 @@
           errors-path (into [:errors type] (if (coll? field) field [field]))]
       (-> state
           (assoc-in form-path value)
-          (update-in errors-path dissoc field)))))
+          (update-in (butlast errors-path) dissoc (last errors-path))))))

 (defn assign-field-value
   [type field value]


Add missing translation string for auth error.

--- src/uxbox/locales/en.cljs
+++ src/uxbox/locales/en.cljs
@@ -37,4 +37,6 @@
    "ds.help.circle" "Circle (Ctrl + E)"
    "ds.help.line" "Line (Ctrl + L)"

+   "errors.auth" "Username or passwords seems to be wrong."
+
    })


Require test-data

Require test-data

--- src/webapp/server/fns.clj
+++ src/webapp/server/fns.clj
@@ -13,8 +13,9 @@
   (:use [webapp-config.settings])
   (:use [overtone.at-at])
   (:import [java.util.UUID])
-  (:import [java.util TimerTask Timer]))
-
+  (:import [java.util TimerTask Timer])
+  (:require [webapp.ignore.test-data])
+)

 (def my-pool (mk-pool))


New "given" macro

New "given" macro

Uses let-bound locals and &env metadata

--- src/main/clojure/com/stuartsierra/lazytest.clj
+++ src/main/clojure/com/stuartsierra/lazytest.clj
@@ -163,6 +163,12 @@
          (finally (close-local-contexts contexts merged active))))))

+(defn- firsts [coll]
+  (vec (map first (partition 2 coll))))
+
+(defn- seconds [coll]
+  (vec (map second (partition 2 coll))))
+
 ;;; Public API

 (defmacro is
@@ -170,25 +176,29 @@
   which will be compiled into a function.  A string will be attached
   as :doc metadata on the following assertion."
   [& assertions]
-  (loop [r [], as assertions]
-    (if (seq as)
-      (let [[doc form nxt]
-            (if (string? (first as))
-              [(first as) (second as) (nnext as)]
-              [nil (first as) (next as)])]
-        (recur (conj r `(SimpleAssertion
-                         (fn [] ~form)
-                         {:doc ~doc,
-                          :form '~form
-                          :file *file*,
-                          :line ~(:line (meta form))}
-                         nil))
-               nxt))
-      `(SimpleContainer ~r {:generator 'is
-                            :line ~(:line (meta &form))
-                            :file *file*
-                            :form '~&form}
-                        nil))))
+  (let [givens (vec (filter #(::given (meta %)) (keys &env)))]
+    (loop [r [], as assertions]
+      (if (seq as)
+        (let [[doc form nxt] (if (string? (first as))
+                               [(first as) (second as) (nnext as)]
+                               [nil (first as) (next as)])
+              metadata {:doc doc,
+                        :form form
+                        :file *file*
+                        :line (:line (meta form))
+                        :locals givens}]
+          (recur (conj r (if (seq givens)
+                           `(ContextualAssertion
+                             ~givens (fn ~givens ~form)
+                             '~metadata nil)
+                           `(SimpleAssertion
+                             (fn [] ~form) '~metadata nil)))
+                 nxt))
+        `(SimpleContainer ~r {:generator 'is
+                              :line ~(:line (meta &form))
+                              :file *file*
+                              :form '~&form}
+                          nil)))))

 (defmacro thrown?
   "Returns true if body throws an instance of class c."
@@ -223,18 +233,28 @@
           (= (+ 8 -1) 7))
 "
   [argv expr & values]
-  (let [argc (count argv)
+  (let [givens (vec (filter #(::given (meta %)) (keys &env)))
+        argc (count argv)
         sym (gensym "f")]
     (assert (vector? argv))
     (assert (zero? (rem (count values) argc)))
     `(let [~sym (fn ~argv ~expr)]
        (SimpleContainer ~(vec (map (fn [vs]
-                                     `(SimpleAssertion
-                                       (fn [] (~sym ~@vs))
-                                       {:form '(are ~argv ~expr ~@vs)
-                                        :file *file*
-                                        :line ~(some #(:line (meta %)) vs)}
-                                       nil))
+                                     (if (seq givens)
+                                       `(ContextualAssertion
+                                         ~givens
+                                         (fn ~givens (~sym ~@vs))
+                                         {:form '(~'are ~argv ~expr ~@vs)
+                                          :file *file*
+                                          :line ~(some #(:line (meta %)) vs)
+                                          :locals '~givens}
+                                         nil)
+                                       `(SimpleAssertion
+                                         (fn [] (~sym ~@vs))
+                                         {:form '(~'are ~argv ~expr ~@vs)
+                                          :file *file*
+                                          :line ~(some #(:line (meta %)) vs)}
+                                         nil)))
                                    (partition argc values)))
                         {:generator 'are
                          :file *file*
@@ -242,37 +262,16 @@
                          :form '~&form}
                         nil))))

-(defmacro given
-  "A series of assertions using values from contexts.
-  bindings is a vector of name-value pairs, like let, where each value
-  is a context created with defcontext.  A string will be attached
-  as :doc metadata on the following assertion."
-  [bindings & assertions]
-  (assert (vector? bindings))
-  (assert (even? (count bindings)))
-  (let [pairs (partition 2 bindings)
-        locals (vec (map first pairs))
-        contexts (vec (map second pairs))]
-    (loop [r [], as assertions]
-      (if (seq as)
-        (let [[doc form nxt]
-              (if (string? (first as))
-                [(first as) (second as) (nnext as)]
-                [nil (first as) (next as)])]
-          (recur (conj r `(ContextualAssertion
-                           ~contexts
-                           (fn ~locals ~form)
-                           {:doc ~doc,
-                            :locals '~locals
-                            :form '~form
-                            :file *file*,
-                            :line ~(:line (meta form))}
-                           nil))
-                 nxt))
-        `(SimpleContainer ~r {:generator 'given
-                              :line ~(:line (meta &form))
-                              :form '~&form}
-                          nil)))))
+(defmacro given
+  "Binds context states to locals.  bindings is a vector of
+  name-value pairs, like let, where each value is a context created
+  with defcontext."
+   [bindings & body]
+   {:pre [(vector? bindings)
+          (even? (count bindings))]}
+  (let [symbols (map #(with-meta % {::given true}) (firsts bindings))]
+    `(let ~(vec (interleave symbols (seconds bindings)))
+       ~@body)))

 (defn- attributes
   "Reads optional name symbol and doc string from args,


Remove obsolete commented out recently replicated test.

--- system-int-test/test/cmr/system_int_test/bootstrap/bulk_index_test.clj
+++ system-int-test/test/cmr/system_int_test/bootstrap/bulk_index_test.clj
@@ -53,7 +53,7 @@
      ;; Make sure the concept was saved successfully
      (is (= 201 (:status coll)))
      (merge umm (select-keys coll [:concept-id :revision-id])))))
-
+
 (defn- save-granule
   "Saves a granule concept"
   ([n collection]
@@ -152,16 +152,6 @@
   (let [search-items (set (map normalize-search-result-item results))
         exp-items (set (map #(dissoc % :status) expected))]
     (is (= exp-items search-items))))
-
-(defn- get-last-replicated-revision-date
-  "Helper to get the last replicated revision date from the database."
-  [db]
-  (j/with-db-transaction
-   [conn db]
-   (->> (j/query conn ["SELECT LAST_REPLICATED_REVISION_DATE FROM REPLICATION_STATUS"])
-        first
-        :last_replicated_revision_date
-        (oracle/oracle-timestamp->str-time conn))))

 (deftest index-system-concepts-test
   (s/only-with-real-database
@@ -217,102 +207,6 @@
     ;; Re-enable message publishing.
     (dev-sys-util/eval-in-dev-sys `(cmr.metadata-db.config/set-publish-messages! true)))))

-;; Commented out due to requiring a database link in order to work - this job is only transitional
-;; for moving to NGAP so we will remove it once we have fully transitioned.
-#_(deftest index-recently-replicated-test
-    (s/only-with-real-database
-     ;; Disable message publishing so items are not indexed as part of the initial save.
-     (dev-sys-util/eval-in-dev-sys `(cmr.metadata-db.config/set-publish-messages! false))
-     (let [last-replicated-datetime "3016-01-01T10:00:00Z"
-           coll-missed-cutoff (save-collection 1 {:revision-date "3016-01-01T09:59:40Z"})
-           coll-within-buffer (save-collection 2 {:revision-date "3016-01-01T09:59:41Z"})
-           coll-after-date (save-collection 3 {:revision-date "3016-01-02T00:00:00Z"})
-           gran-missed-cutoff (save-granule 1 coll-missed-cutoff {:revision-date "3016-01-01T09:59:40Z"})
-           gran-within-buffer (save-granule 2 coll-within-buffer {:revision-date "3016-01-01T09:59:41Z"})
-           gran-after-date (save-granule 3 coll-after-date {:revision-date "3016-01-02T00:00:00Z"})
-           tag-missed-cutoff (save-tag 1 {:revision-date "3016-01-01T09:59:40Z"})
-           tag-within-buffer (save-tag 2 {:revision-date "3016-01-01T09:59:41Z"})
-           tag-after-date (save-tag 3 {:revision-date "3016-01-02T00:00:00Z"})
-           acl-missed-cutoff (save-acl 1
-                                       {:revision-date "3016-01-01T09:59:40Z"
-                                        :extra-fields {:acl-identity "system:token"
-                                                       :target-provider-id "PROV1"}}
-                                       "TOKEN")
-           acl-within-buffer (save-acl 2
-                                       {:revision-date "3016-01-01T09:59:41Z"
-                                        :extra-fields {:acl-identity "system:group"
-                                                       :target-provider-id "PROV1"}}
-                                       "GROUP")
-           acl-after-date (save-acl 3
-                                    {:revision-date "3016-01-02T00:00:00Z"
-                                     :extra-fields {:acl-identity "system:user"
-                                                    :target-provider-id "PROV1"}}
-                                    "USER")
-           group-missed-cutoff (save-group 1 {:revision-date "3016-01-01T09:59:40Z"})
-           group-within-buffer (save-group 2 {:revision-date "3016-01-01T09:59:41Z"})
-           group-after-date (save-group 3 {:revision-date "3016-01-02T00:00:00Z"})
-           db (get-in (s/context) [:system :bootstrap-db])
-           stmt "UPDATE REPLICATION_STATUS SET LAST_REPLICATED_REVISION_DATE = ?"]
-       (j/db-do-prepared db stmt [(cr/to-sql-time (p/parse-datetime last-replicated-datetime))])
-       (bootstrap/index-recently-replicated)
-       ;; Force elastic data to be flushed, not actually waiting for index requests to finish
-       (index/wait-until-indexed)
-       (testing "Concepts with revision date within 20 seconds of last replicated date are indexed."
-         (are3 [concept-type expected]
-           (d/refs-match? expected (search/find-refs concept-type {}))
-
-           "Collections"
-           :collection [coll-within-buffer coll-after-date]
-
-           "Granules"
-           :granule [gran-within-buffer gran-after-date])
-
-         ;; ACLs
-         (let [response (ac/search-for-acls (u/conn-context) {} {:token (tc/echo-system-token)})
-               items (:items response)]
-           (search-results-match? items [acl-within-buffer acl-after-date]))
-
-         ;; Groups
-         (let [response (ac/search-for-groups (u/conn-context) {})
-               ;; Need to filter out admin group created by fixture
-               items (filter #(not (= "mock-admin-group-guid" (:legacy_guid %))) (:items response))]
-           (search-results-match? items [group-within-buffer group-after-date]))
-
-
-         (are3 [expected-tags]
-           (let [result-tags (update
-                               (tags/search {})
-                               :items
-                               (fn [items]
-                                 (map #(select-keys % [:concept-id :revision-id]) items)))]
-             (tags/assert-tag-search expected-tags result-tags))
-
-           "Tags"
-           [tag-within-buffer tag-after-date])))
-
-     (testing "When there are no concepts to index the date is not changed."
-       (j/db-do-prepared db stmt [(cr/to-sql-time (p/parse-datetime "3016-02-01T10:00:00.000Z"))])
-       (bootstrap/index-recently-replicated)
-       (is (= "3016-02-01T10:00:00.000Z" (get-last-replicated-revision-date db))))
-
-     (testing "Max revision dates are tracked correctly"
-       (testing "for provider concepts"
-         (let [coll (save-collection 1 {:revision-date "3016-02-02T10:59:40Z"})]
-           (save-granule 1 coll {:revision-date "3016-02-01T11:59:40Z"})
-           (save-tag 1 {:revision-date "3016-02-01T18:59:40Z"})
-           (bootstrap/index-recently-replicated))
-         (is (= "3016-02-02T10:59:40.000Z" (get-last-replicated-revision-date db))))
-       (testing "for system concepts"
-         (let [coll (save-collection 1 {:revision-date "3016-02-03T10:59:40Z"})]
-           (save-granule 1 coll {:revision-date "3016-03-01T11:59:40Z"})
-           (save-tag 1 {:revision-date "3016-03-01T12:10:47Z"})
-           (bootstrap/index-recently-replicated))
-         (is (= "3016-03-01T12:10:47.000Z" (get-last-replicated-revision-date db))))))
-
-   ;; Re-enable message publishing.
-   (dev-sys-util/eval-in-dev-sys `(cmr.metadata-db.config/set-publish-messages! true)))
-
-
 (deftest bulk-index-by-concept-id
   (s/only-with-real-database
     ;; Disable message publishing so items are not indexed.
@@ -339,7 +233,7 @@
       (bootstrap/bulk-index-concepts "PROV1" :collection colls)
       (bootstrap/bulk-index-concepts "PROV1" :granule [(:concept-id gran2)])
       (bootstrap/bulk-index-concepts "PROV1" :tag [(:concept-id tag1)])
-
+
       ;; Commented out until ACLs and groups are supported in the index by concept-id API
       ; (bootstrap/bulk-index-concepts "CMR" :access-group [(:concept-id group2)])
       ; (bootstrap/bulk-index-concepts "CMR" :acl [(:concept-id acl2)])
@@ -356,7 +250,7 @@

           "Granules"
           :granule [gran2])
-
+

         ;; Commented out until ACLs and groups are supported in the index by concept-id API
         ; ;; ACLs
@@ -377,14 +271,14 @@
                               (fn [items]
                                 (map #(select-keys % [:concept-id :revision-id]) items)))]
             (tags/assert-tag-search expected-tags result-tags))
-
+
           "Tags"
           [tag1])))

     ;; Re-enable message publishing.
     (dev-sys-util/eval-in-dev-sys `(cmr.metadata-db.config/set-publish-messages! true))))

-(deftest bulk-delete-by-concept-id
+(deftest bulk-delete-by-concept-id
   (s/only-with-real-database
     (let [coll1 (save-collection 1)
           coll2 (save-collection 2)
@@ -416,7 +310,7 @@
       (bootstrap/bulk-delete-concepts "PROV1" :collection (map :concept-id [coll1]))
       (bootstrap/bulk-delete-concepts "PROV1" :granule (map :concept-id [gran1 gran3 gran4]))
       (bootstrap/bulk-delete-concepts "PROV1" :tag [(:concept-id tag1)])
-
+
       ;; Commented out until ACLs and groups are supported in the delete by concept-id API
       ; (bootstrap/bulk-index-concepts "CMR" :access-group [(:concept-id group2)])
       ; (bootstrap/bulk-index-concepts "CMR" :acl [(:concept-id acl2)])
@@ -441,7 +335,7 @@
                                 (fn [items]
                                   (map #(select-keys % [:concept-id :revision-id]) items)))]
               (tags/assert-tag-search expected-tags result-tags))
-
+
             "Tags"
             [tag2])))))


Fix failure detection on replicaset->Service payload (#591)

--- waiter/src/waiter/scheduler/kubernetes.clj
+++ waiter/src/waiter/scheduler/kubernetes.clj
@@ -91,7 +91,7 @@
 (defn replicaset->Service
   "Convert a Kubernetes ReplicaSet JSON response into a Waiter Service record."
   [replicaset-json]
-  (if (contains? replicaset-json :error)
+  (if (= "Failure" (:status replicaset-json))
     (do
       (log/info "encountered error response in ReplicaSet query:" replicaset-json)
       nil)


Add async requirement to K8s scheduler (#476)

This is a workaround for a very strange class-loading error that we've
seen when deploying to our production clusters.

--- waiter/src/waiter/scheduler/kubernetes.clj
+++ waiter/src/waiter/scheduler/kubernetes.clj
@@ -10,6 +10,7 @@
 ;;
 (ns waiter.scheduler.kubernetes
   (:require [clj-time.core :as t]
+            [clojure.core.async :as async]
             [clojure.java.io :as io]
             [clojure.string :as string]
             [clojure.tools.logging :as log]


cache tests

cache tests

--- test/cljc/commos/delta/compscribe_test.cljc
+++ test/cljc/commos/delta/compscribe_test.cljc
@@ -174,3 +174,62 @@
          (is (= 0 (<! unsubs-bar)))
          (close! foo-complete)
          (is (empty? (reduce delta/add nil (<! (a/into [] target))))))))))
+
+(deftest cache
+  (let [block-foo (chan)
+        [subs-fn unsubs-fn [subscriptions unsubscribable]]
+        (simulate-api
+         {"/foo/"
+          {:deltas {0 [[:in :a 0]
+                       [:in :b 0]
+                       block-foo]}}
+          "/bar/"
+          {:deltas {0 [[:is :baz 42]]}}})
+        target (chan 1 (comp delta/values
+                             (drop 1)))
+        end-subscription (compscribe target subs-fn unsubs-fn
+                                     ["/foo/" {:a ["/bar/"]
+                                               :b ["/bar/"]}]
+                                     0)]
+    (test-async
+     (test-within 1000
+       (go
+         (let [v (<! target)]
+           (is (= v
+                  {:a {0 {:baz 42}}
+                   :b {0 {:baz 42}}}))
+           (is (identical? (get-in v [:a 0])
+                           (get-in v [:b 0]))))
+         (close! block-foo))))))
+
+(deftest cache-nested
+  (let [block-foo (chan)
+        block-bar (chan)
+        [subs-fn unsubs-fn [subscriptions unsubscribable]]
+        (simulate-api
+         {"/foo/"
+          {:deltas {0 [[:in :a 0]
+                       [:in :b 0]
+                       block-foo]}}
+          "/bar/"
+          {:deltas {0 [[:is :baz 0]
+                       block-bar]}}
+          "/baz/"
+          {:deltas {0 [[:is 42]]}}})
+        target (chan 1 (comp delta/values
+                             (drop 1)))
+        end-subscription (compscribe target subs-fn unsubs-fn
+                                     ["/foo/" {:a ["/bar/" {:baz ["/baz/"]}]
+                                               :b ["/bar/" {:baz ["/baz/"]}]}]
+                                     0)]
+    (test-async
+     (test-within 1000
+       (go
+         (let [v (<! target)]
+           (is (= v
+                  {:a {0 {:baz 42}}
+                   :b {0 {:baz 42}}}))
+           (is (identical? (get-in v [:a 0])
+                           (get-in v [:b 0])))
+           (close! block-bar)
+           (close! block-foo)))))))


fix test

fix test

--- test/chat/test/server/db.clj
+++ test/chat/test/server/db.clj
@@ -140,7 +140,7 @@
                                  :password "foobar"
                                  :avatar ""})
         user-2 (db/create-user! {:id (db/uuid)
-                                 :email "foo@bar.com"
+                                 :email "quux@bar.com"
                                  :password "foobar"
                                  :avatar ""})
         thread-id (db/uuid)


CMR-1381: Change database migration to no longer populate granule-ur column

--- metadata-db-app/src/migrations/015_add_granule_ur_to_granule_tables.clj
+++ metadata-db-app/src/migrations/015_add_granule_ur_to_granule_tables.clj
@@ -4,28 +4,16 @@
             [cmr.metadata-db.data.oracle.sql-utils :as su]))

 (defn up
-  "Migrates the database up to version 15."
+  "Migrates the database up to version 15, adding granule-ur column to provider granule tables."
   []
   (println "migrations.015-add-granule-ur-to-granule-tables up...")
-
-  ;; Create the new column for each granule table first - this will be fast. After the column has
-  ;; been created, ongoing ingests should succeed even while the rest of this migration runs.
   (doseq [t (h/get-granule-tablenames)]
-    (h/sql (format "alter table %s add granule_ur VARCHAR(250)" t)))
-
-  ;; Populate the granule_ur column and create an index simultaneous with ongoing ingest.
-  (doseq [t (h/get-granule-tablenames)]
-    ;; Set the granule UR one collection at a time to prevent long blocking of the granules table
-    (let [collection-id-maps (h/query (format "select distinct(parent_collection_id) from %s" t))]
-      (doseq [collection-id-map collection-id-maps]
-        (h/sql (format "update %s set granule_ur = native_id where parent_collection_id = '%s'"
-                       t
-                       (:parent_collection_id collection-id-map)))))
-    (h/sql (format "alter table %s modify granule_ur NOT NULL" t))
+    (h/sql (format "alter table %s add granule_ur VARCHAR(250)" t))
     (h/sql (format "CREATE INDEX idx_%s_ur ON %s(granule_ur)" t t))))

 (defn down
-  "Migrates the database down from version 15."
+  "Migrates the database down from version 15, removing the granule-ur column from provider granule
+  tables."
   []
   (println "migrations.015-add-granule-ur-to-granule-tables down.")
   (doseq [t (h/get-granule-tablenames)]


Compact to about-bam-indexer-small-file test

--- test/cljam/t_bam_indexer.clj
+++ test/cljam/t_bam_indexer.clj
@@ -9,6 +9,7 @@
             [cljam.bam-indexer :as bai]))

 (def temp-file-sorted (str temp-dir "/test.sorted.bam"))
+(def temp-file-sorted-2 (str temp-dir "/test.sorted2.bam"))

 (deftest about-bam-indexer
   (with-before-after {:before (do (prepare-cache!)
@@ -52,23 +53,30 @@
       )))

 (deftest about-bam-indexer-small-file
-  (doseq [n-threads [1 4]]
-    (with-before-after {:before (do (prepare-cache!)
-                                    (fs/copy small-bam-file temp-file-sorted))
-                        :after (clean-cache!)}
+  (with-before-after {:before (do (prepare-cache!)
+                                  (fs/copy small-bam-file temp-file-sorted)
+                                  (fs/copy small-bam-file temp-file-sorted-2))
+                      :after (clean-cache!)}
+    (let [temp-file-sorted-bai (str temp-file-sorted ".bai")
+          temp-file-sorted-bai-2 (str temp-file-sorted-2 ".bai")]
       (is (not-throw? (bai/create-index temp-file-sorted
-                                        (str temp-file-sorted ".bai")
-                                        :n-threads n-threads)))
-      (is (fs/exists? (str temp-file-sorted ".bai")))
+                                        temp-file-sorted-bai
+                                        :n-threads 1)))
+      (is (fs/exists? temp-file-sorted-bai))
+      (is (not-throw? (bai/create-index temp-file-sorted-2
+                                        temp-file-sorted-bai-2
+                                        :n-threads 4)))
+      (is (fs/exists? temp-file-sorted-bai-2))
+      (is (same-file? temp-file-sorted-bai temp-file-sorted-bai-2))
       (with-open [r (bam/reader temp-file-sorted)]
         ;; Random read with different number of spans.
         (are [?param ?counts] (= (count (io/read-alignments r ?param)) ?counts)
-          {:chr "chr1" :start 23000000 :end 25000000 :depth :shallow} 14858
-          {:chr "chr1" :start 23000000 :end 25000000 :depth :pointer} 14858
-          {:chr "chr1" :start 23000000 :end 25000000 :depth :deep} 14858
-          {:chr "chr1" :start 23000000 :end 24500000 :depth :deep} 11424
+          {:chr "chr1" :start 23000000 :end 23010000 :depth :shallow} 175
+          {:chr "chr1" :start 23000000 :end 23010000 :depth :pointer} 175
+          {:chr "chr1" :start 23000000 :end 23010000 :depth :deep} 175
+          {:chr "chr1" :start 23000000 :end 23020000 :depth :deep} 292
+          {:chr "chr1" :start 23000000 :end 23050000 :depth :deep} 621
           {:chr "chr1" :start 23000000 :end 24000000 :depth :deep} 10010
-          {:chr "chr1" :start 23000000 :end 23500000 :depth :deep} 3806
           {:chr "*"} 0)))))

 (deftest-slow about-bam-indexer-medium-file


New test added into test/clouseau/test_utils.clj

--- test/clouseau/test_utils.clj
+++ test/clouseau/test_utils.clj
@@ -192,6 +192,16 @@
             "world"  (substring "Hello world!" 6 11)
             "world!" (substring "Hello world!" 6 12))))

+(deftest test-substring-3
+    "Check the function clouseau.utils/substring."
+    (testing "the function clouseau.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 clouseau.utils/substring."
     (testing "the function clouseau.utils/substring."


test for core/python

test for core/python

--- test/clygments/core_test.clj
+++ test/clygments/core_test.clj
@@ -1,7 +1,7 @@
 (ns clygments.core-test
   (:require [clojure.test :refer :all]
-            [clygments.core :refer :all]))
+            [clygments.core :as clg]))

-(deftest a-test
-  (testing "FIXME, I fail."
-    (is (= 0 1))))
+(deftest python-interpreter
+  (is (= 16 (.getValue (.eval @#'clg/python "pow(4,2)")))))
+


core: not-empty

core: not-empty

--- core/data/core.clj
+++ core/data/core.clj
@@ -2758,6 +2758,11 @@
   [& vars]
   (every? #(bound?* ^Var %) vars))

+(defn not-empty
+  "If coll is empty, returns nil, else coll"
+  {:added "1.0"}
+  [coll] (when (seq coll) coll))
+
 (defn get-in
   "Returns the value in a nested associative structure,
   where ks is a sequence of keys. Returns nil if the key


cjl - Test for multiple full rows

cjl - Test for multiple full rows

--- test/icfp2015/board_test.clj
+++ test/icfp2015/board_test.clj
@@ -81,4 +81,13 @@
           expected-board { :width 5
                            :height 5
                            :filled #{} } ]
+      (is (= expected-board actual-board))))
+  (testing "rows cleared if multiple full rows"
+    (let [board { :width 3
+                  :height 5
+                  :filled #{ [4 0] [4 1] [4 2] [1 0] [1 1] [1 2] } }
+          actual-board (clear-rows board)
+          expected-board { :width 3
+                           :height 5
+                           :filled #{} } ]
       (is (= expected-board actual-board)))))


don't be too cray cray

don't be too cray cray

--- test/metabase/test_setup.clj
+++ test/metabase/test_setup.clj
@@ -67,7 +67,7 @@
 (defn load-test-datasets
   "Call `load-data!` on all the datasets we're testing against."
   []
-  (u/pdoseq [dataset-name datasets/test-dataset-names]
+  (doseq [dataset-name datasets/test-dataset-names]
     (log/info (format "Loading test data: %s..." (name dataset-name)))
     (let [dataset (datasets/dataset-name->dataset dataset-name)]
       (datasets/load-data! dataset)


Rework existing tests to add checks over all ops

--- test/oxcart/pattern_test.clj
+++ test/oxcart/pattern_test.clj
@@ -2,6 +2,14 @@
   (:require [oxcart.pattern :as p]
             [oxcart.test-util :refer :all]
             [clojure.test :refer :all]))
+
+
+(def ops
+  #{:binding :catch :const :def :do :fn :fn-method
+    :host-call :host-field :host-interop :if :invoke
+    :let :letfn :local :loop :map :maybe-class
+    :maybe-host-form :new :quote :recur :set :set!
+    :throw :try :var :vector :with-meta})

 (def foo
@@ -26,6 +34,10 @@

 (deftest def?-tests
+  (doseq [op ops]
+    (if (not= op :def)
+      (is-not (p/def? {:op op}))
+      (is (p/def? {:op op}))))
   (is (p/def? foo))
   (is (p/def? bar))
   (is-not (p/def? fail)))
@@ -54,6 +66,10 @@

 (deftest fn?-tests
+  (doseq [op ops]
+    (if (not= op :fn)
+      (is-not (p/fn? {:op op}))
+      (is (p/fn? {:op op}))))
   (is (p/fn? (:init foo)))
   (is (p/fn? (:init bar)))
   (is (p/fn? fail))
@@ -69,16 +85,22 @@

 (deftest let?-tests
+  (doseq [op ops]
+    (if (not= op :let)
+      (is-not (p/let? {:op op}))
+      (is (p/let? {:op op}))))
   (is-not (p/let? foo))
   (is-not (p/let? (:init foo)))
   (is-not (p/let? bar))
   (is-not (p/let? (:init bar)))
-  (is (p/let? addition))
-  (is (p/let? {:op :let})))
+  (is (p/let? addition)))

 (deftest letfn?-tests
-  (is (p/letfn? {:op :letfn}))
+  (doseq [op ops]
+    (if (not= op :letfn)
+      (is-not (p/letfn? {:op op}))
+      (is (p/letfn? {:op op}))))
   (is-not (p/letfn? addition))
   (is-not (p/letfn? foo))
   (is-not (p/letfn? (:init foo)))


Optimize array? and find-ns-obj

Optimize array? and find-ns-obj

--- ClojureScript/replete/src/replete/repl.cljs
+++ ClojureScript/replete/src/replete/repl.cljs
@@ -25,6 +25,14 @@

 ;; Prefer ES6 Number.isInteger
 (set! integer? (or (.-isInteger js/Number) integer?))
+
+;; Monkey patch target-specific core fns
+
+(set! array? (fn [x] (instance? js/Array x)))
+
+(set! find-ns-obj (fn [ns] (let [munged-ns (munge (str ns))
+                                 segs (.split munged-ns ".")]
+                             (find-ns-obj* goog/global segs))))

 (def DEBUG false)


CMR-6164 fixes bug where gran-refs is nil

--- ingest-app/src/cmr/ingest/services/jobs.clj
+++ ingest-app/src/cmr/ingest/services/jobs.clj
@@ -267,13 +267,14 @@
   "Takes a list of granule references and a subscriber id and removes any granule that the user does
    not have read access to."
   [context gran-refs subscriber-id]
-  (let [concept-ids (map :concept-id gran-refs)
-        permissions (json/parse-string
-                     (access-control/get-permissions context {:user_id subscriber-id
-                                                              :concept_id (map :concept-id gran-refs)}))]
-    (filter (fn [granule-reference]
-              (some #{"read"} (get permissions (:concept-id granule-reference))))
-            gran-refs)))
+  (when (seq gran-refs)
+    (let [concept-ids (map :concept-id gran-refs)
+          permissions (json/parse-string
+                       (access-control/get-permissions context {:user_id subscriber-id
+                                                                :concept_id (map :concept-id gran-refs)}))]
+      (filter (fn [granule-reference]
+                (some #{"read"} (get permissions (:concept-id granule-reference))))
+              gran-refs))))

 (defn- process-subscriptions
   "Process each subscription in subscriptions into tuple for testing purposes and to use as


Fixes race condition in shell-scheduler-test/test-scale-app (#32)

--- waiter/test/waiter/shell_scheduler_test.clj
+++ waiter/test/waiter/shell_scheduler_test.clj
@@ -150,6 +150,7 @@
       ;; Create service, instances: 1
       (is (= {:success true, :result :created, :message "Created foo"}
              (create-test-service scheduler "foo")))
+      (is (ct/wait-for #(true? (scheduler/app-exists? scheduler "foo")) :interval 0.1))
       ;; Scale up, instances: 2
       (is (= {:success true, :result :scaled, :message "Scaled foo"}
              (scheduler/scale-app scheduler "foo" 2)))


added try catch to om-next template with error feedback

--- resources/om-next.cljs
+++ resources/om-next.cljs
@@ -13,21 +13,34 @@
          '[:app/msg])
   Object
   (render [this]
-    (let [{:keys [app/msg]} (om/props this)]
-      (view {:style {:flexDirection "column" :margin 40 :alignItems "center"}}
-        (text
-          {:style {:fontSize 50 :fontWeight "100" :marginBottom 20 :textAlign "center"}}
-          msg)
+    (try
+      (let [{:keys [app/msg]} (om/props this)]
+        (view {:style {:flexDirection "column" :margin 40 :alignItems "center"}}
+          (text
+            {:style {:fontSize 50 :fontWeight "100" :marginBottom 20 :textAlign "center"}}
+            msg)

-        (image {:source {:uri "https://raw.githubusercontent.com/cljsinfo/logo.cljs/master/cljs.png"}
-                :style {:width 80 :height 80 :marginBottom 30}})
+          (image {:source {:uri "https://raw.githubusercontent.com/cljsinfo/logo.cljs/master/cljs.png"}
+                  :style {:width 80 :height 80 :marginBottom 30}})

-        (touchable-highlight
-          {:style {:backgroundColor "#999" :padding 10 :borderRadius 5}
-           :onPress #(alert "HELLO!")}
-          (text {:style {:color "white" :textAlign "center" :fontWeight "bold"}} "press me"))))))
+          (touchable-highlight
+            {:style {:backgroundColor "#999" :padding 10 :borderRadius 5}
+             :onPress #(alert "HELLO!")}
+            (text {:style {:color "white" :textAlign "center" :fontWeight "bold"}} "press me"))))

-;; om.next parser
+      (catch :default e
+        (view {:style {:backgroundColor "#cc0814" :flex 1 :padding 20 :paddingTop 40}}
+          (text
+            {:style {:fontWeight "normal" :color "white" :fontSize 24 :marginBottom 10}}
+            "ERROR")
+          (text
+            {:style {:color "white" :fontFamily "Menlo-Regular" :fontSize 16 :lineHeight 24}}
+            (.-message e))
+          (text
+            {:style {:color "white" :marginTop 20 :fontSize 16 :fontWeight "bold"}}
+            "Check REPL log for details."))))))
+
+
 (defmulti read om/dispatch)
 (defmethod read :default
   [{:keys [state]} k _]


add benchmark for prepending to a vector

--- scripts/benchmarks.clj
+++ scripts/benchmarks.clj
@@ -206,6 +206,12 @@
     (reduce conj v [1])
     (conj v 1)))

+(let [data [1 2 3 4 5 6 7 8 9 10]]
+  (run-benchmark "prepend to a vector" 1000000
+    (vec (cons 0 data))
+    (setval BEFORE-ELEM 0 data)
+    (into [0] data)
+    ))

 (declarepath TreeValues)


include #iters in benchmark output

include #iters in benchmark output

--- scripts/benchmarks.clj
+++ scripts/benchmarks.clj
@@ -47,20 +47,10 @@
 (defmacro run-benchmark [name amt-per-iter & exprs]
   (let [afn-map (->> exprs shuffle (map (fn [e] [`(quote ~e) `(fn [] ~e)])) (into {}))]
     `(do
-       (println "Benchmark:" ~name)
+       (println "Benchmark:" ~name (str "(" ~amt-per-iter " iterations)"))
        (compare-benchmark ~amt-per-iter ~afn-map)
        (println "\n********************************\n")
        )))
-
-(let [data (range 1000)]
-  (run-benchmark "Traverse into a set" 5000
-    (set data)
-    (set (select ALL data))
-    (into #{} (traverse ALL data))
-    (persistent!
-      (reduce conj! (transient #{}) (traverse ALL data)))
-    (reduce conj #{} (traverse ALL data))
-    ))

 (let [data {:a {:b {:c 1}}}
       p (comp-paths :a :b :c)]
@@ -254,3 +244,13 @@
     (vary-meta data assoc :y 2)
     (setval [META :y] 2 data)))

+(let [data (range 1000)]
+  (run-benchmark "Traverse into a set" 5000
+    (set data)
+    (set (select ALL data))
+    (into #{} (traverse ALL data))
+    (persistent!
+      (reduce conj! (transient #{}) (traverse ALL data)))
+    (reduce conj #{} (traverse ALL data))
+    ))
+


cleaned up track-view a bit

cleaned up track-view a bit

--- src/frontend/renderer.cljs
+++ src/frontend/renderer.cljs
@@ -167,20 +167,21 @@
             title (.-title tags)
             artist (.-artist tags)
             album (.-album tags)
-            username (.-username data)]
-        (dom/div #js {:className "track-view"}
-          (list
-            (dom/span #js {:className "track-title"
-                           :title title}
-                      title)
-            (dom/span #js {:className "track-album"
-                           :title album}
-                      album)
-            (dom/span #js {:className "track-artist"
-                           :title artist}
-                      artist)
-            (dom/span #js {:className "track-uploader"
-                           :title (str "Added by " username)} "Added by " username)))))))
+            username (.-username data)
+            content (list
+                      (dom/span #js {:className "track-title"
+                                     :title title}
+                                title)
+                      (dom/span #js {:className "track-album"
+                                     :title album}
+                                album)
+                      (dom/span #js {:className "track-artist"
+                                     :title artist}
+                                artist)
+                      (dom/span #js {:className "track-uploader"
+                                     :title (str "Added by " username)} "Added by " username))]
+                  (dom/div #js {:className "track-view"}
+                    content)))))

 (defn track-queue [data owner]
   (reify


automatically detect best file type when loading sound files

--- src/cljs/daveconservatoire/site/ui/exercises.cljs
+++ src/cljs/daveconservatoire/site/ui/exercises.cljs
@@ -771,6 +771,46 @@
     (exercise (om/props this)
       (dom/p #js {:key "p"} "What kind of scale do you hear?"))))

+(om/defui ^:once SingleSoundListening
+  static uc/InitialAppState
+  (initial-state [this props]
+    (new-round! this
+      (let [scales (get props ::scales)]
+        (merge
+          (uc/initial-state Exercise nil)
+          {::name           "scales"
+           ::audio/duration 2
+           ::options        (mapv #(vector (str %) (str %)) scales)}
+          props))))
+
+  static om/Ident
+  (ident [_ props] [:exercise/by-name (::name props)])
+
+  static om/IQuery
+  (query [_] '[*])
+
+  static IExercise
+  (new-round [_ props]
+    (let [tonic    (descriptor->value ["B2" ".." "F5"])
+          duration (::audio/duration props)
+          scale    (rand-nth (::scales props))
+          notes    (as-> (build-scale tonic (get SCALE-NAMES scale)) <>
+                     (mapv vector <> (repeat duration)))]
+      (assoc props
+        ::notes notes
+        ::correct-answer scale)))
+
+  Object
+  (render [this]
+    (exercise (om/props this)
+      (dom/p #js {:key "p"} "What kind of scale do you hear?"))))
+
+{"guitar1" {::url   ["instruments/sample-guitar"
+                     "instruments/sample-guitar2"]
+            ::label "Guitar"}
+ "piano"   {::url   ["instruments/piano"]
+            ::label "Piano"}}
+
 (defmulti slug->exercise identity)

 (defmethod slug->exercise :default [_] nil)


Cleaned up arena.cljs

Cleaned up arena.cljs

--- src/cljs/wombats_web_client/components/arena.cljs
+++ src/cljs/wombats_web_client/components/arena.cljs
@@ -2,44 +2,77 @@
   (:require [re-frame.core :as re-frame]
             [wombats-web-client.utils.canvas :as canvas]))

+(defonce spritesheet-png "/images/spritesheet.png")
+
 (defn- draw-image
-  [canvas-element img-name x y width height rotation flipped]
+  [canvas-element img-name x y width height]
   (let [spritesheet (re-frame/subscribe [:spritesheet])
         sprite-info (get @spritesheet (keyword img-name))
         frame (:frame sprite-info)]
     (when-not (nil? frame)
       (let [img (js/Image.)]
-        (set! (.-src img) "/images/spritesheet.png")
+        (set! (.-src img) spritesheet-png)
         (.requestAnimationFrame js/window
                                 (fn []
-                                  (if flipped
-                                    (canvas/draw-image-flipped-horizontally canvas-element
-                                                                            img
-                                                                            (:x frame)
-                                                                            (:y frame)
-                                                                            (:w frame)
-                                                                            (:h frame)
-                                                                            x y
-                                                                            width
-                                                                            height)
-
-                                    (canvas/draw-image-rotated canvas-element
-                                                               img
-                                                               (:x frame)
-                                                               (:y frame)
-                                                               (:w frame)
-                                                               (:h frame)
-                                                               x y
-                                                               width
-                                                               height
-                                                               rotation))))))))
+                                  (canvas/draw-image canvas-element
+                                                     img
+                                                     (:x frame)
+                                                     (:y frame)
+                                                     (:w frame)
+                                                     (:h frame)
+                                                     x
+                                                     y
+                                                     width
+                                                     height)))))))
+
+(defn- draw-image-rotated
+  [canvas-element img-name x y width height rotation]
+  (let [spritesheet (re-frame/subscribe [:spritesheet])
+        sprite-info (get @spritesheet (keyword img-name))
+        frame (:frame sprite-info)]
+    (when-not (nil? frame)
+      (let [img (js/Image.)]
+        (set! (.-src img) spritesheet-png)
+        (.requestAnimationFrame js/window
+                                (fn []
+                                  (canvas/draw-image-rotated canvas-element
+                                                             img
+                                                             (:x frame)
+                                                             (:y frame)
+                                                             (:w frame)
+                                                             (:h frame)
+                                                             x y
+                                                             width
+                                                             height
+                                                             rotation)))))))
+
+(defn- draw-image-flipped-horizontally
+  [canvas-element img-name x y width height]
+
+  (let [spritesheet (re-frame/subscribe [:spritesheet])
+        sprite-info (get @spritesheet (keyword img-name))
+        frame (:frame sprite-info)]
+    (when-not (nil? frame)
+      (let [img (js/Image.)]
+        (set! (.-src img) spritesheet-png)
+        (.requestAnimationFrame js/window
+                                (fn []
+                                  (canvas/draw-image-flipped-horizontally canvas-element
+                                                                          img
+                                                                          (:x frame)
+                                                                          (:y frame)
+                                                                          (:w frame)
+                                                                          (:h frame)
+                                                                          x y
+                                                                          width
+                                                                          height)))))))

 (defn- draw-background
   "This draws the background of a cell (only called for cells that need it)"
   [canvas-element x y width height]
   (draw-image canvas-element
               "arena_bg.png"
-              x y width height 0 false))
+              x y width height))

 (defn- meta-value
   "Gets a score for a meta type for sorting draw level"
@@ -67,25 +100,24 @@
            orientation :orientation} (sort-meta meta)]
     (case type
       :shot
-      (draw-image canvas-element
-                  "fire_shot_right.png"
-                  x y width height
-                  (case orientation
-                    :n 270
-                    :w 180
-                    :s 90
-                    0)
-                  false)
+      (draw-image-rotated canvas-element
+                          "fire_shot_right.png"
+                          x y width height
+                          (case orientation
+                            :n 270
+                            :w 180
+                            :s 90
+                            0))

       :smoke
       (draw-image canvas-element
                   "smoke.png"
-                  x y width height 0 false)
+                  x y width height)

       :explosion
       (draw-image canvas-element
                   "explosion.png"
-                  x y width height 0 false)
+                  x y width height)

       (js/console.log type))))

@@ -99,7 +131,7 @@
                        :medium "2"
                        "1")
                      ".png")
-                x y width height 0 false)
+                x y width height)
     (draw-meta canvas-element contents meta x y width height)))

 (defn- draw-steel-barrier
@@ -112,21 +144,21 @@
                        :medium "2"
                        "1")
                      ".png")
-                x y width height 0 false)
+                x y width height)
     (draw-meta canvas-element contents meta x y width height)))

 (defn- draw-food
   [canvas-element contents meta x y width height]
   (draw-image canvas-element
               "food_cherry.png"
-              x y width height 0 false)
+              x y width height)
   (draw-meta canvas-element contents meta x y width height))

 (defn- draw-poison
   [canvas-element contents meta x y width height]
   (draw-image canvas-element
               "poison_vial_2.png"
-              x y width height 0 false)
+              x y width height)
   (draw-meta canvas-element contents meta x y width height))

 (defn- draw-open
@@ -141,33 +173,41 @@
                     :s "front"
                     :n "back"
                     "right")
+        img-name (str "zakano_" direction ".png")
+        img-name-fire (str "zakano_" direction "_fire.png")
         flipped (= orientation :w)]

     ;; Always draw the base zakano
-    (draw-image canvas-element
-                (str "zakano_" direction ".png")
-                x y width height 0
-                flipped)
+    (if flipped
+      (draw-image-flipped-horizontally canvas-element
+                                       img-name
+                                       x y width height)
+      (draw-image canvas-element
+                  img-name
+                  x y width height))

     ;; See if we need to add any meta to the zakano
     (doseq [{type :type} (sort-meta meta)]

       (case type
         :shot
-        (draw-image canvas-element
-                    (str "zakano_" direction "_fire.png")
-                    x y width height 0
-                    flipped)
+        (if flipped
+          (draw-image-flipped-horizontally canvas-element
+                                           img-name-fire
+                                           x y width height)
+          (draw-image canvas-element
+                      img-name-fire
+                      x y width height))

         :explosion
         (draw-image canvas-element
                     "explosion.png"
-                    x y width height 0 false)
+                    x y width height)

         :smoke
         (draw-image canvas-element
                     "smoke.png"
-                    x y width height 0 false)
+                    x y width height)

         (js/console.log type)))))

@@ -180,33 +220,41 @@
                     :s "front"
                     :n "back"
                     "right")
+        img-name (str "wombat_" color "_" direction ".png")
+        img-name-fire (str "wombat_" color "_" direction "_fire.png")
         flipped (= orientation :w)]

     ;; Always draw the base wombat
-    (draw-image canvas-element
-                (str "wombat_" color "_" direction ".png")
-                x y width height 0
-                flipped)
+    (if flipped
+      (draw-image-flipped-horizontally canvas-element
+                                       img-name
+                                       x y width height)
+      (draw-image canvas-element
+                  img-name
+                  x y width height))

     ;; See if we need to add any meta to the wombat
     (doseq [{type :type} (sort-meta meta)]

       (case type
         :shot
-        (draw-image canvas-element
-                    (str "wombat_" color "_" direction "_fire.png")
-                    x y width height 0
-                    flipped)
+        (if flipped
+          (draw-image-flipped-horizontally canvas-element
+                                           img-name-fire
+                                           x y width height)
+          (draw-image canvas-element
+                      img-name-fire
+                      x y width height))

         :explosion
         (draw-image canvas-element
                     "explosion.png"
-                    x y width height 0 false)
+                    x y width height)

         :smoke
         (draw-image canvas-element
                     "smoke.png"
-                    x y width height 0 false)
+                    x y width height)

         (js/console.log type)))))


sort table by :string/ident

sort table by :string/ident

--- src/om_next_datascript_localisation_demo/components/locale/strings.cljs
+++ src/om_next_datascript_localisation_demo/components/locale/strings.cljs
@@ -144,6 +144,7 @@
     (let [props (om/props this)
           locales (:locales props)
           localised-strings (:localised-strings props)
+          localised-strings (sort-by :string/ident localised-strings)
           ;; to make sure locales are in a consistent order
           ;; we pass the order of display to the row
           order (mapv #(get-in % [:db/id]) locales)


Refactor the factor-element-name function to take a element name string, not an element name keyword

--- src/main/clojure/cascade/internal/viewbuilder.clj
+++ src/main/clojure/cascade/internal/viewbuilder.clj
@@ -58,14 +58,15 @@
       :else (assoc attributes key (str/join " " matches)))))

 (defn factor-element-name
-  "Factors a keyword representing an element name into a simple element name keyword and a
-  map of up to two attributes: :id and :class. The complex element name includes the implicit id and class(es)
-  using CSS-inspired naming; :p.important.top-level#status would factor to
-  [:p { :id :status :class \"important top-level\" } ]. The value for :class will be
-  a keyword if there is only a single value. The attributes map may be nil if the
-  element-name is simple."
+  "Factors a string representing an element name into a simple element name keyword and a
+map of up to two attributes: :id and :class. The complex element name includes the implicit id and class(es)
+using CSS-inspired naming; \"p.important.top-level#status\" would factor to
+[:p { :id :status :class \"important top-level\" } ]. The value for :class or :id will be
+a keyword if there is only a single value, or joined as a string if there are multiple values.
+The attributes map may be nil if the
+element-name is simple."
   [element-name]
-  (let [exploded (explode-element-name (name element-name))]
+  (let [exploded (explode-element-name element-name)]
     (if (empty? exploded)
       [(keyword element-name) nil]
       (let [simple-element-name (keyword (get-in exploded [0 0]))
@@ -109,10 +110,10 @@
       `(raw-node ~(str (name entity-name) ";"))))

   (def parse-element
-    (domonad [name parse-name
+    (domonad [element-selector parse-name
               attributes (optional match-map)
               body (optional parse-body)]
-      (let [[factored-element-name implicit-attributes] (factor-element-name name)
+      (let [[factored-element-name implicit-attributes] (factor-element-name (name element-selector))
             assembled-attributes (merge implicit-attributes attributes)]
         `(element-node ~factored-element-name ~assembled-attributes ~body))))


once a build is not ssh-able, don't show Rebuild with SSH

--- src-cljs/frontend/components/pages/build.cljs
+++ src-cljs/frontend/components/pages/build.cljs
@@ -17,8 +17,9 @@

 (defn- ssh-available?
   "Show the SSH button unless it's disabled"
-  [project]
-  (not (project-model/feature-enabled? project :disable-ssh)))
+  [project build]
+  (not (or (project-model/feature-enabled? project :disable-ssh)
+           (:ssh_disabled build))))

 (defn- rebuild-actions [{:keys [build project]} owner]
   (reify
@@ -65,7 +66,7 @@
            [:ul.dropdown-menu.pull-right
             [:li
              [:a {:on-click (action-for :without_cache)} (text-for :without_cache)]]
-            (when (ssh-available? project)
+            (when (ssh-available? project build)
               [:li
                [:a {:on-click (action-for :with_ssh)} (text-for :with_ssh)]])]]])))))

@@ -135,5 +136,6 @@
                 {:app app
                  :main-content (om/build build-com/build
                                          {:app app
-                                          :ssh-available? (ssh-available? (get-in app (get-in app state/project-path)))})
+                                          :ssh-available? (ssh-available? (get-in app (get-in app state/project-path))
+                                                                          (get-in app (get-in app state/build-path)))})
                  :header-actions (om/build header-actions app)}))))


mouse/clicks

mouse/clicks

--- src/cljx/jamesmacaulay/zelkova/mouse.cljx
+++ src/cljx/jamesmacaulay/zelkova/mouse.cljx
@@ -16,7 +16,7 @@
     out))

 #+cljs
-(defn- position-channel
+(defn position-channel
   [graph opts]
   (let [dom-events (listen js/document "mousemove")
         xform (comp (map (fn [e] [(.-offsetX e) (.-offsetY e)]))
@@ -27,3 +27,14 @@
 (def position (assoc (z/input [0 0] ::position)
                 :event-sources {::position position-channel}))

+#+cljs
+(defn clicks-channel
+  [graph opts]
+  (let [dom-events (listen js/document "click")
+        xform (comp (map (constantly :click))
+                    (map (partial z/->Event ::clicks)))]
+    (async/pipe dom-events (async/chan 1 xform))))
+
+#+cljs
+(def clicks (assoc (z/input [0 0] ::clicks)
+              :event-sources {::clicks clicks-channel}))


Added environ to manage db config

Added environ to manage db config

--- src/hackerati_interval_web_app/schema.clj
+++ src/hackerati_interval_web_app/schema.clj
@@ -1,15 +1,16 @@
 (ns hackerati-interval-web-app.schema
-  (:require [hackerati-interval-web-app.scrape :as scrape]
+  (:require [environ.core :refer [env]]
+            [hackerati-interval-web-app.scrape :as scrape]
             [korma.db :refer :all]
             [korma.core :refer :all]
             [crypto.password.bcrypt :as password]))

 ;;;;;;;;;;;;;;;;;;;; DEFINITIONS ;;;;;;;;;;;;;;;;;;;;

-(defdb db (mysql {:host "127.0.0.1"
-                  :db "hackerati"
-                  :user "project"
-                  :password "project"}))
+(defdb db (mysql {:host (env :db-host)
+                  :db (env :db-name)
+                  :user (env :db-user)
+                  :password (env :db-password)}))

 (declare user tracked-links products productid url prices dates)


Mihir | Setting localized lookup to false;

--- src/aggregatequeryservice/rendertemplates.clj
+++ src/aggregatequeryservice/rendertemplates.clj
@@ -31,5 +31,6 @@
                       (doto (new FileTemplateLoader (new File template-base-dir))))
         multi-template-loader (doto (new MultiTemplateLoader (into-array TemplateLoader [class-loader file-loader])))
         ftl-config (doto (ftl/gen-config :shared extra-params-map)
+                    (.setLocalizedLookup false)
                      (.setTemplateLoader multi-template-loader))]
     (pmap (partial render-template ftl-config query-results) template-list)))