Do not even attempt validation if input file doesn't exist

--- src/mdr2/pipeline1.clj
+++ src/mdr2/pipeline1.clj
@@ -5,7 +5,8 @@
   path and that the pipeline scripts are installed under
   `/usr/lib/daisy-pipeline/scripts`."
   (:require [clojure.java.shell :refer [sh]]
-            [clojure.string :as s]))
+            [clojure.string :as s]
+            [me.raynes.fs :as fs]))

 (def ^:private install-path "/usr/lib/daisy-pipeline/scripts")

@@ -36,18 +37,23 @@
   empty seq on successful validation or a seq of error messages
   otherwise. Possible types are `:dtbook` or `:daisy202`"
   [file type]
-  (let [args ["daisy-pipeline"
-              (str install-path "/verify/ConfigurableValidator.taskScript")
-              (str "--validatorInputFile=" file)]
-        dtbook [;; make sure it is a DTBook file
-                "--validatorRequireInputType=Dtbook document"
-                ;; make sure files with a missing DOCTYPE declaration do not validate
-                "--validatorInputDelegates=org.daisy.util.fileset.validation.delegate.impl.NoDocTypeDeclarationDelegate"]
-        daisy202 [;; make sure it is a DAISY 202 file
-                  "--validatorRequireInputType=DAISY 2.02 DTB"]]
-    (-> (apply sh (concat args (case type :dtbook dtbook :daisy202 daisy202)))
-        :out
-        (filter-output file))))
+  ;; the pipeline1 validator is not so brilliant when it comes to
+  ;; returning error conditions. For that reason we check for
+  ;; existence of the input file before hand
+  (if (not (and (fs/exists? file) (fs/readable? file)))
+    [(format "Input file '%s' does not exist or is not readable" file)]
+    (let [args ["daisy-pipeline"
+                (str install-path "/verify/ConfigurableValidator.taskScript")
+                (str "--validatorInputFile=" file)]
+          dtbook [;; make sure it is a DTBook file
+                  "--validatorRequireInputType=Dtbook document"
+                  ;; make sure files with a missing DOCTYPE declaration do not validate
+                  "--validatorInputDelegates=org.daisy.util.fileset.validation.delegate.impl.NoDocTypeDeclarationDelegate"]
+          daisy202 [;; make sure it is a DAISY 202 file
+                    "--validatorRequireInputType=DAISY 2.02 DTB"]]
+      (-> (apply sh (concat args (case type :dtbook dtbook :daisy202 daisy202)))
+          :out
+          (filter-output file)))))

 (defn audio-encoder
   "Invoke the audio encoder script."


note that id-sks from remote systems may not be unique, and we must track which remote system

--- src/navigator/schema.clj
+++ src/navigator/schema.clj
@@ -21,7 +21,8 @@
                        [:child-of :ref :many]]
                :dbfns [(constraints/unique :comp-tag :name :version)]}]
    [:comp-tag-disp-ctx {:attr [[:name :string]]}]
