CMR-1699 Fixes errors introduced by merge.

--- bootstrap-app/src/cmr/bootstrap/data/util.clj
+++ bootstrap-app/src/cmr/bootstrap/data/util.clj
@@ -16,23 +16,23 @@
   ;; out of sync. The delete processing should happen after this step and put it back in sync.
   (let [mdb-context {:system (helper/get-metadata-db system)}
         indexer-context {:system (helper/get-indexer system)}
-        {:keys [concept-id revision-id]} concept]
+        concept-str (fn [] (pr-str (dissoc concept :metadata)))]
     (try
-      (concept-service/save-concept mdb-context concept)
-      (index-service/index-concept indexer-context concept-id revision-id
-                                   {:ignore-conflict? true :all-revisions-index? false})
-      (index-service/index-concept indexer-context concept-id revision-id
-                                   {:ignore-conflict? true :all-revisions-index? true})
+      (let [{:keys [concept-id revision-id]} (concept-service/save-concept mdb-context concept)]
+        (index-service/index-concept indexer-context concept-id revision-id
+                                     {:ignore-conflict? true :all-revisions-index? false})
+        (index-service/index-concept indexer-context concept-id revision-id
+                                     {:ignore-conflict? true :all-revisions-index? true}))
       (catch clojure.lang.ExceptionInfo e
         (let [data (ex-data e)]
           (if (= (:type data) :conflict)
-            (warn (format "Ignoring conflict saving revision for %s %s: %s"
-                          concept-id revision-id (pr-str (:errors data))))
-            (error e (format "Error saving or indexing concept %s with revision %s. Message: %s"
-                             concept-id revision-id (.getMessage e))))))
+            (warn (format "Ignoring conflict saving revision for %s: %s"
+                          (concept-str) (pr-str (:errors data))))
+            (error e (format "Error saving or indexing concept %s. Message: %s"
+                             (concept-str) (.getMessage e))))))
       (catch Throwable e
-        (error e (format "Error saving or indexing concept %s with revision %s. Message: %s"
-                         concept-id revision-id (.getMessage e)))))))
+        (error e (format "Error saving or indexing concept %s. Message: %s"
+                         (concept-str) (.getMessage e)))))))

 (defn create-tombstone-and-unindex-concept
   "Creates a tombstone with the given concept id and revision id and unindexes the concept."


upgrades to jetty version 9.4.49.v20220914 (#1664)

--- waiter/project.clj
+++ waiter/project.clj
@@ -45,7 +45,7 @@
                  [io.grpc/grpc-core "1.20.0"
                   :exclusions [com.google.guava/guava]
                   :scope "test"]
-                 [twosigma/jet "0.7.10-20220829_161214-g1f873ca"
+                 [twosigma/jet "0.7.10-20220917_061811-g0d23827"
                   :exclusions [org.mortbay.jetty.alpn/alpn-boot]]
                  [twosigma/clj-http "1.0.2-20180124_201819-gcdf23e5"
                   :exclusions [commons-codec commons-io org.clojure/tools.reader potemkin slingshot]]


Fix missing :require in lazytest.describe

--- src/main/clojure/lazytest/describe.clj
+++ src/main/clojure/lazytest/describe.clj
@@ -1,4 +1,5 @@
 (ns lazytest.describe
+  (:require lazytest.random)
   (:use	lazytest.expect
 	lazytest.suite
 	lazytest.find


pending migrations not working for :type :sql

--- joplin.jdbc/src/joplin/jdbc/database.clj
+++ joplin.jdbc/src/joplin/jdbc/database.clj
@@ -71,7 +71,7 @@
 (defmethod pending-migrations :sql [target & args]
   (binding [*migration-table* (get-table target)]
     (do-pending-migrations (get-db target)
-                           (get-migrations (:migrator target)))))
+                           (get-sql-migrations (:migrator target)))))

 ;; ============================================================================
 ;; Code driven sql migrations


Fix bin/eftest when no --junit flag is passed (#87)

Fix bin/eftest when no --junit flag is passed

--- bin/.eftest.clj
+++ bin/.eftest.clj
@@ -28,7 +28,8 @@
                    eftest.report.progress/report
                    (filter
                      identity
-                     [(report-to-file
-                        (requiring-resolve 'eftest.report.junit/report)
-                        junit-path)]))})]
+                     [(when junit?
+                        (report-to-file
+                          (requiring-resolve 'eftest.report.junit/report)
+                          junit-path))]))})]
   (System/exit (+ (:error summary) (:fail summary))))


fix login redirect

fix login redirect

--- src/clj/conference_rating/handler.clj
+++ src/clj/conference_rating/handler.clj
@@ -114,8 +114,8 @@
 (defn prevent-open-redirect-through-relay-state [handler]
   (fn [request]
     (let [clean-request (-> request
-                            (assoc-in [:params :RelayState] nil)
-                            (assoc-in [:form-params :RelayState] nil))]
+                            (assoc-in [:params :RelayState] "/")
+                            (assoc-in [:form-params :RelayState] "/"))]
       (println "request coming in: " request)
       (println "clean request coming in: " clean-request)
       (handler clean-request))))


handle dereferenced accounts in trans update

--- src/clj_money/models/transactions.clj
+++ src/clj_money/models/transactions.clj
@@ -703,7 +703,7 @@
         validated
         (let [existing (find-by-id storage (:id validated) (:transaction-date validated))

-              ; dereferenced items
+              ; dereferenced items - items removed from the transaction
               dereferenced-items (remove (fn [{existing-item-id :id}]
                                            (some #(= existing-item-id
                                                      (:id %))
@@ -714,6 +714,18 @@
               _ (doseq [item dereferenced-items]
                   (delete-transaction-item storage (:id item) (:transaction-date item)))

+              ; dereferenced accounts - accounts removed from the transaction by changing account-id
+              dereferenced-account-ids (apply difference (->> [existing validated]
+                                                              (map :items)
+                                                              (map #(map :account-id %))
+                                                              (map set)))
+
+              dereferenced-account-id-base-items (->> dereferenced-account-ids
+                                                      (map #(hash-map :account-id %
+                                                                      :transaction-date (:transaction-date validated)
+                                                                      :index (Integer/MAX_VALUE)))
+                                                      (map #(get-previous-item storage %)))
+
               ; current items
               _ (doseq [item (:items transaction)]
                   (upsert-item storage (before-save-item item)))
@@ -730,7 +742,8 @@

               ; process all item updates
               _ (recalculate-items storage (concat current-base-items
-                                                   dereferenced-base-items))
+                                                   dereferenced-base-items
+                                                   dereferenced-account-id-base-items))

               ; update the transaction record itself
               updated (update-transaction storage validated)


extract update-item-index-and-balance function

--- src/clj_money/models/transactions.clj
+++ src/clj_money/models/transactions.clj
@@ -183,23 +183,42 @@
   [storage-spec item]
   (update-transaction-item (storage storage-spec) item))

+(defn- update-item-index-and-balance
+  "Accepts a transaction item and a context containing
+    :index   - a transaction item index
+    :balance - a transaction item balance
+    :storage - service used to communicate with the data store
+
+  Calculates the new index and balance for the item and updates
+  them in the data store
+
+  Returns a context containing
+    :index   - the new index
+    :balance - the new balance
+    :storage - unchanged
+
+  This is done in the context of updating existing transaction
+  items that are affected by a new or updated transaction"
+  [{:keys [index balance storage]} item]
+  (let [new-index (+ 1 index)
+        polarized-amount (accounts/polarize-amount storage item)
+        new-balance (+ balance polarized-amount)]
+    (update-item storage (-> item
+                             (assoc :index new-index
+                                    :balance new-balance)
+                             before-save-item))
+    {:index new-index
+     :balance new-balance
+     :storage storage}))
+
 (defn- update-affected-balances
   "Updates the accounts affected by the specified transaction items"
   [storage-spec items]
   (doseq [[account-id items] (group-by :account-id items)]
     (let [last-item (last items) ; these should already be sorted
           subsequent-items (subsequent-items storage-spec last-item)
-          final (reduce (fn [{:keys [index balance]} item]
-                          (let [new-index (+ 1 index)
-                                polarized-amount (accounts/polarize-amount storage-spec item)
-                                new-balance (+ balance polarized-amount)]
-                            (update-item storage-spec (-> item
-                                                          (assoc :index new-index
-                                                                 :balance new-balance)
-                                                          before-save-item))
-                            {:index new-index
-                             :balance new-balance}))
-                        last-item
+          final (reduce update-item-index-and-balance
+                        (assoc last-item :storage storage-spec)
                         subsequent-items)]
       (accounts/update storage-spec {:id account-id
                                      :balance (:balance final)}))))


add utility notification fns

add utility notification fns

--- src/cljs/clj_money/notifications.cljs
+++ src/cljs/clj_money/notifications.cljs
@@ -9,6 +9,12 @@
    (swap! notifications #(conj % {:message message
                                   :severity severity}))))

+(defn success [message] (notify message :success))
+(defn info    [message] (notify message :info))
+(defn warning [message] (notify message :warning))
+(defn warn    [message] (notify message :warning))
+(defn danger  [message] (notify message :danger))
+
 (defn- remove-at
   [coll index]
   (vec (concat (subvec coll 0 index)


reload pending badges after  declining badge

--- src/cljs/salava/badge/ui/pending.cljs
+++ src/cljs/salava/badge/ui/pending.cljs
@@ -34,18 +34,18 @@
      :keywords? true
      :params {:status new-status}
      :handler (fn []
-                  (js/setTimeout (fn [] (swap! state assoc :badge-alert nil)) 3000)
-                #_(reload-fn state))
+                  (js/setTimeout (fn [] (swap! state assoc :badge-alert nil)) 2000)
+                  (if reload-fn (reload-fn state)))
      :error-handler (fn [{:keys [status status-text]}])}))

-(defn update-visibility [visibility badge state reload-fn]
+(defn update-visibility [visibility badge state]
   (swap! state assoc :badge-alert nil)
   (ajax/POST
     (path-for (str "/obpv1/badge/set_visibility/" (:id badge)))
     {:params {:visibility visibility}
      :handler (fn [data]
                 (when (= (:status data) "success")
-                  (update-status (:id badge) "accepted" state reload-fn)
+                  (update-status (:id badge) "accepted" state nil)
                   (swap! state assoc :badge-alert "accepted" :badge-name (:name badge))
                   ))}))

@@ -97,37 +97,6 @@
           }(t :admin/Showmore)]
      [show-more-content state]]))

