undid last two commits

undid last two commits

--- src/frontend/player.cljs
+++ src/frontend/player.cljs
@@ -52,19 +52,13 @@
         (.play (:current-sound @app-state)
                #js {:whileplaying while-playing
                     :onfinish on-finish
-                    :onplay (fn []
-                              (.setPosition (:current-sound @app-state)
-                                            duration)
-                              (if (:paused? @app-state)
-                                (pause)))}))
+                    :onplay #(.setPosition (:current-sound @app-state)
+                                           duration)}))
       (.play (:current-sound @app-state)
              #js {:whileplaying while-playing
                   :onfinish on-finish
-                  :onplay (fn []
-                            (.setPosition (:current-sound @app-state)
-                                          position)
-                            (if (:paused? @app-state)
-                              (pause)))})))
+                  :onplay #(.setPosition (:current-sound @app-state)
+                                        position)})))

   (let [reader (new js/FileReader)]
     (.readAsDataURL reader sound-blob)
@@ -77,7 +71,9 @@
                                              :autoLoad true
                                              :whileloading while-loading
                                              :onload on-load
-                                             :volume (:volume @app-state)}))))))
+                                             :volume (:volume @app-state)}))
+        (if (:paused? @app-state)
+          (pause))))))

 ; TODO: probably should go into a different module...but which?
 (defn destroy-track [sound-id]


Some experiments with Fuzzy Sets

Some experiments with Fuzzy Sets

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

--- src/conexp/contrib/factor_analysis.clj
+++ src/conexp/contrib/factor_analysis.clj
@@ -172,6 +172,55 @@

 ;;;

+(deftype Fuzzy-Set [hashmap]
+  Object
+  (equals [this other]
+    (boolean (or (identical? this other)
+                 (when (= (class this) (class other))
+                   (let [ohashmap (.hashmap ^Fuzzy-Set other)]
+                     (and (forall [k (keys hashmap)]
+                            (=> (not (zero? (hashmap k)))
+                                (= (hashmap k) (ohashmap k))))
+                          (forall [k (keys ohashmap)]
+                            (=> (not (zero? (ohashmap k)))
+                                (= (hashmap k) (ohashmap k))))))))))
+  (hashCode [this]
+    (hash-combine-hash Fuzzy-Set hashmap))
+  ;;
+  clojure.lang.ISeq
+  (first [this]
+    (first hashmap))
+  (next [this]
+    (next hashmap))
+  (more [this]
+    (if-let [n (next hashmap)]
+      n
+      ()))
+  (cons [this o]
+    (if (zero? (second o))
+      this
+      (Fuzzy-Set. (conj hashmap o))))
+  (seq [this]
+    (seq hashmap))
+  (count [this]
+    (count hashmap))
+  (empty [this]
+    (Fuzzy-Set. {}))
+  (equiv [this other]
+    (.equals ^Fuzzy-Set this other))
+  ;;
+  clojure.lang.IFn
+  (invoke [this thing]
+    (let [result (hashmap thing)]
+      (or result 0))))
+
+(defn make-fuzzy-set [map]
+  (Fuzzy-Set. (select-keys map (map (fn [k] (and (< 0 (map k))
+                                                 (<= (map k) 1)))
+                                    (keys map)))))
+
+;;;
+
 (defn fuzzy-object-derivation
   "Computes the fuzzy derivation of the fuzzy set C of objects in
   the given context."
@@ -212,24 +261,22 @@
   [context]
   (let [inz          (incidence context),
         find-maximal (fn [U D]
-                       (max-key (fn [j a]
-                                  (count (fuzzy-oplus-a context U D a j)))
+                       (max-key second
                                 (map (fn [[g m] v]
-                                       [m v])
+                                       [[m v], (count (fuzzy-oplus-a context U D v m))])
                                      inz)))]
-    ;;
     (loop [U (set-of [g m] [g (objects context),
-                            m (attributes context)
+                            m (attributes context),
                             :when (not (zero? (inz [g m])))]),
            F #{}]
       (if (empty? U)
         F
         (let [D (loop [D {},
                        V 0,
-                       [j a] (find-maximal U D)]
-                  (if (> (count (fuzzy-oplus-a context U D a j)) V)
+                       [[j a] value] (find-maximal U D)]
+                  (if (> value V)
                     (recur (assoc D j a)
-                           (count (fuzzy-oplus-a context U D a j))
+                           value
                            (find-maximal U D))
                     D)),
               C (fuzzy-attribute-derivation context D),


Ack the shutdown channel if the peer will never reboot.

--- src/onyx/api.clj
+++ src/onyx/api.clj
@@ -1,6 +1,6 @@
 (ns onyx.api
   (:require [clojure.string :refer [split]]
-            [clojure.core.async :refer [chan >!! <!! close! alts!! timeout go]]
+            [clojure.core.async :refer [chan >!! <!! close! alts!! timeout go promise-chan]]
             [com.stuartsierra.component :as component]
             [taoensso.timbre :refer [info warn fatal error]]
             [onyx.log.entry :refer [create-log-entry]]
@@ -281,9 +281,10 @@
               (= ch restart-ch)
               (do (component/stop live)
                   (Thread/sleep (or (:onyx.peer/retry-start-interval config) 2000))
-                  (when-let [live (restart-peer live shutdown-ch)]
+                  (if-let [live (restart-peer live shutdown-ch)]
                     (do (reset! started-peer live)
-                        (recur live))))
+                        (recur live))
+                    (>!! ack-ch true)))
               :else (throw (ex-info "Read from a channel with no response implementation" {})))))
     (catch Throwable e
       (fatal "Peer lifecycle threw an exception")
@@ -305,8 +306,8 @@
      (fn [_]
        (let [v-peer (system/onyx-peer peer-group monitoring-config)
              live (component/start v-peer)
-             shutdown-ch (chan 1)
-             ack-ch (chan)
+             shutdown-ch (promise-chan)
+             ack-ch (promise-chan)
              started-peer (atom live)]
          {:peer-lifecycle (future (peer-lifecycle started-peer config shutdown-ch ack-ch))
           :started-peer started-peer


Tidy up of system.

Tidy up of system.

--- src/kixi/hecuba/application/system.clj
+++ src/kixi/hecuba/application/system.clj
@@ -141,14 +141,7 @@
          :queue (new-queue (:queue cfg))
          :queue-worker (new-queue-worker)
          :cljs-builder (new-cljs-builder)
-         ;;:web-server (new-webserver (:web-server cfg))
-         ;;:bidi-ring-handler (new-bidi-ring-handler-provider)
-         ;;:main-routes (new-main-routes)
-         ;;:amon-api (new-amon-api "/4")
-         :web-app (new-web-app cfg)
-         ;; :user-api (new-user-api)
-         ;;:cljs-routes (new-cljs-routes (:cljs-builder cfg))
-         )
+         :web-app (new-web-app cfg))
         (mod/system-using
          {;; :main-routes [:store]
           ;; :amon-api [:store :queue]


include primitive array ops benchmark to compare to transducers

--- benchmark/cljs/benchmark_runner.cljs
+++ benchmark/cljs/benchmark_runner.cljs
@@ -315,6 +315,10 @@
 (println ";; transducers")
 (simple-benchmark [xs (into [] (range 1000000))] (transduce (comp (map inc) (map inc) (map inc)) + 0 xs) 1)

+(println ";; primitive array reduce 1000000 many ops")
+(simple-benchmark [xs (into-array (range 1000000))]
+  (-> xs (.map inc) (.map inc) (.map inc) (.reduce (fn [a b] (+ a b)) 0)) 1)
+
 (println ";; reduce range 1000000 many ops")
 (simple-benchmark [xs (range 1000000)] (reduce + 0 (map inc (map inc (map inc xs)))) 1)


NM/RR: Use line style only if repeat child is geotrace

--- src/hatti/map/utils.cljs
+++ src/hatti/map/utils.cljs
@@ -526,15 +526,17 @@

 (defn geotype->marker-style
   "Get marker style for field type."
-  [field]
+  [{:keys [children] :as field}]
   (cond
     (f/geoshape? field) {:layer-type "fill" :style :fill}
     (f/osm? field) {:layer-type "fill" :style :fill}
     (or
      (f/geotrace? field)
-     (f/repeat? field)) {:layer-type "line" :style :line
-                         :layout {:line-join "round"
-                                  :line-cap "round"}}
+     (and (f/repeat? field)
+          (f/geotrace? (first children))))
+    {:layer-type "line" :style :line
+     :layout {:line-join "round"
+              :line-cap "round"}}
     :else {:layer-type "circle" :style :point}))

 (defn filter-selected-features


Fix wrap-versioned-expiry.

Fix wrap-versioned-expiry.

It was never returning nil, even if it couldn't find the file.

--- src/foreclojure/ring.clj
+++ src/foreclojure/ring.clj
@@ -33,11 +33,10 @@

 (defn wrap-versioned-expiry [handler]
   (fn [request]
-    (-> request
-        (update-in [:uri] strip-version-number)
-        (handler)
-        (assoc-in [:headers "Cache-control"]
-                  "public, max-age=31536000"))))
+    (when-let [resp (handler
+                     (update-in request [:uri] strip-version-number))]
+      (assoc-in resp [:headers "Cache-control"]
+                "public, max-age=31536000"))))

 (defn wrap-debug [handler]
   (fn [request]


Fix comments.

Fix comments.

--- src/datascript/core.cljs
+++ src/datascript/core.cljs
@@ -15,15 +15,15 @@
   ISearch
   (-search [db [e a v] callback]
     (case-tree [e a (some? v)] [
-      (slice-it db "eav" [e a v] callback)                ;; e a v
-      (slice-it db "eav" [e a nil] callback)              ;; e a _
+      (slice-it db "eav" [e a v] callback)           ;; e a v
+      (slice-it db "eav" [e a nil] callback)         ;; e a _
       (slice-it db "eav" [e nil nil] (fn [data]
         (callback (filter #(= v (.-v %)) data))))    ;; e _ v
-      (slice-it db "eav" [e nil nil] callback)            ;; e _ _
-      (slice-it db "ave" [a v nil] callback)              ;; _ a v
-      (slice-it db "ave" [a nil nil] callback)            ;; _ a _
+      (slice-it db "eav" [e nil nil] callback)       ;; e _ _
+      (slice-it db "ave" [a v nil] callback)         ;; _ a v
+      (slice-it db "ave" [a nil nil] callback)       ;; _ a _
       (callback (filter #(= v (.-v %)) eav))         ;; _ _ v
-      (callback "eav")]))                              ;; _ _ _
+      (callback "eav")]))                            ;; _ _ _
   (add-record [_ e a v]
     (DB.
       (assoc eav (mapv str [e a v]) (to-array [e a v]))


CMR-2973: Temporarily commenting out broken test.

--- metadata-db-app/int_test/cmr/metadata_db/int_test/concepts/force_delete_test.clj
+++ metadata-db-app/int_test/cmr/metadata_db/int_test/concepts/force_delete_test.clj
@@ -39,33 +39,37 @@
     (is (= 404 (:status (util/force-delete-concept "T22-PROV3" 0))))
     (is (= 404 (:status (util/force-delete-concept "AG22-PROV3" 0))))))

-(deftest force-delete-collection-revision-delete-associated-tag
-  (testing "force delete collection revision cascade to delete tag associations associated with the collection revision"
-    (let [concept (c-spec/gen-concept :collection "CMR" 1 {})
-          saved-concept (util/save-concept concept)
-          concept-id (:concept-id saved-concept)
-          tag1 (util/create-and-save-tag 1)
-          tag2 (util/create-and-save-tag 2)
-          tag3 (util/create-and-save-tag 3)]
-      ;; create some collection revisions
-      (dorun (repeatedly 3 #(util/save-concept concept)))
-      ;; associate tag1 to the whole collection, tag2 to revision 2 and tag3 to revision 3
-      ;; this set up is not realistic, but will test the scenrios more thoroughly
-      (let [ta1 (util/create-and-save-tag-association (dissoc saved-concept :revision-id) tag1 1)
-            ta2 (util/create-and-save-tag-association (assoc saved-concept :revision-id 2) tag2 2)
-            ta3 (util/create-and-save-tag-association (assoc saved-concept :revision-id 3) tag3 3)]

-        ;; no tag associations are deleted before the force delete
-        (util/is-tag-association-deleted? ta1 false)
-        (util/is-tag-association-deleted? ta2 false)
-        (util/is-tag-association-deleted? ta3 false)
+;; Test is broken with external db
+;; CMR-2973
+(comment
+ (deftest force-delete-collection-revision-delete-associated-tag
+   (testing "force delete collection revision cascade to delete tag associations associated with the collection revision"
+     (let [concept (c-spec/gen-concept :collection "CMR" 1 {})
+           saved-concept (util/save-concept concept)
+           concept-id (:concept-id saved-concept)
+           tag1 (util/create-and-save-tag 1)
+           tag2 (util/create-and-save-tag 2)
+           tag3 (util/create-and-save-tag 3)]
+       ;; create some collection revisions
+       (dorun (repeatedly 3 #(util/save-concept concept)))
+       ;; associate tag1 to the whole collection, tag2 to revision 2 and tag3 to revision 3
+       ;; this set up is not realistic, but will test the scenrios more thoroughly
+       (let [ta1 (util/create-and-save-tag-association (dissoc saved-concept :revision-id) tag1 1)
+             ta2 (util/create-and-save-tag-association (assoc saved-concept :revision-id 2) tag2 2)
+             ta3 (util/create-and-save-tag-association (assoc saved-concept :revision-id 3) tag3 3)]

-        ;; force delete collection revision 2
-        (is (= 200 (:status (util/force-delete-concept concept-id 2))))
+         ;; no tag associations are deleted before the force delete
+         (util/is-tag-association-deleted? ta1 false)
+         (util/is-tag-association-deleted? ta2 false)
+         (util/is-tag-association-deleted? ta3 false)

-        ;; the tag association associated with the collection revision is deleted
-        (util/is-tag-association-deleted? ta2 true)
-        ;; tag association associated with other collection revision or whole collection is not deleted
-        (util/is-tag-association-deleted? ta1 false)
-        (util/is-tag-association-deleted? ta3 false)))))
+         ;; force delete collection revision 2
+         (is (= 200 (:status (util/force-delete-concept concept-id 2))))

+         ;; the tag association associated with the collection revision is deleted
+         (util/is-tag-association-deleted? ta2 true)
+         ;; tag association associated with other collection revision or whole collection is not deleted
+         (util/is-tag-association-deleted? ta1 false)
+         (util/is-tag-association-deleted? ta3 false))))))
+


improved tracing behavior during usage in multiple parallel threads

--- src/distillery/tasks.clj
+++ src/distillery/tasks.clj
@@ -18,9 +18,14 @@

 ;; ## Task Tracing

+(def trace-agent (agent nil))
+
 (defn trace-message
   [& msg]
-  (println (str "# " (apply str msg))))
+  (let [text (apply str msg)]
+  (send-off trace-agent
+        (fn [state] (println (str "# " text))))
+  text))

 (defmacro trace-block
   [msg & body]


(PDB-3053) Create unique index on certnames.latest_report_id

Prior to this commit, there was no index on latest_report_id.
In PDB-2789, it was thought that this index caused performance
issues but this was potentially a red-herring.

After this commit, we create a unique index on latest_report_id

--- src/puppetlabs/puppetdb/scf/migrate.clj
+++ src/puppetlabs/puppetdb/scf/migrate.clj
@@ -1036,6 +1036,12 @@
   []
   (jdbc/do-commands
     "CREATE INDEX idx_certnames_latest_report_id on certnames(latest_report_id)"))
+
+(defn index-certnames-unique-latest-report-id
+  []
+  (jdbc/do-commands
+    "DROP INDEX IF EXISTS idx_certnames_latest_report_id"
+    "CREATE UNIQUE INDEX idx_certnames_latest_report_id on certnames(latest_report_id)"))

 (defn add-producer-to-reports-catalogs-and-factsets
   []
@@ -1198,8 +1204,8 @@
    50 remove-historical-catalogs
    51 fact-values-value-to-jsonb
    52 resource-params-cache-parameters-to-jsonb
-   53 add-corrective-change-index})
-
+   53 add-corrective-change-index
+   54 index-certnames-unique-latest-report-id})

 (def desired-schema-version (apply max (keys migrations)))


adding port to running msg on server startup

--- src/restaurant_inspections_api/core.clj
+++ src/restaurant_inspections_api/core.clj
@@ -17,6 +17,6 @@
                   (all-cors (site all-routes))
                   (reload/wrap-reload (all-cors (site #'all-routes))))
         port const/port]
-    (info "Running server...")
+    (info (str "Running server on port " port))
     (load-api-data)
     (run-server handler {:port port})))


bug #5155 - fixed the bug where every token is unknown in send command

Signed-off-by: Goran Jovic <fc686822162e6f379ea05b6f92d78d206147085c@gmail.com>

--- src/status_im/chat/events/commands.cljs
+++ src/status_im/chat/events/commands.cljs
@@ -15,8 +15,8 @@
 ;; because balances are only fetched for them. Revisit this decision with regard to battery/network consequences
 ;; if we were to update all balances.
 (defn- allowed-assets [chain account]
-  (let [visible-token-symbols (get-in account [:settings :wallet :visible-tokens chain])]
-    (->> (tokens/tokens-for chain)
+  (let [visible-token-symbols (get-in account [:settings :wallet :visible-tokens (keyword chain)])]
+    (->> (tokens/tokens-for (keyword chain))
          (filter #(not (:nft? %)))
          (filter #(contains? visible-token-symbols (:symbol %)))
          (map #(vector (-> % :symbol clojure.core/name)


documentation update

documentation update

--- src/engine/data/rope.clj
+++ src/engine/data/rope.clj
@@ -103,7 +103,8 @@
   (instance? Rope x))

 (defn weigh
-  "The accumulated measurement of all children to the right, provided that Treeish-2-3 is implemented for seq.
+  "The accumulated measurement of all children to the right
+Provided that Treeish-2-3 is implemented for seq.
 In other words: What a new Treeish-2-3 node would weigh with seq as its left child."
   [seq]
   {:pre [(measurable? seq)]}
@@ -304,6 +305,7 @@
        (report root (translate root start-line start-column) (translate root end-line end-column)))))

 (defn translate
+  "Translate between Rope measurements"
   ([root row column]
      {:pre [(>= row 0) (>= column 0)]}
      (if (> row (-> root measure :lines))
@@ -319,7 +321,7 @@
   ([root index]
      {:pre [(>= index 0)]}
      (let [[left-rope leaf _ rest] (rope-split-at root index),
-           lines (->> (subs leaf 0 rest) split-lines),
+           lines (split-lines (subs leaf 0 rest)),
            rope-weight (-> left-rope measure :lines),
            weight (dec (count lines))]
        (if (zero? weight)


Extracts constant

Extracts constant

--- src/expound/printer.cljc
+++ src/expound/printer.cljc
@@ -7,6 +7,7 @@
   (:refer-clojure :exclude [format]))

 (def indent-level 2)
+(def max-spec-str-width 100)
 (def anon-fn-str "<anonymous function>")

 (s/def :spec/spec-conjunction
@@ -147,8 +148,7 @@
 (defn simple-spec-or-name [spec-name]
   (let [spec-str (elide-spec-ns (elide-core-ns (pr-str (expand-spec spec-name))))]
     (if (or
-         ;; TODO - extract to named constant
-         (< 100 (count spec-str))
+         (< max-spec-str-width (count spec-str))
          (string/includes? spec-str "\n"))
       spec-name
       spec-str)))


Implement tablet/merge.

Implement tablet/merge.

--- src/merkle_db/tablet.clj
+++ src/merkle_db/tablet.clj
@@ -196,6 +196,11 @@
   "Merge the two tablets into a single tablet. The tablets key ranges must not
   overlap."
   [left right]
-  ; TODO: validate that left and right don't overlap
-  ; TODO: implement
-  (throw (UnsupportedOperationException. "NYI")))
+  (let [left-bound (last-key left)
+        right-bound (first-key right)]
+    (when (key/before? right-bound left-bound)
+      (throw (ex-info (format "Cannot merge tablets with overlapping key ranges: %s > %s"
+                              left-bound right-bound)
+                      {:left-bound left-bound
+                       :right-bound right-bound}))))
+  (update left ::records (comp vec concat) (::records right)))


Fix wrap-404 - it wasn't actually doing that.

--- src/foreclojure/ring.clj
+++ src/foreclojure/ring.clj
@@ -61,6 +61,5 @@
         (handler request)))))

 (defn wrap-404 [handler]
-  (fn [request]
-    (or (handler request)
-        (route/not-found "Page not found"))))
+  (routes handler
+          (route/not-found "Page not found")))


New database indexes

New database indexes

--- src/foreclojure/core.clj
+++ src/foreclojure/core.clj
@@ -14,6 +14,9 @@
             (ring.util [response :as response])))
 (mongo!
  :db "mydb")
+
+(add-index! :users [:user] :unique true)
+(add-index! :users [:solved])

 (defroutes main-routes
   (GET "/" [] (welcome-page))


Uncomment reconcile-solved-count

Uncomment reconcile-solved-count

--- src/foreclojure/core.clj
+++ src/foreclojure/core.clj
@@ -23,7 +23,7 @@
 (add-index! :users [:user] :unique true)
 (add-index! :users [[:solved -1]])

-; (reconcile-solved-count)
+(reconcile-solved-count)

 (defroutes main-routes
   (GET "/" [] (welcome-page))


Simplify the plot pane subscription logic.

--- metlog-vault/src-client/metlog_client/metlog.cljs
+++ metlog-vault/src-client/metlog_client/metlog.cljs
@@ -104,8 +104,8 @@
                    (.-MIN_VALUE js/Number))
                (:end-t new-data))})

-(defn subscribe-plot-data [ series-name series-data-chan ]
-  (let [control-channel (chan)]
+(defn subscribe-plot-data [ series-name update-fn ]
+  (let [control-channel (chan 1 (dedupe))]
     (go-loop [ current-data nil ]
       (when-let [ desired-data-range (<! control-channel) ]
         (let [ updated-data
@@ -116,7 +116,7 @@
                   (merge-series-data data (<! (<<< server/fetch-series-data series-name update-query-range)))
                   data))]
           (when updated-data
-            (put! series-data-chan updated-data))
+            (update-fn updated-data))
           (recur updated-data))))
     control-channel))

@@ -127,13 +127,8 @@

       :component-did-mount
       (fn [ this ]
-        (let [series-data-chan (chan)
-              loop-control (subscribe-plot-data series-name series-data-chan) ]
+        (let [loop-control (subscribe-plot-data series-name #(swap! series-state assoc :series-data %))]
           (swap! series-state assoc :data-loop-control loop-control)
-          (go-loop []
-            (when-let [ series-data (<! series-data-chan) ]
-              (swap! series-state assoc :series-data series-data)
-              (recur)))
           (put! loop-control (range-ending-at plot-end-time query-window))))

       :component-will-unmount
@@ -142,12 +137,8 @@

       :component-will-update
       (fn [ this [ _ _ plot-end-time query-window ]]
-        (when-let [loop-control (:data-loop-control @series-state)]
-          (let [updated-query-window (range-ending-at plot-end-time query-window)]
-            (when (not (= updated-query-window
-                          (:last-query-window @series-state)))
-              (put! loop-control updated-query-window)
-              (swap! series-state assoc :last-query-window updated-query-window)))))
+        (put! (:data-loop-control @series-state)
+              (range-ending-at plot-end-time query-window)))

       :reagent-render
       (fn [ series-name plot-end-time query-window ]


OO: Fix kibbit violation

OO: Fix kibbit violation

--- src/hatti/map/utils.cljs
+++ src/hatti/map/utils.cljs
@@ -146,10 +146,9 @@

 (defmethod get-as-geom :repeat
   [record {:keys [children full-name] :as field}]
-  (do
-    (for [child-record (get record full-name)]
-      (for [child (filter f/geofield? children)]
-        (get-as-geom child-record child)))))
+  (for [child-record (get record full-name)]
+    (for [child (filter f/geofield? children)]
+      (get-as-geom child-record child))))

 (defmethod get-as-geom :default
   [record geofield]


RR: WIP generate hex grid

RR: WIP generate hex grid

--- src/hatti/map/utils.cljs
+++ src/hatti/map/utils.cljs
@@ -495,6 +495,20 @@
     (when (pos? (count features))
       (.fitBounds map bbox #js {:padding "15" :linear true}))))

+(defn generate-hexgrid
+  [map layer-id & [geojson]]
+  (let [features (or (:features geojson)
+                     (.queryRenderedFeatures
+                       map (clj->js {:layers [layer-id]})))
+        layer-data (or geojson
+                       (clj->js
+                         {:type "FeatureCollection" :features features}))
+        bbox (.bbox js/turf (clj->js layer-data))
+        cellWidth 20
+        units "miles"
+        hexgrid (.hexGrid js/turf bbox cellWidth units)]
+    hexgrid))
+
 (defn geotype->marker-style
   "Get marker style for field type."
   [field]
@@ -525,7 +539,18 @@
                             :paint {:circle-color "#fff" :circle-radius 6})
         (when (.getLayer map circle-border) (.removeLayer map circle-border)))
       (om/set-state! owner :style style)
-      (om/set-state! owner :loaded? true))))
+      (om/set-state! owner :loaded? true)
+
+      (add-mapboxgl-source map "hexgrid"
+                           {:geojson (generate-hexgrid map id_string geojson)})
+      (add-mapboxgl-layer map "hexgrid"
+                          "fill"
+                          :paint {:fill-outline-color "#ccc"
+                                  :fill-color {:property "point_count"
+                                               :stops [[0 "transparent"]
+                                                       [1 "#eff3ff"]
+                                                       [100 "#08519c"]]}
+                                  :fill-opacity 0.7}))))

 (defn clear-map-styles
   "Set default style"


empfaenger hat bühne betreten

empfaenger hat bühne betreten

--- src/hello_world/core.clj
+++ src/hello_world/core.clj
@@ -20,18 +20,18 @@
            :password "passwordplaceholder"}))

-(defn sqlquery [name]
+(defn sqlquery [name empfaenger]

 ;(first (jdbc/query mysql-db [(str "select * from konten where Name='" name "'")])))
 (jdbc/execute! mysql-db ["UPDATE konten SET Kontostand = Kontostand - 1 WHERE Kontostand > 0 AND Name = ?" name])
-(jdbc/execute! mysql-db ["UPDATE konten SET Kontostand = Kontostand + 1 WHERE NurZahlen = 0 AND Name = ?" name]))
+(jdbc/execute! mysql-db ["UPDATE konten SET Kontostand = Kontostand + 1 WHERE NurZahlen = 0 AND Name = ?" empfaenger]))
 ;(jdbc/update! mysql-db :konten {:Kontostand 99} ["Name = ?" name]))
 ; maybe this sets the guthaben to 99

 (defn page [name]
   (str ""
        (if name
-  (str "Nice to meet you, " name "! \n" "

")
+  (str "Nice to meet you, " name "! \n" "

")
         (str "<form>"
               "Name: <input name='name' type='text'>"
               "<input type='submit'>"


Replace on with a dot.

Replace on with a dot.

--- src/oc/email/content.clj
+++ src/oc/email/content.clj
@@ -253,7 +253,7 @@
           " in ")
          (when show-board?
           (:board-name entry))
-         " on " (post-date (:published-at entry)))
+         " • " (post-date (:published-at entry)))
    "" "text-left attribution"))

 ;; ----- Digest -----


Change subject to reflect the same title as the bot and also to add the date to avoid message clipping.

--- src/oc/email/content.clj
+++ src/oc/email/content.clj
@@ -18,6 +18,7 @@
 (def date-format (time-format/formatter "MMM. d"))
 (def date-format-no-dot (time-format/formatter "MMM d"))
 (def date-format-year (time-format/formatter "MMM. d YYYY"))
+(def digest-subject-format (time-format/formatter "MMMM d, YYYY"))
 (def date-format-year-comma (time-format/formatter "MMM. d, YYYY"))
 (def day-month-date-year (time-format/formatter "EEEE, MMM. dd, YYYY"))
 (def reminder-date-format (time-format/formatter "EEEE, MMMM d"))
@@ -432,7 +433,8 @@
     (concat [{:type :board :name pretext}] posts)))

 (defn digest-title [org-name]
-  (format digest-title-daily (or org-name "Carrot")))
+  (let [date-str (time-format/unparse digest-subject-format (time/now))]
+    (str "☕ Your " (or org-name "Carrot") " daily digest for " date-str)))

 (defn- get-digest-url [digest-data]
   (s/join "/" [config/web-url (:org-slug digest-data) "all-posts"]))


Get the images prefix from an env var.

Get the images prefix from an env var.

--- src/oc/email/content.clj
+++ src/oc/email/content.clj
@@ -195,7 +195,7 @@
                     94)]
     [:a {:href url}
       [:img {:class "green-button"
-             :src (str "https://open-company.s3.amazonaws.com/email_bt_" cta-text "@2x.png")
+             :src (str config/email-images-prefix "/images/email_bt_" cta-text "@2x.png")
              :width (str image-width)
              :style (str "max-width: " image-width "px;")
              :alt cta-text}]]))
