Renamed "number" function to "random-element-or-thing". Also, slightly tweaked the implementation to either take a random element from a collection or otherwise just return the thing.

--- src/clojush/pushgp/genetic_operators.clj
+++ src/clojush/pushgp/genetic_operators.clj
@@ -8,14 +8,14 @@
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; local utilities

-(defn number
+(defn random-element-or-thing
   "If given a number, returns it. If given a collection, returns a member of the collection.
   Intended for allowing arguments to genetic operators, such as mutation rates, to take
   collections in addition to single values"
-  [number-or-numbers]
-  (if (number? number-or-numbers)
-    number-or-numbers
-    (lrand-nth number-or-numbers)))
+  [thing-or-collection]
+  (if (coll? thing-or-collection)
+    (lrand-nth thing-or-collection)
+    thing-or-collection))

 (declare produce-child-genome-by-autoconstruction) ;; forward declaration for grain size calculations

@@ -207,22 +207,22 @@
                atom-generators]
         :as argmap}]
   (let [uniform-mutation-rate
-        (number uniform-mutation-rate)
+        (random-element-or-thing uniform-mutation-rate)

         uniform-mutation-constant-tweak-rate
-        (number uniform-mutation-constant-tweak-rate)
+        (random-element-or-thing uniform-mutation-constant-tweak-rate)

         uniform-mutation-float-gaussian-standard-deviation
-        (number uniform-mutation-float-gaussian-standard-deviation)
+        (random-element-or-thing uniform-mutation-float-gaussian-standard-deviation)

         uniform-mutation-int-gaussian-standard-deviation
-        (number uniform-mutation-int-gaussian-standard-deviation)
+        (random-element-or-thing uniform-mutation-int-gaussian-standard-deviation)

         uniform-mutation-tag-gaussian-standard-deviation
-        (number uniform-mutation-tag-gaussian-standard-deviation)
+        (random-element-or-thing uniform-mutation-tag-gaussian-standard-deviation)

         uniform-mutation-string-char-change-rate
-        (number uniform-mutation-string-char-change-rate)
+        (random-element-or-thing uniform-mutation-string-char-change-rate)

         string-tweak (fn [st]
                        (apply str (map (fn [c]
@@ -287,7 +287,7 @@
    mutated it will be replaced with a random instruction."
   [ind {:keys [uniform-mutation-rate maintain-ancestors atom-generators]
         :as argmap}]
-  (let [uniform-mutation-rate (number uniform-mutation-rate)
+  (let [uniform-mutation-rate (random-element-or-thing uniform-mutation-rate)
         instruction-mutator (fn [token]
                               (assoc token
                                 :instruction
@@ -317,10 +317,10 @@
                maintain-ancestors atom-generators]
         :as argmap}]
   (let [uniform-mutation-constant-tweak-rate
-        (number uniform-mutation-constant-tweak-rate)
+        (random-element-or-thing uniform-mutation-constant-tweak-rate)

         uniform-mutation-int-gaussian-standard-deviation
-        (number uniform-mutation-int-gaussian-standard-deviation)
+        (random-element-or-thing uniform-mutation-int-gaussian-standard-deviation)

         constant-mutator (fn [token]
                            (let [const (:instruction token)]
@@ -355,10 +355,10 @@
                maintain-ancestors atom-generators]
         :as argmap}]
   (let [uniform-mutation-constant-tweak-rate
-        (number uniform-mutation-constant-tweak-rate)
+        (random-element-or-thing uniform-mutation-constant-tweak-rate)

         uniform-mutation-float-gaussian-standard-deviation
-        (number uniform-mutation-float-gaussian-standard-deviation)
+        (random-element-or-thing uniform-mutation-float-gaussian-standard-deviation)

         constant-mutator (fn [token]
                            (let [const (:instruction token)]
@@ -391,10 +391,10 @@
                maintain-ancestors atom-generators]
         :as argmap}]
   (let [uniform-mutation-rate
-        (number uniform-mutation-rate)
+        (random-element-or-thing uniform-mutation-rate)

         uniform-mutation-tag-gaussian-standard-deviation
-        (number uniform-mutation-tag-gaussian-standard-deviation)
+        (random-element-or-thing uniform-mutation-tag-gaussian-standard-deviation)

         constant-mutator (fn [token]
                            (let [const (:instruction token)]
@@ -425,10 +425,10 @@
                maintain-ancestors atom-generators]
         :as argmap}]
   (let [uniform-mutation-rate
-        (number uniform-mutation-rate)
+        (random-element-or-thing uniform-mutation-rate)

         uniform-mutation-string-char-change-rate
-        (number uniform-mutation-string-char-change-rate)
+        (random-element-or-thing uniform-mutation-string-char-change-rate)

         string-tweak (fn [st]
                        (apply str (map (fn [c]
@@ -465,7 +465,7 @@
   [ind {:keys [uniform-mutation-constant-tweak-rate
                maintain-ancestors atom-generators]
         :as argmap}]
-  (let [uniform-mutation-constant-tweak-rate (number uniform-mutation-constant-tweak-rate)
+  (let [uniform-mutation-constant-tweak-rate (random-element-or-thing uniform-mutation-constant-tweak-rate)
         constant-mutator (fn [token]
                            (let [const (:instruction token)]
                              (if (or (= const true) (= const false))
@@ -497,8 +497,8 @@
         :as argmap}]
   (if (not (some #{:close} epigenetic-markers))
     ind
-    (let [uniform-close-mutation-rate (number uniform-close-mutation-rate)
-          close-increment-rate (number close-increment-rate)
+    (let [uniform-close-mutation-rate (random-element-or-thing uniform-close-mutation-rate)
+          close-increment-rate (random-element-or-thing close-increment-rate)
           close-mutator (fn [instr-map]
                           (let [closes (get instr-map :close 0)]
                             (assoc instr-map :close
@@ -530,7 +530,7 @@
         :as argmap}]
   (if (not (some #{:silent} epigenetic-markers))
     ind
-    (let [uniform-silence-mutation-rate (number uniform-silence-mutation-rate)
+    (let [uniform-silence-mutation-rate (random-element-or-thing uniform-silence-mutation-rate)
           silent-mutator (fn [instr-map]
                            (let [silent (get instr-map :silent false)]
                              (assoc instr-map :silent
@@ -553,7 +553,7 @@
   "Returns the individual with each element of its genome possibly deleted, with probability
 given by uniform-deletion-rate."
   [ind {:keys [uniform-deletion-rate maintain-ancestors] :as argmap}]
-  (let [rate (number uniform-deletion-rate)
+  (let [rate (random-element-or-thing uniform-deletion-rate)
         new-genome (vec (filter identity
                                 (mapv #(if (< (lrand) rate) nil %)
                                       (:genome ind))))]
@@ -572,7 +572,7 @@
   "Returns the individual with each element of its genome possibly preceded or followed by
   a new gene, with probability given by uniform-addition-rate."
   [ind {:keys [uniform-addition-rate maintain-ancestors atom-generators] :as argmap}]
-  (let [rate (number uniform-addition-rate)
+  (let [rate (random-element-or-thing uniform-addition-rate)
         new-genome (vec (apply concat
                                (mapv #(if (< (lrand) rate)
                                         (lshuffle [%
@@ -598,7 +598,7 @@
   uniform-addition-and-deletion-rate."
   [ind {:keys [uniform-addition-and-deletion-rate maintain-ancestors atom-generators]
         :as argmap}]
-  (let [addition-rate (number uniform-addition-and-deletion-rate)
+  (let [addition-rate (random-element-or-thing uniform-addition-and-deletion-rate)
         deletion-rate (if (zero? addition-rate)
                         0
                         (/ 1 (+ (/ 1 addition-rate) 1)))
@@ -631,7 +631,7 @@
   [parent1 parent2
    {:keys [uniform-combination-rate maintain-ancestors]
     :as argmap}]
-  (let [combination-rate (number uniform-combination-rate)
+  (let [combination-rate (random-element-or-thing uniform-combination-rate)
         new-genome (vec
                     (apply concat
                            (mapv (fn [g1 g2]
@@ -660,7 +660,7 @@
   [parent1 parent2
    {:keys [uniform-combination-and-deletion-rate maintain-ancestors]
     :as argmap}]
-  (let [combination-rate (number uniform-combination-and-deletion-rate)
+  (let [combination-rate (random-element-or-thing uniform-combination-and-deletion-rate)
         deletion-rate (if (zero? combination-rate)
                         0
                         (/ 1 (+ (/ 1 combination-rate) 1)))
@@ -691,8 +691,8 @@
    used in ULTRA."
   [parent1 parent2 {:keys [alternation-rate alignment-deviation
                            max-points maintain-ancestors] :as argmap}]
-  (let [alternation-rate (number alternation-rate)
-        alignment-deviation (number alignment-deviation)
+  (let [alternation-rate (random-element-or-thing alternation-rate)
+        alignment-deviation (random-element-or-thing alignment-deviation)
         s1 (:genome parent1)
         s2 (:genome parent2)
         new-genome (loop [i 0


Adds dropdown page.

Adds dropdown page.


Add forest biome and adjust biome distribution

--- src/robinson/worldgen.clj
+++ src/robinson/worldgen.clj
@@ -71,11 +71,14 @@
   (cliskf/vectorize
     (cliskf/vlet [c (center (invert (cliskf/offset (cliskf/scale 0.43 (cliskf/v* [0.5 0.5 0.5] cliskp/vsnoise)) cliskf/radius)))]
       (vcond
+        ;; interior jungle
+        (cliskf/v+ [-0.7 -0.7 -0.7]  (cliskf/v* c (cliskf/v+ [0.4 0.4 0.4] (cliskf/scale 0.03 cliskp/noise))))
+          [0 0.4 0.1]
         ;; interior trees/green
-        (cliskf/v+ [-0.7 -0.7 -0.7]  (cliskf/v* c (cliskf/v+ [0.4 0.4 0.4] (cliskf/scale 0.03 cliskp/noise))))
+        (cliskf/v+ [-0.7 -0.7 -0.7]  (cliskf/v* c (cliskf/v+ [0.4 0.4 0.4] (cliskf/offset [0.5 0.5] (cliskf/scale 0.04 cliskp/noise)))))
           [0 0.5 0]
         ;; interior meadows
-        (cliskf/v+ [-0.58 -0.58 -0.58]  (cliskf/v* c (cliskf/v+ [0.4 0.4 0.4] (cliskf/offset [-0.5 -0.5] (cliskf/scale 0.06 cliskp/noise)))))
+        (cliskf/v+ [-0.56 -0.56 -0.56]  (cliskf/v* c (cliskf/v+ [0.3 0.3 0.3] (cliskf/offset [-0.5 -0.5] (cliskf/scale 0.06 cliskp/noise)))))
           [0.2 0.7 0.2]
         ;; interior dirt/brown
         (cliskf/v+ [-0.55 -0.55 -0.55]  c)
@@ -128,25 +131,35 @@
                 [0.0 0.4 0.5] {:type :water}
                 [0.0 0.5 0.6] {:type :surf}
                 [0.7 0.6 0.0] {:type :sand}
-                [0.3 0.2 0.1] (case (uniform-int 2)
+                [0.3 0.2 0.1] (case (uniform-int 3)
                                 0 {:type :dirt}
                                 1 {:type :gravel})
+                                2 {:type :tall-grass}
                 [0.2 0.7 0.2] (case (uniform-int 5)
                                 0 {:type :dirt}
                                 1 {:type :tall-grass}
                                 2 {:type :tall-grass}
                                 3 {:type :short-grass}
                                 4 {:type :short-grass})
-                [0.0 0.5 0.0] (case (uniform-int 7)
-                                0 {:type :tree}
-                                1 {:type :palm-tree}
-                                2 {:type :fruit-tree :fruit-type (dg/rand-nth [:red-fruit :orange-fruit :yellow-fruit
+                ;; jungle
+                [0.0 0.4 0.1] (case (uniform-int 6)
+                                0 {:type :palm-tree}
+                                1 {:type :fruit-tree :fruit-type (dg/rand-nth [:red-fruit :orange-fruit :yellow-fruit
                                                                                :green-fruit :blue-fruit :purple-fruit
                                                                                :white-fruit :black-fruit])}
-                                3 {:type :tall-grass}
-                                4 {:type :short-grass}
-                                5 {:type :gravel}
-                                6 {:type :bamboo}))))
+                                2 {:type :tall-grass}
+                                3 {:type :short-grass}
+                                4 {:type :gravel}
+                                5 {:type :bamboo})
+                ;; forest
+                [0.0 0.5 0.0] (case (uniform-int 5)
+                                0 {:type :tree}
+                                1 {:type :fruit-tree :fruit-type (dg/rand-nth [:red-fruit :orange-fruit :yellow-fruit
+                                                                               :green-fruit :blue-fruit :purple-fruit
+                                                                               :white-fruit :black-fruit])}
+                                2 {:type :tall-grass}
+                                3 {:type :short-grass}
+                                4 {:type :gravel}))))
             (for [y (range y (+ y height))
                   x (range x (+ x width))]
               [x y]))))))))


Improve async tests

Improve async tests

--- test/clojure/clojurewerkz/cassaforte/async_cql_test.clj
+++ test/clojure/clojurewerkz/cassaforte/async_cql_test.clj
@@ -1,5 +1,6 @@
 (ns clojurewerkz.cassaforte.async-cql-test
   (:refer-clojure :exclude [update])
+  (:import [java.util.concurrent CountDownLatch Executors])
   (:require [clojurewerkz.cassaforte.test-helper :as th]
             [clojurewerkz.cassaforte.client      :as client]
             [clojurewerkz.cassaforte.policies    :as cp]
@@ -13,20 +14,34 @@
 (let [s (th/make-test-session)]
   (deftest test-insert
     (let [r {:name "Alex" :city "Munich" :age (int 19)}]
-      (insert-async s :users r)
+      @(insert-async s :users r)
       (is (= r (first @(select-async s :users))))
       (truncate s :users)))

   (deftest test-insert-time-unit
     (let [r {:name "Alex" :city "Munich" :age (int 19)}]
-      (insert-async s :users r)
+      @(insert-async s :users r)
       (is (= r (first (deref (select-async s :users) 1 java.util.concurrent.TimeUnit/SECONDS))))
+      (truncate s :users)))
+
+  (deftest test-insert-callback
+    (let [r     {:name "Alex" :city "Munich" :age (int 19)}
+          latch (CountDownLatch. 1)]
+      @(insert-async s :users r)
+      (let [result-future (select-async s :users)]
+        (client/add-listener result-future
+                             (fn [] (.countDown latch))
+                             (Executors/newFixedThreadPool 1))
+        (is (= r (first @result-future)))
+        (.await latch)
+        (is (= 0 (.getCount latch))))
+
       (truncate s :users)))

   (deftest test-insert-batch-with-ttl
     (let [input [[{:name "Alex" :city "Munich" :age (int 19)} (using :ttl (int 350))]
                  [{:name "Alex" :city "Munich" :age (int 19)} (using :ttl (int 350))]]]
-      (insert-batch-async s :users input)
+      @(insert-batch-async s :users input)

       @(insert-batch-async s :users input)
       (is (= (first (first input)) (first @(select-async s :users))))
@@ -52,13 +67,13 @@

     (testing "One of many update"
       (dotimes [i 3]
-        (insert-async s :user_posts {:username "user1"
+        @(insert-async s :user_posts {:username "user1"
                                      :post_id (str "post" i)
                                      :body (str "body" i)}))
-      (update-async s :user_posts
-                    {:body "bodynew"}
-                    (where {:username "user1"
-                            :post_id "post1"}))
+      @(update-async s :user_posts
+                     {:body "bodynew"}
+                     (where {:username "user1"
+                             :post_id "post1"}))
       (is (= "bodynew"
              (get-in @(select-async s :user_posts
                                     (where {:username "user1"


Revert "CMR-484: added search granules by legacy cloud_cover min / max method"

This reverts commit 943d6d7d2601ac92c009ca48a6498b5ffada64ef.

--- test/cmr/system_int_test/search/granule_search_test.clj
+++ test/cmr/system_int_test/search/granule_search_test.clj
@@ -266,59 +266,6 @@
            nil 0.7 [gran4 gran5]
            -70.0 31.0 [gran1 gran2 gran4 gran5]))))

-;; covers all of the conditions in search-by-cloud-cover test
-(deftest search-by-legacy-cloud-cover
-  (let [coll1 (d/ingest "CMR_PROV1" (dc/collection {}))
-        coll2 (d/ingest "CMR_PROV2" (dc/collection {}))
-        gran1 (d/ingest "CMR_PROV1" (dg/granule coll1 {:cloud-cover 0.8}))
-        gran2 (d/ingest "CMR_PROV1" (dg/granule coll1 {:cloud-cover 30.0}))
-        gran3 (d/ingest "CMR_PROV1" (dg/granule coll1 {:cloud-cover 120}))
-        gran4 (d/ingest "CMR_PROV2" (dg/granule coll2 {:cloud-cover -60.0}))
-        gran5 (d/ingest "CMR_PROV2" (dg/granule coll2 {:cloud-cover 0.0}))
-        gran6 (d/ingest "CMR_PROV2" (dg/granule coll2 {:granule-ur "sampleur3"}))]
-    (index/flush-elastic-index)
-    (testing "search granules with lower bound cloud-cover value"
-      (are [cc-search items] (d/refs-match? items (search/find-refs :granule cc-search))
-           {"cloud_cover[min]" "0.2"} [gran1 gran2 gran3]))
-    (testing "search granules with upper bound cloud-cover value"
-      (are [cc-search items] (d/refs-match? items (search/find-refs :granule cc-search))
-           {"cloud_cover[max]" "0.7"} [gran4 gran5]))
-    (testing "search by cloud-cover range values that would not cover all granules in store"
-      (are [cc-search items] (d/refs-match? items (search/find-refs :granule cc-search))
-           {"cloud_cover[min]" "-70.0",  "cloud_cover[max]" "31.0"} [gran1 gran2 gran4 gran5]))
-    (testing "search by cloud-cover range values that would not cover all granules in store"
-      (are [cc-search items] (d/refs-match? items (search/find-refs :granule cc-search))
-           {"cloud_cover[min]" "-70.0",  "cloud_cover[max]" "120.0"} [gran1 gran2 gran3 gran4 gran5]))
-    (testing "search by cloud-cover with min value greater than max value"
-      (let [min-value 30.0
-            max-value 0.0]
-        (is (= {:status 422
-                :errors [(vmsg/min-value-greater-than-max min-value max-value)]}
-               (search/find-refs :granule {"cloud_cover[min]" min-value  "cloud_cover[max]" max-value})))))
-    (testing "search by cloud-cover with non numeric strs 'c9c' '' "
-      (let [num-range-p1 "c9c"
-            num-range-p2 ""]
-        (is (= {:status 422
-                :errors [(msg/invalid-numeric-range-msg (format "%s,%s" num-range-p1 num-range-p2))]}
-               (search/find-refs :granule {"cloud_cover[min]" num-range-p1  "cloud_cover[max]" num-range-p2})))))
-    (testing "search by cloud-cover with non numeric strs  '' '99c'"
-      (let [num-range-p1 ""
-            num-range-p2 "99c"]
-        (is (= {:status 422
-                :errors [(msg/invalid-numeric-range-msg (format "%s,%s" num-range-p1 num-range-p2))]}
-               (search/find-refs :granule {"cloud_cover[min]" num-range-p1  "cloud_cover[max]" num-range-p2})))))
-    (testing "search by cloud-cover with empty strs '' ''"
-      (let [num-range-p1 ""
-            num-range-p2 ""]
-        (is (= {:status 422
-                :errors [(msg/invalid-numeric-range-msg (format "%s,%s" num-range-p1 num-range-p2))]}
-               (search/find-refs :granule {"cloud_cover[min]" num-range-p1  "cloud_cover[max]" num-range-p2})))))
-    (testing "search by cloud-cover with invalid range values"
-      (let [num-range-p1 "30"
-            num-range-p2 "c9c"]
-        (is (= {:status 422
-                :errors [(msg/invalid-numeric-range-msg (format "%s,%s" num-range-p1 num-range-p2))]}
-               (search/find-refs :granule {"cloud_cover[min]" num-range-p1  "cloud_cover[max]" num-range-p2})))))))

 ;; Find granules by echo_granule_id, echo_collection_id and concept_id params
 (deftest echo-granule-id-search-test


fix up renderer mentions in docstrings

fix up renderer mentions in docstrings

--- src/quil/core.clj
+++ src/quil/core.clj
@@ -497,8 +497,8 @@
     :added "1.0"}
   bezier-detail
   "Sets the resolution at which Beziers display. The default value is
-  20. This function is only useful when using the P3D or OPENGL
-  renderer as the default (JAVA2D) renderer does not use this
+  20. This function is only useful when using the :p3d or :opengl
+  renderer as the default (:java2d) renderer does not use this
   information."
   [detail]
   (.bezierDetail (current-applet) (int detail)))
@@ -953,7 +953,7 @@
   create-font. For instance, when using the default renderer
   setting (JAVA2D), the actual native version of the font will be
   employed by the sketch, improving drawing quality and
-  performance. With the P2D, P3D, and OPENGL renderer settings, the
+  performance. With the :p2d, :p3d, and :opengl renderer settings, the
   bitmapped version will be used. While this can drastically improve
   speed and appearance, results are poor when exporting if the sketch
   does not include the .otf or .ttf file, and the requested font is
@@ -973,10 +973,10 @@
   "Creates and returns a new PGraphics object of the types P2D, P3D,
   and JAVA2D. Use this class if you need to draw into an off-screen
   graphics buffer. It's not possible to use create-graphics with
-  OPENGL, because it doesn't allow offscreen use. The PDF renderer
-  requires the filename parameter. The DXF renderer should not be used
-  with create-graphics, it's only built for use with begin-raw and
-  end-raw.
+  the OPENGL renderer, because it doesn't allow offscreen use. The
+  PDF renderer requires the filename parameter. The DXF renderer
+  should not be used with create-graphics, it's only built for use
+  with begin-raw and end-raw.

   It's important to call any drawing commands between begin-draw and
   end-draw statements. This is also true for any commands that affect
@@ -1168,8 +1168,8 @@
     :added "1.0"}
   curve-detail
   "Sets the resolution at which curves display. The default value is
-  20. This function is only useful when using the P3D or OPENGL
-  renderer as the default (JAVA2D) renderer does not use this
+  20. This function is only useful when using the :p3d or :opengl
+  renderer as the default (:java2d) renderer does not use this
   information."
   [detail]
   (.curveDetail (current-applet) (int detail)))
@@ -1769,8 +1769,8 @@
   :enable-depth-test - Enables the zbuffer.

   :enable-depth-sort - Enable primitive z-sorting of triangles and
-    lines in P3D and OPENGL. This can slow performance considerably,
-    and the algorithm is not yet perfect.
+    lines in :p3d and :opengl rendering modes. This can slow
+    performance considerably, and the algorithm is not yet perfect.

   :disable-depth-sort - Disables hint :enable-depth-sort

@@ -2646,8 +2646,8 @@
   pixel. The first parameter is the horizontal value for the point,
   the second value is the vertical value for the point, and the
   optional third value is the depth value. Drawing this shape in 3D
-  using the z parameter requires the P3D or OPENGL parameter in
-  combination with size as shown in the above example."
+  using the z parameter requires the :P3D or :opengl renderer to be
+  used."
   ([x y] (.point (current-applet) (float x)(float y)))
   ([x y z] (.point (current-applet) (float x) (float y) (float z))))

@@ -3023,7 +3023,7 @@
   example, calling (rotate-x HALF-PI) and then (rotate-x HALF-PI) is
   the same as (rotate-x PI). If rotate-x is called within the draw fn,
   the transformation is reset when the loop begins again. This
-  function requires passing P3D or OPENGL into the size parameter."
+  function requires either the :p3d or :opengl renderer."
   [angle]
   (.rotateX (current-applet) (float angle)))

@@ -3044,7 +3044,7 @@
   example, calling (rotate-y HALF-PI) and then (rotate-y HALF-PI) is
   the same as (rotate-y PI). If rotate-y is called within the draw fn,
   the transformation is reset when the loop begins again. This
-  function requires passing P3D or OPENGL into the size parameter."
+  function requires either the :p3d or :opengl renderer."
   [angle]
   (.rotateY (current-applet) (float angle)))

@@ -3065,7 +3065,7 @@
   example, calling (rotate-z HALF-PI) and then (rotate-z HALF-PI) is
   the same as (rotate-z PI). If rotate-y is called within the draw fn,
   the transformation is reset when the loop begins again. This
-  function requires passing P3D or OPENGL into the size parameter."
+  function requires either the :p3d or :opengl renderer."
   [angle]
   (.rotateZ (current-applet) (float angle)))

@@ -3146,9 +3146,9 @@
   multiply the effect. For example, calling (scale 2) and then
   (scale 1.5) is the same as (scale 3). If scale is called within
   draw, the transformation is reset when the loop begins again. Using
-  this fuction with the z parameter requires passing P3D or OPENGL
-  into the size parameter as shown in the example above. This function
-  can be further controlled by push-matrix and pop-matrix."
+  this fuction with the z parameter requires specfying :p3d or :opengl
+  as the renderer. This function can be further controlled by
+  push-matrix and pop-matrix."
   ([s] (.scale (current-applet) (float s)))
   ([sx sy] (.scale (current-applet) (float sx) (float sy))))

@@ -3259,7 +3259,7 @@

   Due to what appears to be a bug in Apple's Java implementation, the
   point() and set() methods are extremely slow in some circumstances
-  when used with the default renderer. Using P2D or P3D will fix the
+  when used with the default renderer. Using :p2d or :p3d will fix the
   problem. Grouping many calls to point or set-pixel together can also
   help. (Bug 1094)"
   [x y c]
@@ -3296,9 +3296,9 @@
   parameters to define the x and y values of the opposite corner of
   the shape.

-  Note complex shapes may draw awkwardly with P2D, P3D, and
-  OPENGL. Those renderers do not yet support shapes that have holes or
-  complicated breaks."
+  Note complex shapes may draw awkwardly with the renderers :p2d, :p3d, and
+  :opengl. Those renderers do not yet support shapes that have holes
+  or complicated breaks."
   ([^PShape sh] (.shape (current-applet) sh))
   ([^PShape sh x y] (.shape (current-applet) sh (float x) (float y)))
   ([^PShape sh x y width height] (.shape (current-applet) sh (float x) (float y) (float width) (float height))))
@@ -3606,9 +3606,8 @@
   specified with the corresponding parameters :miter, :bevel, and
   :round. The default joint is :miter.

-  This function is not available with the P2D, P3D, or OPENGL
-  renderers (see bug report). More information about the renderers can
-  be found in the size reference."
+  This function is not available with the :p2d, :p3d, or :opengl
+  renderers."
   [join-mode]
   (let [join-mode (resolve-constant-key join-mode stroke-join-modes)]
     (.strokeJoin (current-applet) (int join-mode))))
@@ -3825,14 +3824,14 @@

   Changing to :screen mode draws letters directly to the front of the
   window and greatly increases rendering quality and speed when used
-  with the P2D and P3D renderers. :screen with OPENGL and JAVA2D (the
-  default) renderers will generally be slower, though pixel accurate
-  with P2D and P3D. With :screen, the letters draw at the actual size
-  of the font (in pixels) and therefore calls to text-size will not
-  affect the size of the letters. To create a font at the size you
-  desire, use create-font. When using :screen, any z-coordinate passed
-  to a text command will be ignored, because your computer screen
-  is...flat!
+  with the :p2d and :p3d renderers. :screen with :opengl
+  and :java2d (the default) renderers will generally be slower, though
+  pixel accurate with :p2d and :p3d. With :screen, the letters draw at
+  the actual size of the font (in pixels) and therefore calls to
+  text-size will not affect the size of the letters. To create a font
+  at the size you desire, use create-font. When using :screen, any
+  z-coordinate passed to a text command will be ignored, because your
+  computer screen is...flat!

   The :shape mode draws text using the the glyph outlines of
   individual characters rather than as textures. This mode is only
@@ -4063,9 +4062,8 @@
   points, lines, triangles, quads, and polygons and is used
   exclusively within the begin-shape and end-shape fns.

-  Drawing a vertex in 3D using the z parameter requires the P3D or
-  OPENGL parameter in combination with size as shown in the above
-  example.
+  Drawing a vertex in 3D using the z parameter requires the :p3d or
+  :opengl renderers to be used.

   This function is also used to map a texture onto the geometry. The
   texture fn declares the texture to apply to the geometry and the u
@@ -4304,8 +4302,8 @@
   :size           - a vector of width and height for the sketch.
                     Defaults to [500 300].

-  :renderer       - Select the renderer type. One of :p2d, :java2d,
-                    :opengl, :pdf or :dxf). Defaults to :p2d.
+  :renderer       - Specify the renderer type. One of :p2d, :java2d,
+                    :opengl, :pdf or :dxf). Defaults to :java2d.

   :title          - a string which will be displayed at the top of
                     the sketch window.


Some type hints for description graphs

Some type hints for description graphs

Signed-off-by: Daniel Borchmann <25857343a15bf1edafebc2912e82ecf775c585c1@mailbox.tu-dresden.de>

--- src/conexp/contrib/dl/languages/description_graphs.clj
+++ src/conexp/contrib/dl/languages/description_graphs.clj
@@ -50,11 +50,11 @@
   (Description-Graph. language vertices neighbours vertex-labels))

 (defmethod print-method Description-Graph [dg out]
-  (let [#^String output (with-out-str
-                          (pprint (list 'Description-Graph
-                                        (vertices dg)
-                                        (neighbours dg)
-                                        (vertex-labels dg))))]
+  (let [^String output (with-out-str
+                         (pprint (list 'Description-Graph
+                                       (vertices dg)
+                                       (neighbours dg)
+                                       (vertex-labels dg))))]
     (.write out (.trim output))))

 ;;; Normalizing
@@ -429,12 +429,14 @@
         G-1 (single-edge->double-edge-graph G-1),
         G-2 (single-edge->double-edge-graph G-2),

-        [sim remove pre*] (efficient-initialize L G-1 G-2),
-
-        #^HashSet non-empty-removes (HashSet. (for [v (:base-set G-1),
-                                                    r R,
-                                                    :when (not (empty? (.get remove [v r])))]
-                                                [v r]))]
+        [^HashMap sim,
+         ^HashMap remove,
+         ^HashMap pre*] (efficient-initialize L G-1 G-2),
+
+        ^HashSet non-empty-removes (HashSet. (for [v (:base-set G-1),
+                                                   r R,
+                                                   :when (not (empty? (.get remove [v r])))]
+                                               [v r]))]
     (while-let [[v r] (first non-empty-removes)]
       (doseq [u ((:pre G-1) v r),
               w (.get remove [v r])]


(PE-7742) Service API test for authorization-check

This commit adds a test that exercises the service protocol API to
ensure the underlying `authorization-check` function is called
correctly.

--- test/puppetlabs/trapperkeeper/services/authorization/authorization_service_test.clj
+++ test/puppetlabs/trapperkeeper/services/authorization/authorization_service_test.clj
@@ -4,6 +4,7 @@
     [clojure.string :as str]
     [puppetlabs.ssl-utils.core :as ssl-utils]
     [puppetlabs.trapperkeeper.app :refer [get-service]]
+    [puppetlabs.trapperkeeper.authorization.rules :as rules]
     [puppetlabs.trapperkeeper.authorization.testutils :refer :all]
     [puppetlabs.trapperkeeper.services :refer [defservice]]
     [puppetlabs.trapperkeeper.services.authorization.authorization-service
@@ -21,25 +22,6 @@
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;; Utilities

-(defprotocol EchoReverseService
-  (echo-reverse [this msg]))
-
-; A simple service using authorization via ring middleware
-(defservice
-  echo-reverse-service EchoReverseService
-  [[:AuthorizationService wrap-with-authorization-check]]
-  (echo-reverse
-    [this msg]
-    (let [handler (fn [req]
-                    (-> req
-                        (:body)
-                        str
-                        str/reverse
-                        ((partial str msg))
-                        response
-                        (assoc :request req)))]
-      (wrap-with-authorization-check handler))))
-
 (def minimal-config
   "Minimal config required to bootstrap AuthorizationService with
   EchoReverseService as a dependant consumer.
@@ -143,6 +125,25 @@
 (def unauthenticated-request
   "A basic unauthenticated request to feed into the tests"
   (request "/" :get "127.0.0.1"))
+
+(defprotocol EchoReverseService
+  (echo-reverse [this msg]))
+
+;; A simple service using authorization via ring middleware
+(defservice
+  echo-reverse-service EchoReverseService
+  [[:AuthorizationService wrap-with-authorization-check]]
+  (echo-reverse
+   [this msg]
+   (let [handler (fn [req]
+                   (-> req
+                       (:body)
+                       str
+                       str/reverse
+                       ((partial str msg))
+                       response
+                       (assoc :request req)))]
+     (wrap-with-authorization-check handler))))

 (defn build-ring-handler
   "Build a ring handler around the echo reverse service"
@@ -158,6 +159,15 @@
        (let [svc (get-service app :EchoReverseService)
              echo-handler (echo-reverse svc "Prefix: ")]
          (echo-handler request)))))))
+
+(defprotocol PlumbingService
+  (call-authorization-check [this request]))
+
+(defservice plumbing-service PlumbingService
+  [[:AuthorizationService authorization-check]]
+  (call-authorization-check
+   [this request]
+   (authorization-check request)))

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;; Tests
@@ -389,3 +399,19 @@
             {:keys [status body]} (app req)]
         (is (= 403 status))
         (is (re-matches #"Forbidden.*" body))))))
+
+(deftest ^:integration authorization-check-test
+  (with-test-logging
+    (with-app-with-config
+      app
+      [plumbing-service authorization-service]
+      (assoc-in minimal-config [:authorization :rules] basic-rules)
+      (testing "allowed request"
+        (is (-> (get-service app :PlumbingService)
+                (call-authorization-check
+                 (assoc base-request :uri "/puppet/v3/catalog/test.domain.org"))
+                (rules/authorized?))))
+      (testing "denied request"
+        (is (not (-> (get-service app :PlumbingService)
+                     (call-authorization-check catalog-request-nocert)
+                     (rules/authorized?))))))))


Only the first call to a memoized function should do the actual work.

--- modules/cache/src/test/clojure/test/immutant/memoize.clj
+++ modules/cache/src/test/clojure/test/immutant/memoize.clj
@@ -32,5 +32,13 @@

 (deftest prepopulation
   (let [plus (memo + "wrong" {[3 5] 9})]
-    (plus 3 5)
-    (is (= 9 (plus 3 5)))))+    (is (= 9 (plus 3 5)))))
+
+(deftest only-first-pays-total-cost
+  (let [f (fn [x] (Thread/sleep 1000) x)
+        m (memo f "first")
+        f1 (future (timeit (m 42)))]
+    (Thread/sleep 500)
+    (is (< (timeit (m 42)) 1))
+    (is (> @f1 1))))
+


removed old parser

removed old parser

--- src/selmer/old_parser.clj
+++ src/selmer/old_parser.clj
@@ -1,367 +0,0 @@
-(ns selmer.old-parser
-  (:require [clojure.string :as s]
-            [selmer.filters :refer [get-filter]]
-            [selmer.tags :refer [tags]])
-  (:import [java.io PushbackReader CharArrayReader StringReader]))
-
-;;; TODO - implement filter/tag parsers
-
-(defn ^CharArrayReader make-reader
-  [^String s]
-  (CharArrayReader. (.toCharArray s)))
-
-(def ^Character tag-opener \{)
-(def ^Character filter-second \{)
-(def ^Character tag-second \%)
-
-(declare buffer-string buffer-filter buffer-tag parser*)
-
-(defn parser
-  [s]
-  (let [rdr (make-reader s)]
-    (parser* rdr :read-string [] nil)))
-
-(defn parser*
-  "Returns a vector where strings are left as they were
-but tags and filters are turned into maps to be compiled"
-  [^CharArrayReader r state ast closing-to-find]
-  (loop [state state ast ast to-find closing-to-find]
-    (case state
-      :read-string
-      (let [[next-step buffered-str] (buffer-string r)]
-        (case next-step
-          ;; Found end of string
-          ;; TODO - error if there's still a closing tag to find
-          :end (if (seq buffered-str)
-                 (conj ast buffered-str)
-                 ast)
-          :read-filter (recur :read-filter
-                              (conj ast buffered-str)
-                              to-find)
-          :read-tag (recur :read-tag
-                           (conj ast buffered-str)
-                           to-find)))
-      :read-filter
-      (recur :read-string
-             (conj ast {:type :filter
-                        :body (buffer-filter r)})
-             to-find)
-      :read-tag
-      (let [{:keys [status name closing-tag args]} (buffer-tag r)]
-        (case status
-          :found-closing-tag
-          (cond
-           (and to-find closing-tag
-                (= to-find closing-tag))
-           ast
-           (and to-find closing-tag)
-           (throw (IllegalStateException. (str "Expected closing tag "
-                                               to-find
-                                               ". Got " closing-tag " instead.")))
-           ;; Found a closing tag when we weren't expecting one
-           :else
-           (do
-             (println "Warning: Found a random closing tag:" closing-tag)
-             (recur :read-string
-                    ast
-                    to-find)))
-          :found-opening-tag
-          ;; Keep parsing after the tag, looks kinda silly
-          (do (recur :read-string
-                     (conj ast
-                           {:type :tag
-                            :tag name
-                            :args args
-                            ;; Parse the body of the tag with a brand new tree
-                            :body
-                            (when-not (= :inline closing-tag)
-                              (parser* r :read-string [] (when-not
-                                                             (= :inline closing-tag)
-                                                           closing-tag)))})
-                     to-find ;; Assume we found the closing tag
-                     )))))))
-
-(defn buffer-string
-  [^CharArrayReader r]
-  (let [sb (StringBuilder.)]
-    (loop [cn (.read r)]
-      (if (== cn -1)
-        ;; Finished reading
-        [:end
-         (str sb)]
-        (let [c (char cn)]
-          (if (= tag-opener c)
-            (let [cn2 (.read r)]
-              (if (== cn2 -1)
-                ;; Reached end of reader
-                (do (.append sb c)
-                    [:end
-                     (str sb)])
-                (let [c2 (char cn2)]
-                  (if (or (= filter-second c2)
-                          (= tag-second c2))
-                    [(if (= filter-second c2)
-                       :read-filter
-                       :read-tag)
-                     (str sb)]
-                    (do (.append sb c)
-                        (.append sb c2)
-                        (recur (.read r)))))))
-            (do (.append sb c)
-                (recur (.read r)))))))))
-
-(defn buffer-filter
-  [^CharArrayReader r]
-  (let [sb (StringBuilder.)]
-    (loop [cn (.read r)]
-      (if (== -1 cn)
-        (throw (IllegalStateException. "Filter with no closing '}}'"))
-        (let [c (char cn)]
-          (case c
-            ;; Possibly found the end of the filter
-            \}
-            (let [cn2 (.read r)]
-              (if (== -1 cn2)
-                (throw (IllegalStateException. "Filter with no closing '}}'"))
-                (let [c2 (char cn2)]
-                  (if (= \} c2)
-                    ;; Found the end of the filter
-                    (str sb)
-                    (do (.append sb c)
-                        (.append sb c2)
-                        (str sb))))))
-            (do (.append sb c)
-                (recur (.read r)))))))))
-
-(declare parse-tag-args)
-
-(defn buffer-tag
-  [^CharArrayReader r]
-  (let [sb (StringBuilder.)]
-    (loop [cn (.read r)]
-      (if (== -1 cn)
-        (throw (IllegalStateException. "Tag with no closing %} 1"))
-        (let [c (char cn)]
-          (case c
-            ;; Possibly found end of tag '%}'
-            \%
-            (let [cn2 (.read r)]
-              (if (== -1 cn2)
-                (throw (IllegalStateException. "Tag with no closing %} 2"))
-                (let [c2 (char cn2)]
-                  (case c2
-                    \}
-                    ;; Return the map result of parsing the tag args
-                    (parse-tag-args (str sb))
-                    (do (.append sb c)
-                        (.append sb c2)
-                        (recur (.read r)))))))
-            (do (.append sb c)
-                (recur (.read r)))))))))
-
-;;; TODO - implement tags
-(def valid-tags
-  (atom {"for" "endfor"
-         "include" :inline
-         "block" "endblock"}))
-
-(defn type-of-tag
-  [tag]
-  (let [vtags @valid-tags
-        opening (set (keys vtags))
-        closing (set (vals vtags))]
-    (cond
-     (or (= :inline (closing tag))
-         (opening tag))
-     :opening
-     (closing tag)
-     :closing
-     :else
-     :invalid)))
-
-(defn parse-tag-args
-  [s]
-  (let [[tag & args]
-        ;; TODO - find out actual spec
-        (-> s
-            (s/trim)
-            (s/split #"\s+"))
-        tag-type (type-of-tag tag)]
-    (if (= :invalid tag-type)
-      (throw (IllegalStateException. (str "Invalid tag:" tag)))
-      {:name tag
-       :args args
-       :status (case tag-type
-                 :opening :found-opening-tag
-                 :closing :found-closing-tag)
-       :closing-tag (case tag-type
-                      :opening (@valid-tags tag)
-                      :closing tag)})))
-
-;;; More Utils
-(defn escape-html*
-  [s]
-  "HTML-escapes the given string."
-  [^String s]
-  ;; This method is "Java in Clojure" for serious speedups.
-  ;; Stolen from davidsantiago/quoin and modified.
-  (let [sb (StringBuilder.)
-        slength (long (count s))]
-    (loop [idx (long 0)]
-      (if (>= idx slength)
-        (.toString sb)
-        (let [c (char (.charAt s idx))]
-          (case c
-            \& (.append sb "&")
-            \< (.append sb "<")
-            \> (.append sb ">")
-            \" (.append sb """)
-            \™ (.append sb "™")
-            \é (.append sb "é")
-            (.append sb c))
-          (recur (inc idx)))))))
-
-(defn strip-doublequotes
-  [^String s]
-  (if (and (> (count s) 1)
-           (= \" (first s) (.charAt s (dec (count s)))))
-    (.substring s 1 (dec (count s)))
-    s))
-
-(defn escape-html
-  [x]
-  (if (and (vector? x)
-           (= :safe (first x)))
-    (second x)
-    (let [s (str x)]
-      (escape-html* s))))
-
-;;; Compile filters
-(defn fix-accessor
-  [ks]
-  (mapv (fn [^String s]
-          (try (Long/valueOf s)
-               (catch NumberFormatException _
-                 (keyword s))))
-        ks))
-
-(defn split-filter-val
-  [s]
-  (let [ks (s/split s #"\.")]
-    (fix-accessor ks)))
-
-(defn fix-filter-args
-  [args]
-  ;; TODO - figure out what kind of extra args filters can take
-  (map (fn [^String s]
-         (try (Long/valueOf s)
-              (catch NumberFormatException _
-                (strip-doublequotes s))))
-       args))
-
-(defn filter-str->fn
-  [s]
-  (let [[filter-name & args]
-        ;; Ignore colons inside doublequotes
-        (re-seq #"(?:[^:\"]|\"[^\"]*\")+" s)
-        args (fix-filter-args args)
-        filter (get-filter filter-name)]
-    (fn [x]
-      (apply filter x args))))
-
-(defn compile-filter-body
-  [s]
-  (let [[val & filters] (->> s
-                             (s/trim)
-                             ;; Ignore pipes and allow escaped doublequotes inside doublequotes
-                             (re-seq #"(?:[^|\"]|\"[^\"]*\")+"))
-        accessor (split-filter-val val)
-        filters (->> filters
-                      (map filter-str->fn)
-                      (reverse))]
-    (fn [context-map]
-      (let [x (get-in context-map accessor)]
-        ;; Escape by default unless the last filter is 'safe'
-        (escape-html ((apply comp filters) x))))))
-;;; End of filter compiling
-
-(declare get-tag) ;; TODO - implement in selmer.tags
-
-;;; Compile tags
-(defn compile-tag
-  [{:keys [tag args body]}]
-  (fn [context-map]
-    (if args
-      (apply (get-tag tag) context-map args body)
-      (apply (get-tag) context-map body))))
-
-;;; End of tag compiling
-
-(defn shallow-compile
-  "Compile only the first level of the lexed-tree.
-Compile means turning filters and tags into fns that expect
-a context map. Strings are left alone"
-  [lexed-tree]
-  (map (fn [token]
-         (cond (string? token)
-               token
-               (= :filter (:type token))
-               (compile-filter-body (:body token))
-               (= :tag (:type token))
-               (compile-tag token)))
-       lexed-tree))
-
-(defn render
-  [s context-map]
-  (let [compiled (shallow-compile (parser s))]
-    (apply str
-           (for [x compiled]
-             (if (string? x)
-               x
-               (x context-map))))))
-
-;;; Testing stuff
-(comment
-  (def ts1
-    "
-{{foo|upper}}
-
-{% for x in lst %}
-{{x}}
-{% include foo.html %}
-{%endfor%}
-
-")
- (def ts2 (apply str (repeat 2 ts1)))
- (def ts3
-    "
-{{foo|upper}}
-
-{% for x in lst %}
-{{x}}
-{% include foo.html %}
-{% block bar%}
-{{y}}
-{%endblock%}
-
-{%endfor%}
-
-")
-
- (def ts4 (apply str (repeat 2 ts3)))
- (def ts5 "
-
-{{x}} {{y}}
-{{x|capitalize}} {{lst|length}}
-
-")
-
- (parser ts1)
- (parser ts2)
- (parser ts3)
- (parser ts4)
- (compile (parser ts1))
- (render ts5 {:x "foo"
-              :y "bar"
-              :lst [1 2 3]})
-)


Updated casting function helper docstrings

--- src/semantic_csv/core.clj
+++ src/semantic_csv/core.clj
@@ -298,28 +298,30 @@
 ;; These functions can be imported and used in your `:cast-fns` specification

 (defn ->int
-  "Translate to int from string or other numeric"
+  "Translate to int from string or other numeric. If string represents a non integer value,
+  it will be rounded down to the nearest int."
   [v]
   (if (string? v)
     (-> v clojure.string/trim Double/parseDouble int)
     (int v)))

 (defn ->long
-  "Translating to long from string or other numeric"
+  "Translating to long from string or other numeric. If string represents a non integeral value,
+  it will be rounded down to the nearest long."
   [v]
   (if (string? v)
     (-> v clojure.string/trim Double/parseDouble long)
     (long v)))

 (defn ->float
-  "Translate to float from string or other numeric"
+  "Translate to float from string or other numeric."
   [v]
   (if (string? v)
     (-> v clojure.string/trim Float/parseFloat)
     (float v)))

 (defn ->double
-  "Translate to double from string or other numeric"
+  "Translate to double from string or other numeric."
   [v]
   (if (string? v)
     (-> v clojure.string/trim Double/parseDouble)


Some last minute doc cleanup

Some last minute doc cleanup

--- src/semantic_csv/core.clj
+++ src/semantic_csv/core.clj
@@ -255,7 +255,7 @@

 (defn slurp-csv
   "This convenience function let's you `parse-and-process` csv data given a csv filename. Note that it is _not_
-  lazy, and must read in all data so the file handle cna be closed."
+  lazy, and must read in all data so the file handle can be closed."
   [csv-filename & {:as opts}]
   (let [rest-options (dissoc opts :parser-opts)]
     (with-open [in-file (io/reader csv-filename)]
@@ -265,7 +265,7 @@
 ;; For the ultimate in _programmer_ laziness:
 ;;
 ;;     (slurp-csv "test/test.csv"
-;;                        :cast-fns {:this #(Integer/parseInt %)})
+;;                :cast-fns {:this #(Integer/parseInt %)})

 ;;

@@ -302,7 +302,7 @@
 ;;
 ;; We've already looked at `cast-with` and `cast-all`, which can be useful as output as well as input
 ;; processing functions.
-;; One of the first things we'll need is a function that takes a sequence of maps and turns it into a sequence
+;; Another important function we'll need is one that takes a sequence of maps and turns it into a sequence
 ;; of vectors since this is what most of our csv writing/formatting libraries will want.

@@ -432,7 +432,7 @@
 ;;

 ;; # One last example showing everything together
 ;;
-;; Let's see how Semantic CSV in the context of a little data pipeline.
+;; Let's see how Semantic CSV works in the context of a little data pipeline.
 ;; We're going to thread data in, tranform into maps, run some computations for each row and assoc in,
 ;; then write the modified data out to a file, all lazily.
 ;; First let's show this with `clojure/data.csv`, which I find a little easier to use for writing.


generate new name for robot if it was reset.

--- clojure/robot-name/robot.clj
+++ clojure/robot-name/robot.clj
@@ -33,15 +33,15 @@
 (defn- change-name [robot new-name]
   (let [id (robot :id)]
     (dosync
-     (alter robots assoc-in [id] name))
+     (alter robots assoc-in [id :name] new-name))
     (@robots id)))

 (defn robot []
   (manufacture))

 (defn robot-name [robot]
-  (:name (get @robots (robot :id)
-              (change-name robot (generate-name)))))
+  (or (:name ( @robots (robot :id)))
+      (:name (change-name robot (generate-name-and-inc-seq)))))

 (defn reset-name [robot]
   (let [original-name (robot :name)]


Remove interceptors from debug information

--- src/day8/re_frame/trace/metamorphic.cljc
+++ src/day8/re_frame/trace/metamorphic.cljc
@@ -85,7 +85,7 @@
 (defn summarise-event [ev]
   (-> ev
       (dissoc :start :duration :end :child-of)
-      (update :tags dissoc :app-db-before :app-db-after :effects :coeffects)))
+      (update :tags dissoc :app-db-before :app-db-after :effects :coeffects :interceptors)))

 (defn summarise-match [match]


Don't try to calculate column sizes if there are no results

--- src/sqls/ui/worksheet.clj
+++ src/sqls/ui/worksheet.clj
@@ -289,29 +289,30 @@
         _ (assert (not= frame nil))
         [strict-rows lazy-rows] rows
         ^javax.swing.JTable results-table (seesaw.core/table :id :results-table
-                                         :auto-resize :off
-                                         :model [:columns columns
-                                                 :rows strict-rows])
+                                                             :auto-resize :off
+                                                             :model [:columns columns
+                                                                     :rows strict-rows])
         results-table-scrollable (seesaw.core/scrollable results-table :id :results-table-scrollable)
         ^javax.swing.JPanel results-panel (seesaw.core/select frame [:#results-panel])
         to-remove (seesaw.core/select frame [:#results-panel :> :*])]
     (doall (map (partial seesaw.core/remove! results-panel) to-remove))
     (seesaw.core/add! results-panel results-table-scrollable)
-    (let [table-column-model (.getColumnModel results-table)
-          column-count (count columns)
-          row-count (count strict-rows)
-          max-column-widths (vec (for [column-index (range column-count)]
-                                   (max 4
-                                        (let [
-                                              column-values (map str (map #(get % column-index) strict-rows))
-                                              column-value-lengths (map count column-values)
-                                              max-column-value-length (apply max column-value-lengths)]
-                                          max-column-value-length))))
-          ]
-      (doall (for [column-index (range column-count)]
-               (let [table-column (.getColumn table-column-model column-index)
-                     column-width (get max-column-widths column-index)]
-                 (.setPreferredWidth table-column (* column-width 10))))))
+    (if (> (count strict-rows) 0)
+      (let [table-column-model (.getColumnModel results-table)
+            column-count (count columns)
+            row-count (count strict-rows)
+            max-column-widths (vec (for [column-index (range column-count)]
+                                     (max 4
+                                          (let [
+                                                column-values (map str (map #(get % column-index) strict-rows))
+                                                column-value-lengths (map count column-values)
+                                                max-column-value-length (apply max column-value-lengths)]
+                                            max-column-value-length))))
+            ]
+        (doall (for [column-index (range column-count)]
+                 (let [table-column (.getColumn table-column-model column-index)
+                       column-width (get max-column-widths column-index)]
+                   (.setPreferredWidth table-column (* column-width 10)))))))
     (set-on-scroll-handler frame (partial on-results-table-scrolled worksheet-atom))))


refactor serialize-scene, add export-scene, remove logging

serialize-scene now only handles serialization and returns map of components
export-scene used to write files/components (or deal with components otherwise via optional handler fn)

--- src/thi/ng/luxor/core.clj
+++ src/thi/ng/luxor/core.clj
@@ -48,7 +48,6 @@

 (defn- include-partials*
   [partials]
-  (prn :partials partials)
   (apply str (map include-file* partials)))

 (defn- inject-scene-partial
@@ -56,7 +55,6 @@
   (when partial
     (if include? (include-file* path) partial)))

-;; TODO rename into export-scene & split out serialize part
 (defn- serialize-lxs
   [scene base-path separate-files?]
   (let [base-name (path-filename base-path)
@@ -79,32 +77,12 @@
              (inject-scene-partial (:geometry scene) (str base-name ".lxo") separate-files?)
              (:lights scene)
              "\nWorldEnd\n")]
-    (spit lxs-path lxs)
-    lxs))
-
-(defn- serialize-lxm
-  [{:keys [materials]} base-path]
-  (when materials
-    (let [path (str base-path ".lxm")
-          body (str (lx-header path) materials)]
-      (spit path body)
-      body)))
-
-(defn- serialize-lxv
-  [{:keys [volumes]} base-path]
-  (when volumes
-    (let [path (str base-path ".lxv")
-          body (str (lx-header path) volumes)]
-      (spit path body)
-      body)))
-
-(defn- serialize-lxo
-  [{:keys [geometry]} base-path]
-  (when geometry
-    (let [path (str base-path ".lxo")
-          body (str (lx-header path) geometry)]
-      (spit path body)
-      body)))
+    {:path lxs-path :body lxs}))
+
+(defn- serialize-scene-component
+  [group path]
+  (when group
+    {:path path :body (str (lx-header path) group)}))

 (defn serialize-scene
   ([scene base-path]
@@ -128,13 +106,26 @@
                     :materials :material
                     :volumes :volume
                     :geometry :shape})
-           lxs (serialize-lxs scene* base-path separate?)]
+           serialized {:lxs (serialize-lxs scene* base-path separate?)}]
        (if separate?
-         (-> lxs
-             (str (serialize-lxm scene* base-path))
-             (str (serialize-lxo scene* base-path))
-             (str (serialize-lxv scene* base-path)))
-         lxs))))
+         (merge
+          serialized
+          {:lxm (serialize-scene-component (:materials scene*) (str base-path ".lxm"))
+           :lxo (serialize-scene-component (:geometry scene*) (str base-path ".lxo"))
+           :lxv (serialize-scene-component (:volumes scene*) (str base-path ".lxv"))})
+         serialized))))
+
+(defn export-scene
+  ([serialized-map]
+     (export-scene
+      serialized-map
+      (fn [_ path body]
+        (println "writing:" path)
+        (spit path body))))
+  ([serialized-map f]
+     (doseq [[id {:keys [path body]}] serialized-map]
+       (when (and path body)
+         (f id path body)))))

 (defn- make-transform-matrix
   [{:keys [scale rx ry rz axis theta translate] :or {rx 0 ry 0 rz 0} :as tx}]


Reverted alia version bump

Reverted alia version bump


Version 0.6.2-SNAPSHOT

Version 0.6.2-SNAPSHOT


Update to mvxcvi/directive 0.4.2.

Update to mvxcvi/directive 0.4.2.


Update deps

Update deps


Update project version

Update project version


Fix duplicated namespaces in generated API doc.

--- project.clj
+++ project.clj
@@ -20,8 +20,8 @@
   :prep-tasks [["with-profile" "+gen,+dev" "run" "-m" "afterglow.src-generator"] "protobuf" "javac" "compile"]
   :main afterglow.core
   :target-path "target/%s"
-  :profiles {:dev {:source-paths ["src" "dev_src" "target/generated"]
-                   :resource-paths ["resources" "dev_resources"]}
+  :profiles {:dev {:source-paths ["dev_src"]
+                   :resource-paths ["dev_resources"]}
              :gen {:prep-tasks ^:replace ["protobuf" "javac" "compile"]}
              :uberjar {:aot :all}}
   :plugins [[lein-ancient "0.6.5"]


Version 1.1.2

Version 1.1.2

--- project.clj
+++ project.clj
@@ -1,6 +1,6 @@
 (def ks-version "1.0.0")

-(defproject puppetlabs/trapperkeeper "1.1.2-SNAPSHOT"
+(defproject puppetlabs/trapperkeeper "1.1.2"
   :description "A framework for configuring, composing, and running Clojure services."
   ;; Abort when version ranges or version conflicts are detected in
   ;; dependencies. Also supports :warn to simply emit warnings.


Release 0.44.1.

Release 0.44.1.

--- project.clj
+++ project.clj
@@ -6,7 +6,7 @@
 ;;   the terms of this license.
 ;;   You must not remove this notice, or any other, from this software.

-(defproject uncomplicate/neanderthal "0.44.0"
+(defproject uncomplicate/neanderthal "0.44.1"
   :description "Neanderthal is a Clojure library for fast matrix and linear algebra computations."
   :url "https://github.com/uncomplicate/neanderthal"
   :scm {:name "git"
@@ -19,8 +19,8 @@
                  [uncomplicate/neanderthal-native "0.33.0"]
                  [uncomplicate/clojurecl "0.15.1"]
                  [org.jocl/jocl-blast "1.5.2"]
-                 [uncomplicate/clojurecuda "0.15.0"]
-                 [org.jcuda/jcublas "11.6.1"]
+                 [uncomplicate/clojurecuda "0.15.1"]
+                 [org.jcuda/jcublas "11.6.1b"]
                  [org.apache.commons/commons-math3 "3.6.1"]]

   :profiles {:dev {:plugins [[lein-midje "3.2.1"]


Update description and url

Update description and url

--- project.clj
+++ project.clj
@@ -1,6 +1,6 @@
 (defproject tixi "0.1.0-SNAPSHOT"
-  :description "FIXME: write this!"
-  :url "http://example.com/FIXME"
+  :description "ASCII diagrams editor"
+  :url "http://textik.com"

   :dependencies [[org.clojure/clojure "1.5.1"]
                  [com.facebook/react "0.10.0"]


a little tidying up...

a little tidying up...

--- dada2-core/src/main/clojure/org/dada2/split_model.clj
+++ dada2-core/src/main/clojure/org/dada2/split_model.clj
@@ -14,7 +14,7 @@
 ;; a real-time "group-by"

-;;; key-fn can become split-key-fn - we don't need a key-fn - are they therefore one and the same ?
+;; key-fn can become split-key-fn - we don't need a key-fn - are they therefore one and the same ?
 ;; applicator needs to create new entry one the fly - contains new-model-fn
 ;; applicator needs to return new-state and new-datum (may not be same as change)
 ;; on-change and on-changes should also be merged and shared with map-model - hard - should we lose singleton api ?
@@ -68,18 +68,11 @@
 	     )]
 	)))

-(defn- without [coll item] (remove (fn [i] (identical? item i)) coll))
-
 (defn ^ModelView split-model [name key-fn make-model-fn]
   (map-model name key-fn (make-on-change make-model-fn) (make-on-changes make-model-fn) nil nil assoc nil))

-;; need to test addition of submodels
-;; need to notify submodel after change...
-
 ;;--------------------------------------------------------------------------------
-
-;;; need metamodel
+;; need metamodel - split-mode IS a metamodel - consider...
 ;; we need a select-model so we can view this remotely without pulling submodel content over the wire

-
-;;; add new-datum-fn - call (new-datum-fn new-datum) to get new-datum
+;; TODO - refactor to share more code with map-model...


move game state query function up in the game dao

--- src/wombats/daos/game.clj
+++ src/wombats/daos/game.clj
@@ -3,6 +3,7 @@
             [taoensso.nippy :as nippy]
             [wombats.game.core :refer [initialize-round]]
             [wombats.game.utils :refer [decision-maker-state]]
+            [wombats.sockets.game :as game-sockets]
             [wombats.daos.helpers :refer [get-entity-by-prop
                                           get-entity-id
                                           gen-id
@@ -103,6 +104,65 @@
   [conn]
   (fn [game-id]
     (get-entity-by-prop conn :game/id game-id game-projection)))
+
+(defn- format-player-map
+  "Formats the player map attached to game-state"
+  [players]
+  (let [formatted-players (map (fn [[player stats user wombat]]
+                                 {:player player
+                                  :stats stats
+                                  :user user
+                                  :wombat wombat
+                                  :state decision-maker-state}) players)]
+    (reduce #(assoc %1 (gen-id) %2) {} formatted-players)))
+
+(defn get-game-state-by-id
+  [conn]
+  (fn [game-id]
+    (let [[frame
+           arena
+           game] (first
+                   (d/q '[:find (pull ?frame [*])
+                                (pull ?arena [*])
+                                (pull ?game [*])
+                          :in $ ?game-id
+                          :where [?game :game/id ?game-id]
+                                 [?game :game/frame ?frame]
+                                 [?game :game/arena ?arena]]
+                        (d/db conn)
+                        game-id))
+          players (d/q '[:find (pull ?players [*])
+                               (pull ?stats [*])
+                               (pull ?user [:db/id
+                                            :user/github-username
+                                            :user/github-access-token])
+                               (pull ?wombat [*])
+                         :in $ ?game-id
+                         :where [?game :game/id ?game-id]
+                                [?game :game/players ?players]
+                                [?game :game/stats ?stats]
+                                [?players :player/user ?user]
+                                [?players :player/wombat ?wombat]]
+                       (d/db conn)
+                       game-id)]
+
+      ;; TODO The datomic query pulls 2 of each player. The following will filter
+      ;;      out the duplicates.
+      (let [n-players (vec
+                       (vals
+                        (reduce (fn [player-acc player]
+                                  (let [id (:db/id (first player))
+                                        existing-ids (set (vals player-acc))]
+                                    (if (contains? existing-ids id)
+                                      player-acc
+                                      (assoc player-acc id player))))
+                                {} players)))]
+
+        {:game-id game-id
+         :frame (update frame :frame/arena nippy/thaw)
+         :arena-config arena
+         :game-config game
+         :players (format-player-map n-players)}))))

 (defn add-game
   "Adds a new game entity to Datomic"
@@ -240,66 +300,12 @@
                   true (conj stats-link-to-game-trx)
                   (game-full? game 1) (conj closed-trx))]

-        (d/transact-async conn trx)))))
-
-(defn- format-player-map
-  "Formats the player map attached to game-state"
-  [players]
-  (let [formatted-players (map (fn [[player stats user wombat]]
-                                 {:player player
-                                  :stats stats
-                                  :user user
-                                  :wombat wombat
-                                  :state decision-maker-state}) players)]
-    (reduce #(assoc %1 (gen-id) %2) {} formatted-players)))
-
-(defn get-game-state-by-id
-  [conn]
-  (fn [game-id]
-    (let [[frame
-           arena
-           game] (first
-                   (d/q '[:find (pull ?frame [*])
-                                (pull ?arena [*])
-                                (pull ?game [*])
-                          :in $ ?game-id
-                          :where [?game :game/id ?game-id]
-                                 [?game :game/frame ?frame]
-                                 [?game :game/arena ?arena]]
-                        (d/db conn)
-                        game-id))
-          players (d/q '[:find (pull ?players [*])
-                               (pull ?stats [*])
-                               (pull ?user [:db/id
-                                            :user/github-username
-                                            :user/github-access-token])
-                               (pull ?wombat [*])
-                         :in $ ?game-id
-                         :where [?game :game/id ?game-id]
-                                [?game :game/players ?players]
-                                [?game :game/stats ?stats]
-                                [?players :player/user ?user]
-                                [?players :player/wombat ?wombat]]
-                       (d/db conn)
-                       game-id)]
-
-      ;; TODO The datomic query pulls 2 of each player. The following will filter
-      ;;      out the duplicates.
-      (let [n-players (vec
-                       (vals
-                        (reduce (fn [player-acc player]
-                                  (let [id (:db/id (first player))
-                                        existing-ids (set (vals player-acc))]
-                                    (if (contains? existing-ids id)
-                                      player-acc
-                                      (assoc player-acc id player))))
-                                {} players)))]
-
-        {:game-id game-id
-         :frame (update frame :frame/arena nippy/thaw)
-         :arena-config arena
-         :game-config game
-         :players (format-player-map n-players)}))))
+        (future
+          (d/transact conn trx)
+
+          (let [game-state ((get-game-state-by-id conn) game-id)]
+            (game-sockets/broadcast-game-info game-state)
+            (game-sockets/broadcast-stats game-state)))))))

 (defn- update-frame-state
   [conn]
@@ -351,7 +357,7 @@
                           :round-start-fn (start-game conn aws-credentials)}
                          aws-credentials))

-      (d/transact-async conn [{:db/id game-eid
+      (d/transact-async conn [{:game/id game-id
                                :game/status :active}]))))

 (defn get-player-from-game


Exclude integs from root build unless :integs active

--- integration-tests/project.clj
+++ integration-tests/project.clj
@@ -18,7 +18,9 @@
   :dependencies [[org.immutant/immutant _]
                  [org.immutant/wildfly _]]
   :aliases {"all" ^:replace ["do" "clean," "test"]}
-  :profiles {:integ-base {:aliases {"test" ^:displace ["immutant" "test"]}}
+  :modules {:parent nil}
+  :profiles {:integ-base {:aliases {"test" ^:displace ["immutant" "test"]}
+                          :modules {:parent ".."}}
              :integ-messaging {:test-paths ["../messaging/test"]}
              :integ-scheduling {:dependencies [[clj-time _]]
                                 :test-paths ["../scheduling/test"]}


switch to java.io.File for directory comparison

--- storm-core/src/clj/backtype/storm/daemon/logviewer.clj
+++ storm-core/src/clj/backtype/storm/daemon/logviewer.clj
@@ -32,8 +32,10 @@

 (defn tail-file [path tail root-dir]
   (let [flen (.length (clojure.java.io/file path))
-        skip (- flen tail)]
-    (if (.startsWith path (.getCanonicalPath (File. root-dir)))
+        skip (- flen tail)
+        log-dir (File. root-dir)
+        log-file (File. path)]
+    (if (= log-dir (.getParentFile log-file))
     (with-open [input (clojure.java.io/input-stream path)
                 output (java.io.ByteArrayOutputStream.)]
       (if (> skip 0) (.skip input skip))


Use a bounded deque for MIDI queue.

Use a bounded deque for MIDI queue.

--- src/afterglow/midi.clj
+++ src/afterglow/midi.clj
@@ -6,7 +6,7 @@
             [overtone.midi :as midi]
             [taoensso.timbre :refer [info error]])
   (:import [java.util.regex Pattern]
-           [java.util.concurrent LinkedBlockingQueue]))
+           [java.util.concurrent LinkedBlockingDeque]))

 (def ^:private max-clock-intervals
   "How many MIDI clock pulses should be kept around for averaging?"
@@ -60,12 +60,14 @@
   (doseq [handler (vals (get-in @control-mappings [(:name (:device msg)) (:channel msg) (:note msg)]))]
     (handler msg)))

-(defonce ^:private ^{:doc "The queue used to hand MIDI events from
-  the extension thread to our world, since there seem to be
-  classloader compatibility issues, and the Java3d classes are not
-  available to threads that are directly dispatching MIDI events."}
-  midi-queue
-  (LinkedBlockingQueue.))
+(defonce ^:private ^{:doc "The queue used to hand MIDI events from the
+  extension thread to our world, since there seem to be classloader
+  compatibility issues, and the Java3d classes are not available to
+  threads that are directly dispatching MIDI events. Although we
+  allocate a capacity of 100 elements, it is expected that the queue
+  will be drained much more quickly than events arrive, and so it will
+  almost always be empty."} midi-queue
+  (LinkedBlockingDeque. 100))

 (defonce ^:private ^{:doc "The thread used to hand MIDI events from
   the extension thread to our world, since there seem to be
@@ -75,11 +77,10 @@
   (atom nil))

 (defn- delegated-message-handler
-  "Takes incoming MIDI events from the core.async channel on a thread
-  with access to all Afterglow classes. Fields incoming MIDI
-  messages, looks for registered interest in them (metronome sync,
-  variable mappings, etc.) and dispatches to the appropriate specific
-  handler."
+  "Takes incoming MIDI events from the incoming queue on a thread with
+  access to all Afterglow classes. Fields incoming MIDI messages,
+  looks for registered interest in them (metronome sync, variable
+  mappings, etc.) and dispatches to the appropriate specific handler."
   []
   (let [running (atom true)]
     (loop [msg (.take midi-queue)]
@@ -111,13 +112,13 @@

 (defn- incoming-message-handler
   "Attached to all midi input devices we manage. Puts the message on a
-  core.async channel so it can be processed by one of our own threads,
-  which have access to all the classes that Afterglow needs."
+  queue so it can be processed by one of our own threads, which have
+  access to all the classes that Afterglow needs."
   [msg]
   (try
     (.add midi-queue msg)
     (catch Throwable t
-      (error t "Problem trasferring MIDI event to core.async channel"))))
+      (error t "Problem trasferring MIDI event to queue"))))

 (defn- connect-midi-in
   "Open a MIDI input device and cause it to send its events to


Added Error Message if XML parsing fails.

--- src/leiningen/ancient/maven_metadata.clj
+++ src/leiningen/ancient/maven_metadata.clj
@@ -2,7 +2,8 @@
       :author "Yannick Scherer"}
   leiningen.ancient.maven-metadata
   (:require [clojure.data.xml :as xml :only [parse-str]])
-  (:use [leiningen.ancient.version :only [version-sort version-map snapshot?]]))
+  (:use [leiningen.ancient.version :only [version-sort version-map snapshot?]]
+        [leiningen.ancient.verbose :only [verbose]]))

 ;; ## Utilities

@@ -71,7 +72,10 @@
 (defn version-seq
   "Get all the available versions from the given metadata XML string."
   [mta]
-  (for [t (xml-seq (xml/parse-str mta))
+  (for [t (try
+            (xml-seq (xml/parse-str mta))
+            (catch Exception e
+              (verbose "Could not read XML: " (.getMessage e))))
         :when (= (:tag t) :version)]
     (first (:content t))))


Sort first by table then by metric value in descending order

--- src/main/hbase_region_inspector/core.clj
+++ src/main/hbase_region_inspector/core.clj
@@ -114,10 +114,11 @@
                      (sort-by first util/compare-server-names
                               (group-by :server visible-regions)))
         ;; Function to sort the regions in the descending order
+        score-fn #(vector (- (metric %))
+                          (.indexOf all-tables (:table %)))
         sort-fn (if (= sort :metric)
-                  (fn [regions] (reverse (sort-by metric regions)))
-                  (fn [regions] (sort-by #(vector (.indexOf all-tables (:table %))
-                                                  (- (metric %))) regions)))
+                  (fn [regions] (sort-by score-fn regions))
+                  (fn [regions] (sort-by (comp vec reverse score-fn) regions)))
         ;; Sort the regions in each server
         grouped (map #(update-in % [:regions] sort-fn) grouped)
         ;; Find the local sum of the metric of each region


CMR-2396: Missing indexing of collection-concept-id-doc-values

--- indexer-app/src/cmr/indexer/data/concepts/granule.clj
+++ indexer-app/src/cmr/indexer/data/concepts/granule.clj
@@ -141,6 +141,7 @@
             :concept-seq-id (:sequence-number (concepts/parse-concept-id concept-id))
             :concept-seq-id-doc-values (:sequence-number (concepts/parse-concept-id concept-id))
             :collection-concept-id parent-collection-id
+            :collection-concept-id-doc-values parent-collection-id
             :collection-concept-seq-id (:sequence-number (concepts/parse-concept-id parent-collection-id))
             :collection-concept-seq-id-doc-values (:sequence-number (concepts/parse-concept-id parent-collection-id))


use basic card when tabs not needed

use basic card when tabs not needed

--- src-cljs/frontend/components/add_projects.cljs
+++ src-cljs/frontend/components/add_projects.cljs
@@ -394,42 +394,45 @@
                                 tab tab
                                 github-authorized? "github"
                                 :else "bitbucket")
-            tabs (when bitbucket-possible?
-                   [{:name "github"
-                     :icon (html [:i.octicon.octicon-mark-github])
-                     :label "GitHub"}
-                    {:name "bitbucket"
-                     :icon (html [:i.fa.fa-bitbucket])
-                     :label "Bitbucket"}])]
-        (card/tabbed
-         {:tab-row (om/build tabs/tab-row {:tabs tabs
-                                           :selected-tab-name selected-vcs-type
-                                           :on-tab-click #(navigate! owner (routes/v1-add-projects-path {:_fragment %}))})}
-         (html
-          [:div
-           (when (= "github" selected-vcs-type)
-             (if github-authorized?
-               (missing-org-info owner)
-               [:div
-                [:p "GitHub is not connected to your account yet. To connect it, click the button below:"]
-                [:a.btn.btn-primary {:href (gh-utils/auth-url)
-                                     :on-click #((om/get-shared owner :track-event) {:event-type :authorize-vcs-clicked
-                                                                                :properties {:vcs-type selected-vcs-type}})}
-                 "Authorize with GitHub"]]))
-           (when (and (= "bitbucket" selected-vcs-type)
-                      (not bitbucket-authorized?))
-             [:div
-              [:p "Bitbucket is not connected to your account yet. To connect it, click the button below:"]
-              [:a.btn.btn-primary {:href (bitbucket/auth-url)
-                                   :on-click #((om/get-shared owner :track-event) {:event-type :authorize-vcs-clicked
-                                                                                :properties {:vcs-type selected-vcs-type}})}
-               "Authorize with Bitbucket"]])
-           (om/build org-picker/picker {:orgs (filter (partial select-vcs-type selected-vcs-type) orgs)
-                                        :selected-org selected-org
-                                        :on-org-click #(raise! owner [:selected-add-projects-org %])})
-           (when (get-in user [:repos-loading (keyword selected-vcs-type)])
-             [:div.orgs-loading
-              [:div.loading-spinner common/spinner]])]))))))
+            tab-content (html
+                         [:div
+                          (when (= "github" selected-vcs-type)
+                            (if github-authorized?
+                              (missing-org-info owner)
+                              [:div
+                               [:p "GitHub is not connected to your account yet. To connect it, click the button below:"]
+                               [:a.btn.btn-primary {:href (gh-utils/auth-url)
+                                                    :on-click #((om/get-shared owner :track-event) {:event-type :authorize-vcs-clicked
+                                                                                :properties {:vcs-type selected-vcs-type}})}
+                                "Authorize with GitHub"]]))
+                          (when (and (= "bitbucket" selected-vcs-type)
+                                     (not bitbucket-authorized?))
+                            [:div
+                             [:p "Bitbucket is not connected to your account yet. To connect it, click the button below:"]
+                             [:a.btn.btn-primary {:href (bitbucket/auth-url)
+                                                  :on-click #((om/get-shared owner :track-event) {:event-type :authorize-vcs-clicked
+                                                                                :properties {:vcs-type selected-vcs-type}})}
+                              "Authorize with Bitbucket"]])
+                          (om/build org-picker/picker {:orgs (filter (partial select-vcs-type selected-vcs-type) orgs)
+                                                       :selected-org selected-org
+                                                       :on-org-click #(raise! owner [:selected-add-projects-org %])})
+                          (when (get-in user [:repos-loading (keyword selected-vcs-type)])
+                            [:div.orgs-loading
+                             [:div.loading-spinner common/spinner]])])]
+        (if bitbucket-possible?
+          (let [tabs [{:name "github"
+                       :icon (html [:i.octicon.octicon-mark-github])
+                       :label "GitHub"}
+                      {:name "bitbucket"
+                       :icon (html [:i.fa.fa-bitbucket])
+                       :label "Bitbucket"}]]
+            (card/tabbed
+             {:tab-row (om/build tabs/tab-row {:tabs tabs
+                                               :selected-tab-name selected-vcs-type
+                                               :on-tab-click #(navigate! owner (routes/v1-add-projects-path {:_fragment %}))})}
+             tab-content))
+          (card/basic
+           tab-content))))))

 (defrender add-projects [data owner]
   (let [user (:current-user data)


Adopt some good style suggestions

Adopt some good style suggestions

--- src-cljs/frontend/components/builds_table.cljs
+++ src-cljs/frontend/components/builds_table.cljs
@@ -194,10 +194,8 @@
                                 :or {show-branch? true
                                      show-project? true}}]
   (let [{:keys [builds projects]} data
-        projects-by-vcs_url (->> projects
-                                 (map (fn [p]
-                                        [(:vcs_url p) p]))
-                                 (into {}))]
+        projects-by-vcs_url (into {}
+                                  (map (juxt :vcs_url identity) projects))]
     (reify
       om/IDisplayName (display-name [_] "Builds Table V2")
       om/IRender


remove (def lexicon) and (def grammar)

remove (def lexicon) and (def grammar)

--- src/babel/english.cljc
+++ src/babel/english.cljc
@@ -19,9 +19,6 @@
    [dag_unify.core :refer [deserialize dissoc-paths
                            fail? fail-path get-in serialize strip-refs]]))

-(def lexicon (:lexicon (medium)))
-(def grammar (:grammar-map (medium)))
-
 ;; can't decide between 'morph' or 'fo' or something other better name.
 (defn morph [expr & {:keys [from-language show-notes]
                      :or {from-language nil
@@ -33,25 +30,15 @@

 (defn analyze
   ([surface-form]
-   (analyze surface-form lexicon)) ;; use (:lexicon medium) per above (def).
-
+   (analyze surface-form (:lexicon (grammar/medium))))
   ([surface-form lexicon] ;; use user-provided lexicon
    (morph/analyze surface-form lexicon)))
-
-;; TODO: do morphological analysis
-;; do find non-infinitives (e.g. find 'parler' given 'parle')
-;; and then apply conjugated parts to lexeme
-;; i.e. if input is 'parle', return
-;; list of lexemes; for each, [:synsem :agr :person] will be
-;; 1st, 2nd, or 3rd, and for all, number will be singular.
-(defn lookup [lexeme]
-  ((:lookup medium) lexeme))

 (defn generate
   [spec & {:keys [max-total-depth model truncate-children]
            :or {max-total-depth generate/max-total-depth
                 truncate-children true
-                model (medium)}}]
+                model (grammar/medium)}}]
   (log/debug (str "generating with spec: " (strip-refs spec) " with max-total-depth: " max-total-depth))
   (let [result (engine/generate spec model
                                 :max-total-depth max-total-depth
@@ -72,14 +59,14 @@
   "parse a string in English into zero or more (hopefully more) phrase structure trees"

   ([input]
-   (parse (preprocess input) (medium)))
+   (parse (preprocess input) (grammar/medium)))

   ([input model]
    (parse/parse (preprocess input) model)))

 (defn sentences [ & [count spec model]]
   (let [count (or (Integer. count) 100)
-        model (or model (medium))
+        model (or model (grammar/medium))
         spec (or (and spec
                       (unifyc spec {:modified false}))
                  {:modified false


fix comment

fix comment

--- src/babel/italiano.clj
+++ src/babel/italiano.clj
@@ -33,7 +33,7 @@
                          transitivize

                          ;; Cleanup functions can go here. Number them for ease of reading.
-                         ;; 1. this filters out any verbs without an inflection: infinitive verbs should have inflection ':infinitive',
+                         ;; 1. this filters out any verbs without an inflection: infinitive verbs should have inflection ':top',
                          ;; rather than not having any inflection.
                          (map-function-on-map-vals
                           (fn [k vals]


Use into instead of apply hash-map.

Use into instead of apply hash-map.

--- src/cbfg/world/t1.cljs
+++ src/cbfg/world/t1.cljs
@@ -58,7 +58,7 @@
   (when-let [ago-ss (get @prog-ss ss-ts)]
     (ago-restore (actx-agw (:world @prog-base)) ago-ss)
     (swap! prog-history #(vec (filter (fn [[s & _]] (<= s ss-ts)) %)))
-    (swap! prog-ss #(apply hash-map (flatten (filter (fn [[s _]] (<= s ss-ts)) %))))
+    (swap! prog-ss #(into {} (filter (fn [[s _]] (<= s ss-ts)) %)))
     ; TODO: This prog-frame deref is strange, as it turned into a
     ; om.core/MapCursor somehow during the event handler rather than
     ; an expected prog-frame dict.


converting jobs to an fn

converting jobs to an fn

--- src/celestial/jobs.clj
+++ src/celestial/jobs.clj
@@ -23,7 +23,7 @@
     [puny.core :refer (entity)]
     [celestial.workflows :as wf]
     [celestial.security :refer (set-user)]
-    [celestial.model :refer (set-env)]
+    [celestial.model :refer (set-env operations)]
     [taoensso.carmine :as car]
     [taoensso.carmine.message-queue :as mq]
     [components.core :refer (Lifecyle)]
@@ -61,31 +61,27 @@
                 (do (apply f args) (save-status spec' :success)))
               (catch Throwable e (error e) (save-status spec' :error)))))))))

-(def jobs
-  (atom
-    {:reload [wf/reload 2] :destroy [wf/destroy 2] :provision [wf/puppetize 2]
-     :stage [wf/stage 2] :run-action [wf/run-action 2] :create [wf/create 2]
-     :start [wf/start 2] :stop [wf/stop 2] :clear [wf/clear 1] :clone [wf/clone 1]
-     }))
-
-(def operations (-> jobs deref keys))
+(defn jobs []
+  {:post [(= (into #{} (keys %)) operations)]}
+  {:reload [wf/reload 2] :destroy [wf/destroy 2] :provision [wf/puppetize 2]
+   :stage [wf/stage 2] :run-action [wf/run-action 2] :create [wf/create 2]
+   :start [wf/start 2] :stop [wf/stop 2] :clear [wf/clear 1] :clone [wf/clone 1]})

 (defn create-wks [queue f total]
   "create a count of workers for queue"
   (mapv (fn [v] (create-worker (name queue) (partial job-exec (with-meta f {:queue queue})))) (range total)))

 (defn initialize-workers []
-  (dosync
-    (doseq [[q [f c]] @jobs]
-      (swap! workers assoc q (create-wks q f c)))))
+  (doseq [[q [f c]] (jobs)]
+    (swap! workers assoc q (create-wks q f c))))

 (defn clear-all []
-  (apply mq/clear-queues (server-conn) (mapv name (keys @jobs))))
+  (apply mq/clear-queues (server-conn) (mapv name (keys (jobs)))))

 (defn enqueue
   "Placing job in redis queue"
   [queue payload]
-  {:pre [(contains? @jobs (keyword queue))]}
+  {:pre [(contains? (jobs) (keyword queue))]}
   (trace "submitting" payload "to" queue)
   (wcar (mq/enqueue queue payload)))

@@ -112,7 +108,7 @@
 (defn running-jobs-status
   "Get all jobs status"
   []
-  (reduce (fn [r t] (into r (queue-status (name t)))) [] (keys @jobs)))
+  (reduce (fn [r t] (into r (queue-status (name t)))) [] (keys (jobs))))

 (defn clear-and-get
   "clears on a missing job-status"


fix km to m

fix km to m

--- src/ceu/live_users.clj
+++ src/ceu/live_users.clj
@@ -138,8 +138,19 @@
         a   (+ (* (Math/sin (/ Δφ 2)) (Math/sin (/ Δφ 2)))
                (* (Math/cos φ1) (Math/cos φ2) (Math/sin (/ Δλ 2)) (Math/sin (/ Δλ 2))))
         c   (* 2 (Math/atan2 (Math/sqrt a) (Math/sqrt (- 1 a))))]
-    (* c R)))
-
+    (* c R 1000)))
+
+
+
+
+
+var a = Math.sin(Δφ/2) * Math.sin(Δφ/2) +
+        Math.cos(φ1) * Math.cos(φ2) *
+        Math.sin(Δλ/2) * Math.sin(Δλ/2);
+var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));
+
+var d = R * c;
+  )

 (defn calc-distance [live-users nickname-from coords-to]


fixed basic test assertions (closing parens were in the wrong place)

--- test/hiccup/test/core.clj
+++ test/hiccup/test/core.clj
@@ -12,9 +12,9 @@

 (deftest tag-names
   (testing "basic tags"
-    (is (= (html [:div] "

")))
-    (is (= (html ["div"] "

")))
-    (is (= (html ['div] "

"))))
+    (is (= (html [:div]) "

"))
+    (is (= (html ["div"]) "

"))
+    (is (= (html ['div]) "

")))
   (testing "tag syntax sugar"
     (is (= (html [:div#foo]) "

"))
     (is (= (html [:div.foo]) "

"))


Add tests for rempick.

Add tests for rempick.

--- test/little_clojurer/chapter4_test.clj
+++ test/little_clojurer/chapter4_test.clj
@@ -27,3 +27,12 @@
     (is (= 1 (pick 1 (range 10))))
     (is (= 5 (pick 5 (range 10))))
     (is (= :b (pick 1 '(:a :b :c))))))
+
+
+(deftest rempick-test
+  (testing
+    (is (= '(0 1 3) (rempick 2 (range 4))))
+    (is (= '(1 2 3) (rempick 0 (range 4))))
+    (is (= '() (rempick 0 '())))
+    (is (= '() (rempick 0 '(:a))))
+    (is (= '(:b) (rempick 0 '(:a :b))))))


STORM-558 change "swap!" to "reset!" to fix assignment-versions always empty in supervisor

--- storm-core/src/clj/backtype/storm/daemon/supervisor.clj
+++ storm-core/src/clj/backtype/storm/daemon/supervisor.clj
@@ -441,7 +441,7 @@
       (.put local-state
             LS-LOCAL-ASSIGNMENTS
             new-assignment)
-      (swap! (:assignment-versions supervisor) versions)
+      (reset! (:assignment-versions supervisor) versions)
       (reset! (:curr-assignment supervisor) new-assignment)
       ;; remove any downloaded code that's no longer assigned or active
       ;; important that this happens after setting the local assignment so that


more logging tidying

more logging tidying

--- dada-core/src/main/clojure/org/dada/core/SessionManagerImpl.clj
+++ dada-core/src/main/clojure/org/dada/core/SessionManagerImpl.clj
@@ -71,9 +71,7 @@
 (defn ^Data -deregisterView [^org.dada.core.SessionManagerImpl this ^Model model ^View view]
   (let [model-name (.getName model)
 	[[_ ^Model metamodel ^ServiceFactory service-factory] mutable] (.state this)
-	dummy (println metamodel (if metamodel (.getExtant (.getData metamodel))))
 	^Model model (.find metamodel model-name)]
-    (println "LocalSessionManager: deregisterView " model view)
     (if (nil? model)
       (do (warn (str "no Model for name: " model-name)) nil) ;should throw Exception
       (let [[_ _view]
@@ -86,7 +84,7 @@
 		       (if (= count 1)
 			 [(dissoc exports model-name) view]
 			 [(assoc exports model-name [(dec count) view])]))
-		     [exports]))))]
+n		     [exports]))))]
 	(if view
 	  (.deregisterView model view)
 	  (.getData model)


merging

merging

--- src/chat/server/db.clj
+++ src/chat/server/db.clj
@@ -144,15 +144,18 @@
       ]))

-(defn uuid []
+(defn uuid
+  []
   (d/squuid))

-(defn- db->user [e]
+(defn- db->user
+  [e]
   {:id (:user/id e)
    :email (:user/email e)
    :avatar (:user/avatar e)})

-(defn- db->message [e]
+(defn- db->message
+  [e]
   {:id (:message/id e)
    :content (:message/content e)
    :user-id (:user/id (:message/user e))
@@ -179,7 +182,8 @@
     (->> (d/resolve-tempid db-after tempids new-id)
          (d/entity db-after))))

-(defn get-users-subscribed-to-thread [thread-id]
+(defn get-users-subscribed-to-thread
+  [thread-id]
   (d/q '[:find [?user-id ...]
          :in $ ?thread-id
          :where
@@ -189,24 +193,25 @@
        (d/db *conn*)
        thread-id))

-(defn create-message! [attrs]
+(defn create-message!
+  [{:keys [thread-id id content user-id created-at]}]
   (let [; show thread for all users subscribed to thread
         add-open-transactions (map (fn [user-id]
                                      [:db/add [:user/id user-id]
-                                      :user/open-thread [:thread/id (attrs :thread-id)]])
-                                   (get-users-subscribed-to-thread (attrs :thread-id)))
+                                      :user/open-thread [:thread/id thread-id]])
+                                   (get-users-subscribed-to-thread thread-id))
         ; upsert thread
         thread-data {:db/id (d/tempid :entities)
-                     :thread/id (attrs :thread-id)}
+                     :thread/id thread-id}
         ; upsert message
         msg-data {:db/id (d/tempid :entities)
-                  :message/id (attrs :id)
-                  :message/content (attrs :content)
-                  :message/user [:user/id (attrs :user-id)]
+                  :message/id id
+                  :message/content content
+                  :message/user [:user/id user-id]
                   :message/thread (:db/id thread-data)
-                  :message/created-at (attrs :created-at)}
+                  :message/created-at created-at}
         ; user who created message: show thread, subscribe to thread
-        subscribe-data {:db/id [:user/id (attrs :user-id)]
+        subscribe-data {:db/id [:user/id user-id]
                         :user/open-thread (thread-data :db/id)
                         :user/subscribed-thread (thread-data :db/id)}
         {:keys [db-after tempids]} @(d/transact *conn* (concat [thread-data
@@ -230,11 +235,11 @@

 (defn create-user!
   "creates a user, returns id"
-  [attrs]
-  (-> {:user/id (attrs :id)
-       :user/email (attrs :email)
-       :user/avatar (attrs :avatar)
-       :user/password-token (password/encrypt (attrs :password))}
+  [{:keys [id email avatar password]}]
+  (-> {:user/id id
+       :user/email email
+       :user/avatar avatar
+       :user/password-token (password/encrypt password)}
       create-entity!
       db->user))

@@ -281,7 +286,8 @@
             (d/db *conn*))
        (map (comp db->message first))))

-(defn get-open-thread-ids-for-user [user-id]
+(defn get-open-thread-ids-for-user
+  [user-id]
   (d/q '[:find [?thread-id ...]
                 :in $ ?user-id
                 :where
@@ -313,7 +319,8 @@
        (map (comp db->user first))
        set))

-(defn- db->thread [thread]
+(defn- db->thread
+  [thread]
   {:id (thread :thread/id)
    :messages (map (fn [msg]
                     {:id (msg :message/id)
@@ -325,7 +332,8 @@
                    (tag :tag/id))
                  (thread :thread/tag))})

-(defn get-open-threads-for-user [user-id]
+(defn get-open-threads-for-user
+  [user-id]
   (->> (d/q '[:find (pull ?thread [:thread/id
                                    {:thread/tag [:tag/id]}
                                    {:message/_thread [:message/id
@@ -341,7 +349,8 @@
        (map first)
        (map db->thread)))

-(defn get-thread [thread-id]
+(defn get-thread
+  [thread-id]
   (-> (d/q '[:find (pull ?thread [:thread/id
                                   {:thread/tag [:tag/id]}
                                   {:message/_thread [:message/id
@@ -357,7 +366,8 @@
       first
       db->thread))

-(defn get-subscribed-thread-ids-for-user [user-id]
+(defn get-subscribed-thread-ids-for-user
+  [user-id]
   (d/q '[:find [?thread-id ...]
          :in $ ?user-id
          :where
@@ -367,12 +377,14 @@
        (d/db *conn*)
        user-id))

-(defn user-hide-thread! [user-id thread-id]
+(defn user-hide-thread!
+  [user-id thread-id]
   (d/transact
     *conn*
     [[:db/retract [:user/id user-id] :user/open-thread [:thread/id thread-id]]]))

-(defn- db->tag [e]
+(defn- db->tag
+  [e]
   {:id (:tag/id e)
    :name (:tag/name e)
    :group-id (get-in e [:tag/group :group/id])
@@ -403,7 +415,8 @@
     (d/transact *conn* [[:db/add [:user/id user-id]
                          :user/subscribed-tag [:tag/id tag-id]]])))

-(defn user-unsubscribe-from-tag! [user-id tag-id]
+(defn user-unsubscribe-from-tag!
+  [user-id tag-id]
   (d/transact *conn* [[:db/retract [:user/id user-id]
                        :user/subscribed-tag [:tag/id tag-id]]]))

@@ -411,7 +424,8 @@
   (d/transact *conn* [[:db/add [:group/id group-id]
                        :group/user [:user/id user-id]]]))

-(defn get-user-subscribed-tag-ids [user-id]
+(defn get-user-subscribed-tag-ids
+  [user-id]
   (d/q '[:find [?tag-id ...]
          :in $ ?user-id
          :where
@@ -421,7 +435,8 @@
        (d/db *conn*)
        user-id))

-(defn- get-users-subscribed-to-tag [tag-id]
+(defn- get-users-subscribed-to-tag
+  [tag-id]
   (d/q '[:find [?user-id ...]
          :in $ ?tag-id
          :where
@@ -431,7 +446,8 @@
        (d/db *conn*)
        tag-id))

-(defn thread-add-tag! [thread-id tag-id]
+(defn thread-add-tag!
+  [thread-id tag-id]
   (let [subscriber-transactions
         (mapcat (fn [user-id]
                [[:db/add [:user/id user-id]
@@ -443,7 +459,8 @@
                              [:db/add [:thread/id thread-id]
                               :thread/tag [:tag/id tag-id]]))))

-(defn get-thread-tags [thread-id]
+(defn get-thread-tags
+  [thread-id]
   (d/q '[:find [?tag-id ...]
          :in $ ?thread-id
          :where


Switch to myisam table for event_timelines.

--- src/chronograph/db.clj
+++ src/chronograph/db.clj
@@ -62,7 +62,7 @@
   (reduce-kv (fn [m k v] (assoc m (coerce/from-date k) v)) {} timeline))

 (k/defentity event-timelines
-  (k/table "event_timelines")
+  (k/table "event_timelines_isam")
   (k/pk :id)
   (k/entity-fields
     :id


added oversize error checking to :x-liftstack instruction

--- test/push/instructions/extra/stack_combinators_test.clj
+++ test/push/instructions/extra/stack_combinators_test.clj
@@ -232,10 +232,23 @@
      :scalar  '()}              :foo-liftstack      {:foo    '(2 3 4)
                                                      :scalar '()}
     ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-    ;; oversized produces an :error
-    {:foo      huge-list
-     :scalar  '(12000)}         :foo-liftstack      {:foo    huge-list
-                                                     :scalar '()
-                                                     :error '({:item "foo-liftstack produced stack overflow", :step 0})}
-    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-    )
+    )
+
+(tabular
+  (fact ":foo-liftstack produces an error when the result is oversized"
+    (check-instruction-here-using-this
+      (i/register-type teeny foo-type)
+      ?new-stacks ?instruction) => (contains ?expected))
+
+    ?new-stacks           ?instruction        ?expected
+    {:foo    '(1 2 3 4)
+     :scalar '(1)}       :foo-liftstack      {:foo    '(2 3 4 1 2 3 4)
+                                              :scalar '()
+                                              :error  '()}
+     ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+    {:foo    '(1 2 3 4 5)
+     :scalar '(1)}       :foo-liftstack      {:foo    '(1 2 3 4 5)
+                                              :scalar '()
+                                              :error  '({:item "foo-liftstack produced stack overflow", :step 0})}
+     ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+     )


Исправление галереи

Исправление галереи

--- src-cljs/ixinfestor/omut.cljs
+++ src-cljs/ixinfestor/omut.cljs
@@ -2492,6 +2492,9 @@
     om/IInitState
     (init-state [_]
       {:i 0})
+    om/IWillReceiveProps
+    (will-receive-props [_ next-props]
+      (om/set-state! own :i 0))
     om/IRenderState
     (render-state [_ {:keys [i]}]
       (if (empty? @app)


add Comet's +1 MU

add Comet's +1 MU

Comet was not adding 1 MU on install. Also fixed Paintbrush message.

--- src/clj/game/cards.clj
+++ src/clj/game/cards.clj
@@ -317,7 +317,8 @@
                    :effect (effect (draw :runner))}}}

    "Comet"
-   {:events {:play-event
+   (:effect (effect (gain :memory 1)) :leave-play (effect (lose :memory 1))
+    :events {:play-event
              {:optional {:prompt "Play another event?" :once :per-turn
                          :effect (effect (resolve-ability
                                           {:prompt "Choose an Event to play"
@@ -1237,7 +1238,7 @@

    "Paintbrush"
    {:abilities [{:cost [:click 1] :msg (msg "give " (:title target)
-                                            " sentry, code gate and barrier until the end of next run this turn")
+                                            " sentry, code gate or barrier until the end of next run this turn")
                  :choices {:req #(and (= (first (:zone %)) :servers) (has? % :type "ICE") (:rezzed %))}}]}

    "Panic Button"