Add support for keyword header keys.

Add support for keyword header keys.

--- src/catacumba/impl/handlers.clj
+++ src/catacumba/impl/handlers.clj
@@ -112,8 +112,8 @@
                              response)
         ^MutableHeaders headersmap (.getHeaders response)]
     (loop [headers headers]
-      (when-let [[^String key vals] (first headers)]
-        (.set headersmap key vals)
+      (when-let [[key vals] (first headers)]
+        (.set headersmap (name key) vals)
         (recur (rest headers))))))

 (defn send!


fix rare bug in supervisor where it would continuously fail to clean up workers because the worker was already partially cleaned up

--- src/clj/backtype/storm/util.clj
+++ src/clj/backtype/storm/util.clj
@@ -416,10 +416,11 @@
   "Removes file or directory at the path. Not recursive. Throws exception on failure"
   [path]
   (log-debug "Removing path " path)
-  (let [deleted? (.delete (File. path))]
-    (when-not deleted?
-      (throw (RuntimeException. (str "Failed to delete " path))))
-    ))
+  (when (exists-file? path)
+    (let [deleted? (.delete (File. path))]
+      (when-not deleted?
+        (throw (RuntimeException. (str "Failed to delete " path))))
+      )))

 (defn local-mkdirs
   [path]


adjustments to formatting in filter.

adjustments to formatting in filter.

--- src/clj/forma/trends/filter.clj
+++ src/clj/forma/trends/filter.clj
@@ -19,11 +19,11 @@
 ;; De-seasonalize time-series

 (defn seasonal-rows [n]
-  "lazy sequence of monthly dummy vectors"
-  (vec
-   (take n
-         (partition 11 1
-                    (cycle (cons 1 (repeat 11 0)))))))
+  "lazy sequence of monthly dummy vectors."
+  (->> (cycle (cons 1 (repeat 11 0)))
+       (partition 11 1)
+       (take n)
+       vec))

 (defn seasonal-matrix
   "create a matrix of [num-months]x11 of monthly dummies, where
@@ -39,8 +39,11 @@
   [ts]
   (let [avg-seq (repeat (count ts) (average ts))
         X    (seasonal-matrix (count ts))
-        fix  (i/mmult (variance-matrix X) (i/trans X) ts)
-        adj  (i/mmult (i/sel X :except-cols 0) (i/sel fix :except-rows 0))]
+        fix  (i/mmult (variance-matrix X)
+                      (i/trans X)
+                      ts)
+        adj  (i/mmult (i/sel X :except-cols 0)
+                      (i/sel fix :except-rows 0))]
     (i/minus ts adj)))

 ;; Hodrick-Prescott filter
@@ -58,7 +61,10 @@
           (insert-into-zeros idx T (cond (= x 0)  [1 2 -1]
                                          (= x 1)  [-2 5 4 1]
                                          :else [1 -4 6 -4 1])))]
