Fix formatting

Fix formatting

--- mtg-pairings-server/src/cljc/mtg_pairings_server/util.cljc
+++ mtg-pairings-server/src/cljc/mtg_pairings_server/util.cljc
@@ -19,7 +19,7 @@
   [m f]
   (persistent!
    (reduce-kv (fn [acc k v]
-               (assoc! acc k (f v)))
+                (assoc! acc k (f v)))
               (transient {})
               m)))

@@ -27,12 +27,12 @@
   [map keys]
   (persistent!
    (reduce (fn [acc k]
-            (let [[from to] (if (coll? k)
-                              k
-                              [k k])]
-              (if-let [entry (find map from)]
-                (assoc! acc to (val entry))
-                acc)))
+             (let [[from to] (if (coll? k)
+                               k
+                               [k k])]
+               (if-let [entry (find map from)]
+                 (assoc! acc to (val entry))
+                 acc)))
            (transient {})
            keys)))


remove unneeded :require

remove unneeded :require

--- src/metabase/driver/postgres.clj
+++ src/metabase/driver/postgres.clj
@@ -4,7 +4,6 @@
                      [string :as s])
             [korma.db :as kdb]
             [swiss.arrows :refer :all]
-            [metabase.config :as config]
             [metabase.driver :as driver]
             (metabase.driver [generic-sql :as generic-sql]
                              [interface :as i])))


strip out unnecessary logging.

strip out unnecessary logging.

--- src/metabase/middleware/auth.clj
+++ src/metabase/middleware/auth.clj
@@ -46,7 +46,7 @@
           session-age-ms (- (System/currentTimeMillis) (.getTime (get session :created_at (java.util.Date. 0))))]
       ;; If the session exists and is not expired (max-session-age > session-age) then validation is good
       (if (and session (> (:max-session-age config/app-defaults) (quot session-age-ms 60000)))
-        (do (println "passing") (handler (assoc request :metabase-userid (:user_id session))))
+        (handler (assoc request :metabase-userid (:user_id session)))
         ;; default response is 401
         response-unauthentic))))


Changing expected caches for the bootstrap application.

--- system-int-test/test/cmr/system_int_test/admin/cache_api_test.clj
+++ system-int-test/test/cmr/system_int_test/admin/cache_api_test.clj
@@ -85,7 +85,7 @@
       (s/only-with-real-database
         (testing "list caches for bootstrap"
           (let [response (list-caches-for-app (url/bootstrap-read-caches-url) admin-read-token)]
-            (is (= ["token-imp"] response))))))
+            (is (= ["token-imp" "kms"] response))))))

     (testing "normal user cannot access cache list API"


More on reducers.

More on reducers.

--- test/com/nomistech/clojure_the_language/reducers_rumford_test.clj
+++ test/com/nomistech/clojure_the_language/reducers_rumford_test.clj
@@ -58,11 +58,11 @@
   (r/reduce + 0 ((r/map person--child?->1) village))
   => 8)

