Fix search

Fix search

--- src/airhead_cljs/core.cljs
+++ src/airhead_cljs/core.cljs
@@ -32,12 +32,6 @@
   [:input {:type "button" :value "Enqueue"
            :on-click #(enqueue-track track)}])

-(defn query-input [query]
-  [:input {:type "text"
-           :value @query
-           :on-change #(reset! query
-                               (-> % .-target .-value))}])
-
 (defn tracks-list [tracks]
   [:ul (for [track @tracks]
          [:li
@@ -54,14 +48,17 @@
   (let [tracks (r/atom [])
         query (r/atom "")
         reset-tracks #(reset! tracks (% "items"))
-        reset-query #(reset! query (-> % .-target .-value))
         get-tracks (fn []
                      (get-json "/api/tracks" reset-tracks
-                               {:q @query}))]
+                               {:q @query}))
+        reset-query (fn [e]
+                      (reset! query (-> e .-target .-value))
+                      (get-tracks))]
+    (get-tracks)
     (fn []
-      (js/setTimeout get-tracks 1000)
       [:div [:h2 "Tracks"]
-       [query-input query]
+       [:input {:type "text" :value @query
+                :on-change reset-query}]
        [tracks-list tracks]
        [upload-form]])))


(WIP) convert js object to map and filter recent tweets. Refs #48

--- samples/twitterbuzz/src/twitterbuzz/core.cljs
+++ samples/twitterbuzz/src/twitterbuzz/core.cljs
@@ -15,6 +15,7 @@

 (defn show [x]
   (.info log (debug/expose x)))
+;; remove this logging code once we can see results on the page

 (def twitter-uri (goog.Uri. "http://twitter.com/search.json"))

@@ -23,8 +24,28 @@
          payload
          callback))

+;; From Chouser - We need something like this in core.
+(defn js-obj-seq [o]
+  (for [k (js-keys o)] [(keyword k) (aget o k)]))
+
+(defn obj->map
+  "Convert a JavaScript object into a Clojure map."
+  [o]
+  (into {} (js-obj-seq o)))
+
+(def state (atom {:max-id 1 :functions []}))
+
 (defn my-callback [json]
-  (show json))
+  (let [result-map (obj->map json)
+        max-id (:max_id result-map)
+        tweets (filter #(> (:id %) (:max-id @state))
+                       (map obj->map (:results result-map)))]
+    ;; tweets should always be the newest tweets.
+    (do (show (str (count tweets)))
+        (swap! state (fn [old] (assoc old :max-id max-id)))
+        (show (str (:max-id @state)))
+        ;; Call registered functions here
+        )))

 (retrieve (.strobj {"q" "clojure"}) my-callback)


Removed unused imports from song listings.

--- src/api/listings/songs.clj
+++ src/api/listings/songs.clj
@@ -1,8 +1,6 @@
 (ns api.listings.songs
   (:require [api.db :as db]
-            [api.util.date :as date]
-            [api.util.param :as param]
-            [clojure.tools.logging :as log]))
+            [api.util.param :as param]))

 (def ^:private song-sort-fields #{:id :name})


trap all special fn errors

trap all special fn errors

--- sidecar/src/figwheel_sidecar/auto_builder.clj
+++ sidecar/src/figwheel_sidecar/auto_builder.clj
@@ -3,7 +3,8 @@
    [clojure.pprint :as p]
    [figwheel-sidecar.core :as fig]
    [figwheel-sidecar.repl :as fig-repl]
-   [figwheel-sidecar.config :as config]
+   [figwheel-sidecar.config :as config]
+   [cljs.repl]
    [cljs.analyzer]
    [cljs.env]
    [clj-stacktrace.repl]
@@ -12,6 +13,7 @@
    [clojure.java.io :as io]
    [clojure.string :as string]
    [clojure.set :refer [intersection]]
+   [clojure.stacktrace :as trace]
    [cljsbuild.util :as util]))

 (defn notify-cljs [command message]
@@ -89,6 +91,17 @@
      ;; are we only accepting string ids?
      (f (keep namify args)))))