-    (i/matrix (concat but-2 (map reverse [second first])))))
+    (->> [second first]
+         (map reverse)
+         (concat but-2)
+         i/matrix)))

 (defn hp-filter
   "return a smoothed time-series, given the HP filter parameter."
@@ -99,19 +105,23 @@
   set to nil."
   [pred coll1 coll2]
   {:pre [(= (count coll1) (count coll2))]}
-  (map #(when-not (pred %2) %1) coll2 coll1))
+  (map #(when-not (pred %2) %1)
+       coll2
+       coll1))

 (defn replace-index-set
-  "replace values in `coll` with `new-val` for all indices in `idx-set`"
+  "replace values in `coll` with `new-val` for all indices in
+  `idx-set`"
   [idx-set new-val coll]
   (for [[m n] (map-indexed vector coll)]
     (if (idx-set m) new-val n)))

 (defn bad-ends
-  "make a set of indices of a collection `coll` for which there are continuous
-  *bad* values, given by the set of values in `bad-set` which serves as a
-  predicate function to (effectively) filter `coll` on the ends.  If there are
-  no bad values on either end, then the function will return an empty set."
+  "make a set of indices of a collection `coll` for which there are
+  continuous *bad* values, given by the set of values in `bad-set`
+  which serves as a predicate function to (effectively) filter `coll`
+  on the ends.  If there are no bad values on either end, then the
+  function will return an empty set."
   [bad-set coll]
   (let [m-coll (map-indexed vector coll)
         r-coll (reverse m-coll)]


todos added

todos added

--- src/webdriver/dsl.clj
+++ src/webdriver/dsl.clj
@@ -27,6 +27,7 @@
 ;; conditinal decorator
 ;; with window decorator
 ;; todo add local html test
+;; custom HTML files for tests
 ;;

 (def ^:dynamic *server*)
@@ -59,6 +60,21 @@
 (defmacro with-xpath [& body]
   `(with-locator "xpath"
      ~@body))
+
+;;
+;; css staff
+;;
+;; todo implements css
+
+;; todo elemet size
+;; todo elemet rect
+;; element location
+;; resize
+;; position
+;; url-hash
+;; all the locators
+;; wait for (not) present/visible/enabled
+;;

 ;;
 ;; windowing
@@ -345,6 +361,7 @@

 ;; todo multi-form
 ;; todo fill form human
+;; todo submit form
 (defn fill-form [form]
   (doseq [[field text] form]
     (let [term (format "//input[@name='%s']" (name field))]


[#1156] Update doc string on remove-tenant script

--- backend/src/akvo/lumen/admin/remove_tenant.clj
+++ backend/src/akvo/lumen/admin/remove_tenant.clj
@@ -1,14 +1,29 @@
 (ns akvo.lumen.admin.remove-tenant
+  "The following env vars are assumed to be present:
+  ENCRYPTION_KEY, KC_URL, KC_SECRET, PG_HOST, PG_DATABASE, PG_USER, PG_PASSWORD
+  ENCRYPTION_KEY is a key specific for the Kubernetes environment used for
+  encrypting the db_uri.
+  The PG_* env vars can be found in the ElephantSQL console for the appropriate
+  instance. KC_URL is the url to keycloak (without trailing /auth).
+  KC_SECRET is the client secret found in the Keycloak admin at
+  > Realms > Akvo > Clients > akvo-lumen-confidential > Credentials > Secret.
+  Use this as follow
+  $ env ENCRYPTION_KEY=*** \\
+  KC_URL=https://*** KC_SECRET=*** \\
+  PG_HOST=***.db.elephantsql.com PG_DATABASE=*** \\
+  PG_USER=*** PG_PASSWORD=*** \\
+  lein run -m akvo.lumen.admin.remove-tenant label
+  KC_URL is probably one of:
+  - http://localhost:8080 for local development
+  - https://login.akvo.org for production
+  - https://kc.akvotest.org for the test environment
+
+  It's not possible to delete a database if open connections exist, workaround:
+  https://dba.stackexchange.com/questions/11893/force-drop-db-while-others-may-be-connected"
   (:require [akvo.lumen.admin.util :as util]
             [akvo.lumen.component.keycloak :as keycloak]
             [cheshire.core :as json]
             [clj-http.client :as client]))
-
-;; The following env vars are assumed to be present:
-;; PG_HOST,  PG_DATABASE, PG_USER, PG_PASSWORD, KC_URL, KC_SECRET
-;; See add-tenant script for instructions on where to find these values
-;;
-;; $ lein run -m akvo.lumen.admin.remove-tenant <label>

 (defn remove-group
   "Remove keycloak group by id"


commit-layout should reset highlight and puppets

to keep main-db in consistent state

--- cljs/src/main/plastic/main/editor/layout.cljs
+++ cljs/src/main/plastic/main/editor/layout.cljs
@@ -10,7 +10,9 @@
                      (editor/set-layout-for-form form-id layout)
                      (editor/set-selectables-for-form form-id selectables)
                      (editor/set-spatial-web-for-form form-id spatial-web)
-                     (editor/set-structural-web-for-form form-id structural-web))]
+                     (editor/set-structural-web-for-form form-id structural-web)
+                     (editor/set-puppets #{})
+                     (editor/set-highlight #{}))]
     (assoc editors editor-id new-editor)))

 (defn update-render-state [editors [editor-id render-state]]
@@ -22,4 +24,4 @@
 ; register handlers

 (register-handler :editor-commit-layout paths/editors-path commit-layout)
-(register-handler :editor-update-render-state paths/editors-path update-render-state)+(register-handler :editor-update-render-state paths/editors-path update-render-state)


Improve the Om Next application layer for screen-based apps

Add a small trick to ensure that the Om Next path of props passed
down to layout views isn't nil. This would result in omcljs$path
of the views to be nil and reconciliation to fail in passing the
correct new props to the views on updates.

--- src/main/workflo/macros/screen/om_next.cljs
+++ src/main/workflo/macros/screen/om_next.cljs
@@ -52,7 +52,8 @@
                     (let [[k v] (first layout-item)]
                       (assoc res k {:view (-> screen :layout
                                               k :factory)
-                                    :props (parser env v nil)})))
+                                    :props (parser (dissoc env :path)
+                                                   v nil)})))
                   {} query)})

 (defn- wrapping-read
@@ -98,7 +99,9 @@
    all returned views with their props / query results."
   [layout]
   (zipmap (keys layout)
-          (map #((:view %) (:props %))
+          (map (fn [{:keys [view props] :as item}]
+                 (view (vary-meta props assoc :om-path
+                                  (-> item meta :om-path))))
                (vals layout))))

 (defview RootWrapper
@@ -118,8 +121,8 @@
   "Mounts a screen with parameters by setting it as the active
    screen and updating the root wrapper's component query
    according to the screen's layout."
-  [reconciler screen params]
-  (let [app   (om/app-root reconciler)
+  [app screen params]
+  (let [c     (om/app-root (:reconciler (:config app)))
         query [{:workflo/screen
                 [:workflo/navigation
                  {:workflo/layout
@@ -128,14 +131,38 @@
                                  [])})
                         (:layout screen))}]}]]
     (set-active-screen! screen params)
-    (om/set-query! app {:params params :query query})))
+    (om/set-query! c {:params params :query query})
+    (some-> app :config :screen-mounted
+            (apply [app screen params]))))

 ;;;; Application bootstrapping

 (defprotocol IApplication
   (mount [this])
   (start [this])
-  (reload [this]))
+  (reload [this])
+  (goto [this screen params]))
+
+(defrecord Application [config router]
+  IApplication
+  (mount [this]
+    (om/add-root! (:reconciler config) RootWrapper (:target config)))
+
+  (start [this]
+    (mount this)
+    (assoc this :router
+           (sb/router
+            {:default-screen (:default-screen config)
+             :mount-screen (partial mount-screen this)})))
+
+  (reload [this]
+    (reload-active-screen!)
+    (mount this)
+    (let [{:keys [screen params]} (active-screen)]
+      (mount-screen this screen params)))
+
+  (goto [this screen params]
+    (sb/goto! router screen params)))

 (defn application
   "Creates an Om Next application that implements screen-based
@@ -155,18 +182,10 @@
    logic and generates the `:navigation` and `:layout` props
    based on the active screen."
   [{:keys [default-screen reconciler root
-           root-js? target]
+           root-js? target screen-mounted]
     :or   {root-js? false}}]
   (set-root-component! root root-js?)
-  (reify IApplication
-    (mount [this]
-      (om/add-root! reconciler RootWrapper target))
-    (start [this]
-      (mount this)
-      (sb/router {:default-screen default-screen
-                  :mount-screen (partial mount-screen reconciler)}))
-    (reload [this]
-      (reload-active-screen!)
-      (mount this)
-      (let [{:keys [screen params]} (active-screen)]
-        (mount-screen reconciler screen params)))))
+  (map->Application {:config {:default-screen default-screen
+                              :reconciler reconciler
+                              :target target
+                              :screen-mounted screen-mounted}}))


+(defn morph-ps)

+(defn morph-ps)

--- src/babel/english.cljc
+++ src/babel/english.cljc
@@ -36,6 +36,9 @@
 (defn fo-ps [expr]
   (parse/fo-ps expr morph/fo))

+(defn morph-ps [expr]
+  (fo-ps expr))
+
 (defn analyze
   ([surface-form lexicon] ;; use user-provided lexicon
    (morph/analyze surface-form lexicon)))


Fix missing manifest tags

Fix missing manifest tags

--- src/docker_clojure/manifest.clj
+++ src/docker_clojure/manifest.clj
@@ -15,6 +15,8 @@
           (docker-tag {:omit-build-tool? true} variant)
           (docker-tag {:omit-build-tool-version? true} variant)
           (docker-tag {:omit-distro? true} variant)
+          (docker-tag {:omit-distro? true, :omit-build-tool-version? true} variant)
+          (docker-tag {:omit-jdk? true, :omit-build-tool-version? true} variant)
           (docker-tag {:omit-jdk? true, :omit-distro? true
                        :omit-build-tool-version? true} variant))
         vec


:sparkles: Improve workspace sidebar show/hide (II)

--- frontend/src/uxbox/main/ui/workspace/left_toolbar.cljs
+++ frontend/src/uxbox/main/ui/workspace/left_toolbar.cljs
@@ -70,7 +70,7 @@
        [:li.tooltip.tooltip-right
         {:alt "Layers"
          :class (when (contains? layout :layers) "selected")
-         :on-click #(st/emit! (dw/toggle-layout-flag :layers))}
+         :on-click #(st/emit! (dw/toggle-layout-flag :sitemap :layers))}
         i/layers]
        [:li.tooltip.tooltip-right
         {:alt (t locale "workspace.toolbar.libraries")


Fix email on copyright notice on jws ns.

--- src/buddy/sign/jws.clj
+++ src/buddy/sign/jws.clj
@@ -1,4 +1,4 @@
-;; Copyright (c) 2014-2015 Andrey Antukh <niwi@niwi.be>
+;; Copyright (c) 2014-2015 Andrey Antukh <niwi@niwi.nz>
 ;;
 ;; Licensed under the Apache License, Version 2.0 (the "License")
 ;; you may not use this file except in compliance with the License.


Update prn output to log correctly on heroku

--- src/build_mon/core.clj
+++ src/build_mon/core.clj
@@ -62,10 +62,11 @@
         [build previous-build] (try (-> api-response :body (json/parse-string true) :value)
                                     (catch Exception e))
         refresh (determine-refresh-rate (:query-params request))]
-    (prn "Build - Result: " (:result build))
-    (prn "Build - Status: " (:status build))
-    (prn "Prev  - Result: " (:result build))
-    (prn "Prev  - Status: " (:status build))
+    (prn "--------------------------------------")
+    (prn (str "Build - Result: " (:result build)))
+    (prn (str "Build - Status: " (:status build)))
+    (prn (str "Prev  - Result: " (:result build)))
+    (prn (str "Prev  - Status: " (:status build)))
     (when build
       {:status 200
        :headers {"Content-Type" "text/html; charset=utf-8"}


Added fwd helper func.

Added fwd helper func.

--- src/cbfg/world/t2.cljs
+++ src/cbfg/world/t2.cljs
@@ -16,6 +16,13 @@
                     (aput-close state-loop (:res-ch m) res))
                   (recur name state-next))))
     req-ch))
+
+; --------------------------------------------
+
+(defn fwd [actx ch-key m]
+  (act fwd actx
+       (println :fwd ch-key m)
+       (areq fwd (ch-key m) m)))

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

@@ -45,6 +52,21 @@
       [server-state (assoc m :status :not-authenticated)])
     nil))

+; --------------------------------------------
+
+(defn lane-handler [actx lane-state m]
+  (case (:op m)
+    :update-realm-user
+    [(assoc lane-state :realm (:realm m) :user (:user m)) (assoc m :status :ok)]
+    "realms-list"
+    (do (act fwd-realms-list actx
+             (aput fwd-realms-list (:server-state-ch m)
+                   (assoc m :realm (:realm lane-state) :user (:user lane-state))))
+        [lane-state nil])
+    nil))
+
+; --------------------------------------------
+
 (defn rq-authenticate [actx m]
   (act rq-authenticate actx
        (let [{:keys [server-state-ch lane-state-ch realm user]} m
@@ -52,32 +74,12 @@
                        (assoc m :op :authenticate))]
          (if (= (:status res) :ok)
            (areq rq-authenticate lane-state-ch
-                 (assoc m :op :update-cred :cred {:realm realm :user user}))
+                 (assoc m :op :update-realm-user :realm realm :user user))
            res))))
-
-; --------------------------------------------
-
-(defn lane-handler [actx lane-state m]
-  (case (:op m)
-    :update-cred
-    [(assoc lane-state :cred (:cred m)) (assoc m :status :ok)]
-    "realms-list"
-    (let [server-state-ch (:server-state-ch m)]
-      (act fwd-realms-list actx
-           (aput fwd-realms-list server-state-ch
-                 (assoc m :cred (:cred lane-state))))
-      [lane-state nil])
-    nil))
-
-(defn rq-fwd-to-lane [actx m] ; Forward to lane-state-ch to handle the request.
-  (act rq-fwd-to-lane actx
-       (areq rq-fwd-to-lane (:lane-state-ch m) m)))
-
-; --------------------------------------------

 (def rq-handlers
   {"authenticate" rq-authenticate
-   "realms-list" rq-fwd-to-lane
+   "realms-list" #(fwd %1 :lane-state-ch %2)
    "add" cbfg.world.base/example-add
    "sub" cbfg.world.base/example-add
    "count" cbfg.world.base/example-count


Concept data now stored with slices

Concept data now stored with slices

* Table-backed slices loaded once instead of twice

--- src/cfpb/qu/loader.clj
+++ src/cfpb/qu/loader.clj
@@ -134,47 +134,31 @@
       (doseq [chunk chunks]
         (coll/insert-batch collection chunk)))))

-(defn- table-collection [table]
-  (str "table__" (name table)))
-
-(defn- load-table
-  [table tabledef dir]
-  (log/info "Loading table" table)
-  (let [collection (table-collection table)]
-    (coll/drop collection)
-    (let [sources (:sources tabledef)
-          columns (:columns tabledef)
-          agent-error-handler (fn [agent exception]
-                                (log/error "Error in table loading agent"
-                                           (.getMessage exception)))
-          agents (map (fn [source]
-                        (agent source
-                               :error-mode :continue
-                               :error-handler agent-error-handler))
-                      sources)]
-      (doseq [agent agents]
-        (send-off agent (fn [file]
-                          (load-csv-file collection (str dir "/" file) columns))))
-      (apply await agents))))
+(defn- load-collection
+  [collection tabledef dir]
+  (coll/drop collection)
+  (let [sources (:sources tabledef)
+        columns (:columns tabledef)
+        agent-error-handler (fn [agent exception]
+                              (log/error "Error in table loading agent"
+                                         (.getMessage exception)))
+        agents (map (fn [source]
+                      (agent source
+                             :error-mode :continue
+                             :error-handler agent-error-handler))
+                    sources)]
+    (doseq [agent agents]
+      (send-off agent (fn [file]
+                        (load-csv-file collection (str dir "/" file) columns))))
+    (apply await agents)))

 (defn- load-table-slice
-  [dataset slice slicedef]
+  [dataset slice slicedef tables dir]
   (let [table (:table slicedef)
-        from-collection (table-collection table)
-        to-collection (name slice)
-        dimensions (:dimensions slicedef)
-        metrics (:metrics slicedef)
-        columns (map keyword (concat dimensions metrics))
-        query (q/partial-query
-               (q/find {})
-               (q/fields (reduce merge (map #(hash-map % 1) columns))))
-        query-result (get-find dataset from-collection query)
-        chunks (->> query-result
-                    :data
-                    (partition-all *chunk-size*))]
+        tabledef ((keyword table) tables)
+        collection (name slice)]
     (log/info "Loading table-backed slice" slice)
-    (doseq [chunk chunks]
-      (coll/insert-batch to-collection chunk))))
+    (load-collection collection tabledef dir)))

 (defn- load-derived-slice
   [dataset slice slicedef]
@@ -201,27 +185,50 @@
         chunks (->> query-result
                     :data
                     (partition-all *chunk-size*))]
+    (coll/drop to-collection)
     (log/info "Loading derived slice" slice)
     (doseq [chunk chunks]
       (coll/insert-batch to-collection chunk))))

 (defn- load-slice
-  [dataset slice slicedef]
+  [dataset slice slicedef tables dir]
   (let [dimensions (:dimensions slicedef)
         type (keyword (:type slicedef))]
     (log/info "Dropping slice" slice)
-    (coll/drop slice)
     (case type
-      :table (load-table-slice dataset slice slicedef)
+      :table (load-table-slice dataset slice slicedef tables dir)
       :derived (load-derived-slice dataset slice slicedef)
       (log/error "Cannot load slice" slice "with type" type))))
+
+(defn- concept-collection [concept]
+  (str "concept__" (name concept)))
+
+(defn- add-concept-to-slice
+  [dataset slice concept]
+  (let [collection (concept-collection concept)
+        query (q/partial-query (q/fields {}))
+        query-result (get-find dataset collection query)]
+    (doseq [row (:data query-result)]
+      (coll/update (name slice)
+                   {concept (concept row)}
+                   {"$set" {(keyword (str "__" (name concept))) row}}
+                   :multi true))))

 (defn- load-concept
   "Go through each slice and replace any dimensions that match a
 concept where the concept is backed by a table with the relevant row
 from that table."
-  [concept definition slices]
-  "whoa")
+  [dataset concept definition slices tables dir]
+  (if-let [table (:table definition)]
+    (let [concept (keyword concept)
+          tabledef ((keyword table) tables)
+          collection (concept-collection concept)]
+      (log/info "Loading table-backed concept" concept)
+      (load-collection collection tabledef dir)
+      (doseq [[slice slicedef] slices]
+        (when (contains? (set (slice-columns slicedef)) (name concept))
+          (log/info "Matching concept" concept "in" slice)
+          (add-concept-to-slice dataset slice concept))))))

 (defn load-dataset
   "Given the name of a dataset, load that dataset from disk into the
@@ -257,15 +264,12 @@
       (drake/run-workflow drakefile :targetv ["=..."]))

     (with-db (get-db dataset)
-      (doseq [[table definition] tables]
-        (log/info "Loading table" (name table) "for dataset" dataset)
-        (load-table table definition dir))
       (doseq [slice slice-load-order]
         (log/info "Loading slice" (name slice) "for dataset" dataset)
-        (load-slice dataset slice (slices slice)))
+        (load-slice dataset slice (slices slice) tables dir))
       (doseq [[concept definition] concepts]
-        (log/info "Updating slices with concept" concept)
-        (load-concept concept definition slices))
+        (log/info "Loading concept" concept)
+        (load-concept dataset concept definition slices tables dir))
       (doseq [[slice definition] slices]
         (log/info "Indexing slice" slice)
         (set-indexes slice (:dimensions definition))))))


fix env

fix env

--- src/ci3/agent/core.clj
+++ src/ci3/agent/core.clj
@@ -119,8 +119,9 @@
 (defmethod u/*fn
   ::run-build
   [{env :env build-config ::build-config}]
-  (let [start (System/nanoTime)]
-    (loop [env env
+  (let [start (System/nanoTime)
+        build-config (assoc build-config :env env )]
+    (loop [env {:env build-config}
            [st & sts] (:pipeline build-config)]
       (if st
         (let [res (do-step st env)]
@@ -131,6 +132,13 @@
           (println "==========================================\nDONE in "
                    (humanize/duration (/ (- (System/nanoTime) start) 1000000) {:number-format str}))
           #_(success build))))))
+
+(comment
+  (u/*apply
+   [::e/env
+    ::run-build]
+   {::build-config {:pipeline [{:type "bash" :command "env"}]}}
+   ))

 (defmethod u/*fn
  ::checkout-project


Changed htile and vtile to mod-h and mod-v, in all functions.

--- src/clj/forma/rain.clj
+++ src/clj/forma/rain.clj
@@ -185,22 +185,22 @@
 (defn resample
   "Takes in a month's worth of PREC/L rain data, and returns a lazy
   seq of data samples for supplied MODIS chunk coordinates."
-  [data res htile vtile chunk chunk-size]
+  [data res mod-h mod-v chunk chunk-size]
   (let [rain (vec data)]
     (for [pixel (range chunk-size)]
       (let [[sample line] (tile-position chunk pixel chunk-size)
-            index (rain-index htile vtile sample line res)]
+            index (rain-index mod-h mod-v sample line res)]
         (rain index)))))

 (defmapcatop [rain-chunks [chunk-size]]
   ^{:doc "Takes in data for a single month of rain data, and resamples
   it to the MODIS sinusoidal grid at the supplied resolution. Returns
-  4-tuples, looking like (htile, vtile, chunk, chunkdata-seq)."}
+  4-tuples, looking like (mod-h, mod-v, chunk, chunkdata-seq)."}
   [data res]
   (let [edge-length (pixels-at-res res)]
-    (for [htile (range h-tiles)
-          vtile (range v-tiles)
+    (for [mod-h (range h-tiles)
+          mod-v (range v-tiles)
           chunk (range (/ (sqr edge-length) chunk-size))
-          :when (valid-modis? htile vtile)]
-      (let [chunk-seq (resample data res htile vtile chunk chunk-size)]
-        [htile vtile chunk chunk-seq]))))+          :when (valid-modis? mod-h mod-v)]
+      (let [chunk-seq (resample data res mod-h mod-v chunk chunk-size)]
+        [mod-h mod-v chunk chunk-seq]))))


Correct brackets

Correct brackets

--- src/cljs/app/core.cljs
+++ src/cljs/app/core.cljs
@@ -106,10 +106,10 @@
 (deftemplate page
   "index.html"
   []
-  {[:#background
-     (kioo/set-class (if (str/blank? (:theme @prefs))
-                       "background-image default"
-                       (str "background-image " (:theme @prefs))))]
+  {[:#background]
+   (kioo/set-class (if (str/blank? (:theme @prefs))
+                     "background-image default"
+                     (str "background-image " (:theme @prefs))))
    [:.kryvos-downloads] (kioo/content (kryvos-downloads))
    [:footer :ul] (kioo/content (map theme-bar themes))})


math docs

math docs

--- src/clojure2d/math.clj
+++ src/clojure2d/math.clj
@@ -1,50 +1,15 @@
-;; ## Math functions
-;;
-;; Here you can find FastMath function wrappers plus some additional functions and constants.
-;; Wrappers are made to provide Clojure functions.
-;;
-;; ### List of constants
-;;
-;; * Processing names: `PI`, `HALF_PI`, `QUARTER_PI`, `TWO_PI`, `TAU`, `E`
-;; * Small quantity: `EPSILON`
-;; * Logarithms: `LN2`, `LN10`, `LOG2E`, `LOG10E`, `INV_LOG_HALF`
-;; * Square roots: `SQRT2`, `SQRT3`, `SQRT5`, `SQRTPI`
-;; * Golden ration: `PHI`
-;; * C (math.h) constants: `M_E`, `M_LOG2E`, `M_LOG10E`, `M_LN2`, `M_LN10`, `M_PI`, `M_PI_2`, `M_PI_4`, `M_1_PI`, `M_2_PI`, `M_2_SQRTPI`, `M_SQRT2`, `M_SQRT1_2`, `M_TWOPI`, `M_3PI_4`, `M_SQRTPI`, `M_LN2LO`, `M_LN2HI`, `M_SQRT3`, `M_IVLN10`, `M_LOG2_E`, `M_INVLN2`
-;;
-;; ### Trigonometry
-;;
-;; * `sin`, `cos`, `tan`, `cot`, `set`, `csc`
-;; * `asin`, `acos`, `atan`, `acot`, `aset`, `acsc`, `atan2`
-;; * `sinh`, `cosh`, `tanh`, `coth`, `seth`, `csch`
-;; * `asinh`, `acosh`, `atanh`, `acoth`, `aseth`, `acsch`
-;; * quick/fast versions: `qsin`, `qcos`
-;;
-;; ### Powers / Logarithms / Roots
-;;
-;; * `log`/`ln`, `log2`, `log10`, `logb`
-;; * `exp`, `pow`, `sq`/`pow2`, `pow3`
-;; * `sqrt`, `cbrt`
-;; * `hypot`
-;; * `low-2-exp` `high-2-exp`
-;; * quick/fast/safe versions: `qexp`, `qlog`, `qpow`/`fpow`, `safe-sqrt`, `qsqrt`
-;;
-;; ### Rounding
-;;
-;; * `floor`, `ceil`, `round`, `rint`
-;; * `reminder`
-;; * `abs`, `iabs`
-;;
-;; ### Other
-;;
-;; * `signum`
-;; * `constrain`
-;; * `norm`, `cnorm`
-;; * `lerp`, `cos-interpolation`
-;; * `wrap`
+;; # Namespace scope
+;;
+;; Collection of math function:
+;;
+;; * Several constants from Java, C, Processing, etc.
+;; * Functions based on FastMath wrapped in Clojure functions (trigonometry, powers/logartihms/roots, rounding)
+;; * Additional math functions (signum, constrain, interpolation)
+;; * Statistics
+;; * Noise and random

 (ns clojure2d.math
-  "FastMath wrappers + helper functions"
+  "Math functions"
   (:import [net.jafama FastMath]
            [org.apache.commons.math3.random RandomGenerator ISAACRandom JDKRandomGenerator MersenneTwister
             Well512a Well1024a Well19937a Well19937c Well44497a Well44497b]
@@ -53,7 +18,12 @@
 (set! *warn-on-reflection* true)
 (set! *unchecked-math* true)

-;; Bunch of math constants
+;; ## Math functions
+;;
+;; FastMath functions type hinted wrapped in processing function (to allow composition etc.).
+;; All functions operate and return `double` or in some cases `long`.
+
+;; Processing math constants
 (def ^:const ^double PI Math/PI)
 (def ^:const ^double HALF_PI (/ PI 2.0))
 (def ^:const ^double QUARTER_PI (/ PI 4.0))
@@ -64,6 +34,7 @@
 ;; Very small number \\(\varepsilon\\)
 (def ^:const ^double EPSILON 1.0e-10)

+;; Trigonometry
 (defn sin ^double [^double v] (FastMath/sin v))
 (defn cos ^double [^double v] (FastMath/cos v))
 (defn tan ^double [^double v] (FastMath/tan v))
@@ -77,21 +48,14 @@
 (defn acosh ^double [^double v] (FastMath/acosh v))
 (defn atanh ^double [^double v] (FastMath/atanh v))

-(defn exp ^double [^double v] (FastMath/exp v))
-(defn log ^double [^double v] (FastMath/log v))
-(defn log10 ^double [^double v] (FastMath/log10 v))
-
-(defn sqrt ^double [^double v] (FastMath/sqrt v))
-(defn cbrt ^double [^double v] (FastMath/cbrt v))
+;; Quick and less accurate `sin` and `cos`
+(defn qsin ^double [^double v] (FastMath/sinQuick v))
+(defn qcos ^double [^double v] (FastMath/cosQuick v))

 ;; Additional trigonometry functions
 (defn cot ^double [^double v] (FastMath/tan (- HALF_PI v)))
 (defn sec ^double [^double v] (/ 1.0 (FastMath/cos v)))
 (defn csc ^double [^double v] (/ 1.0 (FastMath/sin v)))
-
-;; Quick and less accurate `sin` and `cos`
-(defn qsin ^double [^double v] (FastMath/sinQuick v))
-(defn qcos ^double [^double v] (FastMath/cosQuick v))

 ;; Additional cyclometric functions
 (defn acot ^double [^double v] (- HALF_PI (FastMath/atan v)))
@@ -109,10 +73,19 @@
 (defn asech ^double [^double v] (FastMath/acosh (/ 1.0 v)))
 (defn acsch ^double [^double v] (FastMath/asinh (/ 1.0 v)))

+;; exp and log
+(defn exp ^double [^double v] (FastMath/exp v))
+(defn log ^double [^double v] (FastMath/log v))
+(defn log10 ^double [^double v] (FastMath/log10 v))
+
+;; Roots (square and cubic)
+(defn sqrt ^double [^double v] (FastMath/sqrt v))
+(defn cbrt ^double [^double v] (FastMath/cbrt v))
+
 ;; Quick version of exponential \\(e^x\\)
 (defn qexp ^double [^double v] (FastMath/expQuick v))

-;; Alias for logarithm
+;; Alias for natural logarithm
 (def ln log)

 ;; Few logarithm constants
@@ -137,6 +110,7 @@
   ^double [^double base ^double v]
   (/ (FastMath/log v) (FastMath/log base)))

+;; Quick logarithm
 (defn qlog ^double [^double v] (FastMath/logQuick v))

 ;; \\(\log_2 e\\)
@@ -238,7 +212,7 @@
   ^double [^double value]
   (cond (pos? value) 1.0
         (neg? value) -1.0
-        :else 0))
+        :else 0.0))

 (defn sgn
   "Return -1 when value is negative, 1 otherwise"
@@ -258,7 +232,7 @@
       value)))

 (defn iconstrain
-  "Clamp value between mn and mx"
+  "Clamp value between mn and mx (`long` optimized version)"
   ^long [^long value ^long mn ^long mx]
   (if (> value mx)
     mx
@@ -277,13 +251,13 @@
      (/ (- v start) (- stop start)))))

 (defn make-norm
-  "Make map/norm function"
-  ([^double start ^double stop]
+  "Make type hinted map/norm function"
+  (^double [^double start ^double stop]
    (let [r (- stop start)]
        (fn ^double [^double v ^double dstart ^double dstop]
           (let [vn (/ (- v start) r)]
             (+ dstart (* (- dstop dstart) vn))))))
-  ([^double start ^double stop ^double dstart ^double dstop]
+  (^double [^double start ^double stop ^double dstart ^double dstop]
    (let [r (- stop start)]
        (fn ^double [^double v]
           (let [vn (/ (- v start) r)]
@@ -300,7 +274,7 @@

 ;; Linear interpolation between `start` and `stop`.
 (defn lerp
-  "Processing lerp"
+  "Lerp function (same as in Processing)"
   ^double [^double start ^double stop ^double t]
   (let [t1 (- 1.0 t)]
     (+ (* t1 start) (* t stop))))
@@ -315,7 +289,7 @@
 (defn smoothstep
   "GL smoothstep"
   ^double [^double start ^double stop ^double x]
-  (let [t ^double (norm x start stop)]
+  (let [t (norm x start stop)]
     (* t t (- 3.0 (* 2.0 t)))))

 ;;`(wrap 0 -1 1) => 0.0`
@@ -336,7 +310,6 @@
            (* cycle)
            (- value)))))

-;;
 ;; ### Statistics
 ;;
 ;; Whole code is taken from public GIST: https://gist.github.com/scottdw/2960070
@@ -432,6 +405,7 @@
 ;; `(stats-map '(1 2 3 -1 -1 2 -1 11 111))`
 ;; `=> {:MAD 3.0, :Max 111, :Size 9, :LAV -1, :Mode -1, :Mean 14.11111111111111, :Q1 -1.0, :Q3 7.0, :Min -1, :Total 127, :SD 34.43333154064031, :UAV 3, :Median 2.0}`
 (defn stats-map
+  "Calculate several statistics from the list and return as map"
   ([vs]
      (let [sz (count vs)
            svs (sort vs)
@@ -448,8 +422,7 @@
            qd (- ^double q3 ^double q1)
            lav (lower-adjacent-value svs mdn qd)
            uav (upper-adjacent-value rsvs mdn qd)]
-       {
-        :Size sz
+       {:Size sz
         :Min mn
         :Max mx
         :Mean u
@@ -486,7 +459,7 @@

 ;; ## Random function wrappers
 ;;
-;; Main goal for this namespace is to prepare various functions for various RNG algorithms.
+;; RNG wrapper for various RNG source.
 ;; As a RNG source [Apache Commons Math](http://commons.apache.org/proper/commons-math/apidocs/org/apache/commons/math3/random/package-summary.html) project was chosen.
 ;;
 ;; You get following functions:
@@ -497,7 +470,7 @@
 ;;
 ;; The concept is as follows
 ;;
-;; * create `Randomizer` protocol with more processing-like random functions for every primitive type: `int`, `long`, `float`, `double` and `boolean`. Additionally provide similar contract for Gaussian random, and boolean random with set probability (you set probability for getting `true`)
+;; * create `Randomizer` protocol with more processing-like random functions for every primitive type: `int`, `long`, `float` and `double`. Additionally provide similar contract for Gaussian random, and boolean random with set probability (you set probability for getting `true`)
 ;; * enhance every given RNG class with `Randomizer` protocol. This is done by extension of RandomGenerator interface. Every RNG from Apache Commons Math implements it.
 ;; * create factory multimethod to generate RNG object for every class
 ;;
@@ -508,8 +481,13 @@
 ;; * `:isaac` - ISAAC
 ;; * `:well512a`, `:well1024a`, `:well19937a`, `:well19937c`, `:well44497a`, `:well44497b` - several WELL variants

+;; Type hinted functions generating random value
 (defn next-random-value-long
-  ""
+  "Generate next long.
+
+  * arity 0 - from 0 to maximum long value
+  * arity 1 - from 0 to provided integer (excluded)
+  * arity 2 - from the provided range (included, excluded)"
   (^long [^RandomGenerator r] (.nextLong r))
   (^long [^RandomGenerator r ^long mx] (mod (.nextLong r) mx))
   (^long [r ^long mn ^long mx]
@@ -518,7 +496,11 @@
          (+ mn (next-random-value-long r diff))))))

 (defn next-random-value-double
-  ""
+  "Generate next double.
+
+  * arity 0 - from 0 to 1 (exluded)
+  * arity 1 - from 0 to provided double (excluded)
+  * arity 2 - from the provided range (included, excluded)"
   (^double [^RandomGenerator r] (.nextDouble r))
   (^double [^RandomGenerator r ^double mx] (* (.nextDouble r) mx))
   (^double [r ^double mn ^double mx]
@@ -527,7 +509,11 @@
          (+ mn (next-random-value-double r diff))))))

 (defn next-random-value-gaussian
-  ""
+  "Generate next random value from normal distribution.
+
+  * arity 0 - N(0,1)
+  * arity 1 - N(0,par)
+  * arity 2 - N(par1,par2)"
   (^double [^RandomGenerator r] (.nextGaussian r))
   (^double [^RandomGenerator r ^double mx] (* (.nextGaussian r) mx))
   (^double [r ^double mn ^double mx]
@@ -598,11 +584,11 @@
      (new ~cl (int arg#))
      (new ~cl)))

-;; Multimethod `make-randomizer` creates object with new set of functions
+;; Multimethod `make-randomizer` creates RNG object with new set of functions
 ;;
 ;;`(make-randomizer :well512a) => #object[org.apache.commons.math3.random.Well512a 0x1a8535ec "org.apache.commons.math3.random.Well512a@1a8535ec"]`
 ;;
-;;`(make-randomizer :aaaa 123) => #object[org.apache.commons.math3.random.JDKRandomGenerator 0x3f12abed "org.apache.commons.math3.random.JDKRandomGenerator@3f12abed"]`
+;;`(make-randomizer :default 123) => #object[org.apache.commons.math3.random.JDKRandomGenerator 0x3f12abed "org.apache.commons.math3.random.JDKRandomGenerator@3f12abed"]`
 ;;
 ;; Couple of examples
 ;;


Missing spec require

Missing spec require

--- src/compound/core.cljc
+++ src/compound/core.cljc
@@ -1,5 +1,6 @@
 (ns compound.core
   (:require [clojure.set :as set]
+            [compound.spec]
             [clojure.spec.alpha :as s]))

 (defn indexes [compound]


CMR-6318 addressed whitespacing issue

CMR-6318 addressed whitespacing issue

--- indexer-app/src/cmr/indexer/services/index_service.clj
+++ indexer-app/src/cmr/indexer/services/index_service.clj
@@ -86,11 +86,11 @@
   ;; Get the tag associations and variable associations as well.
   (let [batch (map (fn [concept]
                      (let [tag-associations (meta-db/get-associations-for-collection
-                                             context concept :tag-association)
+                                              context concept :tag-association)
                            variable-associations (meta-db/get-associations-for-collection
-                                                  context concept :variable-association)
+                                                   context concept :variable-association)
                            service-associations (meta-db/get-associations-for-collection
-                                                 context concept :service-association)]
+                                                  context concept :service-association)]
                        (-> concept
                            (assoc :tag-associations tag-associations)
                            (assoc :variable-associations variable-associations)
@@ -103,7 +103,7 @@
   ;; Get the variable associations as well.
   (let [batch (map (fn [concept]
                      (let [variable-associations (meta-db/get-associations-for-variable
-                                                  context concept)]
+                                                   context concept)]
                        (assoc concept :variable-associations variable-associations)))
                    batch)]
     (es/prepare-batch context (filter-expired-concepts batch) options)))
@@ -174,11 +174,11 @@
   [concept-type all-revisions-index?]
   (or (not all-revisions-index?)
       (and all-revisions-index? (contains?
-                                 #{:collection :tag-association
-                                   :variable :variable-association
-                                   :service :service-association
-                                   :subscription}
-                                 concept-type))))
+                                  #{:collection :tag-association
+                                    :variable :variable-association
+                                    :service :service-association
+                                    :subscription}
+                                  concept-type))))

 (def REINDEX_BATCH_SIZE 2000)

@@ -291,12 +291,12 @@
 (defn- reindex-suggestions-for-provider
   "Reindex autocomplete suggestion for a given provider"
   [context provider-id]
-  (info "Reindexing autocomplete suggestions for provider " provider-id)
+  (info "Reindexing autocomplete suggestions for provider" provider-id)
   (let [latest-collection-batches (meta-db/find-in-batches
-                                   context
-                                   :collection
-                                   REINDEX_BATCH_SIZE
-                                   {:provider-id provider-id :latest true})
+                                    :context
+                                    :collection
+                                    REINDEX_BATCH_SIZE
+                                    {:provider-id provider-id :latest true})
         latest-suggestion-batches (->> latest-collection-batches
                                        (map #(collection->suggestion-doc context %))
                                        flatten)]
@@ -322,7 +322,7 @@
   * false - only the latest revisions will be indexed"
   ([context provider-ids]
    (reindex-provider-collections
-    context provider-ids {:all-revisions-index? nil :refresh-acls? true :force-version? false}))
+     context provider-ids {:all-revisions-index? nil :refresh-acls? true :force-version? false}))
   ([context provider-ids {:keys [all-revisions-index? refresh-acls? force-version?]}]

    ;; We refresh this cache because it is fairly lightweight to do once for each provider and because
@@ -344,10 +344,10 @@
      (when (or (nil? all-revisions-index?) (not all-revisions-index?))
        (info "Reindexing latest collections for provider" provider-id)
        (let [latest-collection-batches (meta-db/find-in-batches
-                                        context
-                                        :collection
-                                        REINDEX_BATCH_SIZE
-                                        {:provider-id provider-id :latest true})]
+                                         context
+                                         :collection
+                                         REINDEX_BATCH_SIZE
+                                         {:provider-id provider-id :latest true})]
          (bulk-index context latest-collection-batches {:all-revisions-index? false
                                                         :force-version? force-version?})))

@@ -356,10 +356,10 @@
        ;; We will handle that with the index management epic.
        (info "Reindexing all collection revisions for provider" provider-id)
        (let [all-revisions-batches (meta-db/find-in-batches
-                                    context
-                                    :collection
-                                    REINDEX_BATCH_SIZE
-                                    {:provider-id provider-id})]
+                                     context
+                                     :collection
+                                     REINDEX_BATCH_SIZE
+                                     {:provider-id provider-id})]
          (bulk-index context all-revisions-batches {:all-revisions-index? true
                                                     :force-version? force-version?}))))))