-   [:perf-asmt {:attrs [[:id-sk :string "Shared key for 3rd parties" :db.unique/identity]
+   [:perf-asmt {:attrs [[:id-sk :string "Shared key from 3rd parties"]
+                        [:id-sk-origin :keyword] ; e.g., :moodle, :show-evidence, etc.
                         [:name :string]
                         [:version :string] ; not null

@@ -32,7 +33,8 @@
                         [:credit-value-numerator :bigint]
                         [:credit-value-denominator :bigint]]
                :dbfns [(constraints/unique :perf-asmt :name :version :type)]}]
-   [:task {:attrs [[:id-sk :string :db.unique/identity]
+   [:task {:attrs [[:id-sk :string]
+                   [:id-sk-origin :keyword] ; e.g., :moodle, :show-evidence, etc.
                    [:name :string]
                    [:version :string]
                    [:description :string]


Update to Clojure 1.3 - seems to work fine.

--- Spraff/project.clj
+++ Spraff/project.clj
@@ -2,10 +2,8 @@
 (defproject spraff "1.0.0-SNAPSHOT"
     :description "IRC bot."
     :dependencies [
-        [org.clojure/clojure "1.2.1"]
+        [org.clojure/clojure "1.3.0"]
         [irclj "0.4.1-SNAPSHOT"]
         ]
-    :dev-dependencies [
-        [marginalia "0.5.1"]]
     :main spraff.core)


not unwinding history for now

not unwinding history for now

--- src/ophion/aggregate.clj
+++ src/ophion/aggregate.clj
@@ -44,14 +44,14 @@
 (defn from-vertex
   ([label] (from-vertex label {}))
   ([label where]
-   [{:$group {:_id "$to" :to {:$first "$to"} :_history {:$addToSet "$_history"}}}
+   [{:$group {:_id "$from" :to {:$first "$from"} :_history {:$addToSet "$_history"}}}
     {:$lookup
      {:from label
       :localField "from"
       :foreignField "gid"
       :as "vertex"}}
     {:$unwind "$vertex"}
-    {:$unwind "$_history"}
+    ;; {:$unwind "$_history"}
     {:$match where}
     {:$addFields {"vertex._history" "$_history"}}
     {:$replaceRoot {:newRoot "$vertex"}}]))
@@ -66,7 +66,7 @@
       :foreignField "gid"
       :as "vertex"}}
     {:$unwind "$vertex"}
-    {:$unwind "$_history"}
+    ;; {:$unwind "$_history"}
     {:$match where}
     {:$addFields {"vertex._history" "$_history"}}
     {:$replaceRoot {:newRoot "$vertex"}}]))


integrate dollar

integrate dollar

--- src/ophion/aggregate.clj
+++ src/ophion/aggregate.clj
@@ -278,19 +278,19 @@

 (defn render-histogram
   [outer interval]
-  (let [dollar (str "$" (name outer))])
-  [outer
-   [[{:$group
-      {:_id
-       {:$multiply
-        [interval
-         {:$ceil
-          {:$divide
-           [dollar interval]}}]}
-       :count {:$sum 1}}}
-     {:$sort {"_id" -1}}]
-    dollar
-    dollar]])
+  (let [dollar (str "$" (name outer))]
+    [outer
+     [[{:$group
+        {:_id
+         {:$multiply
+          [interval
+           {:$ceil
+            {:$divide
+             [dollar interval]}}]}
+         :count {:$sum 1}}}
+       {:$sort {"_id" -1}}]
+      dollar
+      dollar]]))

 (defn render-aggregate
   [[key query]]


CMR-5452: Removed debug statement.

CMR-5452: Removed debug statement.

--- umm-spec-lib/src/cmr/umm_spec/umm_g/track.clj
+++ umm-spec-lib/src/cmr/umm_spec/umm_g/track.clj
@@ -16,7 +16,6 @@
 (defn umm-g-track->Track
   "Returns the umm-lib granule model Track from the given UMM-G Track."
   [track]
-  (println "------track:"track)
   (when track
     (g/map->Track
      (let [{:keys [Cycle Passes]} track]


formatting

formatting

--- src/overtone/helpers/file.clj
+++ src/overtone/helpers/file.clj
@@ -200,8 +200,8 @@
   "Makes a dir at path if it doesn't already exist. Also creates all
   subdirectories if necessary"
   [path]
-  (let [path  (resolve-tilde-path path)
-        f  (File. path)]
+  (let [path (resolve-tilde-path path)
+        f    (File. path)]
     (.mkdirs f)))

 (defn rm-rf!


refactoring ... further thinning out

refactoring ... further thinning out

--- src/heroku_releases_copy/core.clj
+++ src/heroku_releases_copy/core.clj
@@ -79,28 +79,20 @@
 (defn app-releases [app]
   (get-heroku-data (str "/apps/" app "/releases") heroku-options))

-; TODO -- how to unify these two functions?
-
-(defn get-latest-release [app]
-  (let [release (last (sort-by :version < (app-releases app)))]
-    (get-in release [:slug :id])))
-
-(defn get-specific-release [app version]
-  (let [release (filter #(= version (:version %)) (app-releases app))]
-    (get-in release [:slug :id])))
-
 (defn copy-release [slug target]
   (post-heroku-data (str "/apps/" target "/releases") {"slug" slug}))

 (defn run-copy []
-  (let [configuration-data (get-configuration-from-mongo (:app parameters))
-        targets (find-target-apps (:org parameters) (str/split (:targets parameters) #"\s+"))
+  (let [targets (find-target-apps (:org parameters) (str/split (:targets parameters) #"\s+"))
+        configuration-data (get-configuration-from-mongo (:app parameters))
+        app-releases (app-releases (:app parameters))
         release (if (nil? (:version parameters))
-                  (get-latest-release (:app parameters))
-                  (get-specific-release (:app parameters) (:version parameters)))
+                  (last (sort-by :version < app-releases))
+                  (filter #(= (:version parameters) (:version %)) app-releases))
+        slug (get-in release [:slug :id])
         merge-data (partial merge configuration-data)
-        heroku-copier (comp save-to-mongo merge-data copy-release)] ; AOP on the cheap!
-    (dorun (map #(heroku-copier release %) targets))))
+        heroku-copier (comp save-to-mongo merge-data copy-release)]
+    (dorun (map #(heroku-copier slug %) targets))))

 ;-- Enable lein run
 (defn -main [] (run-copy))


Hopefully a more reliable way to strip out host from both http-kit and clojure-nginx requests.

--- src/posthere/storage.clj
+++ src/posthere/storage.clj
@@ -1,6 +1,7 @@
 (ns posthere.storage
   "Store and read POST requests to/from Redis."
   (:require [clojure.string :as s]
+            [clojure.walk :refer (keywordize-keys)]
             [taoensso.carmine :as car]
             [clj-time.core :as t]
             [clj-time.format :as f]
@@ -40,8 +41,9 @@
   (not (t/before? (f/parse (time-stamp-from-entry request-entry)) (t/now))))

 (defn request-for [request-uuid]
-  (if-let [request (wcar* (car/get (request-key-for request-uuid)))]
-    (update-in request [:headers] dissoc "host")
+  (if-let [req (wcar* (car/get (request-key-for request-uuid)))]
+    (let [request (keywordize-keys req)]
+      (assoc request :headers (dissoc (:headers request) :host)))
     false))

 ;; ----- Public -----


Update router.cljc

Update router.cljc

Wrong param name in protocol's function.

--- src/re_frame/router.cljc
+++ src/re_frame/router.cljc
@@ -73,7 +73,7 @@
   ;; -- API
   (push [this event])
   (add-post-event-callback [this id callack])
-  (remove-post-event-callback [this f])
+  (remove-post-event-callback [this id])
   (purge [this])

   ;; -- Implementation via a Finite State Machine


Fix: :chsk/state message handler in client broken

--- src/rente/client/ws.cljs
+++ src/rente/client/ws.cljs
@@ -16,8 +16,8 @@
     (js/console.log "Unhandled event: %s" (pr-str event)))

 (defmethod event-msg-handler :chsk/state
-  [old-ev-msg new-ev-msg]
-  (if (= (:?data new-ev-msg) {:first-open? true})
+  [{[_old-ev-msg new-ev-msg] :?data, :as ev-msg}]
+  (if (:first-open? new-ev-msg)
     (js/console.log "Channel socket successfully established!")
     (js/console.log "Channel socket state change: %s" (pr-str new-ev-msg))))


Update core.clj

Update core.clj

--- src/swagger_gen/core.clj
+++ src/swagger_gen/core.clj
@@ -1,7 +1,6 @@
 (ns swagger-gen.core
   (:require [clojure.walk :refer [keywordize-keys]]
             [stencil.core :as stencil]
-            [swagger-gen.util :refer [normalize-def]]
             [yaml.core :as yml]))

 (defn load-swagger-file


import works as before, infrastructure update done

--- src/tango/cljs/main.cljs
+++ src/tango/cljs/main.cljs
@@ -209,7 +209,7 @@
     ;; TODO Match your events here <...>
          [:chsk/recv [:file/imported content]]
          (do
-           (swap! app-state #(hash-map :competitions (conj (:competitions %) (:content content))))
+           (swap! app-state #(hash-map :competitions (conj (:competitions %) content)))
            (log (str @app-state))
            )
          [:chsk/recv [:file/export content]]


Add :num-decreases-today to ThroughputDescription coercion

--- src/taoensso/faraday.clj
+++ src/taoensso/faraday.clj
@@ -253,10 +253,12 @@
   ;; LocalSecondaryIndexDescription ; TODO

   ProvisionedThroughputDescription
-  (as-map [throughput] {:read          (.getReadCapacityUnits    throughput)
-                        :write         (.getWriteCapacityUnits   throughput)
-                        :last-decrease (.getLastDecreaseDateTime throughput)
-                        :last-increase (.getLastIncreaseDateTime throughput)}))
+  (as-map [throughput]
+    {:read                (.getReadCapacityUnits      throughput)
+     :write               (.getWriteCapacityUnits     throughput)
+     :last-decrease       (.getLastDecreaseDateTime   throughput)
+     :last-increase       (.getLastIncreaseDateTime   throughput)
+     :num-decreases-today (.getNumberOfDecreasesToday throughput)}))

 ;;;; API - tables


Set connection idle timeout to 1 minute instead of the default 10 minutes

--- src/territory_bro/db.clj
+++ src/territory_bro/db.clj
@@ -15,11 +15,13 @@
            clojure.lang.IPersistentMap
            clojure.lang.IPersistentVector
            org.postgresql.util.PGobject
-           (com.zaxxer.hikari HikariDataSource)))
+           (com.zaxxer.hikari HikariDataSource)
+           (java.time Duration)))

 ; Since there are tens of tenants, we don't want to keep connections open to all of them all the time.
 ; See hikari-cp.core/default-datasource-options for available options.
-(def datasource-options {:minimum-idle 0
+(def datasource-options {:idle-timeout (-> (Duration/ofSeconds 60) (.toMillis))
+                         :minimum-idle 0
                          :maximum-pool-size 2})

 (defn connect! [database-url]


don't need this print debugging anymore

don't need this print debugging anymore

--- src/vigil/operations.clj
+++ src/vigil/operations.clj
@@ -31,8 +31,6 @@
    2. Gather all the data a player needs for a view of their game."
   (let [player (data/get-player stale-player)
         game (data/get-full-game-by-player-id player)]
-    (println player)
-    (println game)
     (dorun (map #(data/intercept-sally!
                   (assoc % :intercepted-by-player-id (:id player)))
                 (filter


Fix race condition preventing task lifecycle from closing before group shutdown.

--- src/onyx/peer/peer_group_manager.clj
+++ src/onyx/peer/peer_group_manager.clj
@@ -118,15 +118,16 @@
 (defn safe-stop-vpeer! [vpeer-component]
   (when vpeer-component
     (try
-     (component/stop vpeer-component)
-     (catch Throwable t
-       (info t "Attempt to stop vpeer failed.")))))
+      (when-let [f (:lifecycle-stop-fn (:state (:virtual-peer vpeer-component)))]
+        (f :peer-left))
+      (component/stop vpeer-component)
+      (catch Throwable t
+        (info t "Attempt to stop vpeer failed.")))))

 (defmethod action :stop-peer [{:keys [group-state] :as state} [type peer-owner-id]]
   (let [vpeer-id (get-in state [:peer-owners peer-owner-id])
         vpeer-component (get-in state [:vpeers vpeer-id])]
     (safe-stop-vpeer! vpeer-component)
-    ;when-not (:no-broadcast? component)
     (-> state
         (update-in [:vpeers] dissoc vpeer-id)
         (assoc-in [:peer-owners peer-owner-id] nil))))


Don't render github user in bitbucket tab

--- src-cljs/frontend/components/add_projects.cljs
+++ src-cljs/frontend/components/add_projects.cljs
@@ -152,7 +152,7 @@
                  ;; in this order (rather than e.g. putting the whole thing into a set)
                  ;; so that new ones don't jump up in the middle as they're loaded.
                  (filter (partial select-vcs-type vcs-type)
-                         (concat [(assoc user :vcs_type vcs-type)]
+                         (concat (if (= "github" vcs-type) [(assoc user :vcs_type vcs-type)])
                                  (:organizations user)
                                  (let [org-names (->> user
                                                       :organizations


read imported macros from clj, create special form list, and symbol->filename

--- get-symbol-metadata/src/core.clj
+++ get-symbol-metadata/src/core.clj
@@ -1,12 +1,16 @@
 (ns core
+  (:refer-clojure :exclude [replace])
   (:require
     [clojure.java.io :as io]
     [clojure.tools.reader :as reader]
     [clojure.tools.reader.reader-types :as readers]
-    [clojure.string :refer [split-lines join]]
+    [clojure.string :refer [split-lines join replace]]
     [cljs.env :as env]
     [cljs.tagged-literals :refer [*cljs-data-readers*]]
     [cljs.analyzer :refer [forms-seq analyze-file]]))
+
+(def special-forms
+  '[if do let quote var fn loop recur throw try . new set!])

 ;;------------------------------------------------------------
 ;; Form Retrieving
@@ -44,6 +48,17 @@
 ;; Form Formatting
 ;;------------------------------------------------------------

+(defn symbol->filename
+  [s]
+  (-> (name s)
+      (replace ">" "GT")
+      (replace "<" "LT")
+      (replace "!" "BANG")
+      (replace "?" "QMARK")
+      (replace "*" "STAR")
+      (replace "+" "PLUS")
+      (replace "/" "SLASH")))
+
 (defn get-def-name
   [form]
   (let [[a b c] form
@@ -80,26 +95,21 @@
    "clojure.set"    {:cljs {"set.cljs"    "clojurescript/src/cljs/clojure/set.cljs"}}
    "clojure.string" {:cljs {"string.cljs" "clojurescript/src/cljs/clojure/string.cljs"}}})

-(def repo-path "code-to-parse")
-
 (defn get-repo-path
   [& args]
-  (str repo-path "/" (get-in paths args)))
+  (str  "code-to-parse/" (get-in paths args)))

 (defmulti get-symbols (fn [ns-] ns-))

 (defmethod get-symbols "cljs.core" [ns-]
   (let [clj-forms      (get-forms-from-file (get-repo-path "cljs.core" :clj "core.clj"))
         clj-cljs-forms (get-forms-from-file (get-repo-path "cljs.core" :cljs "core.clj"))
+        imported-macros (nth (first (filter #(= 'import-macros (first %)) clj-cljs-forms)) 2)
         cljs-forms     (get-forms-from-file (get-repo-path "cljs.core" :cljs "core.cljs"))
-        ;; TODO: get import-macros vector from cljs.core clj
         ;; TODO: read in clojure.core forms listed in import-macros vector
         ]
-    (println
-      "cljs.core forms:"
-      (count clj-forms)
-      (count clj-cljs-forms)
-      (count cljs-forms))))
+    (println imported-macros)
+    ))

 (defmethod get-symbols "clojure.set" [ns-]
   (let [forms (get-forms-from-file (get-repo-path "clojure.set" :cljs "set.cljs"))]
@@ -119,7 +129,5 @@

 (defn -main
   []
-  (get-symbols "cljs.core")
-  (get-symbols "clojure.set")
-  (get-symbols "clojure.string"))
+  (get-symbols "cljs.core"))


Include key in error message.

Include key in error message.

--- src/onyx/static/default_vals.cljc
+++ src/onyx/static/default_vals.cljc
@@ -17,5 +17,5 @@
   {:post [(not (nil? %))]}
   (let [v (get opts k (get default-vals k))]
     (when (nil? v)
-      (throw (ex-info "Default for config key not found." {:key k})))
+      (throw (ex-info (format "Default for config key %s not found." k) {:key k})))
     v))


Whitespace

Whitespace

--- src/oxcart/pattern.clj
+++ src/oxcart/pattern.clj
@@ -128,6 +128,7 @@
   (when (invoke? ast)
     (-> ast :fn)))

+
 (defn private?
   "λ AST → bool


don't let unauthorized users create docs in subdomain

--- src/pc/http/routes.clj
+++ src/pc/http/routes.clj
@@ -231,7 +231,13 @@
   (content/app (common-view-data req)))

 (defpage new-doc "/new" [req]
-  (frontend-response req))
+  (if (:subdomain req)
+    (if (and (:team req)
+             (auth/logged-in? req)
+             (auth/has-team-permission? (pcd/default-db) (:team req) (:auth req) :admin))
+      (frontend-response req)
+      (custom-domain/redirect-to-main req))
+    (frontend-response req)))

 (defn outer-page
   "Response to send for requests that need a document-id that the frontend will route"


Change to the "drone" ship type in the test activity.

--- src/hypernova/activities/test.clj
+++ src/hypernova/activities/test.clj
@@ -64,10 +64,7 @@
 	 (make-watch-list
 	  (map
 	   (fn [idx]
-	     (with-new [invader (ship "drone")]
-	       (set-weapon invader "mini-blaster")
-	       (set-engine invader "microshove")
-	       (set-size invader 3.5)
+	     (with-new [invader (parts "drone")]
 	       (set-faction invader "Invaders")
 	       (set-position invader (random-position player 1000.0))
 	       (set-pilot invader (hypernova.pilots.PlayerHunter. invader))


The wrestle continues with markdown and codex

--- src/re_frame/core.cljc
+++ src/re_frame/core.cljc
@@ -254,22 +254,24 @@
    (registrar/clear-handlers subs/kind query-id)))

 (defn clear-subscription-cache!
-  "Causes all subscriptions to be removed from the cache.
-  Does this by:
-     1. running `on-dispose` on all cached subscriptions
-     2. Each `on-dispose` will perform the removal of themselves.
-
-  This is for development time use. Useful when reloading Figwheel code
-  after a React exception, because React components won't have been
+  "Removes all subscriptions from the cache.
+
+  This is for development time use. Useful when hot realoding reloading
+  to subscription code or after a React/render exception, because React components won't have been
   cleaned up properly. And this, in turn, means the subscriptions within those
-  components won't have been cleaned up correctly. So this forces the issue."
+  components won't have been cleaned up correctly. So this forces the issue.
+
+   Implementation note: it calls `on-dispose` for each cached item,
+   and it is that fucntion which actually performs the cache removal.
+   "
   []
   (subs/clear-subscription-cache!))

 (defn reg-sub-raw
   "This is a low level, advanced function.  You should probably be
-  using reg-sub instead.
-  Docs in
+  using `reg-sub` instead.
+
+  Some docs are available in
   http://day8.github.io/re-frame/flow-mechanics/"
   [query-id handler-fn]
   (registrar/register-handler subs/kind query-id handler-fn))
@@ -592,13 +594,12 @@
    being run), then it runs `f` to compute a new value, which is then assoc-ed
    into the given `out-path` within `db`.

-   Example Usage:
-
-   ```clj
+  Example Usage:
+
       (defn my-f
         [a-val b-val]
         ... some computation on a and b in here)
-
+
       ;; use it
       (def my-interceptor (on-changes my-f [:c] [:a] [:b]))

@@ -607,7 +608,7 @@
         [... my-interceptor ...]  ;; <-- ultimately used here
         (fn [db v]
            ...))
-   ```
+

     Put this Interceptor on handlers which might change paths :a or :b
     and it will:
@@ -667,7 +668,7 @@
   (utils/apply-kw interceptor/->interceptor m))

 (defn get-coeffect
-  "A utility function, typically used when writing an interceptor's `:before `function.
+  "A utility function, typically used when writing an interceptor's `:before` function.

    When called with one argument, it returns the `:coeffects` map from with that `context`.

@@ -704,14 +705,14 @@
    (interceptor/get-effect context key not-found)))

 (defn assoc-effect
-   "A utility function, typically used when writing an interceptor's `:after `function.
+   "A utility function, typically used when writing an interceptor's `:after` function.

    Adds or updates a key/value pair in the `:effects` map within `context`. "
   [context key value]
   (interceptor/assoc-effect context key value))

 (defn enqueue
-  "An advanced utility function, typically used when writing an interceptor's `:before `function.
+  "An advanced utility function, typically used when writing an interceptor's `:before` function.

   Adds a collection of `interceptors` to the end of `context's` execution `:queue`, and then
   returns the updated `context`."
@@ -727,13 +728,16 @@
    By default, these functions map directly to the default `js/console` implementations,
    but you can override with your own fns (set or subset) if you wish to handle the logging yourself.

-   `new-loggers` should be a map with the same keys as standard `loggers`
-
-   Example Usage:
-   ```clj
-     (defn my-fn [& args]  (post-it-somewhere (apply str args)))  ;; here is my alternative
-     (re-frame.core/set-loggers!  {:warn my-fn :log my-fn})       ;; override the defaults with mine
-   ```
+   `new-loggers` should be a map containing a subset of they keys for the standard `loggers`.
+
+  Example Usage:
+
+      (defn my-logger      ;; here is my alternative logging function
+        [& args]
+        (post-it-somewhere (apply str args)))
+
+      ;; now install my alternative loggers
+      (re-frame.core/set-loggers!  {:warn my-logger :log my-logger})
    "
   [new-loggers]
   (loggers/set-loggers! new-loggers))
@@ -747,12 +751,10 @@

    `level` can be one of `:log` `:error` `:warn` `:debug` `:group` `:groupEnd`.

-   Example usage:
-
-
-     (console :error \"Oh, dear God, it happened:\" a-var \"and\" another)
-     (console :warn \"Possible breach of containment wall at:\" dt)
-
+  Example usage:
+
+      (console :error \"Oh, dear God, it happened:\" a-var \"and\" another)
+      (console :warn \"Possible breach of containment wall at:\" dt)
    "
   [level & args]
   (apply loggers/console (into [level] args)))
@@ -787,9 +789,10 @@
       nil)))

 (defn purge-event-queue
-  "Remove all events queued for processing"
+  "Removes all events currently queued for processing"
   []
   (router/purge re-frame.router/event-queue))
+

 ;; -- Event Processing Callbacks  ---------------------------------------------

@@ -817,8 +820,8 @@

 (defn remove-post-event-callback
-  "Unregisters the function identified by `id` to be called after each event is
-   processed."
+  "Unregisters a post event callback function, identified by `id`. Such a
+   function would  have been registered in the first place via `add-post-event-callback`"
   [id]
   (router/remove-post-event-callback re-frame.router/event-queue id))

@@ -829,12 +832,12 @@
   "Deprecated. Use `reg-event-db` instead."
   {:deprecated "0.8.0"}
   [& args]
-  (console :warn  "re-frame:  \"register-handler\" has been renamed \"reg-event-db\" (look for registration of" (str (first args)) ")")
+  (console :warn  "re-frame:  \"register-handler\" has been renamed \"reg-event-db\" (look for registration of " (str (first args)) ")")
   (apply reg-event-db args))

 (defn register-sub
   "Deprecated. Use `reg-sub-raw` instead."
   {:deprecated "0.8.0"}
   [& args]
-  (console :warn  "re-frame:  \"register-sub\" is deprecated. Use \"reg-sub-raw\" (look for registration of" (str (first args)) ")")
+  (console :warn  "re-frame:  \"register-sub\" is deprecated. Use \"reg-sub-raw\" (look for registration of " (str (first args)) ")")
   (apply reg-sub-raw args))


[#522] Update backend deps

[#522] Update backend deps

Remove unused Immutant scheduling dependency

--- backend/project.clj
+++ backend/project.clj
@@ -4,13 +4,13 @@
   :license {:name "GNU Affero General Public License 3.0"
             :url  "https://www.gnu.org/licenses/agpl-3.0.html"}
   :min-lein-version "2.0.0"
-  :dependencies [[cheshire "5.6.3"]
+  :dependencies [[cheshire "5.7.0"]
                  [clj-http "3.4.1"]
-                 [clj-time "0.12.2"]
-                 [com.ibm.icu/icu4j "58.1"]
+                 [clj-time "0.13.0"]
+                 [com.ibm.icu/icu4j "58.2"]
                  [com.layerware/hugsql "0.4.7"]
-                 [com.stuartsierra/component "0.3.1"]
-                 [compojure "1.5.1" :exclusions [medley]]
+                 [com.stuartsierra/component "0.3.2"]
+                 [compojure "1.5.2" :exclusions [medley]]
                  [duct "0.8.2"]
                  [duct/hikaricp-component "0.1.0"]
                  [environ "1.1.0"]
@@ -21,13 +21,12 @@
                  [org.apache.tika/tika-core "1.14"]
                  [org.clojure/clojure "1.8.0"]
                  [org.clojure/data.csv "0.1.3"]
-                 [org.immutant/scheduling "2.1.5" :exclusions [ch.qos.logback/logback-classic]]
-                 [org.immutant/web "2.1.5"]
+                 [org.immutant/web "2.1.6"]
                  [org.postgresql/postgresql "9.4.1212"]
-                 [org.slf4j/slf4j-nop "1.7.21"]
-                 [ragtime/ragtime.jdbc "0.6.3"]
-                 [ring "1.5.0"]
-                 [ring/ring-defaults "0.2.1"]
+                 [org.slf4j/slf4j-nop "1.7.23"]
+                 [ragtime/ragtime.jdbc "0.6.4"]
+                 [ring "1.5.1"]
+                 [ring/ring-defaults "0.2.3"]
                  [ring/ring-json "0.4.0"]]
   :uberjar-name "akvo-lumen.jar"
   :repl-options {:timeout 120000}
@@ -55,7 +54,7 @@
                                     [reloaded.repl "0.2.3"]
                                     [org.clojure/tools.namespace "0.2.11"]
                                     [org.clojure/tools.nrepl "0.2.12"]
-                                    [eftest "0.1.1"]
+                                    [eftest "0.1.2"]
                                     [com.gearswithingears/shrubbery "0.4.1"]
                                     [kerodon "0.8.0"]]
                    :source-paths   ["dev/src"]


Calling init when main is invoked directly

Otherwise the application isn't properly initialized when running on
uberjar.

--- src/tropefest/core.clj
+++ src/tropefest/core.clj
@@ -1,8 +1,9 @@
 (ns tropefest.core
-  (:require [tropefest.handler :refer [app]]
+  (:require [tropefest.handler :refer [app init]]
     [ring.adapter.jetty :refer [run-jetty]])
   (:gen-class))

 (defn -main [& args]
   (let [port (Integer/parseInt (or (System/getenv "PORT") "3000"))]
+    (init)                                                  ; Init doesn't get called on uberjar
     (run-jetty app {:port port :join? false})))


Update data-readers.

Update data-readers.

--- src/vault/data/edn.clj
+++ src/vault/data/edn.clj
@@ -60,8 +60,8 @@
 (def ^:no-doc data-readers
   "Atom containing a map of tag readers supported by Vault."
   (atom
-    {'bin data/read-bin
-     'uri data/read-uri}
+    {'puget/bin data/read-bin
+     'puget/uri data/read-uri}
     :validator map?))


New relations advice|reads-field, advice|writes-field, advice-reachable|advice.

--- EkekoAspectJ/src/damp/ekeko/aspectj/soot.clj
+++ EkekoAspectJ/src/damp/ekeko/aspectj/soot.clj
@@ -6,6 +6,7 @@
     (:use [clojure.core.logic])
     (:use [damp.ekeko logic])
     (:require
+      [damp.qwal :as qwal]
       [damp.ekeko.aspectj
        [projectmodel :as projectmodel]
        [xcut :as xcut]
@@ -72,6 +73,7 @@

 (defn
   advice-soot|method
+  "Relation between an advice and the corresponding Soot method."
   [?advice ?soot]
   (fresh [?model ?scene ?signature]
          (world/advice ?advice)
@@ -81,6 +83,7 @@

 (defn
   intertype|method-soot|method
+  "Relation between an intertype method and the corresponding Soot method."
   [?itmethod ?soot]
   (fresh [?model ?scene ?signature]
          (world/intertype|method ?itmethod)
@@ -88,10 +91,9 @@
          (soot/soot-model-scene ?model ?scene)
          (soot/soot-method-signature ?soot ?signature)))

-
-
 (defn
   field-soot|field
+  "Relation between a field and the corresponding Soot field."
   [?ajfield ?soot]
   (fresh [?model ?scene ?aspect ?signature]
          (world/aspect ?aspect)
@@ -101,14 +103,83 @@
          (soot/soot-field-signature ?soot ?signature)))

-
-
+(defn
+  advice|reads-field
+  "Relation between an advice and one of the fields it reads from."
+  [?advice ?field]
+  (fresh [?soot|method ?soot|field ?soot|unit]
+         (advice-soot|method ?advice ?soot|method)
+         (field-soot|field ?field ?soot|field)
+         (soot/soot|method-soot|unit ?soot|method ?soot|unit)
+         (soot/soot|unit|reads-soot|field ?soot|unit ?soot|field)))
+
+(defn
+  advice|writes-field
+  "Relation between an advice and one of the fields it writes to."
+  [?advice ?field]
+  (fresh [?soot|method ?soot|field ?soot|unit]
+         (advice-soot|method ?advice ?soot|method)
+         (field-soot|field ?field ?soot|field)
+         (soot/soot|method-soot|unit ?soot|method ?soot|unit)
+         (soot/soot|unit|writes-soot|field ?soot|unit ?soot|field)))

+(defn
+  advice-soot|calling|unit-soot|calling|method
+  "Relation between an advice and the Soot unit and method that calls it."
+  [?advice ?soot|calling|unit ?soot|calling|method]
+  (fresh [?soot|method]
+         (advice-soot|method ?advice ?soot|method)
+         (soot/soot|method-soot|unit|caller ?soot|method ?soot|calling|unit)
+         ;next 2 lines are expensive, but required as a unit does not know in which method it resides
+         (soot/soot|method-soot|method|caller ?soot|method ?soot|calling|method)
+         (soot/soot|method-soot|unit ?soot|calling|method ?soot|calling|unit)))

-
+(defn
+  advice-icfg-start
+  "Relation between an advice and an interprocedural control flow graph starting at the advice's application."
+  [?advice ?icfg ?icfg|start]
+  (fresh [?soot|method ?soot|unit|start ?soot|method|start]
+         (advice-soot|method ?advice ?soot|method)
+         (advice-soot|calling|unit-soot|calling|method ?advice ?soot|unit|start ?soot|method|start)
+         (soot/soot-method-icfg ?soot|method|start ?icfg)
+         (equals ?icfg|start (soot/make-icfgnode  ?soot|unit|start ?soot|method|start []))))

+(defn
+  icfg-start
+  "Relation between interprocedural control flow graph and its starting point at the application's entry method."
+  [?icfg ?icfg|start]
+  (fresh [?soot|method]
+        (soot/soot-entry-method ?soot|method)
+        (soot/soot-method-icfg-entry ?soot|method ?icfg ?icfg|start)))

+(defn
+  advice-reachable|advice
+  "Relation between an advice and another advice that may be executed afterwards."
+  [?advice1 ?advice2]
+  (fresh [?soot|method1 ?soot|method2]
+         (advice-soot|method ?advice1 ?soot|method1)
+         (!= ?advice1 ?advice2)
+         (advice-soot|method ?advice2 ?soot|method2)
+         (fresh [?icfg ?icfg|start ?icfg|end]
+                ;starting in main() because starting in the caller of advice1 did not work
+                ;(advice-icfg-start ?advice1 ?icfg ?icfg|start)
+                (icfg-start ?icfg ?icfg|start)
+                (qwal/qwal ?icfg ?icfg|start ?icfg|end []
+                           ;(start in application of first advice, make transition to first advice)
+                           ;qwal/q=>
+                           ;start in main method, make zero or more transitions to first advice
+                           (qwal/q=>*)
+                           (qwal/qcurrent [icfgnode]
+                                          (equals ?soot|method1 (soot/icfgnode-method icfgnode)))
+                           ;make one or more transitions to second advice
+                           (qwal/q=>+)
+                           (qwal/qcurrent [icfgnode]
+                                          (equals ?soot|method2 (soot/icfgnode-method icfgnode)))))))
+
+
+
+
 (comment
   (damp.ekeko/ekeko* [?advice ?method] (advice-sootmethod ?advice ?method))


CMR-2820: Refactored to address PR comments.

--- access-control-app/src/cmr/access_control/services/acl_service.clj
+++ access-control-app/src/cmr/access_control/services/acl_service.clj
@@ -129,10 +129,17 @@
       [(format "Parameter permitted_group has invalid values [%s]. Only 'guest', 'registered' or a group concept id can be specified."
                (str/join ", " invalid-groups))])))

+(def acl-identity-type->search-value
+ "Maps identity type query paremter values to the actual values used in the index."
+ {"system" "System"
+  "single_instance" "Group"
+  "provider" "Provider"
+  "catalog_item" "Catalog Item"})
+
 (defn- valid-identity-type?
   "Returns true if the given identity-type is valid, i.e., one of 'system', 'single_instance', 'provider', or 'catalog_item'."
   [identity-type]
-  (contains? #{"system" "provider" "single_instance" "catalog_item"} (str/lower-case identity-type)))
+  (contains? (set (keys acl-identity-type->search-value)) (str/lower-case identity-type)))

 (defn- identity-type-validation
   "Validates identity-type parameters."
@@ -170,13 +177,6 @@
   [_]
   {:permitted-group :string
    :identity-type :acl-identity-type})
-
-(def acl-identity-type->search-value
-  "Maps identity type query paremter values to the actual values used in the index."
-  {"system" "System"
-   "single_instance" "Group"
-   "provider" "Provider"
-   "catalog_item" "Catalog Item"})

 (defmethod cp/parameter->condition :acl-identity-type
  [concept-type param value options]


adjust UI to use new init/start logic, just render now

--- src/main/shadow/cljs/ui/main.cljs
+++ src/main/shadow/cljs/ui/main.cljs
@@ -138,7 +138,7 @@
 (defonce root-el (js/document.getElementById "root"))

 (defn start []
-  (sg/start ::ui (ui-root)))
+  (sg/render env/rt-ref root-el (ui-root)))

 ;; macro magic requires this ns always being recompiled
 ;; not yet possible to hide this, maybe a build-hook would be better than a macro?
@@ -163,7 +163,9 @@

   (local-eng/init! env/rt-ref)

-  (history/init! env/rt-ref {:start-token "/dashboard"})
+  (history/init! env/rt-ref
+    {:start-token "/dashboard"
+     :root-el root-el})

   (ev/reg-fx env/rt-ref :graph-api
     (http-fx/make-handler
@@ -192,6 +194,4 @@

   (sg/run-tx! env/rt-ref {:e ::m/init!})

-  (sg/init-root env/rt-ref ::ui root-el {})
-
   (js/setTimeout start 0))


Removed dead code.

Removed dead code.

--- src/member_domains/extraction.clj
+++ src/member_domains/extraction.clj
@@ -1,33 +0,0 @@
-(ns member-domains.extraction
-  "Extract DOIs from HTML."
-  (:require [member-domains.structured-extraction]
-            [member-domains.unstructured-extraction]))
-
-
-(defn fetch-with-cookies
-  "Fetch a URL, following redirects and accepting cookies along the way."
-  [url]
-  (loop [headers {}
-         depth 0
-         url url]
-    (if (> depth 4)
-      nil
-      (let [result @(client/get url {:follow-redirects false :headers headers})
-            cookie (-> result :headers :set-cookie)
-            new-headers (merge headers (when cookie {"Cookie" cookie}))]
-         (condp = (:status result)
-          200 result
-          302 (recur new-headers (inc depth) (-> result :headers :location))
-          nil)))))
-
-
-(defn extract-from-url
-  "Given a URL, extract the most likely valid DOI."
-  [url]
-  (let [data (fetch-with-cookies url)
-        from-tags (structured-extraction/from-tags html)
-        from-webpage (unstructured-extraction/from-webpage html url)
-        candidates (concat from-tags from-webpage)
-        ]
-
-  ))


more names

more names

--- src/sushi_machine/random_name.clj
+++ src/sushi_machine/random_name.clj
@@ -51,7 +51,10 @@
                  "mann"
                  "dame"
                  "programmerer"
-                 "selger"])
+                 "kunde"
+                 "kake"
+                 "fisk"
+                 "sushi"])

 (def verb ["hopper"
            "sniker"


(maint) Improve interface documentation

(maint) Improve interface documentation

Improving the docstrings of the Client interface. Making it clear that
unhandled exceptions that were thrown during a WebSocket connection
attempt will propagate through connection state inspectors.

--- src/puppetlabs/pcp/client.clj
+++ src/puppetlabs/pcp/client.clj
@@ -16,17 +16,19 @@
   (connecting? [client]
     "Returns true if the client is currently connecting to the pcp-broker")
   (connected? [client]
-    "Returns true if the client is currently connected to the pcp-broker")
+    "Returns true if the client is currently connected to the pcp-broker.
+    Propagates any unhandled exception thrown while attempting to connect.")
   (associating? [client]
     "Returns true if the client has not yet recieved an association response")
   (associated? [client]
     "Returns true if the client has been successfully assocated with a broker")
   (wait-for-connection [client timeout-ms]
     "Wait up to timeout-ms for a connection to be established.
-    Returns the client if the connection has been established, else nil")
+    Returns the client if the connection has been established, else nil.
+    Propagates any unhandled exception thrown while attempting to connect.")
   (wait-for-association [client timeout-ms]
     "Wait up to timeout-ms for a connection to be associated.  Returns the client if
-     the connection has been associated, else nil.
+    the connection has been associated, else nil.

      NOTE: There are two ways assocation may fail, we may not have
      recieved an association response in the timeout specified, or the
@@ -34,8 +36,8 @@
      associated? if you are interested in detecting the difference.")
   (send! [client message]
     "Send a message across the currently connected client.  Will
-    raise ::not-connected if the client is not currently connected to
-    a broker.")
+    raise ::not-connected if the client is not currently associated with the
+    pcp-broker.")
   (close [client]
     "Close the connection.  Once the client is close you will need a
     new one."))


Reorder in the source code.

Reorder in the source code.

--- src/org/spootnik/cyanite/util.clj
+++ src/org/spootnik/cyanite/util.clj
@@ -185,10 +185,10 @@
   [_ data]
   (aggregate-with :avg data))

-(def agg-path-re (format "^(%s)(\\.|\\-).*" (str/join "|" agg-methods)))
-
 (def agg-fn-map (zipmap agg-methods
                         (map #(partial aggregate-with (keyword %)) agg-methods)))
+
+(def agg-path-re (format "^(%s)(\\.|\\-).*" (str/join "|" agg-methods)))

 (defn agg-fn-by-path
   [path]


Organize animation wrapper

Organize animation wrapper

--- src/zaffre/animation/wrapper.cljc
+++ src/zaffre/animation/wrapper.cljc
@@ -38,7 +38,7 @@
     fg))

-;;; Effects
+;;; Effect helpers

 (defn rain-transition
   [advanced-cell old-cell]
@@ -152,81 +152,11 @@
            nil)
          (rain-transition advanced-cell old-cell))))))))

+
 (defprotocol ACmdStream
   (stream [this]))

-(defrecord RainEffect
-  [terminal layer-id rain-state]
-  ACmdStream
-  (stream [this]
-    (let [dt      33
-          [vw vh] (size terminal)]
-      (go-loop [rain-state rain-state]
-        (<! (timeout dt))
-        (zat/clear! terminal layer-id)
-        (let [chrs (for [[y line] (map-indexed vector rain-state)
-                         [x cell] (map-indexed vector line)
-                         :when cell]
-                     (rain-cell-char x y cell))]
-          (zat/put-chars!
-             terminal
-             layer-id
-             chrs)
-          (zat/refresh! terminal)
-          (recur (step-rain rain-state vw vh)))))))
-
-(defn make-rain-effect
-  [layer-id vw vh]
-  (let [rain-state (repeat vh (vec (repeat vw nil)))]
-    (fn [terminal]
-      (RainEffect. terminal layer-id rain-state))))
-
-(defrecord TransformEffect
-  [terminal layer-id ch from to duration]
-  ACmdStream
-  (stream [this]
-    (let [path (zutil/line-segment-fast-without-endpoints from to)
-          dt   (* 1000 (/ duration (count path)))]
-      (go-loop [[x y] (first path) xys (next path)]
-        (zat/clear! terminal layer-id)
-        (zat/put-chars! terminal layer-id [(assoc ch :x x :y y)])
-        (zat/refresh! terminal)
-        (<! (timeout dt))
-        (if xys
-          (recur (first xys) (next xys)))))))
-
-(defn make-transform-effect
-  [terminal layer-id ch from to duration]
-    (fn [terminal]
-      (TransformEffect. terminal layer-id ch from to duration)))
-
-(defrecord BlinkEffect
-  [terminal layer-id characters initial intervals]
-  ACmdStream
-  (stream [this]
-    (let [dt 1000]
-      (go-loop [state initial]
-        (zat/clear! terminal layer-id)
-        (when state
-          (zat/put-chars! terminal layer-id characters))
-        (zat/refresh! terminal)
-        (<! (timeout dt))
-        (recur (not state))))))
-
-(defn make-blink-effect
-  ([layer-id characters]
-    (make-blink-effect layer-id characters true))
-  ([layer-id characters initial]
-    (make-blink-effect layer-id characters initial (constantly 1000)))
-  ([layer-id characters initial intervals]
-    (fn [terminal]
-      (BlinkEffect. terminal layer-id characters initial intervals))))
-
-(defn make-blip-effect
-  [layer-id characters duration]
-  (make-blink-effect layer-id characters [duration]))
-
-
+;;; Event Streams
 ;; s is a seq of [dt [layer-id [{:c \* :x 1 :y 2 :fg [r g b] :bg [r g b]}...]]]
 (defrecord SeqEffect
   [terminal s]
@@ -242,18 +172,14 @@
         (when xs
           (recur (first xs) (next xs)))))))

-(defn from-seq
+(defn effect-from-events
   [s]
   (fn [terminal]
     (->SeqEffect terminal s)))

-(defn delay-seq [duration s]
+(defn delay-events [duration s]
   (cons [duration []] s))

-;; *******a*****b****c
-;; **d*****e***f**g****h
-;; ==
-;; --**d***a*e***bf*g*c**h
 (defn merge-events-helper [ss]
   (cond
     (empty? ss) []
@@ -289,7 +215,77 @@
   ([s] (filter-events s))
   ([s & ss] (filter-events (merge-events-helper (cons s ss)))))

-;;(merge-events [[0 :a] [1 :b]] [[2 :c]])
+;;; Effects
+(defrecord RainEffect
+  [terminal layer-id rain-state]
+  ACmdStream
+  (stream [this]
+    (let [dt      33
+          [vw vh] (size terminal)]
+      (go-loop [rain-state rain-state]
+        (<! (timeout dt))
+        (zat/clear! terminal layer-id)
+        (let [chrs (for [[y line] (map-indexed vector rain-state)
+                         [x cell] (map-indexed vector line)
+                         :when cell]
+                     (rain-cell-char x y cell))]
+          (zat/put-chars!
+             terminal
+             layer-id
+             chrs)
+          (zat/refresh! terminal)
+          (recur (step-rain rain-state vw vh)))))))
+
+(defn make-rain-effect
+  [layer-id vw vh]
+  (let [rain-state (repeat vh (vec (repeat vw nil)))]
+    (fn [terminal]
+      (RainEffect. terminal layer-id rain-state))))
+
+(defrecord TransformEffect
+  [terminal layer-id ch from to duration]
+  ACmdStream
+  (stream [this]
+    (let [path (zutil/line-segment-fast-without-endpoints from to)
+          dt   (* 1000 (/ duration (count path)))]
+      (go-loop [[x y] (first path) xys (next path)]
+        (zat/clear! terminal layer-id)
+        (zat/put-chars! terminal layer-id [(assoc ch :x x :y y)])
+        (zat/refresh! terminal)
+        (<! (timeout dt))
+        (if xys
+          (recur (first xys) (next xys)))))))
+
+(defn make-transform-effect
+  [terminal layer-id ch from to duration]
+    (fn [terminal]
+      (TransformEffect. terminal layer-id ch from to duration)))
+
+(defrecord BlinkEffect
+  [terminal layer-id characters initial intervals]
+  ACmdStream
+  (stream [this]
+    (let [dt 1000]
+      (go-loop [state initial]
+        (zat/clear! terminal layer-id)
+        (when state
+          (zat/put-chars! terminal layer-id characters))
+        (zat/refresh! terminal)
+        (<! (timeout dt))
+        (recur (not state))))))
+
+(defn make-blink-effect
+  ([layer-id characters]
+    (make-blink-effect layer-id characters true))
+  ([layer-id characters initial]
+    (make-blink-effect layer-id characters initial (constantly 1000)))
+  ([layer-id characters initial intervals]
+    (fn [terminal]
+      (BlinkEffect. terminal layer-id characters initial intervals))))
+
+(defn make-blip-effect
+  [layer-id characters duration]
+  (make-blink-effect layer-id characters [duration]))

 ;;; Queue cmds in a chan and foreard them to dst-chan on `(refresh)`.
 (defrecord WrappedAnimatedTerminal [terminal cmds dst-chan]


Removed udpating.

Removed udpating.

--- src/clj/elephantdb/common/status.clj
+++ src/clj/elephantdb/common/status.clj
@@ -11,7 +11,6 @@
 (defprotocol IStatus
   (ready?   [_] "Is the current status ready?")
   (loading? [_] "Is the current status loading?")
-  (updating? [_] "Is the current status updating?")
   (failed?  [_] "Is the current status failed?")
   (shutdown? [_] "Is the current status shutdown?"))

@@ -19,7 +18,6 @@
   (status [this] "Returns the current state object.")
   (to-ready [this] "Returns a new ready state.")
   (to-loading [this] "Returns a new loading-state.")
-  (to-updating [this] "Returns a new updating-state.")
   (to-failed [this msg] "Returns a new failed state.")
   (to-shutdown [this] "Returns a new shutting-down state."))

@@ -42,15 +40,13 @@
 (extend-type DomainStatus
   IStatus
   (loading? [status]
-    (= (.getSetField status) DomainStatus$_Fields/LOADING))
+    (boolean
+     (or (= (.getSetField status) DomainStatus$_Fields/LOADING)
+         (and (ready? status)
+              (.get_update_status (.get_ready status))))))

   (ready? [status]
     (= (.getSetField status) DomainStatus$_Fields/READY))
-
-  (updating? [status]
-    (boolean
-     (and (ready? status)
-          (.get_update_status (.get_ready status)))))

   (failed? [status]
     (= (.getSetField status) DomainStatus$_Fields/FAILED))
@@ -62,6 +58,5 @@
   (status [state] state)
   (to-loading [state] (t/loading-status))
   (to-ready [state] (t/ready-status))
-  (to-updating [state] (t/ready-status :updating? true))
   (to-failed [state msg] (t/failed-status msg))
   (to-shutdown [state] (t/shutdown-status)))


Fix reserves url and update J Sverdrup valuesˆ

--- src/clj_simple_chart/ncs/reserve.clj
+++ src/clj_simple_chart/ncs/reserve.clj
@@ -5,7 +5,7 @@
             [clj-simple-chart.ncs.raw-production :as raw-production]
             [clojure.test :as test]))

-(def field-reserves-url "http://factpages.npd.no/ReportServer?/FactPages/TableView/field_reserves&rs:Command=Render&rc:Toolbar=false&rc:Parameters=f&rs:Format=CSV&Top100=false&IpAddress=80.213.237.130&CultureCode=en")
+(def field-reserves-url "https://factpages.npd.no/ReportServer_npdpublic?/FactPages/TableView/field_reserves&rs:Command=Render&rc:Toolbar=false&rc:Parameters=f&rs:Format=CSV&Top100=false&IpAddress=92.220.29.120&CultureCode=en")
 (defonce field-reserves-raw (-> field-reserves-url
                                 (client/get)
                                 (:body)
@@ -80,6 +80,6 @@
 (test/is (some #{"SINDRE"} field-names))
 (test/is (not (some #{"33/9-6 DELTA"} field-names)))

-(test/is (= 9.13 (get-reserve "JOHAN SVERDRUP" :fldRecoverableGas)))
-(test/is (= 299.67 (get-reserve "JOHAN SVERDRUP" :fldRecoverableOil)))
-(test/is (= 303.68 (get-reserve "JOHAN SVERDRUP" :fldRecoverableLiquids)))
+(test/is (= 10.24 (get-reserve "JOHAN SVERDRUP" :fldRecoverableGas)))
+(test/is (= 406.58 (get-reserve "JOHAN SVERDRUP" :fldRecoverableOil)))
+(test/is (= 411.08 (get-reserve "JOHAN SVERDRUP" :fldRecoverableLiquids)))


let the backend set the privacy setting

let the backend set the privacy setting

--- src-cljs/frontend/controllers/controls.cljs
+++ src-cljs/frontend/controllers/controls.cljs
@@ -1675,8 +1675,6 @@
 (defmethod post-control-event! :document-privacy-changed
   [browser-state message {:keys [doc-id setting]} previous-state current-state]
   ;; privacy is on the write blacklist until we have a better way to do attribute-level permissions
-  (d/transact! (:db current-state)
-               [{:db/id doc-id :document/privacy setting}])
   (sente/send-msg (:sente current-state) [:frontend/change-privacy {:document/id doc-id
                                                                     :setting setting}]))


next session date

next session date

--- src/cljs/work_sessions/components/headers.cljs
+++ src/cljs/work_sessions/components/headers.cljs
@@ -31,7 +31,7 @@
    [:p
     (unescapeEntities "The session length is 1 hour, 13.30 — 14.30 Helsinki and Moscow time.")]
    [:p
-    (unescapeEntities "The next session will be in a week — on 16 June, time stays the same.")]
+    (unescapeEntities "The next session will be in a week — on 23 June, time stays the same.")]
    [:p
     "Join a simultaneous work session from your computer by opening "
     [:a {:href (str "http://sws.eeefff.org" session-room-url)


[#2252] Increment socket-timeout in import flow http calls

--- backend/src/akvo/lumen/lib/import/flow_common.clj
+++ backend/src/akvo/lumen/lib/import/flow_common.clj
@@ -6,7 +6,7 @@
             [clojure.string :as str])
   (:import [java.time Instant]))

-(def http-client-req-defaults (http.client/req-opts 10000))
+(def ^:private http-client-req-defaults (http.client/req-opts 30000))

 (defn survey-definition
   [api-root headers-fn instance survey-id]


Increase repl-timeout.

Increase repl-timeout.

--- .lein/profiles.clj
+++ .lein/profiles.clj
@@ -9,7 +9,7 @@
                   ;[lein-autodoc "0.9.0"]
                   [lein-marginalia "0.7.0"]
                   [lein-noir "1.2.0"]]
-        :repl-options {:timeout 40000}
+        :repl-options {:timeout 60000}
         :injections [(let [orig (ns-resolve (doto 'clojure.stacktrace require)
                                             'print-cause-trace)
                            new (ns-resolve (doto 'clj-stacktrace.repl require)


Lein.: add nrepl (recommended by Emacs. Live)

--- .lein/profiles.clj
+++ .lein/profiles.clj
@@ -1,6 +1,7 @@

 ;; Inspired heavily by http://dev.solita.fi/2014/03/18/pimp-my-repl.html
 {:user {:dependencies [
+                         [org.clojure/tools.nrepl "0.2.7"]
 ;;                       [org.clojars.gjahad/debug-repl "0.3.3"]
 ;;                       [im.chit/vinyasa "0.3.4"]
 ;;                       [spyscope "0.1.5"] ;; reader macro to print forms before execution: #spy/p, d
@@ -35,6 +36,8 @@
 ;;                     (require 'spyscope.core)
                      ]
         :plugins [
+                    [cider/cider-nrepl "0.9.1"]
+                    [refactor-nrepl "1.1.0"]
 ;;                  ;;[lein-catnip "0.5.1"]
 ;;                  ;;[codox "0.6.1"]                     ; document. generation from src
 ;;                  [lein-ring "0.9.3"]


[lein] bump cider

[lein] bump cider

--- .lein/profiles.clj
+++ .lein/profiles.clj
@@ -11,7 +11,7 @@

                   [lein-pprint                       "1.1.2"]
                   [lein-figwheel                     "0.5.10"]
-                  [cider/cider-nrepl                 "0.14.0"]
+                  [cider/cider-nrepl                 "0.15.0"]
                   [venantius/ultra                   "0.5.1"]
                   [venantius/yagni                   "0.1.4"]]


remove deprecated test

remove deprecated test

--- test/aspire/web_test.clj
+++ test/aspire/web_test.clj
@@ -19,5 +19,3 @@
 (deftest resource-app-test
   (is (= (:status app-response) 200)))

-(deftest resource-comps-test
-  (is (= (:status comps-response) 200)))


remove unreliable card check

remove unreliable card check

Signed-off-by: Michele Balistreri <47483730395cccb6448ad7313d5cedb48de25e40@bitgamma.com>

--- src/status_im/keycard/common.cljs
+++ src/status_im/keycard/common.cljs
@@ -299,22 +299,9 @@
 (fx/defn navigate-to-enter-pin-screen
   {:events [:keycard/navigate-to-enter-pin-screen]}
   [{:keys [db] :as cofx}]
-  (let [key-uid               (get-in db [:keycard :application-info :key-uid])
-        multiaccount-key-uid  (get-in db [:multiaccount :key-uid])
-        keycard-multiaccount? (boolean (get-in db [:multiaccount :keycard-pairing]))]
-    ;; TODO(Ferossgp): If last oeperation was with wrong card,
-    ;; it does not mean that current operation will be with the same card.
-    ;; Because key-uid is stored from latest application-info read user can't
-    ;; start the new operation cause account key-uid is not equal to the one from old read
-    ;; Ideally application info should not be stored in db and only checked when need
-    ;; thus we can ensure that we have always the right card info and not outdated one.
-    (if (or (nil? keycard-multiaccount?)
-            (and key-uid
-                 (= key-uid multiaccount-key-uid)))
-      (fx/merge cofx
-                {:db (assoc-in db [:keycard :pin :current] [])}
-                (navigation/navigate-to-cofx :enter-pin-settings nil))
-      (unauthorized-operation cofx))))
+  (fx/merge cofx
+            {:db (assoc-in db [:keycard :pin :current] [])}
+            (navigation/navigate-to-cofx :enter-pin-settings nil)))

 (defn- tag-lost-exception? [code error]
   (or


Synchronize visibility of lattice editor panel and its canvas

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

--- src/conexp/contrib/draw/lattices.clj
+++ src/conexp/contrib/draw/lattices.clj
@@ -26,6 +26,7 @@
                                      snapshots
                                      zoom-move]
         conexp.contrib.gui.util)
+  (:use seesaw.core)
   (:import [javax.swing JFrame JPanel BoxLayout JScrollBar JScrollPane]
            [java.awt Dimension BorderLayout]))

@@ -83,6 +84,14 @@
                           JScrollPane/HORIZONTAL_SCROLLBAR_NEVER)
             BorderLayout/WEST)
       (.setMinimumSize (Dimension. 0 0)))
+
+    ;;
+    (listen main-panel :component-hidden
+            (fn [_]
+              (.setVisible canvas false)))
+    (listen main-panel :component-shown
+            (fn [_]
+              (.setVisible canvas true)))

     ;; return main panel
     main-panel))


fixed check time to be between 20:00 - 22:00

--- src/trend_compliance/core.clj
+++ src/trend_compliance/core.clj
@@ -78,7 +78,7 @@
 (defn check-time-range [item]
   (let [date (:date (second item))
         parse-date (f/parse (f/formatter "EEE MMM dd HH:mm:ss yyyy") date)]
-    (if (and (>= (t/hour parse-date) 20) (<= (t/hour parse-date) 24)) item "deny")))
+    (if (and (>= (t/hour parse-date) 20) (<= (t/hour parse-date) 22)) item "deny")))

 (defn -main [& args]
   (println "Files (<path/to/WIRED.csv> <path/to/WIRELSS.csv> <path/to/DETAIL>): ")


Make :redef be non-fatal

Make :redef be non-fatal

--- planck-cljs/script/build.clj
+++ planck-cljs/script/build.clj
@@ -15,12 +15,15 @@
                       (System/getenv "CLJS_CHECKED_ARRAYS") (keyword (System/getenv "CLJS_CHECKED_ARRAYS"))
                       :else false))

+(def non-fatal-warnings #{:redef})
+
 (cljs.analyzer/with-warning-handlers
   [(fn [warning-type env extra]
      (when (warning-type cljs.analyzer/*cljs-warnings*)
        (when-let [s (cljs.analyzer/error-message warning-type extra)]
          (binding [*out* *err*]
-           (println "WARNING:" (cljs.analyzer/message env s))
+           (println "WARNING:" (cljs.analyzer/message env s)))
+         (when-not (warning-type non-fatal-warnings)
            (System/exit 1)))))]
   (api/build (api/inputs "src")
     {:output-dir         "out"


Wrap unprocessable handler in a ring-response to properly return a 404.

--- src/fcms/controllers/collections.clj
+++ src/fcms/controllers/collections.clj
@@ -8,7 +8,7 @@
             [fcms.models.item :as item]
             [fcms.views.collections :refer (render-collection)]))

-(def missing-response {:status 404 :body "Not a valid collection." :headers {"Content-Type" "text/plain"}})
+(def missing-response (liberator.representation/ring-response {:status 404 :body "Not a valid collection." :headers {"Content-Type" "text/plain"}}))

 (defn get-collection [coll-slug]
   (if-let [coll (collection/get-collection coll-slug)]


subscribe on login as well #165

subscribe on login as well
#165

--- src/cljs/swarmpit/component/page_login.cljs
+++ src/cljs/swarmpit/component/page_login.cljs
@@ -3,6 +3,7 @@
             [material.icon :as icon]
             [swarmpit.url :refer [dispatch!]]
             [swarmpit.storage :as storage]
+            [swarmpit.event.source :as eventsource]
             [swarmpit.component.handler :as handler]
             [swarmpit.token :as token]
             [swarmpit.routes :as routes]
@@ -27,6 +28,7 @@
      :on-success (fn [response]
                    (reset! local-state)
                    (storage/add "token" (:token response))
+                   (eventsource/init!)
                    (dispatch!
                      (routes/path-for-frontend :service-list)))
      :on-error   (fn [response]


Chapter 9 exercises

Chapter 9 exercises

--- src/clojure_for_the_brave_and_true/core.clj
+++ src/clojure_for_the_brave_and_true/core.clj
@@ -80,3 +80,41 @@
 (spell-slots character)

 (def spell-slots-comp (comp int inc #(/ % 2) c-int))
+
+;;;; Chapter 9 Exercises
+;; 1. Write a function that takes a string as an argument and searches for it on Bing and Google using the slurp function. Your function should return the HTML of the first page returned by the search.
+(defn goog-search-url
+  [search-term]
+  (str "https://www.google.com/search?hl=en&q=" search-term))
+
+(defn bing-search-url
+  [search-term]
+  (str "https://www.bing.com/search?q=" search-term))
+
+(defn search [search-term]
+  (let [result (promise)]
+    (doseq [engine [goog-search-url bing-search-url]]
+      (future (if-let [results-page (slurp (engine search-term))]
+                (deliver result results-page))))
+    @result))
+
+;; 2. Update your function so it takes a second argument consisting of the search engines to use.
+
+(defn search-on-engines [search-term & engine-names]
+  (let [engines {:bing bing-search-url :google goog-search-url}
+        result (promise)]
+    (doseq [engine-name engine-names]
+      (future (if-let [results-page (slurp ((get engines engine-name) search-term))]
+                (deliver result results-page))))
+    (deref result 5000 :timeout)))
+
+;; Note that Google doesn't seem to work, it always returns a 403
+
+;; 3. Create a new function that takes a search term and search engines as arguments, and returns a vector of the URLs from the first page of search results from each search engine.
+
+(defn results-from-search [search-term & engines]
+  (let [results-page (search-on-engines search-term engines)
+        matches (re-seq #"href=\"([^\" ]*)\"" results)
+        uris (map second matches)
+        external-links (filter #(re-find #"http(?s)://" %) uris)]
+    external-links))


slightly optimize update-position

slightly optimize update-position

--- src/voke/system/movement.cljs
+++ src/voke/system/movement.cljs
@@ -109,15 +109,14 @@
     entity))

 (sm/defn update-position :- Entity
-  ; apparently we spend 4% of our time in this trivial-ass function. TODO: investigate
   [entity :- Entity]
-  (reduce
-    (fn [entity axis]
-      (update-in entity
-                 [:shape :center axis]
-                 #(+ % (safe-get-in entity [:motion :velocity axis]))))
-    entity
-    [:x :y]))
+  ; we spend about 4% of our time in this function. i can't figure out how to optimize it any more than this.
+  (let [velocity (get-in entity [:motion :velocity])
+        center (get-in entity [:shape :center])
+        new-center (-> center
+                       (assoc :x (+ (velocity :x) (center :x)))
+                       (assoc :y (+ (velocity :y) (center :y))))]
+    (assoc-in entity [:shape :center] new-center)))

 (sm/defn relevant-to-movement-system? :- s/Bool
   [entity :- Entity]
@@ -139,6 +138,6 @@

                   (when (not= moved-entity entity)
                     (attempt-to-move! entity
-                                      (safe-get-in moved-entity [:shape :center])
-                                      (safe-get-in moved-entity [:motion :velocity])
+                                      (get-in moved-entity [:shape :center])
+                                      (get-in moved-entity [:motion :velocity])
                                       entities)))))})


Fix rule name underscores in tests, too

Fix rule name underscores in tests, too

This is what happens when tests aren't automatic

--- test/clojure_ruby/parser_test.clj
+++ test/clojure_ruby/parser_test.clj
@@ -19,7 +19,7 @@
          (ruby-parser " a ")
          (ruby-parser "\n\t a\n\t ")
          (ruby-parser " \t\na \t\n ")
-         [[:var_ref "a"]])))
+         [[:var-ref "a"]])))

 (deftest assignment
   (is (unambigous? "a = 1"))
@@ -31,23 +31,23 @@
   (is (= (ruby-parser "a = b")
          [[:assignment
            "a"
-           [:var_ref "b"]]])))
+           [:var-ref "b"]]])))

 (deftest mutating-assignment
   (is (unambigous?    "a += 1"))
   (is (= (ruby-parser "a += 1")
-         [[:assignment_mutate "a" "+=" [:number "1"]]]))
+         [[:assignment-mutate "a" "+=" [:number "1"]]]))
   (is (unambigous?    "a -= 1"))
   (is (= (ruby-parser "a -= 1")
-         [[:assignment_mutate "a" "-=" [:number "1"]]])))
+         [[:assignment-mutate "a" "-=" [:number "1"]]])))

 (deftest assignment-and-method-call
   (is (unambigous? "a = o.m"))
   (is (= (ruby-parser "a = o.m")
          [[:assignment
            "a"
-           [:method_call
-            [:var_ref "o"]
+           [:method-call
+            [:var-ref "o"]
             "m"]]])))

 (deftest method-calls
@@ -55,101 +55,101 @@
   (is (unambigous? "alpha.beta()"))
   (is (= (ruby-parser "alpha.beta")
          (ruby-parser "alpha.beta()")
-         [[:method_call
-           [:var_ref "alpha"]
+         [[:method-call
+           [:var-ref "alpha"]
            "beta"]]))
   (is (unambigous? "alpha.beta(1)"))
   (is (= (ruby-parser "alpha.beta(1)")
-         [[:method_call
-           [:var_ref "alpha"]
+         [[:method-call
+           [:var-ref "alpha"]
            "beta"
            [:number "1"]]]))
   (is (unambigous? "alpha.beta(1, 2)"))
   (is (= (ruby-parser "alpha.beta(1, 2)")
-         [[:method_call
-           [:var_ref "alpha"]
+         [[:method-call
+           [:var-ref "alpha"]
            "beta"
            [:number "1"]
            [:number "2"]]]))
   (is (unambigous? "alpha[1]"))
   (is (= (ruby-parser "alpha[1]")
-         [[:method_call_bracket
-           [:var_ref "alpha"]
+         [[:method-call-bracket
+           [:var-ref "alpha"]
            [:number "1"]]]))
   (is (unambigous? "alpha[1] = 2"))
   (is (= (ruby-parser "alpha[1] = 2")
-         [[:method_call_bracket_assignment
-           [:var_ref "alpha"]
+         [[:method-call-bracket-assignment
+           [:var-ref "alpha"]
            [:number "1"]
            [:number "2"]]]))
   (is (unambigous?    "alpha[1] += 2"))
   (is (= (ruby-parser "alpha[1] += 2")
-         [[:method_call_bracket_assignment_mutate
-           [:var_ref "alpha"]
+         [[:method-call-bracket-assignment-mutate
+           [:var-ref "alpha"]
            [:number "1"]
            "+="
            [:number "2"]]]))
   (is (unambigous? "alpha < 4"))
   (is (= (ruby-parser "alpha < 4")
-         [[:method_call_relop
-           [:var_ref "alpha"]
+         [[:method-call-relop
+           [:var-ref "alpha"]
            "<"
            [:number "4"]]])))

 (deftest relational-operator-has-higher-precedence-than-logic-operator
   (is (unambigous?    "a < b && x == y"))
   (is (= (ruby-parser "a < b && x == y")
-         [[:method_call_logic
-           [:method_call_relop [:var_ref "a"] "<" [:var_ref "b"]]
+         [[:method-call-logic
+           [:method-call-relop [:var-ref "a"] "<" [:var-ref "b"]]
            "&&"
-           [:method_call_relop [:var_ref "x"] "==" [:var_ref "y"]]]])))
+           [:method-call-relop [:var-ref "x"] "==" [:var-ref "y"]]]])))

 (deftest method-call-has-higher-precedence-than-relational-operator
   (is (unambigous? "alpha.beta < 4"))
   (is (= (ruby-parser "alpha.beta < 4")
-         [[:method_call_relop
-           [:method_call
-            [:var_ref "alpha"]
+         [[:method-call-relop
+           [:method-call
+            [:var-ref "alpha"]
             "beta"]
            "<"
            [:number "4"]]]))
   (is (unambigous? "1 == gamma.delta"))
   (is (= (ruby-parser "1 == gamma.delta")
-         [[:method_call_relop
+         [[:method-call-relop
            [:number "1"]
            "=="
-           [:method_call
-            [:var_ref "gamma"]
+           [:method-call
+            [:var-ref "gamma"]
             "delta"]]])))

 (deftest flow-if
   (is (unambigous?    "if 1; o.m; 10; end"))
   (is (= (ruby-parser "if 1; o.m; 10; end")
          [[:if
-           [:if_branch [:number "1"]
-            [:method_call [:var_ref "o"] "m"]
+           [:if-branch [:number "1"]
+            [:method-call [:var-ref "o"] "m"]
             [:number "10"]]]]))
   (is (unambigous?    "if 1; 2; elsif 3; 4; end"))
   (is (= (ruby-parser "if 1; 2; elsif 3; 4; end")
          [[:if
-           [:if_branch [:number "1"]
+           [:if-branch [:number "1"]
             [:number "2"]]
-           [:if_branch [:number "3"]
+           [:if-branch [:number "3"]
             [:number "4"]]]])))

 (deftest flow-while
   (is (unambigous? "while 1; o.m; 10; end"))
   (is (= (ruby-parser "while 1; o.m; 10; end")
          [[:while [:number "1"]
-           [:method_call [:var_ref "o"] "m"]
+           [:method-call [:var-ref "o"] "m"]
            [:number "10"]]])))

 (deftest flow-until
   (is (unambigous? "until 1; o.m; 10; end"))
   (is (= (ruby-parser "until 1; o.m; 10; end")
          [[:until [:number "1"]
-           [:method_call [:var_ref "o"] "m"]
+           [:method-call [:var-ref "o"] "m"]
            [:number "10"]]])))

 (deftest flow-case
@@ -167,17 +167,17 @@
   (is (= (ruby-parser "a;b")
          (ruby-parser "a\nb")
          (ruby-parser "a \n b")
-         [[:var_ref "a"]
-          [:var_ref "b"]])))
+         [[:var-ref "a"]
+          [:var-ref "b"]])))

 (deftest rewrite-mutating-assignment
   (is (= (rewrite-assignment-mutate :var-name "+=" :arg)
-         [:assignment :var-name [:method_call [:var_ref :var-name] "+" :arg]])))
+         [:assignment :var-name [:method-call [:var-ref :var-name] "+" :arg]])))

 (deftest rewrite-mutating-bracket-assignment
   (is (= (rewrite-bracket-assignment-mutate :obj :idx "-=" :val)
-         [:method_call :obj "[]=" :idx
-          [:method_call
-           [:method_call :obj "[]" :idx]
+         [:method-call :obj "[]=" :idx
+          [:method-call
+           [:method-call :obj "[]" :idx]
            "-"
            :val]])))


allow configuring :transport-fn for nrepl

fixes #514

--- src/main/shadow/cljs/devtools/server/nrepl.clj
+++ src/main/shadow/cljs/devtools/server/nrepl.clj
@@ -113,16 +113,20 @@
         handler-fn
         ((apply comp (reverse middleware-stack)) server/unknown-op)

-        {:keys [host port]
+        {:keys [host port transport-fn]
          :or {host "0.0.0.0"
               port 0}}
-        merged-config]
+        merged-config
+
+        transport-fn
+        (requiring-resolve (or transport-fn 'nrepl.transport/bencode))]

     (log/debug ::config merged-config)

     (server/start-server
       :bind host
       :port port
+      :transport-fn transport-fn
       ;; breaks vim-fireplace, doesn't even show up in Cursive
       #_:greeting-fn
       #_(fn [transport]


new test

new test

--- test/dalap/test/html/selector.clj
+++ test/dalap/test/html/selector.clj
@@ -56,6 +56,7 @@
 (defrecord CustomType [a b])
 (defrecord CustomType2 [a b])
 (defrecord CustomType3 [a b])
+(deftype CustomType4 [a b])

 (deftest test-match-selector*-custom-types
   (let [item    (CustomType. "hello" "world")
@@ -82,6 +83,7 @@
          ;; / java 1.6 jvms for some reason TODO
          ;;[#(= CustomType3 (type %))] #(do ["*" (:a %) "*"])
          [#(= CustomType3 (type %))] (fn [o w] ["*" (:a o) "*"])
+         [CustomType4] (fn [o w] ["*" (.a o) "*"])

          ;; simple replacements
          [:pre.foo] (fn anon-vis [el w] (w [1 2 3 4]))
@@ -113,13 +115,15 @@
                (html/to-html [:div.happy [:p.bold "hello"
                                           [:div.happy [:p.bold "hello"]]]])))

-        ;; custom types/records
+        ;; custom records/types
         (is (= (vis [:div [:p [(CustomType. 999 888)]]])
                (html/to-html [:div.happy [:p.bold "999"]])))
         (is (= (vis [:div [:p [(CustomType2. "--" "^^")]]])
                (html/to-html [:div.happy [:p.bold "*--*"]])))
         (is (= (vis [:div [:p [(CustomType3. (range 10) "foo")]]])
                (html/to-html [:div.happy [:p.bold "*0123456789*"]])))
+        (is (= (vis [:div [:p [(CustomType4. [:b "a"] "b")]]])
+               (html/to-html [:div.happy [:p.bold ["*" [:b "a"] "*"]]])))

         ;; using sets/maps
         (is (= (vis [:div [:p [88 89]]])


Get attack options with obstacles and catapult

--- test/obb_rules/ai/common_test.clj
+++ test/obb_rules/ai/common_test.clj
@@ -16,6 +16,7 @@

 (def rain (unit/get-unit-by-name "rain"))
 (def krill (unit/get-unit-by-name "krill"))
+(def vect (unit/get-unit-by-name "vector"))

 (deftest get-empty-attack-options
   (let [board (-> (board/create-board)
@@ -34,7 +35,7 @@
     (is (< 0 (option :value)))
     (is (= [[:attack [2 5] [2 6]]] (option :actions)))))

-(deftest get-direct-attack-options
+(deftest get-distance-attack-options
   (let [board (-> (board/create-board)
                   (place-element [2 5] (create-element :p1 krill 1 :south [2 5]))
                   (place-element [2 7] (create-element :p2 rain 1 :north [2 7])))
@@ -44,3 +45,20 @@
     (is (= 2 (option :distance)))
     (is (< 0 (option :value)))
     (is (= [[:attack [2 5] [2 7]]] (option :actions)))))
+
+(deftest get-distance-attack-options
+  (let [board (-> (board/create-board)
+                  (place-element [2 1] (create-element :p1 vect 1 :south [2 1]))
+                  (place-element [2 2] (create-element :p2 rain 1 :north [2 2]))
+                  (place-element [2 4] (create-element :p1 rain 1 :north [2 4]))
+                  (place-element [2 5] (create-element :p2 rain 1 :north [2 5])))
+        options (common/attack-options board (board/get-element board [2 1]))
+        option1 (first options)
+        option2 (last options)]
+    (is (= 2 (count options)))
+    (is (= 1 (option1 :distance)))
+    (is (< 0 (option1 :value)))
+    (is (= [[:attack [2 1] [2 2]]] (option1 :actions)))
+    (is (= 4 (option2 :distance)))
+    (is (< 0 (option2 :value)))
+    (is (= [[:attack [2 1] [2 5]]] (option2 :actions)))))


Fix submit test.

Fix submit test.

--- test/onyx/log/submit_job_test.clj
+++ test/onyx/log/submit_job_test.clj
@@ -34,6 +34,7 @@

 (def entry (create-log-entry :submit-job {:id :j1
                                           :task-scheduler :onyx.task-scheduler/balanced
+                                          :saturation 42
                                           :tasks [:t1 :t2 :t3]}))

 (def f (partial extensions/apply-log-entry (assoc entry :message-id 0)))


Small performance improvements (and limitations) for selecting top level form

--- src/lt/plugins/cljrefactor/util.cljs
+++ src/lt/plugins/cljrefactor/util.cljs
@@ -135,56 +135,72 @@
   (when-let [next-loc (move-loc ed dir loc)]
     (get-ch ed next-loc)))

-
-(defn loc-next-end-pair [ed loc level]
-  (when loc
-    (let [ch (some->> loc (get-ch ed))
-          match? (and (end-pair? ch) (= 0 level))]
-
-      (cond
-       (and (end-loc? ed loc) (not match?)) nil
-       (and (nil? ch) (peek-ch ed :right loc)) (recur ed (move-loc ed :right loc) level)
-       (nil? ch) nil ;; TODO: Need to get rid of these to handle newline only lines in forms (dogslow without)
-       (string|comment? ed loc) (recur ed (move-loc ed :right loc) level)
-       match? loc
-       (start-pair? ch) (recur ed (move-loc ed :right loc) (inc level))
-       (end-pair? ch) (recur ed (move-loc ed :right loc) (dec level))
-       :else (recur ed (move-loc ed :right loc) level)))))
-
-
-
-(defn loc-next-matching-start-pair [ed loc pair-ch level]
-  (when loc
-    (let [ch (some->> loc (get-ch ed))
-          match? (and (= ch pair-ch) (= 0 level))]
-      (cond
-       (and (start-loc? ed loc) (not match?)) nil
-       (and (nil? ch) (peek-ch ed :left loc)) (recur ed (move-loc ed :left loc) pair-ch level)
-       (nil? ch) nil ;; TODO: Need to get rid of these to handle newline only lines in forms (dogslow without)
-       (string|comment? ed loc) (recur ed (move-loc ed :left loc) pair-ch level)
-       match? loc
-       (= ch (get opposites pair-ch)) (recur ed (move-loc ed :left loc) pair-ch (inc level))
-       (= ch pair-ch) (recur ed (move-loc ed :left loc) pair-ch (dec level))
-       :else (recur ed (move-loc ed :left loc) pair-ch level)))))
-
+(defn within-range [[start end] cur]
+  (>= end (:line cur) start))
+
+
+(defn loc-next-end-pair [ed loc]
+  (let [search-range [(:line loc) (+ (:line loc) 100)]]
+    (loop [cur loc
+           line (editor/line ed (:line loc))
+           level 0]
+      (if (or (not cur)
+              (not line)
+              (not (within-range search-range cur)))
+        nil
+        (let [ch (get line (:ch cur))
+              next-loc (move-loc ed :right cur)
+              next-line (if (not= (:line cur) (:line next-loc))
+                          (editor/line ed (:line next-loc))
+                          line)]
+          (cond
+           (and (or (start-pair? ch) (end-pair? ch))
+                (string|comment? ed cur)) (recur next-loc next-line level)
+           (start-pair? ch) (recur next-loc next-line (inc level))
+           (and (end-pair? ch) (= 0 level)) cur
+           (end-pair? ch) (recur next-loc next-line (dec level))
+           :else (recur next-loc next-line level)))))))
+
+
+
+(defn loc-next-matching-start-pair [ed loc pair-ch]
+  (let [search-range [(- (:line loc) 100) (:line loc)]]
+    (loop [cur loc
+           line (editor/line ed (:line loc))
+           level 0]
+      (if (or (not cur)
+              (not line)
+              (not (within-range search-range cur)))
+        nil
+        (let [ch (get line (:ch cur))
+              next-loc (move-loc ed :left cur)
+              next-line (if (not= (:line cur) (:line next-loc))
+                          (editor/line ed (:line next-loc))
+                          line)]
+          (cond
+           (and (or (= ch (get opposites pair-ch))
+                    (= ch pair-ch))
+                (string|comment? ed cur)) (recur next-loc next-line level)
+           (= ch (get opposites pair-ch)) (recur next-loc next-line (inc level))
+           (and (= ch pair-ch) (= 0 level)) cur
+           (= ch pair-ch) (recur next-loc next-line (dec level))
+           :else (recur next-loc next-line level)))))))

 (defn get-bounds-matching [ed loc]
-  (when-let [loc-next-end (loc-next-end-pair ed loc 0)]
+  (when-let [loc-next-end (loc-next-end-pair ed loc)]
     (when-let [loc-next-start (loc-next-matching-start-pair ed
                                                             (move-loc ed :left loc-next-end)
-                                                            (get opposites (get-ch ed loc-next-end))
-                                                            0)]
+                                                            (get opposites (get-ch ed loc-next-end)))]
       [loc-next-start loc-next-end])))

 (defn get-next-bounds-matching [ed [start end]]
-  (when-let [loc-next-end (loc-next-end-pair ed (move-loc ed :right end) 0)]
+  (when-let [loc-next-end (loc-next-end-pair ed (move-loc ed :right end))]
      (when-let [loc-next-start (loc-next-matching-start-pair ed
                                                              (move-loc ed :left start)
-                                                             (get opposites (get-ch ed loc-next-end))
-                                                             0)]
+                                                             (get opposites (get-ch ed loc-next-end)))]
        [loc-next-start loc-next-end])))

@@ -192,9 +208,9 @@
   ([ed] (get-top-level-form ed (editor/->cursor ed)))
   ([ed loc]
    (if-let [[start end] (some->> (get-bounds-matching ed loc)
-                                   (iterate (partial get-next-bounds-matching ed))
-                                   (take-while identity)
-                                   last)]
+                                 (iterate (partial get-next-bounds-matching ed))
+                                 (take-while identity)
+                                 last)]

      {:form-str (editor/range ed start (update-in end [:ch] inc))
       :start start


Test the other randombytes path

Test the other randombytes path

--- test/caesium/randombytes_test.clj
+++ test/caesium/randombytes_test.clj
@@ -9,6 +9,10 @@
     (is (= 10 (bb/buflen buf)))))

 (deftest random-to-buf!-test
+  (let [buf (bb/alloc 30)]
+    (is (= #{0} (set (seq (bb/->bytes buf)))))
+    (r/random-to-buf! buf)
+    (is (not= #{0} (set (seq (bb/->bytes buf))))))
   (let [buf (bb/alloc 20)]
     (r/random-to-buf! buf 10)
     (let [s (seq (bb/->bytes buf))


Tidy up tests

Tidy up tests

--- test/onix/web_test.clj
+++ test/onix/web_test.clj
@@ -43,79 +43,78 @@
       *version* => "something")

 (fact "that ping pongs"
-      (:body (request :get "/ping")) => "pong")
+      (request :get "/ping") => (contains {:body "pong"}))

 (fact "that our healthcheck gives a 200 status if things are healthy"
-      (:status (request :get "/healthcheck")) => 200
+      (request :get "/healthcheck") => (contains {:status 200})
       (provided
        (persistence/dynamo-health-check) => true))

 (fact "that our healthcheck gives a 500 status if things aren't healthy"
-      (:status (request :get "/healthcheck")) => 500
+      (request :get "/healthcheck") => (contains {:status 500})
       (provided
        (persistence/dynamo-health-check) => false))

 (fact "that our pokémon resource is awesome"
-      (:status (request :get "/1.x/pokemon")) => 200)
+      (request :get "/1.x/pokemon") => (contains {:status 200}))

 (fact "that our icon resource is awesome"
-      (:status (request :get "/1.x/icon")) => 200)
+      (request :get "/1.x/icon") => (contains {:status 200}))

 (fact "that creating an application successfully does the right thing"
-      (:status (request :post "/1.x/applications" (to-json {:name "something"}))) => 201
+      (request :post "/1.x/applications" (to-json {:name "something"})) => (contains {:status 201})
       (provided
        (persistence/create-application {:name "something"}) => true))

 (fact "that failing to create an application does the right thing"
-      (:status (request :post "/1.x/applications" (to-json {:name "something"}))) => 409
+      (request :post "/1.x/applications" (to-json {:name "something"})) => (contains {:status 409})
       (provided
        (persistence/create-application {:name "something"}) => false))

 (fact "that listing applications does the right thing"
-      (:body (request :get "/1.x/applications")) => {:applications ["app1" "app2" "app3"]}
+      (request :get "/1.x/applications") => (contains {:body {:applications ["app1" "app2" "app3"]}})
       (provided
        (persistence/list-applications) => ["app1" "app2" "app3"]))

 (fact "that getting an application which doesn't exist is a 404"
-      (:status (request :get "/1.x/applications/onix")) => 404
+      (request :get "/1.x/applications/onix") => (contains {:status 404})
       (provided
        (persistence/get-application "onix") => nil))

 (fact "that getting an application which exists gives back the data"
-      (:body (request :get "/1.x/applications/onix")) => {:name "onix"
-                                                          :metadata {:something "interesting"}}
+      (request :get "/1.x/applications/onix") => (contains {:body {:name "onix" :metadata {:something "interesting"}}})
       (provided
        (persistence/get-application "onix") => {:name "onix"
                                                 :metadata {:something "interesting"}}))

 (fact "that getting an individual metadata item for an application which doesn't exist is a 404"
-      (:status (request :get "/1.x/applications/onix/property")) => 404
+      (request :get "/1.x/applications/onix/property") => (contains {:status 404})
       (provided
        (persistence/get-application "onix") => nil))

 (fact "that getting an individual metadata item for an application which exists but doesn't have the property is a 404"
-      (:status (request :get "/1.x/applications/onix/property")) => 404
+      (request :get "/1.x/applications/onix/property") => (contains {:status 404})
       (provided
        (persistence/get-application "onix") => {:name "onix"
                                                 :metadata {:something "else"}}))

 (fact "that getting an individual metadata item which exists gives back the data"
-      (:body (request :get "/1.x/applications/onix/property")) => {:property "hello"}
+      (request :get "/1.x/applications/onix/property") => (contains {:body {:property "hello"}})
       (provided
        (persistence/get-application "onix") => {:name "onix"
                                                 :metadata {:property "hello"}}))

 (fact "that putting an individual metadata item for an application which didn't exist is 404"
-      (:status (request :put "/1.x/applications/onix/property" (to-json {:value "something"}))) => 404
+      (request :put "/1.x/applications/onix/property" (to-json {:value "something"})) => (contains {:status 404})
       (provided
        (persistence/update-application-metadata "onix" "property" "something") => nil))

 (fact "that putting an individual metadata item for an application which exists is a 201"
-      (:status (request :put "/1.x/applications/onix/property" (to-json {:value "something"}))) => 201
+      (request :put "/1.x/applications/onix/property" (to-json {:value "something"})) => (contains {:status 201})
       (provided
        (persistence/update-application-metadata "onix" "property" "something") => {:property "something"}))

 (fact "that deleting an individual metadata item is a 204"
-      (:status (request :delete "/1.x/applications/onix/property")) => 204
+      (request :delete "/1.x/applications/onix/property") => (contains {:status 204})
       (provided
        (persistence/delete-application-metadata-item "onix" "property") => anything))


Rearrange SSH tab structure for v2

Rearrange SSH tab structure for v2

--- src-cljs/frontend/components/build_head.cljs
+++ src-cljs/frontend/components/build_head.cljs
@@ -284,6 +284,16 @@
      [:p "This will grant you ssh access to the build's containers, prevent the deploy step from starting, and keep the build up for 30 minutes after it finishes to give you time to investigate."]
      [:p "More information " [:a {:href (routes/v1-doc-subpage {:subpage "ssh-build"})} "in our docs"] "."]])

+(defn ssh-ad-v2
+  "Note about why you might want to SSH into a build and buttons to do so"
+  [build owner]
+    [:div.ssh-ad
+     [:p
+      "Often the best way to troubleshoot problems is to ssh into a running or finished build to look at log files, running processes, and so on.
+       This will grant you ssh access to the build's containers, prevent the deploy step from starting, and keep the build up for 30 minutes after it finishes to give you time to investigate.
+       More information " [:a {:href (routes/v1-doc-subpage {:subpage "ssh-build"})} "in our docs"] "."
+     (om/build ssh-buttons build)]])
+
 (defn ssh-instructions
   "Instructions for SSHing into a build that you can SSH into"
   [build owner]
@@ -322,8 +332,12 @@
            (if for-current-user?
              (cond
                (build-model/ssh-enabled-now? build) (ssh-instructions build owner)
-               (build-model/finished? build) (ssh-ad build owner))
-             (ssh-ad build owner))])))))
+               (build-model/finished? build) (if (feature/enabled? :ui-v2)
+                                               (ssh-ad-v2 build owner)
+                                               (ssh-ad build owner)))
+             (if (feature/enabled? :ui-v2)
+               (ssh-ad-v2 build owner)
+               (ssh-ad build owner)))])))))

 (defn build-time-visualization [build owner]
   (reify


fix: template.clj reflection warnings

fix: template.clj reflection warnings

--- src/main/clojure/pdok/featured/template.clj
+++ src/main/clojure/pdok/featured/template.clj
@@ -11,20 +11,20 @@
 (defn template-key [dataset extract-type name]
   (str (template-qualifier dataset extract-type) name))

-(defn- template-with-metadata* [dataset file]
+(defn- template-with-metadata* [dataset ^java.io.File file]
   (let [file-name (.getName file)]
     {:dataset dataset
-     :extract-type (cond-> file
+     :extract-type (cond-> file
                            (-> file .getParentFile .getName (= "partials")) .getParentFile
-                           true .getParentFile
-                           true .getName)
-     :name (subs file-name 0 (.lastIndexOf file-name "."))
+                           true .getParentFile
+                           true .getName)
+     :name (subs file-name 0 (.lastIndexOf file-name "."))
      :template (slurp (.getPath file))}))

 (defn templates-with-metadata [dataset template-location]
-    "Returns the template-contents with metadata included.
+    "Returns the template-contents with metadata included.
      The metadata is based on dataset and where template-file in direcotry structure is located."
-  (let [template-files (filter #(.isFile %) (file-seq (io/file template-location)))]
+    (let [template-files (filter (fn [^java.io.File f] (.isFile f)) (file-seq (io/file template-location)))]
     (map (partial template-with-metadata* dataset) template-files)))

 (defn- clean-up [source]
@@ -34,7 +34,7 @@
   (let [template (clean-up template)
         template (m/replace-in-template template (template-qualifier dataset extract-type) "{{>")
         template-key (template-key dataset extract-type name)]
-      (try
+      (try
         (m/register template-key template)
         (m/render template-key {}) ;check template can be rendered with empty map
         {:template template-key :status "registered"}
@@ -42,8 +42,3 @@
         (log/error "Template: " template-key " cannot be registered")
         (log/error e)
         false))))
-
-
-
-
-


largest minterms

largest minterms

--- stuf/src/sandbox/4clojure.clj
+++ stuf/src/sandbox/4clojure.clj
@@ -1130,7 +1130,7 @@
 (def mp [[1  1  1  1]
          [5  6  7  8]
          [9  10 11 12]
-         [1 14 15 16]])
+         [1 14 15  1]])

 (defn divs [len x]
   (for [i (range 1 (inc len)) j (range 1 (inc len)) :when (= x (* i j))] [i j]))
@@ -1159,5 +1159,15 @@
         ones (for [i (range len) j (range len)
                    :when (= 1 (get-in kmap [i j]))] [i j])]
     (mapcat #(minterms-iter kmap %) ones)))
-
-
+
+(defn smaller? [term terms]
+  (some empty? (map #(clojure.set/difference term %) terms)))
+
+(defn largest
+  ([minterms] (max-minterms minterms '()))
+  ([[fst & rst :as minterm] res]
+   (cond
+     (not (seq minterm)) res
+     (or (smaller? fst res) (smaller? fst rst)) (largest rst res)
+     :else (largest rst (conj res fst)))))
+


152 latin square check

152 latin square check

--- stuf/src/sandbox/4clojure.clj
+++ stuf/src/sandbox/4clojure.clj
@@ -1300,6 +1300,10 @@

 ;;152 Latin Square Slicing
 (defn lsqr? [sq]
-  (let [cnt (count sq)]
-    (and (= cnt (count (first sq)))
-         (= cnt (count (reduce into #{} sq))))))
+  (let [cnt (count sq)
+        tsq (apply map vector sq)
+        xsq (concat tsq sq)
+        cnts (map #((comp count into) #{} %) xsq)]
+    (and (= cnt (count (reduce into #{} sq)))
+         (every? #(= cnt %) cnts))))
+


simplify before setup, every test should choose where to start

--- pedestal-app/test/semtag_web/integration_test.clj
+++ pedestal-app/test/semtag_web/integration_test.clj
@@ -45,9 +45,6 @@
 (use-fixtures :each
               (fn [f]
                 (taxi/set-driver! (init-driver {:webdriver (PhantomJSDriver. (DesiredCapabilities. ))}))
-                (taxi/to "out/public/semtag-web-test.html")
-                (Thread/sleep 1000)
-
                 (binding [ctest/report report] (f))
                 (taxi/quit)))

@@ -62,10 +59,15 @@
   (core/click (taxi/find-element {:tag :a :text text}))
   (Thread/sleep 500))

+(defn visit [url]
+  (taxi/to (full-app-url url))
+  (Thread/sleep 500))
+
 (defn url-ends-with [& args]
   (is (ends-with? (taxi/current-url) (apply app-url args))))

 (deftest navbar-links-work
+  (visit "")
   (url-ends-with "")
   (click "Tag Stats")
   (url-ends-with "#/tag-stats")
@@ -80,6 +82,7 @@
   (url-ends-with "#/"))

 (deftest regular-search-works
+  (visit "")
   (is (seq (taxi/elements "#tags option")) "renders a datalist to autocomplete input")
   (taxi/input-text "#url_search_text" "feynman")
   (taxi/click "#url_search_button")
@@ -91,6 +94,7 @@
   (is (seq (taxi/elements "#search_table tbody tr"))))

 (deftest second-search-with-another-search-type-works
+  (visit "")
   (taxi/input-text "#url_search_text" "feynman")
   (taxi/click "#url_search_button")
   (Thread/sleep 1000)
@@ -120,7 +124,7 @@
     (url-ends-with rel-url)))

 (deftest direct-search-url-works
-  (taxi/to (full-app-url "#/search?query=maxwell&search-type=tagged-with-type"))
+  (visit "#/search?query=maxwell&search-type=tagged-with-type")
   (taxi/refresh)
   (Thread/sleep 500)

@@ -129,6 +133,7 @@

 ;; TODO - revisit not being able to go forward - log count stays the same going forward
 #_(deftest history-works
+  (visit "")
   (click "Tag Stats")
   (is (.endsWith (taxi/current-url) "/semtag-web-test.html#/tag-stats"))
   (back)


Use soft-masking for anti-aliased saturation gauge

--- src/afterglow/controllers/ableton_push_2.clj
+++ src/afterglow/controllers/ableton_push_2.clj
@@ -796,7 +796,7 @@
     (.draw mask-graphics (java.awt.geom.Ellipse2D$Double. 5.0 5.0 40.0 40.0))

     ;; Render the track into the mask using SrcAtop, which effectively uses the alpha value as
-    ;; a covereage value for each pixel stored in the destination. For the areas outside our clip
+    ;; a coverage value for each pixel stored in the destination. For the areas outside our clip
     ;; shape, the destination alpha will be zero, so nothing is rendered in those areas. For the
     ;; areas inside our clip shape, the destination alpha will be fully opaque, so the full color
     ;; is rendered. At the edges, the original antialiasing is carried over to give us the desired
@@ -831,19 +831,61 @@
   gauge, under a variable value."
   [controller index encoder-count hue value active?]
   (let [graphics (create-graphics controller)
+        gauge-image (java.awt.image.BufferedImage. 50 50 java.awt.image.BufferedImage/TYPE_INT_ARGB)
+        gauge-graphics (.createGraphics gauge-image)
+        mask-image (java.awt.image.BufferedImage. 50 50 java.awt.image.BufferedImage/TYPE_INT_ARGB)
+        mask-graphics (.createGraphics mask-image)
         x-center (+ (* index button-cell-width) (* encoder-count 0.5 button-cell-width))
-        arc (java.awt.geom.Arc2D$Double. (- x-center 20.0) 50.0 40.0 40.0 240.0 -3.0 java.awt.geom.Arc2D/OPEN)]
-    (dotimes [i 100]
+        arc (java.awt.geom.Arc2D$Double. 5.0 5.0 40.0 40.0 240.0 -3.0 java.awt.geom.Arc2D/OPEN)]
+
+    ;; Color "outside the lines" that we will be masking so the mask can smoothe the edges
+    (.setStroke gauge-graphics (java.awt.BasicStroke. 3.0 java.awt.BasicStroke/CAP_ROUND
+                                                      java.awt.BasicStroke/JOIN_ROUND))
+    (dotimes [i 100]  ; Draw the saturation track
       (.setAngleStart arc (- 240.0 (* i 3)))
-      (set-graphics-color graphics (colors/create-color :h hue :s i :l 50.0))
-      (.draw graphics arc))
-    (.setStroke graphics (java.awt.BasicStroke. 5.0 java.awt.BasicStroke/CAP_ROUND java.awt.BasicStroke/JOIN_ROUND))
+      (set-graphics-color gauge-graphics (colors/create-color :h hue :s i :l 50.0))
+      (.draw gauge-graphics arc))
+
+    ;; Then draw the wider section representing the current saturation
+    (.setStroke gauge-graphics (java.awt.BasicStroke. 8.0 java.awt.BasicStroke/CAP_ROUND
+                                                      java.awt.BasicStroke/JOIN_ROUND))
     (dotimes [i (max (math/round value) 1)]
       (if active?
-        (set-graphics-color graphics (colors/create-color :h hue :s i :l 50.0))
-        (set-graphics-color graphics (colors/create-color :h hue :s i :l 25.0)))
+        (set-graphics-color gauge-graphics (colors/create-color :h hue :s i :l 50.0))
+        (set-graphics-color gauge-graphics (colors/create-color :h hue :s i :l 25.0)))
       (.setAngleStart arc (- 240.0 (* i 3)))
-      (.draw graphics arc))))
+      (.draw gauge-graphics arc))
+
+    ;; Draw a mask we can use to soft clip the saturation gauge. Start by clearing it so all pixels have zero alpha.
+    (.setComposite mask-graphics java.awt.AlphaComposite/Clear)
+    (.fillRect mask-graphics 0 0 50 50)
+
+    ;; Render the gauge track mask, an anti-aliased arc
+    (.setComposite mask-graphics java.awt.AlphaComposite/Src)
+    (.setRenderingHint mask-graphics java.awt.RenderingHints/KEY_ANTIALIASING
+                       java.awt.RenderingHints/VALUE_ANTIALIAS_ON)
+    (.setColor mask-graphics java.awt.Color/WHITE)
+    (.setAngleStart arc 240.0)
+    (.setAngleExtent arc -300.0)
+    (.draw mask-graphics arc)
+
+    ;; Render the gauge current saturation section, a wider anti-aliased arc
+    (.setStroke mask-graphics (java.awt.BasicStroke. 5.0 java.awt.BasicStroke/CAP_ROUND
+                                                     java.awt.BasicStroke/JOIN_ROUND))
+    (.setAngleExtent arc (* -3.0 value))
+    (.draw mask-graphics arc)
+
+    ;; Render the gauge into the mask using SrcAtop, which effectively uses the alpha value as
+    ;; a coverage value for each pixel stored in the destination. For the areas outside our clip
+    ;; shape, the destination alpha will be zero, so nothing is rendered in those areas. For the
+    ;; areas inside our clip shape, the destination alpha will be fully opaque, so the full color
+    ;; is rendered. At the edges, the original antialiasing is carried over to give us the desired
+    ;; soft clipping effect.
+    (.setComposite mask-graphics java.awt.AlphaComposite/SrcAtop)
+    (.drawImage mask-graphics gauge-image 0 0 nil)
+
+    ;; Finally, draw the soft-masked gauge onto the controller display image
+    (.drawImage graphics mask-image (math/round (- x-center 25)) 45 nil)))

 (defn- metronome-sync-label
   "Determine the sync type label to display under the BPM section."


Fix seq.

Fix seq.

--- src/onyx/coordinator/log/datomic.clj
+++ src/onyx/coordinator/log/datomic.clj
@@ -144,8 +144,9 @@
                                    (last-offered-job db))
         inactive-candidates (mapcat (partial next-inactive-task db) job-seq)
         active-candidates (mapcat (partial next-active-task db) job-seq)]
-    (or (filter identity inactive-candidates)
-        (filter identity active-candidates))))
+    (or (seq (filter identity inactive-candidates))
+        (seq (filter identity active-candidates))
+        [])))

 (defn select-nodes [ent]
   (select-keys ent [:node/peer :node/payload :node/ack


clean

clean

--- test/buddy/core/mac_tests.clj
+++ test/buddy/core/mac_tests.clj
@@ -52,7 +52,6 @@
             result "cb448b440c42ac8ad084fc8a8795c98f5b7802359c305eabd57ecdb20e248896"]
         (is (= result sig))))

-
     (testing "Test simple hmac sha384"
       (let [secretkey "b"
             data "a"
@@ -66,9 +65,6 @@
             sig (bytes->hex (mac/hash data {:key secretkey :alg :hmac+sha512}))
             result "68c1687fa7cb5170ff800580a0cec29dc0ccb515aaf95587bdfe5c923730a7852e2beefefd6be31d97aa612ad8b8569bba61ed2c339cd9b28409751b0b9e96a0"]
         (is (= result sig))))
-
-
-

     (testing "Sign/Verify string"
       (let [sig (mac/hash "foo" {:key secretkey :alg :hmac+sha384})]