Added more info to a few questions in Help tab.

--- src/cljs/netrunner/help.cljs
+++ src/cljs/netrunner/help.cljs
@@ -112,7 +112,8 @@
             {:id "avatar"
              :title "How do I change my avatar?"
              :content [:p "Go to " [:a {:href "http://gravatar.com" :target "_blank"} "gravatar.com"]
-                       " and create an account with the same email as the one used to register on Jinteki.net."]}
+                       " and create an account with the same email as the one used to register on Jinteki.net. Please note that "
+                       "it can sometimes take up to a few hours for the new avatar to be visible on the site."]}
             {:id "bestbrowser"
              :title "What is the best supported browser?"
              :content '([:p "Google Chrome or Firefox on a desktop or laptop is recommended. Safari should work fine too."]
@@ -188,9 +189,9 @@
             {:id "weird"
              :title "The site is behaving weird."
              :content [:p "The server code may have been freshly updated and you don't have the latest Javascript code. "
-                       "First step in every troubleshooting should be a forced refresh of your browser by doing a force refresh ("
-                       [:code "Ctrl + F5"] " on Windows). Also read the announcements on the main page, something about server problems "
-                       "may be written there."]}
+                       "First step in every troubleshooting should be a forced refresh of your browser by doing a "
+                       [:a {:href "http://refreshyourcache.com/en/cache/"} "force refresh"] " (" [:code "Ctrl + F5"] " on Windows). "
+                       "Also read the announcements on the main page, something about server problems may be written there."]}
             {:id "touchproblems"
              :title "The website doesn't work well on my touchscreen device."
              :content [:p "Touchscreen devices are currently not supported. See answer to " [:a {:href "#bestbrowser"} "this question"]


time tracer

time tracer

--- src/cljs/triboard/ai/ai.cljs
+++ src/cljs/triboard/ai/ai.cljs
@@ -91,7 +91,9 @@
   (let [turn (game/current-turn game)
         hard-mode? (is-player-first? (:scores turn))
         ai ((if hard-mode? make-cheating-ai make-ai) (:player turn))]
-    (game/play-at game (best-move ai turn))))
+    (game/play-at game
+      (time (best-move ai turn)) ;; TODO - Remove time
+      )))

 ;; -----------------------------------------


fix sort order bug

fix sort order bug