@@ -368,10 +368,10 @@
   [context]
   (info "Reindexing tags")
   (let [latest-tag-batches (meta-db/find-in-batches
-                            context
-                            :tag
-                            REINDEX_BATCH_SIZE
-                            {:latest true})]
+                             context
+                             :tag
+                             REINDEX_BATCH_SIZE
+                             {:latest true})]
     (bulk-index context latest-tag-batches)))

 (defn- log-ingest-to-index-time
@@ -387,18 +387,18 @@
                     concept-id
                     (t/in-millis (t/interval rev-datetime now))))
       (warn (format
-             "Cannot compute time from ingest to search visibility for [%s] with revision date [%s]."
-             concept-id
-             revision-date)))))
+              "Cannot compute time from ingest to search visibility for [%s] with revision date [%s]."
+              concept-id
+              revision-date)))))

 (defn- get-elastic-version-with-associations
   "Returns the elastic version of the concept and its associations"
   [context concept associations]
   (es/get-elastic-version
-   (-> concept
-       (assoc :tag-associations (:tag-associations associations))
-       (assoc :variable-associations (:variable-associations associations))
-       (assoc :service-associations (:service-associations associations)))))
+    (-> concept
+        (assoc :tag-associations (:tag-associations associations))
+        (assoc :variable-associations (:variable-associations associations))
+        (assoc :service-associations (:service-associations associations)))))

 (defmulti get-elastic-version
   "Returns the elastic version of the concept"
@@ -413,14 +413,14 @@
   [context concept]
   (let [tag-associations (meta-db/get-associations-for-collection context concept :tag-association)
         variable-associations (meta-db/get-associations-for-collection
-                               context concept :variable-association)
+                                context concept :variable-association)
         service-associations (meta-db/get-associations-for-collection
-                              context concept :service-association)
+                               context concept :service-association)
         associations {:tag-associations tag-associations
                       :variable-associations variable-associations
                       :service-associations service-associations}]
     (get-elastic-version-with-associations
-     context concept associations)))
+      context concept associations)))

 (defmethod get-elastic-version :variable
   [context concept]
@@ -508,33 +508,33 @@
                               :variable-associations variable-associations
                               :service-associations service-associations}
                 elastic-version (get-elastic-version-with-associations
-                                 context concept associations)
+                                  context concept associations)
                 tag-associations (es/parse-non-tombstone-associations
-                                  context tag-associations)
+                                   context tag-associations)
                 variable-associations (es/parse-non-tombstone-associations
-                                       context variable-associations)
+                                        context variable-associations)
                 service-associations (es/parse-non-tombstone-associations
-                                      context service-associations)
+                                       context service-associations)
                 concept-indexes (idx-set/get-concept-index-names context concept-id revision-id
                                                                  options concept)
                 es-doc (es/parsed-concept->elastic-doc
-                        context
-                        (-> concept
-                            (assoc :tag-associations tag-associations)
-                            (assoc :variable-associations variable-associations)
-                            (assoc :service-associations service-associations))
-                        parsed-concept)
+                         context
+                         (-> concept
+                             (assoc :tag-associations tag-associations)
+                             (assoc :variable-associations variable-associations)
+                             (assoc :service-associations service-associations))
+                         parsed-concept)
                 elastic-options (-> options
                                     (select-keys [:all-revisions-index? :ignore-conflict?]))]
             (es/save-document-in-elastic
-             context
-             concept-indexes
-             (concept-mapping-types concept-type)
-             es-doc
-             concept-id
-             revision-id
-             elastic-version
-             elastic-options)
+              context
+              concept-indexes
+              (concept-mapping-types concept-type)
+              es-doc
+              concept-id
+              revision-id
+              elastic-version
+              elastic-options)
             (info (format "Finished indexing concept %s, revision-id %s, all-revisions-index? %s"
                           concept-id revision-id all-revisions-index?))))))))

