CMR-1280: Updates ISO MENDS XML generation to use c.s.relations/mbr

--- umm-lib/src/cmr/umm/iso_mends/spatial.clj
+++ umm-lib/src/cmr/umm/iso_mends/spatial.clj
@@ -10,6 +10,7 @@
             [cmr.spatial.mbr :as mbr]
             [cmr.spatial.point :as p]
             [cmr.spatial.polygon :as poly]
+            [cmr.spatial.relations :as r]
             [cmr.umm.collection :as c]
             [cmr.umm.iso-mends.core :as core]
             [cmr.umm.spatial :as umm-s]))
@@ -137,30 +138,10 @@
   []
   (str "geo-" (swap! gml-id-state inc)))

-;;; Rendering the ISO MENDS MBR element for each geometry type
-
-(defmulti geometry->iso-mbr type)
-
 (defmulti geometry->iso-geom
   "Returns content of a ISO MENDS extent element for an individual UMM
   spatial coverage geometry record. Dispatches on type."
   type)
-
-(defmethod geometry->iso-mbr cmr.spatial.point.Point
-  [point]
-  (mbr/point->mbr point))
-
-(defmethod geometry->iso-mbr cmr.spatial.line_string.LineString
-  [line]
-  (ls/line-string->mbr line))
-
-(defmethod geometry->iso-mbr cmr.spatial.polygon.Polygon
-  [polygon]
-  (:mbr polygon))
-
-(defmethod geometry->iso-mbr cmr.spatial.mbr.Mbr
-  [mbr]
-  mbr)

 ;;; Rendering gmd:geographicElement content

@@ -198,7 +179,7 @@
   ;; set the coordinate system based on the spatial coverage for output
   (let [geom (d/calculate-derived (umm-s/set-coordinate-system coordinate-system geom))]
     (list
-     (x/element :gmd:geographicElement {} (geometry->iso-geom (geometry->iso-mbr geom)))
+     (x/element :gmd:geographicElement {} (geometry->iso-geom (r/mbr geom)))
      (x/element :gmd:geographicElement {} (geometry->iso-geom geom)))))

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


CMR-1308 Adds comment clarifying ISO MENDS MBR interleaving

--- umm-lib/src/cmr/umm/iso_mends/spatial.clj
+++ umm-lib/src/cmr/umm/iso_mends/spatial.clj
@@ -70,5 +70,6 @@
   (->> geometries
        (map (partial umm-s/set-coordinate-system spatial-representation))
        (map d/calculate-derived)
+       ;; ISO MENDS interleaves MBRs and actual spatial areas
        (mapcat (juxt r/mbr identity))
        (map gmd/encode)))


Adding back gzip file hack

Adding back gzip file hack


minor

minor