-#_(defn visibility-settings [visibility state]
-  (fn []
-    [:div.col-md-12
-     [:div.dropdown
-      [:a.dropdown-toggle {:data-toggle "dropdown" :type "button" } (case @(cursor state [:visibility])
-                                                                      "public" [:i.fa.fa-globe]
-                                                                      "private" [:i.fa.fa-lock]
-                                                                      "internal" [:i.fa.fa-group]
-                                                                      (t :badge/Public)) #_[:i.fa.fa-share-alt] (case @(cursor state [:visibility])
-                                                                                "public" (t :badge/Public)
-                                                                                "private" (t :badge/Private)
-                                                                                "internal" (t :badge/Shared)
-                                                                                (t :badge/Public)) [:i.fa.fa-chevron-down]]
-      [info "Set your badge visibility" "bottom"]
-      [:ul.dropdown-menu
-       [:li [:a {:href "#" :on-click #(do
-                                        (.preventDefault %)
-                                        (update-visibility "public" state)
-                                        )} [:i {:class "fa fa-globe" }] [:div.text (t :badge/Public)]]]
-       [:li [:a {:href "#" :on-click #(do
-                                        (.preventDefault %)
-                                        (update-visibility "internal" state)
-                                        )} [:i {:class "fa fa-group" }] [:div.text (t :badge/Shared)]]]
-       [:li [:a {:href "#" :on-click #(do
-                                        (.preventDefault %)
-                                        (update-visibility "private" state)
-                                        )} [:i {:class "fa fa-lock" }] [:div.text (t :badge/Private)]]]
-       ]]
-     [:hr.line]]
-    ;]
-    ))

 (defn pending-badge-content [{:keys [id image_file name description visibility assertion_url meta_badge meta_badge_req issuer_content_name issuer_content_url issued_on issued_by_obf verified_by_obf obf_url]}]
   (let [state (atom {:id id
@@ -144,7 +113,6 @@
             {:keys [badge_id content assertion_url]} data
             {:keys [name description tags alignment criteria_content image_file issuer_content_id issuer_content_name issuer_content_url issuer_contact issuer_image issuer_description criteria_url creator_content_id creator_name creator_url creator_email creator_image creator_description message_count endorsement_count ]} (content-setter @selected-language content)]
         [:div
-         #_[:div.row.visibility [visibility-settings visibility state]] ;;visibility settings
          (if (or verified_by_obf issued_by_obf)
            [:div.row.flip
             (bh/issued-by-obf obf_url verified_by_obf issued_by_obf)])
@@ -177,54 +145,54 @@

 (defn visibility-modal [badge state reload-fn]
   (let [visibility (atom (:visibility badge))]
-  (create-class {:reagent-render
-                 (fn [] [:div#badge-settings {:style {:padding "10px"}}
-                         [:form {:class "form-horizontal"}
-                          [:div ;{:class "col-md-12"}
-                           [:fieldset {:class "form-group visibility"}
-                            [:legend {:class "col-md-9 sub-heading"}
-                             (t :badge/Badgevisibility) [info {:content (t :badge/Visibilityinfo) :placement "right"}]]
-                            [:div {:class (str "col-md-12 " @visibility) :style {:margin-top "20px"}}
-                             (if-not (private?)
-                               [:div [:input {:id              "visibility-public"
+    (create-class {:reagent-render
+                   (fn [] [:div#badge-settings {:style {:padding "10px"}}
+                           [:form {:class "form-horizontal"}
+                            [:div ;{:class "col-md-12"}
+                             [:fieldset {:class "form-group visibility"}
+                              [:legend {:class "col-md-9 sub-heading"}
+                               (t :badge/Badgevisibility) [info {:content (t :badge/Visibilityinfo) :placement "right"}]]
+                              [:div {:class (str "col-md-12 " @visibility) :style {:margin-top "20px"}}
+                               (if-not (private?)
+                                 [:div [:input {:id              "visibility-public"
+                                                :name            "visibility"
+                                                :value           "public"
+                                                :type            "radio"
+                                                :on-change       #(do
+                                                                    (.preventDefault %)
+                                                                    (reset! visibility "public"))}]
+                                  [:i {:class "fa fa-globe" }]
+                                  [:label {:for "visibility-public"}
+                                   (t :badge/Public)]])
+                               [:div [:input {:id              "visibility-internal"
                                               :name            "visibility"
-                                              :value           "public"
+                                              :value           "internal"
                                               :type            "radio"
                                               :on-change       #(do
                                                                   (.preventDefault %)
-                                                                  (reset! visibility "public"))}]
-                                [:i {:class "fa fa-globe" }]
-                                [:label {:for "visibility-public"}
-                                 (t :badge/Public)]])
-                             [:div [:input {:id              "visibility-internal"
-                                            :name            "visibility"
-                                            :value           "internal"
-                                            :type            "radio"
-                                            :on-change       #(do
-                                                                (.preventDefault %)
-                                                                (reset! visibility "internal"))}]
-                              [:i {:class "fa fa-group" }]
-                              [:label {:for "visibility-internal"}
-                               (t :badge/Shared)]]
-                             [:div [:input {:id              "visibility-private"
-                                            :name            "visibility"
-                                            :value           "private"
-                                            :type            "radio"
-                                            :on-change       #(do
-                                                                (.preventDefault %)
-                                                                (reset! visibility "private"))
-                                            :default-checked (= "private" (:visibility badge)) #_(= "private" (:visibility badge) #_(get-in @state [:badge-settings :visibility]))}]
-                              [:i {:class "fa fa-lock" }]
-                              [:label {:for "visibility-private"}
-                               (t :badge/Private)]]]]]]
-                         [:hr.border]
-                         [:button.btn.btn-primary {:on-click #(do
-                                                                (.preventDefault %)
-                                                                (update-visibility @visibility badge state reload-fn)
-                                                                )
-                                                   :data-dismiss "modal"}(t :core/Save)]
-                         ])
-                 :component-will-unmount (fn [] (m/close-modal!))})))
+                                                                  (reset! visibility "internal"))}]
+                                [:i {:class "fa fa-group" }]
+                                [:label {:for "visibility-internal"}
+                                 (t :badge/Shared)]]
+                               [:div [:input {:id              "visibility-private"
+                                              :name            "visibility"
+                                              :value           "private"
+                                              :type            "radio"
+                                              :on-change       #(do
+                                                                  (.preventDefault %)
+                                                                  (reset! visibility "private"))
+                                              :default-checked (= "private" (:visibility badge)) #_(= "private" (:visibility badge) #_(get-in @state [:badge-settings :visibility]))}]
+                                [:i {:class "fa fa-lock" }]
+                                [:label {:for "visibility-private"}
+                                 (t :badge/Private)]]]]]]
+                           [:hr.border]
+                           [:button.btn.btn-primary {:on-click #(do
+                                                                  (.preventDefault %)
+                                                                  (update-visibility @visibility badge state)
+                                                                  )
+                                                     :data-dismiss "modal"}(t :core/Save)]
+                           ])
+                   :component-will-unmount (fn [] (m/close-modal!))})))

 (defn badge-pending [badge state reload-fn]
   [:div.row {:key (:id badge)}
@@ -236,7 +204,6 @@
        [:button {:class "btn btn-primary"
                  :on-click #(do
                               (m/modal! [visibility-modal badge state reload-fn] {:size :md :hidden (fn [] (reload-fn state))})
-                              #_(update-status (:id badge) "accepted" state init-data)
                               (.preventDefault %)
                               )
                  :data-dismiss "modal"}


remove pending badges from stream

remove pending badges from stream

--- src/cljs/salava/social/ui/stream.cljs
+++ src/cljs/salava/social/ui/stream.cljs
@@ -423,7 +423,7 @@
      [badge-alert state]
      [pending-connections reload-fn]
      [pending-endorsements]
-     [badges-pending state]
+     #_[badges-pending state]
      (if (not-activated?)
        (not-activated-banner))
      (if admin-events


Made the redis test more spiffy.

Made the redis test more spiffy.

--- src/coming_soon/controllers/redis.clj
+++ src/coming_soon/controllers/redis.clj
@@ -2,8 +2,16 @@
   (:use [compojure.core :only (defroutes GET)])
   (:require [taoensso.carmine :as car]))

-(def redis-ok {:status 200 :body "Connection to Redis is OK."})
-(def redis-borked {:status 500 :body "Connection to Redis is borked."})
+(def pre "<title>Redis Test</title>")
+(defn body [status]
+  (let [
+    color (if status "green" "red")
+    label (if status "OK" "BORKED")]
+    (str "Connection to Redis is: " label "")))
+(def post "")
+
+(def redis-ok {:status 200 :body (str pre (body true) post)})
+(def redis-borked {:status 500 :body (str pre (body false) post)})

 (defn redis-test []
   (try


Quick fix for 270 - Brought back newlines in the top code section of the Events tab (and set a simpler ^key)

--- src/day8/re_frame_10x/view/event.cljs
+++ src/day8/re_frame_10x/view/event.cljs
@@ -165,12 +165,13 @@
                after            (subs form-str end-index)]
            ; DC: We get lots of React errors if we don't force a creation of a new element when the highlight changes. Not really sure why...
            ;; Possibly relevant? https://stackoverflow.com/questions/21926083/failed-to-execute-removechild-on-node
-           ^{:key (pr-str highlighted-form)}
+           ^{:key (gensym)}
            [rc/box
             :style {:max-height       (when-not show-all-code? (str (* 10 17) "px")) ;; Add scrollbar after 10 lines
                     :overflow         "auto"
                     :border           code-border
-                    :background-color common/white-background-color}
+                    :background-color common/white-background-color
+                    :white-space      "pre"} ;; TODO: This is a quick fix for issue #270
             :attr {:on-double-click (handler-fn (rf/dispatch [:code/set-show-all-code? (not show-all-code?)]))}
             :child (if (some? highlighted-form)
                      [components/highlight {:language "clojure"}


upgrade figwheel

upgrade figwheel

--- src/leiningen/new/aemette/project.clj
+++ src/leiningen/new/aemette/project.clj
@@ -8,7 +8,7 @@
                  [secretary "1.2.3"]]

   :plugins [[lein-cljsbuild "1.1.2"]
-            [lein-figwheel "0.5.0-4"]]
+            [lein-figwheel "0.5.0-6"]]

   :source-paths ["src"]
   :clean-targets ^{:protect false} [[:cljsbuild :builds 0 :compiler :output-dir]


Update properties

Update properties

--- src/leiningen/new/cljskel/project.clj
+++ src/leiningen/new/cljskel/project.clj
@@ -8,7 +8,7 @@
                  [compojure "1.2.0"]
                  [environ "1.0.0"]
                  [mixradio/instrumented-ring-jetty-adapter "1.0.0"]
-                 [mixradio/radix "1.0.2"]
+                 [mixradio/radix "1.0.3"]
                  [net.logstash.logback/logstash-logback-encoder "3.2"]
                  [org.clojure/clojure "1.6.0"]
                  [org.clojure/tools.logging "0.3.1"]
@@ -25,26 +25,30 @@
                                   [junit "4.11"]
                                   [midje "1.6.3"]
                                   [rest-cljer "0.1.11"]]
-                   :plugins [[lein-rpm "0.0.5"]
+                   :plugins [[lein-kibit "0.0.8"]
                              [lein-midje "3.1.3"]
-                             [lein-kibit "0.0.8"]]}}
+                             [lein-rpm "0.0.5"]]}}

-  :plugins [[lein-ring "0.8.12"]
-            [lein-environ "1.0.0"]
-            [lein-release "1.0.5"]]
+  :plugins [[lein-environ "1.0.0"]
+            [lein-release "1.0.5"]
+            [lein-ring "0.8.12"]]

   :env {:environment-name "poke"
+        :graphite-enabled false
+        :graphite-host ""
+        :graphite-port 2003
+        :graphite-post-interval-seconds 60
+        :logging-filethreshold "info"
+        :logging-level "info"
+        :logging-path "/tmp"
+        :logging-stashthreshold "off"
+        :production false
         :service-name "{{name}}"
-        :service-port "8080"
+        :service-port 8080
         :service-url "http://localhost:%s"
-        :restdriver-port "8081"
-        :graphite-host ""
-        :graphite-port "8080"
-        :graphite-post-interval "1"
-        :graphite-post-unit "MINUTES"
-        :graphite-enabled "DISABLED"
-        :production "false"
-        :shutdown-timeout-millis "5000"}
+        :shutdown-timeout-millis 5000
+        :restdriver-port 8081
+        :threads 254}

   :lein-release {:deploy-via :shell
                  :shell ["lein" "do" "clean," "uberjar," "pom," "rpm"]}


bad swap! in cljs.core.macros/alias

bad swap! in cljs.core.macros/alias