@@ -568,16 +568,16 @@
   "Index the associated variable concept of the given variable association concept."
   [context concept options]
   (index-associated-concept
-   context (get-in concept [:extra-fields :variable-concept-id]) options))
+    context (get-in concept [:extra-fields :variable-concept-id]) options))

 (defn- reindex-associated-variables
   "Reindex variables associated with the collection"
   [context coll-concept-id coll-revision-id]
   (let [var-associations (meta-db/get-associations-by-collection-concept-id
-                          context coll-concept-id coll-revision-id :variable-association)]
+                           context coll-concept-id coll-revision-id :variable-association)]
     (doseq [association var-associations]
       (index-associated-concept
-       context (get-in association [:extra-fields :variable-concept-id]) {}))))
+        context (get-in association [:extra-fields :variable-concept-id]) {}))))

 (defmethod index-concept :tag-association
   [context concept _parsed-concept options]
@@ -598,8 +598,8 @@
   [context concept-id revision-id options]
   (when-not (and concept-id revision-id)
     (errors/throw-service-error
-     :bad-request
-     (format "Concept-id %s and revision-id %s cannot be null" concept-id revision-id)))
+      :bad-request
+      (format "Concept-id %s and revision-id %s cannot be null" concept-id revision-id)))

   (let [{:keys [all-revisions-index?]} options
         concept-type (cs/concept-id->type concept-id)]
@@ -615,11 +615,11 @@
   [context concept-mapping-types concept-id revision-id]
   (doseq [index (idx-set/get-granule-index-names-for-collection context concept-id)]
     (es/delete-by-query
-     context
-     index
-     (concept-mapping-types :granule)
-     {:term {(query-field->elastic-field :collection-concept-id :granule)
-             concept-id}}))
+      context
+      index
+      (concept-mapping-types :granule)
+      {:term {(query-field->elastic-field :collection-concept-id :granule)
+              concept-id}}))
   ;; reindex variables associated with the collection
   (reindex-associated-variables context concept-id revision-id))

