add arity to accept col-args in make-columns-reader

--- src/asphalt/result.clj
+++ src/asphalt/result.clj
@@ -73,22 +73,29 @@

 (defn make-columns-reader
   "Given result column types, return a type-aware, efficient columns-reading function."
-  [result-types]
-  (i/expected vector? "vector of result types" result-types)
-  (doseq [t result-types]
-    (when-not (contains? t/single-typemap t) (i/expected-result-type t)))
-  (let [rsyms (-> (count result-types)
-                (repeatedly gensym)
-                vec)
-        rlhs  (mapv vector rsyms result-types)]
-    (eval `(fn row-maker#
-             ([^ResultSet result-set# ^long col-count#]
-               (when-not (= col-count# ~(count result-types))
-                 (i/expected ~(str (count result-types) " columns") col-count#))
-               (letcol [~rlhs result-set#]
-                 ~rsyms))
-             ([sql-source# ^ResultSet result-set# ^long col-count#]
-               (row-maker# result-set# col-count#))))))
+  ([result-types col-args]
+    (i/expected vector? "vector of result types" result-types)
+    (i/expected vector? "vector of column args" col-args)
+    (when-not (= (count result-types) (count col-args))
+      (i/expected (format "length of result-types (%d) and col-args (%d) to be the same"
+                    (count result-types) (count col-args))
+        {:result-types result-types :col-args col-args}))
+    (doseq [t result-types]
+      (when-not (contains? t/single-typemap t) (i/expected-result-type t)))
+    (let [rsyms (-> (count result-types)
+                  (repeatedly gensym)
+                  vec)
+          rlhs  (mapv vector rsyms result-types col-args)]
+      (eval `(fn row-maker#
+               ([^ResultSet result-set# ^long col-count#]
+                 (when-not (= col-count# ~(count result-types))
+                   (i/expected ~(str (count result-types) " columns") col-count#))
+                 (letcol [~rlhs result-set#]
+                   ~rsyms))
+               ([sql-source# ^ResultSet result-set# ^long col-count#]
+                 (row-maker# result-set# col-count#))))))
+  ([result-types]
+    (make-columns-reader result-types (mapv (constantly nil) result-types))))

 (defn make-column-value-reader


Refactoring: renaming method used to compare urls

--- src/cloogling/core.clj
+++ src/cloogling/core.clj
@@ -65,7 +65,7 @@
     )
   )

-(defn get-url
+(defn get-url-for-comparison
   [x]
   (-> x
      :url
@@ -78,7 +78,7 @@
 (defn get-common-urls
   [one two]
   (for [ item one
-  :when (contains? (clojure.set/intersection (set (map get-url one)) (set (map get-url two))) (get-url item) )]
+  :when (contains? (clojure.set/intersection (set (map get-url-for-comparison one)) (set (map get-url-for-comparison two))) (get-url-for-comparison item) )]
     (:url item)))


Put start in a function so loading NS doesn't start

--- clojure/src/life/core.clj
+++ clojure/src/life/core.clj
@@ -119,16 +119,17 @@
    (q/fill 255 255 255)
    (q/text "PAUSED" 8 29)))

-(q/defsketch life
-  :title "Game of life"
-  :size (let [size (* board-size cell-size)] [size size])
-  :setup setup
-  :update update-state
-  :draw draw-state
-  :key-pressed key-pressed
-  :mouse-clicked mouse-clicked
-  :features [:keep-on-top]
-  :middleware [m/fun-mode])
+(defn start []
+  (q/defsketch life
+    :title "Game of life"
+    :size (let [size (* board-size cell-size)] [size size])
+    :setup setup
+    :update update-state
+    :draw draw-state
+    :key-pressed key-pressed
+    :mouse-clicked mouse-clicked
+    :features [:keep-on-top]
+    :middleware [m/fun-mode]))

 (defn -main []
-  (println "Booted!?"))
+  (start))


Add another test for `possible-moves'

Add another test for `possible-moves'

--- test/tttclj/t_core.clj
+++ test/tttclj/t_core.clj
@@ -26,4 +26,6 @@

 (facts "about `possible-moves'"
        (fact "there should be 9 to start"
-             (count (possible-moves (create-game))) => 9))
+             (count (possible-moves (create-game))) => 9)
+       (fact "there should be 8 after the first move"
+             (count (possible-moves game1)) => 8))


cleanup

cleanup

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

--- sandbox/AcquisitionEngine/src/main/java/main/sequence_generator.clj
+++ sandbox/AcquisitionEngine/src/main/java/main/sequence_generator.clj
@@ -1,31 +1,12 @@
-(ns sequence-generator
- ;(:require )
- ;(:use )
- ;(:import )
- [:gen-class]
- )
+(ns sequence-generator)

 (defstruct channel :name :exposure :z-offset :use-z-stack :skip-frames)
-
-(def my-channels
-  [(struct channel "Cy3" 100 0 true 0)
-   (struct channel "Cy5"  50 0 false 0)
-   (struct channel "DAPI" 50 0 true 0)])

 (defstruct acq-settings :frames :positions :channels :slices :slices-first
   :time-first :keep-shutter-open-slices :keep-shutter-open-channels
   :use-autofocus :autofocus-skip :relative-slices :exposure)

-(def default-settings
-  (struct-map acq-settings
-    :frames (range 100) :positions [{:name "a" :x 1 :y 2} {:name "b" :x 4 :y 5}]
-    :channels my-channels :slices (range 5)
-    :interval 5 :slices-first true :time-first true
-    :keep-shutter-open-slices false :keep-shutter-open-channels true
-    :use-autofocus true :autofocus-skip 3 :relative-slices true :exposure 100
-    :interval-ms 1000))
-
-(def settings default-settings)
+(declare settings)

 (defn pairs [x]
   (partition 2 1 (concat x [nil])))
@@ -100,8 +81,29 @@
           0
           (settings :interval-ms))))))

+(defn generate-acq-sequence [seq-settings]
+  (binding [settings seq-settings]
+    (-> (make-main-loops)
+      process-skip-z-stack
+      manage-shutter
+      process-use-autofocus
+      process-wait-time)))
+
 ; Testing:

+(def my-channels
+  [(struct channel "Cy3" 100 0 true 0)
+   (struct channel "Cy5"  50 0 false 0)
+   (struct channel "DAPI" 50 0 true 0)])
+
+(def default-settings
+  (struct-map acq-settings
+    :frames (range 100) :positions [{:name "a" :x 1 :y 2} {:name "b" :x 4 :y 5}]
+    :channels my-channels :slices (range 5)
+    :interval 5 :slices-first true :time-first true
+    :keep-shutter-open-slices false :keep-shutter-open-channels true
+    :use-autofocus true :autofocus-skip 3 :relative-slices true :exposure 100
+    :interval-ms 1000))

 (def test-settings
@@ -115,22 +117,16 @@

 (def null-settings
   (struct-map acq-settings
-    :frames (range 100) :positions [{:name "a" :x 1 :y 2} {:name "b" :x 4 :y 5}]
-    :channels my-channels :slices (range 5)
-    :interval 5 :slices-first true :time-first true
+    :frames (range 96)
+    :positions (range 1536)
+    :channels [(struct channel "Cy3" 100 0 true 0)
+               (struct channel "Cy5"  50 0 true 0)]
+    :slices nil
+    :interval 5 :slices-first true :time-first false
     :keep-shutter-open-slices false :keep-shutter-open-channels true
     :use-autofocus true :autofocus-skip 3 :relative-slices true :exposure 100
     :interval-ms 100))

-(defn generate-acq-sequence [seq-settings]
-  (binding [settings seq-settings]
-    (-> (make-main-loops)
-      process-skip-z-stack
-      manage-shutter
-      process-use-autofocus
-      process-wait-time)))
-
-
 (def result (generate-acq-sequence null-settings))

-(count result)+;(count result)


Adapt tests.

Adapt tests.

--- test/suricatta/dsl_test.clj
+++ test/suricatta/dsl_test.clj
@@ -41,35 +41,27 @@
       (is (= bv [2]))))

   (testing "Select clause with field as condition and alias"
-    (let [q (-> (dsl/select ["foo > 5" "bar"])
+    (let [q (-> (dsl/select '("foo > 5" "bar"))
                 (dsl/from "baz"))]
       (is (= (fmt/get-sql q)
              "select foo > 5 \"bar\" from baz"))))

   (testing "Select clause with count(*) expresion"
-    (let [q (-> (dsl/select ["count(*)" "count"])
+    (let [q (-> (dsl/select '("count(*)" "count"))
                 (dsl/from "baz"))]
       (is (= (fmt/get-sql q)
              "select count(*) \"count\" from baz"))))

-  (testing "Select with two tables in from clause"
-    (let [q (-> (dsl/select-one)
-                (dsl/from
-                 (dsl/table "table1" {:alias "foo"})
-                 (dsl/table "table2" {:alias "bar"})))]
+  (testing "Select with two tables in from clause 2"
+    (let [q (-> (dsl/select-one)
+                (dsl/from '("table1" "foo")
+                          '("table2" "bar")))]
       (is (= (fmt/get-sql q)
              "select 1 \"one\" from table1 \"foo\", table2 \"bar\""))))

-  (testing "Select with two tables in from clause 2"
-    (let [q (-> (dsl/select-one)
-                (dsl/from ["table1" "foo"]
-                          ["table2" "bar"]))]
-      (is (= (fmt/get-sql q)
-             "select 1 \"one\" from table1 \"foo\", table2 \"bar\""))))
-
   (testing "Select clause with join"
     (let [q (-> (dsl/select-one)
-                (dsl/from (dsl/table "book"))
+                (dsl/from "book")
                 (dsl/join "author")
                 (dsl/on "book.authorid = book.id"))]
       (is (= (fmt/get-sql q)
@@ -77,8 +69,8 @@

   (testing "Select clause with join and aliases"
     (let [q (-> (dsl/select-one)
-                (dsl/from ["book" "b"])
-                (dsl/join ["author" "a"])
+                (dsl/from '("book" "b"))
+                (dsl/join '("author" "a"))
                 (dsl/on "b.authorid = a.id"))]
       (is (= (fmt/get-sql q)
              "select 1 \"one\" from book \"b\" join author \"a\" on (b.authorid = a.id)"))))
@@ -226,7 +218,7 @@
                  (-> (dsl/values
                       (dsl/row 1 2)
                       (dsl/row 3 4))
-                     (dsl/as-table "t1" "f1" "f2"))))]
+                     (dsl/to-table "t1" "f1" "f2"))))]
       (is (= (fmt/get-sql q {:dialect :pgsql})
              "select f1, f2 from (values(?, ?), (?, ?)) as \"t1\"(\"f1\", \"f2\")"))))

@@ -241,7 +233,7 @@
     (let [q (-> (dsl/select)
                 (dsl/from (-> (dsl/select :f1)
                               (dsl/from :t1)
-                              (dsl/as-table "tt1" "f1"))))]
+                              (dsl/to-table "tt1" "f1"))))]
       (is (= (fmt/get-sql q {:dialect :pgsql})
              "select \"tt1\".\"f1\" from (select f1 from t1) as \"tt1\"(\"f1\")"))))

@@ -249,7 +241,7 @@
     (let [sq (-> (dsl/select (dsl/field "count(*)"))
                  (dsl/from :book)
                  (dsl/where "book.authorid = author.id"))
-          q  (-> (dsl/select :fullname, (dsl/as-field sq "books"))
+          q  (-> (dsl/select :fullname, (dsl/field sq "books"))
                  (dsl/from :author))]
       (is (= (fmt/get-sql q)
              "select fullname, (select count(*) from book where (book.authorid = author.id)) \"books\" from author"))))
@@ -284,6 +276,12 @@
       (is (= (fmt/get-sql q)
              "update t1 set id = ?, name = ?"))))

+  (testing "Update statement without condition and using function"
+    (let [q (-> (dsl/update :t1)
+                (dsl/set :val (dsl/f ["concat(val, ?)" "bar"])))]
+      (is (= (fmt/sqlvec q)
+             ["update t1 set val = concat(val, ?)" "bar"]))))
+
   (testing "Update statement with condition"
     (let [q (-> (dsl/update :t1)
                 (dsl/set :name "foo")
@@ -326,24 +324,25 @@

 (deftest dsl-common-table-expressions
   (testing "Common table expressions"
-    (let [cte1 (-> (dsl/name :t1)
-                   (dsl/with-fields :f1 :f2)
-                   (dsl/as-table (dsl/select (dsl/val 1) (dsl/val "a"))))
-          cte2 (-> (dsl/name :t2)
-                   (dsl/with-fields :f1 :f2)
-                   (dsl/as-table (dsl/select (dsl/val 2) (dsl/val "b"))))
-          q1   (-> (dsl/with cte1 cte2)
-                   (dsl/select (dsl/field "t1.f2"))
-                   (dsl/from :t1 :t2))
+    (let [
+          ;; cte1 (-> (dsl/name :t1)
+          ;;          (dsl/with-fields :f1 :f2)
+          ;;          (dsl/to-table (dsl/select (dsl/val 1) (dsl/val "a"))))
+          ;; cte2 (-> (dsl/name :t2)
+          ;;          (dsl/with-fields :f1 :f2)
+          ;;          (dsl/to-table (dsl/select (dsl/val 2) (dsl/val "b"))))
+          ;; q1   (-> (dsl/with cte1 cte2)
+          ;;          (dsl/select (dsl/field "t1.f2"))
+          ;;          (dsl/from :t1 :t2))

           ;; Same as previous code but less verbose.
           q    (-> (dsl/with
                     (-> (dsl/name :t1)
                         (dsl/with-fields :f1 :f2)
-                        (dsl/as-table (dsl/select (dsl/val 1) (dsl/val "a"))))
+                        (dsl/to-table (dsl/select (dsl/val 1) (dsl/val "a"))))
                     (-> (dsl/name :t2)
                         (dsl/with-fields :f1 :f2)
-                        (dsl/as-table (dsl/select (dsl/val 2) (dsl/val "b")))))
+                        (dsl/to-table (dsl/select (dsl/val 2) (dsl/val "b")))))
                    (dsl/select (dsl/field "t1.f2"))
                    (dsl/from :t1 :t2))
           sql  (fmt/get-sql q {:type :inlined :dialect :pgsql})


Add data payload to events.

Add data payload to events.

--- src/forces_assemble/handler.clj
+++ src/forces_assemble/handler.clj
@@ -124,6 +124,7 @@
    :priority "high"
    :notification {:title (or (:title event) "")
                   :body (or (:body event) "")
+                  :data (or (:data event) {})
                   :sound "default"}})

 (defn add-event-to-channel


extract function get-preceding-items

extract function get-preceding-items


Doc string.

Doc string.


[FIX] `LOG=1` now works when format string contains '%' (like in a URL)

--- src/layzee/adapters/twitter.clj
+++ src/layzee/adapters/twitter.clj
@@ -42,9 +42,9 @@
         (filter tweet-filter (:statuses (json/read-str (:body reply) :key-fn keyword)))))))

 (def log ^{:private true}
-     (fn[msg & args]
+     (fn [msg & args]
        (when settings/log?
-         (println (str "[log] " (apply format (str msg) args))))))
+         (println (str "[log] " (apply format (.replace (str msg) "%" "%%") args))))))

 (defn lazy-web [consumer-token & opts]
   (let [token (bearer-token-for consumer-token)]


Changed ClojureScript optimization level to :none.

--- scripts/build.clj
+++ scripts/build.clj
@@ -8,7 +8,7 @@
    {:main 'cats.runner
     :output-to "out/tests.js"
     :output-dir "out"
-    :optimizations :simple
+    :optimizations :none
     :target :nodejs
     :verbose true})
   (println "... done. Elapsed" (/ (- (System/nanoTime) start) 1e9) "seconds"))


update deps

update deps

--- kafka-clj/project.clj
+++ kafka-clj/project.clj
@@ -26,8 +26,8 @@
                  [org.xerial.snappy/snappy-java "1.1.1-M1"]
                  [org.clojure/tools.logging "0.2.6"]
                  [clj-tcp "0.2.19-SNAPSHOT"]
-                 [fmap-clojure "0.1.4"]
-                 [fun-utils "0.4.0"]
+                 [fmap-clojure "LATEST"]
+                 [fun-utils "LATEST"]
                  [clj-tuple "0.1.4"]
                  [clj-json "0.5.3"]
                  [com.codahale.metrics/metrics-core "3.0.1"]


Remove unused function :yum:

Remove unused function :yum:

--- src/metabase/models/setting.clj
+++ src/metabase/models/setting.clj
@@ -321,14 +321,6 @@
   ;; irrelevant changes (to other settings) are made.
   (events/publish-event :settings-update settings))

-
-(defn- obfuscated-env-var-value
-  "If SETTING was set via env var, return an obfuscated string like `USING $MB_MY_SETTING`.
-   This is meant to be user-facing (it is shown in the admin panel settings page)."
-  ^String [setting]
-  (when (env-var-value setting)
-    (format "Using $%s" (env-var-name setting))))
-
 (defn all
   "Return a sequence of Settings maps, including value and description.
    (For security purposes, this doesn't return the value of a setting if it was set via env var)."
@@ -339,17 +331,6 @@
      :value       (when (not= v (env-var-value setting))
                     v)
      :description (:description setting)
-     :default     (or (obfuscated-env-var-value setting)
+     :default     (or (when (env-var-value setting)
+                        (format "Using $%s" (env-var-name setting)))
                       (:default setting))}))
-
-
-(defn- settings-list
-  "Return a list of all Settings (as created with `defsetting`).
-   This excludes Settings created with the option `:internal?`."
-  []
-  (for [[k setting] @registered-settings
-        :when       (not (:internal? setting))]
-    {:key         k
-     :description (:description setting)
-     :default     (or (obfuscated-env-var-value setting)
-                      (:default setting))}))


Loop listeners & close chs.

Loop listeners & close chs.

--- src/onyx/peer/task_pipeline.clj
+++ src/onyx/peer/task_pipeline.clj
@@ -1,30 +1,41 @@
 (ns onyx.peer.task-pipeline
-  (:require [clojure.core.async :refer [chan]]
+  (:require [clojure.core.async :refer [chan close!]]
             [com.stuartsierra.component :as component]
             [onyx.queue.hornetq :refer [hornetq]]
             [onyx.extensions :as extensions]))

-(defn open-session-loop [read-ch])
+(defn open-session-loop [read-ch]
+  (loop []))

-(defn read-batch-loop [read-ch decompress-ch])
+(defn read-batch-loop [read-ch decompress-ch]
+  (loop []))

-(defn decompress-tx-loop [decompress-ch apply-fn-ch])
+(defn decompress-tx-loop [decompress-ch apply-fn-ch]
+  (loop []))

-(defn apply-fn-loop [apply-fn-ch compress-ch])
+(defn apply-fn-loop [apply-fn-ch compress-ch]
+  (loop []))

-(defn compress-tx-loop [compress-ch write-batch-ch])
+(defn compress-tx-loop [compress-ch write-batch-ch]
+  (loop []))

-(defn write-batch-loop [write-ch status-check-ch])
+(defn write-batch-loop [write-ch status-check-ch]
+  (loop []))

-(defn status-check-loop [status-ch commit-tx-ch])
+(defn status-check-loop [status-ch commit-tx-ch]
+  (loop []))

-(defn commit-tx-loop [commit-ch close-session-ch])
+(defn commit-tx-loop [commit-ch close-session-ch]
+  (loop []))

-(defn close-session-loop [close-ch complete-task-ch])
+(defn close-session-loop [close-ch complete-task-ch]
+  (loop []))

-(defn complete-task-loop [complete-ch reset-payload-node-ch])
+(defn complete-task-loop [complete-ch reset-payload-node-ch]
+  (loop []))

-(defn reset-payload-node-loop [reset-ch])
+(defn reset-payload-node-loop [reset-ch]
+  (loop []))

 (defrecord TaskPipeline [payload-node]
   component/Lifecycle
@@ -70,6 +81,17 @@
   (stop [component]
     (prn "Stopping Task Pipeline")

+    (close! (:read-batch-ch component))
+    (close! (:decompress-tx-ch component))
+    (close! (:apply-fn-ch component))
+    (close! (:compress-tx-ch component))
+    (close! (:write-batch-ch component))
+    (close! (:status-check-ch component))
+    (close! (:commit-tx-ch component))
+    (close! (:close-session-ch component))
+    (close! (:complete-task-ch component))
+    (close! (:reset-payload-node-ch component))
+
     (future-cancel (:open-session-loop component))
     (future-cancel (:read-batch-loop component))
     (future-cancel (:decompress-tx-loop component))


Removed the z-coordinates from the generated vertices.

--- src/petulant_life/rendering.clj
+++ src/petulant_life/rendering.clj
@@ -30,7 +30,7 @@
         (GL15/glBufferData GL15/GL_ARRAY_BUFFER bvs GL15/GL_STATIC_DRAW)

         ;; Loading the VBO into the VAO.
-        (GL20/glVertexAttribPointer 0 3 GL11/GL_FLOAT false 0 0)
+        (GL20/glVertexAttribPointer 0 2 GL11/GL_FLOAT false 0 0)

         ;; Performing the callback with the VAO.
         (callback vao vct)
@@ -45,12 +45,12 @@
 ;; Generating the vertices for a rectangle. Despite it being a rectangle, it
 ;; requires 6 points to be rendered using using a VAO.
 (defn generate-rectangle [[x y w h]]
-  [[x y 0]
-   [x (+ y h) 0]
-   [(+ x w) (+ y h) 0]
-   [x y 0]
-   [(+ x w) (+ y h) 0]
-   [(+ x w) y 0]])
+  [[x y]
+   [x (+ y h)]
+   [(+ x w) (+ y h)]
+   [x y]
+   [(+ x w) (+ y h)]
+   [(+ x w) y]])

 ;; Generating a number of rectangles.
 (defn generate-rectangles [rects]


Have math.clusters compiling now (require vs use cleanup)

--- src/polismath/math/clusters.clj
+++ src/polismath/math/clusters.clj
@@ -16,7 +16,7 @@
             [clojure.core.matrix.select :as matrix-select]
             ))

-(set-current-implementation :vectorz)
+(matrix/set-current-implementation :vectorz)

 (defn clst-append
@@ -47,7 +47,7 @@
     (map-indexed
       (fn [id position] {:id id :members [] :center (matrix/matrix position)})
       ; Have to make sure we don't have identical cluster centers
-      (distinct (rows (nm/get-matrix data))))))
+      (distinct (matrix/rows (nm/get-matrix data))))))

 (defn same-clustering?
@@ -86,7 +86,7 @@
              (matrix/multiply-row m row-i weight))
            mat
            (utils/with-indices weights))))
