Name fns

Name fns

--- src/cljc/robinson/render.cljc
+++ src/cljc/robinson/render.cljc
@@ -581,10 +581,10 @@
         cell-items       (or (cell :items) [])
         hotkeys          (-> state :world :remaining-hotkeys)
         selected-hotkeys (-> state :world :selected-hotkeys)
-        items            (fill-missing #(not (contains? % :hotkey))
-                                            #(assoc %1 :hotkey %2)
-                                            hotkeys
-                                            cell-items)]
+        items            (fill-missing (fn missing [item] (not (contains? item :hotkey)))
+                                       (fn apply-hotkey [item hotkey] (assoc item :hotkey hotkey))
+                                       hotkeys
+                                       cell-items)]
   (log/debug "player-x" player-x "player-y" player-y)
   (log/debug "cell" cell)
   (log/debug "cell-items" cell-items)


more reproducible dirty read test

more reproducible dirty read test

--- src/jepsen/voltdb/dirty_read.clj
+++ src/jepsen/voltdb/dirty_read.clj
@@ -16,6 +16,7 @@
                     [independent  :as independent]
                     [nemesis      :as nemesis]
                     [net          :as net]
+                    [util         :as util]
                     [tests        :as tests]]
             [jepsen.os.debian     :as debian]
             [jepsen.voltdb        :as voltdb]
@@ -92,22 +93,24 @@
             reads (->> ok
                        (filter #(= :read (:f %)))
                        (map :value)
-                       (reduce conj #{}))
+                       (into (sorted-set)))
             strong-read-sets (->> ok
                                   (filter #(= :strong-read (:f %)))
                                   (map :value))
             strong-reads (reduce set/union strong-read-sets)
-            missing     (set/difference reads strong-reads)]
-        ; We expect at least one strong read
+            unseen       (set/difference strong-reads reads)
+            missing      (set/difference reads strong-reads)]
+        ; We expect one strong read per node
         (info :strong-read-sets (count strong-read-sets))
         (info :concurrency (:concurrency test))
-        (assert (pos? (count strong-read-sets)))
+        (assert (= (count strong-read-sets) (:concurrency test)))
         ; All strong reads had darn well better be equal
         (assert (apply = (map count (cons strong-reads strong-read-sets))))

         {:valid?            (empty? missing)
          :read-count        (count reads)
          :strong-read-count (count strong-reads)
+         :unseen-count      (count unseen)
          :missing-count     (count missing)
          :missing           missing}))))