@@ -652,27 +652,27 @@
     (when (indexing-applicable? concept-type all-revisions-index?)
       (info (get-concept-delete-log-string concept-type context concept-id revision-id all-revisions-index?))
       (let [index-names (idx-set/get-concept-index-names
-                         context concept-id revision-id options)
+                          context concept-id revision-id options)
             concept-mapping-types (idx-set/get-concept-mapping-types context)
             elastic-options (select-keys options [:all-revisions-index? :ignore-conflict?])]
         (if all-revisions-index?
           ;; save tombstone in all revisions collection index
           (let [es-doc (es/parsed-concept->elastic-doc context concept (:extra-fields concept))]
             (es/save-document-in-elastic
-             context index-names (concept-mapping-types concept-type)
-             es-doc concept-id revision-id elastic-version elastic-options))
+              context index-names (concept-mapping-types concept-type)
+              es-doc concept-id revision-id elastic-version elastic-options))
           ;; delete concept from primary concept index
           (do
             (es/delete-document
-             context index-names (concept-mapping-types concept-type)
-             concept-id revision-id elastic-version elastic-options)
+              context index-names (concept-mapping-types concept-type)
+              concept-id revision-id elastic-version elastic-options)
             ;; Index a deleted-granule document when granule is deleted
             (when (= :granule concept-type)
               (dg/index-deleted-granule context concept concept-id revision-id elastic-version elastic-options))
             ;; propagate collection deletion to granules
             (when (= :collection concept-type)
               (cascade-collection-delete
-               context concept-mapping-types concept-id revision-id))))))))
+                context concept-mapping-types concept-id revision-id))))))))

 (defn- index-association-concept
   "Index the association concept identified by the given concept-id and revision-id."
@@ -703,19 +703,19 @@
   [context concept-id revision-id]
   (let [concept-type (cs/concept-id->type concept-id)
         index-names (idx-set/get-concept-index-names
-                     context concept-id revision-id {:all-revisions-index? true})
+                      context concept-id revision-id {:all-revisions-index? true})
         concept-mapping-types (idx-set/get-concept-mapping-types context)
         elastic-options {:ignore-conflict? false
                          :all-revisions-index? true}]
     (es/delete-document
-     context
-     index-names
-     (concept-mapping-types concept-type)
-     concept-id
-     revision-id
-     nil ;; Null is sent in as the elastic version because we don't want to set a version for this
-     ;; delete. The concept is going to be gone now and should never be indexed again.
-     elastic-options)))
+      context
+      index-names
+      (concept-mapping-types concept-type)
+      concept-id
+      revision-id
+      nil ;; Null is sent in as the elastic version because we don't want to set a version for this
+      ;; delete. The concept is going to be gone now and should never be indexed again.
+      elastic-options)))

 (defn delete-provider
   "Delete all the concepts within the given provider"
@@ -730,34 +730,34 @@
     ;; delete collections
     (doseq [index (vals (:collection index-names))]
       (es/delete-by-query
-       context
-       index
-       ccmt
-       {:term {(query-field->elastic-field :provider-id :collection) provider-id}}))
+        context
+        index
+        ccmt
+        {:term {(query-field->elastic-field :provider-id :collection) provider-id}}))

     ;; delete the granules
     (doseq [index-name (idx-set/get-granule-index-names-for-provider context provider-id)]
       (es/delete-by-query
-       context
-       index-name
-       (concept-mapping-types :granule)
-       {:term {(query-field->elastic-field :provider-id :granule) provider-id}}))
+        context
+        index-name
+        (concept-mapping-types :granule)
+        {:term {(query-field->elastic-field :provider-id :granule) provider-id}}))

     ;; delete the variables
     (doseq [index (vals (:variable index-names))]
       (es/delete-by-query
-       context
-       index
-       (concept-mapping-types :variable)
-       {:term {(query-field->elastic-field :provider-id :variable) provider-id}}))
+        context
+        index
+        (concept-mapping-types :variable)
+        {:term {(query-field->elastic-field :provider-id :variable) provider-id}}))

     ;; delete the services
     (doseq [index (vals (:service index-names))]
       (es/delete-by-query
-       context
-       index
-       (concept-mapping-types :service)
-       {:term {(query-field->elastic-field :provider-id :service) provider-id}}))))
+        context
+        index
+        (concept-mapping-types :service)
+        {:term {(query-field->elastic-field :provider-id :service) provider-id}}))))

 (defn publish-provider-event
   "Put a provider event on the message queue."
@@ -774,10 +774,10 @@
     (info "Sending events to reindex collections in all providers:" (pr-str providers))
     (doseq [provider-id providers]
       (publish-provider-event
-       context
-       {:action :provider-collection-reindexing
-        :provider-id provider-id
-        :all-revisions-index? false}))
+        context
+        {:action :provider-collection-reindexing
+         :provider-id provider-id
+         :all-revisions-index? false}))
     (info "Reindexing all collection events submitted.")))

 (defn update-humanizers


Add bullet points

Add bullet points

--- frontend/components/integrations.cljs
+++ frontend/components/integrations.cljs
@@ -165,4 +165,17 @@
                [:div
                 [:h1 "Deploy to " [:img {:src (utils/cdn-path "img/outer/integrations/heroku-icon.svg") :alt "Heroku"}] " from CircleCI"]
                 [:p "Experience a simple, modern continuous delivery workflow now."]]
-               [:a {:role "button"} "Sign up for CircleCI"]]]]))))
+               [:a {:role "button"} "Sign up for CircleCI"]]
+              [:div.bullets
+               [:div.bullet
+                [:img {:src (utils/cdn-path "/img/outer/integrations/growing-pains.svg")}]
+                [:h2 "Minimal Configuration"]
+                [:p "Start doing things right from the beginning. Build your continuous delivery workflow on CircleCI and Heroku with a single build container and a couple of Heroku dynos, and simply turn up the dial as your development."]]
+               [:div.bullet
+                [:img {:src (utils/cdn-path "/img/outer/integrations/growing-pains.svg")}]
+                [:h2 "Minimal Configuration"]
+                [:p "Start doing things right from the beginning. Build your continuous delivery workflow on CircleCI and Heroku with a single build container and a couple of Heroku dynos, and simply turn up the dial as your development."]]
+               [:div.bullet
+                [:img {:src (utils/cdn-path "/img/outer/integrations/growing-pains.svg")}]
+                [:h2 "Minimal Configuration"]
+                [:p "Start doing things right from the beginning. Build your continuous delivery workflow on CircleCI and Heroku with a single build container and a couple of Heroku dynos, and simply turn up the dial as your development."]]]]]))))


GM/UK: Fix OSM regex to include files with -ve ids