--- cljs-server/cljsinfo_server/pages/cheatsheet.cljs
+++ cljs-server/cljsinfo_server/pages/cheatsheet.cljs
@@ -743,8 +743,8 @@
   [:div#tooltip-branch.tooltip-53dde {:style "display:none"}
     [:i.fa.fa-thumb-tack.pin-0ad63]
     [:p.info-2e4f9
-      "In conditional statements, everything evaluates to " [:code "true"] " except for "
-      [:code "false"] " and " [:code "nil"] "."]]
+      "In conditional statements, everything evaluates to " [:code "true"]
+      " except for " [:code "false"] " and " [:code "nil"] "."]]

   [:div#tooltip-numbers.tooltip-53dde {:style "display:none"}
     [:i.fa.fa-thumb-tack.pin-0ad63]


Add ui to select scheme

Add ui to select scheme

--- frontend/src/cruncher/rename.cljs
+++ frontend/src/cruncher/rename.cljs
@@ -1,15 +1,32 @@
- (ns cruncher.rename
-   (:require [om.next :as om :refer-macros [defui]]
-             [om.dom :as dom :include-macros true]
-             [goog.dom :as gdom]
-             [cruncher.utils.views :as vlib]
-             [cruncher.utils.lib :as lib]))
+(ns cruncher.rename
+  (:require [om.next :as om :refer-macros [defui]]
+            [om.dom :as dom :include-macros true]
+            [goog.dom :as gdom]
+            [cruncher.utils.views :as vlib]
+            [cruncher.utils.lib :as lib]))

+(defui SelectSchemes
+  Object
+  (render [this]
+    (let [selected (or (om/get-state this :selected) "rename-scheme-1")]
+      (dom/div nil
+               (dom/div #js {:className "form-group"}
+                        (dom/select #js {:className "form-control"
+                                         :onChange  #(println "click")
+                                         :value     selected}
+                                    (dom/option #js {:value "rename-scheme-1"} "IV% AT/DF/ST")
+                                    (dom/option #js {:value "rename-scheme-2"} "AT/DF/ST")
+                                    (dom/option #js {:value "rename-scheme-3"} "IV%")))
+               (dom/div #js {:className "form-group"})))))
+(def select-schemes (om/factory SelectSchemes {}))

 (defui RenamingControls
-       Object
-       (render [this]
-               (dom/div nil
-                        (dom/p #js {:className "lead"} "Rename Pokemon")
-                        "hm?")))
+  Object
+  (render [this]
+    (dom/div nil
+             (dom/p #js {:className "lead"} "Renaming")
+             (dom/label #js {:className "control-label"} "Renames selected Pokemon. Not reversible.")
+             (dom/div #js {:className "row"}
+                      (dom/div #js {:className "col-md-3"}
+                               (select-schemes (om/props this)))))))
 (def controls (om/factory RenamingControls))


no longer expose tag as class name in form component

--- cljs/src/main/plastic/main/editor/render/form.cljs
+++ cljs/src/main/plastic/main/editor/render/form.cljs
@@ -28,20 +28,20 @@
   (let [root-id (id/make form-id :root)
         focused? (subscribe [:editor-focused-form-node editor-id form-id])
         layout (subscribe [:editor-layout-form-node editor-id form-id root-id])
-        selection-subscription (subscribe [:editor-selection-node editor-id root-id])]
+        selected? (subscribe [:editor-selection-node editor-id root-id])]
     (fn [editor-id form-id]
       (log-render "form" form-id
-        (let [{:keys [tag selectable? sections form-kind]} @layout
+        (let [selected? @selected?
+              {:keys [selectable? sections form-kind]} @layout
               {:keys [headers docs code comments]} sections]
           [:div.form
            {:data-pnid form-id
             :class     (classv
-                         (name tag)
                          (str "form-kind-" (name form-kind))
                          (if @focused? "focused")
                          (sections-to-class-names sections)
                          (if selectable? "selectable")
-                         (if (and selectable? @selection-subscription) "selected"))
+                         (if (and selectable? selected?) "selected"))
             :on-click  (partial handle-form-click form-id)}
            (if headers
              [headers-section-component editor-id form-id headers])


removed unused event init-page-event-handler

--- src/penjat/views.cljs
+++ src/penjat/views.cljs
@@ -73,7 +73,6 @@
   []
   (fn start-page-render
     []
-    (dispatch [:init-event-handlers-by-page :start])
     [choose-word-input {:class "new-todo"
                         :placeholder ""
                         :on-save #(dispatch [:set-word %])}]))
@@ -83,7 +82,6 @@
   (let [misses (subscribe [:misses])]
     (fn play-page-render
       []
-      (dispatch [:init-event-handlers-by-page :play])
       [:div
        [guessed-letters]
        [gallow]
@@ -96,7 +94,6 @@
         guesses (subscribe [:guesses])]
       (fn end-page-render
         []
-        (dispatch [:init-event-handlers-by-page :end])
         [:div
          [:div (if (win-game? @word @guesses)
                  "HAS GUANYAT :D !!!!"


Catching exception for empty file on lazy stream

--- src/photon/filedb.clj
+++ src/photon/filedb.clj
@@ -38,13 +38,16 @@
                    (db/lazy-events this "__all__" 0))))
   (db/lazy-events [this stream-name date]
     (log/info "Retrieving events from" stream-name)
-    (with-open [rdr (clojure.java.io/reader file-name)]
-      (filter (fn [ev]
-                (and
-                  (or (= "__all__" stream-name)
-                      (= :__all__ stream-name)
-                      (= stream-name (:stream-name ev)))
-                  (<= date (:server-timestamp ev))))
-              (map #(json/read-str % :key-fn keyword) (doall (line-seq rdr))))))
+    (try
+      (with-open [rdr (clojure.java.io/reader file-name)]
+        (filter (fn [ev]
+                  (and
+                    (or (= "__all__" stream-name)
+                        (= :__all__ stream-name)
+                        (= stream-name (:stream-name ev)))
+                    (<= date (:server-timestamp ev))))
+                (map #(json/read-str % :key-fn keyword) (doall (line-seq rdr)))))
+      (catch java.io.IOException e
+        '())))
   (db/lazy-events-page [this stream-name date page] []))


adding an example of mapping a control bus onto synth params

--- examples/demand.clj
+++ examples/demand.clj
@@ -14,6 +14,7 @@
             note-gen (demand:kr trig 0 freqs)
             src (sin-osc note-gen)]
         (* [0.1 0.1] src)))
+

 ; Randomize the sequence of notes
 (demo 2
@@ -66,6 +67,23 @@
 (buffer-set! buf 3 80)
 (buffer-set! buf 7 20)
 (stop)
+
+; This is an example of mapping a note generating synth (demand rate)
+; outputting on a control bus onto the control of another synth.
+(defsynth note-generator []
+  (let [trig (impulse:kr 8)
+        freqs (dseq [440 880 220] INF)
+        note-gen (demand:kr trig 0 freqs)]
+    (out:kr 0 note-gen)))
+
+(defsynth beep [note 660]
+  (let [src (sin-osc note)]
+    (out 0 (* [0.2 0.2] src))))
+
+;(def generator-node (note-generator))
+;(def beep-node (beep))
+;(node-map-controls beep-node 0 0)
+;(stop)

 (demo 4
       (let [freq (duty (drand [0.2 0.4 0.8 0.6] INF)


[#11599] Smaller kk dev menu items

[#11599] Smaller kk dev menu items

Signed-off-by: Churikova Tetiana <df59d4ef10565572befc1f25db27f19bd387b29a@gmail.com>

--- src/status_im/keycard/test_menu.cljs
+++ src/status_im/keycard/test_menu.cljs
@@ -4,12 +4,13 @@

 (defn button [label accessibility-label handler]
   [react/view
-   {:style {:width           50
+   {:style {:width           20
             :height          30
             :justify-content :center
             :align-items     :center}}
    [react/text
     {:on-press            handler
+     :style               {:font-size 8}
      :accessibility-label accessibility-label}
     label]])


Adj client db is cleared when new activity is selected

--- src/tango/cljs/adjudicator/core.cljs
+++ src/tango/cljs/adjudicator/core.cljs
@@ -143,11 +143,22 @@
       (log (str "Socket Payload: " payload))
       (cond
         (= payload 'app/select-activity)
-        (om/transact! reconciler `[(app/selected-activity-status {:status :out-of-sync})
-                                   (app/status {:status :judging})
-                                   :app/status
-                                   :app/selected-activity
-                                   :app/results])
+        (do
+          (log "Pre Reset")
+          (d/reset-conn! conn (d/init-db #{} (merge adjudicator-ui-schema uidb/schema)))
+          (d/transact! conn [{:db/id -1 :app/id 1}
+                             {:db/id -1 :app/online? false}
+                             {:db/id -1 :app/status :judging}
+                             {:db/id -1 :app/selected-activity-status :in-sync}
+                             {:db/id -1 :app/heat-page 0}
+                             {:db/id -1 :app/heat-page-size 2}
+                             {:db/id -1 :app/admin-mode false}])
+          (log "Pos Reset")
+          (om/transact! reconciler `[(app/selected-activity-status {:status :out-of-sync})
+                                     (app/status {:status :judging})
+                                     :app/status
+                                     :app/selected-activity
+                                     :app/results]))

         (= payload 'app/confirm-marks)
         (om/transact! reconciler `[(app/status {:status :confirmed})])))))


Stop using internally a deprecated function

--- src/promesa/exec.cljc
+++ src/promesa/exec.cljc
@@ -33,7 +33,7 @@

 ;; --- Globals & Defaults (with CLJS Impl)

-#?(:clj (declare scheduled-pool)
+#?(:clj (declare scheduled-executor)
    :cljs (declare ->ScheduledExecutor))

 #?(:clj (declare cached-executor)
@@ -42,7 +42,7 @@
 (declare ->SameThreadExecutor)

 (defonce ^:dynamic *default-scheduler*
-  (delay #?(:clj (scheduled-pool)
+  (delay #?(:clj (scheduled-executor)
             :cljs (->ScheduledExecutor))))

 (defonce ^:dynamic *default-executor*


Implemented the following API call: delete job

--- src/emender_jenkins/rest_api.clj
+++ src/emender_jenkins/rest_api.clj
@@ -74,6 +74,11 @@
                         :type    "Warning"}]
         (send-response response))))

+(defn reload-job-list
+    [previous-response request]
+    (results/reload-all-results (:configuration request))
+    previous-response)
+
 (defn reload-all-results
     [request]
     (results/reload-all-results (:configuration request))
@@ -83,12 +88,6 @@
 (defn create-job
     [request]
     )
-
-(defn delete-job
-    [request]
-    (let [job-name (get-job-name-from-body request)]
-         (println job-name)
-    ))

 (defn job-does-not-exist-response
     [job-name command]
@@ -128,6 +127,18 @@
                                          job-name)
                 send-response)
             (-> (job-does-not-exist-response job-name "enable")
+                send-response))))
+
+(defn delete-job
+    [request]
+    (let [job-name (get-job-name-from-body request)]
+        (if (results/job-exists? job-name)
+            (-> (jenkins-api/delete-job (config/get-jenkins-url request)
+                                        (config/get-jenkins-auth request)
+                                        job-name)
+                (reload-job-list request)
+                send-response)
+            (-> (job-does-not-exist-response job-name "delete")
                 send-response))))

 (defn uri->job-name


Add merge-options and with-options helpers.

--- src/puget/printer.clj
+++ src/puget/printer.clj
@@ -58,17 +58,36 @@
     :class-name      [:bold :blue]}})

+(defn merge-options
+  "Merges a map of options into the current option map, taking care to combine
+  the color scheme correctly."
+  [opts]
+  (let [colors (merge (:color-scheme *options*)
+                      (:color-scheme opts))]
+    (-> *options*
+        (merge opts)
+        (assoc :color-scheme colors))))
+
+
+(defmacro with-options
+  "Executes the given expressions with a set of options merged into the current
+  option map."
+  [opts & body]
+  `(binding [*options* (merge-options ~opts)]
+     ~@body))
+
+
 (defmacro with-color
   "Executes the given expressions with colored output enabled."
   [& body]
-  `(binding [*options* (assoc *options* :print-color true)]
+  `(with-options {:print-color true}
      ~@body))

 (defmacro with-strict-mode
   "Executes the given expressions with strict mode enabled."
   [& body]
-  `(binding [*options* (assoc *options* :strict true)]
+  `(with-options {:strict true}
      ~@body))


refine delete transaction test

refine delete transaction test

--- test/clj_money/models/transactions_test.clj
+++ test/clj_money/models/transactions_test.clj
@@ -367,19 +367,27 @@
                                                 second
                                                 :id))
         checking-items-after (transactions/items-by-account storage-spec
-                                                             (:id checking))
-        expected-before [{:index 2 :amount (bigdec  102) :balance (bigdec  797)}
-                         {:index 1 :amount (bigdec  101) :balance (bigdec  899)}
-                         {:index 0 :amount (bigdec 1000) :balance (bigdec 1000)}]
-        actual-before (map #(select-keys % [:index :amount :balance])
-                           checking-items-before)
-        expected-after[{:index 1 :amount (bigdec  102) :balance (bigdec  898)}
-                       {:index 0 :amount (bigdec 1000) :balance (bigdec 1000)}]
-        actual-after (map #(select-keys % [:index :amount :balance]) checking-items-after)]
-    (is (= expected-before actual-before)
-        "Checking should have the correct items before delete")
-    (is (= expected-after actual-after)
-        "Checking should have the correct items after delete")))
+                                                             (:id checking))]
+    (testing "transaction item balances are adjusted"
+      (let [expected-before [{:index 2 :amount (bigdec  102) :balance (bigdec  797)}
+                             {:index 1 :amount (bigdec  101) :balance (bigdec  899)}
+                             {:index 0 :amount (bigdec 1000) :balance (bigdec 1000)}]
+            actual-before (map #(select-keys % [:index :amount :balance])
+                               checking-items-before)
+            expected-after[{:index 1 :amount (bigdec  102) :balance (bigdec  898)}
+                           {:index 0 :amount (bigdec 1000) :balance (bigdec 1000)}]
+            actual-after (map #(select-keys % [:index :amount :balance]) checking-items-after)]
+        (is (= expected-before actual-before)
+            "Checking should have the correct items before delete")
+        (is (= expected-after actual-after)
+            "Checking should have the correct items after delete")))
+    (testing "account balances are adjusted"
+      (let [checking-after (accounts/find-by-id storage-spec (:id checking))
+            groceries-after (accounts/find-by-id storage-spec (:id groceries))]
+        (is (= (bigdec 898) (:balance checking-after))
+            "Checking should have the correct balance after delete")
+        (is (= (bigdec 102) (:balance groceries-after))
+            "Groceries should have the correct balance after delete")))))

 ; update a transaction
 ; change amount


update

update

--- src/styles/core.clj
+++ src/styles/core.clj
@@ -20,14 +20,17 @@
     ;  :background-image "url('/images/backdrop.jpg')"
      :background-size "cover"
      :background-repeat "no-repeat"}
-    [:p.catch {:color "#e0c583"
+    [:p.catch {:color "#efc664"
                :letter-spacing "0.08em"}]]
-  [:.terminal {:display "inline-block"
-               :padding "1em"
-               :color "#4eb355"
-               :font-family "monospace"
-               :background-color "#282b35"}
-    [:.string {:color "#d28e5d"}]]
+  [:section
+    {:text-align "center"}
+    [:.terminal {:display "inline-block"
+                 :margin-top (em 8);
+                 :padding "1em"
+                 :color "#4eb355"
+                 :font-family "monospace"
+                 :background-color "#282b35"}
+      [:.string {:color "#d28e5d"}]]]
   [:h1
     {:font-family "sans-serif"
      :font-size (em 3.5)


points

points

--- src/scrabble/core.clj
+++ src/scrabble/core.clj
@@ -5,6 +5,26 @@
   (:gen-class))

 (def dict-file "/usr/share/dict/american-english")
+
+(def points
+  {1 [\a \e \i \o \r \s \t]
+   2 [\d \l \n \u]
+   3 [\g \h \y]
+   4 [\c \f \m \p \q]
+   5 [\k \w]
+   8 [\x]
+   10 [\j \q \z]})
+
+(def keyed-points
+  (let [subsets
+        (for [p points]
+          (let [[weight letters] p]
+            (for [l letters]
+              {l weight})))]
+    (into {} (flatten subsets))))
+
+(defn word-value [word]
+  (apply + (map (fn [v] (get keyed-points v)) word)))

 (def all-words
   (->> dict-file


add a configurable service name prefix

add a configurable service name prefix

--- core/src/gorillalabs/tesla/component/telemetry.clj
+++ core/src/gorillalabs/tesla/component/telemetry.clj
@@ -1,3 +1,13 @@
+;;; Telemetry component
+;;;
+;;; Sample configuration:
+;;;
+;;; {:telemetry {:riemann  {:host "127.0.0.2" :port 5555}
+;;;              :host     "app.eu.backend42" ;; leave out for automatic hostname detection
+;;;              :prefix   "app.backend."     ;; automatically prefix all service names
+;;;              :interval 60                 ;; seconds
+;;;              }}
+
 (ns gorillalabs.tesla.component.telemetry
   (:require [clojure.core.async :refer [<! >!! sliding-buffer chan timeout poll! close! go-loop]]
             [clojure.tools.logging :as log]
@@ -25,8 +35,15 @@
       (log/infof "Sending %d event(s) to telemetry backend..." (count events))
       (riemann/send-events client events))))

+(defn- prepare-event [telemetry event]
+  (let [prefix (:prefix (:config telemetry) "")]
+    (-> event
+      (assoc :time (now))
+      (assoc :host (:host telemetry))
+      (assoc :service (str prefix (:service event))))))
+
 (defn enqueue [telemetry event]
-  (>!! (:queue telemetry) (assoc event :time (now) :host (:host telemetry))))
+  (>!! (:queue telemetry) (prepare-event telemetry event)))

 (defn state [telemetry service state]
   (enqueue telemetry {:service service :state state}))
@@ -63,7 +80,8 @@
       (worker client queue (:interval config 30))
       {:host     (:host config (localhost))
        :r-client client
-       :queue    queue})))
+       :queue    queue
+       :config   config})))

 (defn- stop [telemetry]
   (log/info "<- stopping telemetry")


(maint) Schematize test util function

(maint) Schematize test util function

--- src/puppetlabs/trapperkeeper/services/webserver/jetty9_config.clj
+++ src/puppetlabs/trapperkeeper/services/webserver/jetty9_config.clj
@@ -276,7 +276,9 @@
      :port         (or (:port config) default-http-port)
      :request-header-max-size (or (:request-header-max-size config) default-request-header-size)}))

-(schema/defn contains-https-connector? [config]
+(schema/defn ^:always-validate
+  contains-https-connector? :- schema/Bool
+  [config :- WebserverRawConfig]
   (contains-keys? config #{:ssl-port :ssl-host}))

 (schema/defn ^:always-validate


added unit test

added unit test

--- test/clj_fuzzy/jaro_winkler_test.clj
+++ test/clj_fuzzy/jaro_winkler_test.clj
@@ -15,7 +15,9 @@
   (is (= 0.8222222222222223 (jaro "Dwayne" "Duane")))
   (is (= 0.9444444444444443 (jaro "Martha" "Marhta")))
   (is (= 0.7666666666666666 (jaro "Dixon" "Dicksonx")))
-  (is (= 0.4166666666666667 (jaro "Duane" "Freakishlylongstring"))))
+  (is (= 0.4166666666666667 (jaro "Duane" "Freakishlylongstring")))
+  (let [s1 "xxx1" s2 "y123"]
+    (is (= (jaro s1 s2) (jaro s2 s1)))))

 (deftest jaro-winkler-test
   (is (= 1.0 (jaro "Duane" "Duane")))


better command presentation in service info

--- src/cljs/swarmpit/component/service/info/settings.cljs
+++ src/cljs/swarmpit/component/service/info/settings.cljs
@@ -23,4 +23,9 @@
        (form/item "IMAGE DIGEST" image-digest))
      (form/item "MODE" (:mode service))
      (when command
-       (form/item "COMMAND" (str/join " " command)))]))+       (form/item "COMMAND" [:pre {:style {:fontSize "0.9em"
+                                           :margin 0}}
+                             (let [merged (str/join " " command)]
+                               (if (< 100 (count merged))
+                                 (str/join "\n" command)
+                                 merged))]))]))


Wrong atomic? predicate used

Wrong atomic? predicate used

primitive? is right instead.

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

--- src/conexp/contrib/dl/languages/description_graphs.clj
+++ src/conexp/contrib/dl/languages/description_graphs.clj
@@ -97,7 +97,11 @@
 		      (make-dl-definition language A (cons 'and def-A)))]
     (make-tbox language (set definitions))))

-(defn- normalize-for-goal [term goal]
+(defn- normalize-for-goal
+  "If term satisfies goal, regards it as being normalized. Otherwise
+  handles term as tbox and finally introduces a new symbol defining
+  term."
+  [term goal]
   (cond
    (goal term) [term {}]
    (tbox-target-pair? term) (let [[tbox target] (expression term),
@@ -122,7 +126,7 @@
 			   [(make-dl-expression (expression-language term)
 						(list 'exists r norm))
 			    new-defs])
-			 (normalize-for-goal term atomic?))),
+			 (normalize-for-goal term primitive?))),
 	  normalized-terms (map (fn [[A def-A]]
 				  [A (set (map normalizer def-A))])
 				tbox-map)]


-- rename gc-state reader and writer (#153)

--- waiter/src/waiter/core.clj
+++ waiter/src/waiter/core.clj
@@ -496,6 +496,14 @@
                 (discovery/register router-id curator name (str base-path "/" discovery-relative-path) {:host host :port port}))
    :gc-base-path (pc/fnk [[:settings [:zookeeper base-path gc-relative-path]]]
                    (str base-path "/" gc-relative-path))
+   :gc-state-reader-fn (pc/fnk [curator gc-base-path]
+                         (fn read-gc-state [name]
+                           (:data (curator/read-path curator (str gc-base-path "/" name)
+                                                     :nil-on-missing? true :serializer :nippy))))
+   :gc-state-writer-fn (pc/fnk [curator gc-base-path]
+                         (fn write-gc-state [name state]
+                           (curator/write-path curator (str gc-base-path "/" name) state
+                                               :serializer :nippy :create-parent-zknodes? true)))
    :kv-store (pc/fnk [[:settings [:zookeeper base-path] kv-config]
                       [:state passwords]
                       curator]
@@ -508,15 +516,7 @@
                        latch (LeaderLatch. curator leader-latch-path router-id)
                        has-leadership? #(.hasLeadership latch)]
                    (.start latch)
-                   (leader-fn-factory router-id has-leadership? discovery min-routers)))
-   :read-gc-state-fn (pc/fnk [curator gc-base-path]
-                       (fn read-gc-state [name]
-                         (:data (curator/read-path curator (str gc-base-path "/" name)
-                                                   :nil-on-missing? true :serializer :nippy))))
-   :write-gc-state-fn (pc/fnk [curator gc-base-path]
-                        (fn write-gc-state [name state]
-                          (curator/write-path curator (str gc-base-path "/" name) state
-                                              :serializer :nippy :create-parent-zknodes? true)))})
+                   (leader-fn-factory router-id has-leadership? discovery min-routers)))})

 (def routines
   {:allowed-to-manage-service?-fn (pc/fnk [[:curator kv-store]
@@ -779,12 +779,12 @@
                                                       scheduler-state-chan router-chan router-id exit-chan service-id->service-description-fn deployment-error-config)]
                                 {:exit-chan exit-chan
                                  :maintainer-chans maintainer-chan}))
-   :scheduler-broken-services-gc (pc/fnk [[:curator leader?-fn read-gc-state-fn write-gc-state-fn]
+   :scheduler-broken-services-gc (pc/fnk [[:curator gc-state-reader-fn gc-state-writer-fn leader?-fn]
                                           [:settings scheduler-gc-config]
                                           [:state clock scheduler]
                                           scheduler-maintainer]
                                    (let [scheduler-state-chan (async/tap (:scheduler-state-mult-chan scheduler-maintainer) (au/latest-chan))
-                                         service-gc-go-routine (partial service-gc-go-routine read-gc-state-fn write-gc-state-fn leader?-fn clock)]
+                                         service-gc-go-routine (partial service-gc-go-routine gc-state-reader-fn gc-state-writer-fn leader?-fn clock)]
                                      (scheduler/scheduler-broken-services-gc scheduler scheduler-state-chan scheduler-gc-config service-gc-go-routine)))
    :scheduler-maintainer (pc/fnk [[:routines service-id->service-description-fn]
                                   [:settings [:health-check-config health-check-timeout-ms failed-check-threshold] scheduler-syncer-interval-secs]
@@ -797,14 +797,14 @@
                                       scheduler scheduler-state-chan scheduler-syncer-interval-secs
                                       service-id->service-description-fn scheduler/available? http-client failed-check-threshold)
                                :scheduler-state-mult-chan scheduler-state-mult-chan)))
-   :scheduler-services-gc (pc/fnk [[:curator leader?-fn read-gc-state-fn write-gc-state-fn]
+   :scheduler-services-gc (pc/fnk [[:curator gc-state-reader-fn gc-state-writer-fn leader?-fn]
                                    [:routines router-metrics-helpers service-id->service-description-fn]
                                    [:settings scheduler-gc-config]
                                    [:state clock scheduler]
                                    scheduler-maintainer]
                             (let [scheduler-state-chan (async/tap (:scheduler-state-mult-chan scheduler-maintainer) (au/latest-chan))
                                   {:keys [service-id->metrics-fn]} router-metrics-helpers
-                                  service-gc-go-routine (partial service-gc-go-routine read-gc-state-fn write-gc-state-fn leader?-fn clock)]
+                                  service-gc-go-routine (partial service-gc-go-routine gc-state-reader-fn gc-state-writer-fn leader?-fn clock)]
                               (scheduler/scheduler-services-gc
                                 scheduler scheduler-state-chan service-id->metrics-fn scheduler-gc-config service-gc-go-routine service-id->service-description-fn)))
    :service-chan-maintainer (pc/fnk [[:routines start-work-stealing-balancer-fn stop-work-stealing-balancer-fn]


better

better

--- exercism/clojure/grade-school/src/grade_school.clj
+++ exercism/clojure/grade-school/src/grade_school.clj
@@ -4,7 +4,7 @@
   (update db g #(vec (conj % s))))

 (defn grade [db g]
-  (get db g []))
+  (db g []))

 (defn sorted [db]
   (into (sorted-map) (for [[g ss] db] [g (sort ss)])))


fix a missing space in figurehead.ui launching command

--- guest-side-tools/tbnl.figurehead/src/clojure/figurehead/ui/helper/widgets.clj
+++ guest-side-tools/tbnl.figurehead/src/clojure/figurehead/ui/helper/widgets.clj
@@ -197,7 +197,7 @@
              (str "--mastermind-address " mastermind-address)))
     (when mastermind-port
       (swap! args conj
-             (str "--mastermind-port" mastermind-port)))
+             (str "--mastermind-port " mastermind-port)))
     @args))

 (def ^:private saved-widget-state


fixed #46

fixed #46

--- src/server/rooms.cljs
+++ src/server/rooms.cljs
@@ -140,7 +140,7 @@
       (callback))))

 (defn set-current-track-position [room position callback]
-  (let [writer (transit/writer :json)
+  (let [writer (transit/writer :json-verbose)
         track-position-info {:position position
                              :start-time (.now js/Date)}]
   (.set redis-client (redis-room-prefix room "track-position")
@@ -149,13 +149,13 @@
       (callback track-position-info)))))

 (defn get-current-track-position [room callback]
- (let [reader (transit/reader :json)]
+ (let [reader (transit/reader :json-verbose)]
    (.get redis-client (redis-room-prefix room "track-position")
      (fn [err reply]
        (callback (transit/read reader reply))))))

 (defn pause-current-track [room position callback]
-  (let [writer (transit/writer :json)]
+  (let [writer (transit/writer :json-verbose)]
     (.set redis-client (redis-room-prefix room "track-position")
                        (transit/write writer {:position position
                                               :start-time (.now js/Date)})
@@ -165,12 +165,12 @@
             (callback)))))))

 (defn resume-current-track [room callback]
-  (let [reader (transit/reader :json)]
+  (let [reader (transit/reader :json-verbose)]
     (.get redis-client (redis-room-prefix room "track-position")
       (fn [err reply]
         (let [old-track-position-info (transit/read reader reply)
               new-track-position-info (merge old-track-position-info {:start-time (.now js/Date)})
-              writer (transit/writer :json)]
+              writer (transit/writer :json-verbose)]
           (.set redis-client (redis-room-prefix room "track-position")
                              (transit/write writer new-track-position-info)
             (fn []
@@ -199,7 +199,7 @@

 (defn change-current-track-position [room position callback]
   (letfn [(change-pos []
-            (let [writer (transit/writer :json)]
+            (let [writer (transit/writer :json-verbose)]
               (.set redis-client (redis-room-prefix room "track-position")
                                  (transit/write writer {:position position
                                                         :start-time (.now js/Date)})
@@ -257,7 +257,7 @@
                             (fn []
                               (.get redis-client (str "file-hash:" file-hash)
                                 (fn [err music-info-reply]
-                                  (let [reader (transit/reader :json)
+                                  (let [reader (transit/reader :json-verbose)
                                         music-info-json (transit/read reader music-info-reply)
                                         music-info (js->clj music-info-json)]
                                     (callback music-info)))))))))))))))))))
@@ -358,7 +358,7 @@
   ((.scriptWrap redis-lua "getAllMusicInfo") 0 room-id
     (fn [err music-info-reply]
       (let [info (js->clj music-info-reply)
-            reader (transit/reader :json)
+            reader (transit/reader :json-verbose)
             info-to-send (map #(transit/read reader %1) info)]
         (if (empty? info-to-send)
           (callback nil nil)
@@ -446,9 +446,7 @@
     0 room track-num sound-id
     (fn [err reply]
       (if-not (nil? reply)
-        (set-current-track-position room 0
-          (fn []
-            (callback reply)))))))
+        (callback reply)))))

 (defn mute-user [socket-id callback]
   (.set redis-client (str "users:" socket-id ":muted?") "true"


Now the query can handle <-

Now the query can handle <-

--- src/main/clojure/clara/rules.clj
+++ src/main/clojure/clara/rules.clj
@@ -153,7 +153,7 @@
    (sequential? head) (conj (parse-query-body more) head)

    ;; Handle the <- style assignment
-   (symbol? head) (conj (parse-query-body (drop 2 more)) head)))
+   (symbol? head) (conj (parse-query-body (drop 2 more)) (conj head (take 2 more)))))

 ;; Treate a symbol as a rule source, loding all items in its namespace.
 (extend-type clojure.lang.Symbol


No need for default mime-types

No need for default mime-types

This fixes an issue where some files are being returned as application/octet-stream

--- src/yada/schema.clj
+++ src/yada/schema.clj
@@ -224,8 +224,8 @@
   (as-method-map [o] {:response o
                       :produces "text/plain"})
   Object
-  (as-method-map [o] {:response o
-                      :produces "application/octet-stream"})
+  (as-method-map [o] {:response o})
+
   nil
   (as-method-map [o] {:response nil}))


Removed reflaction warnings

Removed reflaction warnings

--- src/yaml/writer.clj
+++ src/yaml/writer.clj
@@ -43,11 +43,13 @@
   flatland.ordered.set.OrderedSet
   (encode [data]
     (java.util.LinkedHashSet.
+     ^flatland.ordered.set.OrderedSet
      (into (ordered-set)
            (map encode data))))
   flatland.ordered.map.OrderedMap
   (encode [data]
     (java.util.LinkedHashMap.
+     ^flatland.ordered.map.OrderedMap
      (into (ordered-map)
            (for [[k v] data]
              [(encode k) (encode v)]))))


added test for blocks

added test for blocks

--- test/stencil/test/core.clj
+++ test/stencil/test/core.clj
@@ -1,6 +1,7 @@
 (ns stencil.test.core
   (:use clojure.test
-        stencil.core))
+        stencil.core
+        stencil.parser))

 ;; Test case to make sure we don't get a regression on inverted sections with
 ;; list values for a name.
@@ -10,3 +11,11 @@
          (render-string "{{^a}}a{{b}}a{{/a}}" {:a [:b "11"]})))
   (is (= ""
          (render-string "{{^a}}a{{b}}a{{/a}}" {"a" ["b" "11"]}))))
+
+
+(def base "x{{%yellow}}{{/yellow}}z")
+
+(deftest block-test
+  (register-template "base" base)
+  (is (= "xyz"
+         (render-string "{{< base}}{{%yellow}}{{yyy}}{{/yellow}}" {:yyy "y"}))))


fixed merge-contexts when context-stack does not contain maps

--- src/stencil/utils.clj
+++ src/stencil/utils.clj
@@ -41,7 +41,7 @@
 (defn merge-contexts
   [context]
   (let [top (first context)
-        stack (rest context)
+        stack (filter map? (rest context))
         fused (apply merge (reverse stack))]
     (if (map? top)
       (merge fused top)


Implements opposite of dsl/exists

Implements opposite of dsl/exists

--- src/suricatta/dsl.clj
+++ src/suricatta/dsl.clj
@@ -486,6 +486,12 @@
   (defer
     (DSL/exists @q)))

+(defn not-exists
+  "Create an exists condition."
+  [q]
+  (defer
+    (DSL/notExists @q)))
+
 (defn group-by
   [q & fields]
   (defer


Rename some functions

Rename some functions

--- src/tick/interval.clj
+++ src/tick/interval.clj
@@ -238,26 +238,26 @@

 ;; Operations on relations

-(defn complement-relation
+(defn complement-r
   "Return the complement of the general relation. The complement ~r of
   a relation r is the relation consisting of all basic relations not
   in r."
   [^GeneralRelation r]
   (assoc r :relations (remove (set (:relations r)) basic-relations)))

-(defn compose-relation
+(defn compose-r
   "Return the composition of r and s"
   [r s]
   (throw (new UnsupportedOperationException "Not yet implemented")))

-(defn converse-relation
+(defn converse-r
   "Return the converse of the given general relation. The converse !r
   of a relation r is the relation consisting of the converses of all
   basic relations in r."
   [^GeneralRelation r]
   (assoc r :relations (map conv (:relations r))))

-(defn intersection-relation
+(defn intersection-r
   "Return the intersection of the r with s"
   [^GeneralRelation r ^GeneralRelation s]
   (s/assert r #(instance? GeneralRelation %))
@@ -267,7 +267,7 @@
 ;; Useful relations

 (def disjoint? (make-relation precedes? preceded-by? meets? met-by?))
-(def concur? (complement-relation disjoint?))
+(def concur? (complement-r disjoint?))

 ;; Functions that make use of Allens' Interval Algebra


Revert some changes.

Revert some changes.

--- src/uxbox/shapes.cljs
+++ src/uxbox/shapes.cljs
@@ -176,9 +176,7 @@
         x' (apply max (map (fn [{:keys [x width]}] (+ x width)) shapes))
         y' (apply max (map (fn [{:keys [y height]}] (+ y height)) shapes))
         width (- x' x)
-        height (- y' y)
-        x (+ dx x)
-        y (+ dy y)]
+        height (- y' y)]
     (as-> shape $
       (merge $ {:width width :height height :x x :y y})
       (container-rect $))))


Basic render-client-cmds ported to world-store from world-fence.

--- src/cbfg/world-store.cljs
+++ src/cbfg/world-store.cljs
@@ -5,7 +5,41 @@
             [cbfg.fence :refer [make-fenced-pump]]
             [cbfg.store :as store]
             [cbfg.store-test]
-            [cbfg.vis :refer [vis-init listen-el get-el-value log-el]]))
+            [cbfg.vis :refer [vis-init listen-el
+                              get-el-value set-el-innerHTML log-el]]))
+
+(defn filter-r [r] (if (map? r)
+                     (-> r
+                         (dissoc :opaque)
+                         (dissoc :op)
+                         (dissoc :fence))
+                     r))
+
+(defn render-client-cmds [client-cmds]
+  (set-el-innerHTML "client"
+                    (apply str
+                           (flatten ["
"
+                                     "
id	fence	op	"
+                                     "    args	responses
"
+                                     (map (fn [[opaque [request responses]]]
+                                            ["
"
+                                             " " opaque "	"
+                                             " " (:fence request) "	"
+                                             " " (:op request) "	"
+                                             " " (filter-r request) "	"
+                                             "
"
+                                             (map (fn [[out-time response]]
+                                                    ["
"
+                                                     (filter-r response)
+                                                     "
"])
+                                                  (reverse responses))
+                                             "
	"
+                                             "
"])
+                                          (sort #(compare (first %1) (first %2))
+                                                client-cmds))
+                                     "
"]))))

 (defn make-store-cmd-handlers [store]
   {"get"
@@ -74,10 +108,15 @@
                                                  cmd3 (reduce #(assoc %1 (keyword %2)
                                                                       (get-el-value (str op "-" %2)))
                                                               cmd2 params)]
+                                             (render-client-cmds (swap! client-cmds
+                                                                        #(assoc % num-ins [cmd3 nil])))
                                              (log-el el-prefix "input" (str num-ins ": " cmd3))
                                              (aput client in-ch (handler cmd3))
                                              (recur (inc num-ins) num-outs))
                              (= ch out-ch) (let [result v]
+                                             (render-client-cmds (swap! client-cmds
+                                                                        #(update-in % [(:opaque v) 1]
+                                                                                conj [num-outs v])))
                                              (log-el el-prefix "output" (str num-outs ": " result))
                                              (recur num-ins (inc num-outs))))))
                 (make-fenced-pump world in-ch out-ch @store-max-inflight)))


Return the result after waiting

Return the result after waiting

--- src/circle/util/retry.clj
+++ src/circle/util/retry.clj
@@ -1,5 +1,4 @@
 (ns circle.util.retry
-  (:use [arohner.utils :only (inspect)])
   (:use [circle.util.except :only (throw-if-not)])
   (:use [robert.bruce :only (try-try-again)]))

@@ -29,5 +28,6 @@
               (let [result (apply f args)]
                 (if success
                   (throw-if-not (success result) "(success) did not return truthy in time")
-                  (throw-if-not result "f did not return truthy in time"))))]
+                  (throw-if-not result "f did not return truthy in time"))
+                result))]
       (try-try-again options f))))


improve invalid resource api message

improve invalid resource api message

--- src/clj/clj_money/api.clj
+++ src/clj/clj_money/api.clj
@@ -2,6 +2,7 @@
   (:refer-clojure :exclude [update])
   (:require [clojure.tools.logging :as log]
             [clojure.pprint :refer [pprint]]
+            [clojure.string :as string]
             [ring.util.response :refer [status response header]]
             [environ.core :refer [env]]
             [cheshire.core :as json]
@@ -39,6 +40,10 @@
                 (env :db)
                 (apply-scope params resource-type))))

+(defn- extract-validation-messages
+  [model]
+  {:message (str "The resource is not valid. " (validation/error-messages model))})
+
 (defn create-resource
   [resource-type params create-fn]
   (let [resource (-> params
@@ -46,7 +51,7 @@
                      (authorize :create))
         result (create-fn (env :db) resource)]
     (if (validation/has-error? result)
-      (status (->response result) 422)
+      (status (->response (extract-validation-messages result)) 422)
       (status (->response result) 201))))

 (defn update-resource


fix ambiguity problem with account lookup

--- src/clj_money/trading.clj
+++ src/clj_money/trading.clj
@@ -488,11 +488,12 @@
       validated)))

 (defn- append-commodity-account
-  [{:keys [storage commodity] :as context}]
+  [{:keys [storage commodity account-id] :as context}]
   (assoc context
          :commodity-account
          (accounts/find-by storage {:commodity-id (:id commodity)
-                                    :entity-id (:entity-id commodity)})))
+                                    :entity-id (:entity-id commodity)
+                                    :parent-id account-id})))

 (defn- apply-split-to-lot
   [storage ratio lot]


use the correct macro table when reading lists, #30

--- src/cljs/cljs/reader.cljs
+++ src/cljs/cljs/reader.cljs
@@ -160,7 +160,7 @@
       (when-not ch (throw "EOF"))
       (if (= delim ch)
         a
-        (if-let [macrofn (get dispatch-macros ch)]
+        (if-let [macrofn (get macros ch)]
           (let [mret (macrofn rdr ch)]
             (recur (if (= mret rdr) a (conj a mret))))
           (do


Shorten up best-ordering

Shorten up best-ordering

--- src/cljs/fatlip/core.cljs
+++ src/cljs/fatlip/core.cljs
@@ -636,8 +636,9 @@
 (defn best-ordering
   "Chooses the graph with the fewest crossings from a collection of OrderedGraphs"
   [ordered-graphs]
-  (let [cm-graphs (map OrderedGraph->CountedAndMarkedGraph ordered-graphs)]
-    (first (sort-by #(-> [(:crossings %) (count (:marked %))]) cm-graphs))))
+  (->> (map OrderedGraph->CountedAndMarkedGraph ordered-graphs)
+       (sort-by #(-> [(:crossings %) (count (:marked %))]))
+       first))

 (defn neighborify


updating working example for updates and aggregations

--- src/cljs/hello2/core.cljs
+++ src/cljs/hello2/core.cljs
@@ -35,36 +35,31 @@
   (render [this]
           (let [{:keys [count id] :as props} (om/props this)]
             (dom/div nil
-                     (println props)
                      (dom/span nil (str "Count: " count " id: " id))
                      (dom/button
                       #js {:onClick
-                           (fn [e] (om/transact! this '[(counter/increment ~props)]))}
+                           (fn [e] (om/transact! this `[(counter/increment ~props) :counters]))}
                       "Click me!")))))
 (def counter-view (om/factory Counter {:keyfn :id}))

-(defui ListView
-  Object
-  (render [this]
-    (println "Render ListView" (-> this om/path first))
-    (let [list (om/props this)]
-      (apply dom/ul nil
-        (map counter-view list)))))
-(def list-view (om/factory ListView))
-
-(defui Thing
+(defui MyRoot
   static om/IQuery
   (query [this]
          (let [subquery (om/get-query Counter)]
-           `[{:counters ~subquery}]))
+           [{:counters subquery}]))
   Object
   (render [this]
           (println "root" (om/props this))
           (let [{:keys [counters]} (om/props this)]
-            (println counters)
-            (dom/div nil "hi")
             (dom/div nil
-                     (list-view counters)))))
+                     (str
+                      "total: "
+                      (->> counters
+                           (map :count)
+                           (reduce +)))
+                     (dom/div nil "hi")
+                     (dom/div nil
+                              (map counter-view counters))))))

 (def reconciler
   (om/reconciler
@@ -72,4 +67,4 @@
      :parser (om/parser {:read read :mutate mutate})}))

 (om/add-root! reconciler
-  Thing (gdom/getElement "app"))
+  MyRoot (gdom/getElement "app"))


Added additional optional parameters to make-gif

--- src/clojure/gift/core.clj
+++ src/clojure/gift/core.clj
@@ -14,20 +14,30 @@
 Usage: (make-gif \"move.gif\" [\"person1.jpg\" \"person2.jpg\"])

 Additional properties:\n
-  :delay - time in milliseconds between frames (default 200)
+  :delay      - time in milliseconds between frames (default 200)
+  :iterations - number of iterations (0 is for infinity)
+  :quality    - quality of color quantization (should be > 0)
+  :width      - width of resulting gif (if not provided the size of first frame is used)
+  :height     - height of resulting gif (if not provided the size of first frame is used)

 "
   [output-path images
-   & {:keys [delay]
-      :or {delay 200}}]
-  (let [encoder (-> (doto (gift.AnimatedGifEncoder. )
-                      (.start output-path)
-                      (.setRepeat 0)
-                      (.setDelay delay) ;; milliseconds
-                      ))]
+   & {:keys [delay
+             iterations
+             quality
+             width
+             height]
+      :or {delay 200
+           iterations 0
+           quality 10}}]
+  (let [encoder (doto (gift.AnimatedGifEncoder.)
+                  (.start output-path)
+                  (.setRepeat iterations)
+                  (.setQuality quality) ;; less is better
+                  (.setDelay delay) ;; milliseconds
+                  )]
+    (when (and width height)
+      (.setSize encoder width height))
     (doseq [i images]
       (.addFrame encoder (read-image i)))
     (.finish encoder)))
-
-;; TODO iterations does not work?
-;; TODO gif quality


running api added

running api added

--- src/webdriver/new.clj
+++ src/webdriver/new.clj
@@ -634,6 +634,16 @@
 ;;
 ;; predicates
 ;;
+
+(defn running? [driver]
+  (with-exception Throwable false
+    (let [{:keys [host port]} @driver
+          socket (java.net.Socket. host port)]
+      (if (.isConnected socket)
+        (do
+          (.close socket)
+          true)
+        false))))

 (defn driver? [driver type]
   (= (dispatch-driver driver) type))
@@ -759,6 +769,9 @@
 (defn wait-has-class [driver q class & [opt]]
   (wait-predicate #(has-class? driver q class) opt))

+(defn wait-running [driver & [opt]]
+  (wait-predicate #(running? driver) opt))
+
 ;;
 ;; touch
 ;;
@@ -942,7 +955,7 @@
     driver))

 (defn connect-driver [driver & [opt]]
-  (wait 2)
+  (wait-running driver)
   (let [session (create-session driver)]
     (swap! driver assoc :session session)
     driver))


test if window exists in :npm-module

test if window exists in :npm-module

fixes #187

--- src/main/shadow/build/output.clj
+++ src/main/shadow/build/output.clj
@@ -530,7 +530,7 @@
 (defn js-module-env
   [state {:keys [runtime] :or {runtime :node} :as config}]
   (str "var $CLJS = {};\n"
-       "var CLJS_GLOBAL = process.browser ? window : global;\n"
+       "var CLJS_GLOBAL = process.browser ? (typeof(window) != 'undefined' ? window : self) : global;\n"
        ;; closure accesses these defines via goog.global.CLOSURE_DEFINES
        "var CLOSURE_DEFINES = $CLJS.CLOSURE_DEFINES = " (closure-defines-json state) ";\n"
        "CLJS_GLOBAL.CLOSURE_NO_DEPS = true;\n"


Add syncs for :rsc-paths added via set-env!

--- boot/core/src/boot/core.clj
+++ boot/core/src/boot/core.clj
@@ -17,7 +17,7 @@
    [java.net URLClassLoader URL]
    java.lang.management.ManagementFactory))

-(declare get-env set-env! boot-env on-env! merge-env! tgt-files relative-path)
+(declare get-env set-env! add-sync! boot-env on-env! merge-env! tgt-files relative-path)

 ;; ## Utility Functions
 ;;
@@ -121,6 +121,7 @@

 (defmethod on-env! ::default  [key old new env] nil)
 (defmethod on-env! :src-paths [key old new env] (add-directories! (set/difference new old)))
+(defmethod on-env! :rsc-paths [key old new env] (add-sync! (get-env :tgt-path) (set/difference new old)))

 (defmulti merge-env!
   "This function is used to modify how new values are merged into the boot atom


delayed docker container (to prevent starting automatically)

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

-(def elastic (new ElasticsearchContainer "docker.elastic.co/elasticsearch/elasticsearch:7.10.2"))
+(def elastic (delay (new ElasticsearchContainer "docker.elastic.co/elasticsearch/elasticsearch:7.10.2")))

 (defn- stop-elasticsearch []
-  (.stop elastic))
+  (.stop @elastic))

 (defn- elastic-has-started? [elastic-ip]
   (let [response (sh "curl" (str elastic-ip "/_cluster/health"))
@@ -23,8 +23,8 @@

 (defn- start-elasticsearch []
        (println "Starting elasticsearch container")
-       (.start elastic)
-       (let [port (.getMappedPort elastic 9200)
+       (.start @elastic)
+       (let [port (.getMappedPort @elastic 9200)
              elastic-ip (str "http://127.0.0.1:" port)]
             (wait-elastic-to-start elastic-ip)
             (intern 'clj-elasticsearch.elastic-utils 'elastic-host elastic-ip)


Update server.clj

Update server.clj

--- examples/ring-malli-swagger/src/example/server.clj
+++ examples/ring-malli-swagger/src/example/server.clj
@@ -55,13 +55,13 @@
         {:swagger {:tags ["math"]}}

         ["/plus"
-         {:get {:summary "plus with spec query parameters"
+         {:get {:summary "plus with malli query parameters"
                 :parameters {:query [:map [:x int?] [:y int?]]}
                 :responses {200 {:body [:map [:total int?]]}}
                 :handler (fn [{{{:keys [x y]} :query} :parameters}]
                            {:status 200
                             :body {:total (+ x y)}})}
-          :post {:summary "plus with spec body parameters"
+          :post {:summary "plus with malli body parameters"
                  :parameters {:body [:map [:x int?] [:y int?]]}
                  :responses {200 {:body [:map [:total int?]]}}
                  :handler (fn [{{{:keys [x y]} :body} :parameters}]


Add touch function, like the unix touch(1) program

--- boot/core/src/boot/core.clj
+++ boot/core/src/boot/core.clj
@@ -426,6 +426,11 @@
   (pod/call-worker
     `(clj-yaml.core/parse-string ~x)))

+(defn touch
+  "Same as the Unix touch(1) program."
+  [f]
+  (.setLastModified f (System/currentTimeMillis)))
+
 (defn git-files [& {:keys [untracked]}]
   (git/ls-files :untracked untracked))


Fix issue with stale state on upload form

--- src-cljs/dakait/components.cljs
+++ src-cljs/dakait/components.cljs
@@ -259,14 +259,21 @@

     om/IDidMount
     (did-mount [this]
-      (.modal ($ (om/get-node owner)) #js {:keyboard false
-                                           :show false
-                                           :backdrop "static"})
-      (go (loop []
-            (<! pusher-modal-chan)
-            (log "Got request to show pusher modal")
-            (.modal ($ (om/get-node owner)) "show")
-            (recur))))
+      (let [$modal ($ (om/get-node owner))
+            url (om/get-node owner "url")]
+        (.modal $modal #js {:keyboard false
+                            :show false
+                            :backdrop "static"})
+        (.on $modal "shown.bs.modal" (fn []
+                                       (.focus url)))
+        (go (loop []
+              (<! pusher-modal-chan)
+              (log "Got request to show pusher modal")
+              (om/set-state! owner :processing false)
+              (om/set-state! owner :error false)
+              (set! (.-value url) "")
+              (.modal $modal "show")
+              (recur)))))
     om/IRenderState
     (render-state [_ state]
       (let [close-dialog #(.modal ($ (om/get-node owner)) "hide")


whitespace

whitespace

--- src-cljs/flatride/frontend.cljs
+++ src-cljs/flatride/frontend.cljs
@@ -83,7 +83,7 @@
         lng (->> coords .-coords .-longitude)
         geocoder (js/window.google.maps.Geocoder.)
         latlng (js/window.google.maps.LatLng. lat lng)]
-  (set! *mapInstance* (window/google.maps.Map. (sel1 :#div-map-canvas) (map-config-obj latlng)))
+  (set! *mapInstance* (window/google.maps.Map. (sel1 :#div-map-canvas) (map-config-obj latlng)))
     (.geocode geocoder (js-obj "latLng" latlng) fill-from-field)))

 (defn init-current-position []


chart types

chart types

--- src/cljs/meo/electron/renderer/ui/dashboard.cljs
+++ src/cljs/meo/electron/renderer/ui/dashboard.cljs
@@ -61,8 +61,6 @@
                              :scores-chart ds/scores-chart
                              :bp-chart bp/bp-chart
                              :barchart-row dc/barchart-row
-                             :linechart-row dc/linechart-row
-                             :chart-data-row dc/chart-data-row
                              :points-by-day dc/points-by-day-chart
                              :points-lost-by-day dc/points-lost-by-day-chart)]
               ^{:key (str (:label chart-cfg) (:tag chart-cfg) (:k chart-cfg))}


major bugfiz

major bugfiz


Reduce default subscriber count

Reduce default subscriber count

--- src/onyx/static/default_vals.clj
+++ src/onyx/static/default_vals.clj
@@ -29,7 +29,7 @@
    :onyx.messaging.aeron/embedded-driver? true
    :onyx.messaging.aeron/offer-idle-strategy :high-restart-latency
    :onyx.messaging.aeron/poll-idle-strategy :high-restart-latency
-   :onyx.messaging.aeron/subscriber-count 4
+   :onyx.messaging.aeron/subscriber-count 2
    :onyx.messaging.netty/thread-pool-sizes 1
    :onyx.messaging.netty/connect-timeout-millis 1000
    :onyx.messaging.netty/pending-buffer-size 10000


Colorize dbug/info/warn/fail output (fixes #137)

--- boot/pod/src/boot/util.clj
+++ boot/pod/src/boot/util.clj
@@ -38,15 +38,16 @@
 (def ^:dynamic *colorize?* (atom (colorize?-system-default)))

 (defn- print*
-  [verbosity args]
+  [verbosity color args]
   (when (>= @*verbosity* verbosity)
     (binding [*out* *err*]
-      (apply printf args) (flush))))
+      (print ((or color identity) (apply format args)))
+      (flush))))

-(defn dbug [& more] (print* 2 more))
-(defn info [& more] (print* 1 more))
-(defn warn [& more] (print* 1 more))
-(defn fail [& more] (print* 1 more))
+(defn dbug [& more] (print* 2 ansi/bold-cyan   more))
+(defn info [& more] (print* 1 ansi/bold-white  more))
+(defn warn [& more] (print* 1 ansi/bold-yellow more))
+(defn fail [& more] (print* 1 ansi/bold-red    more))

 (defmacro with-let
   "Binds resource to binding and evaluates body.  Then, returns


(SERVER-1866) Add filesystem-watch-service to user_repl

Without this change running puppetserver from the repl fails trying to
find the filesystem-watch-service. This commit adds it to allow folks to
run from the repl.

--- dev/user_repl.clj
+++ dev/user_repl.clj
@@ -15,6 +15,7 @@
             [puppetlabs.services.jruby-pool-manager.jruby-pool-manager-service :refer [jruby-pool-manager-service]]
             [puppetlabs.trapperkeeper.services.scheduler.scheduler-service :refer [scheduler-service]]
             [puppetlabs.trapperkeeper.services.status.status-service :refer [status-service]]
+            [puppetlabs.trapperkeeper.services.watcher.filesystem-watch-service :refer [filesystem-watch-service]]
             [puppetlabs.trapperkeeper.core :as tk]
             [puppetlabs.trapperkeeper.app :as tka]
             [clojure.tools.namespace.repl :refer (refresh)]
@@ -63,6 +64,7 @@
                authorization-service
                versioned-code-service
                scheduler-service
+               filesystem-watch-service
                status-service]
               ((resolve 'user/puppetserver-conf)))))
   (alter-var-root #'system tka/init)


Change log from ERROR to WARN (#1698)

Change log from ERROR to WARN (#1698)

Co-authored-by: Scott Crosby <23e8f75489aff47cf2cd5a529e9a769a24e9501c@twosigma.com>

--- scheduler/src/cook/compute_cluster.clj
+++ scheduler/src/cook/compute_cluster.clj
@@ -464,7 +464,7 @@
           (if (:update-succeeded update-result)
             (log/info "Update for cluster" (:cluster-name update) "successful")
             (log/error "Update failed!" update))
-          (log/error "Invalid update!" update)))
+          (log/warn "Invalid update!" update)))
       updates-with-results)))

 (defn update-compute-clusters


Added ability to modify username.

Added ability to modify username.

--- src/foreclojure/login.clj
+++ src/foreclojure/login.clj
@@ -47,7 +47,7 @@
           (response/redirect (or location "/problems")))
       (flash-error "Error logging in." "/login"))))

-(def-page update-password-page []
+(def-page update-credentials-page []
   (with-user [{:keys [user] :as user-obj}]
     [:div#account-settings
      [:div#update-pwd
@@ -56,26 +56,39 @@
       [:table
        (form-to [:post "/login/update"]
                 (map form-row
-                     [[password-field :old-pwd "Current password"]
-                      [password-field :pwd "New password"]
-                      [password-field :repeat-pwd "Repeat password"]])
+                      [[text-field :new-username "Username" user]
+                       [password-field :old-pwd "Current password"]
+                       [password-field :pwd "New password"]
+                       [password-field :repeat-pwd "Repeat password"]])
                 [:tr
                  [:td [:button {:type "submit"} "Reset now"]]])]]]))

-(defn do-update-password! [old-pwd new-pwd repeat-pwd]
+(defn do-update-credentials! [new-username old-pwd new-pwd repeat-pwd]
   (with-user [{:keys [user pwd]}]
-    (let [encryptor (StrongPasswordEncryptor.)]
-      (assuming [(= new-pwd repeat-pwd)
+    (let [encryptor (StrongPasswordEncryptor.)
+          new-pwd-hash (.encryptPassword encryptor new-pwd)
+          new-lower-user (.toLowerCase new-username)]
+      (assuming [(or (= new-lower-user user) (nil? (fetch-one :users :where {:user new-lower-user})))
+                 "User already exists",
+                 (< 3 (.length new-lower-user) 14)
+                 "Username must be 4-13 characters long",
+                 (= new-lower-user
+                    (first (re-seq #"[A-Za-z0-9_]+" new-lower-user)))
+                 "Username must be alphanumeric"
+                 (or (empty? new-pwd) (< 6 (.length new-pwd)))
+                 "New password must be at least seven characters long",
+                 (= new-pwd repeat-pwd)
                  "New password was not entered identically twice"
                  (.checkPassword encryptor old-pwd pwd)
                  "Old password incorrect"]
-        (let [new-pwd-hash (.encryptPassword encryptor new-pwd)]
-          (update! :users {:user user}
-                   {:$set {:pwd new-pwd-hash}}
-                   :upsert false)
-          (flash-msg (str "Password for " user " updated successfully")
-                     "/problems"))
-        (flash-error why "/login/update")))))
+          (do
+            (update! :users {:user user}
+                     {:$set {:pwd (if (not-empty new-pwd) new-pwd-hash pwd) :user new-lower-user}}
+                     :upsert false)
+            (session/session-put! :user new-lower-user)
+            (flash-msg (str "Password for " new-username " updated successfully")
+                       "/problems"))
+          (flash-error why "/login/update")))))

 (def-page reset-password-page []
   [:div
@@ -143,9 +156,9 @@
   (POST "/login" {{:strs [user pwd]} :form-params}
     (do-login user pwd))

-  (GET  "/login/update" [] (update-password-page))
-  (POST "/login/update" {{:strs [old-pwd pwd repeat-pwd]} :form-params}
-    (do-update-password! old-pwd pwd repeat-pwd))
+  (GET  "/login/update" [] (update-credentials-page))
+  (POST "/login/update" {{:strs [new-username old-pwd pwd repeat-pwd]} :form-params}
+    (do-update-credentials! new-username old-pwd pwd repeat-pwd))

   (GET  "/login/reset" [] (reset-password-page))
   (POST "/login/reset" [email]


Fix for "___ solved and counting"

Fix for "___ solved and counting"

Need to iterate over :solved keys to get the total, as well as over
:scores to get per-problem scores, because many problems were solved
before we started tracking scores. We still update :solved, so this
will get all problems.

--- src/foreclojure/mongo.clj
+++ src/foreclojure/mongo.clj
@@ -43,17 +43,17 @@
 (defn reconcile-solved-count
   "Overwrites the times-solved field in the problems collection based on data from the users collection. Should only be called on server startup since it isn't a safe operation. Also updates the total-solved agent."
   []
-  (let [+ (fnil + 0)
-        [total scores]
-        (->> (fetch :users :only [:scores])
-             (mapcat :scores)
-             (frequencies)
-             (reduce (fn [[total scores] [[id score] times]]
-                       [(+ total times)
-                        (update-in scores
-                                   [(number-from-mongo-key id) score]
-                                   + times)])
-                     [0 {}]))]
+  (let [+      (fnil + 0)
+        users  (fetch :users :only [:scores :solved])
+        scores (->> users
+                    (mapcat :scores)
+                    (frequencies)
+                    (reduce (fn [scores [[id score] times]]
+                              (update-in scores
+                                         [(number-from-mongo-key id) score]
+                                         + times))
+                            {}))
+        total  (count (mapcat :solved users))]
     (send solved-stats (constantly (assoc scores :total total)))))

 (defn prepare-mongo []


fixed #88

fixed #88

--- src/frontend/uploads.cljs
+++ src/frontend/uploads.cljs
@@ -1,6 +1,7 @@
 (ns moomoo-frontend.uploads
   (:require [moomoo-frontend.app-state :as app-state]
-            [clojure.data :as data]))
+            [clojure.data :as data]
+            [clojure.set]))

 (defonce blank-upload {:paused?  false
                        :started? false})
@@ -37,7 +38,7 @@
         new-upload-slots (:upload-slots new-state)
         active-uploads   (:active-uploads new-state)
         inactive-uploads (:inactive-uploads new-state)
-        uploads (:uploads new-state)]
+        uploads          (:uploads new-state)]
     (println "UPLOADS!" uploads)
     (cond
       (and (< old-upload-slots new-upload-slots)
@@ -65,22 +66,20 @@
 (add-watch app-state/app-state :upload-slots upload-slots-watch-fn!)

 (defn upload-removed-watch-fn! [_ _ old-state new-state]
-  (let [uploads-keys-diff (data/diff (:uploads old-state)
-                                     (:uploads new-state))]
-    (if-not (nil? (first uploads-keys-diff))
-      (let [deleted-upload-ids (first (keys (first uploads-keys-diff)))]
-        (if-not (nil? deleted-upload-ids)
-          (let [active-uploads   (vec (remove (set deleted-upload-ids) (:active-uploads new-state)))
-                inactive-uploads (vec (remove (set deleted-upload-ids) (:inactive-uploads new-state)))
-                uploads (:uploads new-state)]
-            (if-not (empty? inactive-uploads)
-              (swap! app-state/app-state
-                     merge
-                     {:active-uploads (append-upload active-uploads
-                                                     (first inactive-uploads))
-                      :inactive-uploads (drop-first-upload inactive-uploads)
-                      :uploads (merge uploads {(first inactive-uploads)
-                                               (start-upload (uploads (first inactive-uploads)))})}))))))))
+  (let [deleted-upload-ids (clojure.set/difference (set (keys (:uploads old-state)))
+                                                   (set (keys (:uploads new-state))))]
+    (if-not (empty? deleted-upload-ids)
+      (let [active-uploads   (vec (remove (set deleted-upload-ids) (:active-uploads new-state)))
+            inactive-uploads (vec (remove (set deleted-upload-ids) (:inactive-uploads new-state)))
+            uploads (:uploads new-state)]
+        (if-not (empty? inactive-uploads)
+          (swap! app-state/app-state
+                 merge
+                 {:active-uploads (append-upload active-uploads
+                                                 (first inactive-uploads))
+                  :inactive-uploads (drop-first-upload inactive-uploads)
+                  :uploads (merge uploads {(first inactive-uploads)
+                                           (start-upload (uploads (first inactive-uploads)))})}))))))

 (add-watch app-state/app-state :upload-removed upload-removed-watch-fn!)

@@ -91,10 +90,11 @@
                                (get (:uploads new-state) upload-id))
         old-upload-state (first upload-diff)
         new-upload-state (second upload-diff)]
+    (println "old-upload-state" old-upload-state)
+    (println "new-upload-state" new-upload-state)
     (if (nil? old-upload-state)
       (if (:started? new-upload-state)
-        :started
-        nil)
+        :started)
       (if-not (nil? new-upload-state)
         (let [k (first (keys new-upload-state))
               v (first (vals new-upload-state))]


fix: conf should be present in ES DB to properly manipulate cloud creds on user.

--- jar-async/test/slipstream/async/collector_test.clj
+++ jar-async/test/slipstream/async/collector_test.clj
@@ -1,10 +1,10 @@
 (ns slipstream.async.collector-test
   (:require
     [clojure.test :refer :all]
-    [slipstream.async.collector :refer :all]
-    [com.sixsq.slipstream.db.serializers.utils :as su])
+    [com.sixsq.slipstream.db.serializers.service-config-impl :as sci]
+    [com.sixsq.slipstream.db.serializers.utils :as su]
+    [slipstream.async.collector :refer :all])
   (:import
-    [com.sixsq.slipstream.connector.local LocalConnector]
     [com.sixsq.slipstream.connector.local LocalConnector]
     [com.sixsq.slipstream.persistence User]
     [com.sixsq.slipstream.persistence UserParameter]))
@@ -12,6 +12,7 @@
 ;; NB! We are using Elaticsearch for some Java entities.
 ;; Start local ES node, create a client of it, and set DB CRUD impl.
 (su/test-db-client-and-crud-impl)
+(sci/db-add-default-config)

 (deftest test-add-increasing-space
   (is (= [["joe" "exo" 0] ["joe" "aws" 10] ["mike" "exo" 20]]


core: sequence, every?

core: sequence, every?

--- data/core.clj
+++ data/core.clj
@@ -1272,3 +1272,23 @@
    (fn [& args] (apply f arg1 arg2 arg3 args)))
   ([f arg1 arg2 arg3 & more]
    (fn [& args] (apply f arg1 arg2 arg3 (concat more args)))))
+
+(defn sequence
+  "Coerces coll to a (possibly empty) sequence, if it is not already
+  one. Will not force a lazy seq. (sequence nil) yields ()"
+  {:added "1.0"}
+  [coll]
+  (if (seq? coll)
+    coll
+    (or (seq coll) ())))
+
+(defn every?
+  "Returns true if (pred x) is logical true for every x in coll, else
+  false."
+  {:tag Bool
+  :added "1.0"}
+  [pred coll]
+  (cond
+    (nil? (seq coll)) true
+    (pred (first coll)) (recur pred (next coll))
+    :else false))


Refactors advanceable ICE including Space ICE.

--- src/clj/game/cards-ice.clj
+++ src/clj/game/cards-ice.clj
@@ -32,6 +32,23 @@
   {:label (str "Gain " credits " [Credits]")
    :msg (str "gain " credits " [Credits]")
    :effect (effect (gain :credit credits))})
+
+;;; For Advanceable ICE
+(def advance-counters
+  "Number of advancement counters - for advanceable ICE."
+  (req (or (:advance-counter card) 0)))
+
+(def space-ice-rez-bonus
+  "Amount of rez reduction for the Space ICE."
+  (req (* -3 (or (:advance-counter card) 0))))
+
+(defn space-ice
+  "Creates data for Space ICE with specified abilities."
+  [& abilities]
+  {:advanceable :always
+   :abilities (vec abilities)
+   :rez-cost-bonus space-ice-rez-bonus})
+

 ;;; For Grail ICE
 (def reveal-grail
@@ -118,9 +135,8 @@
                  :trace (assoc trash-program :base 4 :msg "trash a program")}]}

    "Asteroid Belt"
-   {:advanceable :always :abilities [end-the-run]
-    :rez-cost-bonus (req (* -3 (or (:advance-counter card) 0)))}
-
+   (space-ice end-the-run)
+
    "Bandwidth"
    {:abilities [{:msg "give the Runner 1 tag"
                  :effect (effect (tag-runner :runner 1)
@@ -316,7 +332,7 @@
    "Fire Wall"
    {:advanceable :always
     :abilities [end-the-run]
-    :strength-bonus (req (or (:advance-counter card) 0))}
+    :strength-bonus advance-counters}

    "Flare"
    {:abilities [{:label "Trace 6 - Trash 1 hardware, do 2 meat damage, and end the run"
@@ -364,7 +380,7 @@
    "Hadrians Wall"
    {:advanceable :always
     :abilities [end-the-run]
-    :strength-bonus (req (or (:advance-counter card) 0))}
+    :strength-bonus advance-counters}

    "Himitsu-Bako"
    {:abilities [end-the-run {:msg "add it to HQ" :cost [:credit 1] :effect (effect (move card :hand))}]}
@@ -419,7 +435,7 @@

    "Ice Wall"
    {:advanceable :always :abilities [end-the-run]
-    :strength-bonus (req (or (:advance-counter card) 0))}
+    :strength-bonus advance-counters}

    "Ichi 1.0"
    {:abilities [trash-program
@@ -561,9 +577,7 @@
                  :effect (effect (end-run))}]}

    "Nebula"
-   {:advanceable :always
-    :abilities [trash-program]
-    :rez-cost-bonus (req (* -3 (or (:advance-counter card) 0)))}
+   (space-ice trash-program)

    "Negotiator"
    {:abilities [(gain-credits 2)
@@ -597,9 +611,9 @@
    {:abilities [end-the-run]}

    "Orion"
-   {:advanceable :always :abilities [trash-program end-the-run]
-    :rez-cost-bonus (req (* -3 (or (:advance-counter card) 0)))}
-
+   ;; TODO: wormhole subroutine
+   (space-ice trash-program end-the-run)
+
    "Pachinko"
    {:abilities [{:label "End the run if the Runner is tagged"
                  :req (req tagged) :msg "end the run" :effect (effect (end-run))}]}
@@ -647,8 +661,9 @@

    "Searchlight"
    {:advanceable :always
+    ;; Could replace this with (tag-trace advance-counters).
     :abilities [{:label "Trace X - Give the Runner 1 tag"
-                 :trace {:base (req (or (:advance-counter card) 0)) :effect (effect (tag-runner :runner 1))
+                 :trace {:base advance-counters :effect (effect (tag-runner :runner 1))
                          :msg "give the Runner 1 tag"}}]}

    "Sensei"
@@ -659,7 +674,7 @@
    {:advanceable :always
     :abilities [(gain-credits 2)
                 (tag-trace 3)]
-    :strength-bonus (req (or (:advance-counter card) 0))}
+    :strength-bonus advance-counters}

    "Sherlock 1.0"
    {:abilities [{:label "Trace 4 - Add an installed program to the top of Stack"
@@ -849,9 +864,9 @@
     :abilities [(do-net-damage 1)]}

    "Wormhole"
-   {:advanceable :always
-    :rez-cost-bonus (req (* -3 (or (:advance-counter card) 0)))}
-
+   ;; TODO: create an ability for wormhole
+   (space-ice)
+
    "Wotan"
    {:abilities [end-the-run]}


Refixing munch after merge.

Refixing munch after merge.

--- src/clj/minijava/munch.clj
+++ src/clj/minijava/munch.clj
@@ -65,7 +65,7 @@
      (let [offset (:val (:exp1 (:adr dst)))
            e1 (munch (:exp2 (:adr dst)))
            e2 (munch src) ]
-       (emit (movl (MEMORY e1 offset) e2)))
+       (emit (movl  e2 (MEMORY e1 offset))))
        ;; AFTER munching these two statements, emit the code.
        ;; Move(Mem(Binop(Plus(e1, Const(i))),e2) -> movl $i[e1] e2
    (and (isit? (:adr dst) :minijava.ir/BinaryOp) (= (:op (:adr dst)) :+)
@@ -73,14 +73,14 @@
      (let [offset (:val (:exp2 (:adr dst)))
            e1 (munch (:exp1 (:adr dst)))
            e2 (munch src) ]
-       (emit (movl (MEMORY e1 offset) e2)))
+       (emit  e2 (movl (MEMORY e1 offset))))
        ;; AFTER munching these two statements, emit the code.
        ;; Move(Mem(e1),e2) -> movl [e1] e2

    :else
-     (let [adr (munch (:adr src))
-           e2 (munch dst) ]
-       (emit (movl (MEMORY adr) e2)))))
+     (let [adr (munch (:adr dst))
+           e2 (munch src) ]
+       (emit (movl e2 (MEMORY adr 0))))))

 ;; Default Move pattern: just use Movl
 (defmethod munchMap [:minijava.ir/Move :minijava.exp/expression :minijava.exp/expression]


Removed a redundant comment (copy/paste error)

--- src/clj/minijava/munch.clj
+++ src/clj/minijava/munch.clj
@@ -179,7 +179,7 @@
   [exp op rand1 rand2]
   (let [d (Temp (minijava.ir.temp.Temp.)) ]
   		 	(emit (movl  (munch rand1) d))
-        (emit (imull (CONST (:val rand2)) d));;note: the ordering here matters, and is different than above, because subtraction is not commutative
+        (emit (imull (CONST (:val rand2)) d))
                     d))

  (defmethod munchMap [:minijava.ir/BinaryOp :*  :minijava.exp/expression :minijava.exp/expression]
@@ -191,4 +191,4 @@
   			 	(emit (imull  e1 d))
   			  d))

- +


debug-log the head commit and raw string

--- src/clj/runbld/vcs/git.clj
+++ src/clj/runbld/vcs/git.clj
@@ -7,6 +7,7 @@
             [environ.core :as environ]
             [runbld.util.data :refer [strip-trailing-slashes]]
             [runbld.util.date :as date]
+            [runbld.util.debug :as debug]
             [runbld.io :as io]
             [runbld.vcs :as vcs :refer [VcsRepo]]
             [slingshot.slingshot :refer [throw+]]))
@@ -84,6 +85,18 @@
     "git@" loc
     (str "file://" (io/abspath loc))))

+(defn head-commit
+  [dir]
+  (let [repo (git/load-repo dir)]
+    (let [commit (git/git-log-commit repo "HEAD")
+          raw-commit (git/git-log-raw-string repo "HEAD")]
+      (debug/log "HEAD commit:" commit
+                 "Raw string: >" raw-commit "<")
+      (if commit
+        (commit-map commit)
+        (io/log "Failed to get the head-commit. The raw string was:"
+                raw-commit)))))
+
 (defn checkout-workspace [clone-home remote workspace org project branch]
   (let [absremote (resolve-remote remote)
         absworkspace (io/abspath-file workspace)
@@ -93,16 +106,8 @@
                    absremote absworkspace)
         workspace-repo (git/load-repo absworkspace)
         _ (git/git-checkout workspace-repo branch)
-        HEAD (first (git/git-log workspace-repo))]
+        HEAD (head-commit absworkspace)]
     (commit-map HEAD)))
-
-(defn head-commit
-  [dir]
-  (let [repo (git/load-repo dir)]
-    (if-let [commit (git/git-log-commit repo)]
-      (commit-map commit)
-      (io/log "Failed to get the head-commit. The raw string was:"
-              (git/git-log-raw-string repo "HEAD")))))

 (defn project-url
   [this]


Do not specify charset for multipart requests

Details in the following issue: https://github.com/dakrone/clj-http/issues/472

--- src/clj_http/multipart.clj
+++ src/clj_http/multipart.clj
@@ -131,7 +131,6 @@
   [multipart {:keys [mime-subtype]}]
   (let [mp-entity (doto (MultipartEntityBuilder/create)
                     (.setStrictMode)
-                    (.setCharset (encoding-to-charset "UTF-8"))
                     (.setMimeSubtype (or mime-subtype "form-data")))]
     (doseq [m multipart]
       (let [name (or (:part-name m) (:name m))


difference fix

difference fix

--- src/cljc/commos/delta.cljc
+++ src/cljc/commos/delta.cljc
@@ -128,7 +128,7 @@
   (let [cur-v (get-in val ks)]
     (case op
       :is
-      (->> (difference cur-v (first v))
+      (->> (difference cur-v v)
            (map (partial prepend-ks-raw ks)))
       :ex
       (if (map? cur-v)


style fix

style fix

--- src/cljs/fluch/canvas.cljs
+++ src/cljs/fluch/canvas.cljs
@@ -5,9 +5,8 @@
   "Creates a canvas in the given div element"
   [div :- js/Element]
   (let [canvas (.createElement js/document "canvas")]
-    (.setAttribute canvas "style"
-                   #js {:position "relative"
-                        :width "100%"
-                        :height "100%"})
+    (aset canvas "style" "position" "relative")
+    (aset canvas "style" "width" "100%")
+    (aset canvas "style" "height" "100%")
     (.appendChild div canvas)
     (.getContext canvas "2d")))


top level style-fns

top level style-fns

--- src/cljs/re_form/core.cljs
+++ src/cljs/re_form/core.cljs
@@ -268,19 +268,20 @@
    :hover-bg-color "#f1f1f1"
    :border "1px solid #ddd"})

-(def form-style
-  [:*
-   (inputs/radio-input-style default-base-consts)
-   (inputs/file-upload-style default-base-consts)
-   (inputs/button-select-style default-base-consts)
-   (inputs/textarea-style default-base-consts)
-   (inputs/calendar-style default-base-consts)
-   (inputs/switchbox-style default-base-consts)
-   (inputs/text-input-style default-base-consts)
-   (inputs/select-input-style default-base-consts)
-   (inputs/checkbox-group-style default-base-consts)
-   (inputs/select-xhr-style default-base-consts)
-   (inputs/codemirror-style default-base-consts)])
-
-(defn form-style-fn
-  ([] ))
+(def input-style-fns
+  [inputs/radio-input-style
+   inputs/file-upload-style
+   inputs/button-select-style
+   inputs/textarea-style
+   inputs/calendar-style
+   inputs/switchbox-style
+   inputs/text-input-style
+   inputs/select-input-style
+   inputs/checkbox-group-style
+   inputs/select-xhr-style
+   inputs/codemirror-style])
+
+(defn form-style-fn [s]
+  (into [:*] (map #(% s) input-style-fns)))
+
+(def form-style (form-style-fn default-base-consts))


workaround for lack of support for \x unicode character escaping in read-string

--- src/cljs/src/document.cljs
+++ src/cljs/src/document.cljs
@@ -15,6 +15,7 @@

 (ns vix.document
   (:require [cljs.reader :as reader]
+            [clojure.string :as string]
             [vix.util :as util]
             [goog.net.XhrIo :as xhrio]
             [goog.net.EventType :as event-type]
@@ -31,7 +32,10 @@
     (events/listen req goog.net.EventType/COMPLETE callback)
     (. req (send uri
                  method
-                 (pr-str data)
+                 ;; replacing unicode characters until read-string
+                 ;; can deal with \x (which is equivalent to \u00).
+                 ;; See: http://dev.clojure.org/jira/browse/CLJ-1025
+                 (string/replace (pr-str data) #"\\x" "\\u00")
                  (new goog.structs.Map
                       "Content-Type" "text/plain; charset=utf-8")))))


Change Renderable to extend IPersistentMap

Fixes #159.

--- src/compojure/response.clj
+++ src/compojure/response.clj
@@ -39,7 +39,7 @@
   (render [body _]
     (-> (response/response body)
         (response/content-type "text/html; charset=utf-8")))
-  clojure.lang.APersistentMap
+  clojure.lang.IPersistentMap
   (render [resp-map _]
     (merge (with-meta (response/response "") (meta resp-map))
            resp-map))


species.clj edited online with Bitbucket

--- resources/species.clj
+++ resources/species.clj
@@ -6,25 +6,23 @@
                  :tolerance {:detrit {:model :limit
                                       :ideal 25
                                       :radius 1.5}}}
-:lichens {:size 3e4
+ :lichens {:size 3e4
            :max-size 1e5
            :min-size 10
            :production-rate 7e-3
            :influence {:detrit 1e-5}
-         :tolerance {:detrit {:model :limit
+           :tolerance {:detrit {:model :limit
                                 :ideal 75
                                 :radius 40}}}
-
  :soilbacteria {:size 0.3e30
                 :max-size 1e30
                 :min-size 100
                 :production-rate 0.01
                 :tolerance {:detrit {:model :limit
-                                     :ideal 1.2e-30
-                                     :radius -1.2e-30}}
+                                     :ideal 30
+                                     :radius -10}}
                 :influence {:detrit -0.5e-30
                             :soil 0.04e-30}}
-
  :fungus {:size 0.3e9
           :max-size 1e10
           :min-size 100


Update Ring-Codec version

Update Ring-Codec version

--- ring-core/project.clj
+++ ring-core/project.clj
@@ -6,7 +6,7 @@
             :url "http://opensource.org/licenses/MIT"}
   :dependencies [[org.clojure/clojure "1.5.1"]
                  [org.clojure/tools.reader "0.9.1"]
-                 [ring/ring-codec "1.0.0"]
+                 [ring/ring-codec "1.0.1"]
                  [commons-io "2.4"]
                  [commons-fileupload "1.3.1"]
                  [clj-time "0.9.0"]


Refactor: clojure affor already a method to capitalize, lets use it

--- agiledox.clj
+++ agiledox.clj
@@ -1,4 +1,5 @@
 (use 'clojure.java.io)
+(use '[clojure.string :only [capitalize]])

 (defn java-test-file? [file] (.matches (.getName file) ".*[Tt]est.*\\.java"))
 (defn java-test-files [dirname]
@@ -20,7 +21,7 @@
 	(.replaceFirst feature "- test" "-"))

 (defn formSentense [feature]
-	(str " - " (.toUpperCase (.substring feature 2 3)) (.substring feature 3) ".") )
+	(str " - " (capitalize (.substring feature 2)) ".") )

 (defn as-feature [line]
   (formSentense (skipTestPerfixIfPresent (.toLowerCase (.replaceAll line "([A-Z])" " $1")))))


Add missing html macro on icons ns.

Add missing html macro on icons ns.


Change log to warn for bad CORS requests. (#853)

--- waiter/src/waiter/cors.clj
+++ waiter/src/waiter/cors.clj
@@ -50,7 +50,8 @@
           (when-not (preflight-allowed? cors-validator request)
             (throw (ex-info "Cross-origin request not allowed" {:origin origin
                                                                 :request-method request-method
-                                                                :status 403})))
+                                                                :status 403
+                                                                :log-level :warn})))
           (let [{:strs [access-control-request-headers]} headers]
             {:status 200
              :headers {"access-control-allow-origin" origin
@@ -85,7 +86,8 @@
                 (throw (ex-info "Cross-origin request not allowed"
                                 {:origin origin
                                  :request-method request-method
-                                 :status 403}))))
+                                 :status 403
+                                 :log-level :warn}))))
             (ru/update-response bless))))))

 (defrecord PatternBasedCorsValidator [pattern-matches?]


change Unregistered S&W '35 to use card targeting

--- src/clj/game/cards-hardware.clj
+++ src/clj/game/cards-hardware.clj
@@ -500,13 +500,11 @@
    "Unregistered S&W 35"
    {:abilities
     [{:cost [:click 2] :req (req (some #{:hq} (:successful-run runner-reg)))
-      :label "trash a Bioroid, Clone, Executive or Sysop" :prompt "Choose a card to trash"
-      :choices (req (let [contents (mapcat :content (flatten (seq (:servers corp))))
-                          hosted (mapcat :hosted contents)]
-                      (filter #(and (:rezzed %)
-                                    (or (has? % :subtype "Bioroid") (has? % :subtype "Clone")
-                                        (has? % :subtype "Executive") (has? % :subtype "Sysop")))
-                               (concat hosted contents))))
+      :label "trash a Bioroid, Clone, Executive or Sysop" :prompt "Choose a Bioroid, Clone, Executive, or Sysop to trash"
+      :choices {:req #(and (:rezzed %)
+                           (or (has? % :subtype "Bioroid") (has? % :subtype "Clone")
+                               (has? % :subtype "Executive") (has? % :subtype "Sysop"))
+                           (or (= (last (:zone %)) :content) (= (last (:zone %)) :onhost)))}
       :msg (msg "trash " (:title target)) :effect (effect (trash target))}]}

    "Vigil"


tests for Amazon Industrial Zone, ChiLo City Grid, Product Placement

--- src/clj/test/cards-upgrades.clj
+++ src/clj/test/cards-upgrades.clj
@@ -1,4 +1,47 @@
 (in-ns 'test.core)
+
+(deftest amazon-industrial-zone
+  "Amazon Industrial Zone - Immediately rez ICE installed over its server at 3 credit discount"
+  (do-game
+    (new-game (default-corp [(qty "Spiderweb" 1) (qty "Amazon Industrial Zone" 1)])
+              (default-runner))
+    (take-credits state :corp 1)
+    (play-from-hand state :corp "Amazon Industrial Zone" "New remote")
+    (let [aiz (get-in @state [:corp :servers :remote1 :content 0])]
+      (core/rez state :corp aiz)
+      (is (= 2 (:credit (get-corp))))
+      (play-from-hand state :corp "Spiderweb" "Server 1")
+      (prompt-choice :corp "Yes") ; optional ability
+      (let [spid (get-in @state [:corp :servers :remote1 :ices 0])]
+        (is (get-in (refresh spid) [:rezzed]) "Spiderweb rezzed")
+        (is (= 1 (:credit (get-corp))) "Paid only 1 credit to rez")))))
+
+(deftest chilo-city-grid
+  "ChiLo City Grid - Give 1 tag for successful traces during runs on its server"
+  (do-game
+    (new-game (default-corp [(qty "Caduceus" 2) (qty "ChiLo City Grid" 1)])
+              (default-runner))
+    (play-from-hand state :corp "ChiLo City Grid" "New remote")
+    (play-from-hand state :corp "Caduceus" "Server 1")
+    (take-credits state :corp)
+    (let [chilo (get-in @state [:corp :servers :remote1 :content 0])
+          cad (get-in @state [:corp :servers :remote1 :ices 0])]
+      (core/click-run state :runner {:server "R&D"})
+      (core/rez state :corp cad)
+      (core/rez state :corp chilo)
+      (card-ability state :corp cad 0)
+      (prompt-choice :corp 0)
+      (prompt-choice :runner 0)
+      (is (= 3 (:credit (get-corp))) "Trace was successful")
+      (is (= 0 (:tag (get-runner))) "No tags given for run on different server")
+      (core/no-action state :corp nil)
+      (core/successful-run state :runner nil)
+      (core/click-run state :runner {:server "Server 1"})
+      (card-ability state :corp cad 0)
+      (prompt-choice :corp 0)
+      (prompt-choice :runner 0)
+      (is (= 6 (:credit (get-corp))) "Trace was successful")
+      (is (= 1 (:tag (get-runner))) "Runner took 1 tag given from successful trace during run on ChiLo server"))))

 (deftest cyberdex-virus-suite-purge
   "Cyberdex Virus Suite - Purge ability"
@@ -96,6 +139,25 @@
       (prompt-choice :runner "OK")
       (is (= 0 (count (:scored (get-runner)))) "No scored agendas"))))

+(deftest product-placement
+  "Product Placement - Gain 2 credits when Runner accesses it"
+  (do-game
+    (new-game (default-corp [(qty "Product Placement" 1)])
+              (default-runner))
+    (play-from-hand state :corp "Product Placement" "New remote")
+    (take-credits state :corp)
+    (is (= 7 (:credit (get-corp))))
+    (let [pp (get-in @state [:corp :servers :remote1 :content 0])]
+      (core/click-run state :runner {:server "Server 1"})
+      (core/no-action state :corp nil)
+      (core/successful-run state :runner nil)
+      (is (= 9 (:credit (get-corp))) "Gained 2 credits from Runner accessing Product Placement")
+      (prompt-choice :runner "Yes") ; Runner trashes PP
+      (core/click-run state :runner {:server "Archives"})
+      (core/no-action state :corp nil)
+      (core/successful-run state :runner nil)
+      (is (= 9 (:credit (get-corp))) "No credits gained when Product Placement accessed in Archives"))))
+
 (deftest red-herrings
   "Red Herrings - Ability"
   (do-game


Usa str->bytes instead of ->byte-array on hash ns.

--- src/clojure/buddy/core/hash.clj
+++ src/clojure/buddy/core/hash.clj
@@ -65,7 +65,7 @@

   String
   (digest* [^String input ^Keyword alg]
-    (digest* (->byte-array input) alg))
+    (digest* (str->bytes input) alg))

   java.io.InputStream
   (digest* [^java.io.InputStream input ^Keyword alg]


Working audio stop/play transition.

Working audio stop/play transition.

--- cljs/src/hive_jam/core.cljs
+++ cljs/src/hive_jam/core.cljs
@@ -52,6 +52,7 @@
                           :errors []
                           :console []
                           :beat-cursors []
+                          :audio {:play true}
                           :hive {}}))

 (defn config [key]
@@ -858,20 +859,30 @@
                       (map (partial dom/li nil) cursor))))))

 (defn button [{:keys [text click-chan]} owner]
+  (let [render (fn [] (let [node (om/get-node owner)
+                            b (Button. text (.getInstance FlatButtonRenderer))]
+                        (om/update-state! owner #(merge % {:button b}))
+                        (.render b node)
+                        (gevents/listen b Component.EventType.ACTION
+                                        #(go (>! click-chan true)))))]
   (reify
     om/IInitState
-    (init-state [_]
-      {:id (new-id)})
+    (init-state [_] {})
     om/IRenderState
-    (render-state [_ state]
-      (dom/div #js {:id (:id state)}))
+    (render-state [_ state] (dom/div nil nil))
     om/IDidMount
     (did-mount [_]
-      (let [node (om/get-node owner)
-            b (Button. text (.getInstance FlatButtonRenderer))]
-        (.render b node)
-        (gevents/listen b Component.EventType.ACTION
-                        #(go (>! click-chan true)))))))
+      (render))
+    om/IWillUpdate
+    (will-update [_ next _]
+      (let [b (:button (om/get-state owner))
+            prev (om/get-props owner)]
+        (when-not (= next prev)
+          (.dispose b))))
+    om/IDidUpdate
+    (did-update [_ prev _]
+      (when-not (= text (:text prev))
+        (render))))))

 (defn hive-view [{:keys [cursor save-state-ch load-state-ch]}]
   (reify
@@ -883,7 +894,7 @@
                (om/build button {:text "Load state"
                                  :click-chan load-state-ch})))))

-(defn audio-view [_ owner]
+(defn audio-view [cursor owner]
   (reify
     om/IInitState
     (init-state [_]
@@ -892,15 +903,14 @@
         (go-loop []
           (<! play-ch)
           (.play (. js/document (getElementById "audio")))
-          (om/update-state! owner #(merge % {:state :play}))
+          (om/transact! cursor #(merge % {:play true}))
           (recur))
         (go-loop []
           (<! stop-ch)
           (.pause (. js/document (getElementById "audio")))
-          (om/update-state! owner #(merge % {:state :stop}))
+          (om/transact! cursor #(merge % {:play false}))
           (recur))
-        {:state :play
-         :play-ch play-ch
+        {:play-ch play-ch
          :stop-ch stop-ch}))
     om/IRenderState
     (render-state [_ state]
@@ -910,10 +920,10 @@
                           (dom/source #js {:src (str "http://" js/window.location.hostname
                                                      ":" (config "UiAudioPort") "/hivejam")
                                            :type "audio/mpeg"}))
-               (if (= :play (:state state))
-                 (om/build button {:text "stop"
+               (if (:play cursor)
+                 (om/build button {:text "Stop"
                                    :click-chan (:stop-ch state)})
-                 (om/build button {:text "play"
+                 (om/build button {:text "Play"
                                    :click-chan (:play-ch state)}))))
     om/IDidMount
     (did-mount [_]
@@ -1001,7 +1011,7 @@
                (om/build hive-view {:cursor (:hive cursor)
                                     :save-state-ch (:save-state-ch state)
                                     :load-state-ch (:load-state-ch state)})
-               (om/build audio-view {})
+               (om/build audio-view (:audio cursor))
                (om/build grid-view {:id "root" :beat-cursors (:beat-cursors cursor)} {:state state})
                (om/build console-view (:console cursor))))))


clean up public interface

clean up public interface

--- src/com/billpiel/sayid/core.clj
+++ src/com/billpiel/sayid/core.clj
@@ -82,7 +82,7 @@
   [] (#'ws/clear-log! (ws-init! :quiet)))
 (util/defalias w-cl! ws-clear-log!)

-(defn ws-add-trace-fn!*
+(defn- ws-add-trace-fn!*
   "`fn-sym` is a symbol that references an existing function. Applies an
   enabled trace to said functions. Adds the traces to the active
   workspace trace set."
@@ -97,7 +97,7 @@
   `(ws-add-trace-fn!* (util/fully-qualify-sym '~fn-sym)))
 (util/defalias-macro w-atf! ws-add-trace-fn!)

-(defn ws-add-deep-trace-fn!*
+(defn- ws-add-deep-trace-fn!*
   "`fn-sym` is a symbol that references an existing function. Applies an
   enabled trace to said functions. Adds the traces to the active
   workspace trace set."
@@ -113,7 +113,7 @@

 (util/defalias-macro w-adtf! ws-add-deep-trace-fn!)

-(defn ws-add-trace-ns!*
+(defn- ws-add-trace-ns!*
   "`ns-sym` is a symbol that references an existing namespace. Applies an enabled
   trace to all functions in that namespace. Adds the traces to the active workspace trace set."
   [ns-sym]
@@ -226,7 +226,7 @@
                          name
                          args))
     (ws-deref! workspace)))
-
+(util/defalias w-qdtr ws-query-deep-trace-replay)

 (defn ws-deep-trace-apply
   [qual-sym args]
@@ -304,9 +304,9 @@

 ;; === String Output functions

-(def tree->string #'so/tree->string)
-
-(defn get-trees
+(def- tree->string #'so/tree->string)
+
+(defn- get-trees
   [v]
   (let [mk (meta v)]
     (cond
@@ -336,6 +336,7 @@
   (-> coll
       get-trees
       (#'so/print-trees)))
+(util/defalias t-pr trees-print)

 (defn ws-print-unlimited
   [& [ws]]
@@ -361,7 +362,7 @@
                        @recording)))
 (util/defalias r-pr rec-print)

-(defn mk-printer-*-list
+(defn- mk-printer-*-list
   [opts init-prn whitelist?]
   (loop [prn init-prn
          opts' opts]
@@ -382,20 +383,20 @@
                                 assoc fi whitelist?)
                      (rest opts'))))))

-(defn mk-printer-white-list
+(defn- mk-printer-white-list
   [opts]
   (mk-printer-*-list opts
                      (assoc default-printer
                             :selector {})
                      true))

-(defn mk-printer-black-list
+(defn- mk-printer-black-list
   [opts]
   (mk-printer-*-list opts
                      default-printer
                      false))

-(defn mk-printer
+(defn- mk-printer
   [opts]
   (cond
     (nil? opts) default-printer
@@ -481,14 +482,14 @@
   `[:name '~(util/fully-qualify-sym s)])
 (util/defalias-macro qbn query-by-name)

-(defn syms->qbn
+(defn- syms->qbn
   [form]
   (map #(if (symbol? %)
           `(qbn ~%)
           %)
        form))

-(defn ws-query*
+(defn- ws-query*
   [& query]
   (apply q/q
          (ws-deref!)
@@ -513,10 +514,11 @@
                  ~@body))
 (util/defalias-macro r-q rec-query)

-(defmacro qt
+(defmacro tree-query
   "Queries `tree`, a trace record."
   [tree & body] `(q/q ~tree
                       ~@body))
+(util/defalias-macro t-query tree-query)

 ;; === END Query functions


prevent empty spans before links

prevent empty spans before links

--- src-cljs/frontend/components/chat.cljs
+++ src-cljs/frontend/components/chat.cljs
@@ -26,7 +26,9 @@
         ;; may need to add [""], split can return empty array
         parts (or (seq (str/split text url-regex)) [""])]
     (reduce (fn [acc [pre url]]
-              (conj acc [:span pre] (when url [:a {:href url :target "_blank"} url])))
+              (conj acc
+                    (when (< 0 (count pre)) [:span pre])
+                    (when url [:a {:href url :target "_blank"} url])))
             [:span] (partition-all 2 (concat (interleave parts
                                                          matches)
                                              (when (not= (count parts)