Remove InputStream decoding for now.

Remove InputStream decoding for now.

--- src/multihash/core.clj
+++ src/multihash/core.clj
@@ -3,10 +3,7 @@
   (:require
     [clojure.string :as str])
   (:import
-    (java.io
-      InputStream
-      IOException
-      PushbackInputStream)
+    java.io.IOException
     java.security.MessageDigest))

@@ -297,18 +294,4 @@

   (decode
     [source]
-    (decode-array (hex->bytes source)))
-
-
-  InputStream
-
-  (decode
-    [source]
-    (throw (UnsupportedOperationException. "NYI")))
-
-
-  PushbackInputStream
-
-  (decode
-    [source]
-    (throw (UnsupportedOperationException. "NYI"))))
+    (decode-array (hex->bytes source))))


Focus on project tree

Focus on project tree

--- src/nightcode/core.clj
+++ src/nightcode/core.clj
@@ -1,8 +1,10 @@
 (ns nightcode.core
   (:use [seesaw.core :only [invoke-later
                             frame
+                            select
                             native!
                             show!
+                            request-focus!
                             horizontal-panel
                             vertical-panel
                             left-right-split
@@ -26,7 +28,8 @@

 (defn get-project-pane
   []
-  (let [project-tree (tree :id :project-tree)]
+  (let [project-tree (tree :id :project-tree
+                           :focusable? true)]
     (doto project-tree
           (.setRootVisible false)
           (.setShowsRootHandles true)
@@ -111,9 +114,10 @@
   (org.pushingpixels.substance.api.SubstanceLookAndFeel/setSkin
     (org.pushingpixels.substance.api.skin.GraphiteSkin.))
   (invoke-later
-    (-> (frame :title "Nightcode"
-               :content (get-window-content)
-               :width 1024
-               :height 768
-               :on-close :exit)
-        show!)))
+    (let [root (-> (frame :title "Nightcode"
+                          :content (get-window-content)
+                          :width 1024
+                          :height 768
+                          :on-close :exit)
+                   show!)]
+      (request-focus! (select root [:#project-tree])))))


weekly sums

weekly sums

--- src/ontrail/weekly.clj
+++ src/ontrail/weekly.clj
@@ -52,11 +52,30 @@
     (mq/find {:user user :creationDate {:$gte start :$lte end}})
     (mq/sort {:lastModifiedDate 1})))

+(defn accumulate [totals result]
+  (let [get-entry #(if (contains? %1 %2) (%1 %2) 0)
+        acc #(+ (get-entry totals %1) (get-entry result %2))
+        kw-all-distance (keyword "distance_Kaikki")
+        kw-all-duration (keyword "duration_kaikki")
+        kw-sport-distance (keyword (str "distance_" (:sport result)))
+        kw-sport-duration (keyword (str "duration_" (:sport result)))]
+    (assoc totals
+      kw-all-duration (acc kw-all-duration :duration)
+      kw-all-distance (acc kw-all-distance :distance)
+      kw-sport-distance (acc kw-sport-distance :distance)
+      kw-sport-duration (acc kw-sport-duration :duration))))
+
+(defn weekly-sums [results]
+  (if (>= (count results) 1)
+    (reduce accumulate (cons {} results))
+    {}))
+
 (defn interval-as-exlist [user week-interval]
     (let [start (.getStart week-interval) end (.getEnd week-interval)
           results (interval-query user start end)]
       {:week (week-number week-interval)
        :from (to-human-date start) :to (to-human-date (time/minus end (time/days 1)))
+       :sums (weekly-sums results)
        :exs (map simple-result results)}))

 (defn weeks-from [date-time]


Whitespace

Whitespace

--- src/oxcart/pattern.clj
+++ src/oxcart/pattern.clj
@@ -64,7 +64,7 @@
   (-> form private? not))

-(defn dynamic?
+(defn dynamic?
   "λ AST → bool

   Indicates whether the AST node passed as the argument is flagged as


Bug in tokens-view with chimeric strings

--- src/paredit/parser.clj
+++ src/paredit/parser.clj
@@ -194,7 +194,11 @@
     (= :ratio t) (token :ratio count)
     (= :anon-arg t) (token :anon-arg count)
     (= :char t) (token :char count)
-    (= :chimera t) (concat (token :nest 0) (balanced :open-chimera :close-chimera abstract-children) (token :unnest 0))
+    (= :chimera t) (cond
+                     (= "\"" ((get abstract-children 0) parse-tree-view))
+                       (token :string count)
+                     :else
+                       (concat (token :nest 0) (balanced :open-chimera :close-chimera abstract-children) (token :unnest 0)))
     (= :comment t) (token :comment count)
     (= :discard t) (token :comment count)
     (= :net.cgrand.parsley/root t) (concat (mapcat identity (view-children-seq tokens-view abstract-children)) (token :eof))


fix doc

fix doc

--- src/pc/models/plan.clj
+++ src/pc/models/plan.clj
@@ -8,9 +8,9 @@
             [pc.utils :as utils]))

 ;; How coupons work on a plan:
-;;  1. plan gets plan/coupon-code on trial start
-;;  2. When the stripe plan is created, plan/coupon-code is removed
-;;     and replaced with a discount (which has a coupon)
+;;  1. plan gets discount/coupon on trial start
+;;  2. When the stripe plan is created, discount is updated with
+;;     start and end dates
 ;;  3. The discount has an end-date, after which it's no longer applied
 ;;  4. Discount mirrors what is up in Stripe


show doc-id in client list

show doc-id in client list

--- src/pc/views/admin.clj
+++ src/pc/views/admin.clj
@@ -206,9 +206,11 @@
           :let [doc-id (get-in stats [:document :db/id])]]
       [:tr
        [:td
-        [:a {:href (urls/doc-svg doc-id)}
-         [:img {:style "width:100;height:100;"
-                :src (urls/doc-svg doc-id)}]]]
+        [:div
+         [:a {:href (urls/doc-svg doc-id)}
+          [:img {:style "width:100;height:100;"
+                 :src (urls/doc-svg doc-id)}]]]
+        [:div doc-id]]
        [:td (h/h (get-in stats [:cust :cust/email]))]
        [:td [:form {:action "/refresh-client-stats" :method "post"}
              (anti-forgery/anti-forgery-field)


Correct bug in example code

Correct bug in example code

--- src/re_frame/cofx.cljc
+++ src/re_frame/cofx.cljc
@@ -79,8 +79,8 @@
 ;;   (reg-event-fx                    ;;  `-fx` variant used in registration
 ;;     :some-id
 ;;     [(coeffect :now) debug]        ;; notice (coeffect :now) is in interceptors
-;;       (fn [coeffect event]         ;; -fx handlers are given the entire coeffect as 1st argument
-;;         (let [dt (:now coeffect)]  ;; `:now` is available
+;;       (fn [coeffects event]        ;; -fx handlers are given the entire coeffect as 1st argument
+;;         (let [dt (:now coeffects)] ;; `:now` is available
 ;;            ...)))
 ;;
 ;; As a further exercise, consider how you would write a `random` interceptor which adds a random
@@ -89,4 +89,4 @@
     :now
     (fn now-coeffects-handler
       [coeffects]
-      (assoc coeffect :now (js/Date.))))
+      (assoc coeffects :now (js/Date.))))


More expeiments with API doc strings

More expeiments with API doc strings

--- src/re_frame/core.cljc
+++ src/re_frame/core.cljc
@@ -24,32 +24,38 @@

 ;; -- dispatch ----------------------------------------------------------------
 (defn dispatch
-  "Enqueue `event` for processing by event handling machinery.
-
-  `event` is a vector of length >= 1. The 1st element identifies the kind of event.
+  "Queue `event` for processing by event handling machinery.
+
+  `event` is a vector with length >= 1. The 1st element identifies the kind of event.

   Note: the event handler is not run immediately - it is not run
   synchronously. It will likely be run 'very soon', although it may be
   added to the end of a FIFO queue which already contain events.

   Usage:
-     (dispatch [:order-pizza {:supreme 2 :meatlovers 1 :veg 1}])"
+
+     (dispatch [:order-pizza {:supreme 2 :meatlovers 1 :veg 1}])
+   "
   [event]
   (router/dispatch event))

 (defn dispatch-sync
-  "Synchronously (immediately) process `event`. Do not queue.
+  "Synchronously (immediately) process `event`. Does not queue the event
+   for handling later as `dispatch` does.

   Generally, don't use this. Instead use `dispatch`. It is an error
   to use `dispatch-sync` within an event handler.

   Useful when any delay in processing is a problem:
+
      1. the `:on-change` handler of a text field where we are expecting fast typing.
-     2  when initialising your app - see 'main' in todomvc examples
+     2  when initialising your app - see 'main' in examples/todomvc/src/core.cljs
      3. in a unit test where we don't want the action 'later'

   Usage:
-     (dispatch-sync [:sing :falsetto 634])"
+
+     (dispatch-sync [:sing :falsetto 634])
+  "
   [event-v]
   (router/dispatch-sync event-v))

@@ -556,20 +562,27 @@
   leading underscore on the event-v!
   Your event handlers will look like this:

-      (defn my-handler
-        [db [x y z]]    ;; <-- instead of [_ x y z]
-        ....)"
+      (reg-event-db
+        :event-id
+        [... trim-v ...]
+        (fn [db [x y z]]    ;; <-- instead of [_ x y z]
+          ...)
+     ```
+    "
   std-interceptors/trim-v)

 (def after
-  "returns an interceptor which runs a given function `f` in the `:after`
+  "An interceptor factory, which is to say, a function which will return an interceptor.
+
+  Returns an interceptor which runs a given function `f` in the `:after`
   position, presumably for side effects.

   `f` is called with two arguments: the `:effects` value for `:db`
-  (or the `coeffect` value of db if no db effect is returned) and the event.
+  (or the `:coeffect` value of `:db` if no `:db` effect is returned) and the event.
   Its return value is ignored, so `f` can only side-effect.

-  Examples use can be seen in the /examples/todomvc:
+  An examples of use can be seen in /examples/todomvc/events.cljs:
+
      - `f` runs schema validation (reporting any errors found).
      - `f` writes to localstorage."
   std-interceptors/after)
@@ -577,26 +590,29 @@
 (def on-changes
   "An interceptor factory, which is to say, a function which will return an interceptor.

-   The returned interceptor will observe N paths within `db`, and if any of them
+   Returns an interceptor which will observe N paths within `db`, and if any of them
    test not identical? to their previous value  (as a result of a event handler
    being run), then it runs `f` to compute a new value, which is then assoc-ed
    into the given `out-path` within `db`.

    Example Usage:

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

       (reg-event-db
         :event-id
-        [(on-changes my-f [:c]  [:a] [:b]) ... other interceptors]  <-- used here
+        [... my-interceptor ...]  ;; <-- ultimately used here
         (fn [db v]
            ...))
-    ```
-
-    Put this Interceptor on the right handlers (ones which might change :a or :b)
+```
+
+    Put this Interceptor on handlers which might change paths :a or :b
     and it will:

      - call `f` each time the value at path [:a] or [:b] changes
@@ -636,11 +652,11 @@
    Accepts three optional, named arguments:

      - `:id` - an id for the interceptor (decorative only)
-     - `:before` - the before function
-     - `:after`  - the after function
+     - `:before` - the interceptor's before function
+     - `:after`  - the interceptor's after function

    Example use:
-   ```clj
+
    (def my-interceptor
      (->interceptor
        :id     :my-interceptor
@@ -650,13 +666,13 @@
        :after  (fn [context]                         ;; you normally want to change :effects
                  (let [db (get-effect context :db)]  ;; (get-in context [:effects :db])
                    (assoc-effect context :http-ajax {...}])))))
-   ```
+
    "
   [& {:as m :keys [id before after]}]
   (utils/apply-kw interceptor/->interceptor m))

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

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

@@ -671,7 +687,7 @@
    (interceptor/get-coeffect context key not-found)))

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

    Adds or updates a key/value pair in the `:coeffects` map within `context`. "
   [context key value]
@@ -693,14 +709,14 @@
    (interceptor/get-effect context key not-found)))

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

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

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

   Adds a collection of `interceptors` to the end of `context's` execution `:queue`, and then
   returns the updated `context`."
@@ -714,9 +730,9 @@
   "Internally, re-frame uses the logging functions: `warn`, `log`, `error`, `group` and `groupEnd`

    By default, these functions map directly to the default `js/console` implementations,
-   but you can override with your own fns (set or subset).
-
-   `new-loggers` should be a map with the same keys as `loggers`
+   but you can override with your own fns (set or subset) if you wish to handle the logging yourself.
+
+   `new-loggers` should be a map with the same keys as standard `loggers`

    Example Usage:
    ```clj
@@ -729,19 +745,19 @@

 (defn console
-  "A utility function designed to be used by libraries which are extending re-frame, like
-   perhaps an effect handler, which want to produce output via re-frame's loggers.
-
-   It will write `args` to the js/console at `level`.
+  "A utility function for use in libraries which extend re-frame, like
+   perhaps an effect handler, when they want to produce log output.
+
+   It will write the given `args` to js/console at the given `level`.

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

    Example usage:

-   ```clj
+
      (console :error \"Oh, dear God, it happened:\" a-var \"and\" another)
      (console :warn \"Possible breach of containment wall at:\" dt)
-   ```
+
    "
   [level & args]
   (apply loggers/console (into [level] args)))


update docs to use :fx over :dispatch

update docs to use :fx over :dispatch

--- src/re_frame/core.cljc
+++ src/re_frame/core.cljc
@@ -131,7 +131,7 @@
         [one two three]          ;; <-- a seq of interceptors
         (fn [{:keys [db] :as cofx} [_ arg1 arg2]] ;; destructure both arguments
           {:db       (assoc db :some-key arg1)          ;; return a map of effects
-           :dispatch [:some-event arg2]}))
+           :fx [[:dispatch [:some-event arg2]]]}))
   "
   {:api-docs/heading "Event Handlers"}
   ([id handler]


add lwwr to js bindings

add lwwr to js bindings

--- src/replikativ/js.cljs
+++ src/replikativ/js.cljs
@@ -2,16 +2,19 @@
   "Experimental JavaScript API."
   (:require [replikativ.peer :as peer]
             [replikativ.stage :as stage]
+            [replikativ.crdt.lwwr.stage :as lwwr-stage]
             [replikativ.crdt.ormap.stage :as ormap-stage]
             [goog.net.WebSocket]
             [goog.Uri]
             [goog.events]
             [replikativ.crdt.ormap.realize :as ormap-realize]
+            [replikativ.crdt.lwwr.realize :as lwwr-realize]
             [konserve.memory :as mem]
             [kabel.client :refer [client-connect!]]
             [cljs.core.async :refer [chan take! <! >!]]
             [superv.async :refer [S]]
             [taoensso.timbre :as timbre]
+            [replikativ.crdt.lwwr.core :as lwwr]
             [replikativ.crdt.ormap.core :as ormap])
   (:require-macros [superv.async :refer [go-loop-try go-try]]))

@@ -54,6 +57,14 @@
   (let [opts (js->clj opts)]
     (promise (ormap-stage/create-ormap! stage :id (get opts "id") :description (get opts "description")))))

+
+(defn ^:export createLWWR [stage opts]
+  (let [opts (js->clj opts)]
+    (promise (lwwr-stage/create-lwwr! stage :id (get opts "id") :description (get opts "description")))))
+
+(defn ^:export setRegister [stage user crdt-id register]
+  (promise (lwwr-stage/set-register! stage [user crdt-id] register)))
+
 (defn ^:export associate
   [stage user crdt-id tx-key txs]
   (let [txs (js->clj txs)]
@@ -77,9 +88,11 @@
          (reduce (fn [m [k v]] (assoc m k v)) {}))))

-(defn ^:export streamIntoIdentity [stage user crdt-id stream-eval-fns target]
+(defn ^:export streamORMapIdentity [stage user crdt-id stream-eval-fns target]
   (ormap-realize/stream-into-identity! stage [user crdt-id] (eval-fns->js stream-eval-fns) target))

+(defn ^:export streamLWWRIdentity [stage user crdt-id target]
+  (lwwr-realize/stream-into-atom! stage [user crdt-id] target))

 (defn ^:export createUUID [s]
   (cljs.core/uuid s))
@@ -96,8 +109,11 @@
                                  :onNode        on-node?
                                  :createStage   createStage
                                  :newMemStore   newMemStore
+                                 :LWWR #js {:createLWWR createLWWR
+                                            :streamIntoIdentity streamLWWRIntoIdentity
+                                            :setRegister setRegister}
                                  :ORMap         #js {:createORMap        createORMap
-                                                     :streamIntoIdentity streamIntoIdentity
+                                                     :streamIntoIdentity streamORMapIntoIdentity
                                                      :associate          associate}
                                  :clientConnect client-connect!
                                  :createUUID    cljs.core/uuid


Add another exercise.

Add another exercise.

--- src/sem_logic/core.clj
+++ src/sem_logic/core.clj
@@ -68,7 +68,8 @@
   (run* [a t]
         (time t)
         (U a)
-        (everyg (fn [x] (implies #(Pr x t) #(Pr 'p t)))
+        (everyg (fn [x] (implies #(Pr x t)
+                                #(Pr 'p t)))
                 a)))

@@ -77,5 +78,18 @@
   (run* [a t]
         (time t)
         (U a)
-        (everyg (fn [x] (implies #(P Sl x t) #(H Sl x t)))
+        (everyg (fn [x] (implies #(P Sl x t)
+                                #(H Sl x t)))
                 a)))
+
+;; FPS(h*)
+(with-db (db [T [1 2 3]]
+             [U ['h]]
+
+             [Sl 'h 2])
+  (run* [x t]
+        (time t)
+        (fresh [dom]
+               (U dom)
+               (membero x dom))
+        (F (partial P Sl) x t)))


persist to and restore from AsyncStorage

--- mobile/src/cljs/i_was_where_app/ios/store.cljs
+++ mobile/src/cljs/i_was_where_app/ios/store.cljs
@@ -19,13 +19,29 @@
                       :vclock     new-vclock})
         new-state (-> current-state
                       (assoc-in [:entries timestamp] entry)
-                      (assoc-in [:latest-vclock] new-vclock))]
+                      (assoc-in [:latest-vclock] new-vclock))
+        prev (dissoc (get-in current-state [:entries timestamp])
+                     :id :last-saved :vclock)]
+    (when-not (= prev (dissoc msg-payload :id :last-saved :vclock))
+      (go (<! (as/set-item timestamp entry)))
+      (go (<! (as/set-item :latest-vclock last-vclock)))
+      (go (<! (as/set-item :timestamps (set (keys (:entries new-state))))))
+      {:new-state new-state})))
+
+(defn state-fn [put-fn]
+  (let [state (atom {})
+        device-id (.getUniqueID device-info)]
     (go
-      (<! (as/set-item timestamp entry))
-      (println :persisted (<! (as/get-item timestamp))))
-    {:new-state new-state}))
+      (let [latest-vclock (second (<! (as/get-item :latest-vclock)))]
+        (swap! state assoc-in [:latest-vclock] latest-vclock)))
+    (go
+      (let [timestamps (second (<! (as/get-item :timestamps)))]
+        (doseq [ts timestamps]
+          (swap! state assoc-in [:entries ts] (second (<! (as/get-item ts)))))))
+    {:state state}))

 (defn cmp-map [cmp-id]
   {:cmp-id      cmp-id
+   :state-fn    state-fn
    :handler-map {:entry/update persist
                  :entry/new    persist}})


Further simplification of project.clj dependency setup.

--- jvm/project.clj
+++ jvm/project.clj
@@ -12,13 +12,9 @@
   :min-lein-version "2.0.0"
   :dependencies [
                  [org.clojure/clojure  "1.5.1"]
+                 [org.clojure/data.json "0.2.6"]
+                 [org.apache.storm/storm-core "0.9.4"]
                  ]
-  :profiles {:dev
-              {:dependencies [
-                              [org.apache.storm/storm-core "0.9.4"]
-                              [org.clojure/data.json "0.2.6"]
-                              ]
-               }}
   :source-paths ["src"]
   :test-paths ["test"]
   :resource-paths ["resources"]


core: set?

core: set?

--- data/core.clj
+++ data/core.clj
@@ -1866,3 +1866,8 @@
   {:added "1.0"}
   [s]
   (load-string* s))
+
+(defn set?
+  "Returns true if x implements Set"
+  {:added "1.0"}
+  [x] (instance? Set x))


Add missing mount/stop call on fixtures entry point fn.

--- src/uxbox/fixtures.clj
+++ src/uxbox/fixtures.clj
@@ -65,4 +65,5 @@
       (doseq [pi (range 10)]
         (doseq [ui (range 10)]
           (doseq [i (range 10)]
-            (create-page conn (str pi ui i) (str ui i) ui)))))))
+            (create-page conn (str pi ui i) (str ui i) ui))))))
+  (mount/stop))


add species filter

add species filter

--- src/wb_es/web/core.clj
+++ src/wb_es/web/core.clj
@@ -7,6 +7,8 @@
   (->> []
        (cons (when-let [type-value (:type options)]
                {:type {:value (clojure.string/replace type-value #"_" "-")}}))
+       (cons (when-let [species-value (:species options)]
+               {:term {:species species-value}}))
        (filter identity)))


Fix to ResourceDoesNotExistAsync example

--- src/yada/protocols.clj
+++ src/yada/protocols.clj
@@ -32,7 +32,7 @@
   (allowed-method? [f method] (allowed-method? (f method) method))
   (resource [f opts] (let [res (f opts)]
                        (if (d/deferrable? res)
-                         (d/chain (resource res opts))
+                         (d/chain (resource @res opts))
                          (resource res opts))))

   (entity [f resource] (f resource))


CMR-988: Addressed review comments

CMR-988: Addressed review comments

--- ingest-app/src/cmr/ingest/services/temporal_validation.clj
+++ ingest-app/src/cmr/ingest/services/temporal_validation.clj
@@ -26,9 +26,10 @@
         params {"temporal[]" temporal-param
                 :collection-concept-id concept-id
                 "options[temporal][exclude_boundary]" true}
-        error-strs (if before? ["earlier" "start"] ["later" "end"])
-        error-msg (apply format (str "Found granules %s than collection %s date [%s].")
-                         (conj error-strs date-time))]
+        error-msg (format (str "Found granules %s than collection %s date [%s].")
+                          (if before? "earlier" "later")
+                          (if before? "start" "end")
+                          date-time)]
     {:params params
      :error-msg error-msg}))


padding for wizard navigation

padding for wizard navigation

--- priv/ui/src/cljs/holiday_ping_ui/channels/views.cljs
+++ priv/ui/src/cljs/holiday_ping_ui/channels/views.cljs
@@ -163,6 +163,7 @@
         on-prev      (get prev :event prev)
         on-next      (get next :event next)]
     [:div
+     [:br]
      [:nav.level
       [:div.level-left
        (when show-prev?


Handles exceptions during snapshotting

Handles exceptions during snapshotting

--- collectors/snapshot/src/snapshot_collector/core.clj
+++ collectors/snapshot/src/snapshot_collector/core.clj
@@ -7,6 +7,7 @@
             [clj-jgit.querying :as git-query]
             [clojure.java.shell :as shell]
             [cheshire.core :refer :all]
+            [slingshot.slingshot :refer :all]
             [kuona-core.metric.store :as store]
             [kuona-core.git :refer :all]
             [kuona-core.util :refer :all]
@@ -39,15 +40,15 @@

 (defn get-repositories
   [url]
-  (-> (parse-json-body (http/get url)) :hits :hits))
+  (parse-json-body (http/get url)))

 (defn repository-id
   [r]
-  (:_id r))
+  (:id r))

 (defn repository-git-url
   [r]
-  (-> r :_source :url))
+  (-> r :url))

 (defn project-metrics
   [project]
@@ -97,24 +98,35 @@

 (defn snapshot-repository
   [repo]
-  (let [id        (repository-id repo)
-        url       (repository-git-url repo)
-        local-dir (canonical-path (string/join "/" ["/Volumes/data-drive/workspace" id]))
-        name      (-> repo :_source :project :name)]
-    (log/info "snapshotting " id name "from " url "to " local-dir)
-    (if (directory? local-dir) (git-pull url local-dir) (git-clone url local-dir))
-    (let [loc-data      (cloc/loc-collector (fn [a] a) local-dir "foo")
-          snapshot-data (create-snapshot (-> repo :_source :project) (loc-metrics loc-data))]
-      (log/info "snapshot " (put-snapshot snapshot-data id)))))
+  (try+
+   (let [id        (repository-id repo)
+         url       (repository-git-url repo)
+         local-dir (canonical-path (string/join "/" ["/Volumes/data-drive/workspace" id]))
+         name      (-> repo :project :name)]
+     (log/info "Snapshotting " id name "from " url "to " local-dir)
+     (if (directory? local-dir) (git-pull url local-dir) (git-clone url local-dir))
+     (let [loc-data      (cloc/loc-collector (fn [a] a) local-dir "foo")
+           snapshot-data (create-snapshot (-> repo :project) (loc-metrics loc-data))]
+       (log/info "snapshot " (put-snapshot snapshot-data id))))
+   (catch Object _
+     (log/error (:throwable &throw-context) "Unexpected error"))))
+
+
+
+(defn all-repositories
+  ([uri] (all-repositories uri 1))
+  ([uri page]
+   (let [result (get-repositories (str "http://dashboard.kuona.io/api/repositories?page=" page))
+         count  (-> result :count)
+         items  (-> result :items)]
+    (if (= count 0) items (concat items (all-repositories uri (inc page)))))))
+

 (defn -main
   [& args]
   (log/info "Kuona Snapshot Collector")

   (let [options          (parse-opts args cli-options)
-        ;config-file      (:config (:options options))
-        ;config           (load-config (file-reader config-file))
-        repositories     (get-repositories "http://dashboard.kuona.io/api/repositories")
-        urls             (map #(-> % :url) repositories)]
+        repositories     (all-repositories "http://dashboard.kuona.io/api/repositories")]
     (log/info "Found " (count repositories) " configured repositories for analysis")
     (doall (map snapshot-repository repositories))))


maven hybrid fix

maven hybrid fix

--- maven/hybrid/src/main/clojure/org/example/request_impl.clj
+++ maven/hybrid/src/main/clojure/org/example/request_impl.clj
@@ -1,7 +1,9 @@
 (ns org.example.request-impl
   (:use compojure.core
+        [migae.memcache :as mc]
         [ring.middleware.params :only [wrap-params]]
         [ring.middleware.file-info :only [wrap-file-info]])
+  (:refer-clojure :exclude [contains? get])
   (:require [compojure.route :as route]))

 (defroutes request-routes


[#9661] Fix overlapping on puk code screen

--- src/status_im/ui/screens/hardwallet/pin/styles.cljs
+++ src/status_im/ui/screens/hardwallet/pin/styles.cljs
@@ -7,8 +7,8 @@
    :flex-direction  :column
    :justify-content :space-between})

-(styles/defn error-container [small-screen?]
-  {:height        (if small-screen? 18 22)
+(defn error-container [small-screen?]
+  {:height        (when small-screen? 18)
    :margin-top    (if small-screen? 14 10)
    :margin-bottom (if small-screen? 10 0)})

@@ -82,4 +82,4 @@

 (def numpad-button-text
   {:font-size 22
-   :color     colors/blue})+   :color     colors/blue})


Fix prn, apply, let swap! behave like in Cljs.

--- lib/shin/cljs/cljs/core.cljs
+++ lib/shin/cljs/cljs/core.cljs
@@ -900,11 +900,24 @@
     :else
     (str x)))

-(defn prn [& args]
+(defn prn []
   (.apply (.-log console) console arguments))

-(defn apply [f args]
-  (.apply f nil (if args (into-array args) [$])))
+(defn apply
+  ([f args]
+   (.apply f f (into-array args)))
+  ([f x args]
+   (let [arglist (list* x args)]
+     (.apply f f (to-array arglist))))
+  ([f x y args]
+   (let [arglist (list* x y args)]
+     (.apply f f (to-array arglist))))
+  ([f x y z args]
+   (let [arglist (list* x y z args)]
+     (.apply f f (to-array arglist))))
+  ([f a b c d & args]
+   (let [arglist (cons a (cons b (cons c (cons d (spread args)))))]
+     (.apply f f (to-array arglist)))))

 (def lookup-sentinel {$})
 (defn contains? [coll v]
@@ -1110,8 +1123,27 @@
         new-value))
     (-reset! a new-value)))

-(defn swap! [atom f & args]
-  (reset! atom (apply f (cons @atom args))))
+(defn swap!
+  "Atomically swaps the value of atom to be:
+  (apply f current-value-of-atom args). Note that f may be called
+  multiple times, and thus should be free of side effects.  Returns
+  the value that was swapped in."
+  ([a f]
+     (if (instance? Atom a)
+       (reset! a (f (.-state a)))
+       (-swap! a f)))
+  ([a f x]
+     (if (instance? Atom a)
+       (reset! a (f (.-state a) x))
+       (-swap! a f x)))
+  ([a f x y]
+     (if (instance? Atom a)
+       (reset! a (f (.-state a) x y))
+       (-swap! a f x y)))
+  ([a f x y & more]
+     (if (instance? Atom a)
+       (reset! a (apply f (.-state a) x y more))
+       (-swap! a f x y more))))

 (defn add-watch [atom key f]
   (-add-watch atom key f))


Numbers: Don't import clojure.lang.BigInt and clojure.lang.Ratio.

--- test/clojure_the_language/clojure_numerics_test.clj
+++ test/clojure_the_language/clojure_numerics_test.clj
@@ -1,8 +1,5 @@
 (ns clojure-the-language.clojure-numerics-test
-  (:require [midje.sweet :refer :all])
-  (:import clojure.lang.BigInt ;; **** I'm surprised this is needed.
-           clojure.lang.Ratio) ;; **** I'm surprised this is needed.
-  )
+  (:require [midje.sweet :refer :all]))

 ;;;; ___________________________________________________________________________
 ;;;; ---- Numeric types ----
@@ -10,11 +7,20 @@
 ;;; Clojure's numeric types (some of which are Java types)

 (fact (type 2)    => Long)
-(fact (type 2N)   => BigInt)
-(fact (type 2/3)  => Ratio)
+(fact (type 2)    => java.lang.Long)
+
+;; **** I'm surprised clojure.lang.xxxx is needed for BigInt and Ratio.
+
+(fact (type 2N)   => clojure.lang.BigInt)
+
+(fact (type 2/3)  => clojure.lang.Ratio)
+
+(fact (type 2.0M) => BigDecimal)
+(fact (type 2.0M) => java.math.BigDecimal)
 (fact (type 2M)   => BigDecimal)
-(fact (type 2.0M) => BigDecimal)
+
 (fact (type 2.0)  => Double)
+(fact (type 2.0)  => java.lang.Double)

 (fact (type 4/2)  => Long)

@@ -27,7 +33,6 @@

 (fact (type (java.math.BigInteger. "2")) => java.math.BigInteger)

-;;; **** What do you want to do with this?
 ;;; From /Clojure Programming/, p427: "double is the only representation that
 ;;; is inherently inexact".

@@ -189,10 +194,10 @@

 ;;;; ___________________________________________________________________________

-(fact (type (- 2N 1N)) => BigInt)
-
-(fact (type (/ 4N 2N)) => BigInt)
-(fact (type (/ 2N 4N)) => Ratio)
+(fact (type (- 2N 1N)) => clojure.lang.BigInt)
+
+(fact (type (/ 4N 2N)) => clojure.lang.BigInt)
+(fact (type (/ 2N 4N)) => clojure.lang.Ratio)

 ;;;; ___________________________________________________________________________
@@ -226,7 +231,7 @@
     (=-and-same-type (inc' 1) 2) => true)
   (fact "...do not demote"
     (type (dec' (inc' Long/MAX_VALUE)))
-    => BigInt))
+    => clojure.lang.BigInt))

 (def boxed-max-long Long/MAX_VALUE)


Add fact "Collections use `=` to determine equality".


Better descriptions of promotion.

Better descriptions of promotion.

--- test/clojure_the_language/clojure_numerics_test.clj
+++ test/clojure_the_language/clojure_numerics_test.clj
@@ -242,21 +242,6 @@
 (fact (== 2 2N 2M 2.0M 2.0) => true) ; true even for inexact things

 ;;;; ___________________________________________________________________________
-;;;; ---- `==-and-same-type` ----
-
-;;; A helper function.
-
-(defn ==-and-same-type
-  "Returns true iff x and y are of the same type and (== x y) is true."
-  [x y]
-  (and (= (type x) (type y))
-       (== x y)))
-
-(fact (==-and-same-type 2 2)   => true)
-(fact (==-and-same-type 2 2N)  => false)
-(fact (==-and-same-type 2N 2N) => true)
-
-;;;; ___________________________________________________________________________
 ;;;; ---- Going from Longs to bigger or smaller ----

 (def max-long-plus-1 9223372036854775808N)
@@ -270,8 +255,8 @@
 (fact "The xxxx' operators"
   (fact "Auto-promote"
     (inc' Long/MAX_VALUE) => max-long-plus-1)
-  (fact "Only change the type if necessary"
-    (==-and-same-type (inc' 1) 2) => true)
+  (fact "Do not promote if unnecessary"
+    (type (inc' 1)) => Long)
   (fact "Do not demote"
     (type (dec' (inc' Long/MAX_VALUE)))
     => clojure.lang.BigInt))


Added test for reading multi-parent commits

--- test/clj_git/object_test.clj
+++ test/clj_git/object_test.clj
@@ -22,7 +22,17 @@
       :author "j <jamie.williams89@gmail.com> 1453647595 +0000",
       :committer "j <jamie.williams89@gmail.com> 1453647595 +0000"}
     )))
-  ; TOOD: Add a test for multiple parents!
+  (testing "Commit will multiple parents"
+    (is (= (commit "1d8678f71731f37086ad2c91d11b0bd092e8b5a9")
+          {:message
+          "Merge branch 'parent' to create a multi-parent commit (for use in testing)",
+          :parents  [ "96c9883dcb0c0acbed226cb4b43ac6ce4eefb683"
+                      "db96d077657a33f4b637d0e89cd68cdbdb1cdfd4" ]
+          :tree "d250a204642f650a4a3858f3b817b0390c07719f",
+          :author "James Williams <j@Jamess-MacBook-2.local> 1476027126 +0100",
+          :committer
+          "James Williams <j@Jamess-MacBook-2.local> 1476027126 +0100"}))
+  )
 )

 (deftest t-write-blob


Fix tautological test (from typo)

Fix tautological test (from typo)

--- test/compojure/core_test.clj
+++ test/compojure/core_test.clj
@@ -44,7 +44,7 @@

   (testing "map arguments"
     ((GET "/foo" {params :params}
-       (is (= (params {:x "a", :y "b"})))
+       (is (= params {:x "a", :y "b"}))
        nil)
      (-> (mock/request :get "/foo")
          (assoc :params {:x "a", :y "b"}))))


Test for 'subs' etc.

Test for 'subs' etc.

--- test/hurvinek/utils_test.clj
+++ test/hurvinek/utils_test.clj
@@ -127,8 +127,8 @@
                 (is (nil? (get-exception-message e)))))))

 (deftest test-third-1
-    "Check the function zg.utils/third."
-    (testing "the function zg.utils/third."
+    "Check the function hurvinek.utils/third."
+    (testing "the function hurvinek.utils/third."
         (are [x y] (= x y)
             3 (third [1 2 3])
             3 (third [1 2 3 4 5])
@@ -136,15 +136,52 @@
             3 (third '(1 2 3 4 5)))))

 (deftest test-third-2
-    "Check the function zg.utils/third."
-    (testing "the function zg.utils/third."
+    "Check the function hurvinek.utils/third."
+    (testing "the function hurvinek.utils/third."
         (are [x y] (= x y)
             nil (third [1 2])
             nil (third '(1 2)))))

 (deftest test-third-not-NPE
-    "Check the function zg.utils/third."
-    (testing "the function zg.utils/third."
+    "Check the function hurvinek.utils/third."
+    (testing "the function hurvinek.utils/third."
         (are [x y] (= x y)
             nil (third nil))))

+(deftest test-substring-1
+    "Check the function hurvinek.utils/substring."
+    (testing "the function hurvinek.utils/substring."
+        (are [x y] (= x y)
+            "H"      (substring "Hello world!" 0 1)
+            "He"     (substring "Hello world!" 0 2)
+            "Hello"  (substring "Hello world!" 0 5)
+            "Hello " (substring "Hello world!" 0 6))))
+
+(deftest test-substring-2
+    "Check the function hurvinek.utils/substring."
+    (testing "the function hurvinek.utils/substring."
+        (are [x y] (= x y)
+            "w"      (substring "Hello world!" 6 7)
+            "wo"     (substring "Hello world!" 6 8)
+            "world"  (substring "Hello world!" 6 11)
+            "world!" (substring "Hello world!" 6 12))))
+
+(deftest test-substring-3
+    "Check the function hurvinek.utils/substring."
+    (testing "the function hurvinek.utils/substring."
+        (are [x y] (= x y)
+            "Hello world!" (substring "Hello world!" 0)
+            "ello world!"  (substring "Hello world!" 1)
+            "world!"       (substring "Hello world!" 6)
+            "!"            (substring "Hello world!" 11)
+            ""             (substring "Hello world!" 12))))
+
+(deftest test-substring-empty-result
+    "Check the function hurvinek.utils/substring."
+    (testing "the function hurvinek.utils/substring."
+        (are [x y] (= x y)
+            "" (substring "Hello world!" 0 0)
+            "" (substring "Hello world!" 1 1)
+            "" (substring "Hello world!" 2 2)
+            "" (substring "Hello world!" 10 10))))
+


merging add ex to master

merging add ex to master

--- test/ontrail/test/mutate.clj
+++ test/ontrail/test/mutate.clj
@@ -19,9 +19,9 @@
 (deftest basic-exercise-is-valid
   (is (valid? basic-exercise)))

-;(deftest test-parse-distance
-;  (let [hour (* 60 60 100)]
-;    (is (= hour (parse-distance "1h")))))
+(deftest test-parse-distance
+  (let [hour (* 60 60 100)]
+    (is (= hour (parse-distance "1h")))))

 (deftest test-db-insertable-from-basic-user-ex
   (is (= {:title "A title"


unit test to make sure on-close is called

--- test/org/httpkit/ws_test.clj
+++ test/org/httpkit/ws_test.clj
@@ -11,8 +11,16 @@
             [clj-http.util :as u])
   (:import org.httpkit.ws.WebSocketClient))

+(def ws-closed (atom false))
+
+(defn- check-closed []
+  (is @ws-closed)
+  (reset! ws-closed false))
+
 (defn ws-handler [req]
   (when-ws-request req con
+                   (on-close con (fn [status]
+                                   (reset! ws-closed true)))
                    (on-mesg con (fn [msg]
                                   (try
                                     (let [{:keys [length times]} (read-string msg)]
@@ -53,7 +61,8 @@
         (.sendMessage client (pr-str {:length length :times times}))
         (doseq [_ (range 0 times)]
           (is (= length (count (.getMessage client)))))))
-    (.close client))) ;; server's closeFrame response is checked
+    (.close client) ;; server's closeFrame response is checked
+    (check-closed)))

 (deftest test-websocket-fragmented
   (let [client (WebSocketClient. "ws://localhost:4348/ws")]


Fix markdown blocks

Fix markdown blocks

After updating React, there were console warnings about sibling
components with the same key, "devcards-markdown-block", so I nested the
markdown sections under a div element

--- devcards_src/bootstrap_cljs/devcards.cljs
+++ devcards_src/bootstrap_cljs/devcards.cljs
@@ -16,7 +16,8 @@

 ;; Run `lein figwheel` and open the browser to http://localhost:3449/index.html

-(defn mkdn [& mkd-strs] (apply dc/markdown->react mkd-strs))
+(defn mkdn [& mkd-strs] (dom/div
+                          (apply dc/markdown->react mkd-strs)))
 (defn react-card [& content] (dom/div content))

 (def positions ["left" "top" "bottom" "right"])


fix thrift

fix thrift

--- storm-core/project.clj
+++ storm-core/project.clj
@@ -5,7 +5,7 @@
   :dependencies [[org.clojure/clojure "1.4.0"]
                  [commons-io "1.4"]
                  [org.apache.commons/commons-exec "1.1"]
-                 [storm/libthrift7 "0.7.0-1"
+                 [storm/libthrift7 "0.7.0-2"
                   :exclusions [org.slf4j/slf4j-api]]
                  [clj-time "0.4.1"]
                  [com.netflix.curator/curator-framework "1.0.1"


Remove stale comment

Remove stale comment

--- test/expound/paths_test.cljc
+++ test/expound/paths_test.cljc
@@ -30,7 +30,6 @@
    (chuck/times num-tests)
    [form test-utils/any-printable-wo-nan
     i gen/pos-int
-    ;; HERE - figure out how to parse :let as let in hooks
     :let [x (nth-value form i)
           paths (paths/paths-to-value form x [] [])]]
    (is (seq paths))


Three tests for the 'third' function

Three tests for the 'third' function

--- test/hurvinek/utils_test.clj
+++ test/hurvinek/utils_test.clj
@@ -126,3 +126,25 @@
             (catch Exception e
                 (is (nil? (get-exception-message e)))))))

+(deftest test-third-1
+    "Check the function zg.utils/third."
+    (testing "the function zg.utils/third."
+        (are [x y] (= x y)
+            3 (third [1 2 3])
+            3 (third [1 2 3 4 5])
+            3 (third '(1 2 3))
+            3 (third '(1 2 3 4 5)))))
+
+(deftest test-third-2
+    "Check the function zg.utils/third."
+    (testing "the function zg.utils/third."
+        (are [x y] (= x y)
+            nil (third [1 2])
+            nil (third '(1 2)))))
+
+(deftest test-third-not-NPE
+    "Check the function zg.utils/third."
+    (testing "the function zg.utils/third."
+        (are [x y] (= x y)
+            nil (third nil))))
+


Add test for false case also

Add test for false case also

--- test/ontrail/test/crypto.clj
+++ test/ontrail/test/crypto.clj
@@ -8,6 +8,9 @@
 (deftest match-properly
   (is (password-match? "keijo" (com.lambdaworks.crypto.SCryptUtil/scrypt "keijo" 16384 8 1))))

+(deftest not-match-invalid-pwd
+  (not (password-match? "keijo2" (com.lambdaworks.crypto.SCryptUtil/scrypt "keijo" 16384 8 1))))
+
 (deftest base64-decodes
   (is (= "esko" (byte-array-to-string (base64-decode "ZXNrbw==")))))


typo preventing tests running.

typo preventing tests running.

--- test/overtone/event_test.clj
+++ test/overtone/event_test.clj
@@ -13,7 +13,7 @@
     (Thread/sleep 100)
     (is (= 2 @counter))

-    (remove-handler :b)
+    (remove-event-handler :b)
     (event :test-event)
     (Thread/sleep 100)
     (is (= 3 @counter))
@@ -25,7 +25,7 @@
     (Thread/sleep 100)
     (is (= 7 @counter))

-    (remove-event-handlers :test-event)
+    (remove-event-handler :test-event)
     (event :test-event)
     (Thread/sleep 100)
     (is (= 7 @counter))))


another floor tile

another floor tile


Test CI shadow-cljs caching

Test CI shadow-cljs caching

--- examples/todomvc/src/todomvc/core.cljs
+++ examples/todomvc/src/todomvc/core.cljs
@@ -13,7 +13,6 @@
             [devtools.core :as devtools])
   (:import [goog History]
            [goog.history EventType]))
-

 ;; -- Debugging aids ----------------------------------------------------------
 ;; we love https://github.com/binaryage/cljs-devtools


Style tests

Style tests


Refactor indentation.

Refactor indentation.

--- test/cli4clj/test/cli.clj
+++ test/cli4clj/test/cli.clj
@@ -209,39 +209,33 @@

 (deftest async-cmd-not-finished-test
-  (let [cli-opts {:cmds
-                   {:async-foo
-                     {:fn
-                       (fn []
-                         (println "Starting...")
-                         (let [tmp-out *out*]
-                           (doto
-                             (Thread.
-                               (fn []
-                                 (binding [*out* tmp-out]
-                                   (sleep 500)
-                                   (println "Finished."))))
-                             (.start)))
-                         "Started.")}}}
+  (let [cli-opts {:cmds {:async-foo {:fn (fn []
+                                           (println "Starting...")
+                                           (let [tmp-out *out*]
+                                             (doto
+                                               (Thread.
+                                                 (fn []
+                                                   (binding [*out* tmp-out]
+                                                     (sleep 500)
+                                                     (println "Finished."))))
+                                               (.start)))
+                                           "Started.")}}}
         test-cmd-input ["async-foo"]
         out-string (test-cli-stdout #(start-cli cli-opts) test-cmd-input)]
     (is (= (expected-string ["Starting..." "\"Started.\""]) out-string))))

 (deftest async-cmd-sleep-finished-test
-  (let [cli-opts {:cmds
-                   {:async-foo
-                     {:fn
-                       (fn []
-                         (println "Starting...")
-                         (let [tmp-out *out*]
-                           (doto
-                             (Thread.
-                               (fn []
-                                 (binding [*out* tmp-out]
-                                   (sleep 500)
-                                   (println "Finished."))))
-                             (.start)))
-                         "Started.")}}}
+  (let [cli-opts {:cmds {:async-foo {:fn (fn []
+                                           (println "Starting...")
+                                           (let [tmp-out *out*]
+                                             (doto
+                                               (Thread.
+                                                 (fn []
+                                                   (binding [*out* tmp-out]
+                                                     (sleep 500)
+                                                     (println "Finished."))))
+                                               (.start)))
+                                           "Started.")}}}
         test-cmd-input ["async-foo" "_sleep 1000"]
         out-string (test-cli-stdout #(start-cli cli-opts) test-cmd-input)]
     (is (= (expected-string ["Starting..." "\"Started.\"" "Finished."]) out-string))))


IS/SR #25 Reversed order of conference on conference page and used ending date of conference as sort criteria.

--- src/cljs/conference_rating/conference_list_page/conference_list_page.cljs
+++ src/cljs/conference_rating/conference_list_page/conference_list_page.cljs
@@ -65,7 +65,7 @@
    [:div {:class "container-fluid content-container pad-top"}
     [:div {:class "conference-search form-group"}]
     (add-conference-bar)
-    [:div {:class "row"}(map list-entry/display-conference-list-item (sort-by :from conference-list))]]])
+    [:div {:class "row"}(map list-entry/display-conference-list-item (reverse (sort-by :to conference-list)))]]])

 (defonce displayed-conferences (atom nil))


Commented out failing tests because of stack overflow in make-wineglass

--- test/wireframes/examples.clj
+++ test/wireframes/examples.clj
@@ -151,6 +151,7 @@
                      (t/rotate :y (t/degrees->radians -30))
                      (t/translate 0 0 16))})

+(comment ; see issue #8
       (harness {
         :filename "wineglass.png"
         :fill-color 0xEAF5FC
@@ -163,6 +164,7 @@
                      (t/rotate :x (t/degrees->radians 20))
                      (t/scale 1.75)
                      (t/translate 0 0 10))})
+)

       (harness {
         :filename "teapot.png"
@@ -265,6 +267,7 @@
                  (t/translate 0 0 10))}))

 (deftest ^:examples svg
+  (comment ; see issue #8
   (spit "wineglass.svg"
     (svg/->svg
       (partial svg/draw-solid  {
@@ -279,6 +282,7 @@
                    (t/scale 1.75)
                    (t/translate 0 0 10))})
      [800 600]))
+  )

   (spit "sinc3D.svg"
     (svg/->svg


IO editor: filter payload based on WDL IO, not existing config's IO [GAWB-2775] (#1032)

--- src/cljs/main/broadfcui/common/method/config_io.cljs
+++ src/cljs/main/broadfcui/common/method/config_io.cljs
@@ -30,8 +30,8 @@
    :save
    (fn [{:keys [props state locals]}]
      (swap! state dissoc :editing?)
-     {:inputs (select-keys (:inputs @locals) (-> props :values :inputs keys))
-      :outputs (select-keys (:outputs @locals) (-> props :values :outputs keys))})
+     {:inputs (select-keys (:inputs @locals) (map (comp keyword :name) (:inputs (:inputs-outputs props))))
+      :outputs (select-keys (:outputs @locals) (map (comp keyword :name) (:outputs (:inputs-outputs props))))})
    :component-will-mount
    (fn [{:keys [props locals]}]
      (swap! locals utils/deep-merge (:values props)))


Re-implement core to gain performance and simplify code #44

--- flatguicore/test/flatgui/core_test.clj
+++ flatguicore/test/flatgui/core_test.clj
@@ -53,10 +53,10 @@
                                                 :d evolver-c2-d}}}})
         results (atom {})
         result-collector (proxy [IResultCollector] []
-                           (appendResult [_parentComponentUid, path, _componentUid, property, newValue]
-                             (swap! results (fn [r]
-                                              (if (not (or (= :children property) (= :evolvers property)))
-                                                (assoc r [path property] newValue)
+                           (appendResult [_parentComponentUid, path, node, newValue]
+                             (swap! results (fn [r]
+                                              (if (not (or (= :children (.getPropertyId node)) (= :evolvers (.getPropertyId node))))
+                                                (assoc r [path (.getPropertyId node)] newValue)
                                                 r)))
                              )
                            (componentAdded [_componentUid])
@@ -90,10 +90,10 @@
                                      :evolvers {:z-position z-position-evolver}}}})
         results (atom {})
         result-collector (proxy [IResultCollector] []
-                           (appendResult [_parentComponentUid, path, _componentUid, property, newValue]
-                             (swap! results (fn [r]
-                                              (if (not (or (= :children property) (= :evolvers property)))
-                                                (assoc r [path property] newValue)
+                           (appendResult [_parentComponentUid, path, node, newValue]
+                             (swap! results (fn [r]
+                                              (if (not (or (= :children (.getPropertyId node)) (= :evolvers (.getPropertyId node))))
+                                                (assoc r [path (.getPropertyId node)] newValue)
                                                 r)))
                              )
                            (componentAdded [_componentUid])
@@ -121,10 +121,10 @@
                                      :evolvers {:b evolver-c2-b}}}})
         results (atom {})
         result-collector (proxy [IResultCollector] []
-                           (appendResult [_parentComponentUid, _path, _componentUid, property, newValue]
-                             (swap! results (fn [r]
-                                              (if (not (or (= :children property) (= :evolvers property)))
-                                                (assoc r property newValue)
+                           (appendResult [_parentComponentUid, _path, node, newValue]
+                             (swap! results (fn [r]
+                                              (if (not (or (= :children (.getPropertyId node)) (= :evolvers (.getPropertyId node))))
+                                                (assoc r (.getPropertyId node) newValue)
                                                 r)))
                              )
                            (componentAdded [_componentUid])
@@ -166,10 +166,10 @@
                                      :evolvers {:a evolver-a}}}})
         results (atom {})
         result-collector (proxy [IResultCollector] []
-                           (appendResult [_parentComponentUid, path, _componentUid, property, newValue]
-                             (swap! results (fn [r]
-                                              (if (not (or (= :children property) (= :evolvers property)))
-                                                (assoc r [path property] newValue)
+                           (appendResult [_parentComponentUid, path, node, newValue]
+                             (swap! results (fn [r]
+                                              (if (not (or (= :children (.getPropertyId node)) (= :evolvers (.getPropertyId node))))
+                                                (assoc r [path (.getPropertyId node)] newValue)
                                                 r)))
                              )
                            (componentAdded [_componentUid])
@@ -216,10 +216,10 @@
                                      :c2 200}}})
         results (atom {})
         result-collector (proxy [IResultCollector] []
-                           (appendResult [_parentComponentUid, _path, _componentUid, property, newValue]
-                             (swap! results (fn [r]
-                                              (if (not (or (= :children property) (= :evolvers property)))
-                                                (assoc r property newValue)
+                           (appendResult [_parentComponentUid, _path, node, newValue]
+                             (swap! results (fn [r]
+                                              (if (not (or (= :children (.getPropertyId node)) (= :evolvers (.getPropertyId node))))
+                                                (assoc r (.getPropertyId node) newValue)
                                                 r)))
                              )
                            (componentAdded [_componentUid])
@@ -242,10 +242,10 @@
                      :evolvers {:a a-evolver}})
         results (atom {})
         result-collector (proxy [IResultCollector] []
-                           (appendResult [_parentComponentUid, path, _componentUid, property, newValue]
-                             (swap! results (fn [r]
-                                              (if (not (or (= :children property) (= :evolvers property)))
-                                                (assoc r [path property] newValue)
+                           (appendResult [_parentComponentUid, path, node, newValue]
+                             (swap! results (fn [r]
+                                              (if (not (or (= :children (.getPropertyId node)) (= :evolvers (.getPropertyId node))))
+                                                (assoc r [path (.getPropertyId node)] newValue)
                                                 r)))
                              )
                            (componentAdded [_componentUid])
@@ -273,10 +273,10 @@
                      :evolvers {:a a-evolver}})
         results (atom {})
         result-collector (proxy [IResultCollector] []
-                           (appendResult [_parentComponentUid, path, _componentUid, property, newValue]
-                             (swap! results (fn [r]
-                                              (if (not (or (= :children property) (= :evolvers property)))
-                                                (assoc r [path property] newValue)
+                           (appendResult [_parentComponentUid, path, node, newValue]
+                             (swap! results (fn [r]
+                                              (if (not (or (= :children (.getPropertyId node)) (= :evolvers (.getPropertyId node))))
+                                                (assoc r [path (.getPropertyId node)] newValue)
                                                 r)))
                              )
                            (componentAdded [_componentUid])
@@ -381,10 +381,10 @@
                                      :a 5}}})
         results (atom {})
         result-collector (proxy [IResultCollector] []
-                           (appendResult [_parentComponentUid, _path, _componentUid, property, newValue]
-                             (swap! results (fn [r]
-                                              (if (not (or (= :children property) (= :evolvers property)))
-                                                (assoc r property newValue)
+                           (appendResult [_parentComponentUid, _path, node, newValue]
+                             (swap! results (fn [r]
+                                              (if (not (or (= :children (.getPropertyId node)) (= :evolvers (.getPropertyId node))))
+                                                (assoc r (.getPropertyId node) newValue)
                                                 r)))
                              )
                            (componentAdded [_componentUid])
@@ -423,10 +423,10 @@
                                      :a 5}}})
         results (atom {})
         result-collector (proxy [IResultCollector] []
-                           (appendResult [_parentComponentUid, _path, _componentUid, property, newValue]
-                             (swap! results (fn [r]
-                                              (if (not (or (= :children property) (= :evolvers property)))
-                                                (assoc r property newValue)
+                           (appendResult [_parentComponentUid, _path, node, newValue]
+                             (swap! results (fn [r]
+                                              (if (not (or (= :children (.getPropertyId node)) (= :evolvers (.getPropertyId node))))
+                                                (assoc r (.getPropertyId node) newValue)
                                                 r)))
                              )
                            (componentAdded [_componentUid])
@@ -469,10 +469,10 @@
                                      :evolvers {:a a-evolver}}}})
         results (atom {})
         result-collector (proxy [IResultCollector] []
-                           (appendResult [_parentComponentUid, _path, _componentUid, property, newValue]
-                             (swap! results (fn [r]
-                                              (if (not (or (= :children property) (= :evolvers property)))
-                                                (assoc r property newValue)
+                           (appendResult [_parentComponentUid, _path, node, newValue]
+                             (swap! results (fn [r]
+                                              (if (not (or (= :children (.getPropertyId node)) (= :evolvers (.getPropertyId node))))
+                                                (assoc r (.getPropertyId node) newValue)
                                                 r)))
                              )
                            (componentAdded [_componentUid])


More tests for center

More tests for center

--- test/str/core_test.clj
+++ test/str/core_test.clj
@@ -210,7 +210,8 @@
     " foo " (str/center "foo" 5)
     "foo.!" (str/center "foo" 5 ".!")
     "foo." (str/center "foo" 4 ".!")
-    ".!foo." (str/center "foo" 6 ".!")))
+    ".!foo." (str/center "foo" 6 ".!")
+    ".!foo.!." (str/center "foo" 8 ".!")))

 (defspec center-results-in-strings-with-new-width 100
   (prop/for-all


Screen app example: Update to the new defscreen sections form

--- src/examples/workflo/macros/examples/screen_app.cljs
+++ src/examples/workflo/macros/examples/screen_app.cljs
@@ -152,28 +152,28 @@
 ;;;; Screens

 (defscreen UserSettingsScreen
- (url "users/:user-id/settings")
- (navigation
-  {:title "User Settings"})
- (layout
-  {:title 'UserSettingsTitle
-   :content 'UserSettings}))
+  (url "users/:user-id/settings")
+  (navigation
+    {:title "User Settings"})
+  (sections
+    {:title 'UserSettingsTitle
+     :content 'UserSettings}))

 (defscreen UserScreen
   (url "users/:user-id")
   (navigation
-   {:title "User"})
-  (layout
-   {:title 'UserTitle
-    :content 'UserProfile}))
+    {:title "User"})
+  (sections
+    {:title 'UserTitle
+     :content 'UserProfile}))

 (defscreen UserListScreen
   (url "users")
   (navigation
     {:title "Users"})
-  (layout
-   {:title 'UserListTitle
-    :content 'UserList}))
+  (sections
+    {:title 'UserListTitle
+     :content 'UserList}))

 ;;;; Commands

@@ -221,7 +221,10 @@
   (process
    (so/goto @application (:screen data) (:params data))))

-(c/configure-commands! {:process-emit service/deliver-to-services!})
+(c/register-command-hook! :process-emit
+                          (fn [{:keys [output]}]
+                            (when (and output (not (empty? output)))
+                              (service/deliver-to-services! output))))

 ;;;;;; Example app

@@ -239,14 +242,14 @@

 (defview App
   (render
-   (let [{:keys [navigation layout]} (om/props this)]
+   (let [{:keys [navigation sections]} (om/props this)]
      (dom/div nil
        (block {:title "Screen"}
          (:title navigation))
        (block {:title "Title"}
-         (:title layout))
+         (:title sections))
        (block {:title "Content"}
-         (:content layout))))))
+         (:content sections))))))

 ;;;; Bootstrapping


better to remove the perf concern entirely

--- src/main/shadow/cljs/devtools/server/worker/impl.clj
+++ src/main/shadow/cljs/devtools/server/worker/impl.clj
@@ -121,67 +121,80 @@

 (defn extract-reload-info
   "for every cljs build source collect all defs that are marked with special metadata"
-  [{::build/keys [config] :keys [compiler-env build-sources] :as build-state}]
-  (let [{:keys [after-load after-load-async before-load before-load-async] :as devtools-config}
+  [{:keys [build-sources] :as build-state}]
+  (-> {:never-load #{}
+       :after-load []
+       :before-load []}
+      (reduce->
+        (fn [info resource-id]
+          (let [hooks (get-in build-state [:output resource-id ::hooks])]
+            (if-not hooks
+              info
+              (merge-with into info hooks)
+              )))
+        build-sources
+        )))
+
+(defn add-entry [entries fn-sym & extra-attrs]
+  (conj entries
+    (-> {:fn-sym fn-sym
+         :fn-str (cljs-comp/munge (str fn-sym))}
+        (cond->
+          (seq extra-attrs)
+          (merge (apply array-map extra-attrs))))))
+
+(defn build-find-resource-hooks [{:keys [compiler-env] :as build-state} {:keys [resource-id ns] :as src}]
+  (let [{:keys [name meta defs] :as ns-info}
+        (get-in compiler-env [::cljs-ana/namespaces ns])
+
+        {:keys [after-load after-load-async before-load before-load-async] :as devtools-config}
         (get-in build-state [::build/config :devtools])

-        add-entry
-        (fn [entries fn-sym & extra-attrs]
-          (conj entries
-            (-> {:fn-sym fn-sym
-                 :fn-str (cljs-comp/munge (str fn-sym))}
-                (cond->
-                  (seq extra-attrs)
-                  (merge (apply array-map extra-attrs))))))]
-
-    (-> {:never-load #{}
-         :after-load []
-         :before-load []}
-        (reduce->
-          (fn [info {:keys [name meta defs] :as ns-info}]
-            (-> info
-                (cond->
-                  (or (:dev/never-load meta)
-                      (:dev/once meta) ;; can't decide on which meta to use
-                      (:figwheel-noload meta))
-                  (update :never-load conj name))
-
-                (reduce-kv->
-                  (fn [info def-sym {:keys [name meta] :as def-info}]
-                    (cond-> info
-                      (or (:dev/before-load meta)
-                          (= name before-load))
-                      (update :before-load add-entry name)
-
-                      (or (:dev/before-load-async meta)
-                          (= name before-load-async))
-                      (update :before-load add-entry name :async true)
-
-                      (or (:dev/after-load meta)
-                          (= name after-load))
-                      (update :after-load add-entry name)
-
-                      (or (:dev/after-load-async meta)
-                          (= name after-load-async))
-                      (update :after-load add-entry name :async true)
-                      ))
-                  defs)))
-          (->> build-sources
-               (map #(data/get-source-by-id build-state %))
-               (filter #(= :cljs (:type %)))
-               ;; should filter more resources that don't contain hooks
-               ;; processing might become slow when processing too many namespaces?
-               ;; Bruce Hauman added ^:figwheel-hooks on the ns to filter
-               ;; but I think that puts unnecessary burden on the user to "tag" twice
-               ;; should this ever become a bottleneck we can optimize this by only checking
-               ;; for hooks once after compile and cache it
-               ;; FIXME: maybe add cache
-               (remove (fn [{:keys [resource-name] :as rc}]
-                         (or (str/starts-with? resource-name "cljs/")
-                             (str/starts-with? resource-name "clojure/"))))
-               (map :ns)
-               (map #(get-in compiler-env [::cljs-ana/namespaces %]))))
-        )))
+        hooks
+        (-> {:never-load #{}
+             :after-load []
+             :before-load []}
+            (cond->
+              (or (:dev/never-load meta)
+                  (:dev/once meta) ;; can't decide on which meta to use
+                  (:figwheel-noload meta))
+              (update :never-load conj name))
+
+            (reduce-kv->
+              (fn [info def-sym {:keys [name meta] :as def-info}]
+                (cond-> info
+                  (or (:dev/before-load meta)
+                      (= name before-load))
+                  (update :before-load add-entry name)
+
+                  (or (:dev/before-load-async meta)
+                      (= name before-load-async))
+                  (update :before-load add-entry name :async true)
+
+                  (or (:dev/after-load meta)
+                      (= name after-load))
+                  (update :after-load add-entry name)
+
+                  (or (:dev/after-load-async meta)
+                      (= name after-load-async))
+                  (update :after-load add-entry name :async true)))
+              defs))]
+
+    (assoc-in build-state [:output resource-id ::hooks] hooks)))
+
+(defn build-find-hooks [{:keys [build-sources] :as state}]
+  (reduce
+    (fn [state resource-id]
+      (let [{:keys [type resource-name] :as src}
+            (data/get-source-by-id state resource-id)]
+        (if (or (not= :cljs type)
+                (get-in state [:output resource-id ::hooks])
+                (str/starts-with? resource-name "cljs/")
+                (str/starts-with? resource-name "clojure/"))
+          state
+          (build-find-resource-hooks state src))))
+    state
+    build-sources))

 (defn build-compile
   [{:keys [build-state] :as worker-state}]
@@ -197,6 +210,7 @@
                 (build-api/reset-always-compile-namespaces)
                 (build/compile)
                 (build/flush)
+                (build-find-hooks)
                 (update ::compile-attempt inc))]

         (>!!output worker-state


CMR-6965: CMR subscription ingest user-id check should include Authorization header as well.

--- ingest-app/src/cmr/ingest/api/core.clj
+++ ingest-app/src/cmr/ingest/api/core.clj
@@ -48,7 +48,7 @@
   "Create nested elements for the nested maps."
   [m]
   (reduce-kv (fn [memo k v]
-                 (conj memo (xml/element (keyword k) {} (if (map? v)
+                 (conj memo (xml/element (keyword k) {} (if (map? v)
                                                           (create-nested-elements v)
                                                           v))))
              []
@@ -185,7 +185,7 @@
   [context headers]
   (if-let [user-id (get headers transmit-config/user-id-header)]
     user-id
-    (when-let [token (get headers transmit-config/token-header)]
+    (when-let [token (:token context)]
       (cache/get-value (cache/context->cache context user-id-cache-key)
                        token
                        (partial tokens/get-user-id context token)))))


faster malli coercion

faster malli coercion

--- modules/reitit-malli/src/reitit/coercion/malli.cljc
+++ modules/reitit-malli/src/reitit/coercion/malli.cljc
@@ -13,7 +13,11 @@
 ;; coercion
 ;;

-(defrecord Coercer [decoder encoder validator explainer])
+(defprotocol Coercer
+  (-decode [this value])
+  (-encode [this value])
+  (-validate [this value])
+  (-explain [this value]))

 (defprotocol TransformationProvider
   (-transformer [this options]))
@@ -32,10 +36,16 @@

 (defn- -coercer [schema type transformers f encoder opts]
   (if schema
-    (let [->coercer (fn [t] (if t (->Coercer (m/decoder schema opts t)
-                                             (m/encoder schema opts t)
-                                             (m/validator schema opts)
-                                             (m/explainer schema opts))))
+    (let [->coercer (fn [t]
+                      (let [decoder (if t (m/decoder schema opts t) (constantly true))
+                            encoder (if t (m/encoder schema opts t) (constantly true))
+                            validator (m/validator schema opts)
+                            explainer (m/explainer schema opts)]
+                        (reify Coercer
+                          (-decode [_ value] (decoder value))
+                          (-encode [_ value] (encoder value))
+                          (-validate [_ value] (validator value))
+                          (-explain [_ value] (explainer value)))))
           {:keys [formats default]} (transformers type)
           default-coercer (->coercer default)
           encode (or encoder (fn [value _format] value))
@@ -44,29 +54,23 @@
                             default-coercer (constantly default-coercer))]
       (if get-coercer
         (if (= f :decode)
-          ;; decode -> validate
+          ;; decode: decode -> validate
           (fn [value format]
             (if-let [coercer (get-coercer format)]
-              (let [decoder (:decoder coercer)
-                    validator (:validator coercer)
-                    transformed (decoder value)]
-                (if (validator transformed)
+              (let [transformed (-decode coercer value)]
+                (if (-validate coercer transformed)
                   transformed
-                  (let [explainer (:explainer coercer)
-                        error (explainer transformed)]
+                  (let [error (-explain coercer transformed)]
                     (coercion/map->CoercionError
                       (assoc error :transformed transformed)))))
               value))
-          ;; decode -> validate -> encode
+          ;; encode: decode -> validate -> encode
           (fn [value format]
             (if-let [coercer (get-coercer format)]
-              (let [decoder (:decoder coercer)
-                    validator (:validator coercer)
-                    transformed (decoder value)]
-                (if (validator transformed)
+              (let [transformed (-decode coercer value)]
+                (if (-validate coercer transformed)
                   (encode transformed format)
-                  (let [explainer (:explainer coercer)
-                        error (explainer transformed)]
+                  (let [error (-explain coercer transformed)]
                     (coercion/map->CoercionError
                       (assoc error :transformed transformed)))))
               value)))))))


CMR-5071 Returns some comments to granule.clj.

--- umm-spec-lib/src/cmr/umm_spec/umm_g/granule.clj
+++ umm-spec-lib/src/cmr/umm_spec/umm_g/granule.clj
@@ -64,13 +64,13 @@
       :cloud-cover (:CloudCover umm-g-json)
       :two-d-coordinate-system (tiling-system/umm-g-tiling-identification-system->TwoDCoordinateSystem
                                 (:TilingIdentificationSystem umm-g-json))})))
+      ; :access-value (cx/double-at-path umm-g-json [:RestrictionFlag])
       ; :data-granule (xml-elem->DataGranule umm-g-json)
-      ; :access-value (cx/double-at-path umm-g-json [:RestrictionFlag])
+      ; :measured-parameters (mp/xml-elem->MeasuredParameters umm-g-json)
       ; :orbit-calculated-spatial-domains (ocsd/xml-elem->orbit-calculated-spatial-domains umm-g-json)
+      ; :product-specific-attributes (psa/xml-elem->ProductSpecificAttributeRefs umm-g-json)
       ; :related-urls (ru/xml-elem->related-urls umm-g-json)
       ; :spatial-coverage (xml-elem->SpatialCoverage umm-g-json)
-      ; :measured-parameters (mp/xml-elem->MeasuredParameters umm-g-json)
-      ; :product-specific-attributes (psa/xml-elem->ProductSpecificAttributeRefs umm-g-json)

 (defn Granule->umm-g
   "Returns UMM-G JSON from a umm-lib Granule"
@@ -106,5 +106,4 @@
      :Platforms (platform/PlatformRefs->umm-g-platforms platform-refs)
      :CloudCover cloud-cover
      :Projects (project/ProjectRefs->umm-g-projects project-refs)
-     :TilingIdentificationSystem (tiling-system/TwoDCoordinateSystem->umm-g-tiling-identification-system
-                                  two-d-coordinate-system)}))
+     :TilingIdentificationSystem (tiling-system/TwoDCoordinateSystem->umm-g-tiling-identification-system)}))


CMR-3184: Removed the internal error thrown unit testings when Unable to find saved concept happens.

--- metadata-db-app/test/cmr/metadata_db/test/services/concept_constraints.clj
+++ metadata-db-app/test/cmr/metadata_db/test/services/concept_constraints.clj
@@ -83,30 +83,13 @@
         (let [other-concept (make-concept concept-type "PROV1" "C2-PROV1" 1 extra-fields)]
           (not-valid
             (msg/duplicate-field-msg field [other-concept])
-            [other-concept])))
-      (testing "cannot find saved concept throws internal error"
-        (let [db (mem-db/create-db)
-              error-regex (java.util.regex.Pattern/compile
-                            (format "Unable to find saved concept for provider.*PROV1.*and %s .*unique-field1"
-                                    (name field)))]
-          (is (thrown-with-msg?
-                java.lang.Exception
-                error-regex
-                (constraint-fn db {:provider-id "PROV1"} test-concept))))))))
+            [other-concept]))))))

 (deftest unique-constraint-tests
   (unique-constraint-test :collection (cc/unique-field-constraint :entry-title) :entry-title)
   (unique-constraint-test :collection (cc/unique-field-constraint :entry-id) :entry-id)
   (unique-constraint-test :granule (cc/unique-field-constraint :granule-ur) :granule-ur)
-  (unique-constraint-test :granule cc/granule-ur-unique-constraint :granule-ur)
-
-  (testing "invalid field throws internal error"
-    (let [db (mem-db/create-db)
-          test-concept (make-concept :collection "PROV1" "C1-PROV1" 5 {:entry-title "ET1"})]
-      (is (thrown-with-msg?
-            java.lang.Exception
-            #"Unable to find saved concept for provider \[PROV1\] and invalid-field \[null\]"
-            ((cc/unique-field-constraint :invalid-field) db {:provider-id "PROV1"} test-concept))))))
+  (unique-constraint-test :granule cc/granule-ur-unique-constraint :granule-ur))

 (deftest granule-ur-unique-constraint-test
   (testing "native-id is checked for uniqueness when granule-ur is null"


[scamp] add a couple comments about WIP

[scamp] add a couple comments about WIP

--- modules/scamp/src/scamp/core.clj
+++ modules/scamp/src/scamp/core.clj
@@ -88,6 +88,7 @@
    (s/optional-key :removed?) s/Bool
    :send-next-heartbeats-milli-time (s/maybe s/Int)
    :heartbeat-timeout-milli-time (s/maybe s/Int)
+   ;; :clock-value (atom 7) ;; TODO: per-node reference clock
    })

 (def MessageTypesSchema
@@ -112,6 +113,8 @@

    ;; just for saying "Hi" and "please don't assume you've been partitioned from the rest of the cluster"
    :heartbeat
+
+   ;; more stuff that isn't here yet...
    ))

 (def MessageEnvelopeSchema


get the innertext for the comparison

get the innertext for the comparison

--- test-cljs/frontend/components/test_org_settings.cljs
+++ test-cljs/frontend/components/test_org_settings.cljs
@@ -6,12 +6,13 @@
             [frontend.utils.docs :as doc-utils]
             [frontend.utils.html :refer [hiccup->html-str]]
             [frontend.stefon :as stefon]
+            [goog.dom]
             [om.core :as om :include-macros true])
   (:require-macros [cemerick.cljs.test :refer (is deftest with-test run-tests testing test-var)]
                    [dommy.macros :refer (sel1)]))

 (deftest test-discount-rendering
-  (let [format (fn [plan] (hiccup->html-str (org-settings/format-discount plan)))
+  (let [format (fn [plan] (.-innerText (goog.dom/htmlToDocumentFragment (hiccup->html-str (org-settings/format-discount plan)))))
         fifty-percent {:discount { :coupon {
                                      :id                 "qJayHMis"
                                      :percent_off        1


Use letfn in real-ge-matrix.

Use letfn in real-ge-matrix.

--- src/clojure/uncomplicate/neanderthal/impl/buffer_block.clj
+++ src/clojure/uncomplicate/neanderthal/impl/buffer_block.clj
@@ -401,27 +401,27 @@
     (RealBlockVector. fact accessor (vector-engine fact) (.entryType accessor)
                       master buf n strd)))

-(let [column-index (fn ^long [^long ld ^long i ^long j]
-                     (+ (* ld j) i))
-      row-index (fn ^long [^long ld ^long i ^long j]
-                  (+ (* ld i) j))
-      init-all (fn [^DataAccessor accessor buf _ _ val]
-                 (.initialize accessor buf val))
-      init-slice (fn [accessor buf ld fd val]
-                   (dotimes [i fd]
-                     (.initialize ^DataAccessor accessor
-                                  (.slice ^BufferAccessor accessor
-                                          buf (* (long ld) i) fd) val)))
-      straight-cut (fn [fact ^ByteBuffer buf ld sd fd idx]
-                     (real-block-vector fact false
-                                        (.slice ^BufferAccessor (data-accessor fact)
-                                                buf (* (long ld) (long idx)) sd)
-                                        sd 1))
-
-      cross-cut (fn [fact ^ByteBuffer buf ld sd fd idx]
-                  (real-block-vector fact false
-                                     (.slice ^BufferAccessor (data-accessor fact)
-                                             buf idx (inc (* (dec (long fd)) (long ld)))) fd ld))]
+(letfn [(column-index ^long [^long ld ^long i ^long j]
+          (+ (* ld j) i))
+        (row-index  ^long [^long ld ^long i ^long j]
+          (+ (* ld i) j))
+        (init-all [^DataAccessor accessor buf _ _ val]
+          (.initialize accessor buf val))
+        (init-slice  [accessor buf ld fd val]
+          (dotimes [i fd]
+            (.initialize ^DataAccessor accessor
+                         (.slice ^BufferAccessor accessor
+                                 buf (* (long ld) i) fd) val)))
+        (straight-cut  [fact ^ByteBuffer buf ld sd fd idx]
+          (real-block-vector fact false
+                             (.slice ^BufferAccessor (data-accessor fact)
+                                     buf (* (long ld) (long idx)) sd)
+                             sd 1))
+
+        (cross-cut  [fact ^ByteBuffer buf ld sd fd idx]
+          (real-block-vector fact false
+                             (.slice ^BufferAccessor (data-accessor fact)
+                                     buf idx (inc (* (dec (long fd)) (long ld)))) fd ld))]

   (defn real-ge-matrix
     ([fact master buf m n ld ord tra]


Add function to delete R4F profiles

Add function to delete R4F profiles

--- dev/migrate.clj
+++ dev/migrate.clj
@@ -14,6 +14,7 @@
             [cheshire.core :as json]
             [kixi.hecuba.data.entities :as entities]
             [kixi.hecuba.data.projects :as projects]
+            [kixi.hecuba.data.profiles :as profiles-data]
             [kixi.hecuba.api.profiles :as profiles-api]
             [kixi.hecuba.api.profiles.schema :as profiles-schema]
             [clojure.java.io :as io]))
@@ -261,12 +262,37 @@
                                                                :entity-data  (dissoc entity-data :profiles)
                                                                :profiles     profiles))))))
                                            (partition 2 (line-seq rdr)))))]
-      (println "Number of entities to update: " (count entities-with-profiles))
+      (log/info "Number of entities to update: " (count entities-with-profiles))
       (doseq [entity entities-with-profiles] ;; 22 profiles
         (let [profiles-to-insert (map #(-> (hash-map :entity_id (:entity_id entity)
                                                      :profile_data (extract-profile-data %))
                                            (kixi.hecuba.storage.uuid/add-profile-id))
                                       (:profiles entity))]
           (doseq [profile profiles-to-insert]
-            (println "Attempting to store profile with id" (:profile_id profile))
+            (log/info "Attempting to store profile with id" (:profile_id profile))
             (profiles-api/store-profile profile "support@mastodonc.com" store)))))))
+
+
+;; R4F id: "c94a2f01d89708fb406fed83665ccb1c36e441a5"
+(defn delete-r4f-profiles [{:keys [store]}]
+  (db/with-session [session (:hecuba-session store)]
+    (let [project-ids        (into #{} (map :project_id (projects/get-all session "c94a2f01d89708fb406fed83665ccb1c36e441a5")))
+          all-entities       (entities/get-all session)
+          r4f-entities       (filter #(contains? project-ids (:project_id %)) all-entities)
+          entity-ids         (into #{} (map :entity_id r4f-entities))
+          profiles-to-delete (->> (mapcat #(profiles-data/get-profiles % session) entity-ids)
+                                  (map :profile_id))
+          _(log/info "Number of profiles to delete: " (count profiles-to-delete))
+          report             (reduce (fn [{:keys [deleted failed]} profile_id]
+                                       (if-let [error (seq (profiles-data/delete session profile_id))]
+                                         {:deleted deleted :failed (conj failed {:id profile_id :error error})}
+                                         {:deleted (conj deleted profile_id) :failed failed}))
+                                     {:deleted [] :failed []}
+                                     profiles-to-delete)]
+
+      (log/info "Report: " report)
+      ;; Refresh ES
+      (doseq [entity r4f-entities]
+        (-> entity
+            (search/searchable-entity session)
+            (search/->elasticsearch (:search-session store)))))))


Use flat env vars modal cancel button

Use flat env vars modal cancel button

--- src-cljs/frontend/components/project_settings.cljs
+++ src-cljs/frontend/components/project_settings.cljs
@@ -539,8 +539,8 @@
                                                                    :on-change #(utils/edit-input owner (conj state/inputs-path :new-env-var-value) %)}))])
                              :actions [(button/button {:on-click #(do (analytics-track/env-vars-modal-dismissed
                                                                         (merge track-properties {:component "cancel"}))
-                                                                      (close-fn))}
-                                         "Cancel")
+                                                                      (close-fn))
+                                                       :kind :flat} "Cancel")
                                        (button/managed-button {:failed-text "Failed"
                                                                :success-text "Added"
                                                                :loading-text "Adding..."


use clojure core cache

use clojure core cache

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

--- plugins/SlideExplorer2/src/slide_explorer/tile_cache.clj
+++ plugins/SlideExplorer2/src/slide_explorer/tile_cache.clj
@@ -1,5 +1,5 @@
 (ns slide-explorer.tile-cache
-  (:require [slide-explorer.cache :as cache]
+  (:require [clojure.core.cache :as cache]
             [slide-explorer.disk :as disk]
             [slide-explorer.persist :as persist]
             [slide-explorer.reactive :as reactive]))
@@ -15,7 +15,8 @@
 (defn add-tile
   "Adds a tile to the atom in memory and saves a .tif image to the associated directory."
   [memory-tile-atom key image-processor]
-  (swap! memory-tile-atom cache/add-item key image-processor)
+  (swap! memory-tile-atom assoc key image-processor)
+  ;(println (tile-dir memory-tile-atom) (count @memory-tile-atom))
   (when-let [dir (tile-dir memory-tile-atom)]
     (reactive/submit file-executor #(disk/write-tile dir key image-processor))))

@@ -29,18 +30,19 @@
                            (when-let [tile (disk/read-tile dir key)]
                              (swap! memory-tile-atom
                                     #(if-not (get % key)
-                                       (cache/add-item % key tile)
+                                       (assoc % key tile)
                                        %))
                              tile))))))

 (defn get-tile
   [memory-tile-atom key]
-  (swap! memory-tile-atom cache/hit-item key)
-  (get @memory-tile-atom key))
+  (when-let [val (get @memory-tile-atom key)]
+    (swap! memory-tile-atom cache/hit key)
+    val))

 (defn create-tile-cache
   ([lru-cache-limit directory]
-    (doto (atom (cache/empty-lru-map lru-cache-limit))
+    (doto (atom (cache/lru-cache-factory {} :threshold lru-cache-limit))
       (tile-dir! directory)))
   ([lru-cache-limit]
     (create-tile-cache lru-cache-limit nil)))


removing unused closp-crud from project.clj

--- resources/leiningen/new/closp/project.clj
+++ resources/leiningen/new/closp/project.clj
@@ -70,14 +70,6 @@

   :plugins [[lein-cljsbuild "1.1.1"]]

-  :closp-crud {:jdbc-url "jdbc:sqlite:./db/{{name}}.sqlcite"
-               :migrations-output-path "./resources/migrators/sqlite"
-               :clj-src "src/clj"
-               :ns-db "{{ns}}.db"
-               :ns-routes "{{ns}}.routes"
-               :ns-layout "{{ns}}.layout"
-               :templates "resources/templates"}
-
   :min-lein-version "2.5.0"

   ; leaving this commented because of: https://github.com/cursiveclojure/cursive/issues/369


Remove now-extraneous require block

Remove now-extraneous require block

--- src/puppetlabs/trapperkeeper/services/jetty/jetty_core.clj
+++ src/puppetlabs/trapperkeeper/services/jetty/jetty_core.clj
@@ -15,8 +15,7 @@
   (:require [ring.util.servlet :as servlet]
             [clojure.string :refer [split trim]]
             [clojure.tools.logging :as log]
-            [puppetlabs.trapperkeeper.services.jetty.jetty-config :as jetty-config]
-            [puppetlabs.kitchensink.core :refer [compare-jvm-versions]]))
+            [puppetlabs.trapperkeeper.services.jetty.jetty-config :as jetty-config]))

 ;; Work around an issue with OpenJDK's PKCS11 implementation preventing TLSv1
 ;; connections from working correctly


Update lein-swank version and deps.

Update lein-swank version and deps.

--- lein-swank/project.clj
+++ lein-swank/project.clj
@@ -1,4 +1,6 @@
-(defproject leiningen/lein-swank "1.1.0"
+(defproject leiningen/lein-swank "1.2.0-SNAPSHOT"
   :description "A leiningen plugin to launch a swank server."
-  :dependencies [[swank-clojure "1.1.0"]
+  :dependencies [[swank-clojure "1.2.0-break-SNAPSHOT"]
+                 [ant/ant "1.6.5"]
+                 [ant/ant-launcher "1.6.5"]
                  [org.apache.maven/maven-ant-tasks "2.0.10"]])


added more to server interactions page

added more to server interactions page

--- src/tutorial/untangled_tutorial/H_Server_Interactions.cljs
+++ src/tutorial/untangled_tutorial/H_Server_Interactions.cljs
@@ -99,33 +99,35 @@
   ## Differences from stock Om (next)

   For those that are used to Om, you may be interested in the differences and rationale behind the way Untangled
-  handles server interactions.
+  handles server interactions, particularly remote reads.

   In Om, you have a fully customizable experience for reads/writes; however, to get this power you must write
   a parser to process the queries and mutations, including analyzing application state to figure out when to talk
   to a remote. While this is fully general and quite flexible (Untangled is implemented on top of it, after all),
   there is a lot of head scratching to get the result you want.

-  Initial loads and user-driven loads are the most common task in interacting with a server. In both of these cases
-  you probably want:
-
-  - To know that it is happening in the UI
-      - To know/show (in the UI) when the load is in progress on the network
-      - To know/show (in the UI) when the load is complete
-      - The ability to show a loading marker in the UI globally
-      - The ability to show a loading marker in the UI at the *target* location for the incoming data
-  - To have clear reasoning about when you load something that doesn't involve thinking about a parser
-  - The ability to create derived data after the load
-
-  The UI portions are accomplished, of course, by putting something in the app state that the UI is querying for, and
-  rendering it. The reasoning portion requires that you keep track of what you have, and what you want to do. The
-  ability to create derived data and manage the 'state machine' of the process of loading (and failures)
-  is a bit more difficult.
-
-  By eliminating the need for an Om parser to process all of this, and centralizing the logic to a core set of functions
+  Our realization when building Untangled was that remote reads happen in two basic cases: initial load (based on
+  initial application state) and event-driven load (e.g. routing, \"load comments\", etc). Then we had a few more
+  facts that we threw into the mix:
+
+  - We very often wanted to morph the UI query in some way before sending it to the server (e.g. process-roots or
+  asking for a collection, but then wanting to query it in the UI \"grouped by category\").
+      - This need to modify the query (or write server code that could handle various different configurations of the UI)
+        led us to the realization that we really wanted a table in our app database on canonical data, and \"views\" of
+        that data (e.g. a sorted page of it, items grouped by category, etc.) While you can do this with the parser, it
+        is crazy complicated compared to the simple idea: Any time you load data into a given table, allow the user to
+        regenerate derived views in the app state, so that the UI queries just naturally work without parsing logic for
+        *each* re-render. The con, of course, is that you have to keep the derived \"views\" up to date, but this is
+        much easier to reason about (and codify into a central update function) in practice than a parser.
+  - We always needed a marker in the app state so that our remote parsing code could *decide* to return a remote query.
+      - The marker essentially needed to be a state machine kind of state marker (ready to load, loading in progress,
+        loading failed, data present). This was a complication that would be repeated over and over.
+  - We often wanted a *global* marker to indicate when network activity was going on
+
+  By eliminating the need for an Om parser to process all of this and centralizing the logic to a core set of functions
   that handle all of these concerns you gain a lot of simplicity.

-  The use-cases we're addressing are:
+  So, let's look how we handle the explicit use-cases:

   ### Use Case - Initial Load

@@ -140,6 +142,29 @@
   State markers are put in place that allow you to then render the fact that you are loading data. Any number of separate
   server queries can be queued, and the queries themselves are used for normalization. Post-processing of the response
   is well-defined and trivial to access.
+
+  ```
+  (uc/new-untangled-client
+    :initial-state {}
+    :started-callback
+      (fn [app]
+        (df/load-collection :query [{:items (om/get-query CollectionComponent)}]
+                                     :without #{:comments}
+                                     :post-mutation 'app/build-views)))
+  ```
+
+  In the above example the client is created (which must be mounted as a separate step). Once mounted the application
+  will call the `:started-callback` which in turn will trigger a load. This helper function is really a call to
+  om `transact!` that places `ready-to-load` markers in the app state, which in turn triggers the network plumbing. The
+  network plumbing pulls these and processes them via the server and all of the normalization bits of Om (and Untangled).
+
+  The `:without` parameter will elide portions of the query. So for example, if you'd like to lazy load some portion of the
+  collection (e.g. comments on each item) at a later time, you can prevent the server from being asked.
+
+  The `:post-mutation` parameter is the name of the mutation you'd like to run on a successful result of the query. If there
+  is a failure, then a failure marker will be placed in the app state, which you can have programmed your UI to react to
+  (e.g. showing a dialog that has user-driven recovery choices).
+

   ### Use Case - Lazy Loading


Update piggiebacking message and layout

Update piggiebacking message and layout

--- src-cljs/frontend/components/org_settings.cljs
+++ src-cljs/frontend/components/org_settings.cljs
@@ -207,29 +207,32 @@
   (let [containers (pm/paid-linux-containers plan)]
     (str
       (when (pos? containers)
-        (str containers " containers"))
+        (str containers " paid Linux containers"))
       (when (and (pos? containers) (pm/osx? plan))
-        " and ")
+        " and the macOS ")
       (when (pm/osx? plan)
-        (-> plan :osx :template :name)))))
+        (-> plan :osx :template :name)) " plan.")))

 (defn plans-piggieback-plan-notification [{{parent-name :name
                                             parent-vcs-type :vcs_type} :org
                                            :as plan}
                                           current-org-name]
-  [:div.row-fluid
-   [:div.offset1.span10
-    [:div.alert.alert-success
-     [:p
-      "This organization is covered under " [:em parent-name] "'s plan which has " (piggieback-plan-wording plan)]
-     [:p
-      "If you're an admin in the " parent-name
-      " organization, then you can change plan settings from the "
-      [:a {:href (routes/v1-org-settings-path {:org parent-name
-                                               :vcs_type parent-vcs-type})}
-       parent-name " plan page"] "."]
-     [:p
-      "You can create a separate plan for " [:em current-org-name] " when you're no longer covered by " [:em parent-name] "."]]]])
+
+
+  [:div
+   (card/titled {:title "This organization's plan is covered under another organization's plan"}
+              (html
+                [:div
+                 [:p
+                  "This organization is covered under the " [:strong [:em parent-name]] " organization's plan which has " [:strong (piggieback-plan-wording plan)]]
+                 [:p
+                  "If you're an admin in the " [:strong [:em parent-name]]
+                  " organization, then you can change plan settings from the "
+                  [:strong [:a {:href (routes/v1-org-settings-path {:org parent-name
+                                                           :vcs_type parent-vcs-type})}
+                   parent-name " plan page"]] "."]
+                 [:p.mb-0
+                  "You can create a separate plan for " [:strong [:em current-org-name]] " when you're no longer covered by " [:strong [:em parent-name]] "."]]))])

 (defn plural-multiples [num word]
   (if (> num 1)


CMR-1335: Removed TODO

CMR-1335: Removed TODO

--- search-app/src/cmr/search/data/query_to_elastic.clj
+++ search-app/src/cmr/search/data/query_to_elastic.clj
@@ -101,7 +101,6 @@
                         :functions (k2e/keywords->boosted-elastic-filters keywords boosts)
                         :query {:filtered {:query (q/match-all)
                                            :filter core-query}}}}
-      ;; TODO add validation here to make sure boosts are not specified
       (if boosts
         (errors/throw-service-errors :bad-request ["Boosting is only supported for keyword queries"])
         {:filtered {:query (q/match-all)


Add direct SQL test

Add direct SQL test

UI components can now call SQL directly

--- src/webapp/framework/client/components/main_view.cljs
+++ src/webapp/framework/client/components/main_view.cljs
@@ -5,7 +5,7 @@
     [webapp.framework.client.coreclient  :only [ns-coils defn-ui-component def-coils-app
                                                 container  map-many  inline  text log sql
                                                 div img pre component h2 input section
-                                                write-ui read-ui container input component <--
+                                                write-ui read-ui container input component <-- data-view-result-set
                                                 h1 h2 h3 h4 h5 h6 span  data-view-v2 select select-debug realtime realtime-debug
                                                 ]])
   (:require-macros
@@ -51,7 +51,10 @@

-
+(div {:style {:fontWeight "bold"}} (str "COUNT:"
+                                        "(select  id, item  from  coils_todo_items order by id {} )"
+                                        (realtime select  id, item  from  coils_todo_items order by id desc {} )
+                                        ))


CMR-7386: Removed unused variable.

CMR-7386: Removed unused variable.

--- system-int-test/src/cmr/system_int_test/data2/atom.clj
+++ system-int-test/src/cmr/system_int_test/data2/atom.clj
@@ -281,7 +281,7 @@
   (let [{{:keys [short-name version-id processing-level-id collection-data-type]} :product
          :keys [concept-id format-key has-variables has-formats has-transforms
                 has-spatial-subsetting has-temporal-subsetting
-                services variables tools platforms]} collection
+                services variables tools]} collection
         collection (data-core/mimic-ingest-retrieve-metadata-conversion collection)
         {:keys [summary entry-title related-urls associated-difs organizations]} collection
         ;; ECSE-158 - We will use UMM-C's DataDates to get insert-time, update-time for DIF9/DIF10.


CMR-2018: Fixed typo

CMR-2018: Fixed typo

--- system-int-test/src/cmr/system_int_test/data2/core.clj
+++ system-int-test/src/cmr/system_int_test/data2/core.clj
@@ -78,7 +78,7 @@
        response))))

 (defn ingest-concept-with-metadata
-  "Ingest the given concept iwth the given metadata."
+  "Ingest the given concept with the given metadata."
   [provider-id concept-type format-key metadata]
   (let [concept {:concept-type concept-type
                  :provider-id provider-id