@@ -225,8 +225,8 @@
             [:th {:class "small-2 large-2 columns header-icon"}
               [:a
                 {:href config/web-url}
-                [:img {:src "https://open-company-assets.s3.amazonaws.com/img/ML/carrot_logo_with_copy_colors.png"
-                       :srcSet "https://open-company-assets.s3.amazonaws.com/img/ML/carrot_logo_with_copy_colors@2x.png 2x"
+                [:img {:src (str config/email-images-prefix "/images/carrot_logo_with_copy_colors.png")
+                       :srcSet (str config/email-images-prefix "/images/carrot_logo_with_copy_colors@2x.png 2x")
                        :width "74"
                        :height "18"
                        :alt "Carrot"}]]]
@@ -256,8 +256,8 @@
             [:th {:class "small-2 large-2 columns footer-icon"}
               [:a
                 {:href config/web-url}
-                [:img {:src "https://open-company-assets.s3.amazonaws.com/img/ML/carrot_logo_grey_email.png"
-                       :srcSet "https://open-company-assets.s3.amazonaws.com/img/ML/carrot_logo_grey_email@2x.png 2x"
+                [:img {:src (str config/email-images-prefix "/images/carrot_logo_grey_email.png")
+                       :srcSet (str config/email-images-prefix "/images/carrot_logo_grey_email@2x.png 2x")
                        :width "13"
                        :height "24"
                        :alt "Carrot"}]]]]]


future-fact exemplifying streams w/ metaconstants

--- test/as_documentation/metaconstants.clj
+++ test/as_documentation/metaconstants.clj
@@ -41,7 +41,7 @@

 (defn choose-interesting-arg [& args]
   (first (filter interesting? args)))
-
+
 (fact
   (choose-interesting-arg ..first.. ..second..) => ..second..
   (provided
@@ -66,7 +66,7 @@
   (provided
     (--v-- 1 2 3) => 8))

-
+
 ;; Metaconstants can also be used in background prerequisites, like this:

 (future-fact "This is a design flaw: background and 'local' prerequisites should be merged"
@@ -177,3 +177,10 @@
     (gen-doc) => ..doc..
     ..doc..    =contains=> {:header ..header..}
     ..header.. =contains=> {:title "title"}))
+
+(future-fact "Metaconstant merging and streaming"
+  (vector (:header (gen-doc)) (:header (gen-doc))) => [1 2]
+  (provided
+    (gen-doc) =streams=> [..doc1.. ..doc2..]
+    ..doc1.. =contains=> {:header 1}
+    ..doc2.. =contains=> {:header 2}))


Add google analytics

Add google analytics

--- src/pict_source/site.clj
+++ src/pict_source/site.clj
@@ -4,6 +4,17 @@

 (def title "Pict")
 (def slogan "открытый словарь программистов")
+(def google-analytics-code
+  "<script>
+    (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
+    (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
+    m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
+    })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
+
+    ga('create', 'UA-47078794-4', 'auto');
+    ga('send', 'pageview');
+
+  </script>")

 (defn layout [req content]
   (html5
@@ -28,4 +39,5 @@
        [:p {:class "copyright"}
         "© 2015 "
         [:a {:href "http://shvetsovdm.github.io"}
-         "Дмитрий Швецов / Dmitry Shvetsov (shvetsovdm)"]]]]]))
+         "Дмитрий Швецов / Dmitry Shvetsov (shvetsovdm)"]]]]
+     google-analytics-code]))