--- src/clojure/cljam/sorter.clj
+++ src/clojure/cljam/sorter.clj
@@ -27,7 +27,8 @@
     (cond
      (= (:rname b1) "*") 1
      (= (:rname b2) "*") -1
-     :else (compare (:rname b1) (:rname b2)))))
+     :else (compare (get ref-map (:rname b1))
+                    (get ref-map (:rname b2))))))

 (defn- sort-alignments-by-pos [rdr]
   (let [ref-map (apply merge


add more comments

add more comments

--- src/clojure/duratom/core.clj
+++ src/clojure/duratom/core.clj
@@ -138,6 +138,7 @@

 (defn- add-sync-error-handler
   [backend handle-error]
+  ;; have to do this dance here (i.e. mutual recursion)
   (letfn [(backend* []
             (delay
               (with-meta backend
@@ -169,7 +170,7 @@
                                     (fn [e] (throw e))}))]
         (fn [_ e]
           ;; recommitting happens on the
-          ;; agent's dispatch thread synchronously (wrt the original commit)
+          ;; agent's dispatch thread *synchronously* (wrt the original commit)
           (handle-error e recommit*)))))
   backend)


Allow and ignore nils in menu tree

Allow and ignore nils in menu tree

--- src/clojure/neko/ui/menu.clj
+++ src/clojure/neko/ui/menu.clj
@@ -42,7 +42,8 @@
   ([menu tree]
      (make-menu menu Menu/NONE tree))
   ([menu group tree]
-     (doseq [[element-kw attributes & subelements] tree]
+     (doseq [[element-kw attributes & subelements] tree
+             :when element-kw]
        (let [id (to-id (or (:id attributes) Menu/NONE))
              order (to-id (or (:order attributes) Menu/NONE))]
          (case element-kw


Add ignore-errors

Add ignore-errors

--- src/clojure_fabric/utils.clj
+++ src/clojure_fabric/utils.clj
@@ -49,3 +49,11 @@
                (assoc m k (f v)))
           {}
           m))
+
+(defmacro ignore-errors
+  "Execute BODY catching any exceptions.  Returns NIL if
+  body throws, otherwise the value of last for of BODY
+  [This is like the Common Lisp IGNORE-ERRORS.]"
+  [& body]
+  `(try (do ~@body)
+        (catch Throwable e#)))


do not use threads for update scheduling

--- src/otto/app.clj
+++ src/otto/app.clj
@@ -4,7 +4,7 @@
             [otto.github           :as github]
             [otto.repositories     :as repos]
             [otto.web              :as web]
-            [clojure.core.async    :as async :refer [<!! thread timeout]]
+            [clojure.core.async    :as async :refer [<! go timeout]]
             [ring.adapter.jetty    :as jetty])
   (:gen-class :main true))

@@ -16,11 +16,11 @@
 (defn periodically-update
   [organizations user interval update-fn]
   (doseq [o organizations]
-    (thread (loop []
-              (logger/info (format "Updating organization %s" (:name o)))
-              (github/fetch-repositories o user #(update-fn o %))
-              (<!! (timeout interval))
-              (recur)))))
+    (go (loop []
+          (logger/info (format "Updating organization %s" (:name o)))
+          (github/fetch-repositories o user #(update-fn o %))
+          (<! (timeout interval))
+          (recur)))))

 (defn -main
   []


Bump eastwood version to 0.1.3

Bump eastwood version to 0.1.3


Minor formatting and error message update

--- cimi/src/com/sixsq/slipstream/ssclj/resources/user_template.clj
+++ cimi/src/com/sixsq/slipstream/ssclj/resources/user_template.clj
@@ -128,7 +128,7 @@
   [{{:keys [method]} :body :as request}]
   (if (get @descriptions method)
     (add-impl request)
-    (throw (r/ex-bad-request (str "invalid authentication method '" method "'")))))
+    (throw (r/ex-bad-request (str "invalid registration method '" method "'")))))

 (def retrieve-impl (std-crud/retrieve-fn resource-name))
@@ -176,7 +176,6 @@
                   [{:rel (:add c/action-uri) :href id}]
                   [{:rel (:edit c/action-uri) :href id}
                    {:rel (:delete c/action-uri) :href id}
-
                    {:rel (:describe c/action-uri) :href href}])]
         (assoc resource :operations ops))
       (catch Exception e


add view passed to us, without overwriting it....

--- dada-core/src/main/clojure/org/dada/core/SessionManagerImpl.clj
+++ dada-core/src/main/clojure/org/dada/core/SessionManagerImpl.clj
@@ -51,7 +51,7 @@
 	    (swap!
 	     mutable
 	     (fn [[exports]]
-		 (let [[count view] (or (exports model-name) [0 (.client service-factory model-name)])]
+		 (let [[count view] (or (exports model-name) [0 view])]
 		   [(assoc exports model-name [(inc count) view]) (if (zero? count) view)])))]
 	(if view
 	  (.registerView model view)


test for remove-comments

test for remove-comments

--- test/semantic_csv/core_test.clj
+++ test/semantic_csv/core_test.clj
@@ -6,31 +6,43 @@

 (deftest mappify-test
   (let [data [["this" "that"]
-              ["x" "y"]]]
+              ["x" "y"]
+              ["# some comment"]]]
     (testing "mappify should work"
       (is (= (first (mappify data))
              {:this "x" :that "y"})))
     (testing "mappify should let you avoid keyifying"
       (is (= (first (mappify {:keyify false} data))
-             {"this" "x" "that" "y"})))))
+             {"this" "x" "that" "y"})))
+    (testing "mappify should not regard comments"
+      (is (= (last (mappify data))
+             {:this "# some comment"})))))

-(deftest casting-test
-  (let [data [["this" "that"]
-              ["1" "y"]]]
-    (testing "should work with mappify"
-      (is (= (->> data
-                  mappify
-                  (cast-with {:this ->int})
-                  first)
-             {:this 1 :that "y"}))))
-  (let [data [["1" "this"]
-              ["2" "that"]]]
-    (testing "should work without mappify"
-      (is (= (->> data
-                  (cast-with {0 ->int})
-                  second)
-             [2 "that"])))))
+(deftest remove-comments-test
+  (let [data [["# a comment"]
+              ["// another comment"]]]
+    (testing "remove-comments should remove #-designated comments by default"
+      (is (= (remove-comments data)
+             [["// another comment"]])))
+    (testing "remove-comments should take an optional comment designator"
+      (is (= (remove-comments #"^//" data)
+             [["# a comment"]]))))

-
+  (deftest casting-test
+    (let [data [["this" "that"]
+                ["1" "y"]]]
+      (testing "should work with mappify"
+        (is (= (->> data
+                    mappify
+                    (cast-with {:this ->int})
+                    first)
+               {:this 1 :that "y"}))))
+    (let [data [["1" "this"]
+                ["2" "that"]]]
+      (testing "should work without mappify"
+        (is (= (->> data
+                    (cast-with {0 ->int})
+                    second)
+               [2 "that"]))))))


Moving aggregation id log inside exists check

--- src/qu/cache.clj
+++ src/qu/cache.clj
@@ -79,9 +79,9 @@
   ([database query not-found]
      (with-db database
        (let [collection (query-to-key query)]
-		(log/info "FOUND Aggregation - ID:" collection)
          (if (coll/exists? collection)
-           (do (metrics/increment "cache.hit.count")
+           (do (log/info "FOUND Aggregation - ID:" collection)
+			(metrics/increment "cache.hit.count")
              (extract-result collection query))
            (do (metrics/increment "cache.wait.count")
                not-found))))))


Fix logs

Fix logs

--- src/nube/app.clj
+++ src/nube/app.clj
@@ -178,10 +178,10 @@
         (kill-app-instance app image tag)))))

 (defn load-app-logs [app]
-  (for [instance (load-app-instances app)]
-    (let [[host port] (ssplit instance)]
-      (println "Loading logs for" instance)
-      #_(logs (docker-cli host) (:Id (load-container-by-host-and-port host port))))))
+  (vec
+   (for [instance (load-app-instances app)]
+     (let [[host port] (ssplit instance)]
+       (docker! :get host (str "containers/" (:Id (load-container-by-host-and-port host port)) "/logs"))))))

 (defn kill-app-instances [app]
   (doseq [instance (load-app-instances app)]


cosmit

cosmit

--- src/corpusmaker/entities.clj
+++ src/corpusmaker/entities.clj
@@ -49,7 +49,7 @@
   (java.net.URLDecoder/decode url))

 ;; TODO: the following is buggy: unicode ASCII encoded symbols needs to be taken
-;; cared of
+;; care of (see the Jena N-TRIPLE literal parsing code for instance)
 (defn extract-property
   "Extract entity propety value (object is a literal)"
   [#^String line]


(#21372) Adapt a fast returning version of missing? using reduce

This patch includes Deepak's alternative to missing? which returns fast if any
any results of contains? for each of the keys is true.

Signed-off-by: Ken Barber <470bc578162732ac7f9d387d34c4af4ca6e1b6f7@bob.sh>

--- src/com/puppetlabs/utils.clj
+++ src/com/puppetlabs/utils.clj
@@ -207,16 +207,15 @@

       ;; Returns false, as :a is in the collection
       (missing? {:a 'a' :b 'b' :c 'c'} :z :b)"
-  ([coll key]
-    {:pre  [(coll? coll)]
-     :post [(boolean? %)]}
-    (not (contains? coll key)))
-  ([coll key & more-keys]
-    {:pre  [(coll? coll)]
-     :post [(boolean? %)]}
-    (let [comb   (conj more-keys key)
-          result (map #(missing? coll %) comb)]
-      (nil? (some false? result)))))
+  [coll & keys]
+  {:pre  [(coll? coll)]
+   :post [(boolean? %)]}
+  (reduce (fn [_ key]
+            (if (contains? coll key)
+              (reduced false)
+              true))
+          nil
+          keys))

 ;; ## Date and Time


Implement my-deref

Implement my-deref

--- src/cyanite_fetcher/core.clj
+++ src/cyanite_fetcher/core.clj
@@ -91,6 +91,13 @@
     "SELECT path,data,time FROM metric WHERE "
     "path = ? AND tenant = ? AND rollup = ? AND period = ? "
     "AND time >= ? AND time <= ? ORDER BY time ASC;")))
+
+(defn my-deref
+  [f]
+  (let [result (deref f 300000 :timeout)]
+    (when (= result :timeout)
+      (throw (ex-info "Too long!" {})))
+    result))

 (defn par-fetch
   "Fetch data in parallel fashion."
@@ -111,7 +118,7 @@
                            (shutdown-agents)
                            (throw e))))
                     paths))]
-    (map deref futures)))
+    (map my-deref futures)))

 (defn par-fetch-pmap
   "Fetch data in parallel fashion using pmap."
@@ -143,7 +150,7 @@
                                                           (seq)
                                                           (swap! data conj)))})
                     paths))]
-    (map deref channels)
+    (map my-deref channels)
     @data))

 (defn c-get-data
@@ -151,7 +158,7 @@
   [f-par-fetch host paths tenant rollup period from to]
   (println "Connecting to Cassandra...")
   (let [cluster (alia/cluster {:contact-points [host]})
-        session (alia/connect keyspace cluster)
+        session (alia/connect cluster keyspace)
         fetch! (fetchq session)]
     (println "Getting data form Cassandra...")
     (try


Refactor names and logic

Refactor names and logic

--- src/day8/re_frame/trace.cljs
+++ src/day8/re_frame/trace.cljs
@@ -149,8 +149,8 @@
     (for [{:keys [op-type id operation tags duration] :as trace} showing-traces]
       (let [padding   {:padding "0px 5px 0px 5px"}
             row-style (merge padding {:border-top (case op-type :event "1px solid lightgrey" nil)})
-            show?     (get-in @trace-detail-expansions [:overrides id]
-                              (:showing @trace-detail-expansions))
+            show-row? (get-in @trace-detail-expansions [:overrides id]
+                        (:show-all? @trace-detail-expansions))
             #_#__ (js/console.log (devtools/header-api-call tags))]
         (list [:tr {:key   id
                     :style {:color (case op-type
@@ -161,11 +161,9 @@
                                      :re-frame.router/fsm-trigger "#fd701e"
                                      nil)}}
                [:td {:style (merge row-style {:cursor "pointer"})
-                     :on-click (fn [e]
-                                 (when show?
-                                   (swap! trace-detail-expansions assoc-in [:overrides id] true))
-                                 (swap! trace-detail-expansions update-in [:overrides id] not))}
-                (if show? "▼" "▶")]
+                     :on-click #(swap! trace-detail-expansions update-in [:overrides id]
+                                       (fn [bool] (if show-row? false (not bool))))}
+                (if show-row? "▼" "▶")]
                [:td {:style row-style} (str op-type)]
                [:td {:style row-style} (if (= PersistentVector (type (js->clj operation)))
                                          (second operation)
@@ -178,7 +176,7 @@
                                           :white-space "nowrap"})}

                 (.toFixed duration 1) " ms"]]
-              (when show?
+              (when show-row?
                 [:tr {:key (str id "-details")}
                  [:td {:col-span 3} (with-out-str (pprint/pprint (dissoc tags :query-v :event :duration)))]]))))))

@@ -187,7 +185,7 @@
         filter-items               (r/atom [])
         filter-type                (r/atom :contains)
         input-error                (r/atom false)
-        trace-detail-expansions    (r/atom {:showing false :overrides {}})]
+        trace-detail-expansions    (r/atom {:show-all? false :overrides {}})]
     (fn []
       (let [showing-traces       (if (= @filter-items [])
                                    @traces
@@ -235,10 +233,9 @@
              [:th [:button.text-button
                    {:style {:cursor "pointer"}
                     :on-click (fn [e]
-                                (when (:showing @trace-detail-expansions)
-                                  (swap! trace-detail-expansions assoc :overrides {}))
-                                (swap! trace-detail-expansions update :showing not))}
-                   (if (:showing @trace-detail-expansions) "-" "+")]]
+                                (swap! trace-detail-expansions assoc :overrides {})
+                                (swap! trace-detail-expansions update :show-all? not))}
+                   (if (:show-all? @trace-detail-expansions) "-" "+")]]
              [:th "operations"]
              [:th
                (when (pos? (count @filter-items))


we can use pngs now!

we can use pngs now!

--- src/pc/email.clj
+++ src/pc/email.clj
@@ -15,7 +15,7 @@
      [:div
       [:a {:href (str "https://prcrsr.com/document/" doc-id)}
        [:img {:width 256
-              :src (str "https://prcrsr.com/document/" doc-id ".svg?printer-friendly=false")}]]]
+              :src (str "https://prcrsr.com/document/" doc-id ".png?printer-friendly=false")}]]]
      [:div {:style "font-size: 12px"}
       "If you think this message was an error, let us know: "
       [:a {:href "mailto:info@prcrsr.com"} "info@prcrsr.com"] "."]]]))


Add par-fetch-async

Add par-fetch-async

--- src/cyanite_fetcher/core.clj
+++ src/cyanite_fetcher/core.clj
@@ -126,6 +126,24 @@
                         (doall)
                         (seq))) paths))

+(defn par-fetch-async
+  "Fetch data in parallel fashion using execute-async."
+  [session fetch! paths tenant rollup period from to]
+  (let [data (atom [])
+        channels (doall (map #(alia/execute-async session fetch!
+                                                  {:values [% tenant (int rollup)
+                                                            (int period)
+                                                            from to]
+                                                   :fetch-size Integer/MAX_VALUE
+                                                   :success (fn [rows]
+                                                              (->> rows
+                                                                   (map detect-aggregate)
+                                                                   (doall)
+                                                                   (seq)
+                                                                   (swap! data conj)))}) paths))]
+    (map deref channels)
+    @data))
+
 (defn c-get-data
   "Get data from C*."
   [host paths tenant rollup period from to]


CMR-6217 changed test name

CMR-6217 changed test name

--- access-control-app/int-test/cmr/access_control/int_test/access_control_group_crud_test.clj
+++ access-control-app/int-test/cmr/access_control/int_test/access_control_group_crud_test.clj
@@ -473,7 +473,7 @@
                                concept_id2)]}
              (test-util/update-group token concept_id3 (assoc group3 :name (:name group2))))))))

-(deftest update-groups-with-identical-names-but-different-providers
+(deftest update-provider-groups
   (let [group1 (test-util/make-group {:name "group1" :provider_id "PROV1"})
         group1a (test-util/make-group {:name "group2" :provider_id "PROV1"})
         group2 (test-util/make-group {:name "group2" :provider_id "PROV2"})


Add pickup menu

Add pickup menu

--- src/dungeon_crusade/main.clj
+++ src/dungeon_crusade/main.clj
@@ -45,7 +45,9 @@
   {:places {:0 (init-place-0)}
    :current-place :0
    :show-inventory? false
+   :show-pick-up? false
    :last-command nil
+   :remaining-hotkeys (seq "abcdefghijklmnopqrstuvwxyzABCdEFGHIJKLMNOPQRSTUVWQYZ")
    :player {:hp 10
             :max-hp 10
             :$ 0
@@ -86,6 +88,12 @@
                                                                      :horizontal-wall
                                                                      :door-closed])
         true))))
+
+(defn player-cellxy [state]
+  (let [x (-> state :world :player :pos :x)
+        y (-> state :world :player :pos :y)]
+    (get-xy x y (current-place state))))
+

 (defn move-left [state]
   (let [x (-> state :world :player :pos :x)
@@ -168,9 +176,32 @@
           (assoc-in state [:world :places place target-y target-x :type] :door-closed))
         state))))

+(defn pick-up [state keyin]
+  (let [place (current-place state)
+        [player-cell x y] (player-cellxy state)
+        items (player-cellxy :items)
+        item-index (.indexOf (state :world :remaining-hotkeys) keyin)]
+    (-> state
+      ;; dup the item into inventory with hotkey
+      (update-in [:world :player :inventory]
+        (fn [prev-inventory]
+          (conj prev-inventory (nth items item-index))))
+      ;; remove the item from cell
+      (update-in [:world :places place y x :items]
+        (fn [prev-items] (vec (concat (subvec prev-items 0 (dec item-index))
+                                      (subvec prev-items item-index (count prev-items))))))
+      ;; hotkey is no longer available
+      (update-in [:world :remaining-hotkeys]
+        (fn [prev-keys] (vec (concat (subvec prev-keys 0 (dec item-index))
+                                     (subvec prev-keys item-index (count prev-keys)))))))))
+
 (defn toggle-inventory [state]
   (println "toggle-inventory" (not (-> state :world :show-inventory?)))
   (assoc-in state [:world :show-inventory?] (not (-> state :world :show-inventory?))))
+
+(defn toggle-pick-up [state]
+  (println "toggle-pick-up" (not (-> state :world :show-pick-up?)))
+  (assoc-in state [:world :show-pick-up?] (not (-> state :world :show-pick-up?))))

 (defn update-state [state keyin]
@@ -188,25 +219,57 @@
                                               \j :down
                                               \k :up
                                               \l :right)))
+    :pick-up (let [state-with-command(set-last-command state nil)]
+               (pick-up state-with-command keyin))
     (case keyin
       \h (move-left state)
       \j (move-down state)
       \k (move-up state)
       \l (move-right state)
       \i (toggle-inventory state)
+      \, (toggle-pick-up state)
       \o (set-last-command state :open)
       \c (set-last-command state :close)
       state)))
+
+(defn render-pick-up [state]
+  ;; maybe draw pick up menu
+  (when (-> state :world :show-pick-up?)
+    (println "render-pick-up")
+    (let [player-x   (-> state :world :player :pos :x)
+          player-y   (-> state :world :player :pos :y)
+          cell       (first (get-xy player-x player-y (current-place state)))
+          cell-items (or (cell :items) [])
+          contents   (take 22
+                       (concat (map-indexed #(format "%c %-38s" (nth (-> state :world :remaining-hotkeys) %1)
+                                                                (%2 :name))
+                                            cell-items)
+                               (repeat (apply str (repeat 40 " ")))))]
+    (println "player-x" player-x "player-y" player-y)
+    (println "cell" cell)
+    (println "cell-items" cell-items)
+    (println "type-contents" (type contents))
+    (println "contents" contents)
+    (doall (map-indexed (fn [y line] (do
+                                       (println "y" y "line" line "type" (type line))
+                                       (s/put-string (state :screen) 40 (inc y) line {:fg :black :bg :white :styles #{:bold}}))) contents))
+    (println "header")
+    (s/put-string (state :screen) 40 0 "  Pick up                               " {:fg :black :bg :white :styles #{:underline :bold}}))))
+
+(defn render-inventory [state]
+    (when (-> state :world :show-inventory?)
+        (println "render-inventory")
+        (dorun (map (fn [y] (s/put-string (state :screen) 40 y "                                        " {:bg :white})) (range 23)))
+        (s/put-string (state :screen) 40 0 "  Inventory                             " {:fg :black :bg :white :styles #{:underline}})))

 (defn render [state]
   (do
     (println "render")
     (s/clear (state :screen))
     ;; draw map
-    (println "map-with-xy")
     (map-with-xy
       (fn [cell x y]
-        (println cell x y)
+        ;;(println cell x y)
         (when (not (nil? cell))
           (let [cell-items (cell :items)
                 out-char (if (not (nil? cell-items))
@@ -242,18 +305,18 @@
       (-> state :world :player :pos :y)
       (-> state :world :player :sym)
       {:fg :green})
+    ;; maybe draw pick up menu
+    (render-pick-up state)
     ;; maybe draw inventory
-    (when (-> state :world :show-inventory?)
-        (dorun (map (fn [y] (s/put-string (state :screen) 40 y "                                        " {:bg :white})) (range 23)))
-        (s/put-string (state :screen) 40 0 "  Inventory                             " {:fg :black :bg :white :styles #{:underline}}))
+    (render-inventory state)
     ;; draw status bar
     (s/put-string (state :screen) 0  23
-      (format " %s $%d HP:%d(%d) Pw:%d Amr:%d XP:%d/%d T%d                             "
+      (format " %s $%d HP:%d(%d) Pw:%d(%d) Amr:%d XP:%d/%d T%d                         "
         "location-detail"
         (-> state :world :player :$)
         (-> state :world :player :hp)
         (-> state :world :player :max-hp)
-        0 0
+        0 0 10
         (-> state :world :player :xp)
         100
         (-> state :time))


remove all unnecessary deps

remove all unnecessary deps

--- examples/session/project.clj
+++ examples/session/project.clj
@@ -1,6 +1,5 @@
 (defproject authexample "0.1.0-SNAPSHOT"
   :description "Buddy auth example"
-  :url ""
   :min-lein-version "2.0.0"
   :license {:name "Eclipse Public License"
             :url "http://www.eclipse.org/legal/epl-v10.html"}
@@ -8,16 +7,9 @@
                  [compojure "1.2.1"]
                  [ring "1.3.1"]
                  [ring/ring-jetty-adapter "1.3.1"]
-                 [ring/ring-json "0.3.1"]
-                 [ring/ring-headers "0.1.1"]
-                 [hiccup "1.0.5"]
                  [buddy/buddy-sign "0.4.0"]
                  [buddy/buddy-auth "0.4.0"]]
   :ring {:handler authexample.web/app
          :port 9090}
   :profiles {:dev {:plugins [[lein-ring "0.8.13"]]
-                   :test-paths ^:replace []}
-             :test {:dependencies [[midje "1.6.3"]]
-                    :plugins [[lein-midje "3.1.3"]]
-                    :test-paths ["test"]
-                    :resource-paths ["test/resources"]}})
+                   :test-paths ^:replace []}})


Recognize clojure 1.6.

Recognize clojure 1.6.

--- integration-tests/src/test/clojure/immutant/integs/web/noir.clj
+++ integration-tests/src/test/clojure/immutant/integs/web/noir.clj
@@ -23,7 +23,7 @@
   (:require [clj-http.client :as client]))

 (defn run-tests? []
-  (not (version? 1.5)))
+  (not (or (version? 1.5) (version? 1.6))))

 (let [file *file*]
   (use-fixtures :once #(if (run-tests?)


patch ephemeris-api-type

patch ephemeris-api-type

--- src/ephemeris_api/config.clj
+++ src/ephemeris_api/config.clj
@@ -17,13 +17,22 @@

 (defn- to-int [s] (Integer. s))

+;; deployment adapter type
+(defn dadapt []
+  (let [override (nna (env :ephemeris-api-type) keyword)]
+    (if (nil? override)
+      (get (base) :type)
+      override)))
+
 (defn config []
-  (->> (merge {:base "/api"} (base))
-    (configurable [:type]
-                  (nna (env :ephemeris-api-type) keyword))
+  (->> (merge {:base "/api"} ;; the hardcoded defaults
+              (base) ;; the per-environment configured
+              {:type (dadapt)})
     (configurable [:http :host]
                   (env :ephemeris-api-host))
     (configurable [:http :port]
-                  (nna (env :ephemeris-api-port) to-int))
+                  (if (= (dadapt) :jetty) ;; jetty demands int port
+                    (nna (env :ephemeris-api-port) to-int)
+                    (env :ephemeris-api-port)))
     (configurable [:base]
                   (env :ephemeris-api-base))))


db/playlists query

db/playlists query

--- src/trak/db.cljs
+++ src/trak/db.cljs
@@ -6,11 +6,11 @@

 ;; Create database

-                              :me/status              {}
 (defonce schema {:application/state-type {:db/unique :db.unique/identity}
                  :application/state      {}

                  :me/identifier          {:db/unique :db.unique/identity}
+                 :me/status              {}

                  :subscription/name      {}
                  :subscription/channel   {}
@@ -49,7 +49,11 @@
                               :in $ ?identity
                               :where [?me :me/identifier ?identity]] db :me))))

-
+(defn playlists [db owner_id]
+  (unpack-entities db (d/q '[:find ?playlist
+                             :in $ ?owner_id
+                             :where [?playlist :playlist/owner ?owner]]
+                           db owner_id)))

 ;; Utilities


Fixed wording for "Intro to some"

Fixed wording for "Intro to some"

--- src/foreclojure/data_set.clj
+++ src/foreclojure/data_set.clj
@@ -487,7 +487,7 @@
            {:_id 48
             :title "Intro to some"
             :times-solved 0
-            :description "The some function takes a predicate function and a collection.  It returns the first item for which the predicate returns true."
+            :description "The some function takes a predicate function and a collection.  It returns the first logical true value of (predicate x) where x is an item in the collection."
             :tags ["easy"]
             :tests ["(= __ (some #{2 7 6} [5 6 7 8]))"
 		    "(= __ (some #(when (even? %) %) [5 6 7 8]))"]})))


Fix problem #47 for current contains? behaviour.

--- src/foreclojure/data_set.clj
+++ src/foreclojure/data_set.clj
@@ -530,7 +530,7 @@
             :tests ["(contains? #{4 5 6} __)"
                     "(contains? [1 1 1 1 1] __)"
                     "(contains? {4 :a 2 :b} __)"
-                    "(not (contains? '(1 2 4) __))"]})
+                    "(not (contains? [1 2 4] __))"]})

        (insert! :problems
            {:_id 48


Reformatted utils.clj by zprint

Reformatted utils.clj by zprint

--- src/zg/utils.clj
+++ src/zg/utils.clj
@@ -11,47 +11,47 @@
 ;

 (ns zg.utils
-    "Various utility function used by other modules.")
+  "Various utility function used by other modules.")

 (defn third
-    "Simple utility function - returns third item from a given sequence, nil if third item does not exist."
-    [coll]
-    (nth coll 2 nil))
+  "Simple utility function - returns third item from a given sequence, nil if third item does not exist."
+  [coll]
+  (nth coll 2 nil))

 (defn fourth
-    "Simple utility function - returns fourth item from a given sequence, nil if third item does not exist."
-    [coll]
-    (nth coll 3 nil))
+  "Simple utility function - returns fourth item from a given sequence, nil if third item does not exist."
+  [coll]
+  (nth coll 3 nil))

 (defn substring
-    "Call method String.substring()."
-    ([^String s from to]
-     (.substring s from to))
-    ([^String s from]
-     (.substring s from)))
+  "Call method String.substring()."
+  ([^String s from to]
+    (.substring s from to))
+  ([^String s from]
+    (.substring s from)))

 (defn startsWith
-    "Call method String.startsWith()."
-    [^String s pattern]
-    (.startsWith s pattern))
+  "Call method String.startsWith()."
+  [^String s pattern]
+  (.startsWith s pattern))

 (defn endsWith
-    "Call method String.endsWith()."
-    [^String s pattern]
-    (.endsWith s pattern))
+  "Call method String.endsWith()."
+  [^String s pattern]
+  (.endsWith s pattern))

 (defn contains
-    "Call method String.contains()."
-    [^String s pattern]
-    (.contains s pattern))
+  "Call method String.contains()."
+  [^String s pattern]
+  (.contains s pattern))

 (defn replaceAll
-    "Call method String.replaceAll()."
-    [^String s pattern replacement]
-    (.replaceAll s pattern replacement))
+  "Call method String.replaceAll()."
+  [^String s pattern replacement]
+  (.replaceAll s pattern replacement))

 (defn get-exception-message
-    "Retrieve a message from given exception."
-    [^java.lang.Exception exception]
-    (.getMessage exception))
+  "Retrieve a message from given exception."
+  [^java.lang.Exception exception]
+  (.getMessage exception))


adjust docstr

adjust docstr

--- src/minreact/core.clj
+++ src/minreact/core.clj
@@ -150,8 +150,7 @@
   React attributes:

   If the first arg passed to the factory is a map or JS object the
-  following keys are associated directly in the React props and will
-  not be made available in the minreact props:
+  following keys are associated directly in the React props:

   :key, :ref, :dangerouslySetInnerHTML


(SERVER-876) Add versioned-code-service to jruby pool test

One test in the jruby pool test directly leverages the
request-handler-service, which now has a dependency on the
versioned-code-service. This commit adds the versioned-code-service to
the apps to start up for that test to account for the change.

--- test/integration/puppetlabs/services/jruby/jruby_pool_int_test.clj
+++ test/integration/puppetlabs/services/jruby/jruby_pool_int_test.clj
@@ -19,6 +19,7 @@
             [puppetlabs.trapperkeeper.internal :as tk-internal]
             [puppetlabs.trapperkeeper.core :as tk]
             [puppetlabs.services.request-handler.request-handler-service :as handler-service]
+            [puppetlabs.services.versioned-code-service.versioned-code-service :as vcs]
             [puppetlabs.services.config.puppet-server-config-service :as ps-config]
             [puppetlabs.services.protocols.request-handler :as handler]
             [puppetlabs.services.request-handler.request-handler-core :as handler-core]
@@ -325,7 +326,8 @@
     (ks-testutils/with-no-jvm-shutdown-hooks
      (let [services [jruby/jruby-puppet-pooled-service profiler/puppet-profiler-service
                      handler-service/request-handler-service ps-config/puppet-server-config-service
-                     jetty9/jetty9-service]
+                     jetty9/jetty9-service
+                     vcs/versioned-code-service]
            config (-> (jruby-testutils/jruby-puppet-tk-config
                        (jruby-testutils/jruby-puppet-config {:max-active-instances 2}))
                       (assoc-in [:webserver :port] 8081))


CMR-6495 updates test.

CMR-6495 updates test.

--- umm-spec-lib/test/cmr/umm_spec/test/migration/version/variable.clj
+++ umm-spec-lib/test/cmr/umm_spec/test/migration/version/variable.clj
@@ -504,8 +504,7 @@
              (assoc-in [:Characteristics :GroupPath] "/MODIS_Grid_Daily_1km_LST/Data_Fields/sea_surface_temperature")
              (assoc :AdditionalIdentifiers [{:Identifier "CF_Standard_Description",
                                              :Description
-                                             "The sea surface subskin temperature is the temperature at the base of the conductive laminar sub-layer of the ocean surface, that is, at a depth of approximately 1 - 1.5 millimeters below the air-sea interface. For practical purposes, this quantity can be well approximated to the measurement of surface temperature by a microwave radiometer operating in the 6 - 11 gigahertz frequency range, but the relationship is neither direct nor invariant to changing physical conditions or to the specific geometry of the microwave measurements. Measurements of this quantity are subject to a large potential diurnal cycle due to thermal stratification of the upper ocean layer in low wind speed high solar irradiance conditions.",}])
-             (assoc :StandardName "sea_surface_foundation_temperature"))
+                                             "The sea surface subskin temperature is the temperature at the base of the conductive laminar sub-layer of the ocean surface, that is, at a depth of approximately 1 - 1.5 millimeters below the air-sea interface. For practical purposes, this quantity can be well approximated to the measurement of surface temperature by a microwave radiometer operating in the 6 - 11 gigahertz frequency range, but the relationship is neither direct nor invariant to changing physical conditions or to the specific geometry of the microwave measurements. Measurements of this quantity are subject to a large potential diurnal cycle due to thermal stratification of the upper ocean layer in low wind speed high solar irradiance conditions.",}]))
          (vm/migrate-umm {} :variable "1.7" "1.6" variable-concept-17))))

 (deftest migrate-16->17


Fix up project.clj. #7

Fix up project.clj. #7

Add missing requirements and skip :main declaration since we'll just use a shell script to direct traffic.

--- jvm/project.clj
+++ jvm/project.clj
@@ -12,14 +12,15 @@
   :dependencies [[commons-collections/commons-collections "3.2.1"]]
   :profiles {:dev
               {:dependencies [[storm "0.8.2"]
+                              [storm/tools.cli "0.2.2"]
                               [org.clojure/clojure "1.4.0"]
+                              [org.clojure/tools.cli "0.3.1"]
+                              [org.clojure/data.json "0.2.4"]
                               [org.testng/testng "6.8.5"]
                               [org.easytesting/fest-assert-core "2.0M8"]
                               [org.mockito/mockito-all "1.9.0"]
                               [org.jmock/jmock "2.6.0"]]}}
-  :min-lein-version "2.0.0"
   :source-paths ["src"]
   :test-paths ["test"]
-  :aot :all
-  :main streamparse)
   :resource-paths ["resources"]
+  :aot :all)


Update selmer dependency

Update selmer dependency

--- luminus/hello/project.clj
+++ luminus/hello/project.clj
@@ -6,7 +6,7 @@
    [lib-noir "0.6.6"]
    [compojure "1.1.6"]
    [ring-server "0.3.1"]
-   [selmer "0.4.0"]
+   [selmer "0.5.6"]
    [com.taoensso/timbre "1.6.0"]
    [com.postspectacular/rotor "0.1.0"]
    [com.taoensso/tower "1.5.1"]


Problem added - Juxtaposition

Problem added - Juxtaposition

--- src/foreclojure/data_set.clj
+++ src/foreclojure/data_set.clj
@@ -603,4 +603,15 @@
             :tests ["(= [3 2 1] ((__ rest reverse) [1 2 3 4]))"
                     "(= 5 ((__ (partial + 3) second) [1 2 3 4]))"
                     "(= true ((__ zero? #(mod % 8) +) 3 5 7 9))"
-                    "(= \"HELLO\" ((__ #(.toUpperCase %) #(apply str %) take) 5 \"hello world\"))"]})))
+                    "(= \"HELLO\" ((__ #(.toUpperCase %) #(apply str %) take) 5 \"hello world\"))"]})
+
+      (insert! :problems
+           {:_id 59
+            :title "Juxtaposition"
+            :times-solved 0
+            :restricted ["juxt"]
+            :description "Take a set of functions and return a new function that takes a variable number of arguments and returns a sequence containing the result of applying each function left-to-right to the argument list."
+            :tags ["medium" "higher-order-functions" "core-functions"]
+            :tests ["(= [21 6 1] ((__ + max min) 2 3 5 1 6 4))"
+                    "(= [\"HELLO\" 5] ((__ #(.toUpperCase %) count) \"hello\"))"
+                    "(= [2 6 4] ((__ :a :c :b) {:a 2, :b 4, :c 6, :d 8 :e 10}))"]})))


Disable read-eval for security

Disable read-eval for security

--- src/foreclojure/problems.clj
+++ src/foreclojure/problems.clj
@@ -77,7 +77,7 @@
           (if-not test
             (mark-completed id code)
             (let [testcase (s/replace test "__" (str code))]
-              (if (sb sb-tester (read-string testcase))
+              (if (sb sb-tester (safe-read testcase))
                 (recur more)
                 (do
                   (session/flash-put! :code code)


Extract repository update to a function

Extract repository update to a function

--- src/github_changelog/git.clj
+++ src/github_changelog/git.clj
@@ -16,11 +16,14 @@
     (catch FileNotFoundException _
       (git/git-clone uri dir))))

+(defn- refresh [^Repository repo]
+  (git/git-fetch-all repo)
+  repo)
+
 (defn clone [uri dir]
-  (let [path (or dir (git-path uri))
-        repo (clone-or-load uri path)]
-    (git/git-fetch-all repo)
-    repo))
+  (->> (or dir (git-path uri))
+       (clone-or-load uri)
+       refresh))

 (defn- get-merge-sha [^Repository repo ^Ref tag]
   (let [peeled (.peel repo tag)]


Kill switch.

Kill switch.

--- src/kolmogorov_music/geb.clj
+++ src/kolmogorov_music/geb.clj
@@ -35,6 +35,7 @@
 (comment
   (fx-chorus)
   (live/jam (var geb))
+  (def geb nil)
   )

 ; Instrumentation


stage 3

stage 3

--- clojure/src/main/resources/clojure/core.clj
+++ clojure/src/main/resources/clojure/core.clj
@@ -1882,7 +1882,7 @@
    :static true}
   [sym] (. clojure.lang.Var (find sym)))

-(defn binding-conveyor-fn
+#_(defn binding-conveyor-fn
   {:private true
    :added "1.3"}
   [f]
@@ -1914,7 +1914,7 @@
       (.setValidator r (:validator opts)))
     r))

-(defn agent
+#_(defn agent
   "Creates and returns an agent with an initial value of state and
   zero or more options (in any order):

@@ -1949,19 +1949,19 @@
                             (if (:error-handler opts) :continue :fail)))
        a)))

-(defn set-agent-send-executor!
+#_(defn set-agent-send-executor!
   "Sets the ExecutorService to be used by send"
   {:added "1.5"}
   [executor]
   (set! clojure.lang.Agent/pooledExecutor executor))

-(defn set-agent-send-off-executor!
+#_(defn set-agent-send-off-executor!
   "Sets the ExecutorService to be used by send-off"
   {:added "1.5"}
   [executor]
   (set! clojure.lang.Agent/soloExecutor executor))

-(defn send-via
+#_(defn send-via
   "Dispatch an action to an agent. Returns the agent immediately.
   Subsequently, in a thread supplied by executor, the state of the agent
   will be set to the value of:
@@ -1971,7 +1971,7 @@
   [executor ^clojure.lang.Agent a f & args]
   (.dispatch a (binding [*agent* a] (binding-conveyor-fn f)) args executor))

-(defn send
+#_(defn send
   "Dispatch an action to an agent. Returns the agent immediately.
   Subsequently, in a thread from a thread pool, the state of the agent
   will be set to the value of:
@@ -1982,7 +1982,7 @@
   [^clojure.lang.Agent a f & args]
   (apply send-via clojure.lang.Agent/pooledExecutor a f args))

-(defn send-off
+#_(defn send-off
   "Dispatch a potentially blocking action to an agent. Returns the
   agent immediately. Subsequently, in a separate thread, the state of
   the agent will be set to the value of:
@@ -1993,7 +1993,7 @@
   [^clojure.lang.Agent a f & args]
   (apply send-via clojure.lang.Agent/soloExecutor a f args))

-(defn release-pending-sends
+#_(defn release-pending-sends
   "Normally, actions sent directly or indirectly during another action
   are held until the action completes (changes the agent's
   state). This function can be used to dispatch any pending sent
@@ -2004,7 +2004,7 @@
    :static true}
   [] (clojure.lang.Agent/releasePendingSends))

-(defn add-watch
+#_(defn add-watch
   "Adds a watch function to an agent/atom/var/ref reference. The watch
   fn must be a fn of 4 args: a key, the reference, its old-state, its
   new-state. Whenever the reference's state might have been changed,
@@ -2022,14 +2022,14 @@
    :static true}
   [^clojure.lang.IRef reference key fn] (.addWatch reference key fn))

-(defn remove-watch
+#_(defn remove-watch
   "Removes a watch (set by add-watch) from a reference"
   {:added "1.0"
    :static true}
   [^clojure.lang.IRef reference key]
   (.removeWatch reference key))

-(defn agent-error
+#(defn agent-error
   "Returns the exception thrown during an asynchronous action of the
   agent if the agent is failed.  Returns nil if the agent is not
   failed."
@@ -2037,7 +2037,7 @@
    :static true}
   [^clojure.lang.Agent a] (.getError a))

-(defn restart-agent
+#_(defn restart-agent
   "When an agent is failed, changes the agent state to new-state and
   then un-fails the agent so that sends are allowed again.  If
   a :clear-actions true option is given, any actions queued on the
@@ -2054,7 +2054,7 @@
   (let [opts (apply hash-map options)]
     (.restart a new-state (if (:clear-actions opts) true false))))

-(defn set-error-handler!
+#_(defn set-error-handler!
   "Sets the error-handler of agent a to handler-fn.  If an action
   being run by the agent throws an exception or doesn't pass the
   validator fn, handler-fn will be called with two arguments: the
@@ -2064,7 +2064,7 @@
   [^clojure.lang.Agent a, handler-fn]
   (.setErrorHandler a handler-fn))

-(defn error-handler
+#_(defn error-handler
   "Returns the error-handler of agent a, or nil if there is none.
   See set-error-handler!"
   {:added "1.2"
@@ -2072,7 +2072,7 @@
   [^clojure.lang.Agent a]
   (.getErrorHandler a))

-(defn set-error-mode!
+#_(defn set-error-mode!
   "Sets the error-mode of agent a to mode-keyword, which must be
   either :fail or :continue.  If an action being run by the agent
   throws an exception or doesn't pass the validator fn, an
@@ -2089,14 +2089,14 @@
   [^clojure.lang.Agent a, mode-keyword]
   (.setErrorMode a mode-keyword))

-(defn error-mode
+#_(defn error-mode
   "Returns the error-mode of agent a.  See set-error-mode!"
   {:added "1.2"
    :static true}
   [^clojure.lang.Agent a]
   (.getErrorMode a))

-(defn agent-errors
+#_(defn agent-errors
   "DEPRECATED: Use 'agent-error' instead.
   Returns a sequence of the exceptions thrown during asynchronous
   actions of the agent."
@@ -2106,7 +2106,7 @@
   (when-let [e (agent-error a)]
     (list e)))

-(defn clear-agent-errors
+#_(defn clear-agent-errors
   "DEPRECATED: Use 'restart-agent' instead.
   Clears any exceptions thrown during asynchronous actions of the
   agent, allowing subsequent actions to occur."
@@ -2114,7 +2114,7 @@
    :deprecated "1.2"}
   [^clojure.lang.Agent a] (restart-agent a (.deref a)))

-(defn shutdown-agents
+#_(defn shutdown-agents
   "Initiates a shutdown of the thread pools that back the agent
   system. Running actions will complete, but no new actions will be
   accepted"
@@ -2967,7 +2967,7 @@
                                    ~@(when needrec [recform]))))))])))))]
     (nth (step nil (seq seq-exprs)) 1)))

-(defn await
+#_(defn await
   "Blocks the current thread (indefinitely!) until all actions
   dispatched thus far, from this thread or agent, to the agent(s) have
   occurred.  Will block on failed agents.  Will never return if
@@ -2984,12 +2984,12 @@
         (send agent count-down))
       (. latch (await)))))

-(defn ^:static await1 [^clojure.lang.Agent a]
+#_(defn ^:static await1 [^clojure.lang.Agent a]
   (when (pos? (.getQueueCount a))
     (await a))
     a)

-(defn await-for
+#_(defn await-for
   "Blocks the current thread until all actions dispatched thus
   far (from this thread or agent) to the agents have occurred, or the
   timeout (in milliseconds) has elapsed. Returns logical false if
@@ -5893,7 +5893,7 @@
   (-> x (bit-shift-right shift) (bit-and mask)))

 (def ^:private max-mask-bits 13)
-(def ^:private max-switch-table-size (bit-shift-left 1 max-mask-bits))
+#_(def ^:private max-switch-table-size (bit-shift-left 1 max-mask-bits))

 (defn- maybe-min-hash
   "takes a collection of hashes and returns [shift mask] or nil if none found"
@@ -5905,7 +5905,7 @@
                   shift (range 0 31)]
               [shift mask]))))

-(defn- case-map
+#_(defn- case-map
   "Transforms a sequence of test constants and a corresponding sequence of then
   expressions into a sorted map to be consumed by case*. The form of the map
   entries are {(case-f test) [(test-f test) then]}."
@@ -5916,13 +5916,13 @@
               (map test-f tests)
               thens))))

-(defn- fits-table?
+#_(defn- fits-table?
   "Returns true if the collection of ints can fit within the
   max-table-switch-size, false otherwise."
   [ints]
   (< (- (apply max (seq ints)) (apply min (seq ints))) max-switch-table-size))

-(defn- prep-ints
+#_(defn- prep-ints
   "Takes a sequence of int-sized test constants and a corresponding sequence of
   then expressions. Returns a tuple of [shift mask case-map switch-type] where
   case-map is a map of int case values to [test then] tuples, and switch-type
@@ -5938,7 +5938,7 @@
         ; compact case ints, with shift-mask
         [shift mask (case-map #(shift-mask shift mask (int %)) int tests thens) :compact]))))

-(defn- merge-hash-collisions
+#_(defn- merge-hash-collisions
   "Takes a case expression, default expression, and a sequence of test constants
   and a corresponding sequence of then expressions. Returns a tuple of
   [tests thens skip-check-set] where no tests have the same hash. Each set of
@@ -5974,7 +5974,7 @@
                      (into1 #{}))]
     [(keys hmap) (vals hmap) skip-check]))

-(defn- prep-hashes
+#_(defn- prep-hashes
   "Takes a sequence of test constants and a corresponding sequence of then
   expressions. Returns a tuple of [shift mask case-map switch-type skip-check]
   where case-map is a map of int case values to [test then] tuples, switch-type
@@ -6003,7 +6003,7 @@
         [shift mask case-map switch-type skip-check]))))

-(defmacro case
+#_(defmacro case
   "Takes an expression, and a set of clauses.

   Each clause can take the form of either:


Fix tests

Fix tests

--- test/clj/subman/web/style_test.clj
+++ test/clj/subman/web/style_test.clj
@@ -1,6 +0,0 @@
-(ns subman.web.style-test
-  (:require [clojure.test :refer [deftest is]]
-            [subman.web.style :as style]))
-
-(deftest test-main-style
-  (is style/main))


clean up bindings, add failure detail

clean up bindings, add failure detail

--- test/clj_money/api/test_helper.clj
+++ test/clj_money/api/test_helper.clj
@@ -21,8 +21,7 @@
               find-other-user-fn 'find-other-user}}]
   `(deftest ~name
      (let [context# (serialization/realize ~storage ~context)
-           params# {:params (~params-fn context#)}
-           ]
+           params# {:params (~params-fn context#)}]
        (testing "A user can %s list from his own entity"
          (let [response# (with-authentication (~find-user-fn context#)
                            (~list-fn params#))]
@@ -71,6 +70,8 @@
          (let [response# (with-authentication (~find-user-fn context#)
                            (~create-fn params#))
                resources# (~select-resources-fn context#)]
+           (if-not (= 201 (:status response#))
+             (pprint {:invalid-resource (:body response#)}))
            (is (= 201 (:status response#)) "The response is a successful creation")
            (is (some ~compare-fn resources#)
                (format "The response contains the new %s" ~resource-name)))))))


Print /fullpath/file in the message if the file was modified or deleted.

If two files with the same name were modified or deleted then we don't
know which one is about to be reloaded or saved.

--- src/lt/objs/editor/pool.cljs
+++ src/lt/objs/editor/pool.cljs
@@ -129,7 +129,7 @@
                         (when-let [ed (first (by-path f))]
                           (when-not (doc/check-mtime (doc/->stats f) stat)
                             (if (:dirty @ed)
-                              (active-warn ed {:header "This file has been modified."
+                              (active-warn ed {:header (str "File modified: " f)
                                                :body "This file seems to have been modified outside of Light Table. Do you want to load the latest and lose your changes?"
                                                :buttons [{:label "Reload from disk"
                                                           :action (fn []
@@ -138,8 +138,8 @@
                                                          ]})
                               (reload ed)))))))

-(defn warn-delete [ed]
-  (active-warn ed {:header "This file has been deleted."
+(defn warn-delete [f ed]
+  (active-warn ed {:header (str "File deleted: " f)
                    :body "This file seems to have been deleted and we've marked it as unsaved."
                    :buttons [{:label "Save as.."
                               :action (fn []
@@ -151,7 +151,7 @@
           :reaction (fn [ws del]
                       (if-let [ed (first (by-path del))]
                         (do
-                          (warn-delete ed)
+                          (warn-delete del ed)
                           (make-transient-dirty ed)
                           (when-let [ts (:lt.objs.tabs/tabset @ed)]
                             (object/raise ts :tab.updated)))
@@ -160,7 +160,7 @@
                                               false)
                                            (object/by-tag :editor))]
                           (doseq [ed open]
-                            (warn-delete ed)
+                            (warn-delete del ed)
                             (make-transient-dirty ed))))))

 (behavior ::watched.rename


updated forma.trends.stretch test namespace to use thrift API

--- test/forma/trends/stretch_test.clj
+++ test/forma/trends/stretch_test.clj
@@ -1,33 +1,32 @@
 (ns forma.trends.stretch-test
-  (:use forma.trends.stretch
-        midje.sweet)
+  (:use forma.trends.stretch :reload)
+  (:use [midje sweet])
   (:require [forma.date-time :as date]
             [forma.schema :as schema]
-            [forma.trends.data :as data]))
+            [forma.thrift :as thrift]))

-(fact
-  (let [{:keys [start-idx end-idx]} (schema/timeseries-value 384 [1 2 3])]
-    (shift-periods-target-res "32" "16" start-idx end-idx) => [736 741]))
+(fact "Test that `shift-periods-target-res` yields the new start and
+  end index."
+  (let [[start end _] (thrift/unpack (thrift/TimeSeries* 384 [1 2 3]))]
+    (shift-periods-target-res "32" "16" start end) => [736 741]))

-(fact
-  "Expect to see values repeated the correct number of days given
+(fact "Expect to see values repeated the correct number of days given
   16-day dataset."
-  (expand-to-days 384 [1 2 3] 384 1 "32" 0) => (concat (repeat 31 1)
-                                                       (repeat 28 2)
-                                                       (repeat 31 3)))
-
-(fact
-  "Expect to see values repeated the correct number of days given a
-monthly dataset (e.g. 31 for January, 28 for non-leap year February."
-  (expand-to-days 0 [1 2 3] 384 1 "1" 0) => [1 2 3])
+  (let [out-series (concat (repeat 31 1) (repeat 28 2) (repeat 31 3))]
+    (expand-to-days 384 [1 2 3] 384 "32" 0) => out-series))

 (fact
   "Expect to see values repeated the correct number of days given a
   monthly dataset (e.g. 31 for January, 28 for non-leap year
   February."
-  (expand-to-days 736 [1 2 3] 736 1 "16" 0) => (concat (repeat 16 1)
-                                                       (repeat 16 2)
-                                                       (repeat 16 3)))
+  (expand-to-days 0 [1 2 3] 384 "1" 0) => [1 2 3])
+
+(fact
+  "Expect to see values repeated the correct number of days given a
+  monthly dataset (e.g. 31 for January, 28 for non-leap year
+  February."
+  (let [out-series (concat (repeat 16 1) (repeat 16 2) (repeat 16 3))]
+    (expand-to-days 736 [1 2 3] 736 "16" 0) => out-series))

 (fact
   "Starting with January 2002 (non-leap year), period 384, a 3-period
@@ -36,52 +35,53 @@
   which would run past the end of March, requires having the value for
   April. Since we only have through March, that second period in March
   is not generated."
-  (let [ts (schema/timeseries-value 384 [1 2 3])
-        output {:start-idx 736
-                :end-idx 740
-                :series [1.0 1.0625 2.0 2.3125 3.0]}]
-    (ts-expander "32" "16" ts) => output))
+  (let [ts (thrift/TimeSeries* 384 [1 2 3])]
+    (ts-expander "32" "16" ts)
+    => (thrift/TimeSeries* 736 740 [1.0, 1.0625, 2.0, 2.3125, 3.0])))

 (defn get-periods-per-year
-  "Returns the number of periods in a year at the resolution of interest."
+  "Returns the number of periods in a year at the resolution of
+  interest."
   [k]
   ((keyword k) {:32 12 :16 23 :8 46}))

 (defn mk-ts
-  "Create a timeseries based on the number of periods in a year, the number of periods to consume, and the starting index. Values are repeated based on `periods-per-year`, and increment with the year index `(range years)."
+  "Create a timeseries based on the number of periods in a year, the
+  number of periods to consume, and the starting index. Values are
+  repeated based on `periods-per-year`, and increment with the year
+  index `(range years). For the purpose of testing, we test for `10`
+  years."
   [periods-per-year amount start-idx]
-  (let [years 10]
-    (schema/timeseries-value start-idx
-                             (map float (take amount
-                                              (reduce concat
-                                                      (map
-                                                       (partial repeat periods-per-year)
-                                                       (range years))))))))
+  (let [series (map (partial repeat periods-per-year) (range 10))
+        float-series (map float (take amount (reduce concat series)))]
+    (thrift/TimeSeries* start-idx float-series)))

 (tabular
  (fact
-   "Expanding a year-long monthly timeseries (12 periods) should yield a year's worth of 16-day (23) or 8-day (46) periods. Since we established above that the moving average works correctly, we are focusing here on ensuring that the number of periods is correct, and that the end of the year is accounted for correctly. Sixteen- and 8-day timeseries do not fit evenly into a year, so the final period of each year will always be shorter than a normal period by several days.
+   "Expanding a year-long monthly timeseries (12 periods) should yield
+   a year's worth of 16-day (23) or 8-day (46) periods. Since we
+   established above that the moving average works correctly, we are
+   focusing here on ensuring that the number of periods is correct,
+   and that the end of the year is accounted for correctly. Sixteen-
+   and 8-day timeseries do not fit evenly into a year, so the final
+   period of each year will always be shorter than a normal period by
+   several days.

-Here, our timeseries values are repeated in a given year, as described in `mk-ts`.
+   Here, our timeseries values are repeated in a given year, as
+   described in `mk-ts`.

-The number of periods for 16- and 8-day timeseries should be given by
-the number of directories in
-ftp://e4ftl01p.cr.usgs.gov/MOLT/MOD13A1.005 for the range of
-interest, but there appears to be some inconsistency ...
+   The number of periods for 16- and 8-day timeseries should be given
+   by the number of directories in
+   ftp://e4ftl01p.cr.usgs.gov/MOLT/MOD13A1.005 for the range of
+   interest, but there appears to be some inconsistency ...

-For reference:
-Period 360 is 2000-01-01 at monthly resolution
-Period 736 is 2000-01-01 at 16-day resolution
-Period 1380 is 2000-01 at 8-day resolution"
+   For reference:
+     Period 360 is 2000-01-01 at monthly resolution
+     Period 736 is 2000-01-01 at 16-day resolution
+     Period 1380 is 2000-01 at 8-day resolution"
    (let [target-start-idx (date/shift-resolution ?base-res ?target-res ?start-idx)
-         base-ts (mk-ts
-                      (get-periods-per-year ?base-res)
-                      ?base-length
-                      ?start-idx)
-         target-ts (mk-ts
-                        (get-periods-per-year ?target-res)
-                        ?target-length
-                        target-start-idx)]
+         base-ts (mk-ts (get-periods-per-year ?base-res) ?base-length ?start-idx)
+         target-ts (mk-ts (get-periods-per-year ?target-res) ?target-length target-start-idx)]
      (ts-expander ?base-res ?target-res base-ts) => target-ts))
  ?base-length ?target-length  ?base-res ?target-res ?start-idx
  1                1              "32"       "16"        360


test hook

test hook

--- src/main/cawala/api/read.clj
+++ src/main/cawala/api/read.clj
@@ -6,7 +6,7 @@
                      :person/relation :friend}
                  2  {:db/id 2 :person/name "Sally" :person/age 22
                      :person/relation :friend}
-                 3  {:db/id 3 :person/name "Allie" :person/age 69
+                 3  {:db/id 3 :person/name "Allie" :person/age 68
                      :person/relation :enemy}
                  4  {:db/id 4 :person/name "Zoe" :person/age 32
                      :person/relation :friend}


Somewhat yucky fix for infinite loops in synth control bindings.

--- src/overtone/gui/control.clj
+++ src/overtone/gui/control.clj
@@ -29,9 +29,16 @@
                val-atom)
     (bind/bind val-atom
                (bind/transform #(* (/ (- % min-val) (- max-val min-val)) SLIDER-MAX))
+               ; if the value's "close enough" to the spinner, stop. Otherwise,
+               ; we get infinite loops caused by rounding error.
+               (bind/filter #(>= (Math/abs (- % (value slider))) 0.01))
                slider)
     (bind/bind spinner val-atom)
-    (bind/bind val-atom spinner)
+    (bind/bind val-atom
+               ; if the value's "close enough" to the slider, stop. Otherwise,
+               ; we get infinite loops caused by rounding error.
+               (bind/filter #(>= (Math/abs (- % (value spinner))) 0.01))
+               spinner)
     items))

 (defn- control-dial


Bring back #'inst-channels and implement stereo fx...

For now we can just use multiple instances of a mono effect to simulate
a stereo effect. This will extend to multi-channel insts well, but some
fx (like compression and reverb) will benefit from stereo implementations.

--- src/overtone/studio/inst.clj
+++ src/overtone/studio/inst.clj
@@ -33,6 +33,12 @@
     (apply stereo-inst-mixer args)
     (apply mono-inst-mixer args)))

+(defn inst-channels
+  "Internal fn used for multimethod dispatch on Insts."
+  [inst & args]
+  (let [n-chans (:n-chans inst)]
+    (if (> n-chans 1) :stereo :mono)))
+
 (defn inst-volume!
   "Control the volume of a single instrument."
   [inst vol]
@@ -45,13 +51,26 @@
   (ctl (:mixer inst) :pan pan)
   (reset! (:pan inst) pan))

-(defn inst-fx
-  "Append an effect to an instrument channel."
+(defmulti inst-fx!
+  "Append an effect to an instrument channel. Returns a SynthNode or a
+  vector of SynthNodes representing the the effect instance."
+  inst-channels)
+
+(defmethod inst-fx! :mono
   [inst fx]
   (let [fx-group (:fx-group inst)
         bus (:bus inst)
         fx-id (fx :tgt fx-group :pos :tail :bus bus)]
     fx-id))
+
+(defmethod inst-fx! :stereo
+  [inst fx]
+  (let [fx-group (:fx-group inst)
+        bus-l (:id (:bus inst))
+        bus-r (inc bus-l)
+        fx-ids [(fx :tgt fx-group :pos :tail :bus bus-l)
+                (fx :tgt fx-group :pos :tail :bus bus-r)]]
+    fx-ids))

 (defn clear-fx
   [inst]


Changed hard-coded string to localized string.

--- app/src/weather/ui/index.clj
+++ app/src/weather/ui/index.clj
@@ -1,6 +1,7 @@
 (ns weather.ui.index
   (:require [clojure.java.io :as io]
-            [hiccup.page :as page])
+            [hiccup.page :as page]
+            [weather.localization :refer [tr]])
   (:import [org.apache.commons.codec.digest DigestUtils]))

 (defn resource-with-checksum
@@ -16,7 +17,7 @@
   []
   (page/html5
     [:head
-     [:title "weather"]
+     [:title (tr :title)]
      [:meta {:charset "utf-8"}]
      [:meta {:http-equiv "X-UA-Compatible" :content "IE=edge"}]
      [:meta {:name "viewport"


Return txns from worker/run-job

Return txns from worker/run-job

We've been moving towards a style of returning txns, instead of
executing them directly. This allows for much more elegant testing and
control over the transaction cycle!

--- src/overseer/worker.clj
+++ src/overseer/worker.clj
@@ -91,7 +91,7 @@
     (timbre/info "Job" job-id "exited with status" exit-status)
     (if (= exit-status :aborted)
       (timbre/info "Found :aborted job; aborting all dependents of" job-id))
-    @(d/transact conn txns)))
+    txns))

 (defn ->job-executor
   "Construct a function that will reserve a job off the queue and execute it,
@@ -102,7 +102,8 @@
       (when-not (empty? jobs)
         (timbre/info (count jobs) "handleable job(s) found.")
         (if-let [job (select-and-reserve system jobs conn)]
-          (run-job system job-handlers job))))))
+          (let [txns (run-job system job-handlers job)]
+            @(d/transact conn txns)))))))

 (defn run
   "Run a worker, given:


added support for controlling word order (in-out)

--- src/mastersign/wordcloud.clj
+++ src/mastersign/wordcloud.clj
@@ -33,8 +33,9 @@
    :max-test-radius 350
    :order-priority 0.7
    :padding 3
-   :shape-mode :glyph-box ; :word-box, :glyph-box
+   :shape-mode :word-box ; :word-box, :glyph-box
    :allow-rotation true
+   :order-mode :value1 ; :id, :text, :value1, :value2
    :color-fn #'default-color-fn
    })

@@ -65,7 +66,11 @@
   (let [args (merge default-args args)
         img (image 1 1)
         graphics (.createGraphics img)
-        word-stats (reverse (sort-by #(nth % 2) word-stats))
+        word-stats (case (:order-mode args)
+                       :id (sort-by first word-stats)
+                       :text (sort-by second word-stats)
+                       :value2 (reverse (sort-by #(nth % 3) word-stats))
+                       (reverse (sort-by #(nth % 2) word-stats)))
         word-infos (doall (map (partial build-word-info graphics args) word-stats))]
     (.dispose graphics)
     word-infos))


Try CORS with localhost and port

Try CORS with localhost and port

--- src/obb_rules_api/routes.clj
+++ src/obb_rules_api/routes.clj
@@ -47,7 +47,7 @@
   "Setup cors"
   [handler]
   (cors/wrap-cors handler :access-control-allow-origin [#"http://(.+\.)?orionsbelt.eu"
-                                                        #"http://localhost"
+                                                        #"http://localhost:(.+)"
                                                         #"http://orionsbelt-battlegrounds.github.io"]
                           :access-control-allow-methods [:get :put :post :delete]))


Fix GC.

Fix GC.

--- src/onyx/log/commands/gc.clj
+++ src/onyx/log/commands/gc.clj
@@ -6,17 +6,14 @@

 (defmethod extensions/apply-log-entry :gc
   [{:keys [args message-id]} replica]
-  (let [completed (difference (into #{} (:jobs replica))
-                              (into #{} (common/incomplete-jobs replica)))
+  (let [completed (:completed-jobs replica)
         killed (:killed-jobs replica)
-        jobs (concat completed killed)
-        remove-f #(vec (remove (fn [j] (some #{j} jobs)) %))]
+        jobs (concat completed killed)]
     (as-> jobs x
-          (reduce (fn [new job] (update-in new [:jobs] remove-f)) replica x)
-          (reduce (fn [new job] (update-in new [:killed-jobs] remove-f)) x jobs)
+          (assoc-in x [:killed-jobs] [])
+          (assoc-in x [:completed-jobs] [])
           (reduce (fn [new job] (update-in new [:tasks] dissoc job)) x jobs)
           (reduce (fn [new job] (update-in new [:allocations] dissoc job)) x jobs)
-          (reduce (fn [new job] (update-in new [:completions] dissoc job)) x jobs)
           (reduce (fn [new job] (update-in new [:task-schedulers] dissoc job)) x jobs)
           (reduce (fn [new job] (update-in new [:percentages] dissoc job)) x jobs)
           (reduce (fn [new job] (update-in new [:task-percentages] dissoc job)) x jobs)
@@ -29,7 +26,6 @@
   {:jobs (first (diff (into #{} (:jobs old)) (into #{} (:jobs new))))
    :killed-jobs (first (diff (into #{} (:killed-jobs old)) (into #{} (:killed-jobs new))))
    :tasks (first (diff (:tasks old) (:tasks new)))
-   :completions (first (diff (:completions old) (:completions new)))
    :allocations (first (diff (:allocations old) (:allocations new)))})

 (defmethod extensions/reactions :gc


Fix publication lookup, pull out fragment limit

--- src/onyx/messaging/aeron.clj
+++ src/onyx/messaging/aeron.clj
@@ -40,7 +40,7 @@
     (taoensso.timbre/info "Starting Aeron Messenger")
     (let [config (:config peer-group)
           messaging-group (:messaging-group peer-group)
-          publications (:publications messaging-group)
+          publications (atom {})
           send-idle-strategy (:send-idle-strategy messaging-group)
           compress-f (:compress-f (:messaging-group peer-group))
           short-ids (atom {})]
@@ -48,13 +48,16 @@
              :messaging-group messaging-group
              :short-ids short-ids
              :send-idle-strategy send-idle-strategy
+             :publications publications
              :compress-f compress-f)))

-  (stop [{:keys [short-ids] :as component}]
+  (stop [{:keys [short-ids publications] :as component}]
     (taoensso.timbre/info "Stopping Aeron Messenger")
+    (run! #(.close %) (vals @publications))
     (assoc component
            :messaging-group nil
            :send-idle-strategy nil
+           :publications nil
            :short-ids nil
            :compress-f nil)))

@@ -234,6 +237,8 @@
               (into #{} (:peers (get barrier-state (first (keys barrier-state)))))))
    subscription-maps))

+(def fragment-limit 10)
+
 (defmethod extensions/receive-messages AeronMessenger
   [messenger {:keys [onyx.core/subscriptions onyx.core/task-map
                      onyx.core/replica onyx.core/job-id
@@ -249,38 +254,43 @@
             fh (fragment-data-handler (partial handle-message result-state (:onyx.core/task-id event)
                                                (:upstream-task next-subscription)
                                                (:onyx.core/task event)))
-            n-fragments (.controlledPoll ^Subscription subscription ^ControlledFragmentHandler fh 10)]
+            n-fragments (.controlledPoll ^Subscription subscription ^ControlledFragmentHandler fh fragment-limit)]
         @result-state)
       [])))

-(defn get-publication [channel stream-id]
-  (let [error-handler (reify ErrorHandler
-                        (onError [this x]
-                          (taoensso.timbre/warn "Aeron messaging publication error:" x)))
-        ctx (-> (Aeron$Context.)
-                (.errorHandler error-handler))
-        conn (Aeron/connect ctx)]
-    (.addPublication conn channel stream-id)))
+(defn get-publication [publications channel stream-id]
+  (if-let [pub (get @publications [channel stream-id])]
+    pub
+    (let [error-handler (reify ErrorHandler
+                          (onError [this x]
+                            (taoensso.timbre/warn "Aeron messaging publication error:" x)))
+          ctx (-> (Aeron$Context.)
+                  (.errorHandler error-handler))
+          conn (Aeron/connect ctx)
+          pub (.addPublication conn channel stream-id)]
+      (swap! publications assoc [channel stream-id] pub)
+      pub)))

 (defn write [^Publication pub ^UnsafeBuffer buf]
   ;; Needs an escape mechanism so it can break if a peer is shutdown
   ;; Needs an idle mechanism to prevent cpu burn
-  (while (neg? (.offer pub buf 0 (.capacity buf)))))
+  (while (neg? (.offer pub buf 0 (.capacity buf)))
+    (info "Offering")))

 (defmethod extensions/send-messages AeronMessenger
-  [messenger {:keys [channel stream-id] :as conn-spec} batch]
-  (let [pub (get-publication channel stream-id)
+  [{:keys [publications]} {:keys [channel stream-id] :as conn-spec} batch]
+  (let [pub (get-publication publications channel stream-id)
         buf ^UnsafeBuffer (UnsafeBuffer. (messaging-compress batch))]
     (write pub buf)))

 (defmethod extensions/send-barrier AeronMessenger
-  [messenger {:keys [channel stream-id] :as conn-spec} barrier]
-  (let [pub (get-publication channel stream-id)
+  [{:keys [publications]} {:keys [channel stream-id] :as conn-spec} barrier]
+  (let [pub (get-publication publications channel stream-id)
         buf ^UnsafeBuffer (UnsafeBuffer. (messaging-compress barrier))]
     (write pub buf)))

 (defmethod extensions/internal-complete-segment AeronMessenger
-  [messenger completion-message {:keys [channel stream-id] :as conn-spec}]
-  (let [pub (get-publication channel stream-id)
+  [{:keys [publications]} completion-message {:keys [channel stream-id] :as conn-spec}]
+  (let [pub (get-publication publications channel stream-id)
         buf ^UnsafeBuffer (UnsafeBuffer. (messaging-compress completion-message))]
     (write pub buf)))


Aeron will gc its own publications for now

--- src/onyx/messaging/aeron.clj
+++ src/onyx/messaging/aeron.clj
@@ -9,6 +9,7 @@
             [onyx.static.default-vals :refer [defaults arg-or-default]])
   (:import [uk.co.real_logic.aeron Aeron FragmentAssemblyAdapter]
            [uk.co.real_logic.aeron Aeron$Context]
+           [uk.co.real_logic.aeron Publication]
            [uk.co.real_logic.aeron.driver MediaDriver MediaDriver$Context ThreadingMode]
            [uk.co.real_logic.aeron.logbuffer FragmentHandler]
            [uk.co.real_logic.agrona.concurrent UnsafeBuffer]
@@ -57,14 +58,14 @@
              :release-ch release-ch
              :retry-ch retry-ch)))

-  (stop [{:keys [aeron resources release-ch] :as component}]
+  (stop [{:keys [id release-ch retry-ch virtual-peers] :as component}]
     (taoensso.timbre/info "Stopping Aeron")
     (try
       ;;; TODO; could handle the inbound-ch in a similar way - rather than using messenger-buffer
-      (close! (:release-ch component))
-      (close! (:retry-ch component))
+      (close! release-ch)
+      (close! retry-ch)
+      (swap! virtual-peers dissoc id)
       (catch Throwable e (fatal e)))
-
     (assoc component
            :send-idle-strategy nil
            :short-circuitable? nil
@@ -75,11 +76,8 @@
            :inbound-ch nil :release-ch nil :retry-ch nil )))

 (defmethod extensions/open-peer-site AeronConnection
-  [messenger assigned]
-  (swap! (:virtual-peers (:messaging-group (:peer-group messenger)))
-         assoc
-         (:id messenger)
-         messenger))
+  [{:keys [virtual-peers id] :as messenger} assigned]
+  (swap! virtual-peers assoc id messenger))

 (def no-op-error-handler
   (reify ErrorHandler
@@ -110,7 +108,6 @@
         (let [fragments-read (.poll ^uk.co.real_logic.aeron.Subscription subscription ^FragmentHandler handler ^int limit)]
           (.idle idle-strategy fragments-read))))))

-
 (defn handle-message [decompress-f virtual-peers buffer offset length header]
   (let [msg-type (protocol/read-message-type buffer offset)
         offset-rest (inc ^long offset)]
@@ -154,14 +151,18 @@
                                     (catch Throwable e (fatal e))))]
     {:conn conn :subscription subscription :subscriber-fut subscriber-fut}))

-
-;; FIXME, race condition
+(defrecord TrackedPublication [publication last-used])
+
 (defn get-publication [messenger channel]
+  ;; FIXME, race condition may cause two publications to be created
+  ;; same goes for operation/peer-link
   (if-let [pub (get @(:publications messenger) channel)]
-    pub
+    (do
+      (reset! (:last-used pub) (System/currentTimeMillis))
+      (:publication pub))
     (let [conn (Aeron/connect (.errorHandler (Aeron$Context.) no-op-error-handler))
           pub (.addPublication conn channel send-stream-id)]
-      (do (swap! (:publications messenger) assoc channel pub)
+      (do (swap! (:publications messenger) assoc channel (->TrackedPublication pub (atom (System/currentTimeMillis))))
           (swap! (:connections messenger) assoc channel conn)
           pub))))

@@ -172,6 +173,33 @@
                  Available ports can be configured in the peer-config.
                  e.g. {:onyx.messaging/peer-ports [40000, 40002],
                  :onyx.messaging/peer-port-range [40200 40260]}"))))
+
+
+;; FIXME: gc'ing publications could be racy if a publication is grabbed
+;; just as it is being gc'd - though it is unlikely
+(defn gc-publications [publications connections opts]
+  (let [interval (arg-or-default :onyx.messaging/peer-link-gc-interval opts)
+        idle (arg-or-default :onyx.messaging/peer-link-idle-timeout opts)]
+    (loop []
+      (try
+        (Thread/sleep interval)
+        (let [t (System/currentTimeMillis)
+              snapshot @publications
+              to-remove (map first
+                             (filter (fn [[k v]] (>= (- t @(:last-used v)) idle))
+                                     snapshot))]
+          (doseq [k to-remove]
+            (let [pub (:publication (snapshot k))
+                  conn (@connections k)]
+              (swap! publications dissoc k)
+              (swap! connections dissoc k)
+              (.close pub)
+              (.close conn))))
+        (catch InterruptedException e
+          (throw e))
+        (catch Throwable e
+          (fatal e)))
+      (recur))))

 (defrecord AeronPeerGroup [opts publications connections compress-f decompress-f send-idle-strategy]
   component/Lifecycle
@@ -196,8 +224,10 @@
           virtual-peers (atom {})
           publications (atom {})
           connections (atom {})
-          subscriber (start-subscriber! bind-addr port virtual-peers decompress-f receive-idle-strategy)]
+          subscriber (start-subscriber! bind-addr port virtual-peers decompress-f receive-idle-strategy)
+          pub-gc-thread (future (gc-publications publications connections opts))]
       (assoc component
+             :pub-gc-thread pub-gc-thread
              :bind-addr bind-addr
              :external-addr external-addr
              :external-channel external-channel
@@ -215,14 +245,17 @@
   (stop [{:keys [media-driver subscriber publications connections] :as component}]
     (taoensso.timbre/info "Stopping Aeron Peer Group")
     (future-cancel (:subscriber-fut subscriber))
+    (future-cancel (:pub-gc-thread component))
     (.close (:subscription subscriber))
     (.close (:conn subscriber))
     (doseq [pub (vals @publications)]
-      (.close ^uk.co.real_logic.aeron.Publication pub))
+      (.close ^Publication (:publication pub)))
     (doseq [conn (vals @connections)]
       (.close conn))
     (when media-driver (.close ^MediaDriver media-driver))
-    (assoc component :media-driver nil :publications nil :virtual-peers nil
+    (assoc component
+           :pub-gc-thread nil
+           :media-driver nil :publications nil :virtual-peers nil
            :external-channel nil
            :compress-f nil :decompress-f nil :send-idle-strategy nil
            :subscriber nil)))
@@ -281,7 +314,7 @@
   [messenger event {:keys [peer-id channel]} batch]
   (if ((:short-circuitable? messenger) channel)
     (send-messages-short-circuit (short-circuit-ch messenger peer-id :inbound-ch) batch)
-    (let [pub ^uk.co.real_logic.aeron.Publication (get-publication messenger channel)
+    (let [pub ^Publication (get-publication messenger channel)
           [len unsafe-buffer] (protocol/build-messages-msg-buf (:compress-f messenger) peer-id batch)
           offer-f (fn [] (.offer pub unsafe-buffer 0 len))
           idle-strategy (:send-idle-strategy messenger)]
@@ -298,7 +331,7 @@
   [messenger event {:keys [peer-id channel]} acks]
   (if ((:short-circuitable? messenger) channel)
     (ack-messages-short-circuit (short-circuit-ch messenger peer-id :acking-ch) acks)
-    (let [pub ^uk.co.real_logic.aeron.Publication (get-publication messenger channel)
+    (let [pub ^Publication (get-publication messenger channel)
           idle-strategy (:send-idle-strategy messenger)]
       (doseq [{:keys [id completion-id ack-val]} acks]
         (let [unsafe-buffer (protocol/build-acker-message peer-id id completion-id ack-val)
@@ -314,7 +347,7 @@
   (if ((:short-circuitable? messenger) channel)
     (complete-message-short-circuit (short-circuit-ch messenger peer-id :release-ch) id)
     (let [idle-strategy (:send-idle-strategy messenger)
-          pub ^uk.co.real_logic.aeron.Publication (get-publication messenger channel)
+          pub ^Publication (get-publication messenger channel)
           unsafe-buffer (protocol/build-completion-msg-buf peer-id id)
           offer-f (fn [] (.offer pub unsafe-buffer 0 protocol/completion-msg-length))]
       (while (neg? ^long (offer-f))
@@ -328,7 +361,7 @@
   (if ((:short-circuitable? messenger) channel)
     (retry-message-short-circuit (short-circuit-ch messenger peer-id :retry-ch) id)
     (let [idle-strategy (:send-idle-strategy messenger)
-          pub ^uk.co.real_logic.aeron.Publication (get-publication messenger channel)
+          pub ^Publication (get-publication messenger channel)
           unsafe-buffer (protocol/build-retry-msg-buf peer-id id)
           offer-f (fn [] (.offer pub unsafe-buffer 0 protocol/retry-msg-length))]
       (while (neg? ^long (offer-f))


Turn key-pressed? and button-pressed? into functions

--- src/play_clj/core_basics.clj
+++ src/play_clj/core_basics.clj
@@ -115,13 +115,13 @@
   [k]
   (eval (u/gdx-field "Input$Keys" (u/key->upper k))))

-(defmacro key-pressed?
+(defn key-pressed?
   "Returns a boolean indicating if the key cooresponding to `k` is being pressed.

     (key-pressed? :a)
     (key-pressed? :page-down)"
   [k]
-  `(input! :is-key-pressed (key-code ~k)))
+  (input! :is-key-pressed (key-code k)))

 (defn button-code
   "Returns a static field from [Input.Buttons](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/Input.Buttons.html).
@@ -130,12 +130,12 @@
   [k]
   (eval (u/gdx-field "Input$Buttons" (u/key->upper k))))

-(defmacro button-pressed?
+(defn button-pressed?
   "Returns a boolean indicating if the button cooresponding to `k` is being pressed.

     (button-pressed? :left)"
   [k]
-  `(input! :is-button-pressed (button-code ~k)))
+  (input! :is-button-pressed (button-code k)))

 (defn ^:private add-input!
   [^InputProcessor p]


Rename symbols to avoid conflicts

Rename symbols to avoid conflicts

--- src/play_clj/g2d_physics.clj
+++ src/play_clj/g2d_physics.clj
@@ -147,67 +147,67 @@

 ; shapes

-(defn chain*
-  "The function version of `chain`"
+(defn chain-shape*
+  "The function version of `chain-shape`"
   []
   (ChainShape.))

-(defmacro chain
+(defmacro chain-shape
   "Returns a [ChainShape](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/physics/box2d/ChainShape.html)"
   [& options]
-  `(u/calls! ^ChainShape (chain*) ~@options))
-
-(defmacro chain!
-  "Calls a single method on a `chain`"
+  `(u/calls! ^ChainShape (chain-shape*) ~@options))
+
+(defmacro chain-shape!
+  "Calls a single method on a `chain-shape`"
   [object k & options]
   `(u/call! ^ChainShape ~object ~k ~@options))

-(defn circle*
-  "The function version of `circle`"
+(defn circle-shape*
+  "The function version of `circle-shape`"
   ([]
     (CircleShape.))
   ([radius]
-    (doto ^CircleShape (circle*)
+    (doto ^CircleShape (circle-shape*)
       (.setRadius radius)
       (.setPosition (m/vector-2 radius radius)))))

-(defmacro circle
+(defmacro circle-shape
   "Returns a [CircleShape](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/physics/box2d/CircleShape.html)"
   [radius & options]
-  `(u/calls! ^CircleShape (circle* ~radius) ~@options))
-
-(defmacro circle!
-  "Calls a single method on a `circle`"
+  `(u/calls! ^CircleShape (circle-shape* ~radius) ~@options))
+
+(defmacro circle-shape!
+  "Calls a single method on a `circle-shape`"
   [object k & options]
   `(u/call! ^CircleShape ~object ~k ~@options))

-(defn edge*
-  "The function version of `edge`"
+(defn edge-shape*
+  "The function version of `edge-shape`"
   []
   (EdgeShape.))

-(defmacro edge
+(defmacro edge-shape
   "Returns an [EdgeShape](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/physics/box2d/EdgeShape.html)"
   [& options]
-  `(u/calls! ^EdgeShape (edge*) ~@options))
-
-(defmacro edge!
-  "Calls a single method on an `edge`"
+  `(u/calls! ^EdgeShape (edge-shape*) ~@options))
+
+(defmacro edge-shape!
+  "Calls a single method on an `edge-shape`"
   [object k & options]
   `(u/call! ^EdgeShape ~object ~k ~@options))

-(defn polygon*
-  "The function version of `polygon`"
+(defn polygon-shape*
+  "The function version of `polygon-shape`"
   []
   (PolygonShape.))

-(defmacro polygon
+(defmacro polygon-shape
   "Returns a [PolygonShape](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/physics/box2d/PolygonShape.html)"
   [& options]
-  `(u/calls! ^PolygonShape (polygon*) ~@options))
-
-(defmacro polygon!
-  "Calls a single method on a `polygon`"
+  `(u/calls! ^PolygonShape (polygon-shape*) ~@options))
+
+(defmacro polygon-shape!
+  "Calls a single method on a `polygon-shape`"
   [object k & options]
   `(u/call! ^PolygonShape ~object ~k ~@options))


Correctly fill in default host for profiler rate.

--- src/riemann/jvm_profiler.clj
+++ src/riemann/jvm_profiler.clj
@@ -27,7 +27,7 @@
                  :metric      self-time
                  :ttl         (* 2 dt)
                  :tags        tags}))
-         (concat [{:host    host
+         (concat [{:host    (or host (client/localhost))
                    :service (str prefix "profiler rate")
                    :state   "ok"
                    :metric  rate


CMR-4722: Remmoved commented out code and added docstring

--- system-int-test/test/cmr/system_int_test/search/granule_orbit_search_test.clj
+++ system-int-test/test/cmr/system_int_test/search/granule_orbit_search_test.clj
@@ -528,8 +528,8 @@
   ;; 2. Evaluate this block to find all the mbrs.
   ;; It will print out "Elapsed time: XXXX msecs" when it's done
   (def matching-mbrs
-    ; (future (time (doall (filter mbr-finds-granule? (create-mbrs 45.0 90.0 -55.0 55.0 3)))))
-    ;; Create mbrs all over the globe
+    "Creates mbrs all over the globe as search areas. Returns any mbrs which find granules in the
+    local system. Takes awhile to run, so performed as a future."
     (future (time (doall (filter mbr-finds-granule? (create-mbrs -180.0 180.0 -90.0 90.0 3))))))


Better error message if read fails

Better error message if read fails

a lousy substitute for a real ascii reader.

--- src/stl_collector/reader.clj
+++ src/stl_collector/reader.clj
@@ -32,6 +32,10 @@
                  (.order ByteOrder/LITTLE_ENDIAN))]
     (let [num_facets (read-header buffer)]
       (for [n (range num_facets)]
-        (read-facet buffer
-                    (+ stl-file/HEADER_LENGTH
-                       (* n stl-file/BYTES_PER_FACET)))))))
+        (try
+          (read-facet buffer
+                      (+ stl-file/HEADER_LENGTH
+                         (* n stl-file/BYTES_PER_FACET)))
+          (catch Exception e
+            (println "Trouble reading: " filename (.getMessage e))
+            []))))))


docstring

docstring

--- frontend/utils.cljs
+++ frontend/utils.cljs
@@ -77,9 +77,18 @@
                                                                        :context context}])
                        :finally #(put! channel [message :finished context])})))

-(defn edit-input [controls-ch path event & {:keys [value]
-                                            :or {value (.. event -target -value)}}]
+(defn edit-input
+  "Meant to be used in a react event handler, usually for the :on-change event on input.
+  Path is the vector of keys you would pass to assoc-in to change the value in state,
+  event is the Synthetic React event. Pulls the value out of the event.
+  Optionally takes :value as a keyword arg to override the event's value"
+  [controls-ch path event & {:keys [value]
+                             :or {value (.. event -target -value)}}]
   (put! controls-ch [:edited-input {:path path :value value}]))

-(defn toggle-input [controls-ch path event]
+(defn toggle-input
+  "Meant to be used in a react event handler, usually for the :on-change event on input.
+  Path is the vector of keys you would pass to update-in to toggle the value in state,
+  event is the Synthetic React event."
+  [controls-ch path event]
   (put! controls-ch [:toggled-input {:path path}]))


core: not-any?

core: not-any?

--- data/core.clj
+++ data/core.clj
@@ -1310,3 +1310,11 @@
   [pred coll]
   (when (seq coll)
     (or (pred (first coll)) (recur pred (next coll)))))
+
+(def
+  ^{:tag Bool
+    :doc "Returns false if (pred x) is logical true for any x in coll,
+         else true."
+         :arglists '([pred coll])
+         :added "1.0"}
+  not-any? (comp not some))


Limit files queued for processing

Limit files queued for processing

--- src/video_server/process.clj
+++ src/video_server/process.clj
@@ -14,16 +14,23 @@
             [video-server.file :refer [subtitle? video?]]
             [video-server.encoder :refer [encode-subtitle encode-subtitles encode-video extract-thumbnail]]
             [video-server.library :refer [add-info video-key video-for-file video-for-key]]
-            [video-server.metadata :refer [retrieve-metadata]])
-  (:import (java.io File)))
+            [video-server.metadata :refer [retrieve-metadata]]))

 (def process-chan (chan 100))
+
+(defn should-process-file?
+  "Determines whether the file or video should be queued for
+  processing."
+  [file-or-video]
+  (or (record? file-or-video)
+      (some-fn #{video? subtitle?} file-or-video)))

 (defn process-file
   "Enqueues a file or video for processing."
   [folder file-or-video]
-  (log/debug "queueing" (str file-or-video))
-  (go (>! process-chan [folder (video-key file-or-video)])))
+  (when (should-process-file? file-or-video)
+    (log/debug "queueing" (str file-or-video))
+    (go (>! process-chan [folder (video-key file-or-video)]))))

 (defn can-download?
   "Returns whether the file is small enough for downloading."


delete-wish-rem cljs

delete-wish-rem cljs

--- src/wishlistd/cljs/main.cljs
+++ src/wishlistd/cljs/main.cljs
@@ -98,6 +98,10 @@
     (letrem [neu (update-wish wish)]
       (fn [e] nil))))

+(defn delete-wish-rem [$elem]
+  (let [id (.attr $elem "id")]
+    (letrem [neu (delete-wish id)]
+      (fn [e] nil))))

 ; DELEGATES


cleanup

cleanup

--- src/babel/lexicon.cljc
+++ src/babel/lexicon.cljc
@@ -5,8 +5,3 @@
                         :obj {:speakable true}}}}
    :tell {:synsem {:sem {:subj {:human true}
                          :obj {:human true}}}}})
-
-
-
-
-


Uudempi Elasticsearch (7.16.2 -> 7.16.3)

--- clj-test-utils/src/clj_test_utils/elasticsearch_docker_utils.clj
+++ clj-test-utils/src/clj_test_utils/elasticsearch_docker_utils.clj
@@ -5,7 +5,7 @@
     [robert.hooke :refer [add-hook]]
     [clojure.java.shell :refer [sh]]))

-(def image (. (. DockerImageName (parse "190073735177.dkr.ecr.eu-west-1.amazonaws.com/utility/elasticsearch-kouta:1.0")) asCompatibleSubstituteFor "docker.elastic.co/elasticsearch/elasticsearch"))
+(def image (. (. DockerImageName (parse "190073735177.dkr.ecr.eu-west-1.amazonaws.com/utility/elasticsearch-kouta:7.16.3")) asCompatibleSubstituteFor "docker.elastic.co/elasticsearch/elasticsearch"))
 (def elastic (delay (new ElasticsearchContainer image)))

 (defn stop-elasticsearch []
@@ -42,4 +42,4 @@
       (let [result (apply f nss)]
         (when (and embedded-elasticsearch? (not (:dont-stop-elasticsearch args))) (stop-elasticsearch))
         result)))
-  (add-hook #'clojure.test/run-tests #'run-tests-hook))+  (add-hook #'clojure.test/run-tests #'run-tests-hook))


hide hidden files in project panel

hide hidden files in project panel

--- src/brevis/ui/core.clj
+++ src/brevis/ui/core.clj
@@ -145,7 +145,9 @@
   [filename]
   (if-let [tab-idx (is-open? filename)]
     (.setSelectedIndex (:tabbed-panel @editor-window) tab-idx)
-    (add-content-tab-from-filename filename @content-pane-params)))
+    (let [new-tab-idx (.getTabCount (:tabbed-panel @editor-window))]
+      (add-content-tab-from-filename filename @content-pane-params)
+      (.setSelectedIndex (:tabbed-panel @editor-window) new-tab-idx))))

 (defn a-open [e]
   (open-file (select-file)))
@@ -516,7 +518,10 @@
   (simple-tree-model
     #(.isDirectory %)
     #_(fn [f] (filter #(.isDirectory %) (.listFiles f)))
-    (fn [f] (filter #(or (.isDirectory %) (.isFile %)) (.listFiles f)))
+    (fn [f] (filter #(and (not (.isHidden %))
+                          (or (.isDirectory %)
+                              (and (.isFile %))))
+                    (.listFiles f)))
     (File. (:workspace-directory @current-profile))
     #_(File. ".")))


Minor changes in html.clj

Minor changes in html.clj

--- src/build_mon/html.clj
+++ src/build_mon/html.clj
@@ -3,13 +3,11 @@
             [clojure.string :as s]))

-(defn- now [] (java.util.Date.))
-
 (def refresh-icon [:div.refresh-icon.hidden [:i.fa.fa-refresh.fa-spin.fa-3x]])

 (def error-modal [:div.error-modal.hidden
                   [:div.error-modal-background]
-                  [:h1.error-modal-text "Project Monitor Error"]])
+                  [:h1.error-modal-text "Build Monitor Error"]])

 ;RELEASE
 (defn- generate-release-env-panels [{:keys [release-definition-name
@@ -53,18 +51,17 @@
         total-releases (count-total-releases release-info-maps)
         max-panels-per-row 4
         panel-rows (Math/ceil (/ (+ total-builds total-releases) max-panels-per-row))
-        padding 2
         panel-width 25
         panel-height (/ 100 panel-rows)]
   (hiccup/html
     [:head
-     [:title "Project Monitor"]
+     [:title "Build Monitor"]
      [:link#favicon {:rel "shortcut icon" :href favicon-path}]
      [:link {:rel "stylesheet" :href "https://fonts.googleapis.com/css?family=Open+Sans|Roboto"}]
      [:link {:rel "stylesheet" :href
                    "https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css"}]
      [:link {:rel "stylesheet ":href "/style.css" :type "text/css"}]]
-     [:style (str ".panel { width:" panel-width "%; height:" panel-height "%;}")]
+     [:style (str ".panel { width:" panel-width "%; height:" panel-height "%; }")]
     [:body
      refresh-icon
      error-modal


Logging: Implement -log/4 in terms of -log/5.

--- src/pepa/log.clj
+++ src/pepa/log.clj
@@ -36,8 +36,7 @@
          all-components (remove (set (keys logger)) (keys system))]
      (-> system
          (component/system-using (zipmap all-components (repeat [::logger])))
-         (assoc ::logger (component/using logger
-                                          [:config])))))
+         (assoc ::logger (component/using logger [:config])))))
   ([system]
    (wrap-logging system (make-ctl-logger))))

@@ -79,6 +78,6 @@
     ([logger component level throwable message]
      (clojure.tools.logging/log (component-name component) level throwable message))
     ([logger component level message]
-     (clojure.tools.logging/log (component-name component) level nil message))))
+     (-log logger component level nil message))))