--- src/main/clojure/cljs/core/macros.clj
+++ src/main/clojure/cljs/core/macros.clj
@@ -36,5 +36,5 @@
          (doall (map source-fn vars)))))

 (defmacro alias [[_ ns] [_ alias]]
-  (swap! @env/*compiler*
+  (swap! env/*compiler*
     [::namespaces (.getName *ns*) :requires] assoc alias ns))


turn off hiccup reflection warning during compile

--- src/main/clojure/zana/html/slides.clj
+++ src/main/clojure/zana/html/slides.clj
@@ -1,6 +1,7 @@
-(set! *warn-on-reflection* true)
-(set! *unchecked-math* :warn-on-boxed)
-(ns ^{:author "John Alan McDonald" :date "2016-08-31"
+(set! *warn-on-reflection* false)
+(ns ^{:author ["wahpenayo at gmail dot com"
+               "John Alan McDonald"]
+      :date "2018-08-17"
       :doc "A slide show based on
             http://tympanus.net/codrops/2011/09/20/responsive-image-gallery/" }

@@ -8,6 +9,8 @@

   (:require [clojure.java.io :as io]
             [hiccup.page :as hiccup]))
+(set! *warn-on-reflection* true)
+(set! *unchecked-math* :warn-on-boxed)
 ;;------------------------------------------------------------------------------
 (defn- thumb-path [dirname ^java.io.File f]
   (str dirname "/thumbs/" (.getName f)))


remove some dead code

remove some dead code

--- src/main/shadow/cljs/devtools/api.clj
+++ src/main/shadow/cljs/devtools/api.clj
@@ -24,8 +24,7 @@
     [shadow.cljs.devtools.server.repl-impl :as repl-impl]
     [shadow.cljs.devtools.server.runtime :as runtime]
     [cljs.repl :as repl])
-  (:import [java.net Inet4Address NetworkInterface]
-           [clojure.lang Var]))
+  (:import [java.net Inet4Address NetworkInterface]))

 ;; nREPL support

@@ -489,8 +488,6 @@
              (when stop-on-eof
                (super/stop-worker supervisor build-id))))))))

-
-
 ;; FIXME: should maybe allow multiple instances
 (defn node-repl
   ([]
@@ -622,68 +619,6 @@

 (defn test []
   (println "TBD"))
-
-(defn release-snapshot [& args]
-  (println "release-snapshot was moved!")
-  (println "from the CLI use:")
-  (println "\tshadow-cljs run shadow.cljs.build-report <build-id> some.html")
-  (println "from the REPL use:")
-  (println "\t(require '[shadow.cljs.build-report :as r])")
-  (println "\t(r/generate :build-id {:report-file \"some.html\"})")
-  (println "both commands generate a standalone \"some.html\" file with the full report"))
-
-(comment
-  (release-snapshot :browser {})
-
-  (defn node-execute! [node-args file]
-    (let [script-args
-          ["node"]
-
-          pb
-          (doto (ProcessBuilder. script-args)
-            (.directory nil))]
-
-
-      ;; not using this because we only get output once it is done
-      ;; I prefer to see progress
-      ;; (prn (apply shell/sh script-args))
-
-      (let [node-proc (.start pb)]
-
-        (.start (Thread. (bound-fn [] (util/pipe node-proc (.getInputStream node-proc) *out*))))
-        (.start (Thread. (bound-fn [] (util/pipe node-proc (.getErrorStream node-proc) *err*))))
-
-        (let [out (.getOutputStream node-proc)]
-          (io/copy (io/file file) out)
-          (.close out))
-
-        ;; FIXME: what if this doesn't terminate?
-        (let [exit-code (.waitFor node-proc)]
-          exit-code))))
-
-
-  (defn test-all []
-    (-> (build/configure :dev '{:build-id :shadow-build-api/test
-                                :target :node-script
-                                :main shadow.test-runner/main
-                                :output-to "target/shadow-test-runner.js"
-                                :hashbang false})
-        (node/make-test-runner)
-        (build/compile)
-        (build/flush))
-
-    (node-execute! [] "target/shadow-test-runner.js")
-    ::test-all)
-
-  (defn test-affected
-    [source-names]
-    {:pre [(seq source-names)
-           (not (string? source-names))
-           (every? string? source-names)]}
-    (-> (test-setup)
-        (node/execute-affected-tests! source-names))
-    ::test-affected))
-

 (defn- find-local-addrs []
   (for [ni (enumeration-seq (NetworkInterface/getNetworkInterfaces))
@@ -700,8 +635,6 @@
         :when (instance? Inet4Address addr)]
     [ni addr]))

-;; (prn (find-local-addrs))
-
 (defmethod log/log-msg ::multiple-ips [_ {:keys [addrs] :as data}]
   (str "Found multiple IPs, might be using the wrong one. Please report all interfaces should the chosen one be incorrect.\n"
        (->> (for [[ni addr] addrs]


Made new version of byte messenger

Made new version of byte messenger

--- src/basinet/samples/byte_messenger.clj
+++ src/basinet/samples/byte_messenger.clj
@@ -9,11 +9,24 @@

 (def messages-per-connection 100000)

+(defn- read-message [source buffer size]
+  (let [finish-size (- (b/size (b/sink buffer)) size)]
+    (while (> (b/size (b/sink buffer)) finish-size)
+      (b/read source buffer))))
+
+(defn- write-message [sink buffer size]
+  (while (> (b/size (b/source buffer)) 0)
+    (b/write sink buffer)))
+
 (defn- handle-connection [socket message-size]
   (with-open [source (b/source socket)
               sink (b/sink socket)]
-    (dotimes [i messages-per-connection]
-      (transform-and-reply source reverse sink message-size))))
+    (let [input-buffer (b/byte-buffer message-size)
+          output-buffer (b/byte-buffer message-size)]
+      (dotimes [i messages-per-connection]
+        (read-message source input-buffer message-size)
+        (transform-and-reply input-buffer reverse output-buffer message-size)
+        (write-message sink output-buffer message-size)))))

 (defn server [host port connections message-size]
   (with-open [acceptor (tcp/acceptor host port)]
@@ -29,11 +42,16 @@
   (with-open [socket (tcp/connect host port)]
     (let [source (b/source socket)
           sink (b/sink socket)
+          input-buffer (b/byte-buffer message-size)
+          output-buffer (b/byte-buffer message-size)
           latency (atom 0)
           start-time (System/currentTimeMillis)]
       (dotimes [i messages-per-connection]
         (let [start-time (System/currentTimeMillis)]
-          (send-and-receive (byte-array message-size) sink source)
+          (dotimes [i message-size] (b/push output-buffer (byte 0)))
+          (write-message sink output-buffer message-size)
+          (read-message source input-buffer message-size)
+          (dotimes [i message-size] (b/pop input-buffer))
           (swap! latency + (- (System/currentTimeMillis) start-time))))
       (swap! latency / messages-per-connection)
       {:latency (float @latency)


only autocomplete emoji with >= 2 characters

--- src/chat/client/views/new_message.cljs
+++ src/chat/client/views/new_message.cljs
@@ -65,7 +65,7 @@
   [
    ; ... :emoji  -> autocomplete emoji
    (fn [text thread-id]
-     (let [pattern #"\B:(\S{1,})$"]
+     (let [pattern #"\B:(\S{2,})$"]
        (when-let [query (second (re-find pattern text))]
          (->> emoji/unicode
               (filter (fn [[k v]]


don't die on a user report error

don't die on a user report error

--- src/clj/backtype/storm/daemon/task.clj
+++ src/clj/backtype/storm/daemon/task.clj
@@ -182,8 +182,11 @@
         task-stats (mk-task-stats task-object (sampling-rate storm-conf))

         report-error (fn [error]
-                       (.report-task-error storm-cluster-state storm-id task-id error)
-                       (halt-process! 1 "Task died!"))
+                       (.report-task-error storm-cluster-state storm-id task-id error))
+
+        report-error-and-die (fn [error]
+                                (report-error error)
+                                (halt-process! 1 "Task died"))

         ;; heartbeat ASAP so nimbus doesn't reassign
         heartbeat-thread (async-loop
@@ -195,7 +198,7 @@
                             (when @active (storm-conf TASK-HEARTBEAT-FREQUENCY-SECS))
                             )
                           :priority Thread/MAX_PRIORITY
-                          :kill-fn report-error)
+                          :kill-fn report-error-and-die)

         stream->component->grouper (outbound-components topology-context)
         component->tasks (reverse-map task-info)
@@ -276,7 +279,7 @@
                                               storm-active-atom topology-context
                                               task-stats report-error)]
                           (async-loop (fn [] (exec) (when @active 0))
-                                      :kill-fn report-error))
+                                      :kill-fn report-error-and-die))
         system-threads [heartbeat-thread]
         all-threads  (concat executor-threads system-threads)]
     (reify


Update src/ctia/task/migration/migrations.clj

Co-authored-by: Guillaume Erétéo <fadeca11d6a1d76893acf6914bf24b15675e1396@cisco.com>

--- src/ctia/task/migration/migrations.clj
+++ src/ctia/task/migration/migrations.clj
@@ -255,5 +255,5 @@
    :1.0.0 (comp (append-version "1.0.0")
                 (rename-observable-type "pki-serial" "pki_serial")
                 simplify-incident)
-   :1.1.0 (comp (append-version "1.1.0")
+   :investigation-actions (comp (append-version "1.1.0")
                 migrate-action-data)})


bump external dependencies

bump external dependencies

--- cljs/project.clj
+++ cljs/project.clj
@@ -11,9 +11,9 @@
                  [figwheel "0.3.7"]
                  [rm-hull/inkspot "0.0.1-SNAPSHOT"]
                  [spellhouse/phalanges "0.1.6"]
-                 [funcool/cuerdas "0.4.0"]
+                 [funcool/cuerdas "0.5.0"]
                  [reagent "0.5.0" :exclusions [cljsjs/react]]
-                 [cljsjs/react "0.13.3-0"]]
+                 [cljsjs/react "0.13.3-1"]]

   :plugins [[lein-cljsbuild "1.0.5"]
             [lein-figwheel "0.3.3"]]


Be use less restrictive definition of Fn schema

--- src/hu/ssh/github_changelog/schema.clj
+++ src/hu/ssh/github_changelog/schema.clj
@@ -6,7 +6,7 @@
                      :github-api s/Str
                      s/Keyword s/Any})

-(s/defschema Fn (s/conditional fn? s/Any))
+(s/defschema Fn (s/conditional ifn? s/Any))

 (defn- sha? [x] (= (count x) 40))


adding emacsclient comment

adding emacsclient comment

--- src/leiningen/new/figwheel/project.clj
+++ src/leiningen/new/figwheel/project.clj
@@ -67,6 +67,9 @@
              ;; emacsclient -n +$2 $1
              ;;
              ;; :open-file-command "myfile-opener"
+
+             ;; if you are using emacsclient you can just use
+             ;; :open-file-command "emacsclient"

              ;; if you want to disable the REPL
              ;; :repl false
@@ -75,6 +78,7 @@
              ;; :server-logfile "tmp/logs/figwheel-logfile.log"
              }

+
   ;; setting up nREPL for Figwheel and ClojureScript dev
   ;; Please see:
   ;; https://github.com/bhauman/lein-figwheel/wiki/Using-the-Figwheel-REPL-within-NRepl


Remove unneeded :output-to directive

Remove unneeded :output-to directive

--- Clojure/project.clj
+++ Clojure/project.clj
@@ -7,7 +7,6 @@
                  [org.clojure/clojurescript "0.0-2760"]]
   :source-paths ["src"]
   :compiler {
-     :output-to "hello_world.js"
      :output-dir "out"
      :optimizations :none
      :cache-analysis true


fix navigation after qr scanning

fix navigation after qr scanning

--- src/status_im/qr_scanner/handlers.cljs
+++ src/status_im/qr_scanner/handlers.cljs
@@ -36,4 +36,6 @@
 (register-handler :set-qr-code
   (-> (u/side-effect! handle-qr-request)
       ((enrich clear-qr-request))
-      ((after #(dispatch [:navigate-back])))))
+      ((after (fn [{:keys [view-id]}]
+                (when (= :qr-scanner view-id)
+                  (dispatch [:navigate-back])))))))


adjusting puppet integration

adjusting puppet integration

--- test/celestial/integration/puppet.clj
+++ test/celestial/integration/puppet.clj
@@ -18,9 +18,8 @@
   (let [hostname (get-in redis-ec2-spec [:machine :hostname])]
     (clear-all)
     (new-type "redis" type)
-    (register-host spec)
-    (let [vm (reload spec)]
-      (puppetize type (host hostname))
+    (let [id (p/add-system spec) vm* (assoc spec :system-id id) vm (reload vm*)]
+      (puppetize type vm*)
       (.stop vm)
       (.delete vm))))


(PDB-2837) update anonymization to consider producer

Update the anonymization tool to anonymize producer like any other node name.

--- src/puppetlabs/puppetdb/anonymizer.clj
+++ src/puppetlabs/puppetdb/anonymizer.clj
@@ -400,6 +400,7 @@
         (update "resources" anonymize-catalog-resources context config)
         (update "edges" anonymize-edges context config)
         (update "certname" anonymize-leaf :node context config)
+        (update "producer" anonymize-leaf :node context config)
         (update "transaction_uuid" anonymize-leaf :transaction_uuid context config)
         (update "environment" anonymize-leaf :environment context config))))

@@ -409,6 +410,7 @@
   (let [context {"node" (get report "certname")}]
     (-> report
         (update "certname" anonymize-leaf :node context config)
+        (update "producer" anonymize-leaf :node context config)
         (update "resources" anonymize-report-resources context config)
         (update "metrics" anonymize-metrics context config)
         (update "logs" anonymize-logs context config)
@@ -435,6 +437,7 @@
   (let [context {"node" (get wire-facts "certname")}]
     (-> wire-facts
         (update "certname" anonymize-leaf :node context config)
+        (update "producer" anonymize-leaf :node context config)
         (update "values" anonymize-fact-values context config)
         (update "environment" anonymize-leaf :environment context config))))


Add page of pan/tilt cues.

Add page of pan/tilt cues.

--- src/afterglow/examples.clj
+++ src/afterglow/examples.clj
@@ -1005,10 +1005,10 @@
     (keyword (str "aim-group-" shared-prefix "-" (name base-name)))))

 (defn- build-aim-cue
-  "Build an aim cue."
+  "Build an aim cue for the mutiplexable fixture aiming page."
   [fixture-key shared-prefix transform? color]
   (let [isolated? (clojure.string/blank? shared-prefix)]
-    (cues/cue (keyword (str "aim" (name fixture-key)))
+    (cues/cue (keyword (str "aim-" (name fixture-key)))
               (fn [var-map]
                 (let [base-aim (if isolated?
                                  (cues/apply-merging-var-map var-map params/build-aim-param)
@@ -1036,7 +1036,7 @@
               :color color :priority 1)))

 (defn- make-main-aim-cues
-  "Create a page of cues for aiming lights in particular directions,
+  "Create a page of cues for aiming lights in particular points,
   individually and in groups."
   [page-x page-y]
   (let [x-base (* page-x 8)
@@ -1105,6 +1105,114 @@
                                  (var-fx/variable-effect @var-binder :aim-group-b-transform transform)))
                              :color :orange :short-name "Group B flip XY"))))

+(defn- direction-cue-var-key
+  "Determine the cue variable key value to use for a variable being
+  created for an direction cue page cue. `base-name` is the name that
+  will be used for the variable if it is not part of a group of cues
+  sharing variables; if `shared-prefix` is not blank then the variable
+  key will refer to a show variable with that prefix identifying which
+  group it belongs to."
+  [base-name shared-prefix]
+  (if (clojure.string/blank? shared-prefix)
+    (name base-name)
+    (keyword (str "direction-group-" shared-prefix "-" (name base-name)))))
+
+(defn- build-direction-cue
+  "Build a direction cue for the mutiplexable fixture direction page."
+  [fixture-key shared-prefix transform? color]
+  (let [isolated? (clojure.string/blank? shared-prefix)]
+    (cues/cue (keyword (str "dir-" (name fixture-key)))
+              (fn [var-map]
+                (let [base-direction (if isolated?
+                                       (cues/apply-merging-var-map var-map params/build-direction-param-from-pan-tilt)
+                                       (params/build-direction-param-from-pan-tilt
+                                        :pan (direction-cue-var-key "pan" shared-prefix)
+                                        :tilt (direction-cue-var-key "tilt" shared-prefix)))
+                      direction-param (if transform?
+                                        (params/build-direction-transformer
+                                         base-direction (keyword (str "direction-group-" shared-prefix "-transform")))
+                                        base-direction)]
+                  (move/direction-effect (str "P/T " (name fixture-key)
+                                              (when-not isolated?
+                                                (str " (Group " (clojure.string/upper-case shared-prefix)
+                                                     (when transform? " flip") ")")))
+                                         direction-param (show/fixtures-named fixture-key))))
+              :variables [(merge {:key (direction-cue-var-key "pan" shared-prefix) :name "Pan" :min -180.0 :max 180.0
+                                  :centered true :resolution 0.5}
+                                 (when isolated? {:start 0.0}))
+                          (merge {:key (direction-cue-var-key "tilt" shared-prefix) :name "Tilt" :min -180.0 :max 180.0
+                                  :centered true :resolution 0.5}
+                                 (when isolated? {:start 0.0}))]
+              :color color :priority 1)))
+
+(defn- make-main-direction-cues
+  "Create a page of cues for aiming lights in particular directions,
+  individually and in groups."
+  [page-x page-y]
+  (let [x-base (* page-x 8)
+        y-base (* page-y 8)
+        fixtures [:torrent-1 :torrent-2 :blade-1 :blade-2 :blade-3 :blade-4 :blade-5]
+        transform (Transform3D.)]
+
+    ;; Set up default shared direction coordinates
+    (show/set-variable! :direction-group-a-pan 0.0)
+    (show/set-variable! :direction-group-a-tilt 0.0)
+    (show/set-variable! :direction-group-b-pan 0.0)
+    (show/set-variable! :direction-group-b-tilt 0.0)
+
+    ;; Set up default transformation of a reflection over the Y axis
+    (.setScale transform (Vector3d. -1.0 1.0 1.0))
+    (show/set-variable! :direction-group-a-transform transform)
+    (show/set-variable! :direction-group-b-transform transform)
+
+    (loop [fixtures fixtures
+           index 0]
+      (when (seq fixtures)
+        (let [fixture (first fixtures)]
+          ;; Disconnected individual direction cues
+          (show/set-cue! (+ x-base index) y-base (build-direction-cue fixture nil false :white))
+          ;; Group A untransformed direction cues
+          (show/set-cue! (+ x-base index) (inc y-base) (build-direction-cue fixture "a" false :blue))
+          ;; Group A transformed direction cues
+          (show/set-cue! (+ x-base index) (+ y-base 2) (build-direction-cue fixture "a" true :cyan))
+          ;; Group B untransformed direction cues
+          (show/set-cue! (+ x-base index) (+ y-base 3) (build-direction-cue fixture "b" false :red))
+          ;; Group B transformed direction cues
+          (show/set-cue! (+ x-base index) (+ y-base 4) (build-direction-cue fixture "b" true :orange)))
+        (recur (rest fixtures) (inc index))))
+
+    ;; Transformation modifiers for group A
+    (show/set-cue! (+ x-base 7) (inc y-base)
+                   (cues/cue :direction-group-a-transform
+                             (fn [_]
+                               (let [transform (Transform3D.)]
+                                 (.setScale transform (Vector3d. 1.0 -1.0 1.0))
+                                 (var-fx/variable-effect @var-binder :direction-group-a-transform transform)))
+                             :color :cyan :short-name "Group B flip Y"))
+    (show/set-cue! (+ x-base 7) (+ y-base 2)
+                   (cues/cue :direction-group-a-transform
+                             (fn [_]
+                               (let [transform (Transform3D.)]
+                                 (.setScale transform (Vector3d. -1.0 -1.0 1.0))
+                                 (var-fx/variable-effect @var-binder :direction-group-a-transform transform)))
+                             :color :cyan :short-name "Group B flip XY"))
+
+    ;; Transformation modifiers for group B
+    (show/set-cue! (+ x-base 7) (+ y-base 3)
+                   (cues/cue :direction-group-b-transform
+                             (fn [_]
+                               (let [transform (Transform3D.)]
+                                 (.setScale transform (Vector3d. 1.0 -1.0 1.0))
+                                 (var-fx/variable-effect @var-binder :direction-group-b-transform transform)))
+                             :color :orange :short-name "Group B flip Y"))
+    (show/set-cue! (+ x-base 7) (+ y-base 4)
+                   (cues/cue :direction-group-b-transform
+                             (fn [_]
+                               (let [transform (Transform3D.)]
+                                 (.setScale transform (Vector3d. -1.0 -1.0 1.0))
+                                 (var-fx/variable-effect @var-binder :direction-group-b-transform transform)))
+                             :color :orange :short-name "Group B flip XY"))))
+
 (defn make-cues
   "Create a bunch of example cues for experimentation."
   []
@@ -1112,6 +1220,7 @@
   (make-torrent-cues 0 2)  ; Creates 2 8x8 pages: two pages up from the origin, and the next page to the right
   (make-ambient-cues 1 0)  ; Creates a single 8x8 page to the right of the origin
   (make-main-aim-cues 1 1)  ; Creates an 8x8 page above the ambient cues
+  (make-main-direction-cues 2 1)  ; Creates an 8x8 page to the right of that

   ;; Not sure what to do with the rest of this yet! Move or discard...
   ;; For now they are hardcoded to appear on the page above the origin.


Add nice configurable can-can cue.

Add nice configurable can-can cue.

--- src/afterglow/examples.clj
+++ src/afterglow/examples.clj
@@ -1011,6 +1011,42 @@
                    (cues/function-cue :snowball-pos :beams-fixed (show/fixtures-named "snowball")
                                       :effect-name "Snowball Fixed" :end-keys [:snowball-sound]))))

+(defn can-can
+  "A effect that moves the blades like they are in a kick line."
+  [& {:keys [bars cycles stagger spread pan-min pan-max tilt-min tilt-max]
+      :or {bars 1 cycles 1 stagger 0 spread 0 pan-min 0 pan-max 0 tilt-min -100 tilt-max 100}}]
+  (let [bars (params/bind-keyword-param bars Number 1)
+        cycles (params/bind-keyword-param cycles Number 1)
+        stagger (params/bind-keyword-param stagger Number 0)
+        spread (params/bind-keyword-param spread Number 0)
+        pan-min (params/bind-keyword-param pan-min Number 0)
+        pan-max (params/bind-keyword-param pan-max Number 0)
+        tilt-min (params/bind-keyword-param tilt-min Number -30)
+        tilt-max (params/bind-keyword-param pan-max Number 30)
+        pan-ratio (params/build-param-formula Number #(/ (* 4 %1) %2) bars cycles)
+        tilt-ratio (params/build-param-formula Number #(/ %1 %2) bars cycles)
+        fx (for [head [{:key :blade-1 :phase 0.0 :pan-offset 2}
+                       {:key :blade-2 :phase 0.2 :pan-offset 1}
+                       {:key :blade-3 :phase 0.6 :pan-offset -1}
+                       {:key :blade-4 :phase 0.8 :pan-offset -2}
+                       {:key :blade-5 :phase 0.4 :tilt-offset 45}]]
+             (let [head-phase (params/build-param-formula Number #(* % (:phase head 0)) stagger)
+                   tilt-osc (oscillators/sine :interval :bar :interval-ratio tilt-ratio :phase head-phase)
+                   head-tilt-min (params/build-param-formula Number #(+ % (:tilt-offset head 0)) tilt-min)
+                   head-tilt-max (params/build-param-formula Number #(+ % (:tilt-offset head 0)) tilt-max)
+                   tilt-param (oscillators/build-oscillated-param tilt-osc :min head-tilt-min
+                                                                  :max head-tilt-max)
+                   pan-osc (oscillators/sine :interval :bar :interval-ratio pan-ratio :phase head-phase)
+                   head-pan-min (params/build-param-formula Number #(+ %1 (* (:pan-offset head 0) %2))
+                                                            pan-min spread)
+                   head-pan-max (params/build-param-formula Number #(+ %1 (* (:pan-offset head 0) %2))
+                                                            pan-max spread)
+                   pan-param (oscillators/build-oscillated-param pan-osc :min head-pan-min
+                                                                 :max head-pan-max)
+                   direction (params/build-pan-tilt-param :pan pan-param :tilt tilt-param)]
+               (move/pan-tilt-effect "can can element" direction (show/fixtures-named (:key head)))))]
+    (apply fx/scene "Can Can" fx)))
+
 (defn make-movement-cues
   "Create a page of with some large scale and layered movement
   effects. And miscellany which I'm not totally sure what to do with
@@ -1040,7 +1076,7 @@
                                          {:key "z" :min -10 :max 10 :start -1.0}
                                          {:key "y" :min -10 :max 10 :start rig-height}
                                          {:key "x" :min -10 :max 10 :start 0.0}]
-                             :color :green))
+                             :color :green :end-keys [:move-blades :move-torrents]))

     (show/set-cue! (+ x-base 2) (+ y-base 2)
                    (cues/cue :movement (fn [var-map]
@@ -1052,10 +1088,10 @@
                                          {:key "z" :min 0 :max 20 :start 4}
                                        {:key "y" :min -10 :max 10 :start rig-height}
                                        {:key "x" :min -10 :max 10 :start 0.0}]
-                           :color :blue))
+                           :color :blue :end-keys [:move-blades :move-torrents]))

     ;; A chase which overlays on other movement cues, gradually taking over the lights
-    (show/set-cue! (+ x-base 2) (+ y-base 3)
+    (show/set-cue! (+ x-base 2) (+ y-base 6)
                    (cues/cue :crossover (fn [var-map] (cues/apply-merging-var-map var-map crossover-chase))
                              :variables [{:key "beats" :min 1 :max 8 :start 2 :type :integer :name "Beats"}
                                          {:key "fade-fraction" :min 0 :max 1 :start 0 :name "Fade"}
@@ -1125,7 +1161,8 @@
                                       [[17 15 {:pan-min 90.0 :pan-max 179.0 :pan-bars 2 :pan-phase 0.0
                                                :tilt-min 148.0 :tilt-max 255.0 :tilt-bars 1, :tilt-phase 0.0}]
                                        [16 15 {:pan-min 77.0 :pan-max 164.0 :pan-bars 2 :pan-phase 0.0
-                                               :tilt-min 148.0 :tilt-max 255.0, :tilt-bars 1, :tilt-phase 0.0}]]))))
+                                               :tilt-min 148.0 :tilt-max 255.0, :tilt-bars 1, :tilt-phase 0.0}]]))
+                             :end-keys [:movement]))

     (show/set-cue! (+ x-base 7) (+ y-base 2)
                    (cues/cue :move-torrents
@@ -1134,7 +1171,26 @@
                                       [[16 15 {:pan-min 77.0, :pan-max 164.0, :pan-bars 2, :pan-phase 0.5,
                                                :tilt-min 148.0, :tilt-max 255.0, :tilt-bars 1, :tilt-phase 0.25}]
                                        [17 15 {:pan-min 90.0, :pan-max 179.0, :pan-bars 2, :pan-phase 0.0,
-                                               :tilt-min 148.0, :tilt-max 255.0, :tilt-bars 1, :tilt-phase 0.0}]]))))
+                                               :tilt-min 148.0, :tilt-max 255.0, :tilt-bars 1, :tilt-phase 0.0}]]))
+                             :end-keys [:movement]))
+
+    (show/set-cue! (+ x-base 5) y-base
+                   (cues/cue :move-blades
+                             (fn [var-map] (cues/apply-merging-var-map var-map can-can))
+                             :variables [{:key "bars" :name "Bars" :min 1 :max 8 :type :integer :start 1}
+                                         {:key "cycles" :name "Cycles" :min 1 :max 8 :type :integer :start 1}
+                                         {:key "stagger" :name "Stagger" :min 0 :max 4 :start 0}
+                                         {:key "spread" :name "Spread" :min -45 :max 45
+                                          :centered true :resolution 0.25 :start 0}
+                                         {:key "pan-min" :name "Pan min" :min -180 :max 180
+                                          :centered true :resolution 0.5 :start 0}
+                                         {:key "pan-max" :name "Pan max" :min -180 :max 180
+                                          :centered true :resolution 0.5 :start 0}
+                                         {:key "tilt-min" :name "Tilt min" :min -180 :max 180
+                                          :centered true :resolution 0.5 :start -100}
+                                         {:key "tilt-max" :name "Tilt max" :min -180 :max 180
+                                          :centered true :resolution 0.5 :start 100}]
+                             :end-keys [:movement]))

     (show/set-cue! (+ x-base 6) (+ y-base 1)
                    (cues/cue :move-blades
@@ -1149,7 +1205,8 @@
                                        [19 15 {:pan-min 42.0, :pan-max 42.0, :pan-bars 1, :pan-phase 0.0,
                                                :tilt-min 0.0, :tilt-max 197.0, :tilt-bars 1, :tilt-phase 0.0}]
                                        [18 15 {:pan-min 42.0, :pan-max 42.0, :pan-bars 1, :pan-phase 0.0,
-                                               :tilt-min 0.0, :tilt-max 216.0, :tilt-bars 1, :tilt-phase 0.0}]]))))
+                                               :tilt-min 0.0, :tilt-max 216.0, :tilt-bars 1, :tilt-phase 0.0}]]))
+                             :end-keys [:movement]))

     (show/set-cue! (+ x-base 6) (+ y-base 2)
                    (cues/cue :move-blades
@@ -1164,7 +1221,8 @@
                                        [21 15 {:pan-min 42.0, :pan-max 42.0, :pan-bars 1, :pan-phase 0.0,
                                                :tilt-min 0.0, :tilt-max 197.0, :tilt-bars 1, :tilt-phase 0.6}]
                                        [22 15 {:pan-min 39.0, :pan-max 39.0, :pan-bars 1, :pan-phase 0.0,
-                                               :tilt-min 73.0, :tilt-max 248.0, :tilt-bars 1, :tilt-phase 0.8}]]))))
+                                               :tilt-min 73.0, :tilt-max 248.0, :tilt-bars 1, :tilt-phase 0.8}]]))
+                             :end-keys [:movement]))

     (show/set-cue! (+ x-base 6) (+ y-base 3)
                    (cues/cue :move-blades
@@ -1179,7 +1237,8 @@
                                        [19 15 {:pan-min 23.0, :pan-max 64.0, :pan-bars 4, :pan-phase 0.0,
                                                :tilt-min 0.0, :tilt-max 197.0, :tilt-bars 1, :tilt-phase 0.2}]
                                        [18 15 {:pan-min 23.0, :pan-max 64.0, :pan-bars 4, :pan-phase 0.0,
-                                               :tilt-min 0.0, :tilt-max 216.0, :tilt-bars 1, :tilt-phase 0.0}]]))))
+                                               :tilt-min 0.0, :tilt-max 216.0, :tilt-bars 1, :tilt-phase 0.0}]]))
+                             :end-keys [:movement]))

     (show/set-cue! (+ x-base 6) (+ y-base 7)
                    (cues/cue :center-rebel
@@ -1201,7 +1260,8 @@
                                        [21 15 {:pan-min 12.0, :pan-max 66.0, :pan-bars 4, :pan-phase 0.0,
                                                :tilt-min 170.0, :tilt-max 170.0, :tilt-bars 1, :tilt-phase 0.6}]
                                        [22 15 {:pan-min 12.0, :pan-max 66.0, :pan-bars 4, :pan-phase 0.0,
-                                               :tilt-min 230.0, :tilt-max 230.0, :tilt-bars 1, :tilt-phase 0.8}]]))))
+                                               :tilt-min 230.0, :tilt-max 230.0, :tilt-bars 1, :tilt-phase 0.8}]]))
+                             :end-keys [:movement]))

     (show/set-cue! (+ x-base 6) (+ y-base 5)
                    (cues/cue :move-blades
@@ -1216,7 +1276,8 @@
                                        [19 15 {:pan-min 12.0, :pan-max 66.0, :pan-bars 4, :pan-phase 0.2,
                                                :tilt-min 130.0, :tilt-max 130.0, :tilt-bars 1, :tilt-phase 0.2}]
                                        [18 15 {:pan-min 12.0, :pan-max 66.0, :pan-bars 4, :pan-phase 0.6,
-                                               :tilt-min 162.0, :tilt-max 162.0, :tilt-bars 1, :tilt-phase 0.0}]]))))))
+                                               :tilt-min 162.0, :tilt-max 162.0, :tilt-bars 1, :tilt-phase 0.0}]]))
+                             :end-keys [:movement]))))

 (defn- aim-cue-var-key
   "Determine the cue variable key value to use for a variable being
@@ -1375,39 +1436,40 @@
   "Build a raw pan/tilt oscillator cue."
   [fixture-key]
   (cues/cue (keyword (str "p-t-" (name fixture-key)))
-              (fn [var-map]
-                (let [pan-osc (oscillators/sine :interval :bar :interval-ratio (:pan-bars var-map)
-                                                :phase (:pan-phase var-map))
-                      pan-param (oscillators/build-oscillated-param pan-osc :min (:pan-min var-map)
-                                                                    :max (:pan-max var-map))
-                      tilt-osc (oscillators/sine :interval :bar :interval-ratio (:tilt-bars var-map)
-                                                :phase (:tilt-phase var-map))
+            (fn [var-map]
+              (let [pan-osc (oscillators/sine :interval :bar :interval-ratio (:pan-bars var-map)
+                                              :phase (:pan-phase var-map))
+                    pan-param (oscillators/build-oscillated-param pan-osc :min (:pan-min var-map)
+                                                                  :max (:pan-max var-map))
+                    tilt-osc (oscillators/sine :interval :bar :interval-ratio (:tilt-bars var-map)
+                                               :phase (:tilt-phase var-map))
                       tilt-param (oscillators/build-oscillated-param tilt-osc :min (:tilt-min var-map)
-                                                                    :max (:tilt-max var-map))]
-                  (fx/scene (str "P/T " (name fixture-key))
-                            (chan-fx/channel-effect
-                             "pan" pan-param
-                             (afterglow.channels/extract-channels (show/fixtures-named fixture-key)
-                                                                  #(= (:type %) :pan)))
-                            (chan-fx/channel-effect
-                             "tilt" tilt-param
-                             (afterglow.channels/extract-channels (show/fixtures-named fixture-key)
-                                                                  #(= (:type %) :tilt))))))
-              :variables [{:key "pan-min" :name "Pan min" :min 0 :max 255
-                           :centered true :resolution 0.5 :start 0}
-                          {:key "pan-max" :name "Pan max" :min 0 :max 255
-                           :centered true :resolution 0.5 :start 255}
-                          {:key "pan-bars" :name "Pan bars" :min 1 :max 16
-                           :type :integer :start 1}
-                          {:key "pan-phase" :name "Pan phase" :min 0.0 :max 1.0 :start 0.0}
-                          {:key "tilt-min" :name "Tilt min" :min 0 :max 255
-                           :centered true :resolution 0.5 :start 0}
-                          {:key "tilt-max" :name "Tilt max" :min 0 :max 255
-                           :centered true :resolution 0.5 :start 255}
-                          {:key "tilt-bars" :name "Tilt bars" :min 1 :max 16
-                           :type :integer :start 1}
-                          {:key "tilt-phase" :name "Tilt phase" :min 0.0 :max 1.0 :start 0.0}]
-              :color :green :priority 1))
+                                                                     :max (:tilt-max var-map))]
+                (fx/scene (str "P/T " (name fixture-key))
+                          (chan-fx/channel-effect
+                           "pan" pan-param
+                           (chan/extract-channels (chan/expand-heads
+                                                   (show/fixtures-named fixture-key))
+                                                  #(= (:type %) :pan)))
+                          (chan-fx/channel-effect
+                           "tilt" tilt-param
+                           (chan/extract-channels (chan/expand-heads (show/fixtures-named fixture-key))
+                                                  #(= (:type %) :tilt))))))
+            :variables [{:key "pan-min" :name "Pan min" :min 0 :max 255
+                         :centered true :resolution 0.5 :start 0}
+                        {:key "pan-max" :name "Pan max" :min 0 :max 255
+                         :centered true :resolution 0.5 :start 255}
+                        {:key "pan-bars" :name "Pan bars" :min 1 :max 16
+                         :type :integer :start 1}
+                        {:key "pan-phase" :name "Pan phase" :min 0.0 :max 1.0 :start 0.0}
+                        {:key "tilt-min" :name "Tilt min" :min 0 :max 255
+                         :centered true :resolution 0.5 :start 0}
+                        {:key "tilt-max" :name "Tilt max" :min 0 :max 255
+                         :centered true :resolution 0.5 :start 255}
+                        {:key "tilt-bars" :name "Tilt bars" :min 1 :max 16
+                         :type :integer :start 1}
+                        {:key "tilt-phase" :name "Tilt phase" :min 0.0 :max 1.0 :start 0.0}]
+            :color :green :priority 1))

 (defn- make-main-direction-cues
   "Create a page of cues for aiming lights in particular directions,


Changes in code style

Changes in code style

--- src/airhead_cljs/core.cljs
+++ src/airhead_cljs/core.cljs
@@ -3,10 +3,11 @@
   (:require [reagent.core :as r :refer [atom]]
             [ajax.core :refer [GET POST PUT]]))

-(defn get-json [url handler params]
-  (GET url {:handler handler
-            :params params
-            :response-format :json}))
+(defn get-json
+  ([url handler] (get-json url handler []))
+  ([url handler params] (GET url {:handler handler
+                                  :params params
+                                  :response-format :json})))

 ;; -------------------------
 ;; Views
@@ -15,22 +16,29 @@
   [:span (str (track "artist") " - " (track "title"))])

+(defn stream-section [url]
+  [:div
+   [:p [:audio {:src url :controls "controls"}]]
+   [:p [:a {:href url} url]]])
+
+
 (defn current-track-section []
   (let [current-track (atom {})
-        reset #(reset! current-track (% "track"))
-        get-track #(get-json "/api/queue/current" reset {})]
+        reset         #(reset! current-track (% "track"))
+        get-track     #(get-json "/api/queue/current" reset)]
+    (js/setTimeout get-track 1000)
     (fn []
-      (js/setTimeout get-track 1000)
       [:div
-       [:strong "Now playing: "] [track-span @current-track]])))
+       [track-span @current-track]])))

 (defn playlist-section []
-  (let [playlist (atom [])
-        reset #(reset! playlist (% "items"))
-        get-playlist #(get-json "/api/queue" reset {})]
+  (let [playlist     (atom [])
+        reset        #(reset! playlist (% "items"))
+        get-playlist #(get-json "/api/queue" reset)]
+    (js/setTimeout get-playlist 1000)
     (fn []
-      (js/setTimeout get-playlist 1000)
-      [:div [:h2 "Playlist"]
+      [:div
+       [:h2 "Playlist"]
        [:ul (for [track @playlist]
               [:li (track-span track)])]])))

@@ -46,42 +54,48 @@
           [track-span track]])])

 (defn post-track []
-  (let [form (.getElementById js/document "upload-form")]
+  ;; TODO: do not use element id
+  (let [form (.getElementById js/document
+                              "upload-form")]
     (POST "/api/tracks" {:enc-type "multipart/form-data"
                          :body (js/FormData. form)})))

 (defn upload-form []
   [:form {:id "upload-form"}
-   [:input {:type "file" :name "track"}]
-   [:input {:type "button" :value "Upload"
+   [:input {:type "file"
+            :name "track"}]
+   [:input {:type "button"
+            :value "Upload"
             :on-click post-track}]])

 (defn tracks-section []
   (let [tracks (atom [])
-        query (atom "")
         reset-tracks #(reset! tracks (% "items"))
-        get-tracks (fn []
-                     (get-json "/api/tracks" reset-tracks
-                               {:q @query}))
+        get-tracks   #(get-json "/api/tracks"
+                                reset-tracks
+                                {:q %})
+        query  (atom "")
         reset-query (fn [e]
                       (reset! query (-> e .-target .-value))
-                      (get-tracks))]
-    (get-tracks)
+                      (get-tracks @query))]
+    (get-tracks @query)
     (fn []
-      [:div [:h2 "Tracks"]
-       [:input {:type "text" :value @query
+      [:div
+       [:h2 "Tracks"]
+       [:input {:type "text"
+                :value @query
                 :on-change reset-query}]
        [tracks-list tracks]
        [upload-form]])))

 (defn home-page []
   (let [info (atom {})]
-    (get-json "/api/info" #(reset! info %) {})
+    (get-json "/api/info" #(reset! info %))
     (fn []
-      [:div [:h1 (@info "name")]
-       [:p (@info "greet_message")]
-       [:p [:audio {:src (@info "stream_url")
-                :controls "controls"}]]
+      [:div
+       [:h1 (@info "name")]
+       [:p  (@info "greet_message")]
+       [stream-section (@info "stream_url")]
        [current-track-section]
        [playlist-section]
        [tracks-section]])))


More simplification

More simplification

--- test/github_changelog/github_test.clj
+++ test/github_changelog/github_test.clj
@@ -2,7 +2,7 @@
   (:require
     [github-changelog.github :as github]
     [github-changelog.schema :refer [Config Pull Sha]]
-    [github-changelog.schema-generators :as g]
+    [github-changelog.schema-generators :refer [generate sample]]
     [github-changelog.schema-complete :refer [complete]]
     [clojure.test :refer :all]
     [clojure.set :refer [subset?]]
@@ -21,7 +21,7 @@
   (is (= api-endpoint (github/pulls-url config))))

 (deftest parse-pull
-  (let [sha (g/generate Sha)
+  (let [sha (generate Sha)
         example-json {:number 1
                       :html_url ""
                       :title "Something"
@@ -46,9 +46,9 @@
         (is (= body (github/get-pulls config))))))

   (testing "with multiple pages"
-    (let [first-body (g/sample 10 Pull)
+    (let [first-body (sample 10 Pull)
           links {:last {:href "?page=2"}}
-          second-body (g/sample 10 Pull)]
+          second-body (sample 10 Pull)]
       (with-fake-routes-in-isolation
         {{:address api-endpoint :query-params {:state "closed"}} (mocked-response-fn first-body {:links links})
          {:address api-endpoint :query-params {:state "closed" :page "2"}} (mocked-response-fn second-body)}


Add handler-test for latest endpoint

Add handler-test for latest endpoint

--- test/lambdacd_artifacts/core_test.clj
+++ test/lambdacd_artifacts/core_test.clj
@@ -92,12 +92,17 @@
         pipeline (pipeline-with-homedir home-dir)
         handler  (artifact-handler-for pipeline)]
     (spit (file-path-for home-dir 1 "2-3" "some-file") "hello world")
+    (spit (file-path-for home-dir 12 "2-3" "some-file") "hello world again")
     (spit (file-path-for home-dir 1 "2-3" "some-sub-folder" "some-file") "hello world from subfolder")

     (testing "that it returns existing artifacts correctly"
       (let [response (handler (mock/request :get "/1/2-3/some-file"))]
         (is (= 200 (:status response)))
         (is (= (file-path-for home-dir 1 "2-3" "some-file") (:body response)))))
+    (testing "that it returns the latest artifacts correctly"
+      (let [response (handler (mock/request :get "/latest/2-3/some-file"))]
+        (is (= 200 (:status response)))
+        (is (= (file-path-for home-dir 12 "2-3" "some-file") (:body response)))))
     (testing "that it returns existing artifacts in subfolders correctly"
       (let [response (handler (mock/request :get "/1/2-3/some-sub-folder/some-file"))]
         (is (= 200 (:status response)))


Fix clean-ns sometimes blowing up on :refer :all

--- src/refactor_nrepl/ns/dependencies.clj
+++ src/refactor_nrepl/ns/dependencies.clj
@@ -100,8 +100,10 @@
 (defn- find-symbol-ns [libspecs sym]
   (some->> libspecs
            (filter (fn [{:keys [refer refer-macros] :as libspec}]
-                     (or (some (partial = (symbol sym)) refer)
-                         (some (partial = (symbol sym)) refer-macros))))
+                     (or
+                      (and (sequential? refer)
+                           (some (partial = (symbol sym)) refer))
+                      (some (partial = (symbol sym)) refer-macros))))
            first
            :ns))


escape single quotes when logging

escape single quotes when logging

--- storm-core/src/clj/backtype/storm/daemon/supervisor.clj
+++ storm-core/src/clj/backtype/storm/daemon/supervisor.clj
@@ -475,7 +475,9 @@
                      port
                      worker-id])
           command (->> command (map str) (filter (complement empty?)))
-          shell-cmd (->> command (map #(str \' % \')) (clojure.string/join " "))]
+          shell-cmd (->> command
+                         (map #(str \' (clojure.string/escape % {\' "\\'"}) \'))
+                         (clojure.string/join " "))]
       (log-message "Launching worker with command: " shell-cmd)
       (launch-process command :environment {"LD_LIBRARY_PATH" (conf JAVA-LIBRARY-PATH)})
       ))


intermediate chanel

intermediate chanel

--- src/ca_recipe/pipeline.clj
+++ src/ca_recipe/pipeline.clj
@@ -17,3 +17,18 @@
   [in out]
   (let [xf (comp parse-words interesting score)]
     (async/pipeline 4 out xf in)))
+
+(defn interesting-stage
+  [in intermediate]
+  (let [xf (comp parse-words interesting)]
+    (async/pipeline 4 intermediate xf in)))
+
+(defn score-stage
+  [intermediate out]
+  (async/pipeline 1 out score intermediate))
+
+(defn assemble-stages
+  [in out]
+  (let [intermediate (async/chan 100)]
+    (interesting-stage in intermediate)
+    (score-stage intermediate out)))


Whitespace fixes

Whitespace fixes

--- src/catalog/layout/fop.clj
+++ src/catalog/layout/fop.clj
@@ -538,7 +538,7 @@
    (simple-page-master {:master-name "verso"})
    (simple-page-master {:master-name "blank"})
    (simple-page-master {:master-name "first"})
-
+
    [:fo:page-sequence-master {:master-name "main"}
     [:fo:repeatable-page-master-alternatives
      [:fo:conditional-page-master-reference
@@ -602,7 +602,7 @@
                            :language "de"}
         (header :recto)
         (header :verso)
-
+
         (let [subitems (-> items
                            (get fmt)
                            (assoc :editorial editorial
@@ -625,7 +625,7 @@
                          :language "de"}
       (header :recto)
       (header :verso)
-
+
       (let [subitems (-> items
                          ;; remove all formats but fmt. Unfortunately we
                          ;; cannot use select-keys as we need to retain


Fix the issue indents once and for all

Fix the issue indents once and for all

--- src/catalog/layout/fop.clj
+++ src/catalog/layout/fop.clj
@@ -516,10 +516,9 @@
   "Mapping of indents for each issue."
   ;; In theory the issue numbers should be centered properly within the
   ;; circle. Somehow this doesn't seem to pan out, so we resort to
-  ;; fidget with the indent for each issue.
+  ;; fidget with the indent for some issues.
   {3 "143mm"
-   4 "140mm"
-   5 "142mm"})
+   4 "140mm"})

 (defn- coverpage-recto
   "Return a hiccup style sexp for the recto (the front) of the
@@ -583,7 +582,7 @@
                :role "H2"}
               (layout/format-date year issue))]
       [:fo:block-container {:absolute-position "fixed" :width "53mm" :height "53mm"
-                            :left (issue-indent issue "140mm") :top "119mm" :display-align "center"
+                            :left (issue-indent issue "142mm") :top "119mm" :display-align "center"
                             :background-color "transparent"}
        (block {:font-size "120pt" :color (color :white)
                :text-align "center"


put in stub for redis, but still be able to aot compile

--- src/chat/server/invite.clj
+++ src/chat/server/invite.clj
@@ -21,14 +21,25 @@
                  :spec {:host "127.0.0.1"
                         :port 6379}})

+(def prod? (= (env :environment) "prod"))
+(def dev-cache
+  "Cache used in place of redis when running in dev/demo mode"
+  (atom {}))
+
 (defn cache-set! [k v]
-  (car/wcar redis-conn (car/set k v)))
+  (if prod?
+    (car/wcar redis-conn (car/set k v))
+    (swap! cache assoc k v)))

 (defn cache-get [k]
-  (car/wcar redis-conn (car/get k)))
+  (if prod?
+    (car/wcar redis-conn (car/get k))
+    (@cache k)))

 (defn cache-del! [k]
-  (car/wcar redis-conn (car/del k)))
+  (if prod?
+    (car/wcar redis-conn (car/del k))
+    (swap! cache dissoc k)))

 (defn random-nonce
   "url-safe random nonce"


only include names if we have them - not quite right yet

--- src/clj/cljs/sourcemap.clj
+++ src/clj/cljs/sourcemap.clj
@@ -11,17 +11,20 @@
     :source (nth (:sources source-map) source)
     :line   line
     :col    col
-    :name   (when name
+    :name   (if-let [name (-> seg meta :name)]
               (nth (:names source-map) name))}))

 (defn seg-combine [seg relseg]
   (let [[gcol source line col name] seg
-        [rgcol rsource rline rcol rname] relseg]
-    [(+ gcol rgcol)
-     (+ (or source 0) rsource)
-     (+ (or line 0) rline)
-     (+ (or col 0) rcol)
-     (+ (or name 0) rname)]))
+        [rgcol rsource rline rcol rname] relseg
+        nseg [(+ gcol rgcol)
+              (+ (or source 0) rsource)
+              (+ (or line 0) rline)
+              (+ (or col 0) rcol)
+              (+ (or name 0) rname)]]
+    (if name
+      (with-meta nseg {:name (+ name rname)})
+      nseg)))

 (defn decode
   ([source-map]
@@ -35,9 +38,11 @@
                                        (update-in m [(:line segmap)]
                                          (fnil (fn [m]
                                                  (assoc m (:col segmap)
-                                                   {:gline gline
-                                                    :gcol (:gcol segmap)
-                                                    :name (:name segmap)}))
+                                                   (let [d {:gline gline
+                                                            :gcol (:gcol segmap)}]
+                                                     (if-let [name (:name segmap)]
+                                                       (assoc d :name name)
+                                                       d))))
                                                (sorted-map))))
                                      (sorted-map)))))
            lines (seq (string/split mappings #";"))]


Fixing some compile errors for canon

Fixing some compile errors for canon

--- src/clj/minijava/canon.clj
+++ src/clj/minijava/canon.clj
@@ -3,9 +3,87 @@

 (defmulti cannon (fn [x] (type x)))

+(defn isit? [x t]
+(= (type x) t)
+)
+
+(defn nopNull (list (Exp (Const 0))))
+
+(defn reorder [exps]
+	(cond
+			(empty? exps)
+						(nopNull)
+			 (true)
+			 		   (let ((a (first exps)))
+			 		   (cond (isit? a :minijava.ir/Call)
+			 		   			 (let ((t (minijava.ir.temp.Temp))
+			 		   			 				(e (ExpSeq (Move (Temp t) a) (Temp t))))
+			 		   			 		(reorder (cons e (rest exps)))
+			 		   			 )
+			 		   			 (true)
+			 		   			 (let ((aa (cannonExp a))
+			 		   			 				(bb (reorder (rest exps))))
+			 		   			       (cond (commute? (:stm bb) (:exp aa))
+			 		   			       							(list (make-seq (:stm aa) (:stm bb)) (cons (:exp aa) (:exps bb)))
+			 		   			       				(true)
+			 		   			       			  (let ((t (minijava.ir.temp.Temp)))
+			 		   			       			  (list (make-seq (:stm aa) (make-seq (Move (Temp t) (:exp aa)) (:stm bb)) (cons (Temp t) (:exps bb)) ))
+			 		   			       )
+			 		   			 ))
+			 		   )
+
+			 		   )
+	)
+
+)
+
+
+(defn reorderExpCall [x]
+	(reorder x) ;;this is likely wrong
+
+)
+
+(defn reorderCallMove [x]
+	(reorder x) ;;this is likely wrong
+
+)
+
+
+
+
+(defn reorderExp [x]
+	(let ((r (reorder (kids e))))
+	(ExpSeq (:stm x) (build e (:exps x)))
+	)
+)
+
+(defn reorderStm [x]
+	(let ((r (reorder (kids e))))
+	(ExpSeq (:stm x) (build e (:exps x)))
+	)
+)
+
+(defn linear [s lst]
+  (linear (first (:seqs s)) (linear (rest (:seqs s)) lst)) )
+)
+
+(defn linear [s lst]
+	(cond (isit? minijava.ir/Seq)
+				(linear (s l))
+				(true)
+				(cons s l)
+	)
+
+)
+
+(defn linearize [s]
+	(linear (cannon s) '()))
+)
+
+

  (defn isNop [a]
-  (and (isa? a :minijava.ir/Statement) (isa? (:exp a) :minijava.ir/Const))
+  (and (isit? a :minijava.ir/Statement) (isit? (:exp a) :minijava.ir/Const))
   )

  (defn make-seq [a b]
@@ -23,9 +101,9 @@
 (defmethod cannon :minijava.ir/Move
   [x]
   (cond
-  	(and ( isa? (:dst x ) :minijava.ir/Temp) ( isa? (:src x ) :minijava.ir/Call) )
+  	(and ( isit? (:dst x ) :minijava.ir/Temp) ( isit? (:src x ) :minijava.ir/Call) )
   			(reorderCallMove (:dst x ) (:src x ))
-  	 (isa? (:dst x) :minijava.ir/ExpSeq)
+  	 (isit? (:dst x) :minijava.ir/ExpSeq)
   	 		 (cannon (Seq (:seqs (:dst x)) (Move (:exp (:dst x)) (:src x)) ) )
   	 (true (reorderStm x) )

@@ -36,7 +114,7 @@
 (defmethod cannon :minijava.ir/Statement
   [x]
   (cond
-  	 (isa? (:exp x) :minijava.ir/Call)
+  	 (isit? (:exp x) :minijava.ir/Call)
   	 			(reorderExpCall (:exp x))
   	 	(true (reorderStm x))
   )
@@ -65,76 +143,5 @@
  )

-(defn reorderExpCall [x]
-
-
-)
-
-(defn reorderCallMove [x]
-
-
-)

-(defn reorderExp [x]
-	(let ((r (reorder (kids e))))
-	(ExpSeq (:stm x) (build e (:exps x)))
-	)
-)
-
-(defn reorderStm [x]
-	(let ((r (reorder (kids e))))
-	(ExpSeq (:stm x) (build e (:exps x)))
-	)
-)
-
-(defn nopNull (list (Exp (Const 0))))
-
-(defn reorder [exps]
-	(cond
-			(empty? exps)
-						(nopNull)
-			 (true)
-			 		   (let ((a (first exps)))
-			 		   (cond (isa? a :minijava.ir/Call)
-			 		   			 (let ((t (minijava.ir.temp.Temp))
-			 		   			 				(e (ExpSeq (Move (Temp t) a) (Temp t))))
-			 		   			 		(reorder (cons e (rest exps)))
-			 		   			 )
-			 		   			 (true)
-			 		   			 (let ((aa (cannonExp a))
-			 		   			 				(bb (reorder (rest exps))))
-			 		   			       (cond (commute? (:stm bb) (:exp aa))
-			 		   			       							(list (make-seq (:stm aa) (:stm bb)) (cons (:exp aa) (:exps bb)))
-			 		   			       				(true)
-			 		   			       			  (let ((t (minijava.ir.temp.Temp)))
-			 		   			       			  (list (make-seq (:stm aa) (make-seq (Move (Temp t) (:exp aa)) (:stm bb)) (cons (Temp t) (:exps bb)) ))
-			 		   			       )
-			 		   			 ))
-			 		   )
-
-			 		   )
-	)
-
-)
-
-(defn linear [s lst]
-  (linear (first (:seqs s)) (linear (rest (:seqs s)) lst)) )
-)
-
-(defn linear [s lst]
-	(cond (isa? minijava.ir/Seq)
-				(linear (s l))
-				(true)
-				(cons s l)
-	)
-
-)
-
-(defn linearize [s]
-	(linear (cannon s) '()))
-)
-
-
-
-


Make the number of threads of convert changeable

--- src/cljam/algo/convert.clj
+++ src/cljam/algo/convert.clj
@@ -1,6 +1,8 @@
 (ns cljam.algo.convert
   "Format converter from SAM to BAM, and vice versa."
-  (:require [cljam.io.sam :as sam]
+  (:require [clojure.tools.logging :as logging]
+            [cljam.common :refer [*n-threads* get-exec-n-threads]]
+            [cljam.io.sam :as sam]
             [cljam.io.bam.encoder :as encoder]
             [cljam.io.sam.util :as sam-util]
             [cljam.io.util :as io-util]
@@ -11,20 +13,22 @@
 (def ^:private default-num-block 100000)

 (defn- sam-write-alignments [rdr wtr hdr num-block]
+  (when (and (pos? *n-threads*) (> (get-exec-n-threads) 1))
+    (logging/warn "Concurrent SAM writing is not supported."))
   (doseq [alns (partition-all num-block (sam/read-alignments rdr {}))]
     (sam/write-alignments wtr alns hdr)))

 (defn- bam-write-alignments [rdr wtr hdr num-block]
-  (let [refs (sam-util/make-refs hdr)]
-    (cp/with-shutdown! [pool (cp/threadpool (cp/ncpus))]
-      (doseq [blocks (cp/pmap pool
-                              (fn [chunk]
-                                (mapv #(let [bb (ByteBuffer/allocate (encoder/get-block-size %))]
-                                         (encoder/encode-alignment bb % refs)
-                                         {:data (.array bb)})
-                                      chunk))
-                              (partition-all num-block (sam/read-alignments rdr {})))]
-        (sam/write-blocks wtr blocks)))))
+  (let [refs (sam-util/make-refs hdr)
+        n-threads (get-exec-n-threads)]
+    (doseq [blocks (cp/pmap (if (= n-threads 1) :serial (dec n-threads))
+                            (fn [chunk]
+                              (mapv #(let [bb (ByteBuffer/allocate (encoder/get-block-size %))]
+                                       (encoder/encode-alignment bb % refs)
+                                       {:data (.array bb)})
+                                    chunk))
+                            (partition-all num-block (sam/read-alignments rdr {})))]
+      (sam/write-blocks wtr blocks))))

 (defn- _convert!
   [rdr wtr num-block write-alignments-fn]
@@ -35,12 +39,13 @@

 (defn convert
   "Converts file format from input file to output file by the file extension."
-  [in out & {:keys [num-block]
-             :or {num-block default-num-block}}]
+  [in out & {:keys [n-threads num-block]
+             :or {n-threads 0, num-block default-num-block}}]
   (with-open [rdr (sam/reader in)
               wtr (sam/writer out)]
-    (cond
-      (io-util/sam-writer? wtr) (_convert! rdr wtr num-block sam-write-alignments)
-      (io-util/bam-writer? wtr) (_convert! rdr wtr num-block bam-write-alignments)
-      :else (throw (ex-info (str "Unsupported output file format " out) {}))))
+    (binding [*n-threads* n-threads]
+      (cond
+        (io-util/sam-writer? wtr) (_convert! rdr wtr num-block sam-write-alignments)
+        (io-util/bam-writer? wtr) (_convert! rdr wtr num-block bam-write-alignments)
+        :else (throw (ex-info (str "Unsupported output file format " out) {})))))
   nil)


Added dorian

Added dorian

--- src/cljs/guitar1/neck.cljs
+++ src/cljs/guitar1/neck.cljs
@@ -15,6 +15,8 @@
   '(true false true false true true false true false true false true))
 (def aeolian
   '(true false true true false true false true true false true false))
+(def dorian
+  '(true false true true false true false true false true true false))
 (def pentatonic-minor
   '(true false false true false true false true false false true false))

@@ -71,6 +73,7 @@
    [:button {:on-click #(set-scale pentatonic-minor)} "Pentatonic Minor"]
    [:button {:on-click #(set-scale ionian)} "Ionian"]
    [:button {:on-click #(set-scale aeolian)} "Aeolian"]
+   [:button {:on-click #(set-scale dorian)} "Dorian"]
    (conj (map build-string (reverse strings))
          [:ul.string.frets (map #(vector :li %) (into [] (range 24)))])])


Use brackets to bump up/down brush size

Use brackets to bump up/down brush size

--- src/cljs/pizarra/core.cljs
+++ src/cljs/pizarra/core.cljs
@@ -107,7 +107,7 @@
                (dom/input #js {:type "text"
                                :value (:lineWidth tools)
                                :onChange (fn [e]
-                                           (om/update! tools [:lineWidth] (.-value (.-currentTarget e))))})
+                                           (om/update! tools [:lineWidth] (js/parseInt (.-value (.-currentTarget e)))))})
                (dom/input #js {:type "text"
                                :value (:strokeStyle tools)
                                :onChange (fn [e]
@@ -166,15 +166,18 @@
                             (swap! app-state update-in [:canvas] stop-drawing)
                             (undo/push-onto-undo-stack @app-state)))

-(defn bind-number [nkey width]
-  (.bind js/Mousetrap
-         (str nkey)
-         (fn []
-           (swap! app-state update-in [:tools] assoc :lineWidth width))))
+(defn bounded-bump [f n]
+  (let [m (f n)]
+    (if (> m 0)
+      m
+      n)))

-(doseq [i (range 1 10)]
-  (bind-number i i))
-(bind-number 0 10)
+(.bind js/Mousetrap "["
+       (fn [] (swap! app-state update-in [:tools :lineWidth] (partial bounded-bump dec))))
+
+(.bind js/Mousetrap "]"
+       (fn [] (swap! app-state update-in [:tools :lineWidth] (partial bounded-bump inc))))
+

 (comment


Cosmetic changes

Cosmetic changes

--- src/cljs/replumb/repl.cljs
+++ src/cljs/replumb/repl.cljs
@@ -218,25 +218,25 @@

 (defn make-load-fn
   "Makes a load function that will read from a sequence of src-paths
-  using a supplied read-file-fn. It returns a cljs.js-compatible
+  using a supplied read-file-fn!. It returns a cljs.js-compatible
   *load-fn*.

-  Read-file-fn is an async 2-arity function (fn [file-path src-cb] ...)
-  where src-cb is itself a function (fn [source] ...) that needs to be
-  called with the full source of the library (as string)."
-  [verbose? src-paths read-file-fn]
+  Read-file-fn! is an async 2-arity function with signature [file-path
+  src-cb] where src-cb is itself a function (fn [source] ...) that needs
+  to be called with the full source of the library (as string)."
+  [verbose? src-paths read-file-fn!]
   (fn [{:keys [name macros path] :as load-map} cb]
     (cond
       (load/skip-load? load-map) (load/fake-load-fn! load-map cb)
       (re-matches #"^goog/.*" path) (if-let [goog-path (get-goog-path name)]
                                       (load/read-files-and-callback! verbose?
                                                                      (load/goog-file-paths-to-try src-paths goog-path)
-                                                                     read-file-fn
+                                                                     read-file-fn!
                                                                      cb)
                                       (cb nil))
       :else (load/read-files-and-callback! verbose?
                                            (load/file-paths-to-try src-paths macros path)
-                                           read-file-fn
+                                           read-file-fn!
                                            cb))))

 ;;;;;;;;;;;;;;;;
@@ -270,12 +270,12 @@
   [opts user-opts]
   (assoc opts :load-fn!
          (or (:load-fn! user-opts)
-             (let [read-file-fn (:read-file-fn! user-opts)
+             (let [read-file-fn! (:read-file-fn! user-opts)
                    src-paths (:src-paths user-opts)]
-               (if (and read-file-fn (sequential? src-paths))
+               (if (and read-file-fn! (sequential? src-paths))
                  (make-load-fn (:verbose user-opts)
                                (into [] src-paths)
-                               read-file-fn)
+                               read-file-fn!)
                  (when (:verbose user-opts)
                    (common/debug-prn "Invalid :read-file-fn! or :src-paths (is it a valid sequence?). Cannot create *load-fn*.")))))))


Add hover-hex track in the style of selected-hex

--- src/cljs/zetawar/subs.cljs
+++ src/cljs/zetawar/subs.cljs
@@ -561,3 +561,12 @@

 (deftrack configuring-new-game? [conn]
   (:app/configuring-new-game @(app conn)))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;; Tile coordinates
+
+(deftrack hover-hex [conn]
+  (-> @(app conn)
+      (select-values [:app/hover-q
+                      :app/hover-r])
+      not-empty))


Write macro for index access (settting and getting) with automated type hinting (only the NDArray object)  and error reporting for both indices and ndims

--- src/clojure/gpu/matrix.clj
+++ src/clojure/gpu/matrix.clj
@@ -3,7 +3,8 @@
 (ns gpu.matrix
   (:require [clojure.core.matrix.protocols :as mp]
             [clojure.core.matrix :as m]
-            [clojure.core.matrix.utils :refer [error]])
+            [clojure.core.matrix.utils :refer [error]]
+            [clojure.string :as str])
   (:import gpu.matrix.NDArray))

 (set! *warn-on-reflection* true)
@@ -57,61 +58,132 @@
                     (dec ndims) ", but got " dimension-number "instead!"))
         (aget shape dimension-number)))))

+(defn all?
+  ([coll]
+   (every? true? coll))
+  ([f coll]
+   (every? true? (mapv f coll))))
+
+(defn in-bound? [^long idx ^long len]
+  (and (>= idx 0) (< idx len)))
+
+(defmacro with-check-indices [ndims m & args]
+   (let [row (gensym "row_")
+         col (gensym "col_")
+         indexes (gensym "indexes_")
+         check-clause
+         (cond (= ndims 1)
+               `(and (>= ~row 0)
+                     (< ~row (first (mp/get-shape ~m))))
+               (= ndims 2)
+               `(let [shape# (mp/get-shape ~m)]
+                 (and (>= ~row 0)
+                      (< ~row (first shape#))
+                      (>= ~col 0)
+                      (< ~col (second shape#))))
+               :else
+               `(let [shape# (mp/get-shape ~m)]
+                  (all? (map-indexed
+                          (fn [dim# idx#]
+                            (and (>= idx# 0)
+                                 (< idx# (nth shape# dim#))))
+                          ~indexes))))
+         body
+         (cond (= ndims 2)
+               (next (next args))
+               :else
+               (next args))
+         all-indexes
+         (cond (= ndims 1)
+               `[~(first args)]
+               (= ndims 2)
+               `[~(first args) ~(second args)]
+               :else
+               (first args))]
+    `(let ~(cond
+             (= ndims 1)
+             `[~row ~(first args)]
+             (= ndims 2)
+             `[~row ~(first args)
+               ~col ~(second args)]
+             :else
+             `[~indexes ~(first args)])
+       (if ~check-clause
+         (do ~@body)
+         (error
+           (str
+             "Index Error occured while trying to access the following:\n"
+             (->> (reduce (fn [memo# [dim# dim-count# idx#]]
+                            (if (in-bound? idx# dim-count#)
+                              memo#
+                              (conj memo# [dim# dim-count# idx#])))
+                           []
+                           (map vector
+                                (range (mp/dimensionality ~m))
+                                (mp/get-shape ~m)
+                                ~all-indexes))
+                  (map (fn [[dim# dim-count# idx#]]
+                         (str "-- index " idx# " of dimension " dim#
+                              " , where the dimension-count of the dimensions is only " dim-count#)))
+                  (str/join "\n"))
+             "\n"))))))
+
+(defmacro with-check-ndims [ndims m & body]
+  `(if (= ~ndims (.dimensionality ~m))
+     (do ~@body)
+     (error
+       (str "Invalid dimension! Expecting dimension " (.dimensionality ~m) " "
+            "but got " ~ndims " instead"))))
+
+(defmacro with-check-shape [ndims [m-sym m] & body]
+  `(let [~(with-meta m-sym {:tag NDArray}) ~m]
+     (with-check-ndims ~ndims ~m-sym
+       (with-check-indices ~ndims ~m-sym
+         ~@body))))
+
 (extend-protocol mp/PIndexedAccess
   NDArray
-  (get-1d [^NDArray m row]
-    (let [ndims (.dimensionality m)
-          row (long row)]
-      (if (= ndims 1)
-        (.get m row)
-        (error "Invalid shape!"))))
-  (get-2d [^NDArray m row col]
-    (let [ndims (.dimensionality m)
-          row (long row)
-          col (long col)]
-      (if (= ndims 2)
-        (.get m row col)
-        (error "Invalid shape!"))))
-  (get-nd [^NDArray m indexes]
-    (let [ndims (.dimensionality m)
-          ^"[J" indexes (long-array indexes)]
-      (if (= ndims (count indexes))
-        (.get m indexes)
-        (error "Invalid shape!")))))
+  (get-1d [m ^long row]
+    (with-check-shape
+      1 [m m] row
+      (.get m row)))
+  (get-2d [m ^long row ^long col]
+    (with-check-shape
+      2 [m m] row col
+      (.get m row col)))
+  (get-nd [m indexes]
+    (with-check-shape
+      (count indexes) [m m] indexes
+      (.get m (long-array indexes)))))

 (extend-protocol mp/PIndexedSetting
   NDArray
-  (set-1d [^NDArray m ^long row ^double v]
-    (let [ndims (.dimensionality m)
-          ^NDArray m (.clone m)]
-      (if (= ndims 1)
-        (.set m row v)
-        (error "Invalid shape!"))
-      m))
-  (set-2d [^NDArray m ^long row ^long col ^double v]
-    (let [ndims (.dimensionality m)
-          ^NDArray m (.clone m)]
-      (if (= ndims 2)
-        (.set m row col v)
-        (error "Invalid shape!"))
-      m))
-  (set-nd [^NDArray m indexes ^double v]
-    (let [ndims (.dimensionality m)
-          m (.clone m)
-          ^"[J" indexes (long-array indexes)]
-      (if (= ndims (count indexes))
-        (.set m indexes v)
-        (error "Invalid shape"))
-      m))
+  (set-1d [m ^long row ^double v]
+    (with-check-shape
+      1 [m m] row
+      (.set (.clone m) row v)))
+  (set-2d [m ^long row ^long col ^double v]
+    (with-check-shape
+      2 [m m] row col
+      (.set (.clone m) row col v)))
+  (set-nd [m indexes ^double v]
+    (with-check-shape
+      (count indexes) [m m] indexes
+      (.set (.clone m) (long-array indexes) v)))
   (is-mutable? [m] true))

 (extend-protocol mp/PIndexedSettingMutable
   NDArray
-  (set-1d! [^NDArray m ^long i ^double v]
-    (.set m i v))
-  (set-2d! [^NDArray m ^long i ^long j ^double v]
-    (.set m i j v))
-  (set-nd! [^NDArray m indexes ^double v]
-    (let [^"[J" indexes (long-array indexes)]
-      (.set m indexes v))))
+  (set-1d [m ^long row ^double v]
+    (with-check-shape
+      1 [m m] row
+      (.set m row v)))
+  (set-2d [m ^long row ^long col ^double v]
+    (with-check-shape
+      2 [m m] row col
+      (.set m row col v)))
+  (set-nd [m indexes ^double v]
+    (with-check-shape
+      (count indexes) [m m] indexes
+      (.set m (long-array indexes) v))))


:tex output for context now uses array

:tex output for context now uses array

which is correct.

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

--- src/conexp/io/contexts.clj
+++ src/conexp/io/contexts.clj
@@ -308,12 +308,14 @@
     (doseq [[g m] (incidence ctx)]
       (println (str g "," m)))))

-;; output as tex tabular
+
+;; output as tex array

 (define-context-output-format :tex
   [ctx file]
   (with-out-writer file
-    (println (str "\\begin{tabular}{l|*{" (count (attributes ctx)) "}{c|}}"))
+    (println "\\[")
+    (println (str "\\begin{array}{l||*{" (count (attributes ctx)) "}{c|}}"))
     (doseq [m (attributes ctx)]
       (print (str "& " m)))
     (println "\\\\\\hline\\hline")
@@ -322,7 +324,8 @@
       (doseq [m (attributes ctx)]
         (print (str "& " (if ((incidence ctx) [g m]) "\\times" "\\cdot"))))
       (println "\\\\\\hline"))
-    (println (str "\\end{tabular}"))))
+    (println (str "\\end{array}"))
+    (println "\\]")))

 ;;; TODO