using defrecord cleaning a lot of deftype misfortunes

--- src/proxmox/provider.clj
+++ src/proxmox/provider.clj
@@ -2,7 +2,6 @@
   (:require
     [closchema.core :as schema])
   (:use
-    clojure.core.strint
     [clojure.core.memoize :only (memo-ttl)]
     [taoensso.timbre :only (debug info error warn)]
     clojure.core.strint
@@ -57,9 +56,7 @@
     (when (not= exitstatus "OK")
       (throw+ (assoc res :type ::task-failed)))))

-(defn use-ns []
-  (use 'proxmox.remote);TODO this is ugly http://tinyurl.com/avotufx fix with macro
-  (use 'proxmox.provider))
+

 (defmacro safe [f]
   `(try+
@@ -76,12 +73,13 @@
   (when-let [features (:features spec)]
     ;vzctl set 170 --features "nfs:on" --save
     (doseq [f features]
-      (.vzctl this (<< "set ~{vmid} --features \"~{f}\" --save")))) )
+      (vzctl this (<< "set ~{vmid} --features \"~{f}\" --save")))) )

-(deftype Container [node spec]
+(defmacro action [aname dm & ])
+
+(defrecord Container [node spec]
   Vm
   (create [this]
-    (use-ns)
     (debug "creating" (:vmid spec))
     (validate spec)
     (try+
@@ -92,26 +90,22 @@
         (warn "Container already exists" e))))

   (delete [this]
-    (use-ns)
     (debug "deleting" (:vmid spec))
-    (.unmount this)
+    (unmount this)
     (safe
       (prox-delete (str "/nodes/" node "/openvz/" (:vmid spec)))))

   (start [this]
-    (use-ns)
     (debug "starting" (:vmid spec))
     (safe
       (prox-post (str "/nodes/" node "/openvz/" (:vmid spec) "/status/start"))))

   (stop [this]
-    (use-ns)
     (debug "stopping" (:vmid spec))
     (safe
       (prox-post (str "/nodes/" node "/openvz/" (:vmid spec) "/status/stop"))))

   (status [this]
-    (use-ns)
     (try+
       (:status
         (prox-get
@@ -120,15 +114,16 @@

   Openvz
   (unmount [this]
-    (use-ns)
     (debug "unmounting" (:vmid spec))
     (try+
       (safe
         (prox-post (str "/nodes/" node "/openvz/" (:vmid spec) "/status/umount")))
       (catch [:type :proxmox.provider/task-failed] e
         (debug "no container to unmount"))))
+
   (vzctl [this action]
     (execute (config :hypervisor) [(<< "vzctl ~{action}")])
     )
   )

+


Call func using clojure str func

Call func using clojure str func

--- src/verbose_spoon/views/add_course.clj
+++ src/verbose_spoon/views/add_course.clj
@@ -41,7 +41,7 @@
               [:td
                 (f/drop-down :category (fetch-category-list))]
               [:td
-                [:a {:onclick (str "addCategory(['test', 'test2'])" "") :href "#"} "Add new Category"]]]
+                [:a {:onclick (str "addCategory(" "['test', 'test2']" ")") :href "#"} "Add new Category"]]]
             [:tr
               [:td
                 (f/label :numstudents "Estimated Num Students")]


symlink functions for hh streams and manifold streams have been added

--- core/src/cljc/hellhound/streams.cljc
+++ core/src/cljc/hellhound/streams.cljc
@@ -4,7 +4,16 @@
    [hellhound.utils                :refer [todo]]
    [hellhound.streams.impl.channel]))

-
+;; IMPORTANT NOTE: At this point, this namespace is just a proxy for
+;; manifold.stream. But in near future we want to introduce our own
+;; stream implementation which will work with manifold as well but
+;; with completely different implementation. The goals for the new
+;; implementation is to provide necessary means for us to have better
+;; control over concurrency and parallelism and also better abstraction
+;; that helps us to distribute the components load in a cluster.
+;;
+;; So for now these functions are just symlinks for the manifold
+;; streams functions.
 (def stream  s/stream)
 (def stream? s/stream?)

@@ -17,3 +26,11 @@

 (def connect s/connect)
 (def connect-via s/connect-via)
+
+(def map s/map)
+(def transform s/transform)
+
+(def description s/description)
+(def downstream s/downstream)
+
+;; ----------------------------------------------------------------------------


fixed index-in-word fn

fixed index-in-word fn

--- src/re_complete/app.cljs
+++ src/re_complete/app.cljs
@@ -75,10 +75,9 @@
   (if (= (count (words-to-index index text)) 1)
     index
     (->> (words-to-index index text)
-         drop-last
-         (string/join "")
-         count inc
-         (- index))))
+         last
+         count
+         dec)))

 (defn complete-word-with-trimmed-chars
   "Autocomplete word and ignore regex at the beginning and at the end of the word"


break out account tests

break out account tests

--- test/clj_money/models/accounts_test.clj
+++ test/clj_money/models/accounts_test.clj
@@ -47,27 +47,29 @@
           expected [{:name "Checking"
                      :type :asset}]]
       (is (= expected
-             accounts))))
-  (testing "Values are coerced into the correct types"
-    (try
+             accounts)))))
+
+(deftest values-are-coerced-on-create
+  (try
     (let [result (accounts/create storage-spec
                                   (-> attributes
                                       (update-in [:entity-id] str)
                                       (assoc :name "Coerced")))]
       (is (number? (:id result))))
-      (catch clojure.lang.ExceptionInfo e
-        (pprint (ex-data e))
-        (is false "Unexpected validation error"))))
-  (testing "Name can be duplicated across entities"
-    (let [other-entity (entities/create storage-spec {:name "My other life"
-                                                      :user-id (:id user)})
-          a1 (accounts/create storage-spec {:name "Credit card"
-                                            :type :liability
-                                            :entity-id (:id other-entity)})
-          a2 (accounts/create storage-spec {:name "Credit card"
-                                            :type :liability
-                                            :entity-id (:id entity)})]
-      (is (not (validation/has-error? a2)) "A second account can be created with the same name in a different entity"))))
+    (catch clojure.lang.ExceptionInfo e
+      (pprint (ex-data e))
+      (is false "Unexpected validation error"))))
+
+(deftest duplicate-name-across-entities
+  (let [other-entity (entities/create storage-spec {:name "My other life"
+                                                    :user-id (:id user)})
+        a1 (accounts/create storage-spec {:name "Credit card"
+                                          :type :liability
+                                          :entity-id (:id other-entity)})
+        a2 (accounts/create storage-spec {:name "Credit card"
+                                          :type :liability
+                                          :entity-id (:id entity)})]
+    (is (not (validation/has-error? a2)) "A second account can be created with the same name in a different entity")))

 (deftest create-a-child-account
   (let [savings (accounts/create storage-spec {:name "Savings"
@@ -96,7 +98,7 @@
       "Name is required"
       (accounts/create storage-spec (dissoc attributes :name))))

-(deftest name-is-unique
+(deftest name-is-unique-within-a-parent
   (accounts/create storage-spec attributes)
   (assert-validation-error
     :name


Expose atom index constructor

Expose atom index constructor

--- src/io/cyanite/index.clj
+++ src/io/cyanite/index.clj
@@ -64,6 +64,10 @@
 (defmethod build-index :empty
   [options]
   (EmptyIndex.))
+
+(defmethod build-index :atom
+  [options]
+  (map->AtomIndex options))

 (defmethod build-index :agent
   [options]


Improvements to naming and documentation

--- src/io/aviso/tracker.clj
+++ src/io/aviso/tracker.clj
@@ -1,20 +1,20 @@
 (ns io.aviso.tracker
-  "Code for tracing behavior so that it can be logged when there's an exception."
+  "Code for tracking operations so that a history can be presented when an exception is thrown."
   (:require
     [clojure.tools.logging :as l]
     [clojure.tools.logging.impl :as impl]
     [io.aviso.exception :as exception]))

 ;;; Contains a vector of messages (or functions that return messages) used to log the route to the exception.
-(def ^:dynamic ^:private operation-traces)
+(def ^:dynamic ^:private *operation-traces*)

-(def ^:dynamic ^:private innermost-exception)
+(def ^:dynamic ^:private *innermost-exception*)

 (def ^:dynamic *log-traces*
   "A boolean to control the whether traces are logged at :trace level as they are created."
   false)

-(defn- trace-to-string
+(defn- label-to-string
   "Converts a trace to a string; a trace may be a function which is invoked."
   [message]
   (str (if (fn? message) (message) message)))
@@ -22,9 +22,9 @@
 (defn- error [logger message]
   (l/log* logger :error nil message))

-(defn- log-trace [logger trace-messages message e]
+(defn- log-trace-label-stack [logger trace-labels message e]
   (error logger "An exception has occurred:")
-  (doseq [[trace-message i] (map vector trace-messages (iterate inc 1))]
+  (doseq [[trace-message i] (map vector trace-labels (iterate inc 1))]
     (error logger (format "[%3d] - %s" i trace-message)))
   (error logger (format "%s%n%s" message (exception/format-exception e))))

@@ -32,36 +32,36 @@
   "Tracks the execution of a function of no arguments. The trace macro converts into a call to track*.

   logger
-  : SLF4J Logger where logging should occur
+  : Logger where logging should occur (as defined by the clojure.tools.logging Logger protocol)

-  trace-message
+  label
   : String, object, or function. If a function, the function will only be evaluated if the message
     needs to be printed (when an exception occurs, or when logging traces via [[*log-traces*]]).

   f
   : function to invoke. track* returns the result from this function."
-  [logger trace f]
-  (if (bound? #'operation-traces)
+  [logger label f]
+  (if (bound? #'*operation-traces*)
     (try
-      (swap! operation-traces conj trace)
-      (when *log-traces* (l/log* logger :trace nil (trace-to-string trace)))
+      (swap! *operation-traces* conj label)
+      (when *log-traces* (l/log* logger :trace nil (label-to-string label)))
       (f)
       (catch Throwable e
-        (if @innermost-exception
-          (let [trace-strings (mapv trace-to-string @operation-traces)
+        (if @*innermost-exception*
+          (let [trace-label-strings (mapv label-to-string @*operation-traces*)
                 message (or (.getMessage e) (-> e .getClass .getName))]
-            (log-trace logger trace-strings message e)
-            (reset! innermost-exception false)
+            (log-trace-label-stack logger trace-label-strings message e)
+            (reset! *innermost-exception* false)
             (throw (ex-info message
-                            {:operation-trace trace-strings}
+                            {:operation-trace trace-label-strings}
                             e)))
           (throw e)))
       (finally
-        (swap! operation-traces pop)))
+        (swap! *operation-traces* pop)))
     ;; Else, if not yet bound..
-    (binding [operation-traces (atom [])
-              innermost-exception (atom true)]
-      (track* logger trace f))))
+    (binding [*operation-traces* (atom [])
+              *innermost-exception* (atom true)]
+      (track* logger label f))))

 (defn get-logger
   "Determines the logger instance for a namespace (by leveraging some clojure.tools.logging internals)."
@@ -69,15 +69,16 @@
   (impl/get-logger l/*logger-factory* namespace))

 (defmacro track
-  "Tracks the execution of an operation, associating the trace (which describes the operation) with the execution of the body.
+  "Tracks the execution of an operation, associating the label (which describes the operation) with the execution of the body.

-  If an exception occurs inside the body, then all trace messages leading up to the
+  If an exception occurs inside the body, then all labels leading up to the
   point of the exception will be logged (the logger is determined from the current namespace); thus logging only occurs at the
-  most deeply nested trace. The exception thrown is formatted and logged as well.
+  most deeply nested label. The exception thrown is formatted and logged as well.  The actual exception will be rethrown, wrapped in a
+  new `ex-info` exception, with key `:operation-trace` set to the vector of operation trace strings.

-  trace may be a string, an object, or a function that returns a string; execution of the function is deferred until needed."
-  [trace & body]
-  `(track* (get-logger ~*ns*) ~trace #(do ~@body)))
+  label may be a string, an object, or a function that returns a string; execution of the function is deferred until needed."
+  [label & body]
+  `(track* (get-logger ~*ns*) ~label #(do ~@body)))

 (defn timer*
   "Executes a function, timing the duration. It then calculates the elapsed time in milliseconds (as a double) and passes that to a second function.


Allow 0 or empty.

Allow 0 or empty.

--- test/onyx/log/greedy_multi_job_test.clj
+++ test/onyx/log/greedy_multi_job_test.clj
@@ -95,8 +95,10 @@
 (def replica-1
   (playback-log (:log env) (extensions/subscribe-to-log (:log env) ch) ch 2000))

-(fact "20 peers were allocated to job 1, task A, 20 peers were allocated to job 1, task B"
-      (get-counts replica-1 [j1 j2]) => [[5 5] [0 0]])
+(let [])
+(fact "5 peers were allocated to job 1, task A, 5 peers were allocated to job 1, task B"
+      (get-counts replica-1 [j1 j2]) => (fn [x] (or (= x [[5 5] [0 0]])
+                                                   (= x [[5 5] []]))))

 (>!! a-chan :done)
 (close! a-chan)
@@ -104,8 +106,9 @@
 (def replica-2
   (playback-log (:log env) replica-1 ch 2000))

-(fact "20 peers were reallocated to job 2, task C, 20 peers were reallocated to job 2, task D"
-      (get-counts replica-2 [j1 j2]) => [[0 0] [5 5]])
+(fact "5 peers were reallocated to job 2, task C, 5 peers were reallocated to job 2, task D"
+      (get-counts replica-2 [j1 j2]) => (fn [x] (or (= x [[0 0] [5 5]])
+                                                   (= x [[] [5 5]]))))

 (>!! c-chan :done)
 (close! c-chan)
@@ -113,7 +116,9 @@
 (def replica-3
   (playback-log (:log env) replica-2 ch 2000))

-(fact "No peers are executing any tasks" (get-counts replica-3 [j1 j2]) => [[0 0] [0 0]])
+(fact "No peers are executing any tasks" (get-counts replica-3 [j1 j2])
+      => (fn [x] (or (= x [[0 0] [0 0]])
+                    (= x [[] []]))))

 (close! b-chan)
 (close! d-chan)


Remove temp/debug serialization code

Remove temp/debug serialization code

--- src/taoensso/faraday.clj
+++ src/taoensso/faraday.clj
@@ -77,14 +77,6 @@

 ;;;; Coercion - values

-;; TODO Should thawing (like freezing) perhaps be manual?
-;; Cons:
-;;   * Requires manual thawing (obviously).
-;; Pros:
-;;   * Avoid unwanted wrapping of binary data.
-;;   * Backwards-compatible with pre-existing db's binary data.
-;;   * More amenable to future changes.
-
 (deftype Serialized [wrapped-value])
 (defn serialize [x] (Serialized. x))

@@ -141,37 +133,6 @@

 (defn- clj-item->db-item [m]
   (reduce-kv (fn [m k v] (assoc m (name k) (clj-val->db-val v))) {} m))
-
-(comment ; TODO Temp/dev
-  (defn- ba->bb   [^bytes ba] (ByteBuffer/wrap ba))
-  (defn- ba->bb ^ByteBuffer [^bytes ba type]
-    (let [ba-size (alength ba)]
-      (doto (ByteBuffer/allocate (inc ba-size))
-        (.put (case type :bytes (byte 0) :nippy (byte 1)
-                    (throw (Exception. "Invalid wrapping type!"))))
-        (.put ba 0 ba-size))))
-
-  (defn- bb->ba ^bytes [^ByteBuffer bb]
-
-    (let [data (.getBytes (apply str (range 1000)))]
-      (println "---")
-      (time (dotimes [_ 10000] (ba-buffer data)))
-      (time (dotimes [_ 10000] (wrap-ba data :bytes)))
-      (time (dotimes [_ 10000] (ba-buffer (nippy/freeze-to-bytes data))))
-      (time (dotimes [_ 10000] (wrap-ba   (nippy/freeze-to-bytes data) :bytes))))
-
-    (String. (.array (.get (.flip (wrap-ba (.getBytes "foo bar baz") :nippy)))))
-
-    (let [bb (.flip (wrap-ba (.getBytes "foo bar baz" "UTF-8") :nippy))]
-      (.get bb)
-      (.position bb)
-      (.slice bb)
-      ;;(.array bb)
-      (String. (.array bb) "UTF-8")
-      ;;(String. (.array (.slice bb)) "UTF-8")
-      )
-
-    (wrap-ba (.getBytes "foo bar baz") :nippy)))

 ;;;; API - object wrappers


CMR-3279 adds comment and removes redundant check for collection identifier

--- access-control-app/src/cmr/access_control/services/permitted_concept_id_search.clj
+++ access-control-app/src/cmr/access_control/services/permitted_concept_id_search.clj
@@ -19,6 +19,8 @@
   [parsed-concept]
   (gc/group-conds
     :and
+    ;; If there are no access values present in the concept then the include undefined
+    ;; value is used.
     [(if-let [access-value (:Value (:AccessConstraints parsed-concept))]
        (common-qm/numeric-range-intersection-condition
          :collection-access-value-min
@@ -26,7 +28,6 @@
          access-value
          access-value)
        (common-qm/boolean-condition :collection-access-value-include-undefined-value true))
-     (common-qm/boolean-condition :collection-identifier true)
      (common-qm/boolean-condition :collection-applicable true)]))

 (defn get-permitted-concept-id-conditions


add pool create logic

add pool create logic

--- src/thread_exec/core.clj
+++ src/thread_exec/core.clj
@@ -1,4 +1,13 @@
-(ns thread-exec.core)
+(ns thread-exec.core
+  (:import
+    [java.util.concurrent ThreadFactory BlockingQueue Callable ThreadPoolExecutor SynchronousQueue TimeUnit ExecutorService ThreadPoolExecutor$CallerRunsPolicy]))
+
+
+
+(defn- create-exec-service [threads]
+   (doto (ThreadPoolExecutor. 0 threads 60 TimeUnit/SECONDS (SynchronousQueue.))
+     (.setRejectedExecutionHandler  (ThreadPoolExecutor$CallerRunsPolicy.))))
+

 (defn abs [n]
   (Math/abs ^int  n))
@@ -19,7 +28,7 @@
   (reduce (partial nearest t) groups))

 (defn max-value [groups]
-  (reduce (fn [[a1 a2] [b1 b2]] (max a1 a2 b1 b2)) groups))
+  (reduce (fn [a1 [b1 b2]] (max a1 b1 b2)) 0 groups))

 (defn select-group [t groups threshold max-groups]
@@ -28,10 +37,31 @@
    otherwise the nearest group is used and its range is increased to include the new distance, i.e. its grown"
   (let [v (nearest-group t groups)
         d (distance t v)]
-
     (if (and (> d threshold) (< (count groups) max-groups))
       (let [m (max-value groups)
             v2 [m (+ m d threshold)]]
         [v2 (conj groups v2)])
       [v  groups])))
-
+
+
+(defn pool-manager [threshold max-groups start-group pool-create]
+ {:pool-create pool-create
+  :max-groups max-groups :threshold threshold :pools (ref {}) :groups (ref [start-group])})
+
+(defn default-pool-manager [threshold max-groups start-group pool-size]
+   (pool-manager threshold max-groups start-group #(create-exec-service pool-size)))
+
+(defn get-pool [{:keys [max-groups threshold pools groups pool-create]} t]
+  "Gets a pool if within the groups, otherwise a new pool is created and returned"
+  (let [[g groups2] (select-group t @groups threshold max-groups)]
+    (dosync
+      (alter groups (fn [m] groups2))
+
+	    (if-let [exec (get @pools g)]
+	      exec
+	      (get (alter pools (fn [m] (if (nil? (get m g))
+                                          (assoc m g (pool-create))
+                                          m)))
+             g)))))
+
+


works with multiple playersclear!

works with multiple playersclear!

--- src/tic_tac_toe/core.clj
+++ src/tic_tac_toe/core.clj
@@ -12,7 +12,7 @@
             [ring.util.response :as response]
 ))

-(def picture-map {:e "empty.png" :x "cross.png" :o "nought.png"})
+(def picture-map {:e "/empty.png" :x "/cross.png" :o "/nought.png"})

@@ -149,6 +149,12 @@
 (defn get-board-atom []
   (get-board @board))

+(defn get-response [board session]
+  (response/content-type
+            (assoc (response/response (get-board board))
+                                      :session (assoc session :board board))
+            "text/html"))
+

 (defroutes app-routes
   (GET "/" {session :session} ;(get-board-atom)
@@ -164,21 +170,24 @@
   (GET "/place-piece/:pos/:piece"  {{pos :pos piece :piece} :params
                                      session :session}

-         (let [players-turn  (place-piece (:board session) (keyword piece) (Integer/parseInt pos))
-               computer-turn (place-piece players-turn :o (rand-nth (available-squares players-turn)))
-               ]
-
-           (response/content-type
-            (assoc (response/response (get-board computer-turn))
-                                      :session (assoc session :board computer-turn))
-            "text/html")))
+         (let [players-turn  (place-piece (:board session) (keyword piece) (Integer/parseInt pos))]
+           (if (or (= :x (get-game-state players-turn)) (= :draw (get-game-state players-turn)))
+             ( get-response players-turn session)
+             (let [ computer-turn (place-piece players-turn :o (rand-nth (available-squares players-turn)))]
+               (get-response computer-turn session) )
+
+           )))

   (GET "/clear" {session :session}
        (assoc (response/response (str "" )) :session (assoc session :board blank-board)))
-  (POST "/post" [] (do
-                     (reset! board blank-board)
-                     (resp/redirect "/")))
+  (POST "/post"  {session :session}
+
+          (assoc (response/redirect-after-post "/")
+            :session (assoc session :board blank-board)))
+
+
+
   (route/resources "/")
   (route/not-found "
Page not found
"))


Detect unchanged promotions

Detect unchanged promotions

--- test/bluebell/utils/ebmd/java_test.clj
+++ test/bluebell/utils/ebmd/java_test.clj
@@ -332,7 +332,13 @@
     (.extendArgSpec r :u :a)
     (is (= 7 (.getMutationCounter r)))
     (.extendArgSpec r :u :b)
-    (is (= 8 (.getMutationCounter r)))))
+    (is (= 8 (.getMutationCounter r)))
+    (.registerPromotion r :b (Promotion. identity 2.3) :a)
+    (is (= 9 (.getMutationCounter r)))
+    (.registerPromotion r :b (Promotion. identity 2.3) :a)
+    (is (= 9 (.getMutationCounter r)))
+    (.registerPromotion r :b (Promotion. identity 2.4) :a)
+    (is (= 10 (.getMutationCounter r)))))

 (deftest basic-poly-fns
   (let [reg (Registry. debug-settings)


Added read test

Added read test

--- test/ctia/stores/atom/verdict_test.clj
+++ test/ctia/stores/atom/verdict_test.clj
@@ -5,17 +5,39 @@
             [schema.test :as st]
             [schema-generators.generators :as g]
             [ctia.test-helpers.core :as test-helpers]
-            [ctia.schemas.verdict :refer [Verdict StoredVerdict realize-verdict]]))
+            [ctia.schemas.verdict :refer [Verdict StoredVerdict realize-verdict]])
+  (:import [java.util Date]))

 (use-fixtures :once st/validate-schemas)
 (use-fixtures :each (join-fixtures [test-helpers/fixture-properties:clean
                                     test-helpers/fixture-properties:atom-store
                                     test-helpers/fixture-ctia-fast]))

+(defn- test-equiv
+  [a b]
+  (let [a' (dissoc a :created :id)
+        b' (dissoc b :created :id :owner)]
+    (is (= a' b'))))
+
+(def one-second 1000)
+
+(defn time-since
+  [^Date d]
+  (- (.getTime (Date.)) (.getTime d)))
+
 (deftest store-test
   (let [verdicts (g/sample 5 StoredVerdict)]
     (doseq [v verdicts]
-      (println "Realizing " v)
       (let [verdict (select-keys v [:type :disposition :judgement_id :disposition_name])
             realized-verdict (realize-verdict verdict (:owner v))]
         (store/create-verdict @verdict-store realized-verdict)))))
+
+(deftest read-test
+  (let [verdicts (g/sample 5 StoredVerdict)]
+    (doseq [v verdicts]
+      (let [verdict (select-keys v [:type :disposition :judgement_id :disposition_name])
+            realized-verdict (realize-verdict verdict (:owner v))
+            {id :id} (store/create-verdict @verdict-store realized-verdict)
+            {created :created :as read-verdict} (store/read-verdict @verdict-store id)]
+        (test-equiv verdict read-verdict)
+        (is (> one-second (time-since created)))))))


bump template deps

bump template deps

--- resources/boot/new/cljs_exe/build.boot
+++ resources/boot/new/cljs_exe/build.boot
@@ -1,15 +1,15 @@
 (set-env!
  :source-paths    #{"src/cljs"}
  :resource-paths  #{"resources"}
- :dependencies '[[adzerk/boot-cljs          "1.7.228-2"  :scope "test"]
-                 [adzerk/boot-cljs-repl     "0.3.3"      :scope "test"]
-                 [adzerk/boot-reload        "0.4.13"     :scope "test"]
-                 [com.cemerick/piggieback   "0.2.1"      :scope "test"]
-                 [org.clojure/tools.nrepl   "0.2.12"     :scope "test"]
-                 [weasel                    "0.7.0"      :scope "test"]
+ :dependencies '[[adzerk/boot-cljs          "2.0.0"  :scope "test"]
+                 [adzerk/boot-cljs-repl     "0.3.3"  :scope "test"]
+                 [adzerk/boot-reload        "0.5.1"  :scope "test"]
+                 [com.cemerick/piggieback   "0.2.1"  :scope "test"]
+                 [org.clojure/tools.nrepl   "0.2.12" :scope "test"]
+                 [weasel                    "0.7.0"  :scope "test"]
                  [cljs-node-io              "0.5.0"]
-                 [org.clojure/clojurescript "1.9.293"]
-                 [org.clojure/core.async    "0.2.395"]
+                 [org.clojure/clojurescript "1.9.521"]
+                 [org.clojure/core.async    "0.3.442"]
                  [org.clojure/tools.cli     "0.3.5"]])

 (require


fix javascript evaling the whole file everytime

Signed-off-by: Chris Granger <5654cde260ae99bc4d30054171b8bcd902efd19a@gmail.com>

--- src/lt/objs/browser.cljs
+++ src/lt/objs/browser.cljs
@@ -367,23 +367,24 @@
                                            (handle-cb (:cb msg) :editor.eval.js.exception result)))))
     (object/raise this :editor.eval.js.change-live! msg)))

-(defn must-eval-file? [msg]
+(defn must-eval-file? [devtools msg]
   ;;we eval the whole file if there's no meta, or this file isn't loaded in the current page
   (when (-> msg :data :path)
     (or (not (-> msg :data :meta))
-        (not (devtools/find-script devtools/local (-> msg :data :path))))))
+        (not (devtools/find-script devtools (-> msg :data :path))))))

 (behavior ::js-eval
                   :triggers #{:editor.eval.js!}
                   :reaction (fn [this msg]
-                              (if (must-eval-file? msg)
-                                (when-let [ed (object/by-id (:cb msg))]
-                                  (let [data (:data msg)
-                                        data (assoc data :code (str (editor/->val ed) "\n\n//# sourceURL=" (-> data :path)))]
-                                    (devtools/eval-in-webview-client (client->devtools this) data (fn [res]
-                                                                                (eval-js-form this msg)))))
-                                (eval-js-form this msg))))
+                              (let [devtools (client->devtools this)]
+                                (if (must-eval-file? devtools msg)
+                                  (when-let [ed (object/by-id (:cb msg))]
+                                    (let [data (:data msg)
+                                          data (assoc data :code (str (editor/->val ed) "\n\n//# sourceURL=" (-> data :path)))]
+                                      (devtools/eval-in-webview-client (client->devtools this) data (fn [res]
+                                                                                (eval-js-form this msg)))))
+                                  (eval-js-form this msg)))))

 ;;*********************************************************
 ;; Commands


defonce the registry atoms so they won't get reset when compiled at the repl.

--- namespaces/common/src/main/clojure/immutant/registry.clj
+++ namespaces/common/src/main/clojure/immutant/registry.clj
@@ -20,8 +20,8 @@
   (:refer-clojure :exclude (get))
   (:import org.jboss.msc.service.ServiceName))

-(def ^{:private true} registry (atom {}))
-(def ^{:private true} msc-registry (atom nil))
+(defonce ^{:private true} registry (atom {}))
+(defonce ^{:private true} msc-registry (atom nil))

 (defn set-msc-registry [v]
   (reset! msc-registry v))


this fails on auto-proxy but proves how onDisable isn't called because onEnable failed

--- src/memorystone/core.clj
+++ src/memorystone/core.clj
@@ -26,10 +26,10 @@
     (def plugin-manager* (.getPluginManager server* ))
     (def plugin-desc* (.getDescription plugin*))

-    (let [blocklistener (get-blocklistener)]
-      (.registerEvent plugin-manager* (:BLOCK_BREAK event-types) blocklistener (:NORMAL event-priorities) plugin*)
-      (.registerEvent plugin-manager* (:SIGN_CHANGE event-types) blocklistener (:NORMAL event-priorities) plugin*)
-      )
+;    (let [blocklistener (get-blocklistener)]
+;      (.registerEvent plugin-manager* (:BLOCK_BREAK event-types) blocklistener (:NORMAL event-priorities) plugin*)
+;      (.registerEvent plugin-manager* (:SIGN_CHANGE event-types) blocklistener (:NORMAL event-priorities) plugin*)
+;      )
   (log-info "Memory stone started"))

 (defn disable-plugin [plugin]


CMR-3430: Added demo and integration test.

--- system-int-test/test/cmr/system_int_test/search/collection_keyword_search_test.clj
+++ system-int-test/test/cmr/system_int_test/search/collection_keyword_search_test.clj
@@ -1,6 +1,7 @@
 (ns cmr.system-int-test.search.collection-keyword-search-test
   "Integration test for CMR collection search by keyword terms"
   (:require
+    [clojure.java.io :as io]
     [clojure.test :refer :all]
     [cmr.common.util :refer [are3]]
     [cmr.search.data.keywords-to-elastic :as k2e]
@@ -538,12 +539,19 @@
                             (assoc :ShortName "CMR2652SN2")
                             (assoc :EntryTitle "CMR2652ET2"))
                         {:format :umm-json
-                         :accept-format :json})]
+                         :accept-format :json})
+        coll3 (d/ingest-concept-with-metadata-file "iso19115-nil-shapes-C1216318185-NSIDCV0TST-from-uat.xml"
+                                                   {:provider-id "PROV1"
+                                                    :concept-type :collection
+                                                    :format-key :iso19115})]
     (index/wait-until-indexed)
     (testing "parameter searches"
       (are3 [keyword-str items]
         (let [parameter-refs (search/find-refs :collection {:keyword keyword-str})]
           (d/assert-refs-match items parameter-refs))
+        "testing parameter search by shortname keyword in collection whose xml file contains no SpatialExtent content"
+        "NSIDC-0705"
+        [coll3]

         "testing parameter search by existing ancillary keywords"
         "CMR2652AKW1"
@@ -581,6 +589,9 @@
       (are3 [keyword-str items]
         (let [json-refs (search/find-refs-with-json-query :collection {} {:keyword keyword-str})]
           (d/assert-refs-match items json-refs))
+        "testing json query search by shortname keyword in the collection whoes xml file contains no SpatialExtent content"
+        "NSIDC-0705"
+        [coll3]

         "testing json query search by existing ancillary keywords"
         "CMR2652AKW2"


dump nREPL messages with unrecognized keys into the system log

--- ccw.core/src/ccw/repl/view_helpers.clj
+++ ccw.core/src/ccw/repl/view_helpers.clj
@@ -84,10 +84,14 @@
               (doseq [{:keys [out err value ns status] :as resp} (repl/response-seq response-fn)]
                 (ui-sync
                   (when ns
+                    ; TODO: need to make sure that a response from an earlier request doesn't
+                    ; override the current namespace in the view based on a response from a later
+                    ; request...or is that just too much of an edge case?
                     (.setCurrentNamespace repl-view ns))
-                  (doseq [[k v] resp]
-                    (when (#{:out :err :value} k)
-                      (log log-component v k)))
+                  (doseq [[k v] (dissoc resp :id :ns :status)]
+                    (if (log-styles k)
+                      (log log-component v k)
+                      (CCWPlugin/log (str "Cannot handle REPL response: " k (pr-str resp)))))
                   (case status
                     ("timeout" "interrupted") (log log-component (eval-failure-msg status out) :err)
                     nil)))


Add runtype dispatching phase-2 processing

--- src/aerobio/htseq/termseq.clj
+++ src/aerobio/htseq/termseq.clj
@@ -1,6 +1,6 @@
 ;;--------------------------------------------------------------------------;;
 ;;                                                                          ;;
-;;               A E R O B I O . H T S E Q . R N A S E Q                    ;;
+;;               A E R O B I O . H T S E Q . T E R M S E Q                  ;;
 ;;                                                                          ;;
 ;; Permission is hereby granted, free of charge, to any person obtaining    ;;
 ;; a copy of this software and associated documentation files (the          ;;
@@ -47,25 +47,85 @@
    [aerobio.htseq.rnaseq :as rsq]]
   )

+
+(defn get-comparison-files-
+  "Compute the set of comparison bams and the corresponding output csv
+  for the count table matrix. Comparison sets are based on the
+  ComparisonSheet.csv for the experiment of eid (the experiment
+  id). If rep? is true, returns the comparison sets for replicates of
+  comparison pairs, else returns comparison sets for combined bams."
+  ([eid opt]
+   (get-comparison-files- eid "ComparisonSheet.csv" opt))
+  ([eid comp-filename opt]
+   (let [{:keys [rep? runtype]} opt
+         bpath (if rep? [:rep :bams] [:bams])
+         fpath (if rep? [:rep :fcnts] [:fcnts])
+         bams (apply cmn/get-exp-info eid bpath)
+         fcnts (apply cmn/get-exp-info eid fpath)
+         runxref (cmn/get-exp-info eid :run-xref)
+         pre (some (fn[[_ [t pre]]] (when (= t runtype) pre)) runxref)
+         compvec (->> comp-filename
+                      (fs/join (pams/get-params :nextseq-base) eid)
+                      slurp csv/read-csv rest
+                      (mapv #(mapv (fn[c] (let [[s cond] (str/split #"-" c)]
+                                           (str s "-" pre cond))) %)))
+         bamsvec (mapv (fn[v]
+                         (mapcat #(-> (fs/join bams (str % "*.bam"))
+                                      fs/glob sort)
+                                 v))
+                       compvec)
+         otcsvs (mapv (fn[v]
+                        (fs/join fcnts (str (cljstr/join "-" v) ".csv")))
+                      compvec)]
+     (mapv #(vector %1 %2) bamsvec otcsvs))))
+
 (defmethod cmn/get-comparison-files :termseq
   [_ & args]
-  (apply rsq/get-comparison-files- args))
+  (apply get-comparison-files- args))
+

 (defn split-filter-fastqs
   [eid]
   (cmn/split-filter-fastqs eid identity))
+

 (defmethod cmn/get-phase-1-args :termseq
   [_ & args]
   (apply cmn/get-phase-1-args :rnaseq args))

+(defn run-termseq-comparison
+  [eid recipient comparison-file get-toolinfo template rtype]
+  (let [_ (rsq/get-phase-2-dirs eid nil)
+        _ (rsq/get-phase-2-dirs eid :rep)
+        ftype "CDS" ; <-- BAD 'magic number'
+        strain (first (cmn/get-exp-info eid :strains))
+        refnm ((cmn/get-exp-info eid :ncbi-sample-xref) strain)
+        refgtf (fs/join (cmn/get-exp-info eid :refs) (str refnm ".gtf"))
+        repcfg (assoc-in template
+                         [:nodes :ph2 :args]
+                         [eid comparison-file
+                          {:rep? true :runtype rtype}
+                          ftype refgtf recipient])
+        repjob (future (cmn/flow-program repcfg get-toolinfo :run true))
+        cfg (assoc-in template
+                      [:nodes :ph2 :args]
+                      [eid comparison-file
+                       {:rep? false :runtype rtype}
+                       ftype refgtf recipient])
+        cfgjob (future (cmn/flow-program cfg get-toolinfo :run true))]
+    #_(clojure.pprint/pprint repflow)
+    [repjob cfgjob]))
+
 (defmethod cmn/run-comparison :termseq
-  [_ eid recipient compfile get-toolinfo template]
-  (assert false "Term-Seq comparision NYI!"))
+  [_ eid recipient compfile get-toolinfo template phase]
+  (let [rtype (->> phase (str/split #"-") last keyword)]
+    (run-termseq-comparison
+     eid recipient compfile get-toolinfo template rtype)))
+

 (defmethod cmn/run-phase-2 :termseq
-  [_ eid recipient get-toolinfo template]
+  [_ eid recipient get-toolinfo template phase]
   (cmn/run-comparison :termseq
-   eid recipient "ComparisonSheet.csv" get-toolinfo template))
+   eid recipient "ComparisonSheet.csv" get-toolinfo template phase))


Use snippet for FoC content.

Use snippet for FoC content.

--- src/oc/email/content.clj
+++ src/oc/email/content.clj
@@ -107,7 +107,7 @@
             (spacer 1)
             [:p {:class "topic-headline"} (emojify (:headline topic))]
             (spacer 2)
-            (emojify (:body topic))
+            (emojify (:snippet topic))
             (when body? (spacer 20))
             (when body? [:a {:class "topic-read-more" :href topic-url} "READ MORE"])
             (spacer 30)]
@@ -136,13 +136,13 @@
           [:td
             (when cash? (metric (str "CASH - " date) (:cash finances)))
             (when revenue? (metric (str "REVENUE - " date) (:revenue finances)))
-            (when costs? (metric (str "COSTS - " date) (:costs finances)))
-            (when (or cash-flow? burn-rate?)
-              [:p {:class "metric"} "$-211K"]
-              [:p {:class "label"} "CASH FLOW - OCT 2016"])
-            (when (and cash? burn-rate?)
-              [:p {:class "metric"} "1 year"]
-              [:p {:class "label"} "RUNWAY - OCT 2016"])]]]]))
+            (when costs? (metric (str "COSTS - " date) (:costs finances)))]]]]))
+            ; (when (or cash-flow? burn-rate?)
+            ;   [:p {:class "metric"} "$-211K"]
+            ;   [:p {:class "label"} "CASH FLOW - OCT 2016"])
+            ; (when (and cash? burn-rate?)
+            ;   [:p {:class "metric"} "1 year"]
+            ;   [:p {:class "label"} "RUNWAY - OCT 2016"])]]]]))

 (defn- growth-data [topic currency]
   [:table {:class "growth-metrics"}


Update invite to private board copy and links. Fix invite to company.

--- src/oc/email/content.clj
+++ src/oc/email/content.clj
@@ -34,9 +34,9 @@
 (def share-message "sent you a post")
 (def share-cta "Read post")

-(def board-invite-message "invited you to join the private section “%s” within your company digest")
-(def anonymous-board-invite-message "You've been invited to join the private section “%s” within your company digest")
-(def board-invite-explainer "Private sections of the digest are only available to invited team members.")
+(def board-invite-message "%s invited you to join a private section")
+(def board-invite-explainer "%s (%s)")
+(def board-invite-button "View %s")

 (def reset-message "Password reset")
 (def reset-instructions "Click the button below to reset your password. If you didn't request a password reset, you can ignore this email.")
@@ -146,6 +146,8 @@
   [:table {:class "row"}
     [:tr
       [:th {:class "small-12 large-12"}
+        horizontal-line
+        (spacer 16)
         [:img {:class "note-author-avatar" :src (circle-image avatar-url 32)}]
         [:span {:class "note-author-name"} author]]]])

@@ -287,8 +289,8 @@
         first-name (-> notice :inviter :first-name)
         last-name (-> notice :inviter :last-name)
         from (s/join " " [first-name last-name])
-        invite-message (if (s/blank? from) anonymous-board-invite-message (str (s/trim from) " " board-invite-message))
-        formatted-invite-message (format invite-message from)
+        fixed-from (if (not (s/blank? from)) "Someone" from)
+        invite-message (format board-invite-message from)
         from-avatar (-> notice :inviter :avatar-url)
         from-avatar? (not (s/blank? from-avatar))
         note (:note notice)
@@ -300,14 +302,16 @@
                              :org-logo-url logo-url
                              :org-logo-width logo-width
                              :org-logo-height logo-height}))
-      (when logo? (spacer 35))
-      (h1 formatted-invite-message)
-      (spacer 35)
+      (when logo? (spacer 40))
+      (h1 invite-message)
+      (spacer 40)
+      (paragraph (format board-invite-explainer board-name board-url))
+      (when show-note? (spacer 40))
       (when show-note? (note-author from-avatar from))
       (when show-note? (spacer 16))
       (when show-note? (paragraph note))
-      (spacer 35)
-      (left-button "Accept invitation" board-url)
+      (spacer 20)
+      (left-button (format board-invite-button board-name) board-url)
       (spacer 73)]))

 (defn- invite-content [td-classes invite]
@@ -322,10 +326,9 @@
         note (:note invite)
         note? (not (s/blank? note))
         show-note? (and from-avatar? note?)
-        invite-message (str from " "
-                        (if (s/blank? org-name)
-                          invite-message
-                          (format invite-message-with-company org-name)))]
+        invite-message (if (s/blank? org-name)
+                         invite-message
+                         (format invite-message-with-company org-name))]
     [:td {:class td-classes}
       (spacer 40)
       (when logo? (org-logo {:org-name org-name


No longer supply monitoring-config to start-peers

--- src/onyx/test_helper.clj
+++ src/onyx/test_helper.clj
@@ -99,17 +99,18 @@
     (catch Throwable e
       (throw e))))

-(defn try-start-peers [n-peers peer-group monitoring-config]
-  (try
-    (onyx.api/start-peers n-peers peer-group (or monitoring-config {:monitoring :custom}))
-    (catch InterruptedException e)
-    (catch Throwable e
-      (throw e))))
+(defn try-start-peers
+  [n-peers peer-group]
+  (try
+   (onyx.api/start-peers n-peers peer-group)
+   (catch InterruptedException e)
+   (catch Throwable e
+     (throw e))))

 (defn add-test-env-peers!
   "Add peers to an OnyxTestEnv component"
   [{:keys [peer-group peers monitoring-config] :as component} n-peers]
-  (swap! peers into (try-start-peers n-peers peer-group monitoring-config)))
+  (swap! peers into (try-start-peers n-peers peer-group)))

 (defn shutdown-peer [v-peer]
   (try
@@ -133,7 +134,7 @@
     (println "Starting Onyx test environment")
     (let [env (try-start-env env-config)
           peer-group (try-start-group peer-config monitoring-config)
-          peers (try-start-peers n-peers peer-group monitoring-config)]
+          peers (try-start-peers n-peers peer-group)]
       (assoc component :env env :peer-group peer-group :peers (atom peers))))

   (stop [component]


aggregation query

aggregation query

--- src/ophion/aggregate.clj
+++ src/ophion/aggregate.clj
@@ -235,8 +235,8 @@
      (mongo/raw-aggregate
       db collection
       aggregate
-       ;; :cursor {:batch-size 1000}
-      {:allow-disk-use true}))))
+      {:allow-disk-use true
+       :cursor {:batch-size 1000}}))))

 (defn flat
   "this will squash data if they are in the reserved set"


pre-fetch icons

pre-fetch icons

--- cljs-client/tourneybot_client/core.cljs
+++ cljs-client/tourneybot_client/core.cljs
@@ -399,6 +399,9 @@
   [state]
   (let [current-tab (:tab state)]
     [:div
+      ;; NOTE: pre-fetch these icons before the user sees the "Schedule" page
+      [:img {:src "img/check-square-o.svg", :style {:display "none"}}]
+      [:img {:src "img/square-o.svg", :style {:display "none"}}]
       [:header
         [:h1 (:title state)]
         (NavTabs current-tab)]


Only specify that the server is running when it has actually completed the booting process.

--- src/overtone/sc/core.clj
+++ src/overtone/sc/core.clj
@@ -270,13 +270,13 @@
 (defonce scsynth-server* (ref nil))

 (defn- internal-booter [port]
-  (reset! running?* true)
   (log/info "booting internal audio server listening on port: " port)
   (let [server (ScSynth.)
         listener (reify ScSynthStartedListener
                    (started [this]
-                            (log/info "Boot listener...")
-                            (event :booted)))]
+                     (log/info "Boot listener...")
+                     (event :booted)
+                     (reset! running?* true)))]
     (.addScSynthStartedListener server listener)
     (dosync (ref-set sc-world* server))
     (.run server)


update warning messages

update warning messages

--- src/overtone/sc/node.clj
+++ src/overtone/sc/node.clj
@@ -127,7 +127,7 @@
     (free-id :node id 1 #(log/debug (format "node-destroyed: %d" id)))
     (if snode
       (reset! (:status snode) :destroyed)
-      (log/warning (format "ERROR: node-destroyed can't find synth node: %d" id)))
+      (log/warning (format "ERROR: The fn node-destroyed can't find synth node: %d" id)))
     (swap! active-synth-nodes* dissoc id)))

 (defn- node-created
@@ -137,7 +137,7 @@
     ;(log/info (format "node-created: %d\nsynth-node: %s" id snode))
     (if snode
       (reset! (:status snode) :live)
-      (log/warning (format "ERROR: node-created can't find synth node: %d" id)))))
+      (log/warning (format "ERROR: The fn node-created can't find synth node: %d" id)))))

 (defn- node-paused
   "Called when a node is turned off, but not deallocated."
@@ -145,7 +145,7 @@
   (let [snode (get @active-synth-nodes* id)]
     (if snode
       (reset! (:status snode) :paused)
-      (log/warning (format "ERROR: node-paused can't find synth node: %d" id)))))
+      (log/warning (format "ERROR: The fn node-paused can't find synth node: %d" id)))))

 (defn- node-started
   "Called whena a node is turned on."
@@ -153,7 +153,7 @@
   (let [snode (get @active-synth-nodes* id)]
     (if snode
       (reset! (:status snode) :running)
-      (log/warning (format "ERROR: node-started can't find synth node: %d" id)))))
+      (log/warning (format "ERROR: The fn node-started can't find synth node: %d" id)))))

 ; Setup the feedback handlers with the audio server.
 (on-event "/n_end" (fn [info] (node-destroyed (first (:args info)))) ::node-destroyer)


Added a setTimeout in the end turn callback to allow for render repaint.

--- src-browser/simplestrat/renderstate.cljs
+++ src-browser/simplestrat/renderstate.cljs
@@ -668,15 +668,31 @@
     world/advanceturn))

 (defn endturnclicked [event]
-  (let [gamestate (:gamestate @displayed-renderstate)]
-    (if (= :team1 (:activeteam gamestate))
-      (*submitplayeraction* computerturn))))
+  (let [renderstate @displayed-renderstate
+        gamestate (:gamestate renderstate)
+        endturnbutton (:controlpanel renderstate)
+        processcomputerturn (fn []
+                              (*submitplayeraction* computerturn)
+                              (doto endturnbutton
+                                (aset "text" "End My Turn")
+                                (aset color "#066"))
+                              (redraw renderstate))
+        ]
+    (when (= :team1 (:activeteam gamestate))
+      (doto endturnbutton
+        (aset color "#A00000")
+        (aset "text" "THINKING...")
+        )
+      (redraw renderstate)
+      (js/setTimeout processcomputerturn 16))))
+

 (defn createcontrolpanel [[x y]]
-  (let [controlpanel (createjs/Text. "End Turn" "30px Arial" "#066")]
+  (let [controlpanel (createjs/Text. "End My Turn" "30px Arial" "#066")]
     (doto controlpanel
       (aset "x" x)
       (aset "y" y)
+      (aset "textAlign" "center")
       (.addEventListener "click" endturnclicked))
     controlpanel))

@@ -745,7 +761,7 @@
     ;; easy manipulation later
     (swap! displayed-renderstate assoc :stage-map tilemap :stage-characters characters)
     (swap! displayed-renderstate assoc :teamGUIs {:team1 leftRoster :team2 rightRoster :sprites {}})
-    (swap! displayed-renderstate assoc :overlay overlayshape :messagelog messagelog)
+    (swap! displayed-renderstate assoc :overlay overlayshape :messagelog messagelog :controlpanel controlpanel)
     ))

 (defn initializerenderer [canvasname]


34-38

--- src/sandbox/4clojure.clj
+++ src/sandbox/4clojure.clj
@@ -116,3 +116,21 @@

 ;;33 Replicate a Sequence
 (fn [col n] (reduce #(concat %1 (repeat n %2)) [] col))
+
+;;34 Implement range
+#(loop [a %1 col []]
+   (if (>= a %2)
+     col
+     (recur (inc a) (conj col a))))
+
+;;35 Local bindings
+7
+
+;;36 Let it Be
+[z 1 y 3 x 7]
+
+;;37 Regular Expressions
+"ABC"
+
+;;38 Maximum value
+(comp last sort (partial conj '()))


Replace `get-rel-path`.

Replace `get-rel-path`.

`clojure.string.replace-first` does the same thing.

--- src/clj/qualityclj/imports/highlight.clj
+++ src/clj/qualityclj/imports/highlight.clj
@@ -5,18 +5,6 @@

 (def repo-path "repos")
 (def highlight-path "highlight")
-
-(defn get-rel-path
-  "Given a full path and a base path, return the path specific to the
-  full path.
-
-  Example:
-  (get-rel-path \"repos/jcsims/cljagents/src/clj/cljagents/agent.clj\"
-  \"repos\")
-  => \"jcsims/cljagents/src/clj/cljagents/agent.clj\""
-  [full-path base]
-  (let [base (if (.endsWith base "/") base (str base "/"))]
-    (s/replace-first full-path base "")))

 (defn highlight
   "Produce an HTML file from a given source file. Takes a full path to
@@ -38,9 +26,11 @@
         out-path (io/file (str highlight-path "/" project "/"))]
     (when-not (.exists out-path) (.mkdirs out-path))
     (doseq [file (file-seq src-path)]
-      (when (.isFile file)
-        (let [out-file (io/file (str highlight-path "/"
-                                     (get-rel-path (.getPath file) repo-path)
+      (when (and (.isFile file) (.endsWith (.getPath file) "clj"))
+        (let [out-file (io/file (str (s/replace-first
+                                      (.getPath file)
+                                      repo-path
+                                      highlight-path)
                                      ".html"))]
           (.mkdirs (.getParentFile out-file))
           (highlight (.getPath file) (.getPath out-file)))))))


removing some comments

removing some comments

--- src/clojure/my/company/superapp/main.clj
+++ src/clojure/my/company/superapp/main.clj
@@ -94,8 +94,6 @@
     )
   )

-;; (Def jsonSerializer (JsonSerializer. java.util.Map))
-;; (.fromString jsonSerializer "{\"name\":\"Bob\", \"age\":13}")
 (defn init-httpd
   [bind-address port]
   (let [httpd (proxy [NanoHTTPD] [bind-address port]


Add multimethods example from section 4.2.1

--- src/clojure_walkthrough/cjia/ch04_xx.clj
+++ src/clojure_walkthrough/cjia/ch04_xx.clj
@@ -67,3 +67,34 @@
 (subtype-map-type-namer (hash-map))   ;; "map"
 (subtype-map-type-namer (array-map))  ;; "map"
 (subtype-map-type-namer (sorted-map)) ;; "map"
+
+;; 4.2.1: life without multimethods
+(def example-user {:login "rob"
+                   :referrer "mint.com"
+                   :salary 100000
+                   })
+(defn fee-amount [percentage user]
+  (with-precision 16 :rounding HALF_EVEN
+    (* 0.01M percentage (:salary user))))
+
+(defn affiliate-fee [user]
+  (case (:referrer user)
+    "google.com" (fee-amount 0.01M user)
+    "mint.com"   (fee-amount 0.03M user)
+    (fee-amount 0.02M user)))
+
+(affiliate-fee example-user) ;; 30.0000M
+
+;; 4.2.2: Ad hoc polymorphism using multimethod
+(defmulti affiliate-fee (fn [user] (:referrer user)))
+
+(defmethod affiliate-fee "mint.com" [user]
+  (fee-amount 0.03M user))
+
+(defmethod affiliate-fee "google.com" [user]
+  (fee-amount 0.01M user))
+
+(defmethod affiliate-fee :default [user]
+  (fee-amount 0.02M user))
+
+(affiliate-fee example-user) ;; 30.0000M


Re-introduced jazz drum accompanyment

Re-introduced jazz drum accompanyment

--- src/aeolian/abc/header.clj
+++ src/aeolian/abc/header.clj
@@ -8,9 +8,11 @@
 (def xxx-major-key "\nK:C")
 (def xxx-minor-key "\nK:Amin")
 (def note-length "\nL:1/8")
+(def misc "\n%%MIDI chordvol 50")
+(def drums "\n%%MIDI channel 1\n%%MIDI drum dd2d2ddd2d2d 59 51 51 59 59 51 51 59 100 50 50 100 100 50 50 100\n%%MIDI drumon")

 (defn build-common-header [title key]
-  (str reference title-prefix title composer meter note-length "\n" t/starting-tempo key))
+  (str reference title-prefix title composer meter note-length "\n" t/starting-tempo key misc drums))

 (defn build-major-header [title]
   (build-common-header title xxx-major-key))


Prepares relative timings map.

Prepares relative timings map.

--- src/carmine/benchmarks.clj
+++ src/carmine/benchmarks.clj
@@ -114,20 +114,33 @@
        (carmine/get test-key)
        (carmine/ping)))))

+(defn- sorted-map-by-val
+  [m]
+  (into (sorted-map-by #(compare (get m %1) (get m %2))) m))
+
 (defn bench-and-compare-clients
   [opts]
   (println "---")
   (println "Starting benchmarks with"
            (:num-threads opts) "threads and" (:num-laps opts) "laps.")
   (println "Each lap consists of 4 PINGS, 1 SET, 1 GET.")
-  (let [times {:redis-clojure 0 #_(bench-redis-clojure opts)
-               :clj-redis     0 #_(bench-clj-redis opts)
-               :accession     0 #_(bench-accession opts)
+  (let [times {:redis-clojure (bench-redis-clojure opts)
+               :clj-redis     (bench-clj-redis opts)
+               :accession     (bench-accession opts)
                :carmine       (bench-carmine opts)}]
     (println "Done!" "\n")
-    (println "Raw times:" times)))
+    (println "Raw times:" times "\n")
+    (println "Sorted relative times (smaller is better):"
+             (let [min-time (max 0.1 (apply min (vals times)))]
+               (sorted-map-by-val (zipmap (keys times)
+                                          (map #(float (/ % min-time))
+                                               (vals times))))))))

 (comment
+
+  (bench-and-compare-clients (make-benching-options :num-laps 10
+                                                    :num-threads 1))
+
   ;; Standard test
   (bench-and-compare-clients (make-benching-options))