@@ -174,6 +177,7 @@
          :concurrency 10
          :generator (gen/phases
                       (->> (rw-gen)
+                           (gen/stagger 1/100)
                            (gen/nemesis
                              (gen/seq (cycle [(gen/sleep 1)
                                               {:type :info :f :start}


Added number of steps to om slider control

--- src/cljs/my_project/core.cljs
+++ src/cljs/my_project/core.cljs
@@ -348,9 +348,11 @@

 ;; =============================================================================
 ;; {{{ Some stuff for the game view
-(defn slider [view owner {:keys [e-range e-key e-label e-func]}]
+(defn slider [view owner {:keys [e-range e-key e-label e-func e-steps]}]
   (let [[min max] e-range
-        e-label (or e-label "NO LABEL!")]
+        e-label (or e-label "NO LABEL!")
+        e-steps (or e-steps 30)
+        ]
     (reify
       om/IInitState
       (init-state [_]
@@ -376,6 +378,7 @@
                     :style {:width "100px"}
                     :value value
                     :min min :max max
+                    :step (/ (- max min) e-steps )
                     :on-change #(put! ch (js/parseFloat (.. % -target -value)))}]
            [:span value]])))))
 ;; }}}
@@ -421,11 +424,13 @@
 (defmethod handle-message! :set-scale [_ scale]  (scale-swap! (constantly scale)))
 (defmethod handle-message! :set-time-speed [_ time-speed]  (swap! game-view assoc :time-speed time-speed ))

-(defn om-slider [ label data kork range func]
+(defn om-slider [ label data kork range steps func]
   (om/build slider data {:opts {:e-range range
                                 :e-key kork
                                 :e-label label
-                                :e-func func}} ))
+                                :e-func func
+                                :e-steps steps
+                                }} ))

 (defn game-component [data owner]
@@ -447,8 +452,8 @@

         (html
           [:div
-                (om-slider "scale" game-view :scale [1 10] #(msg! :set-scale %))
-                (om-slider "time" game-view :time-speed [0 5] #(msg! :set-time-speed %))
+                (om-slider "scale" game-view :scale [1 10] 1000 #(msg! :set-scale %))
+                (om-slider "time" game-view :time-speed [0 5] 100 #(msg! :set-time-speed %))

            [:p (str "ROGUEBOW ISLANDS : " msecs " " fps)] ])))))


Link to leiningen

Link to leiningen

--- src/clojars/web/dashboard.clj
+++ src/clojars/web/dashboard.clj
@@ -31,7 +31,8 @@
     [:article.row
      (helpers/select-text-script)
      [:div.push-information.col-md-4.col-lg-4.col-sm-4.col-xs-12
-      [:h3.push-header "Push with Leiningen"]
+      [:h3.push-header "Push with "
+       (link-to "http://leiningen.org/" "Leiningen")]
       [:div#leiningen.push-example {:onClick "selectText('leiningen');"}
        [:pre.push-example-leiningen
         (tag "$") " lein deploy clojars\n"]]]


change import style

change import style

--- src/clojure/defgraph/core.clj
+++ src/clojure/defgraph/core.clj
@@ -1,10 +1,10 @@
 (ns defgraph.core
   (:gen-class)
-  (:import com.mxgraph.layout.mxOrganicLayout
-           com.mxgraph.util.mxPoint
-           com.mxgraph.view.mxGraph
-           javax.swing.JFrame
-           com.mxgraph.swing.mxGraphComponent))
+  (:import [com.mxgraph.layout mxOrganicLayout]
+           [com.mxgraph.swing mxGraphComponent]
+           [com.mxgraph.util mxPoint]
+           [com.mxgraph.view mxGraph]
+           [javax.swing JFrame]))

 (def defs     (filter #(.isFile %) (.listFiles (java.io.File. "defs/runs"))))
 (def vertices (map #(.getName %) defs))
@@ -30,7 +30,7 @@
       (.setEdgeCrossingCostFactor 6000)
       (.setMaxIterations 1000)
       (.execute root)))
-    (.endUpdate model))
+  (.endUpdate model))

 (defn -main [& args]
   (if (> (count args) 1)


Reformat.

Reformat.

--- src/clojush/pushgp/pushgp.clj
+++ src/clojush/pushgp/pushgp.clj
@@ -62,10 +62,13 @@
   (let [random-seeds (loop [seeds '()]
                        (let [num-remaining (- population-size (count seeds))]
                          (if (pos? num-remaining)
-                           (let [new-seeds (repeatedly num-remaining #(random/lrand-bytes (:mersennetwister random/*seed-length*)))]
-                             (recur (concat seeds (filter (fn [candidate]
-                                                            (not (some #(random/=byte-array % candidate)
-                                                                       seeds))) new-seeds)))); only add seeds that we do not already have
+                           (let [new-seeds (repeatedly num-remaining
+                                                       #(random/lrand-bytes
+                                                          (:mersennetwister random/*seed-length*)))]
+                             (recur (concat seeds (filter ; only add seeds that we do not already have
+                                                    (fn [candidate]
+                                                      (not (some #(random/=byte-array % candidate)
+                                                                 seeds))) new-seeds))))
                            seeds)))]
     {:random-seeds random-seeds
      :rand-gens (vec (doall (for [k (range population-size)]
@@ -178,12 +181,20 @@
                                                              generation @push-argmap)]
             (cond (= outcome :failure) (do (printf "\nFAILURE\n")
                                          (if (:return-simplified-on-failure @push-argmap)
-                                           (auto-simplify best (:error-function @push-argmap) (:final-report-simplifications @push-argmap) true 500)
+                                           (auto-simplify best
+                                                          (:error-function @push-argmap)
+                                                          (:final-report-simplifications @push-argmap)
+                                                          true
+                                                          500)
                                            (flush)))
                   (= outcome :continue) (do (timer @push-argmap :report)
                                           (println "\nProducing offspring...") (flush)
-                                          (produce-new-offspring pop-agents child-agents rand-gens @push-argmap)
+                                          (produce-new-offspring pop-agents
+                                                                 child-agents
+                                                                 rand-gens
+                                                                 @push-argmap)
                                           (println "Installing next generation...") (flush)
                                           (install-next-generation pop-agents child-agents @push-argmap)
                                           (recur (inc generation)))
                   :else  (final-report generation best @push-argmap))))))))
+


Fix some issues in rendering groups in view app.

--- src/uxbox/view/ui/viewer/shapes.cljs
+++ src/uxbox/view/ui/viewer/shapes.cljs
@@ -59,15 +59,17 @@

 ;; --- Shapes

+(declare shape)
+
 (mx/defc shape*
-  [{:keys [type] :as shape}]
+  [{:keys [type] :as item}]
   (case type
-    :group (group-shape shape #(interactions-wrapper % shape*))
-    :text (text-shape shape)
-    :icon (icon-shape shape)
-    :rect (rect-shape shape)
-    :path (path-shape shape)
-    :circle (circle-shape shape)))
+    :group (group-shape item shape)
+    :text (text-shape item)
+    :icon (icon-shape item)
+    :rect (rect-shape item)
+    :path (path-shape item)
+    :circle (circle-shape item)))

 (mx/defc shape
   [sid]


Implement assert-cors-header to test_helper

--- test/clojars/test/test_helper.clj
+++ test/clojars/test/test_helper.clj
@@ -108,3 +108,8 @@

 (defn get-content-type [resp]
   (some-> resp :headers (get "content-type") (string/split #";") first))
+
+(defn assert-cors-header [resp]
+  (some-> resp :headers
+          (get "access-control-allow-origin")
+          (= "*")))


killing cluster shutdowns nimbus

killing cluster shutdowns nimbus

--- storm-multicore/src/clj/backtype/storm/testing.clj
+++ storm-multicore/src/clj/backtype/storm/testing.clj
@@ -184,8 +184,8 @@

 (defn kill-local-storm-cluster [cluster-map]
-  )
-;  (.shutdown (:nimbus cluster-map))
+  ;; TODO: kill worker and executors as well
+  (.shutdown (:nimbus cluster-map)))
 ;  (.close (:state cluster-map))
 ;  (.disconnect (:storm-cluster-state cluster-map))
 ;  (doseq [s @(:supervisors cluster-map)]


Removed note about inconsistency

Removed note about inconsistency

--- test/forma/trends/stretch_test.clj
+++ test/forma/trends/stretch_test.clj
@@ -70,11 +70,6 @@
    Here, our timeseries values are repeated in a given year, as
    described in `mk-ts`.

-   The number of periods for 16- and 8-day timeseries should be given
-   by the number of directories in
-   ftp://e4ftl01p.cr.usgs.gov/MOLT/MOD13A1.005 for the range of
-   interest, but there appears to be some inconsistency ...
-
    For reference:
      Period 360 is 2000-01-01 at monthly resolution
      Period 736 is 2000-01-01 at 16-day resolution


Just dying seems to cause issues

Just dying seems to cause issues

--- src/main/clojure/oxcart/core.clj
+++ src/main/clojure/oxcart/core.clj
@@ -299,4 +299,4 @@
     (compile (s/replace namespace #"\." "/")
              {:emitter emit
               :settings {:emitter {:entry entry}}}))
-  (System/exit 0))
+  nil)


[#2309] Don't log error that only is not authorized requests

--- backend/src/akvo/lumen/component/keycloak.clj
+++ backend/src/akvo/lumen/component/keycloak.clj
@@ -111,7 +111,11 @@
                                        admins))]
       (contains? (set admin-ids) user-id))
     (catch clojure.lang.ExceptionInfo e
-      (log/error e "Error determine if user was tenant admin, missing Keycloak groups?")
+      (when (not (= 404
+                    (-> e ex-data :status)))
+        (log/error ::tenant-admin? "Error determine if user was tenant admin, missing Keycloak groups?"
+                   {:tenant tenant
+                    :user-id user-id}))
       false)))

 (defn fetch-user-by-id


add some tests for the update logic of resources

--- test/leiningen/namespaces_test.clj
+++ test/leiningen/namespaces_test.clj
@@ -15,6 +15,18 @@
   (is (= ["../project/testfolder1/de/otto/one/cool/ns_test.clj"
           "../project/testfolder2/de/otto/one/cool/ns_test.clj"]
          (ns/namespace->target-path "de.otto.one.cool.ns-test" "project" read-fn))))
+
+(deftest ^:unit resource->target-path-test
+  (is (= ["../target-project/folder1/resource.edn"
+          "../target-project/folder2/resource.edn"]
+         (ns/resource->target-path "resource.edn"
+                                   "target-project"
+                                   (fn [_] {:resource-paths ["folder1" "folder2"]})))))
+
+(deftest ^:unit resource->source-path-test
+  (is (= ["folder1/resource.edn"
+          "folder2/resource.edn"]
+         (ns/resource->source-path "resource.edn" {:resource-paths ["folder1" "folder2"]}))))

 (def project-clj {:source-paths ["folder1" "folder2"]
                   :test-paths   ["testfolder1" "testfolder2"]})


Added advert notice

Added advert notice

--- test/midje_doc/midje_doc_guide.clj
+++ test/midje_doc/midje_doc_guide.clj
@@ -19,7 +19,7 @@
 > git clone https://github.com/zcaudate/lein-midje-doc.git
 > cd lein-midje-doc
 > lein midje-doc once
-> open ./midje-doc-guide.html
+> open ./index.html
 "]]

 [[:section {:title "Installation"}]]


Fixed missing argument to make-repl call

--- src/de/kotka/gorilla/repl.clj
+++ src/de/kotka/gorilla/repl.clj
@@ -110,7 +110,7 @@
                          (throw (Exception. (str "No Repl of that id: " id))))
                        (alter *repls* dissoc id)
                        the-repl))
-                   (make-repl))
+                   (make-repl -1))
         line     (if (= line 0)
                    (the-repl :line)
                    line)]


compression codecs and cleanup

compression codecs and cleanup

--- src/flambo/parquet/thrift.clj
+++ src/flambo/parquet/thrift.clj
@@ -8,12 +8,35 @@
            [org.apache.hadoop.mapreduce Job]
            [org.apache.hadoop.io NullWritable]))

+(def COMPRESSION-CODEC {:uncompressed CompressionCodeName/UNCOMPRESSED
+                        :gzip CompressionCodecName/GZIP
+                        :snappy CompressionCodecName/SNAPPY
+                        :lzo CompressionCodeName/LZO
+                        })
+
 ;; # InputFormat configuration
-(defn unbound-record-filter! [job filter-klass]
+;;
+(defn unbound-record-filter! [job filter-sym]
   (doto job
-    (ParquetThriftInputFormat/setUnboundRecordFilter (Class/forName filter-klass))))
+    (ParquetThriftInputFormat/setUnboundRecordFilter (Class/forName filter-sym))))
+
+(defn parquet-thrift-file
+  "Create an RDD from a directory of parquet-thrift files
+  where `klass` is the thrift class used to create the parquet files."
+  [spark-context path klass & {:keys [job record-filter-class]
+                               :or {job (Job.)}}]
+  (let [job (when record-filter
+              (unbound-record-filter! job record-filter-class))
+        conf (.getConfiguration job)]
+    (.newAPIHadoopFile spark-context
+                       path
+                       ParquetThriftInputFormat
+                       NullWritable
+                       klass
+                       conf)))

 ;; # OutputFormat configuration
+;;
 (defn thrift-class! [job klass]
   (doto job
     (ParquetThriftOutputFormat/setThriftClass klass)))
@@ -26,26 +49,15 @@
   (doto conf
     (.set ThriftReadSupport/THRIFT_COLUMN_FILTER_KEY filter)))

-(defn parquet-thrift-file
-  "Create an RDD from a directory of parquet-thrift files
-  where `klass` is the thrift class used to create the parquet files.
-
-  Accepts an optional :conf keyword argument for a hadoop configuration object."
-  [spark-context path klass & {:keys [job filter-klass]
-                               :or {job (Job.)}}]
-  (let [job (when filter-klass
-              (set-unbound-record-filter job filter-klass))
-        conf (.getConfiguration job)]
-    (.newAPIHadoopFile spark-context
-                       path
-                       ParquetThriftInputFormat
-                       NullWritable
-                       klass
-                       conf)))
-
-(defn save-as-parquet-thrift-file [rdd path klass & {:keys [job]
+(defn save-as-parquet-thrift-file [rdd path klass & {:keys [job compression-codec filter]
                                                      :or {job (Job.)}}]
-  (let [conf (.getConfiguration job)]
+  (let [job (thrift-class! job klass)
+        job (if compression-codec
+              (compression! job (get COMPRESSION-CODEC compression-codec :uncompressed))
+              job)
+        conf (if filter
+               (-> (.getConfiguration job) (column-filter! filter))
+               (.getConfiguration job))]
     (.saveAsNewAPIHadoopFile rdd
                              path
                              Void


repos with disabled issues don't get issue-related stats

--- src/github_authors/github.clj
+++ src/github_authors/github.clj
@@ -42,7 +42,8 @@
   (vec (filter seq s)))

 (defn fetch-issues [user repo state]
-  (filter-bug (github-api-call issues/issues user repo (assoc (gh-auth) :state state :all-pages true))))
+  (let [ret (filter-bug (github-api-call issues/issues user repo (assoc (gh-auth) :state state :all-pages true)))]
+    (if (= ret [[:message "Issues are disabled for this repo"]]) [] ret)))

 (defn fetch-repos
   "Fetch all public repositories for a user"
@@ -53,8 +54,7 @@
   (if (zero? denom) 0 (/ num (Float. (str denom)))))

 (defn ->repo [open closed repo]
-  (let [open (if (= (open [[:message "Issues are disabled for this repo"]])) [] open)
-        all-issues (into open closed)
+  (let [all-issues (into open closed)
         total (count all-issues)]
     {:full-name (:full_name repo)
      :resolved (format "%s/%s" (count closed) total)


Fix insert-cursor-test

Fix insert-cursor-test

--- test/asciinema_player/view_test.cljs
+++ test/asciinema_player/view_test.cljs
@@ -45,13 +45,13 @@
   (is (= (v/remaining-time 133.95 134) "-00:00")))

 (deftest insert-cursor-test
-  (is (= (v/insert-cursor [["foo" {:foo true}] ["bar" {:bar true}]] 0) [["f" {:foo true :cursor true :inverse true}] ["oo" {:foo true}] ["bar" {:bar true}]]))
-  (is (= (v/insert-cursor [["foo" {:foo true}] ["bar" {:bar true}]] 1) [["f" {:foo true}] ["o" {:foo true :cursor true :inverse true}] ["o" {:foo true}] ["bar" {:bar true}]]))
-  (is (= (v/insert-cursor [["foo" {:foo true}] ["bar" {:bar true}]] 2) [["fo" {:foo true}] ["o" {:foo true :cursor true :inverse true}] ["bar" {:bar true}]]))
-  (is (= (v/insert-cursor [["foo" {:foo true}] ["bar" {:bar true}]] 5) [["foo" {:foo true}] ["ba" {:bar true}] ["r" {:bar true :cursor true :inverse true}]]))
-  (is (= (v/insert-cursor [["f" {:foo true}] ["bar" {:bar true}]] 0) [["f" {:foo true :cursor true :inverse true}] ["bar" {:bar true}]]))
-  (is (= (v/insert-cursor [["foo" {:foo true}] ["b" {:bar true}]] 3) [["foo" {:foo true}] ["b" {:bar true :cursor true :inverse true}]]))
-  (is (= (v/insert-cursor [["foo" {:foo true}] ["b" {:bar true}] ["qux" {:qux true}]] 3) [["foo" {:foo true}] ["b" {:bar true :cursor true :inverse true}] ["qux" {:qux true}]]))
+  (is (= (v/insert-cursor [["foo" {:foo true}] ["bar" {:bar true}]] 0) [["f" {:foo true :cursor true}] ["oo" {:foo true}] ["bar" {:bar true}]]))
+  (is (= (v/insert-cursor [["foo" {:foo true}] ["bar" {:bar true}]] 1) [["f" {:foo true}] ["o" {:foo true :cursor true}] ["o" {:foo true}] ["bar" {:bar true}]]))
+  (is (= (v/insert-cursor [["foo" {:foo true}] ["bar" {:bar true}]] 2) [["fo" {:foo true}] ["o" {:foo true :cursor true}] ["bar" {:bar true}]]))
+  (is (= (v/insert-cursor [["foo" {:foo true}] ["bar" {:bar true}]] 5) [["foo" {:foo true}] ["ba" {:bar true}] ["r" {:bar true :cursor true}]]))
+  (is (= (v/insert-cursor [["f" {:foo true}] ["bar" {:bar true}]] 0) [["f" {:foo true :cursor true}] ["bar" {:bar true}]]))
+  (is (= (v/insert-cursor [["foo" {:foo true}] ["b" {:bar true}]] 3) [["foo" {:foo true}] ["b" {:bar true :cursor true}]]))
+  (is (= (v/insert-cursor [["foo" {:foo true}] ["b" {:bar true}] ["qux" {:qux true}]] 3) [["foo" {:foo true}] ["b" {:bar true :cursor true}] ["qux" {:qux true}]]))
   (is (= (v/insert-cursor [["foo" {:foo true}] ["bar" {:bar true}] ["baz" {:baz true}]] 9) [["foo" {:foo true}] ["bar" {:bar true}] ["baz" {:baz true}]]))
   (is (= (v/insert-cursor [["foo" {:foo true}] ["bar" {:bar true}] ["baz" {:baz true}]] 10) [["foo" {:foo true}] ["bar" {:bar true}] ["baz" {:baz true}]]))
   (is (= (v/insert-cursor [] 0) []))


Use constantly to stub functions

Use constantly to stub functions

--- test/memoria/handlers/cards_test.clj
+++ test/memoria/handlers/cards_test.clj
@@ -8,7 +8,7 @@
 (def a-card {:id 123 :title "A Card" :contents "The contents"})

 (deftest listing-cards
-  (with-redefs [cards/all (fn [] [a-card])]
+  (with-redefs [cards/all (constantly [a-card])]
     (let [response (cards-handler/cards-routes (mock/request :get "/cards"))]
       (testing "Responds with 200"
         (is (= (:status response) 200)))
@@ -20,7 +20,7 @@
         (is (= (get-in response [:headers "Content-Type"]) "application/json"))))))

 (deftest getting-a-card
-  (with-redefs [cards/find-by-id (fn [id] a-card)]
+  (with-redefs [cards/find-by-id (constantly a-card)]
     (let [response (cards-handler/cards-routes (mock/request :get (str "/cards/" (:id a-card))))]
       (testing "Responds with 200"
         (is (= (:status response) 200)))
@@ -32,7 +32,7 @@
         (is (= (get-in response [:headers "Content-Type"]) "application/json"))))))

 (deftest getting-a-not-found-card
-  (with-redefs [cards/find-by-id (fn [id] nil)]
+  (with-redefs [cards/find-by-id (constantly nil)]
     (let [response (cards-handler/cards-routes (mock/request :get "/cards/123"))]
       (testing "Responds with 404"
         (is (= (:status response) 404)))
@@ -41,7 +41,7 @@
         (is (= (get-in response [:body :message]) "Could not find a card with id 123"))))))

 (deftest inserting-a-card
-  (with-redefs [cards/insert (fn [attrs] a-card)]
+  (with-redefs [cards/insert (constantly a-card)]
     (let [attrs (select-keys a-card [:title :contents])
           response (cards-handler/cards-routes (mock/request :post "/cards" attrs))]
       (testing "Responds with 200"
@@ -54,7 +54,7 @@
         (is (= (get-in response [:headers "Content-Type"]) "application/json"))))))

 (deftest inserting-a-card-with-invalid-attributes
-  (with-redefs [cards/insert (fn [attrs] (assoc a-card :errors {:title "Can't be blank."}))]
+  (with-redefs [cards/insert (constantly (assoc a-card :errors {:title "Can't be blank."}))]
     (let [attrs {}
           response (cards-handler/cards-routes (mock/request :post "/cards" attrs))]
       (testing "Responds with 400"


Can't assume indices are returned in a consistent order (#102)

--- test/taoensso/faraday/tests/main.clj
+++ test/taoensso/faraday/tests/main.clj
@@ -1035,11 +1035,11 @@
                                            :throughput  {:read 4 :write 2}
                                            }})
    ;; We need to wait until the index is created before updating it, or the call will fail
-   _       @(index-status-watch *client-opts* temp-table :gsindexes "genre-index")
+   _ @(index-status-watch *client-opts* temp-table :gsindexes "genre-index")
    inc-idx @(far/update-table *client-opts* temp-table
-                              {:gsindexes {:operation   :update
-                                           :name        "genre-index"
-                                           :throughput  {:read 6 :write 6}
+                              {:gsindexes {:operation  :update
+                                           :name       "genre-index"
+                                           :throughput {:read 6 :write 6}
                                            }})
    ;; We can create a second index right after
    amt-idx @(far/update-table *client-opts* temp-table
@@ -1051,12 +1051,12 @@
    ;; Let's wait until amount-index is created before deleting genre-index,
    ;; so that we can consistently evaluate the result (otherwise we might not
    ;; know if size/item-count are 0 or nil.
-   _       @(index-status-watch *client-opts* temp-table :gsindexes "amount-index")
+   _ @(index-status-watch *client-opts* temp-table :gsindexes "amount-index")
    del-idx @(far/update-table *client-opts* temp-table
-                              {:gsindexes {:operation   :delete
-                                           :name        "genre-index"
+                              {:gsindexes {:operation :delete
+                                           :name      "genre-index"
                                            }})
-   _       @(index-status-watch *client-opts* temp-table :gsindexes "genre-index")
+   _ @(index-status-watch *client-opts* temp-table :gsindexes "genre-index")
    ;; And get the final state
    fin-idx (far/describe-table *client-opts* temp-table)
    ]
@@ -1082,34 +1082,33 @@
             :throughput {:read 6 :write 6 :last-decrease nil :last-increase nil :num-decreases-today nil}}]
           (:gsindexes inc-idx))
   ;; The second index created comes back without a size or item count
-  (expect [{:name       :amount-index
-            :size       nil
-            :item-count nil
-            :key-schema [{:name :amount :type :hash}]
-            :projection {:projection-type "ALL" :non-key-attributes nil}
-            :throughput {:read 1 :write 1 :last-decrease nil :last-increase nil :num-decreases-today nil}}
-           {:name       :genre-index
-            :size       0
-            :item-count 0
-            :key-schema [{:name :genre :type :hash}]
-            :projection {:projection-type "ALL" :non-key-attributes nil}
-            :throughput {:read 6 :write 6 :last-decrease nil :last-increase nil :num-decreases-today nil}}]
-          (:gsindexes amt-idx))
+  (expect #{{:name       :amount-index
+             :size       nil
+             :item-count nil
+             :key-schema [{:name :amount :type :hash}]
+             :projection {:projection-type "ALL" :non-key-attributes nil}
+             :throughput {:read 1 :write 1 :last-decrease nil :last-increase nil :num-decreases-today nil}}
+            {:name       :genre-index
+             :size       0
+             :item-count 0
+             :key-schema [{:name :genre :type :hash}]
+             :projection {:projection-type "ALL" :non-key-attributes nil}
+             :throughput {:read 6 :write 6 :last-decrease nil :last-increase nil :num-decreases-today nil}}}
+          (set (:gsindexes amt-idx)))
   ;; When we request that the genre index be deleted, it returns that it's being destroyed
-  (expect [{:name       :amount-index
-            :size       0
-            :item-count 0
-            :key-schema [{:name :amount :type :hash}]
-            :projection {:projection-type "ALL" :non-key-attributes nil}
-            :throughput {:read 1 :write 1 :last-decrease nil :last-increase nil :num-decreases-today nil}}
-           {:name       :genre-index
-            :size       nil
-            :item-count nil
-            :key-schema [{:name :genre :type :hash}]
-            :projection {:projection-type "ALL" :non-key-attributes nil}
-            :throughput {:read 6 :write 6 :last-decrease nil :last-increase nil :num-decreases-today nil}}
-           ]
-          (:gsindexes del-idx))
+  (expect #{{:name       :amount-index
+             :size       0
+             :item-count 0
+             :key-schema [{:name :amount :type :hash}]
+             :projection {:projection-type "ALL" :non-key-attributes nil}
+             :throughput {:read 1 :write 1 :last-decrease nil :last-increase nil :num-decreases-today nil}}
+            {:name       :genre-index
+             :size       nil
+             :item-count nil
+             :key-schema [{:name :genre :type :hash}]
+             :projection {:projection-type "ALL" :non-key-attributes nil}
+             :throughput {:read 6 :write 6 :last-decrease nil :last-increase nil :num-decreases-today nil}}}
+          (set (:gsindexes del-idx)))
   ;; And finally, we were left only with the amount index
   (expect [{:name       :amount-index
             :size       0


clojure (pgraph-morphisms): reverted "optimization" of the distances function

--- clojure/org/gavrog/clojure/pgraph_morphisms.clj
+++ clojure/org/gavrog/clojure/pgraph_morphisms.clj
@@ -22,24 +22,16 @@

 (defn distances [net]
   "Pair-wise distances between vertices using the Floyd-Warshall algorithm"
-  (let [nodes (vec (iterator-seq (.nodes net)))
+  (let [nodes (iterator-seq (.nodes net))
         edges (iterator-seq (.edges net))
         n (count nodes)
-        idx (into {} (for [i (range n)] [(nth nodes i) i]))
-        dist (make-array Long/TYPE n n)]
-    (dotimes [i n]
-      (dotimes [j n]
-        (aset dist i j (if (= i j) 0 n))))
-    (doseq [e edges, e* [e (.reverse e)]]
-      (aset dist (idx (.source e*)) (idx (.target e*)) 1))
-    (dotimes [i n]
-      (dotimes [j n]
-        (dotimes [k n]
-          (aset dist j k (min (aget dist j k)
-                              (+ (aget dist j i) (aget dist i k)))))))
-    (into {}
-          (for [u nodes, v nodes]
-            [[u v] (aget dist (idx u) (idx v))]))))
+        dist (into {} (for [v nodes, w nodes] [[v w] (if (= v w) 0 n)]))
+        dist (into dist (for [e edges, e* [e (.reverse e)]]
+                          [[(.source e*) (.target e*)] 1]))]
+    (reduce (fn [d [u v w]]
+              (assoc d [v w] (min (d [v w]) (+ (d [v u]) (d [u w])))))
+            dist
+            (for [u nodes, v nodes, w nodes] [u v w]))))

 (defn diameter [net]
   (apply max (vals (distances net))))


Update project.clj

Update project.clj

--- luminus/hello/project.clj
+++ luminus/hello/project.clj
@@ -3,13 +3,13 @@
   "luminus"
   :dependencies
   [[org.clojure/clojure "1.5.1"]
-   [lib-noir "0.7.9"]
+   [lib-noir "0.8.2"]
    [compojure "1.1.6"]
    [ring-server "0.3.1"]
    [selmer "0.5.7"]
    [com.taoensso/timbre "2.7.1"]
    [com.postspectacular/rotor "0.1.0"]
-   [com.taoensso/tower "1.5.1"]
+   [com.taoensso/tower "2.0.2"]
    [mysql/mysql-connector-java "5.1.28"]
    [korma "0.3.0-RC5"]
    [log4j
@@ -24,11 +24,12 @@
    :init hello.handler/init,
    :destroy hello.handler/destroy}
   :profiles
-  {:production
+  {:uberjar {:aot :all}
+   :production
    {:ring
     {:open-browser? false, :stacktraces? false, :auto-reload? false}},
    :dev
-   {:dependencies [[ring-mock "0.1.5"] [ring/ring-devel "1.2.1"]]}}
+   {:dependencies [[ring-mock "0.1.5"] [ring/ring-devel "1.2.2"]]}}
   :url
   "http://example.com/FIXME"
   :plugins


Support CLJS in oolong by making brew-file CLJ only

--- src/irresponsible/oolong.cljc
+++ src/irresponsible/oolong.cljc
@@ -1,7 +1,7 @@
 (ns irresponsible.oolong
   (:require [com.stuartsierra.component :as cpt]
-            [clojure.tools.reader.edn :as edn]
-            [clojure.tools.reader.reader-types :as rt]
+            #?@(:clj [[clojure.tools.reader.edn :as edn]
+                      [clojure.tools.reader.reader-types :as rt]])
             [irresponsible.oolong.util :refer [simple-system]]))

 ;; oolong is a simple config-based loader for stuartsierra's brilliant
@@ -26,20 +26,21 @@

 (def ^:deprecated brew-master brew)       ; backcompat

-(defn brew-file
-  "Given a configuration file path, reads the file as edn and brews the
-   described system descriptor under the `:app` key using the entire
-   file as configuration.
-   Args: [filename]
-     - filename: a filename naming a file of edn which must take the form
-                 of a map. The `:app` key in the map should point to a valid
-                 RSD. The entire map will be used as configuration
-   Returns: new system with any dependencies resolved
-   Throws: if file does not exist, is invalid edn or is invalid oolong."
-  [filename]
-  (-> filename slurp rt/indexing-push-back-reader edn/read brew))
-
-(def ^:deprecated brew-master-file brew-file)
+#?(:clj
+ (defn brew-file
+   "Given a configuration file path, reads the file as edn and brews the
+    described system descriptor under the `:app` key using the entire
+    file as configuration.
+    Args: [filename]
+      - filename: a filename naming a file of edn which must take the form
+                  of a map. The `:app` key in the map should point to a valid
+                  RSD. The entire map will be used as configuration
+    Returns: new system with any dependencies resolved
+    Throws: if file does not exist, is invalid edn or is invalid oolong."
+   [filename]
+   (-> filename slurp rt/indexing-push-back-reader edn/read brew)))
+#?(:clj
+ (def ^:deprecated brew-master-file brew-file))

 ;; For convenience, we alias a few things from `component`


fix js-await catch

fix js-await catch

fixes #1030

--- src/main/shadow/cljs/modern.cljc
+++ src/main/shadow/cljs/modern.cljc
@@ -321,7 +321,7 @@
          ~@(when (seq body)
              [`(.then (fn [~name] ~@body))])
          ~@(when catch
-             (let [[name & body] catch]
+             (let [[_ name & body] catch]
                [`(.catch (fn [~name] ~@body))]
                )))))


RS & AB | 15 | Remove unnecessary require from user test

--- test/stonecutter/test/db/user.clj
+++ test/stonecutter/test/db/user.clj
@@ -1,7 +1,6 @@
 (ns stonecutter.test.db.user
   (:require [midje.sweet :refer :all]
             [clauth.user :as cl-user]
-            [clauth.client :as cl-client]
             [clauth.auth-code :as cl-auth-code]
             [stonecutter.db.client :as client]
             [stonecutter.db.storage :as s]


Percussive envelopes can be stated in terms of ADSR.

--- src/klangmeister/instruments.cljs
+++ src/klangmeister/instruments.cljs
@@ -6,15 +6,6 @@
   (fn [at context]
     (doto (.createGain context)
       (-> .-gain (.setValueAtTime peak at)))))
-
-(defn percuss [attack decay]
-  (fn [at context]
-    (let [node (.createGain context)]
-      (doto (.-gain node)
-        (.setValueAtTime 0 at)
-        (.linearRampToValueAtTime 1.0 (+ at attack))
-        (.linearRampToValueAtTime 0 (+ at attack decay)))
-      node)))

 (defn adshr [attack decay sustain hold release]
   (fn [at context]
@@ -26,6 +17,9 @@
         (.setValueAtTime sustain (+ at attack decay hold))
         (.linearRampToValueAtTime 0 (+ at attack decay hold release)) )
       node)))
+
+(defn percuss [attack decay]
+  (adshr attack decay 0 0 0))

 (defn ashr [attack hold release]
   (adshr attack 0 1 hold release))


Tinker with teststring.

Tinker with teststring.

--- src/kolmogorov_music/talk.clj
+++ src/kolmogorov_music/talk.clj
@@ -114,7 +114,8 @@
 (defn clapping-music []
   (let [african-bell-pattern (rhythm [1/8 1/8 1/4 1/8 1/4 1/4 1/8 1/4])]
     (->> african-bell-pattern forever (all :part :clap1)
-         (canon #(->> % (take 64) (then (rhythm [1/8])) forever (all :part :clap2))))))
+         (canon
+           #(->> % (take 64) (then (rhythm [1/8])) forever (all :part :clap2))))))

 (comment
   (live/play (clapping-music))
@@ -145,7 +146,7 @@
   (->> (library-of-babel) (take 5)) => ["" " " "!" "\"" "#"]
   (nth (library-of-babel) 364645) => "GEB")

-(fact "Lexicons aren't very random."
+(fact "The Library of Babel isn't random."
   (randomness (take 10000 (library-of-babel))) => #(< % 1/100))


rename routes function

rename routes function

--- backend/src/lambdaui/api.clj
+++ backend/src/lambdaui/api.clj
@@ -17,7 +17,7 @@
 ;  )

-(defn backend-for-frontend []
+(defn ui-for-pipeline [pipeline]
   (ring-json/wrap-json-response
     (routes (GET "/api/summaries" [] (frontend-dummy/build-summaries))
             (GET "/" [] (ring.util.response/redirect "/ui/index.html"))
@@ -29,5 +29,5 @@
 (defonce server (atom nil))

 (defn start-server [port]
-  (reset! server (http/run-server (backend-for-frontend) {:port port})))
+  (reset! server (http/run-server (ui-for-pipeline nil) {:port port})))


Names like `fact-function` privilege an implementation detail.

--- src/midje/emission/boundaries.clj
+++ src/midje/emission/boundaries.clj
@@ -1,6 +1,7 @@
 (ns ^{:doc "Execution boundaries that have to do with checking of faces"}
   midje.emission.boundaries
   (:require [midje.clojure-test-facade :as ctf]
+            [midje.ideas.metadata :as metadata]
             [midje.emission.api :as emit]
             [midje.emission.state :as state]))

@@ -31,7 +32,7 @@
        (emit/fact-stream-summary ct-counters#)
        (all-test-failures-to-self-documenting-map ct-counters#))))

-(defmacro around-fact-function-stream [ffs-sym config-settings & body]
+(defmacro around-fact-stream [ffs-sym config-settings & body]
   `(config/with-augmented-config ~config-settings
      (emit/forget-everything)
      ~@body
@@ -41,23 +42,23 @@

 ;; TODO: Note that both of the fact around functions need to check
 ;; failure counts. It would perhaps make sense to have the
-;; `around-fact-function` wrap `around-top-level-fact-function`, but I
+;; `around-fact` wrap `around-top-level-fact`, but I
 ;; think it would surprise and annoy plugin-writers.

-(defmacro around-top-level-fact-function [ff-sym & body]
+(defmacro around-top-level-fact [fact-sym & body]
   `(let [starting-failures# (state/output-counters:midje-failures)]
-     (emit/possible-new-namespace (metadata/fact-namespace ~ff-sym))
-     (emit/starting-to-check-top-level-fact ~ff-sym)
+     (emit/possible-new-namespace (metadata/fact-namespace ~fact-sym))
+     (emit/starting-to-check-top-level-fact ~fact-sym)
      ~@body
-     (emit/finishing-top-level-fact ~ff-sym)
+     (emit/finishing-top-level-fact ~fact-sym)
      (= starting-failures# (state/output-counters:midje-failures))))

-(defmacro around-fact-function [ff-sym & body]
+(defmacro around-fact [fact-sym & body]
   `(let [starting-failures# (state/output-counters:midje-failures)]
-     (emit/starting-to-check-fact ~ff-sym)
-     (fact-context/adds (metadata/fact-description ~ff-sym)
+     (emit/starting-to-check-fact ~fact-sym)
+     (fact-context/adds (metadata/fact-description ~fact-sym)
                         ~@body)
-     (emit/finishing-fact ~ff-sym)
+     (emit/finishing-fact ~fact-sym)
      (= starting-failures# (state/output-counters:midje-failures))))


Don't allow field names to start with hyphen

--- doclet/src/clojure/play_clj_doclet/core.clj
+++ doclet/src/clojure/play_clj_doclet/core.clj
@@ -16,36 +16,46 @@
 (defn split-string
   [s]
   (if (= s (string/upper-case s))
-    [s]
+    (string/split s #"_")
     (string/split s #"(?=[A-Z])")))

-(defn camel->keyword
+(defn string->keyword
   [s]
-  (->> (string/replace s "_" "-")
-       split-string
+  (->> (split-string s)
        (map string/lower-case)
        (string/join "-")
        keyword))

 (defn parse-param
   [^Parameter p]
-  [(.typeName p) (-> (.name p) camel->keyword name)])
+  [(.typeName p) (-> (.name p) string->keyword name)])

 (defn parse-doc-name
   [^Doc d]
   (cond
     (isa? (type d) ConstructorDoc)
     nil
+
     (isa? (type d) ClassDoc)
-    (subs (.name d) (+ 1 (.lastIndexOf (.name d) ".")))
+    (->> (+ 1 (.lastIndexOf (.name d) "."))
+         (subs (.name d))
+         string->keyword)
+
+    (isa? (type d) FieldDoc)
+    (let [k (string->keyword (.name d))
+          s (name k)]
+      (if (= \- (first s))
+        (keyword (subs s 1))
+        k))
+
     :else
-    (.name d)))
+    (string->keyword (.name d))))

 (defn parse-doc
   [^Doc d clj-name]
   (merge {}
          {:name (->> [(second (string/split clj-name #" "))
-                      (some-> (parse-doc-name d) camel->keyword)]
+                      (parse-doc-name d)]
                      (remove nil?)
                      (string/join " "))}
          (when (> (count (.commentText d)) 0)


CMR-1687: Reset db config

CMR-1687: Reset db config

--- dev-system/dev/user.clj
+++ dev-system/dev/user.clj
@@ -35,8 +35,8 @@
   (system/set-dev-system-echo-type! :in-memory)
   ; (system/set-dev-system-echo-type! :external)

-  ; (system/set-dev-system-db-type! :in-memory)
-  (system/set-dev-system-db-type! :external)
+  (system/set-dev-system-db-type! :in-memory)
+  ; (system/set-dev-system-db-type! :external)

   (system/set-dev-system-message-queue-type! :in-memory)
   ; (system/set-dev-system-message-queue-type! :external)


only show heats if judge is selected

only show heats if judge is selected

--- src/tango/cljs/adjudicator/core.cljs
+++ src/tango/cljs/adjudicator/core.cljs
@@ -308,19 +308,21 @@
       (dom/div nil
         ((om/factory AdjudicatorSelection) panel)

-        (dom/h3 nil (str "Judge : " (if selected-adjudicator
-                                      (:adjudicator/name selected-adjudicator)
-                                      "None selected")))
-        (dom/h3 nil (:activity/name selected-activity))
-        (dom/h3 nil (:round/name selected-activity))
-        (dom/h3 nil (str "Mark " (:round/recall selected-activity) " of "
-                         (count
-                           (:round/starting selected-activity))))
-        ((om/factory HeatsComponent) {:participants (:round/starting selected-activity)
-                                      :heats (:round/heats selected-activity)
-                                      :adjudicator/id (:adjudicator/id selected-adjudicator)
-                                      :activity/id (:activity/id selected-activity)
-                                      :results results-for-this-adjudicator})
+        (when selected-adjudicator
+          (dom/div nil
+            (dom/h3 nil (str "Judge : " (if selected-adjudicator
+                                          (:adjudicator/name selected-adjudicator)
+                                          "None selected")))
+            (dom/h3 nil (:activity/name selected-activity))
+            (dom/h3 nil (:round/name selected-activity))
+            (dom/h3 nil (str "Mark " (:round/recall selected-activity) " of "
+                             (count
+                               (:round/starting selected-activity))))
+            ((om/factory HeatsComponent) {:participants   (:round/starting selected-activity)
+                                          :heats          (:round/heats selected-activity)
+                                          :adjudicator/id (:adjudicator/id selected-adjudicator)
+                                          :activity/id    (:activity/id selected-activity)
+                                          :results        results-for-this-adjudicator})))
         ;(dom/h3 nil (str "Example Participant " (:participant/number
         ;                                          (first (:round/starting selected-activity)))))
         ))))


Fixed outdated render-pulse-card argument

--- src/metabase/pulse/render.clj
+++ src/metabase/pulse/render.clj
@@ -450,7 +450,7 @@
                         :background-color :white
                         :box-shadow       "0 1px 2px rgba(0, 0, 0, .08)"})}
    (binding [*include-title* true]
-     (render-pulse-card card (:data result)))])
+     (render-pulse-card card result))])

 (defn render-pulse-card-to-png
   "Render a PULSE-CARD as a PNG. DATA is the `:data` from a QP result (I think...)"


Upgraded caffe protobuf support.

Upgraded caffe protobuf support.

--- cortex/project.clj
+++ cortex/project.clj
@@ -9,7 +9,7 @@
                  [thinktopic/matrix.fressian "0.3.1"]
                  [net.mikera/vectorz-clj "0.45.0"]
                  [net.mikera/core.matrix "0.54.0"]
-                 [thinktopic/caffe-protobuf "0.1.0"]
+                 [thinktopic/caffe-protobuf "0.2.0"]
                  [net.mikera/clojure-utils "0.7.0"]
                  [core.blas "1.0.2"]
                  [com.github.fommil.netlib/all "1.1.2" :extension "pom"]]


www/case_pages.clj: generate title for untitled cases

--- src/org/altlaw/www/case_pages.clj
+++ src/org/altlaw/www/case_pages.clj
@@ -17,7 +17,9 @@
                     (= :html k) v
                     (= :date k) (date/format-long-date v)
                     (= :court k) (courts/*court-names* v)
-                    (#{:name} k) (tmpl/h v)
+                    (= :name k) (if (or (nil? v) (empty? v))
+                                  (str "Untitled #" (:docid doc))
+                                  (tmpl/h v))
                     (#{:citations :dockets} k) (map tmpl/h v)
                     :else v)))
           {} doc))


ready webhook video data

ready webhook video data

--- src/oc/storage/api/videos.clj
+++ src/oc/storage/api/videos.clj
@@ -8,7 +8,8 @@
             [oc.storage.config :as config]))

 (defn- handle-video-webhook [conn ctx]
-  (timbre/debug ctx))
+  (let [body (:data ctx)]
+    (timbre/debug body)))

 ;; ----- Resources - see: http://clojure-liberator.github.io/liberator/assets/img/decision-graph.svg


Initial trial of tuning systems.

Initial trial of tuning systems.

--- src/overtone/music/tuning.clj
+++ src/overtone/music/tuning.clj
@@ -22,8 +22,26 @@

 ;; 12-tone equal temperament --> Western music
 ;; ratio = (Math/pow 2 (/ 1 12)) => 1.0594630943592953
+;; (perform '((:edo 100 440) 73 76 79)
+;; (perform '(:midi 60 69 81)

 ;; 24-tone equal temperament --> Arabic music
 ;; ratio = (Math/pow 2 (/ 1 24)) => 1.029302236643492
+;; (perform '((:arabic 100 440) 73 76 79)

+(defmulti perfn first)

+(defmethod perfn :ed [[symb divisions multiplier initial freq]]
+    (fn [note]
+        (* freq (Math/pow multiplier (/ (- note initial) divisions)))))
+
+(defmethod perfn :edo [[symb divisions initial freq]]
+    (perfn (list :ed divisions 2 initial freq)))
+
+(defmethod perfn :midi [[symb]]
+    (perfn (list :edo 12 69 440)))
+
+(defmethod perfn :arabic [[symb initial freq]]
+    (perfn (list :edo 12 initial freq)))
+
+(defn perform [[opts & notes]] (map (perfn (flatten (list opts))) notes))


fix: correct parameters in funtions --> dataset extract-type feature(_type)

--- src/test/clojure/pdok/featured/regression_test.clj
+++ src/test/clojure/pdok/featured/regression_test.clj
@@ -42,7 +42,7 @@
         [meta features] (json-reader/features-from-stream stream)]
     [meta features]))

-(defn- inserted-features [extracts dataset dataset-version collection extract-type features]
+(defn- inserted-features [extracts dataset extract-type collection features]
   (doseq [f features]
     (let [record (vector (:_version f) (:_valid_from f) (:_valid_to f) f)]
       (swap! extracts conj record))))
@@ -54,7 +54,7 @@
                              (= valid-from (nth %1 1))) extracts))
       (into [] (remove #(= version (nth % 0)) extracts)))))

-(defn- deleted-versions [extracts dataset collection extract-type records]
+(defn- deleted-versions [extracts dataset extract-type collection records]
     (doseq [record records]
       (swap! extracts remove-extract-record record)))


Implement backoff in initial sync to reduce number of ready messages.

This allows greater number of peers to join together without causing
timeouts.

--- src/onyx/peer/task_lifecycle.clj
+++ src/onyx/peer/task_lifecycle.clj
@@ -277,6 +277,13 @@
         state)
       (goto-next-batch! state))))

+(def initial-sync-backoff-ns ^:const (* 50 1000000))
+
+(defn initial-sync-backoff [state]
+  (when (zero? (t/epoch state))
+    (LockSupport/parkNanos initial-sync-backoff-ns))
+  state)
+
 (defn offer-barriers [state]
   (let [messenger (get-messenger state)
         {:keys [barrier-opts publishers] :as context} (get-context state)
@@ -289,7 +296,9 @@
         remaining-pubs (sequence offer-xf publishers)]
     (if (empty? remaining-pubs)
       (advance state)
-      (set-context! state (assoc context :publishers remaining-pubs)))))
+       (-> state
+           (initial-sync-backoff)
+           (set-context! (assoc context :publishers remaining-pubs))))))

 (defn barrier-status-opts [state]
   (let [status (merged-statuses state)]
@@ -313,7 +322,9 @@
         remaining-peers (sequence offer-xf src-peers)]
     (if (empty? remaining-peers)
       (advance state)
-      (set-context! state (assoc context :src-peers remaining-peers)))))
+      (-> state
+          (initial-sync-backoff)
+          (set-context! (assoc context :src-peers remaining-peers))))))

 (defn unblock-subscribers [state]
   (sub/unblock! (m/subscriber (get-messenger state)))


DRY up slugify tests.

DRY up slugify tests.

--- test/fcms/unit/resources/slugify.clj
+++ test/fcms/unit/resources/slugify.clj
@@ -4,35 +4,47 @@

 (facts "about making slugs"

-  (fact "upper case letters are replaced with lower case letters"
-    (slugify "slug") => "slug"
-    (slugify "Slug") => "slug"
-    (slugify "SLUG") => "slug"
-    (slugify "sLUG") => "slug"
-    (slugify "sluG") => "slug"
-    (slugify "sLuG") => "slug")
+  (tabular (fact "upper case letters are replaced with lower case letters"
+    (slugify ?name) => "slug")
+    ?name
+    "slug"
+    "Slug"
+    "SLUG"
+    "sLUG"
+    "sluG"
+    "sLuG")

-  (fact "internal white space is replaced with a single dash"
-    (slugify "this is a slug") => "this-is-a-slug"
-    (slugify "this is-a slug") => "this-is-a-slug"
-    (slugify "this  is  a  slug") => "this-is-a-slug"
-    (slugify "this is a          slug") => "this-is-a-slug"
+  (tabular (fact "internal spaces is replaced with a single dash"
+    (slugify ?name) => "this-is-a-slug")
+    ?name
+    "this is a slug"
+    "this is-a slug"
+    "this  is  a  slug"
+    "this is a          slug")
+
+  (fact "internal white space characters are replaced with a single dash"
     (slugify "this\t\tis\r\ralso\n\na\r\n\r\nslug") => "this-is-also-a-slug")

-  (fact "prefixed and trailing spaces are removed"
-    (slugify " this is a slug") => "this-is-a-slug"
-    (slugify " this is a slug") => "this-is-a-slug"
-    (slugify "this is a slug ") => "this-is-a-slug"
-    (slugify " this is a slug ") => "this-is-a-slug"
-    (slugify "          this is a slug          ") => "this-is-a-slug"
+  (tabular (fact "prefixed and trailing spaces are removed"
+    (slugify ?name) => "this-is-a-slug")
+    ?name
+    " this is a slug"
+    " this is a slug"
+    "this is a slug "
+    " this is a slug "
+    "          this is a slug          ")
+
+  (fact "prefixed and trailing white space characters are removed"
     (slugify "\t\tthis is a slug\t\t\r\n\r\n") => "this-is-a-slug")

-  (fact "prefixed and trailing dashes are removed"
-    (slugify "-slug") => "slug"
-    (slugify "slug-") => "slug"
-    (slugify "-slug-") => "slug"
-    (slugify "--slug--") => "slug"
-    (slugify "----------slug----------") => "slug")
+  (tabular (fact "prefixed and trailing dashes are removed"
+    (slugify ?name) => "slug")
+    ?name
+    "-slug"
+    "slug-"
+    "-slug-"
+    "--slug--"
+    "----------slug----------")

   (fact "sequential dashes are replaced with a single dash"
     (slugify "this--is----also---a-slug") => "this-is-also-a-slug")
@@ -53,9 +65,11 @@
     (slugify "à-á-â-ã-ā-ă-ȧ-ä-ả-å-ǎ-ȁ-ą-ạ-ḁ-ẚ-ầ-ấ-ẫ-ẩ-ằ-ắ-ẵ-ẳ-ǡ-ǟ-ǻ-ậ-ặ") =>
       "a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a")

-  (fact "other unicode characters are replaced with nothing"
-    (slugify "γλώσσαthis-μουέδωσανis-ελληνικήalso-მივჰხვდეaმასჩემსაالزجاجوهذالايؤلمني.slug मैकाँचखासकताฉันกินกระจกได้לאמזיק")  => "this-is-also-a-slug"
-    (slugify "æ-ǽ-ǣ-this-♜-♛-☃-✄-✈-is-→-☞-➩-⇏-⇉-also-•-✪-▼-❊-✔-a-∑-∏-∛-≃-≈-⅋-⋶-slug") => "this-is-also-a-slug")
+  (tabular (fact "other unicode characters are replaced with nothing"
+    (slugify ?name)  => "this-is-also-a-slug")
+    ?name
+    "γλώσσαthis-μουέδωσανis-ελληνικήalso-მივჰხვდეaმასჩემსაالزجاجوهذالايؤلمني.slug मैकाँचखासकताฉันกินกระจกได้לאמזיק"
+    "æ-ǽ-ǣ-this-♜-♛-☃-✄-✈-is-→-☞-➩-⇏-⇉-also-•-✪-▼-❊-✔-a-∑-∏-∛-≃-≈-⅋-⋶-slug")

   (fact "slugs that are too long are truncated"
     (let [long-slug (apply str (range 0 500))]
@@ -82,9 +96,11 @@
       (slugify all-in-one) => "this-is-also-a-slug"
       (slugify (str all-in-one long-string)) => (str "this-is-also-a-slug-" (apply str (take 236 long-string)))))

-  (fact "perfectly good slugs are unaffected"
-    (slugify "slug") => "slug"
-    (slugify "42") => "42"
-    (slugify "slug42") => "slug42"
-    (slugify "slug-42") => "slug-42"
-    (slugify "this-is-a-slug-42") => "this-is-a-slug-42"))+  (tabular (fact "perfectly good slugs are unaffected"
+    (slugify ?name) => ?slug)
+    ?name               ?slug
+    "slug"              "slug"
+    "42"                "42"
+    "slug42"            "slug42"
+    "slug-42"           "slug-42"
+    "this-is-a-slug-42" "this-is-a-slug-42"))


Test unify! updates for datasets referenced by an atom.

--- test/integration/cljs/core_test.cljs
+++ test/integration/cljs/core_test.cljs
@@ -22,7 +22,7 @@
 (print "\n\nSingle node enter/update/exit\n=============================")
 (let [n 100
       mapping (fn [d] [:span {:x d} (str d)])]
-
+
   (profile (str "ENTER single tag with " n " data")
            (unify! container (range n) mapping))
   (let [children (children container)
@@ -39,7 +39,7 @@
     (assert (= "span" (.toLowerCase (.-nodeName fel))))
     (assert (= (str (dec n)) (:x (attr fel)))))

-
+
   (profile (str "UPDATE single tag with new datum")
            (unify! container (range (inc n)) mapping))
   (assert (= (inc n) (count (children container))))
@@ -52,6 +52,31 @@

 (clear!)
+
+
+(print "\n\nAtom-updates on single node enter/update/exit\n=============================")
+(let [n 100
+      mapping (fn [d] [:span {:x d} (str d)])
+      !ds (atom (range n))]
+
+  (profile (str "ENTER single tag with " n " data")
+           (unify! container !ds mapping))
+  (let [children (children container)
+        fel      (first children)]
+    (assert (= n (count children)))
+    (assert (= "span" (.toLowerCase (.-nodeName fel))))
+    (assert (= "0" (:x (attr fel)))))
+
+  (profile (str "UPDATE single tag, reversing order")
+           (swap! !ds reverse))
+  (let [children (children container)
+        fel       (first children)]
+    (assert (= n (count children)))
+    (assert (= "span" (.toLowerCase (.-nodeName fel))))
+    (assert (= (str (dec n)) (:x (attr fel))))))
+
+(clear!)
+

 (print "\n\nMore complex dataset\n====================")
 (let [n 100
@@ -68,7 +93,7 @@
   (profile "UPDATE/EXIT node hiearchy"
            (unify! container (take 10 new-data) mapping
                    :key-fn :id))
-
+
   (assert (= 10 (count (children container))))
   (assert (= (:val (first new-data))
              (:val (attr (first (children container)))))))


JSON-LD expansion

JSON-LD expansion

--- src/rdf_path_examples/json_ld.clj
+++ src/rdf_path_examples/json_ld.clj
@@ -16,6 +16,13 @@
       :or {options json-ld-options}}]
   (JsonLdProcessor/compact json-ld context options))

+(defn expand
+  "Expand `json-ld` with optional `options`."
+  [^LinkedHashMap json-ld
+   & {:keys [options]
+      :or {options json-ld-options}}]
+  (JsonLdProcessor/expand json-ld options))
+
 (def load-resource
   "Load JSON resource from `resource-path`."
   (comp #(JsonUtils/fromInputStream %) io/input-stream io/resource))


Extract `err-info` from cider-nrepl (#213)

Extract `err-info` from cider-nrepl. It was removed there, as it was superseded by `with-safe-transport`, which handles middleware errors automatically.

--- src/refactor_nrepl/middleware.clj
+++ src/refactor_nrepl/middleware.clj
@@ -1,6 +1,6 @@
 (ns refactor-nrepl.middleware
   (:require [cider.nrepl.middleware.util.cljs :as cljs]
-            [cider.nrepl.middleware.util.misc :refer [err-info]]
+            [clojure.stacktrace :refer [print-cause-trace]]
             [clojure.tools.nrepl.middleware :refer [set-descriptor!]]
             [clojure.tools.nrepl.misc :refer [response-for]]
             [clojure.tools.nrepl.transport :as transport]
@@ -13,6 +13,12 @@
 (defn- require-and-resolve [sym]
   (require (symbol (namespace sym)))
   (resolve sym))
+
+(defn err-info
+  [ex status]
+  {:ex (str (class ex))
+   :err (with-out-str (print-cause-trace ex))
+   :status #{status :done}})

 (defmacro ^:private with-errors-being-passed-on [transport msg & body]
   `(try


Stray prn

Stray prn

--- test/midje/midje_forms/t_editing.clj
+++ test/midje/midje_forms/t_editing.clj
@@ -80,7 +80,6 @@
         z             (zip/seq-zip original)
         original-loc  (-> z zip/down)
         resulting-loc (wrap-with-expect__then__at-rightmost-expect-leaf original-loc)]
-    (prn (zip/root resulting-loc))
     (:line (meta (first (zip/root resulting-loc)))) => 505))


Extend test coverage to all Dynamo API fns

--- test/taoensso/faraday/tests/main.clj
+++ test/taoensso/faraday/tests/main.clj
@@ -19,6 +19,11 @@

 (def ttable :faraday.tests.main)
 (def range-table :faraday.tests.range)
+
+(def run-after-setup (atom #{}))
+
+(defn- after-setup! [thunk]
+  (swap! run-after-setup conj thunk))

 (defn- before-run {:expectations-options :before-run} []
   (assert (and (:access-key *client-opts*)
@@ -31,6 +36,10 @@
     {:range-keydef [:number :n]
      :throughput   {:read 1 :write 1}
      :block?       true})
+
+  (doseq [thunk @run-after-setup]
+    (thunk))
+
   (println "Ready to roll..."))

 (defn- after-run {:expectations-options :after-run} [])
@@ -42,7 +51,9 @@
 (let [i0 {:id 0 :name "foo"}
       i1 {:id 1 :name "bar"}]

-  (far/batch-write-item *client-opts* {ttable {:delete [{:id 0} {:id 1} {:id 2}]}})
+  (after-setup!
+   #(far/batch-write-item *client-opts*
+                          {ttable {:delete [{:id 0} {:id 1} {:id 2}]}}))

   (expect ; Batch put
    [i0 i1 nil] (do (far/batch-write-item *client-opts* {ttable {:put [i0 i1]}})
@@ -69,14 +80,58 @@
                  [(far/get-item *client-opts* ttable {:id 0})
                   (far/get-item *client-opts* ttable {:id 1})])))

-;;;; Range queries
+(let [i {:id 10 :name "update me"}]
+
+  (after-setup!
+    #(far/delete-item *client-opts* ttable {:id 10}))
+
+  (expect
+   {:id 10 :name "baz"}
+   (do
+     (far/put-item *client-opts* ttable i)
+     (far/update-item
+        *client-opts* ttable {:id 10} {:name [:put "baz"]} {:return :all-new})))
+
+  (expect
+   #= (far/ex :conditional-check-failed)
+   (far/update-item *client-opts* ttable
+       {:id 10} {:name [:put "baz"]}
+       {:expected {:name "garbage"}})))
+
+(let [items [{:id 11 :name "eleven" :test "batch"}
+             {:id 12 :name "twelve" :test "batch"}
+             {:id 13 :name "thirteen" :test "batch"}]
+      [i1 i2 i3] items]
+
+  (after-setup!
+   (fn [] (far/batch-write-item
+          *client-opts* {ttable {:delete (map #(select-keys % #{:id}) items)}})))
+
+  (expect
+   [i1]
+   (do (far/batch-write-item *client-opts* {ttable {:put items}})
+       (far/scan *client-opts* ttable
+                 {:attr-conds {:name [:eq "eleven"]}})))
+
+  (expect
+   #{i1 i3}
+   (into #{} (far/scan *client-opts* ttable
+                       {:attr-conds {:name [:ne "twelve"]
+                                     :test [:eq "batch"]}})))
+
+  (expect
+   (repeat 3 {:test "batch"})
+   (far/scan *client-opts* ttable {:attr-conds {:test [:eq "batch"]}
+                                   :return [:test]})))
+
+;;;; range queries
 (let [j0 {:title "One" :number 0}
       j1 {:title "One" :number 1}
       k0 {:title "Two" :number 0}
       k1 {:title "Two" :number 1}]

-  (far/batch-write-item *client-opts*
-    {range-table {:put [j0 j1 k0 k1]}})
+  (after-setup!
+    #(far/batch-write-item *client-opts* {range-table {:put [j0 j1 k0 k1]}}))

   (expect ; Query, normal ordering
     [j0 j1] (far/query *client-opts* range-table {:title [:eq "One"]}))
@@ -152,13 +207,29 @@
 (when-let [endpoint (:endpoint *client-opts*)]
   (when (.contains ^String endpoint "localhost")
     (expect
-      (let [;; Generate > 100 tables to exceed the batch size limit:
-            tables (map #(keyword (str "test_" %)) (range 102))]
-        (doseq [table tables]
-          (far/ensure-table *client-opts* table [:id :n]
-            {:throughput  {:read 1 :write 1}
-             :block?      true}))
-        (let [table-count (count (far/list-tables *client-opts*))]
-          (doseq [table tables]
-            (far/delete-table *client-opts* table))
-          (> table-count 100))))))
+     (let [ ;; Generate > 100 tables to exceed the batch size limit:
+           tables (map #(keyword (str "test_" %)) (range 102))]
+       (doseq [table tables]
+         (far/ensure-table *client-opts* table [:id :n]
+                           {:throughput  {:read 1 :write 1}
+                            :block?      true}))
+       (let [table-count (count (far/list-tables *client-opts*))]
+         (doseq [table tables]
+           (far/delete-table *client-opts* table))
+         (> table-count 100))))
+
+    (let [update-t :faraday.tests.update-table]
+      (after-setup!
+       #(do
+          (when (far/describe-table *client-opts* update-t)
+            (far/delete-table *client-opts* update-t))
+          (far/create-table
+           *client-opts* update-t [:id :n]
+           {:throughput {:read 1 :write 1} :block? true})))
+
+      (expect
+       {:read 2 :write 2}
+       (-> (far/update-table *client-opts* update-t {:read 2 :write 2})
+           deref
+           :throughput
+           (select-keys #{:read :write}))))))


Check that prefix matches are possible.

Check that prefix matches are possible.

--- test/active/clojure/match_test.clj
+++ test/active/clojure/match_test.clj
@@ -172,6 +172,7 @@
    (:a "a" :as a)
    (:b "b")
    (:c :as c)
+   ([:d] :as d)
    ([:d Z] 42 :as Z)
    ([:d Y] :as Y)
    ([:d X] 65)
@@ -181,13 +182,13 @@
 (def example-matcher
   (p/map-matcher
    one   [x y z w]
-   two   [a b c Z Y X foo]
+   two   [a b c d Z Y X foo]
    :else false))

 (t/deftest map-matcher-test
   (t/is (= ["x" "y" "z" "w"]
            (example-matcher one-data)))
-  (t/is (= ["a" "b" "c" 42 23 65 "bar"]
+  (t/is (= ["a" "b" "c" {"Z" 42 "Y" 23 "X" 65 "W" {"foo" "bar"}} 42 23 65 "bar"]
            (example-matcher two-data)))
   (t/is (= false (example-matcher {:kind "none"}))))


Arrange things so that sh and sy-async have public docs

--- planck-cljs/src/planck/shell.cljs
+++ planck-cljs/src/planck/shell.cljs
@@ -25,33 +25,6 @@

 (def ^:private nil-func (fn [_] nil))
 (defn- sh-internal
-  "Launches a sub-process with the supplied arguments.
-  Parameters: cmd, <options>, cb (may be nil-func for synchronous)
-  cmd      the command(s) (Strings) to execute. will be concatenated together.
-  options  optional keyword arguments-- see below.
-  cb       the callback to call upon completion (for async). specify nil-func for sync.
-  Options are:
-  :in      may be given followed by a string of one of the following formats:
-           String conforming to URL Syntax: 'file:///tmp/test.txt'
-           String pointing at an *existing* 'file: '/tmp/test.txt'
-           String with string input: 'Printing input from stdin with funny chars like $@ &'
-           to be fed to the sub-process's stdin.
-  :in-enc  option may be given followed by a String, used as a character
-           encoding name (for example \"UTF-8\" or \"ISO-8859-1\") to
-           convert the input string specified by the :in option to the
-           sub-process's stdin.  Defaults to UTF-8.
-  :out-enc option may be given followed by a String. If a
-           String is given, it will be used as a character encoding
-           name (for example \"UTF-8\" or \"ISO-8859-1\") to convert
-           the sub-process's stdout to a String which is returned.
-  :env     override the process env with a map of String: String.
-  :dir     override the process dir with a String or planck.io/File.
-  if the command can be launched and cb is nil-func, sh returns a map of
-    :exit => sub-process's exit code
-    :out  => sub-process's stdout (as String)
-    :err  => sub-process's stderr (String via platform default encoding),
-  otherwise if cb is not nil-func, executes async and returns nil immediately.
-  otherwise it throws an exception"
   [& args]
   (let [{:keys [cmd opts cb]} (s/conform ::sh-async-args args)]
     (when (nil? cmd)
@@ -69,11 +42,64 @@
         (throw (js/Error. err))
         (if async? nil translated)))))

-(defn sh [& args]
+(defn sh
+  "Launches a sub-process with the supplied arguments.
+  Parameters: cmd, <options>
+  cmd      the command(s) (Strings) to execute. will be concatenated together.
+  options  optional keyword arguments-- see below.
+  Options are:
+  :in      may be given followed by a string of one of the following formats:
+           String conforming to URL Syntax: 'file:///tmp/test.txt'
+           String pointing at an *existing* 'file: '/tmp/test.txt'
+           String with string input: 'Printing input from stdin with funny chars like $@ &'
+           to be fed to the sub-process's stdin.
+  :in-enc  option may be given followed by a String, used as a character
+           encoding name (for example \"UTF-8\" or \"ISO-8859-1\") to
+           convert the input string specified by the :in option to the
+           sub-process's stdin.  Defaults to UTF-8.
+  :out-enc option may be given followed by a String. If a
+           String is given, it will be used as a character encoding
+           name (for example \"UTF-8\" or \"ISO-8859-1\") to convert
+           the sub-process's stdout to a String which is returned.
+  :env     override the process env with a map of String: String.
+  :dir     override the process dir with a String or planck.io/File.
+  if the command can be launched, sh returns a map of
+    :exit => sub-process's exit code
+    :out  => sub-process's stdout (as String)
+    :err  => sub-process's stderr (String via platform default encoding),
+  otherwise it throws an exception"
+  [& args]
   (apply sh-internal (concat args [nil-func])))

 (when-not (clojure.string/starts-with? js/PLANCK_VERSION "1.")
-  (defn sh-async [& args]
+  (defn sh-async
+    "Launches a sub-process with the supplied arguments.
+    Parameters: cmd, <options>, cb
+    cmd      the command(s) (Strings) to execute. will be concatenated together.
+    options  optional keyword arguments-- see below.
+    cb       the callback to call upon completion
+    Options are:
+    :in      may be given followed by a string of one of the following formats:
+             String conforming to URL Syntax: 'file:///tmp/test.txt'
+             String pointing at an *existing* 'file: '/tmp/test.txt'
+             String with string input: 'Printing input from stdin with funny chars like $@ &'
+             to be fed to the sub-process's stdin.
+    :in-enc  option may be given followed by a String, used as a character
+             encoding name (for example \"UTF-8\" or \"ISO-8859-1\") to
+             convert the input string specified by the :in option to the
+             sub-process's stdin.  Defaults to UTF-8.
+    :out-enc option may be given followed by a String. If a
+             String is given, it will be used as a character encoding
+             name (for example \"UTF-8\" or \"ISO-8859-1\") to convert
+             the sub-process's stdout to a String which is returned.
+    :env     override the process env with a map of String: String.
+    :dir     override the process dir with a String or planck.io/File.
+    if the command can be launched, sh-async calls back with a map of
+      :exit => sub-process's exit code
+      :out  => sub-process's stdout (as String)
+      :err  => sub-process's stderr (String via platform default encoding),
+    Returns nil immediately"
+    [& args]
     (apply sh-internal args)))

 (s/def ::string-string-map? (s/and map? (fn [m]
@@ -94,10 +120,10 @@
 (s/def ::out string?)
 (s/def ::err string?)

-(s/fdef sh-internal
-  :args ::sh-async-args
-  :ret (s/keys :req-un [::exit ::out ::err]))
-
 (s/fdef sh
   :args ::sh-args
   :ret (s/keys :req-un [::exit ::out ::err]))
+
+(s/fdef sh-async
+  :args ::sh-async-args
+  :ret nil?)


Schema test

Schema test

Refs #14.

--- test/icecap/handlers/http_test.clj
+++ test/icecap/handlers/http_test.clj
@@ -2,12 +2,18 @@
   (:require [clojure.core.async :as a]
             [manifold.deferred :as d]
             [icecap.handlers.core :refer [execute]]
+            [icecap.schema :refer [check-plan]]
             [icecap.handlers.http]
             [aleph.http :as h]
             [clojure.test :refer :all]))

 (def step
   {:type :http :url "http://www.example.com"})
+
+(deftest schema-tests
+  (testing "valid steps"
+    (are [x] (nil? (check-plan x))
+         step)))

 (def fake-response
   {})


ensure builds directories before starting figwheel

--- plugin/src/leiningen/figwheel.clj
+++ plugin/src/leiningen/figwheel.clj
@@ -190,8 +190,6 @@
         (clean/clean project)))))

 ;; configuration validation and management is internal to figwheel BUT ...
-
-

 ;; we need to be able to introspect the config because we need to add the
 ;; right cljs build source paths to the classpath
@@ -300,6 +298,18 @@
        concat
        (filter sequential? (map :source-paths classpath-builds)))))))

+;; really not digging this
+
+(defn ensure-build-dirs [proj]
+  (when-let [builds (cljs-builds proj)]
+    (->> builds
+         (filter map?)
+         (keep (fn [x] (get-in x [:compiler :output-to])))
+         (filter string?)
+         (keep #(.getParentFile (io/file %)))
+         distinct
+         (mapv #(.mkdirs %)))))
+
 (comment
   (def test-project
     {:cljsbuil
@@ -495,6 +505,7 @@
                                   [command build-ids]
                                   [nil (and command (cons command build-ids))])]
         (clean-on-dependency-change project)
+        (ensure-build-dirs project)
         (println "Figwheel: Cutting some fruit, just a sec ...")
         (fig-dispatch command project build-ids)))))


Add note after dynamic dispatching profiling

--- src/text_justification/model.cljs
+++ src/text_justification/model.cljs
@@ -6,6 +6,7 @@

 ;;;; TODO precalc badness to hash ?
+;;;; TODO profile usage of type hinting

 ;;;;
@@ -50,7 +51,7 @@
 (defn- tj-inner
   "fits words into lines so that whole text looks pretty
   @return #words in each line"
-  ([page-width words]
+  ([page-width words] ;; NOTE: dynamic dispatching does not hurt performance here. Curious..
     (clear-memo)
     (second (tj-inner page-width words 0)))
   ([page-width words word-idx]


RS & AB | #33 | 404 when viewing 'what changed' on first draft

--- test/objective8/integration/front_end/drafting.clj
+++ test/objective8/integration/front_end/drafting.clj
@@ -220,7 +220,27 @@

              (let [{response :response} (p/request user-session draft-diff-url)]
                (:status response) => 200
-               (:body response) => (contains "eading"))))
+               (:body response) => (contains "eading")))
+
+(fact "viewing diff page for the first draft returns 404 page"
+      (against-background
+        (http-api/get-objective OBJECTIVE_ID) => {:status ::http-api/success
+                                                  :result {:status "drafting"
+                                                           :_id OBJECTIVE_ID}}
+        (http-api/get-draft OBJECTIVE_ID DRAFT_ID) => {:status ::http-api/success
+                                                       :result {:_id DRAFT_ID
+                                                                :_created_at "2015-03-24T17:06:37.714Z"
+                                                                :content SOME_HICCUP
+                                                                :objective-id OBJECTIVE_ID
+                                                                :submitter-id USER_ID
+                                                                :username "username"
+                                                                :next-draft-id 4
+                                                                :previous-draft-id nil}}
+        (http-api/get-draft OBJECTIVE_ID nil) => {:status ::http-api/not-found
+                                                  :result {}})
+
+        (let [{response :response} (p/request user-session draft-diff-url)]
+          (:status response) => 404)))

 (facts "about rendering draft-list page"
        (fact "there are no untranslated strings"
@@ -242,7 +262,7 @@
                                                    :response)]
                status => 200
                body => ih/no-untranslated-strings)))
-
+

 (facts "about rendering draft page"
        (fact "there are no untranslated strings"
@@ -260,7 +280,7 @@
                (http-api/get-comments :draft-uri) => {:status ::http-api/success
                                                       :result []}
                (http-api/retrieve-writers OBJECTIVE_ID) => {:status ::http-api/success
-                                                               :result []})
+                                                            :result []})
              (let [user-session (ih/test-context)
                    {status :status body :body} (-> user-session
                                                    (p/request (utils/path-for :fe/draft :id OBJECTIVE_ID :d-id DRAFT_ID))


Fix example does not rotate backwards.

Fix example does not rotate backwards.

Fixes the example so that it can handle backward rotations.

--- exercises/rotational-cipher/src/example.clj
+++ exercises/rotational-cipher/src/example.clj
@@ -1,21 +1,27 @@
 (ns rotational-cipher)

-(def ^:private string (partial apply str))
+(defn ^:private spinner [s a]
+  (let [a (int a)
+        spin (fn [c] (mod (+ c s) 26))]
+    (fn [c]
+      (let [c (- (int c) a)]
+        (char (+ (spin c) a))))))

-(def ^:private lower-case "abcdefghijklmnopqrstuvwxyz")
+(defn ^:private upper-spinner [s]
+  (spinner s \A))

-(def ^:private upper-case (->> lower-case (map clojure.string/upper-case) string))
+(defn ^:private lower-spinner [s]
+  (spinner s \a))

-(def ^:private letters (into #{} (concat lower-case upper-case)))
+(defn ^:private cipher [spin]
+  (let [upper-spin (upper-spinner spin)
+        lower-spin (lower-spinner spin)]
+    (fn [c]
+      (cond
+        (Character/isUpperCase c) (upper-spin c)
+        (Character/isLowerCase c) (lower-spin c)
+        :default c))))

-(defn- rotater [shift]
-  (let [encoding (->> (cycle letters)
-                      (drop (* shift 2))
-                      (take 52)
-                      (zipmap letters))]
-    (fn [char] (get encoding char char))))
-
-(defn rotate [message shift]
-  (->> message
-       (map (rotater shift))
-       string))
+(defn rotate [text spin]
+  (let [cipher (cipher spin)]
+    (apply str (map cipher text)) ))


fix logout link in mobile, #fixes 162

fix logout link in mobile, #fixes 162

--- priv/ui/src/holiday_ping_ui/common/views.cljs
+++ priv/ui/src/holiday_ping_ui/common/views.cljs
@@ -46,7 +46,7 @@
     [:div.navbar-brand
      [:a.navbar-item.is-size-3.app-title {:href "/"} "HolidayPing"]
      [:a.navbar-item.is-hidden-desktop
-      {:href "https://notamonadtutorial.com" :target "_blank"} "Logout"]]
+      {:href "#" :on-click #(re-frame/dispatch [:logout])} "Logout"]]

     [:div.navbar-menu
      [:div.navbar-start


layout refinement

layout refinement

--- src/statuses/views/common.clj
+++ src/statuses/views/common.clj
@@ -9,7 +9,7 @@
 (defn layout [content navigation]
             (html5
               [:head
-               [:meta {:name "viewport"
+               [:meta {:name "viewport"
                        :content "width=device-width, initial-scale=1.0, maximum-scale=1, user-scalable=no"}]
                [:title "innoQ Statuses"]
                (include-css "https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css")
@@ -24,7 +24,7 @@
                 [:div.container-fluid
                  [:div.row
                   [:div.col-xs-12.col-md-8 content]
-                  [:div.col-xs-4.col-md-2
+                  [:div.col-xs-6.col-md-3
                    [:div.well {:style "padding:1em;"}
                     [:ul {:class "nav nav-list"}
                      navigation ]]]]])


lein: + vinyasa.pull/.lein

lein: + vinyasa.pull/.lein

--- .lein/profiles.clj
+++ .lein/profiles.clj
@@ -8,6 +8,7 @@
                        [nrepl-inspect "0.4.1"]    ; for wrap-inspect, Emacs
                        [ritz/ritz-nrepl-middleware "0.7.0"]
                        [night-vision "0.1.0-SNAPSHOT"] ;; print input/output of each call in a ns; see (night-vision.goggles/introspect-ns! '<your ns>)
+                       [leiningen "2.3.4"] ;; Vinyasa needs this, must match my lein version
                        ]
         ;; "Copy" the given function to clojure.core (and thus all namespaces), prefixed with > => (>doc ..)
         :injections [(require 'vinyasa.inject) ;; TODO check also vinyasa/pull, lein, reimport
@@ -17,6 +18,8 @@
                      (vinyasa.inject/inject 'clojure.core '>
                        '[[clojure.repl doc source]
                          [clojure.pprint pprint pp]
+                         [vinyasa.pull pull]
+                         [vinyasa.lein lein]
                          [alex-and-georges.debug-repl debug-repl]
                          [com.georgejahad.difform difform]
                          [clj-ns-browser.sdoc sdoc]])


Fix tests

Fix tests

--- test/asciinema_player/core_test.cljs
+++ test/asciinema_player/core_test.cljs
@@ -4,10 +4,10 @@
             [asciinema-player.core :as c]))

 (deftest make-player-test
-  (let [make-player #(c/make-player 80 24 "https://..." %)]
+  (let [make-player #(c/make-player "https://..." %)]
     (let [player (make-player {})]
-      (is (= (:width player) 80))
-      (is (= (:height player) 24))
+      (is (= (:width player) nil))
+      (is (= (:height player) nil))
       (is (= (:asciicast-url player) "https://..."))
       (is (= (:duration player) 0))
       (is (= (:start-at player) 0))
@@ -17,7 +17,9 @@
       (is (= (:speed player) 1))
       (is (= (:auto-play player) false))
       (is (= (:loop player) nil)))
-    (let [player (make-player {:speed 3 :theme "tango" :font-size "big" :loop true :author "me"})]
+    (let [player (make-player {:width 100 :height 40 :speed 3 :theme "tango" :font-size "big" :loop true :author "me"})]
+      (is (= (:width player) 100))
+      (is (= (:height player) 40))
       (is (= (:speed player) 3))
       (is (= (:theme player) "tango"))
       (is (= (:font-size player) "big"))


Test function get-all-contents is no longer relevant after using S3

--- test/clj/tropology/test/db_nodes.clj
+++ test/clj/tropology/test/db_nodes.clj
@@ -58,9 +58,6 @@
 (defn get-all-article-rels []
   (->> (select links)
        (map db/rename-db-keywords)))
-
-(defn get-all-contents []
-  (select contents))

 ;
 ; Tests


Render invalid references properly

Render invalid references properly

--- src/web/components/node_link.cljs
+++ src/web/components/node_link.cljs
@@ -38,11 +38,15 @@
   Object
   (render [this]
     (let [{:keys [name title kind]} (om/props this)
-          route (node->route (om/props this))]
-      (dom/a #js {:onClick #(routing/activate-route! route)
-                  :className "node-link"}
-        (badge {:kind kind})
-        (dom/span #js {:className "node-link-title"} title)
-        (dom/span #js {:className "node-link-name"} name)))))
+          route (node->route (om/props this))
+          invalid? (not kind)]
+      (if invalid?
+        (dom/span #js {:className "error"}
+          (str "Invalid reference – " name))
+        (dom/a #js {:onClick #(routing/activate-route! route)
+                    :className (str "node-link")}
+               (badge {:kind kind})
+               (dom/span #js {:className "node-link-title"} title)
+               (dom/span #js {:className "node-link-name"} name))))))

 (def node-link (om/factory NodeLink {:key-fn :name}))


Fix test

Fix test

--- src/zaffre/components/render.cljc
+++ src/zaffre/components/render.cljc
@@ -110,10 +110,10 @@
           (assert false (format "found non-text element %s" type)))))))

 (defn text-length [text-element]
-  (-> text-element second :children first count))
+  (-> text-element second :zaffre/children first count))

 (defn space? [text-element]
-  (= " " (-> text-element second :children first)))
+  (= " " (-> text-element second :zaffre/children first)))

 ;; Adapted from https://www.rosettacode.org/wiki/Word_wrap#Clojure
 (defn wrap-lines [size style text]


0.6 doesn't have the notion of completing a task.

--- test/onyx/log/complete_task_test.clj
+++ test/onyx/log/complete_task_test.clj
@@ -1,101 +0,0 @@
-(ns onyx.log.complete-task-test
-  (:require [onyx.extensions :as extensions]
-            [onyx.log.entry :refer [create-log-entry]]
-            [onyx.system]
-            [midje.sweet :refer :all]))
-
-(def entry (create-log-entry :complete-task {:job :j1 :task :t1}))
-
-(def f (partial extensions/apply-log-entry entry))
-
-(def rep-diff (partial extensions/replica-diff entry))
-
-(def rep-reactions (partial extensions/reactions entry))
-
-(def old-replica {:job-scheduler :onyx.job-scheduler/greedy
-                  :jobs [:j1]
-                  :tasks {:j1 [:t1 :t2]}
-                  :allocations {:j1 {:t1 [:a :b] :t2 [:c]}}
-                  :task-schedulers {:j1 :onyx.task-scheduler/round-robin}
-                  :peers [:a :b :c]})
-
-(let [new-replica (f old-replica)
-      diff (rep-diff old-replica new-replica)]
-  (fact (:completions new-replica) => {:j1 [:t1]})
-  (fact (:allocations new-replica) => {:j1 {:t2 [:c]}})
-  (fact (rep-reactions old-replica new-replica diff {:id :a}) =>
-        [{:fn :volunteer-for-task :args {:id :a}}])
-  (fact (rep-reactions old-replica new-replica diff {:id :b}) =>
-        [{:fn :volunteer-for-task :args {:id :b}}])
-  (fact (rep-reactions old-replica new-replica diff {:id :c}) => nil?))
-
-(def entry (create-log-entry :volunteer-for-task {:id :a}))
-
-(def f (partial extensions/apply-log-entry entry))
-
-(def rep-diff (partial extensions/replica-diff entry))
-
-(def rep-reactions (partial extensions/reactions entry))
-
-(def old-replica {:job-scheduler :onyx.job-scheduler/greedy
-                  :jobs [:j1 :j2]
-                  :tasks {:j1 [:t1] :j2 [:t2]}
-                  :allocations {:j1 {}}
-                  :completions {:j1 [:t1]}
-                  :task-schedulers {:j1 :onyx.task-scheduler/greedy :j2 :onyx.task-scheduler/greedy}
-                  :peers [:a]})
-
-(fact (:allocations (f old-replica)) => {:j1 {} :j2 {:t2 [:a]}})
-
-(def old-replica {:job-scheduler :onyx.job-scheduler/round-robin
-                  :jobs [:j1 :j2 :j3]
-                  :tasks {:j1 [:t1] :j2 [:t2] :j3 [:t3]}
-                  :allocations {:j1 {}}
-                  :completions {:j1 [:t1]}
-                  :task-schedulers {:j1 :onyx.task-scheduler/greedy
-                                    :j2 :onyx.task-scheduler/greedy
-                                    :j3 :onyx.task-scheduler/greedy}
-                  :peers [:a]})
-
-(fact (:allocations (f old-replica)) => {:j1 {} :j2 {:t2 [:a]}})
-
-(def old-replica {:job-scheduler :onyx.job-scheduler/round-robin
-                  :jobs [:j1 :j2 :j3]
-                  :tasks {:j1 [:t1] :j2 [:t2] :j3 [:t3]}
-                  :allocations {:j1 {}}
-                  :completions {:j1 [:t1] :j2 [:t3]}
-                  :task-schedulers {:j1 :onyx.task-scheduler/greedy
-                                    :j2 :onyx.task-scheduler/greedy
-                                    :j3 :onyx.task-scheduler/greedy}
-                  :peers [:a]})
-
-(fact (:allocations (f old-replica)) => {:j1 {} :j3 {:t3 [:a]}})
-
-(def old-replica {:job-scheduler :onyx.job-scheduler/round-robin
-                  :jobs [:j1]
-                  :tasks {:j1 [:t1]}
-                  :allocations {:j1 {}}
-                  :completions {:j1 [:t1]}
-                  :task-schedulers {:j1 :onyx.task-scheduler/greedy}
-                  :peers [:a]})
-
-(fact (:allocations (f old-replica)) => {:j1 {}})
-
-(def entry (create-log-entry :volunteer-for-task {:id :a}))
-
-(def f (partial extensions/apply-log-entry entry))
-
-(def rep-diff (partial extensions/replica-diff entry))
-
-(def rep-reactions (partial extensions/reactions entry))
-
-(def old-replica {:job-scheduler :onyx.job-scheduler/greedy
-                  :jobs [:j1]
-                  :tasks {:j1 [:t1 :t2]}
-                  :allocations {:j1 {}}
-                  :completions {:j1 [:t1]}
-                  :task-schedulers {:j1 :onyx.task-scheduler/greedy}
-                  :peers [:a]})
-
-(fact (:allocations (f old-replica)) => {:j1 {:t2 [:a]}})
-


Clean up generation of sound on polyp creation.

Use average row.

--- src/videotest/coral/coral.clj
+++ src/videotest/coral/coral.clj
@@ -126,29 +126,36 @@
 (defn remove-seeds [all-seeds seeds]
   (remove (set seeds) all-seeds))

-(defn make-sound-for-polyp-creation? [seed-count]
-  (> (q/map-range seed-count 1 1000 1.0 0.01) (rand)))
+(defn play-polyp-creation [cell-w num-row-bins seeds]
+  (when (seq seeds)
+    (let [avg-y (/ (reduce (fn [memo {:keys [x y]}]
+                             (+ memo y))
+                           0
+                           seeds)
+                   (count seeds))
+          [_ row] (xy->coords cell-w 0 avg-y)]
+      (sound/polyp-creation (q/map-range row 0 num-row-bins 0.0 1.0)
+                            (q/map-range row 0 num-row-bins 0.0 1.0)))))

 (defn add-polyp [coral-size seed-count coral x y color-rgba color-hsva]
   (let [{:keys [cell-w num-row-bins]} coral-size
         [col row :as coords] (xy->coords cell-w x y)]
-    (if (make-sound-for-polyp-creation? seed-count)
-      (sound/polyp-creation (q/map-range row 0 num-row-bins 0.0 1.0)
-                            (q/map-range row 0 num-row-bins 0.0 1.0)))
     (assoc-in coral [coords] {:color-rgba color-rgba
                               :color-hsva color-hsva})))

 (defn add-seeds-to-coral [coral-size coral seeds]
-  (let [seed-count (count seeds)]
-   (doall
-    (reduce (fn [memo {:keys [x y color-rgba color-hsva] :as seed}]
-              (add-polyp coral-size
-                         seed-count
-                         memo
-                         x y
-                         color-rgba color-hsva))
-            coral
-            seeds))))
+  (let [{:keys [cell-w num-row-bins]} coral-size
+        seed-count (count seeds)]
+    (play-polyp-creation cell-w num-row-bins seeds)
+    (doall
+     (reduce (fn [memo {:keys [x y color-rgba color-hsva] :as seed}]
+               (add-polyp coral-size
+                          seed-count
+                          memo
+                          x y
+                          color-rgba color-hsva))
+             coral
+             seeds))))

 (defn attach-seeds
   [display-h {:keys [motion-seeds coral-size coral] :as state}]


Fix description for when mappings are incomplete

--- src/web/components/nodes.cljs
+++ src/web/components/nodes.cljs
@@ -81,7 +81,10 @@
                 (dom/div #js {:className "node-detail-content"}
                   (if (empty? mapped-here)
                     (dom/div #js {:className "error"}
-                      "No requirements have been mapped here yet.")
+                      (if (= "component" kind)
+                        "No requirements have been mapped here yet."
+                        (str "No requirements or components have been "
+                             "mapped here yet.")))
                     (for [source mapped-here]
                       (node-link source))))))
             (when-not (some #{kind} ["work-item" "tag"])
@@ -91,7 +94,10 @@
                 (dom/div #js {:className "node-detail-content"}
                   (if (empty? mapped-to)
                     (dom/div #js {:className "error"}
-                      "Not mapped to any components yet.")
+                      (if (= "requirement" kind)
+                        (str "Not mapped to any components or "
+                             "work items yet.")
+                        (str "Not mapped to any work items yet.")))
                     (for [target mapped-to]
                       (node-link target))))))))
         (dom/div #js {:className "node-subnodes"}


Refer html function

Refer html function

--- test/comic_reader/scrape_test.clj
+++ test/comic_reader/scrape_test.clj
@@ -1,5 +1,5 @@
 (ns comic-reader.scrape-test
-  (:require [net.cgrand.enlive-html :as html]
+  (:require [net.cgrand.enlive-html :refer [html]]
             [comic-reader.scrape :refer :all]
             [clojure.test :refer :all]))

@@ -18,12 +18,12 @@
          [:img {:src "def"}])))

 (deftest extract-image-tag-test
-  (let [html (html/html [:div {} [:img {:src "dummy-img"
-                                        :alt "alt-text"}]])]
+  (let [html (html [:div {} [:img {:src "dummy-img"
+                                   :alt "alt-text"}]])]
     (is (= (extract-image-tag html [:div :img])
            [:img {:src "dummy-img" :alt "alt-text"}])))

-  (let [html (html/html [:div {} [:p {} [:img {:src "img-two"
-                                               :alt "text-alt"}]]])]
+  (let [html (html [:div {} [:p {} [:img {:src "img-two"
+                                          :alt "text-alt"}]]])]
     (is (= (extract-image-tag html [:div :p :img])
            [:img {:src "img-two" :alt "text-alt"}]))))


add macro unless (using list)

add macro unless (using list)

--- clojure/unless.clj
+++ clojure/unless.clj
@@ -1,4 +1,12 @@
+;; 关于 macro，可以看看这篇
+;; http://blog.csdn.net/ithomer/article/details/17590193
+
 (defmacro unless [test ifnil iftrue]
   `(if ~test ~iftrue ~ifnil))

+;; List 实现
+
+(defmacro unless [test ifnil iftrue]
+  (list 'if test iftrue ifnil))
+
 (unless false (println "TRUE") (println "FALSE"))


updating tests

updating tests

--- test/desdemona/ui/table_test.cljs
+++ test/desdemona/ui/table_test.cljs
@@ -1,8 +1,17 @@
 (ns desdemona.ui.table-test
   (:require
    [desdemona.ui.table :as table]
-   [cljs.test :as t :refer-macros [deftest testing is are]]))
+   [cljs.test :as t :refer-macros [deftest testing is are]]
+   [reagent.core :as r]
+   [cljs.core.match :refer-macros [match]]))

 (deftest table-component-test
-  (is (= (table/table-component)
-         [:div [:h2 "Table"]])))
+  (let [state (r/atom {:results [{:a 1 :b 2}
+                                 {:a 4 :b 2}]})
+        component (table/table-component state)
+        [table wrapper-class] (match component
+                                [:div {:class "container-fluid"}
+                                 [:div {:class wrapper-class}
+                                  table]]
+                                [table wrapper-class])]
+    (is (= wrapper-class "table-responsive table-sorted"))))


Add test to validate that style properties with dashes work

--- test/reagenttest/testreagent.cljs
+++ test/reagenttest/testreagent.cljs
@@ -1019,3 +1019,8 @@
         (r/flush)
         (is (= @spy 0))))
     (is (= @node nil))))
+
+(deftest style-property-names-are-camel-cased
+  (is (= "
foo
"
+         (server/render-to-static-markup
+           [:div {:style {:text-align "center"}} "foo"]))))


CMR-5588: Cleanup test.

CMR-5588: Cleanup test.

--- system-int-test/test/cmr/system_int_test/search/granule_search_format_test.clj
+++ system-int-test/test/cmr/system_int_test/search/granule_search_format_test.clj
@@ -562,9 +562,7 @@
       (testing "granule size is double"
         (let [response (search/find-concepts-atom :granule {:concept-id (:concept-id gran1)})]
           (is (= (Double/MAX_VALUE)
-                 (-> (get-in response [:results :entries])
-                     first
-                     :size))))))
+                 (-> response :results :entries first :size))))))

     (testing "json"
       (let [gran-json (dj/granules->expected-json [gran1] [coll1] "granules.json?granule_ur=Granule1")


Improve the printout on the tests when they fail. clip.

--- test/random_access_map/core_test.clj
+++ test/random_access_map/core_test.clj
@@ -102,16 +102,20 @@
 (defn actual-count [tree]
   (let [t (.tree tree)
         rec (fn rec [t]
-              (let [t (.tree tree)]
-                (match [t]
+              (match [t]
                        [:black-leaf] 0
                        [:double-black-leaf] 0
                        [[c l k v s r]] (+ (rec l) (rec r) 1)
                        :else
                        (ex-info "Actual count called on a non-tree."
                                 {:type :ram-test/actual-count/invalid-input
-                                 :tree tree}))))]
+                                 :tree tree})))]
     (rec t)))
+(defn kvp
+  ([v]
+     (clojure.lang.MapEntry. (k v) v))
+  ([a b]
+     (clojure.lang.MapEntry. (k a) b)))

 (defn valid-colors?
   "Checks to see if all colors are either red or black."
@@ -133,30 +137,29 @@
 (defn set->map
   [s]
   (reduce conj {}
-          (map (fn [k v] (clojure.lang.MapEntry. k v))
+          (map (fn [k v] (kvp k v))
                (range (count s))
                (sort (seq s)))))
-
-
+(defn standard-print [m s]
+  (str "\nThe tested map is:\n" m "\n\nThe tested coll is:\n" s))

 (defn standard-tests [name m s]
-  (testing (str "Testing the basics of " name "...")
+  (testing (str "Testing the basics of " name "." (standard-print m s))
     (is (balanced? m))
     (is (valid-colors? m))
     (is (= (count m) (actual-count m))))
-  (testing (str "Testing find and get of " name "...")
-    (doseq [thing (seq s)]
-      (is (= (find m (k thing)) (clojure.lang.MapEntry. (k thing) thing)))
+  (doseq [thing (seq s)]
+    (testing (str "Testing find and get of " thing " in " name "." (standard-print m s))
+      (is (= (find m (k thing)) (kvp thing)))
       (is (= (get m (k thing)) thing))))
-  (testing (str "Testing nth of " name "...")
-    (let [e (vec (sort (seq s)))
-          f (fn f [v x]
-              (if (>= x (count v))
-                nil
-                (do
-                  (is (= (nth m x) (nth v x)))
-                  (recur v (inc x)))))]
-      (f e 0))))
+  (let [e (vec (sort (seq s)))]
+    ((fn [v x]
+            (if (>= x (count v))
+              nil
+              (do
+                (testing (str "Testing nth of " x " in " name "." (standard-print m v))
+                  (is (= (nth m x) (kvp x (nth v x)))))
+                  (recur v (inc x))))) e 0)))

 (defn test-ranges [name
                    ins-range


Don't apply padding/margin reset to all

Don't apply padding/margin reset to all

--- frontend/styles/faceboard/css/page.clj
+++ frontend/styles/faceboard/css/page.clj
@@ -3,7 +3,7 @@
   (:require [faceboard.lib.helpers :refer [>> mv px]]))

 (def styles
-  [(>> *
+  [(>> :body
      [:margin (px 0)
       :padding (px 0)])
    (>> :html :body :#app main-box page [page page-content]


changing the default to 256M

changing the default to 256M

--- src/blackbox/src/leela/blackbox/storage/cassandra.clj
+++ src/blackbox/src/leela/blackbox/storage/cassandra.clj
@@ -51,56 +51,56 @@
      cluster :graph
      (if-not-exists)
      (column-definitions {:a :uuid :l :varchar :b :uuid :primary-key [[:a :l] :b]})
-     (with {:compaction {:class "LeveledCompactionStrategy" :sstable_size_in_mb "128"}})))
+     (with {:compaction {:class "LeveledCompactionStrategy" :sstable_size_in_mb "256"}})))
   (when-not (describe-table cluster keyspace :n_naming)
     (warn "creating table n_naming")
     (create-table
      cluster :n_naming
      (if-not-exists)
      (column-definitions {:user :varchar :tree :varchar :kind :varchar :node :varchar :guid :uuid :primary-key [[:user :tree :kind] :node]})
-     (with {:compaction {:class "LeveledCompactionStrategy" :sstable_size_in_mb "128"}})))
+     (with {:compaction {:class "LeveledCompactionStrategy" :sstable_size_in_mb "256"}})))
   (when-not (describe-table cluster keyspace :g_naming)
     (warn "creating table g_naming")
     (create-table
      cluster :g_naming
      (if-not-exists)
      (column-definitions {:guid :uuid :user :varchar :tree :varchar :kind :varchar :node :varchar :primary-key [:guid]})
-     (with {:compaction {:class "LeveledCompactionStrategy" :sstable_size_in_mb "128"}})))
+     (with {:compaction {:class "LeveledCompactionStrategy" :sstable_size_in_mb "256"}})))
   (when-not (describe-table cluster keyspace :t_attr)
     (warn "creating table t_attr")
     (create-table
      cluster :t_attr
      (if-not-exists)
      (column-definitions {:key :uuid :name :varchar :bucket :bigint :slot :int :data :blob :primary-key [[:key :name :bucket] :slot]})
-     (with {:compaction {:class "LeveledCompactionStrategy" :sstable_size_in_mb "128"}})))
+     (with {:compaction {:class "LeveledCompactionStrategy" :sstable_size_in_mb "256"}})))
   (when-not (describe-table cluster keyspace :k_attr)
     (warn "creating table k_attr")
     (create-table
      cluster :k_attr
      (if-not-exists)
      (column-definitions {:key :uuid :name :varchar :value :blob  :primary-key [[:key :name]]})
-     (with {:compaction {:class "LeveledCompactionStrategy" :sstable_size_in_mb "128"}})))
+     (with {:compaction {:class "LeveledCompactionStrategy" :sstable_size_in_mb "256"}})))
   (when-not (describe-table cluster keyspace :g_index)
     (warn "creating table g_index")
     (create-table
      cluster :g_index
      (if-not-exists)
      (column-definitions {:key :uuid :name :varchar :primary-key [[:key] :name]})
-     (with {:compaction {:class "LeveledCompactionStrategy" :sstable_size_in_mb "128"}})))
+     (with {:compaction {:class "LeveledCompactionStrategy" :sstable_size_in_mb "256"}})))
   (when-not (describe-table cluster keyspace :k_index)
     (warn "creating table k_index")
     (create-table
      cluster :k_index
      (if-not-exists)
      (column-definitions {:key :uuid :name :varchar :primary-key [[:key] :name]})
-     (with {:compaction {:class "LeveledCompactionStrategy" :sstable_size_in_mb "128"}})))
+     (with {:compaction {:class "LeveledCompactionStrategy" :sstable_size_in_mb "256"}})))
   (when-not (describe-table cluster keyspace :t_index)
     (warn "creating table t_index")
     (create-table
     cluster :t_index
      (if-not-exists)
      (column-definitions {:key :uuid :name :varchar :primary-key [[:key] :name]})
-     (with {:compaction {:class "LeveledCompactionStrategy" :sstable_size_in_mb "128"}}))))
+     (with {:compaction {:class "LeveledCompactionStrategy" :sstable_size_in_mb "256"}}))))

 (defmacro with-connection [[conn endpoint options] & body]
   `(let [~conn (.connect (client/build-cluster {:hosts ~endpoint