rejigger tield tests

rejigger tield tests

--- src/test/clojure/me/moocar/logbackgelf/end_to_end_test.clj
+++ src/test/clojure/me/moocar/logbackgelf/end_to_end_test.clj
@@ -68,7 +68,7 @@
   [config]
   {:pre [(map? config)]}
   (let [appender-type (:type (:appender config))]
-    [:configuration {:debug "true"}
+    [:configuration #_{:debug "true"}
      [:appender {:name "GELF Appender"
                  :class (get appender-classes appender-type)}
       [:remoteHost "localhost"]
@@ -178,6 +178,22 @@
   (gen/map (gen/such-that (comp pos? count) gen/string-alphanumeric)
            (gen/such-that (comp pos? count) gen/string-alphanumeric)))

+(def field-types
+  [["int" gen/int]
+   ["Integer" gen/int]
+   ["long" gen/int]
+   ["Long" gen/int]
+   ;; Hard to get float testing working with json serialization
+;   ["float" (gen/fmap double gen/ratio)]
+;   ["Float" (gen/fmap double gen/ratio)]
+   ["double" (gen/fmap double gen/ratio)]
+   ["Double" (gen/fmap double gen/ratio)]])
+
+(defn field-gen []
+  (gen/bind (gen/elements field-types)
+            (fn [[name gen]]
+              (gen/tuple (gen/return name) gen))))
+
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; Tests

@@ -256,22 +272,6 @@
       (let [json (wait msg-ch)]
         (is (= "www013" (:_node_name json)))))))

-(def field-types
-  [["int" gen/int]
-   ["Integer" gen/int]
-   ["long" gen/int]
-   ["Long" gen/int]
-   ;; Hard to get float testing working with json serialization
-;   ["float" (gen/fmap double gen/ratio)]
-;   ["Float" (gen/fmap double gen/ratio)]
-   ["double" (gen/fmap double gen/ratio)]
-   ["Double" (gen/fmap double gen/ratio)]])
-
-(defn field-gen []
-  (gen/bind (gen/elements field-types)
-            (fn [[name gen]]
-              (gen/tuple (gen/return name) gen))))
-
 (defn t-field-types [system]
   (prop/for-all [[field-type field-val] (field-gen)
                  field-name (gen/not-empty gen/string-alphanumeric)]


CMR-1841: Fixed some failing tests. more tests need to be fixed

--- umm-spec-lib/src/cmr/umm_spec/test/expected_conversion.clj
+++ umm-spec-lib/src/cmr/umm_spec/test/expected_conversion.clj
@@ -501,11 +501,26 @@
       (update-in-each [:VerticalSpatialDomains] fix-iso-vertical-spatial-domain-values)
       prune-empty-maps))

-(defn- expected-organization
-  [organization]
-  (update-in organization [:Party :RelatedUrls]
-             (fn [urls]
-               (seq (map #(assoc % :ContentType nil) urls)))))
+(defn- expected-person
+  [person]
+  (when-let [{:keys [FirstName MiddleName LastName]} person]
+    (-> person
+        (assoc :Uuid nil :FirstName nil :MiddleName nil)
+        (assoc :LastName (str/join
+                                " " (remove nil? [FirstName MiddleName LastName]))))))
+
+(defn- update-with-expected-party
+  "Update the given organization or personnel with expected person in the party"
+  [p]
+  (update-in p [:Party] #(update-in % [:Person] expected-person)))
+
+(defn- expected-responsibility
+  [responsibility]
+  (-> responsibility
+      (update-in [:Party :RelatedUrls] (fn [urls]
+                                         (seq (map #(assoc % :ContentType nil) urls))))
+      update-with-expected-party))
+

 (defmethod convert-internal :iso19115
   [umm-coll _]
@@ -525,7 +540,8 @@
       (update-in [:PublicationReferences] iso-19115-2-publication-reference)
       (update-in [:RelatedUrls] expected-iso-19115-2-related-urls)
       (update-in-each [:AdditionalAttributes] assoc :UpdateDate nil)
-      (update-in-each [:Organizations] expected-organization)))
+      (update-in-each [:Personnel] expected-responsibility)
+      (update-in-each [:Organizations] expected-responsibility)))

 ;; ISO-SMAP


Named the promise explicitly

Named the promise explicitly

Signed-off-by: Stefan Marr <46f1a0bd5592a2f9244ca321b129902a06b53e03@stefan-marr.de>

--- Clojure/src/snake/core.clj
+++ Clojure/src/snake/core.clj
@@ -21,13 +21,11 @@
 (send  board-view  draw-borders)

 ; now start the actual game
-(def game-over    (exec-game-master board-view
-                                    board
-                                    :num-apples 5
-                                    :players   [human-player]))
+(def game-over-promise  (exec-game-master board-view
+                                          board
+                                          :num-apples 5
+                                          :players   [human-player]))

-(println "waiting for game-over")(flush)
-
-(deref game-over) ;; will block until the games is completed
+(deref game-over-promise) ;; will block until the games is completed

 (println "GAME OVER")


Use max_auto_trials instead uf auto_trials

--- src/cider_ci/dispatcher/task.clj
+++ src/cider_ci/dispatcher/task.clj
@@ -65,7 +65,7 @@
         finished-count (->> states (filter #(terminal-states %)) count)
         in-progress-count (- (count states) finished-count)
         create-new-trials-count (min (- (or (:eager_trials spec) 1) in-progress-count)
-                                     (- (or (:auto_trials spec) 2) (count states)))
+                                     (- (or (:max_auto_trials spec) 2) (count states)))
         _range (range 0 create-new-trials-count)
         ]
     (logging/debug "CREATE-TRIALS"
@@ -104,7 +104,7 @@
 (defn evaluate-and-create-trials
   "Evaluate task, evaluate state of trials and adjust state of task.
   Send \"task.state-changed\" message if state changed.
-  Create trials according to auto_trials and eager_trials properties
+  Create trials according to max_auto_trials and eager_trials properties
   if task is not in terminal state. The argument task must be a map
   including an :id key"
   [task]


remove wrap-session, because compojure does it

--- src/clj/clj_money/web/server.clj
+++ src/clj/clj_money/web/server.clj
@@ -230,16 +230,11 @@
                     (conj wrapper (constantly true))
                     wrapper)]
     (fn [{:keys [request-method uri] :as request}]
-      (when (test-fn request)
-        (pprint {(str "enter " description " " request-method " " uri) (select-keys request [:cookies :session :headers])}))
-      (let [apply? (test-fn request)
-            working-handler (if apply?
-                              (wrapper-fn handler)
-                              handler)
-            response (working-handler request)]
-        (when apply?
-          (pprint {(str "exit " description " " request-method " " uri) (select-keys response [:cookies :session :headers])}))
-        response))))
+      (if (test-fn request)
+        (do
+          (log/trace "apply middleware " description " to " request-method " " uri)
+          ((wrapper-fn handler) request))
+        (handler request)))))

 (defn-  wrap-routes
   [handler & wrappers]
@@ -261,7 +256,6 @@
                [wrap-content-type                   "content-type"]
                [#(friend/wrap-authorize % #{:user}) "authorization"    (complement open?)]
                [wrap-authenticate                   "authentication"   (complement open?)]
-               [wrap-session                        "session"]
                [#(wrap-resource % "public")         "public resources"]))

 (defroutes app


add re-rez restriction to Councilman

add re-rez restriction to Councilman

--- src/clj/game/cards-resources.clj
+++ src/clj/game/cards-resources.clj
@@ -118,7 +118,8 @@
    {:events {:rez {:req (req (and (#{"Asset" "Upgrade"} (:type target))
                                   (can-pay? state :runner nil [:credit (rez-cost state :corp target)])))
                    :effect (req (toast state :runner (str "Click Councilman to derez " (card-str state target {:visible true})
-                                                          " that was just rezzed") "info"))}}
+                                                          " that was just rezzed") "info")
+                                (toast state :corp (str "Runner has the opportunity to derez with Councilman.") "error"))}}
     :abilities [{:prompt "Choose an asset or upgrade that was just rezzed"
                  :choices {:req #(and (rezzed? %)
                                       (or (is-type? % "Asset") (is-type? % "Upgrade")))}
@@ -130,6 +131,13 @@
                                     {:msg (msg "pay " creds " [Credit] and derez " (:title c) ". Councilman is trashed")
                                      :effect (req (lose state :runner :credit creds)
                                                   (derez state :corp c)
+                                                  (register-turn-flag! state side
+                                                    card :can-rez
+                                                    (fn [state side card]
+                                                      (if (= (:cid card) (:cid c))
+                                                        ((constantly false)
+                                                         (toast state :corp "Cannot rez the rest of this turn due to Councilman"))
+                                                        true)))
                                                   (trash state side card {:unpreventable true}))}
                                    card nil))))}]}


add credit check on daily casts test

add credit check on daily casts test

--- src/clj/test/cards-resources.clj
+++ src/clj/test/cards-resources.clj
@@ -271,16 +271,20 @@
     (let [dc (get-in @state [:runner :rig :resource 0])]
       ;Number of credits
       (is (= 8 (get-in dc [:counter])))
+      (is (= 2 (get-in @state [:runner :credit])))
       ;End turn
       (take-credits state :runner)
       (take-credits state :corp)
       (is (= 6 (get-in (refresh dc) [:counter])))
+      (is (= 7 (get-in @state [:runner :credit])))
       (take-credits state :runner)
       (take-credits state :corp)
       (is (= 4 (get-in (refresh dc) [:counter])))
+      (is (= 13 (get-in @state [:runner :credit])))
       (take-credits state :runner)
       (take-credits state :corp)
       (is (= 2 (get-in (refresh dc) [:counter])))
+      (is (= 19 (get-in @state [:runner :credit])))
       (take-credits state :runner)
       (take-credits state :corp)
       (is (nil? (get-in @state [:runner :rig :resource 0])))


Draw grid with color which is more amenable to a grey background

--- src/cljs/goya/canvasdrawing.cljs
+++ src/cljs/goya/canvasdrawing.cljs
@@ -30,7 +30,7 @@
         pixel-size zoom-factor]
       (.save context)
       (.translate context 0.5 0.5)