+;; this is temporary until my cljs.repl changes make it to release
+(defn catch-special-fn-errors [special-fn]
+  (fn self
+    ([a b c] (self a b c nil))
+    ([a b form d]
+     (try
+       (special-fn a b form d)
+       (catch Throwable ex
+         (println "Failed to execute special function:" (pr-str (first form)))
+         (trace/print-cause-trace ex 12))))))
+
 (defn setup-control-fns [all-builds build-ids figwheel-server]
   (let [logfile-path (or (:server-logfile figwheel-server) "figwheel_server.log")
         _ (mkdirs logfile-path)
@@ -97,31 +110,36 @@
                                  :focus-ids  build-ids})
         validate-build-ids (let [bs (set (keep :id all-builds))]
                              (fn [ids]
-                               (or (not-empty (intersection bs (set ids)))
-                                   (println "No such build id"))))
+                               (vec (keep #(if (bs %) % (println "No such build id:" %)) ids))))
         get-ids            (fn [ids]
                              (or (and (empty? ids)
                                       (:focus-ids @state-atom))
                                  (validate-build-ids ids)))
-        builder-fn        (builder figwheel-server)
+        display-focus-ids (fn [ids]
+                            (when (not-empty ids)
+                              (println "Focusing on build ids:" (string/join ", " ids))))
         builder-running? #(:autobuilder @state-atom)
         ;; we are going to take an optiona id here
         build-once*     (fn [ids]
-                          (let [bs (set (get-ids ids))]
-                            (mapv builder-fn
-                                  (filter #(bs (:id %)) all-builds))))
-        clean-build*    (fn [_]
-                          (mapv cbuild/clean-build (map :build-options all-builds))
-                          (println "Deleting ClojureScript compilation target files."))
+                          (let [bs (set (get-ids ids))
+                                builds (filter #(bs (:id %)) all-builds)]
+                            (display-focus-ids (map :id builds))
+                            (mapv auto/build-once builds)))
+        clean-build*    (fn [ids]
+                          (let [bs (set (get-ids ids))
+                                builds (filter #(bs (:id %)) all-builds)]
+                            (display-focus-ids (map :id builds))
+                            (mapv cbuild/clean-build (map :build-options builds))
+                            (println "Deleting ClojureScript compilation target files.")))
         run-autobuilder (fn [figwheel-server build-ids]
-                          (binding [*out* log-writer
-                                    *err* log-writer]
-                            (when-not (builder-running?)
-                              (build-once* build-ids)
+                          (when-not (builder-running?)
+                            (build-once* build-ids)
+                            (binding [*out* log-writer
+                                      *err* log-writer]
                               (when-let [abuild (autobuild-ids
                                                  { :all-builds all-builds
                                                    :build-ids build-ids
-                                                  :figwheel-server figwheel-server })]
+                                                   :figwheel-server figwheel-server })]
                                 (reset! state-atom { :autobuilder abuild
                                                      :focus-ids build-ids})))))
         stop-autobuild*  (fn [_]
@@ -156,11 +174,11 @@
 (defn repl-function-docs  []
   "Figwheel Controls:
           (stop-autobuild)           ;; stops Figwheel autobuilder
-          (start-autobuild [id ...]) ;; starts autobuilder focused on option ids
-          (switch-to-build id ...)   ;; switches  autobuilder
+          (start-autobuild [id ...]) ;; starts autobuilder focused on optional ids
+          (switch-to-build id ...)   ;; switches autobuilder to different build
           (reset-autobuild)          ;; stops, cleans, and starts autobuilder
           (build-once [id ...])      ;; builds source once time
-          (clean-build)              ;; deletes compiled cljs target files
+          (clean-build [id ..])      ;; deletes compiled cljs target files
     Docs: (doc function-name-here)
     Exit: Control+C or :cljs/quit
  Results: Stored in vars *1, *2, *3")
@@ -170,14 +188,17 @@
         repl-build   (first (config/narrow-builds* all-builds' build-ids))
         build-ids    (or (not-empty build-ids) [(:id repl-build)]) ;; give a default build-id
         control-fns  (setup-control-fns all-builds' build-ids figwheel-server)
-        special-fns  (into {} (map (fn [[k v]] [k (make-special-fn v)]) control-fns))]
+        special-fns  (into {} (map (fn [[k v]] [k (make-special-fn v)]) control-fns))
+        special-fns  (merge cljs.repl/default-special-fns special-fns)
+        ;; TODO remove this when cljs.repl error catching code makes it to release
+        special-fns  (into {} (map (fn [[k v]] [k (catch-special-fn-errors v)]) special-fns))]
     ((get control-fns 'start-autobuild) build-ids)
     (newline)
     (print "Launching ClojureScript REPL")
     (when-let [id (:id repl-build)] (println " for build:" id))
     (println (repl-function-docs))
     (println "Prompt will show when figwheel connects to your application")
-    ;; it would be cool to switch the repl's build as well is this possible?
+    ;; it would be cool to switch the repl's build as well, is this possible?
     (fig-repl/repl repl-build figwheel-server {:special-fns special-fns})))

 (defn autobuild [src-dirs build-options figwheel-options]


remove debugging console message

remove debugging console message

--- pedestal-app/app/src/semtag_web/services.cljs
+++ pedestal-app/app/src/semtag_web/services.cljs
@@ -16,7 +16,7 @@
                               msg/topic [:search-results]
                               :value results}))
 (defn alert
-  "Creates an alert partial for given type"
+  "Adds an alert box at the top of the page"
   [msg alert-type]
   (dom/prepend! (dom/by-id "main")
                 (partials/alert msg (str "alert-" (name alert-type)))))
@@ -27,10 +27,10 @@
                :request-method "GET"
                :on-success success-fn
                :on-error (fn [{:keys [xhr] :as msg}]
-                           (.log js/console "Request failed with:" (.getResponse xhr))
                            (alert (format "Request '%s' failed with: %s"
                                           uri
-                                          (.getResponse xhr)) :error))))
+                                          (.getResponse xhr))
+                                  :error))))

 (defn services-fn [message input-queue]
   (.log js/console (str "Sending query to server: " message))


Fixed client's app initialization.

Fixed client's app initialization.

--- client/src/ipogudin/collie/client/core.cljs
+++ client/src/ipogudin/collie/client/core.cljs
@@ -29,7 +29,7 @@
      (mount/swap {#'ipogudin.collie.schema/schema schema})
      (mount/swap
        {#'ipogudin.collie.client.configuration/configuration
-        (if api-root
+        (if conf
           (common/deep-merge configuration/default-configuration conf)
           configuration/default-configuration)})
      mount/start)


hyphen -> underscore

hyphen -> underscore

--- src-cljs/frontend/controllers/navigation.cljs
+++ src-cljs/frontend/controllers/navigation.cljs
@@ -399,7 +399,7 @@
       (assoc :navigation-data args)
       (assoc :org-settings-subpage subpage)
       (assoc :org-settings-org-name org)
-      (assoc :org-settings-vcs-type vcs_type)
+      (assoc :org-settings-vcs_type vcs_type)
       (assoc-in state/crumbs-path [{:type :settings-base}
                                    {:type :org
                                     :username org}])


Adding parens

Adding parens

--- config/software/libxslt.clj
+++ config/software/libxslt.clj
@@ -31,6 +31,6 @@
                    :args [ "-pi" "-e" "s/^(LIBXSLT_VERSION_SCRIPT = \\$.+)/\\# Woof/g"
                            (str *omnibus-build-dir* "/libxslt-1.1.26/libxslt/Makefile") ]}
                   {:command (if (is-os? "solaris2") "perl" "true")
-                   :args [ "-pi" "-e" "s/^#LIBXSLT_VERSION_SCRIPT.+)/LIBXSLT_VERSION_SCRIPT =/g"
+                   :args [ "-pi" "-e" "s/^(#LIBXSLT_VERSION_SCRIPT.+)/LIBXSLT_VERSION_SCRIPT =/g"
                            (str *omnibus-build-dir* "/libxslt-1.1.26/libxslt/Makefile") ]}
                   {:command "make" :args ["install"]}])


Remove dupes of `subseq` and `rsubseq` from quickref. Fixes #128.

--- src/clj/clojuredocs/pages/quickref/static.clj
+++ src/clj/clojuredocs/pages/quickref/static.clj
@@ -261,7 +261,7 @@
            merge
            merge-with),
          :title "Use (Sorted Maps)"}
-        {:syms (rseq subseq subseq rsubseq rsubseq),
+        {:syms (rseq subseq rsubseq),

          :title "Use"})}
       {:title "Sets",


try unparse instead of unparse-local

try unparse instead of unparse-local

--- src/cljs/clj_money/api/transaction_items.cljs
+++ src/cljs/clj_money/api/transaction_items.cljs
@@ -12,7 +12,7 @@

 (defn- format-date
   [date]
-  (f/unparse-local (:date f/formatters) date))
+  (f/unparse (:date f/formatters) date))

 (defn- prepare-criteria
   [criteria]


only show sagas with remaining time by default

--- src/cljs/iwaswhere_web/ui/entry/briefing.cljs
+++ src/cljs/iwaswhere_web/ui/entry/briefing.cljs
@@ -286,42 +286,49 @@
             (let [m (js/parseInt (-> ev .-nativeEvent .-target .-value))
                   s (* m 60)
                   updated (assoc-in entry [:briefing :time-allocation saga] s)]
-              (put-fn [:entry/update-local updated]))))]
+              (put-fn [:entry/update-local updated]))))
+        filter-click #(swap! local update-in [:outstanding-time-filter] not)]
     (fn [entry day-stats local edit-mode? put-fn]
       (let [actual-times (:time-by-saga day-stats)
-            sagas @sagas]
-        [:div
-         [:table
-          [:tbody
-           [:tr
-            [:th [:span.fa.fa-filter]]
-            [:th "saga"]
-            [:th "planned"]
-            [:th "actual"]
-            [:th "remaining"]]
-           (for [[k v] (sort-by #(-> % second :saga-name) sagas)]
-             (let [allocation (get-in entry [:briefing :time-allocation k] 0)
-                   actual (get-in (:time-by-saga day-stats) [k] 0)
-                   remaining (- allocation actual)
-                   color (cc/item-color (:saga-name v))
-                   click
-                   (fn [_]
-                     (when-not edit-mode?
-                       (swap! local update-in [:selected] #(if (= k %) nil k))))]
-               (when (or (pos? allocation) (get actual-times k) edit-mode?)
-                 ^{:key (str :time-allocation k)}
-                 [:tr {:on-click click
-                       :class    (when (= k (:selected @local)) "selected")}
-                  [:td [:div.legend {:style {:background-color color}}]]
-                  [:td [:strong (:saga-name v)]]
-                  [:td.time
-                   (if edit-mode?
-                     [:input {:on-input (time-alloc-input-fn entry k)
-                              :value    (when allocation (/ allocation 60))
-                              :type     :number}]
-                     [:span (u/duration-string allocation)])]
-                  [:td.time (u/duration-string actual)]
-                  [:td.time [:strong (u/duration-string remaining)]]])))]]]))))
+            filtered? (:outstanding-time-filter @local)
+            filter-cls (when-not filtered? "inactive")
+            sagas (sort-by #(-> % second :saga-name) @sagas)]
+        [:table
+         [:tbody
+          [:tr
+           [:th [:span.fa.fa-filter
+                 {:on-click filter-click
+                  :class filter-cls}]]
+           [:th "saga"]
+           [:th "planned"]
+           [:th "actual"]
+           [:th "remaining"]]
+          (for [[k v] sagas]
+            (let [allocation (get-in entry [:briefing :time-allocation k] 0)
+                  actual (get-in actual-times [k] 0)
+                  remaining (- allocation actual)
+                  color (cc/item-color (:saga-name v))
+                  click
+                  (fn [_]
+                    (when-not edit-mode?
+                      (swap! local update-in [:selected] #(if (= k %) nil k))))]
+              (when (or (pos? allocation)
+                        (get actual-times k) edit-mode?)
+                (when (or (not filtered?)
+                          (pos? remaining))
+                  ^{:key (str :time-allocation k)}
+                  [:tr {:on-click click
+                        :class    (when (= k (:selected @local)) "selected")}
+                   [:td [:div.legend {:style {:background-color color}}]]
+                   [:td [:strong (:saga-name v)]]
+                   [:td.time
+                    (if edit-mode?
+                      [:input {:on-input (time-alloc-input-fn entry k)
+                               :value    (when allocation (/ allocation 60))
+                               :type     :number}]
+                      [:span (u/duration-string allocation)])]
+                   [:td.time (u/duration-string actual)]
+                   [:td.time [:strong (u/duration-string remaining)]]]))))]]))))

 (defn briefing-view
   [entry put-fn edit-mode? local-cfg]
@@ -330,6 +337,7 @@
         today (.format (js/moment.) "YYYY-MM-DD")
         filter-btn (if (= day today) :active :open)
         local (r/atom {:filter  filter-btn
+                       :outstanding-time-filter true
                        :on-hold false})
         stats (subscribe [:stats])
         options (subscribe [:options])


Updated stub with full implementation.

Updated stub with full implementation.

--- src/cmr/dev/env/manager/watcher/impl/hawk.clj
+++ src/cmr/dev/env/manager/watcher/impl/hawk.clj
@@ -1,3 +1,57 @@
 (ns cmr.dev.env.manager.watcher.impl.hawk
   (:require
-    [hawk.core :as hawk]))
+    [cmr.dev.env.manager.messaging.core :as messaging]
+    [hawk.core :as hawk]
+    [taoensso.timbre :as log]
+    [trifl.fs :as fs]))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;;   Utility Functions   ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(defn clj?
+  [_context event]
+  (when (= :clj (fs/extension (:file event)))
+    true))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;;   Watcher Implementation   ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(defrecord HawkWatcher
+  [service-key
+   messenger])
+
+(defn handle-event
+  [this event]
+  (let [messenger (:messenger this)]
+    (messaging/publish messenger :file-event {:service (:service-key this)
+                                              :event event})
+    (case (:kind event)
+      :modify (messaging/publish messenger :file-modify-event event)
+      :create (messaging/publish messenger :file-create-event event)
+      :delete (messaging/publish messenger :file-delete-event event)
+      (log/warn "Unhandled file system event type:" (:kind event)))
+    this))
+
+(defn add-paths
+  [this paths]
+  (hawk/watch! [{:context (constantly this)
+                 :paths paths
+                 :filter clj?
+                 :handler handle-event}]))
+
+(defn add-path
+  [this path]
+  (add-paths this [path]))
+
+(def behaviour
+  {:handle-event handle-event
+   :add-path add-path
+   :add-paths add-paths})
+
+(defn create-watcher
+  [service-key messenger]
+  (map->HawkWatcher {
+    :service-key service-key
+    :messenger messenger}))


Replace another URLDecoder#decode.

Replace another URLDecoder#decode.

--- storm-core/src/clj/backtype/storm/ui/core.clj
+++ storm-core/src/clj/backtype/storm/ui/core.clj
@@ -29,7 +29,6 @@
             Nimbus$Client StormTopology GlobalStreamId RebalanceOptions
             KillOptions])
   (:import [java.io File])
-  (:import [java.net URLDecoder])
   (:require [compojure.route :as route]
             [compojure.handler :as handler]
             [ring.util.response :as resp]
@@ -1020,7 +1019,7 @@
        (let [include-sys? (get-include-sys? cookies)
             id (url-decode id)]
          (try
-           (-> (topology-page (URLDecoder/decode id) (:window m) include-sys?)
+           (-> (topology-page (url-decode id) (:window m) include-sys?)
              (concat [(mk-system-toggle-button include-sys?)])
              ui-template)
            (catch Exception e (resp/redirect "/")))))


try to make in-parallel-test less flaky (got flaky since step running event now appears later) (#85)

--- test/clj/lambdacd/steps/control_flow_test.clj
+++ test/clj/lambdacd/steps/control_flow_test.clj
@@ -41,6 +41,7 @@
   {:status :failure})

 (defn some-step-sending-failure-but-returning-success [_ {ch :result-channel}]
+  (Thread/sleep 100) ; wait a bit before starting to give both steps some time
   (async/>!! ch [:status :running])
   (async/>!! ch [:status :failure])
   (Thread/sleep 20)
@@ -54,6 +55,7 @@
   {:status :success})

 (defn some-step-sending-running-then-waiting-then-finished-on-channel [_ {ch :result-channel}]
+  (Thread/sleep 100) ; wait a bit before starting to give both steps some time
   (Thread/sleep 10)
   (async/>!! ch [:status :waiting])
   (Thread/sleep 40)


Use sets for equality where order cant matter

--- test/onyx/plugin/input_broker_reboot_test.clj
+++ test/onyx/plugin/input_broker_reboot_test.clj
@@ -65,6 +65,6 @@
         (swap! mock component/start)
         (Thread/sleep 5000)
         (doseq [x test-data2] (>!! input-chan x))
-        (is (= (into test-data1 test-data2)
-             (onyx.plugin.core-async/take-segments! out))))
+        (is (= (set (into test-data1 test-data2))
+               (set (onyx.plugin.core-async/take-segments! out)))))
       (finally (swap! mock component/stop)))))


private defaults; request with no args gets them returned

--- src/clj/ephemeris/core.clj
+++ src/clj/ephemeris/core.clj
@@ -4,12 +4,20 @@
     [ephemeris.points :refer (lookup known?)])
   (:import (swisseph SwissEph SweConst)))

-(def defaults {:utc nil
-               :geo {:lat nil :lon nil}
-               :bodies []
-               :angles true
-               :houses "O"
-               :meta false})
+(def ^:private
+  defaults {:utc nil
+            :geo {:lat nil :lon nil}
+            :bodies []
+            :angles true
+            :houses "O"
+            :meta false})
+
+(defn- request
+  ([] defaults)
+  ([stuff]
+   (let [want (merge defaults stuff)
+         jd (utc-to-jd (:utc want))]
+    (assoc want :jd jd))))

 (defn- geo? [geo]
   (if (and
@@ -35,11 +43,6 @@
           (> (count hs) 0))
       (get hs 0)
       \O)))
-
-(defn- request [stuff]
-  (let [want (merge defaults stuff)
-        jd (utc-to-jd (:utc want))]
-    (assoc want :jd jd)))

 (defn calc [stuff]
   (let [sw (SwissEph.)


fix proto task within protobuf project

fix proto task within protobuf project

--- src/clj/protobuf/tasks.clj
+++ src/clj/protobuf/tasks.clj
@@ -104,7 +104,7 @@
 (deftask compile-native #{proto})
 (deftask proto #{install-protoc}
   "Compile protocol buffer files located in proto dir."
-  (if (= "clojure-protobuf" (:artifact-id *project*))
+  (if (= "protobuf" (:artifact-id *project*))
     (do (invoke fetch-protoc)
         (build-protobuf))
     (protoc (or (:proto *opts*) (proto-files (file "proto"))))))


dissoc client headers from client in case of failure

--- src/clj/swarmpit/agent.clj
+++ src/clj/swarmpit/agent.clj
@@ -22,7 +22,7 @@
                                          (assoc-in [:networks] (api/service-networks id))) true)
               (log/info "Service" id "has been redeployed! [" current-image-id "] -> [" latest-image-id "]")))
           (catch ExceptionInfo e
-            (log/error "Service" id "autoredeploy failed! " (ex-data e))))))))
+            (log/error "Service" id "autoredeploy failed! " (dissoc (ex-data e) :headers))))))))

 (defn init
   []


Add `in-progress?` as a req-key to Forecast

--- src/cljc/witan/schema.cljc
+++ src/cljc/witan/schema.cljc
@@ -105,6 +105,7 @@
    (s/required-key :version)       s/Int
    (s/required-key :last-modified) DateTimeType
    (s/required-key :last-modifier) IdType
+   (s/required-key :in-progress?)  s/Bool
    (s/optional-key :description)   s/Str
    (s/optional-key :tag)           Tag})


Basic front end token authorization test, trivial log-in

Just sending a username and password we know to be part of the test data,
to confirm that the add/query calls work. They all worked cleanly as
expected.

TODO:
- Login form
- Sign up form

