add vol control to monomestep

add vol control to monomestep

--- src/overtone/examples/monome/monomestep.clj
+++ src/overtone/examples/monome/monomestep.clj
@@ -3,7 +3,9 @@
         [clojure.core.match :only [match]]
         [polynome.core :as poly]))

-(definst dubstep [note 40 wob 2 hi-man 0 lo-man 0 sweep-man 0 deci-man 0 tan-man 0 shape 0 sweep-max-freq 3000 hi-man-max 1000 lo-man-max 500 beat-vol 0]
+(defonce dub-vol (atom 1))
+
+(definst dubstep [note 40 wob 2 hi-man 0 lo-man 0 sweep-man 0 deci-man 0 tan-man 0 shape 0 sweep-max-freq 3000 hi-man-max 1000 lo-man-max 500 beat-vol 0 amp 1]
   (let [bpm 300
         shape (select shape [(lf-tri wob) (lf-saw wob)])
         sweep (lin-exp shape -1 1 40 sweep-max-freq)
@@ -39,7 +41,7 @@
         snare (clip2 snare 1)
        beat (* beat-vol (+ kick snare))
         ]
-    (+ snd beat)))
+    (* amp (+ (pan2 snd shape) beat))))

 (def m (poly/init "/dev/tty.usbserial-m64-0790"))
 ;;(def m beatbox.core/m)
@@ -51,6 +53,10 @@
                   2 :deci-man
                   3 :tan-man
                   4 :beat-vol})
+
+(defn toggle-vol
+  []
+  (ctl dubstep :amp (swap! dub-vol #(mod (inc %) 2))))

 (defn toggle-fx
   [x y]
@@ -67,9 +73,10 @@
     (ctl dubstep  :wob wob)))

 (poly/on-press m ::foo (fn [x y s]
-                   (match [x y]
-                          [0 _] (toggle-fx x y)
-                          [_ _] (modulate-pitch-wob x y))))
+                         (match [x y]
+                           [0 7] (toggle-vol)
+                           [0 _] (toggle-fx x y)
+                           [_ _] (modulate-pitch-wob x y))))

 (dubstep)
 ;;(stop)
@@ -81,3 +88,4 @@
   (ctl dubstep :note 30)
   (stop)
   )
+;;(poly/disconnect m)


Implement schema- and value generators for :wrapped

--- src/test/cljc/mikron/schema_generators.cljc
+++ src/test/cljc/mikron/schema_generators.cljc
@@ -39,8 +39,18 @@
                  [:optional {} schema])
                inner-generator))

+(defrecord Box [value])
+
+(defn box ^Box [value]
+  (->Box value))
+
+(defn unbox [^Box box]
+  (.-value box))
+
 (defmethod compound-schema-generator :wrapped [_ inner-generator]
-  inner-generator)
+  (tc.gen/fmap (fn [schema]
+                 [:wrapped {} unbox box schema])
+               inner-generator))

 (defmethod compound-schema-generator :multi [_ inner-generator]
   inner-generator)
@@ -194,8 +204,8 @@
   (tc.gen/one-of [(value-generator [:nil {}])
                   (value-generator schema')]))

-(defmethod value-generator :wrapped [_]
-  (tc.gen/return "Not value-generator implemented for :wrapped"))
+(defmethod value-generator :wrapped [[_ _ _ post schema']]
+  (tc.gen/fmap post (value-generator schema')))

 (defmethod value-generator :multi [_]
   (tc.gen/return "Not value-generator implemented for :multi"))


Add more call-cc-related tests.

Add more call-cc-related tests.

--- test/active/clojure/monad_test.cljc
+++ test/active/clojure/monad_test.cljc
@@ -399,3 +399,57 @@
              (execute-monadic-swiss-army
               (null-monad-command-config nil nil)
               (call-cc f)))))))
+
+(deftest call-cc-state-test
+  (testing "that state does not get saved over call-cc"
+    (let [f (fn [cont]
+              (put-state-component! ::cont-test true)
+              (cont nil))
+          [result state]
+          (execute-monadic-swiss-army
+           (null-monad-command-config nil nil)
+           (monadic
+            (put-state-component! ::cont-test false)
+            [r (call-cc f)]
+            (return r)))]
+      (is (false? (::cont-test state)))))
+  (testing "that state does get passed to but not get saved over call-cc"
+    (let [f (fn [cont]
+              (update-state-component! ::cont-test inc)
+              (cont nil))
+          [result state]
+          (execute-monadic-swiss-army
+           (null-monad-command-config nil nil)
+           (monadic
+            (put-state-component! ::cont-test 0)
+            [r (call-cc f)]
+            (return r)))]
+      (is (= 0 (::cont-test state))))))
+
+(deftest call-cc-env-test
+  (testing "that env does get saved over call-cc"
+    (let [f (fn [cont]
+              (with-env-component ::cont-test (constantly true)
+                (cont nil)))
+          [result _state]
+          (execute-monadic-swiss-army
+           (null-monad-command-config nil nil)
+           (monadic
+            (with-env-component ::cont-test (constantly false)
+              (monadic
+               [r (call-cc f)]
+               (get-env-component ::cont-test)))))]
+      (is (true? result))))
+  (testing "that env does get passed to and saved over call-cc"
+    (let [f (fn [cont]
+              (with-env-component ::cont-test inc
+                (cont nil)))
+          [result _state]
+          (execute-monadic-swiss-army
+           (null-monad-command-config nil nil)
+           (monadic
+            (with-env-component ::cont-test (constantly 0)
+              (monadic
+               [r (call-cc f)]
+               (get-env-component ::cont-test)))))]
+      (is (= 1 result)))))


Add missing newline

Add missing newline

--- test/braid/test/server/db/group.clj
+++ test/braid/test/server/db/group.clj
@@ -72,6 +72,7 @@
       (is (= #{(dissoc user :group-ids)}
              (set (map (fn [u] (dissoc user :group-ids))
                        (db/group-users (group :id)))))))))
+
 (deftest user-group-admin
   (testing "can make a user a group admin"
     (let [group (db/create-group! {:id (db/uuid) :slug "c" :name "c"})


New test: get-last-day-of-week-2

New test: get-last-day-of-week-2

--- test/clj_calendar/calendar_test.clj
+++ test/clj_calendar/calendar_test.clj
@@ -519,3 +519,49 @@
             (.set calendar 2000 00 10 00 00 00)
             (is (= "2000-01-15" (get-last-day-of-week-formatted calendar))))))

+(deftest test-get-last-day-of-week-2
+    "Check the function clj-calendar.calendar/get-last-day-of-week"
+    (testing "the function clj-calendar.calendar/get-last-day-of-week"
+        (let [calendar (get-calendar)]
+            (.set calendar 2000 01 1 00 00 00)
+            (is (= "2000-02-05" (get-last-day-of-week-formatted calendar))))
+        (let [calendar (get-calendar)]
+            (.set calendar 2000 01 2 00 00 00)
+            (is (= "2000-02-05" (get-last-day-of-week-formatted calendar))))
+        (let [calendar (get-calendar)]
+            (.set calendar 2000 01 3 00 00 00)
+            (is (= "2000-02-05" (get-last-day-of-week-formatted calendar))))
+        (let [calendar (get-calendar)]
+            (.set calendar 2000 01 4 00 00 00)
+            (is (= "2000-02-05" (get-last-day-of-week-formatted calendar))))
+        (let [calendar (get-calendar)]
+            (.set calendar 2000 01 5 00 00 00)
+            (is (= "2000-02-05" (get-last-day-of-week-formatted calendar))))
+        (let [calendar (get-calendar)]
+            (.set calendar 2000 01 6 00 00 00)
+            (is (= "2000-02-12" (get-last-day-of-week-formatted calendar))))
+        (let [calendar (get-calendar)]
+            (.set calendar 2000 01 7 00 00 00)
+            (is (= "2000-02-12" (get-last-day-of-week-formatted calendar))))
+        (let [calendar (get-calendar)]
+            (.set calendar 2000 01 8 00 00 00)
+            (is (= "2000-02-12" (get-last-day-of-week-formatted calendar))))
+        (let [calendar (get-calendar)]
+            (.set calendar 2000 01 9 00 00 00)
+            (is (= "2000-02-12" (get-last-day-of-week-formatted calendar))))
+        (let [calendar (get-calendar)]
+            (.set calendar 2000 01 10 00 00 00)
+            (is (= "2000-02-12" (get-last-day-of-week-formatted calendar))))
+        (let [calendar (get-calendar)]
+            (.set calendar 2000 01 11 00 00 00)
+            (is (= "2000-02-12" (get-last-day-of-week-formatted calendar))))
+        (let [calendar (get-calendar)]
+            (.set calendar 2000 01 12 00 00 00)
+            (is (= "2000-02-12" (get-last-day-of-week-formatted calendar))))
+        (let [calendar (get-calendar)]
+            (.set calendar 2000 01 13 00 00 00)
+            (is (= "2000-02-19" (get-last-day-of-week-formatted calendar))))
+        (let [calendar (get-calendar)]
+            (.set calendar 2000 01 14 00 00 00)
+            (is (= "2000-02-19" (get-last-day-of-week-formatted calendar))))))
+


Remove -card suffix from card symbols

Remove -card suffix from card symbols

--- test/cljs/comic_reader/ui_test.cljs
+++ test/cljs/comic_reader/ui_test.cljs
@@ -5,13 +5,13 @@
             [comic-reader.ui :as ui]
             [comic-reader.test-helper :refer [strip-classes]]))