-      (set! (.-strokeStyle context) "rgba(127,127,127,0.4)")
+      (set! (.-strokeStyle context) "rgba(60,50,40,0.4)")
       (set! (.-lineWidth context) 1)
       (dotimes [y height]
         (let [pix-y (* y pixel-size)]


Add husk of defineit page

Add husk of defineit page

--- src/cljs/whatishistory/core.cljs
+++ src/cljs/whatishistory/core.cljs
@@ -46,6 +46,28 @@
 ;; -------------------------
 ;; Components

+(defn defn-form-content []
+  [:form {:class "defnForm"}
+   [:div {:class "fieldWrap"}
+    [:input {:type "text"
+             :class "authorInput"
+             :placeholder "Your Name (Optional)"}]
+    [:br]
+    [:input {:type "email"
+             :class "emailInput"
+             :placeholder "Enter Your Email"}]
+    [:input {:type "email"
+             :class "emailConfirm"
+             :placeholder "Enter Your Email"}]
+    [:span {:class "emailIsConfirmed no"}]
+    [:textarea {:class "defnInput twelve columns"
+                :placeholder "Please compose your definition here..."}]
+    [:div {:class "btnWrap"}
+     [:button {:class "button-primary defnSubmit"} "Submit"]]]])
+
+(defn defn-form []
+  [defn-form-content])
+
 (defn definition [defn-atom]
   (fn [defn-atom]
     (if-not (= (get @defn-atom :text) "")
@@ -69,13 +91,32 @@
   (fn []
     (get-rand-defn)
     [:div {:class "container home"}
-     [:header [:h2 {:class "title"} "What is history?"]]
+     [:header [:h2 {:class "title"} "What is History?"]]
      [definition defn-atom]
+     [:a {:href "/defineit"} "Contribute Your Own Definition"]
      [footer]]))

-(defn about-page []
-  [:div [:h2 "About whatishistory"]
-   [:div [:a {:href "/"} "go to the home page"]]])
+(defn defineit-page []
+  (fn []
+    [:div {:class "container defineit"}
+     [:header [:h2 {:class "title"} "What is History?"]]
+     [:p "The study of history has received many extended and
+          authoritative analyses and definitions. The aim of
+          this site is different: to assemble a very large
+          corpus of definitions of the subject of history and
+          its study by a wide range of people, and to make this
+          data publicly available for computational analysis and
+          re-representation."]
+     [:p [:b "Instructions:"] " Simply take a stab at defining history as
+          you understand it at the moment. Please don't spent too
+          much time. Ten minutes should be sufficient. It is also
+          okay to cite another author who you feel expresses things
+          clearly."]
+     [defn-form]]))
+
+; (defn about-page []
+;   [:div [:h2 "About whatishistory"]
+;    [:div [:a {:href "/"} "go to the home page"]]])

 (defn current-page []
   [:div [(session/get :current-page)]])
@@ -86,8 +127,11 @@
 (secretary/defroute "/" []
   (session/put! :current-page #'home-page))

-(secretary/defroute "/about" []
-  (session/put! :current-page #'about-page))
+(secretary/defroute "/defineit" []
+  (session/put! :current-page #'defineit-page))
+
+; (secretary/defroute "/about" []
+;   (session/put! :current-page #'about-page))

 ;; -------------------------
 ;; Initialize app


Add extra data form for another defn

Add extra data form for another defn

--- src/cljs/whatishistory/core.cljs
+++ src/cljs/whatishistory/core.cljs
@@ -268,6 +268,29 @@
                              (.preventDefault evt)
                              (save-xtra-info app-atom))} "Submit"]]]])

+(defn anothers-xtra-info-form-content [app-atom]
+  [:form {:class "anothersXtraInfoForm"}
+   [:p "Your contribution is greatly appreciated. If you are willing, it would
+          enrich the information being gathered here if you could provide some
+          additional contextual information."]
+     [:div
+      [:label {:for "profession"} "What is the author's profession?"]
+      [:input {:type "text"
+               :id "profession"
+               :placeholder "Profession"
+               :on-change (fn [evt]
+                            (swap! app-atom assoc :profession evt.target.value))}]
+      [:label {:for "country"} "Where was the auth when she/he penned this definition?"]
+      [:select {:on-change (fn [evt]
+                            (swap! app-atom assoc :definition evt.target.value))}
+       (for [country js/window.countries]
+         [:option {:key (hash country)} country])]
+      [:div
+       [:button {:class "button-primary submit"
+                 :on-click (fn [evt]
+                             (.preventDefault evt)
+                             (save-xtra-info app-atom))} "Submit"]]]])
+
 (defn defn-form [app-atom]
   (if (nil? (get @app-atom :defn-form-mode))
     (swap! app-atom assoc :defn-form-mode "default"))
@@ -275,9 +298,6 @@
     (if (= mode "default")
       [defn-form-content app-atom]
       [anothers-defn-form-content app-atom])))
-
-(defn xtra-info-form [app-atom]
-  [xtra-info-form-content app-atom])

 (defn definition [app-atom]
   (fn [app-atom]
@@ -317,8 +337,9 @@
      ;[xtra-info-form app-atom]
      (if (nil? (get @app-atom :defn-obj))
        [defn-form app-atom]
-       [xtra-info-form app-atom])
-     ]))
+       (condp = (get @app-atom :defn-form-mode)
+         "default" [xtra-info-form-content app-atom]
+         "anothers" [anothers-xtra-info-form-content]))]))

 ; (defn about-page []
 ;   [:div [:h2 "About whatishistory"]


Missing changes from prev. commit.

Missing changes from prev. commit.

--- src/clojure/flambo/streaming.clj
+++ src/clojure/flambo/streaming.clj
@@ -11,7 +11,8 @@
                                      function
                                      function2
                                      pair-function
-                                     void-function]])
+                                     void-function]]
+            [flambo.interop :as fi])
   (:import [org.apache.spark.streaming.api.java JavaStreamingContext JavaDStream]
            [org.apache.spark.streaming.kafka KafkaUtils]
            [org.apache.spark.streaming.flume FlumeUtils]
@@ -65,12 +66,10 @@
     ;; JavaDStream doesn't have a .reduceByKey so cast to JavaPairDStream first
     (-> dstream
       (.mapToPair (pair-function identity))
-      (.reduceByKey (function2 f))
-      (.map (function f/untuple)))
+      (.reduceByKey (function2 f)))
     ;; if it's already JavaPairDStream, we're good
     (-> dstream
-        (.reduceByKey (function2 f))
-        (.map (function f/untuple)))))
+        (.reduceByKey (function2 f)))))

 (defn map-to-pair [dstream f]
   (.mapToPair dstream (pair-function f)))
@@ -102,8 +101,7 @@
 (defn group-by-key-and-window [dstream window-length slide-interval]
   (-> dstream
       (.mapToPair (pair-function identity))
-      (.groupByKeyAndWindow (duration window-length) (duration slide-interval))
-      (.map (function f/untuple))))
+      (.groupByKeyAndWindow (duration window-length) (duration slide-interval))))

 (defn reduce-by-window [dstream f f-inv window-length slide-interval]
   (.reduceByWindow dstream (function2 f) (function2 f-inv) (duration window-length) (duration slide-interval)))
@@ -111,8 +109,7 @@
 (defn reduce-by-key-and-window [dstream f window-length slide-interval]
   (-> dstream
       (.mapToPair (pair-function identity))
-      (.reduceByKeyAndWindow (function2 f) (duration window-length) (duration slide-interval))
-      (.map (function f/untuple))))
+      (.reduceByKeyAndWindow (function2 f) (duration window-length) (duration slide-interval))))

 ;; ## Actions


Add gtm_blank and gtm_secondary, and add tests

--- src/clojush/instructions/gtm.clj
+++ src/clojush/instructions/gtm.clj
@@ -24,6 +24,19 @@
      :tapes (vec (repeat num-tapes {:position 0 :contents (sorted-map)}))
      :trace []}))

+(defn ensure-instruction-map
+  "If instr-map is a hash map, returns it unchanged; otherwise returns a default
+  instruction map."
+  [instr-map]
+  (merge {:instruction 'exec_noop
+          :close 0
+          :silent false
+          :random-insertion false
+          :uuid (java.util.UUID/randomUUID)}
+         (if (map? instr-map)
+           instr-map
+           {})))
+
 (defn load-tape
   "Returns the provided Push state but with the indicated tape in its GTM initialized
   to contain the provided genome."
@@ -32,25 +45,13 @@
             [:gtm :tapes tape-index :contents]
             (into (sorted-map)
                   (zipmap (iterate inc 0)
-                          genome))))
+                          (map ensure-instruction-map genome)))))

 (defn dump-tape
   "Returns the genome recorded on the specified tape in the GTM of the provided Push state."
   [push-state tape-index]
   (vec (vals (:contents (get (:tapes (:gtm push-state)) tape-index)))))

-(defn ensure-instruction-map
-  "If instr-map is a hash map, returns it unchanged; otherwise returns a default
-  instruction map."
-  [instr-map]
-  (if (map? instr-map)
-    instr-map
-    {:instruction 'exec_noop
-     :close 0
-     :silent false
-     :random-insertion false
-     :uuid (java.util.UUID/randomUUID)}))
-
 (defn trace
   "Returns push-state with trace-info added to the trace recorded in its GTM."
   [trace-info push-state]
@@ -75,7 +76,7 @@
       (trace 'gtm_tape0
              (-> state
                  (assoc-in [:gtm :secondary] (:primary (:gtm state)))
-                 (assoc-in [:gtm :primary 0])))
+                 (assoc-in [:gtm :primary] 0)))
       state)))

 (define-registered ;; set primary to tape1, secondary to prior primary
@@ -86,7 +87,7 @@
       (trace 'gtm_tape1
              (-> state
                  (assoc-in [:gtm :secondary] (:primary (:gtm state)))
-                 (assoc-in [:gtm :primary 1])))
+                 (assoc-in [:gtm :primary] 1)))
       state)))

 (define-registered ;; set primary to tape2, secondary to prior primary
@@ -97,7 +98,20 @@
       (trace 'gtm_tape2
              (-> state
                  (assoc-in [:gtm :secondary] (:primary (:gtm state)))
-                 (assoc-in [:gtm :primary 2])))
+                 (assoc-in [:gtm :primary] 2)))
+      state)))
+
+(define-registered ;; swaps primary and secondary
+  gtm_secondary
+  ^{:stack-types [:gtm]}
+  (fn [state]
+    (if (:gtm state)
+      (trace 'gtm_secondary
+             (let [p (:primary (:gtm state))
+                   s (:secondary (:gtm state))]
+               (-> state
+                   (assoc-in [:gtm :secondary] p)
+                   (assoc-in [:gtm :primary] s))))
       state)))

@@ -145,6 +159,21 @@
           state))
       state)))

+(define-registered ;; push boolean from whether primary tape is blank at current position
+  gtm_blank
+  ^{:stack-types [:gtm :boolean]}
+  (fn [state]
+    (if (:gtm state)
+      (let [primary (:primary (:gtm state))
+            primary-tape (get (:tapes (:gtm state)) primary)]
+        (trace 'gtm_blank
+               (push-item (if (get (:contents primary-tape) (:position primary-tape))
+                            false
+                            true)
+                          :boolean
+                          state)))
+      state)))
+
 (define-registered ;; push primary tape's instruction to code stack
   gtm_instruction
   ^{:stack-types [:gtm :code]}
@@ -246,7 +275,8 @@

 ;; some tests

-(let [genome (random-plush-genome 10 [1 'exec_noop 'integer_add]
+;; load and dump a random program
+#_(let [genome (random-plush-genome 10 [1 'exec_noop 'integer_add]
                                   {:epigenetic-markers [:close :silent]})]
   (println "Before:" genome)
   (println "After loading and dumping:"
@@ -255,3 +285,85 @@
                                  genome)
                       1)))

+;; use namespaces for following tests
+(do
+  (use 'clojush.interpreter)
+  (use 'clojush.instructions.code)
+  (use 'clojush.instructions.boolean)
+  (use 'clojush.instructions.random-instructions))
+
+;; uniform crossover
+#_(let [g0 (random-plush-genome 20 [0])
+      g1 (random-plush-genome 20 [1])
+      pgm '(gtm_tape0              ;; initial source is tape0
+             exec_y                ;; repeatedly
+             (gtm_tape2            ;;   set destination to tape2
+               gtm_copy            ;;   copy a gene
+               gtm_tape0 gtm_right ;;   move all heads to right
+               gtm_tape1 gtm_right ;;
+               gtm_tape2 gtm_right ;;
+               boolean_rand        ;;   make next source randomly tape0 or tape1
+               exec_if gtm_tape0 gtm_tape1))
+      run-pgm #(run-push pgm %)]
+  (println "g0:" g0)(newline)
+  (println "g1:" g1)(newline)
+  (println "result:"
+           (-> (make-push-state)
+               (init-gtm 3)
+               (load-tape 0 g0)
+               (load-tape 1 g1)
+               (run-pgm)
+               (dump-tape 2))))
+
+;; back and forth on one parent
+#_(let [g [{:instruction 1}{:instruction 2}{:instruction 3}]
+      pgm '(true                  ;; top boolean indicates if moving right
+             exec_y               ;; repeatedly
+             (gtm_tape0           ;;   source is tape0
+               gtm_tape2          ;;   destination is tape2
+               gtm_copy           ;;   copy a gene
+               gtm_right          ;;   move destination to right
+               gtm_tape0          ;;   advance source in current direction
+               exec_if
+               (true gtm_right)
+               (false gtm_left)
+               gtm_blank          ;;   if blank, reverse and move twice
+               exec_if
+               (exec_if false true
+                        exec_if
+                        (true gtm_right gtm_right)
+                        (false gtm_left gtm_left))
+               ()))
+      run-pgm #(run-push pgm %)]
+  (println "g:" g)(newline)
+  (println "result:"
+           (-> (make-push-state)
+               (init-gtm 3)
+               (load-tape 0 g)
+               (run-pgm)
+               (dump-tape 2))))
+
+;; following test requires global-atom-generators to be set
+#_(reset! global-atom-generators [1 2 3])
+
+;; 50% uniform mutation
+#_(let [g (vec (repeat 20 {:instruction 0}))
+      pgm '(gtm_tape0                 ;; source is tape0
+             gtm_tape2                ;; destination is tape2
+             exec_y                   ;; repeatedly
+             (boolean_rand            ;;   randomly either
+               exec_if                ;;
+               (100 code_rand         ;;     set instruction randomly
+                 gtm_set_instruction)
+               gtm_copy               ;;     or copy it
+               gtm_tape0 gtm_right    ;;   in either case advance both tapes
+               gtm_tape2 gtm_right))
+      run-pgm #(run-push pgm %)]
+  (println "g:" g)(newline)
+  (println "result:"
+           (-> (make-push-state)
+               (init-gtm 3)
+               (load-tape 0 g)
+               (run-pgm)
+               (dump-tape 2))))
+