--- src/hatti/ona/post_process.cljs
+++ src/hatti/ona/post_process.cljs
@@ -57,7 +57,7 @@
     (when-not (empty? osm-fields)
       (let [data (get-in app-state [:map-page :data])
             osm-id->osm-data (osm-id->osm-data data form osm-xml)
-            osm-val->osm-id #(re-find #"[0-9]+" %)
+            osm-val->osm-id #(re-find #"[-]?[0-9]+" %)
             osm-val->osm-data (fn [osm-val]
                                 (when osm-val
                                   (osm-id->osm-data


Re-fix managed-form-post

Re-fix managed-form-post

--- frontend/utils/ajax.cljs
+++ frontend/utils/ajax.cljs
@@ -102,22 +102,23 @@
         accept (case format
                  :json "application/json"
                  :xml "applicatin/xml")]
-    (-> (clj-ajax/transform-opts {:format (case format
-                                            :json (clj-ajax/json-request-format)
-                                            :xml (xml-request-format))
-                                  :response-format (case format
-                                                     :json (json-response-format {:keywords? keywords? :url url :method method})
-                                                     :xml (xml-response-format))
-                                  :keywords? keywords?
-                                  :params params
-                                  :headers (merge {:Accept accept}
-                                                  (when (and csrf-token (re-find #"^/" url))
-                                                    {:X-CSRFToken (utils/csrf-token)})
-                                                  headers)
-                                  :handler #(put! channel (assoc % :status :success :scopes (scopes-from-response %)))
-                                  ;; TODO: clean this up
-                                  :error-handler #(put! channel (normalize-error-response % {:url url}))
-                                  :finally #(close! channel)})
+    (-> {:format (case format
+                   :json (clj-ajax/json-request-format)
+                   :xml (xml-request-format))
+         :response-format (case format
+                            :json (json-response-format {:keywords? keywords? :url url :method method})
+                            :xml (xml-response-format))
+         :keywords? keywords?
+         :params params
+         :headers (merge {:Accept accept}
+                         (when (and csrf-token (re-find #"^/" url))
+                           {:X-CSRFToken (utils/csrf-token)})
+                         headers)
+         :handler #(put! channel (assoc % :status :success :scopes (scopes-from-response %)))
+         ;; TODO: clean this up
+         :error-handler #(put! channel (normalize-error-response % {:url url}))
+         :finally #(close! channel)}
+        clj-ajax/transform-opts
         (assoc :uri url :method method)
         clj-ajax/ajax-request)
     channel))
@@ -127,18 +128,17 @@
 (defn managed-form-post [url & {:keys [params headers keywords?]
                                 :or {keywords? true}}]
   (let [channel (chan)]
-    (-> (clj-ajax/transform-opts
-         {:format (merge (clj-ajax/url-request-format)
-                         (json-response-format {:keywords? keywords? :url url :method :post}))
-          :response-format :json
-          :params params
-          :headers (merge {:Accept "application/json"}
-                          (when (re-find #"^/" url)
-                            {:X-CSRFToken (utils/csrf-token)})
-                          headers)
-          :handler #(put! channel (assoc % :status :success))
-          :error-handler #(put! channel %)
-          :finally #(close! channel)})
+    (-> {:format (clj-ajax/url-request-format)
+         :response-format (json-response-format {:keywords? keywords? :url url :method :post})
+         :params params
+         :headers (merge {:Accept "application/json"}
+                         (when (re-find #"^/" url)
+                           {:X-CSRFToken (utils/csrf-token)})
+                         headers)
+         :handler #(put! channel (assoc % :status :success))
+         :error-handler #(put! channel %)
+         :finally #(close! channel)}
+        clj-ajax/transform-opts
         (assoc :uri url :method :post)
         clj-ajax/ajax-request)
     channel))


touch osc walkthrough

touch osc walkthrough

--- src/insane_noises/touch_osc.clj
+++ src/insane_noises/touch_osc.clj
@@ -14,4 +14,22 @@
 ; remove the listener
 (osc-rm-listener server :debug)

-; add
+; add a listener for a specific path
+(osc-handle server "/1/fader6" (fn [msg] (println msg)))
+
+; define a sine wave
+(definst foo [freq 440] (sin-osc freq))
+
+; define the control
+(defn control-foo
+  [val]
+  (let [val (scale-range val 0 1 50 1000)]
+    (ctl foo :freq val)))
+
+; compose listener, controller and sine wave
+(osc-handle server "/1/fader6" (fn [msg] (control-foo (first (:args msg)))))
+
+; trigger foo
+(foo)
+
+(stop)


counts paging correctly

counts paging correctly

--- src/crawler/corpus.clj
+++ src/crawler/corpus.clj
@@ -334,24 +334,25 @@

              yield-at-step (if (nil? (:parent-set acc))
                              1
-                             (apply
-                              max
-                              (map
-                               (fn [[u x]]
-                                 (let [state-action  (:xpath-nav-info
-                                                      (extractor/state-action (:body x)
-                                                                              {:url u}
-                                                                              {}
-                                                                              []))
-
-                                       yield-record  (count
-                                                      (:hrefs-and-texts
-                                                       (first
-                                                        (filter
-                                                         #(= (:xpath %) action-to-take)
-                                                         state-action))))]
-                                   yield-record))
-                               associated-docs)))
+                             (try (apply
+                                   max
+                                   (map
+                                    (fn [[u x]]
+                                      (let [state-action  (:xpath-nav-info
+                                                           (extractor/state-action (:body x)
+                                                                                {:url u}
+                                                                                {}
+                                                                                []))
+
+                                            yield-record  (count
+                                                           (:hrefs-and-texts
+                                                            (first
+                                                             (filter
+                                                              #(= (:xpath %) action-to-take)
+                                                              state-action))))]
+                                        yield-record))
+                                    associated-docs))
+                                  (catch Exception e 0)))

              yield-with-paging (if ((:paging-actions pagination) step)
                                  (* 10 yield-at-step)


Only use user activation if it's set (in the card dialog)

--- src/kanban/components/card.cljs
+++ src/kanban/components/card.cljs
@@ -19,7 +19,8 @@
           {:keys [selected with-name activate-fn]} (om/get-computed this)]
       (dom/span #js {:className (class-names {:assignee true
                                               :selected selected})
-                     :onClick #(activate-fn (om/get-ident this))
+                     :onClick #(when activate-fn
+                                 (activate-fn (om/get-ident this)))
                      :title name}
         (if with-name
           (gstring/format "%s (@%s) " name username)


PDP-99: Fix incrementing metrics, such as cache hit, to be suffixed with count

--- src/qu/logging.clj
+++ src/qu/logging.clj
@@ -51,7 +51,7 @@

 (defn- log-exception
   [req ex total]
-  (metrics/increment "request.exception")
+  (metrics/increment "request.exception.count")
   (error (log-request-msg "Exception" req) (str total "ms"))
   (error ex)
   (error "--- END STACKTRACE ---"))


hard code gals for debug

hard code gals for debug

realtime not working so hardcoded some stuff

--- src/webapp/framework/client/coreclient.cljs
+++ src/webapp/framework/client/coreclient.cljs
@@ -1344,20 +1344,27 @@
    ;(log (pr-str (count (keys @data-queries-v2))))
    (let [x (remote  !check-for-server-updates  {:client-data-session-id  @data-session-id} )
          xx           (-> x :queries keys first)
-         new-key     (dissoc (dissoc xx :start) :end)
+         ;new-key     (dissoc (dissoc xx :start) :end)
+         new-key      {:data-source     :todo_items
+                       :table           "todo_items"
+                       :where           nil
+                       :db-table        "todo_items"
+                       :params          nil
+                       :order           nil
+                       :realtime        true}
          ]
      (log "Client realtime: " new-key)
      (>! data-query-requests-v2  {
                                   :query-key     new-key

                                   :subset-range  {
-                                                  :start   (:start  xx)
-                                                  :end     (:end    xx)
+;                                                  :start   (:start  xx)
+;                                                  :end     (:end    xx)
+                                                  :start   (:start  1)
+                                                  :end     (:end    20)
                                                   } })

      )) 3000)
-
-


Shorten symbol name

Shorten symbol name

--- desktop/src/nightmod/core/desktop_launcher.clj
+++ desktop/src/nightmod/core/desktop_launcher.clj
@@ -23,8 +23,8 @@
 (def ^:const window-height 768)
 (def ^:const editor-width 700)

-(def editor-widgets [:save :undo :redo :font-dec :font-inc
-                     :doc :paredit :paredit-help :close])
+(def widgets [:save :undo :redo :font-dec :font-inc
+              :doc :paredit :paredit-help :close])

 (defn create-layered-pane
   "Returns the pane with the editors."
@@ -88,6 +88,6 @@
   (window/set-theme! args)
   (s/invoke-later
     (s/show! (reset! ui/root (create-window)))
-    (binding [editors/*editor-widgets* editor-widgets]
+    (binding [editors/*widgets* widgets]
       (reset! ui/tree-selection "")))
   (Keyboard/enableRepeatEvents true))


refine transaction tests

refine transaction tests

--- test/clj_money/models/transactions_test.clj
+++ test/clj_money/models/transactions_test.clj
@@ -179,21 +179,12 @@
     (is (= [(bigdec 100)] (map :balance groceries-items))
           "The groceries account balances are correct")))

-; TODO Need to create the accounts for each test instead of once
 (deftest item-indexes-are-set-when-saved
-  (let [context (test-context)
-        attributes (:attributes context)
-        accounts (:accounts context)
-        transaction (transactions/create
-                      storage-spec
-                      attributes)
-        salary-item (->> transaction
-                         :items
-                         (filter #(= (:id (:salary accounts)) (:account-id %)))
-                         first)
-        checking-item (->> transaction
-                         :items
-                         (filter #(= (:id (:checking accounts)) (:account-id %)))
-                         first)]
-    (is (= 0 (:index salary-item)) "The salary transaction item has the correct index")
-    (is (= 0 (:index checking-item)) "The checking transaction item has the correct index")))
+  (let [context (serialization/realize storage-spec balance-context)
+        [checking-items
+         salary-items
+         groceries-items] (map #(transactions/items-by-account storage-spec (:id %))
+                               (:accounts context))]
+    (is (= [1 0] (map :index checking-items)) "The checking transaction items have correct indexes")
+    (is (= [0] (map :index salary-items)) "The salary transaction items have the correct indexes")
+    (is (= [0] (map :index groceries-items)) "The groceries transaction items have the correct indexes")))


refind update transaction test

refind update transaction test

--- test/clj_money/models/transactions_test.clj
+++ test/clj_money/models/transactions_test.clj
@@ -411,10 +411,20 @@
         actual-groceries (->> (:id groceries)
                               (transactions/items-by-account storage-spec)
                               (map #(select-keys % [:index :amount :balance])))]
-    (is (= expected-checking actual-checking)
-        "Check items should have the correct values after update")
-    (is (= expected-groceries actual-groceries)
-        "Groceries items should have the correct values after update")))
+    (testing "transaction item balances are correct"
+      (is (= expected-checking actual-checking)
+          "Check items should have the correct values after update")
+      (is (= expected-groceries actual-groceries)
+          "Groceries items should have the correct values after update"))
+    (testing "account balances are correct"
+      (is (= (bigdec 798.01) (->> checking
+                                  (accounts/reload storage-spec)
+                                  :balance))
+          "The checkout account balance should be correct after update")
+      (is (= (bigdec 201.99) (->> groceries
+                                  (accounts/reload storage-spec)
+                                  :balance))
+          "The groceries account balance should be correct after update"))))

 ; update a transaction
 ; change amount


Fix an import, herpderp

Fix an import, herpderp

--- src/doctopus/files.clj
+++ src/doctopus/files.clj
@@ -6,7 +6,7 @@
 We probably want, but don't yet have: tools for managing local temp (making
 temp dirs, moving around any output generated, cleaning up later)."
   (:require [clojure.string :as str]
-            [doctopus.files.predicates :refer [markdown]]
+            [doctopus.files.predicates :refer [markdown?]]
             [me.raynes.fs :as fs]))

 ;; I think we've pretty much captured this by now? -- RMD Sun Mar 15 20:37:46 2015
@@ -34,8 +34,8 @@

 (defn truncate-str
   "Removes non-relatice path data from a string"
-  [fq-path rel-path]
-  (str/replace fq-path rel-path ""))
+  [fq-path remove-from-fq-path]
+  (str/replace fq-path remove-from-fq-path ""))

 (defn walk-the-docs


Show error message if any

Show error message if any

--- frontend/src/cruncher/communication/auth.cljs
+++ frontend/src/cruncher/communication/auth.cljs
@@ -2,13 +2,18 @@
   (:require [ajax.core :refer [POST]]
             [cruncher.config :as config]
             [cruncher.communication.main :as com]
-            [cruncher.communication.utils :as clib]))
+            [cruncher.communication.utils :as clib]
+            [cruncher.utils.lib :as lib]))

 (defn success-login
   "Callback function when login was successful. Set attributes of user."
   [response]
   (let [res (com/process-response response)]
-    (println "Successfully logged in." res)))
+    (if (= "ok" (:status res))
+      (do
+        (lib/no-error!)
+        (lib/change-view! :default))
+      (lib/error! (:message res)))))

 (defn ajax-login
   "Get cleaned data and send ajax request."


Bring into line with other JVM implementations.

--- clojure_pi_dir/run.clj
+++ clojure_pi_dir/run.clj
@@ -4,7 +4,7 @@
 ; We could actually build in this script because of the way LISPs like Clojure
 ; work but that would mean building every time, so leave it to Make.

-(def n 10000000)
+(def n 50000000)
 (if (> (count *command-line-args*) 0)
   (def n(Integer/parseInt (first *command-line-args*)))
 )
@@ -24,4 +24,4 @@
 (def difference (/ (- stop start) 1000.0))

 (println "Obtained value of PI:" mypi)
-(println "Time taken:" difference "seconds")+(println "Time taken:" difference "seconds")


Use unique Content-IDs to workaround confused email clients. Resolves #3982

--- src/metabase/email/messages.clj
+++ src/metabase/email/messages.clj
@@ -169,17 +169,21 @@
       (.write fos img-bytes))
     file))

+(defn- hash-bytes
+  "Generate a hash to be used in a Content-ID"
+  [^bytes img-bytes]
+  (Math/abs ^Integer (java.util.Arrays/hashCode img-bytes)))
+
 (defn- render-image [images-atom, ^bytes image-bytes]
-  (str "cid:IMAGE" (or (u/first-index-satisfying (fn [^bytes item]
-                                                   (java.util.Arrays/equals item image-bytes))
-                                                 @images-atom)
-                       (u/prog1 (count @images-atom)
-                         (swap! images-atom conj image-bytes)))))
+  (let [content-id (str (hash-bytes image-bytes) "@metabase")]
+    (if-not (contains? @images-atom content-id)
+      (swap! images-atom assoc content-id image-bytes))
+    (str "cid:" content-id)))

 (defn render-pulse-email
   "Take a pulse object and list of results, returns an array of attachment objects for an email"
   [pulse results]
-  (let [images       (atom [])
+  (let [images       (atom {})
         body         (binding [render/*include-title* true
                                render/*render-img-fn* (partial render-image images)]
                        (vec (cons :div (for [result results]
@@ -195,8 +199,8 @@
                         :quotationAuthor (:author data-quote)
                         :logoFooter      true})]
     (apply vector {:type "text/html; charset=utf-8" :content message-body}
-           (map-indexed (fn [idx bytes] {:type         :inline
-                                         :content-id   (str "IMAGE" idx)
-                                         :content-type "image/png"
-                                         :content      (write-byte-array-to-temp-file bytes)})
-                        @images))))
+           (map (fn [[content-id bytes]] {:type         :inline
+                                    :content-id   content-id
+                                    :content-type "image/png"
+                                    :content      (write-byte-array-to-temp-file bytes)})
+                (seq @images)))))


Prefix unused vars with underscore

Prefix unused vars with underscore

--- src/expound/alpha.cljc
+++ src/expound/alpha.cljc
@@ -287,7 +287,7 @@
        (conformed-value problems invalid-value)
        ""))))

-(defmethod value-str :default [_type spec-name form path problems opts]
+(defmethod value-str :default [_type spec-name form path problems _opts]
   (show-spec-name spec-name (value+conformed-value problems spec-name form path {:show-conformed? true})))

 (defn ^:private explain-missing-keys [problems]
@@ -312,7 +312,7 @@
    (value-str type spec-name form in problems opts)
    expected))

-(defmethod expected-str :expound.problem-group/one-value [_type spec-name form path problems opts]
+(defmethod expected-str :expound.problem-group/one-value [_type spec-name _form _path problems opts]
   (let [problem (first problems)
         subproblems (:problems problem)
         grouped-subproblems (vals (group-by :expound.spec.problem/type subproblems))]
@@ -320,7 +320,7 @@
      "\n\nor\n\n"
      (map #(expected-str* spec-name % opts) grouped-subproblems))))

-(defmethod value-str :expound.problem-group/one-value [type spec-name form path problems opts]
+(defmethod value-str :expound.problem-group/one-value [_type spec-name _form _path problems opts]
   (s/assert ::singleton problems)
   (let [problem (first problems)
         subproblems (:problems problem)]
@@ -333,7 +333,7 @@

     "Spec failed"))

-(defmethod problem-group-str :expound.problem-group/one-value [type spec-name form path problems opts]
+(defmethod problem-group-str :expound.problem-group/one-value [type spec-name _form path problems opts]
   (s/assert ::singleton problems)
   (let [problem (first problems)
         subproblems (:problems problem)
@@ -347,7 +347,7 @@
                 opts
                 (expected-str type spec-name form path problems opts))))

-(defmethod expected-str :expound.problem-group/many-values [type spec-name form path problems opts]
+(defmethod expected-str :expound.problem-group/many-values [_type spec-name _form _path problems opts]
   (let [subproblems (:problems (first problems))]
     (string/join
      "\n\nor value\n\n"
@@ -364,7 +364,7 @@
    (header-label "Spec failed")
    (expected-str _type spec-name form path problems opts)))

-(defmethod expected-str :expound.problem/missing-key [_type spec-name _form path problems opts]
+(defmethod expected-str :expound.problem/missing-key [_type _spec-name _form _path problems _opts]
   (explain-missing-keys problems))

 (defmethod problem-group-str :expound.problem/missing-key [type spec-name form path problems opts]
@@ -401,13 +401,13 @@
               opts
               (expected-str type spec-name form path problems opts)))

-(defmethod expected-str :expound.problem/missing-spec [_type spec-name form path problems opts]
+(defmethod expected-str :expound.problem/missing-spec [_type spec-name form path problems _opts]
   (str "with\n\n"
        (->> problems
             (map #(no-method spec-name form path %))
             (string/join "\n\nor with\n\n"))))

-(defmethod value-str :expound.problem/missing-spec [_type spec-name form path problems opts]
+(defmethod value-str :expound.problem/missing-spec [_type spec-name form path _problems _opts]
   (printer/format
    "Cannot find spec for

@@ -513,7 +513,7 @@
                  (let [in (-> prob :expound/in)]
                    (expected-str (-> prob :expound.spec.problem/type) :expound/no-spec-name non-matching-value in [prob] opts))))))

-(defmethod expected-str :expound.problem/insufficient-input [_type spec-name form path problems opts]
+(defmethod expected-str :expound.problem/insufficient-input [_type _spec-name _form _path problems opts]
   (let [problem (first problems)]
     (printer/format
      "should have additional elements. The next element%s %s"
@@ -532,7 +532,7 @@
               opts
               (expected-str type spec-name form path problems opts)))

-(defmethod expected-str :expound.problem/extra-input [_type spec-name form path problems opts]
+(defmethod expected-str :expound.problem/extra-input [_type _spec-name _form _path problems _opts]
   (s/assert ::singleton problems)
   "has extra input")

@@ -546,7 +546,7 @@
               opts
               (expected-str type spec-name form path problems opts)))

-(defmethod expected-str :expound.problem/fspec-exception-failure [_type spec-name form path problems opts]
+(defmethod expected-str :expound.problem/fspec-exception-failure [_type _spec-name _form _path problems _opts]
   (s/assert ::singleton problems)
   (let [problem (first problems)]
     (printer/format
@@ -573,7 +573,7 @@
    opts
    (expected-str type spec-name form path problems opts)))

-(defmethod expected-str :expound.problem/fspec-ret-failure [_type spec-name form path problems opts]
+(defmethod expected-str :expound.problem/fspec-ret-failure [_type _spec-name _form _path problems opts]
   (s/assert ::singleton problems)
   (let [problem (first problems)]
     (printer/format
@@ -592,22 +592,22 @@
    opts
    (expected-str type spec-name form path problems opts)))

-(defmethod value-str :expound.problem/insufficient-input [_type spec-name form path problems opts]
+(defmethod value-str :expound.problem/insufficient-input [_type spec-name form path problems _opts]
   (show-spec-name spec-name (value+conformed-value problems spec-name form path {:show-conformed? false})))

-(defmethod value-str :expound.problem/extra-input [_type spec-name form path problems opts]
+(defmethod value-str :expound.problem/extra-input [_type spec-name form path problems _opts]
   (show-spec-name spec-name (value+conformed-value problems spec-name form path {:show-conformed? false})))

-(defmethod value-str :expound.problem/fspec-fn-failure [_type spec-name form path problems opts]
+(defmethod value-str :expound.problem/fspec-fn-failure [_type spec-name form path problems _opts]
   (show-spec-name spec-name (value+conformed-value problems spec-name form path {:show-conformed? false})))

-(defmethod value-str :expound.problem/fspec-exception-failure [_type spec-name form path problems opts]
+(defmethod value-str :expound.problem/fspec-exception-failure [_type spec-name form path problems _opts]
   (show-spec-name spec-name (value+conformed-value problems spec-name form path {:show-conformed? false})))

-(defmethod value-str :expound.problem/fspec-ret-failure [_type spec-name form path problems opts]
+(defmethod value-str :expound.problem/fspec-ret-failure [_type spec-name form path problems _opts]
   (show-spec-name spec-name (value+conformed-value problems spec-name form path {:show-conformed? false})))

-(defmethod expected-str :expound.problem/fspec-fn-failure [_type spec-name form path problems opts]
+(defmethod expected-str :expound.problem/fspec-fn-failure [_type _spec-name _form _path problems _opts]
   (s/assert ::singleton problems)
   (let [problem (first problems)]
     (printer/format


Improves tab navigation

Improves tab navigation

--- src/front/ui/main.cljs
+++ src/front/ui/main.cljs
@@ -112,6 +112,21 @@
                                                              0))
                                                (reset! selected-task
                                                        nil)
+                                               (.preventDefault e))
+                                             (when (and (= (.-keyCode e)
+                                                           9)
+                                                        (.-shiftKey  e))
+                                               (-> ($ (str "#todo-" (:id task)))
+                                                   (.parent)
+                                                   (.parent)
+                                                   (.parent)
+                                                   (.parent)
+                                                   (.prev)
+                                                   (.find ":tabbable")
+                                                   (.last)
+                                                   (.focus))
+                                               (reset! selected-task
+                                                       nil)
                                                (.preventDefault e)))))
                           :on-focus #(reset! selected-task task)
                           :on-double-click edit}
@@ -143,10 +158,42 @@
 (defn render-done
   [task]
   [:li
-   {:class (build-to-do-class task
+   {:tab-index 0
+    :class (build-to-do-class task
                               @selected-task)
     :id (str "done-" (:id task))
-    :on-click (fn [e]
+    :on-key-down (fn [e]
+                   (do
+                     (when (= (.-keyCode e)
+                              32)
+                       (state/update-task! task
+                                           :done false)
+                       (.preventDefault e))
+                     (when (= (.-keyCode e)
+                              38)
+                       (.focus (.prev ($ ":focus")))
+                       (.preventDefault e))
+                     (when (= (.-keyCode e)
+                              40)
+                       (.focus (.next ($ ":focus")))
+                       (.preventDefault e))
+                     (when (and (= (.-keyCode e)
+                                   9)
+                                (not (.-shiftKey  e)))
+                       (.focus (.get ($ "#search-field")
+                                     0))
+                       (reset! selected-task
+                               nil)
+                       (.preventDefault e))
+                     (when (and (= (.-keyCode e)
+                                   9)
+                                (.-shiftKey  e))
+                       (.focus (.get ($ ".toggle-hide-done")
+                                     0))
+                       (reset! selected-task
+                               nil)
+                       (.preventDefault e))))
+    :on-focus (fn [e]
                 (when (= (.-target e)
                          (.get ($ (str "#done-" (:id task)))
                                0))
@@ -301,7 +348,7 @@
    [:div.search-container
     [:div.icon
      [:i.fa.fa-search]]
-    [:input
+    [:input#search-field
      {:placeholder "Search"}]]])

 (defmulti main-toolbar-component (fn [id _] id))


Remove debug.

Remove debug.

--- src/onyx/peer/task_pipeline.clj
+++ src/onyx/peer/task_pipeline.clj
@@ -61,7 +61,6 @@
 (defn munge-ack [{:keys [queue batch tail-batch?] :as event}]
   (let [f (if tail-batch? butlast identity)
         messages (f batch)]
-    (taoensso.timbre/info "Acking " (:decompressed event))
     (doseq [message messages]
       (extensions/ack-message queue message)))
   event)


Experimentally add a delay with all extent states to next-trigger-state calls.

--- src/onyx/peer/window_state.cljc
+++ src/onyx/peer/window_state.cljc
@@ -100,18 +100,24 @@
                           (assoc :trigger-record trigger-record))
           group-id (:group-id state-event)
           trigger-idx (:idx trigger-record)
+          fire-all? (or fire-all-extents? (not= (:event-type state-event) :new-segment))
+          fire-extents (if fire-all?
+                         (all-extents incremental? window-extension state-store idx group-id)
+                         (:extents state-event))
           next-trigger-state (if state-context-trigger?
                                (let [trigger-state (st/get-trigger state-store trigger-idx group-id)
                                      defaulted-trigger-state (if (= :not-found trigger-state)
                                                                ((:init-state trigger-record) trigger)
                                                                trigger-state)
-                                     next-trigger-state ((:next-trigger-state trigger-record) trigger defaulted-trigger-state state-event)]
+                                     ;; Experimentally add extent-states to trigger next-state call.
+                                     ;; Please note that this behaviour may be removed in the future.
+                                     state-event-extent-states (assoc state-event
+                                                                      :extent-states
+                                                                      (delay (mapv (fn [extent] (st/get-extent state-store idx group-id extent))
+                                                                                fire-extents)))
+                                     next-trigger-state ((:next-trigger-state trigger-record) trigger defaulted-trigger-state state-event-extent-states)]
                                  (st/put-trigger! state-store trigger-idx group-id next-trigger-state)
                                  next-trigger-state))
-          fire-all? (or fire-all-extents? (not= (:event-type state-event) :new-segment))
-          fire-extents (if fire-all?
-                         (all-extents incremental? window-extension state-store idx group-id)
-                         (:extents state-event))
           state-event (assoc state-event :trigger-state next-trigger-state)]
       (run! (fn [extent]
               (let [[lower upper] (we/bounds window-extension extent)


poistettu login/logout

poistettu login/logout

--- mtg-pairings-server/src/mtg_pairings_server/server.clj
+++ mtg-pairings-server/src/mtg_pairings_server/server.clj
@@ -27,27 +27,12 @@
            db))
        db)))

-(defn login [req]
-  (if-let [dci (get-in req [:body :dci])]
-    (do
-      (println "dci:" dci)
-      {:status 200
-       :session (assoc (:session req {}) :dci dci)})
-    {:status 400}))
-
-(defn logout []
-  {:status 200
-   :session nil})

 (defn routes [db]
   (let [tournament-routes (tournament-api/routes db)]
     (c/routes
       (r/resources "/")
       (c/GET "/" [] (response (slurp "resources/public/index.html")))
-      (c/POST "/login" [:as req]
-        (login req))
-      (c/POST "/logout" []
-        (logout))
       (c/context "/tournament" [] tournament-routes))))

 (defn run! []


removed explicit namespace from keys

removed explicit namespace from keys

--- src/org/domaindrivenarchitecture/pallet/serverstate/apt.clj
+++ src/org/domaindrivenarchitecture/pallet/serverstate/apt.clj
@@ -22,8 +22,8 @@
     [pallet.script :as script]
     [pallet.script.lib :as lib]))

-(def res-key-apt-packages ::dda-serverstate-apt-packages)
-(def res-key-apt-repositories ::dda-serverstate-apt-repositories)
+(def res-key-apt-packages ::apt-packages)
+(def res-key-apt-repositories ::apt-repositories)

 (defn define-resources-apt
   "Defines the ospackages resource.


adding more tests for project-facts

adding more tests for project-facts

--- test/clj/app_test.clj
+++ test/clj/app_test.clj
@@ -43,10 +43,12 @@
     (is (not-empty (find-duplicate-facts fs)))))

 (deftest project-facts-1
-  (let [pfs (-> (ff/get-facts) ff/project-facts)]
+  (let [fs (ff/get-facts )
+        pfs (ff/project-facts fs)]
     (is (sequential? pfs))
     (is (not-empty pfs))
-    (is (empty? (find-duplicate-facts pfs)))))
+    (is (empty? (find-duplicate-facts pfs)))
+    (is (< (count pfs) (count fs)))))

 #_(fe/get-entity ldb 1)


Insert data into MongoDB

Insert data into MongoDB

--- src/whitman/db.clj
+++ src/whitman/db.clj
@@ -1,5 +1,6 @@
 (ns whitman.db
-  (:require [monger.core :as mg]))
+  (:require [monger.collection :as mc]
+            [monger.core :as mg]))

 (def ^{:private true} default-db-host "localhost:27017")

@@ -10,3 +11,6 @@

 (defn db [cfg]
   (-> cfg db-url mg/connect-via-uri :db))
+
+(defn insert [cfg query docs]
+  (mc/upsert (db cfg) (get cfg "collection") query docs {:upsert true}))


grammar fix

grammar fix

--- src/leiningen/core.clj
+++ src/leiningen/core.clj
@@ -46,7 +46,7 @@
 (def no-project-needed #{"new" "help" "version"})

 (defn task-not-found [task project & _]
-  (println task "is not a task. Use \"help\" to list all task.")
+  (println task "is not a task. Use \"help\" to list all tasks.")
   (System/exit 1))

 (defn resolve-task [task]


Add optional args to 'project-change-shas

--- src/leiningen/voom.clj
+++ src/leiningen/voom.clj
@@ -338,9 +338,9 @@
     {:sha sha, :ctime (Date. ^String datestr), :parents parents, :refs refs}))

 (defn project-change-shas
-  [gitdir]
-  (->> (git {:gitdir gitdir} "log" "--all" "--pretty=format:%H,%cd,%p,%d"
-            "--name-status" "-m")
+  [gitdir & opts]
+  (->> (apply git {:gitdir gitdir} "log" "--pretty=format:%H,%cd,%p,%d"
+              "--name-status" "-m" opts)
        :lines
        (keep #(if-let [[_ op path] (re-matches #"(.)\t(.*)" %)]
                 (when (re-find #"(^|/)project\.clj$" path)


[TH] remove kehaar from channels require

--- resources/leiningen/new/kraken/channels.clj
+++ resources/leiningen/new/kraken/channels.clj
@@ -1,6 +1,5 @@
 (ns {{name}}.channels
-  (:require [clojure.core.async :as async]
-            [kehaar :as k]))
+  (:require [clojure.core.async :as async]))

 ;;; TODO: Create channels and add them to the list of channels to close.
 (defn close-all! []


CMR-1922: Fixed user.clj external db setting

--- dev-system/dev/user.clj
+++ dev-system/dev/user.clj
@@ -37,8 +37,8 @@
   (system/set-dev-system-echo-type! :in-memory)
   ; (system/set-dev-system-echo-type! :external)

-  ; (system/set-dev-system-db-type! :in-memory)
-  (system/set-dev-system-db-type! :external)
+  (system/set-dev-system-db-type! :in-memory)
+  ; (system/set-dev-system-db-type! :external)

   (system/set-dev-system-message-queue-type! :in-memory)
   ; (system/set-dev-system-message-queue-type! :external)


Make rollback work for datomic

Make rollback work for datomic

--- joplin.datomic/src/joplin/datomic/database.clj
+++ joplin.datomic/src/joplin/datomic/database.clj
@@ -50,11 +50,11 @@
   (remove-migration-id [db id]
     (when-let [conn (get-connection (:url db))]
       (ensure-migration-schema conn)
-      (when-let [mig (first (d/q '[:find ?e
-                                   :in $ ?id
-                                   :where
-                                   [?e :migrations/id ?id]]
-                                 (d/db conn) id))]
+      (when-let [mig (d/q '[:find ?e .
+                            :in $ ?id
+                            :where
+                            [?e :migrations/id ?id]]
+                          (d/db conn) id)]
         @(d/transact conn [[:db.fn/retractEntity mig]]))))
   (applied-migration-ids [db]
     (when-let [conn (get-connection (:url db))]


every data point is associated with a mortgage

--- src/mortgage/core.cljs
+++ src/mortgage/core.cljs
@@ -163,8 +163,11 @@
                        :selected-mortgage Mortgage
                        :ui-event-chan     s/Any})

+(sm/defschema DataPoint {:mortgage Mortgage
+                         :value    s/Num})
+
 (sm/defn draw-bar-graph [y-axis-label :- s/Str
-                         data-points :- [s/Num]]
+                         data-points :- [DataPoint]]
   [:svg {:width 500 :height 300}
    [:line {:x1           100 :y1 20
            :x2           100 :y2 280
@@ -176,13 +179,13 @@
            :stroke-width 1}]

    [:text {:x 70 :y 235 :transform "rotate(270 75 230)"} y-axis-label]
-   [:text {:x 90 :y 30 :text-anchor "end"} (str "$" (.toLocaleString (int (apply max data-points))))]
+   [:text {:x 90 :y 30 :text-anchor "end"} (str "$" (.toLocaleString (int (apply max (map :value data-points)))))]

    (for [[index point] (map-indexed vector data-points)]
      (let [x (+ 110 (* index 50))
            height (* 250
-                     (/ point (apply max data-points)))]
+                     (/ (:value point) (apply max (map :value data-points))))]
        ^{:key (str "rect-" point)} [:rect {:x              (- x 50)
                                            :y              280
                                            :width          40
@@ -193,11 +196,19 @@
                                            }]))])

 (sm/defn draw-money-wasted [state :- UIState]
-  [draw-bar-graph "Money Wasted On Interest" (map (comp :interest total-price-breakdown) (:mortgages state))]
+  [draw-bar-graph
+   "Money Wasted On Interest"
+   (for [m (:mortgages state)]
+     {:mortgage m
+      :value    (-> m total-price-breakdown :interest)})]
   )

 (sm/defn draw-monthly-payment [state :- UIState]
-  [draw-bar-graph "Total Monthly Payment" (map full-monthly-payment-amount (:mortgages state))]
+  [draw-bar-graph
+   "Total Monthly Payment"
+   (for [m (:mortgages state)]
+     {:mortgage m
+      :value (full-monthly-payment-amount m)})]
   )

 (sm/defn draw-mortgage [m :- Mortgage


Use default LZMA options for must faster runtime performance

Signed-off-by: Gregory Haskins <640d9fe47775e6723f0355b7315e38f7d98d3539@gmail.com>

--- src/obcc/dar/write.clj
+++ src/obcc/dar/write.clj
@@ -50,7 +50,7 @@
 (def compressors
   {"none" #(ProxyOutputStream. %)
    "gzip" #(GZIPOutputStream. %)
-   "lzma" #(-> (LzmaOutputStream$Builder. %) .useMaximalDictionarySize (.useEndMarkerMode true) .useBT4MatchFinder .build)
+   "lzma" #(-> (LzmaOutputStream$Builder. %) .build)
    })

 (defn compressor [type os] ((compressors type) os))


return exercise as frontend format

return exercise as frontend format

--- src/ontrail/mutate.clj
+++ src/ontrail/mutate.clj
@@ -117,7 +117,7 @@
         tret (assoc  (dissoc ret :_id) :id str-id)]
     (insert-exercise-inmem-index ret)
     (.debug logger (str (:user params) " created ex " ret))
-    tret))
+    (as-ex-result tret)))

 (defn comment-ex [user params]
   (.debug logger (str user " creating comment " params))


wip: sort of working

wip: sort of working

--- src/reagent/ratom.cljs
+++ src/reagent/ratom.cljs
@@ -203,7 +203,7 @@

 (deftype Reaction [f ^:mutable state ^:mutable dirty? ^:mutable active?
                    ^:mutable watching ^:mutable watches
-                   auto-run on-set on-dispose]
+                   ^:mutable auto-run on-set on-dispose]
   IAtom
   IReactiveAtom

@@ -290,6 +290,14 @@

   IDeref
   (-deref [this]
+    (when (== dirty? maybe-dirty)
+      (let [oldauto auto-run]
+        (set! auto-run nil)
+        (doseq [w watching]
+          (-deref w))
+        (set! auto-run oldauto))
+      (when (== dirty? maybe-dirty)
+        (set! dirty? clean)))
     (if (or auto-run (some? *ratom-context*))
       (do
         (notify-deref-watcher! this)