--- src/cljs/memento/core.cljs
+++ src/cljs/memento/core.cljs
@@ -34,10 +34,35 @@
 (register-handler
   :initialize
   (fn [app-state _]
+    (dispatch [:login-request "ricardo" "supersecret"])
     (merge app-state {:ui-state {:is-busy?      false
                                  :section       :write
                                  :current-query ""
-                                 :is-searching? false}})))
+                                 :is-searching? false}
+                      :token    nil})))
+
+(register-handler
+  :login-request
+  (fn [app-state [_ user pwd]]
+    (POST "/api/auth/login" {:params        {:username user :password pwd}
+                             :handler       #(dispatch [:login-success (:token %)])
+                             :error-handler #(dispatch [:login-error (str "Login error: " %)])})
+    app-state
+    ))
+
+(register-handler
+  :login-success
+  (fn [app-state [_ token]]
+    (assoc app-state :token token)))
+
+(register-handler
+  :login-error
+  (fn [app-state [_ result]]
+    (.log js/console result)
+    (dissoc app-state :token)
+    ))
+
+

 (register-handler
   :set-ui-section
@@ -71,6 +96,7 @@
   :load-memories
   (fn [app-state _]
     (GET "/api/memory/search" {:params        {:q (get-in app-state [:ui-state :current-query])}
+                               :headers       {:authorization (str "Token " (:token app-state))}
                                :handler       #(dispatch [:load-memories-done %])
                                :error-handler #(dispatch [:set-message (str "Error remembering. " %) "alert-danger"])
                                })
@@ -87,12 +113,12 @@
         (assoc-in [:ui-state :is-searching?] false))
     ))

-
 (register-handler
   :save-note
   (fn [app-state _]
     (let [note (get-in app-state [:note :current-note])]
       (POST "/api/memory" {:params        {:thought note}
+                           :headers       {:authorization (str "Token " (:token app-state))}
                            :handler       #(dispatch [:save-note-success note])
                            :error-handler #(dispatch [:save-note-error (str "Error saving note: " %)])}))
     app-state


set namespace order to show specials and core first

--- src/cljs_api_gen/write.clj
+++ src/cljs_api_gen/write.clj
@@ -252,6 +252,21 @@
         changes (last (:changes api))
         all (version-changes (:symbols api) changes)]
     all))
+
+(def ns-order
+  {"special" 1
+   "specialrepl" 2
+   "cljs.core" 3})
+
+(defn compare-ns
+  [a b]
+  (let [ai (get ns-order a)
+        bi (get ns-order b)]
+    (cond
+      (and (nil? ai) (nil? bi)) (compare a b)
+      (nil? ai) 1
+      (nil? bi) -1
+      :else (compare ai bi))))

 (defn readme-library-symbols
   [result]
@@ -276,7 +291,7 @@
                                           :ns k
                                           :ns-link (md-header-link k)
                                           :symbols v}))
-                        (sort-by :ns))]
+                        (sort-by :ns compare-ns))]
     ns-symbols))

 (defn readme-file-data


Add maybe-let macro.

Add maybe-let macro.

--- src/clojure/buddy/util.clj
+++ src/clojure/buddy/util.clj
@@ -21,3 +21,10 @@
   `(domonad maybe-m
      ~bindings
      (do ~@body)))
+
+(defmacro maybe-let
+  "Simple helper for maybe monad."
+  [bindings & body]
+  `(domonad maybe-m
+            ~bindings
+            (do ~@body)))


TCLJS-7: bigint and bigint? have typos in their docstrings

--- src/cognitect/transit.cljs
+++ src/cognitect/transit.cljs
@@ -291,12 +291,12 @@
   (ty/isInteger x))

 (defn bigint
-  "Construct a big decimal from a string."
+  "Construct a big integer from a string."
   [s]
   (ty/bigInteger s))

 (defn bigint?
-  "Returns true if x is a transit big decimal value, false otherwise."
+  "Returns true if x is a transit big integer value, false otherwise."
   [x]
   (ty/isBigInteger x))


Add fsync material.

Add fsync material.

--- src/konserve/filestore.clj
+++ src/konserve/filestore.clj
@@ -16,6 +16,11 @@
   (:import [java.io
             DataInputStream DataOutputStream
             FileInputStream FileOutputStream]))