-    (matrix-stats/mean (matrix mat))))
+    (matrix-stats/mean (matrix/matrix mat))))

 ; It's a vector...
 (defmethod weighted-mean [false true]
@@ -213,7 +213,7 @@
         ; next make sure we're not dealing with any clusters that are identical to eachother
         uniq-clusters (uniqify-clusters clusters)
         ; count uniq data points to figure out how many clusters are possible
-        possible-clusters (min k (count (distinct (rows (nm/get-matrix data)))))]
+        possible-clusters (min k (count (distinct (matrix/rows (nm/get-matrix data)))))]
     (loop [clusters uniq-clusters]
       ; Whatever the case here, we want to do one more recentering
       (let [clusters (recenter-clusters data clusters :weights weights)]
@@ -256,7 +256,7 @@
               (pc/fn->> :members (map trans) set)
               clsts)
    :center (map
-             (pc/fn->> :center (mapv #(round-to % 4)))
+             (pc/fn->> :center (mapv #(utils/round-to % 4)))
              clsts)})

@@ -264,7 +264,7 @@
 (defn kmeans
   "Performs a k-means clustering."
   [data k & {:keys [last-clusters max-iters weights] :or {max-iters 20}}]
-  (let [data-iter (zip (nm/rownames data) (matrix (nm/get-matrix data)))
+  (let [data-iter (utils/zip (nm/rownames data) (matrix/matrix (nm/get-matrix data)))
         clusters  (if last-clusters
                     (clean-start-clusters data last-clusters k :weights weights)
                     (init-clusters data k))]
@@ -279,7 +279,7 @@
   "Dist matrix"
   ([m] (dist-matrix m m))
   ([m1 m2]
-   (matrix
+   (matrix/matrix
      (map
        (fn [r1]
          (map
@@ -293,7 +293,7 @@
   "Distance matrix with rownames and colnames corresponding to rownames of nm1 and nm2 respectively."
   ([nm] (named-dist-matrix nm nm))
   ([nm1 nm2]
-   (named-matrix
+   (nm/named-matrix
      (nm/rownames nm1)
      (nm/rownames nm2)
      (dist-matrix (nm/get-matrix nm1) (nm/get-matrix nm2)))))
@@ -376,7 +376,7 @@

 (defn xy-clusters-to-nmat [clusters]
-  (let [nmat (named-matrix)]
+  (let [nmat (nm/named-matrix)]
     (nm/update-nmat
      nmat
      (apply concat ; flatten the list of lists below
@@ -393,9 +393,9 @@

 (defn xy-clusters-to-nmat2 [clusters]
-  (named-matrix
+  (nm/named-matrix
     (map :id clusters) ; row names
     [:x :y] ; column names
-    (matrix (map :center clusters))))
-
-
+    (matrix/matrix (map :center clusters))))
+
+


Explanatory comment for channels.clj

Explanatory comment for channels.clj

--- resources/leiningen/new/kraken_works/channels.clj
+++ resources/leiningen/new/kraken_works/channels.clj
@@ -1,6 +1,13 @@
 (ns {{name}}.channels
   (:require [clojure.core.async :as async]))

+;;; This namespace is for core.async channels used by kehaar. Channels
+;;; only need to be created for ougoing events and external
+;;; services. If neither are required, this namespace can be
+;;; removed. Add any created channels to the vector of channels
+;;; defined in `close-all!`.
+
 (defn close-all! []
-  (doseq [c []]
-    (async/close! c)))
+  (let [channels []]
+    (doseq [c channels]
+      (async/close! c))))


Some golfing.

Some golfing.

--- clojure/src/advent2017/day11.clj
+++ clojure/src/advent2017/day11.clj
@@ -9,16 +9,6 @@

 (def puzzle (read-puzzle "day11.data" (comp ->csv first ->lines)))

-(defn cube-distance
-  ([[dx dy dz]]
-   (cube-distance [0 0 0] [dx dy dz]))
-  ([[sx sy sz] [dx dy dz]]
-   (/ (+ (Math/abs (- sx dx))
-         (Math/abs (- sy dy))
-         (Math/abs (- sz dz))) 2)))
-
-(defn step [pos off] (mapv + pos off))
-
 (def dir->offset
   {"se" [(+ 1) (- 1)   0  ]
    "ne" [(+ 1)   0   (- 1)]
@@ -26,6 +16,12 @@
    "nw" [(- 1) (+ 1)   0  ]
    "sw" [(- 1)   0   (+ 1)]
    "s"  [  0   (- 1) (+ 1)]})
+
+(defn cube-distance
+  ([a] (cube-distance [0 0 0] a))
+  ([a b] (/ (apply + (map (comp #(Math/abs %) -) a b)) 2)))
+
+(defn step [pos off] (mapv + pos off))

 (defn navigation [input]
   (reductions step [0 0 0] (map dir->offset input)))


defpipeline now returns the pipeline, not its metadata

--- src/tabular/grafter/tabular.clj
+++ src/tabular/grafter/tabular.clj
@@ -598,7 +598,8 @@
    (let [defppln (cons 'defn args)]
      `(let [var# ~defppln
             vmeta# (meta var#)]
-        (alter-meta! var# (fn [_#] (merge vmeta# {:pipeline true})))))))
+        (alter-meta! var# (fn [_#] (merge vmeta# {:pipeline true})))
+        var#))))

 (comment
   ;; TODO implement inner join, maybe l/r outer joins too


re-add sends_gelf sg for terraform integrity

--- src/terraboot/elasticsearch.clj
+++ src/terraboot/elasticsearch.clj
@@ -91,6 +91,7 @@

              (route53_record "logstash" {:records [(vpc-output-of "aws_eip" "logstash" "public_ip")]})
+             (vpc-security-group "sends_gelf" {})

              (vpc-security-group "sends_logstash" {})


fix secretary compiler warnings

fix secretary compiler warnings

--- src-cljs/frontend/routes.cljs
+++ src-cljs/frontend/routes.cljs
@@ -2,10 +2,10 @@
   (:require [cljs.core.async :as async :refer [>! <! alts! chan sliding-buffer close!]]
             [clojure.string :as str]
             [frontend.async :refer [put!]]
+            [frontend.utils :as utils :include-macros true]
             [goog.events :as events]
-            [frontend.utils :as utils :include-macros true])
-  (:require-macros [cljs.core.async.macros :as am :refer [go go-loop alt!]]
-                   [secretary.core :refer [defroute]]))
+            [secretary.core :as secretary :include-macros true :refer-macros [defroute]])
+  (:require-macros [cljs.core.async.macros :as am :refer [go go-loop alt!]]))

 (defn define-spec-routes! [nav-ch]
   (defroute trailing-slash #"(.+)/$" [path]


Дальнейшие расширения omut

Дальнейшие расширения omut

--- src-cljs/ixinfestor/omut.cljs
+++ src-cljs/ixinfestor/omut.cljs
@@ -704,7 +704,8 @@
          paginator-app-init))

 (defn search-view [app owner
-                   {:keys [data-update-fn
+                   {:keys [chan-update
+                           data-update-fn
                            data-rendering-fn
                            add-button-fn]
                     :or {data-update-fn (fn [app]
@@ -717,8 +718,7 @@
   (reify
     om/IInitState
     (init-state [_]
-      {:chan-update (chan)})
-
+      {:chan-update (or chan-update (chan))})
     om/IWillMount
     (will-mount [this]
       (let [chan-update (om/get-state owner :chan-update)]


more comments

more comments

--- core/src/samsara_core/kernel.clj
+++ core/src/samsara_core/kernel.clj
@@ -29,6 +29,7 @@
 ;; * support for orthogonal concerns such as
 ;;   logging, and metrics collecting
 ;; * handling of exception on a message level
+;; * handling of the output-collector done properly
 ;;

 ;; runtime pipeline initialized by init-pipeline!


remove duplicate requires

remove duplicate requires

--- ssclj/jar/src/com/sixsq/slipstream/ssclj/resources/common/utils.clj
+++ ssclj/jar/src/com/sixsq/slipstream/ssclj/resources/common/utils.clj
@@ -5,7 +5,6 @@
     [clj-time.core :as time]
     [clj-time.format :as time-fmt]
     [clojure.spec.alpha :as s]
-    [clj-time.coerce :as c]
     [clj-time.coerce :as c]
     [com.sixsq.slipstream.ssclj.util.log :as logu])
   (:import


fixed 'about' spelling

fixed 'about' spelling

--- src/amindblowingworld/view_index.clj
+++ src/amindblowingworld/view_index.clj
@@ -105,19 +105,19 @@
         [:p "While growing up we were fascinated by game like "
          (link-to "http://en.wikipedia.org/wiki/Populous" "Populous")
          ". As children we encountered these first examples of simulating civilizations evolutions in computer games.
-            They were heroic attempts done in the poor hardware available at that time.
+            They were heroic attempts done in on the poor hardware available at that time.
             This is a small tribute to the kind of creation which captured our fantasy, a long time ago."]
         [:p "The game is settled in a content generated world. We used "
          (link-to "http://github.com/ftomassetti/lands" "Lands") " to produce that world.
             On top of it we simulated the evolution of different tribes. These are a few characteristics of that simulation:"]
         [:ul
-         [:li "Each tribe can own many villages, they spawn in the same area"]
+         [:li "Each tribe can own many villages; they spawn in the same area"]
          [:li "Each tribe has its own language: you will notice that the name of the tribe and the name of its villages sound similar"]
-         [:li "The size of villages depends on the environment (e.g., villages tend to grow bigger in Forest w.r.t. to sand desert)."]]
-        [:p "While these elements are not very evident in the game we like to think they contribute a bit to the atmosphere of the game."]
+         [:li "The size of villages depends on the environment (e.g., villages tend to grow bigger in Forest rather than in sand desert)."]]
+        [:p "While these elements are not very evident in the game, we like to think that they contribute a bit to the atmosphere of the game itself."]
         [:p "In this game the player has only the possibility to destroy, but destruction plays a fundamental role in the mysterious circle of life..."]
-        [:p "Finally, you will notice that two disasters have rather peculiar names. A member of our time comes
-                from Ukraine and we want to use this occasion to share our hope for peace in Ukraine."]
-        [:p "Maybe we could invite Putin to play this game and cause destruction here, leaving alone real people."]
+        [:p "Finally, you will notice that two disasters have rather peculiar names. A member of our team comes
+                from Ukraine and we would like to use this occasion to share our hope for peace in his country."]
+        [:p "Maybe we could invite Putin to play this game and cause destruction here, instead of hurting real people."]
         ]]
     ]]]))


Use all avaible tokens across multiple lines.


Fix missing red border from password fields with errors

--- src/braid/client/gateway/styles.cljs
+++ src/braid/client/gateway/styles.cljs
@@ -111,6 +111,7 @@
     [:&.invalid
      ["input[type=text]"
       "input[type=email]"
+      "input[type=password]"
       {:border-color vars/invalid-color}]

      [:.field


persistence options is just a map

persistence options is just a map

--- src/clj/elephantdb/cascalog/impl.clj
+++ src/clj/elephantdb/cascalog/impl.clj
@@ -8,13 +8,7 @@
   )

 (defn- serializable-persistence-options [options]
-  (when options
-    (HashMap.
-     (into
-      {}
-      (doseq [[k v] options]
-        [k (HashMap. v)]
-        )))))
+  (HashMap. options))

 (defn- serializable-list [l]
   (when l


fixed bug: after switching phones, the image of the old phone was still displayed

--- src/cljs/phonecat_re_frame/subs.cljs
+++ src/cljs/phonecat_re_frame/subs.cljs
@@ -29,9 +29,11 @@
       ;; Note how we are sequencing reactions above. Whenever the phone ratom changes the images ratom will change as well
       (reaction
         (if @phone-details
-          (if-let [image-url (:selected-image-url @phone-details)]
-            image-url
-            (first @images)))))))
+          (let [image-url (:selected-image-url @phone-details)]
+            ;; is the selected url from the current phone's images? (it could also belong to a previously selected phone)
+            (if (some #{image-url} @images)
+              image-url
+              (first @images))))))))

 (register-sub
   :phone-details


Calculate points using seperate atom

Calculate points using seperate atom

--- src/cljs/survivor_bootlist/core.cljs
+++ src/cljs/survivor_bootlist/core.cljs
@@ -6,7 +6,7 @@
 ;; State

 (def contestants (atom [
-                        {:id 1 :name "Carolyn" :out 18 :tribe "masaya" :locked true}
+                        {:id 1 :name "Carolyn" :out 0 :tribe "masaya"}
                         {:id 2 :name "Dan" :out 0 :tribe "escameca"}
                         {:id 3 :name "Hali" :out 0 :tribe "nagarote"}
                         {:id 4 :name "Jenn" :out 0 :tribe "nagarote"}
@@ -26,14 +26,18 @@
                         {:id 18 :name "Will" :out 0 :tribe "nagarote"}
                         ]))

+(def voted-out-list (atom [
+                           {:id 1 :out 18}
+                           ]))
+
 (def entries (atom [
-                    {:id 1 :name "phil" :points 0 :order [18 17 16 15 14 13 12 11 1 10 9 8 7 6 5 4 3 2]}
-                    {:id 2 :name "will" :points 0 :order [2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 1]}
-                    {:id 3 :name "ciwchris" :points 0 :order [4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 1 2 3]}
-                    {:id 11 :name "last" :points 0 :order [3 1 2 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18]}
+                    ;;{:id 1 :name "phil" :points 0 :order [18 17 16 15 14 13 12 11 1 10 9 8 7 6 5 4 3 2]}
+                    ;;{:id 2 :name "will" :points 0 :order [2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 1]}
+                    ;;{:id 3 :name "ciwchris" :points 0 :order [4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 1 2 3]}
+                    {:id 4 :name "last" :points 0 :order [1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18]}
                     ]))

-(def selected-entry (atom 1))
+(def selected-entry (atom 4))

 ;; -------------------------
 ;; To read the players when sorted
@@ -58,18 +62,18 @@
                          [:img {:src (str "/images/" (:name item) ".png")}]
                          [:div (:name item)]])])

-(defn create-contestant-list [entries selected-entry contestants]
-  (let [contestant-order (:order (first (filter #(= selected-entry (:id %)) entries)))]
-    (map
-     #(first (filter (fn [contestant] (= (:id contestant) %)) contestants))
-     contestant-order)))
+(defn create-contestant-list [entries selected-entry voted-out-list]
+  (let [entry-contestant-order (:order (first (filter #(= selected-entry (:id %)) entries)))]
+            (map
+             #(first (filter (fn [voted-out-entry] (= (:id voted-out-entry) %)) voted-out-list))
+             entry-contestant-order)))

 (defn calculate-points-for-entry
-  ([entry] (calculate-points-for-entry 0 18 entry ))
+  ([entry] (calculate-points-for-entry 0 18 entry))
   ([points max-points entry]
-   (if (<= max-points 0)
+   (if (empty? entry)
      points
-     (let [new-points (if (= 0 (:out (first entry)))
+     (let [new-points (if (nil? (first entry))
                         0
                         (Math/abs (- max-points (:out (first entry)))))]
        (recur
@@ -77,51 +81,53 @@
         (dec max-points)
         (rest entry))))))

+(defn calculate-points-for-entries [entries-to-modify voted-out-list]
+  (map #(assoc
+         %
+         :points
+         (calculate-points-for-entry (create-contestant-list entries-to-modify (:id %) voted-out-list)))
+       entries-to-modify))
+
+(defn sorted-entries [entries]
+   (into [] (sort #(compare (:points %2) (:points %1)) entries)))
+
 (defn leader-board [entries contestants]
-  [:ul
-   (for [entry entries]
-     ^{:key (:id entry)} [:li.ui-state-default
-                          [:div {:class "points"} (:name entry)
-                           [:div (calculate-points-for-entry (create-contestant-list entries (:id entry) contestants))]]])])
+  [:div.column
+   [:h3 "Leaderboard"]
+   [:ul
+    (for [entry (sorted-entries entries)]
+      ^{:key (:id entry)} [:li.ui-state-default
+                           [:div {:class "points"} (:name entry)
+                            [:div (:points entry)]]])]])

 (defn create-placed-list [placed]
   (into [] (sort #(compare (:out %2) (:out %1)) placed)))

-(defn create-contestant-list [entries selected-entry contestants]
-  (let [contestant-order (:order (first (filter #(= selected-entry (:id %)) entries)))]
-    (map
-     #(first (filter (fn [contestant] (= (:id contestant) %)) contestants))
-     contestant-order)))
+(defn entries-display [entries selected-entry]
+  [:div.column
+   [:h3 "Entries"]
+   [:select {:on-change #(swap! selected-entry (fn [] (int (-> % .-target .-value))))}
+    (for [entry entries]
+      ^{:key (:id entry)} [:option {:value (:id entry)}
+                           (:name entry)])]
+   [lister (create-contestant-list entries @selected-entry @contestants) "selected-entry"]])

-(defn entries-display [entries selected-entry]
-    [:div
-     [:select {:on-change #(swap! selected-entry (fn [] (int (-> % .-target .-value))))}
-      (for [entry entries]
-        ^{:key (:id entry)} [:option {:value (:id entry)}
-                             (:name entry)])]
-     [lister (create-contestant-list entries @selected-entry @contestants) "selected-entry"]])
+(defn home []
+  (let [entries (calculate-points-for-entries @entries @voted-out-list)]
+    [:div [:h2 "Phil & Will's Survivor 30 Bootlist"]
+     [leader-board entries @contestants]
+     [entries-display entries selected-entry]
+     [:div.column
+      [:h3 "Voted out"]
+      [lister (create-placed-list  (filter #(true? (:locked %)) @contestants)) "placed"]]
+     [:div.column
+      [:h3 "Active"]
+      [lister (filter #(= 0 (:out %)) @contestants) "contestants"]]]))

-(defn home []
-  [:div [:h2 "Phil & Will's Survivor 30 Bootlist"]
-   [leader-board @entries @contestants]
-   [entries-display @entries selected-entry]
-   [lister (create-placed-list  (filter #(true? (:locked %)) @contestants)) "placed"]
-   [lister (filter #(= 0 (:out %)) @contestants) "contestants"]])
-
-(defn update-c [cs ids]
-  (if (empty? ids)
-    cs
-    (let [c (first (filter #(= (:id (first ids)) (:id %)) cs))
-          new-cs (remove #(= (:id (first ids)) (:id %)) cs)
-          new-c (assoc c :out (:out (first ids)))]
-      (recur
-       (into [] (conj new-cs new-c))
-       (rest ids)))))
-
-(defn re-sort [new-placed-list]
-  (let [ids (map-indexed (fn [index item] (hash-map :id (int (.-id item)) :out (- 18 index))) new-placed-list)]
-    (swap! contestants (fn [] (update-c @contestants (into [] ids))))))
+(defn update-voted-out [new-placed-list]
+  (let [new-sorted-list (map-indexed (fn [index item] (hash-map :id (int (.-id item)) :out (- 18 index))) new-placed-list)]
+    (swap! voted-out-list (fn [] new-sorted-list))))

 (defn home-did-mount []
   (js/$ (fn []
@@ -132,7 +138,7 @@
           (.sortable (js/$ "#placed") (clj->js {
                                                 :items "li:not(.ui-state-disabled)"
                                                 :connectWith ".connectedSortable"
-                                                :update (fn [e ui] (re-sort (-> e .-target .-childNodes)))
+                                                :update (fn [e ui] (update-voted-out (-> e .-target .-childNodes)))
                                                 }))
           (.disableSelection (js/$ "#placed")))))


Debugging client startup

Debugging client startup

--- src/com/frereth/common/async_zmq.clj
+++ src/com/frereth/common/async_zmq.clj
@@ -280,10 +280,10 @@
   But then we could have one thread trying to read while another tries to write,
   and that's a recipe for disaster."
   [{:keys [async->sock in<->ex-chan interface _name stopper] :as component}]
-  {:pre [(s/valid? ::event-loopless-pair component)]
+  {:pre [#_(s/valid? ::event-loopless-pair component)]
    :post [(s/valid? :com.frereth.common.schema/async-channel %)]}
   ;; I'm leaving this around because it is extremely useful for debugging problems.
-  (comment (validate-component component))
+  (comment) (validate-component component)
   (let [{:keys [in-chan status-chan]} interface
         in-chan (:ch in-chan)
         status-chan (:ch status-chan)
@@ -646,7 +646,7 @@
                                   :in<->ex-sock in<->ex-sock
                                   :->zmq-sock (:rhs in<->ex-sock)
                                   :async->sock (:lhs in<->ex-sock))
-            ;; I'd prefer to start the async-loop first.
+            ;; I'd prefer to start the zmq-loop first.
             ;; It seems cleaner, and I'm not positive which
             ;; bullets I might have been dodging.
             ;; However:
@@ -654,13 +654,15 @@
             ;; async-loop throws an exception, I have to restart
             ;; the JVM to free up the socket that zmq-loop has bound
             ;; (assuming that we're binding).
-            async-loop (run-async-loop! almost-started)
-            ;; TODO: Still want to clean things up if an exception
-            ;; gets thrown
-            zmq-loop (run-zmq-loop! almost-started)]
-        (assoc almost-started
-               :async-loop async-loop
-               :zmq-loop zmq-loop))))
+            async-loop (run-async-loop! almost-started)]
+        (try
+          (let [zmq-loop (run-zmq-loop! almost-started)]
+            (assoc almost-started
+                   :async-loop async-loop
+                   :zmq-loop zmq-loop))
+          (catch Exception ex
+            (log/error ex "TODO: Cleanup the async loop")
+            (throw ex))))))
   (stop [this]
         (when async-loop
           (do-signal-async-loop-exit async-loop


Deal with user-data, don't create sessions by default but add utility for creating single session.

--- src/acyclic/awstools/core.clj
+++ src/acyclic/awstools/core.clj
@@ -4,20 +4,28 @@
         acyclic.utils.pinhole)
   (:require [clj-ssh.ssh :as ssh]
             [taoensso.timbre :as timbre]
-            [ clojure.core.async :as async
+            [clojure.data.codec.base64 :as b64]
+            [clojure.core.async :as async
              :refer [<! >! <!! >!! timeout chan alt!! go close!]]))
 (timbre/refer-timbre)

+; ami-5cd51634
+
+
+
 (def cred (read-string (slurp "AWS.clj")))

 (apply defcredential (map cred [:access-key :secret-key :endpoint]))

+(defn s->b64 [s] (String. (b64/encode (.getBytes s))))

 (def ^{:private true} paths {:zone  [:launch-specification :placement :availability-zone]
-                             :itype  [:launch-specification :instance-type]
+                             :itype [:launch-specification :instance-type]
                              :price [:spot-price]
-                             :n     [:instance-count]})
+                             :n     [:instance-count]
+                             :udata [s->b64 :launch-specification :user-data]})
+

 (defmacro go-try [& forms]
   `(go (try (do ~@forms)
@@ -33,6 +41,7 @@
     (async/go-loop []
       (let [rc     (go-try (genfn))
             [v c]  (async/alts! [rc t1 out])]
+        (debug "Ats:" v c)
         (cond
          (= c out)                    (do (debug "Canceled")
                                           (when failure (failure)))
@@ -43,6 +52,7 @@
                                           (>! out v))
          :else                        (do (debug "Still" v "Waiting" time-wait)
                                           (<! (timeout (* 1000 time-wait)))
+                                          (debug "Woke up after wait...")
                                           (recur)))))
     out))

@@ -97,8 +107,8 @@

 (defn- give-up-and-cancel [req & [msg]]
   (when msg (debug msg))
-  (some-> req :is terminate)
-  (some-> req :rs cancel))
+  (concat  (some-> req :is terminate)
+           (some-> req :rs cancel)))

 (defn request-spots [req]
   (let [args    (apply concat (seq req))
@@ -146,9 +156,24 @@

 (def ag (ssh/ssh-agent {}))

+(defn ssh-session [host]
+  (let [sess (ssh/session ag host {:strict-host-key-checking :no
+                                   :username "ec2-user"})]
+    (<!! (async/go-loop [n 10]
+           (cond
+            (ssh/connected? sess) sess
+            (zero? n) (do (debug "Failed to connect to" host) nil)
+            :else     (do
+                        (ssh/connect sess)
+                        (if (ssh/connected? sess)
+                          sess
+                          (do
+                            (<! (timeout 1000))
+                            (recur (dec n))))))))))
+
+
 (defn ssh-sessions [hosts]
-  (let [sess (map #(ssh/session ag % {:strict-host-key-checking :no
-                                      :username "ec2-user"})
+  (let [sess (map #()
                   hosts)]
     (loop [n 10]
            (let [o (map #(or (ssh/connected? %) (ssh/connect %)) sess)]
@@ -167,10 +192,10 @@
                   (:hosts req))]
     (patience
      (fn [] (let [sbad (filter #(not (ssh/connected? %)) sess)]
-               (doseq [s sbad] (ssh/connect s))
-               (assoc req :sessions sess)))
+              (doseq [s sbad] (ssh/connect s))
+              (assoc req :sessions sess)))
      #(every? ssh/connected? (:sessions %1))
-     #(give-up-and-cancel req "Failed to add sesions")
+     nil ;#(give-up-and-cancel req "Failed to add sesions")
      60 10
      )))

@@ -181,12 +206,14 @@
 cfn or nil, if one of them failed along the way."
   [x & cfns]
   (let [out (chan)]
+    (debug "Starting" cfns)
     (async/go-loop [[f & fs] cfns
                     x        x]
       (if-not f
         (do (debug "Finished" cfns)
             (>! out x))
-        (let [y (<! (f x))]
+        (let [_ (debug "Invoking" f x)
+              y (<! (f x))]
           (if-not y
             (do (debug "Failed at" f)
                 (close! out))
@@ -202,9 +229,11 @@
   (let [req (apply ph-assoc reqmap paths opts)
         req (assoc req :nmin nmin)
         n    (ph-get reqmap paths :n)
-        req (if (<= nmin n) req (ph-assoc reqmap paths :n nmin))]
-    (chain-some {:req req} add-requests add-instances add-ips  add-sessions)))
-
+        req (if (<= nmin n) req (ph-assoc req paths :n nmin))]
+    (debug "Bringing up" req)
+    (chain-some {:req req} add-requests add-instances add-ips add-hosts)
+    ))
+;; add-sessions

 (defn EDNify
 "EDN-ify an arbitrary object, leaving it alone if it's an innocuous string."
@@ -293,7 +322,6 @@
                  :subnet-id                  (get my-subnets zone)
                  :iam-instance-profile       {:arn "arn:aws:iam::633840533036:instance-profile/girder-peer"}}]
         (apply request-spot-instances req)]
-    (println req)
     (map :spot-instance-request-id  (:spot-instance-requests r))))

 #_(defn patience
@@ -307,7 +335,7 @@
             p   (pred r)]
         (if p
          (do (debug "Returning" r)
-              (>! out r) (close! r))
+              (>! out r) (close! out))
          (let [t2     (timeout (* 1000  time-wait))
                _      (debug "Still" r "Waiting" time-wait "sec")
                [v c] (async/alts! [t1 t2])]


added hyphen in the pred sit-down

added hyphen in the pred sit-down

--- src/babel/english/lexicon.clj
+++ src/babel/english/lexicon.clj
@@ -869,7 +869,7 @@
                                   :past-participle "sat down"
                                   :present {:3sing "sits down"}}
                         :synsem {:cat :verb
-                                 :sem {:pred :sit down}}}
+                                 :sem {:pred :sit-down}}}

    "sleep" {:synsem {:cat :verb
                      :sem {:subj {:animate true}


disable erasure of past perfect sentences

--- src/babel/francais/writer.clj
+++ src/babel/francais/writer.clj
@@ -31,7 +31,7 @@
     (if false
       (delete-from-expressions "fr" {:synsem {:sem {:aspect :perfect, :tense :past}}, :root {:français {:français "abandoner"}}}))

-    (if true
+    (if false
       (delete-from-expressions "fr" {:synsem {:sem {:aspect :perfect, :tense :past}}}))
     (if true
       (delete-from-expressions "fr" {:synsem {:sem {:subj {:pred :io}}}}))


Fix logging filter

Fix logging filter

--- src/cider_ci/storage/main.clj
+++ src/cider_ci/storage/main.clj
@@ -30,7 +30,7 @@

 (defn -main [& args]
   (catcher/wrap-with-log-warn
-    (drtom.logbug.thrown/reset-ns-filter-regex #".*cider-ci.*")
+    (drtom.logbug.thrown/reset-ns-filter-regex #".*cider.ci.*")
     (config/initialize)
     (rdbms/initialize (get-db-spec :repository))
     (nrepl/initialize (-> (get-config) :services :storage :nrepl))


Back to returning the entire map.

Back to returning the entire map.

--- src/clj_applenewsapi/core.clj
+++ src/clj_applenewsapi/core.clj
@@ -7,6 +7,7 @@
 (def default-opts
   {
    ; :debug true
+   :throw-exceptions true
    :accept :json
    :socket-timeout 20000
    :conn-timeout 20000
@@ -66,7 +67,7 @@
          content-type (str "multipart/form-data; boundary=" boundary)
          concatenated (canonical "POST" url ts content-type payload)
          opts (authorize (post-opts boundary payload) concatenated ts channel-name)]
-     (select-keys (client/post url (assoc opts :throw-exceptions true)) [:status :request-time :trace-redirects]))))
+     (client/post url opts))))

 ; test with
 ; (require '[clj-applenewsapi.core :as c]) (def bundle (read-string (slurp "test/bundle.edn")))  (c/create-article bundle :sandbox))


add back button on budget index page

add back button on budget index page

--- src/clj_money/web/budgets.clj
+++ src/clj_money/web/budgets.clj
@@ -70,7 +70,9 @@
                                   {:value :quarter :caption "Quarter"}])
     (number-input-field budget :period-count)
     (text-input-field budget :start-date {:class "date-field"} format-date)
-    [:button.btn.btn-primary {:type :submit} "Save"]))
+    [:button.btn.btn-primary {:type :submit} "Save"]
+    " "
+    [:a.btn.btn-default {:href (format "/entities/%s/budgets" (:entity-id budget))} "Back"]))

 (defn new-budget
   ([entity-id]


Always reply empty (default) subscription.

--- src/cljx/geschichte/sync.cljx
+++ src/cljx/geschichte/sync.cljx
@@ -137,10 +137,12 @@
           (sub bus-out :meta-pub pub-ch)
           (publication-loop pub-ch pubed-ch out sub-metas pn (:peer s))

-          (when-not (= new-subs old-subs)
+          (when (or (= old-subs {})
+                    (not (= new-subs old-subs)))
             (>! bus-in {:topic :meta-sub :metas new-subs :peer pn}))

           ;; propagate (internally) that the remote has subscribed (for connect)
+          ;; also guarantees meta-sub is sent to remote peer before meta-subed!
           (>! bus-in {:topic :meta-subed :metas common-subs :peer (:peer s)})
           (>! out {:topic :meta-subed :metas common-subs :peer (:peer s)})
           (debug pn "finishing subscription")


Fix combat ns for cljs

Fix combat ns for cljs

--- src/cljx/robinson/combat.cljx
+++ src/cljx/robinson/combat.cljx
@@ -1,14 +1,11 @@
 ;; Functions that manipulate state to do what the user commands.
 (ns robinson.combat
-  (:use
-    clojure.pprint
-    robinson.common
-    robinson.random
-    robinson.world
-    robinson.player
-    [robinson.itemgen :exclude [-main]])
-  (:require clojure.pprint
-            clojure.contrib.core
+  (:require [clojure.pprint :refer :all]
+            [robinson.common :refer :all]
+            [robinson.random :refer :all]
+            [robinson.world :refer :all]
+            [robinson.player :refer :all]
+            [robinson.itemgen :refer :all :exclude [-main]]
             [clojure.data.generators :as dg]
             [clojure.stacktrace :as st]
             [taoensso.timbre :as timbre]


Fixed up ecef->lla.

Fixed up ecef->lla.

--- src/cmr/opendap/geom/util.clj
+++ src/cmr/opendap/geom/util.clj
@@ -8,8 +8,8 @@

 (def earth-semi-major-axis 6378137.0)
 (def earth-semi-minor-axis 6356752.3142)
-(def earth-semi-major-axis**2 (Math/pow earth-semi-major-axis 2)
-(def earth-semi-minor-axis**2 (Math/pow earth-semi-minor-axis 2)
+(def earth-semi-major-axis**2 (Math/pow earth-semi-major-axis 2))
+(def earth-semi-minor-axis**2 (Math/pow earth-semi-minor-axis 2))
 (def earth-radius earth-semi-major-axis)
 (def earth-radius**2 earth-semi-major-axis**2)
 (def earth-area (* 4 Math/PI earth-radius**2))
@@ -62,26 +62,23 @@

    Inputs are in meters; outputs are degrees and meters."
   [x y z]
-  (let [b (Math/sqrt (* earth-semi-major-axis**2
-                        (- 1 earth-eccentricity**2)))
-        ep (Math/sqrt (/ (- earth-semi-major-axis**2
+  (let [ep (Math/sqrt (/ (- earth-semi-major-axis**2
                             earth-semi-minor-axis**2)
                          earth-semi-minor-axis**2))
         p (Math/sqrt (+ (Math/pow x 2) (Math/pow y 2)))
-        th (Math/atan2 (* earth-semi-major-axis z)
-                       (* b p))
+        theta (Math/atan2 (* earth-semi-major-axis z)
+                       (* earth-semi-minor-axis p))
         lon (Math/atan2 y x)
-        lat (Math/atan2 (+ z (* earth-eccentricity
-                                (Math/pow p 2)
-                                b
+        lat (Math/atan2 (+ z (* (Math/pow ep 2)
+                                earth-semi-minor-axis
                                 (Math/pow
-                                 (Math/sin th) 3)))
+                                 (Math/sin theta) 3)))
                         (- p (* earth-eccentricity**2
                                 earth-semi-major-axis
                                 (Math/pow
-                                 (Math/cos th) 3))))
+                                 (Math/cos theta) 3))))
         n (prime-vertical-curvature-radius lat)
-        alt (- (/ p (Math/cos lat)) -n)]
+        alt (- (/ p (Math/cos lat)) n)]
     [(Math/toDegrees lat)
      (Math/toDegrees (mod lon (* 2 Math/PI)))
      alt]))


removed dead code

removed dead code

--- src/com/rpl/specter/impl.cljc
+++ src/com/rpl/specter/impl.cljc
@@ -551,25 +551,6 @@
       res
       )))

-(deftype ViewPath [view-fn])
-
-(extend-protocol p/StructurePath
-  ViewPath
-  (select* [^ViewPath this structure next-fn]
-    (->> structure ((.-view-fn this)) next-fn))
-  (transform* [^ViewPath this structure next-fn]
-    (->> structure ((.-view-fn this)) next-fn)
-    ))
-
-(deftype PutValCollector [val])
-
-(extend-protocol p/Collector
-  PutValCollector
-  (collect-val [^PutValCollector this structure]
-    (.-val this)
-    ))
-
-
 (extend-protocol p/StructurePath
   nil
   (select* [this structure next-fn]


exit doc

exit doc

--- sidecar/src/figwheel_sidecar/system.clj
+++ sidecar/src/figwheel_sidecar/system.clj
@@ -499,7 +499,7 @@
   Switch REPL build focus:
           :cljs/quit                      ;; allows you to switch REPL to another build
     Docs: (doc function-name-here)
-    Exit: Control+C or :cljs/quit
+    Exit: :cljs/quit
  Results: Stored in vars *1, *2, *3, *e holds last exception object")

 (defn figwheel-repl-options
@@ -753,4 +753,3 @@
 (defn start-figwheel-and-cljs-repl! [autobuild-options]
   (when-let [system (start-figwheel! autobuild-options)]
     (cljs-repl (:figwheel-system system))))
-


Use update to make the impl more legible

--- src/desdemona/lifecycles/logging.clj
+++ src/desdemona/lifecycles/logging.clj
@@ -21,9 +21,5 @@
   "Adds logging output to a task's output-batch."
   [job task]
   (if-let [entry (first (filter #(= (:onyx/name %) task) (:catalog job)))]
-    (update-in
-     job
-     [:lifecycles]
-     conj
-     {:lifecycle/task task
-      :lifecycle/calls ::log-calls})))
+    (update job :lifecycles conj {:lifecycle/task task
+                                  :lifecycle/calls ::log-calls})))


Tiny bit of cleanup to how coll-name is passed in.

--- src/fcms/controllers/collections.clj
+++ src/fcms/controllers/collections.clj
@@ -11,18 +11,20 @@
 (defn index [coll-name]
   (format "Items in the collection: %s" coll-name))

-(defn accept-switch [{{{coll-name :coll-name} :params} :request {accept :media-type} :representation}]
+(defn accept-switch [coll-name {{accept :media-type} :representation}]
   (cond
     (= accept collection-type) (show coll-name)
     (= accept item-type) (index coll-name)))

 (defresource collection [coll-name]
   :available-media-types [item-type collection-type]
-  :handle-ok accept-switch)
+  :handle-ok (fn [ctx] (accept-switch coll-name ctx)))

 (defroutes collection-routes
   (ANY "/:coll-name" [coll-name] (collection coll-name)))

+application/json;schema=vnd.fcms.item;version=1
+application/vnd.fcms.item+json;version=1

 ;; {:representation
 ;;  {:media-type "application/vnd.fcms.item+json"},


Document grimoire.api.web.read/do-thing-req

--- src/grimoire/api/web/read.clj
+++ src/grimoire/api/web/read.clj
@@ -67,7 +67,13 @@
        succeed fail)
      (grim-result ?res))))

-(defn do-thing-req [config op ctor parent]
+(defn do-thing-req
+  "λ [Cfg → Op → (λ [p → String] → c) → p] → Either[Success[Seq[c]], Failure[String]]
+
+  Helper, does a data request against the Grimoire web API as specified by the
+  config and op, running the request results through the constructor to yield a
+  seq of Things as constructed from the pair (parent, (:name result))."
+  [config op ctor parent]
   (let [?res (do-data-req config parent op)]
     (if (succeed? ?res)
       (->> ?res result


moving proxmox validations and adding bridged entity facts'

--- test/celestial/test/proxmox.clj
+++ test/celestial/test/proxmox.clj
@@ -1,8 +1,9 @@
 (ns celestial.test.proxmox
   (:require
-    [celestial.fixtures :as fix :refer [redis-prox-spec with-conf with-m?]]
+    [celestial.fixtures :as fix :refer [redis-prox-spec redis-bridged-prox-spec with-conf with-m?]]
     [hypervisors.networking :as n]
     [flatland.useful.map :refer  (dissoc-in*)]
+    [proxmox.validations :refer (validate-entity)]
     [proxmox.provider :as prox :refer (vzctl enable-features assign-networking)])
   (:use
     midje.sweet
@@ -14,15 +15,17 @@
     [proxmox.auth :only (fetch-headers auth-headers auth-store auth-expired?)])
   (:import clojure.lang.ExceptionInfo))

+(defn nulify [spec & ks] (assoc-in spec ks nil))
+
 (with-conf
   (let [{:keys [machine proxmox]} redis-prox-spec]
     (with-redefs [ct-id (fn [_] (fn [_] nil))]
       (fact "missing vmid"
-            (vconstruct (assoc-in redis-prox-spec [:proxmox :vmid] nil)) =>
-            (throws ExceptionInfo (with-m? {:machine {:vmid '("must be present")}} ))))
+            (vconstruct (nulify redis-prox-spec :proxmox :vmid)) =>
+            (throws ExceptionInfo (with-m? {:ct {:vmid '("must be present")}} ))))
     (fact "non int vmid"
           (vconstruct (assoc-in redis-prox-spec [:proxmox :vmid] "string")) =>
-          (throws ExceptionInfo (with-m? {:machine {:vmid '("must be a number")}})))
+          (throws ExceptionInfo (with-m? {:ct {:vmid '("must be a number")}})))
     (with-redefs [ct-id (fn [_] 101)]
       (let [ct (vconstruct (assoc-in redis-prox-spec [:proxmox :features] ["nfs:on"]))]
         (fact "vzctl usage"
@@ -87,3 +90,33 @@
           (assign-networking ct network) => (contains (contains {:ip_address "192.168.5.200"}))
           (provided
             (n/mark "192.168.5.200" "proxmox") =>  "192.168.5.200"))))
+
+(fact "proxmox entity validation"
+   (validate-entity redis-prox-spec) => truthy
+
+   (validate-entity (nulify redis-prox-spec :machine :cpus)) => ; common validation
+      (throws ExceptionInfo (with-m? {:machine {:cpus '("must be present")}}))
+
+   (validate-entity (nulify redis-prox-spec :machine :domain)) => ; non fqdn
+      (throws ExceptionInfo (with-m? {:machine {:domain '("must be present")}}))
+
+   (validate-entity (assoc-in redis-prox-spec [:machine :os] "ubutnu-12.04")) => ; entity validation
+      (throws ExceptionInfo (with-m? {:machine {:os '("must be a keyword")}}))
+
+   (validate-entity (assoc-in redis-prox-spec [:proxmox :vmid] 33)) =>
+      (throws ExceptionInfo (with-m? {:proxmox {:vmid '("must be greater then 100")}}))
+
+   (validate-entity (nulify redis-prox-spec :proxmox :vmid)) => truthy
+
+   (validate-entity (nulify redis-prox-spec :proxmox :password)) => ; proxmox validation
+      (throws ExceptionInfo (with-m? {:proxmox {:password '("must be present")}})))
+
+
+(fact "bridged entity validation"
+   (validate-entity redis-bridged-prox-spec) => truthy
+
+   (validate-entity (nulify redis-bridged-prox-spec :machine :netmask)) =>
+      (throws ExceptionInfo (with-m? {:machine {:netmask '("must be present")}}))
+
+   (validate-entity (assoc-in redis-bridged-prox-spec [:machine :netmask] "123")) =>
+      (throws ExceptionInfo (with-m? {:machine {:netmask '("must be a legal ip address")}})))


fixed http test

fixed http test

--- test/clj/swarmpit/http_test.clj
+++ test/clj/swarmpit/http_test.clj
@@ -1,6 +1,6 @@
 (ns swarmpit.http-test
   (:require [clojure.test :refer :all]
-            [org.httpkit.client :as http]
+            [clj-http.client :as http]
             [swarmpit.http :refer :all])
   (:import (clojure.lang ExceptionInfo)))

@@ -9,7 +9,8 @@
   (testing "scope"
     (is (thrown-with-msg?
           ExceptionInfo #"HTTP failure"
-          (execute-in-scope @(http/get "invalid url") nil)))
+          (execute-in-scope {:call-fx #(http/get "invalid url")})))
     (is (thrown-with-msg?
           ExceptionInfo #"Some scope failure"
-          (execute-in-scope @(http/get "invalid url") "Some scope")))))
+          (execute-in-scope {:call-fx #(http/get "invalid url")
+                             :scope   "Some scope"})))))


Finishing testing tversky index

Finishing testing tversky index

--- test/clj_fuzzy/tversky_test.clj
+++ test/clj_fuzzy/tversky_test.clj
@@ -10,16 +10,28 @@
   (:require [clojure.test :refer :all]
             [clj-fuzzy.tversky :refer :all]
             [clj-fuzzy.jaccard]
-            [clj-fuzzy.dice]))
+            [clj-fuzzy.dice])
+  (:use [clj-fuzzy.helpers :only [bigrams]]))

+;; Jaccard equivalent
 (defn jaccard [s1, s2] (- 1 (clj-fuzzy.jaccard/distance s1 s2)))
 (defn tversky-jaccard [s1 s2] (index s1 s2 :alpha 1 :beta 1))
 (defn compare-jaccard [s1 s2] (is (= (jaccard s1 s2) (tversky-jaccard s1 s2))))

+;; Dice equivalent
+(defn tversky-dice [s1 s2] (index (bigrams s1) (bigrams s2) :alpha 0.5 :beta 0.5))
+(defn compare-dice [s1 s2] (is (= (clj-fuzzy.dice/coefficient s1 s2) (tversky-dice s1 s2))))

 (deftest assymetric-index-test
   (compare-jaccard "abc" "abc")
   (compare-jaccard "abc" "xyz")
   (compare-jaccard "night" "nacht")
   (compare-jaccard "context" "contact")
-  (compare-jaccard "ht" "nacht"))
+  (compare-jaccard "ht" "nacht")
+  (compare-dice "healed" "healed")
+  (compare-dice "healed" "sealed")
+  (compare-dice "healed" "healthy")
+  (compare-dice "healed" "heard")
+  (compare-dice "healed" "herded")
+  (compare-dice "healed" "help")
+  (compare-dice "healed" "sold"))


added upsert test for collections

added upsert test for collections

--- test/karras/test_collection.clj
+++ test/karras/test_collection.clj
@@ -127,6 +127,21 @@
             (update people {:first-name "Jim"}
                     (merge Jim {:weight 180})))))

+(fact "upsert-update-test"
+  (count-docs people) => 4
+  (:weight (fetch-one people {:first-name "Jim"})) => 180
+  (against-background
+    (before :facts
+            (upsert people {:first-name "Jim"}
+                    (merge Jim {:weight 180})))))
+
+(fact "upsert-insert-test"
+  (count-docs people) => 5
+  (against-background
+    (before :facts
+            (upsert people {:first-name "Arnold"}
+                    (merge (dissoc Jim :_id) {:first-name "Arnold"})))))
+
 (facts "update-all-tests"
   (doseq [j (fetch people {:last-name "Johnson"})]
     (:age j) => 17)


give the vm a bit more time

give the vm a bit more time

--- test/riemann/test/transport.clj
+++ test/riemann/test/transport.clj
@@ -59,7 +59,7 @@
          s2       (sse-server)
          index    (index/index)
          pubsub   (pubsub/pubsub-registry)
-         core     (transition!
+         core     (transition!
                    (core)
                    {:index    index
                     :pubsub   pubsub
@@ -70,13 +70,13 @@
                         second
                         (partial re-matches #"data: (.*)\n\n")
                         formats/bytes->string)
-         response (http-request
+         response (http-request
                    {:method :get
                     :url    "http://127.0.0.1:5558/index?query=true"})]
      (try
        (client/send-event client {:service "service1"})
        (client/send-event client {:service "service2"})
-       (Thread/sleep 100)
+       (Thread/sleep 500)
        (let [[r2 r1] (channel->seq (map* convert (take* 2 (:body @response))))]

          (is (#{"service1" "service2"} (get r1 "service")))
@@ -95,8 +95,8 @@
                        (encode {:ok true}))]

              (try
-               (enqueue client {:host "localhost"
-                                :port 5555
+               (enqueue client {:host "localhost"
+                                :port 5555
                                 :message msg})
                (Thread/sleep 100)
                (finally
@@ -164,15 +164,15 @@
                                     "riemann.pubsub"]
             (let [server (tcp-server)
                   core   (transition! (core) {:services [server]})
-                  client (wait-for-result
-                           (aleph.tcp/tcp-client
-                             {:host "localhost"
+                  client (wait-for-result
+                           (aleph.tcp/tcp-client
+                             {:host "localhost"
                               :port 5555
                               :frame (finite-block :int32)}))]

               (try
-                (enqueue client
-                         (java.nio.ByteBuffer/wrap
+                (enqueue client
+                         (java.nio.ByteBuffer/wrap
                            (byte-array (map byte [0 1 2]))))
                 (is (thrown? java.lang.IllegalStateException
                              (wait-for-message client)))


added volume options inbound mapping

added volume options inbound mapping

--- src/clj/swarmpit/docker/engine/mapper/inbound.clj
+++ src/clj/swarmpit/docker/engine/mapper/inbound.clj
@@ -138,13 +138,22 @@
                     (merge {:serviceAliases (:Aliases %)})))
          (into []))))

+(defn ->service-mount-options
+  [volume-options]
+  (when volume-options
+    {:labels       (-> volume-options :Labels)
+     :driverConfig {:name    (-> volume-options :DriverConfig :Name)
+                    :options (-> volume-options :DriverConfig :Options)}}))
+
 (defn ->service-mounts
   [service-spec]
   (->> (get-in service-spec [:TaskTemplate :ContainerSpec :Mounts])
        (map (fn [v] {:containerPath (:Target v)
                      :host          (:Source v)
                      :type          (:Type v)
-                     :readOnly      (contains? #{true 1} (:ReadOnly v))}))
+                     :volumeOptions (->service-mount-options (:VolumeOptions v))
+                     :readOnly      (contains? #{true 1} (:ReadOnly v))
+                     :stack         (-> v :VolumeOptions :Labels stack-label)}))
        (into [])))

 (defn ->service-variables
@@ -277,58 +286,58 @@
   ([service]
    (->service service nil nil))
   ([service tasks networks]
-  (let [service-spec (:Spec service)
-        service-labels (:Labels service-spec)
-        service-task-template (:TaskTemplate service-spec)
-        service-mode (->service-mode service-spec)
-        service-name (:Name service-spec)
-        service-id (:ID service)
-        service-tasks (->service-tasks service-id tasks)
-        replicas (get-in service-spec [:Mode :Replicated :Replicas])
-        replicas-running (->service-replicas-running service-tasks)
-        replicas-no-shutdown (->service-replicas-no-shutdown service-tasks)
-        image (get-in service-task-template [:ContainerSpec :Image])
-        image-info (str/split image #"@")
-        image-name (first image-info)
-        image-digest (second image-info)]
-    (array-map
-      :id service-id
-      :version (get-in service [:Version :Index])
-      :createdAt (:CreatedAt service)
-      :updatedAt (:UpdatedAt service)
-      :repository (merge (->service-image-details image-name)
-                         {:image       image-name
-                          :imageDigest image-digest})
-      :serviceName service-name
-      :mode service-mode
-      :stack (-> service-labels stack-label)
-      :replicas replicas
-      :state (if (= service-mode "replicated")
-               (->service-state replicas-running replicas)
-               (->service-state replicas-running replicas-no-shutdown))
-      :status {:info    (if (= service-mode "replicated")
-                          (->service-info-status replicas-running replicas)
-                          (->service-info-status replicas-running replicas-no-shutdown))
-               :update  (get-in service [:UpdateStatus :State])
-               :message (get-in service [:UpdateStatus :Message])}
-      :ports (->service-ports service)
-      :mounts (->service-mounts service-spec)
-      :networks (->service-networks service networks)
-      :secrets (->service-secrets service-spec)
-      :configs (->service-configs service-spec)
-      :variables (->service-variables service-spec)
-      :labels (->service-labels service-labels)
-      :logdriver {:name (or (get-in service-task-template [:LogDriver :Name]) "json-file")
-                  :opts (->service-log-options service-task-template)}
-      :resources {:reservation (->service-resource (get-in service-task-template [:Resources :Reservations]))
-                  :limit       (->service-resource (get-in service-task-template [:Resources :Limits]))}
-      :deployment {:update          (->service-deployment-update service-spec)
-                   :forceUpdate     (:ForceUpdate service-task-template)
-                   :restartPolicy   (->service-deployment-restart-policy service-task-template)
-                   :rollback        (->service-deployment-rollback service-spec)
-                   :rollbackAllowed (some? (:PreviousSpec service))
-                   :autoredeploy    (->service-autoredeploy service-labels)
-                   :placement       (->service-placement-constraints service-spec)}))))
+   (let [service-spec (:Spec service)
+         service-labels (:Labels service-spec)
+         service-task-template (:TaskTemplate service-spec)
+         service-mode (->service-mode service-spec)
+         service-name (:Name service-spec)
+         service-id (:ID service)
+         service-tasks (->service-tasks service-id tasks)
+         replicas (get-in service-spec [:Mode :Replicated :Replicas])
+         replicas-running (->service-replicas-running service-tasks)
+         replicas-no-shutdown (->service-replicas-no-shutdown service-tasks)
+         image (get-in service-task-template [:ContainerSpec :Image])
+         image-info (str/split image #"@")
+         image-name (first image-info)
+         image-digest (second image-info)]
+     (array-map
+       :id service-id
+       :version (get-in service [:Version :Index])
+       :createdAt (:CreatedAt service)
+       :updatedAt (:UpdatedAt service)
+       :repository (merge (->service-image-details image-name)
+                          {:image       image-name
+                           :imageDigest image-digest})
+       :serviceName service-name
+       :mode service-mode
+       :stack (-> service-labels stack-label)
+       :replicas replicas
+       :state (if (= service-mode "replicated")
+                (->service-state replicas-running replicas)
+                (->service-state replicas-running replicas-no-shutdown))
+       :status {:info    (if (= service-mode "replicated")
+                           (->service-info-status replicas-running replicas)
+                           (->service-info-status replicas-running replicas-no-shutdown))
+                :update  (get-in service [:UpdateStatus :State])
+                :message (get-in service [:UpdateStatus :Message])}
+       :ports (->service-ports service)
+       :mounts (->service-mounts service-spec)
+       :networks (->service-networks service networks)
+       :secrets (->service-secrets service-spec)
+       :configs (->service-configs service-spec)
+       :variables (->service-variables service-spec)
+       :labels (->service-labels service-labels)
+       :logdriver {:name (or (get-in service-task-template [:LogDriver :Name]) "json-file")
+                   :opts (->service-log-options service-task-template)}
+       :resources {:reservation (->service-resource (get-in service-task-template [:Resources :Reservations]))
+                   :limit       (->service-resource (get-in service-task-template [:Resources :Limits]))}
+       :deployment {:update          (->service-deployment-update service-spec)
+                    :forceUpdate     (:ForceUpdate service-task-template)
+                    :restartPolicy   (->service-deployment-restart-policy service-task-template)
+                    :rollback        (->service-deployment-rollback service-spec)
+                    :rollbackAllowed (some? (:PreviousSpec service))
+                    :autoredeploy    (->service-autoredeploy service-labels)
+                    :placement       (->service-placement-constraints service-spec)}))))

 (defn ->services
   [services tasks networks]


Increased evalpush-limit for Collataz Numbers problem to 15000

--- src/clojush/problems/software/collatz_numbers.clj
+++ src/clojush/problems/software/collatz_numbers.clj
@@ -57,7 +57,7 @@
       len
       (if (even? n)
         (recur (/ n 2) (inc len))
-        (recur (inc (* 3 n)) (inc len))))))
+        (recur (inc (*' 3 n)) (inc len))))))

 (defn collatz-numbers-test-cases
   "Takes a sequence of inputs and gives IO test cases of the form
@@ -140,7 +140,7 @@
    :atom-generators collatz-numbers-atom-generators
    :max-points 600
    :max-points-in-initial-program 300
-   :evalpush-limit 4000
+   :evalpush-limit 15000
    :population-size 1000
    :max-generations 300
    :parent-selection :lexicase
@@ -158,3 +158,47 @@
    :final-report-simplifications 5000
    :max-error 1000000
    })
+
+;;;;;;;;;;
+;; Below here is for testing a hand-written solution.
+
+;(reset! global-evalpush-limit 5000)
+;
+;(reset! global-max-points 600)
+;
+;(defn test-program-on-training
+;  [program print-outputs]
+;  ((collatz-numbers-error-function collatz-numbers-data-domains) program :train print-outputs))
+;
+;; This program only works if evalpush-limit > 4000 (works at 5000)
+;(def tom-program
+;  '(
+;     tag_exec_100
+;     (
+;       integer_dup
+;       1 integer_gt
+;       exec_if
+;       (
+;        float_inc integer_dup
+;        2 integer_mod 0 integer_eq
+;        exec_if ; condition for even/odd (first even, then odd)
+;        ( ;even case
+;          2 integer_div
+;          )
+;        ( ;odd case
+;          3 integer_mult integer_inc
+;          )
+;        tagged_50
+;        )
+;       (
+;         integer_fromfloat
+;         )
+;       )
+;     in1 1.0
+;     tagged_50
+;     ))
+;
+;(test-program-on-training tom-program false)
+;
+;(run-push tom-program
+;          (push-item 5 :input (make-push-state)))


Fix reflection warning in generated differ fn

--- src/main/cljc/mikron/compiler/processor/diff.cljc
+++ src/main/cljc/mikron/compiler/processor/diff.cljc
@@ -29,9 +29,18 @@
                  ~value-1
                  ~(diff schema paths value-1 value-2 global-options)))))

-(defmethod diff :number [_ _ value-1 value-2 {:keys [processor-type]}]
+(defmethod diff :floating [_ _ value-1 value-2 {:keys [processor-type]}]
   (case processor-type
-    :diff   `(if (== ~value-1 ~value-2)
+    :diff   `(if (== ~(vary-meta value-1 assoc :tag 'double)
+                     ~(vary-meta value-2 assoc :tag 'double))
+               :mikron/dnil
+               ~value-2)
+    :undiff value-2))
+
+(defmethod diff :integer [_ _ value-1 value-2 {:keys [processor-type]}]
+  (case processor-type
+    :diff   `(if (== ~(vary-meta value-1 assoc :tag 'long)
+                     ~(vary-meta value-2 assoc :tag 'long))
                :mikron/dnil
                ~value-2)
     :undiff value-2))


Fix tests: use uruk-tester & UrukDB

Fix tests: use uruk-tester & UrukDB

--- test/uruk/core_test.clj
+++ test/uruk/core_test.clj
@@ -8,8 +8,8 @@
 ;; FIXME You'll have to fill in database credentials that work for
 ;; your system:
 (def db {:uri "xdbc://localhost:8383/"
-         :user "test-admin" :password "uruktesting"
-         :content-base "TutorialDB"})
+         :user "uruk-tester" :password "password"
+         :content-base "UrukDB"})

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;;; Request options
@@ -43,13 +43,13 @@
     (testing "...with URI and content-base"
       (is (thrown? IllegalStateException
                    (with-open [session (create-session {:uri "xdbc://localhost:8383/"
-                                                        :content-base "TutorialDB"})]
+                                                        :content-base "UrukDB"})]
                      (.submitRequest session (.newAdhocQuery session "\"Hello world\""))))))

     (testing "...with URI, user, password"
       (is (= "Hello world"
              (with-open [session (create-session {:uri "xdbc://localhost:8383/"
-                                                  :user "test-admin" :password "uruktesting"})]
+                                                  :user "uruk-tester" :password "password"})]
                (-> session
                    (.submitRequest (.newAdhocQuery session
                                                    "\"Hello world\""))
@@ -141,7 +141,7 @@
     (testing "session creation with hosted content source using options"
       (with-open [sess (create-session
                         db (make-hosted-content-source "localhost" 8383
-                                                       {:content-base "TutorialDB"})
+                                                       {:content-base "UrukDB"})
                         {})]
         (is-default-session-config? (session->map sess))))
     ;; TODO once we want to delve into extreme complexity of ConnectionProvider
@@ -222,7 +222,7 @@
           opts {:default-request-options {:auto-retry-delay-millis 98
                                           :cache-result false
                                           :default-xquery-version "0.9-ml"
-                                          ;; XXX requires `xdmp:timestamp` privilege:
+                                          ;; XXX requires `xdmp:timestamp` execute privilege on the role for the current user
                                           :effective-point-in-time (.getCurrentServerPointInTime
                                                                     dummy-session)
                                           :locale (Locale. "ru")
@@ -260,22 +260,22 @@
       (testing "with hosted content source using content base"
         (with-open [sess (create-session
                           db (make-hosted-content-source "localhost" 8383
-                                                         {:content-base "TutorialDB"})
+                                                         {:content-base "UrukDB"})
                           opts)]
           (as-expected-session-config? (session->map sess) opts)))
       (testing "with hosted content source using user, password, content-base"
         (with-open [sess (create-session
                           db (make-hosted-content-source "localhost" 8383
-                                                         {:user "test-admin"
-                                                          :password "uruktesting"
-                                                          :content-base "TutorialDB"})
+                                                         {:user "uruk-tester"
+                                                          :password "password"
+                                                          :content-base "UrukDB"})
                           opts)]
           (as-expected-session-config? (session->map sess) opts)))
       (testing "with hosted content source using user and password"
         (with-open [sess (create-session
                           db (make-hosted-content-source "localhost" 8383
-                                                         {:user "test-admin"
-                                                          :password "uruktesting"})
+                                                         {:user "uruk-tester"
+                                                          :password "password"})
                           opts)]
           (as-expected-session-config? (session->map sess) opts)))
       ;; TODO once we want to delve into extreme complexity of ConnectionProvider
@@ -316,7 +316,7 @@
     (testing "...hosted content sources"
       (is (instance? com.marklogic.xcc.impl.SessionImpl
                      (create-default-session (make-hosted-content-source "localhost" 8383
-                                                                         {:content-base "TutorialDB"}))))
+                                                                         {:content-base "UrukDB"}))))
       (is (= "default session logger" (-> (make-hosted-content-source "localhost" 8383
                                                                       {:default-logger (Logger/getLogger "default session logger")})
                                           create-default-session
@@ -838,8 +838,8 @@

 ;; (comment
 ;;   (session->map (create-session {:uri "xdbc://localhost:8383/"
-;;                                     :user "test-admin" :password "uruktesting"
-;;                                     :content-base "TutorialDB"}
+;;                                     :user "uruk-tester" :password "password"
+;;                                     :content-base "UrukDB"}
 ;;                                    {} (uri-content-source "xdbc://localhost:8383/"
 ;;                                                           (security-options TODO)))))

@@ -869,7 +869,7 @@
 (deftest content-source-creation-with-host-port-user-pwd
   (testing "content source creation from host and port"
     (let [cs (make-hosted-content-source "localhost" 8383
-                                         {:user "test-admin" :password "uruktesting"})]
+                                         {:user "uruk-tester" :password "password"})]
       (and (instance? ContentSource cs)
            (= 8383 (.getPort (.getConnectionProvider cs)))
            (= "localhost" (.getHostName (.getConnectionProvider cs)))))))
@@ -877,18 +877,18 @@
 ;; TODO with SSLContext
 ;; (comment
 ;;   (describe-session-options (create-session {:uri "xdbc://localhost:8383/"
-;;                                     :user "test-admin" :password "uruktesting"
-;;                                     :content-base "TutorialDB"}
+;;                                     :user "uruk-tester" :password "password"
+;;                                     :content-base "UrukDB"}
 ;;                                    (hosted-content-source "localhost" 8383
-;;                                                           "test-admin" "x" "TutorialDB"
+;;                                                           "uruk-tester" "x" "UrukDB"
 ;;                                                           (security-options TODO))
 ;;                                    {}))

 ;;   (describe-session-options (create-session {:uri "xdbc://localhost:8383/"
-;;                                     :user "test-admin" :password "uruktesting"
-;;                                     :content-base "TutorialDB"}
+;;                                     :user "uruk-tester" :password "password"
+;;                                     :content-base "UrukDB"}
 ;;                                    (managed-content-source connection-provider ;; TODO implement https://docs.marklogic.com/javadoc/xcc/com/marklogic/xcc/spi/ConnectionProvider.html interface
-;;                                                            "test-admin" "x" "TutorialDB")
+;;                                                            "uruk-tester" "x" "UrukDB")
 ;;                                    {})))

 (deftest content-src-options


clean up wanton printlns

clean up wanton printlns

--- seathree/src/seathree/core.clj
+++ seathree/src/seathree/core.clj
@@ -25,7 +25,7 @@
 (defn top-off-update
   "Mark the given username's last update time as now"
   [username]
-  (println "TOPPING OFF")
+  (println "TOPPING OFF FOR" username)
   (wcar* (car/set (update-key username) (time-to-str (time/now)))))

 (defn update-tweets-for
@@ -35,7 +35,6 @@
    parallel against google translate and store the resulting tweets in
    redis"
   [username since]
-  (println "HELLO")
   (top-off-update username)
   ;; TODO stub
   (wcar* (car/lpush (tweets-key username) "foo" "bar" "baz" "quuz")))
@@ -47,15 +46,16 @@
   (future
     (if (time/before? last-update (time/minus (time/now) stale))
       (do
-        (println "UPDATING TWEETS" username)
+        (println "UPDATING TWEETS FOR" username)
         (update-tweets-for username last-update))
-      (println "NOTHING"))))
+      (println "TWEETS FRESH FOR" username))))

 (defn tweets-for
   "Given a list of twitter handles, returns a map of username -> list
    of translated tweets"
   [usernames]
   (for [username usernames]
+    (println "FETCHING TWEETS FOR" username)
     (let [[tweets last-update] (wcar* (car/lrange (tweets-key username) 0 9)
                                       (car/get (update-key username)))]
       (update-last-sync (sync-key username) (time/now)) ; TODO move this to handler. Should only touch this value when an actual request comes in.


Fix indent and note about using getName

Fix indent and note about using getName

--- src/io/perun/markdown.clj
+++ src/io/perun/markdown.clj
@@ -37,9 +37,10 @@

 (defn process-file [file]
   (let [file-content (slurp file)]
-      (u/info "Processing Markdown: %s\n" (.getName file))
-      [(.getName file) (merge (parse-file-metadata file-content)
-                              {:content (markdown-to-html file-content)})]))
+    ; .getName returns only the filename so this should work cross platform
+    (u/info "Processing Markdown: %s\n" (.getName file))
+    [(.getName file) (merge (parse-file-metadata file-content)
+                            {:content (markdown-to-html file-content)})]))

 (defn parse-markdown [markdown-files]
   (let [parsed-files (into {} (map #(-> % io/file process-file) markdown-files))]


Add more details to list-route

Add more details to list-route

--- src/instaskip/actions/routes.clj
+++ src/instaskip/actions/routes.clj
@@ -18,5 +18,8 @@
                                            :activate-at :created-at
                                            :uses-common-filters :endpoint])]
     (println "List route wiht id" id)
-    (t/table filtered-route)))
-
+    (t/table filtered-route)
+    (println "Filters for the route")
+    (t/table (route :filters))
+    (println "Predicates for the route")
+    (t/table (route :predicates))))


Add from.

Add from.

--- src/kixi/hecuba/api/entities.clj
+++ src/kixi/hecuba/api/entities.clj
@@ -111,9 +111,10 @@
 (defn filter-entities
   ([params role store]
      (let [query-string   (or (:q params) "*")
+           page-number    (or (:page params) 0)
            page-size      (or (:size params) default-page-size)
-           page-number    (*  (or (:page params) 0) page-size)
-           results        (search/search-entities query-string page-number page-size (:search-session store))
+           from           (* page-number page-size)
+           results        (search/search-entities query-string from page-size (:search-session store))
            total_hits     (esr/total-hits results)
            file-bucket    (-> store :s3 :file-bucket)
            parsed-results (parse-entities results nil nil role file-bucket)]
@@ -122,11 +123,12 @@
                    :entities   parsed-results}}))
   ([params allowed-programmes allowed-projects role store]
      (let [query-string   (or (:q params) "*")
+           page-number    (or (:page params) 0)
            page-size      (or (:size params) default-page-size)
-           page-number    (*  (or (:page params) 0) page-size)
+           from           (* page-number page-size)
            shoulds        (should-terms allowed-programmes allowed-projects)
            filter-terms   (search-filter nil shoulds nil)
-           results        (search/search-entities query-string filter-terms page-number page-size (:search-session store))
+           results        (search/search-entities query-string filter-terms from page-size (:search-session store))
            total_hits     (esr/total-hits results)
            file-bucket    (-> store :s3 :file-bucket)
            parsed-results (parse-entities results allowed-programmes allowed-projects role file-bucket)]
@@ -135,12 +137,13 @@
                    :entities   parsed-results}}))
   ([project_id params allowed-programmes allowed-projects role store]
      (let [query-string   (or (:q params) "*")
+           page-number    (or (:page params) 0)
            page-size      (or (:size params) default-page-size)
-           page-number    (*  (or (:page params) 0) page-size)
+           from           (* page-number page-size)
            shoulds        (should-terms allowed-programmes allowed-projects)
            must           (must-term :project_id project_id)
            filter-terms   (search-filter must shoulds nil)
-           results        (search/search-entities query-string filter-terms page-number page-size (:search-session store))
+           results        (search/search-entities query-string filter-terms from page-size (:search-session store))
            total_hits     (esr/total-hits results)
            file-bucket    (-> store :s3 :file-bucket)
            parsed-results (parse-entities results allowed-programmes allowed-projects role file-bucket)]


follow kibit lint suggestions

follow kibit lint suggestions

--- src/kixi/hecuba/api/profiles.clj
+++ src/kixi/hecuba/api/profiles.clj
@@ -21,7 +21,7 @@
           method       (:request-method request)
           route-params (:route-params request)
           entity_id    (:entity_id route-params)
-          entity       (-> (db/execute session (hayt/select :entities (hayt/where [[= :id entity_id]]))) first)]
+          entity       (first (db/execute session (hayt/select :entities (hayt/where [[= :id entity_id]]))))]
       (case method
         :post (not (nil? entity))
         :get (let [items (db/execute session (hayt/select :profiles (hayt/where [[= :entity_id entity_id]])))]
@@ -586,10 +586,10 @@
   (let [item (json/decode item-string)
         association-name   (:name   association)
         association-schema (:schema association)]
-    (->> association-schema
-         (map
-           (fn [attr]
-             [ (str (name association-name) "_" (name attr)) (item (name attr)) ])))))
+    (map
+     (fn [attr]
+       [ (str (name association-name) "_" (name attr)) (item (name attr)) ])
+     association-schema)))

 (defn explode-associated-items [association items]
   (let [association-name   (name (:name    association))
@@ -606,17 +606,14 @@

 (defn explode-and-sort-by-schema [item schema]
   (let [exploded-item
-        (->> schema
-             (mapcat
-               (fn [attr]
-                 (let [t (attribute-type attr)]
-                   (case t
-                     :attribute          (do
-                                           (list [(name attr) (item attr)]))
-                     :nested-item        (do
-                                           (explode-nested-item attr (item (:name attr))))
-                     :associated-items   (do
-                                           (explode-associated-items attr (item (:name attr)))))))))]
+         (mapcat
+           (fn [attr]
+             (let [t (attribute-type attr)]
+               (case t
+                 :attribute          (list [(name attr) (item attr)])
+                 :nested-item        (explode-nested-item attr (item (:name attr)))
+                 :associated-items   (explode-associated-items attr (item (:name attr))))))
+           schema)]
     exploded-item))

 (defn extract-attribute [attr-key input]
@@ -635,24 +632,24 @@
   while input is expected to be a hash-map representing the profile, with strings as keys"
   (let [association-name   (:name   attr)
         association-schema (:schema attr)
-        nested-item (->> association-schema
-                         (reduce
-                           (fn [nested-item nested-attr]
-                             (let [nested-attr-name (name nested-attr)
-                                   exploded-attr-name (str (name association-name) "_" nested-attr-name)]
-                               (conj nested-item { nested-attr (input exploded-attr-name)})))
-                           {}))]
+        nested-item (reduce
+                      (fn [nested-item nested-attr]
+                        (let [nested-attr-name (name nested-attr)
+                              exploded-attr-name (str (name association-name) "_" nested-attr-name)]
+                          (conj nested-item { nested-attr (input exploded-attr-name)})))
+                      {}
+                      association-schema)]
     {association-name nested-item}))

 (defn extract-associated-item [association-name association-schema input index]
   "Extracts the item belonging to a 'has many' association from input, at position index."
-  (->> association-schema
-    (reduce
-      (fn [associated-item associated-item-attr]
-        (let [associated-item-attr-name (name associated-item-attr)
-              exploded-attr-name (str (name association-name) "_" index "_" associated-item-attr-name)]
-          (conj associated-item { associated-item-attr (input exploded-attr-name)})))
-      {})))
+  (reduce
+    (fn [associated-item associated-item-attr]
+      (let [associated-item-attr-name (name associated-item-attr)
+            exploded-attr-name (str (name association-name) "_" index "_" associated-item-attr-name)]
+        (conj associated-item { associated-item-attr (input exploded-attr-name)})))
+    {}
+    association-schema))

 (defn extract-associated-items [attr input]
   "Extracts a collection representing a 'has many' association from input.
@@ -683,16 +680,16 @@
   standaed       | timestamp                   | timestamp                  |
   nested item    | profile_data, bedroom_count | profile_data_bedroom_count |
   association    | storeys, first storey_type  | storeys_0_storey_type      |"
-  (->> schema
-       (reduce
-         (fn [item attr]
-           (let [t (attribute-type attr)
-                 imploded-attribute (case t
-                   :attribute               (extract-attribute attr input)
-                   :nested-item             (extract-nested-item attr input)
-                   :associated-items        (extract-associated-items attr input))]
-             (conj item imploded-attribute)))
-         {})))
+  (reduce
+    (fn [item attr]
+      (let [t (attribute-type attr)
+            imploded-attribute (case t
+              :attribute               (extract-attribute attr input)
+              :nested-item             (extract-nested-item attr input)
+              :associated-items        (extract-associated-items attr input))]
+        (conj item imploded-attribute)))
+    {}
+    schema))

 (defn index-malformed? [ctx]
   (let [request (:request ctx)
@@ -718,8 +715,7 @@
                              (map #(dissoc % :user_id)))
          formatted-items (if (= "text/csv" mime)
                            ; serving tall csv style profiles
-                           (let [exploded-items (->> userless-items
-                                                     (map #(explode-and-sort-by-schema % profile-schema)))]
+                           (let [exploded-items (map #(explode-and-sort-by-schema % profile-schema) userless-items)]
                              (apply util/map-longest
                                     add-profile-keys ["" ""] exploded-items))
                            ; serving json profiles
@@ -744,7 +740,7 @@

 (defn resource-exists? [store ctx]
   (db/with-session [session (:hecuba-session store)]
-    (let [request    (-> ctx :request)
+    (let [request    (:request ctx)
           _          (log/infof "resource-exists? request: %s" request)
           entity_id  (-> request :params :entity_id)
           profile_id (-> request :params :profile_id)
@@ -773,10 +769,10 @@
                          (let [body-map (reduce conj {} decoded-body)]
                            (parse-by-schema body-map profile-schema))
                          decoded-body)
-              entity_id  (-> item :entity_id)
+              {:keys [entity_id profile_id]} item
               username   (sec/session-username (-> ctx :request :session))
               user_id    (-> (db/execute session (hayt/select :users (hayt/where [[= :username username]]))) first :id)
-              profile_id (-> item :profile_id)]
+              ]
           (db/execute session (hayt/insert :profiles (hayt/values (-> body
                                                                       (assoc :id profile_id)
                                                                       (assoc :user_id user_id)
@@ -821,7 +817,9 @@
           user_id    (-> (db/execute session (hayt/select :users (hayt/where [[= :username username]]))) first :id)
           profile_id (sha1/gen-key :profile profile)]
       (when (and entity_id timestamp)
-        (when-not (empty? (-> (db/execute session (hayt/select :entities (hayt/where [[= :id entity_id]]))) first))
+        (when (seq
+                (first
+                  (db/execute session (hayt/select :entities (hayt/where [[= :id entity_id]])))))
           (let [query-profile (-> profile
                                  (assoc :user_id user_id)
                                  (update-stringified-lists


phew...types!

phew...types!

--- src/leiningen/code_generator.clj
+++ src/leiningen/code_generator.clj
@@ -38,14 +38,15 @@
   (let [templ-map (dataset->template-map ns dataset)]
     (stenc/render-file "templates/db.mustache" templ-map)))

-
-(defn store-db-file [ns string filename proj-fp]
+(ann ^:no-check store-db-file [String String String String -> nil])
+(defn store-db-file [ns file-content filename proj-fp]
   (let [ns-path (str proj-fp "/" (s/replace ns #"\." "/"))
         ns-file-path (str ns-path "/" filename)]
     (faf/create-if-not-exists ns-path)
-    (spit ns-file-path string)))
-;
-;(defn store-dataset [ns dataset proj-fp]
-;  (let [file-content (render-db-file ns dataset)
-;        filename (str (:name dataset) ".clj")]
-;    (store-db-file ns file-content filename proj-fp)))
+    (spit ns-file-path file-content)))
+
+(ann store-dataset [String pt/entity-description String -> nil])
+(defn store-dataset [ns dataset proj-fp]
+  (let [file-content (render-db-file ns dataset)
+        filename (str (:name dataset) ".clj")]
+    (store-db-file ns file-content filename proj-fp)))