-(defcard-rg loading-card
+(defcard-rg loading
   "## Loading
    This is the loading svg used everywhere on the site."
   [:div {:style {"width" "4em"}}
    (ui/loading)])

-(defcard-rg four-oh-four-card
+(defcard-rg four-oh-four
   (ui/four-oh-four))

 (deftest test-site-button
@@ -43,7 +43,7 @@
   (is (= (ui/set-site-list {} [:site-site-list []])
          {:site-list []})))

-(defcard-rg site-list-card
+(defcard-rg site-list
   (do
     (re-frame/dispatch [:set-site-list
                         [{:id :a :name "Comic A"}


Remove names from revision descriptions in unit tests to match new behavior

--- test/metabase/api/revision_test.clj
+++ test/metabase/api/revision_test.clj
@@ -46,7 +46,7 @@
       (post-dashcard dash-id card-id)
       (get-dashboard-revisions dash-id))))

-(expect [{:is_reversion false, :user @rasta-revision-info, :description "Rasta Toucan added a card."}
+(expect [{:is_reversion false, :user @rasta-revision-info, :description "added a card."}
          {:is_reversion false, :user @rasta-revision-info, :description "First revision."}]
   (with-fake-dashboard [{dash-id :id}]
     (with-fake-card [{card-id₁ :id}]
@@ -55,8 +55,8 @@
         (post-dashcard dash-id card-id₂)
         (get-dashboard-revisions dash-id)))))

-(expect [{:is_reversion false, :user @rasta-revision-info, :description "Rasta Toucan removed a card."}
-         {:is_reversion false, :user @rasta-revision-info, :description "Rasta Toucan added a card."}
+(expect [{:is_reversion false, :user @rasta-revision-info, :description "removed a card."}
+         {:is_reversion false, :user @rasta-revision-info, :description "added a card."}
          {:is_reversion false, :user @rasta-revision-info, :description "First revision."}]
   (with-fake-dashboard [{dash-id :id}]
     (with-fake-card [{card-id₁ :id}]
@@ -68,9 +68,9 @@

 ;;; # TESTS FOR POST /api/revision/revert
 (expect [2
-         [{:is_reversion true,  :user @rasta-revision-info, :description "Rasta Toucan reverted to an earlier revision and added a card."}
-          {:is_reversion false, :user @rasta-revision-info, :description "Rasta Toucan removed a card."}
-          {:is_reversion false, :user @rasta-revision-info, :description "Rasta Toucan added a card."}
+         [{:is_reversion true,  :user @rasta-revision-info, :description "reverted to an earlier revision and added a card."}
+          {:is_reversion false, :user @rasta-revision-info, :description "removed a card."}
+          {:is_reversion false, :user @rasta-revision-info, :description "added a card."}
           {:is_reversion false, :user @rasta-revision-info, :description "First revision."}]]
   (with-fake-dashboard [{dash-id :id}]
     (with-fake-card [{card-id₁ :id}]


Clean up organization of config namespace

No code changes

--- src/puppetlabs/trapperkeeper/config.clj
+++ src/puppetlabs/trapperkeeper/config.clj
@@ -25,7 +25,7 @@
             [puppetlabs.trapperkeeper.logging :refer [configure-logging!]]))

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;; Service protocols
+;;; Service protocol

 (defprotocol ConfigService
   (get-config [this] "Returns a map containing all of the configuration values")
@@ -34,21 +34,6 @@
                  configuration structure, where ks is a sequence of keys.
                  Returns nil if the key is not present, or the default value if
                  supplied."))
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;; Public
-;; TODO: consolidate public sections
-
-(defn config-service
-  "Returns trapperkeeper's configuration service.  Expects
-   to find a command-line argument value for `:config`; the value of this
-   parameter should be the path to an .ini file or a directory of .ini files."
-  [config]
-  (service ConfigService
-           []
-           (get-config [this] config)
-           (get-in-config [this ks] (get-in config ks))
-           (get-in-config [this ks default] (get-in config ks default))))

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;; Private
@@ -86,6 +71,17 @@
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;; Public

+(defn config-service
+  "Returns trapperkeeper's configuration service.  Expects
+   to find a command-line argument value for `:config`; the value of this
+   parameter should be the path to an .ini file or a directory of .ini files."
+  [config]
+  (service ConfigService
+           []
+           (get-config [this] config)
+           (get-in-config [this ks] (get-in config ks))
+           (get-in-config [this ks default] (get-in config ks default))))
+
 (defn parse-config-data
   "Parses the .ini configuration file(s) and returns a map of configuration data."
   [cli-data]


add warnings for misconfigured :build-hooks

fixes #1006

--- src/main/shadow/build.clj
+++ src/main/shadow/build.clj
@@ -215,6 +215,18 @@
         fn
         ))))

+(defmethod build-log/event->str ::hook-not-found
+  [{:keys [hook-sym]}]
+  (format "build hook: %s was not found and will not be used" hook-sym))
+
+(defmethod build-log/event->str ::hook-without-stage
+  [{:keys [hook-sym]}]
+  (format "build hook: %s declared no stages and will not be used" hook-sym))
+
+(defmethod build-log/event->str ::hook-load-failed
+  [{:keys [hook-sym]}]
+  (format "build hook: %s failed to load and will not be used" hook-sym))
+
 (defn configure-hooks-from-config [{::keys [build-id] :as state} build-hooks]
   (reduce-kv
     (fn [state hook-idx [hook-sym & args]]
@@ -225,24 +237,41 @@

         (let [hook-var (find-var hook-sym)
               {::keys [stages stage]} (meta hook-var)]
-          (reduce
-            (fn [state stage]
-              (assoc-in state [:build-hooks stage [hook-idx hook-sym]]
-                (fn [build-state]
-                  (let [result (apply hook-var build-state args)]
-                    (when-not (build-api/build-state? result)
-                      (throw (ex-info "hook returned invalid result" {:type ::invalid-hook-result
-                                                                      :hook-sym hook-sym
-                                                                      :build-id build-id
-                                                                      :stage stage})))
-                    result))))
-            state
-            (or stages [stage])))
+
+          (cond
+            (not hook-var)
+            (util/warn state
+              {:type ::hook-not-found
+               :hook-sym hook-sym})
+
+            (and (not stage) (not (seq stages)))
+            (util/warn state
+              {:type ::hook-without-stage
+               :hook-sym hook-sym})
+
+            :else
+            (reduce
+              (fn [state stage]
+                (assoc-in state [:build-hooks stage [hook-idx hook-sym]]
+                  (fn [build-state]
+                    (let [result (apply hook-var build-state args)]
+                      (when-not (build-api/build-state? result)
+                        (throw (ex-info "hook returned invalid result" {:type ::invalid-hook-result
+                                                                        :hook-sym hook-sym
+                                                                        :build-id build-id
+                                                                        :stage stage})))
+                      result))))
+              state
+              (or stages [stage]))))
         (catch Exception e
           (log/warn-ex e ::hook-config-ex {:hook-idx hook-idx
                                            :hook-sym hook-sym
                                            :build-id build-id})
-          state)))
+
+          (util/warn state
+            {:type ::hook-load-failed
+             :hook-sym hook-sym}
+            ))))
     state
     build-hooks))


attempts to fix imperfect tests

attempts to fix imperfect tests

--- test/babel/test/fr.cljc
+++ test/babel/test/fr.cljc
@@ -285,19 +285,19 @@
                                          :tense :past
                                          :aspect :progressive}}}
                          :model (small))]
-    (is (= :imperfect (get-in result [:head :synsem :infl])))
+    (is (= :imperfect (get-in result [:synsem :infl])))
     (is (= "j'étudiais" (fo result)))))

 (deftest generate-imparfait-regular-ir
-  (let [result (generate {:head {:agr {:gender :masc}}
-                          :synsem {:subcat '()
+  (let [result (generate {:synsem {:subcat '()
+                                   :agr {:gender :masc}
                                    :sem {:pred :sleep
-                                         :subj {:pred :loro}
+                                         :subj {:pred :loro
+                                                :gender :masc}
                                          :tense :past
                                          :aspect :progressive}}}
                          :model (small))]
-    (is (= :imperfect (get-in result [:head :synsem :infl])))
-    (is (= :masc (get-in result [:head :français :agr :gender])))
+    (is (= :imperfect (get-in result [:synsem :infl])))
     (is (= "ils dormaient" (fo result)))))

 (deftest generate-imparfait-regular-re
@@ -307,8 +307,7 @@
                                          :tense :past
                                          :aspect :progressive}}}
                          :model (small))]
-    (is (= :imperfect (get-in result [:head :synsem :infl])))
-    (is (= :masc (get-in result [:head :français :agr :gender])))
+    (is (= :imperfect (get-in result [:synsem :infl])))
     (is (= "vous vendiez" (fo result)))))

 (deftest generate-imparfait-finir


+:subcat '()

+:subcat '()

--- test/babel/test/it.cljc
+++ test/babel/test/it.cljc
@@ -559,7 +559,8 @@
 ;          not)))

 (deftest past-and-gender-agreement
-  (is (= (morph (generate {:synsem {:sem {:pred :go
+  (is (= (morph (generate {:synsem {:subcat '()
+                                    :sem {:pred :go
                                           :aspect :perfect
                                           :tense :present
                                           :subj {:gender :fem


+(deftest io-dormo-a-casa)

+(deftest io-dormo-a-casa)

--- test/babel/test/it.cljc
+++ test/babel/test/it.cljc
@@ -324,3 +324,8 @@
 (deftest chiamarsi-3
   (let [result (parse "lei si chiama Luisa")]
     (is (not (empty? (mapcat :parses result))))))
+
+;; sentential modifiers: S -> S PP
+(deftest io-dormo-a-casa
+  (let [result (parse "io dormo a casa")]
+    (is (not (empty? (mapcat :parses result))))))


fix stereo default cookie, delete unused route

--- src/mars_ogler/routes.clj
+++ src/mars_ogler/routes.clj
@@ -34,7 +34,7 @@
          page "1"
          per-page "25"
          sorting "released"
-         stereo "yes"
+         stereo "off"
          thumbs "no"
          view "list"}
     :as params}]
@@ -86,10 +86,6 @@
   (GET "/stereo" [& params :as {:keys [cookies]}]
     (let [params (merge params (parse-cookie-params cookies [:stereo-mode]))]
       (stereo params)))
-  (GET "/stereo-cookie" [mode]
-       {:status 200
-        :cookies (set-expires {:stereo-mode mode})
-        :body "<html></html>"})
   (GET "/" [& params :as {:keys [query-string cookies]}]
        (let [visit-times (visit-tick (get-in cookies ["visit-last" :value])
                                      (get-in cookies ["visit-start" :value])


generate path

generate path

--- src/strictly_specking/path_matching.clj
+++ src/strictly_specking/path_matching.clj
@@ -1,6 +1,7 @@
 (ns strictly-specking.path-matching
   (:require
    [clojure.spec :as s]
+   [clojure.set :as set]
    [clojure.pprint :as pp]
    [strictly-specking.strict-keys :as strict-impl]))

@@ -127,10 +128,27 @@
                      (sequential? data) list)]
         (f (generate-path-structure (get data p) (rest path) v))))))

-(defn parent-path-from-genereated-structure [gened-path-structure
-                                           ])
-
-#_(generate-path-structure  {:a {:b [{:c {}}]}} [:a :b 1 :c ::int-key ::pred-key] 555)
+(defn generate-path-structure-path
+  "Generates a data structure to demonstrate where to place a key"
+  [data path]
+  (let [p (first path)]
+    (cond
+      (or (empty? path) (nil? path)) '()
+      (nil? data)
+      (let [nxt (generate-path-structure-path nil (rest path))]
+        (if (or (integer? p) (= :strictly-specking.core/int-key p))
+          (cons 0 nxt)
+          (cons p nxt)))
+      :else
+      (when-let [f (cond
+                     ;; This is where you would do sampling
+                     (map? data)        (partial cons p)
+                     (vector? data)     (partial cons 0)
+                     (set? data)        (partial cons 0)
+                     (sequential? data) (partial cons 0))]
+        (f (generate-path-structure-path (get data p) (rest path)))))))
+
+#_(generate-path-structure-path  {:a {:b [{:c {}}]}} [:a :b 1 :c ::int-key ::pred-key])

 #_(best-possible-path
    ['({:ky-spec :strictly-specking.test-schema/cljsbuilds, :ky :cljsbuild}


(maint) Add --no-document option to puppetserver gem install

This prevents an issue with rdoc now that puppetserver's jruby uses
Rubygems 3

--- src-gems/puppetlabs/puppetdb/integration/install_gems.clj
+++ src-gems/puppetlabs/puppetdb/integration/install_gems.clj
@@ -11,14 +11,14 @@
     (jruby-core/cli-run! jruby-config "gem" args)))

 (defn install-gems [gem-list-name config _]
-  (gem-run! config "install" "facter")
-  (gem-run! config "install" "hiera")
+  (gem-run! config "install" "facter" "--no-document")
+  (gem-run! config "install" "hiera" "--no-document")

   ;; Install the puppetserver vendored gems listed inside its jar; this is where
   ;; ezbake gets them
   (let [gem-list (string/split (slurp (io/resource (str "ext/build-scripts/" gem-list-name))) #"\n")]
     (doseq [[gem version] (map #(string/split % #"\s") gem-list)]
-      (gem-run! config "install" gem "--version" version))))
+      (gem-run! config "install" gem "--no-document" "--version" version))))

 (defn -main
   [& args]


Add missing copyright year

Add missing copyright year

--- src/test/clojure/cascade/test_utils.clj
+++ src/test/clojure/cascade/test_utils.clj
@@ -1,4 +1,4 @@
-; Copyright 2009, 2010 Howard M. Lewis Ship
+; Copyright 2009, 2010, 2011 Howard M. Lewis Ship
 ;
 ; Licensed under the Apache License, Version 2.0 (the "License");
 ; you may not use this file except in compliance with the License.


+TODO

+TODO

--- src/babel/italiano/morphology/determiners.cljc
+++ src/babel/italiano/morphology/determiners.cljc
@@ -13,6 +13,8 @@
       slurp
       read-string))

+;; TODO: rules should apply iteratively until no changes are no made
+;; similar to babel.encyclopedia/sem-impl
 (defn apply-determiner-rules [input]
   (let [results
         (remove nil?


Added sub select to hosted cljs apps

Added sub select to hosted cljs apps

Just copied the code from the normal clj macros to cljs

--- src/webapp/framework/client/macros.cljs
+++ src/webapp/framework/client/macros.cljs
@@ -53,7 +53,9 @@
           (~'render [~'this]

                     (~'let [
-                            ~'debug-id       (webapp.framework.client.coreclient/record-component-call
+                             ~'select-id     nil
+
+                             ~'debug-id       (webapp.framework.client.coreclient/record-component-call
                                               (~'ns-coils-debug)
                                               ~(str `~fn-name)
                                               ~(first data-paramater-name)
@@ -194,6 +196,7 @@
              (~'fn [~'record-id]
                    (~'let [~'relative-path (:relative-path ~opts)
                            ~'record        (~'get (~'-> ~'data :values) ~'record-id)
+                           ~'select-id     (~'get-in ~'record [:value :id])
                            ]
                           (~'if (get ~'record :value)
                                 ~@code)))
@@ -357,7 +360,7 @@

     `(~'data-view-v2
-       ~dataview-map
+       (~'if ~'select-id (~'merge ~dataview-map {:relative-path (~'conj (~'conj (~'get ~dataview-map :relative-path) :values)  ~'select-id)}) ~dataview-map)

        {:start     1
         :end       20


Update server IP

Update server IP

--- src/clojure/uk/org/potentialdifference/darknet/config.clj
+++ src/clojure/uk/org/potentialdifference/darknet/config.clj
@@ -1,7 +1,6 @@
 (ns uk.org.potentialdifference.darknet.config)

-(def host "192.168.1.25")
-;; (def host "172.20.10.2")
+(def host "192.168.2.31")

 (def config
   {:api-host host


Run individual tests in order, and tag those that are expected to fail.

--- examples/semi-sweet-examples/test/semi_sweet_simple/core_test.clj
+++ examples/semi-sweet-examples/test/semi_sweet_simple/core_test.clj
@@ -1,9 +1,10 @@

 (ns semi-sweet-simple.core-test
-  (:use [clojure.test])
-  (:use [midje.checkers])
-  (:use [midje.semi-sweet])
+  (:use clojure.test)
+  (:use midje.semi-sweet)
 )
+
+(defn note-expected [] (println "^^^^ The previous failure was expected ^^^^"))

                        ;;;

@@ -21,12 +22,12 @@
 ;;     expected: 3
 ;;       actual: 4
 (deftest example-of-a-simple-equality-test-failure
-  (expect ( #(+ 1 %) 3) => 3))
+  (expect ( #(+ 1 %) 3) => 3)                                          (note-expected))

 ;; You can also use functions on the right-hand side. In that case,
 ;; the actual result is passed as the function's single argument.
 (deftest example-of-a-function-as-right-hand-side
-  (expect ( #(+ 1 %) 3) => odd?))
+  (expect ( #(+ 1 %) 3) => odd?)                                       (note-expected))
 ;; The failing test will look slighly different:
 ;;     FAIL at (core_test.clj:28)
 ;;     Actual result did not pass expected function.
@@ -35,8 +36,8 @@

 ;; If you're testing something that produces a function, use
 ;; (exactly):
-(deftest example-of-a-function-as-right-hand-side
-  (expect (first [even? odd?]) => (exactly odd?)))
+(deftest example-of-an-exact-function-as-right-hand-side
+  (expect (first [even? odd?]) => (exactly odd?))                      (note-expected))
 ;;     Actual result did not pass expected function.
 ;;     expected function: (exactly odd?)
 ;;         actual result: #<core$even_QMARK___4680 clojure.core$even_QMARK___4680@494b6bed>
@@ -45,9 +46,9 @@
 ;;            (ns-publics (40 'midje.checkers))
 ;; They have doc strings.
 ;; Here's one of them:
-(deftest example-of-in-any-order
-  (expect '[3 1 2] => (in-any-order [1 2 3]))  ;; succeeds
-  (expect '[3 3 1 2] => (in-any-order [1 2 3])))  ;; fails
+(deftest example-of-a-predefined-checker
+  (expect '[3 1 2] => (in-any-order [1 2 3]))                         ;; succeeds
+  (expect '[3 3 1 2] => (in-any-order [1 2 3]))                       (note-expected))
 ;;     FAIL at (core_test.clj:51)
 ;;     Actual result did not pass expected function.
 ;;     expected function: (in-any-order [1 2 3])
@@ -66,15 +67,15 @@
 ;; The following test fakes the first-fake so that it returns a
 ;; predefined value when it's called. After that, the result of
 ;; function-under-test is checked in the normal way.
-(deftest example-of-simple-fake
+(deftest example-of-a-simple-fake
   (expect (function-under-test-1 3) => 5
       (fake (first-fake 3) => 5)))

 ;; Here's the failure when a fake is never called
 (defn function-under-test-2 [_] 5)
-(deftest example-of-simple-fake-failure
+(deftest example-of-a-simple-fake-failure
   (expect (function-under-test-2 3) => 5
-      (fake (first-fake 3) => 5)))
+      (fake (first-fake 3) => 5))                                      (note-expected))
 ;;     FAIL for (core_test.clj:80)
 ;;     This expectation was never satisfied:
 ;;     (first-fake 3) should be called at least once.
@@ -145,3 +146,21 @@
 ;; If I call (frozzle), I get this:
 ;;      Exception in thread "main" java.lang.Error: frozzle has no
 ;;      implementation. It's used in mock tests. (core_test.clj:1)
+
+
+
+
+
+(defn test-ns-hook []
+  "This calls the functions in order."
+  (example-of-a-simple-equality-test)
+  (example-of-a-simple-equality-test-failure)
+  (example-of-a-function-as-right-hand-side)
+  (example-of-an-exact-function-as-right-hand-side)
+  (example-of-a-predefined-checker)
+  (example-of-a-simple-fake)
+  (example-of-a-simple-fake-failure)
+  (example-of-multiple-faked-functions)
+  (example-of-interesting-functional-args)
+)
+


fixed domain schemna

fixed domain schemna

--- src/dda/pallet/domain/dda_servertest_crate.clj
+++ src/dda/pallet/domain/dda_servertest_crate.clj
@@ -23,13 +23,15 @@
    [dda.pallet.crate.config :as config-crate]
    [dda.pallet.crate.dda-servertest-crate :as crate]))

+(def ServerTestDomainConfig s/Any)
+
 (def ServertestCrateStackConfig
   {:group-specific-config
    {:dda-servertest-group
     {:dda-servertest crate/ServerTestConfig}}})

 (s/defn ^:always-validate dda-servertest-crate-stack-configuration :- ServertestCrateStackConfig
-  [domain-config :- crate/ServerTestConfig]
+  [domain-config :- ServerTestDomainConfig]
   (let [{:keys [os-user]} domain-config]
     {:group-specific-config
       {:dda-servertest-group


Draw image with original size instead with a fixed one.

--- frontend/src/uxbox/main/data/workspace/drawing.cljs
+++ frontend/src/uxbox/main/data/workspace/drawing.cljs
@@ -225,6 +225,7 @@
       (gpt/divide @refs/selected-zoom)))

 (declare on-init-draw-icon)
+(declare on-init-draw-image)
 (declare on-init-draw-path)
 (declare on-init-draw-free-path)
 (declare on-init-draw-generic)
@@ -238,7 +239,7 @@
                     (rx/take 1))]
     (case (:type shape)
       :icon (on-init-draw-icon shape)
-      :image (on-init-draw-icon shape)
+      :image (on-init-draw-image shape)
       :path (if (:free shape)
               (on-init-draw-free-path shape stoper)
               (on-init-draw-path shape stoper))
@@ -279,6 +280,22 @@
                :y1 y
                :x2 (+ x 200)
                :y2 (+ y (/ 200 proportion))}
+        shape (geom/setup shape props)]
+    (st/emit! (uds/add-shape shape)
+              (uds/select-first-shape)
+              (select-for-drawing nil)
+              ::uev/interrupt)))
+
+(defn- on-init-draw-image
+  [{:keys [metadata] :as shape}]
+  (let [{:keys [x y]} (gpt/divide @refs/canvas-mouse-position
+                                  @refs/selected-zoom)
+        {:keys [width height]} metadata
+        proportion (/ width height)
+        props {:x1 x
+               :y1 y
+               :x2 (+ x width)
+               :y2 (+ y height)}
         shape (geom/setup shape props)]
     (st/emit! (uds/add-shape shape)
               (uds/select-first-shape)


Remove use of kafka admin to discover partitions

--- src/onyx/plugin/kafka.clj
+++ src/onyx/plugin/kafka.clj
@@ -1,7 +1,7 @@
 (ns onyx.plugin.kafka
   (:require [clojure.core.async :as a :refer [chan >!! <!! close! timeout sliding-buffer]]
+            [franzy.admin.cluster :as k-cluster]
             [franzy.admin.zookeeper.client :as k-admin]
-            [franzy.admin.cluster :as k-cluster]
             [franzy.admin.partitions :as k-partitions]
             [franzy.serialization.serializers :refer [byte-array-serializer]]
             [franzy.serialization.deserializers :refer [byte-array-deserializer]]
@@ -10,6 +10,7 @@
             [franzy.clients.producer.types :refer [make-producer-record]]
             [franzy.clients.consumer.protocols :as proto]
             [franzy.clients.consumer.client :as consumer]
+            [franzy.common.metadata.protocols :as metadata]
             [franzy.clients.consumer.protocols :refer [assign-partitions! commit-offsets-sync!
                                                        poll! seek-to-offset!] :as cp]
             [taoensso.timbre :as log :refer [fatal info]]
@@ -71,7 +72,7 @@
 ;; kafka operations

 (defn id->broker [zk-addr]
-  (let [config (k-admin/make-zk-utils {:servers zk-addr} false)]
+  (with-open [zk-utils (k-admin/make-zk-utils {:servers zk-addr} false)]
     (reduce
      (fn [result {:keys [id endpoints]}]
        (assoc
@@ -81,7 +82,7 @@
              ":"
              (get-in endpoints [:plaintext :port]))))
      {}
-     (k-cluster/all-brokers config))))
+     (k-cluster/all-brokers zk-utils))))

 (defn find-brokers [zk-addr]
   (let [results (vals (id->broker zk-addr))]
@@ -139,20 +140,12 @@
         commit-interval (or (:kafka/commit-interval task-map) (:kafka/commit-interval defaults))
         client-id "onyx"
         zk-utils (k-admin/make-zk-utils {:servers (:kafka/zookeeper task-map)} false)
-        partitions (first (vals (k-partitions/partitions-for zk-utils [topic])))
-        n-partitions (count partitions)
-        _ (check-num-peers-equals-partitions task-map n-partitions)
         retry-ch (:retry-ch pipeline)
         pending-messages (:pending-messages pipeline)
         pending-commits (:pending-commits pipeline)
         job-id (:onyx.core/job-id event)
         peer-id (:onyx.core/id event)
         task-id (:onyx.core/task-id event)
-        done-unsupported? (and (> (count partitions) 1)
-                               (not (:kafka/partition task-map)))
-        kpartition (if partition
-                     (Integer/parseInt (str partition))
-                     (log-id @replica job-id peer-id task-id))
         consumer-config {:bootstrap.servers (find-brokers (:kafka/zookeeper task-map))
                          :group.id group-id
                          :enable.auto.commit false
@@ -162,10 +155,17 @@
         key-deserializer (byte-array-deserializer)
         value-deserializer (byte-array-deserializer)
         consumer (consumer/make-consumer consumer-config key-deserializer value-deserializer)
+        kpartition (if partition
+                     (Integer/parseInt (str partition))
+                     (log-id @replica job-id peer-id task-id))
+        partitions (mapv :partition (metadata/partitions-for consumer topic))
+        n-partitions (count partitions)
+        done-unsupported? (and (> (count partitions) 1)
+                               (not (:kafka/partition task-map)))
+        _ (check-num-peers-equals-partitions task-map n-partitions)
         _ (assign-partitions! consumer [{:topic topic :partition kpartition}])
         _ (seek-offset! log consumer group-id topic kpartition task-map)
         offset (cp/next-offset consumer {:topic topic :partition kpartition})
-        poll-timeout-ms (or (:kafka/poll-timeout-ms task-map) (:kafka/poll-timeout-ms defaults))
         commit-interval (or (:kafka/commit-interval task-map) (:kafka/commit-interval defaults))
         commit-fut (future (commit-loop log group-id topic kpartition commit-interval pending-commits))]
     {:kafka/commit-fut commit-fut


Refactored xsession namespace to use given event handlers instead of given multimethod impls

--- src/overtime/xsession.clj
+++ src/overtime/xsession.clj
@@ -6,89 +6,79 @@
 ;(ot/event-debug-on)
 ;(ot/event-debug-off)

-(def xsession-map {24 :1-left
-                   25 :2-left
-                   26 :3-left
-                   27 :high-left
-                   28 :mid-left
-                   29 :low-left
-                   12 :pitch-left
-                   11 :volume-left
+(defonce ^:private handlers-per-knob (atom {}))

-                   44 :headphone-left
-                   46 :rewind-left
-                   43 :ff-left
-                   58 :cue-left
-                   70 :play-left

-                   31 :1-right
-                   32 :2-right
-                   33 :3-right
-                   34 :high-right
-                   35 :mid-right
-                   36 :low-right
-                   15 :pitch-right
-                   14 :volume-right
+(defonce ^:private xsession-map {24 :1-left
+                                 25 :2-left
+                                 26 :3-left
+                                 27 :high-left
+                                 28 :mid-left
+                                 29 :low-left
+                                 12 :pitch-left
+                                 11 :volume-left

-                   45 :headphone-right
-                   56 :rewind-right
-                   57 :ff-right
-                   59 :cue-right
-                   69 :play-right
+                                 44 :headphone-left
+                                 46 :rewind-left
+                                 43 :ff-left
+                                 58 :cue-left
+                                 70 :play-left

-                   17 :fader
-                   20 :inv-fader})
+                                 31 :1-right
+                                 32 :2-right
+                                 33 :3-right
+                                 34 :high-right
+                                 35 :mid-right
+                                 36 :low-right
+                                 15 :pitch-right
+                                 14 :volume-right

-(defmulti on-event (fn [{note :note}] (get xsession-map note :unmapped)))
-(defmethod on-event :default [{note :note velocity :velocity}] (println "Unknown MIDI event:" note ", velocity:" velocity))
-(defmethod on-event :1-left [{velocity :velocity}] (println "1 left:" velocity))
-(defmethod on-event :2-left [{velocity :velocity}] (println "2 left:" velocity))
-(defmethod on-event :3-left [{velocity :velocity}] (println "3 left:" velocity))
-(defmethod on-event :high-left [{velocity :velocity}] (println "High left:" velocity))
-(defmethod on-event :mid-left [{velocity :velocity}] (println "Mid left:" velocity))
-(defmethod on-event :low-left [{velocity :velocity}] (println "Low left:" velocity))
-(defmethod on-event :pitch-left [{velocity :velocity}] (println "Pitch left:" velocity))
-(defmethod on-event :volume-left [{velocity :velocity}] (println "Volume left:" velocity))
+                                 45 :headphone-right
+                                 56 :rewind-right
+                                 57 :ff-right
+                                 59 :cue-right
+                                 69 :play-right

-(defmethod on-event :1-right [{velocity :velocity}] (println "1 right:" velocity))
-(defmethod on-event :2-right [{velocity :velocity}] (println "2 right:" velocity))
-(defmethod on-event :3-right [{velocity :velocity}] (println "3 right:" velocity))
-(defmethod on-event :high-right [{velocity :velocity}] (println "High right:" velocity))
-(defmethod on-event :mid-right [{velocity :velocity}] (println "Mid right:" velocity))
-(defmethod on-event :low-right [{velocity :velocity}] (println "Low right:" velocity))
-(defmethod on-event :pitch-right [{velocity :velocity}] (println "Pitch right:" velocity))
-(defmethod on-event :volume-right [{velocity :velocity}] (println "Volume right:" velocity))
+                                 17 :fader
+                                 20 :inv-fader})

-(defmethod on-event :headphone-left [_event] (println "Headphone left"))
-(defmethod on-event :rewind-left [_event] (println "Rewind left"))
-(defmethod on-event :ff-left [_event] (println "FF left"))
-(defmethod on-event :cue-left [_event] (println "Cue left"))
-(defmethod on-event :play-left [_event] (println "Play left"))
+(defn- get-midi-note
+  [event]
+  (let [midi-note (-> (:note event)
+                      xsession-map)]
+    (if (nil? midi-note)
+      (throw (str "Unknown XSession MIDI note:" midi-note))
+      midi-note)))

-(defmethod on-event :fader [{velocity :velocity}] (println "Fade:" velocity))
-(defmethod on-event :inv-fader [{velocity :velocity}] (println "Inverted Fade:" velocity))
-
-(defmethod on-event :headphone-right [_event] (println "Headphone right"))
-(defmethod on-event :rewind-right [_event] (println "Rewind right"))
-(defmethod on-event :ff-right [_event] (println "FF right"))
-(defmethod on-event :cue-right [_event] (println "Cue right"))
-(defmethod on-event :play-right [_event] (println "Play right"))
-
-(defn- set-event-hdlr
+(defn- set-midi-event-hdlr
   [type hdlr-key]
   (ot/on-event
     [:midi type]
-    (fn [event] (on-event event))
-    hdlr-key)
-  )
-(defn start [] (map set-event-hdlr [:control-change :note-on] [::cc-hdlr ::note-hdlr]))
+    (fn [event]
+      (let [handlers ((get-midi-note event) @handlers-per-knob)]
+        (doseq [[_k f] handlers] (f (:velocity event)))))
+    hdlr-key))
+
+(defn start [] (map set-midi-event-hdlr [:control-change :note-on] [::cc-hdlr ::note-hdlr]))
 (defn stop [] (map ot/remove-event-handler [::cc-hdlr ::note-hdlr]))

+(defn add-handler!
+  [xs-event key f]
+  (swap! handlers-per-knob update-in [xs-event] assoc key f))
+
+(defn remove-handler!
+  [xs-event key]
+  (swap! handlers-per-knob update-in [xs-event] dissoc key))
+
 (comment
-  (defmethod on-event :1-left [{velocity :velocity}] (println "Density:" velocity))
-  (defmethod on-event :high-left [{velocity :velocity}] (println "Grain Dur:" velocity))
-  (defmethod on-event :2-left [{velocity :velocity}] (println "Freq:" velocity))
-  (defmethod on-event :mid-left [{velocity :velocity}] (println "Freq Dev Noise:" velocity))
-  (defmethod on-event :3-left [{velocity :velocity}] (println "Mod Freq:" velocity))
-  (defmethod on-event :volume-left [{velocity :velocity}] (println "Amp:" velocity))
-  )
+  (start)
+  (stop)
+  (add-handler! :1-left :foo #(println "1-left:" %))
+  (add-handler! :1-left :foo #(println "1-left other:" %))
+  (add-handler! :1-left :bar #(println "1-left bar:" %))
+  (remove-handler! :1-left :bar)
+  (add-handler! :high-left :foo #(println "high-left:" %))
+  (add-handler! :2-left :foo #(println "2-left:" %))
+  (add-handler! :mid-left :foo #(println "mid-left:" %))
+  (add-handler! :3-left :foo #(println "3-left:" %))
+  (add-handler! :volume-left :foo #(println "volume-left:" %)))


end<->json

end<->json

--- src/pp/client/format.cljs
+++ src/pp/client/format.cljs
@@ -1,8 +1,11 @@
 (ns pp.client.format
   (:require [cljfmt.core :refer [reformat-string]]
             [pp.client.util :refer [js-log log]]
+            [clojure.walk :refer [keywordize-keys]]
             [cljs.pprint :as p]
             [cljs.reader :as r]
+            [camel-snake-kebab.core :refer [->kebab-case-keyword]]
+            [camel-snake-kebab.extras :refer [transform-keys]]
             cljsjs.js-beautify
             cljsjs.parinfer))

@@ -13,10 +16,14 @@
     (catch js/Object e
       (assoc {} :error e))))

+(def js-settings {:indent_size           2
+                  :indent_char           " "
+                  :max_preserve_newlines 2})
+
 ;; compose a function to transfor erroneous output
-(def  format-clj (comp reformat-string
-                       #(.-text %)
-                       js/parinfer.indentMode))
+(def format-clj (comp reformat-string
+                      #(.-text %)
+                      js/parinfer.indentMode))

 (defn- pp-str [s]
   (-> s
@@ -32,10 +39,25 @@
                       #(.-text %)
                       js/parinfer.indentMode))

+(def edn->json
+  (let [beautify (fn [in] (js/js_beautify in js-settings))]
+    (comp beautify
+          #(.stringify js/JSON %)
+          clj->js
+          r/read-string)))
+
+(def json->edn
+  (comp
+    format-edn
+    str
+    #(transform-keys ->kebab-case-keyword %)
+    js->clj
+    #(.parse js/JSON %)))
+
 (defn format-input! [style input]
   (case style
     :clj  (normalize-result format-clj input)
     :edn  (normalize-result format-edn input)
-    :json (normalize-result js/js_beautify input {:indent_size           2
-                                                  :indent_char           " "
-                                                  :max_preserve_newlines 2})))
+    :json (normalize-result js/js_beautify input js-settings)
+    :edn->json (normalize-result edn->json input)
+    :json->edn (normalize-result json->edn input)))


clean up aliases

clean up aliases

--- src/leiningen/new/reagent_liveedit/project.clj
+++ src/leiningen/new/reagent_liveedit/project.clj
@@ -60,10 +60,10 @@
     "resources/public/css/dev.min.css" "resources/public/css/dev.css"}}

   :aliases {"fig" ["exec" "-pe" "(use '{{ns-name}}.server.services) (start-figwheel)"]
-            "brepl" ["exec" "-pe" "(use '{{ns-name}}.server.services) (browser-repl)"]
             "server" ["ring" "server"]
             "css" ["garden" "auto"]
-            "tests" ["cljsbuild" "auto" "test"]
+            "autotest" ["cljsbuild" "auto" "test"]
+            "test" ["cljsbuild" "test"]
             "web" ["with-profile" "production" "trampoline" "ring" "server"]
             "dev" ["pdo" "css," "fig," "server"]}


Change compile-time to always emit in self hosted cljs

--- src/main/cljc/mikron/compiler/util_macros.cljc
+++ src/main/cljc/mikron/compiler/util_macros.cljc
@@ -4,6 +4,5 @@
 (defmacro compile-time
   "Emits the body only at compile time."
   [& body]
-  (when #?(:clj  (not (:ns &env))
-           :cljs (re-matches #".*\$macros" (name (ns-name *ns*))))
+  (when #?(:clj (not (:ns &env)))
     `(do ~@body)))


Factor out try-contexts as a macro

Factor out try-contexts as a macro

--- src/main/clojure/com/stuartsierra/lazytest.clj
+++ src/main/clojure/com/stuartsierra/lazytest.clj
@@ -87,6 +87,22 @@
   (or (:after c)
       (some has-after? (:parents c))))

+(defmacro #^{:private true} try-contexts
+  "Creates a try/finally block that opens contexts, stores their state
+  in states, and finally closes contexts.  active is the current map
+  of opened contexts."
+  [active contexts states & body]
+  `(let [active# ~active
+         contexts# ~contexts
+         merged# (reduce open-context active# contexts#)
+         ~states (map merged contexts#)]
+     (try
+      ~@body
+      (finally
+       (reduce close-context merged#
+               ;; Only close contexts that weren't active at start:
+               (filter #(not (contains? active# %))
+                       (reverse contexts#)))))))

 ;;; Assertion types

@@ -103,19 +119,12 @@
 (deftype ContextualAssertion [contexts pred] :as this
   TestInvokable
     (invoke-test [active]
-      (let [merged (reduce open-context active contexts)
-            states (map merged contexts)]
-        (try
-         (if (apply pred states)
-           (TestPassed this states)
-           (TestFailed this states))
-         (catch Throwable t
-           (TestThrown this states t))
-         (finally
-          (reduce close-context merged
-                  ;; Only close contexts that weren't active at start:
-                  (filter #(not (contains? active %))
-                          (reverse contexts))))))))
+      (try-contexts active contexts states
+        (if (apply pred states)
+          (TestPassed this states)
+          (TestFailed this states))
+        (catch Throwable t
+          (TestThrown this states t)))))

 ;;; Container types
@@ -128,27 +137,20 @@
       (try
        (TestResults this (map #(invoke-test % active) children))
        (catch Throwable t
-         (TestThrown this active t)))))
+         (TestThrown this nil t)))))

 (deftype ContextualContainer [contexts children] :as this
   clojure.lang.IFn
     (invoke [] (invoke-test this {}))
   TestInvokable
     (invoke-test [active]
-      (let [merged (reduce open-context active contexts)
-            states (map merged contexts)]
-        (try
-         (let [results (map #(invoke-test % active) children)]
-           ;; Force non-lazy evaluation when contexts need closing:
-           (when (some has-after? contexts) (dorun results))
-           (TestResults this results))
-         (catch Throwable t
-           (TestThrown this states t))
-         (finally
-          (reduce close-context merged
-                  ;; Only close contexts that weren't active at start:
-                  (filter #(not (contains? active %))
-                          (reverse contexts))))))))
+      (try-contexts active contexts states
+        (let [results (map #(invoke-test % active) children)]
+          ;; Force non-lazy evaluation when contexts need closing:
+          (when (some has-after? contexts) (dorun results))
+          (TestResults this results))
+        (catch Throwable t
+          (TestThrown this states t)))))

 ;;; Public API


broke up board view into sub-componetns

broke up board view into sub-componetns

--- src/quick_chess/core.cljs
+++ src/quick_chess/core.cljs
@@ -109,30 +109,24 @@
                               (reset! value c)))}])))

 (defn cell-view
-  "todo"
   [state]
-  )
+  (fn [col-idx elem]
+    ^{:key col-idx} [:td {:style (td-style state (:color elem))}
+                     [:div {:style (piece-style state)} (:piece elem)]
+                     [:div {:style {:text-align "center"}} "_"]]))

 (defn row-view
-  "todo"
   [state]
-  )
+  (fn [row-idx row]
+    ^{:key row-idx} [:tr {:style (tr-style state)}
+                     (map-indexed (cell-view state) row)]))

 (defn board-view
   "the board"
   [state]
   [:table {:style (board-style state)}
    [:tbody
-    (map-indexed
-     (fn [row-idx row]
-       ^{:key row-idx} [:tr {:style (tr-style state)}
-                        (map-indexed
-                         (fn [col-idx elem]
-                           ^{:key col-idx} [:td {:style (td-style state (:color elem))}
-                                            [:div {:style (piece-style state)} (:piece elem)]
-                                            [:div {:style {:text-align "center"}} "_"]])
-                         row)])
-     (:board state))]])
+    (map-indexed (row-view state) (:board state))]])

 (defn app-view
   "main component of our app"


Fixed Build error

Fixed Build error

--- src/redbrick_20/core.cljs
+++ src/redbrick_20/core.cljs
@@ -6,8 +6,7 @@
                 [goog.history.EventType :as EventType]
                 [reagent.core :as reagent]
                 [redbrick-20.views.home :as home]
-                [redbrick-20.views.timeline :as timeline]
-                [redbrick-20.views.cian :as cian]))
+                [redbrick-20.views.timeline :as timeline]))

 (def app-state (reagent/atom {}))


CMR-1239: Fix test failure due to system-int-test running in separate JVM in CI

--- system-int-test/test/cmr/system_int_test/ingest/granule_validation_test.clj
+++ system-int-test/test/cmr/system_int_test/ingest/granule_validation_test.clj
@@ -16,8 +16,7 @@
             [cmr.system-int-test.utils.dev-system-util :as dev-sys-util]
             [cmr.common.time-keeper :as tk]
             [clj-time.format :as tf]
-            [clj-time.core :as t]
-            [cmr.metadata-db.services.concept-constraints :as cc]))
+            [clj-time.core :as t]))

 (use-fixtures :each (ingest/reset-fixture {"provguid1" "PROV1" "provguid2" "PROV2"}))

@@ -365,7 +364,8 @@

 (deftest duplicate-granule-ur-test
   ;; Turn on enforcement of duplicate granule UR constraint
-  (cc/set-enforce-granule-ur-constraint! true)
+  (dev-sys-util/eval-in-dev-sys
+    `(cmr.metadata-db.services.concept-constraints/set-enforce-granule-ur-constraint! true))
   (testing "same granule-ur and native-id across providers is valid"
     (assert-valid
       {}


add ?nogears query string to quickfix performance problems

--- site/src/parinfer_site/gears.cljs
+++ site/src/parinfer_site/gears.cljs
@@ -3,7 +3,8 @@
   (:require-macros
     [cljs.core.async.macros :refer [go go-loop]])
   (:require
-    [cljs.core.async :refer [<! timeout chan alts! close!]]))
+    [cljs.core.async :refer [<! timeout chan alts! close!]]
+    goog.Uri))

 (def default-options
   {:radius 16
@@ -155,4 +156,8 @@
     (doseq [g gear-objs]
       (.push gear-array g))

-    (animate-gears! svg selector gear-map gear-array anim-frames)))
+    ;; I think gears are always animating even when offscreen.
+    ;; The "?nogears" query string is a quick fix to disable it if
+    ;; the CPU is choking on some people's machines.
+    (when-not (= "nogears" (.getQuery (goog.Uri. js/document.location)))
+      (animate-gears! svg selector gear-map gear-array anim-frames))))


Always update the :image-url in graph data.

--- samples/twitterbuzz/src/twitterbuzz/core.cljs
+++ samples/twitterbuzz/src/twitterbuzz/core.cljs
@@ -85,14 +85,11 @@
 (defn update-graph [graph tweet-maps]
   (reduce (fn [acc tweet]
             (let [user (:from_user tweet)
-                  mentions (parse-mentions tweet)]
-              (-> (if-let [existing-node (get acc user)]
-                    (assoc acc user
-                           (assoc existing-node :last-tweet (:text tweet)))
-                    (assoc acc user
-                           {:image-url (:profile_image_url tweet)
-                            :last-tweet (:text tweet)
-                            :mentions {}}))
+                  mentions (parse-mentions tweet)
+                  node (get acc user {:mentions {}})]
+              (-> (assoc acc user
+                         (assoc node :last-tweet (:text tweet)
+                                     :image-url (:profile_image_url tweet)))
                   (add-mentions user mentions))))
           graph
           (map #(select-keys % [:text :from_user :profile_image_url]) tweet-maps)))


Reduce number of system tests

Reduce number of system tests

--- test/com/wsscode/pathom/system_test.clj
+++ test/com/wsscode/pathom/system_test.clj
@@ -107,7 +107,7 @@
          (catch-run-parser (comp <!! async-parser) (assoc env ::p/reader async-reader) query)
          (catch-run-parser fulcro-parser env query)))))

-(test/defspec parser-system {:max-size 12 :num-tests 500} (parser-test-props pct/parser-env))
+(test/defspec parser-system {:max-size 12 :num-tests 200} (parser-test-props pct/parser-env))

 (defn resolve-fn
   [{{::pc/keys [output]} ::pc/resolver-data} _]


Cleaning up and fleshing out marginalia comments/docstrings

--- src/semantic_csv/core.clj
+++ src/semantic_csv/core.clj
@@ -1,3 +1,25 @@
+; ## Higher level CSV parsing functionality
+;
+; The most popular CSV parsing libraries for Clojure presently -- `clojure.data.csv` and `clojure-csv` -- are really focused on handling the _syntax_ of CSV;
+; They take CSV text and transform it into collections of row vectors of string values, providing a minimal translation into the world of data.
+; Semantic CSV takes it the next step by giving you tools for addressing the _semantics_ of your data, helping you put it into the form that better reflects what it means, and what's most useful for you.
+;
+; ## Features
+;
+; To be less abstract about it, `semantic-csv` lets you easily:
+;
+; * Absorb header row as a vector of column names, and return remaining rows as maps of `column-name -> row-val`
+; * Write from a collection of maps, given a pre-specified `:header`
+; * When reading, apply casting functions on a column by column basis (for casting to ints, floats, etc) via `:cast-fns`
+; * When writing, apply formatting functions on a column by column basis via `:format-fns`, when `str` won't cut it
+; * Remove lines starting with comment characters (by default `#`)
+; * An optional "sniffer" that reads in N lines, and uses them to guess column types (SOON)
+;
+; ## This namespace...
+;
+; ...is the core of the API.
+
+
 (ns semantic-csv.core
   (:require [clojure.java.io :as io]
             [clojure.data.csv :as csv]))
@@ -11,7 +33,7 @@

 (defn read-csv-row
-  "Translates a single row of values into a map of colname -> val, given colnames in header.
+  "Translates a single row of values into a map of `colname -> val`, given colnames in header.
   The cast-fn arg should be a vector of translation functions the same length as header and row,
   and will be used to translate the raw string vals in row."
   [header cast-fns row]
@@ -24,27 +46,17 @@
       row)))

-(defn ->int
-  "Convenience function for translating strings into integers"
-  [string]
-  (Integer/parseInt string))
-
-(defn ->float
-  "Convenience function for translating strings into floats"
-  [string]
-  (Float/parseFloat string))
-
-
 (defn read-csv-rows
-  "Given a lines-iter, produces a sequence of hash-maps of col -> val mappings, as specified by
-  a header in file (if specified; indices ow). Options
-    header: bool; consume the first row as a header?
-    comment-re: specify a regular expression to use for commenting out lines, or something falsey
-                if this isn't desired
-    remove-empty: also remove empty rows?
-    cast-fns: optionally cast the vals in the map by applying the corresponding function in
-              (cast-fns row-name) to the string val"
-  [lines-iter & {:keys [comment-re header remove-empty cast-fns]
+  "Given a `lines` collection, produces a seq of maps (`colname -> val`) where the column names are
+  based on the first row's values.
+  * `:header`: bool; consume the first row as a header?
+  * `:comment-re`: specify a regular expression to use for commenting out lines, or something falsey
+     if this isn't desired
+  * `:remove-empty`: also remove empty rows?
+  * `:cast-fns`: optional map of `colname | index -> cast-fn`; row maps will have the values as output by the
+     assigned `cast-fn`.
+              `(cast-fns row-name)` to the string val"
+  [lines & {:keys [comment-re header remove-empty cast-fns]
                  :or   {comment-re   #"^\#"
                         header       true
                         remove-empty true
@@ -54,7 +66,7 @@
                                       (re-find comment-re %))
                                     (when remove-empty
                                       (re-find #"^\s*$" %)))
-                               lines-iter)
+                               lines)
         header (first (csv/read-csv (first non-cmnt-lines)))
         non-cmnt-lines (rest non-cmnt-lines)]
     (map
@@ -68,8 +80,8 @@

 (defn read-csv-file
+  "Read csv in from a filename or file handle. For details see the docstring for read-csv-rows"
   [file-or-filename & opts]
-  "Read csv in from a filename or file handle. For details see the docstring for read-csv-rows"
   (if (string? file-or-filename)
     (with-open [f (io/reader file-or-filename)]
       (doall
@@ -83,3 +95,20 @@
   (apply-kwargs read-csv-rows (clojure.string/split-lines csv-str) opts))

+
+;; ## Some parsing functions for your convenience
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+; These functions can be imported and used in your `:cast-fns` specification
+
+(defn ->int
+  "Translating string into integers"
+  [string]
+  (Integer/parseInt string))
+
+(defn ->float
+  "Translate into float"
+  [string]
+  (Float/parseFloat string))
+
+


IP SPRINT - Added more test runner utility functions.

--- common-lib/src/cmr/common/test/runners/util.clj
+++ common-lib/src/cmr/common/test/runners/util.clj
@@ -1,6 +1,7 @@
 (ns cmr.common.test.runners.util
   (:require
-   [clojure.set :as set]))
+   [clojure.set :as set]
+   [clojure.string :as string]))

 (defn integration-test-namespaces
   "The list of integration test namespaces. Anything that contains 'cmr.' and 'int-test' is
@@ -26,3 +27,38 @@
        (#(set/difference % (set (integration-test-namespaces))))
        vec
        sort))
+
+(defn union-namespaces
+  "Get a collection of combined unit and integration tests. This function is
+  useful for auditing CMR tests, in particular, comparing with the independent
+  results obtained from calling `(get-all-tests)`."
+  []
+  (set/union (integration-test-namespaces)
+             (unit-test-namespaces)))
+
+(defn- -all-cmr-namespaces
+  "Returns the collection of all CMR namespaces, each as a namespace object."
+  []
+  (filter (fn [x] (string/starts-with? (ns-name x) "cmr")) (all-ns)))
+
+(defn all-cmr-namespaces
+  "Returns the collection of all CMR namespaces, each as a namespace string.
+  This matches the return values of the `integration-test-namespaces` and
+  `unit-test-namespaces` functions."
+  []
+  (filter (fn [x] (string/starts-with? x "cmr")) (map ns-name (all-ns))))
+
+(defn get-all-tests
+  "This function is useful for auditing the CMR tests. Given a collection of
+  namespaces, it will search all of them for tests, returning all discovered
+  tests as vars. If no collection of namespaces is passed as an arg, a list
+  of all namepsace objects whose namepsace names beginn with 'cmr' will be
+  used instead."
+  ([]
+    (get-all-tests (-all-cmr-namespaces)))
+  ([nss]
+    (->> nss
+         (map #(vals (ns-interns %)))
+         (flatten)
+         (map #(-> % meta :test))
+         (remove nil?))))


Remove unused code from icons sidebar ns.

--- src/uxbox/main/ui/workspace/sidebar/icons.cljs
+++ src/uxbox/main/ui/workspace/sidebar/icons.cljs
@@ -31,17 +31,6 @@
       (l/derive st/state)))

 ;; --- Icons (Component)
-
-(defn- select-icon
-  [icon]
-  (rs/emit! (dw/select-for-drawing icon)))
-
-(defn- change-icon-coll
-  [local event]
-  (let [value (-> (dom/event->value event)
-                  (read-string))]
-    (swap! local assoc :collid value)
-    (rs/emit! (dw/select-for-drawing nil))))

 (mx/defc icon-wrapper
   {:mixins [mx/static]}


need public slave to have at least 4 cpu

--- src/terraboot/cluster.clj
+++ src/terraboot/cluster.clj
@@ -378,7 +378,7 @@
              (asg "public-slaves"
                   cluster-unique
                   {:image_id current-coreos-ami
-                   :instance_type "m4.large"
+                   :instance_type "m4.xlarge"
                    :sgs [(cluster-unique "public-slave-security-group")
                          (vpc-unique "sends_gelf")]
                    :role (cluster-unique "slave-role")
@@ -430,7 +430,7 @@
              (asg "slaves"
                   cluster-unique
                   {:image_id current-coreos-ami
-                   :instance_type "m4.large"
+                   :instance_type "m4.xlarge"
                    :sgs [(cluster-unique "slave-security-group")
                          (vpc-unique "sends_gelf")]
                    :role (cluster-unique "slave-role")


Expand/collapse grid with blue bar.

Expand/collapse grid with blue bar.

--- sonic-jam/src/sonic_jam/core.cljs
+++ sonic-jam/src/sonic_jam/core.cljs
@@ -15,11 +15,12 @@
                :magenta "#d33682"
                :violet "#6c71c4"
                :blue "#268bd2"
+               :faded-blue "#134569" ; custom color
                :cyan "#2aa198"
                :green "#859900"
                :base03 "#002b36"
                :base02 "#073642"
-               :base0102 "#1B444E" ; between base01 and base02
+               :base0102 "#1B444E" ; custom color: between base01 and base02
                :base01 "#586e75"
                :base00 "#657b83"
                :base0 "#839496"
@@ -34,6 +35,7 @@
             :on (:green pallette)
             :off (:base02 pallette)
             :link (:blue pallette)
+            :link-bar (:faded-blue pallette)
             :bar (:base02 pallette)})

 (defonce app-state (atom {:grids {}
@@ -679,34 +681,35 @@
     (render-state [_ state]
       (let [cursor (get (om/observe owner (grids)) id)
             name (get cursor "name")]
-        (dom/div #js {:style #js {:borderLeft (str "solid 12px " (:bar theme))
-                                  :paddingLeft "10px"}}
-                 (if-not (:grid-expanded state)
-                   (dom/div nil
-                            (dom/p style-grey
-                                   (dom/span #js {:onClick #(om/set-state! owner :grid-expanded true)
-                                                  :style #js {:color (:link theme)}} "+")))
-                   (dom/div nil
-                            (dom/p style-grey
-                                   (dom/span #js {:onClick #(om/set-state! owner :grid-expanded false)
-                                                  :style #js {:color (:link theme)}}
-                                             (str "- "))
-                                   (dom/span nil (str name " "))
-                                   (om/build grid-editor {:id id
-                                                          :set-state-ch (:set-state-ch state)
-                                                          :cursor cursor}))
-                            (dom/table nil
-                                       (apply dom/tbody nil
-                                              (let [cursors (map #(hash-map :cursor %1 :track-id (get %1 "id")
-                                                                            :id %2 :delete-ch %3 :beat-cursors %4)
-                                                                 (get cursor "tracks")
-                                                                 (repeat id)
-                                                                 (repeat (:delete-ch state))
-                                                                 (if (nil? beat-cursors) (repeat nil) beat-cursors))]
-                                                (om/build-all track-view cursors {:state state :key :track-id}))))
-                            (om/build track-builder {:cursor (get cursor "tracks")
-                                                     :id id
-                                                     :set-state-ch (:set-state-ch state)}))))))))
+        (dom/table nil
+                   (dom/tbody nil
+                              (dom/td #js {:onClick #(om/set-state! owner :grid-expanded
+                                                                    (not (:grid-expanded state)))
+                                           :style #js {:background (:link-bar theme)
+                                                       :color (:link theme)}}
+                                      (if (:grid-expanded state) " - " " + "))
+
+                              (dom/td #js {:style #js {:padding "0 0 0 10px"}}
+                                      (if-not (:grid-expanded state)
+                                        (dom/div nil " ")
+                                        (dom/div nil
+                                                 (dom/p style-grey
+                                                        (dom/span nil (str name " "))
+                                                        (om/build grid-editor {:id id
+                                                                               :set-state-ch (:set-state-ch state)
+                                                                               :cursor cursor}))
+                                                 (dom/table nil
+                                                            (apply dom/tbody nil
+                                                                   (let [cursors (map #(hash-map :cursor %1 :track-id (get %1 "id")
+                                                                                :id %2 :delete-ch %3 :beat-cursors %4)
+                                                                                (get cursor "tracks")
+                                                                                (repeat id)
+                                                                                (repeat (:delete-ch state))
+                                                                                (if (nil? beat-cursors) (repeat nil) beat-cursors))]
+                                                                     (om/build-all track-view cursors {:state state :key :track-id}))))
+                                                 (om/build track-builder {:cursor (get cursor "tracks")
+                                                                          :id id
+                                                                          :set-state-ch (:set-state-ch state)}))))))))))

 (defn error-view [cursor]
   (reify


Update store API docs

Update store API docs

--- src/icecap/store/api.clj
+++ src/icecap/store/api.clj
@@ -6,15 +6,13 @@
   (create! [store index blob]
     "Stores `blob` at `index`.

-    Returns a core.async chan that will close when the blob has been
-    stored.")
+    Returns a deferred that will fire when the blob has been stored.")
   (retrieve [store index]
     "Get the blob at `index`.

-     Returns a core.async chan that returns the stored blob, then
-     closes. If the blob does not exist, just closes the channel.")
+     Returns a deferred that fires with the stored blob or `nil`.")
   (delete! [store index]
     "Delete the blob at `index`.

-    Returns a core.async chan that will close when the blob has been
-    deleted, even if there wasn't a blob at `index`."))
+    Returns a deferred that fires when the blob has been deleted, even if
+    there wasn't a blob at `index`."))


allow multiple hosts, fixes #53

allow multiple hosts, fixes #53

--- src/io/cyanite/store.clj
+++ src/io/cyanite/store.clj
@@ -143,7 +143,8 @@
     :or   {hints {:replication {:class "SimpleStrategy"
                                 :replication_factor 1}}}}]
   (info "creating cassandra metric store")
-  (let [session (-> (alia/cluster {:contact-points [cluster]})
+  (let [cluster (if (sequential? cluster) cluster [cluster])
+        session (-> (alia/cluster {:contact-points cluster})
                     (alia/connect keyspace))
         insert! (insertq session)
         fetch!  (fetchq session)]


Table is now a single component, no table row!

--- src-cljs/kixi/hecuba/main_om.cljs
+++ src-cljs/kixi/hecuba/main_om.cljs
@@ -9,14 +9,6 @@

 (enable-console-print!)

-(defn table-row [data owner cols]
-  (om/component
-      (apply dom/tr nil
-             (for [col cols]
-               (let [d (get data col)
-                     sd (if (keyword? d) (name d) (str d))]
-                 (dom/td nil (if (#{:hecuba/href :hecuba/parent-href} col) (dom/a #js {:href sd} sd) sd)))))))
-
 (defn table [data owner]
   (om/component
       (dom/div #js {:className "table-responsive"}
@@ -25,9 +17,13 @@
                      (apply dom/tr nil
                             (for [col (:cols data)]
                               (dom/th nil (name col)))))
-                (dom/tbody nil
-                     (om/build-all table-row (:rows data)
-                         {:key :hecuba/id :opts (:cols data)}))))))
+                (apply dom/tbody nil
+                       (for [row (:rows data)]
+                         (apply dom/tr nil
+                              (for [col (:cols data)]
+                                (let [d (get row col)
+                                      sd (if (keyword? d) (name d) (str d))]
+                                  (dom/td nil (if (#{:hecuba/href :hecuba/parent-href} col) (dom/a #js {:href sd} sd) sd)))))))))))

 (defn blank-tab [data owner]
   (om/component


Revert "CMR-2379 Possibly fix a breaking CI test"

This reverts commit ea5bab0a080e69e6b45f1600b7420d86c921c485.

--- umm-lib/project.clj
+++ umm-lib/project.clj
@@ -6,8 +6,7 @@

   :dependencies [[org.clojure/clojure "1.7.0"]
                  [nasa-cmr/cmr-common-lib "0.1.1-SNAPSHOT"]
-                 [nasa-cmr/cmr-spatial-lib "0.1.0-SNAPSHOT"]
-                 [nasa-cmr/cmr-umm-spec-lib "0.1.0-SNAPSHOT"]]
+                 [nasa-cmr/cmr-spatial-lib "0.1.0-SNAPSHOT"]]

   :plugins [[lein-test-out "0.3.1"]]

@@ -33,3 +32,5 @@
          :source-paths ["src" "dev" "test"]
          :injections [(require 'pjstadig.humane-test-output)
                       (pjstadig.humane-test-output/activate!)]}})
+
+


Fire my dvorak input key event.

Fire my dvorak input key event.

--- src/app/cljs/one/sample/view.cljs
+++ src/app/cljs/one/sample/view.cljs
@@ -4,13 +4,15 @@
                        by-class value set-value! set-text! nodes single-node set-attr!]]
         [domina.xpath :only [xpath]]
         [one.browser.animation :only [play]]
-        [one.logging :only [info, get-logger]])
+        [one.logging :only [info, get-logger]]
+        [goog.dom.selection :only [getStart setStart setEnd getEnd]])
   (:require-macros [one.sample.snippets :as snippets])
   (:require [goog.events.KeyCodes :as key-codes]
             [goog.events.KeyHandler :as key-handler]
             [clojure.browser.event :as event]
             [one.dispatch :as dispatch]
-            [one.sample.animation :as fx]))
+            [one.sample.animation :as fx]
+            [one.sample.dvorak :as dvorak]))

 (def ^{:doc "A map which contains chunks of HTML which may be used
   when rendering views."}
@@ -112,14 +114,49 @@
   and renders a view based on the value of the `:state` key."
   :state)

+(defn relevant-keypress-event
+  [event]
+  (not (or (.-ctrlKey event)
+           (.-metaKey event)
+           (= (.-keyCode event) key-codes/BACKSPACE)
+           (= (.-keyCode event) key-codes/TAB)
+           (= (.-keyCode event) key-codes/ENTER)
+           (not (key-codes/isTextModifyingKeyEvent event)))))
+
+(defn translate-keypress-event
+  [text-box event]
+  (let [start (getStart text-box)
+        end (count (value text-box))
+        prefix (apply str (take start (value text-box)))
+        suffix (apply str (take-last (- end (getEnd text-box)) (value text-box)))]
+    (set-value! (single-node text-box)
+                (clojure.string/join [prefix
+                                      (dvorak/simulate-dvorak (.fromCharCode js/String (.-charCode event)))
+                                      suffix]))
+    (setStart text-box (+ start 1))
+    (setEnd text-box (+ start 1)))
+  )
+
 (defmethod render :init [_]
   (fx/initialize-views (:form snippets) (:greeting snippets))
   (add-input-event-listeners "name-input")

-  (event/listen (by-id "text-dvorak-input")
-                "keydown"
-                (fn [e] (.preventDefault e)))
-
+  (one.logging/start-display (one.logging/console-output))
+
+  (let [text-box (by-id "text-dvorak-input")]
+      (event/listen (goog.events.KeyHandler. text-box)
+                    "key"
+                    (fn [e]
+                      (when (relevant-keypress-event e)
+                        (translate-keypress-event text-box e)
+                        (dispatch/fire :dvorak-input {
+                                                      :charcode (.-charCode e)
+                                                      :region-start (getStart text-box)
+                                                      :region-end (getEnd text-box)
+                                                      :target text-box
+                                                      })
+                        (.preventDefault e)))))
+
   (event/listen (by-id "greet-button")
                 "click"
                 #(dispatch/fire :greeting


merging in vijual and having it be default print display.

--- src/overtone/core/sc.clj
+++ src/overtone/core/sc.clj
@@ -622,36 +622,48 @@
    (let [ctls? (if (or (= 1 ctls?) (= true ctls?)) 1 0)]
     (snd "/g_queryTree" id ctls?)
     (let [tree (:args (recv "/g_queryTree.reply" REPLY-TIMEOUT))]
-      (parse-node-tree tree)))))
-
-(defn- render-group-node-str-for-vijual
-  [node]
-  (str "Group " (node :group)))
-
-(defn- render-synth-node-str-for-vijual
-  [node]
-  (str "Synth " (node :id) " " (node :synth)))
-
-(defn- render-node-str-for-vijual
+      (with-meta (parse-node-tree tree)
+                 {:type ::node-tree})))))
+
+; Note: If we really want to render other node types this should be a multimethod.
+(defn- vijual-node
   [node]
   (cond
-   (contains? node :group) (render-group-node-str-for-vijual node)
-   (contains? node :synth) (render-synth-node-str-for-vijual node)
-   (true) (throw (Exception. "Please implement a vijual node renderer for this node type"))
-   ))
+   (contains? node :group)     (str "Group " (node :group))
+   (contains? node :synth)     (str "Synth " (node :id) " " (node :synth))
+   (contains? node :synth-set) (str (count (node :ids)) " Synths " (node :synth-set))
+   (true) (throw (Exception. "Please implement a vijual node renderer for this node type"))))
+
+(defn- vijual-synths
+  [node-list]
+  (let [synth-matcher    #(% :synth)
+        synths           (filter synth-matcher node-list)
+        non-synths       (filter (complement synth-matcher) node-list)
+        compact          #(remove nil? %)
+        compacted-synths (reduce (fn [sum node] (update-in sum [(node :synth) :ids]
+                                                           #(-> (conj [(node :id)] %) flatten compact)))
+                                 {} synths)
+        synth-sets       (into [] (map (fn [[k v]] (if (< 1 (count (v :ids)))
+                                                     {:synth-set k :ids (v :ids)}
+                                                     {:synth k :id (first (v :ids))}))
+                                       compacted-synths))]
+       (into non-synths synth-sets)))

 (defn- prepare-tree-for-vijual
   [tree]
-  (let [node     (render-node-str-for-vijual (dissoc tree :children))
+  (let [node     (vijual-node (dissoc tree :children))
         children (tree :children)]
     (if (pos? (count children))
-      (apply conj [node] (for [i children] (prepare-tree-for-vijual i)))
+      (apply conj [node] (for [i (vijual-synths children) ] (prepare-tree-for-vijual i)))
       [node])))

 (defn print-node-tree
   "Pretty print the tree of live synthesizer instances.  Takes the same args as (node-tree)."
   [& args]
   (draw-tree [(prepare-tree-for-vijual (apply node-tree args))]))
+
+(defmethod clojure.core/print-method ::node-tree [tree writer]
+  (print-method (draw-tree [(prepare-tree-for-vijual tree)]) writer))

 (defn prepend-node
   "Add a synth node to the end of a group list."


update active-synth-nodes* before sending osc message. Fixes #103

--- src/overtone/sc/node.clj
+++ src/overtone/sc/node.clj
@@ -190,8 +190,8 @@
            target (to-synth-id target)
            pos    (or pos 1)
            snode  (SynthGroup. id target position (atom :loading))]
+       (swap! active-synth-nodes* assoc id snode)
        (snd "/g_new" id pos target)
-       (swap! active-synth-nodes* assoc id snode)
        snode)))

 (defn- group-free*


A little bit of cleanup and docs in api server code

--- src/polismath/server.clj
+++ src/polismath/server.clj
@@ -18,7 +18,9 @@
             [bidi.bidi :as bidi]
             [bidi.ring]))

-;(ns-unalias *ns* 'env)
+
+;; First we'll just set up some basic helpers and settings/variables we'll need.
+;; We'll really want to move these to the configuration component when that exists. XXX

 (def tmp-dir "/tmp/")
 (defn full-path [filename] (str tmp-dir filename))
@@ -28,6 +30,9 @@
 (defn full-url
   [& path]
   (apply str app-url-base "/" path))
+
+
+;; A ping handler will just be for debugging purposes

 (defn ping-handler
   "Simple ping handler. Returns response with edn representation of the request as the body.
@@ -38,8 +43,13 @@
    :params {:stuff "the x y"}
    :body (with-out-str (clojure.pprint/pprint request))})

+
+;; The filename is actually pretty iportant.
+;; It should be unique between different expors, as is used as the identifying key for the aws buckets, mongo
+;; tracking and as part of the API requests.
+
 (defn generate-filename
-  "Generates a filename"
+  "Generates a filename based on request-params"
   [{:keys [zid zinvite at-date format] :as request-params}]
   (let [zinvite (or zinvite (export/get-zinvite-from-zid zid))
         last-updated (or at-date (System/currentTimeMillis))
@@ -47,17 +57,23 @@
         path (str "/tmp/polis-export-" zinvite "-" last-updated "." ext)]
     path))

-;; config component => parameterization system?
+
+;; The following is really just a bunch of parameter parsing stuff.
+;; Tihs could all possibly be interwoven with the config component as well.
+
 (defn ->int
+  "Try to parse as an integer; return nil if not possible."
   [x]
   (try (Integer/parseInt x)
        (catch Exception e nil)))

-
 (def parsers {:zid ->int
               :zinvite ->int})
+
 (def allowed-params #{:filename :zid :zinvite :at-date :format})
+
 (defn parsed-params
+  "Parses the params for a request, occording to parsers."
   [params]
   (reduce
     (fn [m [k v]] (if (allowed-params k)
@@ -66,10 +82,9 @@
     {}
     params))

-;; Mmm... how to delete pending submissions that get canceled due to a server restart? maybe we keep track of
-;; a global of what processing are running and for which exports, and look at that when we get a status
-;; request
-
+
+;; We use mongo to persists the status of our exports, and data needed for downloading from AWS.
+;; Here, we're setting up basic mongo read and write helpers.

 (defn update-export-status
   [filename document]
@@ -80,27 +95,22 @@
                                                   :filename filename
                                                   :lastupdate (System/currentTimeMillis)))
              {:upsert true}))
-;(update-export-status "testfilenamedeleteme" {:status :pending})

 (defn get-export-status
   [filename]
   (mc/find-one (db/mongo-db (:env/env :mongolab-uri))
                (db/mongo-collection-name "exports")
                {:filename filename}))
-;(get-export-status "testfilenamedeleteme")
-
-(defn run-datadump
-  [filename {:keys [params] :as request}]
-  (let [params (parsed-params params)
-        ;; The dissoc is just a vague security measure
-        request-params (-> request
-                           :params
-                           (dissoc :env-overrides)
-                           (assoc :filename (full-path filename)))]
-    (export/export-conversation request-params)
-    filename))
-
-;; move to component; uncomment on commit
+
+(defn notify-mongo
+  [filename status params]
+  (update-export-status filename {:status status :params params}))
+
+
+;; We use AWS to store conversation exports whcih took a long time to compute.
+;; These exports are set to expire automatically.
+
+;; move to component; uncomment on commit XXX
 ;(def aws-cred {:access-key (env/env :aws-access-key)
                ;:secret-key (env/env :aws-secret-key)})

@@ -114,10 +124,6 @@
                  :bucket-name "polis-datadump"
                  :key (full-aws-path filename)
                  :file (full-path filename)))
-
-(defn notify-mongo
-  [filename status params]
-  (update-export-status filename {:status status :params params}))

 (defn handle-completion!
   [aws-cred filename params]
@@ -133,78 +139,20 @@
   (go (when-let [late-result (<! compute-chan)]
         (handle-completion! aws-cred filename params))))

-
-(defn redirect-to-aws-url
-  [aws-cred filename]
-  (response/redirect
-    (s3/generate-presigned-url aws-cred "polis-datadump" (full-aws-path filename) (-> 1 time/hours time/from-now))))
-
-(def respond-404
-  {:status 404
-   :headers {"Content-Type" "text/plain"}
-   :body "Unknown, incomplete or expired conversation export"})
-
-
-(defn make-filename-request-handler
-  [aws-cred]
-  (fn [{:keys [params] :as request}]
-    (let [filename (get params :filename)]
-      (if (= (get (get-export-status filename) "status") "complete")
-        ;; Have to think about the security repercussions here. Would be nice if we could stream this and never
-        ;; expose the link here. XXX
-        (redirect-to-aws-url aws-cred filename)
-        respond-404))))
-
-(defn get-status-location-url
-  [filename]
-  (full-url (str "datadump/status?filename=" filename)))
-
-(defn check-back-response
-  ([filename status]
-   {:status  status
-    :headers {"Content-Type" "text/plain"
-              "Location" (get-status-location-url filename)}
-    :body    "Request is processing, but cannot be returned now. Please check back later with the same request url."})
-  ([filename] (check-back-response 202)))
-
-(defn get-datadump-url
-  [filename]
-  (full-url (str "datadump/results?filename=" filename)))
-
-(defn complete-response
-  [filename]
-  {:status  201
-   :headers {"Content-Type" "text/plain"
-             "Location"     (get-datadump-url filename)}
-   :body    "Export is complete. Download at the Location url specified in the header"})
-
-
-(defn get-datadump-status-handler
-  [{:keys [params] :as request}]
-  (let [filename (:filename params)]
-    (case (-> filename get-export-status (get "status"))
-      ("pending" "started" "processing") (check-back-response filename 200)
-      "complete"                         (complete-response filename)
-      ;; In case we don't match, 404
-      respond-404)))
-
-
-(defn get-datadump-handler
-  [{:keys [params] :as request}]
-  ;(let [datadump (async/thread (Thread/sleep 3000) (big-comp))
-  (let [filename (generate-filename request)
-        datadump (async/thread (run-datadump filename request))
-        timeout (async/timeout 2000)
-        [done? _] (async/alts!! [datadump timeout])]
-    (if done?
-      (do
-        (handle-completion! aws-cred filename params)
-        (response/file-response (full-path filename)))
-      (do
-        (handle-timedout-datadump! aws-cred datadump filename params)
-        (check-back-response filename)))))
-
-
+(defn generate-aws-url!
+  "Generate a presigned url from amazon for the given filename. Optionally set an expiration in hours (defaulting to the number
+  sourced from env variable :download-link-expiration."
+  ([aws-cred filename expiration]
+   ;; XXX more env/env stuff
+   (let [expiration (-> expiration time/hours time/from-now)]
+     (s3/generate-presigned-url aws-cred "polis-datadump" (full-aws-path filename) expiration)))
+  ([aws-cred filename]
+   (let [expiration (->int (:download-link-expiration env/env))]
+     (generate-aws-url! aws-cred filename expiration))))
+
+
+;; What follows is the guts of our responding and computing.
+;; The outline of what this looks like is as follows:

 ;; get export params
 ;;   * notify-mongo (:started)
@@ -235,6 +183,105 @@
 ;;       * send link for download.

+;; General helpers..
+
+(def respond-404
+  {:status 404
+   :headers {"Content-Type" "text/plain"}
+   :body "Unknown, incomplete or expired conversation export"})
+
+
+;; Requests for exported files in aws.
+;;
+
+(defn redirect-to-aws-url
+  "Creates a redirection response, which redirects to the aws download link."
+  [aws-cred filename]
+  (response/redirect
+     (generate-aws-url! aws-cred filename)))
+
+(defn make-filename-request-handler
+  "Given aws-creds, returns a function handler function which responds to requests for an existing file on AWS."
+  [aws-cred]
+  (fn [{:keys [params] :as request}]
+    (let [filename (get params :filename)]
+      (if (= (get (get-export-status filename) "status") "complete")
+        ;; Have to think about the security repercussions here. Would be nice if we could stream this and never
+        ;; expose the link here. XXX
+        (redirect-to-aws-url aws-cred filename)
+        respond-404))))
+
+
+;; Requests for checking the status of a computation
+
+(defn get-datadump-url
+  [filename]
+  (full-url (str "datadump/results?filename=" filename)))
+
+(defn complete-response
+  [filename]
+  {:status  201
+   :headers {"Content-Type" "text/plain"
+             "Location"     (get-datadump-url filename)}
+   :body    "Export is complete. Download at the Location url specified in the header"})
+
+(defn get-datadump-status-handler
+  [{:keys [params] :as request}]
+  (let [filename (:filename params)]
+    (case (-> filename get-export-status (get "status"))
+      ("pending" "started" "processing") (check-back-response filename 200)
+      "complete"                         (complete-response filename)
+      ;; In case we don't match, 404
+      respond-404)))
+
+
+;; Top level; either run and return the computation results, or set things up for a 202-lifecycle to be
+;; completed down the road.
+
+(defn get-status-location-url
+  [filename]
+  (full-url (str "datadump/status?filename=" filename)))
+
+(defn check-back-response
+  ([filename status]
+   {:status  status
+    :headers {"Content-Type" "text/plain"
+              "Location" (get-status-location-url filename)}
+    :body    "Request is processing, but cannot be returned now. Please check back later with the same request url."})
+  ([filename] (check-back-response 202)))
+
+(defn run-datadump
+   "Based on params this actually runs the export-conversation computation."
+  [filename {:keys [params] :as request}]
+  (let [params (parsed-params params)
+        ;; The dissoc is just a vague security measure
+        request-params (-> request
+                           :params
+                           (dissoc :env-overrides)
+                           (assoc :filename (full-path filename)))]
+    (export/export-conversation request-params)
+    filename))
+
+(defn get-datadump-handler
+  "Main handler function; Attempts to return a datadump file within within a set amount of time, and if it can't, will
+  respond with a 202, and set up a process for obtaining the results once they're done."
+  [{:keys [params] :as request}]
+  (let [filename (generate-filename request)
+        datadump (async/thread (run-datadump filename request))
+        timeout (async/timeout 2000)
+        [done? _] (async/alts!! [datadump timeout])]
+    (if done?
+      (do
+        (handle-completion! aws-cred filename params)
+        ;(response/file-response "6sc6vt-export.zip") ; XXX
+        (response/file-response (full-path filename)))
+      (do
+        (handle-timedout-datadump! aws-cred datadump filename params)
+        (check-back-response filename)))))
+
+
+;; Route everything together, build handlers, etc
+
 (def routes
   ["/" {"ping"     ping-handler
         "datadump" {""        get-datadump-handler
@@ -243,8 +290,6 @@

 (def handler
   (bidi.ring/make-handler routes))
-
-   ;(response/file-response "6sc6vt-export.zip"))

 (def app
   {:handler
@@ -253,15 +298,17 @@
        ring.params/wrap-params
        )})

-;; Enter component:
-;; This is a bit of a hack right now, since the rest of our system is not in components... But whatevs.
-
 (defn get-port
   [default]
   (or (try
         (Double/parseDouble (:server-port env/env))
         (catch Exception e default))))

+;; Enter component:
+;; This is a bit of a hack right now, since the rest of our system is not in components... But whatevs. XXX
+;; In short we're creating a reference to hold our server, and setting up functions for starting, stopping and
+;; reloading that reference.
+
 (defonce http-server
   (jetty-server {:app app, :port (get-port 3000)}))

@@ -287,6 +334,8 @@
   (stop-server!)
   )

+;; For sketching and REPLING
+
 (comment
   (require '[clj-http.client :as client])

@@ -297,3 +346,16 @@
   )

+;; TODO / Thoughts
+
+;; Mmm... how to delete pending submissions that get canceled due to a server restart? maybe we keep track of
+;; a global of what processing are running and for which exports, and look at that when we get a status
+;; request
+
+;; Auto retry conversations that somehow fail based on heart beat?
+
+;; Require zinvite from ser request for downloaded conv, so that it's easier to secure
+
+;; Expire entries in mongo; or lifecycle of checking for old mongo reords
+
+


Alter wording in comments.

Alter wording in comments.

--- src/re_frame/router.cljs
+++ src/re_frame/router.cljs
@@ -59,14 +59,14 @@
 ;;     which will run event processing after the next Reagent animation frame.
 ;;

-;; Events can have metadata which say to pause event processing.
+;; Events can have metadata which says to pause event processing.
 ;; event metadata -> "run later" functions
 (def later-fns
   {:flush-dom (fn [f] ((.-after-render reagent.core) #(goog.async.nextTick f)))   ;; one tick after the end of the next annimation frame
    :yield     goog.async.nextTick})           ;; almost immediately

-;; Abstract representation of the Queue
+;; Abstract representation of the Event Queue
 (defprotocol IEventQueue

   ;; -- API
@@ -100,7 +100,7 @@
     (-fsm-trigger this :add-event event))

   (add-post-event-callback [_ callback-fn]
-    ;; register a callback function to be called after each event is processed
+    ;; register a callback function which will be called after each event is processed
     (set! post-event-callback-fns (conj post-event-callback-fns callback-fn)))

   (remove-post-event-callback [_ callback-fn]
@@ -204,8 +204,8 @@

 ;; ---------------------------------------------------------------------------
 ;; Event Queue
-;; When "dispatch" is called, the event is added into this queue.  Later the queue
-;; will "run" and the event will be "handled" by the registered function.
+;; When "dispatch" is called, the event is added into this event queue.  Later,
+;;  the queue will "run" and the event will be "handled" by the registered function.
 ;;
 (def event-queue (->EventQueue :idle  #queue [] []))


example updates

example updates

--- example/src/example/core.cljs
+++ example/src/example/core.cljs
@@ -24,11 +24,12 @@
 ;; your web inspector.
 (println "this is a reloaded print statement yeppers")

-;; Example 1 :  simple crate based app
+;; Example 1:  simple crate based app

 ;; Try editing the example below and watch how the live reloading
-;; responds.  This is a rough example meant to quickly demonstrates
-;; what is appropriate to reload and not.
+;; responds.  This is a rough example meant to quickly demonstrate
+;; the reloading behavior. Notice that state is maintained and your
+;; code updates are reflected in the browser.

 ;; define atom once
 (lr/defonce ex1-atom (atom {:r 0 :g 0 :b 0}))


hack up the target calcs some more

hack up the target calcs some more

--- src/block_chain/miner.clj
+++ src/block_chain/miner.clj
@@ -41,8 +41,17 @@
 (defn adjusted-target [blocks frequency]
   (let [times (map #(get-in % [:header :timestamp]) blocks)
         latest-target (get-in (last blocks) [:header :target])
-        ratio (/ frequency (avg-spacing times))]
-    (hex-string (bigint (* ratio
+        ratio (/ (avg-spacing times) frequency)]
+    (println "times: " times)
+    (println "latest t: " latest-target)
+    (println "avg spacing: " (avg-spacing times))
+    (println "ratio: " ratio)
+    (if (> ratio 1)
+      (hex-string (bigint (* 1.1
+                             (hex->int latest-target))))
+      (hex-string (bigint (* 0.9
+                           (hex->int latest-target)))))
+    #_(hex-string (bigint (* ratio
                            (hex->int latest-target))))))

 (defn next-target
@@ -52,8 +61,8 @@
   []
   (let [recent-blocks (take-last 10 @bc/block-chain)]
     (if (and recent-blocks (> (count recent-blocks) 5))
-      (adjusted-target recent-blocks 30)
-      (hex-string (math/expt 2 234)))))
+      (adjusted-target recent-blocks 15)
+      (hex-string (math/expt 2 237)))))

 (defn generate-block
   [transactions]
@@ -74,10 +83,15 @@
   ([block] (mine block (atom true)))
   ([block switch]
    (let [attempt (hashed block)]
+     (when (= 0 (mod (get-in attempt [:header :nonce]) 1000000))
+       (println "got to nonce: " (get-in attempt [:header :nonce])))
      (if (meets-target? attempt)
        attempt
-       (recur (update-in block [:header :nonce] inc)
-              switch)))))
+       (if (not @switch)
+         (do (println "exiting")
+             nil)
+         (recur (update-in block [:header :nonce] inc)
+              switch))))))

 (defn coinbase []
   {:inputs []
@@ -92,16 +106,17 @@
   (into []
         (map txn/hash-txn [(coinbase)])))

-(def mine? (atom true))
+(defonce mine? (atom true))
 (defn stop-miner! [] (reset! mine? false))

 (defn mine-block
   ([] (mine-block (generate-block (gather-transactions))))
   ([pending]
    (println "****** Will Mine Block: ******\n" pending "\n***************************")
-   (let [b (mine pending mine?)]
-     (println "****** Successfully Mined Block: ******\n" b "\n***************************")
-     (bc/add-block! b))))
+   (if-let [b (mine pending mine?)]
+     (do (println "****** Successfully Mined Block: ******\n" b "\n***************************")
+         (bc/add-block! b))
+     (println "didn't find coin, exiting"))))

 (defn run-miner! []
   (reset! mine? true)


fix: [bug] error-handling: upload: non-csv files

--- src/bulk_trader/core.cljs
+++ src/bulk_trader/core.cljs
@@ -1,7 +1,8 @@
 (ns ^:figwheel-always bulk-trader.core
+    (:require-macros [cljs.core.async.macros :refer [go]])
     (:require [om.core :as om :include-macros true]
-              [om.dom :as dom :include-macros true]
               [sablono.core :as html :refer-macros [html]]
+              [cljs.core.async :refer [put! chan <!]]

               [bulk-trader.globals :as g]
               [bulk-trader.parse :as p]
@@ -92,10 +93,11 @@
   (.preventDefault e)
   (let [file (aget (.. e -target -parentNode -firstChild -files) 0)
         reader (js/FileReader.)]
-    ;; set "onload" event handler for reader
-    (set! (.-onload reader)
-          (fn [event]
-            (save-data (.. event -target -result) event)))
+    (if (or (= "text/csv" (.-type file)) (= "application/ms-excel" (.-type file)))
+      (set! (.-onload reader) ; set "onload" event handler for reader
+            (fn [event]
+              (save-data (.. event -target -result) event)))
+      (js/alert "Please upload a .csv file"))
     ;; fire "read" event
     (.readAsText reader file)))