Update channel sizes to 10

Update channel sizes to 10

--- src/com/wsscode/pathom/core.cljc
+++ src/com/wsscode/pathom/core.cljc
@@ -420,8 +420,8 @@
             env       (assoc env ::processing-sequence coll)
             [head & tail] coll
             first-res (<?maybe (join-item (update env ::path conj 0) head))
-            from-chan (async/chan 50)
-            out-chan  (async/chan 50)]
+            from-chan (async/chan 10)
+            out-chan  (async/chan 10)]
         (async/onto-chan from-chan (map vector tail (range)))
         (async/pipeline-async 10
           out-chan


Require base nicer in page layout.

Require base nicer in page layout.

--- src/incise/layouts/impl/page.clj
+++ src/incise/layouts/impl/page.clj
@@ -4,7 +4,7 @@
                                           use-layout
                                           deflayout
                                           defpartial]])
-            incise.layouts.impl.base
+            [incise.layouts.impl.base :as base]
             (hiccup [element :refer [link-to]]
                     [core :refer [html]])))

@@ -18,7 +18,7 @@
 (deflayout page
   "The default page/post layout."
   []
-  (repartial incise.layouts.impl.base/header header)
-  (use-layout incise.layouts.impl.base/base))
+  (repartial base/header header)
+  (use-layout base/base))

 (register [:page :post] page)


Added code highlinting.

Added code highlinting.

--- src/leiningen/jupyter/kernel.clj
+++ src/leiningen/jupyter/kernel.clj
@@ -36,6 +36,8 @@
 (defn get-kernel-json [kernel-script-filename]
   (cheshire/generate-string {:display_name "Lein-Clojure"
                              :language "clojure"
+                             :codemirror_mode "clojure"
+                             :mimetype "text/x-clojure"
                              :argv ["python3" (str kernel-script-filename) "{connection_file}"]}))

 (defn create-kernel [kernel-dir]


Don't NPE when there's no vcs-url yet

Don't NPE when there's no vcs-url yet

--- src-cljs/frontend/utils/vcs_url.cljs
+++ src-cljs/frontend/utils/vcs_url.cljs
@@ -6,7 +6,9 @@
 (def url-project-re #"^https?://([^/]+)/(.*)")

 (defn project-name [vcs-url]
-  (last (re-matches url-project-re vcs-url)))
+  (some->> vcs-url
+           (re-matches url-project-re)
+           (last)))

 (defn vcs-type [vcs-url]
   (or ({"github.com" "github"


hack to filter newlines being objects in codemirror selection string

--- src-cljs/marioide/parinfer/core.cljs
+++ src-cljs/marioide/parinfer/core.cljs
@@ -146,13 +146,6 @@
       (.setCursor cm (aget cursor "line") new-cursor-x))
     (.scrollTo cm scroll-x scroll-y)))

-#_(defn render-demo! []
-    (create-editor! "code-demo" :demo)
-    (editor-ui/render! :demo)
-    (start-editor-sync!)
-    (swap! editor-state assoc-in [:demo :text] demo-example))
-
-
 ;;----------------------------------------------------------------------
 ;; Life Cycle events
 ;;----------------------------------------------------------------------
@@ -166,7 +159,12 @@

 (def frame-updates (atom {}))

-(defn selection [cm] (.getSelections cm (.listSelections cm)))
+(defn selection [cm]
+  (map (fn [s]
+         (clojure.string/replace
+                 s
+                 "[object Object]" ""))
+       (.getSelections cm (.listSelections cm))))

 (defn before-change
   "Called before any change is applied to the editor."
@@ -225,11 +223,11 @@
          cm)))))

 (defn cm-selection-or-form [cm]
-  (let [selection (or (when (= (aget (selection cm) 0) "")
+  (let [selection (or (when (= (first (selection cm)) "")
                         (-> @editor-state
                             :editor
                             :text))
-                      (aget (selection cm) 0))]
+                      (first (selection cm)))]
     selection))

 (defn create-editor!
@@ -287,7 +285,7 @@
        (.on cm "beforeChange" before-change)
        (.on cm "cursorActivity" on-cursor-activity)

-       (.addKeyMap cm #js {"Ctrl-Enter" (fn [cm] (print cm) (evaluate (cm-selection-or-form cm)))})
+       (.addKeyMap cm #js {"Ctrl-Enter" (fn [cm] (evaluate (cm-selection-or-form cm)))})

        cm))))


sketch out wallet balance functions

sketch out wallet balance functions

--- src/block_chain/chain.clj
+++ src/block_chain/chain.clj
@@ -42,10 +42,17 @@

 (defn next-target
   "Calculate the appropriate next target based on the time frequency
-   of recent blocks. Currently just setting a static (easy) target
-   until we have more blocks in place to pull frequency data from."
+   of recent blocks."
   []
   (let [recent-blocks (take-last 10 @block-chain)]
     (if (> (count recent-blocks) 1)
       (target/adjusted-target recent-blocks 15)
       default-target)))
+
+(defn balance [key blocks])
+(defn unspent-outputs [key blocks])
+(defn unspent? [txo blocks] )
+(defn assigned-to-key? [txo])
+
+(defn payment [amount from-key to-key blocks])
+(defn broadcast-txn [txn])


Fix indentation.

Fix indentation.

--- src/airhead_frontend/components.cljs
+++ src/airhead_frontend/components.cljs
@@ -8,11 +8,11 @@

 (defn header []
   (let [cursor  (r/cursor app-state [:info])
-        title   (@cursor :name)
-        message (@cursor :greet_message)]
+                title   (@cursor :name)
+                message (@cursor :greet_message)]
     [:header
-     [:h1 title]
-     [:p message]]))
+      [:h1 title]
+      [:p message]]))

 ;; -------------------------
 ;; Player
@@ -62,16 +62,17 @@
   (let [form-ref (r/atom nil)]
     (fn []
       [:section#upload
-       [:h2 "Upload"]
+        [:h2 "Upload"]

-       [:form.pure-form {:ref #(reset! form-ref %)}
-         [:input.pure-input-3-4 {:type "file" :name "track"}]
-         [:input.pure-button..pure-button-primary.pure-input-1-4
-           {:type "button" :value "Upload"
+        [:form.pure-form
+          {:ref #(reset! form-ref %)}
+          [:input.pure-input-3-4 {:type "file" :name "track"}]
+          [:input.pure-button.pure-button-primary.pure-input-1-4
+            {:type "button" :value "Upload"
             :on-click #(when-let [form @form-ref] (req/upload! form))}]
-         [progress-bar]]
+          [progress-bar]]

-       [:p (@app-state :upload-status)]])))
+        [:p (@app-state :upload-status)]])))

 ;; -------------------------
 ;; Tracks
@@ -86,24 +87,24 @@

 (defn track-tr [track action-button]
   [:tr.track
-   [:td
-    (when action-button
-      [action-button track])]
-   [:td (track :title)] [:td (track :artist)] [:td (track :album)]])
+    [:td
+      (when action-button
+        [action-button track])]
+    [:td (track :title)] [:td (track :artist)] [:td (track :album)]])

 ;; -------------------------
 ;; Playlist

 (defn playlist-section []
   [:section#playlist
-   [:h2 "Playlist"]
-   (if-let [tracks (not-empty (@app-state :playlist))]
-     [:table.pure-table.pure-table-striped
-      [:thead
-       [:tr [:th] [:th  "Title"] [:th "Artist"] [:th "Album"]]]
-      [:tbody (for [track tracks]
-                ^{:key track} [track-tr track playlist-remove-button])]]
-     "The playlist is empty.")])
+    [:h2 "Playlist"]
+    (if-let [tracks (not-empty (@app-state :playlist))]
+      [:table.pure-table.pure-table-striped
+        [:thead
+          [:tr [:th] [:th  "Title"] [:th "Artist"] [:th "Album"]]]
+        [:tbody (for [track tracks]
+                  ^{:key track} [track-tr track playlist-remove-button])]]
+      "The playlist is empty.")])

 ;; -------------------------
 ;; Search
@@ -129,11 +130,11 @@

 (defn sorting-th [field caption]
   [:th {:on-click #(update-sort-field! field)}
-   caption
-   [:span.sorting-arrow (when (= field (@app-state :sort-field))
-                          (if (@app-state :ascending)
-                            " ▲"
-                            " ▼"))]])
+       caption
+       [:span.sorting-arrow (when (= field (@app-state :sort-field))
+                              (if (@app-state :ascending)
+                                " ▲"
+                                " ▼"))]])

 (defn library-section []
   (let [tracks (@app-state :library)]
@@ -141,10 +142,10 @@
       [:h2 "Library"]
       [:form#library-search.pure-form
         [:input.pure-input-3-4 {:type "text"
-                           :id "query"
-                           :placeholder "Search trough the library..."
-                           :value (@app-state :query)
-                           :on-change on-query-change}]
+                               :id "query"
+                               :placeholder "Search trough the library..."
+                               :value (@app-state :query)
+                               :on-change on-query-change}]
         [:span.pure-input-1-4 (str "Tracks: " (count tracks))]]
       [:table.pure-table.pure-table-striped
         [:thead
@@ -159,11 +160,11 @@
 ;; Main

 (defn page-component []
- [:main.pure-g
-   [:div.pure-u-1.pure-u-md-1-2
-     [header]
-     [player-section]
-     [upload-section]
-     [playlist-section]]
-   [:div.pure-u-1.pure-u-md-1-2
-     [library-section]]])
+  [:main.pure-g
+    [:div.pure-u-1.pure-u-md-1-2
+      [header]
+      [player-section]
+      [upload-section]
+      [playlist-section]]
+    [:div.pure-u-1.pure-u-md-1-2
+      [library-section]]])


CMR-1922: Fixed ingest routes to fix some test failures.

--- ingest-app/src/cmr/ingest/api/ingest.clj
+++ ingest-app/src/cmr/ingest/api/ingest.clj
@@ -257,12 +257,11 @@
                                    :native-id native-id
                                    :concept-type :collection}
                                   headers)]
-            (println "concept-attribs:" (pr-str concept-attribs))
             (verify-provider-against-client-id request-context provider-id)
             (acl/verify-ingest-management-permission request-context :update :provider-object provider-id)
             (info (format "Deleting collection %s from client %s"
                           (pr-str concept-attribs) (:client-id request-context)))
