Provide props

Provide props

--- frontend/src/crunsher/views.cljs
+++ frontend/src/crunsher/views.cljs
@@ -21,34 +21,54 @@
   Object
   (render [this]
     (let [pokemon (om/props this)
-          pokemon-db (lib/get-pokemon-by-id (:pokemon-id pokemon))]
+          pokemon-db (lib/get-pokemon-by-id (:pokemon_id pokemon))]
       (dom/tr nil
-              (dom/td nil (:pokemon-id pokemon))
+              (dom/td nil (:pokemon_id pokemon))
               (dom/td nil (:name pokemon-db))
-              (dom/td nil (:individual-attack pokemon))
-              (dom/td nil (:individual-defense pokemon))
-              (dom/td nil (:individual-stamina pokemon))))))
-(def poketable-entry (om/factory PokeTableEntry))
+              (dom/td nil (:individual_attack pokemon))
+              (dom/td nil (:individual_defense pokemon))
+              (dom/td nil (:individual_stamina pokemon))))))
+(def poketable-entry (om/factory PokeTableEntry {}))

 (defui PokeTable
   Object
   (render [this]
-    (dom/table #js {:className "table table-hover"}
-               (dom/thead nil
-                          (dom/tr nil
-                                  (dom/th nil "#")
-                                  (dom/th nil "Name")
-                                  (dom/th nil "Attack")
-                                  (dom/th nil "Defense")
-                                  (dom/th nil "Stamina")))
-               (apply dom/tbody nil
-                      (map #(poketable-entry (lib/merge-react-key %)) (lib/inventory-pokemon))))))
-(def poketable (om/factory PokeTable))
+    (dom/div nil
+             (dom/table #js {:className "table table-hover"}
+                        (dom/thead nil
+                                   (dom/tr nil
+                                           (dom/th nil "#")
+                                           (dom/th nil "Name")
+                                           (dom/th nil "Attack")
+                                           (dom/th nil "Defense")
+                                           (dom/th nil "Stamina")))
+                        (apply dom/tbody nil
+                               (map #(poketable-entry (lib/merge-react-key %)) (lib/inventory-pokemon)))))))
+(def poketable (om/factory PokeTable {}))

-(defui ^:once Main
+(defui Counter
+  static om/IQuery
+  (query [this]
+    [:count])
+  Object
+  (render [this]
+    (let [{:keys [count]} (om/props this)]
+      (dom/div nil
+               (dom/span nil (str "Count: " count))
+               (dom/button
+                 #js {:onClick
+                      (fn [e] (om/transact! this '[(increment)]))}
+                 "Click me!")))))
+(def counter (om/factory Counter))
+
+
+(defui Main
   Object
   (render [this]
     (dom/div nil
              (dom/h1 nil "Poké-Crunsher")
-             (dom/div nil (poketable))
-             (dom/div nil (controls)))))+             (dom/div nil (controls))
+             (dom/div nil (poketable (om/props this)))
+             (dom/div nil (counter (om/props this))))))
+
+


Remove reflection

Remove reflection

--- src/main/clojure/clojure/test/check/rose_tree.cljc
+++ src/main/clojure/clojure/test/check/rose_tree.cljc
@@ -29,13 +29,13 @@
 (defn root
   "Returns the root of a Rose tree."
   {:no-doc true}
-  [rose]
+  [^RoseTree rose]
   (.-root rose))

 (defn children
   "Returns the children of the root of the Rose tree."
   {:no-doc true}
-  [rose]
+  [^RoseTree rose]
   (.-children rose))

 (defn make-rose


Доработки горизонтальной гистограммы

Доработки горизонтальной гистограммы

--- radiolamp-6P3S/src/r6p3s/cpt/d3/chart_histogramm_horizontal.cljs
+++ radiolamp-6P3S/src/r6p3s/cpt/d3/chart_histogramm_horizontal.cljs
@@ -22,7 +22,10 @@
                    bottom
                    x-value-fn
                    y-value-fn
+                   y-value-label-fn
                    y-label
+                   min-p
+                   max-p
                    title
                    description
                    fill
@@ -34,6 +37,8 @@
                    rigth       15
                    bottom      20
                    y-label     ""
+                   min-p       1
+                   max-p       1.1
                    fill        "orange"
                    over-fill   "rebeccapurple"}}]

@@ -65,7 +70,7 @@
                           (.rangeRoundBands #js [0 chart-height] 0.1))

               x-scale (-> js/d3 .-scale .linear
-                          (.domain (d3c/min-max y-value-fn min 1 max 1.1 data))
+                          (.domain (d3c/min-max y-value-fn min min-p max max-p data))
                           (.range  #js [0 chart-width]))

               x-axis (-> js/d3 .-svg .axis (.scale x-scale) (.orient "bottom"))
@@ -128,12 +133,16 @@
             (-> texts
                 ;;(.style "text-anchor" "middle")
                 (.attr "x" (fn [row]
-                                 (let [d (x-scale (y-value-fn row))]
+                             (let [d (x-scale (y-value-fn row))]
                                    (+ 2 (if (< 1 d) d 1)))))
                 (.attr "y" #(+
                              (y-scale (x-value-fn %))
                              (/ (.rangeBand y-scale) 2)))
-                (.text (fn [row] (str (y-value-fn row)))))
+                (.text (fn [row]
+                         (str
+                          (if y-value-label-fn
+                            (y-value-label-fn row)
+                            (y-value-fn row))))))

             (-> texts
                 .exit


Missing cURL comments from collection creation create REST API tests.

--- test/fcms/integration/rest_api/collection/collection_create.clj
+++ test/fcms/integration/rest_api/collection/collection_create.clj
@@ -17,14 +17,14 @@
 ;; all good - generated slug is already used
 ;; all good - with slug
 ;; all good - unicode in the body
+;; no accept
+;; no content type
+;; no charset
 ;; conflicting reserved properties
-;; no accept
 ;; wrong accept
-;; no content type
 ;; wrong content type
-;; no charset
+;; no body
 ;; wrong charset
-;; no body
 ;; body not valid JSON
 ;; no name in body
 ;; slug specified in body is already used
@@ -70,6 +70,8 @@
       ;; Collection is empty?
       (collection/item-count c) => 0)

+    ;; all good - generated slug is different than the provided name - 201 Created
+    ;; curl -i --header "Accept: application/vnd.fcms.collection+json;version=1" --header "Accept-Charset: utf-8" --header "Content-Type: application/vnd.fcms.collection+json;version=1" -X POST -d '{"name":" -tHiS #$is%?-----ελληνικήalso-მივჰხვდემასჩემსაãالزجاجوهذالايؤلمني-slüg♜-♛-☃-✄-✈  - "}' http://localhost:3000/
     (fact "when the generated slug is different than the provided name"
       ;; Create the collection
       (let [response (create-collection-with-api {:name long-unicode-name})]
@@ -86,6 +88,10 @@
       ;; Collection is empty?
       (collection/item-count "this-is-also-a-slug") => 0)

+    ;; all good - generated slug is already used - 201 Created
+    ;; curl -i --header "Accept: application/vnd.fcms.collection+json;version=1" --header "Accept-Charset: utf-8" --header "Content-Type: application/vnd.fcms.collection+json;version=1" -X POST -d '{"name":"c"}' http://localhost:3000/
+    ;; curl -i --header "Accept: application/vnd.fcms.collection+json;version=1" --header "Accept-Charset: utf-8" --header "Content-Type: application/vnd.fcms.collection+json;version=1" -X POST -d '{"name":"c"}' http://localhost:3000/
+    ;; curl -i --header "Accept: application/vnd.fcms.collection+json;version=1" --header "Accept-Charset: utf-8" --header "Content-Type: application/vnd.fcms.collection+json;version=1" -X POST -d '{"name":"c"}' http://localhost:3000/
     (fact "when the generated slug is already used"
       ;; Create first collection
       (let [response (create-collection-with-api {:name c})]
@@ -117,6 +123,8 @@
       ;; Collection is empty?
       (collection/item-count c) => 0)

+    ;; all good - with slug - 201 Created
+    ;; curl -i --header "Accept: application/vnd.fcms.collection+json;version=1" --header "Accept-Charset: utf-8" --header "Content-Type: application/vnd.fcms.collection+json;version=1" -X POST -d '{"name":"c", "slug":"another-c"}' http://localhost:3000/
     (fact "with a provided slug"
       ;; Create the collection
       (let [response (create-collection-with-api {:name c :slug "another-c"})]
@@ -133,6 +141,7 @@
       ;; Collection is empty?
       (collection/item-count "another-c") => 0)

+    ;; all good - unicode in the body - 201 Created
     (fact "containing unicode"
       ;; Create the collection
       (let [response (create-collection-with-api {:name unicode-name :slug c :description unicode-description})]
@@ -149,6 +158,8 @@
       ;; Collection is empty?
       (collection/item-count c) => 0)

+    ;; no accept - 201 Created
+    ;; curl -i --header "Accept-Charset: utf-8" --header "Content-Type: application/vnd.fcms.collection+json;version=1" -X POST -d '{"name":"c"}' http://localhost:3000/
     (fact "without an Accept header"
       (let [response (create-collection-with-api {:Content-Type (mime-type :collection) :Accept-Charset "utf-8"} {:name c})]
         (:status response) => 201
@@ -164,6 +175,8 @@
       ;; Collection is empty?
       (collection/item-count c) => 0)

+    ;; no content type - 201 Created
+    ;; curl -i --header "Accept: application/vnd.fcms.collection+json;version=1" --header "Accept-Charset: utf-8" -X POST -d '{"name":"c"}' http://localhost:3000/
     (fact "without a Content-Type header"
       (let [response (create-collection-with-api {:Accept (mime-type :collection) :Accept-Charset "utf-8"} {:name c})]
         (:status response) => 201
@@ -179,6 +192,8 @@
       ;; Collection is empty?
       (collection/item-count c) => 0)

+    ;; no charset - 201 Created
+    ;; curl -i --header "Accept: application/vnd.fcms.collection+json;version=1" --header "Content-Type: application/vnd.fcms.collection+json;version=1" -X POST -d '{"name":"c"}' http://localhost:3000/
     (fact "without an Accept-Charset header"
       (let [response (create-collection-with-api {:Accept (mime-type :collection) :Accept-Charset "utf-8"} {:name c})]
         (:status response) => 201


fixed encoding error with umlaut

fixed encoding error with umlaut

--- src/distillery/view/video.clj
+++ src/distillery/view/video.clj
@@ -56,7 +56,7 @@
                        (/ num-occ max-occ)
                        (conf-fn mean-confidence)))))]
     (div "hitlist"
-         [(headline 3 "H??ufige Worte")
+         [(headline 3 "Häufige Worte")
           (olist (map item-gen hitlist))])))

 (defn- render-overview


Cope with null temp values

Cope with null temp values

--- app/pyrexia/src/pyrexia/colour_line.cljs
+++ app/pyrexia/src/pyrexia/colour_line.cljs
@@ -8,7 +8,7 @@
   (+ x (/ (- y x) 2)))

 (defn temp-format [val]
-    (gstring/format "%.1f" val))
+  (if (nil? val) "" (gstring/format "%.1f" val)))

 (defn- colours-view []
   (let [colour-count 20


Verifies the with-temp-file opts value is usable

--- plugins/matross/tasks/temp_file.clj
+++ plugins/matross/tasks/temp_file.clj
@@ -52,7 +52,9 @@
       :else
       (let [binding-count (count bindings)
             temp-files (gensym "temp-files")]
-        `(let [~temp-files (temp-file-list ~conn (merge {:type :temp-file} ~opts) ~binding-count)
+        `(let [opts# ~opts
+               _# (if (not (or (map? opts#) (nil? opts#))) (throw (IllegalArgumentException. "Configuration must be a map or nil.")))
+               ~temp-files (temp-file-list ~conn (merge {:type :temp-file} opts#) ~binding-count)
                ~@(apply concat
                         (map-indexed (fn [i v] [v `(nth ~temp-files ~i)])
                                      bindings))


Simplify missing BallotName query

Simplify missing BallotName query

It included a clause copied from the missing-id query that is redundant here.

--- src/vip/data_processor/validation/v5/candidate.clj
+++ src/vip/data_processor/validation/v5/candidate.clj
@@ -42,8 +42,7 @@
   "SELECT xtv.path
     FROM (SELECT DISTINCT subltree(path, 0, 4) || 'BallotName' AS path
           FROM xml_tree_values WHERE results_id = ?
-          AND subltree(path, 0, 4) ~ 'VipObject.0.Candidate.*{1}'
-          AND nlevel(subltree(path, 0, 4)) = 4) xtv
+          AND subltree(path, 0, 4) ~ 'VipObject.0.Candidate.*{1}') xtv
     LEFT JOIN (SELECT path FROM xml_tree_values WHERE results_id = ?) xtv2
     ON xtv.path = subltree(xtv2.path, 0, 5)
     WHERE xtv2.path IS NULL")


Removed obsolete function.

Removed obsolete function.

--- src/fm/simrunner/gui/view.clj
+++ src/fm/simrunner/gui/view.clj
@@ -162,13 +162,3 @@
                                          :config-editor config-editor
                                          :console       console}))))

-(defn simrunner-frame [& {:as options}]
-  (let [options (apply concat options)
-        frame   (apply gui/frame options)
-        view    (simrunner-view)]
-    (-> frame
-        :widget
-        .getContentPane
-        (.add (:widget view)))
-    (assoc frame :contents {:simrunner-view view})))
-


Switch to :global-vars

Switch to :global-vars

--- metrics-clojure-core/project.clj
+++ metrics-clojure-core/project.clj
@@ -15,4 +15,4 @@
                :1.6    {:dependencies [[org.clojure/clojure "1.6.0-master-SNAPSHOT"]]}
                :master {:dependencies [[org.clojure/clojure "1.6.0-master-SNAPSHOT"]]}}
   :aliases  {"all" ["with-profile" "+dev:+1.3:+1.4:+1.6:+master"]}
-  :warn-on-reflection true)
+  :global-vars {*warn-on-reflection* true})


[scamp] use 'msg->envelope to avoid by-hand message construction

--- modules/scamp/src/scamp/core.clj
+++ modules/scamp/src/scamp/core.clj
@@ -396,22 +396,18 @@
   :node-unsubscription message to and return 'world."
   [world :- WorldSchema
    node-to-unsubscribe :- NodeContactAddressSchema]
-  (add-messages world [[:message-envelope
-                        node-to-unsubscribe
-                        :node-unsubscription
-                        node-to-unsubscribe
-                        (*get-envelope-id*)]]))
+  (add-messages world [(msg->envelope node-to-unsubscribe
+                                      :node-unsubscription
+                                      node-to-unsubscribe)]))

 (s/defn send-msg-node-replacement :- MessageEnvelopeSchema
   [recipient-node-contact-address :- NodeContactAddressSchema
    old-node-contact-address :- NodeContactAddressSchema
    new-node-contact-address :- NodeContactAddressSchema]
-  [:message-envelope
-   recipient-node-contact-address
-   :node-replacement
-   {:old old-node-contact-address
-    :new new-node-contact-address}
-   (*get-envelope-id*)])
+  (msg->envelope recipient-node-contact-address
+                 :node-replacement
+                 {:old old-node-contact-address
+                  :new new-node-contact-address}))

 (s/defn send-msg-node-removal :- MessageEnvelopeSchema
   [recipient-node-contact-address :- NodeContactAddressSchema


more tests

more tests

--- moebius/test/moebius/kv_test.clj
+++ moebius/test/moebius/kv_test.clj
@@ -43,4 +43,28 @@
                  (kv/set "s2" "key1" "v2")
                  (kv/get "s2" "key1"))         =>       "v2"

-                 ))
+                 )
+
+
+       (fact "if a key hasn't been set or remove should return `nil`"
+
+             ;; assertion                             expected result
+             (-> kvstore
+                 (kv/set "s1" "key1" "v1")
+                 (kv/set "s2" "key1" "v2")
+                 (kv/get "s3" "key1"))         =>       nil
+
+             (-> kvstore
+                 (kv/set "s1" "key1" "v1")
+                 (kv/set "s2" "key1" "v2")
+                 (kv/get "s1" "key5"))         =>       nil
+
+             (-> kvstore
+                 (kv/set "s1" "key1" "v1")
+                 (kv/set "s1" "key1" nil)
+                 (kv/get "s1" "key1"))         =>       nil
+                 )
+
+
+
+       )


(maint) Add TODO for SERVER-763 location

--- src/puppetlabs/trapperkeeper/authorization/ring_middleware.clj
+++ src/puppetlabs/trapperkeeper/authorization/ring_middleware.clj
@@ -27,6 +27,7 @@
     (->
       request
       (assoc-in name-key (str id))
+      ; TODO SERVER-763 Get authenticity from header if allow-header-cert-info
       (assoc-in is-authentic-key (if id true false)))))

 (schema/defn wrap-authorization-check :- IFn


CMR-3590 removes proto-repl.saved-values

--- access-control-app/int_test/cmr/access_control/int_test/acl_search_test.clj
+++ access-control-app/int_test/cmr/access_control/int_test/acl_search_test.clj
@@ -66,7 +66,6 @@
                                                           :name "1 numbered"
                                                           :collection_applicable true}})
         get-name #(get-in % [:catalog_item_identity :name])]
-    (proto-repl.saved-values/save 1)
     (is (= [(get-name acl3) (get-name acl2) (get-name acl1)
             "Provider - PROV1 - CATALOG_ITEM_ACL"
             "System - ANY_ACL"]


add plan trial notice helpers

add plan trial notice helpers

--- frontend/models/plan.cljs
+++ frontend/models/plan.cljs
@@ -1,5 +1,7 @@
 (ns frontend.models.plan
-  (:require [goog.string :as gstring]))
+  (:require [goog.string :as gstring]
+            [cljs-time.core :as time]
+            [cljs-time.format :as time-format]))

 (defn max-parallelism
   "Maximum parallelism that the plan allows (usually 16x)"
@@ -14,3 +16,19 @@
 (defn max-selectable-parallelism [plan]
   (min (max-parallelism plan)
        (usable-containers plan)))
+
+(defn trial? [plan]
+  (some-> plan :template-properties :type name (= "trial")))
+
+(defn trial-over? [plan]
+  (time/after? (time/now) (time-format/parse (:trial_end plan))))
+
+(defn days-left-in-trial
+  "Returns number of days left in trial, can be negative."
+  [plan]
+  (let [trial-end (time-format/parse (:trial_end plan))
+        now (time/now)]
+    (if (time/after? trial-end now)
+      ;; count partial days as a full day
+      (inc (time/in-days (time/interval now trial-end)))
+      (- (time/in-days (time/interval trial-end now))))))


Removing logging so that the junit ouput can be parsed.

--- system-int-test/src/cmr/system_int_test/system.clj
+++ system-int-test/src/cmr/system_int_test/system.clj
@@ -46,7 +46,6 @@
                                              #(when % (lifecycle/start % system))))
                                 system
                                 component-order)]
-     (info "system-int-test System started")
      (reset! saved-system started-system))))

 (defn stop
@@ -62,7 +61,6 @@
                                                #(when % (lifecycle/stop % system))))
                                   system
                                   (reverse component-order))]
-       (info "system-int-test System stopped")
        (reset! saved-system nil)
        stopped-system))))


minor: improve unit tests

minor: improve unit tests

--- ssclj/auth/test/com/sixsq/slipstream/auth/com/sixsq/slipstream/auth/test_simple_authentication.clj
+++ ssclj/auth/test/com/sixsq/slipstream/auth/com/sixsq/slipstream/auth/test_simple_authentication.clj
@@ -23,8 +23,14 @@
 (def wrong-both         {:user-name "wrong"  :password   "wrong"})
 (def missing-user       {:password  "secret"})
 (def missing-password   {:user-name "joe"})
+(def missing-both       {})

-(def wrongs [wrong-user wrong-password wrong-both missing-user missing-password])
+(def wrongs [wrong-user
+             wrong-password
+             wrong-both
+             missing-user
+             missing-password
+             missing-both])

 (defn- rejected?
   [[ok? result]]
@@ -34,7 +40,8 @@
   [[ok? result]]
   (and
     ok?
-    (= (select-keys valid-credentials [:user-name]) result)))
+    (= (select-keys valid-credentials [:user-name]) result)
+    (not (contains? result :password))))

 (deftest test-auth-user-when-not-added
   (doseq [wrong (cons valid-credentials wrongs)]


Удалил лишний println

Удалил лишний println

--- radiolamp-6P3/src/r6p3/dataform.clj
+++ radiolamp-6P3/src/r6p3/dataform.clj
@@ -185,7 +185,6 @@
   (let [rbs (->> entitys
                  (reduce-kv
                   (fn [a k e]
-                    (println k e)
                     (->> (kc/select e)
                          (reduce #(assoc %1 (%2 :id) (dissoc %2 :id)) {})
                          (assoc a k)))


Avoid use of partial

Avoid use of partial

--- clojure/httpkit/src/websocket/server.clj
+++ clojure/httpkit/src/websocket/server.clj
@@ -35,7 +35,7 @@
 (defn ws-handler [request]
   (with-channel request channel
     (connect! channel)
-    (on-close channel (partial disconnect! channel))
+    (on-close channel #(disconnect! channel %))
     (on-receive channel #(dispatch channel %))))

 (defroutes websocket-routes


free-word.clj: various improvements

free-word.clj: various improvements

--- clojure/org/gavrog/clojure/free_word.clj
+++ clojure/org/gavrog/clojure/free_word.clj
@@ -2,17 +2,17 @@

 (defn normalise [xs]
   (assert (every? integer? xs))
-  (reduce (fn [w x]
-            (cond (= 0 x)
-                  w
-                  (= (last w) (- x))
-                  (pop w)
-                  :else
-                  (conj w x)))
-          []
-          xs))
+  (reduce (fn [w x] (cond (= 0 x)
+                          w,
+                          (= (last w) (- x))
+                          (pop w),
+                          :else
+                          (conj w x)))
+          [] xs))

 (defn- overlap [w1 w2]
+  (assert (every? integer? w1))
+  (assert (every? integer? w2))
   (let [n1 (count w1)
         n2 (count w2)
         n (min n1 n2)
@@ -30,15 +30,28 @@
     (reduce product (product w1 w2) ws)))

 (defn inverse [w]
+  (assert (every? integer? w))
   (into [] (map - (reverse w))))

 (defn raised-to [w m]
-  (let [n (count w)
-        k (overlap w w)]
-    (if (= k n)
-      (if (odd? m) w [])
-      (let [head (subvec w 0 (- (dec n) k))
-            tail (subvec w (inc k))
-            mid (subvec w k (- n k))]
-        (into (reduce into head (repeat m mid)) tail)))))
+  (cond
+    (zero? m)
+    [],
+    (neg? m)
+    (raised-to (inverse w) (- m)),
+    :else
+    (let [n (count w)
+          k (overlap w w)]
+      (if (= k n)
+        (if (odd? m) w [])
+        (let [head (subvec w 0 (- (dec n) k))
+              tail (subvec w (inc k))
+              mid (subvec w k (- n k))]
+          (into (reduce into head (repeat m mid)) tail))))))

+(defn commutator [a b]
+  (product a b (inverse a) (inverse b)))
+
+(def w* product)
+
+(def w** raised-to)


Fix initial sorting in table component

Fix initial sorting in table component

--- src/cljs/org/broadinstitute/firecloud_ui/common/table.cljs
+++ src/cljs/org/broadinstitute/firecloud_ui/common/table.cljs
@@ -127,7 +127,8 @@
         {:no-data? (zero? (count (.-filtered-data this)))
          :columns columns
          :dragging? false}
-        (when-let [col (first (filter #(contains? % :sort-initial) columns))]
+        (when-let [col (first (filter #(contains? % :sort-initial)
+                                      (map merge (:columns props) columns)))]
           {:key-fn (if-let [sorter (:sort-by col)]
                      (fn [row] (sorter (nth row (:index col))))
                      (fn [row] (nth row (:index col))))


Updated Dice Game to go up to n = 1000

Updated Dice Game to go up to n = 1000

--- src/clojush/problems/software/benchmarks_v2/dice_game2.clj
+++ src/clojush/problems/software/benchmarks_v2/dice_game2.clj
@@ -23,8 +23,8 @@

 (defn dice-game-input
   []
-  (let [die1 (inc (rand-int 100))
-        die2 (inc (rand-int 100))]
+  (let [die1 (inc (rand-int 1000))
+        die2 (inc (rand-int 1000))]
     [die1 die2]))

 ;; A list of data domains for the problem. Each domain is a vector containing
@@ -35,21 +35,21 @@
 (def dice-game-data-domains
   [[(list [1 2]
           [2 1]
-          [99 100]
-          [100 99]
-          [1 100]
-          [100 1]
+          [999 1000]
+          [1000 999]
+          [1 1000]
+          [1000 1]
           [3 4]
           [4 3]
           [4 6]
           [6 4]
           [49 50]
-          [50 49]
+          [500 493]
           [1 1]
-          [50 50]
-          [100 100]
+          [500 500]
+          [1000 1000]
           ) 15 0] ; Small and large cases that have n < m, n = m, and n > m
-   [(fn [] (let [x (inc (rand-int 100))]
+   [(fn [] (let [x (inc (rand-int 1000))]
              [x x])) 10 100] ; 10 cases with n = m
    [(fn [] (dice-game-input)) 175 1900] ; Random cases
    ])


Start adding forbidden again, running all tests

--- src/dependable/core_resolve.clj
+++ src/dependable/core_resolve.clj
@@ -58,7 +58,7 @@
                    present-package (get present-packages id)]
                (cond
                  (not (nil? present-package))
-                   (when
+                   (if
                        (or (and (= status :absent)
                                 (not (safe-spec-call spec present-package)))
                            (and (= status :present)
@@ -68,7 +68,8 @@
                       present-packages
                       found-packages
                       absent-specs
-                      rclauses))
+                      rclauses)
+                     [:forbidden id])
                  (= status :absent)
                  (resolve-deps
                   repo


Pre-partitioning into measures to allow for change of accompanying chord based on metric

--- src/aeolian/composer.clj
+++ src/aeolian/composer.clj
@@ -32,7 +32,7 @@
 	; 		(str "\n%%MIDI control 7 " (+ (* 2 method-length) 50)))))

 (defn metric-to-note
-	([metric]
+	[metric]
 		(let [
 					raw-note (str (build-note (parser/line-length-from-metric metric)) " ")
 					final-note-bits (cons (adjust-for-indentation metric)
@@ -43,21 +43,19 @@

 					; (println (str metric " becomes " final-note))
 			final-note))
-	([metric-idx metric total-metrics]
-		(log/info (str "Processing metric " (+ 1 metric-idx) " of " total-metrics))
-		(metric-to-note metric)))
+
+(defn- metrics-to-measure [metric-idx metrics-in-measure total-metrics]
+	(log/info (str "Processing measure " (+ 1 metric-idx) " of " total-metrics))
+	(let [measure (map #(metric-to-note %1) metrics-in-measure)]
+		(str "| " n/major-root (apply str measure) " |\n")))

 (defn- map-metrics [metrics]
 	(let [
-			mapped-notes (map-indexed #(metric-to-note %1 %2 (count metrics)) metrics)
-			notes-in-measures
-				(apply str
-					(flatten
-						(interpose
-							(str "|\n|" n/major-root)
-							(partition notes-per-measure mapped-notes))))
+			metrics-in-measures (partition notes-per-measure metrics)
+			mapped-notes (map-indexed #(metrics-to-measure %1 %2 (count metrics-in-measures)) metrics-in-measures)
+			notes-in-measures (apply str mapped-notes)
 		]
-		(str "|" n/major-root notes-in-measures " |")))
+		notes-in-measures))

 (defn compose [metrics]
 	(if (<= (count metrics) 0)


Adding jenkins to set of json log off

Adding jenkins to set of json log off

--- src/kixi/datastore/system.clj
+++ src/kixi/datastore/system.clj
@@ -104,7 +104,7 @@
   (let [level-config {:level (get-in config [:logging :level])
                       :ns-blacklist (get-in config [:logging :ns-blacklist])
                       :timestamp-opts kixi-log/default-timestamp-opts ; iso8601 timestamps
-                      :appenders (if (= profile :local)
+                      :appenders (if (#{:local :jenkins} profile)
                                    {:println (log/println-appender)}
                                    {:direct-json (kixi-log/timbre-appender-logstash)})}]
     (log/set-config! level-config)


Show which keystore is used when signing

--- src/leiningen/droid/build.clj
+++ src/leiningen/droid/build.clj
@@ -235,7 +235,7 @@
   it is missing."
   [{{:keys [out-apk-path sigalg
             keystore-path key-alias keypass storepass]} :android :as project}]
-  (info "Signing APK...")
+  (info "Signing APK with" keystore-path "...")
   (let [dev-build (dev-build? project)
         suffix (if dev-build "debug-unaligned" "unaligned")
         unaligned-path (append-suffix out-apk-path suffix)


Update _test/check_exercises.clj

Update _test/check_exercises.clj

See #84

--- _test/check_exercises.clj
+++ _test/check_exercises.clj
@@ -9,6 +9,6 @@
   (doseq [problem ((json/parse-string (slurp "config.json")) "problems")
           :let [path-to-problem (partial str problem "/")
                 problem-tests   (symbol (str problem "-test"))]]
-    (load-file (path-to-problem "example.clj"))
-    (load-file (path-to-problem (->snake_case problem) "_test.clj"))
+    (load-file (path-to-problem "src/example.clj"))
+    (load-file (path-to-problem "test/" (->snake_case problem) "_test.clj"))
     (is (successful? (run-tests problem-tests)))))


Oh, ffs

Oh, ffs

--- integration-tests/apps/caching/counter/test/counter/test/locking.clj
+++ integration-tests/apps/caching/counter/test/counter/test/locking.clj
@@ -32,5 +32,5 @@
 (deftest correct-counting-with-optimistic-locking
   (csh/put (:optimistic caches) :count 0)
   (dotimes [_ 3] (msg/publish "/queue/work" {:name :optimistic :key :count}))
-  (is (every? (partial = :success) (take 3 (msg/message-seq "/queue/done" :timeout 30000))))
+  (is (every? (partial = :success) (take 3 (msg/message-seq "/queue/done" :timeout 60000))))
   (is (= 3 (:count (:optimistic caches)))))


Refactor let in github/get-pulls

Refactor let in github/get-pulls

--- src/github_changelog/github.clj
+++ src/github_changelog/github.clj
@@ -46,12 +46,11 @@

 (s/defn get-pulls :- [Pull] [config :- Config]
   (let [call-api (call-api-fn config)
-        request (make-request config)
-        first-response (call-api request)
-        links (:links first-response)
-        first-body (:body first-response)
-        requests (make-requests config links)
-        rest-responses (pmap call-api requests)]
+        first-request (make-request config)
+        first-response (call-api first-request)
+        {links :links first-body :body} first-response
+        rest-requests (make-requests config links)
+        rest-responses (pmap call-api rest-requests)]
     (into first-body (flatten (map :body rest-responses)))))

 (s/defn fetch-pulls :- [Pull]


fix typo: s/:true/true/

fix typo: s/:true/true/

--- src/babel/lexiconfn.cljc
+++ src/babel/lexiconfn.cljc
@@ -739,7 +739,7 @@

 (defn lexicon-for-generation [lexicon]
   "filter elements of a lexicon that are not intended for generation (:use-for-generation=false)"
-  (into {} (map (fn [k] [k (filter #(not (= false (get-in % [:use-for-generation] :true)))
+  (into {} (map (fn [k] [k (filter #(not (= false (get-in % [:use-for-generation] true)))
                                    (get lexicon k))])
                 (keys lexicon))))


only try to send user updates to connected users

--- src/chat/server/sync.clj
+++ src/chat/server/sync.clj
@@ -62,7 +62,9 @@
 (defn broadcast-user-change
   "Broadcast user info change to clients that can see this user"
   [user-id info]
-  (let [ids-to-send-to (map :id (db/with-conn (db/fetch-users-for-user user-id)))]
+  (let [ids-to-send-to (intersection
+                         (set (:any @connected-uids))
+                         (set (map :id (db/with-conn (db/fetch-users-for-user user-id)))))]
     (doseq [uid ids-to-send-to]
       (chsk-send! uid info))))


parser: make path regexp more permissive

--- src/io/cyanite/query/parser.clj
+++ src/io/cyanite/query/parser.clj
@@ -202,7 +202,7 @@
    <w>            = weightedavg

-   <uqpath>       = #'(?i)[a-z0-9.*]+'
+   <uqpath>       = #'(?i)[a-z0-9.*-]+'
    <qpath>        = <'\"'> uqpath <'\"'>
    path           = uqpath | qpath
    <func>         = a|c|d|e|g|h|i|k|l|m|n|o|p|r|s|t|u|w


Add type mapping for MySQL SMALLINT type :scream_cat:

--- src/metabase/driver/mysql.clj
+++ src/metabase/driver/mysql.clj
@@ -49,6 +49,7 @@
     :NUMERIC    :DecimalField
     :REAL       :FloatField
     :SET        :UnknownField
+    :SMALLINT   :IntegerField
     :TEXT       :TextField
     :TIME       :TimeField
     :TIMESTAMP  :DateTimeField


Only deal w/ batched member operations when board is becoming or staying private.

--- src/oc/storage/api/boards.clj
+++ src/oc/storage/api/boards.clj
@@ -179,22 +179,22 @@
           new-authors (-> ctx :data :authors)
           new-viewers (-> ctx :data :viewers)]
       (timbre/info "Updated board:" slug "of org:" org-slug)
-      ;; Ensure current user is author
-      (when (and (= "private" (:access updated-board)) ; board is being set private
-               (nil? (current-authors user-id))) ; and current user is not an author
-        (add-member conn ctx org-slug slug :authors user-id)) ; make the current user an author
-      ;; If authors are specified, make any requested author changes as a "sync"
-      (when new-authors
-        (doseq [author (clojure.set/difference (set new-authors) current-authors)]
-          (add-member conn ctx (:slug org) (:slug updated-result) :authors author))
-        (doseq [author (clojure.set/difference current-authors (set new-authors))]
-          (remove-member conn ctx (:slug org) (:slug updated-result) :authors author)))
-      ;; If viewers are specified, make any requested viewer changes as a "sync"
-      (when new-viewers
-        (doseq [viewer (clojure.set/difference (set new-viewers) current-viewers)]
-          (add-member conn ctx (:slug org) (:slug updated-result) :viewers viewer))
-        (doseq [viewer (clojure.set/difference current-viewers (set new-viewers))]
-          (remove-member conn ctx (:slug org) (:slug updated-result) :viewers viewer)))
+      (when (= "private" (:access updated-board)) ; board is being set private
+        ;; Ensure current user is author
+        (when (nil? (current-authors user-id)) ; and current user is not an author
+          (add-member conn ctx org-slug slug :authors user-id)) ; make the current user an author
+        ;; If authors are specified, make any requested author changes as a "sync"
+        (when new-authors
+          (doseq [author (clojure.set/difference (set new-authors) current-authors)]
+            (add-member conn ctx (:slug org) (:slug updated-result) :authors author))
+          (doseq [author (clojure.set/difference current-authors (set new-authors))]
+            (remove-member conn ctx (:slug org) (:slug updated-result) :authors author)))
+        ;; If viewers are specified, make any requested viewer changes as a "sync"
+        (when new-viewers
+          (doseq [viewer (clojure.set/difference (set new-viewers) current-viewers)]
+            (add-member conn ctx (:slug org) (:slug updated-result) :viewers viewer))
+          (doseq [viewer (clojure.set/difference current-viewers (set new-viewers))]
+            (remove-member conn ctx (:slug org) (:slug updated-result) :viewers viewer))))
       (let [final-result (board-res/get-board conn (:uuid updated-result))]
         (change/send-trigger! (change/->trigger :update final-result))
         (notification/send-trigger! (notification/->trigger :update org {:old board :new final-result} user))


Disallow creating or changing to public access sections when the content visibility settings doesn't allow it.

--- src/oc/storage/api/boards.clj
+++ src/oc/storage/api/boards.clj
@@ -97,10 +97,15 @@
                           (:entries board-map))
             board-data (-> board-map
                         (dissoc :private-notifications :note :pre-flight :exclude)
-                        (assoc :entries entry-data))]
-        {:new-board (api-common/rep (board-res/->board (:uuid org) board-data author))
-         :existing-org (api-common/rep org)
-         :notifications (api-common/rep notifications)})
+                        (assoc :entries entry-data))
+            org-visibility-settings (or (:visibility-settings org) {})
+            disallow-public-board-setting? (:disallow-public-board org-visibility-settings)]
+        (if (and (= (:access board-map) "public")
+                 disallow-public-board-setting?)
+          [false, {:reason :disallowed-public-board}]
+          {:new-board (api-common/rep (board-res/->board (:uuid org) board-data author))
+           :existing-org (api-common/rep org)
+           :notifications (api-common/rep notifications)}))

       (catch clojure.lang.ExceptionInfo e
         [false, {:reason (.getMessage e)}])) ; Not a valid new board
@@ -109,14 +114,20 @@
 (defn- valid-board-update? [conn org-slug slug board-props]
   (if-let* [org (org-res/get-org conn org-slug)
             board (board-res/get-board conn (:uuid org) slug)
-            board-data (dissoc board-props :private-notifications :note)]
-    (let [updated-board (merge board (board-res/clean board-data))]
-      (if (lib-schema/valid? common-res/Board updated-board)
-        {:existing-org (api-common/rep org)
-         :existing-board (api-common/rep board)
-         :board-update (api-common/rep updated-board)
-         :notifications (api-common/rep (:private-notifications board-props))}
-        [false, {:board-update (api-common/rep updated-board)}])) ; invalid update
+            board-data (dissoc board-props :private-notifications :note)
+            org-visibility-settings (or (:visibility-settings org) {})
+            disallow-public-board-setting? (:disallow-public-board org-visibility-settings)]
+    (if (and disallow-public-board-setting?
+             (not= (:access board-data) "public")
+             (= (:access board-props) "public"))
+      [false, {:reason :disallowed-public-board}]
+      (let [updated-board (merge board (board-res/clean board-data))]
+        (if (lib-schema/valid? common-res/Board updated-board)
+          {:existing-org (api-common/rep org)
+           :existing-board (api-common/rep board)
+           :board-update (api-common/rep updated-board)
+           :notifications (api-common/rep (:private-notifications board-props))}
+          [false, {:board-update (api-common/rep updated-board)}]))) ; invalid update
     true)) ; No org or board, so this will fail existence check later

 ;; ----- Actions -----


Add git-branch function.

Add git-branch function.

--- src/clj/clj_git/core.clj
+++ src/clj/clj_git/core.clj
@@ -200,6 +200,11 @@
 (defn git-checkout [repo sha-ish]
   (git repo "checkout" ["-f" sha-ish]))

+(defn git-branch [repo]
+  (-> (git repo "rev-parse" ["--abbrev-ref" "HEAD"])
+      :out
+      str/trim-newline))
+
 (defn git-clone
   ([local remote]
    (git-clone local remote []))


.getPath on the :source-url

.getPath on the :source-url

--- src/clj/cljs/closure.clj
+++ src/clj/cljs/closure.clj
@@ -720,7 +720,7 @@
                     (+ line-offset (or (:lines source) 0))
                     (let [path (.getPath ^URL (:url source))]
                       (if-let [compiled (get @compiled-cljs path)]
-                        (assoc result (:source-url source)
+                        (assoc result (.getPath ^URL (:source-url source))
                           (sm/merge-source-maps (:source-map compiled) closure-source-map line-offset))
                         (assoc result path source)))))
                 (let [out-name (str name ".merged")]


Simplify load-externs function.

Simplify load-externs function.

--- src/clj/cljs/closure.clj
+++ src/clj/cljs/closure.clj
@@ -103,15 +103,10 @@
   load. The :use-only-custom-externs flag may be used to indicate that
   the default externs should be excluded."
   [{:keys [externs use-only-custom-externs target]}]
-  (letfn [(dir-files* [path]
-            (if-let [paths (.listFiles (io/file path))]
-              (map #(.getAbsolutePath %) paths)
-              [path]))
-          (filter-js [ext]
-            (map (fn [p]
-                   (filter #(.endsWith (.toLowerCase %) ".js")
-                           (dir-files* p)))
-                 ext))
+  (letfn [(filter-js [paths]
+            (for [p paths f (file-seq (io/file p))
+                  :when (.endsWith (.toLowerCase (.getName f)) ".js")]
+              (.getAbsolutePath f)))
           (add-target [ext]
             (if (= :nodejs target)
               (cons (.getFile (io/resource "cljs/nodejs_externs.js"))
@@ -119,7 +114,7 @@
               ext))
           (load-js [ext]
             (map #(js-source-file % (io/input-stream %)) ext))]
-    (let [js-sources (-> externs filter-js flatten add-target load-js)]
+    (let [js-sources (-> externs filter-js add-target load-js)]
       (if use-only-custom-externs
         js-sources
         (into js-sources (CommandLineRunner/getDefaultExterns))))))


import again

import again

--- src/clj/scrabble/api.clj
+++ src/clj/scrabble/api.clj
@@ -7,7 +7,7 @@
             [compojure.handler :refer [site]]
             [scrabble.core :as scrabble]
             ;; import env
-            #_[environ.core :refer [env]]
+            [environ.core :refer [env]]
             [ring.adapter.jetty :as jetty]
             [ring.middleware.json :refer [wrap-json-response]]
             [ring.middleware.defaults :refer [api-defaults wrap-defaults]]))


Fix typo.

Fix typo.

--- src/clojars/web/user.clj
+++ src/clojars/web/user.clj
@@ -84,7 +84,7 @@
              (flash flash-msg)
              [:h1 "Profile"]
              (error-list errors)
-             [:p "Your Clojars profile is just your email address and your password. You can change them here, if want."]
+             [:p "Your Clojars profile is just your email address and your password. You can change them here if you like."]
              (form-to [:post "/profile"]
                       (label :email "Email")
                       [:input {:type :email :name :email :id


run the migration for the access entities also

--- src/pc/datomic/migrations.clj
+++ src/pc/datomic/migrations.clj
@@ -59,15 +59,17 @@
   ;; assuming that only entities with document-ids need one. May
   ;; require another migration later if that's false.
   (let [db (d/db conn)]
-    (dorun (pmap (fn [datoms]
-                   @(d/transact-async conn
-                                      (conj
-                                       (for [d datoms]
-                                         [:db/add (:e d) :frontend/id (UUID. (:v d) (:e d))])
-                                       {:db/id (d/tempid :db.part/tx)
-                                        :transaction/source :transaction.source/migration
-                                        :migration :migration/add-frontend-ids})))
-                 (partition-all 100 (d/datoms db :aevt :document/id))))))
+    (doseq [attr [:document/id :permission/document :access-grant/document :access-request/document]]
+      (dorun (pmap (fn [datoms]
+                     @(d/transact-async conn
+                                        (conj
+                                         (for [d datoms]
+                                           [:db/add (:e d) :frontend/id (UUID. (:v d) (:e d))])
+                                         {:db/id (d/tempid :db.part/tx)
+                                          :transaction/source :transaction.source/migration
+                                          :migration :migration/add-frontend-ids})))
+                   (partition-all 100 (remove #(:frontend/id (d/entity db (:e %)))
+                                              (d/datoms db :aevt attr))))))))

 (def migrations
   "Array-map of migrations, the migration version is the key in the map.


bumping version

bumping version

--- core/project.clj
+++ core/project.clj
@@ -1,4 +1,4 @@
-(defproject samsara-core "0.1.0-SNAPSHOT"
+(defproject samsara-core "0.2.0-SNAPSHOT"
   :description "Event stream processing pipeline"

   :url "https://samsara.github.com/"


CMR-3200: Adding test using example files that parses to UMM and attempts to convert to other formats.

--- umm-spec-lib/test/cmr/umm_spec/test/generate_and_parse.clj
+++ umm-spec-lib/test/cmr/umm_spec/test/generate_and_parse.clj
@@ -10,6 +10,7 @@
             [cmr.umm-spec.test.expected-conversion :as expected-conversion]
             [cmr.umm-spec.test.umm-record-sanitizer :as sanitize]
             [cmr.umm-spec.core :as core]
+            [cmr.umm-spec.validation.core :as umm-validation]
             [cmr.common.xml.simple-xpath :refer [select context]]
             [cmr.umm-spec.xml-to-umm-mappings.iso19115-2 :as iso-xml-to-umm]
             [cmr.umm-spec.umm-to-xml-mappings.iso19115-2 :as iso-umm-to-xml]
@@ -58,6 +59,43 @@
   [concept-type metadata-format record]
   (let [metadata-xml (core/generate-metadata test-context record metadata-format)]
     (core/validate-metadata concept-type metadata-format metadata-xml)))
+
+(defn example-files
+  "TODO"
+  [metadata-format]
+  (seq (.listFiles (io/file (io/resource (str "example_data/" (name metadata-format)))))))
+
+(deftest rountrip-example-metadata
+  (let [failed-atom (atom false)
+        check-failure (fn [result]
+                        (when-not result (reset! failed-atom true)))]
+    (doseq [metadata-format tested-collection-formats
+            example-file (example-files metadata-format)
+            :when (not @failed-atom)
+            :let [metadata (slurp example-file)
+                  umm (core/parse-metadata test-context :collection metadata-format metadata)]]
+
+      (proto-repl.saved-values/save 5 metadata-format metadata umm)
+
+      ;; input file is valid
+      (check-failure
+       (is (empty? (core/validate-xml :collection metadata-format metadata))
+           (format "Source file %s is not valid %s XML" example-file metadata-format)))
+      ; Parsed UMM is valid
+      (check-failure
+       (is (empty? (umm-validation/validate-collection umm))
+           (format "Parsing source file %s to UMM produced invalid UMM." example-file)))
+      (doseq [target-format tested-collection-formats
+              :when (not @failed-atom)
+              :let [expected (expected-conversion/convert umm target-format)
+                    actual (xml-round-trip :collection target-format umm)]]
+
+        (proto-repl.saved-values/save 4 target-format expected actual)
+
+        (check-failure
+         (is (= expected actual)
+             (format "Parsing example file %s and converting to %s and then parsing again did not result in expected umm."
+                     example-file target-format)))))))

 (deftest roundtrip-example-collection-record
   (doseq [metadata-format tested-collection-formats]


Server side - Compute the map of namespaces - functions.

--- src/app/clj/fnx/meta/expose.clj
+++ src/app/clj/fnx/meta/expose.clj
@@ -6,7 +6,7 @@
 ;;
 (ns fnx.meta.expose
   "Expose the public functions of a namespace"
-  (:use [clojure.string :only [join escape]]
+  (:use [clojure.string :only [split join escape]]
         [midje.sweet]))

 ;; * First we load the ns with `require`
@@ -47,17 +47,113 @@
 (fact
   (load-ns!) => ["fnx.meta.expose" "fnx.meta.example"])

-(def mmeta meta)
+(defn- parent "Given a namespace, return the namespace's 'parent'"
+  [n]
+  (when n
+      (let [r (split n #"\.")]
+        (if (<= 2 (count r)) (join "." (butlast r)) nil))))

-(defn namespaces-public-fn "Load all the functions of the namespaces"
-  [v]
-  (mapcat #(map mmeta (ns-public-fn (symbol %))) v))
+(fact "parent"
+  (parent nil) => nil
+  (parent "foo.aws.extra") => "foo.aws"
+  (parent "foo.aws") => "foo"
+  (parent "foo") => nil)

-(fact "namespaces-public-fn"
-  (namespaces-public-fn [:ns0 :ns1]) => [:map-meta0 :map-meta1 :map-meta2]
+(defn- nsp "Given a fully qualified function name, return a namespace"
+  [f]
+  (first (split f #"/")))
+
+(fact "nsp"
+  (nsp "fnx.meta/expose") => "fnx.meta")
+
+(defn- child "Given a namespace, return the next namespace's depth"
+  [n vc]
+  (if-not n
+    (distinct (map #(first (clojure.string/split % #"\.")) vc))
+    (remove #{n} ((group-by #(.contains % n) vc) true))))
+
+(unfinished )
+
+(defn- level "Given a namespace, returns its level."
+  [ns]
+  (count (split ns #"\.")))
+
+(fact "level"
+  (level "foo")  => 1
+  (level "foo.aws")  => 2
+  (level "foo.aws.ec2") => 3)
+
+(defn- nth-level "Given a namespace, returns the nth level"
+  [n ns]
+    (join #"." (take n (split ns #"\."))))
+
+(fact "nth-level"
+  (nth-level 0 "foo.aws") => ""
+  (nth-level 1 "foo.aws") => "foo"
+  (nth-level 2 "foo.aws.ec2") => "foo.aws")
+
+(defn- child "Given a namespace, return the next namespace's depth"
+  [n vc]
+  (if n
+    (let [l (level n)]
+      (remove #{n} ((group-by #(.contains % n) (distinct (map #(nth-level (inc l) %) vc))) true)))
+    (distinct (map #(nth-level 1 %) vc))))
+
+(fact "IT - child"
+  (child nil ["foo" "foo.aws" "bar.other" "foo.ec2"]) => ["foo" "bar"]
+  (child "foo" ["foo" "foo.aws" "bar.other" "foo.ec2"]) => ["foo.aws" "foo.ec2"]
+  (child "bar.aws" ["bar" "bar.aws.ec2.s3" "bar.aws.ec" "bar.aws.ec2.s4"]) => ["bar.aws.ec2" "bar.aws.ec"])
+
+(defn- map-namespaces "Given a list of functions, returns the map of keypair ns-fn"
+  [vfn]
+  (group-by nsp vfn))
+
+(fact "map-namespaces"
+  (map-namespaces [:fq-fn1 :fq-fn3 :fq-fn2 :fq-fn4]) => {:foo [:fq-fn1 :fq-fn2]
+                                                         :bar [:fq-fn3]
+                                                         :foobar [:fq-fn4]}
   (provided
-    (ns-public-fn (symbol :ns0)) => [:ns0-fn0 :ns0-fn1]
-    (ns-public-fn (symbol :ns1)) => [:ns1-fn0]
-    (mmeta :ns0-fn0) => :map-meta0
-    (mmeta :ns0-fn1) => :map-meta1
-    (mmeta :ns1-fn0) => :map-meta2))+    (nsp :fq-fn1) => :foo
+    (nsp :fq-fn2) => :foo
+    (nsp :fq-fn3) => :bar
+    (nsp :fq-fn4) => :foobar))
+
+(defn public-ns-fn
+  "Expose the namespaces and functions as the following example map
+  {nil              [nil       [\"foo\" \"bar\"]              []]
+   \"foo\"          [nil       [\"foo.aws\"]                  []]
+   \"bar\"          [nil       [\"bar.file\"]                 []]
+   \"foo.aws\"      [\"foo\"     [\"foo.aws.ec2\" \"foo.aws.s3\"] [\"describe-region\"]]
+   \"foo.aws.ec2\"  [\"foo.aws\" []                           [\"list-ami\"]]
+   \"foo.aws.s3\"   [\"foo.aws\" []                           [\"delete-buckets\"]]
+   \"bar.file\"     [\"bar\"     []                           [\"ls\"]]}"
+  [vfn]
+  (let [m (map-namespaces vfn)
+        k (keys m)
+        i (assoc m nil k)]
+    (reduce (fn [o n]
+              (assoc o n [(parent n) (child n k) (m n)]))
+            {}
+            (keys i))))
+
+(fact "public-ns-fn"
+  (public-ns-fn [:fq-fn1 :fq-fn2 :fq-fn3]) => (contains {nil [nil [:foo :bar] nil]
+                                                         :foo [nil [] [:fq-fn1 :fq-fn2]]
+                                                         :bar [nil [] [:fq-fn3]]} :in-any-order)
+  (provided
+    (map-namespaces [:fq-fn1 :fq-fn2 :fq-fn3]) => {:foo [:fq-fn1 :fq-fn2] :bar [:fq-fn3]}
+    (parent nil) => nil
+    (parent :foo) => nil
+    (parent :bar) => nil
+    (child nil [:foo :bar]) => [:foo :bar]
+    (child :foo [:foo :bar]) => []
+    (child :bar [:foo :bar]) => []))
+
+(fact "IT - public-ns-fn"
+  (public-ns-fn ["foo/expose" "bar/ls" "foo.aws/list-ami" "foo.aws/list-regions" "foo.meta/run" "foo.aws.ec2/test"]) =>
+  '{"foo.aws.ec2" ["foo.aws" []                     ["foo.aws.ec2/test"]]
+    "foo.meta" ["foo"        []                     ["foo.meta/run"]]
+   "foo.aws"   ["foo"        ["foo.aws.ec2"]        ["foo.aws/list-ami" "foo.aws/list-regions"]]
+   "bar"       [nil          []                     ["bar/ls"]]
+   "foo"       [nil          ["foo.aws" "foo.meta"] ["foo/expose"]]
+   nil         [nil          ["foo" "bar"]          nil]})


sort :refers

sort :refers

--- src/babel/italiano/grammar.cljc
+++ src/babel/italiano/grammar.cljc
@@ -6,10 +6,12 @@
    [babel.italiano.lexicon :refer [lexicon]]
    [babel.italiano.morphology :refer [analyze fo]]
    [babel.parse :as parse]
-   [babel.ug :refer [comp-modifies-head head-principle subcat-1-principle subcat-1-1-principle subcat-2-principle
-                     comp-specs-head root-is-head-root
-                     subcat-1-1-principle-comp-subcat-1 root-is-comp
-                     subcat-2-2-principle root-is-head
+   [babel.ug :refer [comp-modifies-head comp-specs-head
+                     head-principle root-is-comp
+                     root-is-head root-is-head-root subcat-1-principle
+                     subcat-1-1-principle subcat-2-principle
+                     subcat-1-1-principle-comp-subcat-1
+                     subcat-2-2-principle
                      subcat-5-principle
                      ]]
    #?(:clj [clojure.tools.logging :as log])


switch order of subcat arguments

switch order of subcat arguments

--- src/babel/italiano/lexicon.cljc
+++ src/babel/italiano/lexicon.cljc
@@ -60,10 +60,10 @@
     ;; "a mezzogiorno"
     {:synsem {:cat :prep
               :sem {:pred :a}
-              :subcat {:1 {:cat :noun
-                           :sem {:time true}}
-                       :2 {:cat :verb
-                           :subcat '()}}}}
+              :subcat {:1 {:cat :verb
+                           :subcat '()}
+                       :2 {:cat :noun
+                           :sem {:time true}}}}}

     ;; e.g. "a ridere": tu hai fatto bene a ridere (you did well to laugh)"
 ;    (let [complement-semantics (atom {:pred :a


working on lexical post-processing of nouns rather than explicitly listing agreement, etc per-lexeme

--- src/babel/italiano/lexicon.cljc
+++ src/babel/italiano/lexicon.cljc
@@ -1677,10 +1677,10 @@
              :italiano {:passato "nato"}}

    "neonato"
-   (unify agreement-noun
-          common-noun
-          countable-noun
-          masculine-noun
+   (unify ;agreement-noun
+          ;common-noun
+          ;countable-noun
+          ;masculine-noun
           {:synsem {:cat :noun
                     :agr {:gender :masc}
                     :sem {:pred :newborn


Fix bug in riemann reporter code

Fix bug in riemann reporter code

--- scheduler/src/cook/components.clj
+++ scheduler/src/cook/components.clj
@@ -315,13 +315,13 @@
                            (when riemann
                              (when-not (:host riemann)
                                (throw (ex-info "You must specific the :host to send the riemann metrics to!" {:riemann riemann})))
-                             (when-not (every? string? tags)
+                             (when-not (every? string? (:tags riemann))
                                (throw (ex-info "Riemann tags must be a [\"list\", \"of\", \"strings\"]") riemann))
                              (let [config (merge {:port 5555
                                                   :local-host (.getHostName
                                                                 (java.net.InetAddress/getLocalHost))}
                                                  riemann)]
-                               (cook.reporter/riemann-reporter config))))
+                               ((lazy-load-var 'cook.reporter/riemann-reporter) config))))
      :nrepl-server (fnk [[:config [:nrepl {enabled? false} {port 0}]]]
                         (when enabled?
                           (when (zero? port)


dealt with TODO in filter.clj; removed need to move smaller functions out of namespace.

--- src/clj/forma/trends/filter.clj
+++ src/clj/forma/trends/filter.clj
@@ -15,9 +15,6 @@
 ;; Hodrick-Prescott convention.  Later, the target (vegetation)
 ;; time-series is combined with a measure of reliability to
 ;; interpolate across "bad" values.
-
-;; TODO: Pull out smaller functions into, perhaps, a utils namespace
-;; to be used in other contexts, namespaces.

 ;; De-seasonalize time-series


Start writing documentation for core.async

--- src/clj/momentum/core/async.clj
+++ src/clj/momentum/core/async.clj
@@ -1,4 +1,127 @@
-(ns momentum.core.async
+(ns ^{:author "Carl Lerche"
+      :doc
+      "The purpose of this namespace is to provide a collection of
+       asynchronous primitives and functions to operate on those
+       primitives.
+
+       == Asynchronous values
+
+       The core primitive is AsyncVal. This is basically just a
+       future (except...), but the name future is already used in
+       clojure.core, so we use a different name to avoid conflicts. A
+       producer is responsible for dealing with raw asynchronous
+       operations and exposing them as AsyncVals. A consumer interacts
+       with the producer, and interacts with the asynchronous
+       operations through AsyncVals.
+
+       An AsyncVal represents a computation that might still be in
+       progress, and which will eventually succeed or fail. A producer
+       realizes the AsyncVal when the raw asynchronous operations it
+       manages have information the producer wants to pass along to
+       the consumer.
+
+       For example, an HTTP request function would return an AsyncVal
+       representing the response before it receives the response. Once
+       the HTTP client receives the response, it will realize the
+       AsyncVal, which will invoke any registered realization
+       callbacks. If something goes wrong (for example, the connection
+       was closed prematurely), then the producer would realize the
+       AsyncVal with the exception.
+
+       If you have an AsyncVal, you will normally receive its realized
+       value by registering a callback on it. You can also dereference
+       the AsyncVal immediately, which will block the current thread
+       under the producer realizes the AsyncVal. You should never
+       dereference an AsyncVal inside an event loop since doing so
+       will freeze the entire system.
+
+       == doasync
+
+       You register callbacks on an AsyncVal using the doasync
+       macro. A full example might look something like:
+
+         (doasync (http/GET \"http://www.google.com\")
+           ;; Function invoked when the asynchronous value returned by
+           ;; http/GET is realized.
+           (fn [[status hdrs body]]
+             (println \"GOT: \" [status hdrs body])))
+
+       The doasync macro itself returns an AsyncVal representing the
+       return value from the callback, making doasync composable.
+
+       Should the producer (the HTTP client in the above example)
+       encounter a failure, the AsyncVal can be aborted with an
+       exception representing the failure. doasync allows these
+       asynchronous exceptions to be handled as well in a similar
+       fashion as clojure’s try / catch. For example:
+
+         (doasync (http/GET \"http://www.some-invalid-host.com/\")
+           (fn [resp]) ;; Will not get invoked
+           (catch Exception e
+             (println \"Encountered an exception: \" e)))
+
+       If an exception is successfully caught, the AsyncVal
+       representing the doasync will be realized with the catch
+       clause’s return value. Exceptions that are not handled will
+       cause the AsyncVal to be aborted with exception. This semantic
+       allows exceptions to bubble up asynchronously.
+
+       Additionally, doasync can handle any clojure type or java
+       object, in which case, the callback gets invoked immediately.
+
+       == Joining asynchronous values
+
+       The join function takes an arbitrary number of both
+       asynchronous values and regular types / objects and returns an
+       AsyncVal that becomes realized when all of the arguments become
+       realized. The realized arguments are then applied to the
+       callback function. For example:
+
+         (doasync (join (http/GET \"http://www.google.com/\")
+                        (http/GET \"http://www.bing.com/\"))
+           (fn [google-response bing-response]
+             ;; Do something with the responses
+             ))
+
+       In the event that one of the arguments becomes aborted, the
+       combined AsyncVal will also become aborted with the same
+       exception.
+
+       == AsyncSeq
+
+       AsyncSeq is an AsyncVal that is always realized with a clojure
+       sequence or nil. It also implements the clojure sequence
+       protocol, however calling first, more, or next on it will throw
+       an exception if it has not been realized yet. AsyncSeqs can
+       used with doasync just the same as AsyncVals can. For example:
+
+         (doasync my-async-seq
+           (fn [[val & more :as realized]]
+             ;; more is another async-seq
+             (when realized
+               (println \"GOT: \" val)
+               (recur* more))))
+
+       The recur* function allows asynchronous recursion. It must be
+       used in a tail position. The recur* function takes N arguments
+       and joins them as explained above. Once the join becomes
+       realized, it is applied to the last invoked function.
+
+       Just like with AsyncVals, an AsyncSeq might also face a failure
+       scenario and become aborted with an exception. These exceptions
+       may be handled in the same way as the previous catch example
+
+       == Composability
+
+       The above primitives are enough to build up some powerful
+       asynchronous abstractions. This namespace contains a number of
+       these abstractions. For example, map* returns an asynchronous
+       sequence consisting of applying a function to the elements of
+       another asynchronous sequence. The first* function returns an
+       asynchronous value representing the head of a given sequence
+       once it becomes realized. In all of these cases, exception
+       handling behaves as expected."}
+  momentum.core.async
   (:use
    momentum.core.atomic)
   (:import
@@ -19,24 +142,32 @@
 ;; ==== Async common ====

 (defn put
-  [^Realizer realizer val]
-  (.put realizer val))
+  "Realize the asynchronous value with the supplied value. Returns
+  true is successful. Returns false otherwise."
+  [^Realizer async-val val]
+  (.put async-val val))

 (defn abort
-  [^Realizer realizer err]
-  (.abort realizer err))
+  "Abort the asynchronous value with the supplied exception. Returns
+  true if successful. Returns false otherwise."
+  [^Realizer async-val err]
+  (.abort async-val err))

 (defn success?
-  [^Async val]
-  (.isSuccessful val))
+  "Returns true if the asynchronous value has been realized
+  successfully."
+  [^Async async-val]
+  (.isSuccessful async-val))

 (defn aborted?
-  [^Async val]
-  (.isAborted val))
+  "Returns true if the asynchronous value has been aborted."
+  [^Async async-val]
+  (.isAborted async-val))

 ;; ==== Async value ====

 (defn async-val
+  "Returns a new unrealized asynchronous value."
   []
   (AsyncVal.))

@@ -47,6 +178,11 @@
   (Pipeline. (reverse stages) catchers finalizer))

 (defn join
+  "Returns an asynchronous value representing the realization of the
+  supplied arguments. The returned asynchronous value will be realized
+  with the realized values of the supplied arguments in the same order
+  or, if any of the suppplied arguments become aborted, it will be
+  aborted with the same exception."
   [& args]
   (Join. args))

@@ -105,12 +241,18 @@
 ;; ==== Async seq ====

 (defmacro async-seq
+  "Takes a body of expressiosn that returns an asynchronous value,
+  ISeq, or nil, and yields a Sequable asynchronous value that will
+  invoke the body only the first time a callback is registered or it
+  is dereferenced, and will cache the result and return it on
+  subsequent calls to seq."
   [& body]
   `(AsyncSeq. (fn [] ~@body)))

 (defn async-seq?
-  [o]
-  (instance? AsyncSeq o))
+  "Returns true if x is an async-seq."
+  [x]
+  (instance? AsyncSeq x))

 (defn- realize-coll
   [coll ms]


Jaro - window width fix

Jaro - window width fix

There was a bug. Different outputs were produced for the same input strings:
(let [s1 "xxx1" s2 "y123"]
  [(jaro s1 s2) (jaro s2 s1)])
 -> [0 0.5]

--- src/clj_fuzzy/jaro_winkler.cljc
+++ src/clj_fuzzy/jaro_winkler.cljc
@@ -22,7 +22,7 @@
          nseq1-matches seq1-matches
          nseq2-matches seq2-matches]
     (if (and ((complement nil?) j)
-             (<= j window-end))
+             (< j window-end))
       (if (and (not (get seq2-matches j))
                (= ch (get shortest j)))
         (recur nil


Provide cursors down the tree

Provide cursors down the tree

--- src/cljs/clojure_rest/core.cljs
+++ src/cljs/clojure_rest/core.cljs
@@ -39,14 +39,12 @@
   [status cards]
   (filter #(= status (-> % deref :status)) cards))

-(defn filter-by-title
-  "Return the id of the cards that contains the searched string inside their title"
-  [filter cards]
-  (->>
-    (if (empty? filter) cards
-     (filter #(utils/str-contains (-> % second :title) filter) cards))
-    (map first)
-  ))
+ (defn filter-by-title
+   "Keep only cards that contains the searched string inside their title"
+   [title cards]
+   (if (empty? title)
+     cards
+     (filter #(utils/str-contains (-> % second :title) title) cards)))

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

@@ -55,13 +53,6 @@
     {:cards {}
      :filter "" ; BUG - If we had two boards, the cards should be the same, but not the filters
     }))
-
-(defn update-card!
-  "Update a card"
-  [card]
-  (swap! app-state
-    #(assoc-in % [:cards (:card-id card)] card)
-  ))

 (defn add-cards!
   "Add several cards to the application state"
@@ -89,27 +80,27 @@
   ])

 (defn render-tasks
-  [{:keys [tasks] :as card}]
-  (let [on-remove #(update-card! (api/remove-task-at card %))
-        on-check #(update-card! (update-in card [:tasks % :done] not))]
+  [card-ref]
+  (let [on-remove #(swap! card-ref api/remove-task-at %)
+        on-check #(swap! card-ref update-in [:tasks % :done] not)]
     [:div.checklist
      [:ul
       (map
         (fn [idx t]
           ^{:key t} [render-task #(on-remove idx) #(on-check idx) t])
-        (range) tasks)]
+        (range) (:tasks @card-ref))]
      ]))

 (defn render-add-task
   "Render the text field allowing to add new tasks to a card"
-  [card]
+  [card-ref]
   [:input.checklist--add-task
    {:type "text"
     :placeholder "Type then hit Enter to add a task"
     :on-key-press
     (fn [e]
       (when (= "Enter" (.-key e))
-        (update-card! (api/add-task card (.. e -target -value)))
+        (swap! card-ref api/add-task (.. e -target -value))
         (set! (.. e -target -value) "")
       ))
    }])
@@ -117,20 +108,18 @@
 (defn render-card
   ; TODO - Try to avoid the update-card! use and use messages / cursors
   ; * Fix the filter on top of the board to provide cursors down?
-  [card-cursor]
-  (let [card (deref card-cursor)
-        show-details (::show-details card)
-        toggle-details #(update-card! (update-in card [::show-details] not))
+  [card-ref]
+  (let [show-details (::show-details @card-ref)
+        toggle-details #(swap! card-ref update-in [::show-details] not)
         title-style (if show-details :div.card__title--is-open :div.card__title)
         details-style (when-not show-details {:style {:display "none"}})]
-    ;(js/alert (str card))
     [:div.card
-     [:div {:style (card-side-color card)}]
-     [title-style {:on-click toggle-details} (:title card)]
+     [:div {:style (card-side-color @card-ref)}]
+     [title-style {:on-click toggle-details} (:title @card-ref)]
      [:div.card__details details-style
-      (:description card)
-      [render-tasks card]
-      [render-add-task card]
+      (:description @card-ref)
+      [render-tasks card-ref]
+      [render-add-task card-ref]
     ]]
   ))

@@ -164,8 +153,9 @@
   ; - But you can create the card at the top
   ; - And then you can assemble them (group-by or filter)
   (let [filter (r/cursor app-state [:filter])
-        card-ids (filter-by-title @filter (:cards @app-state))
-        card-cursors (map #(r/cursor app-state [:cards %1]) card-ids)]
+        cards (reaction (filter-by-title @filter (:cards @app-state)))
+        card-ids (reaction (map first @cards))
+        card-cursors (map #(r/cursor app-state [:cards %]) @card-ids)]
     [:div
      ; TODO - Try to add a button to show details to all tickets
      (render-filter filter)


Store the contents of the scratchpad in an atom.

--- src/cljs/leipzig_live/core.cljs
+++ src/cljs/leipzig_live/core.cljs
@@ -5,10 +5,18 @@
               [accountant.core :as accountant]))

 ;; -------------------------
+;; Model
+(defonce music  (atom ""))
+
+;; -------------------------
 ;; Views

 (defn home-page []
-  [:div [:h1 "Welcome to Leipzig Live!"]])
+  [:div [:h1 "Welcome to Leipzig Live!"]
+   [:div [:input {:type "text"
+                  :value (-> music deref print-str)
+                  :on-change #(reset! music (-> % .-target .-value))}]]
+   [:div @music ]])

 (defn current-page []
   [:div [(session/get :current-page)]])


Add IDeref implementation for either left and right.

--- src/cljx/cats/monad/either.cljx
+++ src/cljx/cats/monad/either.cljx
@@ -39,6 +39,16 @@
   (get-value [_] v)

   #+clj
+  clojure.lang.IDeref
+  #+clj
+  (deref [_] v)
+
+  #+cljs
+  IDeref
+  #+cljs
+  (-deref [_] v)
+
+  #+clj
   Object
   #+clj
   (equals [self other]
@@ -62,6 +72,16 @@
   proto/Context
   (get-context [_] either-monad)
   (get-value [_] v)
+
+  #+clj
+  clojure.lang.IDeref
+  #+clj
+  (deref [_] v)
+
+  #+cljs
+  IDeref
+  #+cljs
+  (-deref [_] v)

   #+clj
   Object


Revert "Reduce amount of memory used"

Revert "Reduce amount of memory used"

This reverts commit 88ffe5349a4b7355ff30bd0107abe1e13d74622f.

--- src/rill/event_store/psql.clj
+++ src/rill/event_store/psql.clj
@@ -26,18 +26,12 @@
     (sql/query spec ["SELECT payload, stream_order, insert_order FROM rill_events WHERE insert_order > ? ORDER BY insert_order ASC LIMIT ?"
                      cursor page-size])))

-(defn- lazy-select [cursor page-size selector]
-  (let [records (selector cursor page-size)]
-    (if (< (count records) page-size)
-      records
-      (concat records
-              (lazy-seq (lazy-select (:cursor (meta (last records)))
-                                     page-size
-                                     selector))))))
-
 (defn messages
   [cursor page-size selector]
-  (seq (map record->message (lazy-select cursor page-size selector))))
+  (let [p (map record->message (selector cursor page-size))]
+    (if (< (count p) page-size)
+      (seq p) ;; make sure we return nil when no messages are found
+      (concat p (lazy-seq (messages (:cursor (meta (last p))) page-size selector))))))

 (defrecord PsqlEventStore [spec page-size]
   EventStore


Add doc for random ugens

Add doc for random ugens

--- src/overtone/sc/ugen/random.clj
+++ src/overtone/sc/ugen/random.clj
@@ -17,39 +17,39 @@
       ;; :rates #{:ir}}

       {:name "RandSeed"
-       :args [{:name "trig", :default 0.0}
-              {:name "seed", :default 56789}]
+       :args [{:name "trig", :default 0.0 :doc "Trigger signal"}
+              {:name "seed", :default 56789 :doc "Seed value"}]
        :rates #{:ir :kr}
        :fixed-outs 0
-       :doc "When the trigger signal changes from nonpositive to positve, the synth's random generator seed is reset to the given value. All synths that use the same random number generator reproduce the same sequence of numbers again."}
+       :doc "When the trigger signal changes from nonpositive to positive, the synth's random generator seed is reset to the given value. All synths that use the same random number generator reproduce the same sequence of numbers again."}

       {:name "RandID"
-       :args [{:name "seed", :default 0}]
+       :args [{:name "seed", :default 0 :doc "Seed id"}]
        :rates #{:ir :kr}
        :fixed-outs 0
        :doc "Choose which random number generator to use for this synth. All synths that use the same generator reproduce the same sequence of numbers when the same seed is set again."}

       {:name "IRand"
-       :args [{:name "lo", :default 0.0}
-              {:name "hi", :default 127.0}]
+       :args [{:name "lo", :default 0.0 :doc "Minimum value of generated integer"}
+              {:name "hi", :default 127.0 :doc "Maximum value of generated integer"}]
        :rates #{:ir}
        :doc "Generates a single random integer value in uniform distribution from lo to hi"}

       {:name "TRand"
-       :args [{:name "lo", :default 0.0}
-              {:name "hi", :default 1.0}
-              {:name "trig", :default 0.0}]
+       :args [{:name "lo", :default 0.0 :doc "Minimum value of generated float"}
+              {:name "hi", :default 1.0 :doc "Maximum value of generated float"}
+              {:name "trig", :default 0.0 :doc "Trigger signal"}]
        :rates #{:kr :ar}
        :doc "Generates a random float value in uniform distribution from lo to hi each time the trig signal changes from nonpositive to positive values"}

       {:name "TIRand"
-       :args [{:name "lo", :default 0}
-              {:name "hi", :default 127}
-              {:name "trig", :default 0.0}]
+       :args [{:name "lo", :default 0 :doc "Minimum value of generated integer"}
+              {:name "hi", :default 127 :doc "Maximum value of generated integer"}
+              {:name "trig", :default 0.0 :doc "Trigger signal"}]
        :rates #{:kr :ar}
        :doc "Generates a random integer value in uniform distribution from lo to hi each time the trig signal changes from nonpositive to positive values"}

@@ -65,9 +65,9 @@

       {:name "NRand"
-       :args [{:name "lo", :default 0.0}
-              {:name "hi", :default 1.0}
-              {:name "n", :default 0}]
+       :args [{:name "lo", :default 0.0 :doc "Minimum value of generated float"}
+              {:name "hi", :default 1.0 :doc "Maximum value of generated float"}
+              {:name "n", :default 0 :doc "Distribution choice"}]
        :rates #{:ir}
        :doc "Generates a single random float value in a sum of n uniform distributions from lo to hi.

@@ -78,31 +78,31 @@

       {:name "ExpRand"
-       :args [{:name "lo", :default 0.01}
-              {:name "hi", :default 1.0}]
+       :args [{:name "lo", :default 0.01 :doc "Minimum value of generated float"}
+              {:name "hi", :default 1.0 :doc "Maximum value of generated float"}]
        :rates #{:ir}
        :doc "Generates a single random float value in an exponential distributions from lo to hi."}

       {:name "TExpRand"
-       :args [{:name "lo", :default 0.01}
-              {:name "hi", :default 1.0}
-              {:name "trig", :default 0.0}]
+       :args [{:name "lo", :default 0.01 :doc "Minimum value of generated float"}
+              {:name "hi", :default 1.0 :doc "Maximum value of generated float"}
+              {:name "trig", :default 0.0 :doc "Trigger signal"}]
        :rates #{:ar :kr}
        :doc "Generates a random float value in exponential distribution from lo to hi each time the trig signal changes from nonpositive to positive values lo and hi must both have the same sign and be non-zero."}

       {:name "CoinGate"
-       :args [{:name "prob"}
-              {:name "trig"}]
+       :args [{:name "prob" :doc "Value between 0 and 1 determines probability of either possibilities"}
+              {:name "trig" :doc "Trigger signal"}]
        :rates #{:kr :ir}
        :doc "When it receives a trigger, it tosses a coin, and either passes the trigger or doesn't."}

       {:name "LinRand"
-       :args [{:name "lo", :default 0.0}
-              {:name "hi", :default 1.0}
-              {:name "minmax", :default 0}]
+       :args [{:name "lo", :default 0.0 :doc "Minimum value of generated float"}
+              {:name "hi", :default 1.0 :doc "Maximum value of generated float"}
+              {:name "minmax", :default 0 :doc "Skew direction (towards lo if negative otherwise hi)"}]
        :rates #{:ir}
        :doc "Generates a single random float value in linear distribution from lo to hi, skewed towards lo if minmax < 0, otherwise skewed towards hi."}])


Removed some unused loader loading functions.

--- src/petulant_life/rendering.clj
+++ src/petulant_life/rendering.clj
@@ -56,52 +56,6 @@
 (defn generate-rectangles [rects]
   (flatten (map generate-rectangle rects)))

-;; Loading a specific type of shader at a given path.
-(defn load-shader [path type]
-  (try
-    (let [content (StringBuffer. (slurp path))
-          sid     (GL20/glCreateShader type)]
-      (do (GL20/glShaderSource sid content)
-          (GL20/glCompileShader sid)
-          sid))
-    (catch Exception e (.exit System 1))))
-
-;; Loading each type of shader from a given path.
-(defn load-each-shader [path]
-  (let [vert (if (.exists (as-file (str path ".vert")))
-               (load-shader (str path ".vert") GL20/GL_VERTEX_SHADER)
-               nil)
-
-        frag (if (.exists (as-file (str path ".frag")))
-               (load-shader (str path ".frag") GL20/GL_FRAGMENT_SHADER)
-               nil)
-
-        geom (if (.exists (as-file (str path ".geom")))
-               (load-shader (str path ".geom") GL32/GL_GEOMETRY_SHADER)
-               nil)]
-    {:vert vert :frag frag :geom geom}))
-
-;; Loading a shader. It loads all possible extensions for the shader. If there is
-;; a .vert, it'll load it. If there's a .frag, it'll load it, etc.
-(defn load-shader-program [path]
-  (let [ss (load-each-shader path)
-        sp (GL20/glCreateProgram)]
-    (do (if (get ss :vert)
-          (GL20/glAttachShader sp (get ss :vert))
-          nil)
-
-        (if (get ss :frag)
-          (GL20/glAttachShader sp (get ss :frag))
-          nil)
-
-        (if (get ss :geom)
-          (GL20/glAttachShader sp (get ss :geom))
-          nil)
-
-        (GL20/glLinkProgram sp)
-
-        sp)))
-
 ;; Drawing based on the information contained in a VAO with a given shader.
 (defn draw-vao [shader vao vct]
   ;; Setting up the VAO.


Fix missing ns error in cljs.

Fix missing ns error in cljs.

--- src/posthere/cljs/posthere.cljs
+++ src/posthere/cljs/posthere.cljs
@@ -118,7 +118,7 @@
   [headers result]
   (if (aget result "invalid-body")
     (let [header-keys (keys headers)
-          header-map (zipmap (map lower-case header-keys) header-keys) ; mapping of lower-case header to mixed-case header
+          header-map (zipmap (map s/lower-case header-keys) header-keys) ; mapping of lower-case header to mixed-case header
           mixed-case-content-type (get header-map "content-type")]
       (assoc headers mixed-case-content-type
         [:span


GAWB0-1397: change height

GAWB0-1397: change height

--- src/cljs/main/broadfcui/page/workspace/monitor/workflow_details.cljs
+++ src/cljs/main/broadfcui/page/workspace/monitor/workflow_details.cljs
@@ -80,7 +80,7 @@
                           .-childNodes (aget 0)
                           (aget "height") (aget "animVal") (aget "value"))]
            (gdom/removeChildren "chart-container")
-           (.timingDiagram js/window (get @refs "chart-container") (:data props) (:workflow-name props) (+ 50 height))))
+           (.timingDiagram js/window (get @refs "chart-container") (:data props) (:workflow-name props) (+ 75 height))))
        (gdom/removeChildren (get @refs "chart-container"))))})

 (defn- backend-logs [data]


Updated website with time of event

Updated website with time of event

--- src/redbrick_20/views/home.cljs
+++ src/redbrick_20/views/home.cljs
@@ -41,7 +41,7 @@
         [:p {:class "event_location"}
           [:b "Event Location: "] (:event-location @data/event-details)]
         [:p {:class "event_location"}
-          [:b "Date: " ] (:event-date @data/event-details)]
+          [:b "Date: " ] (str (:event-date @data/event-details) ": " (:event-information @data/event-details))]
         [:b "Tickets: " ]
           [:a {:class "card-a-tag mdl-card__supporting-text"
             :href (:event-tickets @data/event-details)} "Get Tickets From Tito"]]]])


Refactored for better more idiomatic Clojure

--- desktop/src-common/ds3/space.clj
+++ desktop/src-common/ds3/space.clj
@@ -11,6 +11,7 @@
 (def star-alpha 0.75)
 (def star-color-dim 0.75)
 (def star-color-full 1.0)
+(def off-screen-padding 5)

 (defn create-star-texture [c]
   (let [pix-map (pixmap* 1 1 (pixmap-format :r-g-b-a8888))]
@@ -25,18 +26,21 @@
     :x x :y y
     :star? true :id :star
     :render-layer 1
-    :speed (first (shuffle star-speeds))))
+    :speed (rand-nth star-speeds)))

 (defn create-space []
   (let [colors [star-color-dim star-color-full]
         color-list (rest (for [x colors y colors z colors] (color x y z star-alpha)));create all binary combinations for r g b, but drop [dim dim dim]
-        star-textures (map (fn [c] (create-star-texture (color c))) color-list)]
+        star-textures (map (fn [c] (create-star-texture c)) color-list)]
     (for [count (range star-count)]
-      (create-star (c/screen-to-world (rand-int c/game-width)) (c/screen-to-world (rand-int c/game-height)) (first (shuffle star-textures)))
-      )))
+      (create-star (c/screen-to-world (rand-int c/game-width))
+                   (c/screen-to-world (rand-int c/game-height))
+                   (rand-nth star-textures)))))
+

 (defn move-star [screen {:keys [:y :speed] :as entity}]
   (let [new-y (if (< (+ y speed) 0)
-                    (+ (c/screen-to-world 5) (c/screen-to-world c/game-height))
-                    (+ y speed))]
-  (assoc entity :y new-y)))
+                  (+ (c/screen-to-world off-screen-padding)
+                     (c/screen-to-world c/game-height))
+                  (+ y speed))]
+    (assoc entity :y new-y)))


[#532] Flow null's through in  filters

[#532] Flow null's through in  filters

--- backend/src/akvo/lumen/lib/visualisation/filter.clj
+++ backend/src/akvo/lumen/lib/visualisation/filter.clj
@@ -52,15 +52,15 @@
   (let [{column-type "type" column-name "columnName"} column
         op (if (= operation "keep") "=" "<>")]
     (condp = column-type
-      "number" (format "%s %s %s"
+      "number" (format "%1$s IS NULL OR %1$s %2$s %3$s"
                        column-name
                        op
                        (parse-number value))
-      "date" (format "%s %s '%s'::timestamptz"
+      "date" (format "%1$s IS NULL OR %1$s %2$s '%3$s'::timestamptz"
                      column-name
                      op
                      (parse-date value))
-      "text" (format "%s %s '%s'"
+      "text" (format "%1$s IS NULL OR %1$s %2$s '%3$s'"
                      column-name
                      op
                      (escape-sql-str value))


Refactor

Refactor

--- backend/test/akvo/lumen/lib/transformation_test.clj
+++ backend/test/akvo/lumen/lib/transformation_test.clj
@@ -32,17 +32,17 @@
 (alias 'c.text 'akvo.lumen.specs.import.column.text)
 (alias 'i.values 'akvo.lumen.specs.import.values)

+(use-fixtures :once tu/spec-instrument caddisfly-fixture tenant-conn-fixture error-tracker-fixture)
+
+(hugsql/def-db-fns "akvo/lumen/lib/job-execution.sql")
+(hugsql/def-db-fns "akvo/lumen/lib/transformation_test.sql")
+(hugsql/def-db-fns "akvo/lumen/lib/transformation.sql")
+
 (def ops (vec (json/parse-string (slurp (io/resource "ops.json")))))

 (def invalid-op (-> (take 3 ops)
                     vec
                     (update-in [1 "args"] dissoc "parseFormat")))
-
-(hugsql/def-db-fns "akvo/lumen/lib/job-execution.sql")
-(hugsql/def-db-fns "akvo/lumen/lib/transformation_test.sql")
-(hugsql/def-db-fns "akvo/lumen/lib/transformation.sql")
-
-(use-fixtures :once tu/spec-instrument caddisfly-fixture tenant-conn-fixture error-tracker-fixture)

 (deftest op-validation
   (testing "op validation"
@@ -62,7 +62,7 @@
                                                                  :file "transformation_test.csv"})
           [tag _] (last (for [transformation ops]
                           (tf/apply {:tenant-conn *tenant-conn*} dataset-id {:type :transformation
-                                                              :transformation transformation})))]
+                                                                             :transformation transformation})))]
       (is (= ::lib/ok tag)))))

 (deftest ^:functional test-import-and-transform


bugfix interior/exterior handling in material-ref, bugfix file-mesh for STL meshes (was always writing PLY)

--- src/thi/ng/luxor/compiler.clj
+++ src/thi/ng/luxor/compiler.clj
@@ -13,8 +13,8 @@
   (let [{:keys [__interior __exterior]} (get-in scene [:materials id])]
     (str
      (format "NamedMaterial \"%s\"\n" (name id))
-     (when __interior (format "Interior \"%s\"\n" __interior))
-     (when __exterior (format "Exterior \"%s\"\n" __exterior)))))
+     (when __interior (format "Interior \"%s\"\n" (name __interior)))
+     (when __exterior (format "Exterior \"%s\"\n" (name __exterior))))))

 (defn filter-opts
   [xs] (->> xs (filter #(not (.startsWith (name (key %)) "__"))) (into {})))
@@ -137,8 +137,7 @@
     (str
      (luxentity scene "AreaLightSource" "area" opts)
      (emit stype scene (str id "-mesh")
-           (assoc sopts
-             :name [:string (:__basename sopts)])))))
+           (assoc sopts :name [:string (:__basename sopts)])))))

 (defmethod emit :spot-light
   [_ scene id opts]
@@ -189,21 +188,22 @@
       :name [:string id]})))

 (defn file-mesh
-  [scene id type ext {:keys [__mesh __basename  filename __export-path smooth] :as opts}]
+  [scene id type ext export-fn
+   {:keys [__mesh __basename  filename __export-path smooth] :as opts}]
   (let [path (or __export-path (second filename) (str __basename ext))
         stream-fn (get-in scene [:__config :mesh-streamer])]
     (when __mesh
       (with-open [out (stream-fn id path)]
-        (mio/write-ply out __mesh)))
+        (export-fn out __mesh)))
     (luxentity scene "Shape" type (assoc opts :filename [:string path]))))

 (defmethod emit :plymesh
   [_ scene id opts]
-  (file-mesh scene id "plymesh" ".ply" opts))
+  (file-mesh scene id "plymesh" ".ply" mio/write-ply opts))

 (defmethod emit :stlmesh
   [_ scene id opts]
-  (file-mesh scene id "stlmesh" ".stl" opts))
+  (file-mesh scene id "stlmesh" ".stl" mio/write-stl opts))

 (defmethod emit :shape
   [_ scene id {:keys [__type] :as opts}]


Fix bug on vanilla loader

Fix bug on vanilla loader

--- modules/less/src/modular/less.clj
+++ modules/less/src/modular/less.clj
@@ -19,7 +19,7 @@
 (defn new-less-compiler [& {:as opts}]
   (->> opts
        (merge {:engine :nashorn
-               :loader #(slurp "resources/less/" %)})
+               :loader #(slurp (str "resources/less/" %))})
        (s/validate {:engine (s/enum :javascript :rhino :nashorn)
                     :loader (s/=> s/Str s/Str)
                     :source-path s/Str


little refactor

little refactor

--- src/tic_tac_toe/tic_tac_toe.clj
+++ src/tic_tac_toe/tic_tac_toe.clj
@@ -61,7 +61,7 @@
   (println))

 (defn chars-seq [string]
-  (filter (complement blank?) (split string #"")))
+  (remove blank? (split string #"")))

 (defn map-to-ints [coll]
   (letfn [(parseInt-at [place] (Integer/parseInt (place coll)))]


Small layout change to favor clean display of longer times

I'm running more and more into pages where I've spent several hours.
Changing the layout to favor them, since these are the ones that show up
first on the URL list, and the ones one will see more often.

--- src/ui/relevance/display.cljs
+++ src/ui/relevance/display.cljs
@@ -228,9 +228,9 @@

           ^{:key i}
           [:tr {:class "has_on_hover"}
-           [:td {:class "col-sm-1"}
+           [:td {:class "col-sm-2"}
             (time-display (:time tab))]
-           [:td {:class "col-sm-9"}
+           [:td {:class "col-sm-8"}
             [:a
              {:href url :target "_blank"}
              (if favicon


force exact-match with multiple results to zero result to indicate ambiguity WormBase/website#6382

--- src/wb_es/web/integration.clj
+++ src/wb_es/web/integration.clj
@@ -95,13 +95,14 @@
     (let [params (:params request)
           response (handler request)
           pack-function get-obj
-          body (->> (get-in response [:body :hits :hits])
-                    (first))]
-      (assoc response :body (if body
+          body (get-in response [:body :hits :hits])
+          exact-match (if (= 1 (count body))
+                        (first body))]
+      (assoc response :body (if exact-match
                               (if (or (:fill params)
                                       (:footer params))
-                                (assoc (get-obj body) :footer (get-in request [:params :footer]))
-                                (pack-search-obj body))
+                                (assoc (get-obj exact-match) :footer (get-in request [:params :footer]))
+                                (pack-search-obj exact-match))
                               {})))))

 (defn wrap-count [handler]


Propogate color and background-color for Popup

--- src/zaffre/components/ui.cljc
+++ src/zaffre/components/ui.cljc
@@ -357,7 +357,8 @@
   :display-name "Popup"
   :render (fn [this]
     (log/trace "Popup render")
-    (let [{:keys [children] :as props} (zc/props this)]
+    (let [{:keys [style children] :as props} (zc/props this)
+          {:keys [color background-color]} style]
       (zc/csx [:view {:style {:max-height "100%" :max-width "100%"
                               :height "100%"
                               :align-items :center
@@ -366,8 +367,8 @@
                               :top 0 :left 0
                               :color [0 0 0 128]
                               :background-color [0 0 0 128]}} [
-                [:view {:style {:color [255 255 255 255]
-                                :background-color [0 0 0 255]
+                [:view {:style {:color (or color [255 255 255 255])
+                                :background-color (or background-color [0 0 0 255])
                                 :margin-top 10
                                 ;:margin-bottom 10
                                 :padding 0


collatz-conjecture, fix on example.clj

collatz-conjecture, fix on example.clj

--- exercises/collatz-conjecture/src/example.clj
+++ exercises/collatz-conjecture/src/example.clj
@@ -6,4 +6,5 @@
       (cond (= 1 n)   t
             (even? n) (recur (inc t) (/ n 2))
             :else     (recur (inc t) (inc (* 3 n)))))
-    (throw (IllegalArgumentException. "Just defined for numbers greater than 0."))))
+    (throw (IllegalArgumentException.
+             "Just defined for numbers greater than 0."))))


use (seq (str n)) instead of regex to explode digits

--- euler-clj/src/euler_clj/core.clj
+++ euler-clj/src/euler_clj/core.clj
@@ -133,7 +133,7 @@
   "Return the greatest product of m consecutive digits in a number n."
   [m n]
   (apply max
-    (loop [p (pmap #(bigint (java.lang.Integer/parseInt %)) (rest (string/split (str n) #"")))
+    (loop [p (pmap #(bigint (java.lang.Integer/parseInt (str %))) (seq (str n)))
            results []]
       (let [new-results (conj results (apply * (take m p)))]
         (if (<= (count p) m)


(TK-22) Fix for Jetty9 service shutdown error when not first inited

This commit adds a simple check in the Jetty9 service's `stop` function
which avoids calling the `core/shutdown` function if no `:jetty9-server`
is attached to the context.  This avoids a schema violation `Exception`
which would otherwise be thrown for any case where the Jetty9 service's
`stop` function were called without the Jetty9 service's `init` function
first being called.  The prior `Exception` would have only occurred if
another service had thrown a `Throwable` from its `init` function and the
Jetty9 service's `init` function had not already been called.

--- src/puppetlabs/trapperkeeper/services/webserver/jetty9_service.clj
+++ src/puppetlabs/trapperkeeper/services/webserver/jetty9_service.clj
@@ -37,7 +37,8 @@

   (stop [this context]
         (log/info "Shutting down web server.")
-        (core/shutdown (context :jetty9-server))
+        (if-let [server (:jetty9-server context)]
+          (core/shutdown server))
         context)

   (add-context-handler [this base-path context-path]


Metadata directory

Metadata directory

--- src/clj_jenkins_api/jenkins_api.clj
+++ src/clj_jenkins_api/jenkins_api.clj
@@ -175,34 +175,35 @@
         :trust-store-pass "changeit"}))

 (defn get-template
-    [metadata]
-    (slurp (if metadata "data/template_with_metadata.xml" "data/template.xml")))
+    [metadata-directory metadata]
+    (slurp (if metadata (str metadata-directory "/template_with_metadata.xml")
+                        (str metadata-directory "/template.xml"))))

 (defn create-job
-    [jenkins-url jenkins-auth include-jenkins-reply? job-name git-repo branch metadata]
-    (log-operation job-name git-repo branch "create" metadata)
-    (let [template (get-template metadata)
+    [jenkins-url jenkins-auth include-jenkins-reply? job-name git-repo branch metadata-directory metadata]
+    (log-operation job-name git-repo branch "create_job" metadata)
+    (let [template (get-template metadata-directory metadata)
           config   (update-template template git-repo branch metadata)
           url      (str (update-jenkins-url jenkins-url jenkins-auth) "createItem?name=" (.replaceAll job-name " " "%20"))]
           (log "URL to use: " url)
           (try
               (->> (send-configuration-xml-to-jenkins url config)
-                   (ok-response-structure job-name "create" include-jenkins-reply?))
+                   (ok-response-structure job-name "create_job" include-jenkins-reply?))
               (catch Exception e
                   (.printStackTrace e)
-                  (error-response-structure job-name "create" e)))))
+                  (error-response-structure job-name "create_job" e)))))

 (defn update-job
-    [jenkins-url jenkins-auth include-jenkins-reply? job-name git-repo branch metadata]
-    (log-operation job-name git-repo branch "update" metadata)
-    (let [template (get-template metadata)
+    [jenkins-url jenkins-auth include-jenkins-reply? job-name git-repo branch metadata-directory metadata]
+    (log-operation job-name git-repo branch "update_job" metadata)
+    (let [template (get-template metadata-directory metadata)
           config   (update-template template git-repo branch metadata)
           url      (str (job-name->url (update-jenkins-url jenkins-url jenkins-auth) job-name) "/config.xml")]
           (log "URL to use: " url)
           (try
               (->> (send-configuration-xml-to-jenkins url config)
-                   (ok-response-structure job-name "update" include-jenkins-reply?))
+                   (ok-response-structure job-name "update_job" include-jenkins-reply?))
               (catch Exception e
                   (.printStackTrace e)
-                  (error-response-structure job-name "update" e)))))
-
+                  (error-response-structure job-name "update_job" e)))))
+


Remove debug statement

Remove debug statement

--- src/cljs/asciinema_player/core.cljs
+++ src/cljs/asciinema_player/core.cljs
@@ -299,7 +299,6 @@
         (let [t (timeout msec)
               [_ c] (alts! [input t])]
           (when (= c input)
-            (print "moved")
             (recur))))
       (>! out false)


Check automated deploy.

Check automated deploy.

--- src/cljs/munchkin_toolbox/core.cljs
+++ src/cljs/munchkin_toolbox/core.cljs
@@ -102,7 +102,7 @@
           [:button
            {:class "btn btn-default"
             :on-click #(put! player-added-c true)}
-           "Add player"]])))))
+           "Add a new player"]])))))

 (defn app


Parse keys file with edn and don't attempt if sandboxed

--- src/clojure/nightcode/shortcuts.clj
+++ src/clojure/nightcode/shortcuts.clj
@@ -1,5 +1,7 @@
 (ns nightcode.shortcuts
-  (:require [nightcode.ui :as ui]
+  (:require [clojure.edn :as edn]
+            [nightcode.sandbox :as sandbox]
+            [nightcode.ui :as ui]
             [seesaw.core :as s]
             [seesaw.keymap :as keymap])
   (:import [java.awt Color Component KeyboardFocusManager KeyEventDispatcher
@@ -13,41 +15,44 @@
 (def down? (atom false))
 (def ^:dynamic *hint-container* nil)

-(def ^:const mappings (merge {:new-project "P"
-                       :rename "M"
-                       :import "O"
-                       :remove "G"
-                       :run "R"
-                       :run-repl "E"
-                       :reload "shift S"
-                       :eval "shift X"
-                       :build "B"
-                       :test "T"
-                       :clean "L"
-                       :check-versions "shift V"
-                       :stop "I"
-                       :sdk "shift K"
-                       :auto "shift O"
-                       :up "U"
-                       :save "S"
-                       :undo "Z"
-                       :redo "Y"
-                       :font-dec "MINUS"
-                       :font-inc "EQUALS"
-                       :doc "shift D"
-                       :paredit "shift P"
-                       :find "F"
-                       :replace "shift R"
-                       :close "W"
-                       :repl-console "shift E"
-                       :project-pane "↑ ↓ ↵"
-                       :toggle-logcat "S"
-                       :new-file "N"
-                       :edit "shift M"
-                       :open-in-browser "shift F"
-                       :cancel "shift C"
-                       :build-console "shift A"}
-                      (try (read-string (slurp "keys.clj")) (catch Exception e {}))))
+(def mappings (merge {:new-project "P"
+                      :rename "M"
+                      :import "O"
+                      :remove "G"
+                      :run "R"
+                      :run-repl "E"
+                      :reload "shift S"
+                      :eval "shift X"
+                      :build "B"
+                      :test "T"
+                      :clean "L"
+                      :check-versions "shift V"
+                      :stop "I"
+                      :sdk "shift K"
+                      :auto "shift O"
+                      :up "U"
+                      :save "S"
+                      :undo "Z"
+                      :redo "Y"
+                      :font-dec "MINUS"
+                      :font-inc "EQUALS"
+                      :doc "shift D"
+                      :paredit "shift P"
+                      :find "F"
+                      :replace "shift R"
+                      :close "W"
+                      :repl-console "shift E"
+                      :project-pane "↑ ↓ ↵"
+                      :toggle-logcat "S"
+                      :new-file "N"
+                      :edit "shift M"
+                      :open-in-browser "shift F"
+                      :cancel "shift C"
+                      :build-console "shift A"}
+                     (when-not (sandbox/get-dir)
+                       (try
+                         (edn/read-string (slurp "keys.edn"))
+                         (catch Exception _)))))

 (defn create-mapping!
   "Maps `func` to the key combo associated with `id`."


Delete dsdd.boot

Delete dsdd.boot

--- font-awesome/css/fonts/dsdd.boot
+++ font-awesome/css/fonts/dsdd.boot
@@ -1 +0,0 @@
-