+
+
+;; A useful overview over fsync on Linux:
+;; https://www.usenix.org/conference/osdi14/technical-sessions/presentation/pillai
+

 (defn delete-store
   "Permanently deletes the folder of the store with all files."


Minor tweak to docstring

Minor tweak to docstring

--- src/leiningen/amp/impl.clj
+++ src/leiningen/amp/impl.clj
@@ -51,9 +51,9 @@
   nil)

 (defn- fix-snapshot-version
-  "This method converts SNAPSHOT version numbers into something Alfresco can support. It does this by
+  "This method converts SNAPSHOT version numbers into something MMT can support. It does this by
   decrementing the last non-zero version number element by 1 and appending a 999 version component on
-  the end.  It also always returns a version number with at least version components."
+  the end.  It also always returns a version number with at least 3 version components."
   [version]
   (if (.endsWith ^String version "-SNAPSHOT")
     (let [non-snapshot-version      (.substring ^String version 0 (- (.length ^String version) (.length "-SNAPSHOT")))


Added :context key to request maps in wars

--- src/leiningen/ring/war.clj
+++ src/leiningen/ring/war.clj
@@ -94,8 +94,10 @@
 (defn generate-handler [project handler-sym]
   (if (get-in project [:ring :servlet-path-info?] true)
     `(fn [request#]
-       (let [path-info# (.getPathInfo (:servlet-request request#))]
-         (~handler-sym (assoc request# :path-info path-info#))))
+       (~handler-sym
+         (assoc request#
+           :path-info (.getPathInfo (:servlet-request request#))
+           :context   (.getContextPath (:servlet-request request#)))))
     handler-sym))

 (defn compile-servlet [project]


Grab forms and arglist regardless

Grab forms and arglist regardless

--- planck-cljs/src/planck/repl.cljs
+++ planck-cljs/src/planck/repl.cljs
@@ -832,9 +832,8 @@
       (get-var (get-aenv) sym)
       (repl/print-doc
         (let [var (get-var (get-aenv) sym)
-              var (cond-> var
-                    (:macro var) (assoc :forms (-> var :meta :forms second)
-                                        :arglists (-> var :meta :arglists second)))
+              var (assoc var :forms (-> var :meta :forms second)
+                             :arglists (-> var :meta :arglists second))
               m   (select-keys var
                     [:ns :name :doc :forms :arglists :macro :url])]
           (cond-> (update-in m [:name] name)


replace src path from filepath

replace src path from filepath

Former-commit-id: fece1eed80990a75930a3fa385896b526a79f3fd

--- planck-cljs/src/planck/repl.cljs
+++ planck-cljs/src/planck/repl.cljs
@@ -550,7 +550,8 @@
         (first (js/PLANCK_LOAD (str without-extension ".cljs")))))
     (let [file-source (first (js/PLANCK_LOAD filepath))]
       (or file-source
-        (first (js/PLANCK_LOAD (s/replace filepath #"^out/" "")))))))
+          (first (js/PLANCK_LOAD (s/replace filepath #"^out/" "")))
+          (first (js/PLANCK_LOAD (s/replace filepath #"^src/" "")))))))

 (defn- fetch-source
   [var]


give union data a :union label

give union data a :union label

--- dada-core/src/main/clojure/org/dada/dsl.clj
+++ dada-core/src/main/clojure/org/dada/dsl.clj
@@ -460,7 +460,7 @@
 		   tgt-metamodel (meta-view ".union()" src-metamodel (fn [tgt-metamodel src-model extra-pairs] (connect src-model tgt-model)))]
 	       (insert *metamodel* tgt-model)
 	       (insert tgt-metamodel [tgt-model extra-pairs])
-	       [tgt-metamodel (str prefix ".union()") extra-pairs]))])))
+	       [tgt-metamodel (str prefix ".union()") extra-pairs :union]))])))

 ;; extra keys are inserted into attribute list
 ;; extra values are carried in model's row in metamodel
@@ -495,7 +495,7 @@
 					  (insert *metamodel* count-model)
 					  (insert tgt-metamodel [count-model extra-pairs])
 					  (connect src-model count-model))))]
-		 [tgt-metamodel new-prefix extra-pairs])))])))
+		 [tgt-metamodel new-prefix extra-pairs :count])))])))

 (defn sum [sum-key]
   (fn [[metadata-fn data-fn]]
@@ -527,7 +527,7 @@
 					  (insert *metamodel* sum-model)
 					  (insert tgt-metamodel [sum-model extra-pairs])
 					  (connect src-model sum-model))))]
-		 [tgt-metamodel new-prefix extra-pairs])))])))
+		 [tgt-metamodel new-prefix extra-pairs :sum])))])))

 (defn split-key-value [key]
   (str "split(" (or key "") ")"))
@@ -565,7 +565,7 @@
 		   tgt-prefix (str src-prefix "." split-key)
 		   tgt-extra-pairs src-extra-pairs ;;(concat src-extra-pairs [[split-key "*"]])
 		   dummy (trace "SPLIT tgt-extra-pairs" tgt-extra-pairs)
-		   tgt-data-tuple [tgt-metamodel tgt-prefix tgt-extra-pairs]]
+		   tgt-data-tuple [tgt-metamodel tgt-prefix tgt-extra-pairs :split]]
 	       ;; register it with the global metamodel
 	       (trace "SPLIT DATA SRC  " src-data-tuple)
 	       (insert *metamodel* tgt-metamodel)


lein-release plugin: bumped version from 0.2.1 to 0.2.2-SNAPSHOT for next development cycle

--- material/project.clj
+++ material/project.clj
@@ -1,4 +1,4 @@
-(defproject re-view/material "0.2.1"
+(defproject re-view/material "0.2.2-SNAPSHOT"

   :description "Material design components in re-view"


CMR-1805: Reset elasticsearch port to 9206

--- dev-system/src/cmr/dev_system/system.clj
+++ dev-system/src/cmr/dev_system/system.clj
@@ -122,7 +122,7 @@

 (defmethod create-elastic :in-memory
   [type]
-  (elastic-config/set-elastic-port! 9207)
+  (elastic-config/set-elastic-port! elastic-test-util/IN_MEMORY_ELASTIC_PORT)
   (elastic-server/create-server
     elastic-test-util/IN_MEMORY_ELASTIC_PORT
     (+ elastic-test-util/IN_MEMORY_ELASTIC_PORT 10)


Fixed substitution

Fixed substitution

--- src/mickopedia/mickify.clj
+++ src/mickopedia/mickify.clj
@@ -61,7 +61,7 @@
       (s/replace #"\bmother\b" "mammy")
       (s/replace #"\bmothers\b" "mammies")
       (s/replace #"\bhim\b" "yer man")
-      (s/replace #"\b[vV]agina\b" "gee")
+      (s/replace #"\bvagina\b" "gee")
       (s/replace #"\bVagina\b" "Gee")
       (s/replace #"\bpenis\b" "mickey")
       (s/replace #"\bPenis\b" "Mickey")


fixed call to setTrustStorePassword

fixed call to setTrustStorePassword

--- ring-jetty-adapter/src/ring/adapter/jetty.clj
+++ ring-jetty-adapter/src/ring/adapter/jetty.clj
@@ -31,7 +31,7 @@
     (when (options :truststore)
       (.setTrustStore context (options :truststore)))
     (when (options :trust-password)
-      (.setTrustPassword context (options :trust-password)))
+      (.setTrustStorePassword context (options :trust-password)))
     (case (options :client-auth)
       :need (.setNeedClientAuth context true)
       :want (.setWantClientAuth context true)


Allow stacktrace css to be used with more URLs

This already worked for URLs like http://example.com/, but not for
http://example.com/foo/bar

--- ring-devel/src/ring/middleware/stacktrace.clj
+++ ring-devel/src/ring/middleware/stacktrace.clj
@@ -35,12 +35,12 @@
     (html5
       [:head
         [:title "Ring: Stacktrace"]
-        (include-css "__ring/css/stacktrace.css")]
+        (include-css "/__ring/css/stacktrace.css")]
       [:body
         [:div#exception
           [:h1 (h (.getName (:class ex)))]
           [:div.message (h (:message ex))]
-          [:div.trace
+          [:div.trace
             [:table
               [:tbody (map elem-partial (:trace-elems ex))]]]]])))


Make queue capacity in Jetty adapter more robust

Limit request queue capacity to :max-queued-requests.
Set minimum queue initial capacity and max queue capacity to 8.

Fixes #354.

--- ring-jetty-adapter/src/ring/adapter/jetty.clj
+++ ring-jetty-adapter/src/ring/adapter/jetty.clj
@@ -103,8 +103,8 @@
 (defn- ^ThreadPool create-threadpool [options]
   (let [min-threads         (options :min-threads 8)
         max-threads         (options :max-threads 50)
-        queue-capacity      (max min-threads 8)
-        queue-max-capacity  (options :max-queued-requests Integer/MAX_VALUE)
+        queue-max-capacity  (-> (options :max-queued-requests Integer/MAX_VALUE) (max 8))
+        queue-capacity      (-> min-threads (max 8) (min queue-max-capacity))
         blocking-queue      (BlockingArrayQueue. queue-capacity
                                                  queue-capacity
                                                  queue-max-capacity)


CMR-688: Fixed require in test.

CMR-688: Fixed require in test.

--- umm-lib/test/cmr/umm/test/temporal.clj
+++ umm-lib/test/cmr/umm/test/temporal.clj
@@ -3,7 +3,7 @@
   (:require [clojure.test :refer :all]
             [cmr.umm.collection :as c]
             [clj-time.core :as t]
-            [cmr.indexer.data.concepts.temporal :as tm]))
+            [cmr.umm.temporal :as tm]))

 (def dt1 (t/date-time 2001 10 15 4 3 27 1))
 (def dt2 (t/date-time 2002 10 15 4 3 27 2))


:recycle: Enhance some fragments of code

--- frontend/src/uxbox/main/data/workspace.cljs
+++ frontend/src/uxbox/main/data/workspace.cljs
@@ -935,10 +935,9 @@

 (defn extract-numeric-suffix
   [basename]
-  (let [result (re-find #"(.*)-([0-9]+)$" basename)]
-    (if result
-      [(get result 1) (+ 1 (js/parseInt (get result 2)))]
-      [basename 1])))
+  (if-let [[match p1 p2] (re-find #"(.*)-([0-9]+)$" basename)]
+    [p1 (+ 1 (d/parse-integer p2))]
+    [basename 1]))

 (defn impl-generate-unique-name
   "A unique name generator"
@@ -2073,7 +2072,7 @@
                   (let [result (prepare-change id existing-objs delta)
                         result (if (vector? result) result [result])]
                     (recur
-                     (reduce conj existing-objs (map (fn [item] {(:id item) (:obj item)}) result))
+                     (reduce #(assoc %1 (:id %2) (:obj %2)) existing-objs result)
                      (into chgs result)
                      (first ids)
                      (rest ids)))))))
@@ -2119,10 +2118,10 @@
     ptk/WatchEvent
     (watch [_ state stream]
       (let [selected-objs (map #(get objects %) selected)
-            orig-pos (geom/selection-rect selected-objs)
+            wrapper (geom/selection-rect selected-objs)
+            orig-pos (gpt/point (:x1 wrapper) (:y1 wrapper))
             mouse-pos @ms/mouse-position
-            delta {:x (- (:x mouse-pos) (:x orig-pos))
-                   :y (- (:y mouse-pos) (:y orig-pos))}
+            delta (gpt/subtract mouse-pos orig-pos)

             rchanges (prepare-changes state delta)
             uchanges (map (fn [ch]
@@ -2153,7 +2152,7 @@
     ptk/UpdateEvent
     (update [_ state]
       (assoc-in state [:workspace-local :selected]
-                (map #(get-in % [:obj :id]) rchanges)))))
+                (into #{} (map #(get-in % [:obj :id])) rchanges)))))

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; Page Changes Reactions


correct :target property location

correct :target property location

--- sidecar/src/figwheel_sidecar/auto_builder.clj
+++ sidecar/src/figwheel_sidecar/auto_builder.clj
@@ -192,7 +192,7 @@
     build))

 (defn require-connection-script-js [build]
-  (let [node? (and (:target build) (= (:target build) :nodejs))
+  (let [node? (= :nodejs (get-in build [:compiler :target]))
         main? (get-in build [:build-options :main])
         output-to (get-in build [:build-options :output-to])
         line (if (and main? (not node?))


fix burst time issues

fix burst time issues

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

--- acqEngine/src/org/micromanager/acq_engine.clj
+++ acqEngine/src/org/micromanager/acq_engine.clj
@@ -75,15 +75,16 @@
 (defn jvm-time-ms []
   (quot (System/nanoTime) 1000000))

-(defn compute-time-from-core [tags]
-  (when (@state :burst-init-time)
-    (when-let [t (tags "ElapsedTime-ms")]
-      (log "ElapsedTime-ms" t)
-      (+ (Double/parseDouble t)
-         (@state :burst-init-time)))))
-
 (defn elapsed-time [state]
   (if (state :start-time) (- (jvm-time-ms) (state :start-time)) 0))
+
+(defn core-time-from-tags [tags]
+  (try (Double/parseDouble (tags "ElapsedTime-ms")) (catch Exception e nil)))
+
+(defn burst-time [tags state]
+  (when (and (:burst-time-offset state) (get tags "ElapsedTime-ms"))
+    (+ (core-time-from-tags tags)
+       (:burst-time-offset state))))

 ;; image metadata

@@ -127,7 +128,9 @@
    :tags
    (merge
      (generate-metadata event state)
-     (:tags img))}) ;; include any existing metadata
+     (:tags img)
+     {"ElapsedTime-ms" (burst-time (:tags img) state)}
+     )}) ;; include any existing metadata

 (defn make-TaggedImage [annotated-img]
   (TaggedImage. (:pix annotated-img) (JSONObject. (:tags annotated-img))))
@@ -261,7 +264,6 @@
     (start-property-sequences (:properties trigger-sequence))
     (when absolute-slices
       (start-slice-sequence))
-    (swap! state assoc :burst-init-time (elapsed-time @state))
     (core startSequenceAcquisition (if (first-trigger-missing?) (inc length) length) 0 true)
     (swap! state assoc-in [:last-stage-positions (core getFocusDevice)]
            (last absolute-slices))))
@@ -271,22 +273,26 @@
     (Thread/sleep 5))
   (let [md (Metadata.)
         pix (core popNextImageMD md)
-        tags (parse-core-metadata md)
-        t (compute-time-from-core tags)
-        tags (if (and t (pos? t))
-               (assoc tags "ElapsedTime-ms" t)
-               (dissoc tags "ElapsedTime-ms"))]
-    (log "compute-time t")
+        tags (parse-core-metadata md)]
     {:pix pix :tags (dissoc tags "StartTime-ms")}))
-
+
 (defn collect-burst-images [event out-queue]
   (when (first-trigger-missing?) (pop-burst-image)) ; drop first image if first trigger doesn't happen
-  (doseq [event-data (event :burst-data) :while (not (@state :stop))]
-    (let [image (pop-burst-image)]
-      (.put out-queue (make-TaggedImage (annotate-image image event-data @state))))
-   (if (core isBufferOverflowed)
-      (do (swap! state assoc :stop true)
-          (ReportingUtils/showError "Circular buffer overflowed."))))
+  (swap! state assoc :burst-time-offset nil)
+  (dorun
+    (map-indexed
+      (fn [i evt]
+        (when-not (@state :stop)
+          (let [image (pop-burst-image)]
+            (when (zero? i)
+              (swap! state assoc
+                     :burst-time-offset (- (elapsed-time @state)
+                                           (core-time-from-tags (image :tags)))))
+            (.put out-queue (make-TaggedImage (annotate-image image evt @state))))
+          (when (core isBufferOverflowed)
+            (swap! state assoc :stop true)
+            (ReportingUtils/showError "Circular buffer overflowed."))))
+      (event :burst-data)))
   (while (and (not (@state :stop)) (. mmc isSequenceRunning))
     (Thread/sleep 5)))

@@ -373,11 +379,11 @@
               0))
          z-ref))))

-(defn store-new-z-reference []
+(defn store-new-z-reference [msp]
   (let [z-drive (@state :default-z-drive)]
     (when (and (or (not (core isContinuousFocusEnabled))
                    (core isContinuousFocusDrive z-drive))
-               (not (z-in-msp z-drive)))
+               (not (z-in-msp msp z-drive)))
       (state-assoc! :reference-z (get-z-stage-position z-drive)))))

 ;; startup and shutdown
@@ -438,32 +444,33 @@
                          (-> current-position get-msp (z-in-msp z-drive) not)
                          (or (:autofocus event)
                              (:wait-time-ms event)))]
-    (flatten
-      (list
-        #(log event)
-        (for [[axis pos] (:axes (MultiStagePosition-to-map (get-msp current-position))) :when pos]
-          #(apply set-stage-position axis pos))
-        (for [[d p v] (get-in event [:channel :properties])]
-          #(set-property [d p v]))
-        #(when-lets [exposure (:exposure event)
-                     camera (core getCameraDevice)]
-           (device-best-effort camera (core setExposure exposure)))
-        #(when check-z-ref
-           (set-stage-position z-drive (@state :reference-z)))
-        #(when-let [wait-time-ms (:wait-time-ms event)]
-           (acq-sleep wait-time-ms))
-        #(when (:autofocus event)
-           (run-autofocus))
-        #(when check-z-ref
-           (store-new-z-reference))
-        #(when z-drive
-           (let [z (compute-z-position event)]
-             (set-stage-position z-drive z)))
-        (event :runnables)
-        #(do (wait-for-pending-devices)
-             (expose event)
-             (collect event out-queue)
-             (stop-trigger))))))
+    (filter identity
+      (flatten
+        (list
+          #(log event)
+          (for [[axis pos] (:axes (MultiStagePosition-to-map current-position)) :when pos]
+            #(apply set-stage-position axis pos))
+          (for [[d p v] (get-in event [:channel :properties])]
+            #(set-property [d p v]))
+          #(when-lets [exposure (:exposure event)
+                       camera (core getCameraDevice)]
+             (device-best-effort camera (core setExposure exposure)))
+          #(when check-z-ref
+             (set-stage-position z-drive (@state :reference-z)))
+          #(when-let [wait-time-ms (:wait-time-ms event)]
+             (acq-sleep wait-time-ms))
+          #(when (:autofocus event)
+             (run-autofocus))
+          #(when check-z-ref
+             (store-new-z-reference (get-msp current-position)))
+          #(when z-drive
+             (let [z (compute-z-position event)]
+               (set-stage-position z-drive z)))
+          (event :runnables)
+          #(do (wait-for-pending-devices)
+               (expose event)
+               (collect event out-queue)
+               (stop-trigger)))))))

 (defn execute [event-fns]
   (doseq [event-fn event-fns :while (not (:stop @state))]


don't poison the queue until after cleanup

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

--- acqEngine/src/org/micromanager/acq_engine.clj
+++ acqEngine/src/org/micromanager/acq_engine.clj
@@ -623,8 +623,8 @@
       (let [acq-seq (generate-acq-sequence settings @attached-runnables)]
         (def acq-sequence acq-seq)
         (execute (mapcat #(make-event-fns % out-queue) acq-seq))
+        (cleanup)
         (.put out-queue TaggedImageQueue/POISON)
-        (cleanup)
         ))
     (catch Throwable t (do (ReportingUtils/showError t "Acquisition failed.")
                            (cleanup)))))


Use actual function arguments

Use actual function arguments

--- domain/src/domain/core.clj
+++ domain/src/domain/core.clj
@@ -81,7 +81,7 @@
           current-ad->features))

 (defn get-winning-ad [current-features resulting-features]
-  (let [results (get-scored-ads ads->features-example result-features-example)]
+  (let [results (get-scored-ads current-features resulting-features)]
     (->> results
          (sort-by (comp :score second))
          last)))


Split metrics for synthetic pods and normal pods for time until run and time until waiting (#1841)

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

--- scheduler/src/cook/kubernetes/controller.clj
+++ scheduler/src/cook/kubernetes/controller.clj
@@ -180,9 +180,10 @@
   (if (api/launch-pod api-client name cook-expected-state-dict pod-name)
     ; These metrics only measure the happy paths to avoid wide variations from error rates changing.
     ; k8s-response-time-until-waiting helps us characterize watch latency
-    (merge {:waiting-metric-timer (timers/start (metrics/timer "k8s-response-time-until-waiting" name))
-            :running-metric-timer (timers/start (metrics/timer "k8s-response-time-until-running" name))}
-           cook-expected-state-dict)
+    (let [metric-suffix (if (api/synthetic-pod? pod-name) "-synthetic" "")]
+    (merge {:waiting-metric-timer (timers/start (metrics/timer (str "k8s-response-time-until-waiting" metric-suffix) name))
+            :running-metric-timer (timers/start (metrics/timer (str "k8s-response-time-until-running" metric-suffix) name))}
+           cook-expected-state-dict))
     (handle-pod-submission-failed compute-cluster pod-name)))

 (defn update-or-delete!


Add status icon components

Add status icon components

Upgrades React to version which supports SVG's `fill-rule` attribute.


Don't prevent on-wheel default when autoscrolling

--- src-cljs/frontend/components/build_steps.cljs
+++ src-cljs/frontend/components/build_steps.cljs
@@ -360,12 +360,9 @@
         (html
           [:div {:on-wheel (fn [e]
                              (check-autoscroll owner (aget e "deltaY"))
-                             (when (not= 0 (aget e "deltaX"))
-                               (.preventDefault e)
-                               (let [body (.-body js/document)]
-                                 (set! (.-scrollTop body) (+ (.-scrollTop body) (aget e "deltaY"))))))
-
-                                  :class (str "selected_" current-container-id)}
+                             (let [body (.-body js/document)]
+                               (set! (.-scrollTop body) (+ (.-scrollTop body) (aget e "deltaY")))))
+                 :class (str "selected_" current-container-id)}
            (om/build container-view-v2
                      {:container (containers current-container-id)
                       :non-parallel-actions non-parallel-actions}


Fix assoc-in call.

Fix assoc-in call.

--- src/onyx/peer/function.clj
+++ src/onyx/peer/function.clj
@@ -56,7 +56,7 @@
              tagged (apply acker/prefuse-vals (map (fn [x] (acker/gen-ack-value)) result))]
          (-> rets
              (update-in [:onyx.core/results] conj result)
-             (assoc-in [:oynx.core/children] raw tagged))))
+             (assoc-in [:oynx.core/children raw] tagged))))
      {:onyx.core/results [] :onyx.core/children {}}
      (map vector batch decompressed))))


[Server] Housekeeping

[Server] Housekeeping

--- src/org/httpkit/server.clj
+++ src/org/httpkit/server.clj
@@ -97,11 +97,12 @@
   "Unified asynchronous channel interface for HTTP (streaming or long-polling)
    and WebSocket."

-  (open? [ch] "Returns true iff channel is open.")
-  (close [ch]
+  (open?      [ch] "Returns true iff channel is open.")
+  (websocket? [ch] "Returns true iff channel is a WebSocket.")
+  (close      [ch]
     "Closes the channel. Idempotent: returns true if the channel was actually
     closed, or false if it was already closed.")
-  (websocket? [ch] "Returns true iff channel is a WebSocket.")
+
   (send! [ch data] [ch data close-after-send?]
     "Sends data to client and returns true if the data was successfully sent,
     or false if the channel is closed. Data is sent directly to the client,
@@ -117,14 +118,17 @@
     For WebSocket, a text frame is sent to client if data is String,
     a binary frame when data is byte[] or InputStream. For for HTTP streaming
     responses, data can be one of the type defined by Ring spec")
+
   (on-receive [ch callback]
     "Sets handler (fn [message]) for notification of client WebSocket
     messages. Message ordering is guaranteed by server.

     The message argument could be a string or a byte[].")
+
   (on-ping [ch callback]
     "Sets handler (fn [data]) for notification of client WebSocket pings. The
     data param represents application data and will by a byte[].")
+
   (on-close [ch callback]
     "Sets handler (fn [status]) for notification of channel being closed by the
     server or client. Handler will be invoked at most once. Useful for clean-up.
@@ -140,17 +144,19 @@

 (extend-type AsyncChannel
   Channel
-  (open? [ch] (not (.isClosed ch)))
-  (close [ch] (.serverClose ch 1000))
-  (websocket? [ch] (.isWebSocket ch))
+  (open?      [ch] (not (.isClosed ch)))
+  (websocket? [ch] (.isWebSocket   ch))
+
+  (close      [ch] (.serverClose   ch 1000))
   (send!
-    ([ch data] (.send ch data (not (websocket? ch))))
+    ([ch data                  ] (.send ch data (not (websocket? ch))))
     ([ch data close-after-send?] (.send ch data (boolean close-after-send?))))
+
   (on-receive [ch callback] (.setReceiveHandler ch callback))
-  (on-ping [ch callback] (.setPingHandler ch callback))
-  (on-close [ch callback] (.setCloseHandler ch callback)))
-
-;;;; WebSocket
+  (on-ping    [ch callback] (.setPingHandler    ch callback))
+  (on-close   [ch callback] (.setCloseHandler   ch callback)))
+
+;;;; WebSockets

 (defn sec-websocket-accept [sec-websocket-key]
   (let [md (MessageDigest/getInstance "SHA1")
@@ -163,7 +169,7 @@
 (defn websocket-handshake-check
   "Returns `sec-ws-accept` string iff given Ring request is a valid
   WebSocket handshake."
-  [^AsyncChannel ch ring-req]
+  [ring-req]
   (when-let [sec-ws-key (get-in ring-req [:headers "sec-websocket-key"])]
     (try
       (sec-websocket-accept sec-ws-key)
@@ -182,12 +188,10 @@
 (defn send-websocket-handshake!
   "Returns true iff successfully upgraded a valid WebSocket request."
   [^AsyncChannel ch ring-req]
-  (when-let [sec-ws-accept (websocket-handshake-check ch ring-req)]
+  (when-let [sec-ws-accept (websocket-handshake-check ring-req)]
     (send-checked-websocket-handshake! ch sec-ws-accept)))

-;; (defn websocket-req? [ring-req] (:websocket?    ring-req))
-;; (defn async-channel  [ring-req] (:async-channel ring-req))
-;; (defn async-response [ring-req] {:body (:async-channel ring-req)})
+;;;;

 (defmacro with-channel
   "Evaluates body with `ch-name` bound to the request's underlying
@@ -206,8 +210,8 @@
   (doseq [ch @clients]
     (swap! clients disj ch)
     (send! ch {:status  200
-                 :headers {\"Content-Type\" \"text/html\"}
-                 :body your-async-response}
+               :headers {\"Content-Type\" \"text/html\"}
+               :body your-async-response}
              ;; false ; Uncomment to use chunk encoding for HTTP streaming
              )))

@@ -221,12 +225,14 @@
         (on-close   ch (fn [status] (println \"on-close:\" status))))))

   Channel API (see relevant docstrings for more info):
-    (open? [ch])
-    (close [ch])
-    (websocket? [ch])
-    (send! [ch data] [ch data close-after-send?])
+    (open?       [ch])
+    (websocket?  [ch])
+
+    (close       [ch])
+    (send!       [ch data] [ch data close-after-send?])
+
     (on-receieve [ch callback])
-    (on-close [ch callback])
+    (on-close    [ch callback])

   See org.httpkit.timer ns for optional timeout facilities."
   [ring-req ch-name & body]
@@ -234,7 +240,7 @@
          ~ch-name (:async-channel ring-req#)]

      (if (:websocket? ring-req#)
-       (if-let [sec-ws-accept# (websocket-handshake-check ~ch-name ring-req#)]
+       (if-let [sec-ws-accept# (websocket-handshake-check ring-req#)]
          (do
            ~@body ; Eval body before handshake to allow hooks to be established, Ref. #318
            (send-checked-websocket-handshake! ~ch-name sec-ws-accept#)


Only purge on update or delete.

Only purge on update or delete.

--- src/poky/protocol/http.clj
+++ src/poky/protocol/http.clj
@@ -102,7 +102,7 @@
       (response-with-status "Error in If-Unmodified-Since format. Use RFC 1123 date format." 400)
       (condp = (kv/set* kvstore b k body {:modified modified})
         :updated (response-with-purge "" 200 uri)
-        :inserted (response-with-purge "" 200 uri)
+        :inserted (response-with-status "" 200) ; no need to purge on insert
         :rejected (do
                     (warnf "PUT/POST rejected for '%s/%s'" b k)
                     (response-with-status "" 412))


Smarter error handling on bad Conversation shape (only log mismatches, hopefully)

--- src/polismath/conv_man.clj
+++ src/polismath/conv_man.clj
@@ -171,7 +171,11 @@
                              :recompute recompute
                              :n-votes (count votes))
         ;; Make sure our data has the right shape
-        (s/validate Conversation updated-conv)
+        (when-let [validation-errors (s/check Conversation updated-conv)]
+          ;; XXX Should really be using throw+ (slingshot) here and throutout the code base
+          ;; Also, should put in code for doing smart collapsing of collections...
+          (throw (Exception. (str "Validation error: Conversation Value does not match schema: "
+                                  validation-errors))))
         ; Format and upload main results
         (doseq [[col-name prep-fn] [["main" prep-main] ; main math results, for client
                                     ["bidtopid" prep-bidToPid]]] ; bidtopid mapping, for server


Associated the default users with the default organization

--- src/prop_shop/pre_load.clj
+++ src/prop_shop/pre_load.clj
@@ -9,9 +9,9 @@
   {:added "0.1"}
   []
   (let [organization {:name "Mammoth Erection" :type :organization :uuid #uuid "568c78c0-fe6c-4737-8586-5bdee73438bb"}
-        user1 {:name "Dan" :type :user :uuid #uuid "568c78d7-09ad-4730-b468-7e2026e559cf"}
-        user2 {:name "Justin" :type :user :uuid #uuid "568c7cf8-1eb5-4099-aa65-70367594a920"}]
-    (if-not (b/get-entity-by-uuid (:uuid organization)) (b/add-entity organization))
+        organization-id (:id (if-not (b/get-entity-by-uuid (:uuid organization)) (b/add-entity organization)))
+        user1 {:name "Dan" :type :user :uuid #uuid "568c78d7-09ad-4730-b468-7e2026e559cf" :organization organization-id}
+        user2 {:name "Justin" :type :user :uuid #uuid "568c7cf8-1eb5-4099-aa65-70367594a920" :organization organization-id}]
     (if-not (b/get-entity-by-uuid (:uuid user1)) (b/add-entity user1))
     (if-not (b/get-entity-by-uuid (:uuid user2)) (b/add-entity user2))))


Synthesis aga-terumo.

Synthesis aga-terumo.

--- src/african_polyphony_and_polyrhythm/talk.clj
+++ src/african_polyphony_and_polyrhythm/talk.clj
@@ -56,10 +56,13 @@
       (* vol)))

 (defmethod live/play-note :clap1 [_]
-  (clap 225 :pan 1))
+  (clap 225 :pan 0.75))

 (defmethod live/play-note :clap2 [_]
-  (clap 150 :pan -1))
+  (clap 150 :pan -0.75))
+
+(defmethod live/play-note :clap3 [_]
+  (clap 75 :pan 0))

 (defn vary [t f]
   (fn [notes]
@@ -104,6 +107,11 @@
     (rand-nth variations)
     (lazy-seq (after 4 (rand-variations variations)))))

+(defn rand-variations2 [variations]
+  (concat
+    (rand-nth variations)
+    (lazy-seq (after 2 (rand-variations2 variations)))))
+
 (defn part [model & variations]
   ((apply juxt identity variations) model))

@@ -156,7 +164,7 @@
     (-> note (assoc :pan (-> pitch (/ 9) dec)))
     note))

-(def balendoro
+(def balendoro ; p 343
   (let [horns [tete ta ha tulule bongo]]
     (->> (concat
            horns
@@ -180,3 +188,43 @@
     (live/play)
     )
   )
+
+(def first-drum
+  (let [model (->> (rhythm [2/5 3/5 1/5 1/5 3/5]) (all :part :clap1))
+        a (split 6/5 1/10)
+        b (split 5/5 1/10)
+        c (comp (split 17/15 2/15) (split 5/5 2/15) (omit 6/5))
+        d (comp (omit 7/5) (omit 6/5))]
+    (part model a b c d)))
+
+(def second-drum
+  (let [model (->> (rhythm [2/5 2/5 4/5 1/5 1/5]) (all :part :clap2))
+        a (omit 9/5)
+        b (omit 0)
+        c (comp a b)]
+    (part model a b c)))
+
+(def third-drum
+  (let [model (->> (rhythm [2/5 1/5 2/5]) (all :part :clap3))
+        a (omit 2/5)
+        b (omit 3/5)
+        c (comp (split 0 1/5) a)
+        d (split 3/5 1/5)
+        e (comp (split 3/5 1/10) d)
+        f (split 0 1/5)
+        g (comp (split 0 1/10) f)]
+    (->> (part model a b c d e f g)
+         (map (partial times 2)))))
+
+(def aga-terumo ; p299
+  (let [drums [first-drum second-drum third-drum]]
+    (->> drums
+         (map rand-variations2)
+         ;(map first)
+         (reduce with))))
+
+(comment
+  (->>
+    aga-terumo
+    (tempo (bpm 90))
+    (live/play)))


another comment

another comment

--- src/clj/org/openforis/ceo/db/institutions.clj
+++ src/clj/org/openforis/ceo/db/institutions.clj
@@ -17,6 +17,7 @@
          (pos? institution-id)
          (is-inst-admin-query? user-id institution-id))))

+;; TODO the front end uses get-institution-members, don't return members here.
 (defn- prepare-institution [{:keys [institution_id name logo description url archived members admins pending]}]
   {:id          institution_id
    :name        name


Fix content language selector have full language name

--- src/cljs/salava/core/ui/content_language.cljs
+++ src/cljs/salava/core/ui/content_language.cljs
@@ -1,5 +1,7 @@
 (ns salava.core.ui.content-language
   (:require [reagent.session :as session]
+            [salava.core.i18n :refer [lang-lookup]]
+            [clojure.string :refer [capitalize]]
             [salava.core.helper :refer [dump]]))

 (defn init-content-language
@@ -11,10 +13,11 @@
       (:language-code (first (filter #(= (:language_code %) (:default_language_code %)) contents))))))

 (defn content-language-selector [content-language-atom contents]
+
   (if (< 1 (count contents))
       (into [:div.badge-language-selector]
             (for [content contents]
-              [:a {:href "#" :class (if (= @content-language-atom (:language_code content)) "chosen" "") :on-click #(reset! content-language-atom (:language_code content))} (str  (:language_code content))]))
+              [:a {:href "#" :class (if (= @content-language-atom (:language_code content)) "chosen" "") :on-click #(reset! content-language-atom (:language_code content))} (str  (or (capitalize (get lang-lookup (:language_code content))) (:language_code content)))]))
       [:div.badge-language-selector]))


CMR-2812 Fixes permission check test for new access value validation rules

--- access-control-app/int_test/cmr/access_control/int_test/permission_check_test.clj
+++ access-control-app/int_test/cmr/access_control/int_test/permission_check_test.clj
@@ -289,14 +289,12 @@
                                                  :user_type :guest}]
                             :catalog_item_identity {:name "coll2 guest read"
                                                     :collection_applicable true
-                                                    :collection_identifier {:access_value {:min_value 1
-                                                                                :max_value 10
-                                                                                :include_undefined_value true}}
+                                                    :collection_identifier {:access_value {:include_undefined_value true}}
                                                     :provider_id "PROV1"}})

-        (is (= {coll1 ["read"]
-                coll2 ["read"]
-                coll3 ["read"]
+        (is (= {coll1 []
+                coll2 []
+                coll3 []
                 coll4 ["read"]}
                (get-coll-permissions)))))))


Show "(no output)" when test failure has no output

A test's `message` can be nil, which caused us to fail to show the Test
Summary. We could show an empty box, but a message seems clearer.

--- src-cljs/frontend/components/build_head.cljs
+++ src-cljs/frontend/components/build_head.cljs
@@ -392,7 +392,7 @@
         [:div.properties
          [:div.test-name (format-test-name test)]
          [:div.test-file (:file test)]]
-        (let [message (:message test)
+        (let [message (or (:message test) "(no output)")
               message (if (:show-message test) message
                           (.replace message (js/RegExp. "^\\s+" "m") ""))
               expander-label (if (:show-message test) "less" "more")]


CMR-380: Updating indexer to move some logic into spatial lib.

--- src/cmr/indexer/services/concepts/spatial.clj
+++ src/cmr/indexer/services/concepts/spatial.clj
@@ -7,14 +7,8 @@
             [cmr.spatial.polygon :as p]
             [cmr.spatial.mbr :as mbr]
             [cmr.spatial.lr-binary-search :as lr]
-            [cmr.spatial.serialize :as serialize]
+            [cmr.spatial.serialize :as srl]
             [cmr.common.services.errors :as errors]))
-
-
-(defprotocol ShapeToElasticAttribs
-  (shape->elastic-doc
-    [shape coordinate-system]
-    "Converts a spatial shape into the nested elastic attributes"))

 (defn mbr->elastic-attribs
   [prefix mbr]
@@ -28,24 +22,16 @@
      (with-prefix :south) (:south mbr)
      (with-prefix :crosses-antimeridian) (mbr/crosses-antimeridian? mbr)}))

-(extend-protocol ShapeToElasticAttribs
-  cmr.spatial.polygon.Polygon
-  (shape->elastic-doc
-    [polygon coordinate-system]

-    ;; Only works on geodetic for now
+(defn shape->elastic-doc
+  "Converts a spatial shape into the nested elastic attributes"
+  [shape coordinate-system]
+  ;; ignores coordinate system for now
+  (let [shape (d/calculate-derived shape)]
+    (merge {:ords (srl/shape->stored-ords shape)}
+           (mbr->elastic-attribs "mbr" (srl/shape->mbr shape))
+           (mbr->elastic-attribs "lr" (srl/shape->lr shape)))))

-    (let [polygon (d/calculate-derived polygon)
-          {:keys [mbr rings]} polygon
-          lr (lr/find-lr (first rings))]
-      (when-not lr
-        (errors/internal-error!
-          (format
-            "Unable to find lr of ring [%s]. The current LR algorithm is limited and needs to be improved."
-            (pr-str (first rings)))))
-      (merge {:ords (serialize/shape->stored-ords polygon)}
-             (mbr->elastic-attribs :mbr mbr)
-             (mbr->elastic-attribs :lr lr)))))

 (defn spatial->elastic-docs
   "Converts the spatial area of the given catalog item to the elastic documents"


Release ByteBuf in consolidated gap (WIP)

Just before sending its bytes to the child. Which seems very
problematic.

In previous commits, I was throwing what amounted to a TODO exception
here. This fixed that problem, but led to others.

--- src/clojure/frereth_cp/message/to_child.clj
+++ src/clojure/frereth_cp/message/to_child.clj
@@ -59,7 +59,8 @@
     :as incoming}
    k-v-pair]
   (let [[[start stop] ^ByteBuf buf] k-v-pair]
-    (log/debug (str "Does " start "-" stop " close a hole in "
+    (log/debug (str message-loop-name
+                    ": Does " start "-" stop " close a hole in "
                     gap-buffer " from HWM " receive-bytes "?"))
     ;; For now, this top-level if check is redundant.
     ;; I'd rather be safe and trust the JIT than remove it
@@ -70,10 +71,15 @@
       ;; Q: Did a previous message overwrite this message block?
       (if (< stop receive-bytes)
         (do
-          (log/debug "Dropping previously consolidated block")
-          (throw (RuntimeException. "Probably need to call .release"))
-          ;; Note that the exception keeps this from getting called.
-          ;; And, so far, I haven't hit that.
+          (log/debug (str message-loop-name
+                          ": Dropping previously consolidated block"))
+          (let [to-drop (val (first gap-buffer))]
+            (try
+              (.release to-drop)
+              (catch RuntimeException ex
+                (log/error ex (str message-loop-name
+                                   ": Failed to release"
+                                   to-drop)))))
           (update incoming ::specs/gap-buffer pop-map-first))
         ;; Consolidate this message block
         ;; I'm dubious about the logic for bytes-to-skip
@@ -109,7 +115,11 @@
      :as incoming} ::specs/incoming
     :keys [::specs/message-loop-name]
     :as state}]
-  {:pre [gap-buffer]}
+  (when-not gap-buffer
+    (throw (ex-info "Missing gap-buffer"
+                    {::incoming incoming
+                     ::message-loop message-loop-name
+                     ::incoming-keys (keys incoming)})))
   (assoc state
          ::specs/incoming
          (reduce (fn [{:keys [::specs/receive-bytes]


setup basic example to hotload infinitelives libraries

--- examples/basic/project.clj
+++ examples/basic/project.clj
@@ -4,27 +4,42 @@
   :license {:name "Eclipse Public License"
             :url "http://www.eclipse.org/legal/epl-v10.html"}

-  :dependencies [[org.clojure/clojure "1.7.0"]
-                 [org.clojure/clojurescript "1.7.170"]
-                 [org.clojure/core.async "0.2.374"
+  :dependencies [[org.clojure/clojure "1.8.0"]
+                 [org.clojure/clojurescript "1.9.229"]
+                 [org.clojure/core.async "0.2.391"
                   :exclusions [org.clojure/tools.reader]]

                  [infinitelives/infinitelives.pixi "0.1.1-SNAPSHOT"]
                  ]

-  :plugins [[lein-cljsbuild "1.1.2" :exclusions [[org.clojure/clojure]]]
-            [lein-figwheel "0.5.0-4"]]
+  :plugins [[lein-figwheel "0.5.8"]
+            [lein-cljsbuild "1.1.4" :exclusions [[org.clojure/clojure]]]
+            ]

-  :source-paths ["src"]
+  :source-paths ["src"
+                  "checkouts/infinitelives.utils/src"
+                 "checkouts/infinitelives.pixi/src"
+
+                 ]

   :clean-targets ^{:protect false} ["resources/public/js/compiled" "target"]

   :cljsbuild {:builds
               [{:id "dev"
-                :source-paths ["src"]
+                :source-paths ["src"
+                               "checkouts/infinitelives.utils/src"
+                               "checkouts/infinitelives.pixi/src"
+
+                               ]

                 ;; If no code is to be run, set :figwheel true for continued automagical reloading
-                :figwheel {:on-jsload "basic.core/on-js-reload"}
+                :figwheel {:on-jsload "basic.core/on-js-reload"
+                           ;; :open-urls will pop open your application
+                           ;; in the default browser once Figwheel has
+                           ;; started and complied your application.
+                           ;; Comment this out once it no longer serves you.
+                           :open-urls ["http://localhost:3449/index.html"]
+                           }

                 :compiler {:main basic.core
                            :asset-path "js/compiled/out"
@@ -35,7 +50,11 @@
                ;; production. You can build this with:
                ;; lein cljsbuild once min
                {:id "min"
-                :source-paths ["src"]
+                :source-paths ["src"
+                               "checkouts/infinitelives.utils/src"
+                               "checkouts/infinitelives.pixi/src"
+
+                               ]
                 :compiler {:output-to "resources/public/js/compiled/basic.js"
                            :main basic.core
                            :optimizations :advanced


More work on element options rendering.

More work on element options rendering.

--- frontend/uxbox/ui/workspace/options.cljs
+++ frontend/uxbox/ui/workspace/options.cljs
@@ -8,14 +8,19 @@
             [uxbox.ui.workspace.base :as wb]))

 (def +menus-map+
-  {:builtin/icon [:menu/size-and-pos]
-   :builtin/icon-svg [:menu/size-and-pos]})
+  {:builtin/icon [:menu/measures :menu/fill]
+   :builtin/icon-svg [:menu/measures]})

 (def +menus-by-id+
-  {:menu/size-and-pos
+  {:menu/measures
    {:name "Size & position"
     :icon i/infocard
-    :id (gensym "menu")}})
+    :id :menu/measures}
+
+   :menu/fill
+   {:name "Fill"
+    :icon i/fill
+    :id :menu/fill}})

 (defn viewportcoord->clientcoord
   [pageid viewport-x viewport-y]
@@ -31,51 +36,97 @@
     (viewportcoord->clientcoord page vx vy)))

 (defmulti -render-menu
-  (fn [type shape] type))
+  (fn [menu own shape] (:id menu)))

-(defmethod -render-menu :size-and-position
-  [_ shape]
-  (html [:p "hello world"]))
+(defmethod -render-menu :menu/fill
+  [menu own shape]
+  (html
+   [:div.element-set {:key (str (:id menu))}
+    [:div.element-set-title (:name menu)]
+    [:div.element-set-content
+     ;; SLIDEBAR FOR ROTATION AND OPACITY
+     [:span "Color"]
+     [:div.row-flex
+      [:input#width.input-text
+       {:placeholder "#"
+        :type "text"
+        :value (:color shape "")
+        :on-change (constantly nil)}]]
+
+     ;; RECENT COLORS
+     [:span "Recent colors"]
+     [:div.row-flex
+      [:span.color-th]
+      [:span.color-th {:style {:background "#c5cb7f"}}]
+      [:span.color-th {:style {:background "#6cb533"}}]
+      [:span.color-th {:style {:background "#67c6b5"}}]
+      [:span.color-th {:style {:background "#a178e3"}}]
+      [:span.color-th.palette-th i/palette]]
+
+     ;; SLIDEBAR FOR ROTATION AND OPACITY
+     [:span "Opacity"]
+     [:div.row-flex
+      [:input.slidebar {:type "range"}]]]]))
+
+(defmethod -render-menu :menu/measures
+  [menu own shape]
+  (html
+   [:div.element-set {:key (str (:id menu))}
+    [:div.element-set-title (:name menu)]
+    [:div.element-set-content
+     ;; SLIDEBAR FOR ROTATION AND OPACITY
+     [:span "Size"]
+     [:div.row-flex
+      [:input#width.input-text
+       {:placeholder "Width"
+        :type "number"
+        :value (:width shape)
+        :on-change (constantly nil)}]
+      [:div.lock-size i/lock]
+      [:input#width.input-text
+       {:placeholder "Height"
+        :type "number"
+        :value (:height shape)
+        :on-change (constantly nil)}]]
+
+     [:span "Position"]
+     [:div.row-flex
+      [:input#width.input-text
+       {:placeholder "x"
+        :type "number"
+        :value (:x shape)
+        :on-change (constantly nil)}]
+      [:input#width.input-text
+       {:placeholder "y"
+        :type "number"
+        :value (:x shape)
+        :on-change (constantly nil)}]]
+
+     [:span "Rotation"]
+     [:div.row-flex
+      [:input.slidebar {:type "range"}]]]]))

 (defn element-opts-render
   [own shape]
   (let [local (:rum/local own)
         shape (rum/react shape)
         [popup-x popup-y] (get-position shape)
-        zoom 1]
+        zoom 1
+        menus (get +menus-map+ (:type shape))
+        active-menu (:menu @local (first menus))]
     (html
      [:div#element-options.element-options
       {:style {:left (* popup-x zoom) :top (* popup-y zoom)}}
       [:ul.element-icons
        (for [menu-id (get +menus-map+ (:type shape))
-             :let [menu (get +menus-by-id+ menu-id)]]
-         [:li#e-info
-          {:on-click (constantly nil)
-           :key (str "menu-" (:id menu))
-           :class nil #_"selected"}
+             :let [menu (get +menus-by-id+ menu-id)
+                   selected? (= active-menu menu-id)]]
+         [:li#e-info {:on-click #(swap! local assoc :menu menu-id)
+                      :key (str "menu-" (:id menu))
+                      :class (when selected? "selected")}
           (:icon menu)])]
-      (for [menu-id (get +menus-map+ (:type shape))
-            :let [menu (get +menus-by-id+ menu-id)]]
-        [:div#element-basics.element-set
-         {:key (str (:id menu))
-          :class nil }
-         [:div.element-set-title (:name menu)]
-         [:div.element-set-content
-
-          ;; SLIDEBAR FOR ROTATION AND OPACITY
-          [:span "Rotation"]
-          [:div.row-flex
-           [:input.slidebar {:type "range"}]]
-
-          ;; RECENT COLORS
-          [:span "Recent colors"]
-          [:div.row-flex
-           [:span.color-th]
-           [:span.color-th {:style {:background "#c5cb7f"}}]
-           [:span.color-th {:style {:background "#6cb533"}}]
-           [:span.color-th {:style {:background "#67c6b5"}}]
-           [:span.color-th {:style {:background "#a178e3"}}]
-           [:span.color-th.palette-th i/palette]]]])])))
+      (let [menu (get +menus-by-id+ active-menu)]
+        (-render-menu menu own shape))])))

 (def ^:static element-opts
   (util/component


Fixup stray parens

Fixup stray parens

--- src-cljs/frontend/components/build_head.cljs
+++ src-cljs/frontend/components/build_head.cljs
@@ -736,9 +736,7 @@
                          (map (fn [url] [:a {:href url} "#"
                                          (let [n (re-find #"/\d+$" url)]
                                            (if n (subs n 1) "?"))])
-                              urls))]))
-               ]
-
+                              urls))]))]

             [:tr
              [:th "Author"]
@@ -752,10 +750,7 @@
                         (if-not (:committer_email build)
                           [:span (build-model/committer build)]
                           [:a {:href (str "mailto:" (:committer_email build))}
-                           (build-model/committer build)])]))]
-
-              ]]
-
+                           (build-model/committer build)])]))]]]

             [:div.build-actions
              (when (has-scope :write-settings data)


fix untimezoned value

fix untimezoned value

--- src/cljs/re_form/inputs/date_input_impl.cljs
+++ src/cljs/re_form/inputs/date_input_impl.cljs
@@ -375,7 +375,8 @@
         plc-time {"24h" "hh:mm" "12h" "hh:mm AM|PM"}
         placeholder (str (:placeholder fmt-date-obj) " " (get plc-time fmt-time))
         state (r/atom {:lastValue (:value opts) :value
-                       (date-time-unparse fmt-date fmt-time (:value opts))})
+                       (date-time-unparse fmt-date fmt-time
+                                          (to-local-fn (:value opts)))})
         my-on-blur (fn [event on-blur]
                      (when (:errors @state)
                        (swap! state assoc :value (date-time-unparse
@@ -403,7 +404,7 @@
                      :lastValue v)))))

       :reagent-render
-      (fn [{:keys [value on-change errors on-blur err-classes] :as props}]
+      (fn [{:keys [on-change errors on-blur err-classes] :as props}]
         [:div
          [:div.date-input
           [:i.material-icons


gallery badge messages fix

gallery badge messages fix

--- src/cljs/salava/social/ui/badge_message.cljs
+++ src/cljs/salava/social/ui/badge_message.cljs
@@ -15,52 +15,66 @@
             [salava.core.ui.modal :refer [set-new-view]]
             [salava.core.time :refer [date-from-unix-time]]))

-(defn init-data [state]
-  (ajax/GET
-   (path-for (str "/obpv1/social/messages/" (:badge_id @state) "/" (:page_count @state)))
-   {:handler (fn [data]
-               (swap! state assoc
-                      :messages (into (:messages @state) (:messages data))
-                      :message ""
-                      :page_count (inc (:page_count @state))
-                      :messages_left (:messages_left data)))}))
+(defn init-data
+  ([state]
+   (ajax/GET
+     (path-for (str "/obpv1/social/messages/" (:badge_id @state) "/" (:page_count @state)))
+     {:handler (fn [data]
+                 (swap! state assoc
+                        :messages (into (:messages @state) (:messages data))
+                        :message ""
+                        :page_count (inc (:page_count @state))
+                        :messages_left (:messages_left data)))}))
+  ([state other-ids]
+   (ajax/GET
+     (path-for (str "/obpv1/social/messages/" (:badge_id @state) "/" (:page_count @state)))
+     {:params {:other_ids other-ids}
+      :handler (fn [data]
+                 (swap! state assoc
+                        :messages (into (:messages @state) (:messages data))
+                        :message ""
+                        :page_count (inc (:page_count @state))
+                        :messages_left (:messages_left data)
+                        :other_ids other-ids))}
+     )
+   ))

 (defn save-message [state reload-fn]
   (let [{:keys [message user_id badge_id]} @state]
     (ajax/POST
-     (path-for (str "/obpv1/social/messages/" badge_id))
-     {:response-format :json
-      :keywords? true
-      :params {:message message
-               :user_id user_id}
-      :handler (fn [data]
-                 (do
-                   (if (= "success" (:connected? data))
-                     (do
-
-                       (f/init-data badge_id)
-                       (swap! state assoc :start-following true))
-                     (swap! state assoc :start-following false))
-                   (swap! state assoc
-                          :messages []
-                          :page_count 0)
-                   (init-data state)
-                   (reload-fn)
-                   ))
-      :error-handler (fn [{:keys [status status-text]}]
-                       (dump (str status " " status-text)))})))
+      (path-for (str "/obpv1/social/messages/" badge_id))
+      {:response-format :json
+       :keywords? true
+       :params {:message message
+                :user_id user_id}
+       :handler (fn [data]
+                  (do
+                    (if (= "success" (:connected? data))
+                      (do
+
+                        (f/init-data badge_id)
+                        (swap! state assoc :start-following true))
+                      (swap! state assoc :start-following false))
+                    (swap! state assoc
+                           :messages []
+                           :page_count 0)
+                    (init-data state)
+                    (reload-fn)
+                    ))
+       :error-handler (fn [{:keys [status status-text]}]
+                        (dump (str status " " status-text)))})))

 (defn delete-message [id state]
   (ajax/POST
-   (path-for (str "/obpv1/social/delete_message/" id))
-   {:response-format :json
-    :keywords? true
-    :handler (fn [data]
-               (let [filtered-messages (filter #(not (= id (:id %))) (:messages @state))]
-                 (swap! state assoc :messages filtered-messages)))
-    :error-handler (fn [{:keys [status status-text]}]
-                    (dump (str status " " status-text)))}))
+    (path-for (str "/obpv1/social/delete_message/" id))
+    {:response-format :json
+     :keywords? true
+     :handler (fn [data]
+                (let [filtered-messages (filter #(not (= id (:id %))) (:messages @state))]
+                  (swap! state assoc :messages filtered-messages)))
+     :error-handler (fn [{:keys [status status-text]}]
+                      (dump (str status " " status-text)))}))

 (defn delete-message-button [id state]
   (let [delete-clicked (atom nil)]
@@ -72,7 +86,7 @@
                  :on-click   #(do
                                 (reset! delete-clicked (if (= true @delete-clicked) nil true))
                                 (.preventDefault %))}
-        [:span {:aria-hidden "true"
+        [:span {:aria-hidden "true"
                 :dangerouslySetInnerHTML {:__html "×"}}]]
        (if @delete-clicked
          [:div
@@ -92,14 +106,14 @@
                     (do
                       (let [current (conj str1 " ")]
                         (conj current str2))))]
-      (reduce str-space ()  a-seq)))
+    (reduce str-space ()  a-seq)))

 (defn search-and-replace-www [text]
   (let [split-words (clojure.string/split text #" ")
         helper (fn [current item]
                  (if (or (re-find #"www." item) (re-find #"^https?://" item) (re-find #"^http?://" item))
-                     (conj current (hyperlink item))
-                     (conj current (str item))))]
+                   (conj current (hyperlink item))
+                   (conj current (str item))))]
     (blank-reduce (reduce helper () split-words))))

 (defn message-list-item [{:keys [message first_name last_name ctime id profile_picture user_id]} state]
@@ -113,7 +127,7 @@
            :on-click #(set-new-view [:user :profile] {:user-id user_id})} (str first_name " "last_name)]
       [:span.date (date-from-unix-time (* 1000 ctime) "minutes")]]
      (into [:div] (for [ item (clojure.string/split-lines message)]
-                    (into [:p.msg] (if (or (re-find #"www." item) (re-find #"https?://" item) (re-find #"http?://" item))
+                    (into [:p.msg] (if (or (re-find #"www." item) (re-find #"https?://" item) (re-find #"http?://" item))
                                      (search-and-replace-www item)
                                      item))))]]
    (if (or (=  user_id (:user_id @state)) (= "admin" (:user_role @state)))
@@ -123,7 +137,7 @@
   (if (pos? (:messages_left @state))
     [:div {:class "media message-item"}
      [:div {:class "media-body"}
-      [:span [:a {:href     "#"
+      [:span [:a {:href     "#"
                   :id    "loadmore"
                   :on-click #(do
                                (init-data state)
@@ -140,8 +154,8 @@
   (create-class {:reagent-render (fn [messages]
                                    [:div {:id ""}
                                     (doall
-                                     (for [item messages]
-                                       (message-list-item item state)))
+                                      (for [item messages]
+                                        (message-list-item item state)))
                                     (message-list-load-more state)])
                  ;:component-did-mount #(scroll-bottom)
                  ;:component-did-update #(scroll-bottom)
@@ -161,13 +175,13 @@
                 :disabled (if (blank? @message-atom) "disabled" "")
                 :on-click #(do
                              (save-message state reload-fn)
-                             (.preventDefault %))}
-      (t :social/Postnew)]]]))
+                             (.preventDefault %))}
+       (t :social/Postnew)]]]))

 (defn refresh-button [state]
-  [:a {:href "#"
-       :class "pull-right"
+  [:a {:href "#"
+       :class "pull-right"
        :on-click #(do
                     (init-data state)
                     (.preventDefault %))} "Refresh"])
@@ -204,18 +218,35 @@
      [message-list messages state]]))

-(defn badge-message-handler [badge_id reload-fn]
-  (let [state (atom {:messages []
-                     :user_id (session/get-in [:user :id])
-                     :user_role (session/get-in [:user :role])
-                     :message ""
-                     :badge_id badge_id
-                     :show false
-                     :page_count 0
-                     :messages_left 0
-                     :start-following false})
-        reload-fn (or reload-fn (fn []))]
-
-    (init-data state)
-    (fn []
-      (content state reload-fn))))
+(defn badge-message-handler
+  ([badge_id reload-fn]
+   (let [state (atom {:messages []
+                      :user_id (session/get-in [:user :id])
+                      :user_role (session/get-in [:user :role])
+                      :message ""
+                      :badge_id badge_id
+                      :show false
+                      :page_count 0
+                      :messages_left 0
+                      :start-following false})
+         reload-fn (or reload-fn (fn []))]
+
+     (init-data state)
+     (fn []
+       (content state reload-fn))))
+  ([badge_id reload-fn other-ids]
+   (let [state (atom {:messages []
+                      :user_id (session/get-in [:user :id])
+                      :user_role (session/get-in [:user :role])
+                      :message ""
+                      :badge_id badge_id
+                      :show false
+                      :page_count 0
+                      :messages_left 0
+                      :start-following false})
+         reload-fn (or reload-fn (fn []))]
+
+     (if (empty? other-ids) (init-data state) (init-data state other-ids))
+     (fn []
+       (content state reload-fn)))
+   ))


(SERVER-882) Separate no-code-content-command test

The commit breaks the test for when no code-content-command is set from
the other static-file-content test.

--- test/integration/puppetlabs/general_puppet/general_puppet_int_test.clj
+++ test/integration/puppetlabs/general_puppet/general_puppet_int_test.clj
@@ -104,18 +104,20 @@
           (testing "the /static_file_content endpoint returns an error if file-path is not provided"
             (let [response (get-static-file-content "?code_id=foobar&environment=test")]
               (is (= 400 (:status response)))
-              (is (= error-message (slurp (:body response)))))))))
+              (is (= error-message (slurp (:body response))))))))))

-    (testing "the /static_file_content endpoint errors if :code-content-command is not set"
-      (bootstrap/with-puppetserver-running
-        app
-        {:jruby-puppet
-         {:max-active-instances num-jrubies}
-         :versioned-code
-         {:code-content-command nil}}
-        (let [response (http-client/get "https://localhost:8140/puppet/v3/static_file_content/foo/bar/?code_id=foobar&environment=test"
-                                        (assoc testutils/ssl-request-options
-                                          :as :stream))]
-          (is (= 500 (:status response)))
-          (is (re-matches #".*Cannot retrieve code content because the \"versioned-code\.code-content-command\" setting is not present in configuration.*"
-                 (slurp (:body response)))))))))
+(deftest ^:integration static-file-content-endpoint-test-no-code-content-command
+  (logging/with-test-logging
+   (testing "the /static_file_content endpoint errors if :code-content-command is not set"
+     (bootstrap/with-puppetserver-running
+      app
+      {:jruby-puppet
+       {:max-active-instances num-jrubies}
+       :versioned-code
+       {:code-content-command nil}}
+      (let [response (http-client/get "https://localhost:8140/puppet/v3/static_file_content/modules/foo/files/bar/?code_id=foobar&environment=test"
+                                      (assoc testutils/ssl-request-options
+                                        :as :stream))]
+        (is (= 500 (:status response)))
+        (is (re-matches #".*Cannot retrieve code content because the \"versioned-code\.code-content-command\" setting is not present in configuration.*"
+                        (slurp (:body response)))))))))


Auto-lockdown cmd regexes; fix devth/yetibot#386; fix devth/yetibot#370

--- src/yetibot/core/hooks.clj
+++ src/yetibot/core/hooks.clj
@@ -20,7 +20,7 @@
 ; Stores the mapping of prefix-regex -> sub-commands.
 (defonce hooks (atom {}))

-(defonce prefix->topic (atom {}))
+(defonce re-prefix->topic (atom {}))

 (defn find-sub-cmds
   "Matches prefix against command regexes in `hooks.`"
@@ -52,23 +52,33 @@
                                           [match sub-fn])) cmd-pairs)]
           (sub-fn (merge extra {:cmd cmd :args args :match match}))
           ; couldn't find any sub commands so default to help.
-          (yetibot.core.handler/handle-unparsed-expr (str "help " (get @prefix->topic cmd-re)))))
+          (yetibot.core.handler/handle-unparsed-expr (str "help " (get @re-prefix->topic cmd-re)))))
       (callback cmd-with-args extra))))

 ; Hook the actual handle-cmd called during interpretation.
 (rh/add-hook #'handle-cmd #'handle-with-hooked-cmds)

+(defn lockdown-prefix-regex
+  "Takes a regex and ensures that it's locked down with ^ or $ to prevent
+   collisions with runtime aliases."
+  [re]
+  (let [re-str (str re)]
+    (if (or (re-find #"^\^" re-str) (re-find #"\$$" re-str))
+      re
+      (re-pattern (str "^" re-str "$")))))
+
 (defn cmd-hook-resolved
   "Expects fully resolved syntax where as plain cmd-hook can take normally
    unresolved symbols like _ and translate them into '_"
-  [prefix & cmds]
-  (let [[topic prefix] (if (vector? prefix) prefix [(str prefix) prefix])
+  [re-prefix & cmds]
+  (let [[topic re-prefix] (if (vector? re-prefix) re-prefix [(str re-prefix) re-prefix])
+        re-prefix (lockdown-prefix-regex re-prefix)
         cmd-pairs (partition 2 cmds)]
-    (swap! prefix->topic conj {prefix topic})
+    (swap! re-prefix->topic conj {re-prefix topic})
     (help/add-docs topic
                    (map (fn [[_ cmd-fn]] (:doc (meta cmd-fn)))
                         cmd-pairs))
-    (swap! hooks conj {prefix cmds})))
+    (swap! hooks conj {re-prefix cmds})))

 (defmacro cmd-hook
   "Takes potentially special syntax and resolves it to symbols for


Port Grand Master overlay.

Port Grand Master overlay.

Now takes up less space, protects itself from the adjacent encoder.

--- src/afterglow/controllers/ableton_push_2.clj
+++ src/afterglow/controllers/ableton_push_2.clj
@@ -1499,6 +1499,14 @@
     (reset! (:next-touch-strip controller) [(math/round (* 16383 (/ (- value low) full-range)))
                                             (if (:centered v) 3 1)])))

+(def master-background
+  "The background for the grand master section, to mark it as such."
+  (colors/darken (colors/desaturate (colors/create-color :yellow) 55) 45))
+
+(def master-content
+  "The color for content in the metronome section, to mark it as such."
+  (colors/lighten (colors/create-color :yellow) 20))
+
 (defn- master-encoder-touched
   "Add a user interface overlay to give feedback when turning the
   master encoder."
@@ -1506,12 +1514,24 @@
   (controllers/add-overlay (:overlays controller)
                            (reify controllers/IOverlay
                              (captured-controls [this] #{79})
-                             (captured-notes [this] #{8})
+                             (captured-notes [this] #{8 7})
                              (adjust-interface [this _]
-                               (let [level (master-get-level (get-in controller [:show :grand-master]))]
-                                 (write-display-cell controller 0 3 (make-gauge level))
-                                 (write-display-cell controller 1 3
-                                                     (str "GrandMaster " (format "%5.1f" level)))
+                               (let [level (master-get-level (get-in controller [:show :grand-master]))
+                                     graphics (create-graphics controller)]
+                                 (set-graphics-color graphics master-background)
+
+                                 ;; Draw the background that makes the master section distinctive.
+                                 (set-graphics-color graphics master-background)
+                                 (.fillRect graphics (- Wayang/DISPLAY_WIDTH button-cell-width) 0
+                                            button-cell-width 100)
+
+                                 ;; Draw the label, value, and gauge
+                                 (set-graphics-color graphics master-content)
+                                 (draw-encoder-button-label controller 7 1 "Grand Master" master-content)
+                                 (draw-cue-variable-value controller 7 1
+                                                          (format "%5.1f" level) master-content)
+                                 (draw-gauge controller 7 1 level :track-color dim-amber-color
+                                             :active-color master-content)
                                  (reset! (:next-touch-strip controller) [(math/round (* 16383 (/ level 100))) 1]))
                                true)
                              (handle-control-change [this message]
@@ -1521,10 +1541,10 @@
                                  (master-set-level (get-in controller [:show :grand-master]) (+ level delta))
                                  true))
                              (handle-note-on [this message]
-                               false)
+                               true) ; Suppress activation of the encoder above our overlay
                              (handle-note-off [this message]
-                               ;; Exit the overlay
-                               :done)
+                               ;; Exit the overlay if it was our own encoder being released
+                               (when (= (:note message) 8) :done))
                              (handle-aftertouch [this message])
                              (handle-pitch-bend [this message]
                                (master-set-level (get-in controller [:show :grand-master])


Fixed doesChildLearnGrammar? function

Fixed doesChildLearnGrammar? function

--- src/research_clojure/eChild/runSimulation.clj
+++ src/research_clojure/eChild/runSimulation.clj
@@ -18,13 +18,12 @@
   (def sentenceCount (atom 0))

   (while (and (not @grammarLearned) (< @sentenceCount max_num))
-    (def infoListAndState (consumeSentence (rand-nth sentences)))
-    (def eChildData (conj eChildData [0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1]))
+    (def eChildData (conj (consumeSentence (rand-nth sentences)) [0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1]))
     (def currGrammarAndState (setParameters (get eChildData 0) (get eChildData 2)))
     (swap! grammarLearned (isGrammarLearned? (get currGrammarAndState 1)))
-    (swap! sentenceCount inc))
-  (writeResults currGrammarAndState))
-
+    (swap! sentenceCount inc))
+  ;(writeResults currGrammarAndState)
+  )

 (defn runSimulation
   [sentences max_eChildren max_sentences]


Fix mysql2 (properly this time)

Fix mysql2 (properly this time)

--- src/circle/backend/build/inference/rails.clj
+++ src/circle/backend/build/inference/rails.clj
@@ -129,7 +129,7 @@

 (defn need-mysql-socket? [repo]
   (let [db-config (parse-db-yml repo)]
-    (-> db-config :test :adapter #{"mysql2" "mysql"})))
+    (-> db-config :test :adapter #{"mysql2" "mysql"} boolean)))

 (defn mysql-socket-path [repo]
   (let [db-config (parse-db-yml repo)]
@@ -143,6 +143,7 @@
     (when db-info
       (condp = db-type
         "mysql" (mysql/create-user db-info)
+        "mysql2" (mysql/create-user db-info)
         "postgresql" (postgres/create-role db-info)
         nil))))


Navigate back to the overview once the split has been done

--- src/cljs/mdr2/productions/in_production.cljs
+++ src/cljs/mdr2/productions/in_production.cljs
@@ -102,10 +102,15 @@
                   :on-failure      [::ack-split-failure path]
                   })}))

-(rf/reg-event-db
+(rf/reg-event-fx
   ::ack-split
-  (fn [db [_ path]]
-    (fork/set-submitting db path false)))
+  (fn [{:keys [db]} [_ path]]
+    {:db (fork/set-submitting db path false)
+     ;; FIXME: seems weird that we have to fetch the productions here.
+     ;; Isn't there a way to get directly back to the :in-production
+     ;; view?
+     :dispatch [::fetch-productions]
+     :common/navigate-fx! [:in-production]}))

 (rf/reg-event-db
  ::ack-split-failure


Adjust default training-proportion.

Adjust default training-proportion.

--- src/clojush/problems/classification/penn.clj
+++ src/clojush/problems/classification/penn.clj
@@ -30,7 +30,7 @@
     (println "Total number of data lines:" (count lines))
     (mapv #(mapv read-string %) lines)))

-(def training-proportion 0.1) ;; proportion of training cases to use each generation
+(def training-proportion 0.5) ;; proportion of training cases to use each generation

 (defn define-fitness-cases
   "Returns a map with two keys: train and test. Train maps to a