-(fact
+(fact "can have same 'shape' usage as old-style `map` etc functions"
   (r/reduce + 0 (r/map person--child?->1 village))
   => 8)

-(fact
+(fact "reducing functions are composable"
   (r/reduce + 0 ((comp (r/map (constantly 1))
                        (r/filter person--child?))
                  village))
@@ -401,3 +401,38 @@
 ;;;; ---------------------------------------------------------------------------
 ;;;; nomis stuff

+;;;; ---------------------------------------------------------------------------
+;;;; Demo of ordering
+
+(reduce +  0 ((comp (partial map (fn [x] (println "doing +") (+ x 10)))
+                    (partial map (fn [x] (println "doing *") (* x 10))))
+              [1 2 3]))
+;; doing *
+;; doing *
+;; doing *
+;; doing +
+;; doing +
+;; doing +
+
+(reduce +  0 ((comp (r/map (fn [x] (println "doing +") (+ x 10)))
+                    (r/map (fn [x] (println "doing *") (* x 10))))
+              [1 2 3]))
+;; doing *
+;; doing +
+;; doing *
+;; doing +
+;; doing *
+;; doing +
+
+;;;; ---------------------------------------------------------------------------
+;;;; Example from Rich Hickey's EuroClojure 2012 talk:
+;;;;     http://vimeo.com/channels/357487/45561411
+
+#_
+(let [v (into [] (range 10000000))]
+  [(time (reduce + (map inc (filter even? v))))
+   (time (reduce + (r/map inc (r/filter even? v))))
+   (time (r/fold + (r/map inc (r/filter even? v))))])
+;; "Elapsed time: 1298.577 msecs"
+;; "Elapsed time: 901.575 msecs"
+;; "Elapsed time: 636.778 msecs"


Add << and >> shortcuts for adref and areset!

--- src/main/audio_utils/util.cljs
+++ src/main/audio_utils/util.cljs
@@ -18,6 +18,9 @@
 (defn aderef
   [x]
   (aget x 0))
+
+(def << aderef)
+(def >> areset!)

 ;;;; Time/samples and dB/amplitude conversion


Some tweaks about apply-by

Some tweaks about apply-by

--- src/overtone_workspace/beats.clj
+++ src/overtone_workspace/beats.clj
@@ -162,6 +162,10 @@
             #'init-latchbell-mod [(:rate @latchbell-arg)])
   (apply-by (sequencer-metro (- (next-beat (sequencer-metro) 0 (* 8 beat-per-pattern)) 1/256))
             #'swap! [*beats assoc laserbeam [d _ _ [_ d d] (vec (repeat 64 0.5)) _ _ d _ _ d _ b _ _ [d d d]]])
+  (apply-by (sequencer-metro (- (next-beat (sequencer-metro) 0 (* 4 beat-per-pattern)) 1/256))
+            swap! *beats assoc laserbeam [d _ _ [_ d d] (vec (repeat 64 0.5)) _ _ d _ _ d _ b _ _ [d d d]] [])
+  (apply-by (sequencer-metro (- (next-beat (sequencer-metro) 0 (* 4 beat-per-pattern)) 1/256))
+            swap! *beats assoc laserbeam [d _ _ _ b _ _ d _ _ d _ b _ _ d] [])
   (apply-by (sequencer-metro (- (next-beat (sequencer-metro) 0 (* 8 beat-per-pattern)) 1/256))
             #'swap! [*beats assoc latchbell (vec (repeat 24 a))])

@@ -173,7 +177,6 @@
     (swap! *beats16 assoc laserbeam [_]))
   (swap! *beats assoc latchbell [a _ a _ a _ a _ a _ a _ a _ a _])
   (swap! *beats assoc latchbell [a a  a  a [a a a]])
-  (swap! *beats assoc laserbeam [d _ _ _ b _ _ d _ _ d _ b _ _ d])
   (swap! *beats assoc laserbeam [d c c c b c c d c c d c b c c d])
   (swap! *beats assoc laserbeam (take 16 (cycle [d b c d c b [d] c c [c c c] d])))
   (swap! *beats assoc laserbeam (vec (repeat 16 c)))


Refactored state handling in sequencer.

Refactored state handling in sequencer.

--- src/overtone/gui/sequencer.clj
+++ src/overtone/gui/sequencer.clj
@@ -4,55 +4,65 @@
         [seesaw core mig])
   (:require [seesaw.bind :as bind]))

+(defn- make-initial-state [metro steps instruments]
+  {:playing?  false
+   :metronome metro
+   :rows      (into
+                {}
+                (for [i instruments]
+                  [(:name i) (vec (repeat steps false))]))})
+
+(defn- toggle-playing [state]
+  (update-in state [:playing?] not))
+
+(defn- set-step-state [state step-vec inst]
+  (assoc-in state [:rows (:name inst)] step-vec))
+
 (defn- step-player
-  [playing? metro beat steps instruments step-states]
-  (when @playing?
-    (let [index (mod beat steps)
-          next-beat (inc beat)]
-      (doseq [inst instruments]
-        (when @(nth (get step-states (:name inst)) index)
-          (at (metro beat) (inst))))
-    (apply-at (metro next-beat) #'step-player
-              [playing? metro next-beat steps instruments step-states]))))
+  [state-atom beat steps instruments]
+  (let [state @state-atom]
+    (when (:playing? state)
+      (let [metro (:metronome state)
+            index (mod beat steps)
+            next-beat (inc beat)]
+        (doseq [inst instruments]
+          (when (nth (get-in state [:rows (:name inst)]) index)
+            (at (metro beat) (inst))))
+        (apply-at (metro next-beat) #'step-player
+                  [state-atom next-beat steps instruments])))))

 (defn- step-row
-  [ins steps states]
+  [ins steps state-atom]
   (let [lbl [(label (:name ins)) "gap 5px, gapright 10px"]
         btns (repeatedly steps #(toggle :selected? false))
-        btns-constrained (map (fn [b] [b "width 25:25:25"]) btns)
-        btns-states (partition 2 (interleave btns states))]
-    (doseq [[btn state] btns-states]
-      (bind/bind btn state))
-    (apply vector lbl btns-constrained)))
+        btns-constrained (map (fn [b] [b "width 25:25:25"]) btns)]
+    ; Route changes in buttons to changes in state vector for row
+    (bind/bind
+      (apply bind/funnel btns)
+      (bind/b-swap! state-atom set-step-state ins))
+
+    (apply vector lbl btns-constrained) ))

 (defn step-sequencer
   [metro steps & instruments]
   (invoke-now
-    (let [play-btn (button :text "play")
-          control-pane (horizontal-panel :items [play-btn])
-          step-states (into {}
-                            (for [i instruments]
-                              [(:name i) (vec (repeatedly steps #(atom false)))]))
-          step-rows (mapcat #(step-row % steps (get step-states (:name %))) instruments)
-          seq-pane (mig-panel :constraints [(str "wrap " (inc steps)) "" ""]
-                          :items step-rows)
-          f (frame :title "Sequencer"
-                   :content (vertical-panel :items [control-pane seq-pane])
-                   :on-close :dispose)
-          playing? (atom false)]
+    (let [state-atom   (atom (make-initial-state metro steps instruments))
+          play-btn     (button :text "play")
+          control-pane (toolbar :floatable? false :items [play-btn])
+          seq-pane     (mig-panel :constraints [(str "wrap " (inc steps)) "" ""]
+                                  :items (mapcat #(step-row % steps state-atom) instruments))
+          f (frame :title    "Sequencer"
+                   :content  (border-panel :north control-pane :center seq-pane)
+                   :on-close :dispose)]
       (listen play-btn :action
               (fn [e]
-                (if @playing?
-                  (do
-                    (reset! playing? false)
-                    (invoke-later (config! play-btn :text "play")))
-                  (do
-                    (reset! playing? true)
-                    (step-player playing? metro (metro) steps instruments step-states)
-                    (invoke-later (config! play-btn :text "stop"))))))
+                (let [playing? (:playing? (swap! state-atom toggle-playing))]
+                  (config! play-btn :text (if playing? "stop" "play"))
+                  (if playing?
+                    (step-player state-atom (metro) steps instruments)))))
+
       (with-meta {:frame (-> f pack! show!)
-                  :state step-states
-                  :playing? playing?}
+                  :state state-atom }
                  {:type :sequencer}))))

 (comment


Minor rename on toolboxes components.

Minor rename on toolboxes components.

--- frontend/uxbox/ui/workspace/toolboxes.cljs
+++ frontend/uxbox/ui/workspace/toolboxes.cljs
@@ -4,17 +4,21 @@
             [uxbox.router :as r]
             [uxbox.rstore :as rs]
             [uxbox.state :as s]
+            [uxbox.shapes :as shapes]
+            [uxbox.library :as library]
+            [uxbox.util.data :refer (read-string)]
             [uxbox.data.workspace :as dw]
             [uxbox.ui.workspace.base :as wb]
             [uxbox.ui.icons :as i]
             [uxbox.ui.mixins :as mx]
+            [uxbox.ui.dom :as dom]
             [uxbox.ui.util :as util]))

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; Draw Tools
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

-(def ^:staric draw-tools
+(def ^:staric +draw-tools+
   {:rect
    {:icon i/box
     :help "Box (Ctrl + B)"
@@ -32,11 +36,11 @@
 ;; Draw Tool Box
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

-(defn draw-toolbox-render
+(defn draw-tools-render
   [open-toolboxes]
   (let [workspace (rum/react wb/workspace-state)
         close #(rs/emit! (dw/toggle-toolbox :draw))
-        tools (->> (into [] draw-tools)
+        tools (->> (into [] +draw-tools+)
                    (sort-by (comp :priority second)))]
     (html
      [:div#form-tools.tool-window
@@ -52,20 +56,10 @@
            :on-click (constantly nil)}
           (:icon props)])]])))

-;; #_(for [tool (t/sorted-tools (rum/react t/drawing-tools))]
-;;   [:div.tool-btn.tooltip.tooltip-hover
-;;    {:alt (:text tool)
-;;     :class (when (= (rum/react ws/selected-tool)
-;;                     [(:key tool)])
-;;              "selected")
-;;     :key (:key tool)
-;;     :on-click #(ws/toggle-tool! [(:key tool)])}
-;;    (:icon tool)])]])))
-
-(def ^:static draw-toolbox
+(def ^:static draw-tools
   (util/component
-   {:render draw-toolbox-render
-    :name "draw-toolbox"
+   {:render draw-tools-render
+    :name "draw-tools"
     :mixins [mx/static rum/reactive]}))

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -75,9 +69,7 @@
 (defn layers-render
   []
   (let [workspace (rum/react wb/workspace-state)
-        close #(rs/emit! (dw/toggle-toolbox :layers))
-        tools (->> (into [] draw-tools)
-                   (sort-by (comp :priority second)))]
+        close #(rs/emit! (dw/toggle-toolbox :layers))]
     (html
      [:div#layers.tool-window
       [:div.tool-window-bar


show spinner when ajax is taking long (fixes #2)

--- src/deathrow/routes.cljs
+++ src/deathrow/routes.cljs
@@ -44,17 +44,20 @@
 				;(secretary/dispatch! (.-pathname (.-target %)))
 				;(.setToken hist (.-pathname (.-target %)))
 				))))
-
+
+
 (declare random-path)
 (declare offenders-path)
+
 (defroute root-path "/"
 	[]
-	(jayq/ajax "http://deathrow.herokuapp.com/offenders/random"
-	            {:dataType "json"
-	             :success  (fn [data status xhr]
-	             				(render-quote (js->clj data :keywordize-keys true)))
-	             :error render-error-quote
-	             :timeout 10000}))
+	(let [ajax-timeout (atom 0)]
+		(jayq/ajax "http://deathrow.herokuapp.com/offenders/random"
+			{:dataType "json"
+			:beforeSend #(reset! ajax-timeout (js/setTimeout render-spinner 1000))
+			:success #(do (js/clearTimeout @ajax-timeout) (render-quote (js->clj %1 :keywordize-keys true)))
+			:error render-error-quote
+			:timeout 10000})))

 (defroute offenders-path "/offenders"
 	[]


Privatized some things.

Privatized some things.

--- src/midje/util/checkers.clj
+++ src/midje/util/checkers.clj
@@ -3,7 +3,7 @@
 (ns midje.util.checkers
   (:use [clojure.set :only [difference union subset?]]
         [clojure.contrib.seq :only [rotations]]
-        [clojure.contrib.def :only [defmacro-]]
+        [clojure.contrib.def :only [defmacro- defvar-]]
         [clojure.contrib.pprint :only [cl-format]]
         [clojure.contrib.combinatorics :only [permutations]]
         [midje.util.form-utils :only [regex? vector-without-element-at-index
@@ -139,9 +139,9 @@
  ;;Concerning Throwables

-(def #^{:private true} captured-exception-key "this Throwable was captured by midje:")
+(def captured-exception-key "this Throwable was captured by midje:")
 (defn captured-exception [e] {captured-exception-key e})
-(defn captured-exception? [value] (and (map? value) (value captured-exception-key)))
+(defn- captured-exception? [value] (and (map? value) (value captured-exception-key)))

 (defn- throwable-with-class? [wrapped-throwable expected-class]
   (and (map? wrapped-throwable)
@@ -246,7 +246,7 @@

 (defn- midje-classification [thing] (if (map? thing) ::map ::not-map))

-(defmulti collection-string
+(defmulti #^{:private true} collection-string
   "Given a list of stringified elements, convert them into appropriate
    collection text."
   (fn [midje-classification elements] midje-classification))
@@ -258,7 +258,7 @@
    (str "[" (apply str (interpose " " elements)) "]"))
 ;;-

-(defmulti best-actual-match
+(defmulti #^{:private true} best-actual-match
   "Describe the best actuals found in the comparison."
   (fn [midje-classification comparison] midje-classification))

@@ -275,7 +275,7 @@
 ;;-

-(defmulti best-expected-match
+(defmulti #^{:private true} best-expected-match
   "Describe the best list of expected values found in the comparison."
   (fn [midje-classification comparison expected] midje-classification))

@@ -313,14 +313,14 @@

 ;;-

-(defmulti compare-results
+(defmulti #^{:private true} compare-results
   (fn [actual expected looseness]
     (if (= ::map (midje-classification actual))
       (midje-classification actual)
       [::not-map (or (some #{:in-any-order} looseness) :strict-order)])))

 ;; There are some incommensurable utility behaviors
-(defn compare-one-map-permutation [actual expected keys]
+(defn- compare-one-map-permutation [actual expected keys]
   ;;  (prn "map-comparison" actual expected)
   (reduce (fn [so-far key]
             (if (and (find actual key)
@@ -332,7 +332,7 @@
           keys))

-(defn compare-one-seq-permutation
+(defn- compare-one-seq-permutation
   "Compare actual elements to expected, which is one of perhaps many
    permutations of the original expected list. looseness is a subset of
    #{:gaps-ok :in-any-order}."
@@ -459,7 +459,7 @@
  ;; Initial argument processing

-(defn compatibility-check [actual expected looseness]
+(defn- compatibility-check [actual expected looseness]
   "Fling an error of the combination of actual, expected, and looseness won't work."
   ;; Throwing Errors is just an implementation convenience.
   (cond (regex? expected)
@@ -521,7 +521,7 @@
 ;;

-(defn match? [actual expected looseness]
+(defn- match? [actual expected looseness]
   (let [comparison (compare-results  actual expected looseness)]
     (or (total-match? comparison)
         (apply noted-falsehood


Values from CLJS land should have greenish background

--- src/devtools/format.cljs
+++ src/devtools/format.cljs
@@ -14,6 +14,7 @@
 (def span "span")
 (def ol "ol")
 (def li "li")
+(def general-cljs-land-style "background-color:#efe")

 (declare inlined-value-template)

@@ -151,10 +152,17 @@
     (seq? value) (header-seq-template value)
     (coll? value) (header-coll-template value)))

+(defn wrap-cljs-land-if-needed [needed? tmpl]
+  (if needed?
+    (template span general-cljs-land-style tmpl)
+    tmpl))
+
 (defn inlined-value-template [value]
-  (or (atomic-template value)
-      (js-object-template value)
-      (generic-template value)))
+  (let [tmpl (or
+               (atomic-template value)
+               (js-object-template value)
+               (generic-template value))]
+    (wrap-cljs-land-if-needed (cljs-value? value) tmpl)))

 (defn header-template [value]
   (or (atomic-template value)
@@ -162,7 +170,7 @@
       (pr-str value)))

 (defn build-header [value]
-  (template span "background-color:#efe" (header-template value)))
+  (wrap-cljs-land-if-needed true (header-template value)))

 (defn standard-body-template [lines]
   (template ol standard-ol-style (map #(template li standard-li-style %) lines)))


proper content-type

proper content-type

--- src/dwc_services/api.clj
+++ src/dwc_services/api.clj
@@ -17,7 +17,11 @@
 (defn safe
   ""
   [fun]
-   (try (fun)
+   (try
+     (let [data (fun)]
+       (if (string? data)
+         {:headers {"Content-Type" "application/json"} :body data}
+         data))
     (catch Exception e
       (do
         (.printStackTrace e)
@@ -40,7 +44,7 @@
               {:status 200 :body "ok"})
             {:status 200
              :headers {"Content-Disposition" (str "attachment; filename=\"dwc." to "\"")
-                       "Content-Type" (get ctypes to)}
+                       "Content-Type" (get ctypes (keyword to ))}
              :body (convert {:from from :to to :source url :fixes (:fixes params)})})
           {:status 400 :body "Must provide 'to' parameter of the output format."})
         {:status 400 :body "Must provide 'from' parameter of the input format."})
@@ -61,7 +65,7 @@

   (POST "/validate" req
     (if-let [data (:body req)]
-      (safe #(write-str (validation data)))
+      (safe #({:headers {"Content-Type" "application/json"} :body ( write-str (validation data) ) }))
       {:status 400 :body "Must provide occurrence json of data as input."}))

   (GET "/fix" {params :params}


step1-HelloFamous

--- examples/lesson-carousel-starter-kit/src/carousel/core.cljs
+++ examples/lesson-carousel-starter-kit/src/carousel/core.cljs
@@ -11,10 +11,10 @@
 (defn Carousel [selector data]
   (let [context (.. FamousEngine (createScene selector))
         root (.. context addChild)
-        el (DOMElement. root)
-        _ (.. el (setContent "Hello World")
-              (setProperty "font-size" "40px")
-              (setProperty "color" "white"))
+        el (.. (DOMElement. root)
+               (setContent "Hello Famous")
+               (setProperty "font-size" "40px")
+               (setProperty "color" "white"))
         carousel-obj {:context  context
                       :root     root
                       :el el}]


minor

minor

--- src-cljs/tourney_nerd/core.cljs
+++ src-cljs/tourney_nerd/core.cljs
@@ -92,15 +92,17 @@
 (def victory-points-for-a-tie 1000)

 (def empty-result
-  {:team-id nil
+  {:games-lost 0
+   :games-played 0
+   :games-tied 0
    :games-won 0
-   :games-lost 0
-   :games-tied 0
-   :games-played 0
-   :points-won 0
+   :points-diff 0
    :points-lost 0
    :points-played 0
-   :points-diff 0
+   :points-won 0
+   :team-id nil
+   :team-name nil
+   :team-captain nil
    :victory-points 0})

 (defn- add-game-to-result [result game]
@@ -124,14 +126,14 @@
         scored-for (if (= team-id teamA-id) scoreA scoreB)
         scored-against (if (= team-id teamA-id) scoreB scoreA)]
     (assoc result
+      :games-lost (if lost? (inc games-lost) games-lost)
+      :games-played (inc games-played)
+      :games-tied (if tied? (inc games-tied) games-tied)
       :games-won (if won? (inc games-won) games-won)
-      :games-lost (if lost? (inc games-lost) games-lost)
-      :games-tied (if tied? (inc games-tied) games-tied)
-      :games-played (inc games-played)
-      :points-won (+ points-won scored-for)
+      :points-diff (+ points-diff scored-for (* -1 scored-against))
       :points-lost (+ points-lost scored-against)
       :points-played (+ points-played scoreA scoreB)
-      :points-diff (+ points-diff scored-for (* -1 scored-against))
+      :points-won (+ points-won scored-for)
       :victory-points (+ victory-points
                          (if won? victory-points-for-a-win 0)
                          (if tied? victory-points-for-a-tie 0)
@@ -147,9 +149,9 @@
                                                      (= (:teamB-id %) (name team-id))))
                                            (vals games))]
     (reduce add-game-to-result
-            (assoc empty-result :team-id (name team-id)
-                                :team-name (:name team)
-                                :team-captain (:captain team))
+            (assoc empty-result :team-captain (:captain team)
+                                :team-id (name team-id)
+                                :team-name (:name team))
             games-this-team-has-played)))

 (defn- compare-victory-points [a b]


working for clj and cljs tests

working for clj and cljs tests


Note that tx-range is lazy

Note that tx-range is lazy

--- src/onyx/plugin/datomic.clj
+++ src/onyx/plugin/datomic.clj
@@ -214,6 +214,8 @@
         producer-ch (thread
                       (try
                         (loop [tx-index start-tx]
+                          ;; tx-range called up to maximum tx in each iteration
+                          ;; relies on the fact that tx-range is lazy, therefore only read-size elements will be realised
                           (if-let [entries (seq
                                              (take read-size
                                                    (seq


more output

more output

--- src/fowles/requester.clj
+++ src/fowles/requester.clj
@@ -33,6 +33,7 @@
        from-ch  ([uri] (if (nil? uri)
                          (recur i)
                          (do
+                           (println "getting URI:" uri)
                            (async-get uri to-ch)
                            (recur (inc i)))))


Make add-timer! return nil

Make add-timer! return nil

--- src/play_clj/core_utils.clj
+++ src/play_clj/core_utils.clj
@@ -111,11 +111,11 @@
     new-timer))

 (defn add-timer!
-  "Returns a [Timer](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/utils/Timer.html)
-which runs which will fire the :on-timer function one or more times (depending
-on the given arguments). In the :on-timer function, the id will be passed in the
-screen map. If a timer with that id already exists in the screen, it will be
-stopped and replaced with a new timer.
+  "Creates a [Timer](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/utils/Timer.html)
+which will fire the :on-timer function one or more times (depending on the given
+arguments). In the :on-timer function, the id will be passed in the screen map.
+If a timer with that id already exists in the screen, it will be stopped and
+replaced with a new timer.

     ; wait 2 seconds and run once
     (add-timer! screen :spawn-enemy 2)
@@ -124,14 +124,14 @@
     ; wait 2 seconds, run once, and then run 3 more times at 10 second intervals
     (add-timer! screen :spawn-enemy 2 10 3)"
   ([screen id delay]
-    (doto (create-and-add-timer! screen id)
-      (.scheduleTask (task* screen id) delay)))
+    (-> (create-and-add-timer! screen id)
+        (.scheduleTask (task* screen id) delay)))
   ([screen id delay interval]
-    (doto (create-and-add-timer! screen id)
-      (.scheduleTask (task* screen id) delay interval)))
+    (-> (create-and-add-timer! screen id)
+        (.scheduleTask (task* screen id) delay interval)))
   ([screen id delay interval repeat]
-    (doto (create-and-add-timer! screen id)
-      (.scheduleTask (task* screen id) delay interval repeat))))
+    (-> (create-and-add-timer! screen id)
+        (.scheduleTask (task* screen id) delay interval repeat))))

 (defn remove-timer!
   "Stops and removes the timer associated with `id`, returning it or nil if not


Add on-gl

Add on-gl

--- src/play_clj/core_utils.clj
+++ src/play_clj/core_utils.clj
@@ -1,4 +1,11 @@
 (in-ns 'play-clj.core)
+
+(defmacro on-gl
+  "Runs the macro body on the GL thread.
+
+    (on-gl (set-screen! hello-world main-screen))"
+  [& body]
+  `(app! :post-runnable (fn [] ~@body)))

 ; static fields


fix muuntaja interceptor

fix muuntaja interceptor

--- modules/reitit-interceptors/src/reitit/http/interceptors/muuntaja.clj
+++ modules/reitit-interceptors/src/reitit/http/interceptors/muuntaja.clj
@@ -101,5 +101,5 @@
     :compile (fn [{:keys [muuntaja]} _]
                (if-let [muuntaja (or muuntaja default-muuntaja)]
                  (merge
-                   (stripped (muuntaja.interceptor/format-request-interceptor muuntaja))
+                   (stripped (muuntaja.interceptor/format-response-interceptor muuntaja))
                    {:data {:swagger {:produces (displace (m/encodes muuntaja))}}})))}))


clean up some docs, refactor a tiny bit

clean up some docs, refactor a tiny bit

--- src/r_incantations/core.clj
+++ src/r_incantations/core.clj
@@ -36,7 +36,8 @@
     (sh "R" "--no-save" "-q" :in r)))

 (defn plot-summed-vectors-pandas
-  "Doesn't work. On my system, Canopy's wx dependency is the issue."
+  "Doesn't work. On my system, Canopy's wx dependency is the issue.
+   I'm not going to bother chasing this down."
   []
   (let [p "
 import numpy as np
@@ -50,16 +51,9 @@
     (spit "/tmp/a.py" p)
     ))

-(defn read-strings1 [coll]
-  (map (fn read-strings- [t]
-         (try
-           (let [s (edn/read-string t)]
-             (if (symbol? s)
-               (str s)
-               s))
-           (catch Exception e t)))
-       coll))
-
+;;----------------------------
+;; Data-Driven Security ch03
+;;----------------------------
 (defn read-alienvault-reputation-data []
   (-> "book-data/book/ch03/data/reputation.data"
       (incanter.io/read-dataset :delim \#)
@@ -113,7 +107,8 @@

 (defn get-iana-ipv4-allocations []
   (-> "book-data/book/ch04/data/ipv4-address-space.csv"
-      ;; eat the headers, but don't use them because one column has a SPACE in the name and clojure.core/keyword allows this
+      ;; Eat the headers, but don't use them because one column has a
+      ;; space in the name and clojure.core/keyword allows this. (BAH!)
       (incanter.io/read-dataset :skip 1)
       (incanter.core/col-names
        [:Prefix :Designation :Date :Whois :Status :Note])))
@@ -126,7 +121,8 @@
                    (incanter.core/$ :Prefix iana))
               iana)
         ;; We don't technically need a derived column, here; we just
-        ;; need a seq of all the IP prefixes in av. But this is one way to do it.
+        ;; need a seq of all the IP prefixes in av. But this is one
+        ;; way to do it.
         av (incanter.core/add-derived-column
             :IP.Prefix
             ["IP"]
@@ -157,9 +153,11 @@
                    (assoc tab row (inc cnt))))
                (inc i))))))

+;;----------------------------
+;; Data-Driven Security ch05
+;;----------------------------
 (defn get-zeroaccess-data []
   (-> "book-data/book/ch05/data/zeroaccess.csv"
-      ;; eat the headers, but don't use them because one column has a SPACE in the name and clojure.core/keyword allows this
       (incanter.io/read-dataset :header true)))

 (defn get-state-population-data []
@@ -183,10 +181,8 @@
         incanter.core/view)))

 (defn get-world []
-  (let [filepath "world.csv"]
-    (-> filepath
-        ;; eat the headers, but don't use them because one column has a SPACE in the name and clojure.core/keyword allows this
-        (incanter.io/read-dataset :header true))))
+  (-> "world.csv"
+      (incanter.io/read-dataset :header true)))

 (defn world-map []
   (let [world (get-world)
@@ -211,7 +207,7 @@
     [za users]))

 (defn ch05-3
-  "Based on Listing 5-16 through 5-18"
+  "See listings 5-16 through 5-18"
   [intercept?]
   (let [relation-fn #(* 2 %)
         input (incanter.stats/sample-normal 20000 :mean 10)


take in 'system for helmsman-definition

take in 'system for helmsman-definition

--- test/navigator/test_config.clj
+++ test/navigator/test_config.clj
@@ -11,9 +11,9 @@
 (def system {:datomic-uri "datomic:mem://navigator-test"})
 (def datomic-uri (:datomic-uri system))

-(defn routes [db-conn]
+(defn routes [system]
   (helmsman/compile-routes (into [] (concat timber/helmsman-assets
-                                            (navigator/helmsman-def db-conn)
+                                            (navigator/helmsman-def system)
                                             [[wrap-params]]))))

 (defn start-datomic! [system]
@@ -31,7 +31,7 @@
   system)

 (defn start-jetty! [system]
-  (assoc system :jetty (jetty/run-jetty (routes (:db-conn system)) {:port 8081 :join? false})))
+  (assoc system :jetty (jetty/run-jetty (routes system) {:port 8081 :join? false})))

 (defn stop-jetty! [system]
   (if-let [jetty-server (:jetty system)]


get-wishlist-json view

get-wishlist-json view

--- src/wishlistd/views/wishlist.clj
+++ src/wishlistd/views/wishlist.clj
@@ -26,4 +26,8 @@
 (defn create-wishlist []
   (let [wishlist (insert-wishlist {:title "Default"})
         with-wishes (assoc wishlist :wishes (get-wishes-for-wishlist wishlist))]
-    (wishlist-as-html with-wishes)))+    (wishlist-as-html with-wishes)))
+
+(defn get-wishlist-json [code]
+  (let [wishlist (get-wishlist-with-wishes {:code code})]
+    (response/json (dissoc wishlist :created_at))))


Started reordering the view file

Started reordering the view file

--- src/wishlistd/views/wishlist.clj
+++ src/wishlistd/views/wishlist.clj
@@ -10,15 +10,20 @@
   (common/layout ""))

 (defn create-wishlist-json []
-  (let [wishlist (insert-wishlist {:title "Default"})
-        with-wishes (assoc wishlist :wishes (get-wishes-for-wishlist wishlist))]
-    (response/json (dissoc with-wishes :created_at))))
+  (let [wishlist (create-wishlist-with-wishes)]
+    (response/json (dissoc wishlist :created_at)))) ; not serializable into json
+
+(defpartial wish-as-li [wish]
+  [:label "Description " [:input {:type "text"} (:description wish)]]
+  [:label "URL" [:input {:type "text"} (:url wish)]])
+
+(defpartial wishlist-as-html [wishlist]
+  [:h3 {:class "wishlist-title"} (:title wishlist)]
+  [:ul
+   (wish-as-li nil)
+   (map wish-as-li (:wishes wishlist))])

 (defn create-wishlist []
   (let [wishlist (insert-wishlist {:title "Default"})
         with-wishes (assoc wishlist :wishes (get-wishes-for-wishlist wishlist))]
-    (wishlist-as-html with-wishes)))
-
-(defpartial wishlist-as-html [wishlist]
-  [:h1 (:title wishlist)]
-  [:p "LOLOLOLOL"])
+    (wishlist-as-html with-wishes)))


Unnecessary comment

Unnecessary comment

--- src/wishlistd/views/wishlist.clj
+++ src/wishlistd/views/wishlist.clj
@@ -17,7 +17,7 @@
   (dissoc-date
     (model/update-wishlist wishlist)))

-(defremote read-wishlist [code] ; doesn't need dissoc date
+(defremote read-wishlist [code]
   (model/read-wishlist code))

 (defremote create-wish [wish]


Add two more diagonal test cases for queen attack

The current diagonal tests take place in a situation where the white piece is "to the left and above" the black piece, which means that a technically invalid solution, which does not properly consider all diagonal attack vectors, may pass all test cases.

Given the current test cases:

```clojure
  (is (= true  (queen-attack/can-attack {:w [1 1] :b [6 6]})))
  (is (= true  (queen-attack/can-attack {:w [0 6] :b [1 7]})))
  (is (= true  (queen-attack/can-attack {:w [4 1] :b [6 3]})))
```

If we decompose `w` and `b` as `{[x1 y1] :w, [x2 y2] :b}`, then:

```
x1 <= x2
y1 <= y2
```

This commit adds two more valid diagonal test cases:

```clojure
  (is (= true  (queen-attack/can-attack {:w [2 3] :b [5 0]})))
  (is (= true  (queen-attack/can-attack {:w [2 3] :b [0 5]}))))
```

These will fail certain implementations which would pass the previous test suite, such as:

```clojure
(= (- y2 y1) (- x2 x1))
```

Or:

```clojure
(= (- x1 y1) (- x2 y2))
```

--- exercises/practice/queen-attack/test/queen_attack_test.clj
+++ exercises/practice/queen-attack/test/queen_attack_test.clj
@@ -33,4 +33,6 @@
   (is (= true  (queen-attack/can-attack {:w [5 4] :b [2 4]})))
   (is (= true  (queen-attack/can-attack {:w [1 1] :b [6 6]})))
   (is (= true  (queen-attack/can-attack {:w [0 6] :b [1 7]})))
-  (is (= true  (queen-attack/can-attack {:w [4 1] :b [6 3]}))))
+  (is (= true  (queen-attack/can-attack {:w [4 1] :b [6 3]})))
+  (is (= true  (queen-attack/can-attack {:w [2 3] :b [5 0]})))
+  (is (= true  (queen-attack/can-attack {:w [2 3] :b [0 5]}))))


add conditional exceptions for "essere"

add conditional exceptions for "essere"

--- src/babel/italiano/lexicon.cljc
+++ src/babel/italiano/lexicon.cljc
@@ -1009,7 +1009,14 @@
                                    :3sing "sarà"
                                    :1plur "saremo"
                                    :2plur "sarete"
-                                   :3plur "saranno"}}})]
+                                   :3plur "saranno"}
+
+                          :conditional {:1sing "sarei"
+                                        :2sing "saresti"
+                                        :3sing "sarebbe"
+                                        :1plur "saremmo"
+                                        :2plur "sareste"
+                                        :3plur "sarebberano"}}})]
         [;; essere: adjective
          ;; TODO: unify essere-adjective and essere-intensifier into one lexical entry.
          (let [gender (atom :top)


Makes recaptcha secure and uses new api url.

--- src/cadence/model/recaptcha.clj
+++ src/cadence/model/recaptcha.clj
@@ -5,9 +5,11 @@

 (def ^:dynamic *recaptcha*
-  (let [rconf (:recaptcha config/tokens)]
-    (ReCaptchaFactory/newReCaptcha
-      (:public-key rconf) (:private-key rconf) true)))
+  (let [rconf (:recaptcha config/tokens)
+        recap (ReCaptchaFactory/newSecureReCaptcha
+                (:public-key rconf) (:private-key rconf) true)]
+    (.setRecaptchaServer recap "https://www.google.com/recaptcha/api")
+    recap))

 (defn get-html
   "Returns the html to show the recaptcha."


Start working on comic-list processing

Start working on comic-list processing

--- src/clj/comic_reader/scrape.clj
+++ src/clj/comic_reader/scrape.clj
@@ -1,2 +1,22 @@
 (ns comic-reader.scrape
-  (:require [net.cgrand.enlive-html :as html]))
+  (:require [clojure.string :refer [trim]]
+            [net.cgrand.enlive-html :as html]))
+
+(def sites
+  {"Manga Fox" {:url "http://mangafox.me/manga/"
+                :selector [:div.manga_list :ul :li :a]
+                :normalize (fn [{name :content
+                                 {url :href} :attrs}]
+                             {:name name
+                              :url url})}
+   "Manga Reader" {:url "http://www.mangareader.net/alphabetical"
+                   :selector [:div.series_alpha :ul :li :a]
+                   :normalize (fn [{name :content
+                                    {url :href} :attrs}]
+                                {:name (trim name)
+                                 :url url})}})
+
+(defn fetch-url [url]
+  (html/html-resource (java.net.URL. url)))
+
+(defn fetch-site-list [{:keys [url selector normalize]}])


Change urls for secretary

Change urls for secretary

--- src/cljs/comic_reader/main.cljs
+++ src/cljs/comic_reader/main.cljs
@@ -11,10 +11,10 @@
 (defroute "/" []
   (rf/dispatch [:sites]))

-(defroute "/site/:site" [site]
+(defroute "/comics/:site" [site]
   (rf/dispatch [:comics site]))

-(defroute "/comic/:comic/:volume/:page" {:as location}
+(defroute "/read/:comic/:volume/:page" {:as location}
   (rf/dispatch [:read location]))


Longer alarm duration plz

Longer alarm duration plz

--- src/cljs/mokkameister/core.cljs
+++ src/cljs/mokkameister/core.cljs
@@ -75,7 +75,7 @@
   (swap! state #(assoc % :alarm message))
   (fetch-data!)
   (play-siren!)
-  (go (<! (timeout 30000))
+  (go (<! (timeout (* 2 60 1000)))
       (swap! state #(dissoc % :alarm))))

 (defn subscribe-pusher! []


Make cellsxy-in-viewport much faster

Make cellsxy-in-viewport much faster

--- src/cljx/robinson/viewport.cljx
+++ src/cljx/robinson/viewport.cljx
@@ -262,6 +262,7 @@
         r        (range)
         rrest    (range (inc start-y) v-height)
         dx       (- v-width start-x)
+        rxrest   (range dx v-width)
         _ (println "v-x" v-x)
         _ (println "v-y" v-y)
         _ (println "ax" ax)
@@ -269,53 +270,24 @@
         _ (println "start-x" start-x)
         _ (println "start-y" start-y)
         _ (println "dx" dx)
-        ; upper left quadant
-        cells (->
-              (into [] (mapcat
-                     (fn [line sy]
-                       (into [] (map-indexed (fn [sx cell]
-                             [cell sx sy (+ sx v-x) (+ sy v-y)])
-                           (subvec line start-x))))
-                     (subvec ul-place start-y)
-                     r))
-              (into (mapcat
-                     (fn [line sy]
-                       (into [] (map-indexed (fn [x cell]
-                             [cell (+ x dx) sy (+ x dx v-x) (+ sy v-y)])
-                           (subvec line 0 start-x))))
-                     (subvec ur-place start-y)
-                     r))
-              (into (mapcat
-                     (fn [line sy]
-                       (into [] (map-indexed (fn [sx cell]
-                             [cell sx sy (+ sx v-x) (+ sy v-y)])
-                           (subvec line start-x))))
-                     (subvec ll-place 0 start-y)
-                     rrest))
-              (into (mapcat
-                     (fn [line sy]
-                       (into [] (map-indexed (fn [x cell]
-                             [cell (+ x dx) sy (+ x dx v-x) (+ sy v-y)])
-                            (subvec line 0 start-x))))
-                     (subvec lr-place 0 start-y)
-                     rrest))
-    #_#_cells (reduce into ul-cellsxy
-                  [ur-cellsxy
-                   ll-cellsxy
-                   lr-cellsxy])
-      #_(mapcat concat
-        (map (fn [line1 line2 y]
-               (concat (map vector (subvec line1 start-x) (range) (repeat y) first-wx (repeat (+ v-y y)))
-                       (map vector (subvec line2 0 start-x) first-vx (repeat y) rest-wx (repeat (+ v-y y)))))
-             (subvec ul-place start-y)
-             (subvec ur-place start-y)
-             (range))
-        (map (fn [line3 line4 y]
-               (concat (map vector (subvec line3 start-x) (range) (repeat y) first-wx (repeat (+ v-y y)))
-                       (map vector (subvec line4 0 start-x) first-vx (repeat y) rest-wx (repeat (+ v-y y)))))
-             (subvec ll-place 0 start-y)
-             (subvec lr-place 0 start-y)
-             (range (dec start-y) v-height)))]
+        conj-cells (fn [cells place min-x min-y max-x max-y x-range y-range]
+                     (reduce (fn [cells [line sy]]
+                               (reduce (fn [cells [cell sx]]
+                                         (conj! cells
+                                                [cell sx sy (+ sx v-x) (+ sy v-y)]))
+                                       cells
+                                       (map vector (subvec line min-x max-x)
+                                                   x-range)))
+                             cells
+                             (map vector
+                                  (subvec place min-y max-y)
+                                  y-range)))
+        cells (-> (transient [])
+                    (conj-cells ul-place start-x start-y v-width v-height r      r)
+                    (conj-cells ur-place 0       start-y start-x v-height rxrest r)
+                    (conj-cells ll-place start-x 0       v-width start-y  r      rrest)
+                    (conj-cells lr-place 0       0       v-width start-y  rxrest rrest)
+                    persistent!)]
     ;(log/info "ul-place-id" ul-place-id)
     ;(log/info "ur-place-id" ur-place-id)
     ;(log/info "lr-place-id" lr-place-id)


Updated granule queries to CMR to use the defined bounding box.

--- src/cmr/opendap/ous/granule.clj
+++ src/cmr/opendap/ous/granule.clj
@@ -4,6 +4,7 @@
    [cmr.opendap.const :as const]
    [cmr.opendap.http.request :as request]
    [cmr.opendap.http.response :as response]
+   [cmr.opendap.ous.util :as ous-util]
    [cmr.opendap.util :as util]
    [ring.util.codec :as codec]
    [taoensso.timbre :as log]))
@@ -38,13 +39,17 @@
   [params]
   (let [coll-id (:collection-id params)
         gran-ids (util/remove-empty (:granules params))
-        exclude? (:exclude-granules params)]
+        exclude? (:exclude-granules params)
+        bounding-box (:bounding-box params)]
     (str "collection_concept_id=" coll-id
          (when (seq gran-ids)
           (str "&"
                (if exclude?
                  (build-exclude gran-ids)
-                 (build-include gran-ids)))))))
+                 (build-include gran-ids))))
+         (when (seq bounding-box)
+          (str "&bounding_box="
+               (ous-util/seq->str bounding-box))))))

 (defn async-get-metadata
   "Given a data structure with :collection-id, :granules, and :exclude-granules
@@ -56,6 +61,7 @@
   (let [url (str search-endpoint
                  "/granules?"
                  (build-query params))]
+    (log/debug "Granules query to CMR:" url)
     (request/async-get
      url
      (-> {}
@@ -66,7 +72,7 @@
 (defn extract-metadata
   [promise]
   (let [results @promise]
-    (log/debug "Got results from CMR granule search:" results)
+    (log/trace "Got results from CMR granule search:" results)
     (get-in results [:feed :entry])))

 (defn get-metadata


CMR-4569: Changed the constants to kebab-case.

--- ingest-app/src/cmr/ingest/services/bulk_update_service.clj
+++ ingest-app/src/cmr/ingest/services/bulk_update_service.clj
@@ -33,27 +33,27 @@
   "Indicates bulk update operation completed with errors"
   "FAILED")

-(def ADD_TO_EXISTING
+(def add-to-existing
   "Represents ADD_TO_EXISTING update type"
   "ADD_TO_EXISTING")

-(def FIND_AND_REPLACE
+(def find-and-replace
   "Represents FIND_AND_REPLACE update type"
   "FIND_AND_REPLACE")

-(def FIND_AND_REMOVE
+(def find-and-remove
   "Represents FIND_AND_REMOVE update type"
   "FIND_AND_REMOVE")

-(def FIND_AND_UPDATE
+(def find-and-update
   "Represents FIND_AND_UPDATE update type"
   "FIND_AND_UPDATE")

-(def FIND_AND_UPDATE_HOME_PAGE_URL
+(def find-and-update-home-page-url
   "Represents FIND_AND_UPDATE_HOME_PAGE_URL update type"
   "FIND_AND_UPDATE_HOME_PAGE_URL")

-(def DATA_CENTERS
+(def data-centers
   "Represents DATA_CENTERS update field"
   "DATA_CENTERS")

@@ -64,27 +64,27 @@
   (js/validate-json! bulk-update-schema json)
   (let [body (json/parse-string json true)
         {:keys [update-type update-value find-value update-field]} body]
-    (when (and (not= FIND_AND_REMOVE update-type)
+    (when (and (not= find-and-remove update-type)
                (nil? update-value))
       (errors/throw-service-errors :bad-request
                                    [(format "An update value must be supplied when the update is of type %s"
                                             update-type)]))
-    (when (and (= FIND_AND_UPDATE_HOME_PAGE_URL update-type)
-               (not= DATA_CENTERS update-field))
+    (when (and (= find-and-update-home-page-url update-type)
+               (not= data-centers update-field))
       (errors/throw-service-errors
        :bad-request
-      [(str "FIND_AND_UPDATE_HOME_PAGE_URL update type can not be used for the [" update-field
+      [(str find-and-update-home-page-url " update type can not be used for the [" update-field
             "] update field. "
-            "It can only be used for the DATA_CENTERS update field.")]))
-    (when (and (not= ADD_TO_EXISTING update-type)
+            "It can only be used for the " data-centers " update field.")]))
+    (when (and (not= add-to-existing update-type)
                (sequential? update-value))
       (errors/throw-service-errors
         :bad-request
         [(str "An update value must be a single object for the [" update-type "] update type. "
-              "Arrays are only supported for the ADD_TO_EXISTING update type.")]))
-    (when (and (or (= FIND_AND_REPLACE update-type)
-                   (= FIND_AND_REMOVE update-type)
-                   (= FIND_AND_UPDATE update-type))
+              "Arrays are only supported for the " add-to-existing " update type.")]))
+    (when (and (or (= find-and-replace update-type)
+                   (= find-and-remove update-type)
+                   (= find-and-update update-type))
                (nil? find-value))
       (errors/throw-service-errors :bad-request
                                    [(format "A find value must be supplied when the update is of type %s"


CMR-1863 Corrects DIF 10 platform types to match schema.

--- umm-spec-lib/src/cmr/umm_spec/umm_to_xml_mappings/dif10.clj
+++ umm-spec-lib/src/cmr/umm_spec/umm_to_xml_mappings/dif10.clj
@@ -9,8 +9,7 @@
     "Balloons/Rockets"
     "Earth Observation Satellites"
     "In Situ Land-based Platforms"
-    ;; Sic?
-    "In Sit Ocean-based Platforms"
+    "In Situ Ocean-based Platforms"
     "Interplanetary Spacecraft"
     "Maps/Charts/Photographs"
     "Models/Analyses"


AB & RS | 7 | Use ring middleware wrap content type to serve svg correctly

--- src/stonecutter/handler.clj
+++ src/stonecutter/handler.clj
@@ -1,6 +1,7 @@
 (ns stonecutter.handler
   (:require [ring.middleware.defaults :as ring-mw]
             [ring.middleware.file :as ring-mf]
+            [ring.middleware.content-type :as ring-mct]
             [ring.util.response :as r]
             [ring.adapter.jetty :as ring-jetty]
             [scenic.routes :as scenic]
@@ -114,7 +115,8 @@
       m/wrap-translator
       (m/wrap-config config-m)
       (m/wrap-error-handling err-handler dev-mode?)
-      (m/wrap-custom-static-resources config-m)))
+      (m/wrap-custom-static-resources config-m)
+      ring-mct/wrap-content-type))

 (defn create-api-app [config-m dev-mode?]
   (-> (scenic/scenic-handler routes/routes api-handlers not-found)


Simplify code for tab button

Simplify code for tab button

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

--- src/conexp/contrib/gui/util.clj
+++ src/conexp/contrib/gui/util.clj
@@ -139,24 +139,25 @@
   [^JTabbedPane tabpane, component]
   ;; This contains code copied from TabComponentDemo and
   ;; ButtonTabComponent from the Java Tutorial
-  (let [tabbutton      (proxy [JButton] []
-                         (paintComponent [^Graphics g]
-                           (let [^JButton this this]
-                             (proxy-super paintComponent g)
-                             (let [^Graphics2D g2 (.create g),
-                                   delta 6]
-                               (when (.. this getModel isPressed)
-                                 (.translate g2 1 1))
-                               (.setStroke g2 (BasicStroke. 2))
-                               (.setColor g2 Color/BLACK)
-                               (when (.. this getModel isRollover)
-                                 (.setColor g2 Color/MAGENTA))
-                               (.drawLine g2 delta delta
-                                          (- (. this getWidth) delta 1)
-                                          (- (.  this getHeight) delta 1))
-                               (.drawLine g2 (- (. this getWidth) delta 1) delta
-                                          delta (- (. this getHeight) delta 1))
-                               (.dispose g2)))))]
+  (let [tabbutton (button :paint (fn [^JButton this ^Graphics g]
+                                   (proxy-super paintComponent g)
+                                   (let [^Graphics2D g2 (.create g),
+                                         delta 6]
+                                     (when (.. this getModel isPressed)
+                                       (.translate g2 1 1))
+                                     (.setStroke g2 (BasicStroke. 2))
+                                     (.setColor g2 Color/BLACK)
+                                     (when (.. this getModel isRollover)
+                                       (.setColor g2 Color/MAGENTA))
+                                     (.drawLine g2 delta delta
+                                                (- (. this getWidth) delta 1)
+                                                (- (.  this getHeight) delta 1))
+                                     (.drawLine g2 (- (. this getWidth) delta 1) delta
+                                                delta (- (. this getHeight) delta 1))
+                                     (.dispose g2)))
+                          :preferred-size [17 :by 17]
+                          :tip "Close this tab"
+                          :focusable? false)]
     (doto tabbutton
       (listen :action
               (fn [_]
@@ -171,11 +172,9 @@
                 (let [component (.getComponent evt)]
                   (when (instance? AbstractButton component)
                     (.setBorderPainted ^AbstractButton component false)))))
-      (.setPreferredSize (Dimension. 17 17))
-      (.setToolTipText "Close this tab")
+      (.setBorderPainted false)
       (.setContentAreaFilled false)
-      (.setBorderPainted false)
-      (.setFocusable false))))
+      )))

 (defn- make-tab-head
   "Creates and returns a panel to be used as tab component."


Add stage functions

Add stage functions

Rename `typical-drilling-depth` to `typical-vertical-depth`. Add `typical-toe-measured-depth` and additional functions about stage tops, lengths and extents.

--- src/test_utils/sandbox.cljs
+++ src/test_utils/sandbox.cljs
@@ -1,47 +1,64 @@
-(ns test-utils.sandbox
-  (:require [test-utils.core :as tuc]
-            [test-utils.word-source :as ws]))
-
-;; Stuff I'm trying out
-
-(defn name-abbreviation-pair []
-  (repeatedly 3 ws/rand-word))
-
-(defn person-name []
-  [(ws/rand-word) (if (= 0 (rem (rand-int 300) 3)) (tuc/rand-alpha) "") (ws/rand-word)])
-
-(defn two-digit-zero-pad [number]
-  (if (>= number 10)
-    number
-    (str "0" number)))
-
-(defn date []
-  (str (tuc/rand-range 1999 2023) "-"
-       (two-digit-zero-pad (tuc/rand-range 1 13)) "-"
-       (two-digit-zero-pad (tuc/rand-range 1 32))))
-
-(defn wallclock []
-  (str (two-digit-zero-pad (tuc/rand-range 0 25)) ":"
-       (two-digit-zero-pad (tuc/rand-range 0 60)) ":"
-       (two-digit-zero-pad (tuc/rand-range 0 60))))
-
-(defn date-time []
-  (str (date) "T" (wallclock)))
-
-(defn price []
-  [(tuc/rand-2) (tuc/rand-2)])
-
-(defn tax []
-  [(tuc/rand-digit) (tuc/rand-2)])
-
-(defn typical-drilling-depth []
-  (tuc/draw-normal 8000 1216))
-
-(defn rand-easting []
-  (let [minimum-easting 167000
-        maximum-easting 833000]
-    (tuc/rand-range minimum-easting (inc maximum-easting))))
-
-(defn rand-northing []
-  (let [maximum-northing 1e7]
-    (tuc/rand-range maximum-northing)))
+(ns test-utils.sandbox
+  (:require [test-utils.core :as tuc]
+            [test-utils.word-source :as ws]))
+
+;; Stuff I'm trying out
+
+(defn name-abbreviation-pair []
+  (repeatedly 3 ws/rand-word))
+
+(defn person-name []
+  [(ws/rand-word) (if (= 0 (rem (rand-int 300) 3)) (tuc/rand-alpha) "") (ws/rand-word)])
+
+(defn two-digit-zero-pad [number]
+  (if (>= number 10)
+    number
+    (str "0" number)))
+
+(defn date []
+  (str (tuc/rand-range 1999 2023) "-"
+       (two-digit-zero-pad (tuc/rand-range 1 13)) "-"
+       (two-digit-zero-pad (tuc/rand-range 1 32))))
+
+(defn wallclock []
+  (str (two-digit-zero-pad (tuc/rand-range 0 25)) ":"
+       (two-digit-zero-pad (tuc/rand-range 0 60)) ":"
+       (two-digit-zero-pad (tuc/rand-range 0 60))))
+
+(defn date-time []
+  (str (date) "T" (wallclock)))
+
+(defn price []
+  [(tuc/rand-2) (tuc/rand-2)])
+
+(defn tax []
+  [(tuc/rand-digit) (tuc/rand-2)])
+
+(defn typical-vertical-depth []
+  (tuc/draw-normal 8000 1216))
+
+(defn typical-toe-measured-depth []
+  (tuc/draw-normal 18000 1500))
+
+(defn typical-stage-top []
+  (tuc/draw-normal 13750 2150))
+
+(defn typical-stage-length []
+  (tuc/draw-normal 152 17))
+
+(defn typical-stage-extent
+  ([]
+   (typical-stage-extent typical-stage-top))
+  ([top-f]
+   (let [top (top-f)
+         length (typical-stage-length)]
+     (vector top (+ top length)))))
+
+(defn rand-easting []
+  (let [minimum-easting 167000
+        maximum-easting 833000]
+    (tuc/rand-range minimum-easting (inc maximum-easting))))
+
+(defn rand-northing []
+  (let [maximum-northing 1e7]
+    (tuc/rand-range maximum-northing)))


added test for group-by

added test for group-by

--- pigpen-cascading/src/test/clojure/pigpen/cascading_test.clj
+++ pigpen-cascading/src/test/clojure/pigpen/cascading_test.clj
@@ -61,28 +61,39 @@
            (is (= '([1 (2 3) ("foo") ("foo2")] [2 (4) ("bar" "baz") ("bar2")]) (read-output output)))))

 (comment test-inner-join
-  (write-input input1 [{:a 1} {:a 2}])
-  (write-input input2 [{:b 1} {:b 2}])
-  (let [left (load-clj input1)
-        right (load-clj input2)
-        cmd (pigpen/join [(left :on :a)
-                          (right :on :b)]
-                         (fn [x y] [x y]))
-        cmd (store-clj output cmd)]
+         (write-input input1 [{:a 1} {:a 2}])
+         (write-input input2 [{:b 1} {:b 2}])
+         (let [left (load-clj input1)
+               right (load-clj input2)
+               cmd (pigpen/join [(left :on :a)
+                                 (right :on :b)]
+                                (fn [x y] [x y]))
+               cmd (store-clj output cmd)]
+           (.complete (generate-flow cmd))
+           (is (= '([{:a 1} {:b 1}] [{:a 2} {:b 2}]) (read-output output)))))
+
+(comment test-outer-join
+         (write-input input1 [{:a 1} {:a 2} {:a 3}])
+         (write-input input2 [{:b 1} {:b 2} {:b 4}])
+         (let [left (load-clj input1)
+               right (load-clj input2)
+               cmd (pigpen/join [(left :on :a :type :required)
+                                 (right :on :b :type :optional)]
+                                (fn [x y] [x y]))
+               cmd (store-clj output cmd)]
+           ;(pp/pprint (preprocess-commands (oven/bake :cascading {} cmd)))
+           (.complete (generate-flow cmd))
+           (is (= '([{:a 1} {:b 1}] [{:a 2} {:b 2}] [{:a 3} nil]) (read-output output)))))
+
+(deftest test-group-by
+  (write-input input1 [{:a 1 :b 1} {:a 1 :b 2} {:a 2 :b 3}])
+  (let [data (load-clj input1)
+        cmd (->> data
+                 (pigpen/group-by :a)
+                 (pigpen/map (fn [[k v]] [k (reduce + (map :b v))]))
+                 (store-clj output))]
+    (pp/pprint (preprocess-commands (oven/bake :cascading {} cmd)))
     (.complete (generate-flow cmd))
-    (is (= '([{:a 1} {:b 1}] [{:a 2} {:b 2}]) (read-output output)))))
-
-(deftest test-outer-join
-  (write-input input1 [{:a 1} {:a 2} {:a 3}])
-  (write-input input2 [{:b 1} {:b 2} {:b 4}])
-  (let [left (load-clj input1)
-        right (load-clj input2)
-        cmd (pigpen/join [(left :on :a :type :required)
-                          (right :on :b :type :optional)]
-                         (fn [x y] [x y]))
-        cmd (store-clj output cmd)]
-    ;(pp/pprint (preprocess-commands (oven/bake :cascading {} cmd)))
-    (.complete (generate-flow cmd))
-    (is (= '([{:a 1} {:b 1}] [{:a 2} {:b 2}] [{:a 3} nil]) (read-output output)))))
+    (is (= '([1 ({:a 1, :b 1} {:a 1, :b 2})] [2 ({:a 2, :b 3})]) (read-output output)))))

 (run-tests 'pigpen.cascading-test)


Clean up documentation.

Clean up documentation.

--- project/analyze-data/src/analyze_data/corpus_to_tf_idf.clj
+++ project/analyze-data/src/analyze_data/corpus_to_tf_idf.clj
@@ -20,21 +20,20 @@
   suitable for serialization.

   corpus: a sequence of maps containing keys 'document-name' and
-          'document-text', where 'document-name' is a unique identifier and
-          'document-text' is a document
+          'document-text', where 'document-name' is a unique identifier.

   Return a map of the following form:
   {:all-terms  [term1 term2 ...]
    :idf        {term1 value
                 term2 value
                 ...}
-   :document-names [item1 item2 ...]
-   :tf-idf     [[term1-value term2-value ...]
-                [term1-value term2-value ...]
+   :document-names [doc1-name doc2-name ...]
+   :tf-idf     [[doc1-term1-value doc1-term2-value ...]
+                [doc2-term1-value doc2-term2-value ...]
                 ...]}

   :all-terms is a sorted sequence of all terms found in the corpus.
-  :document-names is a sequence of the 'document-name' keys.
+  :document-names is a sequence of the 'document-name' values.
   :idf is a map from term to its inverse document frequency.
   :tf-idf is a core.matrix sparse matrix containing the tf-idf values. Each
           row corresponds to a document and each column to a term."


Add option to include child content.

Add option to include child content.

--- project/scrape-summitpost-data/src/scrape_summitpost_data/core.clj
+++ project/scrape-summitpost-data/src/scrape_summitpost_data/core.clj
@@ -3,12 +3,17 @@
             [clojure.java.io :as io]
             [clojure.string :as string]
             [clojure.tools.cli :refer [parse-opts]]
-            [scrape-summitpost-data.get-item-texts :refer [get-item-texts]])
+            [scrape-summitpost-data.get-item-texts
+             :refer [get-item-texts get-item-texts-with-children]])
   (:gen-class))

 (def cli-options
   [["-f" "--file FILE" "File name for csv data"
     :default "data.csv"]
+   [nil
+    "--include-child-content"
+    (str "For each result, also include the content of all pages listed under "
+         "the 'Children' header in the left sidebar.")]
    ["-h" "--help"]])

 (defn usage [options-summary]
@@ -21,7 +26,7 @@
         options-summary
         ""
         "link: link (relative to summitpost domain) to a summitpost search"
-        "results page"
+        "      results page"
         "      e.g. /object_list.php?object_type=1&state_province_1=Washington&sort_select_1=object_name"
         ""]
        (string/join \newline)))
@@ -37,11 +42,14 @@
 (defn save-summitpost-search-results!
   "Save a csv of item names and page texts for all search result items found
   at `search-link`."
-  [file-name search-link]
+  [file-name search-link include-child-content?]
   (with-open [out-file (io/writer file-name)]
+    (let [get-texts-fn (if include-child-content?
+                         get-item-texts-with-children
+                         get-item-texts)]
     (csv/write-csv out-file
                    (cons ["document-url", "document-name", "document-text"]
-                         (get-item-texts search-link)))))
+                         (get-texts-fn search-link))))))

 (defn -main [& args]
   (let [{:keys [options arguments errors summary]} (parse-opts args cli-options)]
@@ -49,4 +57,6 @@
       (:help options) (exit 0 (usage summary))
       (not= (count arguments) 1) (exit 1 (usage summary))
       errors (exit 1 (error-msg errors)))
-    (save-summitpost-search-results! (:file options) (first arguments))))
+    (save-summitpost-search-results! (:file options)
+                                     (first arguments)
+                                     (:include-child-content options))))


[scamp] add paper section references to 'ns comment

--- modules/scamp/src/scamp/core.clj
+++ modules/scamp/src/scamp/core.clj
@@ -1,10 +1,12 @@
 (ns scamp.core
-  "Implement Gossip cluster membership protocol defined in \"Peer-to-Peer Membership Management
+  "\"He was a scamp; he is a hero!\" - Les Mis, p. 587
+
+  Implement Gossip cluster membership protocol defined in \"Peer-to-Peer Membership Management
   for Gossip-Based Protocols\".
   SCAMP = SCAlable Membership Protocol
   https://www.microsoft.com/en-us/research/wp-content/uploads/2016/02/ieee_tocs.pdf

-  TODO:
+  Paper sections TODO:
     * DONE: subscription (§2.2.1, Algorithm 1)
     * DONE: subscription (§2.2.1, Algorithm 2)
     * DONE: unsubscription (§2.2.2)


CMR-8081: Updated matched error message to catch more error cases.

--- common-app-lib/src/cmr/common_app/services/search/elastic_search_index.clj
+++ common-app-lib/src/cmr/common_app/services/search/elastic_search_index.clj
@@ -142,7 +142,7 @@
            :payload-too-large
            "The search is creating more buckets than allowed by CMR. Please narrow your search."))

-        (when (re-find #"too_many_clauses: maxClauseCount" body)
+        (when (re-find #"maxClauseCount is set to 1024" body)
           (info "Execute ES query failed due to" body)
           (errors/throw-service-error
            :payload-too-large


CMR-4499: Fix docstring

CMR-4499: Fix docstring

--- search-app/src/cmr/search/data/elastic_relevancy_scoring.clj
+++ search-app/src/cmr/search/data/elastic_relevancy_scoring.clj
@@ -43,8 +43,8 @@
   (slurp (io/resource "bin_keyword_score.groovy")))

 (defconfig community-usage-bin-size
-  "When sort-bin-keyword-scores is true, the keyword score should
-  be rounded to the nearest keyword-score-bin-size"
+  "When sort-use-relevancy-score is true, the community usage score should
+  be rounded to the nearest community-usage-bin-size"
   {:type Double
    :default 400.0})


Finally got around to adding tests for source file/lyrics

--- test/aeolian/composer_test.clj
+++ test/aeolian/composer_test.clj
@@ -41,7 +41,20 @@
                 instrument-commands (re-seq #"\[I: MIDI program \d+\]" metrics-for-n-authors)]
             (count (distinct instrument-commands)) => 2)))

-       (future-fact "changes to source file name produces a change in lyrics")
+       (facts "when processing source files"
+        (fact "a single source file uses the same lyric"
+          (let [metrics-for-same-file (c/metrics-to-measure ["Notification.java#1 LL=3"
+                                                               "Notification.java#10 LL=70"
+                                                               "Notification.java#100 LL=99"] k/major 1)
+                lyric-commands (re-seq #"w: [\w.]+" metrics-for-same-file)]
+            (count (distinct lyric-commands)) => 1))
+
+        (fact "multiple source files produce a change in lyrics"
+          (let [metrics-for-same-file (c/metrics-to-measure ["Foo.java#1 LL=3"
+                                                               "Bar.java#10 LL=70"
+                                                               "Blech.java#100 LL=99"] k/major 1)
+                lyric-commands (re-seq #"w: [\w.]+" metrics-for-same-file)]
+            (count (distinct lyric-commands)) => 3)))

        (defn- notes-in-measure [metrics]  (first (:notes (c/build-measure [metrics] k/major 1))))


removed duplicate definitions

removed duplicate definitions

--- sidecar/src/figwheel_sidecar/build_middleware/notifications.clj
+++ sidecar/src/figwheel_sidecar/build_middleware/notifications.clj
@@ -173,22 +173,7 @@
       (when-let [s (cljs.analyzer/error-message warning-type extra)]
         (callback (cljs.analyzer/message env s))))))

-(defmulti report-exception (fn [exception cause] (or (:type cause) (:tag cause))))
-
-(defmethod report-exception :reader-exception [e {:keys [file line column]}]
-  (println (format "ERROR: %s on file %s, line %d, column %d"
-                   (some-> e (.getCause) (.getMessage))
-                   file line column)))
-
-(defmethod report-exception :cljs/analysis-error [e {:keys [file line column]}]
-  (println (format "ANALYSIS ERROR: %s on file %s, line %d, column %d"
-                   (some-> e (.getCause) (.getMessage))
-                   file line column)))
-
-(defmethod report-exception :default [e _]
-  #_(clj-stacktrace.repl/pst+ e)
-  (stack/print-stack-trace e 30))
-
+;; TODO use ansi library
 (let [foreground-red "\u001b[31m"
       reset-color "\u001b[0m"]
   (defmulti report-exception (fn [exception cause] (or (:type cause) (:tag cause))))


Tekstit virheilmoituksiin

Tekstit virheilmoituksiin

--- mtg-pairings-server/src/mtg_pairings_server/tournament_api.clj
+++ mtg-pairings-server/src/mtg_pairings_server/tournament_api.clj
@@ -10,9 +10,12 @@
   `(let [user# (user-for-apikey ~apikey)
          owner# (owner-of-tournament ~sanction-id)]
      (cond
-       (nil? owner#) {:status 404}
-       (nil? user#) {:status 400}
-       (not= owner# user#) {:status 403}
+       (nil? owner#) {:status 404
+                      :body "Virheellinen sanktiointinumero"}
+       (nil? user#) {:status 400
+                     :body "Virheellinen API key"}
+       (not= owner# user#) {:status 403
+                            :body "Eri käyttäjän tallentama turnaus"}
        :else (do ~@body))))

 (defroutes tournament-routes
@@ -27,7 +30,8 @@
                            (assoc :owner user))]
         (add-tournament tournament)
         {:status 204})
-      {:status 400}))
+      {:status 400
+       :body "Virheellinen API key"}))
   (GET "/" []
     :return [Tournament]
     :summary "Hae kaikki turnaukset"


Fix FMI weather data fetching unit tests

Tests were broken in commit f17a303.

--- test/env_logger/grabber_test.clj
+++ test/env_logger/grabber_test.clj
@@ -137,7 +137,7 @@
 (deftest test-latest-data-extraction
   (testing "Tests FMI data extraction"
     (with-fake-routes {
-                       #"http:\/\/data\.fmi\.fi\/fmi-apikey\/(.+)"
+                       #"https:\/\/data\.fmi\.fi\/fmi-apikey\/(.+)"
                        (fn [_] {:status 200
                                 :body "<?xml version=\"1.0\"
                                              encoding=\"UTF-8\"?>
@@ -199,12 +199,12 @@
               :pressure 1006.5}
              (get-latest-fmi-data "api-key" 87874))))
     (with-fake-routes {
-                       #"http://data.fmi.fi/fmi-apikey/.+"
+                       #"https://data.fmi.fi/fmi-apikey/.+"
                        (fn [req] {:status 200
                                   :body "not XML content"})}
       (is (= {} (get-latest-fmi-data "my-api-key" 87874))))
     (with-fake-routes {
-                       #"http://data.fmi.fi/fmi-apikey/.+"
+                       #"https://data.fmi.fi/fmi-apikey/.+"
                        (fn [req] {:status 400})}
       (is (= {} (get-latest-fmi-data "my-api-key" 87874))))))


check if data is already pure js before converting

--- src/gamma_driver/impl/bind.cljs
+++ src/gamma_driver/impl/bind.cljs
@@ -44,10 +44,13 @@
      driver
      program
      element
-     (let [input (if (map? input) input {:data input})]
+     (let [input (if (map? input) input {:data input})
+           data (:data input)]
        (assoc input
          :element element
-         :data (clj->js (flatten [(:data input)])))))))
+         :data (if (array? data)
+                 data
+                 (clj->js (flatten [data]))))))))

 (defmethod bind* :element-index [fns driver program element input]
   (let [{:keys [bind-element-array element-array-buffer]} fns]


Save data readers to resource for neko to read it later

--- src/leiningen/droid/compile.clj
+++ src/leiningen/droid/compile.clj
@@ -15,14 +15,28 @@

 ;; ### Pre-compilation tasks

+(defn save-data-readers-to-resource
+  "Save project's *data-readers* value to application's resources so
+  it can be later retrieved in runtime. This is necessary to be able
+  to use data readers when developing in REPL on the device."
+  [{{:keys [res-path]} :android :as project}]
+  (.mkdirs (io/file res-path "raw"))
+  (eval/eval-in-project
+   project
+   `(spit (io/file ~res-path "raw" "data_readers.clj")
+          (into {} (map (fn [[k# v#]]
+                          [k# (symbol (subs (str v#) 2))])
+                        *data-readers*)))))
+
 (defn code-gen
   "Generates the R.java file from the resources.

   This task is necessary if you define the UI in XML and also to gain
   access to your strings and images by their ID."
   [{{:keys [sdk-path target-version manifest-path res-path gen-path
-            out-res-path external-res-paths library]} :android}]
+            out-res-path external-res-paths library]} :android :as project}]
   (info "Generating R.java...")
+  (save-data-readers-to-resource project)
   (let [aapt-bin (sdk-binary sdk-path :aapt)
         android-jar (get-sdk-android-jar sdk-path target-version)
         manifest-file (io/file manifest-path)


(MAINT) removed i18n require

(MAINT) removed i18n require

no longer needs i18n in this file

--- src/clj/puppetlabs/services/jruby/jruby_puppet_service.clj
+++ src/clj/puppetlabs/services/jruby/jruby_puppet_service.clj
@@ -5,7 +5,6 @@
             [puppetlabs.services.jruby-pool-manager.jruby-core :as jruby-core]
             [puppetlabs.trapperkeeper.core :as trapperkeeper]
             [puppetlabs.trapperkeeper.services :as tk-services]
-            [puppetlabs.i18n.core :as i18n :refer [trs tru]]
             [puppetlabs.services.protocols.jruby-puppet :as jruby]))

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


added docs on using mutation merge and the new load funciton

--- src/devguide/untangled_devguide/H_Server_Interactions.cljs
+++ src/devguide/untangled_devguide/H_Server_Interactions.cljs
@@ -160,8 +160,9 @@

   Untangled includes a few helper functions that can assist you in invoking the `untangled/load` mutation.

-  1. `load-data` and `load-data-action`
-  2. `load-field` and `load-field-action`
+  1. `load` and `load-action` : Newer, preferred API for most loads
+  1. `load-data` and `load-data-action` : Alternate API. Harder to use for some cases.
+  2. `load-field` and `load-field-action` : Field-targeted API (for lazy loading a component field)

   The former of each pair are methods that directly invoke a `transact!` to place load requests into a load queue.

@@ -169,13 +170,13 @@
   own mutations (e.g. you want to switch to a new area of the UI (local mutation), but also trigger a *remote read* to load the
   content of that UI at the same time).

-  ### Load Data vs. Load Field
-
-  Both of these function families are calls to the built-in `untangled/load` mutation, so requests made by either function
+  ### Load vs. Load Data vs. Load Field
+
+  All of these function families are calls to the built-in `untangled/load` mutation behind the scenes, so requests made by these functions
   go through the same networking layer and have the same customizations through their named parameters (see the doc strings
   in the [data-fetch namespace](https://github.com/untangled-web/untangled-client/blob/master/src/untangled/client/data_fetch.cljs)).
-  The only difference is that `load-data` must be passed a complete query while `load-field` uses the passed-in component
-  to create its query.
+  The only difference is in how the query is specified. `load` requires a top-level keyword and a component, `load-data`
+  must be passed a complete query, and `load-field` uses the passed-in component and a field name to create its query.

   `load-field` is really just a helper for a common use-case: loading a field of some specific thing on the screen. It
    focuses the component's query to the specified field, associates the component's ident with the query,
@@ -184,7 +185,96 @@
   from your server when the app initially loads, you must use `load-data` with the reconciler passed to the
   `:started-callback` function when creating a new untangled client application.

-  #### Use case - Lazy loading
+  #### Use case - Initial load
+
+  In Untangled, initial load is an explicit step. You simply put calls to `load` or `load-data` in your app start callback.
+  State markers are put in place that allow you to then render the fact that you are loading data. Any number of separate
+  server queries can be queued, and the queries themselves are used for normalization. Post-processing of the response
+  is well-defined and trivial to access.
+
+  ```
+  (uc/new-untangled-client
+    :initial-state {}
+    :started-callback
+      (fn [{:keys [reconciler] :as app}]
+        (df/load app :items CollectionComponent {:without #{:comments} :post-mutation 'app/build-views})
+        ; OR (less preferred)
+        (df/load-data reconciler [{:items (om/get-query CollectionComponent)}]
+                                   :without #{:comments}
+                                   :post-mutation 'app/build-views)))
+  ```
+
+  In the above example the client is created (which must be mounted as a separate step). Once mounted the application
+  will call the `:started-callback` which in turn will trigger a load. This helper functions are really a call to
+  om `transact!` that places `ready-to-load` markers in the app state, which in turn triggers the network plumbing. The
+  network plumbing pulls these and processes them via the server and all of the normalization bits of Om (and Untangled).
+
+  The `:without` parameter will elide portions of the query. So for example, if you'd like to lazy load some portion of the
+  collection (e.g. comments on each item) at a later time, you can prevent the server from being asked.
+
+  The `:post-mutation` parameter is the name of the mutation you'd like to run on a successful result of the query. If there
+  is a failure, then a failure marker will be placed in the app state, which you can have programmed your UI to react to
+  (e.g. showing a dialog that has user-driven recovery choices).
+
+  #### Use case - Loading a specific entity from the server
+
+  The `load` function can accept an ident instead of a top-level property:
+
+  ```
+  (df/load app [:person/by-id 22] Person)
+  ```
+
+  which will load the specific entity (assuming your server responsds with it) into you client database. This could be
+  used, for example, to refresh a particular entity in your client database.
+
+  Giving a post mutation would allow you to further integrate that entity into you views.
+
+  NOTE: the `untangled.core/integrate-ident!` function is particularly handy for peppering the resulting ident
+  around the views in a post mutation.
+
+  #### Use case - Loading a collection into an entity
+
+  In this case you'd like to send the server some well-defined query, like `[{:all-people (om/get-query Person)}]`, but
+  that will place the collection at the root of your app database under the `:all-people` key. The `:target` parameter
+  can be used to redirect the result.
+
+  Assume your database has the following state representing some UI Pane in a tab:
+
+  ```
+  { :friends { :tab { :people [] }}}
+  ```
+
+  The following load would send the desired query, and rewrite the result into the desired location (while also
+  normalizing the incoming People):
+
+  ```
+  (df/load app :all-people Person {:target [:friends :tab :people]})
+  ```
+
+  ```
+  { :friends { :tab { :people [[:people/by-id 1] [:people/by-id 2]] }}
+    :people/by-id { 1 { ... }
+                    2 { ... }}
+  ```
+
+  #### Use case - Including parameters on the server query
+
+  Sometimes you'll want to modify the generated client query to include parameters. For example, perhaps you'd like to
+  limit the query from the prior example:
+
+  ```
+  (df/load app :all-people Person {:params {:limit 10} :target [:friends :tab :people]})
+  ```
+
+  would result in `{:limit 10}` being visible in the server query parameters:
+
+  ```
+  ;; assuming your server-side read is a multimethod:
+  (defmethod api-read :all-people [env k params]
+     (let [limit (or (:limit params) 10)] ...))
+  ```
+
+  #### Use case - Lazy loading a field

   One common operation is to load data in response to a user interaction. Interestingly, the query that you might
   have used in the initial load use case might have included UI queries for data you didn't want to fetch yet. So, we want
@@ -300,13 +390,14 @@
   the code to use the action-suffixed load instead. To learn more about the dangers of loads and lifecycle methods, see
   the [reference on loading data]().

-  ### Using `untangled/load` Directly
+  ### Using the `untangled/load` Mutation Directly

   The helper functions described above simply trigger a built-in Untangled mutation called `untangled/load`, which you are
   allowed (and sometimes encouraged) to use directly. The arguments to this mutation include:

   - `query`: The specific query you'd like to send to the server
   - `post-mutation`: A symbol indicating a mutation to run after the load completes
+  - `post-mutation-params` - An optional map  that will be passed to the post-mutation when it is called. May only contain raw data, not code!
   - `without`: A set of keywords that should be (recursively) removed from `query`
   - `refresh`: A vector of keywords that should cause re-rendering after the load.
   - `parallel`: True or false. If true, bypasses the sequential network queue
@@ -752,6 +843,69 @@
   built on the server will be passed back to the client, where Untangled will do a recursive walk of the client-side
   database to replace every instance of the tempid with the database id. Note that the map at the :tempids key can have
   more than one tempid to database-id pair.
+
+  #### Dealing with Server Mutation Return Values
+
+  The server mutation is allowed to return a value. Normally the only value that makes sense is for temporary ID remapping as
+  previoiusly discussed:
+
+  ```
+  {:tempids {old-id new-id}}
+  ```
+
+  which is handled for you automatically. In some cases you'd like to return other details. The Om/Untangled model
+  treats all returned data from the server as novelty to be merged to your application state. With query results this
+  is straightforward because the query you sent allows the merge system to properly normalize the result. Mutations
+  do not have a query, so any additional data they return makes no sense by default, and such data is normally just ignored by
+  the client.
+
+  If you want to see the returned values from the server, then you need to add a `mutation-merge` function to your
+  client. You can do this when you create your client:
+
+  ```
+  (defmulti return-merge (fn [state mutation-sym return-value] mutation-sym))
+  (defmethod return-merge :default [s m r] s)
+
+  (new-untangled-client :mutation-merge return-merge)
+  ```
+
+  Typically you'll create something like a multimethod for this merge function and dispatch on the mutation symbol. Then
+  you can co-locate your return value merging definitions with your local mutation defitions. For example:
+
+  ```
+  (defmethod m/mutate 'some-mutation [env k p] {:remote true })
+  (defmethod app/return-merge 'some-mutation [state k returnval] state')
+  ```
+
+  Note that the API is a bit different between the two: mutations get the app state atom in an environment, and you
+  end up swapping on that atom to change state. The return merge function is running during state merge, and must
+  take the old state and return a new state.
+
+  ### Global network activity marker
+
+  Untangled will automatically maintain a global network activity marker at the top level of the app state under the
+  keyword `:ui/loading-data`. This key will have a `true` value when there are network requests awaiting a response from
+  the server, and will have a `false` value when there are no network requests in process.
+
+  You can access this marker from any component that composes to root by including a link in your component's query:
+
+  ```
+  (defui Item ... )
+  (def ui-item (om/factory Item {:keyfn :id}))
+
+  (defui List
+    static om/IQuery (query [this] [:id :title {:items (om/get-query Item)} [:ui/loading-data '_]]
+    ...
+    (render [this]
+      (let [{:keys [title items ui/loading-data]} (om/props this)]
+        (if (and loading-data (empty? items))
+          (dom/div nil \"Loading...\")
+          (dom/div nil
+            (dom/h1 nil title)
+            (map ui-item items))))
+  ```
+  Because the global loading marker is at the top level of the application state, do not use the keyword as a follow-on
+  read to mutations because it may unnecessarily trigger a re-render of the entire application.

   ## Differences from stock Om (Next)

@@ -783,68 +937,15 @@
   By eliminating the need for an Om parser to process all of this and centralizing the logic to a core set of functions
   that handle all of these concerns you gain a lot of simplicity.

-  So, let's look how we handle the explicit use-cases:
-
-  ### Use case - Initial load
-
-  In Om, you'd write a parser, set some initial state indicating 'I need to load this', and in your parser you'd return
+  ### Differences in Initial load
+
+  In Om you'd write a parser, set some initial state indicating 'I need to load this', and in your parser you'd return
   a remote `true` for that portion of the read when you hit it. The intention would then be that the server returning
   data would overwrite that marker and the resulting re-render would update the UI. If your UI query doesn't match what
   your server wants to hear, then you either write multiple UI-handling bits on the server, or you pre/post process the
   ROOT-centric query in your send function. Basically, you write a lot of plumbing. Server error handling is completely
   up to you in your send method.

-  In Untangled, initial load is an explicit step. You simply put calls to `load-data` in your app start callback.
-  State markers are put in place that allow you to then render the fact that you are loading data. Any number of separate
-  server queries can be queued, and the queries themselves are used for normalization. Post-processing of the response
-  is well-defined and trivial to access.
-
-  ```
-  (uc/new-untangled-client
-    :initial-state {}
-    :started-callback
-      (fn [app]
-        (df/load-data :query [{:items (om/get-query CollectionComponent)}]
-                                     :without #{:comments}
-                                     :post-mutation 'app/build-views)))
-  ```
-
-  In the above example the client is created (which must be mounted as a separate step). Once mounted the application
-  will call the `:started-callback` which in turn will trigger a load. This helper function is really a call to
-  om `transact!` that places `ready-to-load` markers in the app state, which in turn triggers the network plumbing. The
-  network plumbing pulls these and processes them via the server and all of the normalization bits of Om (and Untangled).
-
-  The `:without` parameter will elide portions of the query. So for example, if you'd like to lazy load some portion of the
-  collection (e.g. comments on each item) at a later time, you can prevent the server from being asked.
-
-  The `:post-mutation` parameter is the name of the mutation you'd like to run on a successful result of the query. If there
-  is a failure, then a failure marker will be placed in the app state, which you can have programmed your UI to react to
-  (e.g. showing a dialog that has user-driven recovery choices).
-
-
-  ### Global network activity marker
-
-  Untangled will automatically maintain a global network activity marker at the top level of the app state under the
-  keyword `:ui/loading-data`. This key will have a `true` value when there are network requests awaiting a response from
-  the server, and will have a `false` value when there are no network requests in process.
-
-  You can access this marker from any component that composes to root by including a link in your component's query:
-
-  ```
-  (defui Item ... )
-  (def ui-item (om/factory Item {:keyfn :id}))
-
-  (defui List
-    static om/IQuery (query [this] [:id :title {:items (om/get-query Item)} [:ui/loading-data '_]]
-    ...
-    (render [this]
-      (let [{:keys [title items ui/loading-data]} (om/props this)]
-        (if (and loading-data (empty? items))
-          (dom/div nil \"Loading...\")
-          (dom/div nil
-            (dom/h1 nil title)
-            (map ui-item items))))
-  ```
-  Because the global loading marker is at the top level of the application state, do not use the keyword as a follow-on
-  read to mutations because it may unnecessarily trigger a re-render of the entire application.
+  In Untangled, initial load is an explicit step. You simply put calls to `load` in your app start callback.
+
 ")


CMR-4307: Added retries

CMR-4307: Added retries

--- search-app/src/cmr/search/services/humanizers/humanizer_report_service.clj
+++ search-app/src/cmr/search/services/humanizers/humanizer_report_service.clj
@@ -53,6 +53,11 @@
    to be populated in the event when the delay is not long enough."
   {:default 60000 :type Long}) ;; one minute

+(defconfig humanizer-report-generator-job-retry-number
+  "Number of times humanizer-report-generator-job retries to get the collections
+   from collection cache."
+  {:default 20 :type Long})
+
 (defn- rfm->umm-collection
   "Takes a revision format map and parses it into a UMM-spec record."
   [context revision-format-map]
@@ -70,18 +75,25 @@
   (map #(rfm->umm-collection context %) rfms))

 (defn- wait-and-retry-for-collection-cache
-  "Wait configurable number of seconds before retrying to get all the collections
-   from collection cache. If collections are still not present, throw warning."
+  "Wait configurable number of milli seconds before retrying configurable number of times
+   to get all the collections from collection cache. If collections are still not present, throw warning."
   [context]
   (info (format "Collection cache is not populated after %d seconds of delay"
                 (humanizer-report-generator-job-delay)))
-  (Thread/sleep (humanizer-report-generator-job-wait))
+  ;; sleep, retry 19 times, then sleep and retry one last time.
+  (Thread/sleep (humanizer-report-generator-job-wait))
+  (let [a (atom (- (humanizer-report-generator-job-retry-number) 1))]
+    (while (and (pos? @a) (not (seq (metadata-cache/all-cached-revision-format-maps context))))
+      (info (format "Humanizer report generator job is sleeping for %d milli-seconds before retry"
+                    (humanizer-report-generator-job-wait)))
+      (Thread/sleep (humanizer-report-generator-job-wait))
+      (swap! a dec)))
   (let [rfms (metadata-cache/all-cached-revision-format-maps context)]
     (if (seq rfms)
       rfms
-      (warn (format "Collection cache is not populated after %d seconds of delay and %d milli-seconds of wait."
+      (warn (format "Collection cache is not populated after %d seconds of delay and %d times of retry."
                     (humanizer-report-generator-job-delay)
-                    (humanizer-report-generator-job-wait))))))
+                    (humanizer-report-generator-job-retry-number))))))

 (defn- get-all-collections
   "Retrieves all collections from the Metadata cache, partitions them into batches of size


CMR-2186: Remove flatten call after refactor

--- search-app/src/cmr/search/services/query_execution/facets/links_helper.clj
+++ search-app/src/cmr/search/services/query_execution/facets/links_helper.clj
@@ -117,12 +117,11 @@
   passed in value. Looks for matches case insensitively."
   [query-params value]
   (let [value (str/lower-case value)]
-    (flatten
-      (keep (fn [[k value-or-values]]
-              (when (coll? value-or-values)
-                (when (some #{value} (map str/lower-case value-or-values))
-                  k)))
-            query-params))))
+    (keep (fn [[k value-or-values]]
+            (when (coll? value-or-values)
+              (when (some #{value} (map str/lower-case value-or-values))
+                k)))
+          query-params)))

 (defn- get-keys-to-remove
   "Returns a sequence of keys that have a single value which matches the passed in value. Looks for


GAWB-1930: Taking out logging message

GAWB-1930: Taking out logging message

--- src/cljs/main/broadfcui/page/billing/billing_management.cljs
+++ src/cljs/main/broadfcui/page/billing/billing_management.cljs
@@ -63,7 +63,6 @@
 (react/defc BillingProjectTable
   {:reload
    (fn [{:keys [this refs after-update]}]
-     (utils/cljslog "now we're up here")
      (react/call :load-data this)
      (after-update #((@refs "table") :refresh-rows)))
    :render


Fixed testcase for exploration

Fixed testcase for exploration

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

--- src/conexp/contrib/tests/dl/languages/EL_gfp_exploration.clj
+++ src/conexp/contrib/tests/dl/languages/EL_gfp_exploration.clj
@@ -67,12 +67,14 @@
                             (and (exists HasChild (and Female))))
                (subsumption (and (exists HasChild (and Female)) Female)
                             (and Mother))
-               (subsumption (and Male Mother)
+               (subsumption (and Mother Male)
                             (and [(tbox All (and Father Mother (exists HasChild All))),
                                   All]))
                (subsumption (and (exists HasChild (and (exists HasChild (and Female)))))
                             (and [(tbox All (and Father Mother (exists HasChild All))),
-                                  All])))))
+                                  All]))))))
+
+(deftest- model-gcis-returns-correct-count
   (are [model gci-count] (let [gcis (model-gcis model)]
                            (and (= gci-count (count gcis))
                                 (forall [gci gcis]
@@ -84,7 +86,8 @@
        grandparent-model 32))

 (defn test-ns-hook []
-  (model-gcis-returns-correct-result))
+  (model-gcis-returns-correct-result)
+  (model-gcis-returns-correct-count))

 ;;;


use midje.checkers.

use midje.checkers.

--- test/midje/semi_sweet_test.clj
+++ test/midje/semi_sweet_test.clj
@@ -1,7 +1,6 @@
 (ns midje.semi-sweet-test
+  (:use clojure.test)
   (:use [midje.semi-sweet] :reload-all)
-  (:use [midje.checkers])
-  (:use [clojure.test])
   (:use [midje.test-util]))

 (only-mocked faked-function mocked-function other-function)


Fix test, make sure connections are closed

--- test/org/akvo/resumed_test.clj
+++ test/org/akvo/resumed_test.clj
@@ -151,7 +151,9 @@
           (is (> (.getOffset uploader) 0))
           (recur (.uploadChunk uploader))))
       (.finish uploader)
-      (.stop srv)))
+      (.stop srv))))
+
+(deftest java-client-resume
   (testing "Java client - resuming"
     (let [handler (make-handler)
           port (+ 3000 (int (rand 100)))
@@ -175,5 +177,6 @@
         (when (> up -1)
           (is (> (.getOffset upldr2) 0))
           (recur (.uploadChunk upldr2))))
+      (.finish upldr)
       (.finish upldr2)
       (.stop srv))))


too -> two

too -> two

Thanks to mattsonlyattack!

--- demo/demo.cljs
+++ demo/demo.cljs
@@ -240,7 +240,7 @@
    one entry-point that is necessary for most applications: "
     [:code "cloact.core/render-component"] "."]

-   [:p "It takes too arguments: a component, and a DOM node. For
+   [:p "It takes two arguments: a component, and a DOM node. For
    example, splashing the very first example all over the page would
    look like this:"]


Fix for the system interation test failure in CI.

--- system-int-test/test/cmr/system_int_test/ingest/collection_ingest_test.clj
+++ system-int-test/test/cmr/system_int_test/ingest/collection_ingest_test.clj
@@ -384,11 +384,7 @@
        :dif10 ["Line 1 - cvc-datatype-valid.1.2.3: 'A.000Z' is not a valid value of union type 'DateOrTimeOrEnumType'."
                "Line 1 - cvc-type.3.1.3: The value 'A.000Z' of element 'Beginning_Date_Time' is not valid."
                (str "Line 1 - cvc-complex-type.2.4.a: Invalid content was found starting with element 'Summary'."
-                    " One of '{\"http://gcmd.gsfc.nasa.gov/Aboutus/xml/dif/\":Project,"
-                    " \"http://gcmd.gsfc.nasa.gov/Aboutus/xml/dif/\":Quality,"
-                    " \"http://gcmd.gsfc.nasa.gov/Aboutus/xml/dif/\":Access_Constraints,"
-                    " \"http://gcmd.gsfc.nasa.gov/Aboutus/xml/dif/\":Use_Constraints,"
-                    " \"http://gcmd.gsfc.nasa.gov/Aboutus/xml/dif/\":Dataset_Language,"
+                    " One of '{\"http://gcmd.gsfc.nasa.gov/Aboutus/xml/dif/\":Dataset_Language,"
                     " \"http://gcmd.gsfc.nasa.gov/Aboutus/xml/dif/\":Originating_Center,"
                     " \"http://gcmd.gsfc.nasa.gov/Aboutus/xml/dif/\":Organization}' is expected.")]


(TK-50) Remove atom

(TK-50) Remove atom

Remove atom being used in the get-default-server-from-config
function and replace it with a combination of first and filter.

--- src/puppetlabs/trapperkeeper/services/webserver/jetty9_core.clj
+++ src/puppetlabs/trapperkeeper/services/webserver/jetty9_core.clj
@@ -654,11 +654,7 @@

 (defn get-default-server-from-config
   [config]
-  (let [default (atom nil)]
-    (doseq [[server-id server-config] config]
-      (if (:default-server server-config)
-        (compare-and-set! default nil server-id)))
-    @default))
+  (first (flatten (filter #(:default-server (second %)) config))))

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;; Service Function Implementations


Update core_test.clj

Update core_test.clj

--- test/swagger_gen/core_test.clj
+++ test/swagger_gen/core_test.clj
@@ -1,4 +1,3 @@
 (ns swagger-gen.core-test
   (:require [clojure.test :refer :all]
             [swagger-gen.core :refer :all]))
-


Fixed Camel Case generator; also made it not take result from output stack.

--- src/clojush/problems/software/benchmarks_v2/camel_case.clj
+++ src/clojush/problems/software/benchmarks_v2/camel_case.clj
@@ -10,23 +10,33 @@
         clojure.math.numeric-tower)
     (:require [clojure.string :as str]))

+(defn word-generator
+  "Generates words at a nice distribution for Camel Case
+   All words will have length [1, 5]."
+  []
+  (let [chars-between #(map char (range (int %1) (inc (int %2))))
+        chars (chars-between \a \z)
+        word-len (inc (rand-int 5))]
+    (apply str (repeatedly word-len #(rand-nth chars)))))
+
+(defn cleanup-length
+  [string len]
+  (let [result (take len string)]
+    (if (or (= (last result) \space)
+            (= (last result) \-))
+      (apply str (butlast result))
+      (apply str result))))
+
 ;; Define test cases
 (defn camel-case-input
   "Makes a Camel Case input of length len."
-  ; Code found from https://stackoverflow.com/questions/27053726/how-to-generate-random-password-with-the-fixed-length-in-clojure
   [len]
-  (let [chars-between #(map char (range (int %1) (inc (int %2))))
-        chars (concat (chars-between \a \z)
-                      " "
-                      "-")
-        word (take len (repeatedly #(rand-nth chars)))]
-    (apply str word)))
-
-(comment
-  (camel-case-input 20)
-
-  (first (test-and-train-data-from-domains camel-case-data-domains))
-  )
+  (loop [result-string (word-generator)]
+    (if (>= (count result-string) len)
+      (cleanup-length result-string len)
+      (recur (str result-string
+                  (if (< (lrand) 0.5) \- \space)
+                  (word-generator))))))

 ; Atom generators
 (def camel-case-atom-generators
@@ -51,17 +61,21 @@
 ;; random element of the set.
 (def camel-case-data-domains
   [[(list ""
-          "oneword"
+          "nospaceordash"
           "two-words"
-          "two-words and-a-space"
+          "two words"
           "all separate words"
-          "all-one-word-with-th-dash"
-          "saaaaaaaaaaaaaaaaaaaaaame") 7 0] ;; "Special" inputs covering some base cases
-   [(fn [] (camel-case-input (inc (lrand-int 20)))) 193 2000]
+          "all-one-word-dashed"
+          "loooooong-wooooords"
+          "loooooong wooooords"
+          "a-b-c-d-e-f-g-h-i-j"
+          "a b c d e f g h i j"
+          "saaaaaaaaaaaaaaaaame") 11 0] ;; "Special" inputs covering some base cases
+   [(fn [] (camel-case-input (inc (lrand-int 20)))) 189 2000]
    ])

 ;;Can make Camel Case test data like this:
-;(test-and-train-data-from-domains camel-case-data-domains)
+(comment (test-and-train-data-from-domains camel-case-data-domains))

 ; Helper function for error function
 (defn camel-case-test-cases
@@ -101,9 +115,8 @@
                                                     [])]
                        (let [final-state (run-push (:program individual)
                                                    (->> (make-push-state)
-                                                     (push-item input :input)
-                                                     (push-item "" :output)))
-                             result (stack-ref :output 0 final-state)]
+                                                        (push-item input :input)))
+                             result (stack-ref :string 0 final-state)]
                          (when print-outputs
                            (println (format "\n| Correct output: %s\n| Program output: %s" (pr-str correct-output) (pr-str result))))
                          ; Record the behavior
@@ -150,7 +163,7 @@
 ; Define the argmap
 (def argmap
  {:error-function (make-camel-case-error-function-from-cases (first camel-case-train-and-test-cases)
-                                                                     (second camel-case-train-and-test-cases))
+                                                             (second camel-case-train-and-test-cases))
   :atom-generators camel-case-atom-generators
   :max-points 2000
   :max-genome-size-in-initial-program 250