-            (generate-ingest-response headers (ingest/save-collection request-context concept-attribs)))))
+            (generate-ingest-response headers (ingest/delete-concept request-context concept-attribs)))))

       (context ["/validate/granule/:native-id" :native-id #".*$"] [native-id]
         (POST "/" {:keys [params headers request-context] :as request}
@@ -279,10 +278,11 @@
                           (concept->loggable-string concept) (:client-id request-context)))
             (generate-ingest-response headers (ingest/save-granule request-context concept))))
         (DELETE "/" {:keys [request-context params headers]}
-          (let [concept-attribs {:provider-id provider-id
-                                 :native-id native-id
-                                 :concept-type :granule
-                                 :revision-id (get headers "cmr-revision-id")}]
+          (let [concept-attribs (set-revision-id
+                                  {:provider-id provider-id
+                                   :native-id native-id
+                                   :concept-type :granule}
+                                  headers)]
             (verify-provider-against-client-id request-context provider-id)
             (acl/verify-ingest-management-permission request-context :update :provider-object provider-id)
             (info (format "Deleting granule %s from client %s"


work around bad code in cljs.core

work around bad code in cljs.core

goog.nodeGlobalRequire is never used outside self-hosted and only
defined by the node bootstrap code which we are never using

add this noop so closure doesn't complain on --check

--- src/main/shadow/cljs/closure.clj
+++ src/main/shadow/cljs/closure.clj
@@ -282,6 +282,15 @@
        (map :output)
        (str/join "\n")))

+;; CLOSURE-WARNING: Property nodeGlobalRequire never defined on goog
+;; Original: ~/.m2/repository/org/clojure/clojurescript/1.9.542/clojurescript-1.9.542.jar!/cljs/core.cljs [293:4]
+;; cljs/core.cljs contains a call to goog.nodeGlobalRequire(...) which is only used in self-host mode
+;; but causes the closure compiler --check to complain
+;; since we are never going to use it just emit a noop to get rid of the warning
+
+(def goog-nodeGlobalRequire-fix
+  "\ngoog.nodeGlobalRequire = function(path) { return false };\n")
+
 (defn make-closure-modules
   "make a list of modules (already in dependency order) and create the closure JSModules"
   [state modules]
@@ -291,7 +300,9 @@
           (fn [js-mods {:keys [js-name name depends-on sources] :as mod}]
             (let [js-mod (JSModule. js-name)]
               (when (:default mod)
-                (.add js-mod (SourceFile/fromCode "closure_setup.js" (output/closure-defines-and-base state))))
+                (.add js-mod (SourceFile/fromCode "closure_setup.js"
+                               (str (output/closure-defines-and-base state)
+                                    goog-nodeGlobalRequire-fix))))

               (doseq [{:keys [name type js-name output] :as src}
                       (map #(get-in state [:sources %]) sources)]


unused ns

unused ns

--- src/celestial/topsort.clj
+++ src/celestial/topsort.clj
@@ -1,42 +0,0 @@
-(ns celestial.topsort
-  "See https://gist.github.com/alandipert/1263783"
-  (:use [clojure.set :only (difference union intersection)]))
-
-(defn without
-  "Returns set s with x removed."
-  [s x] (difference s #{x}))
-
-(defn take-1
-  "Returns the pair [element, s'] where s' is set s with element removed."
-  [s] {:pre [(not (empty? s))]}
-  (let [item (first s)]
-    [item (without s item)]))
-
-(defn no-incoming
-  "Returns the set of nodes in graph g for which there are no incoming
-  edges, where g is a map of nodes to sets of nodes."
-  [g]
-  (let [nodes (set (keys g))
-        have-incoming (apply union (vals g))]
-    (difference nodes have-incoming)))
-
-(defn normalize
-  "Returns g with empty outgoing edges added for nodes with incoming
-  edges only.  Example: {:a #{:b}} => {:a #{:b}, :b #{}}"
-  [g]
-  (let [have-incoming (apply union (vals g))]
-    (reduce #(if (get % %2) % (assoc % %2 #{})) g have-incoming)))
-
-(defn kahn-sort
-  "Proposes a topological sort for directed graph g using Kahn's
-  algorithm, where g is a map of nodes to sets of nodes. If g is
-  cyclic, returns nil."
-  ([g]
-   (kahn-sort (normalize g) [] (no-incoming g)))
-  ([g l s]
-   (if (empty? s)
-     (when (every? empty? (vals g)) l)
-     (let [[n s'] (take-1 s)
-           m (g n)
-           g' (reduce #(update-in % [n] without %2) g m)]
-       (recur g' (conj l n) (union s' (intersection (no-incoming g') m)))))))


Add diff-power-rule to leibniz

Add diff-power-rule to leibniz

Still untested though. Next up is tests for `control`.

--- src/chapter3/leibniz.cljs
+++ src/chapter3/leibniz.cljs
@@ -45,11 +45,21 @@
                  (list '* (d 'e2) (list 'd (d 'e1) (d 'v1)))
                  (list '* (d 'e1) (list 'd (d 'e2) (d 'v1)))))
    "diff-product-rule"])
+(defn diff-power-e3-rule [d x]
+  (and (not (atom? x))
+       (when-let [d2 (match-state '(exp (? e1) (number? e2)) x)]
+         (merge d d2))))
+(def diff-power-rule
+  ['(d (diff-power-e3-rule e3) (? v1))
+   (fn [d] (list '* (d 'e2)
+                 (list '* (list 'exp (d 'e1) (list 'dec (d 'e2)))
+                       (list 'd (d 'e1) (d 'v1)))))
+   "diff-power-rule"])
 ; other rules go here ...

 ; TODO: Clojure HAS to have a class/record facility to do this...
 (def rule-pattern first)
-(defn rule-action [rule] second)
+(def rule-action second)
 (defn rule-name [rule] (nth rule 2))

 (def rules


don't put the entire methods AST into namespaces for supporting inference, just :max-fixed-arity, :variadic and the :tag

--- src/clj/cljs/analyzer.clj
+++ src/clj/cljs/analyzer.clj
@@ -577,29 +577,34 @@
                    (and (:fn-var v) (not fn-var?)))
           (warning :fn-var env {:ns-name ns-name :sym sym})))
       (swap! env/*compiler* assoc-in [::namespaces ns-name :defs sym]
-             (merge
-              {:name name}
-              sym-meta
-              (when doc {:doc doc})
-              (when dynamic {:dynamic true})
-              (source-info name env)
-              ;; the protocol a protocol fn belongs to
-              (when protocol
-                {:protocol protocol})
-              ;; symbol for reified protocol
-              (when-let [protocol-symbol (-> sym meta :protocol-symbol)]
-                {:protocol-symbol protocol-symbol
-                 :impls #{}})
-              (when fn-var?
-                {:fn-var true
-                 ;; protocol implementation context
-                 :protocol-impl (:protocol-impl init-expr)
-                 ;; inline protocol implementation context
-                 :protocol-inline (:protocol-inline init-expr)
-                 :variadic (:variadic init-expr)
-                 :max-fixed-arity (:max-fixed-arity init-expr)
-                 :method-params (map :params (:methods init-expr))
-                 :methods (:methods init-expr)})))
+        (merge
+          {:name name}
+          sym-meta
+          (when doc {:doc doc})
+          (when dynamic {:dynamic true})
+          (source-info name env)
+          ;; the protocol a protocol fn belongs to
+          (when protocol
+            {:protocol protocol})
+          ;; symbol for reified protocol
+          (when-let [protocol-symbol (-> sym meta :protocol-symbol)]
+            {:protocol-symbol protocol-symbol
+              :impls #{}})
+          (when fn-var?
+            {:fn-var true
+             ;; protocol implementation context
+             :protocol-impl (:protocol-impl init-expr)
+             ;; inline protocol implementation context
+             :protocol-inline (:protocol-inline init-expr)
+             :variadic (:variadic init-expr)
+             :max-fixed-arity (:max-fixed-arity init-expr)
+             :method-params (map :params (:methods init-expr))
+             :methods (map (fn [method]
+                             (let [tag (infer-tag env (assoc method :op :method))]
+                               (cond-> (select-keys method
+                                         [:max-fixed-arity :variadic])
+                                 tag (assoc :tag tag))))
+                        (:methods init-expr))})))
       (merge {:env env :op :def :form form
               :name name :var var-expr :doc doc :init init-expr}
              (when tag {:tag tag})


we also need to pass relevant source map options in the incremental compile case

--- src/clj/cljs/compiler.clj
+++ src/clj/cljs/compiler.clj
@@ -972,7 +972,9 @@
                         (spit sm-file
                           (sm/encode {(url-path src) (:source-map sm-data)}
                             {:lines (+ (:gen-line sm-data) 2)
-                             :file (url-path dest)}))))
+                             :file (url-path dest)
+                             :source-map-timestamp (:source-map-timestamp opts)
+                             :source-map-pretty-print (:source-map-pretty-print opts)}))))
                     (let [path (.getPath (.toURL ^File dest))]
                       (swap! env/*compiler* assoc-in [::compiled-cljs path] ret)
                       (swap! env/*compiler* assoc-in [::ana/analyzed-cljs path] true))


remove sorting on churn and file-commit-pair

--- src/clj/gitomic/query.clj
+++ src/clj/gitomic/query.clj
@@ -27,19 +27,15 @@
        :in $ ?r ?p
        :where
        [?f :file/path ?p]
-       [?ch :change/path ?f]
-       [?c :commit/changes ?ch]
-       [?c :commit/merge? false]
-       [?r :repo/commits ?c]]
+       [?r :repo/files ?f]
+       [?ch :change/file ?f]]
      db r path))

 (defn files-in-repo [db repo]
   (q '[:find [?f ...]
        :in $ ?r
        :where
-       [?r :repo/commits ?c]
-       [?c :commit/changes ?ch]
-       [?ch :change/path ?f]]
+       [?r :repo/files ?f]]
      db repo))

 (defn weight [max n]
@@ -51,28 +47,24 @@
         xs))

 (defn churn [db r]
-  (reverse
-    (sort-by second
-             (q '[:find ?p (count ?ch)
-                  :in $ ?r
-                  :where
-                  [?r :repo/files ?f]
-                  [?f :file/path ?p]
-                  [?ch :change/file ?f]]
-                db r))))
+  (q '[:find ?p (count ?ch)
+       :in $ ?r
+       :where
+       [?r :repo/files ?f]
+       [?f :file/path ?p]
+       [?ch :change/file ?f]]
+     db r))

 (defn file-commit-pair [db r file-path]
-  (reverse
-    (sort-by second
-                     (q '[:find ?p2 (count ?c)
-                                 :in $ ?r ?p
-                                 :where
-                                 [?f1 :file/path ?p]
-                                 [?ch1 :change/file ?f1]
-                                 [?c :commit/changes ?ch1]
-                                 [?r :repo/commits ?c]
-                                 [?c :commit/changes ?ch2]
-                                 [(!= ?ch1 ?ch2)]
-                                 [?ch2 :change/file ?f2]
-                                 [?f2 :file/path ?p2]]
-                               db r file-path))))+  (q '[:find ?p2 (count ?c)
+       :in $ ?r ?p
+       :where
+       [?f1 :file/path ?p]
+       [?ch1 :change/file ?f1]
+       [?c :commit/changes ?ch1]
+       [?r :repo/commits ?c]
+       [?c :commit/changes ?ch2]
+       [(!= ?ch1 ?ch2)]
+       [?ch2 :change/file ?f2]
+       [?f2 :file/path ?p2]]
+     db r file-path))


Fix typo

Fix typo

--- src/clj/zetawar/data.cljs
+++ src/clj/zetawar/data.cljs
@@ -56,7 +56,7 @@
                           :capture-base :done}
      :done               {}}}})

-;; TODO: add support multiple zone of control types
+;; TODO: add support for multiple zone of control types
 ;; TODO: check how capturing armor works in Elite Command
 ;; TODO: check how repair amount works in Elite Command
 ;; TODO: add :buildable-at => {<terrain type ids>...}


Moar.

Moar.

--- src/clojurecraft/core.clj
+++ src/clojurecraft/core.clj
@@ -18,6 +18,7 @@
      0x09 :respawn
      0x0A :player
      0x0B :playerposition
+     0x0C :playerlook
 })
 (def packet-ids (apply assoc {} (mapcat reverse packet-types)))

@@ -118,8 +119,14 @@
       (-write-double conn y)
       (-write-double conn stance)
       (-write-double conn z)
-      (-write-bool conn onground)
-      )
+      (-write-bool conn onground))
+
+(defn write-packet-playerlook [conn {yaw :yaw pitch :pitch onground :onground}]
+      (-write-byte conn (:playerlook packet-ids))
+
+      (-write-float conn yaw)
+      (-write-float conn pitch)
+      (-write-bool conn onground))

 ; Writing Wrappers -----------------------------------------------------------------
@@ -135,6 +142,7 @@
         (= packet-type :respawn)        (write-packet-respawn conn payload)
         (= packet-type :player)         (write-packet-player conn payload)
         (= packet-type :playerposition) (write-packet-playerposition conn payload)
+        (= packet-type :playerlook)     (write-packet-playerlook conn payload)
         )
       (flushc conn))


Adding the token to ingest management permission cache.

--- src/cmr/search/system.clj
+++ src/cmr/search/system.clj
@@ -5,6 +5,7 @@
             [cmr.common.cache :as cache]
             [clojure.core.cache :as clj-cache]
             [cmr.acl.acl-cache :as ac]
+            [cmr.acl.core :as acl]
             [cmr.common.jobs :as jobs]
             [cmr.search.api.routes :as routes]
             [cmr.search.data.elastic-search-index :as idx]
@@ -64,7 +65,8 @@
                                                 (clj-cache/ttl-cache-factory {} :ttl TOKEN_CACHE_TIME))
                       :has-granules-map (hgrf/create-has-granules-map-cache)
                       coll-cache/cache-key (coll-cache/create-cache)
-                      xslt/xsl-transformer-cache-name (cache/create-cache)}
+                      xslt/xsl-transformer-cache-name (cache/create-cache)
+                      acl/token-imp-cache-key (acl/create-token-imp-cache)}
              :zipkin (context/zipkin-config "Search" false)
              :search-public-conf search-public-conf
              :scheduler (jobs/create-scheduler


CMR-3289 Removes length limit from ACL identifiers

--- access-control-app/src/cmr/access_control/data/acl_schema.clj
+++ access-control-app/src/cmr/access_control/data/acl_schema.clj
@@ -86,8 +86,7 @@
              {:required [:group_permissions :single_instance_identity]}
              {:required [:group_permissions :catalog_item_identity]}]
      :definitions {:IdentifierType {:type :string
-                                    :minLength 1
-                                    :maxLength 100}
+                                    :minLength 1}
                    :GroupPermissionsType {:type :object
                                           :additionalProperties false
                                           :properties {:permissions {:type :array


Optimize the projects/pages loading.

Optimize the projects/pages loading.

--- src/uxbox/data/projects.cljs
+++ src/uxbox/data/projects.cljs
@@ -71,27 +71,34 @@
 (defn load-projects
   []
   (letfn [(transform [state projects]
-            (reduce stpr/assoc-project state projects))
+            (as-> state $
+              (reduce stpr/assoc-project $ projects)
+              (assoc $ ::projects-loaded true)))
           (on-loaded [projects]
             #(transform % projects))]
     (reify
       rs/WatchEvent
       (-apply-watch [_ state]
-        (-> (rp/do :fetch/projects)
-            (p/then on-loaded))))))
+        (if (::projects-loaded state)
+          (rx/empty)
+          (-> (rp/do :fetch/projects)
+              (p/then on-loaded)))))))

 (defn load-pages
   []
   (letfn [(transform [state pages]
-            (reduce stpr/assoc-page state pages))
+            (as-> state $
+              (reduce stpr/assoc-page $ pages)
+              (assoc $ ::pages-loaded true)))
           (on-loaded [pages]
             #(transform % pages))]
     (reify
       rs/WatchEvent
       (-apply-watch [_ state]
-        (println "load-pages")
-        (-> (rp/do :fetch/pages)
-            (p/then on-loaded))))))
+        (if (::pages-loaded state)
+          (rx/empty)
+          (-> (rp/do :fetch/pages)
+              (p/then on-loaded)))))))

 (defn create-page
   [{:keys [name width height project layout] :as data}]


Finish connection timeout support.

Finish connection timeout support.

--- src/onyx/messaging/netty_tcp.clj
+++ src/onyx/messaging/netty_tcp.clj
@@ -230,17 +230,14 @@
             (.group client-group)
             (.channel channel)
             (.handler (client-channel-initializer (new-client-handler))))
-        ch-fut ^ChannelFuture (.awaitUninterruptibly ^ChannelFuture (.connect ^Bootstrap b ^String host ^Integer port)
-                                                     ;; TODO, add connection timeout
-                                                     ;(:onyx.messaging.netty/connect-timeout-millis defaults)
-                                                     ;TimeUnit/MILLISECONDS
-                                                     )
-        ch (.channel ch-fut)]
-    (if (and (.isSuccess ^ChannelFuture ch-fut)
-             (established? ch))
-      ch
-      (do (.close ch)
-          nil))))
+        ch-fut ^ChannelFuture (.connect ^Bootstrap b ^String host ^Integer port)]
+    (if (.awaitUninterruptibly ch-fut (:onyx.messaging.netty/connect-timeout-millis defaults))
+      (let [ch (.channel ch-fut)]
+        (if (and (.isSuccess ch-fut)
+                 (established? ch))
+          ch
+          (do (.close ch)
+              nil))))))

 (defrecord NettyTcpSockets [peer-group]
   component/Lifecycle


Clean up task printing

Clean up task printing

--- src/onyx/peer/task_lifecycle.clj
+++ src/onyx/peer/task_lifecycle.clj
@@ -518,6 +518,7 @@
                 (:onyx/name task-map)
                 :slot
                 (:slot-id event)
+                :id
                 (:id event)
                 (get lifecycle-names idx)
                 :adv? advanced
@@ -529,16 +530,14 @@
                 (count (m/subscriptions messenger))
                 :n-pubs
                 (count (m/publications messenger))
-                ;; re-add
                 ;:port
                 ;(:port (:messenger-group messenger))
                 :batch
                 (:batch event)
                 :segments-gen
                 (:segments (:results event))
-                ;; FIXME
-                #_(if (= :input (:onyx/type task-map))
-                    [:barriers-first-5 (vec (take 5 (sort-by key (:barriers state))))])]))
+                (if (= :input (:onyx/type task-map))
+                  [:barriers-first-5 (vec (take 5 (sort-by key barriers)))])]))
     this)
   (set-context! [this new-context]
     (set! context new-context)


Transpose line.

Transpose line.

--- src/onyx/queue/hornetq_utils.clj
+++ src/onyx/queue/hornetq_utils.clj
@@ -52,8 +52,8 @@

 (defn write-and-cap! [config queue-name messages echo]
   (let [tc (TransportConfiguration. (.getName NettyConnectorFactory) config)
+        locator (HornetQClient/createServerLocatorWithoutHA (into-array [tc]))
         _ (.setReconnectAttempts locator -1)
-        locator (HornetQClient/createServerLocatorWithoutHA (into-array [tc]))
         session-factory (.createSessionFactory locator)
         session (.createTransactedSession session-factory)]


Cleaned up code a little.

Cleaned up code a little.

--- src/wombats/sockets/game.clj
+++ src/wombats/sockets/game.clj
@@ -125,52 +125,22 @@
 ;; Broadcast helper functions

 (defn- broadcast-to-viewers
-  [game-id send-fn]
+  [game-id message]
   (let [channel-ids (get-game-room-channel-ids game-id)]
     (doseq [channel-id channel-ids]
-      (send-fn channel-id))))
+      (send-message channel-id message))))

 ;; Broadcast/send functions
-
-(defn- send-arena
-  [arena]
-  (let [msg (m/arena-message arena)]
-    (fn [chan-id]
-      (send-message chan-id msg))))

 (defn broadcast-arena
   [game-id arena]
   (broadcast-to-viewers game-id
-                        (send-arena arena)))
-
-(defn- send-chat-message
-  [game-id formatted-message]
-  (let [msg (m/chat-message game-id formatted-message)]
-    (fn [chan-id]
-      (send-message chan-id msg))))
-
-(defn- send-game-info
-  "Pulls out relevant info from game-state and sends it in join-game"
-  [game]
-  (let [msg (m/game-info-message game)]
-    (fn [chan-id]
-      (send-message chan-id msg))))
-
-(defn- broadcast-game-info
-  [game-id game]
-  (broadcast-to-viewers game-id
-                        (send-game-info game)))
-
-(defn- send-stats
-  [stats]
-  (let [msg (m/stats-message stats)]
-    (fn [chan-id]
-      (send-message chan-id msg))))
+                        (m/arena-message arena)))

 (defn broadcast-stats
   [game-id stats]
   (broadcast-to-viewers game-id
-                        (send-stats stats)))
+                        (m/stats-message stats)))

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; Handlers
@@ -210,14 +180,16 @@
              (assoc socket-user :color (:player/color player)))

       ;; Sends the current game frame to the frontend
-      ((send-arena arena) chan-id)
+      (send-message chan-id
+                    (m/arena-message arena))

       ;; Sends the stats (player info)
-      ((send-stats (get-player-stats game-state)) chan-id)
-
+      (send-message chan-id
+                    (m/stats-message (get-player-stats game-state)))

       ;; Sends the game info to the front end
-      ((send-game-info game) chan-id))))
+      (send-message chan-id
+                    (m/game-info-message game)))))

 (defn- leave-game
   [_]
@@ -236,7 +208,7 @@
                                :color (get-player-color game-id chan-id)
                                :timestamp (str (l/local-now))}]
         (broadcast-to-viewers game-id
-                              (send-chat-message game-id formatted-message))))))
+                              (m/chat-message game-id formatted-message))))))

 (defn create-socket-handler-map
   "Allows for adding custom handlers that respond to namespaced messages


adding location function to LigatureStore

--- src/org/almibe/ligature/core.clj
+++ src/org/almibe/ligature/core.clj
@@ -9,7 +9,9 @@
   (all-datasets [this]
     "Returns a seq of all existing datasets.")
   (close [this]
-    "Close connection with the Store."))
+    "Close connection with the Store.")
+  (location [this]
+    "Returns a String representation of this Store's location."))

 (defprotocol LigatureDataset
   "A Dataset manages a collection of Statements and supports ontologies and querying."


Implement 'type'

Implement 'type'

--- lib/shin/cljs/cljs/core.cljs
+++ lib/shin/cljs/cljs/core.cljs
@@ -139,6 +139,10 @@
 ;; Internal - do not use
 (defn- hamt-make []
   (hamt/make {$ "hash" hash "keyEq" =}))
+
+(defn type [x]
+  (when-not (nil? x)
+    (.-constructor x)))

 (defn array
   []


(PDB-4636) core/run-command: fix doc string typo

--- src/puppetlabs/puppetdb/core.clj
+++ src/puppetlabs/puppetdb/core.clj
@@ -24,7 +24,7 @@
     (println (str/join "\n" usage-lines))))

 (defn run-command
-  "Does the real work of invoking a command by attempting to result it and
+  "Does the real work of invoking a command by attempting to resolve it and
    passing in args. `success-fn` is a no-arg function that is called when the
    command successfully executes.  `fail-fn` is called when a bad command is given
    or a failure executing a command."


Call runMain by prying open the private method

--- src/radicalzephyr/boot_junit.clj
+++ src/radicalzephyr/boot_junit.clj
@@ -2,6 +2,8 @@
   {:boot/export-tasks true}
   (:require [boot.core :as core])
   (:import org.junit.runner.JUnitCore
+           (org.junit.internal JUnitSystem
+                               RealSystem)
            (org.reflections Reflections
                             Configuration)
            (org.reflections.scanners Scanner
@@ -11,9 +13,15 @@
                                  ConfigurationBuilder
                                  FilterBuilder)))

+(defn invoke-private-method [obj fn-name-string & args]
+  (let [m (first (filter (fn [x] (.. x getName (equals fn-name-string)))
+                         (.. obj getClass getDeclaredMethods)))]
+    (. m (setAccessible true))
+    (. m (invoke obj (into-array Object args)))))
+
 (defn failure->map [failure]
   {:description (.. failure (getDescription) (toString))
-   :exception (.getException failure)
+   ;;:exception (.getException failure)
    :message (.getMessage failure)})

 (defn result->map [result]
@@ -46,11 +54,15 @@
   [p packages PACKAGE #{sym} "The set of Java packages to run tests in."]
   (core/with-pre-wrap fileset
     (if (seq packages)
-      (let [result (JUnitCore/runClasses
-                    (into-array Class
-                                (find-all-tests packages)))]
+      (let [^JUnitCore core (JUnitCore.)
+            ^JUnitSystem system (RealSystem.)
+            result (invoke-private-method core "runMain"
+                                          system
+                                          (into-array String
+                                                      (map (memfn getName)
+                                                           (find-all-tests packages))))]
         (when (> (.getFailureCount result) 0)
-          (throw (ex-info "There were some test failures."
-                          (result->map result)))))
+          #_(throw (ex-info "There were some test failures."
+                            (result->map result)))))
       (println "No packages were tested."))
     fileset))


Remove debug logging

Remove debug logging

--- src/ruuvi_server/tracker_api.clj
+++ src/ruuvi_server/tracker_api.clj
@@ -25,8 +25,7 @@
         altitude (when (params :altitude) (parse/parse-decimal (params :altitude)))
         ]
     ;; TODO use select-keys
-    (info (:speed params))
-    (info params)
+    (debug params)
     (merge params {:event_time date_time
                    :latitude latitude
                    :longitude longitude


Hide status message

Hide status message

Former-commit-id: cd3c6e93c9b8aac8e6a0ec82d50564244745d7c0

--- src/syng_im/components/chat.cljs
+++ src/syng_im/components/chat.cljs
@@ -148,19 +148,19 @@
       (let [msgs                @messages
                                         ;_                 (log/debug "messages=" msgs)
             ;; temp to show first status
-            msgs-clj (assoc (js->clj msgs) "-1"
-                            {:msg-id "-1"
-                             :content (str "The brash businessman’s braggadocio "
-                                           "and public exchange with candidates "
-                                           "in the US presidential election")
-                             :delivery-status "seen"
-                             :from "Status"
-                             :chat-id "-"
-                             :content-type content-type-status
-                             :timestamp 1
-                             :outgoing false
-                             :to nil})
-            msgs (clj->js msgs-clj)
+            ;; msgs-clj (assoc (js->clj msgs) "-1"
+            ;;                 {:msg-id "-1"
+            ;;                  :content (str "The brash businessman’s braggadocio "
+            ;;                                "and public exchange with candidates "
+            ;;                                "in the US presidential election")
+            ;;                  :delivery-status "seen"
+            ;;                  :from "Status"
+            ;;                  :chat-id "-"
+            ;;                  :content-type content-type-status
+            ;;                  :timestamp 1
+            ;;                  :outgoing false
+            ;;                  :to nil})
+            ;; msgs (clj->js msgs-clj)
             ;; end temp
             datasource          (to-realm-datasource msgs)
             contacts            (:contacts @chat)


Fix 3-digit armstrong test description

Fix 3-digit armstrong test description

The description contradicts what is being tested and needs to be in
the negative.

--- exercises/armstrong-numbers/test/armstrong_numbers_test.clj
+++ exercises/armstrong-numbers/test/armstrong_numbers_test.clj
@@ -15,7 +15,7 @@
     (is (armstrong? 153))))

 (deftest not-armstrong-number-100
-  (testing "Three digit number that is an Armstrong number"
+  (testing "Three digit number that is not an Armstrong number"
     (is (not (armstrong? 100)))))

 (deftest armstrong-number-9474


Make sure that namespaces for spec keywords are determined eagerly to avoid namespace mismatches.

--- src/active/clojure/record_spec.cljc
+++ src/active/clojure/record_spec.cljc
@@ -204,33 +204,36 @@
                  ?field-triples)
        ;; specs
        ~(letfn [(spec-or-true [?field]
-                 (or (:spec (meta ?field)) '(constantly true)))]
-         ;; Generate a spec for each constructor arg. Uses each constructor arg and prepends the type name + "-" as the name.
-          `(do
-             ~@(for [[?field _ _] ?field-triples]
-                 `(s-def ~(ns-keyword (str ?type "-" ?field)) ~(spec-or-true ?field)))
-             (s-def ~(ns-keyword ?type)
-                    (s-spec ~?predicate
-                            :gen (fn []
-                                   (->> (s-gen (s-keys :req [~@(map #(ns-keyword (str ?type "-" %))
-                                                                    ?constructor-args)]))
-                                        (s-fmap (fn [ks#]
-                                                  (~(symbol (str "map->" ?type))
-                                                   (clojure.set/rename-keys
-                                                    ks#
-                                                    ~(into {} (for [constructor-arg ?constructor-args]
-                                                                [(ns-keyword (str ?type "-" constructor-arg))
-                                                                 (keyword constructor-arg)]))))))))))
-             (s-fdef ~?constructor
-                     :args (s-cat
-                            ~@(apply concat
-                                     (for [[?field ?spec] (map (fn [constructor-arg]
-                                                                 (let [field (first (filter #(= constructor-arg %) (map first ?field-triples)))]
-                                                                   [field (spec-or-true field)]))
-                                                               ?constructor-args)]
-                                       [(keyword ?field) ?spec])))
-                     :ret ~(ns-keyword ?type))
-             ~@(for [[?field ?accessor _] ?field-triples]
-                 `(s-fdef ~?accessor
-                          :args (s-cat ~(keyword ?type) ~(ns-keyword ?type))
-                          :ret  ~(spec-or-true ?field)))))))))
+                  (or (:spec (meta ?field)) '(constantly true)))]
+          (let [?field-specs (mapv (fn [[?field _ _]] (ns-keyword (str ?type "-" ?field))) ?field-triples)]
+            ;; Generate a spec for each constructor arg. Uses each constructor arg and prepends the type name + "-" as the name.
+            `(do
+               ~@(mapv (fn [[?field _ _] ?field-spec]
+                         `(s-def ?field-spec ~(spec-or-true ?field)))
+                       ?field-triples ?field-specs)
+               (s-def ~(ns-keyword ?type)
+                      (s-spec ~?predicate
+                              :gen (fn []
+                                     (->> (s-gen (s-keys :req [~@(map #(ns-keyword (str ?type "-" %))
+                                                                      ?constructor-args)]))
+                                          (s-fmap (fn [ks#]
+                                                    (~(symbol (str "map->" ?type))
+                                                     (clojure.set/rename-keys
+                                                      ks#
+                                                      ~(into {} (for [constructor-arg ?constructor-args]
+                                                                  [(ns-keyword (str ?type "-" constructor-arg))
+                                                                   (keyword constructor-arg)]))))))))))
+               (s-fdef ~?constructor
+                       :args (s-cat
+                              ~@(apply concat
+                                       (for [[?field ?spec] (map (fn [constructor-arg]
+                                                                   (let [field (first (filter #(= constructor-arg %) (map first ?field-triples)))]
+                                                                     [field (spec-or-true field)]))
+                                                                 ?constructor-args)]
+                                         [(keyword ?field) ?spec])))
+                       :ret ~(ns-keyword ?type))
+               ~@(mapv (fn [[?field ?accessor _]]
+                         `(s-fdef ~?accessor
+                                  :args (s-cat ~(keyword ?type) ~(ns-keyword ?type))
+                                  :ret  ~(spec-or-true ?field)))
+                       ?field-triples))))))))


Improve API doc.

Improve API doc.

--- src/afterglow/controllers/tempo.clj
+++ src/afterglow/controllers/tempo.clj
@@ -1,6 +1,6 @@
 (ns afterglow.controllers.tempo
   "Provides support for easily implementing tap-tempo and shift
-  buttons on any controller."
+  buttons on any MIDI controller."
   {:author "James Elliott"}
   (:require [overtone.midi :as midi]
             [afterglow.controllers :as controllers]
@@ -150,9 +150,9 @@
   can be used to modify other mappings. The shift state is entered
   whenever the specified note (when `kind` is `:note`) or
   controller-change (when `kind` is `:control`) message is received
-  with a non-zero velocity (or control value), and left whenever a
-  matching note-off or controller message with velocity zero is
-  received.
+  with a non-zero velocity (or control value) on the specified
+  `channel`. The shift state is ended whenever a matching note-off or
+  controller-change message with velocity zero is received.

   The device to be mapped is identified by `device-filter`. The first
   input port which matches using [[filter-devices]] will be used.


Support easier mounting of Blade at strange angle.

Model the head separate from the fixture itself, so you just need to
know where it clamps to a lighting rig, and from the mounting angle
Afterglow can figure out where the head is located.

--- src/afterglow/fixtures/blizzard.clj
+++ src/afterglow/fixtures/blizzard.clj
@@ -164,6 +164,16 @@
   ![Blade
   axes](https://raw.githubusercontent.com/brunchboy/afterglow/master/doc/assets/Blade.png)

+  If you are hanging the light at an odd angle, or for any reason it
+  is harder to measure the exact axis location than the location of
+  where you are hanging it, you can supply an optional argument
+  `:hung` containing the distance in meters from the origin in the
+  photo to the point at which it was hung (the center of the bar it is
+  clamped to), and Afterglow will calculate where the head is based on
+  that distance and the orientation at which you reported it hung.
+  With the standard clamp mount and a standard O-clamp that distance
+  seems to be twelve inches.
+
   The center pan value (aimed straight at the audience when hung in
   the default orientation described above), is defined as 84, a half
   revolution around from that, so that it has room to move in both
@@ -190,14 +200,12 @@
   using optional keyword arguments following the `mode` value."
   ([]
    (blade-rgbw :15-channel))
-  ([mode & {:keys [pan-center pan-half-circle tilt-center tilt-half-circle]
-            :or {pan-center 84 pan-half-circle 84 tilt-center 8 tilt-half-circle -214}}]
+  ([mode & {:keys [hung pan-center pan-half-circle tilt-center tilt-half-circle]
+            :or {hung 0 pan-center 84 pan-half-circle 84 tilt-center 8 tilt-half-circle -214}}]
    (assoc (case mode
             :15-channel {:channels [(chan/pan 1 3) (chan/tilt 2 4)
                                     (chan/fine-channel :movement-speed 5
                                                        :function-name "Movement Speed (fast->slow)")
-                                    (chan/color 6 :red) (chan/color 7 :green)
-                                    (chan/color 8 :blue) (chan/color 9 :white)
                                     (chan/fine-channel :custom-color 10)
                                     (chan/functions :strobe 11 0 nil
                                                     1 {:type :strobe
@@ -209,13 +217,17 @@
                                                     0 :linear-dimming 26 :fade-step-increase
                                                     51 :color-macros 91 :color-fade-in-out
                                                     131 :color-snap 171 :color-fade
-                                                    211 :auto 251 :sound-active)]}
+                                                    211 :auto 251 :sound-active)]
+                         :heads [{:channels [(chan/color 6 :red) (chan/color 7 :green)
+                                              (chan/color 8 :blue) (chan/color 9 :white)]
+                                   :y hung}]}
             :11-channel {:channels [(chan/pan 1 3) (chan/tilt 2 4)
                                     (chan/fine-channel :movement-speed 5
                                                        :function-name "Movement Speed (fast->slow)")
-                                    (chan/color 6 :red) (chan/color 7 :green)
-                                    (chan/color 8 :blue) (chan/color 9 :white)
-                                    (chan/dimmer 10) (chan/fine-channel :custom-color 11)]})
+                                    (chan/dimmer 10) (chan/fine-channel :custom-color 11)]
+                         :heads [{:channels [(chan/color 6 :red) (chan/color 7 :green)
+                                              (chan/color 8 :blue) (chan/color 9 :white)]
+                                   :y hung}]})
           :name "Blizzard Blade RGBW"
           :mode mode
           :pan-center pan-center :pan-half-circle pan-half-circle
@@ -226,18 +238,6 @@
 ;;       motions. Also unimplemented is the whole concept of Fiture ID, but that would require
 ;;       major support throughout Afterglow. Wait until people using overpopulated DMX networks
 ;;       ask for it...
-
-(def ^:private ws-head-offsets
-  "The X-axis positions of the eight weather system heads"
-  [-0.406 -0.305 -0.191 -0.083 0.083 0.191 0.305 0.406])
-
-(defn- ws-head
-  "Creates a head definition for one head of the Weather System"
-  [index]
-  {:channels [(chan/color (+ 2 (* 3 index)) :red)
-              (chan/color (+ 3 (* 3 index)) :green)
-              (chan/color (+ 4 (* 3 index)) :blue)]
-   :x (get ws-head-offsets index)})

 (defn puck-fab5
   "[Puck
@@ -298,6 +298,18 @@
           :name "Blizzard Puck Fab5"
           :mode mode)))

+(def ^:private ws-head-offsets
+  "The X-axis positions of the eight weather system heads"
+  [-0.406 -0.305 -0.191 -0.083 0.083 0.191 0.305 0.406])
+
+(defn- ws-head
+  "Creates a head definition for one head of the Weather System"
+  [index]
+  {:channels [(chan/color (+ 2 (* 3 index)) :red)
+              (chan/color (+ 3 (* 3 index)) :green)
+              (chan/color (+ 4 (* 3 index)) :blue)]
+   :x (get ws-head-offsets index)})
+
 (defn weather-system
   "[Weather
   System](http://www.blizzardlighting.com/products/all-in-one-lighting-systems/item/209-weather-system)


Mujir, Mihir - exposing getTaskById java api

--- src/aggregatequeryservice/dblog.clj
+++ src/aggregatequeryservice/dblog.clj
@@ -45,7 +45,7 @@
         tasks (get-all-in-progress-tasks* db-spec)]
     tasks))

-(defn -getTaskById [connection-provider task-id]
+(defn -getTaskById [this connection-provider task-id]
   (create-record (utils/do-with-connection (partial get-task-by-id task-id) connection-provider)))

 (defn ^java.util.ArrayList -getAllTasks [this connection-provider]


Track the finer-grained timing metrics.

Track the finer-grained timing metrics.

--- src/algebolic/evolution/metrics.clj
+++ src/algebolic/evolution/metrics.clj
@@ -1,10 +1,15 @@
 (ns algebolic.evolution.metrics
   "Functions for extracting metrics for each generation.")
+
+;; TODO: this could be better, I think. It's a bit repetitive specifying the metrics to
+;; TODO: generate in the evolution function, and then having to specify the metrics to
+;; TODO: gather again here.

 (defn initialise-metrics
   "Generates an empty metrics structure with the appropriates slots, given the score keys."
   [score-keys]
-  (into {:time []} (map (fn [k] [k {:mean [] :min [] :max []}]) score-keys)))
+  (into {:time [] :selection-time [] :reproduction-time [] :scoring-time []}
+        (map (fn [k] [k {:mean [] :min [] :max []}]) score-keys)))

 (defn- update-population-metric
   "Update a single population-level metric."
@@ -24,10 +29,14 @@
   (reduce
     (partial update-population-metric pop) metrics keys))

+(defn- update-metric
+  [zg metrics key]
+  (update-in metrics [key] #(conj % (key zg))))
+
 (defn- update-other-metrics
   "Used for bunging in other ad-hoc metrics dervied from the zeitgeist."
   [metrics zg]
-  (update-in metrics [:time] #(conj % (:time zg))))
+  (reduce (partial update-metric zg) metrics [:time :selection-time :scoring-time :reproduction-time]))

 (defn update-metrics!
   "Takes a metrics atom and update score and other metrics from a given zeitgeist. Swaps the


Updated api message format (so the keys match get request)

--- src/wombats/sockets/messages.clj
+++ src/wombats/sockets/messages.clj
@@ -109,14 +109,15 @@
   [{:keys [game-config] :as game-state}]

   (get-message :game-info
-               {:round-start-time (get-start-time game-state)
-                :round-number (get-round-number game-state)
-                :max-players (:game/max-players game-config)
-                :player-count (count (:players game-state))
-                :name (:game/name game-config)
-                :status (:game/status game-config)
-                :game-winner (get-game-winner game-state)
-                :stats (vec (get-player-stats game-state))}))
+               {:game/round-start-time (get-start-time game-state)
+                :game/round-number (get-round-number game-state)
+                :game/max-players (:game/max-players game-config)
+                :game/players (:players game-state)
+                :game/name (:game/name game-config)
+                :game/status (:game/status game-config)
+                :game/winner (get-game-winner game-state)
+                :game/stats (vec (get-player-stats game-state))
+                :game/is-private (:game/is-private game-config)}))

 (defn handshake-message
   [chan-id]


better handling of space bar

better handling of space bar

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

--- plugins/SlideExplorer2/src/slide_explorer/user_controls.clj
+++ plugins/SlideExplorer2/src/slide_explorer/user_controls.clj
@@ -149,15 +149,18 @@
     (binder "RIGHT" :x -)
     (binder "LEFT" :x +)))

+(defn toggle-mode [screen-state]
+  (assoc screen-state :mode
+         (condp = (:mode screen-state)
+           :explore :navigate
+           :navigate :explore
+              :navigate)))
+
 (defn handle-mode-keys [panel screen-state-atom]
   (let [window (SwingUtilities/getWindowAncestor panel)]
-    (bind-window-keys window ["SPACE"]
-                      #(swap! screen-state-atom
-                              (fn [state]
-                                (assoc state :mode
-                                       (condp = (:mode state)
-                                         :explore :navigate
-                                         :navigate :explore)))))))
+    (bind-window-keys window [\ ] ; space bar
+                      #(swap! screen-state-atom toggle-mode))))
+

 (defn handle-wheel [component z-atom]
   (.addMouseWheelListener component


ui.cljs: Simplify :require.

ui.cljs: Simplify :require.

--- src-cljs/pepa/ui.cljs
+++ src-cljs/pepa/ui.cljs
@@ -1,7 +1,8 @@
 (ns pepa.ui
-  (:require [om.core :as om]
-            [garden.units :as u :refer [px em pt]]
-            [sablono.core :refer-macros [html]])
+  (:require
+   ;; Necessary for the `defcomponent' macro
+   om.core
+   sablono.core)
   (:require-macros pepa.ui))

 (defn css-fade [animation-name duration]


Add inline validations

Add inline validations

--- src/braid/client/register/views.cljs
+++ src/braid/client/register/views.cljs
@@ -3,12 +3,17 @@
     [reagent.core :as r]
     [garden.core :refer [css]]
     [garden.stylesheet :refer [at-import]]
-    [clojure.string :as string]))
+    [clojure.string :as string])
+  (:import
+    [goog.events KeyCodes]))

 (def braid-color "#2bb8ba")

 (def small-spacing "0.5rem")
 (def border-radius "3px")
+
+(def invalid-color "#fd4734")
+(def valid-color "#2bb8ba")

 (defn input-field-mixin []
   {:font-size "1.25rem"
@@ -46,7 +51,8 @@
       :background-size "contain"}]]

    [:.option
-    {:margin [[small-spacing 0]]}
+    {:margin [[small-spacing 0]]
+     :position "relative"}

     [:h2
      {:font-size "1em"
@@ -55,10 +61,19 @@
     [:.explanation
      {:color "#999"
       :font-size "0.75em"
-      :margin [[small-spacing 0 0 0]]}]
-
-    [:p
-     {:margin "0"}]
+      :margin [[small-spacing 0 0 0]]}
+
+     [:p
+      {:margin "0"}]]
+
+    [:.error-message
+     {:position "absolute"
+      :top 0
+      :right 0
+      :text-align "right"
+      :line-height "1.5rem"
+      :font-size "0.75em"
+      :color invalid-color}]

     [:label
      {:display "block"}
@@ -73,9 +88,28 @@
      ["::-webkit-input-placeholder"
       {:color "#eee"}]]

+    [:&.invalid
+     ["input[type=text]"
+      {:border-color invalid-color}]
+
+     [:.field::after
+      (input-field-mixin)
+      {:content "\"!\""
+       :color invalid-color
+       :border "none"
+       :display "inline-block"}]]
+
+    [:&.valid
+     [:.field::after
+      (input-field-mixin)
+      {:content "\"\u2713\""
+       :color valid-color
+       :border "none"
+       :display "inline-block"}]]
+
     [:&.group-url

-     [:.domain
+     [:.field
       {:white-space "nowrap"}

       ["input[type=text]"
@@ -104,7 +138,20 @@
       {:margin [[small-spacing 0]]
        :border "1px solid #eee"
        :padding [["0.75rem" "1rem" "1.0rem"]]
-       :border-radius border-radius}
+       :border-radius border-radius
+       :position "relative"}
+
+      [:&.checked
+       [:&::after
+        (input-field-mixin)
+        {:content "\"\u2713\""
+         :color valid-color
+         :position "absolute"
+         :right "-2em"
+         :top "50%"
+         :margin-top "-1em"
+         :border "none"
+         :display "inline-block"}]]

       [:span
        {:display "inline-block"
@@ -114,6 +161,7 @@
       [:.explanation
        {:margin-left "1.5rem"
         :margin-top "0.25em"}
+
        [:p
         {:display "inline"
          :margin-right "0.25em"}]]]]]
@@ -173,56 +221,123 @@
   [:h1 "Braid"])

 (defn form-view []
-  (let [fields (r/atom {:name nil
-                        :url nil
-                        :type nil})]
+  (let [fields (r/atom {:name ""
+                        :url ""
+                        :type ""})
+        focused? (r/atom {:name nil
+                          :url nil
+                          :type nil})]
     (fn []
-      (let [name-valid? (not (string/blank? (@fields :name)))
-            url-valid? (not (string/blank? (@fields :url)))
-            type-valid? (not (string/blank? (@fields :type)))
-            valid? (and
-                     name-valid?
-                     url-valid?
-                     type-valid?)]
-        (println valid?)
+      (let [blank? {:name (string/blank? (@fields :name))
+                    :url (string/blank? (@fields :url))
+                    :type (string/blank? (@fields :type))}
+            validations {:name [{:valid? (not (blank? :name))
+                                 :message "Your group needs a name"}]
+                         :url [{:valid? (not (blank? :url))
+                                :message "Your group needs a URL"}
+                               {:valid? (boolean (re-matches #"[a-z0-9-]*" (@fields :url)))
+                                :message "Your URL can only contain lowercase letters, numbers or dashes"}
+                               {:valid? (not (re-matches #"-.*" (@fields :url)))
+                                :message "Your URL can't start with a -"}
+                               {:valid? (not (re-matches #".*-" (@fields :url)))
+                                :message "Your URL can't end with a -"}]
+                         :type [{:valid? (not (blank? :type))
+                                 :message "You need to select a group type"}]}
+            tee (fn [x]
+                  (println x) x)
+            valid? (fn [field]
+                     (->> (validations field)
+                          (map :valid?)
+                          tee
+                          (every? true?)))
+            messages (fn [field]
+                       (->> (validations field)
+                            (remove :valid?)
+                            (map :message)))
+            _ (println (valid? :url))
+            show-status? {:name (and
+                                  (not (@focused? :name))
+                                  (not (blank? :name)))
+                          :url (and
+                                 (not (@focused? :url))
+                                 (not (blank? :url)))
+                          :type (and
+                                  (not (@focused? :type))
+                                  (not (blank? :type)))}
+            all-valid? (and (valid? :name) (valid? :url) (valid? :type))]
         [:form.register
          [header-view]

          [:div.option.group-name
+          {:class (when (show-status? :name)
+                    (if (valid? :name)
+                      "valid" "invalid"))}
           [:label
            [:h2 "Group Name"]
-           [:input {:type "text"
-                    :placeholder "Team Awesome"
-                    :auto-focus true
-                    :value (@fields :name) ; TODO guess from email
-                    :on-change (fn [e]
-                                 (let [value (.. e -target -value)]
-                                   (swap! fields assoc :name value)))}]
+           [:div.field
+            [:input {:type "text"
+                     :placeholder "Team Awesome"
+                     :auto-focus true
+                     :value (@fields :name) ; TODO guess from email
+                     :on-focus (fn [_]
+                                 (swap! focused? assoc :name true))
+                     :on-blur (fn [_]
+                                (swap! focused? assoc :name false))
+                     :on-change (fn [e]
+                                  (let [value (.. e -target -value)]
+                                    (swap! fields assoc :name value)))}]]
+           (when (and (show-status? :name) (not (valid? :name)))
+             [:div.error-message (first (messages :name))])
            [:div.explanation
             [:p "Your group's name will show up in menus and headings. It doesn't need to be formal."]]]]

          [:div.option.group-url
+          {:class (when (show-status? :url)
+                    (if (valid? :url)
+                      "valid" "invalid"))}
           [:label
            [:h2 "Group URL"]
-           [:div.domain
+           [:div.field
             [:input {:type "text"
                      :placeholder "awesome"
+                     :autocomplete false
+                     :autocorrect false
+                     :autocapitalize false
+                     :spellcheck false
                      :value (@fields :url) ; TODO guess from email
+                     :on-focus (fn [_]
+                                 (swap! focused? assoc :url true))
+                     :on-blur (fn [_]
+                                (swap! focused? assoc :url false))
+                     :on-key-down (fn [e]
+                                    (when (and
+                                            (not (contains? #{KeyCodes.LEFT KeyCodes.RIGHT
+                                                              KeyCodes.UP KeyCodes.DOWN
+                                                              KeyCodes.TAB KeyCodes.BACKSPACE}
+                                                            (.. e -keyCode)))
+                                            (not (re-matches #"[a-z0-9-]" (.. e -key))))
+                                      (.preventDefault e)))
                      :on-change (fn [e]
                                   (let [value (.. e -target -value)]
                                     (swap! fields assoc :url value)))}]
             [:span ".braid.chat"]]
+           (when (and (show-status? :url) (not (valid? :url)))
+             [:div.error-message (first (messages :url))])
            [:div.explanation
             [:p "Pick something short and recognizeable."]
             [:p "Lowercase letters, numbers and dashes only."]]]]

          [:div.option.group-type
           [:h2 "Group Type"]
-          [:label
+          [:label {:class (when (= "public" (@fields :type)) "checked")}
            [:input {:type "radio"
                     :name "type"
                     :value "public"
                     :checked (when (= "public" (@fields :type)))
+                    :on-focus (fn [_]
+                                (swap! focused? assoc :type true))
+                    :on-blur (fn [_]
+                               (swap! focused? assoc :type false))
                     :on-click (fn [e]
                                 (let [value (.. e -target -value)]
                                   (swap! fields assoc :type value)))}]
@@ -230,11 +345,15 @@
            [:div.explanation
             [:p "Anyone can find and join your group through the Braid Group Directory."]
             [:p "Unlimited everything. Free forever."]]]
-          [:label
+          [:label {:class (when (= "private" (@fields :type)) "checked")}
            [:input {:type "radio"
                     :name "type"
                     :value "private"
                     :checked (when (= "private" (@fields :type)))
+                    :on-focus (fn [_]
+                                (swap! focused? assoc :type true))
+                    :on-blur (fn [_]
+                               (swap! focused? assoc :type false))
                     :on-click (fn [e]
                                 (let [value (.. e -target -value)]
                                   (swap! fields assoc :type value)))}]
@@ -243,7 +362,7 @@
             [:p "Invite-only and hidden from the Braid Group Directory."]
             [:p "Free to evaluate, then pay-what-you-want."]]]]

-         [:button {:disabled (not valid?)}
+         [:button {:disabled (not all-valid?)}
           "Create your group"]]))))

 (defn app-view []


fix asana api retry

fix asana api retry

--- src/chat/server/extensions/asana.clj
+++ src/chat/server/extensions/asana.clj
@@ -131,7 +131,7 @@
        401
        (do (timbre/warnf "token expired %s %s" (:status resp) (:body resp))
            (if (refresh-token ext)
-             (fetch-asana-info ext-id path)
+             (fetch-asana-info ext-id method path opts)
              (timbre/warnf "Failed to refresh token")))

        (timbre/warnf "Asana api request failed: %s %s" (:status resp) (:body resp))))))


Just a little more info.

Just a little more info.

--- src/clj/qualityclj/linters/kibit.clj
+++ src/clj/qualityclj/linters/kibit.clj
@@ -24,6 +24,7 @@
   (let [{:keys [file line expr alt]} check-map
         content (str "Instead of:\n\t" (pprint-code expr) "\nTry:\n\t"
                      (pprint-code alt))]
+    (info "\nAdding note to line " line ":\n" content)
     (db/add-note file line content :kibit)))

 (defn kibitize-project


fix phone component atom deref

fix phone component atom deref

--- src/cljs/phonecat_re_frame/core.cljs
+++ src/cljs/phonecat_re_frame/core.cljs
@@ -13,9 +13,9 @@
 ;; Re-frame data

 (re-frame/register-sub
-  :search-input
-  (fn [db]
-    (reaction (:search-input @db))))
+ :search-input
+ (fn [db]
+   (reaction (:search-input @db))))

 (re-frame/register-sub        ;; a new subscription handler
  :phones             ;; usage (subscribe [:phones])
@@ -44,8 +44,8 @@
 (defn phone-component
   [phone]
   [:li
-   [:span (:name @phone)]
-   [:p (:snippet @phone)]])
+   [:span (:name phone)]
+   [:p (:snippet phone)]])

 (defn matches-query?
   [search-input phone]
@@ -62,7 +62,7 @@
     (fn []
       [:ul {:class "phones"}
        (for [phone (filter (partial matches-query? @search-input) @phones)]
-         ^{:key phone} [phone-component phone])])))
+         ^{:key (:name phone)} [phone-component phone])])))

 (defn search-component
   []


Refactor oauth ui routes

Refactor oauth ui routes

--- src/cljs/salava/oauth/ui/routes.cljs
+++ src/cljs/salava/oauth/ui/routes.cljs
@@ -14,8 +14,7 @@
      (str (base-path context) "/user/oauth/google") {:weight 46 :title (t :oauth/Google) :site-navi true :breadcrumb (t :user/User " / " :oauth/Google)}})

 (defn ^:export navi [context]
- (or (as-> {} $
-       (when (session/get-in [:facebook-app-id]) (assoc $ (str (base-path context) "/user/oauth/facebook") {:weight 44 :title (t :oauth/Facebook) :site-navi true :breadcrumb (t :user/User " / " :oauth/Facebook)}))
-       (when (session/get-in [:linkedin-app-id]) (assoc $ (str (base-path context) "/user/oauth/linkedin") {:weight 45 :title (t :oauth/Linkedin) :site-navi true :breadcrumb (t :user/User " / " :oauth/Linkedin)}))
-       (when (session/get-in [:google-app-id]) (assoc $ (str (base-path context) "/user/oauth/google") {:weight 46 :title (t :oauth/Google) :site-navi true :breadcrumb (t :user/User " / " :oauth/Google)})))
-  {}))
+ (as-> {} $
+   (if-not (blank? (session/get-in [:facebook-app-id])) (assoc $ (str (base-path context) "/user/oauth/facebook") {:weight 44 :title (t :oauth/Facebook) :site-navi true :breadcrumb (t :user/User " / " :oauth/Facebook)}) (merge $ {}))
+   (if-not (blank? (session/get-in [:linkedin-app-id])) (assoc $ (str (base-path context) "/user/oauth/linkedin") {:weight 45 :title (t :oauth/Linkedin) :site-navi true :breadcrumb (t :user/User " / " :oauth/Linkedin)}) (merge $ {}))
+   (if-not (blank? (session/get-in [:google-app-id])) (assoc $ (str (base-path context) "/user/oauth/google") {:weight 46 :title (t :oauth/Google) :site-navi true :breadcrumb (t :user/User " / " :oauth/Google)}) (merge $ {}))))


renaming

renaming

--- src/cljs/triboard/ai/strategies.cljs
+++ src/cljs/triboard/ai/strategies.cljs
@@ -9,26 +9,27 @@
 ;; TODO - For the AI sensible to the number of moves
 ;; We want to count the number of transitions available for the player

-(defn- eval-leaf-score
+(defn- eval-next-score-of
   "Evaluate the score of a leaf turn by looking at its transition
    In effect, it will look the score one level after"
-  [ai {:keys [scores] :as turn} eval-score]
+  [ai {:keys [scores] :as turn} players]
   (minimax/minimax-step ai turn
     (fn [_ transition]
-      (eval-score (scores/update-scores scores transition))
+      (let [scores (scores/update-scores scores transition)]
+        (apply + (map #(get scores %) players)))
       )))

 (defn optimize-own-score-ai
   [player]
   (reify minimax/AIStrategy
-    (eval-turn [this turn] (eval-leaf-score this turn #(get % player)))
+    (eval-turn [this turn] (eval-next-score-of this turn [player]))
     (maximizing? [_ turn] (= (:player turn) player))
     ))

 (defn optmize-ai-scores-ai
   []
   (reify minimax/AIStrategy
-    (eval-turn [this turn] (eval-leaf-score this turn #(+ (:red %) (:green %))))
+    (eval-turn [this turn] (eval-next-score-of this turn [:red :green]))
     (maximizing? [_ turn] (not= (:player turn) :blue))
     ))


Restore calculator state from Bundle

Restore calculator state from Bundle

--- src/clojure/warreq/kea/calc/calc.clj
+++ src/clojure/warreq/kea/calc/calc.clj
@@ -9,6 +9,7 @@
             [warreq.kea.calc.util :as u]
             [warreq.kea.calc.math :as math])
   (:import android.widget.EditText
+           android.os.Bundle
            android.widget.TextView
            android.graphics.Typeface
            android.text.InputType))
@@ -100,8 +101,8 @@
       [:edit-text {:id ::z
                    :input-type 0
                    :single-line true
-                   :layout-height (if landscape? [34 :dp] [64 :dp])
-                   :text-size (if landscape? [22 :sp] [44 :sp])
+                   :layout-height (if landscape? [48 :dp] [68 :dp])
+                   :text-size (if landscape? [22 :sp] [42 :sp])
                    :typeface android.graphics.Typeface/MONOSPACE
                    :gravity :left
                    :layout-width :fill
@@ -133,6 +134,9 @@
   :features [:no-title]
   (onCreate [this bundle]
             (.superOnCreate this bundle)
+            (when (not= nil bundle)
+              (let [s (map bigdec (.getStringArrayList bundle "stack"))]
+                (reset! stack s)))
             (neko.debug/keep-screen-on this)
             (let [landscape? (= (get-screen-orientation) :landscape)]
               (on-ui
@@ -146,6 +150,10 @@
                            (.setText y (str (first new)))
                            (.setText x (str (second new)))
                            (.setText w (str (nth new 2 "")))))))
+  (onSaveInstanceState [this bundle]
+                       (let [s (java.util.ArrayList. (map str (deref stack)))]
+                         (.putStringArrayList bundle "stack" s))
+                       (.superOnSaveInstanceState this bundle))
   (onResume [this]
             (.superOnResume this)
             ;; Force an event to make the watchers update


conform to schema's fn macro

conform to schema's fn macro

--- src/corpus_utils/text.clj
+++ src/corpus_utils/text.clj
@@ -16,7 +16,7 @@

 (sm/defn read-tsv :- [[s/Str]]
   [file :- s/Str
-   & header?]
+   header? :- Boolean]
   (let [records (with-open [r (io/reader file)]
                   (doall (csv/read-csv r :separator \tab :quote 0)))]
     (vec


shift git clone to configuration phase

shift git clone to configuration phase

--- src/dda/pallet/crate/managed_ide.clj
+++ src/dda/pallet/crate/managed_ide.clj
@@ -57,7 +57,7 @@
       (atom/install config))
     ))

-(s/defn install-user
+(s/defn configure-user
   "install common used packages for ide"
   [config :- DdaIdeConfig]
   (let [os-user-name (name (-> config :ide-user))
@@ -76,12 +76,16 @@
       ))
   )

+(s/defmethod dda-crate/dda-configure facility
+  [dda-crate config]
+  "dda managed vm: install configure"
+  (configure-user config)
+  )
+
 (s/defmethod dda-crate/dda-install facility
   [dda-crate config]
   "dda managed vm: install routine"
-  (println config)
   (install-system config)
-  (install-user config)
   )

 (s/defmethod dda-crate/dda-settings facility


Fix bug where extract-series just emitted nil

(Not in a stable version, so no worries)

--- src/clj/com/hypirion/clj_xchart.clj
+++ src/clj/com/hypirion/clj_xchart.clj
@@ -757,7 +757,7 @@
   Example: (extract-series {:x f, :y g, :bubble bubble} coll)
         == {:x (map f coll), :y (map g coll), :bubble (map bubble coll)}"
   [keymap coll]
-  (map-vals #(% coll) keymap))
+  (map-vals #(map % coll) keymap))

 (defn- normalize-group
   [m]